Added detection for the usage of JPMS, updated version

master Version_1.2
Robinson 2023-01-02 10:51:33 +01:00
parent b41e5397ef
commit af8e0ee0cc
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
7 changed files with 29 additions and 30 deletions

View File

@ -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

View File

@ -20,7 +20,7 @@ Maven Info
<dependency>
<groupId>com.dorkbox</groupId>
<artifactId>OS</artifactId>
<version>1.1</version>
<version>1.2</version>
</dependency>
</dependencies>
```
@ -30,7 +30,7 @@ Gradle Info
```
dependencies {
...
implementation("com.dorkbox:OS:1.1")
implementation("com.dorkbox:OS:1.2")
}
```

View File

@ -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"

10
src/dorkbox/os/JVM.kt Normal file
View File

@ -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
}

View File

@ -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
*/

View File

@ -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 {}

8
src9/dorkbox/os/JVM.kt Normal file
View File

@ -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
}