summaryrefslogtreecommitdiffstats
path: root/build/android/copy_ex.gypi
blob: 8c49d247c3447bd33893ee8400abcfc4ebf4e3be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Copy files to a directory with the option to clear directory first.
#
# Variables:
#   dest_path - directory to copy files to.
#   src_files - optional, a list of files to copy without changing name.
#   clear - optional, if set, clear directory before copying files.
#   renaming_sources - optional, a list of files to copy and rename.
#   renaming_destinations - optional, a list of new file names corresponding to
#                           renaming_sources.
#
# Exmaple
#  {
#    'target_name': 'copy_assets',
#    'type': 'none',
#    'variables': {
#      'dest_path': 'apk/assets/path',
#      'src_files': ['path1/fr.pak'],
#      'clear': 1,
#      # path2/old1 and path3/old2 will be copied to apk/assets/path and
#      # renamed to new1, new2 respectly.
#      'renaming_sources': ['path2/old1', 'path3/old2'],
#      'renaming_destinations': ['new1', 'new2'],
#    },
#    'includes': [ '../build/android/copy_ex.gypi' ],
#  },
#
{
  'variables': {
    'clear%': 0,
    'src_files%': [],
    'renaming_sources%': [],
    'renaming_destinations%': [],
  },
  'actions': [{
    'action_name': '<(_target_name)_copy_ex',
    'variables': {
      'additional_args':[],
      'local_inputs': [],
      'dest_files': [],
      'conditions': [
        ['clear == 1', {
          'additional_args': ['--clear'],
        }],
        ['src_files != []', {
          'additional_args': ['--files', '<(src_files)'],
          'local_inputs': ['<@(src_files)'],
          # src_files will be used to generate destination files path for
          # outputs.
          'dest_files': ['<@(src_files)'],
        }],
        ['renaming_sources != []', {
          'additional_args': [
            '--renaming-sources', '<(renaming_sources)',
            '--renaming-destinations', '<(renaming_destinations)'
          ],
          'local_inputs': ['<@(renaming_sources)'],
          'dest_files': ['<@(renaming_destinations)'],
        }],
      ],
    },
    'inputs': [
      '<(DEPTH)/build/android/gyp/copy_ex.py',
      '<(DEPTH)/build/android/gyp/generate_copy_ex_outputs.py',
      '<@(local_inputs)',
    ],
    'outputs': [
      '<!@pymod_do_main(generate_copy_ex_outputs --dest-path <(dest_path) --src-files <(dest_files))',
    ],
    'action': [
      'python', '<(DEPTH)/build/android/gyp/copy_ex.py',
      '--dest', '<(dest_path)',
      '<@(additional_args)',
    ],
  }],
}