Skip to content

Commit

Permalink
Removes dead code + add demo publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fathzer committed May 23, 2024
1 parent e91f67c commit e408fcc
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B -Dsonar.coverage.exclusions=**/WindowsShortcut.java -P sonar org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dorg.slf4j.simpleLogger.log.org.mockserver.log=warn -Dsonar.projectKey=fathzer_ajlib
run: mvn -B -Dsonar.coverage.exclusions=**/WindowsShortcut.java,**/demo/** -P sonar org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dorg.slf4j.simpleLogger.log.org.mockserver.log=warn -Dsonar.projectKey=fathzer_ajlib
69 changes: 69 additions & 0 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Demo
on:
push:
branches:
- "master"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
name: Demo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu' # Alternative distribution options are available.
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: |
mvn -P demo package
mkdir ./demo
mv ./target/ajlib-demo.jar ./demo
ls -l ./demo/*
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./demo
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target/
dependency-reduced-pom.xml
1 change: 0 additions & 1 deletion .project
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
</buildCommand>
</buildSpec>
<natures>
<nature>org.sonar.ide.eclipse.core.sonarNature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,13 @@

A-JLib is a simple java library with Swing widgets, utilities and other stuff.

Please have a look at the javadoc [here](https://javadoc.io/doc/com.fathzer/ajlib)
It tries to simplify the development of Swing applications ... which is, sometime, a nightmare!<br>
It contains the classes I developed during the <a href="https://www.yapbam.net">Yapbam project</a> in
order to deal with the problems I encountered.

It requires Java 7+ and is released under Apache 2 License.

A demonstration of Swing widgets is available at [https://fathzer.github.io/ajlib/ajlib-demo.jar](https://fathzer.github.io/ajlib/ajlib-demo.jar).
It is a runnable jar. After you've downloaded it, run it using:
`java -jar ajlib-demo.jar`
Javadoc is available [here](https://javadoc.io/doc/com.fathzer/ajlib).
6 changes: 3 additions & 3 deletions overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
It contains the classes I developed during the <a href="https://www.yapbam.net">Yapbam project</a> in
order to deal with the problems I encountered.<br>
<br>
The source code is available here: <a target="_top" href="https://github.com/fathzer/ajlib">https://github.com/fathzer/ajlib</a><br>
For maven users, AJLib is also available in <a href="https://search.maven.org/artifact/com.fathzer/ajlib">Maven central</a>:<br>
The source code is available at <a target="_top" href="https://github.com/fathzer/ajlib">https://github.com/fathzer/ajlib</a><br>
<br>For maven users, AJLib is also available in <a href="https://search.maven.org/artifact/com.fathzer/ajlib">Maven central</a>:<br>
<i>&lt;dependency&gt;<br>
&nbsp;&nbsp;&lt;groupId&gt;com.fathzer&lt;/groupId&gt;<br>
&nbsp;&nbsp;&lt;artifactId&gt;ajlib&lt;/artifactId&gt;<br>
&nbsp;&nbsp;&lt;version&gt;0.3.16&lt;/version&gt;<br>
&lt;/dependency&gt;</i><br><br>

It is released under Apache 2 License (information is available <a href="../LICENSE">there</a>).
It is released under Apache 2 License (information is available <a href="../LICENSE">there</a>).<br>
It requires Java 7+.
</span>
</body></html>
88 changes: 53 additions & 35 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,59 @@
<properties>
<sonar.organization>fathzer</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
</profile>
<profile>
<id>demo</id>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<excludes combine.self="override" />
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<configuration>
<finalName>ajlib-demo</finalName>
<minimizeJar>true</minimizeJar>
<filters>
<filter>
<artifact>*.*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.fathzer.soft.ajlib.swing.demo.AJLibDemo</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>
</profile>
</profiles>

<dependencies>
Expand All @@ -54,11 +105,6 @@
<artifactId>jlocal</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-annotations</artifactId>
<version>${animal-sniffer-version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -82,41 +128,13 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<version>3.4.1</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.fathzer.soft.ajlib.swing.demo.AJLibDemo</mainClass>
</manifest>
</archive>
<excludes>
<exclude>**/package.html</exclude>
<exclude>**/demo/**</exclude>
</excludes>
</configuration>
</plugin>

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>install</phase>
<configuration>
<target>
<zip
destfile="${basedir}/A-JLib-v${project.version}.zip">
<zipfileset dir="." includes="license.html" />
<zipfileset dir="${project.build.directory}" includes="*.jar" />
</zip>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,8 @@ public static String getString(String key, Locale locale) {
public final void launch() {
// Set the look and feel
setLookAndFeel();
// Install the exceptions logger on the AWT event queue.
if (isJava6()) {
// Warning the new event queue may ABSOLUTLY be NOT installed by the event dispatch thread under java 1.6 or the program will never exit
installEventQueue();
} else {
// Warning the new event queue may ABSOLUTLY be installed by the event dispatch thread under java 1.7 or the program will never exit
// Warning - 2, if the new event queue is installed by the Runnable that launches start, it sometimes cause a NullPointerException
// Warning the new event queue may ABSOLUTLY be installed by the event dispatch thread under java 1.7+ or the program will never exit
// Warning (2), if the new event queue is installed by the Runnable that launches start, it sometimes cause a NullPointerException
// at java.awt.EventQueue.getCurrentEventImpl(EventQueue.java:796), for instance when setting the selectedItem of a JComboBox in the start method
try {
SwingUtilities.invokeAndWait(new Runnable() {
Expand All @@ -92,7 +87,6 @@ public void run() {
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getCause());
}
}
// Schedule a job for the event-dispatching thread:
// creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
Expand All @@ -102,10 +96,6 @@ public void run() {
});
}

private static boolean isJava6() {
return "1.6".equals(System.getProperty("java.specification.version"));
}

private void installEventQueue() {
EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
queue.push(new EventQueue() {
Expand Down

0 comments on commit e408fcc

Please sign in to comment.