Skip to content

Commit

Permalink
[JetBrains] Migrate backend-plugin platform version for 2024.2 (#19978
Browse files Browse the repository at this point in the history
)

* [JetBrains] Migrate platform version for `2024.2.*`

-  Update Platform Version of JetBrains Backend Plugin (EAP) to 242.18071-EAP-CANDIDATE-SNAPSHOT

* fix sdkman cmd not found

* Regist plugin verify task

* stable broken

* restart to get more workspace space

* Make it build

* Remove deprecated preload property

* Revert "Remove deprecated preload property"

This reverts commit 4574632.

* do not verify

* add todo

* Use `--build-file` flag

* Revert "Use `--build-file` flag"

This reverts commit 3cc4494.
  • Loading branch information
mustard-mh authored Jul 5, 2024
1 parent 23dfac6 commit 3f63730
Show file tree
Hide file tree
Showing 11 changed files with 405 additions and 47 deletions.
5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/ide/jetbrains/backend-plugin/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
bin
build
gradle-local.properties
.intellijPlatform
17 changes: 14 additions & 3 deletions components/ide/jetbrains/backend-plugin/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ packages:
- components/gitpod-protocol/java:lib
srcs:
- "**/*.kt"
- "build.gradle.kts"
- "build.gradle-stable.kts"
- "gradle.properties"
- "gradle-stable.properties"
- "gradle/wrapper/*"
Expand All @@ -55,6 +55,7 @@ packages:
- NO_VERIFY_JB_PLUGIN=${noVerifyJBPlugin}
config:
commands:
- ["mv", "build.gradle-stable.kts", "build.gradle.kts"]
- ["./build.sh", "${__git_commit}"]
- name: plugin-latest
type: generic
Expand All @@ -65,7 +66,7 @@ packages:
- components/gitpod-protocol/java:lib
srcs:
- "**/*.kt"
- "build.gradle.kts"
- "build.gradle-latest.kts"
- "gradle.properties"
- "gradle-latest.properties"
- "gradle/wrapper/*"
Expand All @@ -77,9 +78,19 @@ packages:
env:
- JB_QUALIFIER=latest
- NO_VERIFY_JB_PLUGIN=${noVerifyJBPlugin}
# TODO(hw): remove after `2024.2.*` is stable
- SDKMAN_DIR=/home/gitpod/.sdkman
config:
commands:
- ["./build.sh", "${__git_commit}"]
# TODO(hw): remove after 2024.2.* is stable
- ["mv", "build.gradle-latest.kts", "build.gradle.kts"]
- - "bash"
- "-c"
- >
echo java=21.0.3.fx-zulu > .sdkmanrc
&& source "$SDKMAN_DIR/bin/sdkman-init.sh"
&& sdk env install
&& ./build.sh ${__git_commit}
- name: latest-info
type: generic
srcs:
Expand Down
6 changes: 6 additions & 0 deletions components/ide/jetbrains/backend-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Provides integrations within a Gitpod workspace.

<!-- Plugin description end -->

## Development before `2024.2.*` is released

- You will need to copy content in build.gradle-stable.kts if you want to test stable IDEs changes. For latest, this step is the same
- Make sure your build script `build.gradle.kts` is synced with `build.gradle-<version>.kts`
- Other steps are the same with *Development* section

## Development

The ideal setup to develop this plugin is using IntelliJ in Gitpod.
Expand Down
163 changes: 163 additions & 0 deletions components/ide/jetbrains/backend-plugin/build.gradle-latest.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
// Copyright (c) 2024 Gitpod GmbH. All rights reserved.
// Licensed under the GNU Affero General Public License (AGPL).
// See License.AGPL.txt in the project root for license information.

import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun properties(key: String) = project.findProperty(key).toString()

plugins {
// Java support
id("java")
// Kotlin support - check the latest version at https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm
id("org.jetbrains.kotlin.jvm") version "2.0.0"
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
id("org.jetbrains.intellij.platform") version "2.0.0-beta8"
// id("org.jetbrains.intellij.platform.migration") version "2.0.0-beta7"
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
id("io.gitlab.arturbosch.detekt") version "1.23.6"
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
id("org.jlleitschuh.gradle.ktlint") version "12.1.1"
// Gradle Properties Plugin - read more: https://github.com/stevesaliman/gradle-properties-plugin
id("net.saliman.properties") version "1.5.2"
}

group = properties("pluginGroup")
val environmentName = properties("environmentName")
var pluginVersion = "${properties("pluginVersion")}-${properties("gitpodVersion")}"

if (environmentName.isNotBlank()) {
pluginVersion += "-$environmentName"
}

project(":") {
kotlin {
val excludedPackage = if (environmentName == "latest") "stable" else "latest"
sourceSets["main"].kotlin.exclude("io/gitpod/jetbrains/remote/${excludedPackage}/**")
}

sourceSets {
main {
resources.srcDirs("src/main/resources-${environmentName}")
}
}
}

// Configure project's dependencies
repositories {
mavenCentral()
}

dependencies {
implementation(project(":supervisor-api")) {
artifact {
type = "jar"
}
}
implementation(project(":gitpod-protocol")) {
artifact {
type = "jar"
}
}
implementation("io.prometheus:simpleclient_pushgateway:0.15.0")
compileOnly("javax.websocket:javax.websocket-api:1.1")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.18.1")
testImplementation(kotlin("test"))

// grpc
// https://mvnrepository.com/artifact/com.google.api.grpc/proto-google-common-protos
implementation("com.google.api.grpc:proto-google-common-protos:2.41.0")
implementation("io.grpc:grpc-core:1.65.0")
implementation("io.grpc:grpc-protobuf:1.65.0")
// https://mvnrepository.com/artifact/io.grpc/grpc-stub
implementation("io.grpc:grpc-stub:1.65.0")
implementation("io.grpc:grpc-netty-shaded:1.65.0")
}

repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}

dependencies {
intellijPlatform {
create(properties("platformType"), properties("platformVersion"))

// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
bundledPlugins(properties("platformBundledPlugins").split(',').map{ it.trim() })
}
}

// Configure gradle-intellij-plugin plugin.
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
intellijPlatform {
pluginConfiguration {
name = properties("pluginName")
version = pluginVersion
ideaVersion {
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
}
}
instrumentCode = false

}

// Configure detekt plugin.
// Read more: https://detekt.github.io/detekt/kotlindsl.html
detekt {
autoCorrect = true
buildUponDefaultConfig = true
ignoreFailures = true

// reports {
// html.enabled = false
// xml.enabled = false
// txt.enabled = false
// }
}

ktlint {
ignoreFailures = true
filter {
exclude("build.gradle-*.kts")
}
}

kotlin {
jvmToolchain(21)
}

tasks.withType<Detekt> {
jvmTarget = "21"
onlyIf { project.findProperty("skipDetekt") != "true" }
}

tasks {
withType<JavaCompile> {
sourceCompatibility = "21"
targetCompatibility = "21"
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "21"
}

buildSearchableOptions {
enabled = false
}

test {
// Currently, we need to indicate where are the test classes.
// Read more: https://youtrack.jetbrains.com/issue/IDEA-278926/All-inheritors-of-UsefulTestCase-are-invisible-for-Gradle#focus=Comments-27-5561012.0-0
isScanForTestClasses = false
include("**/*Test.class")
}
}

tasks.register("runPluginVerifier") {
intellijPlatform.verifyPlugin.ides.ide(IntelliJPlatformType.IntellijIdeaUltimate, properties("pluginVerifierIdeVersions"))
}
142 changes: 142 additions & 0 deletions components/ide/jetbrains/backend-plugin/build.gradle-stable.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.
// Licensed under the GNU Affero General Public License (AGPL).
// See License.AGPL.txt in the project root for license information.

import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun properties(key: String) = project.findProperty(key).toString()

plugins {
// Java support
id("java")
// Kotlin support - check the latest version at https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm
id("org.jetbrains.kotlin.jvm") version "1.9.0"
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
id("org.jetbrains.intellij") version "1.17.4"
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
id("io.gitlab.arturbosch.detekt") version "1.21.0"
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
// Gradle Properties Plugin - read more: https://github.com/stevesaliman/gradle-properties-plugin
id("net.saliman.properties") version "1.5.2"
}

group = properties("pluginGroup")
val environmentName = properties("environmentName")
var pluginVersion = "${properties("pluginVersion")}-${properties("gitpodVersion")}"

if (environmentName.isNotBlank()) {
pluginVersion += "-$environmentName"
}

project(":") {
kotlin {
val excludedPackage = if (environmentName == "latest") "stable" else "latest"
sourceSets["main"].kotlin.exclude("io/gitpod/jetbrains/remote/${excludedPackage}/**")
}

sourceSets {
main {
resources.srcDirs("src/main/resources-${environmentName}")
}
}
}

// Configure project's dependencies
repositories {
mavenCentral()
}

dependencies {
implementation(project(":supervisor-api")) {
artifact {
type = "jar"
}
}
implementation(project(":gitpod-protocol")) {
artifact {
type = "jar"
}
}
implementation("io.prometheus:simpleclient_pushgateway:0.15.0")
compileOnly("javax.websocket:javax.websocket-api:1.1")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.18.1")
testImplementation(kotlin("test"))

// grpc
implementation("com.google.api.grpc:proto-google-common-protos:2.2.2")
implementation("io.grpc:grpc-core:1.49.0")
implementation("io.grpc:grpc-protobuf:1.49.0")
implementation("io.grpc:grpc-stub:1.49.0")
implementation("io.grpc:grpc-netty-shaded:1.49.0")
}

// Configure gradle-intellij-plugin plugin.
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
intellij {
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
type.set(properties("platformType"))
instrumentCode.set(false)
downloadSources.set(properties("platformDownloadSources").toBoolean())
updateSinceUntilBuild.set(true)

// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file.
plugins.set(properties("platformBundledPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
}

// Configure detekt plugin.
// Read more: https://detekt.github.io/detekt/kotlindsl.html
detekt {
autoCorrect = true
buildUponDefaultConfig = true
ignoreFailures = true

reports {
html.enabled = false
xml.enabled = false
txt.enabled = false
}
}
ktlint {
ignoreFailures = true
}

tasks {
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}

withType<Detekt> {
jvmTarget = "17"
}

buildSearchableOptions {
enabled = false
}

test {
// Currently, we need to indicate where are the test classes.
// Read more: https://youtrack.jetbrains.com/issue/IDEA-278926/All-inheritors-of-UsefulTestCase-are-invisible-for-Gradle#focus=Comments-27-5561012.0-0
isScanForTestClasses = false
include("**/*Test.class")
}

runPluginVerifier {
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
}

patchPluginXml {
version.set(pluginVersion)
}

verifyPlugin {
// TODO(hw): DO NOT IGNORE FAILURE AFTER UPGRADE
ignoreFailures = true
}
}
Loading

0 comments on commit 3f63730

Please sign in to comment.