diff --git a/android-application/build.gradle b/android-application/build.gradle index e1e88b9..0e6e60b 100644 --- a/android-application/build.gradle +++ b/android-application/build.gradle @@ -26,8 +26,8 @@ android { compileOptions { // Gradle 9/10 require modern Java versions (Java 17 or Java 21) for the build environment, // but you can still target Java 8 or Java 11 for Android compatibility. - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_9 + targetCompatibility = JavaVersion.VERSION_1_9 } // Updated: packagingOptions is deprecated and removed in AGP 9.0+. Use packaging instead. diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..9fa7f28 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 ef0abaf..2e7bb9f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,5 +2,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.1-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/helper-scripts/abstract/abstract-sonatype-publish.sh b/helper-scripts/abstract/abstract-sonatype-publish.sh index 21b758a..06c2571 100644 --- a/helper-scripts/abstract/abstract-sonatype-publish.sh +++ b/helper-scripts/abstract/abstract-sonatype-publish.sh @@ -40,23 +40,39 @@ function generateGenericPom() { } function publishBuild() { - local artifactId=$1 - local artifact=$2 - local version=$3 - local javadoc_jar=$4 - local sources_jar=$5 - local pomFile=$6 + local groupId="$1" + local artifactId="$2" + local artifact="$3" + local version="$4" + local javadoc_jar="$5" + local sources_jar="$6" + local pomFile="$7" - ${maven_bin} gpg:sign-and-deploy-file -s ${settings} -Durl=${sonatype_url} \ - -DartifactId=${artifactId} \ - -DrepositoryId=${repository} \ - -Dversion=${version} \ - -DpomFile=${pomFile} \ - -Dgpg.passphrase=${passphrase} \ - -Dfile=${artifact} \ - -Djavadoc=${javadoc_jar} \ - -Dsources=${sources_jar} + : "${CENTRAL_TOKEN_USERNAME:?Missing Central token username}" + : "${CENTRAL_TOKEN_PASSWORD:?Missing Central token password}" + # Upload and sign the main JAR, sources, Javadoc, and POM. + "${maven_bin}" gpg:sign-and-deploy-file \ + -s "${settings}" \ + -Durl="${sonatype_url}" \ + -DgroupId="${groupId}" \ + -DartifactId="${artifactId}" \ + -Dversion="${version}" \ + -DrepositoryId="${repository}" \ + -DpomFile="${pomFile}" \ + -Dfile="${artifact}" \ + -Djavadoc="${javadoc_jar}" \ + -Dsources="${sources_jar}" \ + -Dgpg.passphrase="${passphrase}" || return $? - return $? -} + # Transfer the uploaded deployment to the Central Publisher Portal. + local token + token=$(printf '%s:%s' \ + "${CENTRAL_TOKEN_USERNAME}" \ + "${CENTRAL_TOKEN_PASSWORD}" | base64 | tr -d '\n') || return $? + + curl --fail-with-body --silent --show-error \ + --request POST \ + --header "Authorization: Bearer ${token}" \ + "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/${groupId}?publishing_type=user_managed" +} \ No newline at end of file diff --git a/helper-scripts/project-impl/publishing/install-maven-latest.sh b/helper-scripts/project-impl/publishing/install-maven-latest.sh index c974d2e..7e798a3 100755 --- a/helper-scripts/project-impl/publishing/install-maven-latest.sh +++ b/helper-scripts/project-impl/publishing/install-maven-latest.sh @@ -3,7 +3,7 @@ source "./helper-scripts/project-impl/variables.sh" function downloadMavenLatest() { - wget "https://dlcdn.apache.org/maven/maven-3/${maven_version}/binaries/apache-maven-${maven_version}-bin.tar.gz" + wget "https://archive.apache.org/dist/maven/maven-3/${maven_version}/binaries/apache-maven-${maven_version}-bin.tar.gz" return $? } diff --git a/helper-scripts/project-impl/publishing/maven-settings.xml b/helper-scripts/project-impl/publishing/maven-settings.xml index 3198330..712e3bb 100644 --- a/helper-scripts/project-impl/publishing/maven-settings.xml +++ b/helper-scripts/project-impl/publishing/maven-settings.xml @@ -4,9 +4,9 @@ http://maven.apache.org/xsd/settings-1.0.0.xsd"> - ossrh - ${env.OSSRH_USERNAME} - ${env.OSSRH_TOKEN} + central + ${env.CENTRAL_TOKEN_USERNAME} + ${env.CENTRAL_TOKEN_PASSWORD} diff --git a/helper-scripts/project-impl/publishing/sonatype-publish-artifacts.sh b/helper-scripts/project-impl/publishing/sonatype-publish-artifacts.sh index 8b51fb5..93cf2da 100755 --- a/helper-scripts/project-impl/publishing/sonatype-publish-artifacts.sh +++ b/helper-scripts/project-impl/publishing/sonatype-publish-artifacts.sh @@ -16,4 +16,4 @@ generateGenericPom ${groupId} ${desktop_artifactId_release} ${version} "${deskto cat "${desktop_pomFile}" # publish 'android' and 'desktop' builds to maven sonatype -publishBuild "${desktop_artifactId_release}" "${desktop_artifact}" "${version}" "${javadoc_jar}" "${sources_jar}" "${desktop_pomFile}" +publishBuild "${groupId}" "${desktop_artifactId_release}" "${desktop_artifact}" "${version}" "${javadoc_jar}" "${sources_jar}" "${desktop_pomFile}" diff --git a/helper-scripts/project-impl/variables.sh b/helper-scripts/project-impl/variables.sh index d715278..7fe0362 100644 --- a/helper-scripts/project-impl/variables.sh +++ b/helper-scripts/project-impl/variables.sh @@ -2,8 +2,8 @@ # Maven sonatype stuff # --------------------- -sonatype_url="https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" -repository="ossrh" +sonatype_url="https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" +repository="central" groupId="io.github.electrostat-lab" maven_version="3.9.4" maven_bin="./apache-maven-$maven_version/bin/mvn" diff --git a/snaploader-examples/build.gradle b/snaploader-examples/build.gradle index c0c91ac..d8b08a7 100644 --- a/snaploader-examples/build.gradle +++ b/snaploader-examples/build.gradle @@ -87,3 +87,8 @@ dependencies { runtimeOnly 'com.github.stephengold:jolt-jni-Windows64_avx2:6.1.1:DebugSp' runtimeOnly 'io.github.software-hardware-codesign:jme3-alloc-desktop:1.0.0-pre-gamma-2' } + +java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 +} \ No newline at end of file diff --git a/snaploader-examples/src/main/java/module-info.java b/snaploader-examples/src/main/java/module-info.java new file mode 100644 index 0000000..bc4e054 --- /dev/null +++ b/snaploader-examples/src/main/java/module-info.java @@ -0,0 +1,8 @@ +module electrostatic4j.snaploader.examples { + requires electrostatic4j.snaploader; + requires java.logging; + requires java.base; + requires com.github.stephengold.joltjni; + + exports electrostatic4j.snaploader.examples; +} \ No newline at end of file diff --git a/snaploader/build.gradle b/snaploader/build.gradle index 7b5834e..f2224c6 100644 --- a/snaploader/build.gradle +++ b/snaploader/build.gradle @@ -18,7 +18,7 @@ tasks.register("generateSourcesJar", Jar) { tasks.withType(JavaCompile).configureEach { // Updated: In Gradle 9+, compiler options (like release) use lazy Property types. // They must be assigned via .set() rather than raw assignment. - options.release.set(8) + options.release.set(9) } jar { @@ -36,8 +36,7 @@ dependencies { // Standardized api configuration notation for Gradle 9/10 api 'com.github.oshi:oshi-core:7.7.0' } - java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_9 + targetCompatibility = JavaVersion.VERSION_1_9 } \ No newline at end of file diff --git a/snaploader/src/main/java/electrostatic4j/snaploader/filesystem/FileExtractor.java b/snaploader/src/main/java/electrostatic4j/snaploader/filesystem/FileExtractor.java index ecd3eda..b642a67 100644 --- a/snaploader/src/main/java/electrostatic4j/snaploader/filesystem/FileExtractor.java +++ b/snaploader/src/main/java/electrostatic4j/snaploader/filesystem/FileExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024, The Electrostatic-Sandbox Distributed Simulation Framework, jSnapLoader + * Copyright (c) 2023-2026, The Electrostatic-Sandbox Distributed Simulation Framework, jSnapLoader * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -171,9 +171,10 @@ public void extract() throws FileExtractionProcessingException, FilesystemResour try { close(); } catch (Exception ex) { - throw new FilesystemResourceScavengingException(); + throw new FilesystemResourceScavengingException( + "Failed to close the file extractor handler #" + getHashKey(), e); } - throw new FileExtractionProcessingException("", e); + throw new FileExtractionProcessingException("Error while extracting the file #" + getHashKey(), e); // release the native resources anyway! } finally { if (fileExtractionListener != null) { diff --git a/snaploader/src/main/java/electrostatic4j/snaploader/filesystem/FileLocator.java b/snaploader/src/main/java/electrostatic4j/snaploader/filesystem/FileLocator.java index 83cd9f9..f593931 100644 --- a/snaploader/src/main/java/electrostatic4j/snaploader/filesystem/FileLocator.java +++ b/snaploader/src/main/java/electrostatic4j/snaploader/filesystem/FileLocator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024, The Electrostatic-Sandbox Distributed Simulation Framework, jSnapLoader + * Copyright (c) 2023-2026, The Electrostatic-Sandbox Distributed Simulation Framework, jSnapLoader * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -142,11 +142,11 @@ public void initialize(int size) throws FilesystemResourceInitializationExceptio try { close(); } catch (IOException ex) { - throw new FilesystemResourceScavengingException("File locator resources closure failed!", ex); + throw new FilesystemResourceScavengingException("File locator resources closure failed #" + getHashKey(), ex); } // fire the failure listener when file localization fails and pass // the causative exception - throw new FilesystemResourceInitializationException("File locator initialization failed!", e); + throw new FilesystemResourceInitializationException("File locator initialization failed #" + getHashKey(), e); } } diff --git a/snaploader/src/main/java/module-info.java b/snaploader/src/main/java/module-info.java new file mode 100644 index 0000000..c5cf7e2 --- /dev/null +++ b/snaploader/src/main/java/module-info.java @@ -0,0 +1,13 @@ +module electrostatic4j.snaploader { + requires java.logging; + requires java.base; + requires com.github.oshi; + + exports electrostatic4j.snaploader; + exports electrostatic4j.snaploader.filesystem; + exports electrostatic4j.snaploader.library; + exports electrostatic4j.snaploader.platform; + exports electrostatic4j.snaploader.platform.util; + exports electrostatic4j.snaploader.throwable; + exports electrostatic4j.snaploader.util; +} \ No newline at end of file