[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 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 |
| 3 | # found in the LICENSE file. |
| 4 | |
| 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. |
| 7 | # |
| 8 | # To use this, create a gyp target with the following form: |
| 9 | # { |
| 10 | # 'target_name': 'aidl_aidl-file-name', |
| 11 | # 'type': 'none', |
| 12 | # 'variables': { |
[email protected] | 8bf6c17 | 2012-08-13 18:35:49 | [diff] [blame] | 13 | # 'package_name': <name-of-package> |
[email protected] | 320b204 | 2012-07-10 23:12:06 | [diff] [blame] | 14 | # 'aidl_interface_file': '<interface-path>/<interface-file>.aidl', |
[email protected] | 4ab5ddb | 2012-12-14 05:58:11 | [diff] [blame] | 15 | # 'aidl_import_include': '<(DEPTH)/<path-to-src-dir>', |
[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 16 | # }, |
| 17 | # 'sources': { |
[email protected] | 320b204 | 2012-07-10 23:12:06 | [diff] [blame] | 18 | # '<input-path1>/<input-file1>.aidl', |
| 19 | # '<input-path2>/<input-file2>.aidl', |
[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 20 | # ... |
| 21 | # }, |
[email protected] | 320b204 | 2012-07-10 23:12:06 | [diff] [blame] | 22 | # 'includes': ['<path-to-this-file>/java_aidl.gypi'], |
[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 23 | # } |
| 24 | # |
| 25 | # |
[email protected] | 320b204 | 2012-07-10 23:12:06 | [diff] [blame] | 26 | # The generated java files will be: |
| 27 | # <(PRODUCT_DIR)/lib.java/<input-file1>.java |
| 28 | # <(PRODUCT_DIR)/lib.java/<input-file2>.java |
| 29 | # ... |
[email protected] | 8bf6c17 | 2012-08-13 18:35:49 | [diff] [blame] | 30 | # |
[email protected] | 4ab5ddb | 2012-12-14 05:58:11 | [diff] [blame] | 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 | # |
[email protected] | 8bf6c17 | 2012-08-13 18:35:49 | [diff] [blame] | 35 | # TODO(cjhopman): dependents need to rebuild when this target's inputs have changed. |
[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 36 | |
| 37 | { |
[email protected] | 8bf6c17 | 2012-08-13 18:35:49 | [diff] [blame] | 38 | 'direct_dependent_settings': { |
| 39 | 'variables': { |
[email protected] | d54f19b | 2012-09-28 18:22:29 | [diff] [blame] | 40 | 'generated_src_dirs': ['<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/'], |
[email protected] | 8bf6c17 | 2012-08-13 18:35:49 | [diff] [blame] | 41 | }, |
| 42 | }, |
[email protected] | 4ab5ddb | 2012-12-14 05:58:11 | [diff] [blame] | 43 | 'variables': { |
| 44 | 'aidl_import_include%': '', |
| 45 | 'additional_aidl_arguments': [], |
[email protected] | 309501b | 2012-12-15 22:30:27 | [diff] [blame^] | 46 | 'additional_aidl_input_paths': [], |
[email protected] | 4ab5ddb | 2012-12-14 05:58:11 | [diff] [blame] | 47 | }, |
| 48 | 'conditions': [ |
| 49 | ['"<(aidl_import_include)"!=""', { |
| 50 | 'variables': { |
[email protected] | 309501b | 2012-12-15 22:30:27 | [diff] [blame^] | 51 | 'additional_aidl_arguments': [ '-I<(aidl_import_include)' ], |
| 52 | 'additional_aidl_input_paths': [ '<!@(find <(aidl_import_include) -name "*.java")', ] |
[email protected] | 4ab5ddb | 2012-12-14 05:58:11 | [diff] [blame] | 53 | } |
| 54 | }], |
| 55 | ], |
[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 56 | 'rules': [ |
| 57 | { |
| 58 | 'rule_name': 'compile_aidl', |
| 59 | 'extension': 'aidl', |
| 60 | 'inputs': [ |
| 61 | '<(android_sdk)/framework.aidl', |
| 62 | '<(aidl_interface_file)', |
[email protected] | 309501b | 2012-12-15 22:30:27 | [diff] [blame^] | 63 | '<@(additional_aidl_input_paths)', |
[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 64 | ], |
| 65 | 'outputs': [ |
[email protected] | 8bf6c17 | 2012-08-13 18:35:49 | [diff] [blame] | 66 | '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/<(RULE_INPUT_ROOT).java', |
[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 67 | ], |
| 68 | 'action': [ |
[email protected] | 5308c3bf | 2012-07-04 14:27:36 | [diff] [blame] | 69 | '<(android_sdk_tools)/aidl', |
[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 70 | '-p<(android_sdk)/framework.aidl', |
| 71 | '-p<(aidl_interface_file)', |
[email protected] | 4ab5ddb | 2012-12-14 05:58:11 | [diff] [blame] | 72 | '<@(additional_aidl_arguments)', |
[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 73 | '<(RULE_INPUT_PATH)', |
[email protected] | 8bf6c17 | 2012-08-13 18:35:49 | [diff] [blame] | 74 | '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/<(RULE_INPUT_ROOT).java', |
[email protected] | 5b6f069 | 2012-06-12 05:00:05 | [diff] [blame] | 75 | ], |
| 76 | }, |
| 77 | ], |
| 78 | } |