diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b26b41..da3618f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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/wrapper-validation-action@v1.0.3 + uses: gradle/wrapper-validation-action@v1.0.4 # Run verifyPlugin and test Gradle tasks test: @@ -38,38 +44,52 @@ jobs: runs-on: ubuntu-latest steps: - # Setup Java 1.8 environment for the next steps - - name: Setup Java - uses: actions/setup-java@v1 - with: - java-version: 1.8 - # 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/cache@v2 + # Setup Java 11 environment for the next steps + - name: Setup Java + uses: actions/setup-java@v2 with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} + distribution: zulu + java-version: 11 + cache: gradle + + # Set environment variables + - name: Export Properties + id: properties + shell: bash + run: | + PROPERTIES="$(./gradlew properties --console=plain -q)" + IDE_VERSIONS="$(echo "$PROPERTIES" | grep "^pluginVerifierIdeVersions:" | base64)" - # Cache Gradle Wrapper - - name: Setup Gradle Wrapper Cache - uses: actions/cache@v2 + echo "::set-output name=ideVersions::$IDE_VERSIONS" + echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier" + + # Cache Plugin Verifier IDEs + - name: Setup Plugin Verifier IDEs Cache + uses: actions/cache@v2.1.6 with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides + key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }} + + # Run Qodana inspections + - name: Qodana - Code Inspection + uses: JetBrains/qodana-action@v2.1-eap - # Run detekt, ktlint and tests - - name: Run Linters and Test - run: ./gradlew check + # Run tests + - name: Run Tests + run: ./gradlew test # Run verifyPlugin Gradle task - name: Verify Plugin run: ./gradlew verifyPlugin + # Run IntelliJ Plugin Verifier action using GitHub Action + - name: Run Plugin Verifier + run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }} + # Build plugin with buildPlugin Gradle task and provide the artifact for the next workflow jobs # Requires test job to be passed build: @@ -77,35 +97,21 @@ jobs: needs: test runs-on: ubuntu-latest outputs: - name: ${{ steps.properties.outputs.name }} version: ${{ steps.properties.outputs.version }} changelog: ${{ steps.properties.outputs.changelog }} - artifact: ${{ steps.properties.outputs.artifact }} steps: - # Setup Java 1.8 environment for the next steps - - name: Setup Java - uses: actions/setup-java@v1 - with: - java-version: 1.8 - # 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/cache@v2 - 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/cache@v2 + # Setup Java 11 environment for the next steps + - name: Setup Java + uses: actions/setup-java@v2 with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + distribution: zulu + java-version: 11 + cache: gradle # Set environment variables - name: Export Properties @@ -119,128 +125,50 @@ jobs: CHANGELOG="${CHANGELOG//'%'/'%25'}" CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" - ARTIFACT="${NAME}-${VERSION}.zip" echo "::set-output name=version::$VERSION" echo "::set-output name=name::$NAME" echo "::set-output name=changelog::$CHANGELOG" - echo "::set-output name=artifact::$ARTIFACT" # Build artifact using buildPlugin Gradle task - name: Build Plugin run: ./gradlew buildPlugin - # Upload plugin artifact to make it available in the next jobs - - name: Upload artifact - uses: actions/upload-artifact@v1 + # Store built plugin as an artifact for downloading + - name: Upload artifacts + uses: actions/upload-artifact@v2.2.4 with: - name: plugin-artifact - path: ./build/distributions/${{ steps.properties.outputs.artifact }} - - # Verify built plugin using IntelliJ Plugin Verifier tool - # Requires build job to be passed -# verify: -# name: Verify -# needs: build -# runs-on: ubuntu-latest -# steps: -# -# # Setup Java 1.8 environment for the next steps -# - name: Setup Java -# uses: actions/setup-java@v1 -# with: -# java-version: 1.8 -# -# # Check out current repository -# - name: Fetch Sources -# uses: actions/checkout@v2 -# -# # Cache Gradle Dependencies -# - name: Setup Gradle Dependencies Cache -# uses: actions/cache@v2 -# 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/cache@v2 -# with: -# path: ~/.gradle/wrapper -# key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} -# -# # Set environment variables -# - name: Export Properties -# id: properties -# shell: bash -# run: | -# PROPERTIES="$(./gradlew properties --console=plain -q)" -# IDE_VERSIONS="$(echo "$PROPERTIES" | grep "^pluginVerifierIdeVersions:" | base64)" -# -# echo "::set-output name=ideVersions::$IDE_VERSIONS" -# echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier" -# -# # Cache Plugin Verifier IDEs -# - name: Setup Plugin Verifier IDEs Cache -# uses: actions/cache@v2 -# with: -# path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides -# key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }} -# -# # Run IntelliJ Plugin Verifier action using GitHub Action -# - name: Verify Plugin -# run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }} + name: "${{ steps.properties.outputs.name }} - ${{ steps.properties.outputs.version }}" + path: ./build/distributions/* # Prepare a draft release for GitHub Releases page for the manual verification # If accepted and published, release workflow would be triggered releaseDraft: name: Release Draft if: github.event_name != 'pull_request' - needs: [build] + needs: build runs-on: ubuntu-latest steps: # 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 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \ - | tr '\r\n' ' ' \ - | jq '.[] | select(.draft == true) | .id' \ - | xargs -I '{}' \ - curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{} + gh api repos/{owner}/{repo}/releases \ + --jq '.[] | select(.draft == true) | .id' \ + | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} # Create new release draft - which is not publicly visible and requires manual acceptance - name: Create Release Draft - id: createDraft - uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: v${{ needs.build.outputs.version }} - release_name: v${{ needs.build.outputs.version }} - body: ${{ needs.build.outputs.changelog }} - draft: true - - # Download plugin artifact provided by the previous job - - name: Download Artifact - uses: actions/download-artifact@v2 - with: - name: plugin-artifact - - # Upload artifact as a release asset - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.createDraft.outputs.upload_url }} - asset_path: ./${{ needs.build.outputs.artifact }} - asset_name: ${{ needs.build.outputs.artifact }} - asset_content_type: application/zip + run: | + gh release create v${{ needs.build.outputs.version }} \ + --draft \ + --title "v${{ needs.build.outputs.version }}" \ + --notes "${{ needs.build.outputs.changelog }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 382fa91..b023e60 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,57 +14,56 @@ jobs: runs-on: ubuntu-latest steps: - # Setup Java 1.8 environment for the next steps - - name: Setup Java - uses: actions/setup-java@v1 - with: - java-version: 1.8 - # Check out current repository - name: Fetch Sources - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 with: ref: ${{ github.event.release.tag_name }} + # Setup Java 11 environment for the next steps + - name: Setup Java + uses: actions/setup-java@v2 + with: + distribution: zulu + java-version: 11 + cache: gradle + + # Update Unreleased section with the current release note + - name: Patch Changelog + run: | + ./gradlew patchChangelog --release-note="`cat << EOM + ${{ github.event.release.body }} + EOM`" + # Publish the plugin to the Marketplace - name: Publish Plugin env: PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} run: ./gradlew publishPlugin - # Patch changelog, commit and push to the current repository - changelog: - name: Update Changelog - needs: release - runs-on: ubuntu-latest - steps: - - # Setup Java 1.8 environment for the next steps - - name: Setup Java - uses: actions/setup-java@v1 - with: - java-version: 1.8 + # Upload artifact as a release asset + - name: Upload Release Asset + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v2 - with: - ref: ${{ github.event.release.tag_name }} + # Create pull request + - name: Create Pull Request + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${{ github.event.release.tag_name }}" + BRANCH="changelog-update-$VERSION" - # Update Unreleased section with the current version - - name: Patch Changelog - run: ./gradlew patchChangelog + git config user.email "action@github.com" + git config user.name "GitHub Action" - # Commit patched Changelog - - name: Commit files - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git commit -m "Update changelog" -a + git checkout -b $BRANCH + git commit -am "Changelog update - $VERSION" + git push --set-upstream origin $BRANCH - # Push changes - - name: Push changes - uses: ad-m/github-push-action@master - with: - branch: main - github_token: ${{ secrets.GITHUB_TOKEN }} + gh pr create \ + --title "Changelog update - \`$VERSION\`" \ + --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ + --base main \ + --head $BRANCH diff --git a/.github/workflows/run-ui-tests.yml b/.github/workflows/run-ui-tests.yml new file mode 100644 index 0000000..f549056 --- /dev/null +++ b/.github/workflows/run-ui-tests.yml @@ -0,0 +1,60 @@ +# GitHub Actions Workflow created for launching UI tests on Linux, Windows, and Mac in the following steps: +# - prepare and launch Idea with your plugin and robot-server plugin, which is need to interact with UI +# - wait for the Idea started +# - run UI tests with separate Gradle task +# +# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ IDEA. +# +# Workflow is triggered manually. + +name: Run UI Tests +on: + workflow_dispatch + +jobs: + + testUI: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + runIde: | + export DISPLAY=:99.0 + Xvfb -ac :99 -screen 0 1920x1080x16 & + gradle runIdeForUiTests & + - os: windows-latest + runIde: start gradlew.bat runIdeForUiTests + - os: macos-latest + runIde: ./gradlew runIdeForUiTests & + + steps: + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v2.3.4 + + # Setup Java 11 environment for the next steps + - name: Setup Java + uses: actions/setup-java@v2 + with: + distribution: zulu + java-version: 11 + cache: gradle + + # Run IDEA prepared for UI testing + - name: Run IDE + run: ${{ matrix.runIde }} + + # Wait for IDEA to be started + - name: Health Check + uses: jtalk/url-health-check-action@v1.5 + with: + url: http://127.0.0.1:8082 + max-attempts: 15 + retry-delay: 30s + + # Run tests + - name: Tests + run: ./gradlew test diff --git a/build.gradle.kts b/build.gradle.kts index 35a1bd1..10d25b7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,3 @@ -import io.gitlab.arturbosch.detekt.Detekt -import org.jetbrains.changelog.closure import org.jetbrains.changelog.markdownToHTML import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -10,14 +8,12 @@ plugins { id("java") // Kotlin support id("org.jetbrains.kotlin.jvm") version "1.4.31" - // gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin - id("org.jetbrains.intellij") version "0.7.2" - // gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin - id("org.jetbrains.changelog") version "1.1.2" - // detekt linter - read more: https://detekt.github.io/detekt/gradle.html - id("io.gitlab.arturbosch.detekt") version "1.15.0" - // ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle - id("org.jlleitschuh.gradle.ktlint") version "10.0.0" + // Gradle IntelliJ Plugin + id("org.jetbrains.intellij") version "1.2.1" + // Gradle Changelog Plugin + id("org.jetbrains.changelog") version "1.3.1" + // Gradle Qodana Plugin + id("org.jetbrains.qodana") version "0.1.13" } group = properties("pluginGroup") @@ -26,97 +22,101 @@ version = properties("pluginVersion") // Configure project's dependencies repositories { mavenCentral() - jcenter() -} -dependencies { - detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.16.0") } -// Configure gradle-intellij-plugin plugin. -// Read more: https://github.com/JetBrains/gradle-intellij-plugin +// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin intellij { - pluginName = properties("pluginName") - version = properties("platformVersion") - type = properties("platformType") - downloadSources = properties("platformDownloadSources").toBoolean() - updateSinceUntilBuild = false + pluginName.set(properties("pluginName")) + version.set(properties("platformVersion")) + type.set(properties("platformType")) + downloadSources.set(properties("platformDownloadSources").toBoolean()) + updateSinceUntilBuild.set(true) // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. - setPlugins(*properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty).toTypedArray()) + plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) } -// Configure gradle-changelog-plugin plugin. -// Read more: https://github.com/JetBrains/gradle-changelog-plugin +// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin changelog { - version = properties("pluginVersion") - groups = emptyList() + version.set(properties("pluginVersion")) + groups.set(emptyList()) } -// Configure detekt plugin. -// Read more: https://detekt.github.io/detekt/kotlindsl.html -detekt { - toolVersion = "1.16.0" - config = files("./detekt-config.yml") - buildUponDefaultConfig = true - reports { - html.enabled = false - xml.enabled = false - txt.enabled = false - } +// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin +qodana { + cachePath.set(projectDir.resolve(".qodana").canonicalPath) + reportPath.set(projectDir.resolve("build/reports/inspections").canonicalPath) + saveReport.set(true) + showReport.set(System.getenv("QODANA_SHOW_REPORT").toBoolean()) } tasks { - // Set the compatibility versions to 1.8 - withType { - sourceCompatibility = "1.8" - targetCompatibility = "1.8" - } - withType { - kotlinOptions.jvmTarget = "1.8" + // Set the JVM compatibility versions + properties("javaVersion").let { + withType { + sourceCompatibility = it + targetCompatibility = it + } + withType { + kotlinOptions.jvmTarget = it + } } - withType { - jvmTarget = "1.8" + wrapper { + gradleVersion = properties("gradleVersion") } patchPluginXml { - version(properties("pluginVersion")) - sinceBuild(properties("pluginSinceBuild")) - untilBuild(properties("pluginUntilBuild")) + version.set(properties("pluginVersion")) + sinceBuild.set(properties("pluginSinceBuild")) + untilBuild.set(properties("pluginUntilBuild")) // Extract the section from README.md and provide for the plugin's manifest - pluginDescription( - closure { - File("./README.md").readText().lines().run { - val start = "" - val 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( + projectDir.resolve("README.md").readText().lines().run { + val start = "" + val 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.run { + getOrNull(properties("pluginVersion")) ?: getLatest() + }.toHTML() + }) } runPluginVerifier { - ideVersions(properties("pluginVerifierIdeVersions")) + ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty)) + } + + // 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", "") + systemProperty("jb.consents.confirmation.enabled", "false") + } + + signPlugin { + certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) + privateKey.set(System.getenv("PRIVATE_KEY")) + password.set(System.getenv("PRIVATE_KEY_PASSWORD")) } 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())) } } diff --git a/detekt-config.yml b/detekt-config.yml deleted file mode 100644 index 1caf4ce..0000000 --- a/detekt-config.yml +++ /dev/null @@ -1,14 +0,0 @@ -# Default detekt configuration: -# https://github.com/detekt/detekt/blob/master/detekt-core/src/main/resources/default-detekt-config.yml - -formatting: - Indentation: - continuationIndentSize: 8 - ParameterListWrapping: - indentSize: 8 -exceptions: - TooGenericExceptionCaught: - excludes: ['**/actions/CreateDartTestFromIntentionAction.kt'] - SwallowedException: - excludes: ['**/actions/CreateDartTestFromIntentionAction.kt'] - diff --git a/gradle.properties b/gradle.properties index cf73d3d..33ffd85 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,21 +3,31 @@ pluginGroup = com.github.grahamsmith.darttest pluginName = dart-test -pluginVersion = 0.0.6 +pluginVersion = 0.0.7 + +# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html +# for insight into build numbers and IntelliJ Platform versions. pluginSinceBuild = 202 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 = 2020.2 2020.3.2, 2021.1 +# See https://jb.gg/intellij-platform-builds-list for available build versions. +pluginVerifierIdeVersions = 2020.3.4, 2021.1.3, 2021.2.1 platformType = IC -platformVersion = 2020.3 +platformVersion = 2021.2.3 platformDownloadSources = true + # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 -platformPlugins = Dart:203.7759 +platformPlugins = Dart:212.5632 + +# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3 +javaVersion = 11 +gradleVersion = 7.2 # 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. +# suppress inspection "UnusedProperty" kotlin.stdlib.default.dependency = false diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c..7454180 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 442d913..ffed3a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0..1b6c787 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/qodana.yml b/qodana.yml new file mode 100644 index 0000000..dac95d3 --- /dev/null +++ b/qodana.yml @@ -0,0 +1,6 @@ +# Qodana configuration: +# https://www.jetbrains.com/help/qodana/qodana-yaml.html + +version: 1.0 +profile: + name: qodana.recommended