Merge "Compile stubs to .dex" am: 709dbd08a0
am: bfbca5848b
am: 0f9f20e2b4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2503215 Change-Id: I09c3798da462c1ad09f1ce4b0de064f34130ab48 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
45
java/java.go
45
java/java.go
@@ -1612,10 +1612,15 @@ type ApiLibrary struct {
|
||||
android.ModuleBase
|
||||
android.DefaultableModuleBase
|
||||
|
||||
hiddenAPI
|
||||
dexer
|
||||
|
||||
properties JavaApiLibraryProperties
|
||||
|
||||
stubsSrcJar android.WritablePath
|
||||
stubsJar android.WritablePath
|
||||
// .dex of stubs, used for hiddenapi processing
|
||||
dexJarFile OptionalDexJarPath
|
||||
}
|
||||
|
||||
type JavaApiLibraryProperties struct {
|
||||
@@ -1793,6 +1798,20 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
Inputs(staticLibs)
|
||||
builder.Build("merge_zips", "merge jar files")
|
||||
|
||||
// compile stubs to .dex for hiddenapi processing
|
||||
dexParams := &compileDexParams{
|
||||
flags: javaBuilderFlags{},
|
||||
sdkVersion: al.SdkVersion(ctx),
|
||||
minSdkVersion: al.MinSdkVersion(ctx),
|
||||
classesJar: al.stubsJar,
|
||||
jarName: ctx.ModuleName() + ".jar",
|
||||
}
|
||||
dexOutputFile := al.dexer.compileDex(ctx, dexParams)
|
||||
uncompressed := true
|
||||
al.initHiddenAPI(ctx, makeDexJarPathFromPath(dexOutputFile), al.stubsJar, &uncompressed)
|
||||
dexOutputFile = al.hiddenAPIEncodeDex(ctx, dexOutputFile)
|
||||
al.dexJarFile = makeDexJarPathFromPath(dexOutputFile)
|
||||
|
||||
ctx.Phony(ctx.ModuleName(), al.stubsJar)
|
||||
|
||||
ctx.SetProvider(JavaInfoProvider, JavaInfo{
|
||||
@@ -1800,6 +1819,32 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
})
|
||||
}
|
||||
|
||||
func (al *ApiLibrary) DexJarBuildPath() OptionalDexJarPath {
|
||||
return al.dexJarFile
|
||||
}
|
||||
|
||||
func (al *ApiLibrary) DexJarInstallPath() android.Path {
|
||||
return al.dexJarFile.Path()
|
||||
}
|
||||
|
||||
func (al *ApiLibrary) ClassLoaderContexts() dexpreopt.ClassLoaderContextMap {
|
||||
return nil
|
||||
}
|
||||
|
||||
// java_api_library constitutes the sdk, and does not build against one
|
||||
func (al *ApiLibrary) SdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
return android.SdkSpecNone
|
||||
}
|
||||
|
||||
// java_api_library is always at "current". Return FutureApiLevel
|
||||
func (al *ApiLibrary) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
||||
return android.FutureApiLevel
|
||||
}
|
||||
|
||||
// implement the following interfaces for hiddenapi processing
|
||||
var _ hiddenAPIModule = (*ApiLibrary)(nil)
|
||||
var _ UsesLibraryDependency = (*ApiLibrary)(nil)
|
||||
|
||||
//
|
||||
// Java prebuilts
|
||||
//
|
||||
|
Reference in New Issue
Block a user