diff --git a/LICENSE b/LICENSE index 13f3f66..1082f83 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ - OS - Information about the system, Java runtime, OS, Window Manager, and Desktop Environment. [The Apache Software License, Version 2.0] https://git.dorkbox.com/dorkbox/OS - Copyright 2022 + Copyright 2023 Dorkbox LLC Extra license information diff --git a/README.md b/README.md index abe052b..1643110 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Maven Info com.dorkbox OS - 1.1 + 1.2 ``` @@ -30,7 +30,7 @@ Gradle Info ``` dependencies { ... - implementation("com.dorkbox:OS:1.1") + implementation("com.dorkbox:OS:1.2") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index df288dd..1043178 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -38,7 +38,7 @@ object Extras { // set for the project const val description = "Information about the system, Java runtime, OS, Window Manager, and Desktop Environment." const val group = "com.dorkbox" - const val version = "1.1" + const val version = "1.2" // set as project.ext const val name = "OS" diff --git a/src/dorkbox/os/JVM.kt b/src/dorkbox/os/JVM.kt new file mode 100644 index 0000000..b82abc6 --- /dev/null +++ b/src/dorkbox/os/JVM.kt @@ -0,0 +1,10 @@ +package dorkbox.os + +internal object JVM { + // java 8 cannot use JPMS. We use a multi-release jar to detect the state for java9+ runtimes + + /** + * Returns true if the currently running JVM is using the classpath or modules (JPMS) + */ + var usesJpms = false +} diff --git a/src/dorkbox/os/OS.kt b/src/dorkbox/os/OS.kt index 71966d9..763aa0b 100644 --- a/src/dorkbox/os/OS.kt +++ b/src/dorkbox/os/OS.kt @@ -29,7 +29,7 @@ object OS { /** * Gets the version number. */ - const val version = "1.1" + const val version = "1.2" init { // Add this project to the updates system, which verifies this class + UUID + version information @@ -43,7 +43,7 @@ object OS { const val LINE_SEPARATOR_MACOS = "\r" const val LINE_SEPARATOR_WINDOWS = "\r\n" - val TEMP_DIR = File(getProperty("java.io.tmpdir", "temp")).absoluteFile!! + val TEMP_DIR = File(getProperty("java.io.tmpdir", "temp")).absoluteFile /** * The currently running MAJOR java version as a NUMBER. For example, "Java version 1.7u45", and converts it into 7, uses JEP 223 for java > 9 @@ -74,6 +74,11 @@ object OS { } } + /** + * Returns true if the currently running JVM is using the classpath or modules (JPMS) + */ + val usesJpms = JVM.usesJpms + /** * Returns the *ORIGINAL* system time zone, before (*IF*) it was changed to UTC */ diff --git a/src9/dorkbox/os/EmptyClass.java b/src9/dorkbox/os/EmptyClass.java deleted file mode 100644 index c650f84..0000000 --- a/src9/dorkbox/os/EmptyClass.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2021 dorkbox, llc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dorkbox.os; - -/** - * Required for intellij to not complain regarding `module-info` for a multi-release jar. - * This file is completely ignored by the gradle build process - */ -public -class EmptyClass {} diff --git a/src9/dorkbox/os/JVM.kt b/src9/dorkbox/os/JVM.kt new file mode 100644 index 0000000..7986c19 --- /dev/null +++ b/src9/dorkbox/os/JVM.kt @@ -0,0 +1,8 @@ +package dorkbox.os + +internal object JVM { + /** + * Returns true if the currently running JVM is using the classpath or modules (JPMS) + */ + var usesJpms = true == java.lang.ModuleLayer.boot().findModule("java.desktop").isPresent +}