Index: build/config/android/internal_rules.gni |
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni |
index b864dd54f2656b70a3795e0ac72e6f6423c58cca..7f055f4e6bb9a507411e431d165e351ad3f8effa 100644 |
--- a/build/config/android/internal_rules.gni |
+++ b/build/config/android/internal_rules.gni |
@@ -16,17 +16,16 @@ rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) |
android_aapt_path = "$rebased_android_sdk_build_tools/aapt" |
template("android_lint") { |
- set_sources_assignment_filter([]) |
- if (defined(invoker.testonly)) { |
- testonly = invoker.testonly |
- } |
- |
- jar_path = invoker.jar_path |
- android_manifest = invoker.android_manifest |
- java_files = invoker.java_files |
- base_path = "$target_gen_dir/$target_name" |
- |
action(target_name) { |
+ set_sources_assignment_filter([]) |
+ if (defined(invoker.testonly)) { |
+ testonly = invoker.testonly |
+ } |
+ jar_path = invoker.jar_path |
+ android_manifest = invoker.android_manifest |
+ java_files = invoker.java_files |
+ base_path = "$target_gen_dir/$target_name" |
+ |
script = "//build/android/gyp/lint.py" |
result_path = base_path + "/result.xml" |
config_path = base_path + "/config.xml" |
@@ -73,6 +72,57 @@ template("android_lint") { |
} |
} |
+template("proguard") { |
+ action(target_name) { |
+ set_sources_assignment_filter([]) |
+ if (defined(invoker.testonly)) { |
+ testonly = invoker.testonly |
+ } |
+ script = "//build/android/gyp/proguard.py" |
+ _proguard_jar_path = "$android_sdk_root/tools/proguard/lib/proguard.jar" |
+ |
+ _output_jar_path = invoker.output_jar_path |
+ inputs = [ |
+ android_sdk_jar, |
+ _proguard_jar_path, |
+ ] |
+ if (defined(invoker.inputs)) { |
+ inputs += invoker.inputs |
+ } |
+ depfile = "${target_gen_dir}/${target_name}.d" |
+ outputs = [ |
+ depfile, |
+ _output_jar_path, |
+ "$_output_jar_path.dump", |
+ "$_output_jar_path.seeds", |
+ "$_output_jar_path.mapping", |
+ "$_output_jar_path.usage", |
+ ] |
+ args = [ |
+ "--depfile", |
+ rebase_path(depfile, root_build_dir), |
+ "--proguard-path", |
+ rebase_path(_proguard_jar_path, root_build_dir), |
+ "--output-path", |
+ rebase_path(_output_jar_path, root_build_dir), |
+ "--classpath", |
+ rebased_android_sdk_jar, |
+ ] |
+ if (defined(invoker.args)) { |
+ args += invoker.args |
+ } |
+ if (defined(invoker.deps)) { |
+ deps = invoker.deps |
+ } |
+ if (defined(invoker.public_deps)) { |
+ public_deps = invoker.public_deps |
+ } |
+ if (defined(invoker.data_deps)) { |
+ data_deps = invoker.data_deps |
+ } |
+ } |
+} |
+ |
template("findbugs") { |
jar_path = invoker.jar_path |
@@ -124,9 +174,8 @@ template("dex") { |
if (defined(invoker.testonly)) { |
testonly = invoker.testonly |
} |
- |
- assert(defined(invoker.output)) |
action(target_name) { |
+ assert(defined(invoker.output)) |
script = "//build/android/gyp/dex.py" |
depfile = "$target_gen_dir/$target_name.d" |
if (defined(invoker.sources)) { |
@@ -229,21 +278,21 @@ template("zip") { |
# See build/android/gyp/write_build_config.py and |
# build/android/gyp/util/build_utils.py:ExpandFileArgs |
template("write_build_config") { |
- set_sources_assignment_filter([]) |
- if (defined(invoker.testonly)) { |
- testonly = invoker.testonly |
- } |
+ action(target_name) { |
+ set_sources_assignment_filter([]) |
+ if (defined(invoker.testonly)) { |
+ testonly = invoker.testonly |
+ } |
- assert(defined(invoker.type)) |
- assert(defined(invoker.build_config)) |
+ assert(defined(invoker.type)) |
+ assert(defined(invoker.build_config)) |
- type = invoker.type |
- build_config = invoker.build_config |
+ type = invoker.type |
+ build_config = invoker.build_config |
- assert(type == "android_apk" || type == "java_library" || |
- type == "android_resources" || type == "deps_dex") |
+ assert(type == "android_apk" || type == "java_library" || |
+ type == "android_resources" || type == "deps_dex") |
- action(target_name) { |
if (defined(invoker.visibility)) { |
visibility = invoker.visibility |
} |
@@ -378,6 +427,14 @@ template("write_build_config") { |
"--readelf-path=$rebased_android_readelf", |
] |
} |
+ |
+ if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) { |
+ args += [ |
+ "--proguard-enabled", |
+ "--proguard-info", |
+ rebase_path(invoker.proguard_info, root_build_dir), |
+ ] |
+ } |
} |
if (defined(invoker.srcjar)) { |
@@ -402,38 +459,23 @@ template("process_java_prebuilt") { |
assert(invoker.build_config != "") |
if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { |
- _proguard_jar_path = "$android_sdk_root/tools/proguard/lib/proguard.jar" |
- _proguard_config_path = invoker.proguard_config |
_build_config = invoker.build_config |
_rebased_build_config = rebase_path(_build_config, root_build_dir) |
+ _proguard_config_path = invoker.proguard_config |
_output_jar_target = "${target_name}__proguard_process" |
- action(_output_jar_target) { |
- script = "//build/android/gyp/proguard.py" |
+ proguard(_output_jar_target) { |
inputs = [ |
- android_sdk_jar, |
- _proguard_jar_path, |
_build_config, |
_input_jar_path, |
_proguard_config_path, |
] |
- depfile = "${target_gen_dir}/${target_name}.d" |
- outputs = [ |
- depfile, |
- _output_jar_path, |
- ] |
+ output_jar_path = _output_jar_path |
+ _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] |
+ _rebased_proguard_configs = |
+ [ rebase_path(_proguard_config_path, root_build_dir) ] |
args = [ |
- "--depfile", |
- rebase_path(depfile, root_build_dir), |
- "--proguard-path", |
- rebase_path(_proguard_jar_path, root_build_dir), |
- "--input-path", |
- rebase_path(_input_jar_path, root_build_dir), |
- "--output-path", |
- rebase_path(_output_jar_path, root_build_dir), |
- "--proguard-config", |
- rebase_path(_proguard_config_path, root_build_dir), |
- "--classpath", |
- rebased_android_sdk_jar, |
+ "--input-paths=$_rebased_input_paths", |
+ "--proguard-configs=$_rebased_proguard_configs", |
"--classpath=@FileArg($_rebased_build_config:javac:classpath)", |
] |
@@ -1379,6 +1421,14 @@ template("process_resources") { |
] |
} |
+ if (defined(invoker.proguard_file)) { |
+ outputs += [ invoker.proguard_file ] |
+ args += [ |
+ "--proguard-file", |
+ rebase_path(invoker.proguard_file, root_build_dir), |
+ ] |
+ } |
+ |
if (defined(invoker.args)) { |
args += invoker.args |
} |