Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MIT License (jar, source) version on CI [skip actions] #1375

Merged
merged 6 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/scripts/release-snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ ln -s "../libs/plantuml-pdf-${RELEASE_VERSION}.jar" "${RELEASE_DIR}
ln -s "../libs/plantuml-linux-amd64-${RELEASE_VERSION}" "${RELEASE_DIR}/plantuml-linux-amd64-SNAPSHOT"
ln -s "../libs/plantuml-darwin-amd64-${RELEASE_VERSION}" "${RELEASE_DIR}/plantuml-darwin-amd64-SNAPSHOT"
ln -s "../libs/plantuml-win-amd64-${RELEASE_VERSION}.exe" "${RELEASE_DIR}/plantuml-win-amd64-SNAPSHOT.exe"
ln -s "../plantuml-mit/build/libs/plantuml-mit-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml-mit-SNAPSHOT.jar"
ln -s "../plantuml-mit/build/libs/plantuml-mit-${RELEASE_VERSION}-sources.jar" "${RELEASE_DIR}/plantuml-mit-SNAPSHOT-sources.jar"

if [[ -e "build/publications/maven/module.json.asc" ]]; then
# signatures are optional so that forked repos can release snapshots without needing a gpg signing key
Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ ln -s "../libs/plantuml-pdf-${RELEASE_VERSION}.jar" "${RELEASE_DIR}
ln -s "../libs/plantuml-linux-amd64-${RELEASE_VERSION}" "${RELEASE_DIR}/plantuml-linux-amd64-${RELEASE_VERSION}"
ln -s "../libs/plantuml-darwin-amd64-${RELEASE_VERSION}" "${RELEASE_DIR}/plantuml-darwin-amd64-${RELEASE_VERSION}"
ln -s "../libs/plantuml-win-amd64-${RELEASE_VERSION}.exe" "${RELEASE_DIR}/plantuml-win-amd64-${RELEASE_VERSION}.exe"

ln -s "../plantuml-mit/build/libs/plantuml-mit-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml-mit-${RELEASE_VERSION}.jar"
ln -s "../plantuml-mit/build/libs/plantuml-mit-${RELEASE_VERSION}-sources.jar" "${RELEASE_DIR}/plantuml-mit-${RELEASE_VERSION}-sources.jar"

if [[ -e "build/publications/maven/module.json.asc" ]]; then
# signatures are optional so that forked repos can release snapshots without needing a gpg signing key
Expand Down
49 changes: 0 additions & 49 deletions .github/workflows/ci-mit.yml.off

This file was deleted.

15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ jobs:
path: |
build/libs
build/publications
plantuml-mit/build/libs
key: "libs-${{ github.run_id }}"
enableCrossOsArchive: true

Expand All @@ -172,30 +173,35 @@ jobs:
distribution: temurin
cache: gradle

- uses: actions/cache/restore@v3
- name: Restore Libs cache
uses: actions/cache/restore@v3
with:
path: |
build/libs
build/publications
plantuml-mit/build/libs
key: "libs-${{ github.run_id }}"
fail-on-cache-miss: true
enableCrossOsArchive: true

- uses: actions/cache/restore@v3
- name: Restore Native-image-darwin-amd64 cache
uses: actions/cache/restore@v3
with:
path: "build/libs/plantuml-darwin-amd64-*"
key: "native-image-darwin-amd64-${{ github.run_id }}"
fail-on-cache-miss: true
enableCrossOsArchive: true

- uses: actions/cache/restore@v3
- name: Restore Native-image-win-amd64 cache
uses: actions/cache/restore@v3
with:
path: "build/libs/plantuml-win-amd64-*"
key: "native-image-win-amd64-${{ github.run_id }}"
fail-on-cache-miss: true
enableCrossOsArchive: true

- uses: actions/cache/restore@v3
- name: Restore Native-image-linux-amd64 cache
uses: actions/cache/restore@v3
with:
path: "build/libs/plantuml-linux-amd64-*"
key: "native-image-linux-amd64-${{ github.run_id }}"
Expand All @@ -210,6 +216,7 @@ jobs:
path: |
build/libs/*
build/publications/maven/*
plantuml-mit/build/libs/*

- name: Create snapshot release
if: needs.workflow_config.outputs.do_snapshot_release == 'true'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/native-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
path: |
build/libs
build/publications
plantuml-mit/build/libs
key: "libs-${{ github.run_id }}"
fail-on-cache-miss: true
enableCrossOsArchive: true
Expand Down
79 changes: 0 additions & 79 deletions build-mit.gradle.kts

This file was deleted.

159 changes: 159 additions & 0 deletions plantuml-mit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// permits to start the build setting the javac release parameter, no parameter means build for java8:
// gradle clean build -x javaDoc -PjavacRelease=8
// gradle clean build -x javaDoc -PjavacRelease=17
// also supported is to build first, with java17, then switch the java version, and run the test with java8:
// gradle clean build -x javaDoc -x test
// gradle test
val javacRelease = (project.findProperty("javacRelease") ?: "8") as String

plugins {
java
`maven-publish`
signing
}

group = "net.sourceforge.plantuml"
description = "PlantUML"

java {
withSourcesJar()
//withJavadocJar()
registerFeature("pdf") {
usingSourceSet(sourceSets["main"])
}
}

dependencies {
compileOnly("org.apache.ant:ant:1.10.13")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
testImplementation("org.scilab.forge:jlatexmath:1.0.7")
}

repositories {
mavenLocal()
mavenCentral()
}

sourceSets {
main {
java {
srcDirs("build/generated/sjpp")
}
resources {
srcDirs("build/generated/sjpp")
include("**/*.png")
include("**/*.svg")
include("**/*.txt")
}
}
}

tasks.compileJava {
if (JavaVersion.current().isJava8) {
java.targetCompatibility = JavaVersion.VERSION_1_8
} else {
options.release.set(Integer.parseInt(javacRelease))
}
}

tasks.withType<Jar>().configureEach {
manifest {
attributes["Main-Class"] = "net.sourceforge.plantuml.Run"
attributes["Implementation-Version"] = archiveVersion
attributes["Build-Jdk-Spec"] = System.getProperty("java.specification.version")
from("../manifest.txt")
}
from("../skin") { into("skin") }
from("../stdlib") { into("stdlib") }
from("../svg") { into("svg") }
from("../themes") { into("themes") }
// source sets for java and resources are on "src", only put once into the jar
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

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

val syncSources by tasks.registering(Sync::class) {
from(rootProject.layout.projectDirectory.dir("src"))
into(project.layout.buildDirectory.dir("sources/sjpp/java"))
}

val preprocessMitLicenceAntTask by tasks.registering() {
dependsOn(syncSources)
inputs.dir(project.layout.buildDirectory.dir("sources/sjpp/java"))
outputs.dir(project.layout.buildDirectory.dir("generated/sjpp"))
doLast {
ant.withGroovyBuilder {
"taskdef"(
"name" to "sjpp",
"classname" to "sjpp.SjppAntTask",
"classpath" to rootProject.layout.projectDirectory.files("sjpp.jar").asPath
)
"sjpp"(
"src" to project.layout.buildDirectory.dir("sources/sjpp/java").get().asFile.absolutePath,
"dest" to project.layout.buildDirectory.dir("generated/sjpp").get().asFile.absolutePath,
"define" to "__MIT__"
)
}
}
}

tasks.processResources{
dependsOn(preprocessMitLicenceAntTask)
}

tasks.compileJava{
dependsOn(preprocessMitLicenceAntTask)
}

tasks.named("sourcesJar"){
dependsOn(preprocessMitLicenceAntTask)
}


publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
pom {
name.set("PlantUML")
description.set("PlantUML is a component that allows to quickly write diagrams from text.")
groupId = project.group as String
artifactId = project.name
version = project.version as String
url.set("https://plantuml.com/")
licenses {
license {
name.set("The GNU General Public License")
url.set("http://www.gnu.org/licenses/gpl.txt")
}
}
developers {
developer {
id.set("arnaud.roques")
name.set("Arnaud Roques")
email.set("plantuml@gmail.com")
}
}
scm {
connection.set("scm:git:git://github.com:plantuml/plantuml.git")
developerConnection.set("scm:git:ssh://git@github.com:plantuml/plantuml.git")
url.set("https://github.com/plantuml/plantuml")
}
}
}
repositories {
maven {
name = "OSSRH"
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}
4 changes: 4 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
rootProject.name = "plantuml"

val isCiBuild = System.getenv("CI") != null

include("plantuml-mit")