Merge "Remove suffix based stub matching logic" into main am: 65c530c17e

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3235808

Change-Id: Iad8c5a6fc68dc6e8cc2770a4f3f57a9fac18d3be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2024-08-23 03:52:13 +00:00
committed by Automerger Merge Worker
4 changed files with 90 additions and 43 deletions

View File

@@ -226,6 +226,10 @@ type CommonProperties struct {
Ravenizer struct {
Enabled *bool
}
// Contributing api surface of the stub module. Is not visible to bp modules, and should
// only be set for stub submodules generated by the java_sdk_library
Stub_contributing_api *string `blueprint:"mutated"`
}
// Properties that are specific to device modules. Host module factories should not add these when
@@ -1536,7 +1540,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
// outputFile should be agnostic to the build configuration,
// thus "combine" the single static lib in order to prevent the static lib from being exposed
// to the copy rules.
stub, _ := moduleStubLinkType(ctx.ModuleName())
stub, _ := moduleStubLinkType(j)
if stub {
combinedJar := android.PathForModuleOut(ctx, "combined", jarName)
@@ -2164,6 +2168,25 @@ type moduleWithSdkDep interface {
getSdkLinkType(ctx android.BaseModuleContext, name string) (ret sdkLinkType, stubs bool)
}
func sdkLinkTypeFromSdkKind(k android.SdkKind) sdkLinkType {
switch k {
case android.SdkCore:
return javaCore
case android.SdkSystem:
return javaSystem
case android.SdkPublic:
return javaSdk
case android.SdkModule:
return javaModule
case android.SdkSystemServer:
return javaSystemServer
case android.SdkPrivate, android.SdkNone, android.SdkCorePlatform, android.SdkTest:
return javaPlatform
default:
return javaSdk
}
}
func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret sdkLinkType, stubs bool) {
switch name {
case android.SdkCore.DefaultJavaLibraryName(),
@@ -2185,30 +2208,16 @@ func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret
return javaSystem, true
}
if stub, linkType := moduleStubLinkType(name); stub {
if stub, linkType := moduleStubLinkType(m); stub {
return linkType, true
}
ver := m.SdkVersion(ctx)
switch ver.Kind {
case android.SdkCore:
return javaCore, false
case android.SdkSystem:
return javaSystem, false
case android.SdkPublic:
return javaSdk, false
case android.SdkModule:
return javaModule, false
case android.SdkSystemServer:
return javaSystemServer, false
case android.SdkPrivate, android.SdkNone, android.SdkCorePlatform, android.SdkTest:
return javaPlatform, false
}
if !ver.Valid() {
panic(fmt.Errorf("sdk_version is invalid. got %q", ver.Raw))
}
return javaSdk, false
return sdkLinkTypeFromSdkKind(ver.Kind), false
}
// checkSdkLinkType make sures the given dependency doesn't have a lower SDK link type rank than