Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI Build

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 21 with JavaFX
uses: actions/setup-java@v4
with:
distribution: 'liberica'
java-version: '21'
java-package: 'jdk+fx'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: '**/build/reports/tests/'
retention-days: 7

dependency-check:
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 21 with JavaFX
uses: actions/setup-java@v4
with:
distribution: 'liberica'
java-version: '21'
java-package: 'jdk+fx'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Check for dependency updates
run: ./gradlew dependencyUpdates

- name: Upload dependency report
uses: actions/upload-artifact@v4
with:
name: dependency-updates-report
path: 'build/dependencyUpdates/'
retention-days: 30
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@
- JUnit Jupiter is configured; place specs under `module/src/test/groovy` with `*Test.groovy` naming.
- Keep UI-heavy code factored so logic can be unit-tested without displays; use resource fixtures already present for rendering assertions.
- Run `./gradlew test` before pushing; add focused tests when altering IO, clipboard, or rendering behaviors.
- Always run `./gradlew test` after completing a task to validate changes.

## Commit & Pull Request Guidelines
- Follow the existing history: short, imperative messages (e.g., “fix publishing by …”, “improve display methods”).
- PRs should list the touched modules (`gi-common`, `gi-fx`, etc.), describe behavior changes, and link issues/tickets.
- Include screenshots or gifs for visual tweaks in `gi-fx`/`gi-swing`; note platform specifics if a change is OS-dependent.
- Keep release/publishing secrets (signing keys, Sonatype creds) out of the repo; supply them via local `gradle.properties` when needed.

## Implementation Guidelines
- A task has 3 parts, implementation, tests, and documentation. A task is not done until all 3 parts are completed.
10 changes: 5 additions & 5 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
- 2.5. [x] Broaden `urlExists`: close the HTTP connection and treat 2xx/3xx as success to avoid resource leaks and false negatives.

## 3. Build & platform coverage
- 3.1 [ ] Add automated tests (JUnit/Gradle) for helpers like `FileUtils.baseName`/`getResourceUrl` and content-type detection using existing `src/test/resources` assets; add headless checks for table/clipboard adapters where feasible.
- 3.2. [ ] Set up CI (e.g., GitHub Actions) to run `./gradlew build` and `./gradlew dependencyUpdates` across modules to catch regressions and dependency drift.
- 3.3. [ ] Increase Gradle JVM memory: add `org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m` to `gradle.properties` to avoid metaspace warnings during builds.
- 3.4. [ ] Extract duplicated fatJar task logic to a shared Gradle convention plugin instead of repeating in each module.
- 3.5. [ ] Flesh out `release.sh` to automate version bumps, changelog generation, and GitHub releases.
- 3.1 [x] Add automated tests (JUnit/Gradle) for helpers like `FileUtils.baseName`/`getResourceUrl` and content-type detection using existing `src/test/resources` assets; add headless checks for table/clipboard adapters where feasible.
- 3.2. [x] Set up CI (e.g., GitHub Actions) to run `./gradlew build` and `./gradlew dependencyUpdates` across modules to catch regressions and dependency drift.
- 3.3. [x] Increase Gradle JVM memory: add `org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m` to `gradle.properties` to avoid metaspace warnings during builds.
- 3.4. [x] Extract duplicated fatJar task logic to a shared Gradle convention plugin instead of repeating in each module.
- 3.5. [x] Flesh out `release.sh` to automate version bumps, changelog generation, and GitHub releases.

## 4. Code quality & refactoring
- 4.1 [ ] Replace 12+ `System.err.println()` calls with a proper logging framework (SLF4J/Logback); locations include `gi-fx/InOut.groovy`, `gi-fx/Viewer.groovy`, `gi-swing/InOut.groovy`.
Expand Down
7 changes: 7 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id 'groovy-gradle-plugin'
}

repositories {
gradlePluginPortal()
}
31 changes: 31 additions & 0 deletions buildSrc/src/main/groovy/se.alipsa.gi.fatjar-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Convention plugin for creating fat JARs with all dependencies bundled.
* Apply this plugin to any module that needs a fat JAR artifact.
*
* Usage in module build.gradle:
* plugins {
* id 'se.alipsa.gi.fatjar-conventions'
* }
*/

def fatJarTask = tasks.register('fatJar', Jar) {
dependsOn(classes)
archiveClassifier = 'fatjar'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}

// Exclude signature files that cause issues when repackaging signed JARs
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'

with jar
}

// Make the regular jar task depend on fatJar so both are built together
tasks.named('jar') {
dependsOn fatJarTask
}
20 changes: 2 additions & 18 deletions gi-console/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'signing'
id 'maven-publish'
id("se.alipsa.nexus-release-plugin") version '2.0.0'
id 'se.alipsa.gi.fatjar-conventions'
}

description = 'Allows Gade Gui Interactive capabilities from a standalone console app'
Expand Down Expand Up @@ -40,33 +41,16 @@ test {
useJUnitPlatform()
}

def fatJarContainer = tasks.register('fatJar', Jar) {
dependsOn(classes)
archiveClassifier = 'fatjar'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
with jar
}

tasks.named('javadocJar', Jar) {
from tasks.named('groovydoc')
dependsOn tasks.named('groovydoc')
}

jar {
dependsOn fatJarContainer
}

publishing {
publications {
maven(MavenPublication) {
from components.java
artifact(fatJarContainer)
artifact(tasks.named('fatJar'))
pom {
name = 'Gade standalone UI interaction library for the console'
description = "${project.description}"
Expand Down
22 changes: 2 additions & 20 deletions gi-fx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'signing'
id 'maven-publish'
id("se.alipsa.nexus-release-plugin") version '2.0.0'
id 'se.alipsa.gi.fatjar-conventions'
}

description = 'Allows Gade Gui Interactive capabilities from a javafx standalone app'
Expand Down Expand Up @@ -64,25 +65,6 @@ test {
useJUnitPlatform()
}

def fatJarContainer = tasks.register('fatjar', Jar) {
dependsOn(classes)
archiveClassifier = 'fatjar'
//archiveBaseName = project.name + '-fat'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
with jar
}


jar {
dependsOn fatJarContainer
}

tasks.named('javadocJar', Jar) {
from tasks.named('groovydoc')
dependsOn tasks.named('groovydoc')
Expand All @@ -92,7 +74,7 @@ publishing {
publications {
maven(MavenPublication) {
from components.java
artifact(fatJarContainer)
artifact(tasks.named('fatJar'))
pom {
name = 'Gade standalone GUI interaction library'
description = "${project.description}"
Expand Down
21 changes: 2 additions & 19 deletions gi-swing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'maven-publish'
id 'signing'
id("se.alipsa.nexus-release-plugin") version '2.0.0'
id 'se.alipsa.gi.fatjar-conventions'
}

description = 'Allows Gade Gui Interactive capabilities from a standalone app'
Expand Down Expand Up @@ -46,29 +47,11 @@ repositories {
}
}

def fatJarContainer = tasks.register('fatJar', Jar) {
dependsOn(classes)
archiveClassifier = 'fatjar'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
with jar
}


jar {
dependsOn fatJarContainer
}

publishing {
publications {
maven(MavenPublication) {
from components.java
artifact(fatJarContainer)
artifact(tasks.named('fatJar'))
pom {
name = 'Gade standalone GUI interaction library for Swing'
description = "${project.description}"
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
org.gradle.configuration-cache=true
org.gradle.configuration-cache=true

# Increase JVM memory to avoid metaspace warnings during builds
org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m
Loading