Skip to content

Commit

Permalink
Merge pull request plantuml#912 from soloturn/master
Browse files Browse the repository at this point in the history
switch default build to gradle, fixes #47
  • Loading branch information
arnaudroques authored Feb 11, 2022
2 parents b687dcc + 8603c8d commit e8e923d
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 90 deletions.
38 changes: 20 additions & 18 deletions .github/workflows/ci-gradle.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -93,14 +91,18 @@ 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

- 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
Expand All @@ -114,8 +116,8 @@ 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 }}
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
120 changes: 60 additions & 60 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -66,50 +66,50 @@ tasks.compileJava {
}

tasks.withType<Jar> {
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<MavenPublication>("maven") {
from(components["java"])
}
publications.create<MavenPublication>("maven") {
from(components["java"])
}
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.encoding = "UTF-8"
}

tasks.withType<Javadoc> {
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"])
}

0 comments on commit e8e923d

Please sign in to comment.