Add previous_api
property to java_api_library
module
`Previous_api` is used to migrate nullness information in metalava (i.e. convert @Nullable and @NonNull to @RecentlyNullable and @RecentlyNonNull for some methods). The input is required to generate loosely equivalent from-text stubs. Test: m && compare nullness annotations between from-source stubs and from-text stubs Bug: 293962901 Change-Id: Ic7a0868415fdb2c65d0d472e527fe73280b7651d
This commit is contained in:
@@ -1683,6 +1683,9 @@ type JavaApiLibraryProperties struct {
|
||||
// extracting the compiled class files provided by the
|
||||
// full_api_surface_stub module.
|
||||
Full_api_surface_stub *string
|
||||
|
||||
// Version of previously released API file for compatibility check.
|
||||
Previous_api *string `android:"path"`
|
||||
}
|
||||
|
||||
func ApiLibraryFactory() android.Module {
|
||||
@@ -1890,6 +1893,12 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
|
||||
al.stubsFlags(ctx, cmd, stubsDir)
|
||||
|
||||
migratingNullability := String(al.properties.Previous_api) != ""
|
||||
if migratingNullability {
|
||||
previousApi := android.PathForModuleSrc(ctx, String(al.properties.Previous_api))
|
||||
cmd.FlagWithInput("--migrate-nullness ", previousApi)
|
||||
}
|
||||
|
||||
al.stubsSrcJar = android.PathForModuleOut(ctx, "metalava", ctx.ModuleName()+"-"+"stubs.srcjar")
|
||||
al.stubsJarWithoutStaticLibs = android.PathForModuleOut(ctx, "metalava", "stubs.jar")
|
||||
al.stubsJar = android.PathForModuleOut(ctx, ctx.ModuleName(), fmt.Sprintf("%s.jar", ctx.ModuleName()))
|
||||
|
Reference in New Issue
Block a user