Export LintDepSetsIntf from java package

This interface will be used in the apex package to propagate
strict_updatability_linting to transitive deps of mainline code

Test: In build/soong, go test ./java
Bug: 182349282

Change-Id: I30151217e843e4e9fe82db572a066918414ed3a0
This commit is contained in:
Spandan Das 2022-01-14 21:19:14 +00:00
parent 076b9c26e9
commit 17854f5797
2 changed files with 15 additions and 15 deletions

View file

@ -102,12 +102,12 @@ type lintOutputsIntf interface {
lintOutputs() *lintOutputs
}
type lintDepSetsIntf interface {
type LintDepSetsIntf interface {
LintDepSets() LintDepSets
// Methods used to propagate strict_updatability_linting values.
getStrictUpdatabilityLinting() bool
setStrictUpdatabilityLinting(bool)
GetStrictUpdatabilityLinting() bool
SetStrictUpdatabilityLinting(bool)
}
type LintDepSets struct {
@ -158,15 +158,15 @@ func (l *linter) LintDepSets() LintDepSets {
return l.outputs.depSets
}
func (l *linter) getStrictUpdatabilityLinting() bool {
func (l *linter) GetStrictUpdatabilityLinting() bool {
return BoolDefault(l.properties.Lint.Strict_updatability_linting, false)
}
func (l *linter) setStrictUpdatabilityLinting(strictLinting bool) {
func (l *linter) SetStrictUpdatabilityLinting(strictLinting bool) {
l.properties.Lint.Strict_updatability_linting = &strictLinting
}
var _ lintDepSetsIntf = (*linter)(nil)
var _ LintDepSetsIntf = (*linter)(nil)
var _ lintOutputsIntf = (*linter)(nil)
@ -273,7 +273,7 @@ func (l *linter) writeLintProjectXML(ctx android.ModuleContext, rule *android.Ru
cmd.FlagForEachArg("--error_check ", l.properties.Lint.Error_checks)
cmd.FlagForEachArg("--fatal_check ", l.properties.Lint.Fatal_checks)
if l.getStrictUpdatabilityLinting() {
if l.GetStrictUpdatabilityLinting() {
// Verify the module does not baseline issues that endanger safe updatability.
if baselinePath := l.getBaselineFilepath(ctx); baselinePath.Valid() {
cmd.FlagWithInput("--baseline ", baselinePath.Path())
@ -382,7 +382,7 @@ func (l *linter) lint(ctx android.ModuleContext) {
depSetsBuilder := NewLintDepSetBuilder().Direct(html, text, xml)
ctx.VisitDirectDepsWithTag(staticLibTag, func(dep android.Module) {
if depLint, ok := dep.(lintDepSetsIntf); ok {
if depLint, ok := dep.(LintDepSetsIntf); ok {
depSetsBuilder.Transitive(depLint.LintDepSets())
}
})
@ -660,10 +660,10 @@ func lintZip(ctx android.BuilderContext, paths android.Paths, outputPath android
// Enforce the strict updatability linting to all applicable transitive dependencies.
func enforceStrictUpdatabilityLintingMutator(ctx android.TopDownMutatorContext) {
m := ctx.Module()
if d, ok := m.(lintDepSetsIntf); ok && d.getStrictUpdatabilityLinting() {
if d, ok := m.(LintDepSetsIntf); ok && d.GetStrictUpdatabilityLinting() {
ctx.VisitDirectDepsWithTag(staticLibTag, func(d android.Module) {
if a, ok := d.(lintDepSetsIntf); ok {
a.setStrictUpdatabilityLinting(true)
if a, ok := d.(LintDepSetsIntf); ok {
a.SetStrictUpdatabilityLinting(true)
}
})
}

View file

@ -2363,17 +2363,17 @@ func (module *SdkLibraryImport) LintDepSets() LintDepSets {
}
}
func (module *SdkLibraryImport) getStrictUpdatabilityLinting() bool {
func (module *SdkLibraryImport) GetStrictUpdatabilityLinting() bool {
if module.implLibraryModule == nil {
return false
} else {
return module.implLibraryModule.getStrictUpdatabilityLinting()
return module.implLibraryModule.GetStrictUpdatabilityLinting()
}
}
func (module *SdkLibraryImport) setStrictUpdatabilityLinting(strictLinting bool) {
func (module *SdkLibraryImport) SetStrictUpdatabilityLinting(strictLinting bool) {
if module.implLibraryModule != nil {
module.implLibraryModule.setStrictUpdatabilityLinting(strictLinting)
module.implLibraryModule.SetStrictUpdatabilityLinting(strictLinting)
}
}