Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to new IntelliJ Gradle Plugin #95

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# - Run 'test' and 'verifyPlugin' tasks.
# - Run Qodana inspections.
# - Run the 'buildPlugin' task and prepare artifact for further tests.
# - Run the 'runPluginVerifier' task.
# - Run the 'verifyPlugin' task.
# - Create a draft release.
#
# The workflow is triggered on push and pull_request events.
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
./gradlew printProductsReleases # prepare list of IDEs for Plugin Verifier

# Build plugin
- name: Build plugin
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}

# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ fabric.properties
/gitmoji-plugin.jar
.idea/
*.iml
.intellijPlatform/

/build/
/.gradle/
65 changes: 50 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)
fun Provider<String>.toList() = map { it.split(',').mapNotNull { s -> s.trim().takeIf(String::isNotEmpty) } }

plugins {
id("java") // Java support
Expand All @@ -18,8 +22,11 @@ version = properties("pluginVersion").get()

// Configure project's dependencies
repositories {
maven("https://www.jetbrains.com/intellij-repository/snapshots/")
mavenCentral()
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
Expand All @@ -28,6 +35,21 @@ dependencies {
implementation("com.google.code.gson:gson:2.11.0")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("org.yaml:snakeyaml:2.2")
intellijPlatform {
create(type = properties("platformType"), version = properties("platformVersion"), useInstaller = false)
jetbrainsRuntime()
plugins(
properties("platformPlugins").toList()
)
bundledPlugins(
properties("platformBundledPlugins").toList()
)
pluginVerifier()
zipSigner()
instrumentationTools()

testFramework(TestFrameworkType.Platform)
}
}

// Set the JVM language level used to build the project.
Expand All @@ -36,13 +58,16 @@ kotlin {
}

// 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")

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
intellijPlatform {
pluginConfiguration {
name = properties("pluginName")
}
pluginVerification {
freeArgs = listOf("-mute", "TemplateWordInPluginName")
ides {
ide(type = properties("platformType"), version = properties("platformVersion"), useInstaller = false)
}
}
}

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
Expand All @@ -69,7 +94,7 @@ tasks {
}

patchPluginXml {
version = properties("pluginVersion")
version = properties("pluginVersion").get()
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")

Expand Down Expand Up @@ -102,11 +127,21 @@ tasks {

// 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", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
task {
jvmArgumentProviders += CommandLineArgumentProvider {
listOf(
"-Drobot-server.port=8082",
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
)
}
}

plugins {
robotServerPlugin()
}
}

signPlugin {
Expand All @@ -123,4 +158,4 @@ tasks {
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels = properties("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
}
}
}
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ platformType = IC
platformVersion = 2024.1

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
# Note: Bundled plugins are now defined separately from plugins of other sources (like JetBrains Marketplace).
# Example: platformBundledPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins =
platformBundledPlugins =

# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
javaVersion = 17
Expand All @@ -36,4 +38,4 @@ org.gradle.configuration-cache = true
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
systemProp.org.gradle.unsafe.kotlin.assignment = true
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
# plugins
kotlin = "2.0.0"
changelog = "2.2.1"
gradleIntelliJPlugin = "1.17.4"
gradleIntelliJPlugin = "2.1.0"
qodana = "2024.1.5"
kover = "0.8.3"

[libraries]

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" }
gradleIntelliJPlugin = { id = "org.jetbrains.intellij.platform", version.ref = "gradleIntelliJPlugin" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
Loading