2012-12-10 16:38:24 +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 generate Java source files from templates that are processed
|
|
|
|
# through the host C pre-processor.
|
|
|
|
#
|
|
|
|
# To use this, create a gyp target with the following form:
|
|
|
|
# {
|
|
|
|
# 'target_name': 'android_net_java_constants',
|
|
|
|
# 'type': 'none',
|
|
|
|
# 'sources': [
|
|
|
|
# 'net/android/NetError.template',
|
|
|
|
# ],
|
|
|
|
# 'variables': {
|
2013-03-02 20:39:08 +04:00
|
|
|
# 'package_name': 'org/chromium/net',
|
2013-01-19 08:05:48 +04:00
|
|
|
# 'template_deps': ['net/base/certificate_mime_type_list.h'],
|
2012-12-10 16:38:24 +04:00
|
|
|
# },
|
2013-04-02 03:12:33 +04:00
|
|
|
# 'includes': [ '../build/android/java_cpp_template.gypi' ],
|
2012-12-10 16:38:24 +04:00
|
|
|
# },
|
|
|
|
#
|
2013-01-19 08:05:48 +04:00
|
|
|
# The 'sources' entry should only list template file. The template file
|
2012-12-10 16:38:24 +04:00
|
|
|
# itself should use the 'ClassName.template' format, and will generate
|
2013-01-19 08:05:48 +04:00
|
|
|
# 'gen/templates/<package-name>/ClassName.java. The files which template
|
|
|
|
# dependents on and typically included by the template should be listed
|
|
|
|
# in template_deps variables. Any change to them will force a rebuild of
|
|
|
|
# the template, and hence of any source that depends on it.
|
2012-12-10 16:38:24 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
{
|
|
|
|
# Location where all generated Java sources will be placed.
|
|
|
|
'variables': {
|
2013-04-02 03:12:33 +04:00
|
|
|
'include_path%': '<(DEPTH)',
|
|
|
|
'output_dir': '<(SHARED_INTERMEDIATE_DIR)/templates/<(package_name)',
|
2012-12-10 16:38:24 +04:00
|
|
|
},
|
|
|
|
'direct_dependent_settings': {
|
|
|
|
'variables': {
|
2013-05-21 21:32:27 +04:00
|
|
|
# Ensure that the output directory is used in the class path
|
|
|
|
# when building targets that depend on this one.
|
2012-12-10 16:38:24 +04:00
|
|
|
'generated_src_dirs': [
|
|
|
|
'<(output_dir)/',
|
|
|
|
],
|
2013-05-21 21:32:27 +04:00
|
|
|
# Ensure dependents are rebuilt when sources for this rule change.
|
|
|
|
'additional_input_paths': [
|
|
|
|
'<@(_sources)',
|
|
|
|
'<@(template_deps)',
|
|
|
|
],
|
2012-12-10 16:38:24 +04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
# Define a single rule that will be apply to each .template file
|
|
|
|
# listed in 'sources'.
|
|
|
|
'rules': [
|
|
|
|
{
|
|
|
|
'rule_name': 'generate_java_constants',
|
|
|
|
'extension': 'template',
|
2013-01-19 08:05:48 +04:00
|
|
|
# Set template_deps as additional dependencies.
|
2013-04-02 03:12:33 +04:00
|
|
|
'variables': {
|
|
|
|
'output_path': '<(output_dir)/<(RULE_INPUT_ROOT).java',
|
|
|
|
},
|
|
|
|
'inputs': [
|
2013-04-05 03:04:40 +04:00
|
|
|
'<(DEPTH)/build/android/gyp/util/build_utils.py',
|
|
|
|
'<(DEPTH)/build/android/gyp/gcc_preprocess.py',
|
2013-04-02 03:12:33 +04:00
|
|
|
'<@(template_deps)'
|
|
|
|
],
|
2012-12-10 16:38:24 +04:00
|
|
|
'outputs': [
|
2013-04-02 03:12:33 +04:00
|
|
|
'<(output_path)',
|
2012-12-10 16:38:24 +04:00
|
|
|
],
|
|
|
|
'action': [
|
2013-04-05 03:04:40 +04:00
|
|
|
'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
|
2013-04-02 03:12:33 +04:00
|
|
|
'--include-path=<(include_path)',
|
|
|
|
'--output=<(output_path)',
|
|
|
|
'--template=<(RULE_INPUT_PATH)',
|
2012-12-10 16:38:24 +04:00
|
|
|
],
|
|
|
|
'message': 'Generating Java from cpp template <(RULE_INPUT_PATH)',
|
|
|
|
}
|
|
|
|
],
|
|
|
|
}
|