diff options
author | 2022-05-16 13:10:47 +0000 | |
---|---|---|
committer | 2022-05-16 17:09:10 +0000 | |
commit | 958806b8c846a5c37830721d82e2d2adb9e7dc16 (patch) | |
tree | 943592cded1980c9a5b32594faeeb2b6eb2b3f63 /java/prebuilt_apis.go | |
parent | 4dd76eb26c6f673a85d1c33c504e3beb1324bcdb (diff) |
Add custom java_sdk_library info to the SDK info file
Previously the SDK info file only contained basic common information
about each member. This change adds support for each member to
provide custom information to add to the info file.
It uses that mechanism to add the following:
* "dist_stem"
* "scopes" object containing:
* for each scope a:
"<scope>" object containing:
* "current_api" - the path within the snapshot for the API's .txt
file.
* "removed_api" - the path within the snapshot for the removed
API's .txt file.
* "latest_api" - the path within the build to the latest finalized
API .txt file.
* "latest_removed_api" - the path within the build to the latest
finalized removed API .txt file.
In order to access the latest API files it was necessary to add and
resolve dependencies on the module that makes them available. In order
to do that safely the code for creating the names of the modules was
refactored to avoid duplicating the name creation logic.
Bug: 204763318
Test: m nothing
Change-Id: Ica68abbd2b2c7c2b2b7877b502f96cc89f06fd68
Diffstat (limited to 'java/prebuilt_apis.go')
-rw-r--r-- | java/prebuilt_apis.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/java/prebuilt_apis.go b/java/prebuilt_apis.go index 44650a6d0..944970783 100644 --- a/java/prebuilt_apis.go +++ b/java/prebuilt_apis.go @@ -212,6 +212,10 @@ func createSystemModules(mctx android.LoadHookContext, version, scope string) { mctx.CreateModule(systemModulesImportFactory, &props) } +func PrebuiltApiModuleName(module, scope, version string) string { + return module + ".api." + scope + "." + version +} + func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) { // <apiver>/<scope>/api/<module>.txt apiLevelFiles := globApiDirs(mctx, p, "api/*.txt") @@ -220,12 +224,9 @@ func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) { } // Create modules for all (<module>, <scope, <version>) triplets, - apiModuleName := func(module, scope, version string) string { - return module + ".api." + scope + "." + version - } for _, f := range apiLevelFiles { module, version, scope := parseFinalizedPrebuiltPath(mctx, f) - createApiModule(mctx, apiModuleName(module, scope, strconv.Itoa(version)), f) + createApiModule(mctx, PrebuiltApiModuleName(module, scope, strconv.Itoa(version)), f) } // Figure out the latest version of each module/scope @@ -266,7 +267,7 @@ func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) { // Sort the keys in order to make build.ninja stable for _, k := range android.SortedStringKeys(latest) { info := latest[k] - name := apiModuleName(info.module, info.scope, "latest") + name := PrebuiltApiModuleName(info.module, info.scope, "latest") createApiModule(mctx, name, info.path) } @@ -278,7 +279,7 @@ func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) { filename, _, scope := parsePrebuiltPath(mctx, f) referencedModule := strings.TrimSuffix(filename, "-incompatibilities") - createApiModule(mctx, apiModuleName(referencedModule+"-incompatibilities", scope, "latest"), f) + createApiModule(mctx, PrebuiltApiModuleName(referencedModule+"-incompatibilities", scope, "latest"), f) incompatibilities[referencedModule+"."+scope] = true } @@ -286,7 +287,7 @@ func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) { // Create empty incompatibilities files for remaining modules for _, k := range android.SortedStringKeys(latest) { if _, ok := incompatibilities[k]; !ok { - createEmptyFile(mctx, apiModuleName(latest[k].module+"-incompatibilities", latest[k].scope, "latest")) + createEmptyFile(mctx, PrebuiltApiModuleName(latest[k].module+"-incompatibilities", latest[k].scope, "latest")) } } } |