Index: build/config/android/internal_rules.gni |
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni |
index 616e4f958febb16e3f59bacad3670e996bd8f838..2d3f528d278932d7d8cdf5520f4128ef82623512 100644 |
--- a/build/config/android/internal_rules.gni |
+++ b/build/config/android/internal_rules.gni |
@@ -15,17 +15,16 @@ android_sdk_jar = "$android_sdk/android.jar" |
rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) |
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" |
@@ -62,6 +61,49 @@ 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 |
+ |
+ _output_jar_path = invoker.output_jar_path |
newt (away)
2015/05/29 01:43:04
duplicate line
|
+ 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 |
+ } |
+ } |
+} |
+ |
template("findbugs") { |
jar_path = invoker.jar_path |
@@ -105,9 +147,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)) { |
@@ -196,21 +237,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) { |
script = "//build/android/gyp/write_build_config.py" |
depfile = "$target_gen_dir/$target_name.d" |
inputs = [] |
@@ -341,6 +382,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)) { |
@@ -365,37 +414,22 @@ 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) |
- action("${target_name}__proguard_process") { |
- script = "//build/android/gyp/proguard.py" |
+ _proguard_config_path = invoker.proguard_config |
+ proguard("${target_name}__proguard_process") { |
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)", |
] |
} |
@@ -1168,6 +1202,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 |
} |