Pass config files to metalava
Adds a filegroup "metalava-config-files" whose contents are passed to Metalava using the `--config-file` option. Bug: 354699349 Test: m checkapi Change-Id: I1e246517c2ef678e41214c975aecee97f9faca67
This commit is contained in:
17
java/java.go
17
java/java.go
@@ -269,7 +269,7 @@ type JavaInfo struct {
|
||||
ImplementationAndResourcesJars android.Paths
|
||||
|
||||
// ImplementationJars is a list of jars that contain the implementations of classes in the
|
||||
//module.
|
||||
// module.
|
||||
ImplementationJars android.Paths
|
||||
|
||||
// ResourceJars is a list of jars that contain the resources included in the module.
|
||||
@@ -2039,12 +2039,17 @@ type JavaApiLibraryProperties struct {
|
||||
// List of aconfig_declarations module names that the stubs generated in this module
|
||||
// depend on.
|
||||
Aconfig_declarations []string
|
||||
|
||||
// List of hard coded filegroups containing Metalava config files that are passed to every
|
||||
// Metalava invocation that this module performs. See addMetalavaConfigFilesToCmd.
|
||||
ConfigFiles []string `android:"path" blueprint:"mutated"`
|
||||
}
|
||||
|
||||
func ApiLibraryFactory() android.Module {
|
||||
module := &ApiLibrary{}
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
module.AddProperties(&module.properties)
|
||||
module.properties.ConfigFiles = getMetalavaConfigFilegroupReference()
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
module.initModuleAndImport(module)
|
||||
android.InitDefaultableModule(module)
|
||||
return module
|
||||
@@ -2060,7 +2065,7 @@ func (al *ApiLibrary) StubsJar() android.Path {
|
||||
|
||||
func metalavaStubCmd(ctx android.ModuleContext, rule *android.RuleBuilder,
|
||||
srcs android.Paths, homeDir android.WritablePath,
|
||||
classpath android.Paths) *android.RuleBuilderCommand {
|
||||
classpath android.Paths, configFiles android.Paths) *android.RuleBuilderCommand {
|
||||
rule.Command().Text("rm -rf").Flag(homeDir.String())
|
||||
rule.Command().Text("mkdir -p").Flag(homeDir.String())
|
||||
|
||||
@@ -2099,6 +2104,8 @@ func metalavaStubCmd(ctx android.ModuleContext, rule *android.RuleBuilder,
|
||||
FlagWithArg("--hide ", "InvalidNullabilityOverride").
|
||||
FlagWithArg("--hide ", "ChangedDefault")
|
||||
|
||||
addMetalavaConfigFilesToCmd(cmd, configFiles)
|
||||
|
||||
if len(classpath) == 0 {
|
||||
// The main purpose of the `--api-class-resolution api` option is to force metalava to ignore
|
||||
// classes on the classpath when an API file contains missing classes. However, as this command
|
||||
@@ -2310,7 +2317,9 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
ctx.ModuleErrorf("Error: %s has an empty api file.", ctx.ModuleName())
|
||||
}
|
||||
|
||||
cmd := metalavaStubCmd(ctx, rule, srcFiles, homeDir, systemModulesPaths)
|
||||
configFiles := android.PathsForModuleSrc(ctx, al.properties.ConfigFiles)
|
||||
|
||||
cmd := metalavaStubCmd(ctx, rule, srcFiles, homeDir, systemModulesPaths, configFiles)
|
||||
|
||||
al.stubsFlags(ctx, cmd, stubsDir)
|
||||
|
||||
|
Reference in New Issue
Block a user