Revert "Check that API is up-to-date when building java_sdk_library"
This reverts commit c166b68589
.
Bug: 234113632
Bug: 236187167
Reason for revert: causes problems with update-api, see b/236187167
Change-Id: I4c88151cb5e2c86bb6c1a955c5065966a4fbb3e0
This commit is contained in:
@@ -697,53 +697,10 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
zipSyncCleanupCmd(rule, srcJarDir)
|
zipSyncCleanupCmd(rule, srcJarDir)
|
||||||
|
|
||||||
if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") {
|
|
||||||
d.generateCheckCurrentCheckedInApiIsUpToDateBuildRules(ctx)
|
|
||||||
|
|
||||||
// Make sure that whenever the API stubs are generated that the current checked in API files are
|
|
||||||
// checked to make sure that they are up-to-date.
|
|
||||||
cmd.Validation(d.checkCurrentApiTimestamp)
|
|
||||||
}
|
|
||||||
|
|
||||||
rule.Build("metalava", "metalava merged")
|
rule.Build("metalava", "metalava merged")
|
||||||
|
|
||||||
if String(d.properties.Check_nullability_warnings) != "" {
|
if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") {
|
||||||
if d.nullabilityWarningsFile == nil {
|
|
||||||
ctx.PropertyErrorf("check_nullability_warnings",
|
|
||||||
"Cannot specify check_nullability_warnings unless validating nullability")
|
|
||||||
}
|
|
||||||
|
|
||||||
checkNullabilityWarnings := android.PathForModuleSrc(ctx, String(d.properties.Check_nullability_warnings))
|
|
||||||
|
|
||||||
d.checkNullabilityWarningsTimestamp = android.PathForModuleOut(ctx, "metalava", "check_nullability_warnings.timestamp")
|
|
||||||
|
|
||||||
msg := fmt.Sprintf(`\n******************************\n`+
|
|
||||||
`The warnings encountered during nullability annotation validation did\n`+
|
|
||||||
`not match the checked in file of expected warnings. The diffs are shown\n`+
|
|
||||||
`above. You have two options:\n`+
|
|
||||||
` 1. Resolve the differences by editing the nullability annotations.\n`+
|
|
||||||
` 2. Update the file of expected warnings by running:\n`+
|
|
||||||
` cp %s %s\n`+
|
|
||||||
` and submitting the updated file as part of your change.`,
|
|
||||||
d.nullabilityWarningsFile, checkNullabilityWarnings)
|
|
||||||
|
|
||||||
rule := android.NewRuleBuilder(pctx, ctx)
|
|
||||||
|
|
||||||
rule.Command().
|
|
||||||
Text("(").
|
|
||||||
Text("diff").Input(checkNullabilityWarnings).Input(d.nullabilityWarningsFile).
|
|
||||||
Text("&&").
|
|
||||||
Text("touch").Output(d.checkNullabilityWarningsTimestamp).
|
|
||||||
Text(") || (").
|
|
||||||
Text("echo").Flag("-e").Flag(`"` + msg + `"`).
|
|
||||||
Text("; exit 38").
|
|
||||||
Text(")")
|
|
||||||
|
|
||||||
rule.Build("nullabilityWarningsCheck", "nullability warnings check")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Droidstubs) generateCheckCurrentCheckedInApiIsUpToDateBuildRules(ctx android.ModuleContext) {
|
|
||||||
if len(d.Javadoc.properties.Out) > 0 {
|
if len(d.Javadoc.properties.Out) > 0 {
|
||||||
ctx.PropertyErrorf("out", "out property may not be combined with check_api")
|
ctx.PropertyErrorf("out", "out property may not be combined with check_api")
|
||||||
}
|
}
|
||||||
@@ -819,6 +776,42 @@ func (d *Droidstubs) generateCheckCurrentCheckedInApiIsUpToDateBuildRules(ctx an
|
|||||||
Text(")")
|
Text(")")
|
||||||
|
|
||||||
rule.Build("metalavaCurrentApiUpdate", "update current API")
|
rule.Build("metalavaCurrentApiUpdate", "update current API")
|
||||||
|
}
|
||||||
|
|
||||||
|
if String(d.properties.Check_nullability_warnings) != "" {
|
||||||
|
if d.nullabilityWarningsFile == nil {
|
||||||
|
ctx.PropertyErrorf("check_nullability_warnings",
|
||||||
|
"Cannot specify check_nullability_warnings unless validating nullability")
|
||||||
|
}
|
||||||
|
|
||||||
|
checkNullabilityWarnings := android.PathForModuleSrc(ctx, String(d.properties.Check_nullability_warnings))
|
||||||
|
|
||||||
|
d.checkNullabilityWarningsTimestamp = android.PathForModuleOut(ctx, "metalava", "check_nullability_warnings.timestamp")
|
||||||
|
|
||||||
|
msg := fmt.Sprintf(`\n******************************\n`+
|
||||||
|
`The warnings encountered during nullability annotation validation did\n`+
|
||||||
|
`not match the checked in file of expected warnings. The diffs are shown\n`+
|
||||||
|
`above. You have two options:\n`+
|
||||||
|
` 1. Resolve the differences by editing the nullability annotations.\n`+
|
||||||
|
` 2. Update the file of expected warnings by running:\n`+
|
||||||
|
` cp %s %s\n`+
|
||||||
|
` and submitting the updated file as part of your change.`,
|
||||||
|
d.nullabilityWarningsFile, checkNullabilityWarnings)
|
||||||
|
|
||||||
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
|
rule.Command().
|
||||||
|
Text("(").
|
||||||
|
Text("diff").Input(checkNullabilityWarnings).Input(d.nullabilityWarningsFile).
|
||||||
|
Text("&&").
|
||||||
|
Text("touch").Output(d.checkNullabilityWarningsTimestamp).
|
||||||
|
Text(") || (").
|
||||||
|
Text("echo").Flag("-e").Flag(`"` + msg + `"`).
|
||||||
|
Text("; exit 38").
|
||||||
|
Text(")")
|
||||||
|
|
||||||
|
rule.Build("nullabilityWarningsCheck", "nullability warnings check")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func StubsDefaultsFactory() android.Module {
|
func StubsDefaultsFactory() android.Module {
|
||||||
|
Reference in New Issue
Block a user