diff --git a/README.adoc b/README.adoc deleted file mode 100644 index a42662c..0000000 --- a/README.adoc +++ /dev/null @@ -1,14 +0,0 @@ -# xbib Time - -image:https://api.travis-ci.org/xbib/time.svg[title="Build status", link="https://travis-ci.org/xbib/time/"] -image:https://img.shields.io/sonar/http/nemo.sonarqube.com/org.xbib%3Atime/coverage.svg?style=flat-square[title="Coverage", link="https://sonarqube.com/dashboard/index?id=org.xbib%3Atime"] -image:https://maven-badges.herokuapp.com/maven-central/org.xbib/time/badge.svg[title="Maven Central", link="http://search.maven.org/#search%7Cga%7C1%7Cxbib%20time"] -image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[title="Apache License 2.0", link="https://opensource.org/licenses/Apache-2.0"] - -This is a bundle of time utilities for Java 8 Time API. It consists of - -- Chronic: parsing natural language to compute time spans (from https://github.com/samtingleff/jchronic) -- Pretty: pretty printing time durations (from https://github.com/ocpsoft/prettytime) -- Format: format time descriptions (from https://github.com/JodaOrg/joda-time) - -This project has no dependencies. diff --git a/README.md b/README.md new file mode 100644 index 0000000..96cce36 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# xbib Time + +This is a bundle of time utilities for Java 8 Time API. It consists of + +- Chronic: parsing natural language to compute time spans (from https://github.com/samtingleff/jchronic) +- Pretty: pretty printing time durations (from https://github.com/ocpsoft/prettytime) +- Format: format time descriptions (from https://github.com/JodaOrg/joda-time) + +This project has no dependencies. diff --git a/build.gradle b/build.gradle index c750a0b..94a38a5 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } wrapper { - gradleVersion = "${project.property('gradle.wrapper.version')}" + gradleVersion = libs.versions.gradle.get() distributionType = Wrapper.DistributionType.ALL } @@ -25,14 +25,15 @@ ext { apply plugin: 'java-library' -dependencies { - testImplementation "org.quartz-scheduler:quartz:${project.property('quartz.version')}" - testImplementation "com.google.caliper:caliper:${project.property('caliper.version')}" -} - apply from: rootProject.file('gradle/ide/idea.gradle') apply from: rootProject.file('gradle/repositories/maven.gradle') apply from: rootProject.file('gradle/compile/java.gradle') apply from: rootProject.file('gradle/test/junit5.gradle') apply from: rootProject.file('gradle/publishing/publication.gradle') apply from: rootProject.file('gradle/publishing/sonatype.gradle') + +dependencies { + testImplementation libs.quartz + testImplementation libs.caliper +} + diff --git a/gradle.properties b/gradle.properties index 04a120c..6d58ced 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,5 @@ group = org.xbib name = time -version = 2.2.0 +version = 2.3.0 org.gradle.warning.mode = ALL -gradle.wrapper.version = 7.3.2 -quartz.version = 2.3.2 -caliper.version = 1.0-beta-2 diff --git a/gradle/test/junit5.gradle b/gradle/test/junit5.gradle index d08c379..09ce233 100644 --- a/gradle/test/junit5.gradle +++ b/gradle/test/junit5.gradle @@ -1,12 +1,8 @@ - -def junitVersion = project.hasProperty('junit.version')?project.property('junit.version'):'5.8.2' -def hamcrestVersion = project.hasProperty('hamcrest.version')?project.property('hamcrest.version'):'2.2' - dependencies { - testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}" - testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}" - testImplementation "org.hamcrest:hamcrest-library:${hamcrestVersion}" - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}" + testImplementation libs.junit.jupiter.api + testImplementation libs.junit.jupiter.params + testImplementation libs.hamcrest + testRuntimeOnly libs.junit.jupiter.engine } test { @@ -24,4 +20,16 @@ test { "${result.skippedTestCount} skipped" } } + // for Guava using reflection on JDK classes which JDK17 does not like + jvmArgs '--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED', + '--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED', + '--add-exports=java.base/sun.nio.ch=ALL-UNNAMED', + '--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED', + '--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED', + '--add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED', + '--add-opens=java.base/java.lang=ALL-UNNAMED', + '--add-opens=java.base/java.lang.reflect=ALL-UNNAMED', + '--add-opens=java.base/java.io=ALL-UNNAMED', + '--add-opens=java.base/java.util=ALL-UNNAMED' + } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..249e583 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac0b842..2ec77e5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..a69d9cb 100755 --- a/gradlew +++ b/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f..53a6b23 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle index 89f4110..b14355c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,16 @@ -rootProject.name = name +dependencyResolutionManagement { + versionCatalogs { + libs { + version('gradle', '7.5') + version('groovy', '3.0.10') + version('junit', '5.8.2') + library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit') + library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit') + library('junit-jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit') + library('hamcrest', 'org.hamcrest', 'hamcrest-library').version('2.2') + library('junit4', 'junit', 'junit').version('4.13.2') + library('quartz', 'org.quartz-scheduler', 'quartz').version('2.3.2') + library('caliper', 'com.google.caliper', 'caliper').version('1.0-beta-3') + } + } +} diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index aff965b..9b1a76e 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -9,5 +9,4 @@ module org.xbib.time { exports org.xbib.time.pretty.i18n; exports org.xbib.time.pretty.units; exports org.xbib.time.schedule; - exports org.xbib.time.util; } diff --git a/src/main/java/org/xbib/time/schedule/DayOfWeekField.java b/src/main/java/org/xbib/time/schedule/DayOfWeekField.java index 9ebaa42..038165c 100644 --- a/src/main/java/org/xbib/time/schedule/DayOfWeekField.java +++ b/src/main/java/org/xbib/time/schedule/DayOfWeekField.java @@ -117,8 +117,8 @@ public class DayOfWeekField extends DefaultField { protected Builder(boolean oneBased) { super(1, 7); this.oneBased = oneBased; - last = new LinkedHashSet<>(); - nth = new LinkedHashSetMultiMap<>(); + this.last = new LinkedHashSet<>(); + this.nth = new LinkedHashSetMultiMap<>(); } @Override diff --git a/src/test/java/org/xbib/time/pretty/PrettyTimeI18n_in_ID_Test.java b/src/test/java/org/xbib/time/pretty/PrettyTimeI18n_in_ID_Test.java index f190551..54d2301 100644 --- a/src/test/java/org/xbib/time/pretty/PrettyTimeI18n_in_ID_Test.java +++ b/src/test/java/org/xbib/time/pretty/PrettyTimeI18n_in_ID_Test.java @@ -26,9 +26,9 @@ public class PrettyTimeI18n_in_ID_Test { @Test public void testLocaleISOCorrectness() { - assertEquals("in", this.locale.getLanguage()); + assertEquals("id", this.locale.getLanguage()); assertEquals("ID", this.locale.getCountry()); - assertEquals("Bahasa Indonesia", this.locale.getDisplayLanguage()); + assertEquals("Indonesia", this.locale.getDisplayLanguage()); assertEquals("Indonesia", this.locale.getDisplayCountry()); }