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
This commit is contained in:
Cole Faust 2024-06-06 14:39:32 -07:00
parent 4eef64a70b
commit 89b4d18ba1

View file

@ -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 {