Merge "Fix typo in bp2build denylist."
diff --git a/android/androidmk.go b/android/androidmk.go
index 4f6e24c..72b6584 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -518,7 +518,7 @@
a.AddStrings("LOCAL_TARGET_REQUIRED_MODULES", a.Target_required...)
// If the install rule was generated by Soong tell Make about it.
- if amod.InstallBypassMake() && len(base.katiInstalls) > 0 {
+ if len(base.katiInstalls) > 0 {
// Assume the primary install file is last since it probably needs to depend on any other
// installed files. If that is not the case we can add a method to specify the primary
// installed file.
diff --git a/android/config.go b/android/config.go
index 5d90fd2..5c0e5ae 100644
--- a/android/config.go
+++ b/android/config.go
@@ -569,9 +569,6 @@
func (c *config) HostToolPath(ctx PathContext, tool string) Path {
path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false, tool)
- if ctx.Config().KatiEnabled() {
- path = path.ToMakePath()
- }
return path
}
@@ -581,17 +578,11 @@
ext = ".dylib"
}
path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "lib64", false, lib+ext)
- if ctx.Config().KatiEnabled() {
- path = path.ToMakePath()
- }
return path
}
func (c *config) HostJavaToolPath(ctx PathContext, tool string) Path {
path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "framework", false, tool)
- if ctx.Config().KatiEnabled() {
- path = path.ToMakePath()
- }
return path
}
@@ -667,6 +658,10 @@
return value == "0" || value == "n" || value == "no" || value == "off" || value == "false"
}
+func (c *config) TargetsJava11() bool {
+ return c.IsEnvTrue("EXPERIMENTAL_TARGET_JAVA_VERSION_11")
+}
+
// EnvDeps returns the environment variables this build depends on. The first
// call to this function blocks future reads from the environment.
func (c *config) EnvDeps() map[string]string {
@@ -1485,6 +1480,22 @@
return c.config.productVariables.BoardReqdMaskPolicy
}
+func (c *deviceConfig) BoardSystemExtPublicPrebuiltDirs() []string {
+ return c.config.productVariables.BoardSystemExtPublicPrebuiltDirs
+}
+
+func (c *deviceConfig) BoardSystemExtPrivatePrebuiltDirs() []string {
+ return c.config.productVariables.BoardSystemExtPrivatePrebuiltDirs
+}
+
+func (c *deviceConfig) BoardProductPublicPrebuiltDirs() []string {
+ return c.config.productVariables.BoardProductPublicPrebuiltDirs
+}
+
+func (c *deviceConfig) BoardProductPrivatePrebuiltDirs() []string {
+ return c.config.productVariables.BoardProductPrivatePrebuiltDirs
+}
+
func (c *deviceConfig) DirectedVendorSnapshot() bool {
return c.config.productVariables.DirectedVendorSnapshot
}
@@ -1698,7 +1709,7 @@
}
// Append a list of (apex, jar) pairs to the list.
-func (l *ConfiguredJarList) AppendList(other ConfiguredJarList) ConfiguredJarList {
+func (l *ConfiguredJarList) AppendList(other *ConfiguredJarList) ConfiguredJarList {
apexes := make([]string, 0, l.Len()+other.Len())
jars := make([]string, 0, l.Len()+other.Len())
diff --git a/android/module.go b/android/module.go
index c479b59..6de4165 100644
--- a/android/module.go
+++ b/android/module.go
@@ -429,7 +429,6 @@
InstallInRecovery() bool
InstallInRoot() bool
InstallInVendor() bool
- InstallBypassMake() bool
InstallForceOS() (*OsType, *ArchType)
RequiredModuleNames() []string
@@ -496,7 +495,6 @@
InstallInRecovery() bool
InstallInRoot() bool
InstallInVendor() bool
- InstallBypassMake() bool
InstallForceOS() (*OsType, *ArchType)
HideFromMake()
IsHideFromMake() bool
@@ -1704,10 +1702,6 @@
return false
}
-func (m *ModuleBase) InstallBypassMake() bool {
- return true
-}
-
func (m *ModuleBase) InstallForceOS() (*OsType, *ArchType) {
return nil, nil
}
@@ -2829,10 +2823,6 @@
return m.module.InstallInRoot()
}
-func (m *moduleContext) InstallBypassMake() bool {
- return m.module.InstallBypassMake()
-}
-
func (m *moduleContext) InstallForceOS() (*OsType, *ArchType) {
return m.module.InstallForceOS()
}
@@ -2857,12 +2847,6 @@
return true
}
- if m.Device() {
- if m.Config().KatiEnabled() && !m.InstallBypassMake() {
- return true
- }
- }
-
return false
}
@@ -2921,7 +2905,7 @@
orderOnlyDeps = deps
}
- if m.Config().KatiEnabled() && m.InstallBypassMake() {
+ if m.Config().KatiEnabled() {
// When creating the install rule in Soong but embedding in Make, write the rule to a
// makefile instead of directly to the ninja file so that main.mk can add the
// dependencies from the `required` property that are hard to resolve in Soong.
@@ -2980,7 +2964,7 @@
}
if !m.skipInstall() {
- if m.Config().KatiEnabled() && m.InstallBypassMake() {
+ if m.Config().KatiEnabled() {
// When creating the symlink rule in Soong but embedding in Make, write the rule to a
// makefile instead of directly to the ninja file so that main.mk can add the
// dependencies from the `required` property that are hard to resolve in Soong.
@@ -3026,7 +3010,7 @@
m.module.base().hooks.runInstallHooks(m, nil, fullInstallPath, true)
if !m.skipInstall() {
- if m.Config().KatiEnabled() && m.InstallBypassMake() {
+ if m.Config().KatiEnabled() {
// When creating the symlink rule in Soong but embedding in Make, write the rule to a
// makefile instead of directly to the ninja file so that main.mk can add the
// dependencies from the `required` property that are hard to resolve in Soong.
diff --git a/android/module_test.go b/android/module_test.go
index 8607a8d..d9e2c87 100644
--- a/android/module_test.go
+++ b/android/module_test.go
@@ -204,10 +204,6 @@
}
}
-func (m *depsModule) InstallBypassMake() bool {
- return true
-}
-
func (m *depsModule) GenerateAndroidBuildActions(ctx ModuleContext) {
outputFile := PathForModuleOut(ctx, ctx.ModuleName())
ctx.Build(pctx, BuildParams{
@@ -450,7 +446,7 @@
assertOrderOnlys(symlinkRule("foo"))
}
-func TestInstallBypassMake(t *testing.T) {
+func TestInstallKatiEnabled(t *testing.T) {
if runtime.GOOS != "linux" {
t.Skip("requires linux")
}
diff --git a/android/paths.go b/android/paths.go
index e68106c..70e427b 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -112,7 +112,6 @@
InstallInDebugRamdisk() bool
InstallInRecovery() bool
InstallInRoot() bool
- InstallBypassMake() bool
InstallForceOS() (*OsType, *ArchType)
}
@@ -465,9 +464,6 @@
// PathForGoBinary returns the path to the installed location of a bootstrap_go_binary module.
func PathForGoBinary(ctx PathContext, goBinary bootstrap.GoBinaryTool) Path {
goBinaryInstallDir := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false)
- if ctx.Config().KatiEnabled() {
- goBinaryInstallDir = goBinaryInstallDir.ToMakePath()
- }
rel := Rel(ctx, goBinaryInstallDir.String(), goBinary.InstallPath())
return goBinaryInstallDir.Join(ctx, rel)
}
@@ -1646,8 +1642,8 @@
return p
}
-// ToMakePath returns a new InstallPath that points to Make's install directory instead of Soong's,
-// i.e. out/ instead of out/soong/.
+// Deprecated: ToMakePath is a noop, PathForModuleInstall always returns Make paths when building
+// embedded in Make.
func (p InstallPath) ToMakePath() InstallPath {
p.makePath = true
return p
@@ -1688,9 +1684,6 @@
func makePathForInstall(ctx ModuleInstallPathContext, os OsType, arch ArchType, partition string, debug bool, pathComponents ...string) InstallPath {
ret := pathForInstall(ctx, os, arch, partition, debug, pathComponents...)
- if ctx.InstallBypassMake() && ctx.Config().KatiEnabled() {
- ret = ret.ToMakePath()
- }
return ret
}
@@ -1732,7 +1725,10 @@
soongOutDir: ctx.Config().soongOutDir,
partitionDir: partionPath,
partition: partition,
- makePath: false,
+ }
+
+ if ctx.Config().KatiEnabled() {
+ base.makePath = true
}
return base.Join(ctx, pathComponents...)
@@ -2008,10 +2004,6 @@
return m.inRoot
}
-func (m testModuleInstallPathContext) InstallBypassMake() bool {
- return false
-}
-
func (m testModuleInstallPathContext) InstallForceOS() (*OsType, *ArchType) {
return m.forceOS, m.forceArch
}
diff --git a/android/paths_test.go b/android/paths_test.go
index 3cad852..2f87977 100644
--- a/android/paths_test.go
+++ b/android/paths_test.go
@@ -1486,7 +1486,8 @@
AssertPathRelativeToTopEquals(t, "install path for soong", "out/soong/target/product/test_device/system/install/path", p)
})
t.Run("install for make", func(t *testing.T) {
- p := PathForModuleInstall(ctx, "install/path").ToMakePath()
+ p := PathForModuleInstall(ctx, "install/path")
+ p.makePath = true
AssertPathRelativeToTopEquals(t, "install path for make", "out/target/product/test_device/system/install/path", p)
})
t.Run("output", func(t *testing.T) {
@@ -1500,14 +1501,12 @@
t.Run("mixture", func(t *testing.T) {
paths := Paths{
PathForModuleInstall(ctx, "install/path"),
- PathForModuleInstall(ctx, "install/path").ToMakePath(),
PathForOutput(ctx, "output/path"),
PathForSource(ctx, "source/path"),
}
expected := []string{
"out/soong/target/product/test_device/system/install/path",
- "out/target/product/test_device/system/install/path",
"out/soong/output/path",
"source/path",
}
diff --git a/android/rule_builder.go b/android/rule_builder.go
index f8de5fb..1c6b1c0 100644
--- a/android/rule_builder.go
+++ b/android/rule_builder.go
@@ -839,14 +839,6 @@
// The tool is in the Soong output directory, it will be copied to __SBOX_OUT_DIR__/tools/out
return filepath.Join(sboxToolsSubDir, "out", relOutSoong)
}
- if ctx.Config().KatiEnabled() {
- toolDir = toolDir.ToMakePath()
- relOut, isRelOut, _ := maybeRelErr(toolDir.String(), path.String())
- if isRelOut {
- // The tool is in the Make output directory, it will be copied to __SBOX_OUT_DIR__/tools/out
- return filepath.Join(sboxToolsSubDir, "out", relOut)
- }
- }
// The tool is in the source directory, it will be copied to __SBOX_OUT_DIR__/tools/src
return filepath.Join(sboxToolsSubDir, "src", path.String())
}
diff --git a/android/test_suites.go b/android/test_suites.go
index 22f6cf2..55e1da7 100644
--- a/android/test_suites.go
+++ b/android/test_suites.go
@@ -60,7 +60,7 @@
for _, module := range SortedStringKeys(files) {
installedPaths = append(installedPaths, files[module]...)
}
- testCasesDir := pathForInstall(ctx, ctx.Config().BuildOS, X86, "testcases", false).ToMakePath()
+ testCasesDir := pathForInstall(ctx, ctx.Config().BuildOS, X86, "testcases", false)
outputFile := PathForOutput(ctx, "packaging", "robolectric-tests.zip")
rule := NewRuleBuilder(pctx, ctx)
diff --git a/android/variable.go b/android/variable.go
index a7068108..bc93835 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -344,13 +344,17 @@
RecoverySnapshotDirsIncluded []string `json:",omitempty"`
HostFakeSnapshotEnabled bool `json:",omitempty"`
- BoardVendorSepolicyDirs []string `json:",omitempty"`
- BoardOdmSepolicyDirs []string `json:",omitempty"`
- BoardReqdMaskPolicy []string `json:",omitempty"`
- BoardPlatVendorPolicy []string `json:",omitempty"`
- SystemExtPublicSepolicyDirs []string `json:",omitempty"`
- SystemExtPrivateSepolicyDirs []string `json:",omitempty"`
- BoardSepolicyM4Defs []string `json:",omitempty"`
+ BoardVendorSepolicyDirs []string `json:",omitempty"`
+ BoardOdmSepolicyDirs []string `json:",omitempty"`
+ BoardReqdMaskPolicy []string `json:",omitempty"`
+ BoardPlatVendorPolicy []string `json:",omitempty"`
+ BoardSystemExtPublicPrebuiltDirs []string `json:",omitempty"`
+ BoardSystemExtPrivatePrebuiltDirs []string `json:",omitempty"`
+ BoardProductPublicPrebuiltDirs []string `json:",omitempty"`
+ BoardProductPrivatePrebuiltDirs []string `json:",omitempty"`
+ SystemExtPublicSepolicyDirs []string `json:",omitempty"`
+ SystemExtPrivateSepolicyDirs []string `json:",omitempty"`
+ BoardSepolicyM4Defs []string `json:",omitempty"`
BoardSepolicyVers *string `json:",omitempty"`
PlatformSepolicyVersion *string `json:",omitempty"`
diff --git a/androidmk/androidmk/android.go b/androidmk/androidmk/android.go
index 1045ca6..ae52688 100644
--- a/androidmk/androidmk/android.go
+++ b/androidmk/androidmk/android.go
@@ -229,6 +229,8 @@
"LOCAL_IS_UNIT_TEST": "unit_test",
"LOCAL_ENFORCE_USES_LIBRARIES": "enforce_uses_libs",
+
+ "LOCAL_CHECK_ELF_FILES": "check_elf_files",
})
}
diff --git a/androidmk/androidmk/androidmk_test.go b/androidmk/androidmk/androidmk_test.go
index a2d6992..ea53705 100644
--- a/androidmk/androidmk/androidmk_test.go
+++ b/androidmk/androidmk/androidmk_test.go
@@ -1566,6 +1566,25 @@
}
`,
},
+ {
+ desc: "LOCAL_CHECK_ELF_FILES",
+ in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo
+LOCAL_SRC_FILES := test.c
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_CHECK_ELF_FILES := false
+include $(BUILD_PREBUILT)
+ `,
+ expected: `
+cc_prebuilt_library_shared {
+ name: "foo",
+ srcs: ["test.c"],
+
+ check_elf_files: false,
+}
+`,
+ },
}
func TestEndToEnd(t *testing.T) {
diff --git a/apex/androidmk.go b/apex/androidmk.go
index f001fa2..8cca137 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -149,7 +149,7 @@
var modulePath string
if apexType == flattenedApex {
// /system/apex/<name>/{lib|framework|...}
- modulePath = filepath.Join(a.installDir.ToMakePath().String(), apexBundleName, fi.installDir)
+ modulePath = filepath.Join(a.installDir.String(), apexBundleName, fi.installDir)
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
if a.primaryApexType && !symbolFilesNotNeeded {
fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathWhenActivated)
@@ -362,7 +362,7 @@
data.Entries.WriteLicenseVariables(w)
fmt.Fprintln(w, "LOCAL_MODULE_CLASS := ETC") // do we need a new class?
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", a.outputFile.String())
- fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", a.installDir.ToMakePath().String())
+ fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", a.installDir.String())
stemSuffix := apexType.suffix()
if a.isCompressed {
stemSuffix = imageCapexSuffix
diff --git a/apex/apex.go b/apex/apex.go
index 55b0858..635ff30 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -458,10 +458,6 @@
modulePaths []string
}
-func (*apexBundle) InstallBypassMake() bool {
- return true
-}
-
// apexFileClass represents a type of file that can be included in APEX.
type apexFileClass int
diff --git a/apex/apex_test.go b/apex/apex_test.go
index a749ea1..9ab8ca1 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -2657,7 +2657,10 @@
}
func TestVendorApex(t *testing.T) {
- ctx := testApex(t, `
+ result := android.GroupFixturePreparers(
+ prepareForApexTest,
+ android.FixtureModifyConfig(android.SetKatiEnabledForTests),
+ ).RunTestWithBp(t, `
apex {
name: "myapex",
key: "myapex.key",
@@ -2681,24 +2684,24 @@
}
`)
- ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
+ ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
"bin/mybin",
"lib64/libfoo.so",
// TODO(b/159195575): Add an option to use VNDK libs from VNDK APEX
"lib64/libc++.so",
})
- apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
- data := android.AndroidMkDataForTest(t, ctx, apexBundle)
+ apexBundle := result.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
+ data := android.AndroidMkDataForTest(t, result.TestContext, apexBundle)
name := apexBundle.BaseModuleName()
prefix := "TARGET_"
var builder strings.Builder
data.Custom(&builder, name, prefix, "", data)
- androidMk := android.StringRelativeToTop(ctx.Config(), builder.String())
+ androidMk := android.StringRelativeToTop(result.Config, builder.String())
installPath := "out/target/product/test_device/vendor/apex"
ensureContains(t, androidMk, "LOCAL_MODULE_PATH := "+installPath)
- apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
+ apexManifestRule := result.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
requireNativeLibs := names(apexManifestRule.Args["requireNativeLibs"])
ensureListNotContains(t, requireNativeLibs, ":vndk")
}
@@ -8500,7 +8503,7 @@
java_import {
name: "foo",
jars: ["foo.jar"],
- installable: true,
+ apex_available: ["myapex"],
}
`,
dexpreopt.FixtureSetApexSystemServerJars("myapex:foo"),
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index 254c90e..02d8075 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -222,7 +222,7 @@
Host_required: p.hostRequired,
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", p.installDir.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", p.installDir.String())
entries.SetString("LOCAL_MODULE_STEM", p.installFilename)
entries.SetPath("LOCAL_SOONG_INSTALLED_MODULE", p.installedFile)
entries.SetString("LOCAL_SOONG_INSTALL_PAIRS", p.outputApex.String()+":"+p.installedFile.String())
@@ -256,7 +256,7 @@
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", p.installDir.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", p.installDir.String())
entries.SetString("LOCAL_SOONG_INSTALLED_MODULE", filepath.Join(p.installDir.String(), fi.stem()))
entries.SetString("LOCAL_SOONG_INSTALL_PAIRS",
fi.builtFile.String()+":"+filepath.Join(p.installDir.String(), fi.stem()))
@@ -472,10 +472,6 @@
inputApex android.Path
}
-func (p *Prebuilt) InstallBypassMake() bool {
- return true
-}
-
type ApexFileProperties struct {
// the path to the prebuilt .apex file to import.
//
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 636bab8..800b58f 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -453,7 +453,7 @@
}
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- path, file := filepath.Split(installer.path.ToMakePath().String())
+ path, file := filepath.Split(installer.path.String())
stem, suffix, _ := android.SplitFileExt(file)
entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
entries.SetString("LOCAL_MODULE_PATH", path)
@@ -532,7 +532,7 @@
c.libraryDecorator.androidMkWriteExportedFlags(entries)
if c.shared() || c.static() {
- path, file := filepath.Split(c.path.ToMakePath().String())
+ path, file := filepath.Split(c.path.String())
stem, suffix, ext := android.SplitFileExt(file)
entries.SetString("LOCAL_BUILT_MODULE_STEM", "$(LOCAL_MODULE)"+ext)
entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
diff --git a/cc/cc.go b/cc/cc.go
index 215ef9c..22baf30 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1385,8 +1385,6 @@
return c.installer != nil && c.installer.installInRoot()
}
-func (c *Module) InstallBypassMake() bool { return true }
-
type baseModuleContext struct {
android.BaseModuleContext
moduleContextImpl
diff --git a/cc/config/global.go b/cc/config/global.go
index 2091e18..7f2c23e 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -224,8 +224,6 @@
"-Wno-pessimizing-move", // http://b/154270751
// New warnings to be fixed after clang-r399163
"-Wno-non-c-typedef-for-linkage", // http://b/161304145
- // New warnings to be fixed after clang-r407598
- "-Wno-string-concatenation", // http://b/175068488
// New warnings to be fixed after clang-r428724
"-Wno-align-mismatch", // http://b/193679946
// New warnings to be fixed after clang-r433403
@@ -265,6 +263,9 @@
// http://b/199369603
"-Wno-null-pointer-subtraction",
+
+ // http://b/175068488
+ "-Wno-string-concatenation",
}
IllegalFlags = []string{
diff --git a/dexpreopt/config.go b/dexpreopt/config.go
index 6d6b41d..1f99a96 100644
--- a/dexpreopt/config.go
+++ b/dexpreopt/config.go
@@ -100,6 +100,48 @@
RelaxUsesLibraryCheck bool
}
+var allPlatformSystemServerJarsKey = android.NewOnceKey("allPlatformSystemServerJars")
+
+// Returns all jars on the platform that system_server loads, including those on classpath and those
+// loaded dynamically.
+func (g *GlobalConfig) AllPlatformSystemServerJars(ctx android.PathContext) *android.ConfiguredJarList {
+ return ctx.Config().Once(allPlatformSystemServerJarsKey, func() interface{} {
+ res := g.SystemServerJars.AppendList(&g.StandaloneSystemServerJars)
+ return &res
+ }).(*android.ConfiguredJarList)
+}
+
+var allApexSystemServerJarsKey = android.NewOnceKey("allApexSystemServerJars")
+
+// Returns all jars delivered via apex that system_server loads, including those on classpath and
+// those loaded dynamically.
+func (g *GlobalConfig) AllApexSystemServerJars(ctx android.PathContext) *android.ConfiguredJarList {
+ return ctx.Config().Once(allApexSystemServerJarsKey, func() interface{} {
+ res := g.ApexSystemServerJars.AppendList(&g.ApexStandaloneSystemServerJars)
+ return &res
+ }).(*android.ConfiguredJarList)
+}
+
+var allSystemServerClasspathJarsKey = android.NewOnceKey("allSystemServerClasspathJars")
+
+// Returns all system_server classpath jars.
+func (g *GlobalConfig) AllSystemServerClasspathJars(ctx android.PathContext) *android.ConfiguredJarList {
+ return ctx.Config().Once(allSystemServerClasspathJarsKey, func() interface{} {
+ res := g.SystemServerJars.AppendList(&g.ApexSystemServerJars)
+ return &res
+ }).(*android.ConfiguredJarList)
+}
+
+var allSystemServerJarsKey = android.NewOnceKey("allSystemServerJars")
+
+// Returns all jars that system_server loads.
+func (g *GlobalConfig) AllSystemServerJars(ctx android.PathContext) *android.ConfiguredJarList {
+ return ctx.Config().Once(allSystemServerJarsKey, func() interface{} {
+ res := g.AllPlatformSystemServerJars(ctx).AppendList(g.AllApexSystemServerJars(ctx))
+ return &res
+ }).(*android.ConfiguredJarList)
+}
+
// GlobalSoongConfig contains the global config that is generated from Soong,
// stored in dexpreopt_soong.config.
type GlobalSoongConfig struct {
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index 3145315..de139c4 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -115,7 +115,7 @@
// /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
// or performance. If PreoptExtractedApk is true, we ignore the only preopt boot image options.
if global.OnlyPreoptBootImageAndSystemServer && !global.BootJars.ContainsJar(module.Name) &&
- !AllSystemServerJars(ctx, global).ContainsJar(module.Name) && !module.PreoptExtractedApk {
+ !global.AllSystemServerJars(ctx).ContainsJar(module.Name) && !module.PreoptExtractedApk {
return true
}
@@ -197,8 +197,8 @@
}
// Returns the dex location of a system server java library.
-func GetSystemServerDexLocation(global *GlobalConfig, lib string) string {
- if apex := global.ApexSystemServerJars.ApexOfJar(lib); apex != "" {
+func GetSystemServerDexLocation(ctx android.PathContext, global *GlobalConfig, lib string) string {
+ if apex := global.AllApexSystemServerJars(ctx).ApexOfJar(lib); apex != "" {
return fmt.Sprintf("/apex/%s/javalib/%s.jar", apex, lib)
}
return fmt.Sprintf("/system/framework/%s.jar", lib)
@@ -240,7 +240,8 @@
invocationPath := odexPath.ReplaceExtension(ctx, "invocation")
- systemServerJars := AllSystemServerJars(ctx, global)
+ systemServerJars := global.AllSystemServerJars(ctx)
+ systemServerClasspathJars := global.AllSystemServerClasspathJars(ctx)
rule.Command().FlagWithArg("mkdir -p ", filepath.Dir(odexPath.String()))
rule.Command().FlagWithOutput("rm -f ", odexPath)
@@ -251,10 +252,15 @@
var clcHost android.Paths
var clcTarget []string
- for i := 0; i < jarIndex; i++ {
- lib := systemServerJars.Jar(i)
+ endIndex := systemServerClasspathJars.IndexOfJar(module.Name)
+ if endIndex < 0 {
+ // The jar is a standalone one. Use the full classpath as the class loader context.
+ endIndex = systemServerClasspathJars.Len()
+ }
+ for i := 0; i < endIndex; i++ {
+ lib := systemServerClasspathJars.Jar(i)
clcHost = append(clcHost, SystemServerDexJarHostPath(ctx, lib))
- clcTarget = append(clcTarget, GetSystemServerDexLocation(global, lib))
+ clcTarget = append(clcTarget, GetSystemServerDexLocation(ctx, global, lib))
}
if DexpreoptRunningInSoong {
@@ -270,12 +276,22 @@
// cannot see the rule in the generated dexpreopt.sh script).
}
- checkSystemServerOrder(ctx, jarIndex)
+ clcHostString := "PCL[" + strings.Join(clcHost.Strings(), ":") + "]"
+ clcTargetString := "PCL[" + strings.Join(clcTarget, ":") + "]"
+
+ if systemServerClasspathJars.ContainsJar(module.Name) {
+ checkSystemServerOrder(ctx, jarIndex)
+ } else {
+ // Standalone jars are loaded by separate class loaders with SYSTEMSERVERCLASSPATH as the
+ // parent.
+ clcHostString = "PCL[];" + clcHostString
+ clcTargetString = "PCL[];" + clcTargetString
+ }
rule.Command().
- Text("class_loader_context_arg=--class-loader-context=PCL[" + strings.Join(clcHost.Strings(), ":") + "]").
+ Text(`class_loader_context_arg=--class-loader-context="` + clcHostString + `"`).
Implicits(clcHost).
- Text("stored_class_loader_context_arg=--stored-class-loader-context=PCL[" + strings.Join(clcTarget, ":") + "]")
+ Text(`stored_class_loader_context_arg=--stored-class-loader-context="` + clcTargetString + `"`)
} else {
// There are three categories of Java modules handled here:
@@ -533,17 +549,6 @@
}
}
-var allSystemServerJarsKey = android.NewOnceKey("allSystemServerJars")
-
-// TODO: eliminate the superficial global config parameter by moving global config definition
-// from java subpackage to dexpreopt.
-func AllSystemServerJars(ctx android.PathContext, global *GlobalConfig) *android.ConfiguredJarList {
- return ctx.Config().Once(allSystemServerJarsKey, func() interface{} {
- allSystemServerJars := global.SystemServerJars.AppendList(global.ApexSystemServerJars)
- return &allSystemServerJars
- }).(*android.ConfiguredJarList)
-}
-
// A predefined location for the system server dex jars. This is needed in order to generate
// class loader context for dex2oat, as the path to the jar in the Soong module may be unknown
// at that time (Soong processes the jars in dependency order, which may be different from the
@@ -567,7 +572,7 @@
mctx, isModule := ctx.(android.ModuleContext)
if isModule {
config := GetGlobalConfig(ctx)
- jars := AllSystemServerJars(ctx, config)
+ jars := config.AllSystemServerClasspathJars(ctx)
mctx.WalkDeps(func(dep android.Module, parent android.Module) bool {
depIndex := jars.IndexOfJar(dep.Name())
if jarIndex < depIndex && !config.BrokenSuboptimalOrderOfSystemServerJars {
diff --git a/dexpreopt/dexpreopt_test.go b/dexpreopt/dexpreopt_test.go
index 798d776..07e4fad 100644
--- a/dexpreopt/dexpreopt_test.go
+++ b/dexpreopt/dexpreopt_test.go
@@ -50,6 +50,15 @@
android.PathForOutput(ctx, fmt.Sprintf("%s/enforce_uses_libraries.status", name)))
}
+func testPlatformSystemServerModuleConfig(ctx android.PathContext, name string) *ModuleConfig {
+ return createTestModuleConfig(
+ name,
+ fmt.Sprintf("/system/framework/%s.jar", name),
+ android.PathForOutput(ctx, fmt.Sprintf("%s/dexpreopt/%s.jar", name, name)),
+ android.PathForOutput(ctx, fmt.Sprintf("%s/aligned/%s.jar", name, name)),
+ android.PathForOutput(ctx, fmt.Sprintf("%s/enforce_uses_libraries.status", name)))
+}
+
func createTestModuleConfig(name, dexLocation string, buildPath, dexPath, enforceUsesLibrariesStatusFile android.OutputPath) *ModuleConfig {
return &ModuleConfig{
Name: name,
@@ -181,6 +190,52 @@
android.AssertStringEquals(t, "installs", wantInstalls.String(), rule.Installs().String())
}
+func TestDexPreoptStandaloneSystemServerJars(t *testing.T) {
+ config := android.TestConfig("out", nil, "", nil)
+ ctx := android.BuilderContextForTesting(config)
+ globalSoong := globalSoongConfigForTests()
+ global := GlobalConfigForTests(ctx)
+ module := testPlatformSystemServerModuleConfig(ctx, "service-A")
+
+ global.StandaloneSystemServerJars = android.CreateTestConfiguredJarList(
+ []string{"platform:service-A"})
+
+ rule, err := GenerateDexpreoptRule(ctx, globalSoong, global, module)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ wantInstalls := android.RuleBuilderInstalls{
+ {android.PathForOutput(ctx, "service-A/dexpreopt/oat/arm/javalib.odex"), "/system/framework/oat/arm/service-A.odex"},
+ {android.PathForOutput(ctx, "service-A/dexpreopt/oat/arm/javalib.vdex"), "/system/framework/oat/arm/service-A.vdex"},
+ }
+
+ android.AssertStringEquals(t, "installs", wantInstalls.String(), rule.Installs().String())
+}
+
+func TestDexPreoptApexStandaloneSystemServerJars(t *testing.T) {
+ config := android.TestConfig("out", nil, "", nil)
+ ctx := android.BuilderContextForTesting(config)
+ globalSoong := globalSoongConfigForTests()
+ global := GlobalConfigForTests(ctx)
+ module := testApexModuleConfig(ctx, "service-A", "com.android.apex1")
+
+ global.ApexStandaloneSystemServerJars = android.CreateTestConfiguredJarList(
+ []string{"com.android.apex1:service-A"})
+
+ rule, err := GenerateDexpreoptRule(ctx, globalSoong, global, module)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ wantInstalls := android.RuleBuilderInstalls{
+ {android.PathForOutput(ctx, "service-A/dexpreopt/oat/arm/javalib.odex"), "/system/framework/oat/arm/apex@com.android.apex1@javalib@service-A.jar@classes.odex"},
+ {android.PathForOutput(ctx, "service-A/dexpreopt/oat/arm/javalib.vdex"), "/system/framework/oat/arm/apex@com.android.apex1@javalib@service-A.jar@classes.vdex"},
+ }
+
+ android.AssertStringEquals(t, "installs", wantInstalls.String(), rule.Installs().String())
+}
+
func TestDexPreoptProfile(t *testing.T) {
config := android.TestConfig("out", nil, "", nil)
ctx := android.BuilderContextForTesting(config)
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index 80ab41b..c2866ab 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -376,7 +376,7 @@
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_TAGS", "optional")
- entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base())
if len(p.properties.Symlinks) > 0 {
entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...)
diff --git a/etc/snapshot_etc.go b/etc/snapshot_etc.go
index 9a25d5a..b54a8a6 100644
--- a/etc/snapshot_etc.go
+++ b/etc/snapshot_etc.go
@@ -128,7 +128,7 @@
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_TAGS", "optional")
- entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base())
},
},
diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go
index 73d807d..fc973a4 100644
--- a/filesystem/bootimg.go
+++ b/filesystem/bootimg.go
@@ -267,7 +267,7 @@
OutputFile: android.OptionalPathForPath(b.output),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", b.installDir.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", b.installDir.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", b.installFileName())
},
},
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index b2caa51..0796258 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -394,7 +394,7 @@
OutputFile: android.OptionalPathForPath(f.output),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", f.installDir.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", f.installDir.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", f.installFileName())
},
},
diff --git a/filesystem/logical_partition.go b/filesystem/logical_partition.go
index 739e609..e2f7d7b 100644
--- a/filesystem/logical_partition.go
+++ b/filesystem/logical_partition.go
@@ -215,7 +215,7 @@
OutputFile: android.OptionalPathForPath(l.output),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", l.installDir.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", l.installDir.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", l.installFileName())
},
},
diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go
index 3f16c0d..63e0aba 100644
--- a/filesystem/vbmeta.go
+++ b/filesystem/vbmeta.go
@@ -247,7 +247,7 @@
OutputFile: android.OptionalPathForPath(v.output),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", v.installDir.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", v.installDir.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", v.installFileName())
},
},
diff --git a/java/androidmk.go b/java/androidmk.go
index 272a4fd..19fe7e2 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -182,7 +182,14 @@
}
func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries {
- if prebuilt.hideApexVariantFromMake || !prebuilt.ContainingSdk().Unversioned() {
+ if prebuilt.hideApexVariantFromMake {
+ // For a library imported from a prebuilt APEX, we don't need a Make module for itself, as we
+ // don't need to install it. However, we need to add its dexpreopt outputs as sub-modules, if it
+ // is preopted.
+ dexpreoptEntries := prebuilt.dexpreopter.AndroidMkEntriesForApex()
+ return append(dexpreoptEntries, android.AndroidMkEntries{Disabled: true})
+ }
+ if !prebuilt.ContainingSdk().Unversioned() {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Disabled: true,
}}
@@ -685,7 +692,7 @@
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString())
- entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath())
+ entries.SetPath("LOCAL_MODULE_PATH", r.installDir)
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...)
},
},
diff --git a/java/app.go b/java/app.go
index b753c0c..1c69aeb 100755
--- a/java/app.go
+++ b/java/app.go
@@ -485,7 +485,7 @@
a.jniLibs = jniLibs
if a.shouldEmbedJnis(ctx) {
jniJarFile = android.PathForModuleOut(ctx, "jnilibs.zip")
- a.installPathForJNISymbols = a.installPath(ctx).ToMakePath()
+ a.installPathForJNISymbols = a.installPath(ctx)
TransformJniLibsToJar(ctx, jniJarFile, jniLibs, a.useEmbeddedNativeLibs(ctx))
for _, jni := range jniLibs {
if jni.coverageFile.Valid() {
diff --git a/java/app_import.go b/java/app_import.go
index 4d1969e..3e5f972 100644
--- a/java/app_import.go
+++ b/java/app_import.go
@@ -108,8 +108,6 @@
return true
}
-func (a *AndroidAppImport) InstallBypassMake() bool { return true }
-
// Updates properties with variant-specific values.
func (a *AndroidAppImport) processVariants(ctx android.LoadHookContext) {
config := ctx.Config()
diff --git a/java/base.go b/java/base.go
index c45ef64..7cd71a2 100644
--- a/java/base.go
+++ b/java/base.go
@@ -122,6 +122,14 @@
Javacflags []string
}
+ Openjdk11 struct {
+ // List of source files that should only be used when passing -source 1.9 or higher
+ Srcs []string `android:"path"`
+
+ // List of javac flags that should only be used when passing -source 1.9 or higher
+ Javacflags []string
+ }
+
// When compiling language level 9+ .java code in packages that are part of
// a system module, patch_module names the module that your sources and
// dependencies should be patched into. The Android runtime currently
@@ -959,6 +967,10 @@
if flags.javaVersion.usesJavaModules() {
j.properties.Srcs = append(j.properties.Srcs, j.properties.Openjdk9.Srcs...)
}
+ if ctx.Config().TargetsJava11() {
+ j.properties.Srcs = append(j.properties.Srcs, j.properties.Openjdk11.Srcs...)
+ }
+
srcFiles := android.PathsForModuleSrcExcludes(ctx, j.properties.Srcs, j.properties.Exclude_srcs)
if hasSrcExt(srcFiles.Strings(), ".proto") {
flags = protoFlags(ctx, &j.properties, &j.protoProperties, flags)
diff --git a/java/classpath_fragment.go b/java/classpath_fragment.go
index e77971b..ca27528 100644
--- a/java/classpath_fragment.go
+++ b/java/classpath_fragment.go
@@ -204,7 +204,7 @@
OutputFile: android.OptionalPathForPath(c.outputFilepath),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", c.installDirPath.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", c.installDirPath.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", c.outputFilepath.Base())
},
},
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index f3a53ee..e9bc518 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -115,6 +115,11 @@
return !apexInfo.IsForPlatform()
}
+func forPrebuiltApex(ctx android.BaseModuleContext) bool {
+ apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
+ return apexInfo.ForPrebuiltApex
+}
+
func moduleName(ctx android.BaseModuleContext) string {
// Remove the "prebuilt_" prefix if the module is from a prebuilt because the prefix is not
// expected by dexpreopter.
@@ -134,7 +139,9 @@
return true
}
- if !ctx.Module().(DexpreopterInterface).IsInstallable() {
+ // If the module is from a prebuilt APEX, it shouldn't be installable, but it can still be
+ // dexpreopted.
+ if !ctx.Module().(DexpreopterInterface).IsInstallable() && !forPrebuiltApex(ctx) {
return true
}
@@ -152,15 +159,16 @@
return true
}
+ isApexSystemServerJar := global.AllApexSystemServerJars(ctx).ContainsJar(moduleName(ctx))
if isApexVariant(ctx) {
// Don't preopt APEX variant module unless the module is an APEX system server jar and we are
// building the entire system image.
- if !global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) || ctx.Config().UnbundledBuild() {
+ if !isApexSystemServerJar || ctx.Config().UnbundledBuild() {
return true
}
} else {
// Don't preopt the platform variant of an APEX system server jar to avoid conflicts.
- if global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
+ if isApexSystemServerJar {
return true
}
}
@@ -191,8 +199,8 @@
func (d *dexpreopter) getInstallPath(
ctx android.ModuleContext, defaultInstallPath android.InstallPath) android.InstallPath {
global := dexpreopt.GetGlobalConfig(ctx)
- if global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
- dexLocation := dexpreopt.GetSystemServerDexLocation(global, moduleName(ctx))
+ if global.AllApexSystemServerJars(ctx).ContainsJar(moduleName(ctx)) {
+ dexLocation := dexpreopt.GetSystemServerDexLocation(ctx, global, moduleName(ctx))
return android.PathForModuleInPartitionInstall(ctx, "", strings.TrimPrefix(dexLocation, "/"))
}
if !d.dexpreoptDisabled(ctx) && isApexVariant(ctx) &&
@@ -229,8 +237,7 @@
return
}
- isSystemServerJar := global.SystemServerJars.ContainsJar(moduleName(ctx)) ||
- global.ApexSystemServerJars.ContainsJar(moduleName(ctx))
+ isSystemServerJar := global.AllSystemServerJars(ctx).ContainsJar(moduleName(ctx))
bootImage := defaultBootImageConfig(ctx)
if global.UseArtImage {
@@ -336,6 +343,8 @@
dexpreoptRule.Build("dexpreopt", "dexpreopt")
+ isApexSystemServerJar := global.AllApexSystemServerJars(ctx).ContainsJar(moduleName(ctx))
+
for _, install := range dexpreoptRule.Installs() {
// Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT.
installDir := strings.TrimPrefix(filepath.Dir(install.To), "/")
@@ -343,7 +352,7 @@
arch := filepath.Base(installDir)
installPath := android.PathForModuleInPartitionInstall(ctx, "", installDir)
- if global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
+ if isApexSystemServerJar {
// APEX variants of java libraries are hidden from Make, so their dexpreopt
// outputs need special handling. Currently, for APEX variants of java
// libraries, only those in the system server classpath are handled here.
@@ -362,7 +371,7 @@
}
}
- if !global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
+ if !isApexSystemServerJar {
d.builtInstalled = dexpreoptRule.Installs().String()
}
}
@@ -381,7 +390,7 @@
OutputFile: android.OptionalPathForPath(install.outputPathOnHost),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", install.installDirOnDevice.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", install.installDirOnDevice.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", install.installFileOnDevice)
entries.SetString("LOCAL_NOT_AVAILABLE_FOR_PLATFORM", "false")
},
diff --git a/java/dexpreopt_check.go b/java/dexpreopt_check.go
index 565901d..149cbb7 100644
--- a/java/dexpreopt_check.go
+++ b/java/dexpreopt_check.go
@@ -59,7 +59,7 @@
func getInstallPath(ctx android.ModuleContext, location string) android.InstallPath {
return android.PathForModuleInPartitionInstall(
- ctx, "", strings.TrimPrefix(location, "/")).ToMakePath()
+ ctx, "", strings.TrimPrefix(location, "/"))
}
func (m *dexpreoptSystemserverCheck) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -72,9 +72,10 @@
return
}
- systemServerJars := dexpreopt.AllSystemServerJars(ctx, global)
+ // TODO(b/203198541): Check all system server jars.
+ systemServerJars := global.AllSystemServerClasspathJars(ctx)
for _, jar := range systemServerJars.CopyOfJars() {
- dexLocation := dexpreopt.GetSystemServerDexLocation(global, jar)
+ dexLocation := dexpreopt.GetSystemServerDexLocation(ctx, global, jar)
odexLocation := dexpreopt.ToOdexPath(dexLocation, targets[0].Arch.ArchType)
odexPath := getInstallPath(ctx, odexLocation)
vdexPath := getInstallPath(ctx, pathtools.ReplaceExtension(odexLocation, "vdex"))
diff --git a/java/java.go b/java/java.go
index f77c694..9b4a005 100644
--- a/java/java.go
+++ b/java/java.go
@@ -267,8 +267,6 @@
return j.kytheFiles
}
-func (j *Module) InstallBypassMake() bool { return true }
-
type dependencyTag struct {
blueprint.BaseDependencyTag
name string
@@ -451,7 +449,7 @@
return normalizeJavaVersion(ctx, javaVersion)
} else if ctx.Device() {
return defaultJavaLanguageVersion(ctx, sdkContext.SdkVersion(ctx))
- } else if ctx.Config().IsEnvTrue("EXPERIMENTAL_TARGET_JAVA_VERSION_11") {
+ } else if ctx.Config().TargetsJava11() {
// Temporary experimental flag to be able to try and build with
// java version 11 options. The flag, if used, just sets Java
// 11 as the default version, leaving any components that
diff --git a/java/lint.go b/java/lint.go
index fe3218e..7845c33 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -377,6 +377,7 @@
html := android.PathForModuleOut(ctx, "lint", "lint-report.html")
text := android.PathForModuleOut(ctx, "lint", "lint-report.txt")
xml := android.PathForModuleOut(ctx, "lint", "lint-report.xml")
+ baseline := android.PathForModuleOut(ctx, "lint", "lint-baseline.xml")
depSetsBuilder := NewLintDepSetBuilder().Direct(html, text, xml)
@@ -447,6 +448,8 @@
cmd.FlagWithInput("--baseline ", lintBaseline.Path())
}
+ cmd.FlagWithOutput("--write-reference-baseline ", baseline)
+
cmd.Text("|| (").Text("if [ -e").Input(text).Text("]; then cat").Input(text).Text("; fi; exit 7)")
rule.Command().Text("rm -rf").Flag(lintPaths.cacheDir.String()).Flag(lintPaths.homeDir.String())
diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go
index 0d8ebac..f442ddf 100644
--- a/java/platform_compat_config.go
+++ b/java/platform_compat_config.go
@@ -115,7 +115,7 @@
Include: "$(BUILD_PREBUILT)",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.configFile.Base())
},
},
diff --git a/java/robolectric.go b/java/robolectric.go
index 16af546..f719521 100644
--- a/java/robolectric.go
+++ b/java/robolectric.go
@@ -352,7 +352,6 @@
return module
}
-func (r *robolectricTest) InstallBypassMake() bool { return true }
func (r *robolectricTest) InstallInTestcases() bool { return true }
func (r *robolectricTest) InstallForceOS() (*android.OsType, *android.ArchType) {
return &r.forceOSType, &r.forceArchType
@@ -430,7 +429,6 @@
}
}
-func (r *robolectricRuntimes) InstallBypassMake() bool { return true }
func (r *robolectricRuntimes) InstallInTestcases() bool { return true }
func (r *robolectricRuntimes) InstallForceOS() (*android.OsType, *android.ArchType) {
return &r.forceOSType, &r.forceArchType
diff --git a/java/rro_test.go b/java/rro_test.go
index 27abbe4..be0d7ba 100644
--- a/java/rro_test.go
+++ b/java/rro_test.go
@@ -62,6 +62,7 @@
result := android.GroupFixturePreparers(
PrepareForTestWithJavaDefaultModules,
PrepareForTestWithOverlayBuildComponents,
+ android.FixtureModifyConfig(android.SetKatiEnabledForTests),
fs.AddToFixture(),
).RunTestWithBp(t, bp)
@@ -127,7 +128,10 @@
}
func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
- ctx, config := testJava(t, `
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ android.FixtureModifyConfig(android.SetKatiEnabledForTests),
+ ).RunTestWithBp(t, `
java_defaults {
name: "rro_defaults",
theme: "default_theme",
@@ -148,7 +152,7 @@
//
// RRO module with defaults
//
- m := ctx.ModuleForTests("foo_with_defaults", "android_common")
+ m := result.ModuleForTests("foo_with_defaults", "android_common")
// Check AAPT2 link flags.
aapt2Flags := strings.Split(m.Output("package-res.apk").Args["flags"], " ")
@@ -159,14 +163,14 @@
}
// Check device location.
- path := android.AndroidMkEntriesForTest(t, ctx, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
+ path := android.AndroidMkEntriesForTest(t, result.TestContext, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
expectedPath := []string{shared.JoinPath("out/target/product/test_device/product/overlay/default_theme")}
- android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", config, expectedPath, path)
+ android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", result.Config, expectedPath, path)
//
// RRO module without defaults
//
- m = ctx.ModuleForTests("foo_barebones", "android_common")
+ m = result.ModuleForTests("foo_barebones", "android_common")
// Check AAPT2 link flags.
aapt2Flags = strings.Split(m.Output("package-res.apk").Args["flags"], " ")
@@ -176,9 +180,9 @@
}
// Check device location.
- path = android.AndroidMkEntriesForTest(t, ctx, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
+ path = android.AndroidMkEntriesForTest(t, result.TestContext, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
expectedPath = []string{shared.JoinPath("out/target/product/test_device/product/overlay")}
- android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", config, expectedPath, path)
+ android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", result.Config, expectedPath, path)
}
func TestOverrideRuntimeResourceOverlay(t *testing.T) {
diff --git a/java/sdk.go b/java/sdk.go
index de7070e..756a24d 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -55,7 +55,7 @@
return JAVA_VERSION_7
} else if sdk.FinalOrFutureInt() <= 29 {
return JAVA_VERSION_8
- } else if ctx.Config().IsEnvTrue("EXPERIMENTAL_TARGET_JAVA_VERSION_11") {
+ } else if ctx.Config().TargetsJava11() {
// Temporary experimental flag to be able to try and build with
// java version 11 options. The flag, if used, just sets Java
// 11 as the default version, leaving any components that
diff --git a/java/sdk_library.go b/java/sdk_library.go
index de0d796..0bc8895 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1392,6 +1392,10 @@
Srcs []string
Javacflags []string
}
+ Openjdk11 struct {
+ Srcs []string
+ Javacflags []string
+ }
Dist struct {
Targets []string
Dest *string
@@ -1418,6 +1422,8 @@
}
props.Openjdk9.Srcs = module.properties.Openjdk9.Srcs
props.Openjdk9.Javacflags = module.properties.Openjdk9.Javacflags
+ props.Openjdk11.Srcs = module.properties.Openjdk11.Srcs
+ props.Openjdk11.Javacflags = module.properties.Openjdk11.Javacflags
// We compile the stubs for 1.8 in line with the main android.jar stubs, and potential
// interop with older developer tools that don't support 1.9.
props.Java_version = proptools.StringPtr("1.8")
@@ -2641,7 +2647,7 @@
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_TAGS", "optional")
- entries.SetString("LOCAL_MODULE_PATH", module.installDirPath.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", module.installDirPath.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", module.outputFilePath.Base())
},
},
diff --git a/java/systemserver_classpath_fragment.go b/java/systemserver_classpath_fragment.go
index 2ec33a4..fa61ea6 100644
--- a/java/systemserver_classpath_fragment.go
+++ b/java/systemserver_classpath_fragment.go
@@ -60,7 +60,7 @@
classpathJars := configuredJarListToClasspathJars(ctx, configuredJars, p.classpathType)
standaloneConfiguredJars := p.standaloneConfiguredJars(ctx)
standaloneClasspathJars := configuredJarListToClasspathJars(ctx, standaloneConfiguredJars, STANDALONE_SYSTEMSERVER_JARS)
- configuredJars = configuredJars.AppendList(standaloneConfiguredJars)
+ configuredJars = configuredJars.AppendList(&standaloneConfiguredJars)
classpathJars = append(classpathJars, standaloneClasspathJars...)
p.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, configuredJars, classpathJars)
}
@@ -122,7 +122,7 @@
classpathJars := configuredJarListToClasspathJars(ctx, configuredJars, s.classpathType)
standaloneConfiguredJars := s.standaloneConfiguredJars(ctx)
standaloneClasspathJars := configuredJarListToClasspathJars(ctx, standaloneConfiguredJars, STANDALONE_SYSTEMSERVER_JARS)
- configuredJars = configuredJars.AppendList(standaloneConfiguredJars)
+ configuredJars = configuredJars.AppendList(&standaloneConfiguredJars)
classpathJars = append(classpathJars, standaloneClasspathJars...)
s.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, configuredJars, classpathJars)
diff --git a/linkerconfig/linkerconfig.go b/linkerconfig/linkerconfig.go
index 8d0ad7c..dbc112e 100644
--- a/linkerconfig/linkerconfig.go
+++ b/linkerconfig/linkerconfig.go
@@ -155,7 +155,7 @@
OutputFile: android.OptionalPathForPath(l.outputFilePath),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", l.installDirPath.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", l.installDirPath.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", l.outputFilePath.Base())
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !installable)
entries.SetString("LINKER_CONFIG_PATH_"+l.Name(), l.OutputFile().String())
diff --git a/mk2rbc/expr.go b/mk2rbc/expr.go
index ca48bd9..7cd4899 100644
--- a/mk2rbc/expr.go
+++ b/mk2rbc/expr.go
@@ -16,18 +16,13 @@
import (
"fmt"
- "strconv"
"strings"
)
-// Represents an expression in the Starlark code. An expression has
-// a type, and it can be evaluated.
+// Represents an expression in the Starlark code. An expression has a type.
type starlarkExpr interface {
starlarkNode
typ() starlarkType
- // Try to substitute variable values. Return substitution result
- // and whether it is the same as the original expression.
- eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool)
// Emit the code to copy the expression, otherwise we will end up
// with source and target pointing to the same list.
emitListVarCopy(gctx *generationContext)
@@ -50,12 +45,6 @@
literal string
}
-func (s *stringLiteralExpr) eval(_ map[string]starlarkExpr) (res starlarkExpr, same bool) {
- res = s
- same = true
- return
-}
-
func (s *stringLiteralExpr) emit(gctx *generationContext) {
gctx.writef("%q", s.literal)
}
@@ -81,12 +70,6 @@
literal int
}
-func (s *intLiteralExpr) eval(_ map[string]starlarkExpr) (res starlarkExpr, same bool) {
- res = s
- same = true
- return
-}
-
func (s *intLiteralExpr) emit(gctx *generationContext) {
gctx.writef("%d", s.literal)
}
@@ -112,10 +95,6 @@
literal bool
}
-func (b *boolLiteralExpr) eval(_ map[string]starlarkExpr) (res starlarkExpr, same bool) {
- return b, true
-}
-
func (b *boolLiteralExpr) emit(gctx *generationContext) {
if b.literal {
gctx.write("True")
@@ -148,6 +127,35 @@
args []starlarkExpr
}
+func NewInterpolateExpr(parts []starlarkExpr) starlarkExpr {
+ result := &interpolateExpr{}
+ needString := true
+ for _, part := range parts {
+ if needString {
+ if strLit, ok := part.(*stringLiteralExpr); ok {
+ result.chunks = append(result.chunks, strLit.literal)
+ } else {
+ result.chunks = append(result.chunks, "")
+ }
+ needString = false
+ } else {
+ if strLit, ok := part.(*stringLiteralExpr); ok {
+ result.chunks[len(result.chunks)-1] += strLit.literal
+ } else {
+ result.args = append(result.args, part)
+ needString = true
+ }
+ }
+ }
+ if len(result.chunks) == len(result.args) {
+ result.chunks = append(result.chunks, "")
+ }
+ if len(result.args) == 0 {
+ return &stringLiteralExpr{literal: strings.Join(result.chunks, "")}
+ }
+ return result
+}
+
func (xi *interpolateExpr) emit(gctx *generationContext) {
if len(xi.chunks) != len(xi.args)+1 {
panic(fmt.Errorf("malformed interpolateExpr: #chunks(%d) != #args(%d)+1",
@@ -181,37 +189,6 @@
}
}
-func (xi *interpolateExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- same = true
- newChunks := []string{xi.chunks[0]}
- var newArgs []starlarkExpr
- for i, arg := range xi.args {
- newArg, sameArg := arg.eval(valueMap)
- same = same && sameArg
- switch x := newArg.(type) {
- case *stringLiteralExpr:
- newChunks[len(newChunks)-1] += x.literal + xi.chunks[i+1]
- same = false
- continue
- case *intLiteralExpr:
- newChunks[len(newChunks)-1] += strconv.Itoa(x.literal) + xi.chunks[i+1]
- same = false
- continue
- default:
- newChunks = append(newChunks, xi.chunks[i+1])
- newArgs = append(newArgs, newArg)
- }
- }
- if same {
- res = xi
- } else if len(newChunks) == 1 {
- res = &stringLiteralExpr{newChunks[0]}
- } else {
- res = &interpolateExpr{chunks: newChunks, args: newArgs}
- }
- return
-}
-
func (_ *interpolateExpr) typ() starlarkType {
return starlarkTypeString
}
@@ -238,14 +215,11 @@
isDefined bool
}
-func (v *variableRefExpr) eval(map[string]starlarkExpr) (res starlarkExpr, same bool) {
- predefined, ok := v.ref.(*predefinedVariable)
- if same = !ok; same {
- res = v
- } else {
- res = predefined.value
+func NewVariableRefExpr(ref variable, isDefined bool) starlarkExpr {
+ if predefined, ok := ref.(*predefinedVariable); ok {
+ return predefined.value
}
- return
+ return &variableRefExpr{ref, isDefined}
}
func (v *variableRefExpr) emit(gctx *generationContext) {
@@ -275,15 +249,6 @@
expr starlarkExpr
}
-func (s *toStringExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- if x, same := s.expr.eval(valueMap); same {
- res = s
- } else {
- res = &toStringExpr{expr: x}
- }
- return
-}
-
func (s *toStringExpr) emit(ctx *generationContext) {
switch s.expr.typ() {
case starlarkTypeString, starlarkTypeUnknown:
@@ -329,15 +294,6 @@
expr starlarkExpr
}
-func (n *notExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- if x, same := n.expr.eval(valueMap); same {
- res = n
- } else {
- res = ¬Expr{expr: x}
- }
- return
-}
-
func (n *notExpr) emit(ctx *generationContext) {
ctx.write("not ")
n.expr.emit(ctx)
@@ -365,17 +321,6 @@
isEq bool // if false, it's !=
}
-func (eq *eqExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- xLeft, sameLeft := eq.left.eval(valueMap)
- xRight, sameRight := eq.right.eval(valueMap)
- if same = sameLeft && sameRight; same {
- res = eq
- } else {
- res = &eqExpr{left: xLeft, right: xRight, isEq: eq.isEq}
- }
- return
-}
-
func (eq *eqExpr) emit(gctx *generationContext) {
var stringOperand string
var otherOperand starlarkExpr
@@ -444,13 +389,6 @@
v variable
}
-func (v *variableDefinedExpr) eval(_ map[string]starlarkExpr) (res starlarkExpr, same bool) {
- res = v
- same = true
- return
-
-}
-
func (v *variableDefinedExpr) emit(gctx *generationContext) {
if v.v != nil {
v.v.emitDefined(gctx)
@@ -476,22 +414,6 @@
items []starlarkExpr
}
-func (l *listExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- newItems := make([]starlarkExpr, len(l.items))
- same = true
- for i, item := range l.items {
- var sameItem bool
- newItems[i], sameItem = item.eval(valueMap)
- same = same && sameItem
- }
- if same {
- res = l
- } else {
- res = &listExpr{newItems}
- }
- return
-}
-
func (l *listExpr) emit(gctx *generationContext) {
if !gctx.inAssignment || len(l.items) < 2 {
gctx.write("[")
@@ -578,22 +500,6 @@
gctx.indentLevel -= 2
}
-func (c *concatExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- same = true
- xConcat := &concatExpr{items: make([]starlarkExpr, len(c.items))}
- for i, item := range c.items {
- var sameItem bool
- xConcat.items[i], sameItem = item.eval(valueMap)
- same = same && sameItem
- }
- if same {
- res = c
- } else {
- res = xConcat
- }
- return
-}
-
func (_ *concatExpr) typ() starlarkType {
return starlarkTypeList
}
@@ -622,19 +528,6 @@
isNot bool
}
-func (i *inExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- x := &inExpr{isNot: i.isNot}
- var sameExpr, sameList bool
- x.expr, sameExpr = i.expr.eval(valueMap)
- x.list, sameList = i.list.eval(valueMap)
- if same = sameExpr && sameList; same {
- res = i
- } else {
- res = x
- }
- return
-}
-
func (i *inExpr) emit(gctx *generationContext) {
i.expr.emit(gctx)
if i.isNot {
@@ -679,17 +572,6 @@
return starlarkTypeString
}
-func (ix *indexExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- newArray, isSameArray := ix.array.eval(valueMap)
- newIndex, isSameIndex := ix.index.eval(valueMap)
- if same = isSameArray && isSameIndex; same {
- res = ix
- } else {
- res = &indexExpr{newArray, newIndex}
- }
- return
-}
-
func (ix *indexExpr) emitListVarCopy(gctx *generationContext) {
ix.emit(gctx)
}
@@ -711,27 +593,6 @@
returnType starlarkType
}
-func (cx *callExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- newCallExpr := &callExpr{name: cx.name, args: make([]starlarkExpr, len(cx.args)),
- returnType: cx.returnType}
- if cx.object != nil {
- newCallExpr.object, same = cx.object.eval(valueMap)
- } else {
- same = true
- }
- for i, args := range cx.args {
- var s bool
- newCallExpr.args[i], s = args.eval(valueMap)
- same = same && s
- }
- if same {
- res = cx
- } else {
- res = newCallExpr
- }
- return
-}
-
func (cx *callExpr) emit(gctx *generationContext) {
sep := ""
if cx.object != nil {
@@ -793,22 +654,6 @@
ifFalse starlarkExpr
}
-func (i *ifExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- cond, condSame := i.condition.eval(valueMap)
- t, tSame := i.ifTrue.eval(valueMap)
- f, fSame := i.ifFalse.eval(valueMap)
- same = condSame && tSame && fSame
- if same {
- return i, same
- } else {
- return &ifExpr{
- condition: cond,
- ifTrue: t,
- ifFalse: f,
- }, same
- }
-}
-
func (i *ifExpr) emit(gctx *generationContext) {
gctx.write("(")
i.ifTrue.emit(gctx)
@@ -851,10 +696,6 @@
name string
}
-func (i *identifierExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- return i, true
-}
-
func (i *identifierExpr) emit(gctx *generationContext) {
gctx.write(i.name)
}
@@ -881,21 +722,6 @@
action starlarkExpr
}
-func (f *foreachExpr) eval(valueMap map[string]starlarkExpr) (res starlarkExpr, same bool) {
- list, listSame := f.list.eval(valueMap)
- action, actionSame := f.action.eval(valueMap)
- same = listSame && actionSame
- if same {
- return f, same
- } else {
- return &foreachExpr{
- varName: f.varName,
- list: list,
- action: action,
- }, same
- }
-}
-
func (f *foreachExpr) emit(gctx *generationContext) {
gctx.write("[")
f.action.emit(gctx)
@@ -927,12 +753,6 @@
message string
}
-func (b *badExpr) eval(_ map[string]starlarkExpr) (res starlarkExpr, same bool) {
- res = b
- same = true
- return
-}
-
func (b *badExpr) emit(gctx *generationContext) {
gctx.emitConversionError(b.errorLocation, b.message)
}
diff --git a/mk2rbc/mk2rbc.go b/mk2rbc/mk2rbc.go
index 0c3780f..024311e 100644
--- a/mk2rbc/mk2rbc.go
+++ b/mk2rbc/mk2rbc.go
@@ -411,7 +411,6 @@
ifNestLevel int
moduleNameCount map[string]int // count of imported modules with given basename
fatalError error
- builtinMakeVars map[string]starlarkExpr
outputSuffix string
errorLogger ErrorLogger
tracedVariables map[string]bool // variables to be traced in the generated script
@@ -464,7 +463,6 @@
currentNodeIndex: 0,
ifNestLevel: 0,
moduleNameCount: make(map[string]int),
- builtinMakeVars: map[string]starlarkExpr{},
variables: make(map[string]variable),
dependentModules: make(map[string]*moduleInfo),
soongNamespaces: make(map[string]map[string]bool),
@@ -600,9 +598,6 @@
}
}
- // TODO(asmundak): move evaluation to a separate pass
- asgn.value, _ = asgn.value.eval(ctx.builtinMakeVars)
-
asgn.previous = ctx.lastAssignment(name)
ctx.setLastAssignment(name, asgn)
switch a.Type {
@@ -629,7 +624,6 @@
ctx.wrapBadExpr(xBad)
return
}
- val, _ = val.eval(ctx.builtinMakeVars)
// Unfortunately, Soong namespaces can be set up by directly setting corresponding Make
// variables instead of via add_soong_config_namespace + add_soong_config_var_value.
@@ -785,7 +779,6 @@
func (ctx *parseContext) handleSubConfig(
v mkparser.Node, pathExpr starlarkExpr, loadAlways bool, processModule func(inheritedModule)) {
- pathExpr, _ = pathExpr.eval(ctx.builtinMakeVars)
// In a simple case, the name of a module to inherit/include is known statically.
if path, ok := maybeString(pathExpr); ok {
@@ -1122,7 +1115,7 @@
return xBad, true
}
return &eqExpr{
- left: &variableRefExpr{ctx.addVariable("TARGET_BOARD_PLATFORM"), false},
+ left: NewVariableRefExpr(ctx.addVariable("TARGET_BOARD_PLATFORM"), false),
right: call.args[0],
isEq: isEq,
}, true
@@ -1131,7 +1124,7 @@
return xBad, true
}
return &inExpr{
- expr: &variableRefExpr{ctx.addVariable("TARGET_BOARD_PLATFORM"), false},
+ expr: NewVariableRefExpr(ctx.addVariable("TARGET_BOARD_PLATFORM"), false),
list: maybeConvertToStringList(call.args[0]),
isNot: !isEq,
}, true
@@ -1140,7 +1133,7 @@
return xBad, true
}
return &inExpr{
- expr: &variableRefExpr{ctx.addVariable("TARGET_PRODUCT"), true},
+ expr: NewVariableRefExpr(ctx.addVariable("TARGET_PRODUCT"), true),
list: maybeConvertToStringList(call.args[0]),
isNot: !isEq,
}, true
@@ -1153,8 +1146,8 @@
return ctx.newBadExpr(directive, "cannot handle non-constant argument to is-vendor-board-platform"), true
}
return &inExpr{
- expr: &variableRefExpr{ctx.addVariable("TARGET_BOARD_PLATFORM"), false},
- list: &variableRefExpr{ctx.addVariable(s + "_BOARD_PLATFORMS"), true},
+ expr: NewVariableRefExpr(ctx.addVariable("TARGET_BOARD_PLATFORM"), false),
+ list: NewVariableRefExpr(ctx.addVariable(s+"_BOARD_PLATFORMS"), true),
isNot: !isEq,
}, true
@@ -1183,8 +1176,8 @@
// if the expression is ifneq (,$(call is-vendor-board-platform,...)), negate==true,
// so we should set inExpr.isNot to false
return &inExpr{
- expr: &variableRefExpr{ctx.addVariable("TARGET_BOARD_PLATFORM"), false},
- list: &variableRefExpr{ctx.addVariable("QCOM_BOARD_PLATFORMS"), true},
+ expr: NewVariableRefExpr(ctx.addVariable("TARGET_BOARD_PLATFORM"), false),
+ list: NewVariableRefExpr(ctx.addVariable("QCOM_BOARD_PLATFORMS"), true),
isNot: isEq,
}, true
}
@@ -1366,12 +1359,12 @@
args: []starlarkExpr{
&stringLiteralExpr{literal: substParts[0]},
&stringLiteralExpr{literal: substParts[1]},
- &variableRefExpr{v, ctx.lastAssignment(v.name()) != nil},
+ NewVariableRefExpr(v, ctx.lastAssignment(v.name()) != nil),
},
}
}
if v := ctx.addVariable(refDump); v != nil {
- return &variableRefExpr{v, ctx.lastAssignment(v.name()) != nil}
+ return NewVariableRefExpr(v, ctx.lastAssignment(v.name()) != nil)
}
return ctx.newBadExpr(node, "unknown variable %s", refDump)
}
@@ -1416,7 +1409,7 @@
case "firstword", "lastword":
return ctx.parseFirstOrLastwordFunc(node, expr.name, args)
case "my-dir":
- return &variableRefExpr{ctx.addVariable("LOCAL_PATH"), true}
+ return NewVariableRefExpr(ctx.addVariable("LOCAL_PATH"), true)
case "subst", "patsubst":
return ctx.parseSubstFunc(node, expr.name, args)
default:
@@ -1579,16 +1572,18 @@
// If we reached here, it's neither string literal nor a simple variable,
// we need a full-blown interpolation node that will generate
// "a%b%c" % (X, Y) for a$(X)b$(Y)c
- xInterp := &interpolateExpr{args: make([]starlarkExpr, len(mk.Variables))}
- for i, ref := range mk.Variables {
- arg := ctx.parseReference(node, ref.Name)
- if x, ok := arg.(*badExpr); ok {
- return x
+ parts := make([]starlarkExpr, len(mk.Variables)+len(mk.Strings))
+ for i := 0; i < len(parts); i++ {
+ if i%2 == 0 {
+ parts[i] = &stringLiteralExpr{literal: mk.Strings[i/2]}
+ } else {
+ parts[i] = ctx.parseReference(node, mk.Variables[i/2].Name)
+ if x, ok := parts[i].(*badExpr); ok {
+ return x
+ }
}
- xInterp.args[i] = arg
}
- xInterp.chunks = append(xInterp.chunks, mk.Strings...)
- return xInterp
+ return NewInterpolateExpr(parts)
}
// Handles the statements whose treatment is the same in all contexts: comment,
diff --git a/python/androidmk.go b/python/androidmk.go
index ccc85ec..233d867 100644
--- a/python/androidmk.go
+++ b/python/androidmk.go
@@ -78,7 +78,7 @@
entries.Required = append(entries.Required, "libc++")
entries.ExtraEntries = append(entries.ExtraEntries,
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- path, file := filepath.Split(installer.path.ToMakePath().String())
+ path, file := filepath.Split(installer.path.String())
stem := strings.TrimSuffix(file, filepath.Ext(file))
entries.SetString("LOCAL_MODULE_SUFFIX", filepath.Ext(file))
diff --git a/rust/androidmk.go b/rust/androidmk.go
index 1f18b4a..4e58632 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -193,7 +193,7 @@
ret.ExtraEntries = append(ret.ExtraEntries,
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetPath("LOCAL_SOONG_UNSTRIPPED_BINARY", compiler.unstrippedOutputFile)
- path, file := filepath.Split(compiler.path.ToMakePath().String())
+ path, file := filepath.Split(compiler.path.String())
stem, suffix, _ := android.SplitFileExt(file)
entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
entries.SetString("LOCAL_MODULE_PATH", path)
diff --git a/rust/library.go b/rust/library.go
index 07843fe..bb2e83f 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -681,6 +681,12 @@
}
variation := v.(*Module).ModuleBase.ImageVariation().Variation
+ if strings.HasPrefix(variation, cc.VendorVariationPrefix) {
+ // TODO(b/204303985)
+ // Disable vendor dylibs until they are supported
+ v.(*Module).Disable()
+ }
+
if strings.HasPrefix(variation, cc.VendorVariationPrefix) &&
m.HasVendorVariant() &&
!snapshot.IsVendorProprietaryModule(mctx) &&
diff --git a/rust/rust.go b/rust/rust.go
index 300c0f5..c2585f2 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -1312,10 +1312,6 @@
return mod.InRecovery()
}
-func (mod *Module) InstallBypassMake() bool {
- return true
-}
-
func linkPathFromFilePath(filepath android.Path) string {
return strings.Split(filepath.String(), filepath.Base())[0]
}
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index 2d98e8b..e1df8ac 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -166,10 +166,6 @@
var _ android.HostToolProvider = (*ShBinary)(nil)
-func (s *ShBinary) InstallBypassMake() bool {
- return true
-}
-
type ShTest struct {
ShBinary
@@ -435,7 +431,7 @@
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
s.customAndroidMkEntries(entries)
- entries.SetPath("LOCAL_MODULE_PATH", s.installDir.ToMakePath())
+ entries.SetPath("LOCAL_MODULE_PATH", s.installDir)
entries.AddCompatibilityTestSuites(s.testProperties.Test_suites...)
if s.testConfig != nil {
entries.SetPath("LOCAL_FULL_TEST_CONFIG", s.testConfig)
diff --git a/sh/sh_binary_test.go b/sh/sh_binary_test.go
index 865d5f3..28b6fb9 100644
--- a/sh/sh_binary_test.go
+++ b/sh/sh_binary_test.go
@@ -42,7 +42,10 @@
}
func TestShTestSubDir(t *testing.T) {
- ctx, config := testShBinary(t, `
+ result := android.GroupFixturePreparers(
+ prepareForShTest,
+ android.FixtureModifyConfig(android.SetKatiEnabledForTests),
+ ).RunTestWithBp(t, `
sh_test {
name: "foo",
src: "test.sh",
@@ -50,17 +53,20 @@
}
`)
- mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
+ mod := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
- entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
+ entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0]
expectedPath := "out/target/product/test_device/data/nativetest64/foo_test"
actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0]
- android.AssertStringPathRelativeToTopEquals(t, "LOCAL_MODULE_PATH[0]", config, expectedPath, actualPath)
+ android.AssertStringPathRelativeToTopEquals(t, "LOCAL_MODULE_PATH[0]", result.Config, expectedPath, actualPath)
}
func TestShTest(t *testing.T) {
- ctx, config := testShBinary(t, `
+ result := android.GroupFixturePreparers(
+ prepareForShTest,
+ android.FixtureModifyConfig(android.SetKatiEnabledForTests),
+ ).RunTestWithBp(t, `
sh_test {
name: "foo",
src: "test.sh",
@@ -72,13 +78,13 @@
}
`)
- mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
+ mod := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
- entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
+ entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0]
expectedPath := "out/target/product/test_device/data/nativetest64/foo"
actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0]
- android.AssertStringPathRelativeToTopEquals(t, "LOCAL_MODULE_PATH[0]", config, expectedPath, actualPath)
+ android.AssertStringPathRelativeToTopEquals(t, "LOCAL_MODULE_PATH[0]", result.Config, expectedPath, actualPath)
expectedData := []string{":testdata/data1", ":testdata/sub/data2"}
actualData := entries.EntryMap["LOCAL_TEST_DATA"]
diff --git a/snapshot/host_snapshot.go b/snapshot/host_snapshot.go
index 2a25a00..252cef8 100644
--- a/snapshot/host_snapshot.go
+++ b/snapshot/host_snapshot.go
@@ -180,7 +180,7 @@
DistFiles: android.MakeDefaultDistFiles(f.zipFile.Path()),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", f.installDir.ToMakePath().String())
+ entries.SetString("LOCAL_MODULE_PATH", f.installDir.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", f.installFileName())
},
},