├── .gitignore
├── settings.gradle.kts
├── src
├── test
│ ├── testData
│ │ └── rename
│ │ │ ├── foo.xml
│ │ │ └── foo_after.xml
│ └── kotlin
│ │ └── com
│ │ └── github
│ │ └── liuqian1996
│ │ └── demoideaplugin
│ │ └── MyPluginTest.kt
└── main
│ ├── resources
│ ├── messages
│ │ └── MyBundle.properties
│ └── META-INF
│ │ ├── pluginIcon.svg
│ │ └── plugin.xml
│ └── kotlin
│ └── com
│ └── github
│ └── liuqian1996
│ └── demoideaplugin
│ ├── services
│ ├── MyApplicationService.kt
│ └── MyProjectService.kt
│ ├── listeners
│ └── MyProjectManagerListener.kt
│ └── MyBundle.kt
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── qodana.yml
├── CHANGELOG.md
├── .github
├── dependabot.yml
└── workflows
│ ├── run-ui-tests.yml
│ ├── release.yml
│ └── build.yml
├── .idea
└── gradle.xml
├── .run
├── Run IDE for UI Tests.run.xml
├── Run IDE with Plugin.run.xml
├── Run Plugin Tests.run.xml
├── Run Qodana.run.xml
└── Run Plugin Verification.run.xml
├── gradle.properties
├── README.md
├── gradlew.bat
└── gradlew
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | .idea
3 | .qodana
4 | build
5 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | rootProject.name = "demo-idea-plugin"
2 |
--------------------------------------------------------------------------------
/src/test/testData/rename/foo.xml:
--------------------------------------------------------------------------------
1 |
2 | 1>Foo
3 |
4 |
--------------------------------------------------------------------------------
/src/test/testData/rename/foo_after.xml:
--------------------------------------------------------------------------------
1 |
2 | Foo
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aliuq/demo-idea-plugin/main/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/src/main/resources/messages/MyBundle.properties:
--------------------------------------------------------------------------------
1 | name=My Plugin
2 | applicationService=Application service
3 | projectService=Project service: {0}
4 |
--------------------------------------------------------------------------------
/qodana.yml:
--------------------------------------------------------------------------------
1 | # Qodana configuration:
2 | # https://www.jetbrains.com/help/qodana/qodana-yaml.html
3 |
4 | version: 1.0
5 | profile:
6 | name: qodana.recommended
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # demo-idea-plugin Changelog
4 |
5 | ## [Unreleased]
6 | ### Added
7 | - Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)
8 |
--------------------------------------------------------------------------------
/src/main/kotlin/com/github/liuqian1996/demoideaplugin/services/MyApplicationService.kt:
--------------------------------------------------------------------------------
1 | package com.github.liuqian1996.demoideaplugin.services
2 |
3 | import com.github.liuqian1996.demoideaplugin.MyBundle
4 |
5 | class MyApplicationService {
6 |
7 | init {
8 | println(MyBundle.message("applicationService"))
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/kotlin/com/github/liuqian1996/demoideaplugin/services/MyProjectService.kt:
--------------------------------------------------------------------------------
1 | package com.github.liuqian1996.demoideaplugin.services
2 |
3 | import com.intellij.openapi.project.Project
4 | import com.github.liuqian1996.demoideaplugin.MyBundle
5 |
6 | class MyProjectService(project: Project) {
7 |
8 | init {
9 | println(MyBundle.message("projectService", project.name))
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/kotlin/com/github/liuqian1996/demoideaplugin/listeners/MyProjectManagerListener.kt:
--------------------------------------------------------------------------------
1 | package com.github.liuqian1996.demoideaplugin.listeners
2 |
3 | import com.intellij.openapi.components.service
4 | import com.intellij.openapi.project.Project
5 | import com.intellij.openapi.project.ProjectManagerListener
6 | import com.github.liuqian1996.demoideaplugin.services.MyProjectService
7 |
8 | internal class MyProjectManagerListener : ProjectManagerListener {
9 |
10 | override fun projectOpened(project: Project) {
11 | project.service()
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # Dependabot configuration:
2 | # https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
3 |
4 | version: 2
5 | updates:
6 | # Maintain dependencies for Gradle dependencies
7 | - package-ecosystem: "gradle"
8 | directory: "/"
9 | target-branch: "next"
10 | schedule:
11 | interval: "daily"
12 | # Maintain dependencies for GitHub Actions
13 | - package-ecosystem: "github-actions"
14 | directory: "/"
15 | target-branch: "next"
16 | schedule:
17 | interval: "daily"
18 |
--------------------------------------------------------------------------------
/src/main/kotlin/com/github/liuqian1996/demoideaplugin/MyBundle.kt:
--------------------------------------------------------------------------------
1 | package com.github.liuqian1996.demoideaplugin
2 |
3 | import com.intellij.DynamicBundle
4 | import org.jetbrains.annotations.NonNls
5 | import org.jetbrains.annotations.PropertyKey
6 |
7 | @NonNls
8 | private const val BUNDLE = "messages.MyBundle"
9 |
10 | object MyBundle : DynamicBundle(BUNDLE) {
11 |
12 | @Suppress("SpreadOperator")
13 | @JvmStatic
14 | fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
15 | getMessage(key, *params)
16 |
17 | @Suppress("SpreadOperator", "unused")
18 | @JvmStatic
19 | fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
20 | getLazyMessage(key, *params)
21 | }
22 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
19 |
20 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/pluginIcon.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.github.liuqian1996.demoideaplugin
4 | demo-idea-plugin
5 | liuqian1996
6 |
7 | com.intellij.modules.platform
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.run/Run IDE for UI Tests.run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | true
18 | true
19 | false
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.run/Run IDE with Plugin.run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | true
20 | true
21 | false
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.run/Run Plugin Tests.run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | true
20 | true
21 | false
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.run/Run Qodana.run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | true
22 | true
23 | false
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/test/kotlin/com/github/liuqian1996/demoideaplugin/MyPluginTest.kt:
--------------------------------------------------------------------------------
1 | package com.github.liuqian1996.demoideaplugin
2 |
3 | import com.intellij.ide.highlighter.XmlFileType
4 | import com.intellij.psi.xml.XmlFile
5 | import com.intellij.testFramework.TestDataPath
6 | import com.intellij.testFramework.fixtures.BasePlatformTestCase
7 | import com.intellij.util.PsiErrorElementUtil
8 |
9 | @TestDataPath("\$CONTENT_ROOT/src/test/testData")
10 | class MyPluginTest : BasePlatformTestCase() {
11 |
12 | fun testXMLFile() {
13 | val psiFile = myFixture.configureByText(XmlFileType.INSTANCE, "bar")
14 | val xmlFile = assertInstanceOf(psiFile, XmlFile::class.java)
15 |
16 | assertFalse(PsiErrorElementUtil.hasErrors(project, xmlFile.virtualFile))
17 |
18 | assertNotNull(xmlFile.rootTag)
19 |
20 | xmlFile.rootTag?.let {
21 | assertEquals("foo", it.name)
22 | assertEquals("bar", it.value.text)
23 | }
24 | }
25 |
26 | override fun getTestDataPath() = "src/test/testData/rename"
27 |
28 | fun testRename() {
29 | myFixture.testRename("foo.xml", "foo_after.xml", "a2")
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/.run/Run Plugin Verification.run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | true
20 | true
21 | false
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # IntelliJ Platform Artifacts Repositories
2 | # -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
3 |
4 | pluginGroup = com.github.liuqian1996.demoideaplugin
5 | pluginName = demo-idea-plugin
6 | # SemVer format -> https://semver.org
7 | pluginVersion = 0.0.1
8 |
9 | # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
10 | # for insight into build numbers and IntelliJ Platform versions.
11 | pluginSinceBuild = 203
12 | pluginUntilBuild = 213.*
13 |
14 | # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
15 | platformType = IC
16 | platformVersion = 2020.3.4
17 |
18 | # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
19 | # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
20 | platformPlugins =
21 |
22 | # Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
23 | javaVersion = 11
24 |
25 | # Gradle Releases -> https://github.com/gradle/gradle/releases
26 | gradleVersion = 7.3
27 |
28 | # Opt-out flag for bundling Kotlin standard library.
29 | # See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
30 | # suppress inspection "UnusedProperty"
31 | kotlin.stdlib.default.dependency = false
32 |
--------------------------------------------------------------------------------
/.github/workflows/run-ui-tests.yml:
--------------------------------------------------------------------------------
1 | # GitHub Actions Workflow for launching UI tests on Linux, Windows, and Mac in the following steps:
2 | # - prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with UI
3 | # - wait for IDE to start
4 | # - run UI tests with separate Gradle task
5 | #
6 | # Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform
7 | #
8 | # Workflow is triggered manually.
9 |
10 | name: Run UI Tests
11 | on:
12 | workflow_dispatch
13 |
14 | jobs:
15 |
16 | testUI:
17 | runs-on: ${{ matrix.os }}
18 | strategy:
19 | fail-fast: false
20 | matrix:
21 | include:
22 | - os: ubuntu-latest
23 | runIde: |
24 | export DISPLAY=:99.0
25 | Xvfb -ac :99 -screen 0 1920x1080x16 &
26 | gradle runIdeForUiTests &
27 | - os: windows-latest
28 | runIde: start gradlew.bat runIdeForUiTests
29 | - os: macos-latest
30 | runIde: ./gradlew runIdeForUiTests &
31 |
32 | steps:
33 |
34 | # Check out current repository
35 | - name: Fetch Sources
36 | uses: actions/checkout@v2.4.0
37 |
38 | # Setup Java 11 environment for the next steps
39 | - name: Setup Java
40 | uses: actions/setup-java@v2
41 | with:
42 | distribution: zulu
43 | java-version: 11
44 | cache: gradle
45 |
46 | # Run IDEA prepared for UI testing
47 | - name: Run IDE
48 | run: ${{ matrix.runIde }}
49 |
50 | # Wait for IDEA to be started
51 | - name: Health Check
52 | uses: jtalk/url-health-check-action@v2
53 | with:
54 | url: http://127.0.0.1:8082
55 | max-attempts: 15
56 | retry-delay: 30s
57 |
58 | # Run tests
59 | - name: Tests
60 | run: ./gradlew test
61 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # demo-idea-plugin
2 |
3 | 
4 | [](https://plugins.jetbrains.com/plugin/PLUGIN_ID)
5 | [](https://plugins.jetbrains.com/plugin/PLUGIN_ID)
6 |
7 | ## Template ToDo list
8 | - [x] Create a new [IntelliJ Platform Plugin Template][template] project.
9 | - [ ] Get familiar with the [template documentation][template].
10 | - [ ] Verify the [pluginGroup](/gradle.properties), [plugin ID](/src/main/resources/META-INF/plugin.xml) and [sources package](/src/main/kotlin).
11 | - [ ] Review the [Legal Agreements](https://plugins.jetbrains.com/docs/marketplace/legal-agreements.html).
12 | - [ ] [Publish a plugin manually](https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html?from=IJPluginTemplate) for the first time.
13 | - [ ] Set the Plugin ID in the above README badges.
14 | - [ ] Set the [Deployment Token](https://plugins.jetbrains.com/docs/marketplace/plugin-upload.html).
15 | - [ ] Click the Watch button on the top of the [IntelliJ Platform Plugin Template][template] to be notified about releases containing new features and fixes.
16 |
17 |
18 | This Fancy IntelliJ Platform Plugin is going to be your implementation of the brilliant ideas that you have.
19 |
20 | This specific section is a source for the [plugin.xml](/src/main/resources/META-INF/plugin.xml) file which will be extracted by the [Gradle](/build.gradle.kts) during the build process.
21 |
22 | To keep everything working, do not remove `` sections.
23 |
24 |
25 | ## Installation
26 |
27 | - Using IDE built-in plugin system:
28 |
29 | Settings/Preferences > Plugins > Marketplace > Search for "demo-idea-plugin" >
30 | Install Plugin
31 |
32 | - Manually:
33 |
34 | Download the [latest release](https://github.com/liuqian1996/demo-idea-plugin/releases/latest) and install it manually using
35 | Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...
36 |
37 |
38 | ---
39 | Plugin based on the [IntelliJ Platform Plugin Template][template].
40 |
41 | [template]: https://github.com/JetBrains/intellij-platform-plugin-template
42 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | # GitHub Actions Workflow created for handling the release process based on the draft release prepared
2 | # with the Build workflow. Running the publishPlugin task requires the PUBLISH_TOKEN secret provided.
3 |
4 | name: Release
5 | on:
6 | release:
7 | types: [prereleased, released]
8 |
9 | jobs:
10 |
11 | # Prepare and publish the plugin to the Marketplace repository
12 | release:
13 | name: Publish Plugin
14 | runs-on: ubuntu-latest
15 | steps:
16 |
17 | # Check out current repository
18 | - name: Fetch Sources
19 | uses: actions/checkout@v2.4.0
20 | with:
21 | ref: ${{ github.event.release.tag_name }}
22 |
23 | # Setup Java 11 environment for the next steps
24 | - name: Setup Java
25 | uses: actions/setup-java@v2
26 | with:
27 | distribution: zulu
28 | java-version: 11
29 | cache: gradle
30 |
31 | # Set environment variables
32 | - name: Export Properties
33 | id: properties
34 | shell: bash
35 | run: |
36 | CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
37 | ${{ github.event.release.body }}
38 | EOM
39 | )"
40 |
41 | CHANGELOG="${CHANGELOG//'%'/'%25'}"
42 | CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
43 | CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
44 |
45 | echo "::set-output name=changelog::$CHANGELOG"
46 |
47 | # Update Unreleased section with the current release note
48 | - name: Patch Changelog
49 | if: ${{ steps.properties.outputs.changelog != '' }}
50 | env:
51 | CHANGELOG: ${{ steps.properties.outputs.changelog }}
52 | run: |
53 | ./gradlew patchChangelog --release-note="$CHANGELOG"
54 |
55 | # Publish the plugin to the Marketplace
56 | - name: Publish Plugin
57 | env:
58 | PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
59 | run: ./gradlew publishPlugin
60 |
61 | # Upload artifact as a release asset
62 | - name: Upload Release Asset
63 | env:
64 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65 | run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
66 |
67 | # Create pull request
68 | - name: Create Pull Request
69 | if: ${{ steps.properties.outputs.changelog != '' }}
70 | env:
71 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72 | run: |
73 | VERSION="${{ github.event.release.tag_name }}"
74 | BRANCH="changelog-update-$VERSION"
75 |
76 | git config user.email "action@github.com"
77 | git config user.name "GitHub Action"
78 |
79 | git checkout -b $BRANCH
80 | git commit -am "Changelog update - $VERSION"
81 | git push --set-upstream origin $BRANCH
82 |
83 | gh pr create \
84 | --title "Changelog update - \`$VERSION\`" \
85 | --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
86 | --base main \
87 | --head $BRANCH
88 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | # GitHub Actions Workflow created for testing and preparing the plugin release in following steps:
2 | # - validate Gradle Wrapper,
3 | # - run 'test' and 'verifyPlugin' tasks,
4 | # - run Qodana inspections,
5 | # - run 'buildPlugin' task and prepare artifact for the further tests,
6 | # - run 'runPluginVerifier' task,
7 | # - create a draft release.
8 | #
9 | # Workflow is triggered on push and pull_request events.
10 | #
11 | # GitHub Actions reference: https://help.github.com/en/actions
12 | #
13 | ## JBIJPPTPL
14 |
15 | name: Build
16 | on:
17 | # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
18 | push:
19 | branches: [main]
20 | # Trigger the workflow on any pull request
21 | pull_request:
22 |
23 | jobs:
24 |
25 | # Run Gradle Wrapper Validation Action to verify the wrapper's checksum
26 | # Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks
27 | # Build plugin and provide the artifact for the next workflow jobs
28 | build:
29 | name: Build
30 | runs-on: ubuntu-latest
31 | outputs:
32 | version: ${{ steps.properties.outputs.version }}
33 | changelog: ${{ steps.properties.outputs.changelog }}
34 | steps:
35 |
36 | # Check out current repository
37 | - name: Fetch Sources
38 | uses: actions/checkout@v2.4.0
39 |
40 | # Validate wrapper
41 | - name: Gradle Wrapper Validation
42 | uses: gradle/wrapper-validation-action@v1.0.4
43 |
44 | # Setup Java 11 environment for the next steps
45 | - name: Setup Java
46 | uses: actions/setup-java@v2
47 | with:
48 | distribution: zulu
49 | java-version: 11
50 | cache: gradle
51 |
52 | # Set environment variables
53 | - name: Export Properties
54 | id: properties
55 | shell: bash
56 | run: |
57 | PROPERTIES="$(./gradlew properties --console=plain -q)"
58 | VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
59 | NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
60 | CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
61 | CHANGELOG="${CHANGELOG//'%'/'%25'}"
62 | CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
63 | CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
64 |
65 | echo "::set-output name=version::$VERSION"
66 | echo "::set-output name=name::$NAME"
67 | echo "::set-output name=changelog::$CHANGELOG"
68 | echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
69 |
70 | ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
71 |
72 | # Run tests
73 | - name: Run Tests
74 | run: ./gradlew test
75 |
76 | # Collect Tests Result of failed tests
77 | - name: Collect Tests Result
78 | if: ${{ failure() }}
79 | uses: actions/upload-artifact@v2
80 | with:
81 | name: tests-result
82 | path: ${{ github.workspace }}/build/reports/tests
83 |
84 | # Cache Plugin Verifier IDEs
85 | - name: Setup Plugin Verifier IDEs Cache
86 | uses: actions/cache@v2.1.6
87 | with:
88 | path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
89 | key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
90 |
91 | # Run Verify Plugin task and IntelliJ Plugin Verifier tool
92 | - name: Run Plugin Verification tasks
93 | run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
94 |
95 | # Collect Plugin Verifier Result
96 | - name: Collect Plugin Verifier Result
97 | if: ${{ always() }}
98 | uses: actions/upload-artifact@v2
99 | with:
100 | name: pluginVerifier-result
101 | path: ${{ github.workspace }}/build/reports/pluginVerifier
102 |
103 | # Run Qodana inspections
104 | - name: Qodana - Code Inspection
105 | uses: JetBrains/qodana-action@v2.1-eap
106 |
107 | # Collect Qodana Result
108 | - name: Collect Qodana Result
109 | uses: actions/upload-artifact@v2
110 | with:
111 | name: qodana-result
112 | path: ${{ github.workspace }}/qodana
113 |
114 | # Prepare plugin archive content for creating artifact
115 | - name: Prepare Plugin Artifact
116 | id: artifact
117 | shell: bash
118 | run: |
119 | cd ${{ github.workspace }}/build/distributions
120 | FILENAME=`ls *.zip`
121 | unzip "$FILENAME" -d content
122 |
123 | echo "::set-output name=filename::$FILENAME"
124 |
125 | # Store already-built plugin as an artifact for downloading
126 | - name: Upload artifact
127 | uses: actions/upload-artifact@v2.2.4
128 | with:
129 | name: ${{ steps.artifact.outputs.filename }}
130 | path: ./build/distributions/content/*/*
131 |
132 | # Prepare a draft release for GitHub Releases page for the manual verification
133 | # If accepted and published, release workflow would be triggered
134 | releaseDraft:
135 | name: Release Draft
136 | if: github.event_name != 'pull_request'
137 | needs: build
138 | runs-on: ubuntu-latest
139 | steps:
140 |
141 | # Check out current repository
142 | - name: Fetch Sources
143 | uses: actions/checkout@v2.4.0
144 |
145 | # Remove old release drafts by using the curl request for the available releases with draft flag
146 | - name: Remove Old Release Drafts
147 | env:
148 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149 | run: |
150 | gh api repos/{owner}/{repo}/releases \
151 | --jq '.[] | select(.draft == true) | .id' \
152 | | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
153 |
154 | # Create new release draft - which is not publicly visible and requires manual acceptance
155 | - name: Create Release Draft
156 | env:
157 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
158 | run: |
159 | gh release create v${{ needs.build.outputs.version }} \
160 | --draft \
161 | --title "v${{ needs.build.outputs.version }}" \
162 | --notes "$(cat << 'EOM'
163 | ${{ needs.build.outputs.changelog }}
164 | EOM
165 | )"
166 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84 |
85 | APP_NAME="Gradle"
86 | APP_BASE_NAME=${0##*/}
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | MAX_FD=$( ulimit -H -n ) ||
147 | warn "Could not query maximum file descriptor limit"
148 | esac
149 | case $MAX_FD in #(
150 | '' | soft) :;; #(
151 | *)
152 | ulimit -n "$MAX_FD" ||
153 | warn "Could not set maximum file descriptor limit to $MAX_FD"
154 | esac
155 | fi
156 |
157 | # Collect all arguments for the java command, stacking in reverse order:
158 | # * args from the command line
159 | # * the main class name
160 | # * -classpath
161 | # * -D...appname settings
162 | # * --module-path (only if needed)
163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164 |
165 | # For Cygwin or MSYS, switch paths to Windows format before running java
166 | if "$cygwin" || "$msys" ; then
167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169 |
170 | JAVACMD=$( cygpath --unix "$JAVACMD" )
171 |
172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
173 | for arg do
174 | if
175 | case $arg in #(
176 | -*) false ;; # don't mess with options #(
177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178 | [ -e "$t" ] ;; #(
179 | *) false ;;
180 | esac
181 | then
182 | arg=$( cygpath --path --ignore --mixed "$arg" )
183 | fi
184 | # Roll the args list around exactly as many times as the number of
185 | # args, so each arg winds up back in the position where it started, but
186 | # possibly modified.
187 | #
188 | # NB: a `for` loop captures its iteration list before it begins, so
189 | # changing the positional parameters here affects neither the number of
190 | # iterations, nor the values presented in `arg`.
191 | shift # remove old arg
192 | set -- "$@" "$arg" # push replacement arg
193 | done
194 | fi
195 |
196 | # Collect all arguments for the java command;
197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198 | # shell script including quotes and variable substitutions, so put them in
199 | # double quotes to make sure that they get re-expanded; and
200 | # * put everything else in single quotes, so that it's not re-expanded.
201 |
202 | set -- \
203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
204 | -classpath "$CLASSPATH" \
205 | org.gradle.wrapper.GradleWrapperMain \
206 | "$@"
207 |
208 | # Use "xargs" to parse quoted args.
209 | #
210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211 | #
212 | # In Bash we could simply go:
213 | #
214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215 | # set -- "${ARGS[@]}" "$@"
216 | #
217 | # but POSIX shell has neither arrays nor command substitution, so instead we
218 | # post-process each arg (as a line of input to sed) to backslash-escape any
219 | # character that might be a shell metacharacter, then use eval to reverse
220 | # that process (while maintaining the separation between arguments), and wrap
221 | # the whole thing up as a single "set" statement.
222 | #
223 | # This will of course break if any of these variables contains a newline or
224 | # an unmatched quote.
225 | #
226 |
227 | eval "set -- $(
228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229 | xargs -n1 |
230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231 | tr '\n' ' '
232 | )" '"$@"'
233 |
234 | exec "$JAVACMD" "$@"
235 |
--------------------------------------------------------------------------------