Skip to content

Commit

Permalink
Merge branch 'milestone-v0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
matty-r committed Dec 11, 2023
2 parents 898ff08 + e8bee1c commit 6a23aae
Show file tree
Hide file tree
Showing 40 changed files with 3,845 additions and 880 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ Logs/*
.vscode/*
out/*
lib/*
themes/*
src/urChatBasic/backend/JoinClassLoader.java
src/urChatBasic/frontend/utils/UIManagerDefaults.java
themes
release
test-output
report

# not tested
build/tag-build-win.ps1
build/tag-build-win.ps1
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,39 @@ urChat is a Java based IRC Client designed around simplicity and minimal resourc

Contributions
======
**Currently targeting ![Milestone v0.4.0](https://github.com/matty-r/urChat/milestone/3)**
**Currently targeting ![Milestone v0.4.0](https://github.com/matty-r/urChat/milestone/3)**

If you would like to assist in the development of urChat take a look at the Issues associated with the project. Please let me know if you wish to tackle a certain issue.

Test/Code Coverage Dependencies
======
Dependencies required only for running the tests:

Create a **lib/test** directory with the following files:

* [Junit 4](https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar)
* [Hamcrest Core](https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar)
* [TestNG 7.8.0](https://repo1.maven.org/maven2/org/testng/testng/7.8.0/testng-7.8.0.jar)
* [JCommander](https://repo1.maven.org/maven2/com/beust/jcommander/1.82/jcommander-1.82.jar)
* [SLF4J](https://repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar)

Extract jacocoagent.jar and jacococli.jar into the **lib/coverage** directory

* [Jacoco](https://search.maven.org/remotecontent?filepath=org/jacoco/jacoco/0.8.11/jacoco-0.8.11.zip)

Usage
======
Ensure you've got Java 17 available on your system, download and run the latest JAR release (https://github.com/matty-r/urChat/releases). If you'd like to try out the Theme functionality, create a 'themes' directory next to the urChat.jar and download the FlatLAF.jar release and place within that directory. The theme can be selected under the client options page.

Test Usage
======

Using the testng.xml - must be in the same directory as urchat.jar
* java -cp "urTestRunner.jar" org.testng.TestNG testng.xml

Without testng.xml
* java -jar urTestRunner.jar

Screenshots
======

Expand Down
87 changes: 87 additions & 0 deletions build/test-build-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

# Save the current directory to a variable
initial_dir=$(pwd)

# Clone the repository into a temporary directory
temp_dir=$(mktemp -d)
git clone . "$temp_dir"
cd "$temp_dir"

# Compile the Java files for the main jar
find src -name "*.java" -exec javac -d "bin" {} +

cd "bin"

# Copy the images directory
cp -r "$initial_dir/src/images" "."

# Create a manifest file specifying the main class
echo "Main-Class: urChatBasic.frontend.DriverGUI" > ../manifest.txt

# Create the JAR file with the manifest and compiled class files, includes the lib and images directory in the created JAR file
jar -cfm "urchat.jar" ../manifest.txt .

# Delete all the files not needed to compile the test runner
rm -rf "images"
rm -rf "urChatBasic"

# Copy the lib directory
cp -r "$initial_dir/lib" "$temp_dir/"

# Copy the test libs
cp -r "$temp_dir/lib/test/" "$temp_dir/bin/"

# Compile the Java files for the urTestRunner, using the urchat.jar as a source of the lib files
find ../tests -name "*.java" -exec javac -cp "urchat.jar:test/*" -d . {} +

# Extract the test libs to be included in urTestRunner.jar
mkdir -p "$temp_dir/extracted_libs"
cd "$temp_dir/extracted_libs"

for file in "$temp_dir"/lib/test/*.jar; do
jar xf "$file"
done

cd "$temp_dir/bin"

# Move the main.jar back into the temp dir (we don't want it included in urTestRunner)
mv "urchat.jar" "$temp_dir"

# Delete the test libs
rm -rf "test"

# Create a manifest file for urTestRunner
echo "Main-Class: URTestRunner" > ../testmanifest.txt
echo "Class-Path: urchat.jar test/*" >> ../testmanifest.txt

# Compile to urTestRunner.jar using the testmanifest.txt, the contents of the current directory (/bin) plus the extracted_libs
jar -cfm "urTestRunner.jar" "$temp_dir/testmanifest.txt" . -C "$temp_dir/extracted_libs/" .

mv "urTestRunner.jar" "$temp_dir"

cd "$temp_dir"

mkdir -p "report"

# run with jacoco agent to build coverage.exec
java -javaagent:lib/coverage/jacocoagent.jar=destfile=coverage.exec -cp "urchat.jar:urTestRunner.jar" org.testng.TestNG ./build/testng_release.xml

# build html report pointing to the source .java files
java -jar lib/coverage/jacococli.jar report coverage.exec --classfiles urchat.jar --html report --sourcefiles src/

# Move the JARs to the release directory
mkdir -p "$initial_dir/release"
mv "$temp_dir/urchat.jar" "$initial_dir/release"
mv "$temp_dir/urTestRunner.jar" "$initial_dir/release"

# Jacoco Output
mv "report" "$initial_dir"

# TestNG Output
mv "test-output" "$initial_dir"

# Clean up the temporary directory
cd "$initial_dir"

rm -rf "$temp_dir"
81 changes: 81 additions & 0 deletions build/testng.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="GUITests">
<test name="Test #000 - Explictly defined method name">
<classes>
<class name="backend.DialogTests">
<methods>
<include name="testYesNoDialogWithActionListener"/>
</methods>
</class>
</classes>
</test>
<test name="Test #001 - Basic group test">
<groups>
<run>
<include name="Test #001"/>
</run>
</groups>
<classes>
<class name="backend.MessageHandlerTests"/>
<class name="backend.DialogTests"/>
</classes>
</test>
<test name="Test #002 - Parameter Test">
<parameter name="channelName" value="testingNameAsParameter"/>

<groups>
<run>
<include name="Test #002"/>
</run>
</groups>
<classes>
<class name="backend.MessageHandlerTests"/>
</classes>
</test>
<test name="Test #003 - Dependancy tests">
<groups>
<run>
<include name="Test #003"/>
</run>
</groups>
<classes>
<class name="backend.MessageHandlerTests"/>
</classes>
</test>
<test name="Test #004 - Test method included due to dependancy">
<groups>
<run>
<include name="Test #004"/>
</run>
</groups>
<classes>
<class name="backend.MessageHandlerTests"/>
</classes>
</test>
<test name="Test #005 - Failed Timeout test">
<groups>
<run>
<include name="Test #005"/>
</run>
</groups>
<classes>
<class name="backend.MessageHandlerTests"/>
</classes>
</test>
<test name="Test #006 - Exclude groups">
<groups>
<run>
<exclude name="Test #001"/>
<exclude name="Test #002"/>
<exclude name="Test #003"/>
<exclude name="Test #004"/>
<exclude name="Test #005"/>
</run>
</groups>
<classes>
<class name="backend.MessageHandlerTests"/>
<class name="backend.DialogTests"/>
<class name="backend.UserGUITests"/>
</classes>
</test>
</suite>
8 changes: 8 additions & 0 deletions build/testng_release.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Tag Release">
<test name="All Tests">
<packages>
<package name="backend.*" />
</packages>
</test>
</suite>
Loading

0 comments on commit 6a23aae

Please sign in to comment.