From 1f367bfe8b63fd9a27ee361b625aec6458ab102c Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 18 Dec 2018 22:46:24 -0800 Subject: [PATCH] Add a flag to allow unbundled builds to build SDKs from source Mainline modules are tightly coupled to the platform, and should build against the current SDK from source and not prebuilts. Add a flag UNBUNDLED_BUILD_SDKS_FROM_SOURCE to specify that a TARGET_BUILD_APPS build should build the current SDK instead of using the prebuilts. Bug: 121194841 Bug: 121231426 Test: no change to out/build-aosp_sailfish.ninja Test: forrest unbundled build Test: forrest master apps build Test: forrest mainline modules build Change-Id: I45a40a335483dae2fe192721df9b31bdbab97ee5 --- android/config.go | 4 ++++ android/variable.go | 33 +++++++++++++++++---------------- java/aar.go | 2 +- java/java.go | 2 +- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/android/config.go b/android/config.go index a0954b67e..f046318ef 100644 --- a/android/config.go +++ b/android/config.go @@ -569,6 +569,10 @@ func (c *config) UnbundledBuild() bool { return Bool(c.productVariables.Unbundled_build) } +func (c *config) UnbundledBuildPrebuiltSdks() bool { + return Bool(c.productVariables.Unbundled_build) && !Bool(c.productVariables.Unbundled_build_sdks_from_source) +} + func (c *config) IsPdkBuild() bool { return Bool(c.productVariables.Pdk) } diff --git a/android/variable.go b/android/variable.go index 85937e3b1..a1cdea16a 100644 --- a/android/variable.go +++ b/android/variable.go @@ -177,22 +177,23 @@ type productVariables struct { AppsDefaultVersionName *string `json:",omitempty"` - Allow_missing_dependencies *bool `json:",omitempty"` - Unbundled_build *bool `json:",omitempty"` - Malloc_not_svelte *bool `json:",omitempty"` - Safestack *bool `json:",omitempty"` - HostStaticBinaries *bool `json:",omitempty"` - Binder32bit *bool `json:",omitempty"` - UseGoma *bool `json:",omitempty"` - Debuggable *bool `json:",omitempty"` - Eng *bool `json:",omitempty"` - Treble_linker_namespaces *bool `json:",omitempty"` - Enforce_vintf_manifest *bool `json:",omitempty"` - Pdk *bool `json:",omitempty"` - Uml *bool `json:",omitempty"` - Use_lmkd_stats_log *bool `json:",omitempty"` - Arc *bool `json:",omitempty"` - MinimizeJavaDebugInfo *bool `json:",omitempty"` + Allow_missing_dependencies *bool `json:",omitempty"` + Unbundled_build *bool `json:",omitempty"` + Unbundled_build_sdks_from_source *bool `json:",omitempty"` + Malloc_not_svelte *bool `json:",omitempty"` + Safestack *bool `json:",omitempty"` + HostStaticBinaries *bool `json:",omitempty"` + Binder32bit *bool `json:",omitempty"` + UseGoma *bool `json:",omitempty"` + Debuggable *bool `json:",omitempty"` + Eng *bool `json:",omitempty"` + Treble_linker_namespaces *bool `json:",omitempty"` + Enforce_vintf_manifest *bool `json:",omitempty"` + Pdk *bool `json:",omitempty"` + Uml *bool `json:",omitempty"` + Use_lmkd_stats_log *bool `json:",omitempty"` + Arc *bool `json:",omitempty"` + MinimizeJavaDebugInfo *bool `json:",omitempty"` UncompressPrivAppDex *bool `json:",omitempty"` ModulesLoadedByPrivilegedModules []string `json:",omitempty"` diff --git a/java/aar.go b/java/aar.go index 89517fede..a108ba053 100644 --- a/java/aar.go +++ b/java/aar.go @@ -443,7 +443,7 @@ func (a *AARImport) Name() string { } func (a *AARImport) DepsMutator(ctx android.BottomUpMutatorContext) { - if !ctx.Config().UnbundledBuild() { + if !ctx.Config().UnbundledBuildPrebuiltSdks() { sdkDep := decodeSdkDep(ctx, sdkContext(a)) if sdkDep.useModule && sdkDep.frameworkResModule != "" { ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule) diff --git a/java/java.go b/java/java.go index aea1ef90d..6eae05cb1 100644 --- a/java/java.go +++ b/java/java.go @@ -555,7 +555,7 @@ func decodeSdkDep(ctx android.BaseContext, sdkContext sdkContext) sdkDep { return ret } - if ctx.Config().UnbundledBuild() && v != "" { + if ctx.Config().UnbundledBuildPrebuiltSdks() && v != "" { return toPrebuilt(v) }