Merge "Fix check-boot-jars when a boot jar is provided by prebuilt"
diff --git a/android/config.go b/android/config.go
index a53f44a..b906108 100644
--- a/android/config.go
+++ b/android/config.go
@@ -712,10 +712,17 @@
return Bool(c.productVariables.Allow_missing_dependencies)
}
+// Returns true if building without full platform sources.
func (c *config) UnbundledBuild() bool {
return Bool(c.productVariables.Unbundled_build)
}
+// Returns true if building apps that aren't bundled with the platform.
+// UnbundledBuild() is always true when this is true.
+func (c *config) UnbundledBuildApps() bool {
+ return Bool(c.productVariables.Unbundled_build_apps)
+}
+
func (c *config) UnbundledBuildUsePrebuiltSdks() bool {
return Bool(c.productVariables.Unbundled_build) && !Bool(c.productVariables.Unbundled_build_sdks_from_source)
}
diff --git a/android/variable.go b/android/variable.go
index 863fe5a..b2149c3 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -216,6 +216,7 @@
Allow_missing_dependencies *bool `json:",omitempty"`
Unbundled_build *bool `json:",omitempty"`
+ Unbundled_build_apps *bool `json:",omitempty"`
Unbundled_build_sdks_from_source *bool `json:",omitempty"`
Malloc_not_svelte *bool `json:",omitempty"`
Malloc_zero_contents *bool `json:",omitempty"`
diff --git a/cc/sdk.go b/cc/sdk.go
index a6f94af..b68baad 100644
--- a/cc/sdk.go
+++ b/cc/sdk.go
@@ -41,7 +41,7 @@
modules[0].(*Module).Properties.Sdk_version = nil
modules[1].(*Module).Properties.IsSdkVariant = true
- if ctx.Config().UnbundledBuild() {
+ if ctx.Config().UnbundledBuildApps() {
modules[0].(*Module).Properties.HideFromMake = true
modules[0].(*Module).Properties.PreventInstall = true
} else {
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index d6eb008..df6d79d 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -35,6 +35,7 @@
android.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
android.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
android.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
+ android.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory)
}
type prebuiltEtcProperties struct {
@@ -293,3 +294,15 @@
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
return module
}
+
+// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image.
+// If soc_specific property is set to true, the DSP related file is installed to the vendor <partition>/dsp
+// directory for vendor image.
+func PrebuiltDSPFactory() android.Module {
+ module := &PrebuiltEtc{}
+ module.socInstallDirBase = "dsp"
+ InitPrebuiltEtcModule(module, "etc/dsp")
+ // This module is device-only
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
+ return module
+}
diff --git a/etc/prebuilt_etc_test.go b/etc/prebuilt_etc_test.go
index e13cb3c..4ce1984 100644
--- a/etc/prebuilt_etc_test.go
+++ b/etc/prebuilt_etc_test.go
@@ -65,6 +65,7 @@
ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
+ ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory)
ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
android.FailIfErrored(t, errs)
@@ -281,3 +282,39 @@
})
}
}
+
+func TestPrebuiltDSPDirPath(t *testing.T) {
+ targetPath := filepath.Join(buildDir, "/target/product/test_device")
+ tests := []struct {
+ description string
+ config string
+ expectedPath string
+ }{{
+ description: "prebuilt: system dsp",
+ config: `
+ prebuilt_dsp {
+ name: "foo.conf",
+ src: "foo.conf",
+ }`,
+ expectedPath: filepath.Join(targetPath, "system/etc/dsp"),
+ }, {
+ description: "prebuilt: vendor dsp",
+ config: `
+ prebuilt_dsp {
+ name: "foo.conf",
+ src: "foo.conf",
+ soc_specific: true,
+ sub_dir: "sub_dir",
+ }`,
+ expectedPath: filepath.Join(targetPath, "vendor/dsp/sub_dir"),
+ }}
+ for _, tt := range tests {
+ t.Run(tt.description, func(t *testing.T) {
+ ctx, _ := testPrebuiltEtc(t, tt.config)
+ p := ctx.ModuleForTests("foo.conf", "android_arm64_armv8-a").Module().(*PrebuiltEtc)
+ if p.installDirPath.String() != tt.expectedPath {
+ t.Errorf("expected %q, got %q", tt.expectedPath, p.installDirPath)
+ }
+ })
+ }
+}
diff --git a/rust/builder.go b/rust/builder.go
index 5069b07..7dbb59d 100644
--- a/rust/builder.go
+++ b/rust/builder.go
@@ -163,7 +163,7 @@
if flags.Coverage {
var gcnoFile android.WritablePath
// Provide consistency with cc gcda output, see cc/builder.go init()
- profileEmitArg := strings.TrimPrefix("PWD=", cc.PwdPrefix()) + "/"
+ profileEmitArg := strings.TrimPrefix(cc.PwdPrefix(), "PWD=") + "/"
if outputFile.Ext() != "" {
gcnoFile = android.PathForModuleOut(ctx, pathtools.ReplaceExtension(outputFile.Base(), "gcno"))