Create install rule for loadplugins without adding to blueprint_tools
m checkbuild --soong-only currently runs into errors for "Test for
dangling rules" since the install rule for loadplugins is not created in
`m --soong-only`. In regular `m` builds kati generates the installation
rule since `LOCAL_SOONG_INSTALLED_MODULE` for `loadplugins` is empty in
the generated Android.mk file.
To solve the missing rule in soong-only mode, always generate the
installation rule.
To prevent repeated reanalysis in `m`, do not add the installed file to
`blueprint_tools`, which is a transitive dep of droid via droid_targets.
Bug: 394096939
Test: m blueprint_tools && m blueprint_tools (second one is noop)
Test: m checkbuild --soong-only (passes at top of stack)
Change-Id: I202bb2fa31543f8e3acbe11a4732f6236cd3b71f
diff --git a/golang/golang.go b/golang/golang.go
index d33f5e0..3422f8b 100644
--- a/golang/golang.go
+++ b/golang/golang.go
@@ -97,17 +97,16 @@
outputFile := android.PathForArbitraryOutput(ctx, android.Rel(ctx, ctx.Config().OutDir(), g.IntermediateFile())).WithoutRel()
g.outputFile = outputFile
- // Don't create install rules for modules used by bootstrap, the install command line will differ from
- // what was used during bootstrap, which will cause ninja to rebuild the module on the next run,
- // triggering reanalysis.
- if !usedByBootstrap(ctx.ModuleName()) {
- installPath := ctx.InstallFile(android.PathForModuleInstall(ctx, "bin"), ctx.ModuleName(), outputFile)
+ installPath := ctx.InstallFile(android.PathForModuleInstall(ctx, "bin"), ctx.ModuleName(), outputFile)
- // Modules in an unexported namespace have no install rule, only add modules in the exported namespaces
- // to the blueprint_tools phony rules.
- if !ctx.Config().KatiEnabled() || g.ExportedToMake() {
- ctx.Phony("blueprint_tools", installPath)
- }
+ // Modules in an unexported namespace have no install rule, only add modules in the exported namespaces
+ // to the blueprint_tools phony rules.
+ if (!ctx.Config().KatiEnabled() || g.ExportedToMake()) && !usedByBootstrap(ctx.ModuleName()) {
+ // Don't add the installed file of bootstrap tools to the deps of `blueprint_tools`.
+ // The install command line will differ from what was used during bootstrap,
+ // which will cause ninja to rebuild the module on the next run,
+ // triggering reanalysis.
+ ctx.Phony("blueprint_tools", installPath)
}
ctx.SetOutputFiles(android.Paths{outputFile}, "")