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

Side by Side Diff: build/config/android/rules.gni

Issue 1451483002: [Android] Add gn support for multidex. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: agrieve comments Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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("//base/android/linker/config.gni") 5 import("//base/android/linker/config.gni")
6 import("//build/config/android/config.gni") 6 import("//build/config/android/config.gni")
7 import("//build/config/android/internal_rules.gni") 7 import("//build/config/android/internal_rules.gni")
8 import("//build/toolchain/toolchain.gni") 8 import("//build/toolchain/toolchain.gni")
9 import("//third_party/android_platform/config.gni") 9 import("//third_party/android_platform/config.gni")
10 import("//tools/grit/grit_rule.gni") 10 import("//tools/grit/grit_rule.gni")
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 gen_dir = "$target_gen_dir/$target_name" 1223 gen_dir = "$target_gen_dir/$target_name"
1224 base_path = "$gen_dir/$target_name" 1224 base_path = "$gen_dir/$target_name"
1225 _build_config = "$target_gen_dir/$target_name.build_config" 1225 _build_config = "$target_gen_dir/$target_name.build_config"
1226 resources_zip_path = "$base_path.resources.zip" 1226 resources_zip_path = "$base_path.resources.zip"
1227 _all_resources_zip_path = "$base_path.resources.all.zip" 1227 _all_resources_zip_path = "$base_path.resources.all.zip"
1228 _jar_path = "$base_path.jar" 1228 _jar_path = "$base_path.jar"
1229 _lib_dex_path = "$base_path.dex.jar" 1229 _lib_dex_path = "$base_path.dex.jar"
1230 _rebased_lib_dex_path = rebase_path(_lib_dex_path, root_build_dir) 1230 _rebased_lib_dex_path = rebase_path(_lib_dex_path, root_build_dir)
1231 _template_name = target_name 1231 _template_name = target_name
1232 1232
1233 final_dex_path = "$gen_dir/classes.dex" 1233 enable_multidex = defined(invoker.enable_multidex) && invoker.enable_multidex
1234 if (enable_multidex) {
1235 final_dex_path = "$gen_dir/classes.dex.zip"
1236 } else {
1237 final_dex_path = "$gen_dir/classes.dex"
1238 }
1234 final_dex_target_name = "${_template_name}__final_dex" 1239 final_dex_target_name = "${_template_name}__final_dex"
1235 1240
1236 _final_apk_path = "" 1241 _final_apk_path = ""
1237 if (defined(invoker.final_apk_path)) { 1242 if (defined(invoker.final_apk_path)) {
1238 _final_apk_path = invoker.final_apk_path 1243 _final_apk_path = invoker.final_apk_path
1239 } else if (defined(invoker.apk_name)) { 1244 } else if (defined(invoker.apk_name)) {
1240 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" 1245 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk"
1241 } 1246 }
1242 _dist_jar_path_list = 1247 _dist_jar_path_list =
1243 process_file_template( 1248 process_file_template(
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 rebased_proguard_configs = rebase_path(_proguard_configs, root_build_dir) 1532 rebased_proguard_configs = rebase_path(_proguard_configs, root_build_dir)
1528 args = [ 1533 args = [
1529 "--proguard-configs=$rebased_proguard_configs", 1534 "--proguard-configs=$rebased_proguard_configs",
1530 "--tested-apk-info=@FileArg($_rebased_build_config:proguard:tested_apk_i nfo)", 1535 "--tested-apk-info=@FileArg($_rebased_build_config:proguard:tested_apk_i nfo)",
1531 "--input-paths=@FileArg($_rebased_build_config:proguard:input_paths)", 1536 "--input-paths=@FileArg($_rebased_build_config:proguard:input_paths)",
1532 ] 1537 ]
1533 } 1538 }
1534 _dex_sources = [ _proguard_jar_path ] 1539 _dex_sources = [ _proguard_jar_path ]
1535 _dex_deps = [ ":$_proguard_target" ] 1540 _dex_deps = [ ":$_proguard_target" ]
1536 } else { 1541 } else {
1537 _dex_sources = [ _lib_dex_path ] 1542 if (enable_multidex) {
1543 _dex_sources = [ _jar_path ]
1544 } else {
1545 _dex_sources = [ _lib_dex_path ]
1546 }
1538 _dex_deps = [ ":$java_target" ] 1547 _dex_deps = [ ":$java_target" ]
1539 } 1548 }
1540 1549
1541 dex("$final_dex_target_name") { 1550 dex("$final_dex_target_name") {
1551 forward_variables_from(invoker, [ "enable_multidex" ])
1542 deps = _dex_deps + [ ":$build_config_target" ] 1552 deps = _dex_deps + [ ":$build_config_target" ]
1543 inputs = [ 1553 inputs = [
1544 _build_config, 1554 _build_config,
1545 ] 1555 ]
1546 sources = _dex_sources 1556 sources = _dex_sources
1547 output = final_dex_path 1557 output = final_dex_path
1548 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" 1558 if (enable_multidex) {
1559 _dex_arg_key = "${_rebased_build_config}:dist_jar:dependency_jars"
1560 } else {
1561 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files"
1562 }
1549 args = [ "--inputs=@FileArg($_dex_arg_key)" ] 1563 args = [ "--inputs=@FileArg($_dex_arg_key)" ]
1550 } 1564 }
1551 1565
1552 if (_native_libs != []) { 1566 if (_native_libs != []) {
1553 _prepare_native_target_name = "${_template_name}__prepare_native" 1567 _prepare_native_target_name = "${_template_name}__prepare_native"
1554 action(_prepare_native_target_name) { 1568 action(_prepare_native_target_name) {
1555 forward_variables_from(invoker, 1569 forward_variables_from(invoker,
1556 [ 1570 [
1557 "data_deps", 1571 "data_deps",
1558 "public_deps", 1572 "public_deps",
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
2150 } 2164 }
2151 2165
2152 android_library(target_name) { 2166 android_library(target_name) {
2153 java_files = [] 2167 java_files = []
2154 srcjar_deps = [ ":${_template_name}__protoc_java" ] 2168 srcjar_deps = [ ":${_template_name}__protoc_java" ]
2155 deps = [ 2169 deps = [
2156 "//third_party/android_protobuf:protobuf_nano_javalib", 2170 "//third_party/android_protobuf:protobuf_nano_javalib",
2157 ] 2171 ]
2158 } 2172 }
2159 } 2173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698