2012-04-17 08:39:52 +04:00
|
|
|
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
# This file is meant to be included into a target to provide a rule
|
|
|
|
# to build Java in a consistent manner.
|
|
|
|
#
|
|
|
|
# To use this, create a gyp target with the following form:
|
|
|
|
# {
|
|
|
|
# 'target_name': 'my-package_java',
|
|
|
|
# 'type': 'none',
|
|
|
|
# 'variables': {
|
|
|
|
# 'package_name': 'my-package',
|
|
|
|
# 'java_in_dir': 'path/to/package/root',
|
|
|
|
# },
|
|
|
|
# 'includes': ['path/to/this/gypi/file'],
|
|
|
|
# }
|
|
|
|
#
|
2012-09-28 22:22:29 +04:00
|
|
|
# The generated jar-file will be:
|
|
|
|
# <(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar
|
|
|
|
# Required variables:
|
|
|
|
# package_name - Used to name the intermediate output directory and in the
|
|
|
|
# names of some output files.
|
|
|
|
# java_in_dir - The top-level java directory. The src should be in
|
|
|
|
# <java_in_dir>/src.
|
|
|
|
# Optional/automatic variables:
|
|
|
|
# additional_input_paths - These paths will be included in the 'inputs' list to
|
|
|
|
# ensure that this target is rebuilt when one of these paths changes.
|
|
|
|
# additional_src_dirs - Additional directories with .java files to be compiled
|
|
|
|
# and included in the output of this target.
|
|
|
|
# generated_src_dirs - Same as additional_src_dirs except used for .java files
|
|
|
|
# that are generated at build time. This should be set automatically by a
|
|
|
|
# target's dependencies. The .java files in these directories are not
|
|
|
|
# included in the 'inputs' list (unlike additional_src_dirs).
|
|
|
|
# input_jars_paths - The path to jars to be included in the classpath. This
|
|
|
|
# should be filled automatically by depending on the appropriate targets.
|
2012-11-15 01:20:47 +04:00
|
|
|
# javac_includes - A list of specific files to include. This is by default
|
2012-11-14 05:23:40 +04:00
|
|
|
# empty, which leads to inclusion of all files specified. May include
|
|
|
|
# wildcard, and supports '**/' for recursive path wildcards, ie.:
|
|
|
|
# '**/MyFileRegardlessOfDirectory.java', '**/IncludedPrefix*.java'.
|
2012-11-17 00:39:20 +04:00
|
|
|
# has_java_resources - Set to 1 if the java target contains an
|
|
|
|
# Android-compatible resources folder named res. If 1, R_package and
|
|
|
|
# R_package_relpath must also be set.
|
|
|
|
# R_package - The java package in which the R class (which maps resources to
|
|
|
|
# integer IDs) should be generated, e.g. org.chromium.content.
|
|
|
|
# R_package_relpath - Same as R_package, but replace each '.' with '/'.
|
2012-04-17 08:39:52 +04:00
|
|
|
|
|
|
|
{
|
2012-09-19 22:19:18 +04:00
|
|
|
'dependencies': [
|
2012-09-21 15:11:10 +04:00
|
|
|
'<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs'
|
2012-09-19 22:19:18 +04:00
|
|
|
],
|
2012-10-09 06:20:29 +04:00
|
|
|
# This all_dependent_settings is used for java targets only. This will add the
|
|
|
|
# chromium_<(package_name) jar to the classpath of dependent java targets.
|
|
|
|
'all_dependent_settings': {
|
2012-08-09 22:08:19 +04:00
|
|
|
'variables': {
|
|
|
|
'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'variables': {
|
|
|
|
'input_jars_paths': [],
|
2012-08-13 22:35:49 +04:00
|
|
|
'additional_src_dirs': [],
|
2012-11-14 05:23:40 +04:00
|
|
|
'javac_includes': [],
|
2012-11-17 00:39:20 +04:00
|
|
|
'additional_input_paths': ['>@(additional_R_files)'],
|
|
|
|
'generated_src_dirs': ['>@(generated_R_dirs)'],
|
|
|
|
'generated_R_dirs': [],
|
|
|
|
'additional_R_files': [],
|
|
|
|
'has_java_resources%': 0,
|
2012-08-09 22:08:19 +04:00
|
|
|
},
|
2012-11-17 00:39:20 +04:00
|
|
|
'conditions': [
|
|
|
|
['has_java_resources == 1', {
|
|
|
|
'variables': {
|
|
|
|
'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R',
|
|
|
|
'R_file': '<(R_dir)/<(R_package_relpath)/R.java',
|
|
|
|
'generated_src_dirs': ['<(R_dir)'],
|
|
|
|
'additional_input_paths': ['<(R_file)'],
|
|
|
|
},
|
|
|
|
'all_dependent_settings': {
|
|
|
|
'variables': {
|
|
|
|
# Dependent jars include this target's R.java file via
|
|
|
|
# generated_R_dirs and additional_R_files.
|
|
|
|
'generated_R_dirs': ['<(R_dir)'],
|
|
|
|
'additional_R_files': ['<(R_file)'],
|
|
|
|
|
|
|
|
# Dependent APKs include this target's resources via
|
|
|
|
# additional_res_dirs and additional_res_packages.
|
|
|
|
'additional_res_dirs': ['<(java_in_dir)/res'],
|
|
|
|
'additional_res_packages': ['<(R_package)'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'actions': [
|
|
|
|
# Generate R.java for the library. This R.java contains non-final
|
|
|
|
# constants and is used only while compiling the library jar (e.g.
|
|
|
|
# chromium_content.jar). When building an apk, a new R.java file with
|
|
|
|
# the correct resource -> ID mappings will be generated by merging the
|
|
|
|
# resources from all libraries and the main apk project.
|
|
|
|
{
|
|
|
|
'action_name': 'generate_r_java',
|
|
|
|
'message': 'generating R.java for <(package_name)',
|
|
|
|
'inputs': [
|
|
|
|
'<(android_sdk_tools)/aapt',
|
|
|
|
'<(android_sdk)/android.jar',
|
|
|
|
'<(DEPTH)/build/android/AndroidManifest.xml',
|
|
|
|
'<!@(find <(java_in_dir)/res -type f)',
|
|
|
|
],
|
|
|
|
'outputs': [
|
|
|
|
'<(R_file)',
|
|
|
|
],
|
|
|
|
'action': [
|
|
|
|
'<(android_sdk_tools)/aapt',
|
|
|
|
'package',
|
|
|
|
'-m',
|
|
|
|
'--non-constant-id',
|
|
|
|
'--custom-package', '<(R_package)',
|
|
|
|
'-M', '<(DEPTH)/build/android/AndroidManifest.xml',
|
|
|
|
'-S', '<(java_in_dir)/res',
|
|
|
|
'-I', '<(android_sdk)/android.jar',
|
|
|
|
'-J', '<(R_dir)',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
],
|
2012-04-17 08:39:52 +04:00
|
|
|
'actions': [
|
|
|
|
{
|
|
|
|
'action_name': 'ant_<(package_name)',
|
|
|
|
'message': 'Building <(package_name) java sources.',
|
|
|
|
'inputs': [
|
2012-08-09 22:08:19 +04:00
|
|
|
'android/ant/common.xml',
|
|
|
|
'android/ant/chromium-jars.xml',
|
2012-09-28 22:22:29 +04:00
|
|
|
'>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")',
|
2012-08-09 22:08:19 +04:00
|
|
|
'>@(input_jars_paths)',
|
2012-09-22 05:21:32 +04:00
|
|
|
'>@(additional_input_paths)',
|
2012-04-17 08:39:52 +04:00
|
|
|
],
|
|
|
|
'outputs': [
|
2012-05-10 05:50:47 +04:00
|
|
|
'<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar',
|
2012-04-17 08:39:52 +04:00
|
|
|
],
|
|
|
|
'action': [
|
|
|
|
'ant',
|
2012-10-05 20:51:32 +04:00
|
|
|
'-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
|
2012-08-01 15:31:47 +04:00
|
|
|
'-DANDROID_SDK=<(android_sdk)',
|
2012-08-07 03:23:51 +04:00
|
|
|
'-DANDROID_SDK_ROOT=<(android_sdk_root)',
|
|
|
|
'-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
|
|
|
|
'-DANDROID_SDK_VERSION=<(android_sdk_version)',
|
2012-08-31 02:54:09 +04:00
|
|
|
'-DANDROID_GDBSERVER=<(android_gdbserver)',
|
2012-09-28 22:22:29 +04:00
|
|
|
'-DPRODUCT_DIR=<(ant_build_out)',
|
|
|
|
|
|
|
|
'-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)',
|
|
|
|
'-DGENERATED_SRC_DIRS=>(generated_src_dirs)',
|
|
|
|
'-DINPUT_JARS_PATHS=>(input_jars_paths)',
|
|
|
|
'-DPACKAGE_NAME=<(package_name)',
|
2012-11-14 05:23:40 +04:00
|
|
|
'-DJAVAC_INCLUDES=>(javac_includes)',
|
2012-09-28 22:22:29 +04:00
|
|
|
|
2012-08-14 00:17:24 +04:00
|
|
|
'-Dbasedir=<(java_in_dir)',
|
2012-04-17 08:39:52 +04:00
|
|
|
'-buildfile',
|
2012-08-14 00:17:24 +04:00
|
|
|
'<(DEPTH)/build/android/ant/chromium-jars.xml'
|
2012-04-17 08:39:52 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|