Remove naming conventioned based file sorting in java_api_library
With api_files property being removed from java_api_library, all api
files are passed to java_api_library via java_api_contribution, which
provide api_surface information. Instead of relying on the naming
convention of the api files, java_api_library can utilize this
information to sort the api files from narrower api scope to the wider
api scope.
Test: m --build-from-text-stub
Bug: 295429988
Change-Id: Idd832778833c072c6b7e9d1f775533e5f4e2af00
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 6349d92..282379c 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -286,6 +286,17 @@
return list
}
+// Method that maps the apiScopes properties to the index of each apiScopes elements.
+// apiScopes property to be used as the key can be specified with the input accessor.
+// Only a string property of apiScope can be used as the key of the map.
+func (scopes apiScopes) MapToIndex(accessor func(*apiScope) string) map[string]int {
+ ret := make(map[string]int)
+ for i, scope := range scopes {
+ ret[accessor(scope)] = i
+ }
+ return ret
+}
+
var (
scopeByName = make(map[string]*apiScope)
allScopeNames []string