Merge "Add previous_api property to java_api_library module" into main am: 9a3cd19bee am: 7bdc85175f

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

Change-Id: Ia9d23a2c145a0172ad22dc44a0916854a508e818
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jihoon Kang
2023-08-14 21:46:17 +00:00
committed by Automerger Merge Worker

View File

@@ -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()))