From 89b4d18ba1547b5c09da03e9d89eb2af4b223437 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Thu, 6 Jun 2024 14:39:32 -0700 Subject: [PATCH] Make buildinfo_prop depend on build number file buildinfo.prop should be rebuilt when the build number file changes, because it needs to contain the up to date build number as well. When this was implemented in make, that dependency was added. But when we converted it to soong, it was removed. (aosp/3015794 and aosp/3015818) Fixes: 332733525 Test: m out/target/product/emu64x/obj/ETC/buildinfo.prop_intermediates/buildinfo.prop repeatedly, see that it rebuilds Change-Id: Ife9bfa7d48f2578984761f0a78eda3513b324298 --- android/buildinfo_prop.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/android/buildinfo_prop.go b/android/buildinfo_prop.go index 8288fc555..e84aec21a 100644 --- a/android/buildinfo_prop.go +++ b/android/buildinfo_prop.go @@ -111,10 +111,11 @@ func (p *buildinfoPropModule) GenerateAndroidBuildActions(ctx ModuleContext) { cmd.FlagWithArg("--build-id=", config.BuildId()) cmd.FlagWithArg("--build-keys=", config.BuildKeys()) - // shouldn't depend on BuildNumberFile and BuildThumbprintFile to prevent from rebuilding - // on every incremental build. - cmd.FlagWithArg("--build-number-file=", config.BuildNumberFile(ctx).String()) + // Note: depending on BuildNumberFile will cause the build.prop file to be rebuilt + // every build, but that's intentional. + cmd.FlagWithInput("--build-number-file=", config.BuildNumberFile(ctx)) if shouldAddBuildThumbprint(config) { + // In the previous make implementation, a dependency was not added on the thumbprint file cmd.FlagWithArg("--build-thumbprint-file=", config.BuildThumbprintFile(ctx).String()) } @@ -123,8 +124,10 @@ func (p *buildinfoPropModule) GenerateAndroidBuildActions(ctx ModuleContext) { cmd.FlagWithArg("--build-variant=", buildVariant) cmd.FlagForEachArg("--cpu-abis=", config.DeviceAbi()) - // shouldn't depend on BUILD_DATETIME_FILE to prevent from rebuilding on every incremental - // build. + // Technically we should also have a dependency on BUILD_DATETIME_FILE, + // but it can be either an absolute or relative path, which is hard to turn into + // a Path object. So just rely on the BuildNumberFile always changing to cause + // us to rebuild. cmd.FlagWithArg("--date-file=", ctx.Config().Getenv("BUILD_DATETIME_FILE")) if len(config.ProductLocales()) > 0 {