diff --git a/.github/workflows/IJ-latest.yml b/.github/workflows/IJ-latest.yml index c21ab9bc6..4e77ce40e 100644 --- a/.github/workflows/IJ-latest.yml +++ b/.github/workflows/IJ-latest.yml @@ -23,7 +23,7 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew build --continue -PideaVersion=LATEST-EAP-SNAPSHOT + run: ./gradlew build --continue -PplatformVersion=LATEST-EAP-SNAPSHOT - uses: actions/upload-artifact@v2 if: always() with: diff --git a/.github/workflows/IJ.yml b/.github/workflows/IJ.yml index 7076fe147..aa1411128 100644 --- a/.github/workflows/IJ.yml +++ b/.github/workflows/IJ.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - IJ: [IC-2022.2, IC-2022.3, IC-2023.1, IC-2023.2, IC-2023.2.3] + IJ: [2022.2, 2022.3, 2023.1, 2023.2, 2023.2.3] steps: - uses: actions/checkout@v2 @@ -27,9 +27,9 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew buildPlugin -PideaVersion=${{ matrix.IJ }} + run: ./gradlew buildPlugin -PplatformVersion=${{ matrix.IJ }} - name: Verify with Gradle - run: ./gradlew runPluginVerifier -PideaVersion=${{ matrix.IJ }} + run: ./gradlew runPluginVerifier -PplatformVersion=${{ matrix.IJ }} - name: Upload report uses: actions/upload-artifact@v2 if: always() diff --git a/.github/workflows/buildZip.yml b/.github/workflows/buildZip.yml index 341649550..17f6a12bf 100644 --- a/.github/workflows/buildZip.yml +++ b/.github/workflows/buildZip.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: 11 + java-version: 17 distribution: 'temurin' cache: 'gradle' - name: Grant execute permission for gradlew diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b559302e..d4eb96b86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: 11 + java-version: 17 distribution: 'temurin' cache: 'gradle' - name: Grant execute permission for gradlew @@ -36,10 +36,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: 11 + java-version: 17 distribution: 'temurin' cache: 'gradle' - name: Grant execute permission for gradlew @@ -57,10 +57,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: 11 + java-version: 17 distribution: 'temurin' cache: 'gradle' - name: Grant execute permission for gradlew diff --git a/.github/workflows/itests.yml b/.github/workflows/itests.yml index 597be6f75..490cea705 100644 --- a/.github/workflows/itests.yml +++ b/.github/workflows/itests.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Run integration tests run: | export DISPLAY=:99.0 @@ -43,10 +43,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Run integration tests run: | ./gradlew integrationTest @@ -68,10 +68,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Run integration tests run: | .\gradlew.bat integrationTest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d8156762b..aad6e240c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,10 +8,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..723f2f878 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1 @@ +## [Unreleased] \ No newline at end of file diff --git a/README.md b/README.md index 2c4c79376..b7367cdf1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# Quarkus Tools for IntelliJ +

Quarkus Tools for IntelliJ

+ [plugin-repo]: https://plugins.jetbrains.com/plugin/13234-quarkus [plugin-version-svg]: https://img.shields.io/jetbrains/plugin/v/13234-quarkus.svg [plugin-downloads-svg]: https://img.shields.io/jetbrains/plugin/d/13234-quarkus.svg @@ -11,9 +12,9 @@ ## Description - -This JetBrains IntelliJ plugin provides support for Quarkus development via a -[Quarkus language server](https://github.com/redhat-developer/quarkus-ls/tree/master/microprofile.ls). + +A plugin aimed at Quarkus based development, providing easy bootstrapping and code assist from [Quarkus](https://quarkus.io/) related assets and [Qute](https://quarkus.io/guides/qute-reference). + ### application.properties support @@ -230,7 +231,7 @@ When editing `application.properties` files, you have access to: ## Requirements * Intellij IDEA 2022.2 or more recent (we **try** to support the last 4 major IDEA releases) - * Java JDK (or JRE) 11 or more recent + * Java JDK (or JRE) 17 or more recent ​ ## Contributing @@ -268,10 +269,10 @@ So we extracted these classes into the ```intellij-community``` folder. But as t classes are highly linked to the version of the IntelliJ SDK used to build, there is a script to copy them from the GitHub intellij-community repository. -This script is ```pulltest.sh``` +This script is ```pull_intellij_tests``` If the version of the IntelliJ SDK used to build is changed (see gradle.properties), you must -update the branch in ```pulltest.sh``` and run the script again. +update the branch in ```pull_intellij_tests``` and run the script again. #### UI testing diff --git a/build.gradle b/build.gradle deleted file mode 100644 index d3dc995ec..000000000 --- a/build.gradle +++ /dev/null @@ -1,210 +0,0 @@ -import org.jetbrains.intellij.tasks.RunPluginVerifierTask - -plugins { - id "org.jetbrains.intellij" version "1.14.2" - id 'idea' - id 'java' - id 'org.jetbrains.kotlin.jvm' version '1.6.0' - id 'jacoco' - id 'com.adarshr.test-logger' version '3.2.0' -} - -sourceCompatibility = '11' -targetCompatibility = '11' - -intellij { - version = ideaVersion //for a full list of IntelliJ IDEA releases please see https://www.jetbrains.com/intellij-repository/releases - plugins = ['java', 'maven', 'gradle-java', 'properties', 'yaml', 'com.redhat.devtools.intellij.telemetry:1.0.0.44'] - pluginName = 'Quarkus Tools' - updateSinceUntilBuild = false -} - -runPluginVerifier { - ideVersions = [ideaVersion] - failureLevel = RunPluginVerifierTask.FailureLevel.NONE -} - -publishPlugin { - token = jetBrainsToken - channels = [jetBrainsChannel] -} - -repositories { - mavenLocal() - mavenCentral() - maven { - url 'https://repository.jboss.org/nexus/content/repositories/snapshots' - } - maven { - url 'https://repository.jboss.org/nexus/content/groups/public' - } - maven { - url 'https://repo.eclipse.org/content/repositories/lsp4mp-snapshots' - } - maven { - url 'https://repo.eclipse.org/content/repositories/lsp4mp-releases' - } - maven { - url 'https://packages.jetbrains.team/maven/p/ij/intellij-dependencies' - } -} - -configurations { - runtimeClasspath { - exclude group: 'org.slf4j', module: 'slf4j-api' - } - compileKotlin { - kotlinOptions { - jvmTarget = "11" - } - } - - compileTestKotlin { - kotlinOptions { - jvmTarget = "11" - } - } - lsp - testRuntime { - setCanBeResolved(true) - } -} - -sourceSets { - test { - java.srcDir 'src/test/java' - java.srcDir 'intellij-community/java/testFramework/src' - java.srcDir 'intellij-community/platform/external-system-api/testFramework/src' - java.srcDir 'intellij-community/platform/external-system-impl/testSrc' - java.srcDir 'intellij-community/platform/lang-impl/testSources' - java.srcDir 'intellij-community/platform/testFramework/extensions/src' - java.srcDir 'intellij-community/plugins/gradle/testSources' - java.srcDir 'intellij-community/plugins/gradle/tooling-extension-impl/testSources' - java.srcDir 'intellij-community/plugins/maven/src/test/java' - java.srcDir 'intellij-community/plugins/maven/testFramework/src' - resources.srcDir file('src/test/resources') - } - - integrationTest { - java.srcDir file('src/it/java') - resources.srcDir file('src/it/resources') - compileClasspath += sourceSets.main.output + configurations.testRuntime - runtimeClasspath += output + compileClasspath - } -} - -task integrationTest(type: Test) { - useJUnitPlatform() - description = 'Runs the integration tests.' - group = 'verification' - testClassesDirs = sourceSets.integrationTest.output.classesDirs - classpath = sourceSets.integrationTest.runtimeClasspath - outputs.upToDateWhen { false } - mustRunAfter test -} - -testlogger { - theme 'standard' - showExceptions true - showStackTraces true - showFullStackTraces false - showCauses true - slowThreshold 2000 - showSummary true - showSimpleNames false - showPassed true - showSkipped true - showFailed true - showOnlySlow false - showStandardStreams false - showPassedStandardStreams true - showSkippedStandardStreams true - showFailedStandardStreams true - logLevel 'lifecycle' -} - -tasks.withType(Test) { - environment 'GRADLE_RELEASE_REPOSITORY','https://services.gradle.org/distributions' - systemProperty 'idea.log.leaked.projects.in.tests', 'false' - systemProperty 'idea.maven.test.mirror', 'https://repo1.maven.org/maven2' - systemProperty 'com.redhat.devtools.intellij.telemetry.mode', 'disabled' -} - -tasks.withType(Copy) { - duplicatesStrategy = DuplicatesStrategy.INCLUDE -} - -dependencies { - implementation 'org.zeroturnaround:zt-zip:1.14' - implementation 'com.kotcrab.remark:remark:1.2.0' - implementation 'org.jsoup:jsoup:1.14.2' - implementation("io.quarkus:quarkus-core:$quarkusVersion") { - transitive = false - } - implementation("io.quarkus:quarkus-core-deployment:$quarkusVersion") { - exclude group: 'org.aesh' - exclude group: 'org.apache.commons' - exclude group: 'org.wildfly.common' - exclude group: 'io.quarkus.gizmo' - exclude group: 'org.ow2.asm' - exclude group: 'io.quarkus' - exclude group: 'org.eclipse.sisu' - exclude group: 'org.graalvm.sdk' - exclude group: 'org.junit.platform' - exclude group: 'org.junit.jupiter' - } - implementation("io.quarkus:quarkus-arc:$quarkusVersion") { - transitive = false - } - implementation "org.eclipse.lsp4mp:org.eclipse.lsp4mp.ls:$lsp4mpVersion" - implementation 'org.eclipse.lsp4j:org.eclipse.lsp4j:0.15.0' - //required by lsp4j as the version from IJ is incompatible - implementation 'com.google.code.gson:gson:2.8.9' - implementation 'com.vladsch.flexmark:flexmark:0.62.2' - testImplementation 'com.redhat.devtools.intellij:intellij-common-ui-test-library:0.2.0' - lsp("org.eclipse.lsp4mp:org.eclipse.lsp4mp.ls:$lsp4mpVersion:uber") { - transitive = false - } - lsp ("com.redhat.microprofile:com.redhat.quarkus.ls:$quarkusLsVersion") { - transitive = false - } - implementation "com.redhat.microprofile:com.redhat.qute.ls:$quteLsVersion" - lsp ("com.redhat.microprofile:com.redhat.qute.ls:$quteLsVersion:uber") { - transitive = false - } - implementation files(new File(buildDir, 'server')) { - builtBy 'copyDeps' - } - testImplementation 'org.assertj:assertj-core:3.19.0' -} - - -task copyDeps(type: Copy) { - from configurations.lsp - into new File(buildDir, 'server/server') - rename '^(.*)(-[0-9]+.[0-9]+.[0-9]+(-SNAPSHOT)?)(.*)$', '$1$4' -} - -runIde { - systemProperties['com.redhat.devtools.intellij.telemetry.mode'] = 'disabled' -} - -runIdeForUiTests { - systemProperty "robot-server.port", System.getProperty("robot-server.port") -} - -prepareSandbox { - dependsOn copyDeps -} - -jacocoTestReport { - reports { - xml.enabled true - html.enabled true - } -} - -check.dependsOn jacocoTestReport - -group 'com.redhat.devtools.intellij' -version projectVersion // Plugin version diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..5d7e294b7 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,288 @@ +import com.adarshr.gradle.testlogger.theme.ThemeType +import org.jetbrains.changelog.markdownToHTML +import org.jetbrains.intellij.tasks.RunPluginVerifierTask + +fun properties(key: String) = providers.gradleProperty(key) +fun environment(key: String) = providers.environmentVariable(key) +fun prop(name: String): String { + return properties(name).get() +} +plugins { + java // Java support + alias(libs.plugins.kotlin) // Kotlin support + alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin + alias(libs.plugins.changelog) // Gradle Changelog Plugin + alias(libs.plugins.testLogger) // Nice test logs + jacoco // Code coverage +} + +group = prop("pluginGroup") +version = prop("pluginVersion") + +val quarkusVersion = prop("quarkusVersion") +val lsp4mpVersion = prop("lsp4mpVersion") +val quarkusLsVersion = prop("lsp4mpVersion") +val quteLsVersion = prop("quteLsVersion") + +// Configure project's dependencies +repositories { + mavenLocal() + mavenCentral() + maven { url = uri("https://repository.jboss.org/nexus/content/repositories/snapshots") } + maven { url = uri("https://repository.jboss.org/nexus/content/groups/public") } + maven { url = uri("https://repo.eclipse.org/content/repositories/lsp4mp-snapshots") } + maven { url = uri("https://repo.eclipse.org/content/repositories/lsp4mp-releases") } + maven { url = uri("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies") } +} + +val lsp: Configuration by configurations.creating + +sourceSets { + named("test") { + java.srcDir("src/test/java") + java.srcDir("intellij-community/java/testFramework/src") + java.srcDir("intellij-community/platform/external-system-api/testFramework/src") + java.srcDir("intellij-community/platform/external-system-impl/testSrc") + java.srcDir("intellij-community/platform/lang-impl/testSources") + java.srcDir("intellij-community/platform/testFramework/extensions/src") + java.srcDir("intellij-community/plugins/gradle/src") + java.srcDir("intellij-community/plugins/gradle/testSources") + java.srcDir("intellij-community/plugins/gradle/tooling-extension-impl/testSources") + java.srcDir("intellij-community/plugins/maven/src/test/java") + java.srcDir("intellij-community/plugins/maven/testFramework/src") + resources.srcDir("src/test/resources") + } + + create("integrationTest") { + java.srcDir("src/it/java") + resources.srcDir("src/it/resources") + compileClasspath += sourceSets.main.get().output + compileClasspath += configurations.testImplementation.get() + runtimeClasspath += compileClasspath + sourceSets.test.get().output + } +} + +// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog +dependencies { + implementation("org.zeroturnaround:zt-zip:1.14") + implementation("com.kotcrab.remark:remark:1.2.0") + implementation("org.jsoup:jsoup:1.14.2") + implementation("io.quarkus:quarkus-core:$quarkusVersion") { + isTransitive = false + } + implementation("io.quarkus:quarkus-core-deployment:$quarkusVersion") { + exclude(group = "org.aesh") + exclude(group = "org.apache.commons") + exclude(group = "org.wildfly.common") + exclude(group = "io.quarkus.gizmo") + exclude(group = "org.ow2.asm") + exclude(group = "io.quarkus") + exclude(group = "org.eclipse.sisu") + exclude(group = "org.graalvm.sdk") + exclude(group = "org.junit.platform") + exclude(group = "org.junit.jupiter") + isTransitive = false + } + implementation("io.quarkus:quarkus-arc:$quarkusVersion") { + isTransitive = false + } + implementation("org.eclipse.lsp4mp:org.eclipse.lsp4mp.ls:$lsp4mpVersion") + implementation("org.eclipse.lsp4j:org.eclipse.lsp4j:0.15.0") + // Required by lsp4j as the version from IJ is incompatible + implementation("com.google.code.gson:gson:2.8.9") + implementation("com.vladsch.flexmark:flexmark:0.62.2") + lsp("org.eclipse.lsp4mp:org.eclipse.lsp4mp.ls:$lsp4mpVersion:uber") { + isTransitive = false + } + lsp("com.redhat.microprofile:com.redhat.quarkus.ls:$quarkusLsVersion") { + isTransitive = false + } + implementation("com.redhat.microprofile:com.redhat.qute.ls:$quteLsVersion") + lsp("com.redhat.microprofile:com.redhat.qute.ls:$quteLsVersion:uber") { + isTransitive = false + } + implementation(files(layout.buildDirectory.dir("server")) { + builtBy("copyDeps") + }) + + testImplementation("com.redhat.devtools.intellij:intellij-common-ui-test-library:0.2.0") + testImplementation("org.assertj:assertj-core:3.19.0") + +} + +// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+. +kotlin { + jvmToolchain { + languageVersion = JavaLanguageVersion.of(17) + vendor = JvmVendorSpec.JETBRAINS + } +} + +// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html +intellij { + pluginName = properties("pluginName") + version = properties("platformVersion") + type = properties("platformType") + updateSinceUntilBuild = false + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. + plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } +} + +configurations { + runtimeClasspath { + exclude(group = "org.slf4j", module = "slf4j-api") + } + testImplementation { + isCanBeResolved = true + } +} + +testlogger { + theme = ThemeType.STANDARD + showExceptions = true + showStackTraces = true + showFullStackTraces = false + showCauses = true + slowThreshold = 2000 + showSummary = true + showSimpleNames = false + showPassed = true + showSkipped = true + showFailed = true + showOnlySlow = false + showStandardStreams = false + showPassedStandardStreams = true + showSkippedStandardStreams = true + showFailedStandardStreams = true + logLevel = LogLevel.LIFECYCLE +} + +// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin +changelog { + groups.empty() + repositoryUrl = properties("pluginRepositoryUrl") +} + +tasks.withType { + environment("GRADLE_RELEASE_REPOSITORY","https://services.gradle.org/distributions") + systemProperty("idea.log.leaked.projects.in.tests", "false") + systemProperty( "idea.maven.test.mirror", "https://repo1.maven.org/maven2") + systemProperty( "com.redhat.devtools.intellij.telemetry.mode", "disabled") +} + +tasks.withType { + duplicatesStrategy = DuplicatesStrategy.INCLUDE +} + +tasks.register("integrationTest") { + useJUnitPlatform() + description = "Runs the integration tests." + group = "verification" + testClassesDirs = sourceSets["integrationTest"].output.classesDirs + classpath = sourceSets["integrationTest"].runtimeClasspath + outputs.upToDateWhen { false } + mustRunAfter(tasks["test"]) +} + +tasks.register("copyDeps") { + val serverDir = layout.buildDirectory.dir("server/server") + from(lsp) + into(serverDir) + rename("^(.*)(-[0-9]+.[0-9]+.[0-9]+(-SNAPSHOT)?)(.*)$", "$1$4") + doLast { + val destinationDir = serverDir.get().asFile + val numFilesCopied = destinationDir.listFiles()?.size ?: 0 + logger.quiet("Copied $numFilesCopied JARs from lsp configuration to ${destinationDir}.") + } +} + + +tasks { + wrapper { + gradleVersion = properties("gradleVersion").get() + } + + runPluginVerifier { + failureLevel = RunPluginVerifierTask.FailureLevel.NONE + } + + patchPluginXml { + version = properties("pluginVersion") + sinceBuild = properties("pluginSinceBuild") + untilBuild = properties("pluginUntilBuild") + + // Extract the section from README.md and provide for the plugin's manifest + pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { + val start = "" + val end = "" + + with(it.lines()) { + if (!containsAll(listOf(start, end))) { + throw GradleException("Plugin description section not found in README.md:\n$start ... $end") + } + subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML) + } + } + +// val changelog = project.changelog // local variable for configuration cache compatibility +// // Get the latest available change notes from the changelog file +// changeNotes = version.map { pluginVersion -> +// with(changelog) { +// renderItem( +// (getOrNull(pluginVersion) ?: getUnreleased()).withHeader(false).withEmptySections(false), +// Changelog.OutputType.HTML +// ) +// } +// } + } + + runIde { + systemProperties["com.redhat.devtools.intellij.telemetry.mode"] = "disabled" + } + + // Configure UI tests plugin + // Read more: https://github.com/JetBrains/intellij-ui-test-robot + runIdeForUiTests { + systemProperty("robot-server.port", "8082") + systemProperty("ide.mac.message.dialogs.as.sheets", "false") + systemProperty("jb.privacy.policy.text", "") + systemProperty("jb.consents.confirmation.enabled", "false") + } + + prepareSandbox { + dependsOn("copyDeps") + } + + jacocoTestReport { + reports { + xml.required = true + html.required = true + } + } + + signPlugin { + certificateChain = environment("CERTIFICATE_CHAIN") + privateKey = environment("PRIVATE_KEY") + password = environment("PRIVATE_KEY_PASSWORD") + } + + publishPlugin { + dependsOn("patchChangelog") + token = environment("PUBLISH_TOKEN") + // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 + // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: + // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel + + //val releasedVersion = version.replace("-SNAPSHOT", "-eap"); + //def isSnapshot = props['projectVersion'].contains('-SNAPSHOT') + //def version = isSnapshot?props['projectVersion'].replace('-SNAPSHOT', ".${env.BUILD_NUMBER}"):props['projectVersion'] + ".${env.BUILD_NUMBER}" + channels = + properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) } + + //channels = releasedVersion.map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) } + } + + check { + dependsOn(jacocoTestReport) + } +} diff --git a/gradle.properties b/gradle.properties index 89d24c104..73782a847 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,41 @@ -ideaVersion = IC-2022.2 -projectVersion=1.29.1-SNAPSHOT +# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html + +pluginGroup = com.redhat.devtools.intellij +pluginName = Quarkus Tools +pluginRepositoryUrl = https://github.com/redhat-developer/intellij-quarkus +# SemVer format -> https://semver.org +pluginVersion = 1.29.1-SNAPSHOT + +# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html +pluginSinceBuild = 222 +#pluginUntilBuild = 233.* + +# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension +platformType = IC +platformVersion = 2022.2.3 + +# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html +# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 +platformPlugins = com.intellij.java, maven, gradle-java, properties, yaml, com.redhat.devtools.intellij.telemetry:1.0.0.44 + +# Gradle Releases -> https://github.com/gradle/gradle/releases +gradleVersion = 8.4 + jetBrainsToken=invalid jetBrainsChannel=stable quarkusVersion=3.1.2.Final lsp4mpVersion=0.10.0 quarkusLsVersion=0.17.0 quteLsVersion=0.17.0 + +# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib kotlin.stdlib.default.dependency = false + +# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html +org.gradle.configuration-cache = true + +# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html +org.gradle.caching = true + +# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment +systemProp.org.gradle.unsafe.kotlin.assignment = true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..1930c0808 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,19 @@ +[versions] +# libraries +annotations = "24.0.1" + +# plugins +testlogger = "3.2.0" +kotlin = "1.9.10" +changelog = "2.2.0" +gradleIntelliJPlugin = "1.16.0" + + +[libraries] +annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } + +[plugins] +changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } +gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" } +kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +testLogger = { id = "com.adarshr.test-logger", version.ref = "testlogger" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c02..7f93135c4 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f42e62f37..3fa8f862f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index c53aefaa5..1aa94a426 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32c..93e3f59f1 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/intellij-community/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleJvmSupportMatricies.kt b/intellij-community/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleJvmSupportMatricies.kt new file mode 100644 index 000000000..08698288e --- /dev/null +++ b/intellij-community/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleJvmSupportMatricies.kt @@ -0,0 +1,79 @@ +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package org.jetbrains.plugins.gradle.util + +import com.intellij.util.lang.JavaVersion +import org.gradle.util.GradleVersion + +const val MINIMUM_SUPPORTED_JAVA = 7 +const val MAXIMUM_SUPPORTED_JAVA = 16 + +fun isSupported(gradleVersion: GradleVersion, javaVersion: JavaVersion): Boolean { + val baseVersion = gradleVersion.baseVersion + val featureVersion = javaVersion.feature + return when { + // Gradle 7.2 and java 17 are partially compatible + // https://github.com/gradle/gradle/issues/16857 + baseVersion >= GradleVersion.version("7.2") -> featureVersion in 8..17 + // https://docs.gradle.org/7.0/release-notes.html#java-16 + baseVersion >= GradleVersion.version("7.0") -> featureVersion in 8..16 + // https://docs.gradle.org/6.7/release-notes.html#java-15 + baseVersion >= GradleVersion.version("6.7") -> featureVersion in 8..15 + // many builds might work with Java 15 but there are some known issues https://github.com/gradle/gradle/issues/13532 + baseVersion >= GradleVersion.version("6.3") -> featureVersion in 8..14 + baseVersion >= GradleVersion.version("6.0") -> featureVersion in 8..13 + baseVersion >= GradleVersion.version("5.4.1") -> featureVersion in 8..12 + baseVersion >= GradleVersion.version("5.0") -> featureVersion in 8..11 + baseVersion >= GradleVersion.version("4.1") -> featureVersion in 7..9 + baseVersion >= GradleVersion.version("4.0") -> featureVersion in 7..8 + else -> featureVersion in 7..8 + } +} + +fun suggestGradleVersion(javaVersion: JavaVersion): GradleVersion? { + val featureVersion = javaVersion.feature + return when { + isSupported(GradleVersion.current(), javaVersion) -> GradleVersion.current() + featureVersion in 8..17 -> GradleVersion.version("7.2") + // https://docs.gradle.org/5.0/release-notes.html#potential-breaking-changes + featureVersion == 7 -> GradleVersion.version("4.10.3") + else -> null + } +} + +fun suggestJavaVersion(gradleVersion: GradleVersion): JavaVersion { + val baseVersion = gradleVersion.baseVersion + return when { + baseVersion >= GradleVersion.version("7.2") -> JavaVersion.compose(17) + baseVersion >= GradleVersion.version("7.0") -> JavaVersion.compose(16) + baseVersion >= GradleVersion.version("6.7") -> JavaVersion.compose(15) + baseVersion >= GradleVersion.version("6.3") -> JavaVersion.compose(14) + baseVersion >= GradleVersion.version("6.0") -> JavaVersion.compose(13) + baseVersion >= GradleVersion.version("5.4.1") -> JavaVersion.compose(12) + baseVersion >= GradleVersion.version("5.0") -> JavaVersion.compose(11) + baseVersion >= GradleVersion.version("4.1") -> JavaVersion.compose(9) + else -> JavaVersion.compose(8) + } +} + +fun suggestOldestCompatibleGradleVersion(javaVersion: JavaVersion): GradleVersion? { + val featureVersion = javaVersion.feature + return when { + featureVersion >= 17 -> GradleVersion.version("7.2") + featureVersion >= 16 -> GradleVersion.version("7.0") + featureVersion >= 15 -> GradleVersion.version("6.7") + featureVersion >= 14 -> GradleVersion.version("6.3") + featureVersion >= 13 -> GradleVersion.version("6.0") + featureVersion >= 12 -> GradleVersion.version("5.4.1") + featureVersion >= 11 -> GradleVersion.version("4.8") + featureVersion >= 7 -> GradleVersion.version("3.0") + else -> null + } +} + +fun suggestOldestCompatibleJavaVersion(gradleVersion: GradleVersion): JavaVersion { + val baseVersion = gradleVersion.baseVersion + return when { + baseVersion >= GradleVersion.version("5.0") -> JavaVersion.compose(8) + else -> JavaVersion.compose(7) + } +} diff --git a/pulltest.sh b/pull_intellij_tests.sh similarity index 94% rename from pulltest.sh rename to pull_intellij_tests.sh index 250931658..07ecb09e5 100755 --- a/pulltest.sh +++ b/pull_intellij_tests.sh @@ -1,5 +1,5 @@ # Check version to clone from https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html#intellij-platform-based-products-of-recent-ide-versions -IDEA_VERSION=222 #2022.2 +IDEA_VERSION=$(grep '^pluginSinceBuild' gradle.properties | cut -d '=' -f 2 | tr -d ' ') # 222 = 2022.2 rm -rf intellij-community-tmp 2>/dev/null git clone --single-branch --depth 1 --branch $IDEA_VERSION https://github.com/JetBrains/intellij-community intellij-community-tmp rm -rf intellij-community 2>/dev/null @@ -34,4 +34,6 @@ mkdir -p intellij-community/plugins/gradle/tooling-extension-impl/testSources/or cp -p intellij-community-tmp/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/annotation/TargetVersions.java intellij-community/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/annotation mkdir -p intellij-community/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/util/ cp -p intellij-community-tmp/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/util/VersionMatcher.java intellij-community/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/util +mkdir -p intellij-community/plugins/gradle/src/org/jetbrains/plugins/gradle/util +cp -p intellij-community-tmp/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleJvmSupportMatricies.kt intellij-community/plugins/gradle/src/org/jetbrains/plugins/gradle/util echo "Done!" \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 000000000..c4ca94a84 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" +} + +rootProject.name = "intellij-quarkus" diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 21c39c48a..d62a9349d 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -4,12 +4,6 @@ 1.0 Red-Hat - -

Quarkus Tools for IntelliJ

-

A plugin aimed at Quarkus based development, providing easy bootstrapping and code assist from Quarkus related assets and Qute.

- ]]> - 1.29.0