summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/arch.go12
-rw-r--r--android/config.go4
-rw-r--r--android/neverallow.go2
-rw-r--r--android/sdk.go17
-rw-r--r--android/variable.go2
5 files changed, 35 insertions, 2 deletions
diff --git a/android/arch.go b/android/arch.go
index cbf77c758..3587b469f 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -655,7 +655,8 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) {
prefer32 := os == Windows
// Determine the multilib selection for this module.
- multilib, extraMultilib := decodeMultilib(base, os)
+ force_first_on_device := mctx.Config().ForceMultilibFirstOnDevice()
+ multilib, extraMultilib := decodeMultilib(base, os, force_first_on_device)
// Convert the multilib selection into a list of Targets.
targets, err := decodeMultilibTargets(multilib, osTargets, prefer32)
@@ -730,7 +731,7 @@ func addTargetProperties(m Module, target Target, multiTargets []Target, primary
// multilib from the factory's call to InitAndroidArchModule if none was set. For modules that
// called InitAndroidMultiTargetsArchModule it always returns "common" for multilib, and returns
// the actual multilib in extraMultilib.
-func decodeMultilib(base *ModuleBase, os OsType) (multilib, extraMultilib string) {
+func decodeMultilib(base *ModuleBase, os OsType, force_first_on_device bool) (multilib, extraMultilib string) {
// First check the "android.compile_multilib" or "host.compile_multilib" properties.
switch os.Class {
case Device:
@@ -749,6 +750,13 @@ func decodeMultilib(base *ModuleBase, os OsType) (multilib, extraMultilib string
multilib = base.commonProperties.Default_multilib
}
+ // If a device is configured with multiple targets, this option
+ // force all device targets that prefer32 to be compiled only as
+ // the first target.
+ if force_first_on_device && os.Class == Device && (multilib == "prefer32" || multilib == "first_prefer32") {
+ multilib = "first"
+ }
+
if base.commonProperties.UseTargetVariants {
// Darwin has the concept of "universal binaries" which is implemented in Soong by
// building both x86_64 and arm64 variants, and having select module types know how to
diff --git a/android/config.go b/android/config.go
index 8f7adaa4b..fa704faac 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1757,6 +1757,10 @@ func (c *deviceConfig) GenerateAidlNdkPlatformBackend() bool {
return c.config.productVariables.GenerateAidlNdkPlatformBackend
}
+func (c *config) ForceMultilibFirstOnDevice() bool {
+ return c.productVariables.ForceMultilibFirstOnDevice
+}
+
// The ConfiguredJarList struct provides methods for handling a list of (apex, jar) pairs.
// Such lists are used in the build system for things like bootclasspath jars or system server jars.
// The apex part is either an apex name, or a special names "platform" or "system_ext". Jar is a
diff --git a/android/neverallow.go b/android/neverallow.go
index f87cebbc9..609b55a06 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -152,7 +152,9 @@ func createJavaDeviceForHostRules() []Rule {
javaDeviceForHostProjectsAllowedList := []string{
"development/build",
"external/guava",
+ "external/kotlinx.coroutines",
"external/robolectric-shadows",
+ "external/robolectric",
"frameworks/layoutlib",
}
diff --git a/android/sdk.go b/android/sdk.go
index 3a5624030..1ce692fb6 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -661,6 +661,10 @@ type SdkMemberType interface {
// an Android.bp file.
RequiresBpProperty() bool
+ // SupportedBuildReleases returns the string representation of a set of target build releases that
+ // support this member type.
+ SupportedBuildReleases() string
+
// UsableWithSdkAndSdkSnapshot returns true if the member type supports the sdk/sdk_snapshot,
// false otherwise.
UsableWithSdkAndSdkSnapshot() bool
@@ -760,6 +764,11 @@ type SdkMemberTypeBase struct {
// property to be specifiable in an Android.bp file.
BpPropertyNotRequired bool
+ // The name of the first targeted build release.
+ //
+ // If not specified then it is assumed to be available on all targeted build releases.
+ SupportedBuildReleaseSpecification string
+
SupportsSdk bool
HostOsDependent bool
@@ -780,6 +789,10 @@ func (b *SdkMemberTypeBase) RequiresBpProperty() bool {
return !b.BpPropertyNotRequired
}
+func (b *SdkMemberTypeBase) SupportedBuildReleases() string {
+ return b.SupportedBuildReleaseSpecification
+}
+
func (b *SdkMemberTypeBase) UsableWithSdkAndSdkSnapshot() bool {
return b.SupportsSdk
}
@@ -933,6 +946,10 @@ type SdkMemberContext interface {
// RequiresTrait returns true if this member is expected to provide the specified trait.
RequiresTrait(trait SdkMemberTrait) bool
+
+ // IsTargetBuildBeforeTiramisu return true if the target build release for which this snapshot is
+ // being generated is before Tiramisu, i.e. S.
+ IsTargetBuildBeforeTiramisu() bool
}
// ExportedComponentsInfo contains information about the components that this module exports to an
diff --git a/android/variable.go b/android/variable.go
index 490fa7af6..aa6b1e2c1 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -490,6 +490,8 @@ type productVariables struct {
SepolicyFreezeTestExtraPrebuiltDirs []string `json:",omitempty"`
GenerateAidlNdkPlatformBackend bool `json:",omitempty"`
+
+ ForceMultilibFirstOnDevice bool `json:",omitempty"`
}
func boolPtr(v bool) *bool {