1# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# Include this file in a target to copy all necessary files to satisfy
6# the transitive dependencies of a set of top-level JavaScript files
7# using closure-style dependency declarations.  The following variables
8# must be available when this file is included:
9# js_root_flags: List of '-r' flags to jsbundler.py for locating the
10#   .js files.
11# path_rewrite_flags: '-w' flags to jsbundler.py to replace source path
12#   prefixes at the destination.
13# dest_dir: Destination directory for all copied files.
14
15{
16  'actions': [
17    {
18      'action_name': 'copy_js',
19      'message': 'Copy JS for <(_target_name)',
20      'variables': {
21        'js_bundler_path': 'tools/jsbundler.py',
22        'js_files': [
23          '<!@(python <(js_bundler_path) <(js_root_flags) <(_sources))'
24        ],
25      },
26      'inputs': [
27        '<(js_bundler_path)',
28        '<@(js_files)',
29      ],
30      'outputs': [
31        '<!@(python <(js_bundler_path) <@(path_rewrite_flags) -d <(dest_dir) <@(js_files))'
32      ],
33      'action': [
34        'python',
35        '<(js_bundler_path)',
36        '-m', 'copy',
37        '-d', '<(dest_dir)',
38        '<@(path_rewrite_flags)',
39        '<@(js_files)',
40      ],
41    },
42  ]
43}
44