Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b79aa8fe authored by Colin Cross's avatar Colin Cross
Browse files

Use providers for lint

Bug: b/348040422
Test: lint_test.go
Flag: EXEMPT refactor
Change-Id: I420bee2c7056a3f4acee3af5955f79c504ea61d9
parent b323c911
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -588,7 +588,7 @@ type apexFile struct {
	dataPaths                 []android.DataPath // becomes LOCAL_TEST_DATA

	jacocoReportClassesFile android.Path     // only for javalibs and apps
	lintDepSets             java.LintDepSets // only for javalibs and apps
	lintInfo                *java.LintInfo   // only for javalibs and apps
	certificate             java.Certificate // only for apps
	overriddenPackageName   string           // only for apps

@@ -1667,7 +1667,6 @@ type javaModule interface {
	BaseModuleName() string
	DexJarBuildPath(ctx android.ModuleErrorfContext) java.OptionalDexJarPath
	JacocoReportClassesFile() android.Path
	LintDepSets() java.LintDepSets
	Stem() string
}

@@ -1687,7 +1686,9 @@ func apexFileForJavaModuleWithFile(ctx android.ModuleContext, module javaModule,
	dirInApex := "javalib"
	af := newApexFile(ctx, dexImplementationJar, module.BaseModuleName(), dirInApex, javaSharedLib, module)
	af.jacocoReportClassesFile = module.JacocoReportClassesFile()
	af.lintDepSets = module.LintDepSets()
	if lintInfo, ok := android.OtherModuleProvider(ctx, module, java.LintProvider); ok {
		af.lintInfo = lintInfo
	}
	af.customStem = module.Stem() + ".jar"
	// TODO: b/338641779 - Remove special casing of sdkLibrary once bcpf and sscpf depends
	// on the implementation library
@@ -1725,7 +1726,6 @@ type androidApp interface {
	JacocoReportClassesFile() android.Path
	Certificate() java.Certificate
	BaseModuleName() string
	LintDepSets() java.LintDepSets
	PrivAppAllowlist() android.OptionalPath
}

@@ -1761,7 +1761,9 @@ func apexFilesForAndroidApp(ctx android.BaseModuleContext, aapp androidApp) []ap

	af := newApexFile(ctx, fileToCopy, aapp.BaseModuleName(), dirInApex, app, aapp)
	af.jacocoReportClassesFile = aapp.JacocoReportClassesFile()
	af.lintDepSets = aapp.LintDepSets()
	if lintInfo, ok := android.OtherModuleProvider(ctx, aapp, java.LintProvider); ok {
		af.lintInfo = lintInfo
	}
	af.certificate = aapp.Certificate()

	if app, ok := aapp.(interface {
+3 −1
Original line number Diff line number Diff line
@@ -1158,7 +1158,9 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) {
func (a *apexBundle) buildLintReports(ctx android.ModuleContext) {
	depSetsBuilder := java.NewLintDepSetBuilder()
	for _, fi := range a.filesInfo {
		depSetsBuilder.Transitive(fi.lintDepSets)
		if fi.lintInfo != nil {
			depSetsBuilder.Transitive(fi.lintInfo)
		}
	}

	a.lintReports = java.BuildModuleLintReportZips(ctx, depSetsBuilder.Build())
+0 −4
Original line number Diff line number Diff line
@@ -533,10 +533,6 @@ func (a *AndroidAppImport) MinSdkVersion(ctx android.EarlyModuleContext) android
	return android.SdkSpecPrivate.ApiLevel
}

func (a *AndroidAppImport) LintDepSets() LintDepSets {
	return LintDepSets{}
}

var _ android.ApexModule = (*AndroidAppImport)(nil)

// Implements android.ApexModule
+0 −3
Original line number Diff line number Diff line
@@ -707,9 +707,6 @@ func setOutputFiles(ctx android.ModuleContext, m Module) {
		ctx.SetOutputFiles(android.Paths{m.dexer.proguardDictionary.Path()}, ".proguard_map")
	}
	ctx.SetOutputFiles(m.properties.Generated_srcjars, ".generated_srcjars")
	if m.linter.outputs.xml != nil {
		ctx.SetOutputFiles(android.Paths{m.linter.outputs.xml}, ".lint")
	}
}

func InitJavaModule(module android.DefaultableModule, hod android.HostOrDeviceSupported) {
+0 −8
Original line number Diff line number Diff line
@@ -2607,10 +2607,6 @@ func (a *Import) JacocoReportClassesFile() android.Path {
	return nil
}

func (j *Import) LintDepSets() LintDepSets {
	return LintDepSets{}
}

func (j *Import) getStrictUpdatabilityLinting() bool {
	return false
}
@@ -3120,10 +3116,6 @@ func (a *DexImport) JacocoReportClassesFile() android.Path {
	return nil
}

func (a *DexImport) LintDepSets() LintDepSets {
	return LintDepSets{}
}

func (j *DexImport) IsInstallable() bool {
	return true
}
Loading