Skip to content

Commit

Permalink
Update to intellij-platform-plugin-template v0.10.1 (#236)
Browse files Browse the repository at this point in the history
* Update to intellij-platform-plugin-template v0.10.1

* Update GrammarKit to 2021.1.3

* Update gradle-intellij-plugin to 1.1.2
  • Loading branch information
tomblachut authored Jul 14, 2021
1 parent dc3c6ae commit 46cd8f5
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 62 deletions.
49 changes: 29 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
## JBIJPPTPL

name: Build
on: [push, pull_request]
on:
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
push:
branches: [main]
# Trigger the workflow on any pull request
pull_request:

jobs:

# Run Gradle Wrapper Validation Action to verify the wrapper's checksum
Expand All @@ -25,11 +31,11 @@ jobs:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4

# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/[email protected].3
uses: gradle/[email protected].4

# Run verifyPlugin and test Gradle tasks
test:
Expand All @@ -40,24 +46,25 @@ jobs:

# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4

# Cache Gradle dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/[email protected].4
uses: actions/[email protected].6
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}

# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/[email protected].4
uses: actions/[email protected].6
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
Expand Down Expand Up @@ -85,24 +92,25 @@ jobs:

# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4

# Cache Gradle Dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/[email protected].4
uses: actions/[email protected].6
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}

# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/[email protected].4
uses: actions/[email protected].6
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
Expand Down Expand Up @@ -132,7 +140,7 @@ jobs:

# Upload plugin artifact to make it available in the next jobs
- name: Upload artifact
uses: actions/[email protected].2
uses: actions/[email protected].3
with:
name: plugin-artifact
path: ./build/distributions/${{ steps.properties.outputs.artifact }}
Expand All @@ -147,24 +155,25 @@ jobs:

# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4

# Cache Gradle Dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/[email protected].4
uses: actions/[email protected].6
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}

# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/[email protected].4
uses: actions/[email protected].6
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
Expand All @@ -182,7 +191,7 @@ jobs:
# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
uses: actions/[email protected].4
uses: actions/[email protected].6
with:
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }}
Expand All @@ -202,7 +211,7 @@ jobs:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4

# Remove old release drafts by using the curl request for the available releases with draft flag
- name: Remove Old Release Drafts
Expand All @@ -218,7 +227,7 @@ jobs:
# Create new release draft - which is not publicly visible and requires manual acceptance
- name: Create Release Draft
id: createDraft
uses: actions/create-release@v1
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -236,7 +245,7 @@ jobs:
# Upload artifact as a release asset
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ jobs:

# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4
with:
ref: ${{ github.event.release.tag_name }}

Expand All @@ -41,13 +42,14 @@ jobs:

# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4
with:
ref: ${{ github.event.release.tag_name }}

Expand Down
61 changes: 27 additions & 34 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import org.jetbrains.changelog.closure
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.grammarkit.tasks.GenerateLexer
import org.jetbrains.intellij.tasks.RunIdeTask
Expand All @@ -8,13 +7,13 @@ fun properties(key: String) = project.findProperty(key).toString()

plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.4.32"
id("org.jetbrains.kotlin.jvm") version "1.5.10"
// https://github.com/JetBrains/gradle-intellij-plugin
id("org.jetbrains.intellij") version "0.7.2"
id("org.jetbrains.intellij") version "1.1.2"
// https://github.com/JetBrains/gradle-changelog-plugin
id("org.jetbrains.changelog") version "1.1.2"
// https://github.com/JetBrains/gradle-grammar-kit-plugin
id("org.jetbrains.grammarkit") version "2020.3.2"
id("org.jetbrains.grammarkit") version "2021.1.3"
}

group = properties("pluginGroup")
Expand Down Expand Up @@ -45,7 +44,6 @@ val intellijPlugins = listOfNotNull(

repositories {
mavenCentral()
jcenter()
}

sourceSets.main {
Expand All @@ -54,14 +52,14 @@ sourceSets.main {

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

// https://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_dependencies.html
setPlugins(*intellijPlugins.toTypedArray())
plugins.set(intellijPlugins)
}

changelog {
Expand All @@ -87,47 +85,42 @@ tasks {
withType<KotlinCompile> {
dependsOn(generateLexer)
kotlinOptions.jvmTarget = "11"
kotlinOptions.languageVersion = "1.4"
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=compatibility")
}

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

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription(
closure {
File(projectDir, "README.md").readText().lines().run {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

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").run { markdownToHTML(this) }
}
pluginDescription.set(
File(projectDir, "README.md").readText().lines().run {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

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").run { markdownToHTML(this) }
)
// Get the latest available change notes from the changelog file
changeNotes(
closure {
changelog.getLatest().toHTML()
}
)
changeNotes.set(provider { changelog.getLatest().toHTML() })
}

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

publishPlugin {
dependsOn("patchChangelog")
token(System.getenv("PUBLISH_TOKEN"))
token.set(System.getenv("PUBLISH_TOKEN"))
// 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").split('-').getOrElse(1) { "default" }.split('.').first())
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
}

withType<RunIdeTask> {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
pluginGroup=dev.blachut.svelte.lang
pluginName=svelte-intellij
pluginVersion=0.19.0
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html#intellij-platform-based-products-of-recent-ide-versions
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild=203.5784
pluginUntilBuild=212.*
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
# See https://jb.gg/intellij-platform-builds-list for available build versions.
pluginVerifierIdeVersions=IU-2020.3.3, IU-2021.1
pluginVerifierIdeVersions=IU-2020.3.3, IU-2021.1.3
platformType=IU
platformVersion=203-EAP-SNAPSHOT
platformDownloadSources=true
# Opt-out flag for bundling Kotlin standard library.
# See https://kotlinlang.org/docs/reference/using-gradle.html#dependency-on-the-standard-library for details.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
kotlin.stdlib.default.dependency=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 46cd8f5

Please sign in to comment.