Support building WITHOUT_CHECK_API=true
When WITHOUT_CHECK_API=true the check api process is not run which means that the current.txt and removed.txt files are not generated by the build. In that case this change causes the droidstubs module to fallback to exporting the source files instead. An additional removedApiFilePath property (to match apiFilePath) was added to hold the exported path as removedApiFile has to be a WritablePath and source paths are not writable. Bug: 169034951 Test: m WITHOUT_CHECK_API=true nothing fails without this fix, passes with it. Change-Id: If6b09dd67c8533368b71405143f524d66350703f
This commit is contained in:
parent
ff98103505
commit
bc0fe96be3
|
@ -1016,7 +1016,8 @@ type Droidstubs struct {
|
||||||
annotationsZip android.WritablePath
|
annotationsZip android.WritablePath
|
||||||
apiVersionsXml android.WritablePath
|
apiVersionsXml android.WritablePath
|
||||||
|
|
||||||
apiFilePath android.Path
|
apiFilePath android.Path
|
||||||
|
removedApiFilePath android.Path
|
||||||
|
|
||||||
metadataZip android.WritablePath
|
metadataZip android.WritablePath
|
||||||
metadataDir android.WritablePath
|
metadataDir android.WritablePath
|
||||||
|
@ -1059,7 +1060,7 @@ func (d *Droidstubs) OutputFiles(tag string) (android.Paths, error) {
|
||||||
case ".api.txt":
|
case ".api.txt":
|
||||||
return android.Paths{d.apiFilePath}, nil
|
return android.Paths{d.apiFilePath}, nil
|
||||||
case ".removed-api.txt":
|
case ".removed-api.txt":
|
||||||
return android.Paths{d.removedApiFile}, nil
|
return android.Paths{d.removedApiFilePath}, nil
|
||||||
case ".annotations.zip":
|
case ".annotations.zip":
|
||||||
return android.Paths{d.annotationsZip}, nil
|
return android.Paths{d.annotationsZip}, nil
|
||||||
case ".api_versions.xml":
|
case ".api_versions.xml":
|
||||||
|
@ -1074,7 +1075,7 @@ func (d *Droidstubs) ApiFilePath() android.Path {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droidstubs) RemovedApiFilePath() android.Path {
|
func (d *Droidstubs) RemovedApiFilePath() android.Path {
|
||||||
return d.removedApiFile
|
return d.removedApiFilePath
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droidstubs) StubsSrcJar() android.Path {
|
func (d *Droidstubs) StubsSrcJar() android.Path {
|
||||||
|
@ -1125,6 +1126,9 @@ func (d *Droidstubs) stubsFlags(ctx android.ModuleContext, cmd *android.RuleBuil
|
||||||
d.apiFile = android.PathForModuleOut(ctx, filename)
|
d.apiFile = android.PathForModuleOut(ctx, filename)
|
||||||
cmd.FlagWithOutput("--api ", d.apiFile)
|
cmd.FlagWithOutput("--api ", d.apiFile)
|
||||||
d.apiFilePath = d.apiFile
|
d.apiFilePath = d.apiFile
|
||||||
|
} else if sourceApiFile := proptools.String(d.properties.Check_api.Current.Api_file); sourceApiFile != "" {
|
||||||
|
// If check api is disabled then make the source file available for export.
|
||||||
|
d.apiFilePath = android.PathForModuleSrc(ctx, sourceApiFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") ||
|
if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") ||
|
||||||
|
@ -1133,6 +1137,10 @@ func (d *Droidstubs) stubsFlags(ctx android.ModuleContext, cmd *android.RuleBuil
|
||||||
filename := proptools.StringDefault(d.properties.Removed_api_filename, ctx.ModuleName()+"_removed.txt")
|
filename := proptools.StringDefault(d.properties.Removed_api_filename, ctx.ModuleName()+"_removed.txt")
|
||||||
d.removedApiFile = android.PathForModuleOut(ctx, filename)
|
d.removedApiFile = android.PathForModuleOut(ctx, filename)
|
||||||
cmd.FlagWithOutput("--removed-api ", d.removedApiFile)
|
cmd.FlagWithOutput("--removed-api ", d.removedApiFile)
|
||||||
|
d.removedApiFilePath = d.removedApiFile
|
||||||
|
} else if sourceRemovedApiFile := proptools.String(d.properties.Check_api.Current.Removed_api_file); sourceRemovedApiFile != "" {
|
||||||
|
// If check api is disabled then make the source removed api file available for export.
|
||||||
|
d.removedApiFilePath = android.PathForModuleSrc(ctx, sourceRemovedApiFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
if String(d.properties.Removed_dex_api_filename) != "" {
|
if String(d.properties.Removed_dex_api_filename) != "" {
|
||||||
|
|
Loading…
Reference in New Issue