From 17854f5797d10fc04301703e7d0fc7adee09394d Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Fri, 14 Jan 2022 21:19:14 +0000 Subject: [PATCH] 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 --- java/lint.go | 22 +++++++++++----------- java/sdk_library.go | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/java/lint.go b/java/lint.go index 7845c336b..e97c9c225 100644 --- a/java/lint.go +++ b/java/lint.go @@ -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) } }) } diff --git a/java/sdk_library.go b/java/sdk_library.go index 6a2a7a845..820d9ffc6 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -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) } }