IDE external annotations: get rid of unnecessary product codes, download ideaIU annotations always.

GitOrigin-RevId: 19b199ce938efac7f49e6355f181337e25a3df6f
This commit is contained in:
Sergey Patrikeev
2019-08-02 13:04:58 +03:00
committed by intellij-monorepo-bot
parent 0d23842aab
commit 49f2467978
2 changed files with 5 additions and 12 deletions
@@ -31,22 +31,15 @@ class PublicIdeExternalAnnotationsRepository(private val project: Project) : Ide
SNAPSHOTS_REPO_URL
)
private val allProductCodes = listOf("IU", "IC", "RM", "PY", "PC", "PE", "PS", "WS", "OC", "CL", "DB", "RD", "GO", "MPS", "AI")
private val ideaIUAnnotationsCoordinates = "com.jetbrains.intellij.idea" to "ideaIU"
}
private fun getAnnotationsCoordinates(): Pair<String, String>? {
//Currently, for any IDE download ideaIU's annotations.
private val productCodeToAnnotationsCoordinates = allProductCodes.associate {
it to ideaIUAnnotationsCoordinates
}
fun hasAnnotationsForProduct(productCode: String): Boolean =
productCode in productCodeToAnnotationsCoordinates
return "com.jetbrains.intellij.idea" to "ideaIU"
}
override fun downloadExternalAnnotations(ideBuildNumber: BuildNumber): IdeExternalAnnotations? {
val productCode = ideBuildNumber.productCode.takeIf { it.isNotEmpty() } ?: "IU"
val (groupId, artifactId) = productCodeToAnnotationsCoordinates[productCode] ?: return null
val (groupId, artifactId) = getAnnotationsCoordinates() ?: return null
val lastReleaseVersion = "${ideBuildNumber.baselineVersion}.999999"
val lastReleaseAnnotations = tryDownload(groupId, artifactId, lastReleaseVersion, listOf(RELEASES_REPO_DESCRIPTION))
@@ -62,7 +62,7 @@ class IdeExternalAnnotationsUpdater {
}
fun updateIdeaJdkAnnotationsIfNecessary(project: Project, ideaJdk: Sdk, buildNumber: BuildNumber) {
if (!isInspectionEnabled(project) || !PublicIdeExternalAnnotationsRepository.hasAnnotationsForProduct(buildNumber.productCode)) {
if (!isInspectionEnabled(project)) {
return
}