Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1054)

Unified Diff: build/config/android/internal_rules.gni

Issue 2543463002: Add retrolambda.py and integrate it to build process. (Closed)
Patch Set: Addressing comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/config/android/config.gni ('k') | build/config/android/rules.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/android/internal_rules.gni
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
index 3121ee986856da5a63143c0d71770aa16eabe74c..373d28cead1e474b56f3820af84b407d1f258d0a 100644
--- a/build/config/android/internal_rules.gni
+++ b/build/config/android/internal_rules.gni
@@ -418,7 +418,7 @@ template("copy_ex") {
}
}
-# Generates a script in the output bin directory which runs the test
+# Generates a script in the build bin directory which runs the test
# target using the test runner script in build/android/test_runner.py.
template("test_runner_script") {
testonly = true
@@ -819,10 +819,10 @@ if (enable_java_templates) {
}
}
- # Generates a script in the output bin.java directory to run a java binary.
+ # Generates a script in the build bin directory to run a java binary.
#
# Variables
- # main_class: The class containing the progam entry point.
+ # main_class: The class containing the program entry point.
# jar_path: The path to the jar to run.
# script_name: Name of the script to generate.
# build_config: Path to .build_config for the jar (contains classpath).
@@ -1000,9 +1000,6 @@ if (enable_java_templates) {
_input_jar_path = invoker.input_jar_path
_output_jar_path = invoker.output_jar_path
- _proguard_preprocess =
- defined(invoker.proguard_preprocess) && invoker.proguard_preprocess
-
_jar_excluded_patterns = []
if (defined(invoker.jar_excluded_patterns)) {
_jar_excluded_patterns = invoker.jar_excluded_patterns
@@ -1011,56 +1008,65 @@ if (enable_java_templates) {
invoker.strip_resource_classes
_filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes
+ _proguard_preprocess =
+ defined(invoker.proguard_preprocess) && invoker.proguard_preprocess
+
_enable_assert =
defined(invoker.supports_android) && invoker.supports_android &&
(is_java_debug || dcheck_always_on)
- assert(_enable_assert || true) # Mark used.
+
+ _retrolambda = defined(invoker.supports_android) &&
+ invoker.supports_android && use_java8
+
+ _deps = []
+ _previous_output_jar = _input_jar_path
if (_filter_jar) {
_filter_target = "${target_name}__filter"
+ _filter_input_jar = _previous_output_jar
+ _filter_output_jar = "$target_out_dir/$target_name-filtered.jar"
- _filter_jar_path = "$target_out_dir/$target_name-filtered.jar"
action(_filter_target) {
script = "//build/android/gyp/jar.py"
- forward_variables_from(invoker,
- [
- "deps",
- "public_deps",
- ])
+ deps = _deps
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+ if (defined(invoker.public_deps)) {
+ public_deps = invoker.public_deps
+ }
inputs = [
_build_config,
- _input_jar_path,
+ _filter_input_jar,
]
outputs = [
- _filter_jar_path,
+ _filter_output_jar,
]
args = [
"--input-jar",
- rebase_path(_input_jar_path, root_build_dir),
+ rebase_path(_filter_input_jar, root_build_dir),
"--jar-path",
- rebase_path(_filter_jar_path, root_build_dir),
+ rebase_path(_filter_output_jar, root_build_dir),
"--excluded-classes=$_jar_excluded_patterns",
]
if (_strip_resource_classes) {
args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_config:javac:resource_packages)" ]
}
}
+
+ _deps = []
+ _deps = [ ":$_filter_target" ]
+ _previous_output_jar = _filter_output_jar
}
if (_proguard_preprocess) {
- _output_jar_target = "${target_name}__proguard_process"
- _proguard_output_jar = _output_jar_path
+ _proguard_target = "${target_name}__proguard_process"
+ _proguard_input_jar = _previous_output_jar
+ _proguard_output_jar = "$target_out_dir/$target_name-proguarded.jar"
_proguard_config_path = invoker.proguard_preprocess_config
- proguard(_output_jar_target) {
- if (_filter_jar) {
- _proguard_input_jar = _filter_jar_path
- deps = [
- ":$_filter_target",
- ]
- } else {
- _proguard_input_jar = _input_jar_path
- deps = []
- }
+
+ proguard(_proguard_target) {
+ deps = _deps
if (defined(invoker.deps)) {
deps += invoker.deps
}
@@ -1084,20 +1090,23 @@ if (enable_java_templates) {
"--classpath=@FileArg($_rebased_build_config:javac:classpath)",
]
}
- } else if (_enable_assert) {
- _output_jar_target = "${target_name}__assert"
- _assert_output_jar = _output_jar_path
- action(_output_jar_target) {
- script = "$root_out_dir/bin/helper/java_assertion_enabler"
+
+ _deps = []
+ _deps = [ ":$_proguard_target" ]
+ _previous_output_jar = _proguard_output_jar
+ }
+
+ if (_enable_assert) {
+ _assert_target = "${target_name}__assert"
+ _assert_input_jar = _previous_output_jar
+ _assert_output_jar = "$target_out_dir/$target_name-asserted.jar"
+
+ action(_assert_target) {
+ script = "$root_build_dir/bin/helper/java_assertion_enabler"
deps = [
"//build/android/java_assertion_enabler($default_toolchain)",
]
- if (_filter_jar) {
- _assert_input_jar = _filter_jar_path
- deps += [ ":$_filter_target" ]
- } else {
- _assert_input_jar = _input_jar_path
- }
+ deps += _deps
if (defined(invoker.deps)) {
deps += invoker.deps
}
@@ -1115,31 +1124,65 @@ if (enable_java_templates) {
rebase_path(_assert_output_jar, root_build_dir),
]
}
- } else {
- _output_jar_target = "${target_name}__copy"
- copy(_output_jar_target) {
- if (_filter_jar) {
- _copy_input_jar = _filter_jar_path
- public_deps = [
- ":$_filter_target",
- ]
- } else {
- _copy_input_jar = _input_jar_path
- public_deps = []
- }
+
+ _deps = []
+ _deps = [ ":$_assert_target" ]
+ _previous_output_jar = _assert_output_jar
+ }
+
+ if (_retrolambda) {
+ _retrolambda_target = "${target_name}__retrolambda"
+ _retrolambda_input_jar = _previous_output_jar
+ _retrolambda_output_jar = "$target_out_dir/$target_name-retrolambda.jar"
+
+ android_sdk_jar = "$android_sdk/android.jar"
+ action(_retrolambda_target) {
+ script = "//build/android/gyp/retrolambda.py"
+ deps = _deps
if (defined(invoker.deps)) {
- deps = invoker.deps
+ deps += invoker.deps
}
if (defined(invoker.public_deps)) {
- public_deps += invoker.public_deps
+ public_deps = invoker.public_deps
}
- sources = [
- _copy_input_jar,
+ inputs = [
+ _build_config,
+ _retrolambda_input_jar,
]
outputs = [
- _output_jar_path,
+ _retrolambda_output_jar,
+ ]
+ args = [
+ "--input-jar",
+ rebase_path(_retrolambda_input_jar, root_build_dir),
+ "--output-jar",
+ rebase_path(_retrolambda_output_jar, root_build_dir),
+ "--classpath=@FileArg($_rebased_build_config:javac:classpath)",
+ "--android-sdk-jar",
+ rebase_path(android_sdk_jar, root_build_dir),
]
}
+
+ _deps = []
+ _deps = [ ":$_retrolambda_target" ]
+ _previous_output_jar = _retrolambda_output_jar
+ }
+
+ _output_jar_target = "${target_name}__copy"
+ copy(_output_jar_target) {
+ deps = _deps
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+ if (defined(invoker.public_deps)) {
+ public_deps = invoker.public_deps
+ }
+ sources = [
+ _previous_output_jar,
+ ]
+ outputs = [
+ _output_jar_path,
+ ]
}
group(target_name) {
@@ -2079,7 +2122,9 @@ if (enable_java_templates) {
rebase_path(_android_sdk_ijar, root_build_dir)
args += [ "--bootclasspath=$_rebased_android_sdk_ijar" ]
}
- if (_supports_android) {
+ if (use_java8) {
+ args += [ "--java-version=1.8" ]
+ } else if (_supports_android) {
args += [ "--java-version=1.7" ]
}
foreach(e, _manifest_entries) {
« no previous file with comments | « build/config/android/config.gni ('k') | build/config/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698