diff options
-rw-r--r-- | aconfig/Android.bp | 3 | ||||
-rw-r--r-- | android/config.go | 4 | ||||
-rw-r--r-- | android/variable.go | 2 | ||||
-rw-r--r-- | cc/config/global.go | 3 | ||||
-rw-r--r-- | java/droidstubs.go | 10 | ||||
-rw-r--r-- | java/legacy_core_platform_api_usage.go | 2 | ||||
-rw-r--r-- | java/prebuilt_apis.go | 34 | ||||
-rw-r--r-- | java/prebuilt_apis_test.go | 16 | ||||
-rw-r--r-- | java/testing.go | 23 | ||||
-rw-r--r-- | scripts/gen_build_prop.py | 4 |
10 files changed, 42 insertions, 59 deletions
diff --git a/aconfig/Android.bp b/aconfig/Android.bp index 33e04a405..a15fe866b 100644 --- a/aconfig/Android.bp +++ b/aconfig/Android.bp @@ -31,9 +31,6 @@ bootstrap_go_package { pluginFor: ["soong_build"], } -// All FlaggedApi flags associated with platform API. -// By default this uses the platform APIs associated with android.jar -// but other verticals/platforms can override via soong config setting. all_aconfig_declarations { name: "all_aconfig_declarations", visibility: [ diff --git a/android/config.go b/android/config.go index 52d7f3b41..b92eb7ed9 100644 --- a/android/config.go +++ b/android/config.go @@ -1114,6 +1114,10 @@ func (c *config) PlatformSdkVersion() ApiLevel { return uncheckedFinalApiLevel(*c.productVariables.Platform_sdk_version) } +func (c *config) PlatformSdkVersionFull() string { + return proptools.StringDefault(c.productVariables.Platform_sdk_version_full, "") +} + func (c *config) RawPlatformSdkVersion() *int { return c.productVariables.Platform_sdk_version } diff --git a/android/variable.go b/android/variable.go index 5980efda4..f00dd138b 100644 --- a/android/variable.go +++ b/android/variable.go @@ -210,7 +210,7 @@ type ProductVariables struct { Platform_display_version_name *string `json:",omitempty"` Platform_version_name *string `json:",omitempty"` Platform_sdk_version *int `json:",omitempty"` - Platform_sdk_minor_version *int `json:",omitempty"` + Platform_sdk_version_full *string `json:",omitempty"` Platform_sdk_codename *string `json:",omitempty"` Platform_sdk_version_or_codename *string `json:",omitempty"` Platform_sdk_final *bool `json:",omitempty"` diff --git a/cc/config/global.go b/cc/config/global.go index 5011acd50..e81ac0d47 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -373,6 +373,9 @@ var ( // Flags that must not appear in any command line. IllegalFlags = []string{ "-w", + "-pedantic", + "-pedantic-errors", + "-Werror=pedantic", } CStdVersion = "gnu23" diff --git a/java/droidstubs.go b/java/droidstubs.go index c21592518..b30c8448a 100644 --- a/java/droidstubs.go +++ b/java/droidstubs.go @@ -564,7 +564,15 @@ func (d *Droidstubs) apiLevelsAnnotationsFlags(ctx android.ModuleContext, cmd *a }) } if apiVersions != nil { - cmd.FlagWithArg("--current-version ", ctx.Config().PlatformSdkVersion().String()) + // We are migrating from a single API level to major.minor + // versions and PlatformSdkVersionFull is not yet set in all + // release configs. If it is not set, fall back on the single + // API level. + if fullSdkVersion := ctx.Config().PlatformSdkVersionFull(); len(fullSdkVersion) > 0 { + cmd.FlagWithArg("--current-version ", fullSdkVersion) + } else { + cmd.FlagWithArg("--current-version ", ctx.Config().PlatformSdkVersion().String()) + } cmd.FlagWithArg("--current-codename ", ctx.Config().PlatformSdkCodename()) cmd.FlagWithInput("--apply-api-levels ", apiVersions) } diff --git a/java/legacy_core_platform_api_usage.go b/java/legacy_core_platform_api_usage.go index 4be7d0470..21895d4cc 100644 --- a/java/legacy_core_platform_api_usage.go +++ b/java/legacy_core_platform_api_usage.go @@ -47,8 +47,8 @@ var legacyCorePlatformApiModules = []string{ "sam", "saminterfacelibrary", "sammanagerlibrary", - "services", "services.core.unboosted", + "services.impl", "Settings-core", "SettingsGoogle", "SettingsGoogleOverlayCoral", diff --git a/java/prebuilt_apis.go b/java/prebuilt_apis.go index 527e479f2..31f149ea9 100644 --- a/java/prebuilt_apis.go +++ b/java/prebuilt_apis.go @@ -55,11 +55,6 @@ type prebuiltApisProperties struct { // If set to true, compile dex for java_import modules. Defaults to false. Imports_compile_dex *bool - - // If set to true, allow incremental platform API of the form MM.m where MM is the major release - // version corresponding to the API level/SDK_INT and m is an incremental release version - // (e.g. API changes associated with QPR). Defaults to false. - Allow_incremental_platform_api *bool } type prebuiltApis struct { @@ -97,28 +92,28 @@ func parsePrebuiltPath(ctx android.LoadHookContext, p string) (module string, ve } // parseFinalizedPrebuiltPath is like parsePrebuiltPath, but verifies the version is numeric (a finalized version). -func parseFinalizedPrebuiltPath(ctx android.LoadHookContext, p string, allowIncremental bool) (module string, version int, release int, scope string) { +func parseFinalizedPrebuiltPath(ctx android.LoadHookContext, p string) (module string, version int, release int, scope string) { module, v, scope := parsePrebuiltPath(ctx, p) - if allowIncremental { - parts := strings.Split(v, ".") - if len(parts) != 2 { - ctx.ModuleErrorf("Found unexpected version '%v' for incremental prebuilts - expect MM.m format for incremental API with both major (MM) an minor (m) revision.", v) - return - } + + // assume a major.minor version code + parts := strings.Split(v, ".") + if len(parts) == 2 { sdk, sdk_err := strconv.Atoi(parts[0]) qpr, qpr_err := strconv.Atoi(parts[1]) if sdk_err != nil || qpr_err != nil { - ctx.ModuleErrorf("Unable to read version number for incremental prebuilt api '%v'", v) + ctx.ModuleErrorf("Unable to read major.minor version for prebuilt api '%v'", v) return } version = sdk release = qpr return } + + // assume a legacy integer only api level release = 0 version, err := strconv.Atoi(v) if err != nil { - ctx.ModuleErrorf("Found finalized API files in non-numeric dir '%v'", v) + ctx.ModuleErrorf("Unable to read API level for prebuilt api '%v'", v) return } return @@ -279,12 +274,11 @@ func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) { } // Create modules for all (<module>, <scope, <version>) triplets, - allowIncremental := proptools.BoolDefault(p.properties.Allow_incremental_platform_api, false) for _, f := range apiLevelFiles { - module, version, release, scope := parseFinalizedPrebuiltPath(mctx, f, allowIncremental) - if allowIncremental { - incrementalVersion := strconv.Itoa(version) + "." + strconv.Itoa(release) - createApiModule(mctx, PrebuiltApiModuleName(module, scope, incrementalVersion), f) + module, version, release, scope := parseFinalizedPrebuiltPath(mctx, f) + if release != 0 { + majorDotMinorVersion := strconv.Itoa(version) + "." + strconv.Itoa(release) + createApiModule(mctx, PrebuiltApiModuleName(module, scope, majorDotMinorVersion), f) } else { createApiModule(mctx, PrebuiltApiModuleName(module, scope, strconv.Itoa(version)), f) } @@ -300,7 +294,7 @@ func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) { getLatest := func(files []string, isExtensionApiFile bool) map[string]latestApiInfo { m := make(map[string]latestApiInfo) for _, f := range files { - module, version, release, scope := parseFinalizedPrebuiltPath(mctx, f, allowIncremental) + module, version, release, scope := parseFinalizedPrebuiltPath(mctx, f) if strings.HasSuffix(module, "incompatibilities") { continue } diff --git a/java/prebuilt_apis_test.go b/java/prebuilt_apis_test.go index 1f095e49b..17fdae962 100644 --- a/java/prebuilt_apis_test.go +++ b/java/prebuilt_apis_test.go @@ -102,15 +102,15 @@ func TestPrebuiltApis_WithExtensions(t *testing.T) { android.AssertStringEquals(t, "Expected latest baz = api level 32", "prebuilts/sdk/32/public/api/baz.txt", baz_input) } -func TestPrebuiltApis_WithIncrementalApi(t *testing.T) { +func TestPrebuiltApis_WithMixedVersionCodes(t *testing.T) { t.Parallel() runTestWithIncrementalApi := func() (foo_input, bar_input, baz_input string) { result := android.GroupFixturePreparers( prepareForJavaTest, - FixtureWithPrebuiltIncrementalApis(map[string][]string{ + FixtureWithPrebuiltApis(map[string][]string{ "33.0": {"foo"}, - "33.1": {"foo", "bar", "baz"}, - "33.2": {"foo", "bar"}, + "34": {"foo", "bar", "baz"}, + "34.1": {"foo", "bar"}, "current": {"foo", "bar"}, }), ).RunTest(t) @@ -119,9 +119,9 @@ func TestPrebuiltApis_WithIncrementalApi(t *testing.T) { baz_input = result.ModuleForTests(t, "baz.api.public.latest", "").Rule("generator").Implicits[0].String() return } - // 33.1 is the latest for baz, 33.2 is the latest for both foo & bar + // 34 is the latest for baz, 34.1 is the latest for both foo & bar foo_input, bar_input, baz_input := runTestWithIncrementalApi() - android.AssertStringEquals(t, "Expected latest foo = api level 33.2", "prebuilts/sdk/33.2/public/api/foo.txt", foo_input) - android.AssertStringEquals(t, "Expected latest bar = api level 33.2", "prebuilts/sdk/33.2/public/api/bar.txt", bar_input) - android.AssertStringEquals(t, "Expected latest baz = api level 33.1", "prebuilts/sdk/33.1/public/api/baz.txt", baz_input) + android.AssertStringEquals(t, "Expected latest foo = api level 34.1", "prebuilts/sdk/34.1/public/api/foo.txt", foo_input) + android.AssertStringEquals(t, "Expected latest bar = api level 34.1", "prebuilts/sdk/34.1/public/api/bar.txt", bar_input) + android.AssertStringEquals(t, "Expected latest baz = api level 34", "prebuilts/sdk/34/public/api/baz.txt", baz_input) } diff --git a/java/testing.go b/java/testing.go index d7878d68d..82dbcee89 100644 --- a/java/testing.go +++ b/java/testing.go @@ -236,29 +236,6 @@ func FixtureWithPrebuiltApisAndExtensions(apiLevel2Modules map[string][]string, ) } -func FixtureWithPrebuiltIncrementalApis(apiLevel2Modules map[string][]string) android.FixturePreparer { - mockFS := android.MockFS{} - path := "prebuilts/sdk/Android.bp" - - bp := fmt.Sprintf(` - prebuilt_apis { - name: "sdk", - api_dirs: ["%s"], - allow_incremental_platform_api: true, - imports_sdk_version: "none", - imports_compile_dex: true, - } - `, strings.Join(android.SortedKeys(apiLevel2Modules), `", "`)) - - for release, modules := range apiLevel2Modules { - mockFS.Merge(prebuiltApisFilesForModules([]string{release}, modules)) - } - return android.GroupFixturePreparers( - android.FixtureAddTextFile(path, bp), - android.FixtureMergeMockFs(mockFS), - ) -} - func prebuiltApisFilesForModules(apiLevels []string, modules []string) map[string][]byte { libs := append([]string{"android"}, modules...) diff --git a/scripts/gen_build_prop.py b/scripts/gen_build_prop.py index a0d25465c..cef7241fc 100644 --- a/scripts/gen_build_prop.py +++ b/scripts/gen_build_prop.py @@ -165,7 +165,7 @@ def generate_common_build_props(args): print(f"ro.{partition}.build.version.release={config['Platform_version_last_stable']}") print(f"ro.{partition}.build.version.release_or_codename={config['Platform_version_name']}") print(f"ro.{partition}.build.version.sdk={config['Platform_sdk_version']}") - print(f"ro.{partition}.build.version.sdk_minor={build_flags['RELEASE_PLATFORM_SDK_MINOR_VERSION']}") + print(f"ro.{partition}.build.version.sdk_full={config['Platform_sdk_version_full']}") def generate_build_info(args): print() @@ -198,7 +198,7 @@ def generate_build_info(args): print(f"ro.build.display.id?={config['BuildDesc']}") print(f"ro.build.version.incremental={config['BuildNumber']}") print(f"ro.build.version.sdk={config['Platform_sdk_version']}") - print(f"ro.build.version.sdk_minor={build_flags['RELEASE_PLATFORM_SDK_MINOR_VERSION']}") + print(f"ro.build.version.sdk_full={config['Platform_sdk_version_full']}") print(f"ro.build.version.preview_sdk={config['Platform_preview_sdk_version']}") print(f"ro.build.version.preview_sdk_fingerprint={config['PlatformPreviewSdkFingerprint']}") print(f"ro.build.version.codename={config['Platform_sdk_codename']}") |