diff options
author | Kristóf Marussy <kristof@marussy.com> | 2023-04-08 23:22:02 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2023-04-08 23:22:02 +0200 |
commit | 9c327a95dfa844f22f21fe99a8b45cace36567df (patch) | |
tree | 38841b46d86e184d9714a80e8a5fb8c650346e44 | |
parent | chore(deps): bump dependencies (diff) | |
download | refinery-9c327a95dfa844f22f21fe99a8b45cace36567df.tar.gz refinery-9c327a95dfa844f22f21fe99a8b45cace36567df.tar.zst refinery-9c327a95dfa844f22f21fe99a8b45cace36567df.zip |
build: always prefer slf4j instead of log4j 1.x
Make sure we get slf4j in every test source set and every application by
default. Saves configuration effort when creating a new library that tests
VIATRA or other dependencies that require log4j.
4 files changed, 21 insertions, 14 deletions
diff --git a/buildSrc/src/main/kotlin/refinery-java-application.gradle.kts b/buildSrc/src/main/kotlin/refinery-java-application.gradle.kts index b3fab1fa..65409acf 100644 --- a/buildSrc/src/main/kotlin/refinery-java-application.gradle.kts +++ b/buildSrc/src/main/kotlin/refinery-java-application.gradle.kts | |||
@@ -1,3 +1,5 @@ | |||
1 | import org.gradle.accessors.dm.LibrariesForLibs | ||
2 | |||
1 | plugins { | 3 | plugins { |
2 | application | 4 | application |
3 | id("com.github.johnrengelman.shadow") | 5 | id("com.github.johnrengelman.shadow") |
@@ -5,6 +7,18 @@ plugins { | |||
5 | 7 | ||
6 | apply(plugin = "refinery-java-conventions") | 8 | apply(plugin = "refinery-java-conventions") |
7 | 9 | ||
10 | // Use log4j-over-slf4j instead of log4j 1.x when running the application. | ||
11 | configurations.named("runtimeClasspath") { | ||
12 | exclude(group = "log4j", module = "log4j") | ||
13 | } | ||
14 | |||
15 | val libs = the<LibrariesForLibs>() | ||
16 | |||
17 | dependencies { | ||
18 | implementation(libs.slf4j.simple) | ||
19 | implementation(libs.slf4j.log4j) | ||
20 | } | ||
21 | |||
8 | for (taskName in listOf("distTar", "distZip", "shadowDistTar", "shadowDistZip")) { | 22 | for (taskName in listOf("distTar", "distZip", "shadowDistTar", "shadowDistZip")) { |
9 | tasks.named(taskName) { | 23 | tasks.named(taskName) { |
10 | enabled = false | 24 | enabled = false |
diff --git a/buildSrc/src/main/kotlin/refinery-java-conventions.gradle.kts b/buildSrc/src/main/kotlin/refinery-java-conventions.gradle.kts index 2d5ce8b5..3f9b4208 100644 --- a/buildSrc/src/main/kotlin/refinery-java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/refinery-java-conventions.gradle.kts | |||
@@ -17,6 +17,11 @@ repositories { | |||
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
20 | // Use log4j-over-slf4j instead of log4j 1.x in the tests. | ||
21 | configurations.testRuntimeClasspath { | ||
22 | exclude(group = "log4j", module = "log4j") | ||
23 | } | ||
24 | |||
20 | val libs = the<LibrariesForLibs>() | 25 | val libs = the<LibrariesForLibs>() |
21 | 26 | ||
22 | dependencies { | 27 | dependencies { |
@@ -28,6 +33,8 @@ dependencies { | |||
28 | testImplementation(libs.junit.params) | 33 | testImplementation(libs.junit.params) |
29 | testImplementation(libs.mockito.core) | 34 | testImplementation(libs.mockito.core) |
30 | testImplementation(libs.mockito.junit) | 35 | testImplementation(libs.mockito.junit) |
36 | testImplementation(libs.slf4j.simple) | ||
37 | testImplementation(libs.slf4j.log4j) | ||
31 | } | 38 | } |
32 | 39 | ||
33 | java.toolchain { | 40 | java.toolchain { |
diff --git a/subprojects/language-web/build.gradle.kts b/subprojects/language-web/build.gradle.kts index c68daa9a..b78a0d66 100644 --- a/subprojects/language-web/build.gradle.kts +++ b/subprojects/language-web/build.gradle.kts | |||
@@ -8,11 +8,6 @@ val webapp: Configuration by configurations.creating { | |||
8 | isCanBeResolved = true | 8 | isCanBeResolved = true |
9 | } | 9 | } |
10 | 10 | ||
11 | configurations.all { | ||
12 | // Use log4j-over-slf4j instead of log4j 1.x | ||
13 | exclude(group = "log4j", module = "log4j") | ||
14 | } | ||
15 | |||
16 | dependencies { | 11 | dependencies { |
17 | implementation(project(":refinery-language")) | 12 | implementation(project(":refinery-language")) |
18 | implementation(project(":refinery-language-ide")) | 13 | implementation(project(":refinery-language-ide")) |
@@ -20,8 +15,6 @@ dependencies { | |||
20 | implementation(libs.jetty.servlet) | 15 | implementation(libs.jetty.servlet) |
21 | implementation(libs.jetty.websocket.server) | 16 | implementation(libs.jetty.websocket.server) |
22 | implementation(libs.slf4j.api) | 17 | implementation(libs.slf4j.api) |
23 | implementation(libs.slf4j.simple) | ||
24 | implementation(libs.slf4j.log4j) | ||
25 | implementation(libs.xtext.web) | 18 | implementation(libs.xtext.web) |
26 | webapp(project(path = ":refinery-frontend", configuration = "productionAssets")) | 19 | webapp(project(path = ":refinery-frontend", configuration = "productionAssets")) |
27 | testImplementation(testFixtures(project(":refinery-language"))) | 20 | testImplementation(testFixtures(project(":refinery-language"))) |
diff --git a/subprojects/store-query-viatra/build.gradle.kts b/subprojects/store-query-viatra/build.gradle.kts index d7a37f11..7451dd83 100644 --- a/subprojects/store-query-viatra/build.gradle.kts +++ b/subprojects/store-query-viatra/build.gradle.kts | |||
@@ -2,15 +2,8 @@ plugins { | |||
2 | id("refinery-java-library") | 2 | id("refinery-java-library") |
3 | } | 3 | } |
4 | 4 | ||
5 | configurations.testRuntimeClasspath { | ||
6 | // VIATRA requires log4j 1.x, but we use log4j-over-slf4j instead | ||
7 | exclude(group = "log4j", module = "log4j") | ||
8 | } | ||
9 | |||
10 | dependencies { | 5 | dependencies { |
11 | implementation(libs.ecore) | 6 | implementation(libs.ecore) |
12 | api(libs.viatra) | 7 | api(libs.viatra) |
13 | api(project(":refinery-store-query")) | 8 | api(project(":refinery-store-query")) |
14 | testImplementation(libs.slf4j.simple) | ||
15 | testImplementation(libs.slf4j.log4j) | ||
16 | } | 9 | } |