Merge "Introduce AlwaysUsePrebuiltSdks"
This commit is contained in:
@@ -722,7 +722,7 @@ func (c *config) AllowMissingDependencies() bool {
|
||||
return Bool(c.productVariables.Allow_missing_dependencies)
|
||||
}
|
||||
|
||||
// Returns true if building without full platform sources.
|
||||
// Returns true if a full platform source tree cannot be assumed.
|
||||
func (c *config) UnbundledBuild() bool {
|
||||
return Bool(c.productVariables.Unbundled_build)
|
||||
}
|
||||
@@ -733,8 +733,9 @@ 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)
|
||||
// Returns true if building modules against prebuilt SDKs.
|
||||
func (c *config) AlwaysUsePrebuiltSdks() bool {
|
||||
return Bool(c.productVariables.Always_use_prebuilt_sdks)
|
||||
}
|
||||
|
||||
func (c *config) Fuchsia() bool {
|
||||
|
@@ -217,7 +217,7 @@ type productVariables struct {
|
||||
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"`
|
||||
Always_use_prebuilt_sdks *bool `json:",omitempty"`
|
||||
Malloc_not_svelte *bool `json:",omitempty"`
|
||||
Malloc_zero_contents *bool `json:",omitempty"`
|
||||
Malloc_pattern_fill_contents *bool `json:",omitempty"`
|
||||
|
2
cc/rs.go
2
cc/rs.go
@@ -25,7 +25,7 @@ import (
|
||||
|
||||
func init() {
|
||||
pctx.VariableFunc("rsCmd", func(ctx android.PackageVarContext) string {
|
||||
if ctx.Config().UnbundledBuild() {
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() {
|
||||
// Use RenderScript prebuilts for unbundled builds but not PDK builds
|
||||
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin/llvm-rs-cc")
|
||||
} else {
|
||||
|
@@ -625,7 +625,7 @@ func (a *AARImport) JacocoReportClassesFile() android.Path {
|
||||
}
|
||||
|
||||
func (a *AARImport) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
if !ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
||||
if !ctx.Config().AlwaysUsePrebuiltSdks() {
|
||||
sdkDep := decodeSdkDep(ctx, sdkContext(a))
|
||||
if sdkDep.useModule && sdkDep.frameworkResModule != "" {
|
||||
ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule)
|
||||
|
@@ -2866,6 +2866,7 @@ func TestUncompressDex(t *testing.T) {
|
||||
config := testAppConfig(nil, bp, nil)
|
||||
if unbundled {
|
||||
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
|
||||
config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
|
||||
}
|
||||
|
||||
ctx := testContext()
|
||||
|
@@ -128,7 +128,7 @@ func init() {
|
||||
pctx.HostBinToolVariable("ExtractApksCmd", "extract_apks")
|
||||
pctx.VariableFunc("TurbineJar", func(ctx android.PackageVarContext) string {
|
||||
turbine := "turbine.jar"
|
||||
if ctx.Config().UnbundledBuild() {
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() {
|
||||
return "prebuilts/build-tools/common/framework/" + turbine
|
||||
} else {
|
||||
return ctx.Config().HostJavaToolPath(ctx, turbine).String()
|
||||
@@ -178,7 +178,7 @@ func init() {
|
||||
|
||||
func hostBinToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
|
||||
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin", tool)
|
||||
} else {
|
||||
return ctx.Config().HostToolPath(ctx, tool).String()
|
||||
@@ -188,7 +188,7 @@ func hostBinToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||
|
||||
func hostJavaToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
|
||||
return filepath.Join("prebuilts/sdk/tools/lib", tool+".jar")
|
||||
} else {
|
||||
return ctx.Config().HostJavaToolPath(ctx, tool+".jar").String()
|
||||
@@ -198,7 +198,7 @@ func hostJavaToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||
|
||||
func hostJNIToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
|
||||
ext := ".so"
|
||||
if runtime.GOOS == "darwin" {
|
||||
ext = ".dylib"
|
||||
@@ -212,7 +212,7 @@ func hostJNIToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||
|
||||
func hostBinToolVariableWithBuildToolsPrebuilt(name, tool string) {
|
||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
|
||||
return filepath.Join("prebuilts/build-tools", ctx.Config().PrebuiltOS(), "bin", tool)
|
||||
} else {
|
||||
return ctx.Config().HostToolPath(ctx, tool).String()
|
||||
|
@@ -100,7 +100,7 @@ func stubFlagsRule(ctx android.SingletonContext) {
|
||||
// Add the android.test.base to the set of stubs only if the android.test.base module is on
|
||||
// the boot jars list as the runtime will only enforce hiddenapi access against modules on
|
||||
// that list.
|
||||
if inList("android.test.base", ctx.Config().BootJars()) && !ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
||||
if inList("android.test.base", ctx.Config().BootJars()) && !ctx.Config().AlwaysUsePrebuiltSdks() {
|
||||
publicStubModules = append(publicStubModules, "android.test.base.stubs")
|
||||
}
|
||||
|
||||
|
@@ -309,7 +309,7 @@ func (l *linter) lint(ctx android.ModuleContext) {
|
||||
rule.Command().Text("mkdir -p").Flag(cacheDir.String()).Flag(homeDir.String())
|
||||
|
||||
var annotationsZipPath, apiVersionsXMLPath android.Path
|
||||
if ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() {
|
||||
annotationsZipPath = android.PathForSource(ctx, "prebuilts/sdk/current/public/data/annotations.zip")
|
||||
apiVersionsXMLPath = android.PathForSource(ctx, "prebuilts/sdk/current/public/data/api-versions.xml")
|
||||
} else {
|
||||
@@ -395,7 +395,7 @@ func (l *lintSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||
}
|
||||
|
||||
func (l *lintSingleton) copyLintDependencies(ctx android.SingletonContext) {
|
||||
if ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() {
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -357,7 +357,7 @@ func (r *robolectricRuntimes) TestSuites() []string {
|
||||
var _ android.TestSuiteModule = (*robolectricRuntimes)(nil)
|
||||
|
||||
func (r *robolectricRuntimes) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
if !ctx.Config().UnbundledBuildUsePrebuiltSdks() && r.props.Lib != nil {
|
||||
if !ctx.Config().AlwaysUsePrebuiltSdks() && r.props.Lib != nil {
|
||||
ctx.AddVariationDependencies(nil, libTag, String(r.props.Lib))
|
||||
}
|
||||
}
|
||||
@@ -371,8 +371,16 @@ func (r *robolectricRuntimes) GenerateAndroidBuildActions(ctx android.ModuleCont
|
||||
r.runtimes = append(r.runtimes, installedRuntime)
|
||||
}
|
||||
|
||||
if !ctx.Config().UnbundledBuildUsePrebuiltSdks() && r.props.Lib != nil {
|
||||
if !ctx.Config().AlwaysUsePrebuiltSdks() && r.props.Lib != nil {
|
||||
runtimeFromSourceModule := ctx.GetDirectDepWithTag(String(r.props.Lib), libTag)
|
||||
if runtimeFromSourceModule == nil {
|
||||
if ctx.Config().AllowMissingDependencies() {
|
||||
ctx.AddMissingDependencies([]string{String(r.props.Lib)})
|
||||
} else {
|
||||
ctx.PropertyErrorf("lib", "missing dependency %q", String(r.props.Lib))
|
||||
}
|
||||
return
|
||||
}
|
||||
runtimeFromSourceJar := android.OutputFileForModule(ctx, runtimeFromSourceModule, "")
|
||||
|
||||
runtimeName := fmt.Sprintf("android-all-%s-robolectric-r0.jar",
|
||||
|
10
java/sdk.go
10
java/sdk.go
@@ -53,7 +53,7 @@ type sdkContext interface {
|
||||
|
||||
func UseApiFingerprint(ctx android.BaseModuleContext) bool {
|
||||
if ctx.Config().UnbundledBuild() &&
|
||||
!ctx.Config().UnbundledBuildUsePrebuiltSdks() &&
|
||||
!ctx.Config().AlwaysUsePrebuiltSdks() &&
|
||||
ctx.Config().IsEnvTrue("UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT") {
|
||||
return true
|
||||
}
|
||||
@@ -212,7 +212,7 @@ func (s sdkSpec) forPdkBuild(ctx android.EarlyModuleContext) sdkSpec {
|
||||
func (s sdkSpec) usePrebuilt(ctx android.EarlyModuleContext) bool {
|
||||
if s.version.isCurrent() {
|
||||
// "current" can be built from source and be from prebuilt SDK
|
||||
return ctx.Config().UnbundledBuildUsePrebuiltSdks()
|
||||
return ctx.Config().AlwaysUsePrebuiltSdks()
|
||||
} else if s.version.isNumbered() {
|
||||
// validation check
|
||||
if s.kind != sdkPublic && s.kind != sdkSystem && s.kind != sdkTest {
|
||||
@@ -511,7 +511,7 @@ func sdkSingletonFactory() android.Singleton {
|
||||
type sdkSingleton struct{}
|
||||
|
||||
func (sdkSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||
if ctx.Config().UnbundledBuildUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -634,7 +634,7 @@ func createAPIFingerprint(ctx android.SingletonContext) {
|
||||
} else if ctx.Config().IsPdkBuild() {
|
||||
// TODO: get this from the PDK artifacts?
|
||||
cmd.Text("echo PDK >").Output(out)
|
||||
} else if !ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
||||
} else if !ctx.Config().AlwaysUsePrebuiltSdks() {
|
||||
in, err := ctx.GlobWithDeps("frameworks/base/api/*current.txt", nil)
|
||||
if err != nil {
|
||||
ctx.Errorf("error globbing API files: %s", err)
|
||||
@@ -663,7 +663,7 @@ func ApiFingerprintPath(ctx android.PathContext) android.OutputPath {
|
||||
}
|
||||
|
||||
func sdkMakeVars(ctx android.MakeVarsContext) {
|
||||
if ctx.Config().UnbundledBuildUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -1799,7 +1799,7 @@ func (module *SdkLibraryImport) Name() string {
|
||||
func (module *SdkLibraryImport) createInternalModules(mctx android.DefaultableHookContext) {
|
||||
|
||||
// If the build is configured to use prebuilts then force this to be preferred.
|
||||
if mctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
||||
if mctx.Config().AlwaysUsePrebuiltSdks() {
|
||||
module.prebuilt.ForcePrefer()
|
||||
}
|
||||
|
||||
|
@@ -384,6 +384,7 @@ func TestClasspath(t *testing.T) {
|
||||
config := testConfig(nil, bpJava8, nil)
|
||||
if testcase.unbundled {
|
||||
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
|
||||
config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
|
||||
}
|
||||
if testcase.pdk {
|
||||
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
|
||||
@@ -407,6 +408,7 @@ func TestClasspath(t *testing.T) {
|
||||
config := testConfig(nil, bp, nil)
|
||||
if testcase.unbundled {
|
||||
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
|
||||
config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
|
||||
}
|
||||
if testcase.pdk {
|
||||
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
|
||||
@@ -433,6 +435,7 @@ func TestClasspath(t *testing.T) {
|
||||
|
||||
if testcase.unbundled {
|
||||
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
|
||||
config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
|
||||
}
|
||||
if testcase.pdk {
|
||||
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
|
||||
@@ -451,6 +454,7 @@ func TestClasspath(t *testing.T) {
|
||||
|
||||
if testcase.unbundled {
|
||||
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
|
||||
config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
|
||||
}
|
||||
if testcase.pdk {
|
||||
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
|
||||
|
Reference in New Issue
Block a user