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> | 13 # 'package_name': <name-of-package> |
14 # 'aidl_interface_file': '<interface-path>/<interface-file>.aidl', | 14 # 'aidl_interface_file': '<interface-path>/<interface-file>.aidl', |
| 15 # 'aidl_import_include': '<(DEPTH)/<path-to-src-dir>', |
15 # }, | 16 # }, |
16 # 'sources': { | 17 # 'sources': { |
17 # '<input-path1>/<input-file1>.aidl', | 18 # '<input-path1>/<input-file1>.aidl', |
18 # '<input-path2>/<input-file2>.aidl', | 19 # '<input-path2>/<input-file2>.aidl', |
19 # ... | 20 # ... |
20 # }, | 21 # }, |
21 # 'includes': ['<path-to-this-file>/java_aidl.gypi'], | 22 # 'includes': ['<path-to-this-file>/java_aidl.gypi'], |
22 # } | 23 # } |
23 # | 24 # |
24 # | 25 # |
25 # The generated java files will be: | 26 # The generated java files will be: |
26 # <(PRODUCT_DIR)/lib.java/<input-file1>.java | 27 # <(PRODUCT_DIR)/lib.java/<input-file1>.java |
27 # <(PRODUCT_DIR)/lib.java/<input-file2>.java | 28 # <(PRODUCT_DIR)/lib.java/<input-file2>.java |
28 # ... | 29 # ... |
29 # | 30 # |
| 31 # Optional variables: |
| 32 # 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. |
| 34 # |
30 # TODO(cjhopman): dependents need to rebuild when this target's inputs have chan
ged. | 35 # TODO(cjhopman): dependents need to rebuild when this target's inputs have chan
ged. |
31 | 36 |
32 { | 37 { |
33 'direct_dependent_settings': { | 38 'direct_dependent_settings': { |
34 'variables': { | 39 'variables': { |
35 'generated_src_dirs': ['<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/']
, | 40 'generated_src_dirs': ['<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/']
, |
36 }, | 41 }, |
37 }, | 42 }, |
| 43 'variables': { |
| 44 'aidl_import_include%': '', |
| 45 'additional_aidl_arguments': [], |
| 46 }, |
| 47 'conditions': [ |
| 48 ['"<(aidl_import_include)"!=""', { |
| 49 'variables': { |
| 50 'additional_aidl_arguments': [ '-I<(aidl_import_include)' ] |
| 51 } |
| 52 }], |
| 53 ], |
38 'rules': [ | 54 'rules': [ |
39 { | 55 { |
40 'rule_name': 'compile_aidl', | 56 'rule_name': 'compile_aidl', |
41 'extension': 'aidl', | 57 'extension': 'aidl', |
42 'inputs': [ | 58 'inputs': [ |
43 '<(android_sdk)/framework.aidl', | 59 '<(android_sdk)/framework.aidl', |
44 '<(aidl_interface_file)', | 60 '<(aidl_interface_file)', |
45 ], | 61 ], |
46 'outputs': [ | 62 'outputs': [ |
47 '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/<(RULE_INPUT_ROOT).java
', | 63 '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/<(RULE_INPUT_ROOT).java
', |
48 ], | 64 ], |
49 'action': [ | 65 'action': [ |
50 '<(android_sdk_tools)/aidl', | 66 '<(android_sdk_tools)/aidl', |
51 '-p<(android_sdk)/framework.aidl', | 67 '-p<(android_sdk)/framework.aidl', |
52 '-p<(aidl_interface_file)', | 68 '-p<(aidl_interface_file)', |
| 69 '<@(additional_aidl_arguments)', |
53 '<(RULE_INPUT_PATH)', | 70 '<(RULE_INPUT_PATH)', |
54 '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/<(RULE_INPUT_ROOT).java
', | 71 '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/<(RULE_INPUT_ROOT).java
', |
55 ], | 72 ], |
56 }, | 73 }, |
57 ], | 74 ], |
58 } | 75 } |
OLD | NEW |