Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies #233

Merged
merged 6 commits into from
Mar 12, 2022
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
10 changes: 1 addition & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,10 @@ jobs:
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'gradle'

- uses: gradle/wrapper-validation-action@v1

- name: Cache Gradle packages and wrapper
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-java-${{ matrix.java }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-java-${{ matrix.java }}-gradle

- name: Cache SonarQube packages
uses: actions/cache@v2
with:
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,10 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'

- uses: gradle/wrapper-validation-action@v1

- name: Cache Gradle packages and wrapper
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Configure webstart
run: |
cp .github/workflows/webstart.properties.template webstart/webstart.properties
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

See [Release](https://github.com/itsallcode/white-rabbit/releases/tag/v1.9.0) / [Milestone](https://github.com/itsallcode/white-rabbit/milestone/11?closed=1)

* [#233](https://github.com/itsallcode/white-rabbit/pull/233): Upgrade dependencies, use [Gradle versions catalog](https://docs.gradle.org/current/userguide/platforms.html).

## [1.8.0] - 2022-01-22

See [Release](https://github.com/itsallcode/white-rabbit/releases/tag/v1.8.0) / [Milestone](https://github.com/itsallcode/white-rabbit/milestone/10?closed=1)
Expand Down
4 changes: 4 additions & 0 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ javadoc {
enabled = true
}

dependencies {
testImplementation libs.bundles.testUtils
}

def getOptionalProperty(String name) {
if(project.hasProperty(name)) {
return project.property(name)
Expand Down
36 changes: 9 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
plugins {
id 'eclipse'
id "org.sonarqube" version "3.3"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.1"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.3"
id "io.codearte.nexus-staging" version "0.30.0"
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
id "com.moowork.node" version "1.3.1" apply false
id "com.github.ben-manes.versions" version "0.41.0"
id "com.github.ben-manes.versions" version "0.42.0"
id "org.panteleyev.jpackageplugin" version "1.3.1" apply false
id "org.gradle.crypto.checksum" version "1.2.0" apply false
}

ext {
junitVersion = '5.8.2'
log4jVersion = '2.17.1'
mockitoVersion = '4.2.0'
yassonVersion = '2.0.3'
jsonBindApiVersion = '2.0.0'
javaFxVersion = '18-ea+9'
monocleVersion = '12.0.1+2'
id "org.gradle.crypto.checksum" version "1.4.0" apply false
}

def getProjectVersion() {
Expand Down Expand Up @@ -53,24 +43,16 @@ subprojects {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}

dependencies {
testImplementation "org.assertj:assertj-core:3.22.0"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.mockito:mockito-junit-jupiter:$mockitoVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
testImplementation "org.junit-pioneer:junit-pioneer:1.5.0"
testImplementation "nl.jqno.equalsverifier:equalsverifier:3.8.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testRuntimeOnly "org.apache.logging.log4j:log4j-core:$log4jVersion"
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

test {
useJUnitPlatform()
testing {
suites {
test {
useJUnitJupiter(libs.versions.junitJupiter.get())
}
}
}

javadoc {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
21 changes: 11 additions & 10 deletions jfxui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@ plugins {

dependencies {
implementation project(':logic')
def javaFxVersion = libs.versions.javafx.get()
['win', 'mac', 'linux'].forEach {platform ->
implementation "org.openjfx:javafx-base:$javaFxVersion:$platform"
implementation "org.openjfx:javafx-graphics:$javaFxVersion:$platform"
implementation "org.openjfx:javafx-controls:$javaFxVersion:$platform"
}

implementation "org.apache.logging.log4j:log4j-api:$log4jVersion"
implementation "org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.600"
implementation "jakarta.json.bind:jakarta.json.bind-api:${jsonBindApiVersion}"
implementation libs.log4j.api
implementation libs.jdtAnnotations
implementation libs.jsonBindApi

runtimeOnly "org.apache.logging.log4j:log4j-core:${log4jVersion}"
runtimeOnly "org.apache.logging.log4j:log4j-jul:${log4jVersion}"
runtimeOnly "org.fusesource.jansi:jansi:2.4.0"
runtimeOnly libs.log4j.core
runtimeOnly libs.log4j.jul
runtimeOnly libs.jansi

testImplementation "jakarta.json.bind:jakarta.json.bind-api:${jsonBindApiVersion}"
testRuntimeOnly "org.eclipse:yasson:${yassonVersion}"
testImplementation libs.testfx
testImplementation libs.bundles.testUtils

testImplementation "org.testfx:testfx-junit5:4.0.16-alpha"
testRuntimeOnly "org.testfx:openjfx-monocle:jdk-$monocleVersion"
testRuntimeOnly libs.yasson
testRuntimeOnly libs.monocle
}

shadowJar {
Expand Down
8 changes: 5 additions & 3 deletions logic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ plugins {

dependencies {
api project(':api')
implementation "org.apache.logging.log4j:log4j-api:$log4jVersion"
implementation "jakarta.json.bind:jakarta.json.bind-api:${jsonBindApiVersion}"
implementation "org.eclipse:yasson:${yassonVersion}"
implementation libs.log4j.api
implementation libs.jsonBindApi
implementation libs.yasson

testImplementation libs.bundles.testUtils
}

ext.generatedResourcesFolder = file("$buildDir/generated-resources")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.itsallcode.whiterabbit.logic.service.holidays;

import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;

import java.time.LocalDate;
import java.time.YearMonth;
Expand All @@ -20,6 +19,12 @@ class HolidayAggregator
// used to separate names of of multiple holidays occurring on the same day
private static final String DELIMITER = ", ";
private final HashMap<LocalDate, List<HolidayInstance>> holidays = new HashMap<>();
private final ModelFactory modelFactory;

HolidayAggregator(ModelFactory modelFactory)
{
this.modelFactory = modelFactory;
}

public void collect(Holidays holidayProvider, YearMonth month)
{
Expand All @@ -29,12 +34,12 @@ public void collect(Holidays holidayProvider, YearMonth month)
}
}

public List<DayData> createDayData(ModelFactory factory)
public List<DayData> createDayData()
{
return holidays.entrySet().stream()
.map(e -> toDayData(factory, e.getKey(), e.getValue()))
.map(e -> toDayData(e.getKey(), e.getValue()))
.sorted((a, b) -> a.getDate().compareTo(b.getDate()))
.collect(toList());
.toList();
}

private void collect(Holidays holidayProvider, LocalDate date)
Expand All @@ -56,9 +61,9 @@ private void collect(Holidays holidayProvider, LocalDate date)
}
}

private DayData toDayData(ModelFactory factory, LocalDate date, List<HolidayInstance> instances)
private DayData toDayData(LocalDate date, List<HolidayInstance> instances)
{
final DayData holiday = factory.createDayData();
final DayData holiday = modelFactory.createDayData();
holiday.setDate(date);
// Depending on the category of each instance we could set different
// types here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ public HolidayService(List<Holidays> providers)

public List<DayData> getHolidays(ModelFactory factory, YearMonth month)
{
final HolidayAggregator aggregator = new HolidayAggregator();
final HolidayAggregator aggregator = new HolidayAggregator(factory);
for (final Holidays provider : holidayProviders)
{
aggregator.collect(provider, month);
}
return aggregator.createDayData(factory);
return aggregator.createDayData();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ void test()
when(holidayProvider2.getHolidays(D2)).thenReturn(Arrays.asList(h4));
when(holidayProvider2.getHolidays(not(or(eq(D1), eq(D2))))).thenReturn(Collections.emptyList());

final HolidayAggregator aggregator = new HolidayAggregator();
final HolidayAggregator aggregator = new HolidayAggregator(new JsonModelFactory());
aggregator.collect(holidayProvider1, YEAR_MONTH);
aggregator.collect(holidayProvider2, YEAR_MONTH);

final List<DayData> days = aggregator.createDayData(new JsonModelFactory());
final List<DayData> days = aggregator.createDayData();
assertThat(days.get(0).getComment()).isEqualTo("h4");
assertThat(days.get(1).getComment()).isEqualTo("h1, h2, h3");
}
Expand Down
5 changes: 2 additions & 3 deletions plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
subprojects {
apply plugin: "com.github.johnrengelman.shadow"

def log4jApi = "org.apache.logging.log4j:log4j-api:$log4jVersion"
dependencies {
implementation project(':api')
implementation log4jApi
implementation libs.log4j.api
}

shadowJar {
archiveBaseName.set("${project.name}-plugin")
archiveClassifier.set(null)
archiveVersion.set("")
dependencies {
exclude(dependency(log4jApi))
exclude(dependency('org.apache.logging.log4j:log4j-api'))
exclude(project(':api'))
}
}
Expand Down
1 change: 1 addition & 0 deletions plugins/csv/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dependencies {
testImplementation project(':logic')
testImplementation libs.bundles.testUtils
}
8 changes: 5 additions & 3 deletions plugins/holiday-calculator/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
dependencies {
implementation 'org.itsallcode:holiday-calculator:0.2.0'

testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}") {
implementation(libs.holidaycalculator) {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
testImplementation libs.bundles.testUtils
testRuntimeOnly(libs.log4j.slf4j) {
exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.itsallcode.whiterabbit.plugin.holidaycalculator;

import static java.util.stream.Collectors.toList;

import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
Expand All @@ -25,7 +23,7 @@ class CalculatedHolidays implements org.itsallcode.whiterabbit.api.features.Holi

private final HolidaySet holidaySet;

public CalculatedHolidays(Path dataDir)
CalculatedHolidays(Path dataDir)
{
holidaySet = new HolidaySet(readHolidays(dataDir.resolve(HOLIDAYS_CONFIGURATION_FILE)));
}
Expand Down Expand Up @@ -61,9 +59,14 @@ protected List<Holiday> readHolidays(Path configurationFile)
@Override
public List<Holidays.HolidayInstance> getHolidays(LocalDate date)
{
return holidaySet.instances(date).stream()
List<HolidayInstance> holidays = holidaySet.instances(date).stream()
.map(h -> new HolidayInstanceImpl(h.getCategory(), h.getName(), date))
.collect(toList());
.map(HolidayInstance.class::cast)
.toList();
if (!holidays.isEmpty())
{
LOG.debug("Found {} holidays for date {}: {}", holidays.size(), date, holidays);
}
return holidays;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,8 @@

import org.itsallcode.whiterabbit.api.features.Holidays.HolidayInstance;

public class HolidayInstanceImpl implements HolidayInstance
record HolidayInstanceImpl(String category, String name, LocalDate date) implements HolidayInstance
{
private final String category;
private final String name;
private final LocalDate date;

public HolidayInstanceImpl(String category, String name, LocalDate date)
{
this.category = category;
this.name = name;
this.date = date;
}

@Override
public String getCategory()
{
Expand Down
17 changes: 8 additions & 9 deletions plugins/pmsmart/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@

dependencies {
def seleniumVersion = "4.1.1"
implementation libs.selenium.edgeDriver
implementation libs.selenium.support
runtimeOnly libs.selenium.devtools
implementation libs.webdrivermanager

implementation "org.seleniumhq.selenium:selenium-edge-driver:$seleniumVersion"
implementation "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
runtimeOnly "org.seleniumhq.selenium:selenium-devtools:4.0.0-rc-1"
implementation "io.github.bonigarcia:webdrivermanager:5.0.3"

testImplementation project(':logic')
testImplementation "jakarta.json.bind:jakarta.json.bind-api:${jsonBindApiVersion}"

runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}") {
testImplementation libs.jsonBindApi
testImplementation libs.bundles.testUtils

runtimeOnly(libs.log4j.slf4j) {
exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
}
Expand Down
Loading