michael@0: # Copyright (c) 2012 The Chromium Authors. All rights reserved. michael@0: # Use of this source code is governed by a BSD-style license that can be michael@0: # found in the LICENSE file. michael@0: michael@0: # This file is meant to be included into a target to provide a rule michael@0: # to build Java in a consistent manner. michael@0: # michael@0: # To use this, create a gyp target with the following form: michael@0: # { michael@0: # 'target_name': 'my-package_java', michael@0: # 'type': 'none', michael@0: # 'variables': { michael@0: # 'package_name': 'my-package', michael@0: # 'java_in_dir': 'path/to/package/root', michael@0: # }, michael@0: # 'includes': ['path/to/this/gypi/file'], michael@0: # } michael@0: # michael@0: # The generated jar-file will be: michael@0: # <(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar michael@0: # Required variables: michael@0: # package_name - Used to name the intermediate output directory and in the michael@0: # names of some output files. michael@0: # java_in_dir - The top-level java directory. The src should be in michael@0: # /src. michael@0: # Optional/automatic variables: michael@0: # additional_input_paths - These paths will be included in the 'inputs' list to michael@0: # ensure that this target is rebuilt when one of these paths changes. michael@0: # additional_src_dirs - Additional directories with .java files to be compiled michael@0: # and included in the output of this target. michael@0: # generated_src_dirs - Same as additional_src_dirs except used for .java files michael@0: # that are generated at build time. This should be set automatically by a michael@0: # target's dependencies. The .java files in these directories are not michael@0: # included in the 'inputs' list (unlike additional_src_dirs). michael@0: # input_jars_paths - The path to jars to be included in the classpath. This michael@0: # should be filled automatically by depending on the appropriate targets. michael@0: michael@0: { michael@0: 'dependencies': [ michael@0: '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' michael@0: ], michael@0: # This all_dependent_settings is used for java targets only. This will add the michael@0: # chromium_<(package_name) jar to the classpath of dependent java targets. michael@0: 'all_dependent_settings': { michael@0: 'variables': { michael@0: 'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar'], michael@0: }, michael@0: }, michael@0: 'variables': { michael@0: 'input_jars_paths': [], michael@0: 'additional_src_dirs': [], michael@0: 'additional_input_paths': [], michael@0: 'generated_src_dirs': [], michael@0: }, michael@0: 'actions': [ michael@0: { michael@0: 'action_name': 'ant_<(package_name)', michael@0: 'message': 'Building <(package_name) java sources.', michael@0: 'inputs': [ michael@0: 'android/ant/common.xml', michael@0: 'android/ant/chromium-jars.xml', michael@0: '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', michael@0: '>@(input_jars_paths)', michael@0: '>@(additional_input_paths)', michael@0: ], michael@0: 'outputs': [ michael@0: '<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar', michael@0: ], michael@0: 'action': [ michael@0: 'ant', michael@0: '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', michael@0: '-DANDROID_SDK=<(android_sdk)', michael@0: '-DANDROID_SDK_ROOT=<(android_sdk_root)', michael@0: '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', michael@0: '-DANDROID_SDK_VERSION=<(android_sdk_version)', michael@0: '-DANDROID_GDBSERVER=<(android_gdbserver)', michael@0: '-DPRODUCT_DIR=<(ant_build_out)', michael@0: michael@0: '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', michael@0: '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', michael@0: '-DINPUT_JARS_PATHS=>(input_jars_paths)', michael@0: '-DPACKAGE_NAME=<(package_name)', michael@0: michael@0: '-Dbasedir=<(java_in_dir)', michael@0: '-buildfile', michael@0: '<(DEPTH)/build/android/ant/chromium-jars.xml' michael@0: ] michael@0: }, michael@0: ], michael@0: }