Skip to content

Commit

Permalink
Version 3.4.0-220.0.dev
Browse files Browse the repository at this point in the history
Merge 0310183 into dev
  • Loading branch information
Dart CI committed Mar 9, 2024
2 parents 02e7899 + 0310183 commit c3bd630
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 186 deletions.
54 changes: 18 additions & 36 deletions build/dart/copy_tree.gni
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@ _dart_root = rebase_path("../..")
# copy_tree() copies a directory tree rooted at `source` to `dest`, which should
# be somewhere under $root_out_dir.
#
# When dest is a subdirectory of the dest of a different copy_tree() target,
# the target whose dest is the subdirectory should include the target whose
# dest is the parent directory in its "deps" list. This prevents races on
# directory creation that could happen if the two targets were executed
# concurrently.
#
# Optional parameters:
# exclude - A comma separated list that is passed to shutil.ignore_patterns()
# in tools/copy_tree.py.
template("_copy_tree") {
template("copy_tree") {
assert(defined(invoker.source), "copy_tree must define 'source'")
assert(defined(invoker.dest), "copy_tree must define 'dest'")
assert(defined(invoker.inputs), "copy_tree must define 'inputs'")
source = invoker.source
dest = invoker.dest
inputs = invoker.inputs
action(target_name) {
if (defined(invoker.visibility)) {
visibility = invoker.visibility
Expand All @@ -27,11 +31,18 @@ template("_copy_tree") {
deps += invoker.deps
}

depfile = "$target_gen_dir/$target_name.d"
stampfile = "$target_gen_dir/$target_name.stamp"

common_args = [
"--from",
rebase_path(source),
"--to",
rebase_path(dest),
"--depfile",
rebase_path(depfile),
"--stamp",
rebase_path(stampfile),
]
if (defined(invoker.exclude)) {
common_args += [
Expand All @@ -40,33 +51,14 @@ template("_copy_tree") {
]
}

relative_files = rebase_path(inputs, rebase_path(source))

output_files = []
foreach(input, relative_files) {
output_files += [ "$dest/$input" ]
}

outputs = output_files
outputs = [ stampfile ]
script = "$_dart_root/tools/copy_tree.py"
args = common_args
}
}

# copy_trees() arranges to invoke copy_tree.py only once to gather the list of
# input source files for every _copy_tree() target. It takes a list of scopes as
# a parameter. The scopes should contain the following mappings.
#
# target: The target name for the _copy_tree() target.
# visibility: The visibility for the _copy_tree() target.
# source: The source directory relative to this directory.
# dest: The destination directory for the _copy_tree() target.
# deps: Any deps needed for the _copy_tree() target.
# ignore_patterns: Patterns to ignore when walking the directory tree.
# This should be '{}' if nothing should be ignored.
#
# copy_trees() will then make sure each invocation of _copy_tree() has the
# correct 'inputs' parameter
# DEPRECATED: This can be removed after the uses in the flutter/engine tree
# are migrated to use copy_tree().
template("copy_trees") {
assert(defined(invoker.sources), "$target_name must define 'source'")
sources = invoker.sources
Expand All @@ -78,28 +70,18 @@ template("copy_trees") {
]
}

# Evaluate script output as GN, producing a scope containing a single value
# "sources"
copy_tree_inputs_scope = exec_script("$_dart_root/tools/copy_tree.py",
[ "--gn" ] + copy_tree_source_paths,
"scope")

# A list of lists of input source files for copy_tree.
copy_tree_inputs = copy_tree_inputs_scope.sources
copy_tree_inputs_index = 0
foreach(copy_tree_spec, sources) {
_copy_tree(copy_tree_spec.target) {
copy_tree(copy_tree_spec.target) {
visibility = copy_tree_spec.visibility
source = copy_tree_spec.source
dest = copy_tree_spec.dest
inputs = copy_tree_inputs[copy_tree_inputs_index]
if (defined(copy_tree_spec.deps)) {
deps = copy_tree_spec.deps
}
if (copy_tree_spec.ignore_patterns != "{}") {
exclude = copy_tree_spec.ignore_patterns
}
}
copy_tree_inputs_index = copy_tree_inputs_index + 1
}
}
54 changes: 28 additions & 26 deletions runtime/observatory/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -74,44 +74,46 @@ if (!is_debug) {
observatory_ignore_patterns += [ "*.map" ]
}

# The ignore_patterns entry in the scopes accepted by copy_trees() is a
# The ignore_patterns entry in the scopes accepted by copy_tree() is a
# string of comma delimited patterns.
observatory_ignore_string = "\$sdk"
foreach(pattern, observatory_ignore_patterns) {
observatory_ignore_string = "$observatory_ignore_string,$pattern"
}

copy_tree_specs = []

copy_tree_specs += [
{
target = "copy_web_package"
visibility = [ ":deploy_observatory" ]
source = "web"
dest = "$target_out_dir/observatory/deployed/web"
ignore_patterns = observatory_ignore_string
},
]
copy_tree("copy_web_package") {
visibility = [
":copy_observatory_package",
":deploy_observatory",
]
source = "web"
dest = "$target_out_dir/observatory/deployed/web"
exclude = observatory_ignore_string
}

copy_tree_specs += [
{
target = "copy_observatory_package"
visibility = [ ":deploy_observatory" ]
source = "lib"
dest = "$target_out_dir/observatory/deployed/web/packages/observatory"
ignore_patterns = observatory_ignore_string
},
]
copy_tree("copy_observatory_package") {
visibility = [
":copy_main_dart_js",
":deploy_observatory",
]
source = "lib"
dest = "$target_out_dir/observatory/deployed/web/packages/observatory"
exclude = observatory_ignore_string

# This is not a rule, rather, it generates rules with names of the form:
# "copy_$package_package" for the packages in observatory_pub_packages.
copy_trees("copy_observatory_packages") {
sources = copy_tree_specs
# This deps prevents this copy and copy_web_package from racing on the
# creation of the "web" directory.
deps = [ ":copy_web_package" ]
}

copy("copy_main_dart_js") {
visibility = [ ":deploy_observatory" ]
deps = [ ":build_observatory" ]
deps = [
":build_observatory",

# This deps prevents this copy from racing with the above copy actions on
# the creation of the "web" directory.
":copy_observatory_package",
]
sources = [ "$target_gen_dir/observatory/web/main.dart.js" ]
if (is_debug) {
sources += [ "$target_gen_dir/observatory/web/main.dart.js.map" ]
Expand Down
76 changes: 27 additions & 49 deletions sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -212,66 +212,44 @@ _full_sdk_libraries = [
# ]
_platform_sdk_libraries = _full_sdk_libraries

# From here down to the copy_trees() invocation, we collect all the information
# about trees that need to be copied in the list of scopes, copy_tree_specs.
copy_tree_specs = []

# This rule copies dartdoc templates to
# bin/resources/dartdoc/templates
copy_tree_specs += [
{
target = "copy_dartdoc_templates"
visibility = [ ":copy_dartdoc_files" ]
source = "../third_party/pkg/dartdoc/lib/templates"
dest = "$root_out_dir/$dart_sdk_output/bin/resources/dartdoc/templates"
ignore_patterns = "{}"
},
]
copy_tree("copy_dartdoc_templates") {
visibility = [ ":copy_dartdoc_files" ]
source = "../third_party/pkg/dartdoc/lib/templates"
dest = "$root_out_dir/$dart_sdk_output/bin/resources/dartdoc/templates"
exclude = "{}"
}

# This rule copies dartdoc resources to
# bin/resources/dartdoc/resources
copy_tree_specs += [
{
target = "copy_dartdoc_resources"
visibility = [ ":copy_dartdoc_files" ]
source = "../third_party/pkg/dartdoc/lib/resources"
dest = "$root_out_dir/$dart_sdk_output/bin/resources/dartdoc/resources"
ignore_patterns = "{}"
},
]
copy_tree("copy_dartdoc_resources") {
visibility = [ ":copy_dartdoc_files" ]
source = "../third_party/pkg/dartdoc/lib/resources"
dest = "$root_out_dir/$dart_sdk_output/bin/resources/dartdoc/resources"
exclude = "{}"
}

# This rule copies the pre-built DevTools application to
# bin/resources/devtools/
copy_tree_specs += [
{
target = "copy_prebuilt_devtools"
visibility = [ ":create_common_sdk" ]
source = "../third_party/devtools/web"
dest = "$root_out_dir/$dart_sdk_output/bin/resources/devtools"
ignore_patterns = "{}"
},
]
copy_tree("copy_prebuilt_devtools") {
visibility = [ ":create_common_sdk" ]
source = "../third_party/devtools/web"
dest = "$root_out_dir/$dart_sdk_output/bin/resources/devtools"
exclude = "{}"
}

# This loop generates rules to copy libraries to lib/
foreach(library, _full_sdk_libraries) {
copy_tree_specs += [
{
target = "copy_${library}_library"
visibility = [
":copy_full_sdk_libraries",
":copy_platform_sdk_libraries",
]
source = "lib/$library"
dest = "$root_out_dir/$dart_sdk_output/lib/$library"
ignore_patterns = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
},
]
}

# This generates targets for everything in copy_tree_specs. The targets have the
# same name as the "target" fields in the scopes of copy_tree_specs.
copy_trees("copy_trees") {
sources = copy_tree_specs
copy_tree("copy_${library}_library") {
visibility = [
":copy_full_sdk_libraries",
":copy_platform_sdk_libraries",
]
source = "lib/$library"
dest = "$root_out_dir/$dart_sdk_output/lib/$library"
exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
}
}

_has_dot_sym = !is_win && rebase_path(".") == rebase_path("//sdk")
Expand Down
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 3
MINOR 4
PATCH 0
PRERELEASE 219
PRERELEASE 220
PRERELEASE_PATCH 0
Loading

0 comments on commit c3bd630

Please sign in to comment.