Reland "Migrate buildinfo.sh script into Soong"
To build system.img in Soong, we need all artifacts including
build.prop. This fully migrates buildinfo.prop file into Soong as a
first step to build build.prop on Soong.
This fixes an error caused by an incorrect path to build thumbprint
file.
Bug: 322090587
Test: compare build.prop before and after
Test: build multiple times and see build.prop isn't rebuilt
Change-Id: Id4fa830009538856c30825ff47268b11fa6cb5d6
diff --git a/android/config.go b/android/config.go
index 10c30d4..2ee3b93 100644
--- a/android/config.go
+++ b/android/config.go
@@ -114,6 +114,8 @@
GenerateDocFile
)
+const testKeyDir = "build/make/target/product/security"
+
// SoongOutDir returns the build output directory for the configuration.
func (c Config) SoongOutDir() string {
return c.soongOutDir
@@ -841,6 +843,10 @@
return String(c.productVariables.BuildId)
}
+func (c *config) DisplayBuildNumber() bool {
+ return Bool(c.productVariables.DisplayBuildNumber)
+}
+
// BuildNumberFile returns the path to a text file containing metadata
// representing the current build's number.
//
@@ -852,6 +858,23 @@
return PathForOutput(ctx, String(c.productVariables.BuildNumberFile))
}
+// BuildHostnameFile returns the path to a text file containing metadata
+// representing the current build's host name.
+func (c *config) BuildHostnameFile(ctx PathContext) Path {
+ return PathForOutput(ctx, String(c.productVariables.BuildHostnameFile))
+}
+
+// BuildThumbprintFile returns the path to a text file containing metadata
+// representing the current build's thumbprint.
+//
+// Rules that want to reference the build thumbprint should read from this file
+// without depending on it. They will run whenever their other dependencies
+// require them to run and get the current build thumbprint. This ensures they
+// don't rebuild on every incremental build when the build thumbprint changes.
+func (c *config) BuildThumbprintFile(ctx PathContext) Path {
+ return PathForArbitraryOutput(ctx, "target", "product", c.DeviceName(), String(c.productVariables.BuildThumbprintFile))
+}
+
// DeviceName returns the name of the current device target.
// TODO: take an AndroidModuleContext to select the device name for multi-device builds
func (c *config) DeviceName() string {
@@ -873,6 +896,10 @@
return c.productVariables.DeviceProduct != nil
}
+func (c *config) DeviceAbi() []string {
+ return c.productVariables.DeviceAbi
+}
+
func (c *config) DeviceResourceOverlays() []string {
return c.productVariables.DeviceResourceOverlays
}
@@ -881,6 +908,10 @@
return c.productVariables.ProductResourceOverlays
}
+func (c *config) PlatformDisplayVersionName() string {
+ return String(c.productVariables.Platform_display_version_name)
+}
+
func (c *config) PlatformVersionName() string {
return String(c.productVariables.Platform_version_name)
}
@@ -1038,7 +1069,7 @@
if defaultCert != "" {
return PathForSource(ctx, filepath.Dir(defaultCert))
}
- return PathForSource(ctx, "build/make/target/product/security")
+ return PathForSource(ctx, testKeyDir)
}
func (c *config) DefaultAppCertificate(ctx PathContext) (pem, key SourcePath) {
@@ -1050,10 +1081,18 @@
return defaultDir.Join(ctx, "testkey.x509.pem"), defaultDir.Join(ctx, "testkey.pk8")
}
+func (c *config) BuildKeys() string {
+ defaultCert := String(c.productVariables.DefaultAppCertificate)
+ if defaultCert == "" || defaultCert == filepath.Join(testKeyDir, "testkey") {
+ return "test-keys"
+ }
+ return "dev-keys"
+}
+
func (c *config) ApexKeyDir(ctx ModuleContext) SourcePath {
// TODO(b/121224311): define another variable such as TARGET_APEX_KEY_OVERRIDE
defaultCert := String(c.productVariables.DefaultAppCertificate)
- if defaultCert == "" || filepath.Dir(defaultCert) == "build/make/target/product/security" {
+ if defaultCert == "" || filepath.Dir(defaultCert) == testKeyDir {
// When defaultCert is unset or is set to the testkeys path, use the APEX keys
// that is under the module dir
return pathForModuleSrc(ctx)
@@ -1112,6 +1151,10 @@
return Bool(c.productVariables.Eng)
}
+func (c *config) BuildType() string {
+ return String(c.productVariables.BuildType)
+}
+
// DevicePrimaryArchType returns the ArchType for the first configured device architecture, or
// Common if there are no device architectures.
func (c *config) DevicePrimaryArchType() ArchType {
@@ -2086,3 +2129,19 @@
func (c *config) BuildIgnoreApexContributionContents() []string {
return c.productVariables.BuildIgnoreApexContributionContents
}
+
+func (c *config) ProductLocales() []string {
+ return c.productVariables.ProductLocales
+}
+
+func (c *config) ProductDefaultWifiChannels() []string {
+ return c.productVariables.ProductDefaultWifiChannels
+}
+
+func (c *config) BoardUseVbmetaDigestInFingerprint() bool {
+ return Bool(c.productVariables.BoardUseVbmetaDigestInFingerprint)
+}
+
+func (c *config) OemProperties() []string {
+ return c.productVariables.OemProperties
+}