OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 a rule | 5 # This file is meant to be included into a target to provide a rule |
6 # to build Java aidl files in a consistent manner. | 6 # to build Java aidl files in a consistent manner. |
7 # | 7 # |
8 # To use this, create a gyp target with the following form: | 8 # To use this, create a gyp target with the following form: |
9 # { | 9 # { |
10 # 'target_name': 'aidl_aidl-file-name', | 10 # 'target_name': 'aidl_aidl-file-name', |
11 # 'type': 'none', | 11 # 'type': 'none', |
12 # 'variables': { | 12 # 'variables': { |
13 # 'package_name': <name-of-package> | |
14 # 'aidl_interface_file': '<interface-path>/<interface-file>.aidl', | 13 # 'aidl_interface_file': '<interface-path>/<interface-file>.aidl', |
15 # 'aidl_import_include': '<(DEPTH)/<path-to-src-dir>', | 14 # 'aidl_import_include': '<(DEPTH)/<path-to-src-dir>', |
16 # }, | 15 # }, |
17 # 'sources': { | 16 # 'sources': { |
18 # '<input-path1>/<input-file1>.aidl', | 17 # '<input-path1>/<input-file1>.aidl', |
19 # '<input-path2>/<input-file2>.aidl', | 18 # '<input-path2>/<input-file2>.aidl', |
20 # ... | 19 # ... |
21 # }, | 20 # }, |
22 # 'includes': ['<path-to-this-file>/java_aidl.gypi'], | 21 # 'includes': ['<path-to-this-file>/java_aidl.gypi'], |
23 # } | 22 # } |
24 # | 23 # |
25 # | 24 # |
26 # The generated java files will be: | 25 # The generated java files will be: |
27 # <(PRODUCT_DIR)/lib.java/<input-file1>.java | 26 # <(PRODUCT_DIR)/lib.java/<input-file1>.java |
28 # <(PRODUCT_DIR)/lib.java/<input-file2>.java | 27 # <(PRODUCT_DIR)/lib.java/<input-file2>.java |
29 # ... | 28 # ... |
30 # | 29 # |
31 # Optional variables: | 30 # Optional variables: |
32 # aidl_import_include - This should be an absolute path to your java src folder | 31 # aidl_import_include - This should be an absolute path to your java src folder |
33 # that contains the classes that are imported by your aidl files. | 32 # that contains the classes that are imported by your aidl files. |
34 # | 33 # |
35 # TODO(cjhopman): dependents need to rebuild when this target's inputs have chan
ged. | 34 # TODO(cjhopman): dependents need to rebuild when this target's inputs have chan
ged. |
36 | 35 |
37 { | 36 { |
38 'direct_dependent_settings': { | |
39 'variables': { | |
40 'generated_src_dirs': ['<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/']
, | |
41 }, | |
42 }, | |
43 'variables': { | 37 'variables': { |
| 38 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/aidl', |
44 'aidl_import_include%': '', | 39 'aidl_import_include%': '', |
45 'additional_aidl_arguments': [], | 40 'additional_aidl_arguments': [], |
46 'additional_aidl_input_paths': [], | 41 'additional_aidl_input_paths': [], |
47 }, | 42 }, |
| 43 'direct_dependent_settings': { |
| 44 'variables': { |
| 45 'generated_src_dirs': ['<(intermediate_dir)/'], |
| 46 }, |
| 47 }, |
48 'conditions': [ | 48 'conditions': [ |
49 ['"<(aidl_import_include)"!=""', { | 49 ['"<(aidl_import_include)"!=""', { |
50 'variables': { | 50 'variables': { |
51 'additional_aidl_arguments': [ '-I<(aidl_import_include)' ], | 51 'additional_aidl_arguments': [ '-I<(aidl_import_include)' ], |
52 'additional_aidl_input_paths': [ '<!@(find <(aidl_import_include) -name
"*.java")', ] | 52 'additional_aidl_input_paths': [ '<!@(find <(aidl_import_include) -name
"*.java")', ] |
53 } | 53 } |
54 }], | 54 }], |
55 ], | 55 ], |
56 'rules': [ | 56 'rules': [ |
57 { | 57 { |
58 'rule_name': 'compile_aidl', | 58 'rule_name': 'compile_aidl', |
59 'extension': 'aidl', | 59 'extension': 'aidl', |
60 'inputs': [ | 60 'inputs': [ |
61 '<(android_sdk)/framework.aidl', | 61 '<(android_sdk)/framework.aidl', |
62 '<(aidl_interface_file)', | 62 '<(aidl_interface_file)', |
63 '<@(additional_aidl_input_paths)', | 63 '<@(additional_aidl_input_paths)', |
64 ], | 64 ], |
65 'outputs': [ | 65 'outputs': [ |
66 '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/<(RULE_INPUT_ROOT).java
', | 66 '<(intermediate_dir)/<(RULE_INPUT_ROOT).java', |
67 ], | 67 ], |
68 'action': [ | 68 'action': [ |
69 '<(android_sdk_tools)/aidl', | 69 '<(android_sdk_tools)/aidl', |
70 '-p<(android_sdk)/framework.aidl', | 70 '-p<(android_sdk)/framework.aidl', |
71 '-p<(aidl_interface_file)', | 71 '-p<(aidl_interface_file)', |
72 '<@(additional_aidl_arguments)', | 72 '<@(additional_aidl_arguments)', |
73 '<(RULE_INPUT_PATH)', | 73 '<(RULE_INPUT_PATH)', |
74 '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/<(RULE_INPUT_ROOT).java
', | 74 '<(intermediate_dir)/<(RULE_INPUT_ROOT).java', |
75 ], | 75 ], |
76 }, | 76 }, |
77 ], | 77 ], |
78 } | 78 } |
OLD | NEW |