Commit 8d7f97f4 authored by Peter Wen's avatar Peter Wen Committed by Chromium LUCI CQ

Android: Add more java build configs to depfile

Recursive resource deps is meant for an android_library target to
directly depend on all of its transitive resource deps. A target that
does this also needs to rebuild its build config file when its
transitive java library deps change, since otherwise, if a transitive
resource dep is removed from the build by being removed from the java
target that used to depend on it, the recursive resource target's build
config would be stale and the removed resource would be included in the
final apk/bundle.

Example:

A: Resource dep that turns on recursive_resource_deps.
B: Java library
C: Java library
D: Resource dep

A depends on B depends on C depends on D.

Previously, A's depfile would only contain D.build_config. But if C
removes D as a dependency, and the removal doesn't result in a change
for B.build_config, A.build_config would not be rebuilt, since it only
depends on B.build_config (via direct dep) and D.build_config (via
recursive_resources_deps). Thus entirely missing the change to
C.build_config.

Bug: 1168655
Fixed: 1168655
Change-Id: I500d307802d64ef81099540ebd6fb54f4953c270
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2639227Reviewed-by: default avatarClark DuVall <cduvall@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Auto-Submit: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845762}
parent 2d6fb47d
...@@ -804,7 +804,7 @@ def _DepsFromPaths(dep_paths, ...@@ -804,7 +804,7 @@ def _DepsFromPaths(dep_paths,
current target) that we could then use to get a full transitive dependants current target) that we could then use to get a full transitive dependants
list (eg using Deps#all). So filtering single elements out of this list, list (eg using Deps#all). So filtering single elements out of this list,
filters whole branches of dependencies. By resolving groups (i.e. expanding filters whole branches of dependencies. By resolving groups (i.e. expanding
them to their consituents), depending on a group is equivalent to directly them to their constituents), depending on a group is equivalent to directly
depending on each element of that group. depending on each element of that group.
""" """
blocklist = [] blocklist = []
...@@ -1212,9 +1212,17 @@ def main(argv): ...@@ -1212,9 +1212,17 @@ def main(argv):
build_utils.ParseGnList(options.annotation_processor_configs or ''), build_utils.ParseGnList(options.annotation_processor_configs or ''),
options.type, filter_root_targets=False) options.type, filter_root_targets=False)
all_inputs = sorted( all_inputs = (deps.AllConfigPaths() + processor_deps.AllConfigPaths() +
set(deps.AllConfigPaths() + processor_deps.AllConfigPaths() + list(static_library_dependent_configs_by_path))
list(static_library_dependent_configs_by_path)))
if options.recursive_resource_deps:
# Include java_library targets since changes to these targets can remove
# resource deps from the build, which would require rebuilding this target's
# build config file: crbug.com/1168655.
recursive_java_deps = _DepsFromPathsWithFilters(
GetAllDepsConfigsInOrder(deps_configs_paths),
allowlist=['java_library'])
all_inputs.extend(recursive_java_deps.AllConfigPaths())
direct_deps = deps.Direct() direct_deps = deps.Direct()
system_library_deps = deps.Direct('system_java_library') system_library_deps = deps.Direct('system_java_library')
...@@ -2014,7 +2022,8 @@ def main(argv): ...@@ -2014,7 +2022,8 @@ def main(argv):
build_utils.WriteJson(config, options.build_config, only_if_changed=True) build_utils.WriteJson(config, options.build_config, only_if_changed=True)
if options.depfile: if options.depfile:
build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) build_utils.WriteDepfile(options.depfile, options.build_config,
sorted(set(all_inputs)))
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -4,10 +4,8 @@ Copyright 2019 The Chromium Authors. All rights reserved. ...@@ -4,10 +4,8 @@ Copyright 2019 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. found in the LICENSE file.
--> -->
<!-- Comment out to avoid Android lint failure.
<ripple xmlns:android="http://schemas.android.com/apk/res/android" <ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight"> android:color="?android:attr/colorControlHighlight">
<!-- Mask drawable, not actually rendered. This just keeps the ripple inside the module. --> <!-- Mask drawable, not actually rendered. This just keeps the ripple inside the module. -->
<item android:id="@android:id/mask" android:drawable="@android:color/white"/> <item android:id="@android:id/mask" android:drawable="@android:color/white"/>
</ripple> </ripple>
-->
...@@ -4,7 +4,6 @@ Copyright 2019 The Chromium Authors. All rights reserved. ...@@ -4,7 +4,6 @@ Copyright 2019 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. found in the LICENSE file.
--> -->
<!-- Comment out to avoid Android lint failure.
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="gm_font_weight_regular"> <style name="gm_font_weight_regular">
<item name="android:fontFamily">sans-serif</item> <item name="android:fontFamily">sans-serif</item>
...@@ -21,4 +20,3 @@ found in the LICENSE file. ...@@ -21,4 +20,3 @@ found in the LICENSE file.
<item name="android:textAlignment">viewStart</item> <item name="android:textAlignment">viewStart</item>
</style> </style>
</resources> </resources>
-->
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