Merge "Compile stubs to .dex" am: 709dbd08a0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2503215 Change-Id: Ibfe3bd59f0a85de9c764d5193f15e6deff674389 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
@@ -1613,10 +1613,15 @@ type ApiLibrary struct {
|
|||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
android.DefaultableModuleBase
|
android.DefaultableModuleBase
|
||||||
|
|
||||||
|
hiddenAPI
|
||||||
|
dexer
|
||||||
|
|
||||||
properties JavaApiLibraryProperties
|
properties JavaApiLibraryProperties
|
||||||
|
|
||||||
stubsSrcJar android.WritablePath
|
stubsSrcJar android.WritablePath
|
||||||
stubsJar android.WritablePath
|
stubsJar android.WritablePath
|
||||||
|
// .dex of stubs, used for hiddenapi processing
|
||||||
|
dexJarFile OptionalDexJarPath
|
||||||
}
|
}
|
||||||
|
|
||||||
type JavaApiLibraryProperties struct {
|
type JavaApiLibraryProperties struct {
|
||||||
@@ -1794,6 +1799,20 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
Inputs(staticLibs)
|
Inputs(staticLibs)
|
||||||
builder.Build("merge_zips", "merge jar files")
|
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.Phony(ctx.ModuleName(), al.stubsJar)
|
||||||
|
|
||||||
ctx.SetProvider(JavaInfoProvider, JavaInfo{
|
ctx.SetProvider(JavaInfoProvider, JavaInfo{
|
||||||
@@ -1801,6 +1820,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
|
// Java prebuilts
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user