Merge "Add code to enable USE_BAZEL=1 m functionality in AOSP."
diff --git a/android/config.go b/android/config.go
index 004b743..8b5ede6 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1336,11 +1336,6 @@
return len(l.jars)
}
-// Apex component of idx-th pair on the list.
-func (l *ConfiguredJarList) apex(idx int) string {
- return l.apexes[idx]
-}
-
// Jar component of idx-th pair on the list.
func (l *ConfiguredJarList) Jar(idx int) string {
return l.jars[idx]
@@ -1354,7 +1349,7 @@
// If the list contains the given (apex, jar) pair.
func (l *ConfiguredJarList) containsApexJarPair(apex, jar string) bool {
for i := 0; i < l.Len(); i++ {
- if apex == l.apex(i) && jar == l.Jar(i) {
+ if apex == l.apexes[i] && jar == l.jars[i] {
return true
}
}
@@ -1367,31 +1362,34 @@
}
// Append an (apex, jar) pair to the list.
-func (l *ConfiguredJarList) Append(apex string, jar string) {
- l.apexes = append(l.apexes, apex)
- l.jars = append(l.jars, jar)
+func (l *ConfiguredJarList) Append(apex string, jar string) ConfiguredJarList {
+ // Create a copy of the backing arrays before appending to avoid sharing backing
+ // arrays that are mutated across instances.
+ apexes := make([]string, 0, len(l.apexes)+1)
+ copy(apexes, l.apexes)
+ apexes = append(apexes, apex)
+
+ jars := make([]string, 0, len(l.jars)+1)
+ copy(jars, l.jars)
+ jars = append(l.jars, jar)
+
+ return ConfiguredJarList{apexes, jars}
}
// Filter out sublist.
-func (l *ConfiguredJarList) RemoveList(list ConfiguredJarList) {
+func (l *ConfiguredJarList) RemoveList(list ConfiguredJarList) ConfiguredJarList {
apexes := make([]string, 0, l.Len())
jars := make([]string, 0, l.Len())
for i, jar := range l.jars {
- apex := l.apex(i)
+ apex := l.apexes[i]
if !list.containsApexJarPair(apex, jar) {
apexes = append(apexes, apex)
jars = append(jars, jar)
}
}
- l.apexes = apexes
- l.jars = jars
-}
-
-// A copy of itself.
-func (l *ConfiguredJarList) CopyOf() ConfiguredJarList {
- return ConfiguredJarList{CopyOf(l.apexes), CopyOf(l.jars)}
+ return ConfiguredJarList{apexes, jars}
}
// A copy of the list of strings containing jar components.
@@ -1404,7 +1402,7 @@
pairs := make([]string, 0, l.Len())
for i, jar := range l.jars {
- apex := l.apex(i)
+ apex := l.apexes[i]
pairs = append(pairs, apex+":"+jar)
}
@@ -1466,17 +1464,16 @@
}
func CreateConfiguredJarList(ctx PathContext, list []string) ConfiguredJarList {
- apexes := make([]string, 0, len(list))
- jars := make([]string, 0, len(list))
+ apexes := make([]string, len(list))
+ jars := make([]string, len(list))
- l := ConfiguredJarList{apexes, jars}
-
- for _, apexjar := range list {
+ for i, apexjar := range list {
apex, jar := splitConfiguredJarPair(ctx, apexjar)
- l.Append(apex, jar)
+ apexes[i] = apex
+ jars[i] = jar
}
- return l
+ return ConfiguredJarList{apexes, jars}
}
func EmptyConfiguredJarList() ConfiguredJarList {
diff --git a/android/paths.go b/android/paths.go
index 4eb9d20..a056ad4 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -1237,7 +1237,12 @@
type InstallPath struct {
basePath
- baseDir string // "../" for Make paths to convert "out/soong" to "out", "" for Soong paths
+ // partitionDir is the part of the InstallPath that is automatically determined according to the context.
+ // For example, it is host/<os>-<arch> for host modules, and target/product/<device>/<partition> for device modules.
+ partitionDir string
+
+ // makePath indicates whether this path is for Soong (false) or Make (true).
+ makePath bool
}
func (p InstallPath) buildDir() string {
@@ -1250,7 +1255,23 @@
func (p InstallPath) writablePath() {}
func (p InstallPath) String() string {
- return filepath.Join(p.config.buildDir, p.baseDir, p.path)
+ if p.makePath {
+ // Make path starts with out/ instead of out/soong.
+ return filepath.Join(p.config.buildDir, "../", p.path)
+ } else {
+ return filepath.Join(p.config.buildDir, p.path)
+ }
+}
+
+// PartitionDir returns the path to the partition where the install path is rooted at. It is
+// out/soong/target/product/<device>/<partition> for device modules, and out/soong/host/<os>-<arch> for host modules.
+// The ./soong is dropped if the install path is for Make.
+func (p InstallPath) PartitionDir() string {
+ if p.makePath {
+ return filepath.Join(p.config.buildDir, "../", p.partitionDir)
+ } else {
+ return filepath.Join(p.config.buildDir, p.partitionDir)
+ }
}
// Join creates a new InstallPath with paths... joined with the current path. The
@@ -1271,7 +1292,7 @@
// ToMakePath returns a new InstallPath that points to Make's install directory instead of Soong's,
// i.e. out/ instead of out/soong/.
func (p InstallPath) ToMakePath() InstallPath {
- p.baseDir = "../"
+ p.makePath = true
return p
}
@@ -1301,10 +1322,10 @@
func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string, debug bool,
pathComponents ...string) InstallPath {
- var outPaths []string
+ var partionPaths []string
if os.Class == Device {
- outPaths = []string{"target", "product", ctx.Config().DeviceName(), partition}
+ partionPaths = []string{"target", "product", ctx.Config().DeviceName(), partition}
} else {
osName := os.String()
if os == Linux {
@@ -1320,30 +1341,33 @@
if os.Class == Host && (arch == X86_64 || arch == Common) {
archName = "x86"
}
- outPaths = []string{"host", osName + "-" + archName, partition}
+ partionPaths = []string{"host", osName + "-" + archName, partition}
}
if debug {
- outPaths = append([]string{"debug"}, outPaths...)
+ partionPaths = append([]string{"debug"}, partionPaths...)
}
- outPaths = append(outPaths, pathComponents...)
- path, err := validatePath(outPaths...)
+ partionPath, err := validatePath(partionPaths...)
if err != nil {
reportPathError(ctx, err)
}
- ret := InstallPath{basePath{path, ctx.Config(), ""}, ""}
+ base := InstallPath{
+ basePath: basePath{partionPath, ctx.Config(), ""},
+ partitionDir: partionPath,
+ makePath: false,
+ }
- return ret
+ return base.Join(ctx, pathComponents...)
}
func pathForNdkOrSdkInstall(ctx PathContext, prefix string, paths []string) InstallPath {
- paths = append([]string{prefix}, paths...)
- path, err := validatePath(paths...)
- if err != nil {
- reportPathError(ctx, err)
+ base := InstallPath{
+ basePath: basePath{prefix, ctx.Config(), ""},
+ partitionDir: prefix,
+ makePath: false,
}
- return InstallPath{basePath{path, ctx.Config(), ""}, ""}
+ return base.Join(ctx, paths...)
}
func PathForNdkInstall(ctx PathContext, paths ...string) InstallPath {
diff --git a/android/paths_test.go b/android/paths_test.go
index 9ecf4a1..51e4ba5 100644
--- a/android/paths_test.go
+++ b/android/paths_test.go
@@ -264,10 +264,11 @@
deviceTarget := Target{Os: Android, Arch: Arch{ArchType: Arm64}}
testCases := []struct {
- name string
- ctx *moduleInstallPathContextImpl
- in []string
- out string
+ name string
+ ctx *moduleInstallPathContextImpl
+ in []string
+ out string
+ partitionDir string
}{
{
name: "host binary",
@@ -277,8 +278,9 @@
target: hostTarget,
},
},
- in: []string{"bin", "my_test"},
- out: "host/linux-x86/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "host/linux-x86/bin/my_test",
+ partitionDir: "host/linux-x86",
},
{
@@ -289,8 +291,9 @@
target: deviceTarget,
},
},
- in: []string{"bin", "my_test"},
- out: "target/product/test_device/system/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "target/product/test_device/system/bin/my_test",
+ partitionDir: "target/product/test_device/system",
},
{
name: "vendor binary",
@@ -303,8 +306,9 @@
},
},
},
- in: []string{"bin", "my_test"},
- out: "target/product/test_device/vendor/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "target/product/test_device/vendor/bin/my_test",
+ partitionDir: "target/product/test_device/vendor",
},
{
name: "odm binary",
@@ -317,8 +321,9 @@
},
},
},
- in: []string{"bin", "my_test"},
- out: "target/product/test_device/odm/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "target/product/test_device/odm/bin/my_test",
+ partitionDir: "target/product/test_device/odm",
},
{
name: "product binary",
@@ -331,8 +336,9 @@
},
},
},
- in: []string{"bin", "my_test"},
- out: "target/product/test_device/product/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "target/product/test_device/product/bin/my_test",
+ partitionDir: "target/product/test_device/product",
},
{
name: "system_ext binary",
@@ -345,8 +351,9 @@
},
},
},
- in: []string{"bin", "my_test"},
- out: "target/product/test_device/system_ext/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "target/product/test_device/system_ext/bin/my_test",
+ partitionDir: "target/product/test_device/system_ext",
},
{
name: "root binary",
@@ -357,8 +364,9 @@
},
inRoot: true,
},
- in: []string{"my_test"},
- out: "target/product/test_device/root/my_test",
+ in: []string{"my_test"},
+ out: "target/product/test_device/root/my_test",
+ partitionDir: "target/product/test_device/root",
},
{
name: "recovery binary",
@@ -369,8 +377,9 @@
},
inRecovery: true,
},
- in: []string{"bin/my_test"},
- out: "target/product/test_device/recovery/root/system/bin/my_test",
+ in: []string{"bin/my_test"},
+ out: "target/product/test_device/recovery/root/system/bin/my_test",
+ partitionDir: "target/product/test_device/recovery/root/system",
},
{
name: "recovery root binary",
@@ -382,8 +391,9 @@
inRecovery: true,
inRoot: true,
},
- in: []string{"my_test"},
- out: "target/product/test_device/recovery/root/my_test",
+ in: []string{"my_test"},
+ out: "target/product/test_device/recovery/root/my_test",
+ partitionDir: "target/product/test_device/recovery/root",
},
{
@@ -395,8 +405,9 @@
},
inData: true,
},
- in: []string{"nativetest", "my_test"},
- out: "target/product/test_device/data/nativetest/my_test",
+ in: []string{"nativetest", "my_test"},
+ out: "target/product/test_device/data/nativetest/my_test",
+ partitionDir: "target/product/test_device/data",
},
{
name: "vendor native test binary",
@@ -410,8 +421,9 @@
},
inData: true,
},
- in: []string{"nativetest", "my_test"},
- out: "target/product/test_device/data/nativetest/my_test",
+ in: []string{"nativetest", "my_test"},
+ out: "target/product/test_device/data/nativetest/my_test",
+ partitionDir: "target/product/test_device/data",
},
{
name: "odm native test binary",
@@ -425,8 +437,9 @@
},
inData: true,
},
- in: []string{"nativetest", "my_test"},
- out: "target/product/test_device/data/nativetest/my_test",
+ in: []string{"nativetest", "my_test"},
+ out: "target/product/test_device/data/nativetest/my_test",
+ partitionDir: "target/product/test_device/data",
},
{
name: "product native test binary",
@@ -440,8 +453,9 @@
},
inData: true,
},
- in: []string{"nativetest", "my_test"},
- out: "target/product/test_device/data/nativetest/my_test",
+ in: []string{"nativetest", "my_test"},
+ out: "target/product/test_device/data/nativetest/my_test",
+ partitionDir: "target/product/test_device/data",
},
{
@@ -456,8 +470,9 @@
},
inData: true,
},
- in: []string{"nativetest", "my_test"},
- out: "target/product/test_device/data/nativetest/my_test",
+ in: []string{"nativetest", "my_test"},
+ out: "target/product/test_device/data/nativetest/my_test",
+ partitionDir: "target/product/test_device/data",
},
{
@@ -469,8 +484,9 @@
},
inSanitizerDir: true,
},
- in: []string{"bin", "my_test"},
- out: "target/product/test_device/data/asan/system/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "target/product/test_device/data/asan/system/bin/my_test",
+ partitionDir: "target/product/test_device/data/asan/system",
},
{
name: "sanitized vendor binary",
@@ -484,8 +500,9 @@
},
inSanitizerDir: true,
},
- in: []string{"bin", "my_test"},
- out: "target/product/test_device/data/asan/vendor/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "target/product/test_device/data/asan/vendor/bin/my_test",
+ partitionDir: "target/product/test_device/data/asan/vendor",
},
{
name: "sanitized odm binary",
@@ -499,8 +516,9 @@
},
inSanitizerDir: true,
},
- in: []string{"bin", "my_test"},
- out: "target/product/test_device/data/asan/odm/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "target/product/test_device/data/asan/odm/bin/my_test",
+ partitionDir: "target/product/test_device/data/asan/odm",
},
{
name: "sanitized product binary",
@@ -514,8 +532,9 @@
},
inSanitizerDir: true,
},
- in: []string{"bin", "my_test"},
- out: "target/product/test_device/data/asan/product/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "target/product/test_device/data/asan/product/bin/my_test",
+ partitionDir: "target/product/test_device/data/asan/product",
},
{
@@ -530,8 +549,9 @@
},
inSanitizerDir: true,
},
- in: []string{"bin", "my_test"},
- out: "target/product/test_device/data/asan/system_ext/bin/my_test",
+ in: []string{"bin", "my_test"},
+ out: "target/product/test_device/data/asan/system_ext/bin/my_test",
+ partitionDir: "target/product/test_device/data/asan/system_ext",
},
{
@@ -544,8 +564,9 @@
inData: true,
inSanitizerDir: true,
},
- in: []string{"nativetest", "my_test"},
- out: "target/product/test_device/data/asan/data/nativetest/my_test",
+ in: []string{"nativetest", "my_test"},
+ out: "target/product/test_device/data/asan/data/nativetest/my_test",
+ partitionDir: "target/product/test_device/data/asan/data",
},
{
name: "sanitized vendor native test binary",
@@ -560,8 +581,9 @@
inData: true,
inSanitizerDir: true,
},
- in: []string{"nativetest", "my_test"},
- out: "target/product/test_device/data/asan/data/nativetest/my_test",
+ in: []string{"nativetest", "my_test"},
+ out: "target/product/test_device/data/asan/data/nativetest/my_test",
+ partitionDir: "target/product/test_device/data/asan/data",
},
{
name: "sanitized odm native test binary",
@@ -576,8 +598,9 @@
inData: true,
inSanitizerDir: true,
},
- in: []string{"nativetest", "my_test"},
- out: "target/product/test_device/data/asan/data/nativetest/my_test",
+ in: []string{"nativetest", "my_test"},
+ out: "target/product/test_device/data/asan/data/nativetest/my_test",
+ partitionDir: "target/product/test_device/data/asan/data",
},
{
name: "sanitized product native test binary",
@@ -592,8 +615,9 @@
inData: true,
inSanitizerDir: true,
},
- in: []string{"nativetest", "my_test"},
- out: "target/product/test_device/data/asan/data/nativetest/my_test",
+ in: []string{"nativetest", "my_test"},
+ out: "target/product/test_device/data/asan/data/nativetest/my_test",
+ partitionDir: "target/product/test_device/data/asan/data",
},
{
name: "sanitized system_ext native test binary",
@@ -608,8 +632,9 @@
inData: true,
inSanitizerDir: true,
},
- in: []string{"nativetest", "my_test"},
- out: "target/product/test_device/data/asan/data/nativetest/my_test",
+ in: []string{"nativetest", "my_test"},
+ out: "target/product/test_device/data/asan/data/nativetest/my_test",
+ partitionDir: "target/product/test_device/data/asan/data",
}, {
name: "device testcases",
ctx: &moduleInstallPathContextImpl{
@@ -619,8 +644,9 @@
},
inTestcases: true,
},
- in: []string{"my_test", "my_test_bin"},
- out: "target/product/test_device/testcases/my_test/my_test_bin",
+ in: []string{"my_test", "my_test_bin"},
+ out: "target/product/test_device/testcases/my_test/my_test_bin",
+ partitionDir: "target/product/test_device/testcases",
}, {
name: "host testcases",
ctx: &moduleInstallPathContextImpl{
@@ -630,8 +656,9 @@
},
inTestcases: true,
},
- in: []string{"my_test", "my_test_bin"},
- out: "host/linux-x86/testcases/my_test/my_test_bin",
+ in: []string{"my_test", "my_test_bin"},
+ out: "host/linux-x86/testcases/my_test/my_test_bin",
+ partitionDir: "host/linux-x86/testcases",
}, {
name: "forced host testcases",
ctx: &moduleInstallPathContextImpl{
@@ -643,8 +670,9 @@
forceOS: &Linux,
forceArch: &X86,
},
- in: []string{"my_test", "my_test_bin"},
- out: "host/linux-x86/testcases/my_test/my_test_bin",
+ in: []string{"my_test", "my_test_bin"},
+ out: "host/linux-x86/testcases/my_test/my_test_bin",
+ partitionDir: "host/linux-x86/testcases",
},
}
@@ -657,10 +685,48 @@
output.basePath.path,
tc.out)
}
+ if output.partitionDir != tc.partitionDir {
+ t.Errorf("unexpected partitionDir:\n got: %q\nwant: %q\n",
+ output.partitionDir, tc.partitionDir)
+ }
})
}
}
+func TestBaseDirForInstallPath(t *testing.T) {
+ testConfig := pathTestConfig("")
+ deviceTarget := Target{Os: Android, Arch: Arch{ArchType: Arm64}}
+
+ ctx := &moduleInstallPathContextImpl{
+ baseModuleContext: baseModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
+ }
+ ctx.baseModuleContext.config = testConfig
+
+ actual := PathForModuleInstall(ctx, "foo", "bar")
+ expectedBaseDir := "target/product/test_device/system"
+ if actual.partitionDir != expectedBaseDir {
+ t.Errorf("unexpected partitionDir:\n got: %q\nwant: %q\n", actual.partitionDir, expectedBaseDir)
+ }
+ expectedRelPath := "foo/bar"
+ if actual.Rel() != expectedRelPath {
+ t.Errorf("unexpected Rel():\n got: %q\nwant: %q\n", actual.Rel(), expectedRelPath)
+ }
+
+ actualAfterJoin := actual.Join(ctx, "baz")
+ // partitionDir is preserved even after joining
+ if actualAfterJoin.partitionDir != expectedBaseDir {
+ t.Errorf("unexpected partitionDir after joining:\n got: %q\nwant: %q\n", actualAfterJoin.partitionDir, expectedBaseDir)
+ }
+ // Rel() is updated though
+ expectedRelAfterJoin := "baz"
+ if actualAfterJoin.Rel() != expectedRelAfterJoin {
+ t.Errorf("unexpected Rel() after joining:\n got: %q\nwant: %q\n", actualAfterJoin.Rel(), expectedRelAfterJoin)
+ }
+}
+
func TestDirectorySortedPaths(t *testing.T) {
config := TestConfig("out", nil, "", map[string][]byte{
"Android.bp": nil,
diff --git a/apex/allowed_deps.txt b/apex/allowed_deps.txt
index 07e78af..c7223c4 100644
--- a/apex/allowed_deps.txt
+++ b/apex/allowed_deps.txt
@@ -278,6 +278,7 @@
libcutils_sockets(minSdkVersion:29)
libdiagnose_usb(minSdkVersion:(no version))
libdl(minSdkVersion:(no version))
+libdmabufheap(minSdkVersion:29)
libeigen(minSdkVersion:(no version))
libfifo(minSdkVersion:29)
libFLAC(minSdkVersion:29)
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 0f8888a..c315124 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -81,13 +81,12 @@
targets := dexpreoptTargets(ctx)
deviceDir := android.PathForOutput(ctx, ctx.Config().DeviceName())
- artModules := global.ArtApexJars.CopyOf()
+ artModules := global.ArtApexJars
// With EMMA_INSTRUMENT_FRAMEWORK=true the Core libraries depend on jacoco.
if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
- artModules.Append("com.android.art", "jacocoagent")
+ artModules = artModules.Append("com.android.art", "jacocoagent")
}
- frameworkModules := global.BootJars.CopyOf()
- frameworkModules.RemoveList(artModules)
+ frameworkModules := global.BootJars.RemoveList(artModules)
artSubdir := "apex/art_boot_images/javalib"
frameworkSubdir := "system/framework"
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index 9d07e41..c3ae75e 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -258,17 +258,17 @@
Inputs(flagsCSV).
FlagWithInput("--unsupported ",
android.PathForSource(ctx, "frameworks/base/config/hiddenapi-unsupported.txt")).
- FlagWithInput("--unsupported-ignore-conflicts ", combinedRemovedApis).
+ FlagWithInput("--unsupported ", combinedRemovedApis).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "removed").
FlagWithInput("--max-target-q ",
android.PathForSource(ctx, "frameworks/base/config/hiddenapi-max-target-q.txt")).
FlagWithInput("--max-target-p ",
android.PathForSource(ctx, "frameworks/base/config/hiddenapi-max-target-p.txt")).
- FlagWithInput("--max-target-o-ignore-conflicts ",
- android.PathForSource(ctx, "frameworks/base/config/hiddenapi-max-target-o.txt")).
+ FlagWithInput("--max-target-o ", android.PathForSource(
+ ctx, "frameworks/base/config/hiddenapi-max-target-o.txt")).Flag("--ignore-conflicts ").
FlagWithInput("--blocked ",
android.PathForSource(ctx, "frameworks/base/config/hiddenapi-force-blocked.txt")).
- FlagWithInput("--unsupported-packages ",
- android.PathForSource(ctx, "frameworks/base/config/hiddenapi-unsupported-packages.txt")).
+ FlagWithInput("--unsupported ", android.PathForSource(
+ ctx, "frameworks/base/config/hiddenapi-unsupported-packages.txt")).Flag("--packages ").
FlagWithOutput("--output ", tempPath)
commitChangeForRestat(rule, tempPath, outputPath)
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index c214e75..c1813ec 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -120,10 +120,8 @@
android_arm64: {
srcs: ["android/arm64/lib/sdkmember.so"],
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/lib/sdkmember.so"],
},
},
@@ -143,10 +141,8 @@
android_arm64: {
srcs: ["android/arm64/lib/sdkmember.so"],
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/lib/sdkmember.so"],
},
},
@@ -162,7 +158,7 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
enabled: true,
},
},
@@ -670,20 +666,21 @@
enabled: false,
},
linux_glibc: {
- enabled: true,
compile_multilib: "both",
},
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/bin/mynativebinary"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["linux_glibc/x86/bin/mynativebinary"],
},
windows: {
- enabled: true,
compile_multilib: "64",
},
windows_x86_64: {
+ enabled: true,
srcs: ["windows/x86_64/bin/mynativebinary.exe"],
},
},
@@ -701,20 +698,21 @@
enabled: false,
},
linux_glibc: {
- enabled: true,
compile_multilib: "both",
},
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/bin/mynativebinary"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["linux_glibc/x86/bin/mynativebinary"],
},
windows: {
- enabled: true,
compile_multilib: "64",
},
windows_x86_64: {
+ enabled: true,
srcs: ["windows/x86_64/bin/mynativebinary.exe"],
},
},
@@ -727,15 +725,20 @@
host_supported: true,
native_binaries: ["myexports_mynativebinary@current"],
target: {
+ windows: {
+ compile_multilib: "64",
+ },
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
enabled: true,
},
- windows: {
+ linux_glibc_x86: {
enabled: true,
- compile_multilib: "64",
+ },
+ windows_x86_64: {
+ enabled: true,
},
},
}
@@ -811,10 +814,8 @@
host: {
enabled: false,
},
- linux_bionic: {
- enabled: true,
- },
linux_bionic_x86_64: {
+ enabled: true,
srcs: ["x86_64/bin/mynativebinary"],
},
},
@@ -832,10 +833,8 @@
host: {
enabled: false,
},
- linux_bionic: {
- enabled: true,
- },
linux_bionic_x86_64: {
+ enabled: true,
srcs: ["x86_64/bin/mynativebinary"],
},
},
@@ -854,10 +853,8 @@
host: {
enabled: false,
},
- linux_bionic: {
- enabled: true,
- },
linux_bionic_x86_64: {
+ enabled: true,
srcs: ["x86_64/lib/mynativelib.so"],
},
},
@@ -875,10 +872,8 @@
host: {
enabled: false,
},
- linux_bionic: {
- enabled: true,
- },
linux_bionic_x86_64: {
+ enabled: true,
srcs: ["x86_64/lib/mynativelib.so"],
},
},
@@ -896,7 +891,7 @@
host: {
enabled: false,
},
- linux_bionic: {
+ linux_bionic_x86_64: {
enabled: true,
},
},
@@ -952,13 +947,12 @@
host: {
enabled: false,
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["x86_64/bin/linker"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["x86/bin/linker"],
},
},
@@ -978,13 +972,12 @@
host: {
enabled: false,
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["x86_64/bin/linker"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["x86/bin/linker"],
},
},
@@ -1000,7 +993,10 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
enabled: true,
},
},
@@ -1345,14 +1341,13 @@
host: {
enabled: false,
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["x86_64/lib/mynativelib.so"],
export_include_dirs: ["x86_64/include_gen/mynativelib"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["x86/lib/mynativelib.so"],
export_include_dirs: ["x86/include_gen/mynativelib"],
},
@@ -1373,14 +1368,13 @@
host: {
enabled: false,
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["x86_64/lib/mynativelib.so"],
export_include_dirs: ["x86_64/include_gen/mynativelib"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["x86/lib/mynativelib.so"],
export_include_dirs: ["x86/include_gen/mynativelib"],
},
@@ -1397,7 +1391,10 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
enabled: true,
},
},
@@ -1464,20 +1461,21 @@
enabled: false,
},
linux_glibc: {
- enabled: true,
compile_multilib: "both",
},
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/lib/mynativelib.so"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["linux_glibc/x86/lib/mynativelib.so"],
},
windows: {
- enabled: true,
compile_multilib: "64",
},
windows_x86_64: {
+ enabled: true,
srcs: ["windows/x86_64/lib/mynativelib.dll"],
},
},
@@ -1495,20 +1493,21 @@
enabled: false,
},
linux_glibc: {
- enabled: true,
compile_multilib: "both",
},
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/lib/mynativelib.so"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["linux_glibc/x86/lib/mynativelib.so"],
},
windows: {
- enabled: true,
compile_multilib: "64",
},
windows_x86_64: {
+ enabled: true,
srcs: ["windows/x86_64/lib/mynativelib.dll"],
},
},
@@ -1521,15 +1520,20 @@
host_supported: true,
native_shared_libs: ["mysdk_mynativelib@current"],
target: {
+ windows: {
+ compile_multilib: "64",
+ },
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
enabled: true,
},
- windows: {
+ linux_glibc_x86: {
enabled: true,
- compile_multilib: "64",
+ },
+ windows_x86_64: {
+ enabled: true,
},
},
}
@@ -1669,14 +1673,13 @@
host: {
enabled: false,
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["x86_64/lib/mynativelib.a"],
export_include_dirs: ["x86_64/include_gen/mynativelib"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["x86/lib/mynativelib.a"],
export_include_dirs: ["x86/include_gen/mynativelib"],
},
@@ -1696,14 +1699,13 @@
host: {
enabled: false,
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["x86_64/lib/mynativelib.a"],
export_include_dirs: ["x86_64/include_gen/mynativelib"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["x86/lib/mynativelib.a"],
export_include_dirs: ["x86/include_gen/mynativelib"],
},
@@ -1720,7 +1722,10 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
enabled: true,
},
},
@@ -1885,10 +1890,8 @@
host: {
enabled: false,
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["x86_64/lib/mynativelib.a"],
export_include_dirs: ["x86_64/include_gen/mynativelib"],
},
@@ -1908,10 +1911,8 @@
host: {
enabled: false,
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["x86_64/lib/mynativelib.a"],
export_include_dirs: ["x86_64/include_gen/mynativelib"],
},
@@ -1929,7 +1930,7 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
enabled: true,
},
},
@@ -2027,7 +2028,10 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
enabled: true,
},
},
@@ -2046,7 +2050,10 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
enabled: true,
},
},
@@ -2062,7 +2069,10 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
enabled: true,
},
},
@@ -2118,9 +2128,14 @@
export_include_dirs: ["android/include/include-android"],
},
linux_glibc: {
- enabled: true,
export_include_dirs: ["linux_glibc/include/include-host"],
},
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
},
}
@@ -2140,9 +2155,14 @@
export_include_dirs: ["android/include/include-android"],
},
linux_glibc: {
- enabled: true,
export_include_dirs: ["linux_glibc/include/include-host"],
},
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
},
}
@@ -2155,7 +2175,10 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
enabled: true,
},
},
@@ -2346,13 +2369,12 @@
android_arm: {
srcs: ["android/arm/lib/sslvariants.so"],
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/lib/sslvariants.so"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["linux_glibc/x86/lib/sslvariants.so"],
},
},
@@ -2377,13 +2399,12 @@
android_arm: {
srcs: ["android/arm/lib/sslvariants.so"],
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/lib/sslvariants.so"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["linux_glibc/x86/lib/sslvariants.so"],
},
},
@@ -2398,7 +2419,10 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
enabled: true,
},
},
@@ -2536,13 +2560,12 @@
android_arm: {
srcs: ["android/arm/lib/stubslib.so"],
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/lib/stubslib.so"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["linux_glibc/x86/lib/stubslib.so"],
},
},
@@ -2571,13 +2594,12 @@
android_arm: {
srcs: ["android/arm/lib/stubslib.so"],
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/lib/stubslib.so"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["linux_glibc/x86/lib/stubslib.so"],
},
},
@@ -2592,7 +2614,10 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
enabled: true,
},
},
@@ -2637,13 +2662,12 @@
android_arm: {
srcs: ["android/arm/lib/mylib.so"],
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/lib/mylib-host.so"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["linux_glibc/x86/lib/mylib-host.so"],
},
},
@@ -2666,13 +2690,12 @@
android_arm: {
srcs: ["android/arm/lib/mylib.so"],
},
- linux_glibc: {
- enabled: true,
- },
linux_glibc_x86_64: {
+ enabled: true,
srcs: ["linux_glibc/x86_64/lib/mylib-host.so"],
},
linux_glibc_x86: {
+ enabled: true,
srcs: ["linux_glibc/x86/lib/mylib-host.so"],
},
},
@@ -2687,7 +2710,10 @@
host: {
enabled: false,
},
- linux_glibc: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
enabled: true,
},
},
diff --git a/sdk/update.go b/sdk/update.go
index f29b5a0..7bf5dea 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -347,34 +347,11 @@
targetPropertySet := snapshotModule.AddPropertySet("target")
- // If host is supported and any member is host OS dependent then disable host
- // by default, so that we can enable each host OS variant explicitly. This
- // avoids problems with implicitly enabled OS variants when the snapshot is
- // used, which might be different from this run (e.g. different build OS).
- hasHostOsDependentMember := false
- if s.HostSupported() {
- for _, memberRef := range memberRefs {
- if memberRef.memberType.IsHostOsDependent() {
- hasHostOsDependentMember = true
- break
- }
- }
- if hasHostOsDependentMember {
- hostPropertySet := targetPropertySet.AddPropertySet("host")
- hostPropertySet.AddProperty("enabled", false)
- }
- }
-
// Iterate over the os types in a fixed order.
for _, osType := range s.getPossibleOsTypes() {
if sdkVariant, ok := osTypeToMemberProperties[osType]; ok {
osPropertySet := targetPropertySet.AddPropertySet(sdkVariant.Target().Os.Name)
- // Enable the variant explicitly when we've disabled it by default on host.
- if hasHostOsDependentMember && osType.Class == android.Host {
- osPropertySet.AddProperty("enabled", true)
- }
-
variantProps := variantToProperties[sdkVariant]
if variantProps.Compile_multilib != "" && variantProps.Compile_multilib != "both" {
osPropertySet.AddProperty("compile_multilib", variantProps.Compile_multilib)
@@ -384,6 +361,31 @@
}
}
+ // If host is supported and any member is host OS dependent then disable host
+ // by default, so that we can enable each host OS variant explicitly. This
+ // avoids problems with implicitly enabled OS variants when the snapshot is
+ // used, which might be different from this run (e.g. different build OS).
+ if s.HostSupported() {
+ var supportedHostTargets []string
+ for _, memberRef := range memberRefs {
+ if memberRef.memberType.IsHostOsDependent() && memberRef.variant.Target().Os.Class == android.Host {
+ targetString := memberRef.variant.Target().Os.String() + "_" + memberRef.variant.Target().Arch.ArchType.String()
+ if !android.InList(targetString, supportedHostTargets) {
+ supportedHostTargets = append(supportedHostTargets, targetString)
+ }
+ }
+ }
+ if len(supportedHostTargets) > 0 {
+ hostPropertySet := targetPropertySet.AddPropertySet("host")
+ hostPropertySet.AddProperty("enabled", false)
+ }
+ // Enable the <os>_<arch> variant explicitly when we've disabled it by default on host.
+ for _, hostTarget := range supportedHostTargets {
+ propertySet := targetPropertySet.AddPropertySet(hostTarget)
+ propertySet.AddProperty("enabled", true)
+ }
+ }
+
// Prune any empty property sets.
snapshotModule.transform(pruneEmptySetTransformer{})
@@ -984,7 +986,7 @@
archTypeName := archType.Name
archVariants := variantsByArchName[archTypeName]
- archInfo := newArchSpecificInfo(ctx, archType, osSpecificVariantPropertiesFactory, archVariants)
+ archInfo := newArchSpecificInfo(ctx, archType, osType, osSpecificVariantPropertiesFactory, archVariants)
osInfo.archInfos = append(osInfo.archInfos, archInfo)
}
@@ -1067,11 +1069,6 @@
osPropertySet = targetPropertySet.AddPropertySet(osType.Name)
archPropertySet = targetPropertySet
- // Enable the variant explicitly when we've disabled it by default on host.
- if ctx.memberType.IsHostOsDependent() && osType.Class == android.Host {
- osPropertySet.AddProperty("enabled", true)
- }
-
// Arch specific properties need to be added to an os and arch specific
// section prefixed with <os>_.
archOsPrefix = osType.Name + "_"
@@ -1105,6 +1102,7 @@
baseInfo
archType android.ArchType
+ osType android.OsType
linkInfos []*linkTypeSpecificInfo
}
@@ -1113,10 +1111,10 @@
// Create a new archTypeSpecificInfo for the specified arch type and its properties
// structures populated with information from the variants.
-func newArchSpecificInfo(ctx android.SdkMemberContext, archType android.ArchType, variantPropertiesFactory variantPropertiesFactoryFunc, archVariants []android.Module) *archTypeSpecificInfo {
+func newArchSpecificInfo(ctx android.SdkMemberContext, archType android.ArchType, osType android.OsType, variantPropertiesFactory variantPropertiesFactoryFunc, archVariants []android.Module) *archTypeSpecificInfo {
// Create an arch specific info into which the variant properties can be copied.
- archInfo := &archTypeSpecificInfo{archType: archType}
+ archInfo := &archTypeSpecificInfo{archType: archType, osType: osType}
// Create the properties into which the arch type specific properties will be
// added.
@@ -1180,6 +1178,10 @@
func (archInfo *archTypeSpecificInfo) addToPropertySet(ctx *memberContext, archPropertySet android.BpPropertySet, archOsPrefix string) {
archTypeName := archInfo.archType.Name
archTypePropertySet := archPropertySet.AddPropertySet(archOsPrefix + archTypeName)
+ // Enable the <os>_<arch> variant explicitly when we've disabled it by default on host.
+ if ctx.memberType.IsHostOsDependent() && archInfo.osType.Class == android.Host {
+ archTypePropertySet.AddProperty("enabled", true)
+ }
addSdkMemberPropertiesToSet(ctx, archInfo.Properties, archTypePropertySet)
for _, linkInfo := range archInfo.linkInfos {