blob: 8c49d247c3447bd33893ee8400abcfc4ebf4e3be [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001# Copyright 2015 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# Copy files to a directory with the option to clear directory first.
6#
7# Variables:
8# dest_path - directory to copy files to.
9# src_files - optional, a list of files to copy without changing name.
10# clear - optional, if set, clear directory before copying files.
11# renaming_sources - optional, a list of files to copy and rename.
12# renaming_destinations - optional, a list of new file names corresponding to
13# renaming_sources.
14#
15# Exmaple
16# {
17# 'target_name': 'copy_assets',
18# 'type': 'none',
19# 'variables': {
20# 'dest_path': 'apk/assets/path',
21# 'src_files': ['path1/fr.pak'],
22# 'clear': 1,
23# # path2/old1 and path3/old2 will be copied to apk/assets/path and
24# # renamed to new1, new2 respectly.
25# 'renaming_sources': ['path2/old1', 'path3/old2'],
26# 'renaming_destinations': ['new1', 'new2'],
27# },
28# 'includes': [ '../build/android/copy_ex.gypi' ],
29# },
30#
31{
32 'variables': {
33 'clear%': 0,
34 'src_files%': [],
35 'renaming_sources%': [],
36 'renaming_destinations%': [],
37 },
38 'actions': [{
39 'action_name': '<(_target_name)_copy_ex',
40 'variables': {
41 'additional_args':[],
42 'local_inputs': [],
43 'dest_files': [],
44 'conditions': [
45 ['clear == 1', {
46 'additional_args': ['--clear'],
47 }],
48 ['src_files != []', {
49 'additional_args': ['--files', '<(src_files)'],
50 'local_inputs': ['<@(src_files)'],
51 # src_files will be used to generate destination files path for
52 # outputs.
53 'dest_files': ['<@(src_files)'],
54 }],
55 ['renaming_sources != []', {
56 'additional_args': [
57 '--renaming-sources', '<(renaming_sources)',
58 '--renaming-destinations', '<(renaming_destinations)'
59 ],
60 'local_inputs': ['<@(renaming_sources)'],
61 'dest_files': ['<@(renaming_destinations)'],
62 }],
63 ],
64 },
65 'inputs': [
66 '<(DEPTH)/build/android/gyp/copy_ex.py',
67 '<(DEPTH)/build/android/gyp/generate_copy_ex_outputs.py',
68 '<@(local_inputs)',
69 ],
70 'outputs': [
71 '<!@pymod_do_main(generate_copy_ex_outputs --dest-path <(dest_path) --src-files <(dest_files))',
72 ],
73 'action': [
74 'python', '<(DEPTH)/build/android/gyp/copy_ex.py',
75 '--dest', '<(dest_path)',
76 '<@(additional_args)',
77 ],
78 }],
79}