Skip to content

Commit

Permalink
Merge branch 'dependency-analysis' into dev (#307, note: #308)
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed Mar 20, 2024
2 parents b8d1aca + e3fcf73 commit 6d62037
Show file tree
Hide file tree
Showing 24 changed files with 129 additions and 63 deletions.
3 changes: 2 additions & 1 deletion app/hcc-quarkus/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ plugins {

dependencies {

implementation(libs.jackson.databind)

implementation(project(":modules:hcc-bootstrap"))
implementation(project(":modules:hcc-director"))
implementation(libs.jackson.databind)

// Enable MQTT
implementation(project(":modules:hcc-mqtt"))
Expand Down
2 changes: 0 additions & 2 deletions app/hcc-springboot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ plugins {
}

dependencies {

implementation(project(":modules:hcc-bootstrap"))
testImplementation(libs.reactor.test)
}

// SpringBoot additions
Expand Down
17 changes: 1 addition & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ plugins {
alias(libs.plugins.quarkus.plugin) apply false

alias(libs.plugins.gradle.versions)
alias(libs.plugins.gradle.dependency.analysis)
}

sonarqube {
Expand All @@ -25,7 +26,6 @@ sonarqube {
subprojects {

apply(plugin = "java")
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "jacoco")
apply(plugin = rootProject.libs.plugins.errorprone.get().pluginId)
Expand Down Expand Up @@ -59,21 +59,6 @@ subprojects {
}

dependencies {

implementation(rootProject.libs.log4j.api)
implementation(rootProject.libs.log4j.core)

implementation(rootProject.libs.reactor.core)
implementation(rootProject.libs.reactor.tools)

testImplementation(rootProject.libs.mockito)
testImplementation(rootProject.libs.junit5.api)
testImplementation(rootProject.libs.junit5.params)
testImplementation(rootProject.libs.assertj.core)
testImplementation(rootProject.libs.reactor.test)

testRuntimeOnly(rootProject.libs.junit5.engine)

errorprone(rootProject.libs.errorprone)
}

Expand Down
28 changes: 14 additions & 14 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,46 +1,45 @@
[versions]

assertj = "3.24.2"
assertj = "3.25.3"
commons-lang3 = "3.14.0"
errorprone = "2.24.0"
errorprone = "2.26.1"
google-api-services-calendar = "v3-rev305-1.23.0"
google-cloud-storage = "1.48.0"
google-oauth-client-jetty = "1.23.0"
gradle-dependency-analysis = "1.30.0"
hivemq-mqtt = "1.3.3"
httpclient = "4.5.14"
influxdb = "2.24"
jackson = "2.16.1"
jackson = "2.17.0"
jacoco = "0.8.11"
jib = "3.4.0"
jib = "3.4.1"
jmdns = "3.5.9"
junit5 = "5.10.1"
junit5 = "5.10.2"
log4j = "2.20.0"
mapstruct = "1.5.5.Final"
mockito = "5.8.0"
mockito = "5.11.0"
netty = "1.1.14"
reactor = "3.6.1"
reactor = "3.6.4"
rxtx = "2.1.7"
sonarqube = "4.4.1.3373"
spring-boot-plugin = "3.2.1"
spring-boot-plugin = "3.2.3"

# Quarkus

quarkus-platform = "3.6.4"
quarkus-platform = "3.8.2"

# This relates to Spring packages used outside SpringBoot, those are managed by their own plugin
# Gradle is smart enough to match this to SpringBoot, but it'll be a good idea to keep an eye on it.

spring-standalone = "6.1.2"
spring-standalone = "6.1.4"

[libraries]

assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" }
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commons-lang3" }
errorprone = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone" }
google-api-services-calendar = { module = "com.google.apis:google-api-services-calendar", version.ref = "google-api-services-calendar" }
google-cloud-storage = { module = "com.google.cloud:google-cloud-storage", version.ref = "google-cloud-storage" }
google-oauth-client-jetty = { module = "com.google.oauth-client:google-oauth-client-jetty", version.ref = "google-oauth-client-jetty" }
hivemq-mqtt-client-reactor = { module = "com.hivemq:hivemq-mqtt-client-reactor", version.ref = "hivemq-mqtt" }
hivemq-mqtt-client = { module = "com.hivemq:hivemq-mqtt-client", version.ref = "hivemq-mqtt" }
httpclient = { module = "org.apache.httpcomponents:httpclient", version.ref = "httpclient" }
influxdb = { module = "org.influxdb:influxdb-java", version.ref = "influxdb" }
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
Expand Down Expand Up @@ -94,7 +93,8 @@ micrometer-registry-jmx = { module = "io.micrometer:micrometer-registry-jmx" }

errorprone = { id = "net.ltgt.errorprone", version = "3.1.0" }
git-properties = { id = "com.gorylenko.gradle-git-properties", version = "2.4.1" }
gradle-versions = { id = "com.github.ben-manes.versions", version = "0.50.0"}
gradle-dependency-analysis = { id = "com.autonomousapps.dependency-analysis", version.ref = "gradle-dependency-analysis" }
gradle-versions = { id = "com.github.ben-manes.versions", version = "0.51.0"}
jib = { id = "com.google.cloud.tools.jib", version.ref = "jib" }
quarkus-plugin = { id = "io.quarkus", version.ref = "quarkus-platform" }
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }
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,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
5 changes: 5 additions & 0 deletions modules/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
subprojects {
dependencies {
testRuntimeOnly(rootProject.libs.junit5.engine)
}
}
21 changes: 12 additions & 9 deletions modules/hcc-bootstrap/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
plugins {
java
`java-library`
}

dependencies {

implementation(project(":modules:hcc-data-source-api"))
api(project(":modules:hcc-common"))
implementation(project(":modules:hcc-common"))
api(project(":modules:hcc-config"))
implementation(project(":modules:hcc-director"))

implementation(libs.jackson.databind)
api(project(":modules:hcc-data-source-api"))
api(project(":modules:hcc-director"))

api(libs.jackson.databind)
implementation(libs.jackson.dataformat.yaml)
implementation(libs.jackson.datatype.jdk8)
implementation(libs.jackson.datatype.jsr310)
implementation(libs.reactor.tools)

// VT: NOTE: "implementation()" dependencies will migrate to
// "runtimeOnly" after the annotation based instantiation is introduced

// Enable the Swing console
implementation(project(":modules:hcc-swing"))
api(project(":modules:hcc-swing"))

// Enable InfluxDB logger
implementation(project(":modules:hcc-influxdb"))
Expand All @@ -30,17 +32,16 @@ dependencies {
runtimeOnly(project(":modules:hcc-xbee"))

// Enable MQTT
implementation(project(":modules:hcc-mqtt"))
api(project(":modules:hcc-mqtt"))

// Enable Home Assistant integration
implementation(project(":modules:hcc-ha"))

// Enable remote control over HTTP
implementation(project(":modules:hcc-http"))
implementation(project(":modules:hcc-http-gae"))

// Enable remote control via WebUI
implementation(project(":modules:hcc-webui"))
api(project(":modules:hcc-webui"))

// Enable Google Calendar integration
implementation(project(":modules:hcc-scheduler-gcal-v3"))
Expand All @@ -53,4 +54,6 @@ dependencies {
annotationProcessor(libs.mapstruct.processor)

testImplementation(libs.assertj.core)
testImplementation(libs.junit5.api)
testImplementation(libs.junit5.params)
}
10 changes: 10 additions & 0 deletions modules/hcc-common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
plugins {
`java-library`
}

dependencies {

api(libs.log4j.api)
api(libs.commons.lang3)
api(libs.reactor.core)

testImplementation(libs.junit5.params)
testImplementation(libs.assertj.core)
testImplementation(libs.reactor.test)
}
6 changes: 4 additions & 2 deletions modules/hcc-config/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
dependencies {

implementation(project(":modules:hcc-model"))
implementation(libs.jackson.databind)

testImplementation(libs.assertj.core)
implementation(project(":modules:hcc-model"))

testImplementation(libs.assertj.core)
testImplementation(libs.jackson.datatype.jdk8)
testImplementation(libs.jackson.datatype.jsr310)
testImplementation(libs.jackson.dataformat.yaml)
testImplementation(libs.junit5.api)
testImplementation(libs.log4j.core)
}
7 changes: 7 additions & 0 deletions modules/hcc-director/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
plugins {
`java-library`
}

dependencies {

api(project(":modules:hcc-common"))
api(project(":modules:hcc-model"))
api(project(":modules:hcc-scheduler"))

testImplementation(libs.assertj.core)
testImplementation(libs.junit5.api)
}
6 changes: 5 additions & 1 deletion modules/hcc-driver/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
plugins {
`java-library`
}

dependencies {

api(project(":modules:hcc-common"))
implementation(project(":modules:hcc-common"))
api(project(":modules:hcc-model"))
}
5 changes: 3 additions & 2 deletions modules/hcc-ha/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
java
`java-library`
}

dependencies {
Expand All @@ -11,5 +11,6 @@ dependencies {
implementation(libs.jackson.datatype.jdk8)
implementation(libs.jackson.datatype.jsr310)

implementation(libs.hivemq.mqtt.client.reactor)
testImplementation(libs.assertj.core)
testImplementation(libs.junit5.api)
}
9 changes: 6 additions & 3 deletions modules/hcc-http-gae/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
plugins {
`java-library`
}

dependencies {

// https://cloud.google.com/docs/authentication/production#auth-cloud-implicit-java
implementation(libs.google.cloud.storage)
implementation(libs.jackson.databind)
implementation(libs.httpclient)

implementation(project(":modules:hcc-common"))
implementation(project(":modules:hcc-http"))
api(project(":modules:hcc-http"))
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.sf.dz3r.view.http.gae.v3;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.sf.dz3r.instrumentation.Marker;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
Expand All @@ -18,7 +18,6 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Type;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
Expand All @@ -35,8 +34,7 @@ public class OAuth2DeviceIdentityProvider {

private final Logger logger = LogManager.getLogger(getClass());

private final Gson gson = new Gson();
private final Type mapType = new TypeToken<Map<String,String>>(){}.getType();
private final ObjectMapper objectMapper = new ObjectMapper();

private final HttpClient httpClient = HttpClientFactory.createClient();

Expand Down Expand Up @@ -249,7 +247,7 @@ private String acquire(
// https://developers.google.com/identity/protocols/OAuth2ForDevices#step-6-handle-responses-to-polling-requests

{
responseMap = gson.fromJson(responseJson, mapType);
responseMap = objectMapper.readValue(responseJson, new TypeReference<>() {});

String accessToken = responseMap.get("access_token");
String refreshToken = responseMap.get("refresh_token");
Expand Down Expand Up @@ -309,7 +307,7 @@ private Map<String, String> getResponseMap(HttpResponse rsp) throws IOException
}

var responseJson = EntityUtils.toString(rsp.getEntity());
Map<String,String> responseMap = gson.fromJson(responseJson, mapType);
Map<String,String> responseMap = objectMapper.readValue(responseJson, new TypeReference<>() {});

logger.debug("response: {}", responseMap);

Expand Down
6 changes: 4 additions & 2 deletions modules/hcc-http/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
dependencies {
plugins {
`java-library`
}

api(libs.httpclient)
dependencies {

api(project(":modules:hcc-director"))
}
4 changes: 4 additions & 0 deletions modules/hcc-influxdb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ dependencies {
implementation(libs.influxdb)

implementation(project(":modules:hcc-director"))

testImplementation(libs.assertj.core)
testImplementation(libs.junit5.api)
testImplementation(libs.reactor.tools)
}
11 changes: 10 additions & 1 deletion modules/hcc-model/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
dependencies {

implementation(project(":modules:hcc-common"))
implementation(libs.jackson.databind)
implementation(libs.log4j.core)

implementation(project(":modules:hcc-common"))

testImplementation(libs.assertj.core)
testImplementation(libs.mockito)
testImplementation(libs.junit5.api)
testImplementation(libs.junit5.params)
testImplementation(libs.reactor.test)
testImplementation(libs.reactor.tools)
}
11 changes: 9 additions & 2 deletions modules/hcc-mqtt/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
dependencies {
plugins {
`java-library`
}

dependencies {

implementation(libs.hivemq.mqtt.client.reactor)
api(libs.hivemq.mqtt.client)
implementation(libs.jackson.databind)

implementation(project(":modules:hcc-common"))
implementation(project(":modules:hcc-model"))

testImplementation(libs.assertj.core)
testImplementation(libs.junit5.api)
testImplementation(libs.reactor.tools)
}
4 changes: 4 additions & 0 deletions modules/hcc-owapi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ dependencies {
implementation(project(":modules:hcc-common"))
implementation(project(":modules:hcc-model"))
implementation(project(":modules:hcc-driver"))

testImplementation(libs.assertj.core)
testImplementation(libs.junit5.api)
testImplementation(libs.reactor.test)
}
Loading

0 comments on commit 6d62037

Please sign in to comment.