-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate to IntelliJ Platform Gradle Plugin
- Loading branch information
Showing
7 changed files
with
127 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.gradle | ||
.idea | ||
.intellijPlatform | ||
.qodana | ||
build | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,136 @@ | ||
import java.net.URI | ||
|
||
fun properties(key: String) = providers.gradleProperty(key) | ||
fun environment(key: String) = providers.environmentVariable(key) | ||
val remoteRobotVersion = "0.11.21" | ||
import org.jetbrains.intellij.platform.gradle.TestFrameworkType | ||
|
||
plugins { | ||
id("java") // Java support | ||
alias(libs.plugins.kotlin) // Kotlin support | ||
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin | ||
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin | ||
alias(libs.plugins.changelog) // Gradle Changelog Plugin | ||
alias(libs.plugins.qodana) // Gradle Qodana Plugin | ||
alias(libs.plugins.kover) // Gradle Kover Plugin | ||
} | ||
|
||
group = properties("pluginGroup").get() | ||
version = properties("pluginVersion").get() | ||
group = providers.gradleProperty("pluginGroup").get() | ||
version = providers.gradleProperty("pluginVersion").get() | ||
|
||
// Set the JVM language level used to build the project. | ||
kotlin { | ||
jvmToolchain(17) | ||
} | ||
|
||
// Configure project's dependencies | ||
repositories { | ||
mavenCentral() | ||
maven { url = URI("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies") } | ||
|
||
// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html | ||
intellijPlatform { | ||
defaultRepositories() | ||
} | ||
} | ||
|
||
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog | ||
dependencies { | ||
testImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion") | ||
testImplementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion") | ||
testImplementation("com.intellij.remoterobot:remote-robot:0.11.21") | ||
testImplementation("com.intellij.remoterobot:remote-fixtures:0.11.21") | ||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0") | ||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.0") | ||
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.9.3") | ||
|
||
// Logging Network Calls | ||
testImplementation("com.squareup.okhttp3:logging-interceptor:4.12.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(17) | ||
} | ||
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html | ||
intellijPlatform { | ||
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion")) | ||
|
||
// 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 `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins. | ||
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') }) | ||
|
||
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. | ||
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } | ||
} | ||
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace. | ||
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') }) | ||
|
||
tasks { | ||
wrapper { | ||
gradleVersion = properties("gradleVersion").get() | ||
instrumentationTools() | ||
pluginVerifier() | ||
zipSigner() | ||
testFramework(TestFrameworkType.Platform) | ||
} | ||
} | ||
|
||
patchPluginXml { | ||
version = properties("pluginVersion") | ||
sinceBuild = properties("pluginSinceBuild") | ||
untilBuild = properties("pluginUntilBuild") | ||
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html | ||
intellijPlatform { | ||
pluginConfiguration { | ||
version = providers.gradleProperty("pluginVersion") | ||
|
||
ideaVersion { | ||
sinceBuild = providers.gradleProperty("pluginSinceBuild") | ||
untilBuild = providers.gradleProperty("pluginUntilBuild") | ||
} | ||
} | ||
|
||
downloadRobotServerPlugin { | ||
version.set(remoteRobotVersion) | ||
signing { | ||
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN") | ||
privateKey = providers.environmentVariable("PRIVATE_KEY") | ||
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD") | ||
} | ||
|
||
// 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") | ||
systemProperty("ide.mac.file.chooser.native", "false") | ||
systemProperty("jbScreenMenuBar.enabled", "false") | ||
systemProperty("apple.laf.useScreenMenuBar", "false") | ||
systemProperty("idea.trust.all.projects", "true") | ||
systemProperty("ide.show.tips.on.startup.default.value", "false") | ||
systemProperty("eap.require.license", "false") | ||
publishing { | ||
token = providers.environmentVariable("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 | ||
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) } | ||
} | ||
|
||
pluginVerification { | ||
ides { | ||
recommended() | ||
} | ||
} | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin | ||
changelog { | ||
groups.empty() | ||
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl") | ||
} | ||
|
||
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration | ||
kover { | ||
reports { | ||
total { | ||
xml { | ||
onCheck = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
signPlugin { | ||
certificateChain = environment("CERTIFICATE_CHAIN") | ||
privateKey = environment("PRIVATE_KEY") | ||
password = environment("PRIVATE_KEY_PASSWORD") | ||
tasks { | ||
wrapper { | ||
gradleVersion = providers.gradleProperty("gradleVersion").get() | ||
} | ||
|
||
publishPlugin { | ||
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 | ||
channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) } | ||
dependsOn(patchChangelog) | ||
} | ||
} | ||
|
||
|
||
|
||
intellijPlatformTesting { | ||
runIde { | ||
register("runIdeForUiTests") { | ||
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() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
[versions] | ||
# libraries | ||
annotations = "24.1.0" | ||
|
||
# plugins | ||
kotlin = "1.9.21" | ||
gradleIntelliJPlugin = "1.16.1" | ||
|
||
[libraries] | ||
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } | ||
changelog = "2.2.1" | ||
intelliJPlatform = "2.0.1" | ||
kotlin = "1.9.25" | ||
kover = "0.8.3" | ||
qodana = "2024.1.9" | ||
|
||
[plugins] | ||
gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" } | ||
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } | ||
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" } | ||
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" } |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters