aboutsummaryrefslogtreecommitdiffstats
path: root/java/sdk_library.go
diff options
context:
space:
mode:
authorSundong Ahn <sundongahn@google.com>2018-07-24 11:19:26 +0900
committerSundong Ahn <sundongahn@google.com>2018-07-26 01:40:08 +0000
commit20e998b32c6e8ab7285da2d502374714640407df (patch)
tree51c64763ed813256940b2b4d81dbf4cca4444c2a /java/sdk_library.go
parentb13a015cee808c68bf7142b2848dbe02747966c0 (diff)
downloadandroid_build_soong-20e998b32c6e8ab7285da2d502374714640407df.tar.gz
android_build_soong-20e998b32c6e8ab7285da2d502374714640407df.tar.bz2
android_build_soong-20e998b32c6e8ab7285da2d502374714640407df.zip
API txt files are dist artifacts
API txt files from a java_sdk_library are automatically registered as dist artifacts for sdk and win_sdk targets. They are installed under $(DIST_DIR)/apistubs/<apiscope>/api/<name>.txt where <apiscope> can be public, system and test. Bug: 77577799 Test: m -j Change-Id: I38cd8ee000445ce843ac01ead38001e509228738
Diffstat (limited to 'java/sdk_library.go')
-rw-r--r--java/sdk_library.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 3bac8f6f..57a0c3ab 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -47,6 +47,9 @@ var (
systemApiStubsTag = dependencyTag{name: "system"}
testApiStubsTag = dependencyTag{name: "test"}
implLibTag = dependencyTag{name: "platform"}
+ publicApiFileTag = dependencyTag{name: "publicApi"}
+ systemApiFileTag = dependencyTag{name: "systemApi"}
+ testApiFileTag = dependencyTag{name: "testApi"}
)
type apiScope int
@@ -134,6 +137,10 @@ type sdkLibrary struct {
systemApiStubsImplPath android.Paths
testApiStubsImplPath android.Paths
implLibImplPath android.Paths
+
+ publicApiFilePath android.Path
+ systemApiFilePath android.Path
+ testApiFilePath android.Path
}
func (module *sdkLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {
@@ -142,6 +149,10 @@ func (module *sdkLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddDependency(ctx.Module(), systemApiStubsTag, module.stubsName(apiScopeSystem))
ctx.AddDependency(ctx.Module(), testApiStubsTag, module.stubsName(apiScopeTest))
ctx.AddDependency(ctx.Module(), implLibTag, module.implName())
+
+ ctx.AddDependency(ctx.Module(), publicApiFileTag, module.docsName(apiScopePublic))
+ ctx.AddDependency(ctx.Module(), systemApiFileTag, module.docsName(apiScopeSystem))
+ ctx.AddDependency(ctx.Module(), testApiFileTag, module.docsName(apiScopeTest))
}
func (module *sdkLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -170,6 +181,18 @@ func (module *sdkLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
ctx.ModuleErrorf("depends on module %q of unknown tag %q", otherName, tag)
}
}
+ if doc, ok := to.(ApiFilePath); ok {
+ switch tag {
+ case publicApiFileTag:
+ module.publicApiFilePath = doc.ApiFilePath()
+ case systemApiFileTag:
+ module.systemApiFilePath = doc.ApiFilePath()
+ case testApiFileTag:
+ module.testApiFilePath = doc.ApiFilePath()
+ default:
+ ctx.ModuleErrorf("depends on module %q of unknown tag %q", otherName, tag)
+ }
+ }
})
}
@@ -199,6 +222,24 @@ func (module *sdkLibrary) AndroidMk() android.AndroidMkData {
module.testApiStubsPath.Strings()[0]+
":"+path.Join("apistubs", "test", module.BaseModuleName()+".jar")+")")
}
+ if module.publicApiFilePath != nil {
+ fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+
+ module.publicApiFilePath.String()+
+ ":"+path.Join("apistubs", "public", "api",
+ module.BaseModuleName()+".txt")+")")
+ }
+ if module.systemApiFilePath != nil {
+ fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+
+ module.systemApiFilePath.String()+
+ ":"+path.Join("apistubs", "system", "api",
+ module.BaseModuleName()+".txt")+")")
+ }
+ if module.testApiFilePath != nil {
+ fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+
+ module.testApiFilePath.String()+
+ ":"+path.Join("apistubs", "test", "api",
+ module.BaseModuleName()+".txt")+")")
+ }
},
}
}