OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # This file is meant to be included into a target to provide an action | 5 # This file is meant to be included into a target to provide an action |
6 # to generate Java source files from a C++ header file containing annotated | 6 # to generate Java source files from the Google API keys using a Python script. |
7 # enum definitions using a Python script. | |
8 # | 7 # |
9 # To use this, create a gyp target with the following form: | 8 # To use this, create a gyp target with the following form: |
10 # { | 9 # { |
11 # 'target_name': 'bitmap_format_java', | 10 # 'target_name': 'google_api_keys_java', |
12 # 'type': 'none', | 11 # 'type': 'none', |
13 # 'variables': { | 12 # 'includes': [ '../build/android/java_google_api_keys.gypi' ], |
14 # 'source_file': 'ui/android/bitmap_format.h', | |
15 # }, | |
16 # 'includes': [ '../build/android/java_cpp_enum.gypi' ], | |
17 # }, | 13 # }, |
18 # | 14 # |
19 # Then have the gyp target which compiles the java code depend on the newly | 15 # Then have the gyp target which compiles the java code depend on the newly |
20 # created target. | 16 # created target. |
21 | 17 |
22 { | 18 { |
23 'variables': { | 19 'variables': { |
24 # Location where all generated Java sources will be placed. | 20 # Location where all generated Java sources will be placed. |
25 'output_dir': '<(SHARED_INTERMEDIATE_DIR)/enums/<(_target_name)', | 21 'output_dir': '<(SHARED_INTERMEDIATE_DIR)/java_google_api_keys', |
26 'generator_path': '<(DEPTH)/build/android/gyp/java_cpp_enum.py', | 22 'generator_path': '<(DEPTH)/build/android/gyp/java_google_api_keys.py', |
27 'generator_args': '<(output_dir) <(source_file)', | 23 'generator_args': '<(output_dir)', |
28 }, | 24 }, |
29 'direct_dependent_settings': { | 25 'direct_dependent_settings': { |
30 'variables': { | 26 'variables': { |
31 # Ensure that the output directory is used in the class path | 27 # Ensure that the output directory is used in the class path |
32 # when building targets that depend on this one. | 28 # when building targets that depend on this one. |
33 'generated_src_dirs': [ | 29 'generated_src_dirs': [ |
34 '<(output_dir)/', | 30 '<(output_dir)/', |
35 ], | 31 ], |
36 # Ensure that the targets depending on this one are rebuilt if the sources | 32 # Ensure that the targets depending on this one are rebuilt if the sources |
37 # of this one are modified. | 33 # of this one are modified. |
38 'additional_input_paths': [ | 34 #'additional_input_paths': [ |
39 '<(source_file)', | 35 # '<(source_file)', |
agrieve
2015/10/30 00:55:13
meant to be commented out?
dvh
2015/10/30 20:56:20
I removed it.
| |
40 ], | 36 #], |
41 }, | 37 }, |
42 }, | 38 }, |
43 'actions': [ | 39 'actions': [ |
44 { | 40 { |
45 'action_name': 'generate_java_constants', | 41 'action_name': 'generate_java_google_api_keys', |
46 'inputs': [ | 42 'inputs': [ |
47 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 43 '<(DEPTH)/build/android/gyp/java_google_api_keys.py', |
48 '<(generator_path)', | 44 '<(generator_path)', |
49 '<(source_file)', | |
50 ], | 45 ], |
51 'outputs': [ | 46 'outputs': [ |
52 # This is the main reason this is an action and not a rule. Gyp doesn't | 47 '<(output_dir)/GoogleAPIKeys.java', |
53 # properly expand RULE_INPUT_PATH here and so it's impossible to | |
54 # calculate the list of outputs. | |
55 '<!@pymod_do_main(java_cpp_enum --print_output_only ' | |
56 '<@(generator_args))', | |
57 ], | 48 ], |
58 'action': [ | 49 'action': [ |
59 'python', '<(generator_path)', '<@(generator_args)' | 50 'python', '<(generator_path)', '<@(generator_args)' |
60 ], | 51 ], |
61 'message': 'Generating Java from cpp header <(source_file)', | 52 'message': 'Generating Java from Google API Keys header', |
62 }, | 53 }, |
63 ], | 54 ], |
64 } | 55 } |
OLD | NEW |