diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2a41259..d6d1d4d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,10 +11,15 @@ jobs: uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '17' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + - name: Build run: ./gradlew build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d9533ef..85bff98 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,8 @@ name: Publish on: push: - branches: [ main, hotfix ] + branches: [ main, hotfix , testRelease] + workflow_dispatch: jobs: publish: @@ -13,15 +14,20 @@ jobs: uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '17' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + - name: Build run: ./gradlew build - - name: Publish to Sonatype (for snapshots) or to Maven Central and GitHub Repository (for releases) + - name: Publish to Sonatype (for snapshots) or to Maven Central run: ./gradlew publish closeAndReleaseRepository env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} diff --git a/.github/workflows/update-gradle-wrapper.yml b/.github/workflows/update-gradle-wrapper.yml index afa016c..36de278 100644 --- a/.github/workflows/update-gradle-wrapper.yml +++ b/.github/workflows/update-gradle-wrapper.yml @@ -12,6 +12,12 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: '17' + - name: Update Gradle Wrapper uses: gradle-update/update-gradle-wrapper-action@v1 with: diff --git a/README.md b/README.md index 24d0e1d..b374f51 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,30 @@ Goal: "Less Code, Increased Productivity" Simplistic example: See also: + +## Release a new version to maven central + +Check gpg key and export: + +```bash +gpg --list-keys +gpg -K --keyid-format short +gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg +``` + +fill out gradle.properties with + +``` +signing.keyId= +signing.password= +signing.secretKeyRingFile=~/.gnupg/secring.gpg + +ossrhUsername= +ossrhPassword= +``` + +When all is set: (Warning: This step cannot be undone!) + +```terminal +./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository +``` diff --git a/build.gradle b/build.gradle index ad05d57..af83306 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ plugins { - id 'java-library' - id 'maven-publish' - id 'signing' - id 'org.openjfx.javafxplugin' version '0.1.0' - id "io.codearte.nexus-staging" version "0.30.0" + id 'java-library' + id 'maven-publish' + id 'signing' + id 'org.openjfx.javafxplugin' version '0.1.0' + id "io.github.gradle-nexus.publish-plugin" version "2.0.0" } allprojects { @@ -28,13 +28,13 @@ java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 - //withJavadocJar() + withJavadocJar() withSourcesJar() } javafx { version = "20" - modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.web', 'javafx.swing' ] + modules = ['javafx.controls', 'javafx.fxml', 'javafx.web', 'javafx.swing'] } dependencies { @@ -86,29 +86,6 @@ publishing { } } } - repositories { - maven { - name = "OSSRH" - def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" - def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" - url = isReleaseVersion ? releasesRepoUrl : snapshotsRepoUrl - credentials { - username = System.getenv("MAVEN_USERNAME") - password = System.getenv("MAVEN_PASSWORD") - } - } - // This currently only works for released versions, as github has problems with overwriting snapshots - if (isReleaseVersion) { - maven { - name = "GitHubPackages" - url = "https://maven.pkg.github.com/JabRef/afterburner.fx" - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - } - } } signing { @@ -116,13 +93,14 @@ signing { useInMemoryPgpKeys(System.getenv("SIGNING_KEY"), System.getenv("SIGNING_PASSWORD")) sign publishing.publications.mavenJava } - -nexusStaging { - username = System.getenv("MAVEN_USERNAME") - password = System.getenv("MAVEN_PASSWORD") +nexusPublishing { + repositories { + sonatype { //only for users registered in Sonatype after 24 Feb 2021 + username = System.getenv("MAVEN_USERNAME") + password = System.getenv("MAVEN_PASSWORD") + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + } + } } -// Don't publish snapshots to Maven Central -closeAndReleaseRepository.onlyIf { isReleaseVersion } -closeRepository.onlyIf { isReleaseVersion } -releaseRepository.onlyIf { isReleaseVersion } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135..e644113 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 ac72c34..b82aa23 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 0adc8e1..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -145,7 +145,7 @@ 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=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -202,11 +202,11 @@ fi # 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 $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. +# 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" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..25da30d 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 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 @@ -57,11 +57,11 @@ 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 diff --git a/src/main/java/com/airhacks/afterburner/injection/PresenterFactory.java b/src/main/java/com/airhacks/afterburner/injection/PresenterFactory.java index f7af926..8b3bf97 100644 --- a/src/main/java/com/airhacks/afterburner/injection/PresenterFactory.java +++ b/src/main/java/com/airhacks/afterburner/injection/PresenterFactory.java @@ -106,7 +106,7 @@ public void injectMembers(Object controller, Function injectionC /** * Populate the given object. - * For example, set all fields annotated with {@link javax.inject.Inject}. + * For example, set all fields annotated with {@link jakarta.inject.Inject}. * * @param instance the object to inject members into * @param injectionContext a cache of already instantiated and initialized instances diff --git a/src/main/java/com/airhacks/afterburner/views/ResourceLocator.java b/src/main/java/com/airhacks/afterburner/views/ResourceLocator.java index 8efa21f..c9f0ceb 100644 --- a/src/main/java/com/airhacks/afterburner/views/ResourceLocator.java +++ b/src/main/java/com/airhacks/afterburner/views/ResourceLocator.java @@ -68,11 +68,7 @@ static ResourceLocator discover() { /** * This method method replaces the standard afterburner dependency * injection. - * - * @param the type of the presenter - * @param clazz presenter class containing the default constructor. - * @param injectionContext a cache of already instantiated and initialized - * instances. + * @param name The name of the bundle * @return a fully initialized presenter with injected dependencies. */ ResourceBundle getResourceBundle(String name); diff --git a/src/main/java/com/airhacks/afterburner/views/ViewLoader.java b/src/main/java/com/airhacks/afterburner/views/ViewLoader.java index 2e26e25..283f9a2 100644 --- a/src/main/java/com/airhacks/afterburner/views/ViewLoader.java +++ b/src/main/java/com/airhacks/afterburner/views/ViewLoader.java @@ -106,7 +106,7 @@ private static ExecutorService getExecutorService() { /** * Sets the given class as controller. * - * @implNote We don't use {@link FXMLLoader#setController(Object)} since then the {@code fx:controller} attribute + * We don't use {@link FXMLLoader#setController(Object)} since then the {@code fx:controller} attribute * is no longer allowed in the fxml file and we loose IDE support. */ public ViewLoader controller(Object root) { @@ -141,8 +141,8 @@ public ViewLoader inject(Function injectionContext) { /** * Sets the root of the object hierarchy. The value passed to this method - * is used as the value of the {@link } tag. This method - * must be called prior to loading the document when using {@link }. + * is used as the value of the {@code } tag. This method + * must be called prior to loading the document when using {@code }. * * @param root the object used as the root */