summaryrefslogtreecommitdiff
path: root/java/sdk_library.go
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2020-05-07 20:39:05 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-05-07 20:39:05 +0000
commit3d60daadbc35a9d2486355a9220e57dedafd3ef1 (patch)
tree9085c3df2f935cdff3cfc8e4b38f91ed0723ac7d /java/sdk_library.go
parent7500f46b95d347f758d2fb579bf7d7926dbc8cc8 (diff)
parentf022920bde04b32bdb7479998c65f3405808996f (diff)
Merge "Switch java_sdk_library to use SetDefaultableHook()"
Diffstat (limited to 'java/sdk_library.go')
-rw-r--r--java/sdk_library.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 4d480ee1b..39c118d34 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -387,7 +387,7 @@ func (module *SdkLibrary) apiDistPath(apiScope *apiScope) string {
}
// Get the sdk version for use when compiling the stubs library.
-func (module *SdkLibrary) sdkVersionForStubsLibrary(mctx android.LoadHookContext, apiScope *apiScope) string {
+func (module *SdkLibrary) sdkVersionForStubsLibrary(mctx android.DefaultableHookContext, apiScope *apiScope) string {
sdkDep := decodeSdkDep(mctx, sdkContext(&module.Library))
if sdkDep.hasStandardLibs() {
// If building against a standard sdk then use the sdk version appropriate for the scope.
@@ -407,7 +407,7 @@ func (module *SdkLibrary) latestRemovedApiFilegroupName(apiScope *apiScope) stri
}
// Creates a static java library that has API stubs
-func (module *SdkLibrary) createStubsLibrary(mctx android.LoadHookContext, apiScope *apiScope) {
+func (module *SdkLibrary) createStubsLibrary(mctx android.DefaultableHookContext, apiScope *apiScope) {
props := struct {
Name *string
Srcs []string
@@ -478,7 +478,7 @@ func (module *SdkLibrary) createStubsLibrary(mctx android.LoadHookContext, apiSc
// Creates a droidstubs module that creates stubs source files from the given full source
// files
-func (module *SdkLibrary) createStubsSources(mctx android.LoadHookContext, apiScope *apiScope) {
+func (module *SdkLibrary) createStubsSources(mctx android.DefaultableHookContext, apiScope *apiScope) {
props := struct {
Name *string
Srcs []string
@@ -597,7 +597,7 @@ func (module *SdkLibrary) DepIsInSameApex(mctx android.BaseModuleContext, dep an
}
// Creates the xml file that publicizes the runtime library
-func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) {
+func (module *SdkLibrary) createXmlFile(mctx android.DefaultableHookContext) {
props := struct {
Name *string
Lib_name *string
@@ -718,7 +718,12 @@ func (module *SdkLibrary) getApiDir() string {
// For a java_sdk_library module, create internal modules for stubs, docs,
// runtime libs and xml file. If requested, the stubs and docs are created twice
// once for public API level and once for system API level
-func (module *SdkLibrary) CreateInternalModules(mctx android.LoadHookContext) {
+func (module *SdkLibrary) CreateInternalModules(mctx android.DefaultableHookContext) {
+ // If the module has been disabled then don't create any child modules.
+ if !module.Enabled() {
+ return
+ }
+
if len(module.Library.Module.properties.Srcs) == 0 {
mctx.PropertyErrorf("srcs", "java_sdk_library must specify srcs")
return
@@ -804,7 +809,7 @@ func SdkLibraryFactory() android.Module {
module.InitSdkLibraryProperties()
android.InitApexModule(module)
InitJavaModule(module, android.HostAndDeviceSupported)
- android.AddLoadHook(module, func(ctx android.LoadHookContext) { module.CreateInternalModules(ctx) })
+ module.SetDefaultableHook(func(ctx android.DefaultableHookContext) { module.CreateInternalModules(ctx) })
return module
}