| OLD | NEW | 
|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be | 
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. | 
| 4 | 4 | 
| 5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") | 
| 6 import("//build/config/zip.gni") | 6 import("//build/config/zip.gni") | 
| 7 import("//third_party/ijar/ijar.gni") | 7 import("//third_party/ijar/ijar.gni") | 
| 8 | 8 | 
| 9 assert(is_android) | 9 assert(is_android) | 
| 10 | 10 | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 67       "--processed-config-path", | 67       "--processed-config-path", | 
| 68       rebase_path(config_path, root_build_dir), | 68       rebase_path(config_path, root_build_dir), | 
| 69       "--result-path", | 69       "--result-path", | 
| 70       rebase_path(result_path, root_build_dir), | 70       rebase_path(result_path, root_build_dir), | 
| 71       "--java-files=$rebased_java_files", | 71       "--java-files=$rebased_java_files", | 
| 72       "--enable", | 72       "--enable", | 
| 73     ] | 73     ] | 
| 74   } | 74   } | 
| 75 } | 75 } | 
| 76 | 76 | 
| 77 template("proguard") { |  | 
| 78   action(target_name) { |  | 
| 79     set_sources_assignment_filter([]) |  | 
| 80     forward_variables_from(invoker, |  | 
| 81                            [ |  | 
| 82                              "deps", |  | 
| 83                              "data_deps", |  | 
| 84                              "public_deps", |  | 
| 85                              "testonly", |  | 
| 86                            ]) |  | 
| 87     script = "//build/android/gyp/proguard.py" |  | 
| 88     _proguard_jar_path = "//third_party/proguard/lib/proguard.jar" |  | 
| 89     _output_jar_path = invoker.output_jar_path |  | 
| 90     inputs = [ |  | 
| 91       android_sdk_jar, |  | 
| 92       _proguard_jar_path, |  | 
| 93     ] |  | 
| 94     if (defined(invoker.inputs)) { |  | 
| 95       inputs += invoker.inputs |  | 
| 96     } |  | 
| 97     depfile = "${target_gen_dir}/${target_name}.d" |  | 
| 98     outputs = [ |  | 
| 99       depfile, |  | 
| 100       _output_jar_path, |  | 
| 101       "$_output_jar_path.dump", |  | 
| 102       "$_output_jar_path.seeds", |  | 
| 103       "$_output_jar_path.mapping", |  | 
| 104       "$_output_jar_path.usage", |  | 
| 105     ] |  | 
| 106     args = [ |  | 
| 107       "--depfile", |  | 
| 108       rebase_path(depfile, root_build_dir), |  | 
| 109       "--proguard-path", |  | 
| 110       rebase_path(_proguard_jar_path, root_build_dir), |  | 
| 111       "--output-path", |  | 
| 112       rebase_path(_output_jar_path, root_build_dir), |  | 
| 113       "--classpath", |  | 
| 114       rebased_android_sdk_jar, |  | 
| 115     ] |  | 
| 116     if (defined(invoker.args)) { |  | 
| 117       args += invoker.args |  | 
| 118     } |  | 
| 119   } |  | 
| 120 } |  | 
| 121 |  | 
| 122 template("findbugs") { | 77 template("findbugs") { | 
| 123   jar_path = invoker.jar_path | 78   jar_path = invoker.jar_path | 
| 124 | 79 | 
| 125   build_config = invoker.build_config | 80   build_config = invoker.build_config | 
| 126 | 81 | 
| 127   action(target_name) { | 82   action(target_name) { | 
| 128     forward_variables_from(invoker, | 83     forward_variables_from(invoker, | 
| 129                            [ | 84                            [ | 
| 130                              "deps", | 85                              "deps", | 
| 131                              "testonly", | 86                              "testonly", | 
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 271 # Write the target's .build_config file. This is a json file that contains a | 226 # Write the target's .build_config file. This is a json file that contains a | 
| 272 # dictionary of information about how to build this target (things that | 227 # dictionary of information about how to build this target (things that | 
| 273 # require knowledge about this target's dependencies and cannot be calculated | 228 # require knowledge about this target's dependencies and cannot be calculated | 
| 274 # at gn-time). There is a special syntax to add a value in that dictionary to | 229 # at gn-time). There is a special syntax to add a value in that dictionary to | 
| 275 # an action/action_foreachs args: | 230 # an action/action_foreachs args: | 
| 276 #   --python-arg=@FileArg($rebased_build_config_path:key0:key1) | 231 #   --python-arg=@FileArg($rebased_build_config_path:key0:key1) | 
| 277 # At runtime, such an arg will be replaced by the value in the build_config. | 232 # At runtime, such an arg will be replaced by the value in the build_config. | 
| 278 # See build/android/gyp/write_build_config.py and | 233 # See build/android/gyp/write_build_config.py and | 
| 279 # build/android/gyp/util/build_utils.py:ExpandFileArgs | 234 # build/android/gyp/util/build_utils.py:ExpandFileArgs | 
| 280 template("write_build_config") { | 235 template("write_build_config") { | 
|  | 236   set_sources_assignment_filter([]) | 
|  | 237 | 
|  | 238   assert(defined(invoker.type)) | 
|  | 239   assert(defined(invoker.build_config)) | 
|  | 240 | 
|  | 241   type = invoker.type | 
|  | 242   build_config = invoker.build_config | 
|  | 243 | 
|  | 244   assert(type == "android_apk" || type == "java_library" || | 
|  | 245          type == "android_resources" || type == "deps_dex" || | 
|  | 246          type == "android_assets" || type == "resource_rewriter") | 
|  | 247 | 
| 281   action(target_name) { | 248   action(target_name) { | 
| 282     set_sources_assignment_filter([]) |  | 
| 283     type = invoker.type |  | 
| 284     build_config = invoker.build_config |  | 
| 285 |  | 
| 286     assert(type == "android_apk" || type == "java_library" || |  | 
| 287            type == "android_resources" || type == "deps_dex" || |  | 
| 288            type == "android_assets" || type == "resource_rewriter") |  | 
| 289 |  | 
| 290     deps = [] | 249     deps = [] | 
| 291     forward_variables_from(invoker, | 250     forward_variables_from(invoker, | 
| 292                            [ | 251                            [ | 
| 293                              "deps", | 252                              "deps", | 
| 294                              "testonly", | 253                              "testonly", | 
| 295                              "visibility", | 254                              "visibility", | 
| 296                            ]) | 255                            ]) | 
| 297 | 256 | 
| 298     script = "//build/android/gyp/write_build_config.py" | 257     script = "//build/android/gyp/write_build_config.py" | 
| 299     depfile = "$target_gen_dir/$target_name.d" | 258     depfile = "$target_gen_dir/$target_name.d" | 
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 437     if (is_apk) { | 396     if (is_apk) { | 
| 438       if (defined(invoker.native_libs)) { | 397       if (defined(invoker.native_libs)) { | 
| 439         inputs += invoker.native_libs | 398         inputs += invoker.native_libs | 
| 440         rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir) | 399         rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir) | 
| 441         rebased_android_readelf = rebase_path(android_readelf, root_build_dir) | 400         rebased_android_readelf = rebase_path(android_readelf, root_build_dir) | 
| 442         args += [ | 401         args += [ | 
| 443           "--native-libs=$rebased_native_libs", | 402           "--native-libs=$rebased_native_libs", | 
| 444           "--readelf-path=$rebased_android_readelf", | 403           "--readelf-path=$rebased_android_readelf", | 
| 445         ] | 404         ] | 
| 446       } | 405       } | 
| 447 |  | 
| 448       if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) { |  | 
| 449         args += [ |  | 
| 450           "--proguard-enabled", |  | 
| 451           "--proguard-info", |  | 
| 452           rebase_path(invoker.proguard_info, root_build_dir), |  | 
| 453         ] |  | 
| 454       } |  | 
| 455     } | 406     } | 
| 456 | 407 | 
| 457     if (defined(invoker.srcjar)) { | 408     if (defined(invoker.srcjar)) { | 
| 458       args += [ | 409       args += [ | 
| 459         "--srcjar", | 410         "--srcjar", | 
| 460         rebase_path(invoker.srcjar, root_build_dir), | 411         rebase_path(invoker.srcjar, root_build_dir), | 
| 461       ] | 412       ] | 
| 462     } | 413     } | 
| 463   } | 414   } | 
| 464 } | 415 } | 
| 465 | 416 | 
| 466 template("process_java_prebuilt") { | 417 template("process_java_prebuilt") { | 
| 467   set_sources_assignment_filter([]) | 418   set_sources_assignment_filter([]) | 
| 468   forward_variables_from(invoker, [ "testonly" ]) | 419   forward_variables_from(invoker, [ "testonly" ]) | 
| 469 | 420 | 
| 470   _input_jar_path = invoker.input_jar_path | 421   _input_jar_path = invoker.input_jar_path | 
| 471   _output_jar_path = invoker.output_jar_path | 422   _output_jar_path = invoker.output_jar_path | 
| 472   _output_ijar_path = get_path_info(_output_jar_path, "dir") + "/" + | 423   _output_ijar_path = get_path_info(_output_jar_path, "dir") + "/" + | 
| 473                       get_path_info(_output_jar_path, "name") + ".interface.jar" | 424                       get_path_info(_output_jar_path, "name") + ".interface.jar" | 
| 474 | 425 | 
| 475   assert(invoker.build_config != "") | 426   assert(invoker.build_config != "") | 
| 476 | 427 | 
| 477   if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | 428   if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | 
|  | 429     _proguard_jar_path = "//third_party/proguard/lib/proguard.jar" | 
|  | 430     _proguard_config_path = invoker.proguard_config | 
| 478     _build_config = invoker.build_config | 431     _build_config = invoker.build_config | 
| 479     _rebased_build_config = rebase_path(_build_config, root_build_dir) | 432     _rebased_build_config = rebase_path(_build_config, root_build_dir) | 
| 480     _proguard_config_path = invoker.proguard_config |  | 
| 481     _output_jar_target = "${target_name}__proguard_process" | 433     _output_jar_target = "${target_name}__proguard_process" | 
| 482     proguard(_output_jar_target) { | 434     action(_output_jar_target) { | 
| 483       forward_variables_from(invoker, | 435       forward_variables_from(invoker, | 
| 484                              [ | 436                              [ | 
| 485                                "data_deps", | 437                                "data_deps", | 
| 486                                "deps", | 438                                "deps", | 
| 487                                "public_deps", | 439                                "public_deps", | 
| 488                              ]) | 440                              ]) | 
|  | 441       script = "//build/android/gyp/proguard.py" | 
| 489       inputs = [ | 442       inputs = [ | 
|  | 443         android_sdk_jar, | 
|  | 444         _proguard_jar_path, | 
| 490         _build_config, | 445         _build_config, | 
| 491         _input_jar_path, | 446         _input_jar_path, | 
| 492         _proguard_config_path, | 447         _proguard_config_path, | 
| 493       ] | 448       ] | 
| 494       output_jar_path = _output_jar_path | 449       depfile = "${target_gen_dir}/${target_name}.d" | 
| 495       _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] | 450       outputs = [ | 
| 496       _rebased_proguard_configs = | 451         depfile, | 
| 497           [ rebase_path(_proguard_config_path, root_build_dir) ] | 452         _output_jar_path, | 
|  | 453       ] | 
| 498       args = [ | 454       args = [ | 
| 499         "--input-paths=$_rebased_input_paths", | 455         "--depfile", | 
| 500         "--proguard-configs=$_rebased_proguard_configs", | 456         rebase_path(depfile, root_build_dir), | 
|  | 457         "--proguard-path", | 
|  | 458         rebase_path(_proguard_jar_path, root_build_dir), | 
|  | 459         "--input-path", | 
|  | 460         rebase_path(_input_jar_path, root_build_dir), | 
|  | 461         "--output-path", | 
|  | 462         rebase_path(_output_jar_path, root_build_dir), | 
|  | 463         "--proguard-config", | 
|  | 464         rebase_path(_proguard_config_path, root_build_dir), | 
|  | 465         "--classpath", | 
|  | 466         rebased_android_sdk_jar, | 
| 501         "--classpath=@FileArg($_rebased_build_config:javac:classpath)", | 467         "--classpath=@FileArg($_rebased_build_config:javac:classpath)", | 
| 502       ] | 468       ] | 
| 503     } | 469     } | 
| 504   } else { | 470   } else { | 
| 505     _output_jar_target = "${target_name}__copy_jar" | 471     _output_jar_target = "${target_name}__copy_jar" | 
| 506     copy(_output_jar_target) { | 472     copy(_output_jar_target) { | 
| 507       forward_variables_from(invoker, | 473       forward_variables_from(invoker, | 
| 508                              [ | 474                              [ | 
| 509                                "data_deps", | 475                                "data_deps", | 
| 510                                "deps", | 476                                "deps", | 
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1567 | 1533 | 
| 1568     if (defined(invoker.all_resources_zip_path)) { | 1534     if (defined(invoker.all_resources_zip_path)) { | 
| 1569       all_resources_zip = invoker.all_resources_zip_path | 1535       all_resources_zip = invoker.all_resources_zip_path | 
| 1570       outputs += [ all_resources_zip ] | 1536       outputs += [ all_resources_zip ] | 
| 1571       args += [ | 1537       args += [ | 
| 1572         "--all-resources-zip-out", | 1538         "--all-resources-zip-out", | 
| 1573         rebase_path(all_resources_zip, root_build_dir), | 1539         rebase_path(all_resources_zip, root_build_dir), | 
| 1574       ] | 1540       ] | 
| 1575     } | 1541     } | 
| 1576 | 1542 | 
| 1577     if (defined(invoker.proguard_file)) { |  | 
| 1578       outputs += [ invoker.proguard_file ] |  | 
| 1579       args += [ |  | 
| 1580         "--proguard-file", |  | 
| 1581         rebase_path(invoker.proguard_file, root_build_dir), |  | 
| 1582       ] |  | 
| 1583     } |  | 
| 1584 |  | 
| 1585     if (defined(invoker.args)) { | 1543     if (defined(invoker.args)) { | 
| 1586       args += invoker.args | 1544       args += invoker.args | 
| 1587     } | 1545     } | 
| 1588   } | 1546   } | 
| 1589 } | 1547 } | 
| 1590 | 1548 | 
| 1591 template("copy_ex") { | 1549 template("copy_ex") { | 
| 1592   set_sources_assignment_filter([]) | 1550   set_sources_assignment_filter([]) | 
| 1593   action(target_name) { | 1551   action(target_name) { | 
| 1594     inputs = [] | 1552     inputs = [] | 
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1783     ] | 1741     ] | 
| 1784     args = [ | 1742     args = [ | 
| 1785       "--depfile", | 1743       "--depfile", | 
| 1786       rebase_path(depfile, root_build_dir), | 1744       rebase_path(depfile, root_build_dir), | 
| 1787       "--script-output-path", | 1745       "--script-output-path", | 
| 1788       rebase_path(generated_script, root_build_dir), | 1746       rebase_path(generated_script, root_build_dir), | 
| 1789     ] | 1747     ] | 
| 1790     args += test_runner_args | 1748     args += test_runner_args | 
| 1791   } | 1749   } | 
| 1792 } | 1750 } | 
| OLD | NEW | 
|---|