summaryrefslogtreecommitdiff
path: root/android/sdk_version.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/sdk_version.go')
-rw-r--r--android/sdk_version.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/android/sdk_version.go b/android/sdk_version.go
index a7e03dcd8..cace88a01 100644
--- a/android/sdk_version.go
+++ b/android/sdk_version.go
@@ -84,6 +84,40 @@ func (k SdkKind) String() string {
}
}
+// JavaLibraryName returns the soong module containing the Java APIs of that API surface.
+func (k SdkKind) JavaLibraryName(c Config) string {
+ name := k.defaultJavaLibraryName()
+ return JavaLibraryNameFromText(c, name)
+}
+
+// JavaLibraryNameFromText returns the name of .txt equivalent of a java_library, but does
+// not check if either module exists.
+// TODO: Return .txt (single-tree or multi-tree equivalents) based on config
+func JavaLibraryNameFromText(c Config, name string) string {
+ // This returns the default for now.
+ // TODO: Implement this
+ return name
+}
+
+func (k SdkKind) defaultJavaLibraryName() string {
+ switch k {
+ case SdkPublic:
+ return "android_stubs_current"
+ case SdkSystem:
+ return "android_system_stubs_current"
+ case SdkTest:
+ return "android_test_stubs_current"
+ case SdkCore:
+ return "core.current.stubs"
+ case SdkModule:
+ return "android_module_lib_stubs_current"
+ case SdkSystemServer:
+ return "android_system_server_stubs_current"
+ default:
+ panic(fmt.Errorf("APIs of API surface %v cannot be provided by a single Soong module\n", k))
+ }
+}
+
// SdkSpec represents the kind and the version of an SDK for a module to build against
type SdkSpec struct {
Kind SdkKind