mirror of
https://github.com/AppleCommander/applesingle.git
synced 2026-10-22 03:02:27 +00:00
Adding module version detection.
This commit is contained in:
1 parent
4eca8b01d2
commit
e3dc65c62a
2 files changed
+19
-1
No files matched your search
@@ -25,6 +25,11 @@ jar {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.compilerArgs += ['--module-path', classpath.asPath]
|
||||
options.javaModuleVersion = project.version.toString()
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -47,7 +47,20 @@ public class AppleSingle {
|
||||
|
||||
public static final String VERSION;
|
||||
static {
|
||||
VERSION = AppleSingle.class.getPackage().getImplementationVersion();
|
||||
String version = AppleSingle.class.getPackage().getImplementationVersion();
|
||||
if (version == null && AppleSingle.class.getModule().getDescriptor() != null) {
|
||||
// When run under the Java Module system (JPMS) we need to get it a different way.
|
||||
version = AppleSingle.class.getModule()
|
||||
.getDescriptor()
|
||||
.version()
|
||||
.map(Object::toString)
|
||||
.orElse("Development Build");
|
||||
}
|
||||
// For unit tests, the descriptor (apparently) doesn't exist, so we skip it.
|
||||
if (version == null) {
|
||||
version = "Unit Testing";
|
||||
}
|
||||
VERSION = version;
|
||||
}
|
||||
|
||||
private Map<Integer,Consumer<Entry>> entryConsumers = new HashMap<>();
|
||||
|
||||
Reference in new issue
Block a user