From 4b69c497da6bfc3c4f6c5fa050da3fdd4a604f47 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 7 Jun 2019 13:06:06 -0700 Subject: [PATCH 1/2] Add implicit outputs to ErrorRule rules When building with ALLOW_MISSING_DEPENDENCIES=true, Soong replaces rules in modules that have missing dependencies with ErrorRule rules that print an error. The ErrorRules were not listing implicit outputs, which could lead to dangling dependencies. Test: manual Change-Id: Ife1604c0a9a1159087b12568fd4c2b69517d81a7 --- android/module.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/android/module.go b/android/module.go index 03993e519..87e2ca7d9 100644 --- a/android/module.go +++ b/android/module.go @@ -966,10 +966,12 @@ type moduleContext struct { func (m *moduleContext) ninjaError(params BuildParams, err error) (PackageContext, BuildParams) { return pctx, BuildParams{ - Rule: ErrorRule, - Description: params.Description, - Output: params.Output, - Outputs: params.Outputs, + Rule: ErrorRule, + Description: params.Description, + Output: params.Output, + Outputs: params.Outputs, + ImplicitOutput: params.ImplicitOutput, + ImplicitOutputs: params.ImplicitOutputs, Args: map[string]string{ "error": err.Error(), }, From 3245b2cb83342fa162822832d0d9adde2f0c5bed Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 7 Jun 2019 13:18:09 -0700 Subject: [PATCH 2/2] Don't add dependencies on uses-library modules in unbundled builds Unbundled builds may not have definitions of shared libraries, and they are not dexpreopted so the dependencies are not used anyways. Test: manual Change-Id: I89ad92f3b073422734f824ac3a8a3b9baf995ccb --- java/app.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/java/app.go b/java/app.go index cf9354f57..78e05012c 100644 --- a/java/app.go +++ b/java/app.go @@ -938,16 +938,18 @@ type usesLibrary struct { } func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, noFrameworkLibs bool) { - ctx.AddVariationDependencies(nil, usesLibTag, u.usesLibraryProperties.Uses_libs...) - ctx.AddVariationDependencies(nil, usesLibTag, u.presentOptionalUsesLibs(ctx)...) - if !noFrameworkLibs { - // dexpreopt/dexpreopt.go needs the paths to the dex jars of these libraries in case construct_context.sh needs - // to pass them to dex2oat. Add them as a dependency so we can determine the path to the dex jar of each - // library to dexpreopt. - ctx.AddVariationDependencies(nil, usesLibTag, - "org.apache.http.legacy", - "android.hidl.base-V1.0-java", - "android.hidl.manager-V1.0-java") + if !ctx.Config().UnbundledBuild() { + ctx.AddVariationDependencies(nil, usesLibTag, u.usesLibraryProperties.Uses_libs...) + ctx.AddVariationDependencies(nil, usesLibTag, u.presentOptionalUsesLibs(ctx)...) + if !noFrameworkLibs { + // dexpreopt/dexpreopt.go needs the paths to the dex jars of these libraries in case construct_context.sh needs + // to pass them to dex2oat. Add them as a dependency so we can determine the path to the dex jar of each + // library to dexpreopt. + ctx.AddVariationDependencies(nil, usesLibTag, + "org.apache.http.legacy", + "android.hidl.base-V1.0-java", + "android.hidl.manager-V1.0-java") + } } }