Skip to content

Commit

Permalink
Switch to org.jetbrains.intellij.platform v2.0.0-beta7
Browse files Browse the repository at this point in the history
Copy from JetBrains/intellij-platform-plugin-template#438

Add missing property

Remove redundant block

Add `org.jetbrains.intellij.platform.buildFeature.useBinaryReleases = false`

Move `PythonCore` to `platformBundledPlugins`

Sync comment

Web link instead of app link

Unnecessary comment

Bump to v2.0.0-beta7

Re-add accidentally removed `systemProperty()` call

Manually specify the IDEs to verify against

Revert "Manually specify the IDEs to verify against"

This reverts commit ad49196.

Bump `org.jetbrains.kotlinx.kover` back to 0.8.1

Remove extraneous comment
  • Loading branch information
InSyncWithFoo committed Jun 19, 2024
1 parent ea8a79c commit 0d73c62
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 86 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ jobs:
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
./gradlew listProductsReleases
-
name: Build plugin
run: |
Expand Down Expand Up @@ -243,7 +241,7 @@ jobs:
name: Run verifier
run: |
chmod +x ./gradlew
./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
-
name: Upload result
if: always()
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-ui-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
runIde: |
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1920x1080x16 &
gradle runIdeForUiTests &
gradle testIdeUi &
-
os: windows-latest
runIde: |
start gradlew.bat runIdeForUiTests
start gradlew.bat testIdeUi
-
os: macos-latest
runIde: |
./gradlew runIdeForUiTests &
./gradlew testIdeUi &
steps:
-
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ venv/
### Generated ###
.gradle/
.kotlin/
.intellijPlatform/
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
Expand Down
2 changes: 1 addition & 1 deletion .run/Run IDE for UI Tests.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</option>
<option name="taskNames">
<list>
<option value="runIdeForUiTests"/>
<option value="testIdeUi"/>
</list>
</option>
<option name="vmOptions"/>
Expand Down
2 changes: 1 addition & 1 deletion .run/Run Verifications.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</option>
<option name="taskNames">
<list>
<option value="runPluginVerifier"/>
<option value="verifyPlugin"/>
</list>
</option>
<option name="vmOptions" value=""/>
Expand Down
155 changes: 90 additions & 65 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,45 +1,115 @@
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)

plugins {
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.qodana) // Gradle Qodana Plugin
alias(libs.plugins.kover) // Gradle Kover Plugin
alias(libs.plugins.kotlinSerialization) // Kotlin serialization support
alias(libs.plugins.kotlin)
alias(libs.plugins.intellijPlatform)
alias(libs.plugins.changelog)
alias(libs.plugins.qodana)
alias(libs.plugins.kover)
alias(libs.plugins.kotlinSerialization)
}

group = properties("pluginGroup").get()
version = properties("pluginVersion").get()

// Set the JVM language level used to build the project.
kotlin {
jvmToolchain(17)
}

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

// 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 {
compileOnly(libs.kotlinxSerialization)
testImplementation(kotlin("test"))

// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
create(properties("platformType"), properties("platformVersion"))

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

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
plugins(properties("platformPlugins").map { it.split(',') })

instrumentationTools()
pluginVerifier()
testFramework(TestFrameworkType.Platform)
}
}

// Set the JVM language level used to build the project.
kotlin {
jvmToolchain(17)
}

// 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")
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
pluginConfiguration {
name = properties("pluginName")
version = properties("pluginVersion")

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description 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 = properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
}

ideaVersion {
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
}
}

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
signing {
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
password = environment("PRIVATE_KEY_PASSWORD")
}

publishing {
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.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
}

verifyPlugin {
ides {
recommended()
}
}
}

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
Expand Down Expand Up @@ -72,61 +142,16 @@ tasks {
gradleVersion = properties("gradleVersion").get()
}

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

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description 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 = properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
}
}

// Configure UI tests plugin
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
runIdeForUiTests {
testIdeUi {
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")
}

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
channels = properties("pluginVersion").map {
listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" })
}
dependsOn(patchChangelog)
}
}
9 changes: 7 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ platformType = PC
platformVersion = 242-EAP-SNAPSHOT

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins = PythonCore
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
platformPlugins =
# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins = PythonCore

gradleVersion = 8.8

Expand All @@ -28,3 +30,6 @@ org.gradle.configuration-cache = true

# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching = true

# https://app.slack.com/client/T5P9YATH9/C05C80200LS/1716992543.096089
org.jetbrains.intellij.platform.buildFeature.useBinaryReleases = false
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ kotlinxSerialization = "1.7.0"
# plugins
kotlin = "2.0.0"
changelog = "2.2.0"
gradleIntelliJPlugin = "1.17.3"
intellijPlatform = "2.0.0-beta7"
qodana = "2024.1.5"
kover = "0.8.1"

Expand All @@ -24,9 +24,9 @@ version.ref = "kotlinxSerialization"
id = "org.jetbrains.changelog"
version.ref = "changelog"

[plugins.gradleIntelliJPlugin]
id = "org.jetbrains.intellij"
version.ref = "gradleIntelliJPlugin"
[plugins.intellijPlatform]
id = "org.jetbrains.intellij.platform"
version.ref = "intellijPlatform"

[plugins.kotlin]
id = "org.jetbrains.kotlin.jvm"
Expand Down
7 changes: 0 additions & 7 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
Expand Down

0 comments on commit 0d73c62

Please sign in to comment.