OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a |
| 3 # BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 _dart_root = rebase_path("..") |
| 6 |
| 7 # copy_tree() copies a directory tree rooted at `source` to `dest`, which should |
| 8 # be somewhere under $root_out_dir. |
| 9 # |
| 10 # Optional parameters: |
| 11 # exclude - A comma separated list that is passed to shutil.ignore_patterns() |
| 12 # in tools/copy_tree.py. |
| 13 template("copy_tree") { |
| 14 assert(defined(invoker.source), "copy_tree must define 'source'") |
| 15 assert(defined(invoker.dest), "copy_tree must define 'dest'") |
| 16 source = invoker.source |
| 17 dest = invoker.dest |
| 18 action(target_name) { |
| 19 if (defined(invoker.visibility)) { |
| 20 visibility = invoker.visibility |
| 21 } |
| 22 |
| 23 deps = [] |
| 24 if (defined(invoker.deps)) { |
| 25 deps += invoker.deps |
| 26 } |
| 27 |
| 28 common_args = [ |
| 29 "--from", |
| 30 rebase_path(source), |
| 31 "--to", |
| 32 rebase_path(dest), |
| 33 ] |
| 34 if (defined(invoker.exclude)) { |
| 35 common_args += [ |
| 36 "--exclude", |
| 37 invoker.exclude, |
| 38 ] |
| 39 } |
| 40 |
| 41 dry_run_args = common_args + [ "--dry-run" ] |
| 42 input_files = exec_script("$_dart_root/tools/copy_tree.py", |
| 43 dry_run_args, |
| 44 "list lines") |
| 45 inputs = input_files |
| 46 relative_files = rebase_path(input_files, rebase_path(source)) |
| 47 |
| 48 output_files = [] |
| 49 foreach(input, relative_files) { |
| 50 output_files += [ "$dest/$input" ] |
| 51 } |
| 52 |
| 53 outputs = output_files |
| 54 script = "$_dart_root/tools/copy_tree.py" |
| 55 args = common_args |
| 56 } |
| 57 } |
OLD | NEW |