Skip to content

Commit

Permalink
Release Setup (#62)
Browse files Browse the repository at this point in the history
* build(framework): Prepare Maven publication

* fix(framework): Invalid HTML in JavaDocs

* build(framework): Determine framework version via git tags

* ci: Add Java CI/CD action

* build(annotation-processor): Prepare Maven publication

* build: Remove git versioning

* chore(framework,annotation-processor): Update all dependencies

* build(framework,annotation-processor): Add description

* fix(annotation-processor): Inception year

* ci: Fix pull_request trigger

* ci: Make gradlew executable

* test(framework): Add missing hamcrest dependency

* chose: Add License

* build: Headless tests

* fix: Use monocle 17

* build(ludo): No sourcesJar

* build: Fix headless mode

* ci: Don't build test projects
  • Loading branch information
Clashsoft authored Mar 4, 2024
1 parent e508106 commit 0cb5ee1
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 46 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/java-ci-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Java CI/CD

on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master

jobs:
test:
name: Java ${{ matrix.java }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
java:
- 17
- 21
os:
- ubuntu
- windows
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.java }}
java-package: jdk
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build with Gradle
run: ./gradlew :framework:build :annotation-processor:build
- name: Deploy to Maven Central
if: matrix.os == 'ubuntu' && matrix.java == 17 && startsWith(github.ref, 'refs/tags/v')
run: |
echo '${{ secrets.SIGNING_KEY }}' | base64 -d > /tmp/signing_key.gpg
./gradlew \
'-PsonatypeUsername=${{ secrets.NEXUS_USERNAME }}' \
'-PsonatypePassword=${{ secrets.NEXUS_PASSWORD }}' \
'-Psigning.keyId=${{ secrets.SIGNING_KEY_ID }}' \
'-Psigning.password=${{ secrets.SIGNING_PASSWORD }}' \
'-Psigning.secretKeyRingFile=/tmp/signing_key.gpg' \
publishToSonatype closeAndReleaseSonatypeStagingRepository
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 - 2024 Fujaba Tool Suite

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
58 changes: 48 additions & 10 deletions annotation-processor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
plugins {
id "java"
id 'maven-publish'
id 'signing'
}

group projectGroup
version projectVersion
group = projectGroup
version = processorVersion
description = 'Annotation Processor for fulibFx. Checks for common errors and creates compilation errors and warnings.'

// ------------------- Dependencies -------------------

Expand All @@ -18,8 +21,10 @@ repositories {
// Project dependencies
dependencies {
// https://mvnrepository.com/artifact/com.google.auto.service/auto-service-annotations
implementation 'com.google.auto.service:auto-service-annotations:1.1.1'
annotationProcessor 'com.google.auto.service:auto-service:1.1.1'
implementation group: 'com.google.auto.service', name: 'auto-service-annotations', version: '1.1.1'

// https://mvnrepository.com/artifact/com.google.auto.service/auto-service
annotationProcessor group: 'com.google.auto.service', name: 'auto-service', version: '1.1.1'

// Framework
implementation project(":framework")
Expand All @@ -31,12 +36,8 @@ java {
sourceCompatibility = getVersionForMajor(javaSourceVersion)
targetCompatibility = getVersionForMajor(javaTargetVersion)

if (generateSourcesJar) {
withSourcesJar()
}
if (generateJavadocJar) {
withJavadocJar()
}
withSourcesJar()
withJavadocJar()
}

static JavaVersion getVersionForMajor(String version) {
Expand Down Expand Up @@ -65,3 +66,40 @@ jar {

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

// ------------------- Publishing -------------------

publishing.publications.create('mavenJava', MavenPublication) {
it.artifactId = 'fulibFx-processor'
it.from(components.java)
it.pom {
name = 'fulibFx-processor'
description = project.description
url = 'https://github.com/fujaba/fulibFx'
inceptionYear = '2024'

scm {
url = 'https://github.com/fujaba/fulibFx'
}

licenses {
license {
name = 'MIT License'
url = 'https://www.opensource.org/licenses/mit-license.php'
}
}

developers {
developer {
id = 'LeStegii'
name = 'Paul Mertens'
}
developer {
id = 'Clashsoft'
name = 'Adrian Kunz'
}
}
}
}

signing.sign publishing.publications.mavenJava
22 changes: 22 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
// https://plugins.gradle.org/plugin/io.github.gradle-nexus.publish-plugin
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
}

nexusPublishing.repositories.sonatype()

allprojects {
if (hasProperty('headless') || System.getenv('CI')) {
tasks.withType(Test).configureEach {
systemProperties = [
'java.awt.headless': 'true',
'testfx.robot': 'glass',
'testfx.headless': 'true',
'glass.platform': 'Monocle',
'monocle.platform': 'Headless',
'prism.order': 'sw',
'prism.text': 't2k',
]
}
}
}
81 changes: 60 additions & 21 deletions framework/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
plugins {
id "java"
id "org.openjfx.javafxplugin" version "0.0.13"
id "com.github.johnrengelman.shadow" version "7.0.0"
id 'maven-publish'
id 'signing'
// https://plugins.gradle.org/plugin/org.openjfx.javafxplugin
id "org.openjfx.javafxplugin" version "0.1.0"
}

group projectGroup
version projectVersion
group = projectGroup
version = frameworkVersion
description = 'A versatile Framework for JavaFX applications specifically designed for MVC pattern projects.'

// ------------------- Dependencies -------------------

Expand All @@ -19,23 +22,23 @@ repositories {

// JavaFX dependencies
javafx {
version = '20'
version = '21.0.2'
modules = ['javafx.controls', 'javafx.graphics', 'javafx.fxml', 'javafx.media']
}

// Project dependencies
dependencies {
// https://mvnrepository.com/artifact/org.jetbrains/annotations
implementation 'org.jetbrains:annotations:24.0.1'
implementation group: 'org.jetbrains', name: 'annotations', version: '24.1.0'

// https://mvnrepository.com/artifact/com.google.dagger/dagger
implementation group: 'com.google.dagger', name: 'dagger', version: '2.42'
implementation group: 'com.google.dagger', name: 'dagger', version: '2.51'

// https://mvnrepository.com/artifact/com.google.dagger/dagger-compiler
annotationProcessor group: 'com.google.dagger', name: 'dagger-compiler', version: '2.42'
annotationProcessor group: 'com.google.dagger', name: 'dagger-compiler', version: '2.51'

// https://mvnrepository.com/artifact/io.reactivex.rxjava3/rxjava
implementation group: 'io.reactivex.rxjava3', name: 'rxjava', version: '3.1.4'
implementation group: 'io.reactivex.rxjava3', name: 'rxjava', version: '3.1.8'
}

// ------------------- Tests -------------------
Expand All @@ -44,22 +47,25 @@ dependencies {
dependencies {

// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.9.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.1'

// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.9.2'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.1'

// https://mvnrepository.com/artifact/org.testfx/testfx-junit5
testImplementation group: 'org.testfx', name: 'testfx-junit5', version: '4.0.16-alpha'
testImplementation group: 'org.testfx', name: 'testfx-junit5', version: '4.0.17'

// https://mvnrepository.com/artifact/org.hamcrest/hamcrest
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'

// https://mvnrepository.com/artifact/org.testfx/openjfx-monocle
testImplementation group: 'org.testfx', name: 'openjfx-monocle', version: 'jdk-12.0.1+2'
testImplementation group: 'org.testfx', name: 'openjfx-monocle', version: '17.0.10'

// https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.2.0'
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.11.0'

// https://mvnrepository.com/artifact/com.google.dagger/dagger-compiler
testAnnotationProcessor group: 'com.google.dagger', name: 'dagger-compiler', version: '2.42'
testAnnotationProcessor group: 'com.google.dagger', name: 'dagger-compiler', version: '2.51'

}

Expand All @@ -73,12 +79,8 @@ java {
sourceCompatibility = getVersionForMajor(javaSourceVersion)
targetCompatibility = getVersionForMajor(javaTargetVersion)

if (generateSourcesJar) {
withSourcesJar()
}
if (generateJavadocJar) {
withJavadocJar()
}
withSourcesJar()
withJavadocJar()
}

static JavaVersion getVersionForMajor(String version) {
Expand Down Expand Up @@ -107,3 +109,40 @@ jar {

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

// ------------------- Publishing -------------------

publishing.publications.create('mavenJava', MavenPublication) {
it.artifactId = 'fulibFx'
it.from(components.java)
it.pom {
name = 'fulibFx'
description = project.description
url = 'https://github.com/fujaba/fulibFx'
inceptionYear = '2023'

scm {
url = 'https://github.com/fujaba/fulibFx'
}

licenses {
license {
name = 'MIT License'
url = 'https://www.opensource.org/licenses/mit-license.php'
}
}

developers {
developer {
id = 'LeStegii'
name = 'Paul Mertens'
}
developer {
id = 'Clashsoft'
name = 'Adrian Kunz'
}
}
}
}

signing.sign publishing.publications.mavenJava
6 changes: 4 additions & 2 deletions framework/src/main/java/org/fulib/fx/util/MapUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ private MapUtil() {
/**
* Checks if the given parameter is a map with the given key and value types.
* <p>
* This will not work for maps not directly specifying the generic types, such as MyMap extends HashMap<Key, Value>.
* This will not work for maps not directly specifying the generic types,
* such as {@code MyMap extends HashMap<Key, Value>}.
*
* @param parameter The parameter to check
* @param key The key type
Expand All @@ -71,7 +72,8 @@ public static boolean isMapWithTypes(@NotNull Parameter parameter, @NotNull Clas
/**
* Checks if the given field is a map with the given key and value types.
* <p>
* This will not work for maps not directly specifying the generic types, such as MyMap extends HashMap<Key, Value>.
* This will not work for maps not directly specifying the generic types,
* such as {@code MyMap extends HashMap<Key, Value>}.
*
* @param field The field to check
* @param key The key type
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Details about the project
projectName = fulibFx
projectVersion = 1.0.0
projectVersion = 0.0.0
frameworkVersion = 0.1.0
processorVersion = 0.1.0

# Gradle settings
projectGroup = org.fulib
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
13 changes: 1 addition & 12 deletions ludo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies {
testImplementation group: 'org.testfx', name: 'testfx-junit5', version: '4.0.16-alpha'

// https://mvnrepository.com/artifact/org.testfx/openjfx-monocle
testImplementation group: 'org.testfx', name: 'openjfx-monocle', version: 'jdk-12.0.1+2'
testImplementation group: 'org.testfx', name: 'openjfx-monocle', version: '17.0.10'

// https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.2.0'
Expand All @@ -67,23 +67,12 @@ dependencies {
java {
sourceCompatibility = getVersionForMajor(javaSourceVersion)
targetCompatibility = getVersionForMajor(javaTargetVersion)

if (generateSourcesJar) {
withSourcesJar()
}
if (generateJavadocJar) {
withJavadocJar()
}
}

test {
useJUnitPlatform()
}

sourcesJar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

jar {
from {
configurations.internal.collect { it.isDirectory() ? it : zipTree(it) }
Expand Down

0 comments on commit 0cb5ee1

Please sign in to comment.