summaryrefslogtreecommitdiff
path: root/java/base.go
diff options
context:
space:
mode:
author Jared Duke <jdduke@google.com> 2025-03-10 23:03:00 +0000
committer Jared Duke <jdduke@google.com> 2025-03-11 22:40:57 +0000
commit0ac6ae721d7400e0f5fa6d03f08eca63412390cc (patch)
tree4a3816f5e69ef46b4fa2a887a452180b728e3056 /java/base.go
parent6a3b2d08fdef380fbced31156e27dea01d35ccd2 (diff)
Add a trace_references_from dex optimization property
Introduce a new property `trace_references_from` in the optimize block. This field allows specifying a set of downstream targets from which to trace references when optimizing the current target. In practice, this requires explicit breaking of any cycles that might occur. A follow-up effort will explore doing this dynamically and implicitly for `libs` references onto an optimized target that enables this feature. Bug: 212737576 Test: m nothing Test: go test ./java Flag: EXEMPT bugfix Change-Id: I088bd8bf89403661a084a43b2822a6efbbc0294d
Diffstat (limited to 'java/base.go')
-rw-r--r--java/base.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/java/base.go b/java/base.go
index 0833831fc..d49a9bc49 100644
--- a/java/base.go
+++ b/java/base.go
@@ -888,6 +888,10 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
// Add dependency on libraries that provide additional hidden api annotations.
ctx.AddVariationDependencies(nil, hiddenApiAnnotationsTag, j.properties.Hiddenapi_additional_annotations...)
+ // Add dependency on (soft) downstream libs from which to trace references during optimization.
+ traceRefs := j.dexProperties.Optimize.Trace_references_from.GetOrDefault(ctx, []string{})
+ ctx.AddVariationDependencies(nil, traceReferencesTag, traceRefs...)
+
// For library dependencies that are component libraries (like stubs), add the implementation
// as a dependency (dexpreopt needs to be against the implementation library, not stubs).
for _, dep := range libDeps {