Skip to content

Commit cc565d4

Browse files
committed
I read the Gradle docs again
1 parent 0e4affd commit cc565d4

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "fish.cichlidmc"
7-
version = "2.0.0"
7+
version = "2.0.1"
88

99
repositories {
1010
mavenCentral()
@@ -22,6 +22,11 @@ java {
2222
}
2323
}
2424

25+
tasks.compileJava {
26+
// sync module version so it can be read at runtime
27+
options.javaModuleVersion = provider { version as String }
28+
}
29+
2530
tasks.test {
2631
useJUnitPlatform()
2732
}

src/main/java/module-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
open module fish.cichlidmc.tinyjson {
2-
requires static org.jetbrains.annotations;
2+
requires static transitive org.jetbrains.annotations;
33

44
exports fish.cichlidmc.tinyjson;
55
exports fish.cichlidmc.tinyjson.value;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package fish.cichlidmc.tinyjson.test.def;
2+
3+
import fish.cichlidmc.tinyjson.TinyJson;
4+
import org.junit.jupiter.api.Test;
5+
6+
public final class MiscTests {
7+
@Test
8+
public void checkModuleVersion() {
9+
TinyJson.class.getModule().getDescriptor().version().orElseThrow();
10+
}
11+
}

src/test/java/module-info.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// the test sourceSet must be a module for Gradle to treat the main sourceSet as a module.
2+
// we want that so we can verify that the metadata is set correctly.
3+
open module fish.cichlidmc.tinyjson.test {
4+
requires fish.cichlidmc.tinyjson;
5+
requires org.junit.jupiter.api;
6+
}

0 commit comments

Comments
 (0)