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