diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index e69de29..0000000 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index 284ddcd..0000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build -on: - push: - branches: - - main - pull_request: -jobs: - check: - runs-on: ubuntu-latest - strategy: - matrix: - java: [8, 11, 15] - fail-fast: false - steps: - - name: "Checkout repo" - uses: "actions/checkout@v2" - with: - fetch-depth: 0 - - name: "Setup Java ${{ matrix.java }}" - uses: "actions/setup-java@v1" - with: - java-version: ${{ matrix.java }} - - name: "Validate Gradle Wrapper" - uses: gradle/wrapper-validation-action@v1 - - name: "Cache Gradle wrapper" - uses: "actions/cache@v2" - with: - path: | - ~/.gradle/wrapper - ~/.gradle/notifications - key: "gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}" - - name: "Cache Gradle dependencies" - uses: "actions/cache@v2" - with: - path: "~/.gradle/caches" - key: "gradle-caches-${{ runner.os }}-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }}" - - name: "Gradle check" - run: "./gradlew check --continue" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..0f27d03 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,33 @@ +name: CI +on: + push: + branches: [main] + pull_request: +jobs: + ci: + runs-on: ubuntu-latest + env: + GRADLE_OPTS: -Dorg.gradle.java.installations.fromEnv=JAVA_HOME_8_x64,JAVA_HOME_11_x64,JAVA_HOME_17_x64 + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Java 11 + uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 11 + - name: Setup Java 17 + uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 17 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Gradle check + run: ./gradlew check --continue diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 11445f1..2bd83a8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,67 +1,33 @@ name: Release on: push: - tags: - - "*" + tags: ["*"] jobs: - check: + release: runs-on: ubuntu-latest - strategy: - matrix: - java: [8, 11, 15] - fail-fast: false steps: - - name: "Checkout repo" - uses: "actions/checkout@v2" + - name: Checkout repo + uses: actions/checkout@v2 with: fetch-depth: 0 - - name: "Setup Java ${{ matrix.java }}" - uses: "actions/setup-java@v1" - with: - java-version: ${{ matrix.java }} - - name: "Validate Gradle Wrapper" - uses: gradle/wrapper-validation-action@v1 - - name: "Cache Gradle wrapper" - uses: "actions/cache@v2" - with: - path: | - ~/.gradle/wrapper - ~/.gradle/notifications - key: "gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}" - - name: "Cache Gradle dependencies" - uses: "actions/cache@v2" - with: - path: "~/.gradle/caches" - key: "gradle-caches-${{ runner.os }}-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }}" - - name: "Gradle check" - run: "./gradlew check --continue" - publish: - runs-on: ubuntu-latest - needs: check - steps: - - name: "Checkout repo" - uses: "actions/checkout@v2" - with: - fetch-depth: 0 - - name: "Setup Java" - uses: "actions/setup-java@v1" - with: - java-version: 8 - - name: "Cache Gradle wrapper" - uses: "actions/cache@v2" - with: - path: | - ~/.gradle/wrapper - ~/.gradle/notifications - key: "gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}" - - name: "Cache Gradle dependencies" - uses: "actions/cache@v2" - with: - path: "~/.gradle/caches" - key: "gradle-caches-${{ runner.os }}-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }}" - - name: "Gradle publish" + - name: Setup Java 11 + uses: actions/setup-java@v2 + with: + distribution: zulu + java-version: 11 + - name: Setup Java 17 + uses: actions/setup-java@v2 + with: + distribution: zulu + java-version: 17 + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Gradle publish env: - BINTRAY_USER: ${{ secrets.BINTRAY_USER }} - BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingPassphrase: ${{ secrets.PGP_SIGNING_PASSPHRASE }} GRADLE_OPTS: "-Dorg.gradle.project.gradle.publish.key=${{ secrets.GRADLE_PLUGIN_KEY }} -Dorg.gradle.project.gradle.publish.secret=${{ secrets.GRADLE_PLUGIN_SECRET }}" - run: "./gradlew publish publishPlugins" + run: ./gradlew publishAllPublicationsToCentralReleasesRepository diff --git a/.stutter/java15.lock b/.stutter/java15.lock deleted file mode 100644 index fdbbc96..0000000 --- a/.stutter/java15.lock +++ /dev/null @@ -1,4 +0,0 @@ -# DO NOT MODIFY: Generated by Stutter plugin. -6.3 -6.6.1 -6.7-rc-1 diff --git a/.stutter/java8.lock b/.stutter/java8.lock deleted file mode 100644 index cb5bb97..0000000 --- a/.stutter/java8.lock +++ /dev/null @@ -1,6 +0,0 @@ -# DO NOT MODIFY: Generated by Stutter plugin. -5.0 -5.6.4 -6.0.1 -6.6.1 -6.7-rc-1 diff --git a/README.md b/README.md index 2576dac..30881b1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,15 @@ # gradle-git-publish -![](https://github.com/ajoberstar/gradle-git-publish/workflows/.github/workflows/build.yaml/badge.svg) +[![CI](https://github.com/ajoberstar/gradle-git-publish/actions/workflows/ci.yaml/badge.svg)](https://github.com/ajoberstar/gradle-git-publish/actions/workflows/ci.yaml) ## Project News +### Newest versions are on Maven Central + +As of 3.0.1, gradle-git-publish is published to Maven Central. + +This project is no longer directly published to the Gradle Plugin Portal, but since the portal proxies Maven Central you can still access it through the portal. The only side effect is that [the portal](https://plugins.gradle.org/plugin/org.ajoberstar.git-publish) will no longer list the latest version. Use this repo or [search.maven.org](https://search.maven.org/search?q=g:org.ajoberstar.git-publish) to find the latest version. + ### Retirement of Bintray/JCenter This project was previously uploaded to JCenter, which is being retired by JFrog on May 1st 2021. @@ -42,29 +48,12 @@ changes and compatibility with Java and Gradle versions. ### Applying the Plugin -**Plugins DSL** - ```groovy plugins { id 'org.ajoberstar.git-publish' version '' } ``` -**Classic** - -```groovy -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'org.ajoberstar:gradle-git-publish:' - } -} - -apply plugin: 'org.ajoberstar.git-publish' -``` - ### Configuration **NOTE:** In general, there are no default values here. The main exception is that the `repoUri` and `referenceRepoUri` will be automatically set if you use the `org.ajoberstar.grgit` plugin to your project's origin repo URI. diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 881420d..0000000 --- a/build.gradle +++ /dev/null @@ -1,81 +0,0 @@ -plugins { - id 'org.ajoberstar.grgit' - id 'org.ajoberstar.reckon' - - id 'maven-publish' - id 'java-gradle-plugin' - id 'java-library' - id 'groovy' - - id 'com.gradle.plugin-publish' - id 'org.ajoberstar.stutter' -} - -apply from: 'gradle/spotless.gradle' -apply from: 'gradle/locking.gradle' -apply from: 'gradle/bintray.gradle' - -reckon { - scopeFromProp() - stageFromProp('alpha', 'beta', 'rc', 'final') -} - -group = 'org.ajoberstar' - -sourceCompatibility = 8 - -java { - withSourcesJar() - withJavadocJar() -} - -repositories { - jcenter() -} - -dependencies { - // gradle - compileOnly gradleApi() - - // groovy - compileOnly localGroovy() - - // grgit - api 'org.ajoberstar.grgit:grgit-core:latest.release' - compatTestImplementation 'org.ajoberstar.grgit:grgit-core:latest.release' - - // testing - compatTestImplementation gradleTestKit() - compatTestImplementation 'org.spockframework:spock-core:1.3-groovy-2.5' -} - -stutter { - sparse = true - java(8) { - compatibleRange '5.0' - } - java(15) { - compatibleRange '6.3' - } -} - -pluginBundle { - website = 'https://github.com/ajoberstar/gradle-git-publish' - vcsUrl = 'https://github.com/ajoberstar/gradle-git-publish.git' - description = 'Publishing to Git repositories' - plugins { - publishPlugin { - id = 'org.ajoberstar.git-publish' - displayName = 'Git Publish Plugin' - tags = ['publish', 'git'] - } - } - mavenCoordinates { - groupId = project.group - artifactId = project.name - version = project.version - } -} - -// remove duplicate publication -gradlePlugin.automatedPublishing = false diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..cd7ea31 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,91 @@ +plugins { + id("org.ajoberstar.defaults.gradle-plugin") + groovy + + id("org.ajoberstar.stutter") + id("org.ajoberstar.grgit") + id("org.ajoberstar.reckon") +} + +group = "org.ajoberstar.git-publish" +description = "Gradle plugin for publishing to Git repositories" + +reckon { + scopeFromProp() + stageFromProp("beta", "rc", "final") +} + +mavenCentral { + developerName.set("Andrew Oberstar") + developerEmail.set("ajoberstar@gmail.com") + githubOwner.set("ajoberstar") + githubRepository.set("reckon") +} + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(8)) + } +} + +dependencies { + // grgit + api("org.ajoberstar.grgit:grgit-core:[4.0,5.0[") + compatTestImplementation("org.ajoberstar.grgit:grgit-core:[4.0,5.0[") + + // testing + compatTestImplementation(gradleTestKit()) + compatTestImplementation("org.spockframework:spock-core:2.0-groovy-3.0") +} + +tasks.named("jar") { + manifest { + attributes.put("Automatic-Module-Name", "org.ajoberstar.git.publish.gradle") + } +} + +tasks.withType { + useJUnitPlatform() +} + +stutter { + val java8 by matrices.creating { + javaToolchain { + languageVersion.set(JavaLanguageVersion.of(8)) + } + gradleVersions { + compatibleRange("5.0") + } + } + val java11 by matrices.creating { + javaToolchain { + languageVersion.set(JavaLanguageVersion.of(11)) + } + gradleVersions { + compatibleRange("5.0") + } + } + val java17 by matrices.creating { + javaToolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } + gradleVersions { + compatibleRange("7.3") + } + } +} + +tasks.named("check") { + dependsOn(tasks.named("compatTest")) +} + +gradlePlugin { + plugins { + create("plugin") { + id = "org.ajoberstar.git-publish" + displayName = "Git Publish Plugin" + description = "Gradle plugin for publishing to Git repositories" + implementationClass = "org.ajoberstar.gradle.git.publish.GitPublishPlugin" + } + } +} \ No newline at end of file diff --git a/gradle.lockfile b/gradle.lockfile new file mode 100644 index 0000000..02b9845 --- /dev/null +++ b/gradle.lockfile @@ -0,0 +1,24 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +cglib:cglib-nodep:3.3.0=compatTestCompileClasspath,compatTestRuntimeClasspath +com.googlecode.javaewah:JavaEWAH:1.1.12=compatTestCompileClasspath,compatTestRuntimeClasspath,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy:1.11.0=compatTestCompileClasspath,compatTestRuntimeClasspath +org.ajoberstar.grgit:grgit-core:4.1.1=compatTestCompileClasspath,compatTestRuntimeClasspath,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apiguardian:apiguardian-api:1.1.0=compatTestCompileClasspath,compatTestRuntimeClasspath +org.assertj:assertj-core:3.16.1=compatTestCompileClasspath,compatTestRuntimeClasspath +org.codehaus.groovy:groovy:3.0.8=compatTestCompileClasspath,compatTestRuntimeClasspath +org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r=compatTestCompileClasspath,compatTestRuntimeClasspath,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hamcrest:hamcrest:2.2=compatTestCompileClasspath,compatTestRuntimeClasspath +org.jetbrains:annotations:20.1.0=compatTestCompileClasspath,compatTestRuntimeClasspath +org.junit.platform:junit-platform-commons:1.7.2=compatTestCompileClasspath,compatTestRuntimeClasspath +org.junit.platform:junit-platform-engine:1.7.2=compatTestCompileClasspath,compatTestRuntimeClasspath +org.junit.platform:junit-platform-launcher:1.7.2=compatTestCompileClasspath,compatTestRuntimeClasspath +org.junit.platform:junit-platform-testkit:1.7.2=compatTestCompileClasspath,compatTestRuntimeClasspath +org.junit:junit-bom:5.7.2=compatTestCompileClasspath,compatTestRuntimeClasspath +org.objenesis:objenesis:3.2=compatTestCompileClasspath,compatTestRuntimeClasspath +org.opentest4j:opentest4j:1.2.0=compatTestCompileClasspath,compatTestRuntimeClasspath +org.ow2.asm:asm:9.1=compatTestCompileClasspath,compatTestRuntimeClasspath +org.slf4j:slf4j-api:1.7.30=compatTestCompileClasspath,compatTestRuntimeClasspath,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.spockframework:spock-core:2.0-groovy-3.0=compatTestCompileClasspath,compatTestRuntimeClasspath +empty= diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle deleted file mode 100644 index f832de6..0000000 --- a/gradle/bintray.gradle +++ /dev/null @@ -1,16 +0,0 @@ -allprojects { - plugins.withId('maven-publish') { - publishing { - repositories { - maven { - name = 'bintray' - url = 'https://api.bintray.com/maven/ajoberstar/maven/gradle-git-publish/;publish=1' - credentials { - username = System.env['BINTRAY_USER'] - password = System.env['BINTRAY_KEY'] - } - } - } - } - } -} diff --git a/gradle/dependency-locks/compatTestCompileClasspath.lockfile b/gradle/dependency-locks/compatTestCompileClasspath.lockfile deleted file mode 100644 index e788f49..0000000 --- a/gradle/dependency-locks/compatTestCompileClasspath.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# This is a Gradle generated file for dependency locking. -# Manual edits can break the build and are not advised. -# This file is expected to be part of source control. -com.googlecode.javaewah:JavaEWAH:1.1.7 -junit:junit:4.12 -org.ajoberstar.grgit:grgit-core:4.1.0 -org.codehaus.groovy:groovy-json:2.5.4 -org.codehaus.groovy:groovy-macro:2.5.4 -org.codehaus.groovy:groovy-nio:2.5.4 -org.codehaus.groovy:groovy-sql:2.5.4 -org.codehaus.groovy:groovy-templates:2.5.4 -org.codehaus.groovy:groovy-test:2.5.4 -org.codehaus.groovy:groovy-xml:2.5.4 -org.codehaus.groovy:groovy:2.5.4 -org.eclipse.jgit:org.eclipse.jgit:5.9.0.202009080501-r -org.hamcrest:hamcrest-core:1.3 -org.slf4j:slf4j-api:1.7.2 -org.spockframework:spock-core:1.3-groovy-2.5 diff --git a/gradle/dependency-locks/compatTestRuntimeClasspath.lockfile b/gradle/dependency-locks/compatTestRuntimeClasspath.lockfile deleted file mode 100644 index e788f49..0000000 --- a/gradle/dependency-locks/compatTestRuntimeClasspath.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# This is a Gradle generated file for dependency locking. -# Manual edits can break the build and are not advised. -# This file is expected to be part of source control. -com.googlecode.javaewah:JavaEWAH:1.1.7 -junit:junit:4.12 -org.ajoberstar.grgit:grgit-core:4.1.0 -org.codehaus.groovy:groovy-json:2.5.4 -org.codehaus.groovy:groovy-macro:2.5.4 -org.codehaus.groovy:groovy-nio:2.5.4 -org.codehaus.groovy:groovy-sql:2.5.4 -org.codehaus.groovy:groovy-templates:2.5.4 -org.codehaus.groovy:groovy-test:2.5.4 -org.codehaus.groovy:groovy-xml:2.5.4 -org.codehaus.groovy:groovy:2.5.4 -org.eclipse.jgit:org.eclipse.jgit:5.9.0.202009080501-r -org.hamcrest:hamcrest-core:1.3 -org.slf4j:slf4j-api:1.7.2 -org.spockframework:spock-core:1.3-groovy-2.5 diff --git a/gradle/dependency-locks/compileClasspath.lockfile b/gradle/dependency-locks/compileClasspath.lockfile deleted file mode 100644 index c67983c..0000000 --- a/gradle/dependency-locks/compileClasspath.lockfile +++ /dev/null @@ -1,7 +0,0 @@ -# This is a Gradle generated file for dependency locking. -# Manual edits can break the build and are not advised. -# This file is expected to be part of source control. -com.googlecode.javaewah:JavaEWAH:1.1.7 -org.ajoberstar.grgit:grgit-core:4.1.0 -org.eclipse.jgit:org.eclipse.jgit:5.9.0.202009080501-r -org.slf4j:slf4j-api:1.7.2 diff --git a/gradle/dependency-locks/runtimeClasspath.lockfile b/gradle/dependency-locks/runtimeClasspath.lockfile deleted file mode 100644 index c67983c..0000000 --- a/gradle/dependency-locks/runtimeClasspath.lockfile +++ /dev/null @@ -1,7 +0,0 @@ -# This is a Gradle generated file for dependency locking. -# Manual edits can break the build and are not advised. -# This file is expected to be part of source control. -com.googlecode.javaewah:JavaEWAH:1.1.7 -org.ajoberstar.grgit:grgit-core:4.1.0 -org.eclipse.jgit:org.eclipse.jgit:5.9.0.202009080501-r -org.slf4j:slf4j-api:1.7.2 diff --git a/gradle/dependency-locks/testCompileClasspath.lockfile b/gradle/dependency-locks/testCompileClasspath.lockfile deleted file mode 100644 index c67983c..0000000 --- a/gradle/dependency-locks/testCompileClasspath.lockfile +++ /dev/null @@ -1,7 +0,0 @@ -# This is a Gradle generated file for dependency locking. -# Manual edits can break the build and are not advised. -# This file is expected to be part of source control. -com.googlecode.javaewah:JavaEWAH:1.1.7 -org.ajoberstar.grgit:grgit-core:4.1.0 -org.eclipse.jgit:org.eclipse.jgit:5.9.0.202009080501-r -org.slf4j:slf4j-api:1.7.2 diff --git a/gradle/dependency-locks/testRuntimeClasspath.lockfile b/gradle/dependency-locks/testRuntimeClasspath.lockfile deleted file mode 100644 index c67983c..0000000 --- a/gradle/dependency-locks/testRuntimeClasspath.lockfile +++ /dev/null @@ -1,7 +0,0 @@ -# This is a Gradle generated file for dependency locking. -# Manual edits can break the build and are not advised. -# This file is expected to be part of source control. -com.googlecode.javaewah:JavaEWAH:1.1.7 -org.ajoberstar.grgit:grgit-core:4.1.0 -org.eclipse.jgit:org.eclipse.jgit:5.9.0.202009080501-r -org.slf4j:slf4j-api:1.7.2 diff --git a/gradle/locking.gradle b/gradle/locking.gradle deleted file mode 100644 index 8603d6a..0000000 --- a/gradle/locking.gradle +++ /dev/null @@ -1,20 +0,0 @@ -allprojects { - plugins.withId('java-base') { - sourceSets.all { sourceSet -> - configurations[sourceSet.compileClasspathConfigurationName].resolutionStrategy.activateDependencyLocking() - configurations[sourceSet.runtimeClasspathConfigurationName].resolutionStrategy.activateDependencyLocking() - } - - task lock { - doFirst { - assert gradle.startParameter.writeDependencyLocks - } - doLast { - sourceSets.all { sourceSet -> - configurations[sourceSet.compileClasspathConfigurationName].resolve() - configurations[sourceSet.runtimeClasspathConfigurationName].resolve() - } - } - } - } -} diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle deleted file mode 100644 index 5ee61b8..0000000 --- a/gradle/spotless.gradle +++ /dev/null @@ -1,27 +0,0 @@ -allprojects { - plugins.withId('com.diffplug.spotless') { - spotless { - plugins.withId('java') { - java { - importOrder 'java', 'javax', '' - removeUnusedImports() - eclipse().configFile(project.rootProject.file('gradle/eclipse-java-formatter.xml')) - } - } - plugins.withId('groovy') { - format 'groovy', { - target 'src/**/*.groovy' - trimTrailingWhitespace() - indentWithSpaces(2) - endWithNewline() - } - } - format 'gradle', { - target '**/*.gradle' - trimTrailingWhitespace() - indentWithSpaces(2) - endWithNewline() - } - } - } -} 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 12d38de..2e6e589 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.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0..c53aefa 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/settings.gradle b/settings.gradle deleted file mode 100644 index fe3f141..0000000 --- a/settings.gradle +++ /dev/null @@ -1,13 +0,0 @@ -pluginManagement { - plugins { - id 'com.gradle.plugin-publish' version '0.12.0' - - id 'org.ajoberstar.grgit' version '4.0.2' - id 'org.ajoberstar.reckon' version '0.12.0' - id 'org.ajoberstar.stutter' version '0.5.1' - - id 'com.diffplug.spotless' version '5.5.2' - } -} - -rootProject.name = 'gradle-git-publish' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..d687b3a --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,20 @@ +pluginManagement { + plugins { + id("org.ajoberstar.defaults.gradle-plugin") version "0.17.1" + + id("org.ajoberstar.grgit") version "4.1.1" + id("org.ajoberstar.reckon") version "0.13.1" + id("org.ajoberstar.stutter") version "0.7.0" + + id("com.diffplug.spotless") version "6.2.1" + } +} + +dependencyResolutionManagement { + repositories { + mavenCentral() + } + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) +} + +rootProject.name = "gradle-git-publish" diff --git a/src/compatTest/groovy/org/ajoberstar/gradle/git/publish/BaseCompatTest.groovy b/src/compatTest/groovy/org/ajoberstar/gradle/git/publish/BaseCompatTest.groovy index a555645..f12df25 100644 --- a/src/compatTest/groovy/org/ajoberstar/gradle/git/publish/BaseCompatTest.groovy +++ b/src/compatTest/groovy/org/ajoberstar/gradle/git/publish/BaseCompatTest.groovy @@ -2,31 +2,36 @@ package org.ajoberstar.gradle.git.publish import spock.lang.IgnoreIf import spock.lang.Specification +import spock.lang.TempDir + import org.ajoberstar.grgit.Grgit import org.gradle.testkit.runner.GradleRunner import org.gradle.testkit.runner.BuildResult import org.gradle.testkit.runner.TaskOutcome import org.gradle.testkit.runner.UnexpectedBuildFailure -import org.junit.Rule -import org.junit.rules.TemporaryFolder class BaseCompatTest extends Specification { - @Rule TemporaryFolder tempDir = new TemporaryFolder() + @TempDir File tempDir File projectDir File buildFile Grgit remote def setup() { - projectDir = tempDir.newFolder('project') + projectDir = new File(tempDir, 'project') buildFile = projectFile('build.gradle') - def remoteDir = tempDir.newFolder('remote') + def remoteDir = new File(tempDir, 'remote') remote = Grgit.init(dir: remoteDir) remoteFile('master.txt') << 'contents here' remote.add(patterns: ['.']) remote.commit(message: 'first commit') + // handle different init branches to keep existing tests the same + if (remote.branch.current().name != 'master') { + remote.checkout(branch: 'master', createBranch: true) + } + remote.checkout(branch: 'gh-pages', orphan: true) remote.remove(patterns: ['master.txt']) remoteFile('index.md') << '# This Page is Awesome!' @@ -89,7 +94,7 @@ gitPublish { def 'reset pulls from reference repo if available before pulling from remote'() { given: - def referenceDir = tempDir.newFolder('reference') + def referenceDir = new File(tempDir, 'reference') def reference = Grgit.clone(dir: referenceDir, uri: remote.repository.rootDir.toURI()) reference.checkout(branch: 'gh-pages', createBranch: true) // add a file that will get fetched but not pushed @@ -275,13 +280,18 @@ gitPublish { def 'existing working repo is scrapped if different remote'() { given: - def badRemoteDir = tempDir.newFolder('badRemote') + def badRemoteDir = new File(tempDir, 'badRemote') def badRemote = Grgit.init(dir: badRemoteDir) new File(badRemoteDir, 'master.txt') << 'bad contents here' badRemote.add(patterns: ['.']) badRemote.commit(message: 'bad first commit') + // handle different init branches to keep existing tests the same + if (badRemote.branch.current().name != 'master') { + badRemote.checkout(branch: 'master', createBranch: true) + } + def working = Grgit.clone(dir: "${projectDir}/build/gitPublish", uri: badRemote.repository.rootDir.toURI()) working.checkout(branch: 'gh-pages', startPoint: 'origin/master', createBranch: true) working.close() diff --git a/src/main/resources/META-INF/gradle-plugins/org.ajoberstar.git-publish.properties b/src/main/resources/META-INF/gradle-plugins/org.ajoberstar.git-publish.properties deleted file mode 100644 index 8c72be7..0000000 --- a/src/main/resources/META-INF/gradle-plugins/org.ajoberstar.git-publish.properties +++ /dev/null @@ -1 +0,0 @@ -implementation-class=org.ajoberstar.gradle.git.publish.GitPublishPlugin diff --git a/stutter.lockfile b/stutter.lockfile new file mode 100644 index 0000000..30b32ae --- /dev/null +++ b/stutter.lockfile @@ -0,0 +1,4 @@ +# DO NOT MODIFY: Generated by Stutter plugin. +java11=5.0,5.6.4,6.0.1,6.9.2,7.0.2,7.4 +java17=7.3.3,7.4 +java8=5.0,5.6.4,6.0.1,6.9.2,7.0.2,7.4