Merge "API: Add baseline file for API check" am: 2bfc6bf896 am: 991093b0cb am: 58e83b9c7b am: 541ebaadc0

am: 1782e71b7b

Change-Id: Iaee23c81bb1b0b84a55e0b656c8d0ec48df676ca
This commit is contained in:
Adrian Roos
2019-08-14 08:52:22 -07:00
committed by android-build-merger

View File

@@ -111,6 +111,9 @@ type ApiToCheck struct {
// :module syntax).
Removed_api_file *string `android:"path"`
// If not blank, path to the baseline txt file for approved API check violations.
Baseline_file *string `android:"path"`
// Arguments to the apicheck tool.
Args *string
}
@@ -1503,6 +1506,8 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
apiFile := android.PathForModuleSrc(ctx, String(d.properties.Check_api.Current.Api_file))
removedApiFile := android.PathForModuleSrc(ctx, String(d.properties.Check_api.Current.Removed_api_file))
baselineFile := android.OptionalPathForModuleSrc(ctx, d.properties.Check_api.Current.Baseline_file)
updatedBaselineOutput := android.PathForModuleOut(ctx, "current_baseline.txt")
d.checkCurrentApiTimestamp = android.PathForModuleOut(ctx, "check_current_api.timestamp")
@@ -1523,6 +1528,11 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
d.inclusionAnnotationsFlags(ctx, cmd)
d.mergeAnnoDirFlags(ctx, cmd)
if baselineFile.Valid() {
cmd.FlagWithInput("--baseline ", baselineFile.Path())
cmd.FlagWithOutput("--update-baseline ", updatedBaselineOutput)
}
zipSyncCleanupCmd(rule, srcJarDir)
msg := fmt.Sprintf(`\n******************************\n`+
@@ -1581,6 +1591,8 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
apiFile := android.PathForModuleSrc(ctx, String(d.properties.Check_api.Last_released.Api_file))
removedApiFile := android.PathForModuleSrc(ctx, String(d.properties.Check_api.Last_released.Removed_api_file))
baselineFile := android.OptionalPathForModuleSrc(ctx, d.properties.Check_api.Last_released.Baseline_file)
updatedBaselineOutput := android.PathForModuleOut(ctx, "last_released_baseline.txt")
d.checkLastReleasedApiTimestamp = android.PathForModuleOut(ctx, "check_last_released_api.timestamp")
@@ -1603,6 +1615,11 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
d.mergeAnnoDirFlags(ctx, cmd)
if baselineFile.Valid() {
cmd.FlagWithInput("--baseline ", baselineFile.Path())
cmd.FlagWithOutput("--update-baseline ", updatedBaselineOutput)
}
zipSyncCleanupCmd(rule, srcJarDir)
msg := `\n******************************\n` +