Commit f371656e authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Android: output .dex files to target_out_dir rather than target_gen_dir

Binary files don't belong in target_gen_dir.

Bug: 917446
Change-Id: I08611efc78c20ee7cdf65e0ed3090e96c7cb7242
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1839431Reviewed-by: default avatarPeter Kotwicz <pkotwicz@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703310}
parent e0d243aa
......@@ -634,15 +634,20 @@ def ReadSourcesList(sources_list_file_name):
return [file_name.strip() for file_name in f]
def CallAndWriteDepfileIfStale(function, options, record_path=None,
input_paths=None, input_strings=None,
output_paths=None, force=False,
pass_changes=False, depfile_deps=None,
def CallAndWriteDepfileIfStale(on_stale_md5,
options,
record_path=None,
input_paths=None,
input_strings=None,
output_paths=None,
force=False,
pass_changes=False,
depfile_deps=None,
add_pydeps=True):
"""Wraps md5_check.CallAndRecordIfStale() and writes a depfile if applicable.
Depfiles are automatically added to output_paths when present in the |options|
argument. They are then created after |function| is called.
argument. They are then created after |on_stale_md5| is called.
By default, only python dependencies are added to the depfile. If there are
other input paths that are not captured by GN deps, then they should be listed
......@@ -660,16 +665,6 @@ def CallAndWriteDepfileIfStale(function, options, record_path=None,
if hasattr(options, 'depfile') and options.depfile:
python_deps = _ComputePythonDependencies()
input_paths += python_deps
output_paths += [options.depfile]
def on_stale_md5(*args):
function(*args)
if python_deps is not None:
all_depfile_deps = list(python_deps) if add_pydeps else []
if depfile_deps:
all_depfile_deps.extend(depfile_deps)
WriteDepfile(options.depfile, output_paths[0], all_depfile_deps,
add_pydeps=False)
md5_check.CallAndRecordIfStale(
on_stale_md5,
......@@ -679,3 +674,13 @@ def CallAndWriteDepfileIfStale(function, options, record_path=None,
output_paths=output_paths,
force=force,
pass_changes=pass_changes)
# Write depfile even when inputs have not changed to ensure build correctness
# on bots that build with & without patch, and the patch changes the depfile
# location.
if python_deps is not None:
all_depfile_deps = list(python_deps) if add_pydeps else []
if depfile_deps:
all_depfile_deps.extend(depfile_deps)
WriteDepfile(
options.depfile, output_paths[0], all_depfile_deps, add_pydeps=False)
......@@ -6,7 +6,7 @@ import("//build/config/android/rules.gni")
android_library("bootstrap_java") {
# Use .dex rather than .dex.jar to be usable by package_apk().
dex_path = "$target_gen_dir/bootstrap.dex"
dex_path = "$target_out_dir/bootstrap.dex"
java_files = [
"java/org/chromium/incrementalinstall/BootstrapApplication.java",
"java/org/chromium/incrementalinstall/BootstrapInstrumentation.java",
......
......@@ -2818,7 +2818,7 @@ if (enable_java_templates) {
if (defined(_dex_path)) {
dex_path =
get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex"
get_label_info(_dex_target, "target_out_dir") + "/bootstrap.dex"
}
native_libs = _native_libs_even_when_incremental
......@@ -3286,7 +3286,7 @@ if (enable_java_templates) {
}
if (_supports_android) {
_dex_path = "$target_gen_dir/$_main_target_name.dex.jar"
_dex_path = "$target_out_dir/$_main_target_name.dex.jar"
if (defined(invoker.dex_path)) {
_dex_path = invoker.dex_path
}
......
......@@ -2144,8 +2144,8 @@ if (enable_java_templates) {
template("android_apk_or_module") {
forward_variables_from(invoker, [ "testonly" ])
assert(defined(invoker.android_manifest))
_gen_dir = "$target_gen_dir/$target_name"
_base_path = "$_gen_dir/$target_name"
_out_dir = "$target_out_dir/$target_name"
_base_path = "$_out_dir/$target_name"
_build_config = "$target_gen_dir/$target_name.build_config"
_build_config_target = "$target_name$build_config_target_suffix"
......@@ -2173,7 +2173,7 @@ if (enable_java_templates) {
_enable_multidex =
!defined(invoker.enable_multidex) || invoker.enable_multidex
_final_dex_path = "$_gen_dir/classes.dex.zip"
_final_dex_path = "$_out_dir/classes.dex.zip"
if (!_is_bundle_module) {
_final_apk_path = invoker.final_apk_path
......@@ -2372,7 +2372,7 @@ if (enable_java_templates) {
defined(invoker.static_library_dependent_targets) && _proguard_enabled
if (_is_static_library_provider) {
_static_library_sync_dex_path =
"$_gen_dir/static_library_synchronized_proguard.classes.dex.zip"
"$_out_dir/static_library_synchronized_proguard.classes.dex.zip"
_resource_ids_provider_deps = []
foreach(_target, invoker.static_library_dependent_targets) {
if (_target.is_resource_ids_provider) {
......
......@@ -58,15 +58,15 @@ proguarded_dist_dex("webapk_runtime_library") {
"//base/android/proguard/chromium_code.flags",
"//base/android/proguard/chromium_apk.flags",
]
output = "$target_gen_dir/$runtime_library_dex_asset_name"
output = "$target_out_dir/$runtime_library_dex_asset_name"
}
android_assets("runtime_library_assets") {
write_file("$target_gen_dir/webapk_dex_version.txt", runtime_library_version)
sources = [
"$target_gen_dir/$runtime_library_dex_asset_name",
"$target_gen_dir/webapk_dex_version.txt",
"$target_out_dir/$runtime_library_dex_asset_name",
]
deps = [
......
......@@ -5,12 +5,12 @@
import("//build/config/android/rules.gni")
android_library("canary_lib_java") {
dex_path = "$target_gen_dir/canary.dex"
dex_path = "$target_out_dir/canary.dex"
java_files = [ "src/org/chromium/webapk/shell_apk/test/canary/Canary.java" ]
}
android_library("canary_lib2_java") {
dex_path = "$target_gen_dir/canary2.dex"
dex_path = "$target_out_dir/canary2.dex"
java_files = [ "src/org/chromium/webapk/shell_apk/test/canary/Canary2.java" ]
}
......@@ -19,7 +19,7 @@ android_library("canary_lib2_java") {
android_assets("canary_dex_assets") {
sources = [
"$target_gen_dir/canary.dex",
"$target_out_dir/canary.dex",
]
disable_compression = true
deps = [
......@@ -29,7 +29,7 @@ android_assets("canary_dex_assets") {
android_assets("canary_dex2_assets") {
sources = [
"$target_gen_dir/canary2.dex",
"$target_out_dir/canary2.dex",
]
disable_compression = true
deps = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment