Merge "Call hook in java_sdk_library after droidstubs generation"

This commit is contained in:
Treehugger Robot
2023-02-07 21:59:20 +00:00
committed by Gerrit Code Review
3 changed files with 5 additions and 4 deletions

View File

@@ -55,7 +55,7 @@ func (d *DefaultableModuleBase) SetDefaultableHook(hook DefaultableHook) {
d.hook = hook d.hook = hook
} }
func (d *DefaultableModuleBase) callHookIfAvailable(ctx DefaultableHookContext) { func (d *DefaultableModuleBase) CallHookIfAvailable(ctx DefaultableHookContext) {
if d.hook != nil { if d.hook != nil {
d.hook(ctx) d.hook(ctx)
} }
@@ -82,7 +82,7 @@ type Defaultable interface {
SetDefaultableHook(hook DefaultableHook) SetDefaultableHook(hook DefaultableHook)
// Call the hook if specified. // Call the hook if specified.
callHookIfAvailable(context DefaultableHookContext) CallHookIfAvailable(context DefaultableHookContext)
} }
type DefaultableModule interface { type DefaultableModule interface {
@@ -630,6 +630,6 @@ func defaultsMutator(ctx TopDownMutatorContext) {
defaultable.applyDefaults(ctx, defaultsList) defaultable.applyDefaults(ctx, defaultsList)
} }
defaultable.callHookIfAvailable(ctx) defaultable.CallHookIfAvailable(ctx)
} }
} }

View File

@@ -1749,7 +1749,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
} }
} }
mctx.CreateModule(DroidstubsFactory, &props) mctx.CreateModule(DroidstubsFactory, &props).(*Droidstubs).CallHookIfAvailable(mctx)
} }
func (module *SdkLibrary) compareAgainstLatestApi(apiScope *apiScope) bool { func (module *SdkLibrary) compareAgainstLatestApi(apiScope *apiScope) bool {

View File

@@ -120,6 +120,7 @@ func TestJavaSdkLibrary(t *testing.T) {
result.ModuleForTests(apiScopePublic.stubsSourceModuleName("foo"), "android_common") result.ModuleForTests(apiScopePublic.stubsSourceModuleName("foo"), "android_common")
result.ModuleForTests(apiScopeSystem.stubsSourceModuleName("foo"), "android_common") result.ModuleForTests(apiScopeSystem.stubsSourceModuleName("foo"), "android_common")
result.ModuleForTests(apiScopeTest.stubsSourceModuleName("foo"), "android_common") result.ModuleForTests(apiScopeTest.stubsSourceModuleName("foo"), "android_common")
result.ModuleForTests(apiScopePublic.stubsSourceModuleName("foo")+".api.contribution", "")
result.ModuleForTests("foo"+sdkXmlFileSuffix, "android_common") result.ModuleForTests("foo"+sdkXmlFileSuffix, "android_common")
result.ModuleForTests("foo.api.public.28", "") result.ModuleForTests("foo.api.public.28", "")
result.ModuleForTests("foo.api.system.28", "") result.ModuleForTests("foo.api.system.28", "")