Support core library
To support core library, "Openjdk9", "No_standard_libs" and metalava
properties are added to java_sdk_library.
If core_lib is true, dist paths are changed to
apistubs/core/....
impl library name is changed to {module_name}.jar instead of
{module_name}.impl.jar
Bug: 110404779
Test: m -j
Change-Id: Ieb6248ea714b4260333d8bf61573d4f3413f7f24
Merged-In: Ieb6248ea714b4260333d8bf61573d4f3413f7f24
(cherry picked from commit af4907fed798aa736d3d20f5439ba87be7ab0f10)
diff --git a/java/prebuilt_apis.go b/java/prebuilt_apis.go
index 59b2092..c11e010 100644
--- a/java/prebuilt_apis.go
+++ b/java/prebuilt_apis.go
@@ -17,7 +17,6 @@
import (
"android/soong/android"
"sort"
- "strconv"
"strings"
"github.com/google/blueprint/proptools"
@@ -66,14 +65,9 @@
return
}
-func parseApiFilePath(ctx android.BaseModuleContext, path string) (module string, apiver int, scope string) {
+func parseApiFilePath(ctx android.BaseModuleContext, path string) (module string, apiver string, scope string) {
elements := strings.Split(path, "/")
- ver, err := strconv.Atoi(elements[0])
- if err != nil {
- ctx.ModuleErrorf("invalid version %q found in path: %q", elements[0], path)
- return
- }
- apiver = ver
+ apiver = elements[0]
scope = elements[1]
if scope != "public" && scope != "system" && scope != "test" {
@@ -151,7 +145,7 @@
type latestApiInfo struct {
module string
scope string
- apiver int
+ apiver string
path string
}
m := make(map[string]latestApiInfo)
@@ -160,14 +154,15 @@
// create a filegroup for each api txt file
localPath := strings.TrimPrefix(f, mydir)
module, apiver, scope := parseApiFilePath(mctx, localPath)
- createFilegroup(mctx, module, scope, strconv.Itoa(apiver), localPath)
+ createFilegroup(mctx, module, scope, apiver, localPath)
// find the latest apiver
key := module + "." + scope
info, ok := m[key]
if !ok {
m[key] = latestApiInfo{module, scope, apiver, localPath}
- } else if apiver > info.apiver {
+ } else if len(apiver) > len(info.apiver) || (len(apiver) == len(info.apiver) &&
+ strings.Compare(apiver, info.apiver) > 0) {
info.apiver = apiver
info.path = localPath
}