Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinquenel committed Aug 12, 2024
1 parent f139ec8 commit a7690db
Show file tree
Hide file tree
Showing 17 changed files with 241 additions and 207 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ plugin_verifier_task:
source .cirrus/use-gradle-wrapper.sh
VERSIONS=$(curl -s -L https://jb.gg/intellij-platform-builds-list | jq '.[] | "\(.code) \(.releases[].version)"' | grep -Ew "${ALLOWED_IDE}" | grep "${IDEA_VERSION}" | tr -d '"' | awk '{k=$1} $2>a[k]{a[k]=$2} END{for (i in a) print i, a[i]}' | sort -u | sed 's/ /-/' | paste -s -d',')
echo ${VERSIONS}
./gradlew :runPluginVerifier -PverifierVersions=${VERSIONS}
./gradlew :verifyPlugin -PverifierVersions=${VERSIONS}
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
on_failure:
reports_artifacts:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ its/projects/*-tmp/
*.iml
*.ipr
.idea
.intellijPlatform

# ---- Eclipse
.classpath
Expand Down
200 changes: 110 additions & 90 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

import com.jetbrains.plugin.blockmap.core.BlockMap
import java.io.BufferedInputStream
import java.io.BufferedOutputStream
import java.io.FileInputStream
import java.io.FileOutputStream
import java.util.EnumSet
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
import org.jetbrains.intellij.tasks.RunPluginVerifierTask
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask

plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.intellij)
//alias(libs.plugins.intellij)
alias(libs.plugins.intellij.migration)
alias(libs.plugins.sonarqube)
java
jacoco
Expand All @@ -33,6 +33,7 @@ buildscript {

group = "org.sonarsource.sonarlint.intellij"
description = "SonarLint for IntelliJ IDEA"
val pluginName = "sonarlint-intellij"

val sonarlintCoreVersion: String by project
val intellijBuildVersion: String by project
Expand All @@ -49,7 +50,7 @@ allprojects {
apply {
plugin("idea")
plugin("java")
plugin("org.jetbrains.intellij")
plugin("org.jetbrains.intellij.platform")
plugin("org.cyclonedx.bom")
plugin("com.github.hierynomus.license")
}
Expand All @@ -65,6 +66,9 @@ allprojects {
}
}
}
intellijPlatform {
defaultRepositories()
}
mavenCentral {
content {
// avoid dependency confusion
Expand Down Expand Up @@ -97,7 +101,7 @@ allprojects {

val bomFile = layout.buildDirectory.file("reports/bom.json")
artifacts.add("archives", bomFile.get().asFile) {
name = "sonarlint-intellij"
name = pluginName
type = "json"
classifier = "cyclonedx"
builtBy("cyclonedxBom")
Expand All @@ -114,52 +118,97 @@ allprojects {
)
)
excludes(
listOf("**/*.jar", "**/*.png", "**/README", "**/proto/*.java")
listOf("**/*.jar", "**/*.png", "**/README")
)
strictCheck = true
}
}

subprojects {
tasks {
buildSearchableOptions {
// the only module contributing settings is the root one
enabled = false
}
intellijPlatform {
buildSearchableOptions = false
}
}

intellij {
version.set(intellijBuildVersion)
pluginName.set("sonarlint-intellij")
updateSinceUntilBuild.set(false)
plugins.set(listOf("java", "Git4Idea"))
}

val verifierVersions: String by project

tasks.runPluginVerifier {
if (project.hasProperty("verifierVersions")) {
ideVersions.set(verifierVersions.split(','))
} else {
// Test oldest supported, and latest
ideVersions.set(listOf("IC-2022.3.1", "IC-2024.1.4"))
intellijPlatform {
pluginConfiguration {
ideaVersion {
sinceBuild = "223.8214.6"
}
name = pluginName
}
failureLevel.set(
EnumSet.complementOf(
EnumSet.of(
// these are the only issues we tolerate
RunPluginVerifierTask.FailureLevel.DEPRECATED_API_USAGES,
RunPluginVerifierTask.FailureLevel.EXPERIMENTAL_API_USAGES,
RunPluginVerifierTask.FailureLevel.NOT_DYNAMIC,
RunPluginVerifierTask.FailureLevel.OVERRIDE_ONLY_API_USAGES,
// TODO Workaround for CLion
RunPluginVerifierTask.FailureLevel.MISSING_DEPENDENCIES,
// needed because of CPPToolset.isRemote()
RunPluginVerifierTask.FailureLevel.SCHEDULED_FOR_REMOVAL_API_USAGES
)
// updateSinceUntilBuild.set(false)

pluginVerification {
failureLevel = listOf(
// these are the only issues we tolerate
VerifyPluginTask.FailureLevel.DEPRECATED_API_USAGES,
VerifyPluginTask.FailureLevel.EXPERIMENTAL_API_USAGES,
VerifyPluginTask.FailureLevel.NOT_DYNAMIC,
VerifyPluginTask.FailureLevel.OVERRIDE_ONLY_API_USAGES,
// TODO Workaround for CLion
VerifyPluginTask.FailureLevel.MISSING_DEPENDENCIES,
// needed because of CPPToolset.isRemote()
VerifyPluginTask.FailureLevel.SCHEDULED_FOR_REMOVAL_API_USAGES
)
)

if (project.hasProperty("verifierVersions")) {
ides {
verifierVersions.split(',').forEach {
ide(it)
}
}
} else {
// Test oldest supported, and latest
ides {
ide("IC-2022.3.1")
ide("IC-2024.1.4")
}
}

}

sonar {
properties {
property("sonar.projectName", "SonarLint for IntelliJ IDEA")
}
}

artifactory {
clientConfig.info.buildName = pluginName
clientConfig.info.buildNumber = System.getenv("BUILD_ID")
clientConfig.isIncludeEnvVars = true
clientConfig.envVarsExcludePatterns =
"*password*,*PASSWORD*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*TOKEN*,*LOGIN*,*login*,*key*,*KEY*,*PASSPHRASE*,*signing*"
clientConfig.info.addEnvironmentProperty(
"ARTIFACTS_TO_DOWNLOAD",
"org.sonarsource.sonarlint.intellij:sonarlint-intellij:zip,org.sonarsource.sonarlint.intellij:sonarlint-intellij:json:cyclonedx"
)
setContextUrl(System.getenv("ARTIFACTORY_URL"))
publish {
repository {
setProperty("repoKey", System.getenv("ARTIFACTORY_DEPLOY_REPO"))
setProperty("username", System.getenv("ARTIFACTORY_DEPLOY_USERNAME"))
setProperty("password", System.getenv("ARTIFACTORY_DEPLOY_PASSWORD"))
}
defaults {
setProperties(
mapOf(
"vcs.revision" to System.getenv("CIRRUS_CHANGE_IN_REPO"),
"vcs.branch" to (System.getenv("CIRRUS_BASE_BRANCH")
?: System.getenv("CIRRUS_BRANCH")),
"build.name" to pluginName,
"build.number" to System.getenv("BUILD_ID")
)
)
publishConfigs("archives")
setPublishPom(true)
setPublishIvy(false)
}
}
}
}

tasks.test {
Expand All @@ -170,11 +219,15 @@ tasks.test {
val runIdeDirectory: String by project

tasks.runIde {
systemProperty("sonarlint.telemetry.disabled", "true")
// uncomment to customize the SonarCloud URL
//systemProperty("sonarlint.internal.sonarcloud.url", "https://sonarcloud.io/")
if (project.hasProperty("runIdeDirectory")) {
ideDir.set(File(runIdeDirectory))
jvmArgumentProviders += CommandLineArgumentProvider {
listOf(
"-DideDir=$runIdeDirectory",
"-Dsonarlint.telemetry.disabled=true",
// uncomment to customize the SonarCloud URL
//"-Dsonarlint.internal.sonarcloud.url=https://sonarcloud.io/"
)
}
}
maxHeapSize = "2g"
}
Expand All @@ -190,6 +243,13 @@ configurations {
}

dependencies {
intellijPlatform {
intellijIdeaCommunity(intellijBuildVersion)
bundledPlugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
pluginVerifier()
instrumentationTools()
testFramework(TestFrameworkType.Platform)
}
implementation(libs.sonarlint.java.client.legacy)
implementation(libs.sonarlint.java.client.utils)
implementation(libs.sonarlint.rpc.java.client)
Expand Down Expand Up @@ -222,28 +282,27 @@ dependencies {
}

tasks {

fun copyPlugins(destinationDir: File, pluginName: Property<String>) {
fun copyPlugins(destinationDir: File, name: String) {
copy {
from(project.configurations["sqplugins"])
into(file("$destinationDir/${pluginName.get()}/plugins"))
into(file("$destinationDir/${name}/plugins"))
}
}

fun copyOmnisharp(destinationDir: File, pluginName: Property<String>) {
fun copyOmnisharp(destinationDir: File, name: String) {
configurations["omnisharp"].resolvedConfiguration.resolvedArtifacts.forEach { artifact ->
copy {
from(zipTree(artifact.file))
into(file("$destinationDir/${pluginName.get()}/omnisharp/${artifact.classifier}"))
into(file("$destinationDir/${name}/omnisharp/${artifact.classifier}"))
}
}
}

fun copySloop(destinationDir: File, pluginName: Property<String>) {
fun copySloop(destinationDir: File, name: String) {
configurations["sloop"].resolvedConfiguration.resolvedArtifacts.forEach { artifact ->
copy {
from(zipTree(artifact.file))
into(file("$destinationDir/${pluginName.get()}/sloop/"))
into(file("$destinationDir/${name}/sloop/"))
}
}
}
Expand All @@ -256,7 +315,7 @@ tasks {
}
}

prepareTestingSandbox {
prepareTestSandbox {
doLast {
copyPlugins(destinationDir, pluginName)
copyOmnisharp(destinationDir, pluginName)
Expand Down Expand Up @@ -321,45 +380,6 @@ tasks.artifactoryPublish {
)
}

sonar {
properties {
property("sonar.projectName", "SonarLint for IntelliJ IDEA")
}
}

artifactory {
clientConfig.info.buildName = "sonarlint-intellij"
clientConfig.info.buildNumber = System.getenv("BUILD_ID")
clientConfig.isIncludeEnvVars = true
clientConfig.envVarsExcludePatterns = "*password*,*PASSWORD*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*TOKEN*,*LOGIN*,*login*,*key*,*KEY*,*PASSPHRASE*,*signing*"
clientConfig.info.addEnvironmentProperty(
"ARTIFACTS_TO_DOWNLOAD",
"org.sonarsource.sonarlint.intellij:sonarlint-intellij:zip,org.sonarsource.sonarlint.intellij:sonarlint-intellij:json:cyclonedx"
)
setContextUrl(System.getenv("ARTIFACTORY_URL"))
publish {
repository {
setProperty("repoKey", System.getenv("ARTIFACTORY_DEPLOY_REPO"))
setProperty("username", System.getenv("ARTIFACTORY_DEPLOY_USERNAME"))
setProperty("password", System.getenv("ARTIFACTORY_DEPLOY_PASSWORD"))
}
defaults {
setProperties(
mapOf(
"vcs.revision" to System.getenv("CIRRUS_CHANGE_IN_REPO"),
"vcs.branch" to (System.getenv("CIRRUS_BASE_BRANCH")
?: System.getenv("CIRRUS_BRANCH")),
"build.name" to "sonarlint-intellij",
"build.number" to System.getenv("BUILD_ID")
)
)
publishConfigs("archives")
setPublishPom(true)
setPublishIvy(false)
}
}
}

signing {
setRequired {
val branch = System.getenv("CIRRUS_BRANCH") ?: ""
Expand Down
12 changes: 7 additions & 5 deletions clion-common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
val clionResharperBuildVersion: String by project

plugins {
id("org.jetbrains.intellij.platform.module")
kotlin("jvm")
}

intellij {
version.set(clionResharperBuildVersion)
}

dependencies {
intellijPlatform {
rider(clionResharperBuildVersion)
instrumentationTools()
}

implementation(project(":common"))
testImplementation(libs.junit.api)
testImplementation(libs.mockito.core)
Expand All @@ -22,4 +24,4 @@ dependencies {

tasks.test {
useJUnitPlatform()
}
}
9 changes: 7 additions & 2 deletions clion-resharper/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
val clionResharperBuildVersion: String by project

intellij {
version.set(clionResharperBuildVersion)
plugins {
id("org.jetbrains.intellij.platform.module")
}

dependencies {
intellijPlatform {
rider(clionResharperBuildVersion)
instrumentationTools()
}

implementation(project(":common"))
implementation(project(":clion-common"))
testImplementation(libs.junit.api)
Expand Down
12 changes: 9 additions & 3 deletions clion/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
val clionBuildVersion: String by project

intellij {
version.set(clionBuildVersion)
plugins.set(listOf("com.intellij.clion", "com.intellij.cidr.base", "com.intellij.cidr.lang"))
plugins {
id("org.jetbrains.intellij.platform.module")
}

dependencies {
intellijPlatform {
clion(clionBuildVersion)
bundledPlugin("com.intellij.clion")
bundledPlugin("com.intellij.cidr.base")
bundledPlugin("com.intellij.cidr.lang")
instrumentationTools()
}
implementation(project(":common"))
implementation(project(":clion-common"))
testImplementation(libs.junit.api)
Expand Down
Loading

0 comments on commit a7690db

Please sign in to comment.