summaryrefslogtreecommitdiff
path: root/android-lint/src
diff options
context:
space:
mode:
authorAmr Afifiy <amrmahmoud@google.com>2021-11-03 14:47:17 +0000
committerAmr Afifiy <amrmahmoud@google.com>2021-11-03 16:49:38 +0000
commit6301a80b4dc7ae7984bd400eb9104d9f2271f3fc (patch)
tree37249b949c68847e496d1d7818a97d0e6e3deb1e /android-lint/src
parent3689f4a72ea0c2cfccc6579729fbfd58df3d6707 (diff)
downloadidea-6301a80b4dc7ae7984bd400eb9104d9f2271f3fc.tar.gz
Revert "Add a sourceset field to LintModelModuleLibrary"
This reverts commit 852d9a8f0e0bd197715c79349c2d007f0883012f. Reason for revert: Moving from using a sourceset field to rely on the artifact address to distinguish between different sourceset artifacts. There is no need currently for lint to know whether a library or a module is a testFixtures component of a library or a module. By moving to using the artifact address lint will deal with them as separate artifacts. Change-Id: Iebd9569b46deebed75a17c7d60d75721bb3bfb04
Diffstat (limited to 'android-lint/src')
-rw-r--r--android-lint/src/com/android/tools/idea/lint/model/LintModelDumper.kt1
-rw-r--r--android-lint/src/com/android/tools/idea/lint/model/LintModelFactory.kt23
2 files changed, 2 insertions, 22 deletions
diff --git a/android-lint/src/com/android/tools/idea/lint/model/LintModelDumper.kt b/android-lint/src/com/android/tools/idea/lint/model/LintModelDumper.kt
index 176090a2533..415d88bd40c 100644
--- a/android-lint/src/com/android/tools/idea/lint/model/LintModelDumper.kt
+++ b/android-lint/src/com/android/tools/idea/lint/model/LintModelDumper.kt
@@ -266,7 +266,6 @@ private fun ProjectDumper.dump(lintModelLibrary: LintModelLibrary) {
prop("ProguardRules") { proguardRules.path.toPrintablePath() }
}
prop("ProjectPath") { (this@with as? LintModelModuleLibrary)?.projectPath }
- prop("sourceSet") { (this@with as? LintModelModuleLibrary)?.sourceSet?.sourceSetName }
prop("ResolvedCoordinates") { (this@with as? LintModelExternalLibrary)?.resolvedCoordinates?.toString()?.replaceKnownPaths() }
prop("Provided") { provided.takeIf { it }?.toString() }
}
diff --git a/android-lint/src/com/android/tools/idea/lint/model/LintModelFactory.kt b/android-lint/src/com/android/tools/idea/lint/model/LintModelFactory.kt
index d2a42f4c306..ae41bb7d9c8 100644
--- a/android-lint/src/com/android/tools/idea/lint/model/LintModelFactory.kt
+++ b/android-lint/src/com/android/tools/idea/lint/model/LintModelFactory.kt
@@ -37,7 +37,6 @@ import com.android.tools.idea.gradle.model.IdeVariant
import com.android.ide.common.repository.GradleVersion
import com.android.sdklib.AndroidVersion
import com.android.tools.idea.gradle.model.IdeArtifactLibrary
-import com.android.tools.idea.gradle.model.IdeModuleSourceSet
import com.android.tools.lint.model.DefaultLintModelAndroidArtifact
import com.android.tools.lint.model.DefaultLintModelAndroidLibrary
import com.android.tools.lint.model.DefaultLintModelBuildFeatures
@@ -65,7 +64,6 @@ import com.android.tools.lint.model.LintModelLintOptions
import com.android.tools.lint.model.LintModelMavenName
import com.android.tools.lint.model.LintModelModule
import com.android.tools.lint.model.LintModelModuleLoader
-import com.android.tools.lint.model.LintModelModuleSourceSet
import com.android.tools.lint.model.LintModelModuleType
import com.android.tools.lint.model.LintModelNamespacingMode
import com.android.tools.lint.model.LintModelResourceField
@@ -197,12 +195,6 @@ class LintModelFactory : LintModelModuleLoader {
return DefaultLintModelModuleLibrary(
artifactAddress = library.getMavenArtifactAddress(),
projectPath = projectPath,
- sourceSet = when (library.sourceSet) {
- IdeModuleSourceSet.MAIN -> LintModelModuleSourceSet.MAIN
- IdeModuleSourceSet.TEST_FIXTURES -> LintModelModuleSourceSet.TEST_FIXTURES
- IdeModuleSourceSet.UNIT_TEST -> LintModelModuleSourceSet.UNIT_TEST
- IdeModuleSourceSet.ANDROID_TEST -> LintModelModuleSourceSet.ANDROID_TEST
- },
lintJar = library.lintJar?.let(::File),
provided = false
)
@@ -214,12 +206,7 @@ class LintModelFactory : LintModelModuleLoader {
private fun IdeJavaLibrary.getArtifactName(): String =
getMavenName().let { mavenName -> "${mavenName.groupId}:${mavenName.artifactId}" }
- private fun IdeModuleLibrary.getArtifactName(): String {
- val projectSuffix = if (sourceSet == IdeModuleSourceSet.TEST_FIXTURES) {
- "-test-fixtures"
- } else ""
- return "artifacts:$projectPath$projectSuffix"
- }
+ private fun IdeModuleLibrary.getArtifactName(): String = "artifacts:$projectPath"
private fun IdeArtifactLibrary.getMavenName(): LintModelMavenName = getMavenName(artifactAddress)
@@ -227,13 +214,7 @@ class LintModelFactory : LintModelModuleLoader {
private fun IdeJavaLibrary.getMavenArtifactAddress(): String = artifactAddress.substringBefore("@")
- // TODO(b/158346611): Review artifact names for modules.
- private fun IdeModuleLibrary.getMavenArtifactAddress(): String {
- val projectSuffix = if (sourceSet == IdeModuleSourceSet.TEST_FIXTURES) {
- "-test-fixtures"
- } else ""
- return "artifacts:$projectPath$projectSuffix:unspecified"
- }
+ private fun IdeModuleLibrary.getMavenArtifactAddress(): String = "artifacts:$projectPath:unspecified" // TODO(b/158346611): Review artifact names for modules.
private fun getGraphItem(
artifactName: String,