diff --git a/.github/workflows/marketplace_deploy.yml b/.github/workflows/marketplace_deploy.yml deleted file mode 100644 index cc3bc17b..00000000 --- a/.github/workflows/marketplace_deploy.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Deploy signed plugin into Jetbrains Marketplace - -on: - release: - types: [published] - - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - env: - CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} - PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} - - steps: - - uses: actions/checkout@v4 - - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 17 - - - name: Setup properties - id: properties - shell: bash - run: | - NAME=$(grep "^pluginName=" plugin.properties | cut -d '=' -f 2) - VERSION=$(grep "^version=" plugin.properties | cut -d '=' -f 2) - - echo "NAME=$NAME" - echo "VERSION=$VERSION" - - echo "name=$NAME" >> $GITHUB_ENV - echo "version=$VERSION" >> $GITHUB_ENV - echo "artifactName=$NAME-$VERSION" >> $GITHUB_ENV - - - name: Build signed plugin - run: ./gradlew publishPlugin diff --git a/.github/workflows/build.yml b/.github/workflows/release.yml similarity index 91% rename from .github/workflows/build.yml rename to .github/workflows/release.yml index f9150749..376bed45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,9 @@ -name: Create release +name: Release on: + push: + tags: + - '*' workflow_dispatch: jobs: @@ -15,6 +18,7 @@ jobs: CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} + PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} outputs: version: ${{ steps.properties.outputs.artifactName }} @@ -28,6 +32,10 @@ jobs: distribution: temurin java-version: 17 + - uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + - name: Setup properties id: properties shell: bash @@ -71,6 +79,9 @@ jobs: INVALID_PLUGIN NOT_DYNAMIC + - name: Publish to Marketplace + run: ./gradlew publishPlugin + - name: Remove old drafts env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index b9cc9afa..5e17f6fc 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -1,14 +1,19 @@ name: Validation on: + push: + branches: + - main pull_request: - branches: [ "main" ] - workflow_dispatch: jobs: build: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] + + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -18,6 +23,10 @@ jobs: with: distribution: temurin java-version: 17 - - - name: Run tests - run: ./gradlew test + + - uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + + - name: Run build + run: ./gradlew build diff --git a/.idea/icon.svg b/.idea/icon.svg new file mode 100644 index 00000000..14346149 --- /dev/null +++ b/.idea/icon.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 0705337f..98f03f5b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,24 +1,6 @@ -import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask - plugins { - alias(libs.plugins.compose.compiler) apply false - alias(libs.plugins.gradle.dependency.check) + alias(libs.plugins.kotlin.jvm) apply false + alias(libs.plugins.kotlin.compose) apply false alias(libs.plugins.jetbrains.compose) apply false alias(libs.plugins.jetbrains.intellij) apply false - alias(libs.plugins.kotlin.jvm) apply false -} - -tasks.withType { - rejectVersionIf { - isNonStable(candidate.version) - } } - -fun isNonStable(version: String): Boolean { - val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { - version.uppercase().contains(it) - } - val regex = "^[0-9,.v-]+(-r)?$".toRegex() - val isStable = stableKeyword || regex.matches(version) - return isStable.not() -} \ No newline at end of file diff --git a/components/generator/common/build.gradle.kts b/components/generator/common/build.gradle.kts index 66b55dcc..8eb857e0 100644 --- a/components/generator/common/build.gradle.kts +++ b/components/generator/common/build.gradle.kts @@ -2,10 +2,6 @@ plugins { alias(libs.plugins.kotlin.jvm) } -repositories { - mavenCentral() -} - dependencies { implementation(libs.kotlinpoet) diff --git a/components/generator/iconpack/build.gradle.kts b/components/generator/iconpack/build.gradle.kts index 4de0e466..3d1b4b10 100644 --- a/components/generator/iconpack/build.gradle.kts +++ b/components/generator/iconpack/build.gradle.kts @@ -2,10 +2,6 @@ plugins { alias(libs.plugins.kotlin.jvm) } -repositories { - mavenCentral() -} - dependencies { implementation(projects.components.generator.common) diff --git a/components/generator/imagevector/build.gradle.kts b/components/generator/imagevector/build.gradle.kts index 50338929..6e3ddc6e 100644 --- a/components/generator/imagevector/build.gradle.kts +++ b/components/generator/imagevector/build.gradle.kts @@ -2,11 +2,6 @@ plugins { alias(libs.plugins.kotlin.jvm) } -repositories { - google() - mavenCentral() -} - dependencies { implementation(projects.components.generator.common) implementation(projects.components.google) diff --git a/components/google/build.gradle.kts b/components/google/build.gradle.kts index f9ca48af..368f7b56 100644 --- a/components/google/build.gradle.kts +++ b/components/google/build.gradle.kts @@ -2,10 +2,6 @@ plugins { alias(libs.plugins.kotlin.jvm) } -repositories { - mavenCentral() -} - dependencies { implementation(projects.components.generator.common) diff --git a/components/parser/build.gradle.kts b/components/parser/build.gradle.kts index 32cb097e..cd14d83c 100644 --- a/components/parser/build.gradle.kts +++ b/components/parser/build.gradle.kts @@ -2,11 +2,6 @@ plugins { alias(libs.plugins.kotlin.jvm) } -repositories { - google() - mavenCentral() -} - dependencies { api(projects.components.google) diff --git a/gradle.properties b/gradle.properties index 7d63573d..75f3189d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,7 @@ -org.gradle.configuration-cache=true org.gradle.caching=true +org.gradle.configuration-cache=true +org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx4g +org.gradle.parallel=true kotlin.stdlib.default.dependency=false kotlin.code.style=official \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f892cbc9..b975a97f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,13 +2,13 @@ kotlin = "2.0.0" [libraries] -android-build-tools = "com.android.tools:sdk-common:31.5.0" +android-build-tools = "com.android.tools:sdk-common:31.5.1" koin-compose = "io.insert-koin:koin-compose:1.1.5" -kotlin-io = "org.jetbrains.kotlinx:kotlinx-io-core:0.4.0" +kotlin-io = "org.jetbrains.kotlinx:kotlinx-io-core:0.5.1" -kotlinpoet = "com.squareup:kotlinpoet:1.18.0" +kotlinpoet = "com.squareup:kotlinpoet:1.18.1" kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } tiamat = "io.github.composegears:tiamat:1.1.0-rc02" @@ -17,8 +17,7 @@ tiamat-koin = "io.github.composegears:tiamat-koin:1.1.0-rc02" xpp3 = "org.ogce:xpp3:1.1.6" [plugins] -compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } -gradle-dependency-check = { id = "com.github.ben-manes.versions", version = "0.51.0" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } jetbrains-compose = { id = "org.jetbrains.compose", version = "1.6.11" } jetbrains-intellij = "org.jetbrains.intellij:1.17.4" -kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832..2c352119 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 0d184210..09523c0e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..f5feea6d 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # 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 +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,12 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 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"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +134,29 @@ location of your Java installation." fi else 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. + if ! command -v java >/dev/null 2>&1 + then + 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 location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +201,15 @@ if "$cygwin" || "$msys" ; then done fi -# 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. + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +217,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32..9b42019c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index ca47c697..1e525d7a 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -3,10 +3,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.konan.properties.Properties plugins { - alias(libs.plugins.compose.compiler) + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.kotlin.compose) alias(libs.plugins.jetbrains.compose) alias(libs.plugins.jetbrains.intellij) - alias(libs.plugins.kotlin.jvm) } val pluginProperties = Properties().apply { @@ -16,10 +16,18 @@ val pluginProperties = Properties().apply { group = "io.github.composegears" version = pluginProperties.getProperty("version") +/** + * Could not reuse repositories in settings.gradle.kts, seems this is a bug of Intellij plugin. + */ repositories { + google { + mavenContent { + includeGroupAndSubgroups("androidx") + includeGroupAndSubgroups("com.android") + includeGroupAndSubgroups("com.google") + } + } mavenCentral() - google() - maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev") } dependencies { @@ -89,16 +97,16 @@ tasks { signPlugin { // chain.crt content (base64 ci) - certificateChain = System.getenv("CERTIFICATE_CHAIN") + certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN") // private.pem content (base64 ci) - privateKey = System.getenv("PRIVATE_KEY") + privateKey = providers.environmentVariable("PRIVATE_KEY") // PEM pass phrase - password = System.getenv("PRIVATE_KEY_PASSWORD") + password = providers.environmentVariable("PRIVATE_KEY_PASSWORD") } publishPlugin { - token = System.getenv("PUBLISH_TOKEN") + token = providers.environmentVariable("PUBLISH_TOKEN") } } \ No newline at end of file diff --git a/renovate.json5 b/renovate.json5 new file mode 100644 index 00000000..43de84ef --- /dev/null +++ b/renovate.json5 @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended", + ] +} diff --git a/settings.gradle.kts b/settings.gradle.kts index de219108..1e38ab4d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,4 @@ +enableFeaturePreview("STABLE_CONFIGURATION_CACHE") enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") pluginManagement { @@ -7,6 +8,19 @@ pluginManagement { } } +dependencyResolutionManagement { + repositories { + google { + mavenContent { + includeGroupAndSubgroups("androidx") + includeGroupAndSubgroups("com.android") + includeGroupAndSubgroups("com.google") + } + } + mavenCentral() + } +} + rootProject.name = "valkyrie" include("plugin")