diff --git a/.github/scripts/release-snapshot.sh b/.github/scripts/release-snapshot.sh index 0b4dd4074..67018aad4 100755 --- a/.github/scripts/release-snapshot.sh +++ b/.github/scripts/release-snapshot.sh @@ -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 diff --git a/.github/scripts/release.sh b/.github/scripts/release.sh index ca8a1b33b..097e3077e 100755 --- a/.github/scripts/release.sh +++ b/.github/scripts/release.sh @@ -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 diff --git a/.github/workflows/ci-mit.yml.off b/.github/workflows/ci-mit.yml.off deleted file mode 100644 index 48aaadccc..000000000 --- a/.github/workflows/ci-mit.yml.off +++ /dev/null @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61e584dcd..e7a4d086e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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' diff --git a/.github/workflows/native-image.yml b/.github/workflows/native-image.yml index 10a7b1934..92958a33e 100644 --- a/.github/workflows/native-image.yml +++ b/.github/workflows/native-image.yml @@ -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 diff --git a/build-mit.gradle.kts b/build-mit.gradle.kts deleted file mode 100644 index 5bd6515b3..000000000 --- a/build-mit.gradle.kts +++ /dev/null @@ -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().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().configureEach { - options.encoding = "UTF-8" -} - diff --git a/plantuml-mit/build.gradle.kts b/plantuml-mit/build.gradle.kts new file mode 100644 index 000000000..6c240f7ab --- /dev/null +++ b/plantuml-mit/build.gradle.kts @@ -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().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().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("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") + } + } + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index e49c0b081..5b231b621 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,5 @@ rootProject.name = "plantuml" + +val isCiBuild = System.getenv("CI") != null + +include("plantuml-mit")