updated Gradle and lys-catalog versions
All checks were successful
CI / build (push) Successful in 24s
All checks were successful
CI / build (push) Successful in 24s
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import net.woggioni.gradle.graalvm.NativeImageConfigurationTask
|
||||||
import net.woggioni.gradle.graalvm.NativeImageTask
|
import net.woggioni.gradle.graalvm.NativeImageTask
|
||||||
import net.woggioni.gradle.graalvm.NativeImagePlugin
|
import net.woggioni.gradle.graalvm.NativeImagePlugin
|
||||||
|
|
||||||
@@ -16,8 +17,17 @@ dependencies {
|
|||||||
implementation project(':')
|
implementation project(':')
|
||||||
}
|
}
|
||||||
|
|
||||||
nativeImage {
|
Property<String> mainModuleName = objects.property(String.class)
|
||||||
mainClass = 'net.woggioni.jwo.benchmark.Main'
|
mainModuleName.set('net.woggioni.jwo')
|
||||||
|
Property<String> mainClassName = objects.property(String.class)
|
||||||
|
mainClassName.set('net.woggioni.jwo.benchmark.Main')
|
||||||
|
|
||||||
|
tasks.named(NativeImagePlugin.CONFIGURE_NATIVE_IMAGE_TASK_NAME, NativeImageConfigurationTask) {
|
||||||
|
mainClass = mainClassName
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named(NativeImagePlugin.NATIVE_IMAGE_TASK_NAME, NativeImageTask) {
|
||||||
useMusl = true
|
useMusl = true
|
||||||
buildStaticImage = true
|
buildStaticImage = true
|
||||||
|
mainClass = mainClassName
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,6 @@ plugins {
|
|||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'jacoco'
|
id 'jacoco'
|
||||||
alias(catalog.plugins.multi.release.jar)
|
|
||||||
alias(catalog.plugins.lombok)
|
alias(catalog.plugins.lombok)
|
||||||
alias(catalog.plugins.sambal)
|
alias(catalog.plugins.sambal)
|
||||||
}
|
}
|
||||||
@@ -24,6 +23,7 @@ allprojects {
|
|||||||
languageVersion = JavaLanguageVersion.of(21)
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
vendor = JvmVendorSpec.ORACLE
|
vendor = JvmVendorSpec.ORACLE
|
||||||
}
|
}
|
||||||
|
modularity.inferModulePath = true
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -63,7 +63,6 @@ allprojects {
|
|||||||
|
|
||||||
pluginManager.withPlugin('java-library') {
|
pluginManager.withPlugin('java-library') {
|
||||||
java {
|
java {
|
||||||
withJavadocJar()
|
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,7 +114,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
options.release = 8
|
options.release = 11
|
||||||
options.compilerArgs << '-parameters'
|
options.compilerArgs << '-parameters'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,6 +3,6 @@ org.gradle.parallel=true
|
|||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
|
|
||||||
gitea.maven.url = https://gitea.woggioni.net/api/packages/woggioni/maven
|
gitea.maven.url = https://gitea.woggioni.net/api/packages/woggioni/maven
|
||||||
jwo.version = 2025.02.25
|
jwo.version = 2025.04.19
|
||||||
lys.version = 2025.02.25
|
lys.version = 2025.04.16
|
||||||
guice.version = 5.0.1
|
guice.version = 5.0.1
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import net.woggioni.gradle.graalvm.NativeImagePlugin
|
import net.woggioni.gradle.graalvm.NativeImagePlugin
|
||||||
import net.woggioni.gradle.graalvm.NativeImageTask
|
import net.woggioni.gradle.graalvm.NativeImageTask
|
||||||
|
import net.woggioni.gradle.graalvm.NativeImageConfigurationTask
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
@@ -16,13 +17,17 @@ dependencies {
|
|||||||
implementation project(':jmath')
|
implementation project(':jmath')
|
||||||
}
|
}
|
||||||
|
|
||||||
nativeImage {
|
Property<String> mainClassName = objects.property(String.class)
|
||||||
mainClass = 'net.woggioni.jmath.benchmark.Main'
|
mainClassName.set('net.woggioni.jmath.benchmark.Main')
|
||||||
useMusl = true
|
|
||||||
buildStaticImage = true
|
|
||||||
}
|
|
||||||
|
|
||||||
configureNativeImage {
|
|
||||||
|
tasks.named(NativeImagePlugin.CONFIGURE_NATIVE_IMAGE_TASK_NAME, NativeImageConfigurationTask) {
|
||||||
|
mainClass = mainClassName
|
||||||
args('20')
|
args('20')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.named(NativeImagePlugin.NATIVE_IMAGE_TASK_NAME, NativeImageTask) {
|
||||||
|
useMusl = true
|
||||||
|
buildStaticImage = true
|
||||||
|
mainClass = mainClassName
|
||||||
|
}
|
||||||
|
@@ -90,7 +90,36 @@ public class Hash {
|
|||||||
return new String(hexChars);
|
return new String(hexChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int charToInt(char c) {
|
||||||
|
if (c >= '0' && c <= '9') {
|
||||||
|
return c - '0';
|
||||||
|
} else if(c >= 'a' && c <= 'f') {
|
||||||
|
return 10 + c - 'a';
|
||||||
|
} else if(c >= 'A' && c <= 'F') {
|
||||||
|
return 10 + c - 'A';
|
||||||
|
} else {
|
||||||
|
throw newThrowable(IllegalArgumentException.class, "Illegal hex character '%c'", c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static byte[] hexToBytes(String hexString) {
|
public static byte[] hexToBytes(String hexString) {
|
||||||
|
if (hexString.length() % 2 != 0) {
|
||||||
|
throw newThrowable(IllegalArgumentException.class, "Hex string length must be even," +
|
||||||
|
" string has length '%d' instead", hexString.length());
|
||||||
|
}
|
||||||
|
byte[] result = new byte[hexString.length() / 2];
|
||||||
|
for(int i = 0; i < hexString.length(); i++) {
|
||||||
|
int value = charToInt(hexString.charAt(i));
|
||||||
|
if (i % 2 == 0) {
|
||||||
|
result[i / 2] += (byte) (value << 4);
|
||||||
|
} else {
|
||||||
|
result[i / 2] += (byte) value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] hexToBytes2(String hexString) {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
if (hexString.length() % 2 != 0) {
|
if (hexString.length() % 2 != 0) {
|
||||||
throw newThrowable(IllegalArgumentException.class, "Hex string length must be even," +
|
throw newThrowable(IllegalArgumentException.class, "Hex string length must be even," +
|
||||||
|
@@ -237,6 +237,10 @@ public class JWO {
|
|||||||
return Hash.bytesToHex(bytes);
|
return Hash.bytesToHex(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static byte[] hexToBytes(String hexStr) {
|
||||||
|
return Hash.hexToBytes(hexStr);
|
||||||
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public static void deletePath(Path path) {
|
public static void deletePath(Path path) {
|
||||||
Files.walk(path)
|
Files.walk(path)
|
||||||
|
@@ -65,6 +65,7 @@ public class HashTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ArgumentsSource(HexTestArguments.class)
|
@ArgumentsSource(HexTestArguments.class)
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
public void hexTest(String sourceString, Class<? extends Throwable> t) {
|
public void hexTest(String sourceString, Class<? extends Throwable> t) {
|
||||||
@@ -78,4 +79,18 @@ public class HashTest {
|
|||||||
Assertions.assertEquals(sourceString.toUpperCase(), Hash.bytesToHex(bytes));
|
Assertions.assertEquals(sourceString.toUpperCase(), Hash.bytesToHex(bytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ArgumentsSource(HexTestArguments.class)
|
||||||
|
@ParameterizedTest
|
||||||
|
public void hexTest2(String sourceString, Class<? extends Throwable> t) {
|
||||||
|
if(t != null) {
|
||||||
|
Assertions.assertThrows(t, () ->
|
||||||
|
Hash.hexToBytes2(sourceString)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
byte[] bytes = Hash.hexToBytes2(sourceString);
|
||||||
|
Assertions.assertEquals(sourceString.length() / 2, bytes.length);
|
||||||
|
Assertions.assertEquals(sourceString.toUpperCase(), Hash.bytesToHex(bytes));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,7 @@ public class JavaVersionTest {
|
|||||||
JWO.copy(is, baos);
|
JWO.copy(is, baos);
|
||||||
}
|
}
|
||||||
final var jwoClassVersion = JavaVersion.forClass(baos.toByteArray());
|
final var jwoClassVersion = JavaVersion.forClass(baos.toByteArray());
|
||||||
assertEquals(JavaVersion.VERSION_1_8, jwoClassVersion);
|
assertEquals(JavaVersion.VERSION_11, jwoClassVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user