diff --git a/.gitignore b/.gitignore index 6b6051c..561c926 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,59 @@ +build/ +target/ +!.mvn/wrapper/maven-wrapper.jar +.DS_Store +out/ +generated/ +generated_tests/ +generated-resources-dir/ +bin/ +*.swp + +# python +__pycache__ +venv +.pyc + +# Compiled class file +*.class + +# Log file +*.log +*.log* + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.gradle/* + +### IntelliJ IDEA ### .idea -.gradle -build -profilers -testdata -hotspot_*.log \ No newline at end of file +*.iws +*.iml +*.ipr +#### Intellij run configuration +.run/ + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* +*/.gradle/* \ No newline at end of file diff --git a/build.gradle b/build.gradle index dd01eaf..dd20cd0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,4 @@ import me.champeau.jmh.JmhBytecodeGeneratorTask -import org.ajoberstar.grgit.Grgit import org.gradle.internal.os.OperatingSystem import java.time.Duration @@ -8,9 +7,8 @@ plugins { id 'java' id 'scala' id 'me.champeau.jmh' version '0.7.1' - id 'org.ajoberstar.grgit' version '5.2.0' - id 'pl.allegro.tech.build.axion-release' version '1.15.5' - id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' + id 'pl.allegro.tech.build.axion-release' version '1.21.1' + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'maven-publish' id 'signing' } @@ -18,7 +16,8 @@ plugins { scmVersion { versionCreator('versionWithBranch') tag { - prefix = '' + // Property in newer versions + prefix.set('') } } @@ -62,20 +61,43 @@ dependencies { testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitVersion } -tasks.register('downloadTestData') { - doFirst { - def testDataDir = new File("${project.projectDir.getAbsolutePath()}/testdata") - if (!testDataDir.exists()) { - testDataDir.mkdir() - } - def numbersTestDataDir = new File("${testDataDir}/parse-number-fxx-test-data") - if (!numbersTestDataDir.exists()) { - def grgit = Grgit.clone(dir: numbersTestDataDir, uri: 'https://github.com/nigeltao/parse-number-fxx-test-data.git') - grgit.close() +def testdataParent = layout.projectDirectory.dir("testdata") +def repoDir = testdataParent.dir("parse-number-fxx-test-data") + +tasks.register('prepareTestDataDir') { + description = 'Create testdata/ directory if missing' + doLast { + def parent = testdataParent.asFile + if (!parent.exists()) { + logger.lifecycle("Creating ${parent}") + parent.mkdirs() } } } +tasks.register('downloadTestData', Exec) { + description = 'Clone parse-number-fxx-test-data into testdata/ if missing' + group = 'verification' + dependsOn tasks.named('prepareTestDataDir') + + // Run if repo dir missing OR empty (handles half-created directories) + onlyIf { + def d = repoDir.asFile + !d.exists() || (d.isDirectory() && (d.listFiles() == null || d.listFiles().length == 0)) + } + + workingDir testdataParent.asFile + commandLine 'git', 'clone', 'https://github.com/nigeltao/parse-number-fxx-test-data.git', 'parse-number-fxx-test-data' + + doFirst { + logger.lifecycle("Cloning parse-number-fxx-test-data into ${repoDir.asFile}") + } +} + +tasks.withType(Test).configureEach { + dependsOn tasks.named('downloadTestData') +} + tasks.register('test256', Test) { dependsOn downloadTestData useJUnitPlatform() @@ -103,8 +125,18 @@ tasks.register('test512', Test) { } test { + // run JUnit 5 tests + useJUnitPlatform() + + jvmArgs += [ + '--add-modules', 'jdk.incubator.vector', '-Xmx2g' + ] + // still run the vector-width-specific tasks first dependsOn 'test256' dependsOn 'test512' + + // and don't blow up if this particular task finds nothing + failOnNoDiscoveredTests = false } tasks.withType(JmhBytecodeGeneratorTask).configureEach { @@ -206,15 +238,21 @@ if (System.getenv('GPG_KEY_ID')) { nexusPublishing { repositories { sonatype { - nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/") - snapshotRepositoryUrl = uri("https://central.sonatype.com/repository/maven-snapshots/") - stagingProfileId = '3c0bbfe420699e' - username = System.getenv('SONATYPE_USERNAME') - password = System.getenv('SONATYPE_PASSWORD') + nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) + snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) + + if (System.getenv('SONATYPE_USERNAME')) { + username.set(System.getenv('SONATYPE_USERNAME')) + } + if (System.getenv('SONATYPE_PASSWORD')) { + password.set(System.getenv('SONATYPE_PASSWORD')) + } + + stagingProfileId.set('3c0bbfe420699e') } } - connectTimeout = Duration.ofMinutes(3) - clientTimeout = Duration.ofMinutes(3) + connectTimeout.set(Duration.ofMinutes(3)) + clientTimeout.set(Duration.ofMinutes(3)) } def getBooleanProperty(String name, boolean defaultValue) { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1b33c55..f8e1ee3 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 d4081da..23449a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 23d15a9..adff685 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/gradlew.bat b/gradlew.bat index 5eed7ee..e509b2d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -70,11 +70,10 @@ goto fail :execute @rem Setup the command line -set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell