1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-05 21:17:52 +00:00

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

* Add MIT version on CI

* chore: add gradle project for plantuml-mit

* chore: add publish to gradle project plantuml-mit

* chore: suppress test on u20 win19, add MIT on release script

Suppress ubuntu20 and win2019 test
Test of symbolic link on release script for MIT license
Delete now not used files:
- ci-mit.yml
- license-mit.yml
- build-mit.gradle.kts

* fix: side effect of MIT on Native CI

* fix(build): update paths to mit jars

---------

Co-authored-by: Eric Vantillard <eric.vantillard@evaxion.fr>
This commit is contained in:
The-Lum 2023-04-05 12:13:14 +02:00 committed by GitHub
parent b308944fd0
commit 19d7fba544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 179 additions and 133 deletions

View File

@ -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

View File

@ -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

View File

@ -1,49 +0,0 @@
name: ci-mit
'on':
create: null
pull_request:
types:
- opened
- synchronize
- reopened
paths-ignore:
- '*.md'
- docs/**
push:
branches:
- master
paths-ignore:
- '*.md'
- docs/**
workflow_dispatch: null
defaults:
run:
shell: bash
jobs:
workflow_config:
runs-on: ubuntu-latest
outputs:
do_release: '${{ steps.config.outputs.do_release }}'
do_snapshot_release: '${{ steps.config.outputs.do_snapshot_release }}'
pom_version: '${{ steps.config.outputs.pom_version }}'
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Run pre-processor
run: |
ls -l
java -jar sjpp.jar
java -jar sjpp.jar src src-mit __MIT__
ls -l
- name: Rename build-mit.gradle
run: |
ls -l *.kts
cp build-mit.gradle.kts build.gradle.kts
ls -l *.kts
- name: Compile
run: gradle jar --no-daemon
- name: print version
run: |
ls -l
ls -l build/libs
java -jar build/libs/plantuml-M.YYYY.m-SNAPSHOT.jar -version

View File

@ -147,6 +147,7 @@ jobs:
path: |
build/libs
build/publications
plantuml-mit/build/libs
key: "libs-${{ github.run_id }}"
enableCrossOsArchive: true
@ -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 }}"
@ -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'

View File

@ -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

View File

@ -1,79 +0,0 @@
// 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("src-mit")
}
resources {
srcDirs("src-mit")
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"
}

View File

@ -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")
}
}
}
}

View File

@ -1 +1,5 @@
rootProject.name = "plantuml"
val isCiBuild = System.getenv("CI") != null
include("plantuml-mit")