Build against SDKs for native libs only for unbundled apps.
Unbundled APEX modules need to access the platform variant (i.e.
sdk:"") since it's there that the versioned stubs are exposed.
Test: m SOONG_ALLOW_MISSING_DEPENDENCIES=true \
TARGET_BUILD_UNBUNDLED=true toybox
on master-art with prebuilt Runtime (Bionic) APEX SDK. The prebuilt
SDK doesn't have libc.ndk.xxx etc, which e.g. libcrypto would depend
on without this CL, since it specifies sdk_version.
Bug: 157549171
Change-Id: I3095e42beb2b48421bfb81be942cc2ac30405fd0
diff --git a/android/config.go b/android/config.go
index a53f44a..b906108 100644
--- a/android/config.go
+++ b/android/config.go
@@ -712,10 +712,17 @@
return Bool(c.productVariables.Allow_missing_dependencies)
}
+// Returns true if building without full platform sources.
func (c *config) UnbundledBuild() bool {
return Bool(c.productVariables.Unbundled_build)
}
+// Returns true if building apps that aren't bundled with the platform.
+// UnbundledBuild() is always true when this is true.
+func (c *config) UnbundledBuildApps() bool {
+ return Bool(c.productVariables.Unbundled_build_apps)
+}
+
func (c *config) UnbundledBuildUsePrebuiltSdks() bool {
return Bool(c.productVariables.Unbundled_build) && !Bool(c.productVariables.Unbundled_build_sdks_from_source)
}
diff --git a/android/variable.go b/android/variable.go
index 863fe5a..b2149c3 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -216,6 +216,7 @@
Allow_missing_dependencies *bool `json:",omitempty"`
Unbundled_build *bool `json:",omitempty"`
+ Unbundled_build_apps *bool `json:",omitempty"`
Unbundled_build_sdks_from_source *bool `json:",omitempty"`
Malloc_not_svelte *bool `json:",omitempty"`
Malloc_zero_contents *bool `json:",omitempty"`