Skip to content

Commit

Permalink
♻️ refactor(intellij): bump to intellij platform plguin v2
Browse files Browse the repository at this point in the history
Signed-off-by: Pauline <git@ethanlibs.co>
  • Loading branch information
pauliesnug committed Aug 14, 2024
1 parent b6ba216 commit 86ba001
Show file tree
Hide file tree
Showing 23 changed files with 365 additions and 350 deletions.
22 changes: 0 additions & 22 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,11 @@ indent_style = tab
tab_width = 4
trim_trailing_whitespace = true

[*.gradle]
indent_style = tab

[*.java]
indent_style = tab
ij_continuation_indent_size = 8
ij_java_imports_layout = $*,|,java.**,|,javax.**,|,*,|,net.minecraft.**,|,org.polyfrost.**
ij_java_class_count_to_use_import_on_demand = 999

[*.json]
indent_style = space
indent_size = 2

[.editorconfig]
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false

[*.gradle]
indent_style = tab

[*.toml]
indent_style = tab
tab_width = 2

[*.properties]
indent_style = space
indent_size = 2
5 changes: 0 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
# Dependabot configuration:
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
# Maintain dependencies for Gradle dependencies
- package-ecosystem: "gradle"
directory: "/"
target-branch: "next"
schedule:
interval: "daily"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "next"
Expand Down
39 changes: 33 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
Expand All @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v4

- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v2
uses: gradle/actions/wrapper-validation@v3

- name: Setup Java
uses: actions/setup-java@v4
Expand Down Expand Up @@ -49,8 +49,6 @@ jobs:
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
- name: Build plugin
run: ./gradlew buildPlugin

Expand All @@ -70,6 +68,35 @@ jobs:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*

test:
name: Test
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true

- name: Run Tests
run: ./gradlew check

- name: Collect Tests Result
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: tests-result
path: ${{ github.workspace }}/build/reports/tests

verify:
name: Verify plugin
needs: [ build ]
Expand Down Expand Up @@ -102,7 +129,7 @@ jobs:
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}

- 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 }}

- name: Collect Plugin Verifier Result
if: ${{ always() }}
Expand All @@ -114,7 +141,7 @@ jobs:
releaseDraft:
name: Release draft
if: github.event_name != 'pull_request'
needs: [ build, verify ]
needs: [ build, test, inspectCode, verify ]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Created by https://www.toptal.com/developers/gitignore/api/java,gradle,forgegradle,kotlin,macos,intellij,intellij+all,eclipse,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=java,gradle,forgegradle,kotlin,macos,intellij,intellij+all,eclipse,visualstudiocode
# Created by https://www.toptal.com/developers/gitignore/api/java,macos,gradle,kotlin,eclipse,intellij,forgegradle,intellij+all,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=java,macos,gradle,kotlin,eclipse,intellij,forgegradle,intellij+all,visualstudiocode

### Eclipse ###
.metadata
Expand Down Expand Up @@ -81,6 +81,7 @@ run/
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.intellijPlatform

# AWS User-specific
.idea/**/aws.xml
Expand Down Expand Up @@ -360,4 +361,4 @@ gradle-app.setting
# Java heap dump
*.hprof

# End of https://www.toptal.com/developers/gitignore/api/java,gradle,forgegradle,kotlin,macos,intellij,intellij+all,eclipse,visualstudiocode
# End of https://www.toptal.com/developers/gitignore/api/java,macos,gradle,kotlin,eclipse,intellij,forgegradle,intellij+all,visualstudiocode
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## [Unreleased]

### Added

- Update to IntelliJ Platform `2.0.0`

## [2.1.0] - 2024-06-15

### Added
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ An IntelliJ plugin to add support for the ReplayMod [preprocessor syntax](https:
* Highlighting/intellisense of preprocessor comment blocks.
* Ability to "fold" preprocessor comment blocks.
* Auto-remapping within preprocessor comment blocks based on variables.
* Configurable jump to preprocessed file action.
<!-- plugin description end -->

129 changes: 83 additions & 46 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,59 +1,53 @@
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 {
id("java")
alias(libs.plugins.kotlin)
alias(libs.plugins.intellij)
alias(libs.plugins.intelliJPlatform)
alias(libs.plugins.kotlinter)
alias(libs.plugins.changelog)
}

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

repositories {
maven("https://repo.polyfrost.org/releases")
}

kotlin {
jvmToolchain(17)
jvmToolchain(17)
}

kotlinter {
ignoreFailures = false
reporters = arrayOf("checkstyle", "plain")
repositories {
mavenCentral()

intellijPlatform {
defaultRepositories()
}
}

intellij {
pluginName = properties("pluginName")
version = properties("platformVersion")
type = properties("platformType")
dependencies {
testImplementation(libs.junit)

plugins = properties("platformPlugins").map {
it.split(',').map(String::trim).filter(String::isNotEmpty)
}
}
intellijPlatform {
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })

changelog {
groups.empty()
repositoryUrl = properties("pluginRepositoryUrl")
instrumentationTools()
pluginVerifier()
zipSigner()
testFramework(TestFrameworkType.Platform)
}
}

tasks {
wrapper {
gradleVersion = properties("gradleVersion").get()
}

patchPluginXml {
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
intellijPlatform {
pluginConfiguration {
version = providers.gradleProperty("pluginVersion")

pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- plugin description -->"
val end = "<!-- plugin description end -->"

Expand All @@ -66,7 +60,7 @@ tasks {
}

val changelog = project.changelog
changeNotes = properties("pluginVersion").map { pluginVersion ->
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
Expand All @@ -76,28 +70,71 @@ tasks {
)
}
}
}

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")
ideaVersion {
sinceBuild = providers.gradleProperty("pluginSinceBuild")
untilBuild = providers.gradleProperty("pluginUntilBuild")
}
}

signing {
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
privateKey = providers.environmentVariable("PRIVATE_KEY")
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
}

signPlugin {
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
password = environment("PRIVATE_KEY_PASSWORD")
publishing {
token = providers.environmentVariable("PUBLISH_TOKEN")
channels = providers.gradleProperty("pluginVersion").map {
listOf(it.substringAfter('-', "")
.substringBefore('.').ifEmpty { "default" })
}
}

pluginVerification {
ides {
recommended()
}
}
}

changelog {
groups.empty()
repositoryUrl = properties("pluginRepositoryUrl")
}

kotlinter {
ignoreFailures = false
reporters = arrayOf("checkstyle", "plain")
}

tasks {
wrapper {
gradleVersion = properties("gradleVersion").get()
}

publishPlugin {
dependsOn("patchChangelog")
token = environment("PUBLISH_TOKEN")
channels = properties("pluginVersion").map {
listOf(it.substringAfter("-", "").substringBefore(".").ifEmpty {
"default"
})
}
}

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()
}
}
}
}
35 changes: 16 additions & 19 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
pluginGroup=org.polyfrost.sorbet.intelliprocessor
pluginName=IntelliProcessor
pluginRepositoryUrl=https://github.com/Polyfrost/IntelliProcessor
pluginGroup = org.polyfrost.sorbet.intelliprocessor
pluginName = IntelliProcessor
pluginRepositoryUrl = https://github.com/Polyfrost/IntelliProcessor
pluginVersion = 2.1.0

pluginVersion=2.1.0
pluginSinceBuild = 233
pluginUntilBuild = 242.*
platformType = IC
platformVersion = 2023.3.7
platformPlugins =
platformBundledPlugins = com.intellij.java

pluginSinceBuild=223
pluginUntilBuild=241.*

platformType=IC
platformVersion=2022.3.3

platformPlugins=com.intellij.java

gradleVersion=8.7
gradleVersion = 8.9

kotlin.stdlib.default.dependency=false
kotlin.code.style=official

org.gradle.configuration-cache = true
org.gradle.caching = true

org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureoncommand=true
org.gradle.parallel.threads=4
org.gradle.jvmargs=-Xmx4G
org.gradle.daemon = true
org.gradle.parallel = true
org.gradle.configureoncommand = true
org.gradle.parallel.threads = 4
org.gradle.jvmargs = -Xmx4G
Loading

0 comments on commit 86ba001

Please sign in to comment.