Skip to content

Commit 4a0c8fd

Browse files
committed
Add more test coverage
1 parent 14c47e0 commit 4a0c8fd

File tree

17 files changed

+136
-6
lines changed

17 files changed

+136
-6
lines changed

samples/basic/build-logic/src/main/kotlin/org.my.gradle.java-module.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ tasks.test {
99
}
1010

1111
dependencies {
12-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
12+
testRuntimeOnly(javaModuleDependencies.gav("org.junit.jupiter.engine"))
1313
}

samples/basic/gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ org_slf4j = "1.7.28"
55
org_slf4j_simple = "1.7.28"
66

77
org_junit_jupiter_api = "5.7.2"
8+
org_junit_jupiter_engine = "5.7.2"

samples/configuration-cache/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ application {
1010
}
1111

1212
dependencies {
13-
runtimeOnly(libs.slf4j.simple)
13+
runtimeOnly(javaModuleDependencies.gav("org.slf4j.simple"))
1414
}

samples/configuration-cache/build-logic/src/main/kotlin/org.my.gradle.java-module.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ tasks.test {
99
}
1010

1111
dependencies {
12-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
12+
testRuntimeOnly(javaModuleDependencies.gav("org.junit.jupiter.engine"))
1313
}

samples/configuration-cache/gradle/libs.versions.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
org_apache_xmlbeans = "5.0.1"
33
com_fasterxml_jackson_databind = "2.12.5"
44
org_slf4j = "1.7.32"
5+
org_slf4j_simple = "1.7.32"
56

67
org_junit_jupiter_api = "5.7.2"
7-
8-
[libraries]
9-
slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "org_slf4j" }
8+
org_junit_jupiter_engine = "5.7.2"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
plugins {
2+
id("org.my.gradle.java-module")
3+
id("application")
4+
}
5+
6+
application {
7+
applicationDefaultJvmArgs = listOf("-ea")
8+
mainClass.set("org.my.app.App")
9+
mainModule.set("org.my.app")
10+
}
11+
12+
dependencies {
13+
runtimeOnly(javaModuleDependencies.gav("org.slf4j.simple"))
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module org.my.app {
2+
requires org.slf4j;
3+
requires org.my.lib;
4+
requires static org.apache.xmlbeans;
5+
6+
exports org.my.app;
7+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.my.app;
2+
3+
import com.fasterxml.jackson.databind.ObjectMapper;
4+
import org.apache.xmlbeans.impl.tool.XMLBean;
5+
import org.slf4j.spi.LoggerFactoryBinder;
6+
7+
public class App {
8+
public static void main(String[] args) {
9+
doWork();
10+
}
11+
12+
public static boolean doWork() {
13+
ObjectMapper om = new ObjectMapper();
14+
if (!om.canSerialize(LoggerFactoryBinder.class)) {
15+
throw new RuntimeException("Boom!");
16+
}
17+
System.out.println(App.class.getModule().getName());
18+
19+
try {
20+
new XMLBean();
21+
throw new RuntimeException("Boom!");
22+
} catch (NoClassDefFoundError e) {
23+
// This is expected at runtime!
24+
}
25+
return true;
26+
}
27+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
dependencies {
6+
implementation("de.jjohannes.gradle:java-module-dependencies:0.3")
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pluginManagement {
2+
// This is for testing against the latest version of the plugin, remove if you copied this for a real project
3+
includeBuild(extra.properties["pluginLocation"] ?: rootDir.parentFile.parentFile.parent)
4+
}
5+
6+
dependencyResolutionManagement {
7+
repositories.gradlePluginPortal()
8+
}

0 commit comments

Comments
 (0)