# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//flutter/build/concurrent_jobs.gni")
import("//flutter/common/config.gni")
import("//third_party/dart/build/dart/copy_tree.gni")

declare_args() {
  # Maximum number of Dart processes to run in parallel.
  #
  # To avoid out-of-memory errors we explicitly reduce the number of jobs.
  concurrent_dart_jobs = concurrent_jobs.dart
}

pool("dart_pool") {
  depth = concurrent_dart_jobs
}

if (build_engine_artifacts) {
  if (flutter_prebuilt_dart_sdk) {
    copy_trees("_copy_trees") {
      sources = [
        {
          target = "copy_dart_sdk"
          visibility = [ ":dart_sdk" ]
          source = prebuilt_dart_sdk
          dest = "$root_out_dir/dart-sdk"
          ignore_patterns = "{}"
        },
      ]
    }
    group("dart_sdk") {
      public_deps = [ ":copy_dart_sdk" ]
    }
  } else {
    group("dart_sdk") {
      public_deps = [ "//third_party/dart:create_sdk" ]
    }
  }
}
