Skip to content

Commit

Permalink
Upgrade dependencies (#271)
Browse files Browse the repository at this point in the history
* Reduce workflow permissions

* Update vscode config

* Upgrade gradle

* Upgrade dependencies

* Fix compiler warnings

* Remove unnecessary action

---------

Co-authored-by: kaklakariada <[email protected]>
  • Loading branch information
kaklakariada and kaklakariada authored Mar 17, 2024
1 parent d50b86d commit 7ae5699
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 77 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ jobs:
matrix:
java: [21]
os: ['ubuntu-latest', 'windows-latest']
env:
DEFAULT_JAVA: 21
DEFAULT_OS: 'ubuntu-latest'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.java }}
cancel-in-progress: true
name: Build on ${{ matrix.os }} with Java ${{ matrix.java }}
runs-on: ${{ matrix.os }}
env:
DEFAULT_JAVA: 21
DEFAULT_OS: 'ubuntu-latest'
permissions:
contents: read
defaults:
run:
shell: bash

steps:

Expand All @@ -37,6 +42,7 @@ jobs:

- name: Cache SonarQube packages
uses: actions/cache@v4
if: ${{ env.DEFAULT_JAVA == matrix.java && env.DEFAULT_OS == matrix.os }}
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-java-${{ matrix.java }}-sonar
Expand All @@ -54,13 +60,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Publish Test Report
uses: scacap/action-surefire-report@v1
if: ${{ always() && env.DEFAULT_OS == matrix.os && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
with:
report_paths: '**/build/test-results/*/TEST-*.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Archive executable JAR for ${{ matrix.java }}
uses: actions/upload-artifact@v4
if: ${{ env.DEFAULT_JAVA == matrix.java && env.DEFAULT_OS == matrix.os }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
cancel-in-progress: true
name: Analyze
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write

strategy:
fail-fast: false
Expand Down
13 changes: 2 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
{
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true,
"**/build/": false,
"**/bin/": true,
".gradle/": true,
".idea/": true,
},
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.generate.finalModifiers": "explicit",
"source.fixAll": "explicit"
},
"java.codeGeneration.useBlocks": true,
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "modificationsIfAvailable",
"editor.formatOnSaveMode": "file",
"sonarlint.connectedMode.project": {
"connectionId": "itsallcode",
"projectKey": "white-rabbit"
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id 'eclipse'
id "org.sonarqube" version "4.4.1.3373"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.8"
id "io.codearte.nexus-staging" version "0.30.0"
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id "com.moowork.node" version "1.3.1" apply false
id "com.github.ben-manes.versions" version "0.50.0"
id "com.github.ben-manes.versions" version "0.51.0"
id "org.panteleyev.jpackageplugin" version "1.6.0" apply false
id "org.gradle.crypto.checksum" version "1.4.0" apply false
}
Expand Down
16 changes: 8 additions & 8 deletions docs/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Clone and configure

```bash
```sh
mkdir time-recording-data
git clone https://github.com/itsallcode/white-rabbit.git
cd white-rabbit
Expand All @@ -14,7 +14,7 @@ echo "data = $HOME/time-recording-data/" > $HOME/.whiterabbit.properties

### Build and launch

```bash
```sh
# Build WhiteRabbit and install plugins to $HOME/.whiterabbit/plugins/
./gradlew build installPlugins
# To skip unit and ui-tests, run
Expand All @@ -34,13 +34,13 @@ java -jar jfxui/build/libs/white-rabbit-fx-<version>[-SNAPSHOT].jar

Run all tests:

```bash
```sh
./gradlew check
```

Run only UI-Tests:

```bash
```sh
# Headless (default)
./gradlew check
# Not Headless (don't move mouse while running!)
Expand All @@ -49,21 +49,21 @@ Run only UI-Tests:

Run a single test:

```bash
```sh
./gradlew uiTest -i --tests AboutDialogUiTest
```

### Check that dependencies are up-to-date

```bash
```sh
./gradlew dependencyUpdates
```

### <a name="build_native_package"></a>Build Native Packages

Precondition for Windows: Install the [WiX Toolset](https://wixtoolset.org) and add it to the `PATH`.

```bash
```sh
./gradlew jpackage --info -PreleaseVersion=x.y.z
```

Expand All @@ -89,7 +89,7 @@ Add the following to your `~/.gradle/gradle.properties`:
1. Make sure the [Changelog](../CHANGELOG.md) is updated
2. Run the following command:

```bash
```sh
./gradlew clean build publish closeAndReleaseRepository --info -PreleaseVersion=<version>
```

Expand Down
2 changes: 1 addition & 1 deletion docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Precondition: Install Java Runtime Environment (JRE) 21, e.g. from [Adoptium / E
* double clicking or
* executing command

```bash
```sh
java -jar whiterabbitfx-signed.jar
```

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ public class ActivitiesTable
private final EditListener<DayRecord> editListener;
private final AppService appService;

public ActivitiesTable(ReadOnlyProperty<DayRecord> selectedDay, SimpleObjectProperty<Activity> selectedActivity,
EditListener<DayRecord> editListener, AppService appService)
public ActivitiesTable(final ReadOnlyProperty<DayRecord> selectedDay,
final SimpleObjectProperty<Activity> selectedActivity,
final EditListener<DayRecord> editListener, final AppService appService)
{
this.selectedActivity = selectedActivity;
this.editListener = editListener;
Expand All @@ -65,7 +66,7 @@ public ActivitiesTable(ReadOnlyProperty<DayRecord> selectedDay, SimpleObjectProp
selectedDay.addListener((observable, oldValue, newValue) -> updateTableValues(newValue));
}

public void updateTableValues(DayRecord day)
public void updateTableValues(final DayRecord day)
{
JavaFxUtil.runOnFxApplicationThread(() -> {
if (day == null || day.activities().isEmpty())
Expand Down Expand Up @@ -142,18 +143,18 @@ public TableView<ActivityPropertyAdapter> initTable()
return table;
}

private boolean isDoubleClickEvent(MouseEvent event)
private boolean isDoubleClickEvent(final MouseEvent event)
{
return event.getButton().equals(MouseButton.PRIMARY) && event.getClickCount() == 2;
}

private boolean targetIsEmptySpace(EventTarget target)
private boolean targetIsEmptySpace(final EventTarget target)
{
if (target instanceof TableRow<?> row)
if (target instanceof final TableRow<?> row)
{
return row.getItem() == null;
}
else if (target instanceof TableCell<?, ?> cell)
else if (target instanceof final TableCell<?, ?> cell)
{
return cell.getTableRow().getItem() == null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.itsallcode.whiterabbit.logic.service.plugin.origin;

class ClassPathPluginOrigin extends PluginOrigin
class ClasspathPluginOrigin extends PluginOrigin
{
ClassPathPluginOrigin(ClassLoader classLoader)
ClasspathPluginOrigin(final ClassLoader classLoader)
{
super(classLoader);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@

public abstract class PluginOrigin implements AppPluginOrigin
{
private ClassLoader classLoader;
private final ClassLoader classLoader;

protected PluginOrigin(ClassLoader classLoader)
protected PluginOrigin(final ClassLoader classLoader)
{
this.classLoader = classLoader;
}

public static PluginOrigin forCurrentClassPath()
{
return new ClassPathPluginOrigin(getBaseClassLoader());
return new ClasspathPluginOrigin(getBaseClassLoader());
}

public static PluginOrigin forJar(Path jar)
public static PluginOrigin forJar(final Path jar)
{
return new JarPluginOrigin(jar, createClassLoader(jar));
}
Expand All @@ -31,14 +31,14 @@ private static ClassLoader getBaseClassLoader()
return PluginOrigin.class.getClassLoader();
}

private static ClassLoader createClassLoader(Path jar)
private static ClassLoader createClassLoader(final Path jar)
{
final String name = "PluginClassLoader-" + jar.getFileName();
final URL[] urls = new URL[] { toUrl(jar) };
return new URLClassLoader(name, urls, getBaseClassLoader());
}

private static URL toUrl(Path path)
private static URL toUrl(final Path path)
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ProjectImpl implements Project
@JsonbProperty("costCarrier")
private String costCarrier;

public ProjectImpl(String projectId, String label, String costCarrier)
public ProjectImpl(final String projectId, final String label, final String costCarrier)
{
this.projectId = projectId;
this.label = label;
Expand All @@ -31,7 +31,7 @@ public String getProjectId()
return projectId;
}

public void setProjectId(String projectId)
public void setProjectId(final String projectId)
{
this.projectId = projectId;
}
Expand All @@ -42,7 +42,7 @@ public String getLabel()
return label;
}

public void setLabel(String label)
public void setLabel(final String label)
{
this.label = label;
}
Expand All @@ -53,7 +53,7 @@ public String getCostCarrier()
return costCarrier;
}

public void setCostCarrier(String costCarrier)
public void setCostCarrier(final String costCarrier)
{
this.costCarrier = costCarrier;
}
Expand All @@ -70,7 +70,7 @@ public int hashCode()
}

@Override
public boolean equals(Object obj)
public boolean equals(final Object obj)
{
if (this == obj)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
import org.mockito.junit.jupiter.MockitoExtension;

@ExtendWith(MockitoExtension.class)
class ClassPathPluginOriginTest
class ClasspathPluginOriginTest
{
@Mock
private ClassLoader classLoaderMock;
private ClassPathPluginOrigin origin;
private ClasspathPluginOrigin origin;

@BeforeEach
void setup()
{
origin = new ClassPathPluginOrigin(classLoaderMock);
origin = new ClasspathPluginOrigin(classLoaderMock);
}

@Test
Expand Down
Loading

0 comments on commit 7ae5699

Please sign in to comment.