Remove obsolete PDK build functionality
This hasn't worked for a couple years, and continues to bitrot. Just
remove it.
Adds a bpfix rule so that we can eventually remove the
product_variables.pdk definition, which is now always a no-op.
Test: treehugger
Change-Id: I830b54d419b59f6db1d4617b45e61a78234f57a7
Merged-In: I830b54d419b59f6db1d4617b45e61a78234f57a7
diff --git a/android/config.go b/android/config.go
index a6284f0..a1e97c9 100644
--- a/android/config.go
+++ b/android/config.go
@@ -742,10 +742,6 @@
return Bool(c.productVariables.Fuchsia)
}
-func (c *config) IsPdkBuild() bool {
- return Bool(c.productVariables.Pdk)
-}
-
func (c *config) MinimizeJavaDebugInfo() bool {
return Bool(c.productVariables.MinimizeJavaDebugInfo) && !Bool(c.productVariables.Eng)
}
diff --git a/android/variable.go b/android/variable.go
index 9fb8577..1f21f34 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -233,7 +233,6 @@
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"`
diff --git a/bpfix/bpfix/bpfix.go b/bpfix/bpfix/bpfix.go
index 689cbd1..faec473 100644
--- a/bpfix/bpfix/bpfix.go
+++ b/bpfix/bpfix/bpfix.go
@@ -128,6 +128,10 @@
Name: "removeSoongConfigBoolVariable",
Fix: removeSoongConfigBoolVariable,
},
+ {
+ Name: "removePdkProperty",
+ Fix: runPatchListMod(removePdkProperty),
+ },
}
func NewFixRequest() FixRequest {
@@ -993,6 +997,25 @@
return patchlist.Add(prop.Pos().Offset, prop.End().Offset+2, replaceStr)
}
+func removePdkProperty(mod *parser.Module, buf []byte, patchlist *parser.PatchList) error {
+ prop, ok := mod.GetProperty("product_variables")
+ if !ok {
+ return nil
+ }
+ propMap, ok := prop.Value.(*parser.Map)
+ if !ok {
+ return nil
+ }
+ pdkProp, ok := propMap.GetProperty("pdk")
+ if !ok {
+ return nil
+ }
+ if len(propMap.Properties) > 1 {
+ return patchlist.Add(pdkProp.Pos().Offset, pdkProp.End().Offset+2, "")
+ }
+ return patchlist.Add(prop.Pos().Offset, prop.End().Offset+2, "")
+}
+
func mergeMatchingModuleProperties(mod *parser.Module, buf []byte, patchlist *parser.PatchList) error {
return mergeMatchingProperties(&mod.Properties, buf, patchlist)
}
diff --git a/bpfix/bpfix/bpfix_test.go b/bpfix/bpfix/bpfix_test.go
index 8988177..ef9814f 100644
--- a/bpfix/bpfix/bpfix_test.go
+++ b/bpfix/bpfix/bpfix_test.go
@@ -998,3 +998,61 @@
})
}
}
+
+func TestRemovePdkProperty(t *testing.T) {
+ tests := []struct {
+ name string
+ in string
+ out string
+ }{
+ {
+ name: "remove property",
+ in: `
+ cc_library_shared {
+ name: "foo",
+ product_variables: {
+ other: {
+ bar: true,
+ },
+ pdk: {
+ enabled: false,
+ },
+ },
+ }
+ `,
+ out: `
+ cc_library_shared {
+ name: "foo",
+ product_variables: {
+ other: {
+ bar: true,
+ },
+ },
+ }
+ `,
+ },
+ {
+ name: "remove property and empty product_variables",
+ in: `
+ cc_library_shared {
+ name: "foo",
+ product_variables: {
+ pdk: {
+ enabled: false,
+ },
+ },
+ }
+ `,
+ out: `
+ cc_library_shared {
+ name: "foo",
+ }
+ `,
+ },
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ runPass(t, test.in, test.out, runPatchListMod(removePdkProperty))
+ })
+ }
+}
diff --git a/cc/rs.go b/cc/rs.go
index de3e64b..ba69f23 100644
--- a/cc/rs.go
+++ b/cc/rs.go
@@ -26,7 +26,7 @@
func init() {
pctx.VariableFunc("rsCmd", func(ctx android.PackageVarContext) string {
if ctx.Config().AlwaysUsePrebuiltSdks() {
- // Use RenderScript prebuilts for unbundled builds but not PDK builds
+ // Use RenderScript prebuilts for unbundled builds
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin/llvm-rs-cc")
} else {
return ctx.Config().HostToolPath(ctx, "llvm-rs-cc").String()
diff --git a/java/config/config.go b/java/config/config.go
index d0296ff..2f39c99 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -178,7 +178,7 @@
func hostBinToolVariableWithSdkToolsPrebuilt(name, tool string) {
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
- if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() {
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin", tool)
} else {
return ctx.Config().HostToolPath(ctx, tool).String()
@@ -188,7 +188,7 @@
func hostJavaToolVariableWithSdkToolsPrebuilt(name, tool string) {
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
- if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() {
return filepath.Join("prebuilts/sdk/tools/lib", tool+".jar")
} else {
return ctx.Config().HostJavaToolPath(ctx, tool+".jar").String()
@@ -198,7 +198,7 @@
func hostJNIToolVariableWithSdkToolsPrebuilt(name, tool string) {
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
- if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() {
ext := ".so"
if runtime.GOOS == "darwin" {
ext = ".dylib"
@@ -212,7 +212,7 @@
func hostBinToolVariableWithBuildToolsPrebuilt(name, tool string) {
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
- if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() {
return filepath.Join("prebuilts/build-tools", ctx.Config().PrebuiltOS(), "bin", tool)
} else {
return ctx.Config().HostToolPath(ctx, tool).String()
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 3abe782..b445456 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -505,7 +505,7 @@
globalSoong := dexpreopt.GetCachedGlobalSoongConfig(ctx)
global := dexpreopt.GetGlobalConfig(ctx)
- if global.DisableGenerateProfile || ctx.Config().IsPdkBuild() || ctx.Config().UnbundledBuild() {
+ if global.DisableGenerateProfile || ctx.Config().UnbundledBuild() {
return nil
}
profile := ctx.Config().Once(bootImageProfileRuleKey, func() interface{} {
@@ -560,7 +560,7 @@
globalSoong := dexpreopt.GetCachedGlobalSoongConfig(ctx)
global := dexpreopt.GetGlobalConfig(ctx)
- if global.DisableGenerateProfile || ctx.Config().IsPdkBuild() || ctx.Config().UnbundledBuild() {
+ if global.DisableGenerateProfile || ctx.Config().UnbundledBuild() {
return nil
}
return ctx.Config().Once(bootFrameworkProfileRuleKey, func() interface{} {
@@ -602,7 +602,7 @@
var bootFrameworkProfileRuleKey = android.NewOnceKey("bootFrameworkProfileRule")
func updatableBcpPackagesRule(ctx android.SingletonContext, image *bootImageConfig, missingDeps []string) android.WritablePath {
- if ctx.Config().IsPdkBuild() || ctx.Config().UnbundledBuild() {
+ if ctx.Config().UnbundledBuild() {
return nil
}
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 0840d50..4c5f66c 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -1081,9 +1081,7 @@
rule.Build(pctx, ctx, "javadoc", desc)
- if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") &&
- !ctx.Config().IsPdkBuild() {
-
+ if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") {
apiFile := android.PathForModuleSrc(ctx, String(d.properties.Check_api.Current.Api_file))
removedApiFile := android.PathForModuleSrc(ctx, String(d.properties.Check_api.Current.Removed_api_file))
@@ -1150,9 +1148,7 @@
rule.Build(pctx, ctx, "doclavaCurrentApiUpdate", "update current API")
}
- if apiCheckEnabled(ctx, d.properties.Check_api.Last_released, "last_released") &&
- !ctx.Config().IsPdkBuild() {
-
+ if apiCheckEnabled(ctx, d.properties.Check_api.Last_released, "last_released") {
apiFile := android.PathForModuleSrc(ctx, String(d.properties.Check_api.Last_released.Api_file))
removedApiFile := android.PathForModuleSrc(ctx, String(d.properties.Check_api.Last_released.Removed_api_file))
@@ -1444,7 +1440,7 @@
}
func (d *Droidstubs) apiToXmlFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand) {
- if Bool(d.properties.Jdiff_enabled) && !ctx.Config().IsPdkBuild() && d.apiFile != nil {
+ if Bool(d.properties.Jdiff_enabled) && d.apiFile != nil {
if d.apiFile.String() == "" {
ctx.ModuleErrorf("API signature file has to be specified in Metalava when jdiff is enabled.")
}
@@ -1592,7 +1588,7 @@
// Add API lint options.
- if BoolDefault(d.properties.Check_api.Api_lint.Enabled, false) && !ctx.Config().IsPdkBuild() {
+ if BoolDefault(d.properties.Check_api.Api_lint.Enabled, false) {
doApiLint = true
newSince := android.OptionalPathForModuleSrc(ctx, d.properties.Check_api.Api_lint.New_since)
@@ -1650,8 +1646,7 @@
// Add "check released" options. (Detect incompatible API changes from the last public release)
- if apiCheckEnabled(ctx, d.properties.Check_api.Last_released, "last_released") &&
- !ctx.Config().IsPdkBuild() {
+ if apiCheckEnabled(ctx, d.properties.Check_api.Last_released, "last_released") {
doCheckReleased = true
if len(d.Javadoc.properties.Out) > 0 {
@@ -1728,8 +1723,7 @@
rule.Build(pctx, ctx, "metalava", "metalava merged")
- if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") &&
- !ctx.Config().IsPdkBuild() {
+ if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") {
if len(d.Javadoc.properties.Out) > 0 {
ctx.PropertyErrorf("out", "out property may not be combined with check_api")
@@ -1843,7 +1837,7 @@
rule.Build(pctx, ctx, "nullabilityWarningsCheck", "nullability warnings check")
}
- if Bool(d.properties.Jdiff_enabled) && !ctx.Config().IsPdkBuild() {
+ if Bool(d.properties.Jdiff_enabled) {
if len(d.Javadoc.properties.Out) > 0 {
ctx.PropertyErrorf("out", "out property may not be combined with jdiff")
}
diff --git a/java/sdk.go b/java/sdk.go
index fa4c053..b44cd8e1 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -191,23 +191,6 @@
return s.kind != sdkPrivate && s.kind != sdkNone && s.kind != sdkCorePlatform
}
-// forPdkBuild converts this sdkSpec into another sdkSpec that is for the PDK builds.
-func (s sdkSpec) forPdkBuild(ctx android.EarlyModuleContext) sdkSpec {
- // For PDK builds, use the latest SDK version instead of "current" or ""
- if s.kind == sdkPrivate || s.kind == sdkPublic {
- kind := s.kind
- if kind == sdkPrivate {
- // We don't have prebuilt SDK for private APIs, so use the public SDK
- // instead. This looks odd, but that's how it has been done.
- // TODO(b/148271073): investigate the need for this.
- kind = sdkPublic
- }
- version := sdkVersion(LatestSdkVersionInt(ctx))
- return sdkSpec{kind, version, s.raw}
- }
- return s
-}
-
// usePrebuilt determines whether prebuilt SDK should be used for this sdkSpec with the given context.
func (s sdkSpec) usePrebuilt(ctx android.EarlyModuleContext) bool {
if s.version.isCurrent() {
@@ -233,9 +216,6 @@
if !s.valid() {
return s.version, fmt.Errorf("invalid sdk version %q", s.raw)
}
- if ctx.Config().IsPdkBuild() {
- s = s.forPdkBuild(ctx)
- }
if s.version.isNumbered() {
return s.version, nil
}
@@ -350,9 +330,6 @@
return sdkDep{}
}
- if ctx.Config().IsPdkBuild() {
- sdkVersion = sdkVersion.forPdkBuild(ctx)
- }
if !sdkVersion.validateSystemSdk(ctx) {
return sdkDep{}
}
@@ -511,7 +488,7 @@
type sdkSingleton struct{}
func (sdkSingleton) GenerateBuildActions(ctx android.SingletonContext) {
- if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() {
return
}
@@ -631,9 +608,6 @@
if ctx.Config().PlatformSdkCodename() == "REL" {
cmd.Text("echo REL >").Output(out)
- } else if ctx.Config().IsPdkBuild() {
- // TODO: get this from the PDK artifacts?
- cmd.Text("echo PDK >").Output(out)
} else if !ctx.Config().AlwaysUsePrebuiltSdks() {
in, err := ctx.GlobWithDeps("frameworks/base/api/*current.txt", nil)
if err != nil {
@@ -663,7 +637,7 @@
}
func sdkMakeVars(ctx android.MakeVarsContext) {
- if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() {
return
}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 0ed8394..25f0134 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1124,22 +1124,17 @@
// Creates a static java library that has API stubs
func (module *SdkLibrary) createStubsLibrary(mctx android.DefaultableHookContext, apiScope *apiScope) {
props := struct {
- Name *string
- Visibility []string
- Srcs []string
- Installable *bool
- Sdk_version *string
- System_modules *string
- Patch_module *string
- Libs []string
- Compile_dex *bool
- Java_version *string
- Product_variables struct {
- Pdk struct {
- Enabled *bool
- }
- }
- Openjdk9 struct {
+ Name *string
+ Visibility []string
+ Srcs []string
+ Installable *bool
+ Sdk_version *string
+ System_modules *string
+ Patch_module *string
+ Libs []string
+ Compile_dex *bool
+ Java_version *string
+ Openjdk9 struct {
Srcs []string
Javacflags []string
}
@@ -1166,7 +1161,6 @@
props.Patch_module = module.properties.Patch_module
props.Installable = proptools.BoolPtr(false)
props.Libs = module.sdkLibraryProperties.Stub_only_libs
- props.Product_variables.Pdk.Enabled = proptools.BoolPtr(false)
props.Openjdk9.Srcs = module.properties.Openjdk9.Srcs
props.Openjdk9.Javacflags = module.properties.Openjdk9.Javacflags
// We compile the stubs for 1.8 in line with the main android.jar stubs, and potential
diff --git a/java/sdk_test.go b/java/sdk_test.go
index 13fc915..776069d 100644
--- a/java/sdk_test.go
+++ b/java/sdk_test.go
@@ -30,7 +30,6 @@
var classpathTestcases = []struct {
name string
unbundled bool
- pdk bool
moduleType string
host android.OsClass
properties string
@@ -217,35 +216,6 @@
},
{
- name: "pdk default",
- pdk: true,
- bootclasspath: []string{`""`},
- system: "sdk_public_30_system_modules",
- java8classpath: []string{"prebuilts/sdk/30/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
- java9classpath: []string{"prebuilts/sdk/30/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
- aidl: "-pprebuilts/sdk/30/public/framework.aidl",
- },
- {
- name: "pdk current",
- pdk: true,
- properties: `sdk_version: "current",`,
- bootclasspath: []string{`""`},
- system: "sdk_public_30_system_modules",
- java8classpath: []string{"prebuilts/sdk/30/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
- java9classpath: []string{"prebuilts/sdk/30/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
- aidl: "-pprebuilts/sdk/30/public/framework.aidl",
- },
- {
- name: "pdk 29",
- pdk: true,
- properties: `sdk_version: "29",`,
- bootclasspath: []string{`""`},
- system: "sdk_public_30_system_modules",
- java8classpath: []string{"prebuilts/sdk/30/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
- java9classpath: []string{"prebuilts/sdk/30/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
- aidl: "-pprebuilts/sdk/30/public/framework.aidl",
- },
- {
name: "module_current",
properties: `sdk_version: "module_current",`,
bootclasspath: []string{"android_module_lib_stubs_current", "core-lambda-stubs"},
@@ -386,9 +356,6 @@
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)
- }
ctx := testContext()
run(t, ctx, config)
@@ -410,9 +377,6 @@
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)
- }
ctx := testContext()
run(t, ctx, config)
@@ -437,9 +401,6 @@
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)
- }
ctx := testContext()
run(t, ctx, config)
@@ -456,9 +417,6 @@
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)
- }
ctx := testContext()
run(t, ctx, config)
diff --git a/ui/build/config.go b/ui/build/config.go
index 3fa0479..b263a98 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -53,8 +53,6 @@
// Autodetected
totalRAM uint64
- pdkBuild bool
-
brokenDupRules bool
brokenUsesNetwork bool
brokenNinjaEnvVars []string
@@ -968,14 +966,6 @@
return c.targetDeviceDir
}
-func (c *configImpl) SetPdkBuild(pdk bool) {
- c.pdkBuild = pdk
-}
-
-func (c *configImpl) IsPdkBuild() bool {
- return c.pdkBuild
-}
-
func (c *configImpl) BuildDateTime() string {
return c.buildDateTime
}
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index e229856..999af07 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -161,8 +161,6 @@
"BUILD_ID",
"OUT_DIR",
"AUX_OS_VARIANT_LIST",
- "TARGET_BUILD_PDK",
- "PDK_FUSION_PLATFORM_ZIP",
"PRODUCT_SOONG_NAMESPACES",
}
@@ -281,7 +279,6 @@
config.SetTargetDevice(make_vars["TARGET_DEVICE"])
config.SetTargetDeviceDir(make_vars["TARGET_DEVICE_DIR"])
- config.SetPdkBuild(make_vars["TARGET_BUILD_PDK"] == "true")
config.SetBuildBrokenDupRules(make_vars["BUILD_BROKEN_DUP_RULES"] == "true")
config.SetBuildBrokenUsesNetwork(make_vars["BUILD_BROKEN_USES_NETWORK"] == "true")
config.SetBuildBrokenNinjaUsesEnvVars(strings.Fields(make_vars["BUILD_BROKEN_NINJA_USES_ENV_VARS"]))
diff --git a/ui/build/kati.go b/ui/build/kati.go
index 1cd5fea..f6d3a57 100644
--- a/ui/build/kati.go
+++ b/ui/build/kati.go
@@ -134,14 +134,10 @@
args := []string{
"--writable", config.OutDir() + "/",
+ "--werror_implicit_rules",
"-f", "build/make/core/main.mk",
}
- // PDK builds still uses a few implicit rules
- if !config.IsPdkBuild() {
- args = append(args, "--werror_implicit_rules")
- }
-
if !config.BuildBrokenDupRules() {
args = append(args, "--werror_overriding_commands")
}