From 7613bd1929057a0da89f4c85ca6506ea98869286 Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Mon, 3 Feb 2025 23:17:22 +0000 Subject: 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 --- golang/golang.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'golang') diff --git a/golang/golang.go b/golang/golang.go index d33f5e050..3422f8bdf 100644 --- a/golang/golang.go +++ b/golang/golang.go @@ -97,17 +97,16 @@ func (g *GoBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) { 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) - - // 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) - } + 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()) && !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}, "") -- cgit v1.2.3-59-g8ed1b