diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 48508278..2eb10675 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -15,6 +15,8 @@ jobs: ref: master # for ratchet - uses: actions/checkout@v6 - uses: ./.github/actions/setup-java + with: + java-version: 17 - run: ./gradlew spotlessApply - uses: reviewdog/action-suggester@v1 with: @@ -36,6 +38,8 @@ jobs: steps: - uses: actions/checkout@v6 - uses: ./.github/actions/setup-java + with: + java-version: 17 - run: ./gradlew publishToMavenLocal test env: TEST_SERVER_URL: http://localhost:${{ job.services.app.ports[3000] }} @@ -66,6 +70,8 @@ jobs: steps: - uses: actions/checkout@v6 - uses: ./.github/actions/setup-java + with: + java-version: 17 - run: ./gradlew testUnrollAcceptanceTest env: TEST_SERVER_URL: http://localhost:3000 @@ -97,11 +103,6 @@ jobs: fail-fast: false matrix: agp_version: - - '7.0.0' - - '7.1.0' - - '7.2.0' - - '7.3.0' - - '7.4.0' - '8.0.0' - '8.1.0' - '8.2.0' @@ -120,16 +121,6 @@ jobs: - '9.1.0' - '9.2.0' include: - - agp_version: '7.0.0' - gradle_version: '7.0.2' - - agp_version: '7.1.0' - gradle_version: '7.2' - - agp_version: '7.2.0' - gradle_version: '7.3.3' - - agp_version: '7.3.0' - gradle_version: '7.4.2' - - agp_version: '7.4.0' - gradle_version: '7.5' - agp_version: '8.0.0' gradle_version: '8.0' java_version: '17' diff --git a/CHANGELOG.md b/CHANGELOG.md index 3adeb0b0..542b4c36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,25 @@ # ChangeLog -## Unreleased - +## ver 2.10.0 + +- Migrate to Android Gradle Plugin's public `androidComponents`/Artifacts API and support AGP 9.x. [#283](https://github.com/DeployGate/gradle-deploygate-plugin/pull/283) + - Support the following Android Gradle Plugin versions: + - 8.8.x with Gradle 8.10.2 + - 8.9.x with Gradle 8.11.1 + - 8.10.x with Gradle 8.11.1 + - 8.11.x with Gradle 8.13 + - 8.12.x with Gradle 8.13 + - 8.13.x with Gradle 8.13 + - 9.0.x with Gradle 9.1.0 + - 9.1.x with Gradle 9.3.1 + - 9.2.x with Gradle 9.4.1 - Support Gradle's configuration cache. [#272](https://github.com/DeployGate/gradle-deploygate-plugin/pull/272) +### Breaking Changes + +- Drop support for Android Gradle Plugin 4.2.x–7.4.x and Gradle 6.x–7.x. + - The minimum required Android Gradle Plugin is now **8.0** (was 4.2.0), the minimum required Gradle is now **8.0** (was 6.7.1), and **JDK 17** is required. To keep using AGP 4.2.x–7.4.x or Gradle 6.x–7.x, stay on 2.9.x or earlier. + ## ver 2.9.0 - Support Android Gradle Plugin of below: diff --git a/README.md b/README.md index 11cafd80..f303cad0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Gradle DeployGate Plugin -[![Build Status](https://travis-ci.org/DeployGate/gradle-deploygate-plugin.png?branch=master)](https://travis-ci.org/DeployGate/gradle-deploygate-plugin) +[![Build Status](https://github.com/DeployGate/gradle-deploygate-plugin/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/DeployGate/gradle-deploygate-plugin/actions/workflows/build-and-test.yml) [ ![Download](https://img.shields.io/maven-central/v/com.deploygate/gradle) ](https://search.maven.org/artifact/com.deploygate/gradle) This is the DeployGate plugin for the Gradle. You can build and deploy your apps to DeployGate by running a single task. @@ -71,39 +71,39 @@ This plugin does not work with non-app modules and/or library modules correctly. ## Version Compatibility -| Android Gradle Plugin | Gradle DeployGate Plugin | -|:---------------------------|:-----------------------------| -| < 3.0.0 | 1.1.5 (No longer maintained) | -| 3.3.x, 3.4.x, 3.5.x | \>=2.0.0,\<2.6 | -| 3.6.x | \>=2.1.0,\<2.6 | -| 4.0.x | \>=2.2.0,\<2.6 | -| 4.1.x | \>=2.3.0,\<2.6 | -| 4.2.x | \>=2.4.0,\<2.10.0 | -| 7.0.x (Arctic Fox) | \>=2.4.0 | -| 7.1.x (Bumblebee) | \>=2.4.0 | -| 7.2.x (Chipmunk) | \>=2.4.0 | -| 7.3.x (Dolphin) | \>=2.4.0 | -| 7.4.x (Electric Eel) | \>=2.4.0 | -| 8.0.x (Flamingo) | \>=2.6.0 | -| 8.1.x (Giraffe) | \>=2.7.0 | -| 8.2.x (Hedgehog) | \>=2.7.0 | -| 8.3.x (Iguana) | \>=2.8.0 | -| 8.4.x (Jellyfish) | \>=2.8.0 | -| 8.5.x (Koala) | \>=2.8.0 | -| 8.6.x (Koala Feature Drop) | \>=2.8.0 | -| 8.7.x (Ladybug) | \>=2.8.0 | -| 8.8.x | \>=2.10.0 | -| 8.9.x | \>=2.10.0 | -| 8.10.x | \>=2.10.0 | -| 8.11.x | \>=2.10.0 | -| 8.12.x | \>=2.10.0 | -| 8.13.x | \>=2.10.0 | -| 9.0.x | \>=2.10.0 | -| 9.1.x | \>=2.10.0 | -| 9.2.x | \>=2.10.0 | +| Android Gradle Plugin | Gradle DeployGate Plugin | +|:-----------------------------|:----------------------------| +| < 3.0.0 | 1.1.5 (No longer maintained) | +| 3.3.x, 3.4.x, 3.5.x | \>=2.0.0,\<2.6 | +| 3.6.x | \>=2.1.0,\<2.6 | +| 4.0.x | \>=2.2.0,\<2.6 | +| 4.1.x | \>=2.3.0,\<2.6 | +| 4.2.x | \>=2.4.0,\<2.10.0 | +| 7.0.x (Arctic Fox) | \>=2.4.0,\<2.10.0 | +| 7.1.x (Bumblebee) | \>=2.4.0,\<2.10.0 | +| 7.2.x (Chipmunk) | \>=2.4.0,\<2.10.0 | +| 7.3.x (Dolphin) | \>=2.4.0,\<2.10.0 | +| 7.4.x (Electric Eel) | \>=2.4.0,\<2.10.0 | +| 8.0.x (Flamingo) | \>=2.6.0 | +| 8.1.x (Giraffe) | \>=2.7.0 | +| 8.2.x (Hedgehog) | \>=2.7.0 | +| 8.3.x (Iguana) | \>=2.8.0 | +| 8.4.x (Jellyfish) | \>=2.8.0 | +| 8.5.x (Koala) | \>=2.8.0 | +| 8.6.x (Koala Feature Drop) | \>=2.8.0 | +| 8.7.x (Ladybug) | \>=2.8.0 | +| 8.8.x (Ladybug Feature Drop) | \>=2.10.0 | +| 8.9.x (Meerkat) | \>=2.10.0 | +| 8.10.x (Meerkat Feature Drop) | \>=2.10.0 | +| 8.11.x (Narwhal) | \>=2.10.0 | +| 8.12.x (Narwhal Feature Drop) | \>=2.10.0 | +| 8.13.x (Otter) | \>=2.10.0 | +| 9.0.x | \>=2.10.0 | +| 9.1.x | \>=2.10.0 | +| 9.2.x | \>=2.10.0 | > **Gradle DeployGate Plugin 2.10.0** migrated to AGP's public `androidComponents`/Artifacts API and -> therefore requires **AGP 7.0+** and **Gradle 7.0+**. To use AGP 4.2.x–6.x, stay on 2.9.x or earlier. +> therefore requires **AGP 8.0+**, **Gradle 8.0+**, and **JDK 17**. To use AGP 4.2.x–7.4.x, stay on 2.9.x or earlier. ### Canary/Beta support table @@ -113,16 +113,13 @@ We are not supporting Canary(Alpha) versions because of API stability. Please wa See the test matrix of [.github/workflows/build-and-test.yml](./.github/workflows/build-and-test.yml) for the latest information. -| JRE | Android Gradle Plugin | Gradle DeployGate Plugin | -|:----|:----------------------|:-------------------------| -| 17 | - | - | - ### Binary compatibility | Gradle DeployGate Plugin | Minimum JRE version | |:-------------------------|:--------------------| | \<2.6 | 7 | | \>=2.6.0 | 8 | +| \>=2.10.0 | 17 | ### Gradle compatibility @@ -130,7 +127,7 @@ See the test matrix of [.github/workflows/build-and-test.yml](./.github/workflow |:-------------------------|:-----------------------| | \<2.6 | 5.4 | | \>=2.6.0 | 6.7.1 | -| \>=2.10.0 | 7.0 | +| \>=2.10.0 | 8.0 | ## Usage @@ -310,7 +307,7 @@ If you get a time-out error from jitpack, then please run your task again. ### Requirements -- JRE 11+ +- JRE 17+ - Docker (only for testing) ### Steps @@ -327,7 +324,7 @@ And also, please make sure your changes pass unit tests and acceptance tests. CI ```bash # please make sure https://github.com/DeployGate/deploygate-mock-server/pkgs/container/deploygate-mock-server has been launched -./gradlew test acceptanceTest +./gradlew test testUnrollAcceptanceTest testPluginAcceptanceTest ``` ## Migrate from v1 to v2 @@ -417,7 +414,7 @@ See [CHANGELOG.md](./CHANGELOG.md) # License -Copyright 2015-2020 DeployGate Inc. +Copyright 2015-2026 DeployGate Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/README_JP.md b/README_JP.md index 0d07b9d4..ee86b445 100644 --- a/README_JP.md +++ b/README_JP.md @@ -1,6 +1,6 @@ # Gradle DeployGate Plugin -[![Build Status](https://travis-ci.org/DeployGate/gradle-deploygate-plugin.png?branch=master)](https://travis-ci.org/DeployGate/gradle-deploygate-plugin) +[![Build Status](https://github.com/DeployGate/gradle-deploygate-plugin/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/DeployGate/gradle-deploygate-plugin/actions/workflows/build-and-test.yml) [ ![Download](https://img.shields.io/maven-central/v/com.deploygate/gradle) ](https://search.maven.org/artifact/com.deploygate/gradle) DeployGate Gradle プラグインです。DeployGate 経由でアプリを配信するための Gradle タスクが簡単に設定できます。 @@ -69,39 +69,39 @@ DeployGate Gradle プラグインは非 app モジュールや android-library ## Version Compatibility -| Android Gradle Plugin | Gradle DeployGate Plugin | -|:---------------------------|:-------------------------| -| < 3.0.0 | 1.1.5 (保守終了) | -| 3.3.x, 3.4.x, 3.5.x | \>=2.0.0,\<2.6 | -| 3.6.x | \>=2.1.0,\<2.6 | -| 4.0.x | \>=2.2.0,\<2.6 | -| 4.1.x | \>=2.3.0,\<2.6 | -| 4.2.x | \>=2.4.0,\<2.10.0 | -| 7.0.x (Arctic Fox) | \>=2.4.0 | -| 7.1.x (Bumblebee) | \>=2.4.0 | -| 7.2.x (Chipmunk) | \>=2.4.0 | -| 7.3.x (Dolphin) | \>=2.4.0 | -| 7.4.x (Electric Eel) | \>=2.4.0 | -| 8.0.x (Flamingo) | \>=2.6.0 | -| 8.1.x (Giraffe) | \>=2.7.0 | -| 8.2.x (Hedgehog) | \>=2.7.0 | -| 8.3.x (Iguana) | \>=2.8.0 | -| 8.4.x (Jellyfish) | \>=2.8.0 | -| 8.5.x (Koala) | \>=2.8.0 | -| 8.6.x (Koala Feature Drop) | \>=2.8.0 | -| 8.7.x (Ladybug) | \>=2.8.0 | -| 8.8.x | \>=2.10.0 | -| 8.9.x | \>=2.10.0 | -| 8.10.x | \>=2.10.0 | -| 8.11.x | \>=2.10.0 | -| 8.12.x | \>=2.10.0 | -| 8.13.x | \>=2.10.0 | -| 9.0.x | \>=2.10.0 | -| 9.1.x | \>=2.10.0 | -| 9.2.x | \>=2.10.0 | +| Android Gradle Plugin | Gradle DeployGate Plugin | +|:-----------------------------|:------------------------| +| < 3.0.0 | 1.1.5 (保守終了) | +| 3.3.x, 3.4.x, 3.5.x | \>=2.0.0,\<2.6 | +| 3.6.x | \>=2.1.0,\<2.6 | +| 4.0.x | \>=2.2.0,\<2.6 | +| 4.1.x | \>=2.3.0,\<2.6 | +| 4.2.x | \>=2.4.0,\<2.10.0 | +| 7.0.x (Arctic Fox) | \>=2.4.0,\<2.10.0 | +| 7.1.x (Bumblebee) | \>=2.4.0,\<2.10.0 | +| 7.2.x (Chipmunk) | \>=2.4.0,\<2.10.0 | +| 7.3.x (Dolphin) | \>=2.4.0,\<2.10.0 | +| 7.4.x (Electric Eel) | \>=2.4.0,\<2.10.0 | +| 8.0.x (Flamingo) | \>=2.6.0 | +| 8.1.x (Giraffe) | \>=2.7.0 | +| 8.2.x (Hedgehog) | \>=2.7.0 | +| 8.3.x (Iguana) | \>=2.8.0 | +| 8.4.x (Jellyfish) | \>=2.8.0 | +| 8.5.x (Koala) | \>=2.8.0 | +| 8.6.x (Koala Feature Drop) | \>=2.8.0 | +| 8.7.x (Ladybug) | \>=2.8.0 | +| 8.8.x (Ladybug Feature Drop) | \>=2.10.0 | +| 8.9.x (Meerkat) | \>=2.10.0 | +| 8.10.x (Meerkat Feature Drop) | \>=2.10.0 | +| 8.11.x (Narwhal) | \>=2.10.0 | +| 8.12.x (Narwhal Feature Drop) | \>=2.10.0 | +| 8.13.x (Otter) | \>=2.10.0 | +| 9.0.x | \>=2.10.0 | +| 9.1.x | \>=2.10.0 | +| 9.2.x | \>=2.10.0 | > **Gradle DeployGate Plugin 2.10.0** は AGP の公開 API である `androidComponents`/Artifacts API へ移行したため、 -> **AGP 7.0 以上**および **Gradle 7.0 以上**が必要です。AGP 4.2.x〜6.x を使う場合は 2.9.x 以前をご利用ください。 +> **AGP 8.0 以上**・**Gradle 8.0 以上**・**JDK 17** が必要です。AGP 4.2.x〜7.4.x を使う場合は 2.9.x 以前をご利用ください。 ### Canary/Beta サポート情報 @@ -111,16 +111,13 @@ API仕様が頻繁に変わる可能性があることから、Canary(Alpha) バ [.github/workflows/build-and-test.yml](./.github/workflows/build-and-test.yml) を参考にしてください -| JRE | Android Gradle Plugin | Gradle DeployGate Plugin | -|:----|:----------------------|:-------------------------| -| 17 | - | - | - ### Binary compatibility | Gradle DeployGate Plugin | Minimum JRE version | |:-------------------------|:--------------------| | \<2.6 | 7 | | \>=2.6.0 | 8 | +| \>=2.10.0 | 17 | ### Gradle compatibility @@ -128,7 +125,7 @@ API仕様が頻繁に変わる可能性があることから、Canary(Alpha) バ |:-------------------------|:-----------------------| | \<2.6 | 5.4 | | \>=2.6.0 | 6.7.1 | -| \>=2.10.0 | 7.0 | +| \>=2.10.0 | 8.0 | ## Usage @@ -304,7 +301,7 @@ jitpack.io は初回のリクエストを受けてからスナップショット ### 要求 -- JRE 11+ +- JRE 17+ - Docker (テスト用の機能のみ) ### Steps @@ -321,7 +318,7 @@ jitpack.io は初回のリクエストを受けてからスナップショット ```bash # https://github.com/DeployGate/deploygate-mock-server/pkgs/container/deploygate-mock-server を起動してください -./gradlew test acceptanceTest +./gradlew test testUnrollAcceptanceTest testPluginAcceptanceTest ``` ## v1 から v2 への移行 @@ -412,7 +409,7 @@ deploygate { # License -Copyright 2015-2019 DeployGate Inc. +Copyright 2015-2026 DeployGate Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/build.gradle b/build.gradle index 80989fb8..5278a17f 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { maven { url "https://plugins.gradle.org/m2/" } mavenCentral() } - dependencies { classpath "com.diffplug.spotless:spotless-plugin-gradle:7.2.1" } + dependencies { classpath "com.diffplug.spotless:spotless-plugin-gradle:8.6.0" } } class VersionString implements Comparable { @@ -85,7 +85,11 @@ class VersionString implements Comparable { apply plugin: 'groovy' apply plugin: 'maven-publish' apply plugin: 'signing' -apply plugin: "com.diffplug.spotless" +// Spotless 8.x requires Gradle 8.1+. The acceptance matrix runs this build on Gradle 8.0 +// (AGP 8.0's minimum) as well, where Spotless must not be applied. +if (VersionString.parse(gradle.gradleVersion) >= VersionString.parse("8.1")) { + apply plugin: "com.diffplug.spotless" +} group = 'com.deploygate' version = new File(rootProject.projectDir, 'src/main/resources/VERSION').text.trim() @@ -101,11 +105,9 @@ repositories { ext { releaseVersion = version // Be careful to set androidGradleVersion's default. Bytecode compatibility needs to drop backward compatibility. - androidGradleVersion = VersionString.parse(System.getenv("TEST_AGP_VERSION") ?: "4.2.0") + androidGradleVersion = VersionString.parse(System.getenv("TEST_AGP_VERSION") ?: "8.0.0") gradleVersion = VersionString.parse(gradle.gradleVersion) - requireJava11 = VersionString.parse("7.4.0") <= androidGradleVersion - requireGroovy3 = VersionString.parse("7.0") <= gradleVersion // Gradle 9.0+ bundles Groovy 4, which needs the matching Spock variant. requireGroovy4 = VersionString.parse("9.0") <= gradleVersion } @@ -152,15 +154,9 @@ task createClasspathManifest { // Gradle 9 removed the project-level sourceCompatibility/targetCompatibility convention, // so these must be configured on the `java` extension. java { - if (requireJava11) { - // since this version, android gradle plugin artifact is targeting Java 11 and we are using it in testing dependencies. - // We need to change target compatibility only for testing. - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_11 - } else { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } + // The minimum supported AGP is 8.0, which requires JDK 17, so target Java 17 directly. + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } dependencies { @@ -186,12 +182,9 @@ dependencies { if (requireGroovy4) { testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0' testImplementation 'org.spockframework:spock-junit4:2.3-groovy-4.0' - } else if (requireGroovy3) { + } else { testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0' testImplementation 'org.spockframework:spock-junit4:2.3-groovy-3.0' - } else { - testImplementation 'org.spockframework:spock-core:2.3-groovy-2.5' - testImplementation 'org.spockframework:spock-junit4:2.3-groovy-2.5' } // for ApplyPluginSpec @@ -264,41 +257,43 @@ def isRelease() { } allprojects { - // spotless requires Java11 so please comment out all spotless configurations if you wanna run on JRE 8 - spotless { - ratchetFrom 'origin/master' - - encoding 'UTF-8' - - java { - importOrder() - removeUnusedImports() - googleJavaFormat('1.16.0').aosp().reflowLongStrings() - formatAnnotations() - indentWithSpaces(4) - } - groovy { - importOrder() - excludeJava() - greclipse('4.26') - indentWithSpaces(4) - } - groovyGradle { - target '*.gradle' - greclipse('4.26') - indentWithSpaces(4) - } - format 'misc', { - target '*.md', '.gitignore', '*.properties' + // Spotless requires Java 17 and Gradle 8.1+; skip it where unavailable (e.g. the Gradle 8.0 acceptance matrix). + if (VersionString.parse(gradle.gradleVersion) >= VersionString.parse("8.1")) { + spotless { + ratchetFrom 'origin/master' + + encoding 'UTF-8' + + java { + importOrder() + removeUnusedImports() + googleJavaFormat('1.16.0').aosp().reflowLongStrings() + formatAnnotations() + leadingTabsToSpaces(4) + } + groovy { + importOrder() + excludeJava() + greclipse('4.26') + leadingTabsToSpaces(4) + } + groovyGradle { + target '*.gradle' + greclipse('4.26') + leadingTabsToSpaces(4) + } + format 'misc', { + target '*.md', '.gitignore', '*.properties' - trimTrailingWhitespace() - indentWithSpaces(4) - endWithNewline() - } + trimTrailingWhitespace() + leadingTabsToSpaces(4) + endWithNewline() + } - // TODO detect violations automatically - // DO: Use org.jetbrains.annotations.{NotNull,Nullable,VisibleForTesting} - // DON'T: Use javax.annotations.{Nonnull,Nullable}, Guavas VisibleForTesting + // TODO detect violations automatically + // DO: Use org.jetbrains.annotations.{NotNull,Nullable,VisibleForTesting} + // DON'T: Use javax.annotations.{Nonnull,Nullable}, Guavas VisibleForTesting + } } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f..1b33c55b 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 4d9ca164..d4081da4 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-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..23d15a93 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,11 @@ 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\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -133,22 +133,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,18 +200,28 @@ 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, 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" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" +# 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 ac1b06f9..5eed7ee8 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,8 +13,10 @@ @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 +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 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. +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 @@ -56,32 +59,34 @@ 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. +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 +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +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 diff --git a/src/main/groovy/com/deploygate/gradle/plugins/internal/gradle/GradleCompat.groovy b/src/main/groovy/com/deploygate/gradle/plugins/internal/gradle/GradleCompat.groovy index c34ee35d..2b5c4546 100644 --- a/src/main/groovy/com/deploygate/gradle/plugins/internal/gradle/GradleCompat.groovy +++ b/src/main/groovy/com/deploygate/gradle/plugins/internal/gradle/GradleCompat.groovy @@ -3,7 +3,6 @@ package com.deploygate.gradle.plugins.internal.gradle import com.deploygate.gradle.plugins.internal.VersionString import org.gradle.api.Project import org.gradle.api.provider.Provider -import org.gradle.util.GradleVersion import org.jetbrains.annotations.NotNull class GradleCompat { @@ -29,20 +28,15 @@ class GradleCompat { } /** - * Handle forUseAtConfigurationTime compatibility. + * Kept for source compatibility with existing call sites. * - * {@code Provider#forUseAtConfigurationTime()} is only required to read providers at - * configuration time on Gradle 6.x. It was deprecated in Gradle 7.4 (so calling it on 7.0+ - * emits a deprecation warning) and removed in Gradle 9.0. We therefore only invoke it on - * Gradle below 7.0 and return the provider untouched otherwise. + * {@code Provider#forUseAtConfigurationTime()} was only required on Gradle 6.x, was deprecated + * in Gradle 7.4, and removed in Gradle 9.0. The minimum supported Gradle is now 8.0, where + * reading providers at configuration time is the default, so this is a pass-through. * * ref: https://github.com/gradle/gradle/issues/15600 */ static Provider forUseAtConfigurationTime(Provider provider) { - if (GradleVersion.current().baseVersion >= GradleVersion.version("7.0")) { - return provider - } else { - return provider.forUseAtConfigurationTime() - } + return provider } } diff --git a/src/main/resources/VERSION b/src/main/resources/VERSION index c8e38b61..10c2c0c3 100644 --- a/src/main/resources/VERSION +++ b/src/main/resources/VERSION @@ -1 +1 @@ -2.9.0 +2.10.0