diff options
Diffstat (limited to 'java/base.go')
-rw-r--r-- | java/base.go | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/java/base.go b/java/base.go index 4ab82c58f..910145785 100644 --- a/java/base.go +++ b/java/base.go @@ -229,6 +229,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 @@ -1541,7 +1545,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) @@ -2169,6 +2173,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(), @@ -2190,30 +2213,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 |