Merge changes from topic "hiddenapi_exportable" into main am: 7e9343b889
am: cf38079804
am: 5aea28265a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2897486 Change-Id: Iac2820fecdb0bb91040879461dd8a4de012c3ade Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -199,6 +199,10 @@ type ApiStubsSrcProvider interface {
|
||||
StubsSrcJar() android.Path
|
||||
}
|
||||
|
||||
type ExportableApiStubsSrcProvider interface {
|
||||
ExportableStubsSrcJar() android.Path
|
||||
}
|
||||
|
||||
// Provider of information about API stubs, used by java_sdk_library.
|
||||
type ApiStubsProvider interface {
|
||||
AnnotationsZip() android.Path
|
||||
@@ -208,6 +212,14 @@ type ApiStubsProvider interface {
|
||||
ApiStubsSrcProvider
|
||||
}
|
||||
|
||||
type ExportableApiStubsProvider interface {
|
||||
ExportableAnnotationsZip() android.Path
|
||||
ExportableApiFilePath() android.Path
|
||||
ExportableRemovedApiFilePath() android.Path
|
||||
|
||||
ExportableApiStubsSrcProvider
|
||||
}
|
||||
|
||||
type currentApiTimestampProvider interface {
|
||||
CurrentApiTimestamp() android.Path
|
||||
}
|
||||
|
@@ -727,7 +727,9 @@ func (paths *scopePaths) extractStubsLibraryInfoFromDependency(ctx android.Modul
|
||||
func (paths *scopePaths) extractEverythingStubsLibraryInfoFromDependency(ctx android.ModuleContext, dep android.Module) error {
|
||||
if lib, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
|
||||
paths.stubsHeaderPath = lib.HeaderJars
|
||||
paths.stubsImplPath = lib.ImplementationJars
|
||||
if !ctx.Config().ReleaseHiddenApiExportableStubs() {
|
||||
paths.stubsImplPath = lib.ImplementationJars
|
||||
}
|
||||
|
||||
libDep := dep.(UsesLibraryDependency)
|
||||
paths.stubsDexJarPath = libDep.DexJarBuildPath(ctx)
|
||||
@@ -738,7 +740,11 @@ func (paths *scopePaths) extractEverythingStubsLibraryInfoFromDependency(ctx and
|
||||
}
|
||||
|
||||
func (paths *scopePaths) extractExportableStubsLibraryInfoFromDependency(ctx android.ModuleContext, dep android.Module) error {
|
||||
if _, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
|
||||
if lib, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
|
||||
if ctx.Config().ReleaseHiddenApiExportableStubs() {
|
||||
paths.stubsImplPath = lib.ImplementationJars
|
||||
}
|
||||
|
||||
libDep := dep.(UsesLibraryDependency)
|
||||
paths.exportableStubsDexJarPath = libDep.DexJarBuildPath(ctx)
|
||||
return nil
|
||||
@@ -756,6 +762,15 @@ func (paths *scopePaths) treatDepAsApiStubsProvider(dep android.Module, action f
|
||||
}
|
||||
}
|
||||
|
||||
func (paths *scopePaths) treatDepAsExportableApiStubsProvider(dep android.Module, action func(provider ExportableApiStubsProvider)) error {
|
||||
if exportableApiStubsProvider, ok := dep.(ExportableApiStubsProvider); ok {
|
||||
action(exportableApiStubsProvider)
|
||||
return nil
|
||||
} else {
|
||||
return fmt.Errorf("expected module that implements ExportableApiStubsSrcProvider, e.g. droidstubs")
|
||||
}
|
||||
}
|
||||
|
||||
func (paths *scopePaths) treatDepAsApiStubsSrcProvider(dep android.Module, action func(provider ApiStubsSrcProvider)) error {
|
||||
if apiStubsProvider, ok := dep.(ApiStubsSrcProvider); ok {
|
||||
action(apiStubsProvider)
|
||||
@@ -771,6 +786,12 @@ func (paths *scopePaths) extractApiInfoFromApiStubsProvider(provider ApiStubsPro
|
||||
paths.removedApiFilePath = android.OptionalPathForPath(provider.RemovedApiFilePath())
|
||||
}
|
||||
|
||||
func (paths *scopePaths) extractApiInfoFromExportableApiStubsProvider(provider ExportableApiStubsProvider) {
|
||||
paths.annotationsZip = android.OptionalPathForPath(provider.ExportableAnnotationsZip())
|
||||
paths.currentApiFilePath = android.OptionalPathForPath(provider.ExportableApiFilePath())
|
||||
paths.removedApiFilePath = android.OptionalPathForPath(provider.ExportableRemovedApiFilePath())
|
||||
}
|
||||
|
||||
func (paths *scopePaths) extractApiInfoFromDep(ctx android.ModuleContext, dep android.Module) error {
|
||||
return paths.treatDepAsApiStubsProvider(dep, func(provider ApiStubsProvider) {
|
||||
paths.extractApiInfoFromApiStubsProvider(provider)
|
||||
@@ -781,6 +802,10 @@ func (paths *scopePaths) extractStubsSourceInfoFromApiStubsProviders(provider Ap
|
||||
paths.stubsSrcJar = android.OptionalPathForPath(provider.StubsSrcJar())
|
||||
}
|
||||
|
||||
func (paths *scopePaths) extractStubsSourceInfoFromExportableApiStubsProviders(provider ExportableApiStubsSrcProvider) {
|
||||
paths.stubsSrcJar = android.OptionalPathForPath(provider.ExportableStubsSrcJar())
|
||||
}
|
||||
|
||||
func (paths *scopePaths) extractStubsSourceInfoFromDep(ctx android.ModuleContext, dep android.Module) error {
|
||||
return paths.treatDepAsApiStubsSrcProvider(dep, func(provider ApiStubsSrcProvider) {
|
||||
paths.extractStubsSourceInfoFromApiStubsProviders(provider)
|
||||
@@ -788,6 +813,12 @@ func (paths *scopePaths) extractStubsSourceInfoFromDep(ctx android.ModuleContext
|
||||
}
|
||||
|
||||
func (paths *scopePaths) extractStubsSourceAndApiInfoFromApiStubsProvider(ctx android.ModuleContext, dep android.Module) error {
|
||||
if ctx.Config().ReleaseHiddenApiExportableStubs() {
|
||||
return paths.treatDepAsExportableApiStubsProvider(dep, func(provider ExportableApiStubsProvider) {
|
||||
paths.extractApiInfoFromExportableApiStubsProvider(provider)
|
||||
paths.extractStubsSourceInfoFromExportableApiStubsProviders(provider)
|
||||
})
|
||||
}
|
||||
return paths.treatDepAsApiStubsProvider(dep, func(provider ApiStubsProvider) {
|
||||
paths.extractApiInfoFromApiStubsProvider(provider)
|
||||
paths.extractStubsSourceInfoFromApiStubsProviders(provider)
|
||||
|
Reference in New Issue
Block a user