From 7d256adde6e761aacd2070bf1a67b72ae7c0e121 Mon Sep 17 00:00:00 2001 From: soloturn Date: Fri, 11 Feb 2022 09:40:17 +0100 Subject: [PATCH 1/4] switch default build to gradle, fixes #47 --- .github/workflows/ci-gradle.yml | 24 ++++++++++++------------ .github/workflows/ci.yml | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci-gradle.yml b/.github/workflows/ci-gradle.yml index 9057e9c6859..33d9fcb5f1e 100644 --- a/.github/workflows/ci-gradle.yml +++ b/.github/workflows/ci-gradle.yml @@ -1,18 +1,18 @@ name: CI gradle on: -# create: -# pull_request: -# types: [ opened, synchronize, reopened ] -# paths-ignore: -# - '*.md' -# - 'docs/**' -# push: -# branches: -# - master -# paths-ignore: -# - '*.md' -# - 'docs/**' + create: + pull_request: + types: [ opened, synchronize, reopened ] + paths-ignore: + - '*.md' + - 'docs/**' + push: + branches: + - master + paths-ignore: + - '*.md' + - 'docs/**' workflow_dispatch: defaults: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aab795b2dab..022efe2b730 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: - create: - pull_request: - types: [ opened, synchronize, reopened ] - paths-ignore: - - '*.md' - - 'docs/**' - push: - branches: - - master - paths-ignore: - - '*.md' - - 'docs/**' +# create: +# pull_request: +# types: [ opened, synchronize, reopened ] +# paths-ignore: +# - '*.md' +# - 'docs/**' +# push: +# branches: +# - master +# paths-ignore: +# - '*.md' +# - 'docs/**' workflow_dispatch: defaults: From 12fce2cfd6176ad33e4c7524fcb2d3b41c34d906 Mon Sep 17 00:00:00 2001 From: soloturn Date: Fri, 11 Feb 2022 10:00:05 +0100 Subject: [PATCH 2/4] no gradle daemon so windows 2019 can use the cache. in case somebody wonders about the confusing message that a daemon is started, an explanation here: https://discuss.gradle.org/t/no-daemon-switch-ineffective-if-jvm-settings-cause-new-fork/14919/7 --- .github/workflows/ci-gradle.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-gradle.yml b/.github/workflows/ci-gradle.yml index 33d9fcb5f1e..9c949f50c9a 100644 --- a/.github/workflows/ci-gradle.yml +++ b/.github/workflows/ci-gradle.yml @@ -93,10 +93,10 @@ jobs: # Compile / Test / Package are separate steps so the reason for any failure is more obvious in GitHub UI - name: Compile - run: gradle -q compileJava + run: gradle -q compileJava --no-daemon - name: Test - run: gradle -q test + run: gradle -q test --no-daemon # The repeated "matrix.release_from_this_build" checks are messy, but I have not found a simple way to avoid them # See https://github.com/actions/runner/issues/662 @@ -121,6 +121,7 @@ jobs: GPG_PASSPHRASE: ${{ secrets.ARTIFACT_SIGNING_PASSPHRASE }} run: | gradle sign "-Pversion=${POM_VERSION}"\ + "--no-daemon" \ "-Psigning.gnupg.keyName=${GPG_KEYNAME}" \ "-Psigning.gnupg.passphrase=${GPG_PASSPHRASE}" From ad222ccc1bcf70ec61416613156d97a7b2472c12 Mon Sep 17 00:00:00 2001 From: soloturn Date: Fri, 11 Feb 2022 11:13:46 +0100 Subject: [PATCH 3/4] build.gradle.kts, project uses tab, not space indent --- build.gradle.kts | 120 +++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 37d2f291bc4..66c0b840cf6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,54 +7,54 @@ val javacRelease = (project.findProperty("javacRelease") ?: "8") as String plugins { - java - `maven-publish` - signing + java + `maven-publish` + signing } repositories { - mavenLocal() - mavenCentral() + mavenLocal() + mavenCentral() } dependencies { - compileOnly("org.apache.ant:ant:1.10.12") - testImplementation("org.assertj:assertj-core:3.22.0") - testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") - testImplementation("org.scilab.forge:jlatexmath:1.0.7") + compileOnly("org.apache.ant:ant:1.10.12") + testImplementation("org.assertj:assertj-core:3.22.0") + testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") + testImplementation("org.scilab.forge:jlatexmath:1.0.7") } group = "net.sourceforge.plantuml" description = "PlantUML" java { - withSourcesJar() - withJavadocJar() + withSourcesJar() + withJavadocJar() } sourceSets { - main { - java { - srcDirs("src") - } - resources { - srcDirs("src") - include("**/graphviz.dat") - include("**/*.png") - include("**/*.svg") - include("**/*.txt") - } - } - test { - java { - srcDirs("test") - } - resources { - srcDirs(".") - include("skin/**/*.skin") - include("themes/**/*.puml") - } - } + main { + java { + srcDirs("src") + } + resources { + srcDirs("src") + include("**/graphviz.dat") + include("**/*.png") + include("**/*.svg") + include("**/*.txt") + } + } + test { + java { + srcDirs("test") + } + resources { + srcDirs(".") + include("skin/**/*.skin") + include("themes/**/*.puml") + } + } } tasks.compileJava { @@ -66,50 +66,50 @@ tasks.compileJava { } tasks.withType { - manifest { - attributes["Main-Class"] = "net.sourceforge.plantuml.Run" - attributes["Implementation-Version"] = archiveVersion - attributes["Build-Jdk-Spec"] = System.getProperty("java.specification.version") - from("manifest.txt") - } + manifest { + attributes["Main-Class"] = "net.sourceforge.plantuml.Run" + attributes["Implementation-Version"] = archiveVersion + attributes["Build-Jdk-Spec"] = System.getProperty("java.specification.version") + from("manifest.txt") + } - dependsOn(configurations.runtimeClasspath) - from({ - configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) } - }) + dependsOn(configurations.runtimeClasspath) + from({ + configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) } + }) // source sets for java and resources are on "src", only put once into the jar duplicatesStrategy = org.gradle.api.file.DuplicatesStrategy.EXCLUDE - from("skin") { into("skin") } - from("stdlib") { into("stdlib") } - from("svg") { into("svg") } - from("themes") { into("themes") } + from("skin") { into("skin") } + from("stdlib") { into("stdlib") } + from("svg") { into("svg") } + from("themes") { into("themes") } } publishing { - publications.create("maven") { - from(components["java"]) - } + publications.create("maven") { + from(components["java"]) + } } tasks.withType { - options.encoding = "UTF-8" + options.encoding = "UTF-8" } tasks.withType { - options { - this as StandardJavadocDocletOptions - addBooleanOption("Xdoclint:none", true) - addStringOption("Xmaxwarns", "1") - } + options { + this as StandardJavadocDocletOptions + addBooleanOption("Xdoclint:none", true) + addStringOption("Xmaxwarns", "1") + } } tasks.test { - useJUnitPlatform() - testLogging.showStandardStreams = true + useJUnitPlatform() + testLogging.showStandardStreams = true } signing { - useGpgCmd() - sign(publishing.publications["maven"]) + useGpgCmd() + sign(publishing.publications["maven"]) } From 8603c8da91f050c698c141b8735d66edf778d94d Mon Sep 17 00:00:00 2001 From: soloturn Date: Fri, 11 Feb 2022 11:14:55 +0100 Subject: [PATCH 4/4] gradle, build and sign artifacts in 2 steps release is not from windows 2019, daemon can be used --- .github/workflows/ci-gradle.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-gradle.yml b/.github/workflows/ci-gradle.yml index 9c949f50c9a..92d94bedd05 100644 --- a/.github/workflows/ci-gradle.yml +++ b/.github/workflows/ci-gradle.yml @@ -78,8 +78,6 @@ jobs: os: ubuntu-20.04 java_version: 8 runs-on: ${{ matrix.os }} - env: - SIGN_ARTIFACTS: ${{ secrets.ARTIFACT_SIGNING_KEY != '' }} steps: - name: Checkout the repository uses: actions/checkout@v2 @@ -101,6 +99,10 @@ jobs: # The repeated "matrix.release_from_this_build" checks are messy, but I have not found a simple way to avoid them # See https://github.com/actions/runner/issues/662 + - name: Create artifacts + if: matrix.release_from_this_build + run: gradle -q build -x test + - name: Setup gpg if: matrix.release_from_this_build && env.ARTIFACT_SIGNING_KEY id: gpg @@ -114,14 +116,13 @@ jobs: key_id="$(echo "${ARTIFACT_SIGNING_KEY}" | gpg --batch --show-keys --with-colons | awk -F: '$1 == "sec" { print $5 }')" echo "::set-output name=key_id::${key_id}" - - name: Create artifacts - if: matrix.release_from_this_build + - name: Sign artifacts + if: matrix.release_from_this_build && env.ARTIFACT_SIGNING_KEY env: GPG_KEYNAME: ${{ steps.gpg.outputs.key_id }} GPG_PASSPHRASE: ${{ secrets.ARTIFACT_SIGNING_PASSPHRASE }} run: | gradle sign "-Pversion=${POM_VERSION}"\ - "--no-daemon" \ "-Psigning.gnupg.keyName=${GPG_KEYNAME}" \ "-Psigning.gnupg.passphrase=${GPG_PASSPHRASE}"