Rename build.ninja with product name

Current build.ninja does not contain any product name, while other ninja
files (such as combined ninja) do. This change adds product name to the
build.ninja so it can be separated over multiple lunch targets

Bug: 277029044
Test: build succeeded and checked if out/soong/build.ninja has been
renamed

Change-Id: I16dc71f829fd76f01b98da0d509a8e0ef6f62fa9
This commit is contained in:
Kiyoung Kim
2023-04-19 13:13:45 +09:00
parent 03cd59b723
commit a37d9baa96
4 changed files with 91 additions and 35 deletions

View File

@@ -1229,6 +1229,13 @@ func (c *configImpl) TargetProduct() string {
panic("TARGET_PRODUCT is not defined")
}
func (c *configImpl) TargetProductOrErr() (string, error) {
if v, ok := c.environ.Get("TARGET_PRODUCT"); ok {
return v, nil
}
return "", fmt.Errorf("TARGET_PRODUCT is not defined")
}
func (c *configImpl) TargetDevice() string {
return c.targetDevice
}
@@ -1554,11 +1561,21 @@ func (c *configImpl) KatiPackageNinjaFile() string {
}
func (c *configImpl) SoongVarsFile() string {
return filepath.Join(c.SoongOutDir(), "soong.variables")
targetProduct, err := c.TargetProductOrErr()
if err != nil {
return filepath.Join(c.SoongOutDir(), "soong.variables")
} else {
return filepath.Join(c.SoongOutDir(), "soong."+targetProduct+".variables")
}
}
func (c *configImpl) SoongNinjaFile() string {
return filepath.Join(c.SoongOutDir(), "build.ninja")
targetProduct, err := c.TargetProductOrErr()
if err != nil {
return filepath.Join(c.SoongOutDir(), "build.ninja")
} else {
return filepath.Join(c.SoongOutDir(), "build."+targetProduct+".ninja")
}
}
func (c *configImpl) CombinedNinjaFile() string {