diff --git a/.github/workflows/deployment-ea.yml b/.github/workflows/deployment-ea.yml new file mode 100644 index 00000000000..674f26c9478 --- /dev/null +++ b/.github/workflows/deployment-ea.yml @@ -0,0 +1,391 @@ +name: Deployment + +on: + push: + branches: + - main + - main-release + paths-ignore: + - 'docs/**' + - 'src/test/**' + - 'README.md' + tags: + - '*' + pull_request: + merge_group: + workflow_dispatch: + inputs: + notarization: + type: boolean + required: false + default: false + +env: + SpringerNatureAPIKey: ${{ secrets.SpringerNatureAPIKey }} + AstrophysicsDataSystemAPIKey: ${{ secrets.AstrophysicsDataSystemAPIKey }} + IEEEAPIKey: ${{ secrets.IEEEAPIKey }} + BiodiversityHeritageApiKey: ${{ secrets.BiodiversityHeritageApiKey}} + OSXCERT: ${{ secrets.OSX_SIGNING_CERT }} + GRADLE_OPTS: -Xmx4g -Dorg.gradle.vfs.watch=false + JAVA_OPTS: -Xmx4g + +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}" + cancel-in-progress: true + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + # if you change the os version rename all other occurrences + - os: ubuntu-22.04 + displayName: linux + archivePortable: tar -c -C jabgui/build/distribution JabRef | pigz --rsyncable > jabgui/build/distribution/JabRef-portable_linux.tar.gz && rm -R jabgui/build/distribution/JabRef + archivePortableJabKit: tar -c -C jabkit/build/distribution jabkit | pigz --rsyncable > jabkit/build/distribution/jabkit-portable_linux.tar.gz && rm -R jabkit/build/distribution/jabkit + - os: windows-latest + displayName: windows + archivePortable: 7z a -r jabgui/build/distribution/JabRef-portable_windows.zip ./jabgui/build/distribution/JabRef && rm -R jabgui/build/distribution/JabRef + archivePortableJabKit: 7z a -r jabkit/build/distribution/jabkit-portable_windows.zip ./jabkit/build/distribution/jabkit && rm -R jabkit/build/distribution/jabkit + - os: macos-13 # intel image + displayName: macOS + suffix: '' + - os: macos-14 + displayName: macOS (ARM64) + suffix: '_arm64' + runs-on: ${{ matrix.os }} + outputs: + major: ${{ steps.gitversion.outputs.Major }} + minor: ${{ steps.gitversion.outputs.Minor }} + branchname: ${{ steps.gitversion.outputs.branchName }} + name: ${{ matrix.displayName }} installer and portable version + steps: + - name: Check secrets presence + id: checksecrets + shell: bash + run: | + if [ "$BUILDJABREFPRIVATEKEY" == "" ]; then + echo "secretspresent=NO" >> $GITHUB_OUTPUT + echo "❌ Secret BUILDJABREFPRIVATEKEY not present" + else + echo "secretspresent=YES" >> $GITHUB_OUTPUT + echo "✔️ Secret BUILDJABREFPRIVATEKEY present" + fi + env: + BUILDJABREFPRIVATEKEY: ${{ secrets.buildJabRefPrivateKey }} + - name: Fetch all history for all tags and branches + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: 'true' + show-progress: 'false' + - name: Install pigz and cache (linux) + if: (matrix.os == 'ubuntu-22.04') + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: pigz + version: 1.0 + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v3.2.1 + with: + versionSpec: "5.x" + - name: Run GitVersion + id: gitversion + uses: gittools/actions/gitversion/execute@v3.2.1 + + - name: Tell gradle to use JDK25 + run: sed -i "s/JavaLanguageVersion.of(25)/JavaLanguageVersion.of(24)/" build-logic/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts + + # region setup-JDK + - name: Setup JDK 25 for "java toolchain" of Gradle + uses: jdx/mise-action@v2 + with: + mise_toml: | + [tools] + java = { version = "openjdk-25.0.0-ea+21", release_type = "ea" } + - name: Debug + run: | + set -x + set -e + echo $JAVA_HOME + java --version + - name: Make JDK known to gradle (Linux, macOS) + if: (matrix.os != 'windows-latest') + shell: bash + # Hint by https://github.com/gradle/gradle/issues/29355#issuecomment-2598556970 + run: ln -s ~/.local/share/mise ~/.asdf + - name: Make JDK known to gradle (Windows) + if: (matrix.os == 'windows-latest') + shell: bash + run: mv ~/AppData/Local/mise ~/.asdf + - name: Setup JDK for gradle itself + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + # endregion + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Prepare merged jars and modules dir (macOS) + # prepareModulesDir is executing a build, which should run through even if no upload to builds.jabref.org is made + if: (matrix.os == 'macos-13') || (matrix.os == 'macos-14') || (steps.checksecrets.outputs.secretspresent == 'NO') + run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" :jabgui:prepareModulesDir + - name: Setup macOS key chain + if: ((matrix.os == 'macos-13') || (matrix.os == 'macos-14')) && (steps.checksecrets.outputs.secretspresent == 'YES') + uses: slidoapp/import-codesign-certs@1923310662e8682dd05b76b612b53301f431cd5d + with: + p12-file-base64: ${{ secrets.OSX_SIGNING_CERT }} + p12-password: ${{ secrets.OSX_CERT_PWD }} + keychain-password: jabref + - name: Setup macOS key chain for app id cert + if: ((matrix.os == 'macos-13') || (matrix.os == 'macos-14')) && (steps.checksecrets.outputs.secretspresent == 'YES') + uses: slidoapp/import-codesign-certs@1923310662e8682dd05b76b612b53301f431cd5d + with: + p12-file-base64: ${{ secrets.OSX_SIGNING_CERT_APPLICATION }} + p12-password: ${{ secrets.OSX_CERT_PWD }} + create-keychain: false + keychain-password: jabref + - name: Debug + run: | + echo $JAVA_HOME + cat mise.toml + mise hook-env -f + mise hook-env -f | grep 'export JAVA_HOME' + eval $(mise hook-env -f | grep 'export JAVA_HOME') + echo $JAVA_HOME + eval $(mise hook-env -f | grep 'export PATH') + echo $JAVA_HOME + - name: Build dmg and pkg (macOS) + if: ((matrix.os == 'macos-13') || (matrix.os == 'macos-14')) && (steps.checksecrets.outputs.secretspresent == 'YES') + shell: bash + run: | + set -e + cd jabgui + + # see https://github.com/jdx/mise/discussions/4973 + eval $(mise hook-env -f | grep 'export JAVA_HOME') + eval $(mise hook-env -f | grep 'export PATH') + echo $JAVA_HOME + + # Use Java's packaging tool to create "JabRef.app" + jpackage \ + --module org.jabref/org.jabref.Launcher \ + --module-path $JAVA_HOME/jmods/:build/jlinkbase/jlinkjars \ + --add-modules org.jabref,org.jabref.merged.module \ + --add-modules jdk.incubator.vector \ + --dest build/distribution \ + --name JabRef \ + --app-version ${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }} \ + --verbose \ + --mac-sign \ + --vendor "JabRef e.V." \ + --mac-package-identifier JabRef \ + --mac-package-name JabRef \ + --type app-image \ + --mac-signing-key-user-name "JabRef e.V. (6792V39SK3)" \ + --mac-package-signing-prefix org.jabref \ + --mac-entitlements buildres/mac/jabref.entitlements \ + --icon src/main/resources/icons/jabref.icns \ + --resource-dir buildres/mac \ + --file-associations buildres/mac/bibtexAssociations.properties \ + --jlink-options --bind-services \ + --java-options --add-exports=javafx.base/com.sun.javafx.event=org.jabref.merged.module \ + --java-options --add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module \ + --java-options --add-opens=javafx.graphics/javafx.scene=org.jabref.merged.module \ + --java-options --add-opens=javafx.controls/javafx.scene.control=org.jabref.merged.module \ + --java-options --add-opens=javafx.controls/javafx.scene.control.skin=org.jabref.merged.module \ + --java-options --add-opens=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module \ + --java-options --add-opens=javafx.controls/javafx.scene.control=org.jabref \ + --java-options --add-exports=javafx.base/com.sun.javafx.event=org.jabref \ + --java-options --add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref \ + --java-options --add-opens=javafx.graphics/javafx.scene=org.jabref \ + --java-options --add-opens=javafx.controls/javafx.scene.control=org.jabref \ + --java-options --add-opens=javafx.controls/com.sun.javafx.scene.control=org.jabref \ + --java-options --add-opens=javafx.base/javafx.collections=org.jabref \ + --java-options --add-opens=javafx.base/javafx.collections.transformation=org.jabref \ + --java-options --add-modules=jdk.incubator.vector + + # Add additional files / directories + cp buildres/mac/jabrefHost.py build/distribution/JabRef.app/Contents/ + cp -R buildres/mac/native-messaging-host build/distribution/JabRef.app/Contents/ + + # Sign the final artifact + codesign --force --deep --sign "Developer ID Application: JabRef e.V. (6792V39SK3)" \ + --entitlements buildres/mac/jabref.entitlements \ + --options runtime --timestamp build/distribution/JabRef.app + + # pack dmg and pkg + hdiutil create -volname "JabRef" -srcfolder build/distribution/JabRef.app -ov -format UDZO build/distribution/JabRef${{ matrix.suffix }}.dmg + productbuild --component build/distribution/JabRef.app /Applications --sign "Developer ID Installer: JabRef e.V. (6792V39SK3)" build/distribution/JabRef${{ matrix.suffix }}.pkg + + # Cleanup unpacked file + rm -rf build/distribution/JabRef.app + - name: Build runtime image and installer (linux, Windows) + if: (matrix.os != 'macos-13') && (matrix.os != 'macos-14') && (steps.checksecrets.outputs.secretspresent == 'YES') + shell: bash + run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" :jabgui:jpackage + - name: Build JabKit + if: (steps.checksecrets.outputs.secretspresent == 'YES') + shell: bash + run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" :jabkit:jpackage + - name: Remove JabKit build for macOS + if: (matrix.os == 'macos-13') || (matrix.os == 'macos-14') + run: rm -rf jabkit/build/distribution/jabkit.app + - name: Package application image (linux, Windows) + if: (matrix.os != 'macos-13') && (matrix.os != 'macos-14') && (steps.checksecrets.outputs.secretspresent == 'YES') + shell: bash + run: | + set -e + ${{ matrix.archivePortable }} + ${{ matrix.archivePortableJabKit }} + - name: Rename files + if: (matrix.os != 'macos-13') && (matrix.os != 'macos-14') && (steps.checksecrets.outputs.secretspresent == 'YES') + shell: pwsh + run: | + get-childitem -Path jabgui/build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"} + get-childitem -Path jabgui/build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"} + - name: Repack deb file for Debian + if: (matrix.os == 'ubuntu-22.04') && (steps.checksecrets.outputs.secretspresent == 'YES') + shell: bash + run: | + cd jabgui/build/distribution + ar x jabref_${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}_amd64.deb + zstd -d < control.tar.zst | xz > control.tar.xz + zstd -d < data.tar.zst | xz > data.tar.xz + ar -m -c -a sdsd jabref_${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}_amd64_repackaged.deb debian-binary control.tar.xz data.tar.xz + rm debian-binary control.tar.* data.tar.* + mv -f jabref_${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}_amd64_repackaged.deb jabref_${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}_amd64.deb + - name: Setup rsync (macOS) + if: ${{ (!startsWith(github.ref, 'refs/heads/gh-readonly-queue')) && (steps.checksecrets.outputs.secretspresent == 'YES') && (((matrix.os == 'macos-13') || (matrix.os == 'macos-14')) && !((startsWith(github.ref, 'refs/tags/') || inputs.notarization == true))) }} + run: brew install rsync + - name: Setup rsync (Windows) + if: (matrix.os == 'windows-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue')) + # We want to have rsync available at this place to avoid uploading and downloading from GitHub artifact store (taking > 5 minutes in total) + # We cannot use "action-rsyncer", because that requires Docker which is unavailable on Windows + # We cannot use "setup-rsync", because that does not work on Windows + # We do not use egor-tensin/setup-cygwin@v4, because it replaces the default shell + run: choco install --no-progress rsync + - name: Setup SSH key + if: ${{ (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue')) && (!((startsWith(github.ref, 'refs/tags/') || (inputs.notarization == true)))) }} + run: | + echo "${{ secrets.buildJabRefPrivateKey }}" > sshkey + chmod 600 sshkey + - name: Upload to builds.jabref.org (Windows) + if: (matrix.os == 'windows-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue')) + shell: cmd + # for rsync installed by chocolatey, we need the ssh.exe delivered with that installation + run: | + rsync -rt --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --itemize-changes --stats --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync" -e 'C:\ProgramData\chocolatey\lib\rsync\tools\bin\ssh.exe -p 9922 -i sshkey -o StrictHostKeyChecking=no' jabgui/build/distribution/ jrrsync@build-upload.jabref.org:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/ || true + rsync -rt --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --itemize-changes --stats --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync" -e 'C:\ProgramData\chocolatey\lib\rsync\tools\bin\ssh.exe -p 9922 -i sshkey -o StrictHostKeyChecking=no' jabkit/build/distribution/ jrrsync@build-upload.jabref.org:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/ || true + - name: Upload to builds.jabref.org (linux, macOS) + # macOS: Negated condition of "Upload to GitHub workflow artifacts store (macOS)" + # Reason: We either upload the non-notarized files - or notarize the files later (and upload these later) + # needs to be on one line; multi line does not work + if: ${{ (!startsWith(github.ref, 'refs/heads/gh-readonly-queue')) && (steps.checksecrets.outputs.secretspresent == 'YES') && ((matrix.os == 'ubuntu-22.04') || (matrix.os == 'macos-13') || (matrix.os == 'macos-14')) && !((startsWith(github.ref, 'refs/tags/') || inputs.notarization == true)) }} + shell: bash + run: | + rsync -rt --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --itemize-changes --stats --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync" -e 'ssh -p 9922 -i sshkey -o StrictHostKeyChecking=no' jabgui/build/distribution/ jrrsync@build-upload.jabref.org:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/ || true + rsync -rt --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --itemize-changes --stats --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync" -e 'ssh -p 9922 -i sshkey -o StrictHostKeyChecking=no' jabkit/build/distribution/ jrrsync@build-upload.jabref.org:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/ || true + - name: Upload to GitHub workflow artifacts store (macOS) + if: ((matrix.os == 'macos-13') || (matrix.os == 'macos-14')) && (steps.checksecrets.outputs.secretspresent == 'YES') && (startsWith(github.ref, 'refs/tags/') || inputs.notarization == true) + uses: actions/upload-artifact@v4 + with: + # tbn = to-be-notarized + name: JabRef-macOS-tbn-${{ matrix.os }} + path: build/distribution + compression-level: 0 # no compression + - name: Upload to GitHub workflow artifacts store + if: (steps.checksecrets.outputs.secretspresent != 'YES') + uses: actions/upload-artifact@v4 + with: + name: JabRef-${{ matrix.os }} + path: build/distribution + compression-level: 0 # no compression + announce: + name: Comment on pull request + runs-on: ubuntu-22.04 + needs: [build] + if: ${{ github.event_name == 'pull_request' }} + steps: + - name: Check secrets presence + id: checksecrets + shell: bash + run: | + if [ "$BUILDJABREFPRIVATEKEY" == "" ]; then + echo "secretspresent=NO" >> $GITHUB_OUTPUT + echo "❌ Secret BUILDJABREFPRIVATEKEY not present" + else + echo "secretspresent=YES" >> $GITHUB_OUTPUT + echo "✔️ Secret BUILDJABREFPRIVATEKEY present" + fi + env: + BUILDJABREFPRIVATEKEY: ${{ secrets.buildJabRefPrivateKey }} + - name: Comment PR + if: (steps.checksecrets.outputs.secretspresent == 'YES') + uses: thollander/actions-comment-pull-request@v3 + with: + message: | + The build of this PR is available at . + comment-tag: download-link + mode: recreate + notarize: # outsourced in a separate job to be able to rerun if this fails for timeouts + name: macOS notarization + strategy: + # Ensure that calls to Apple are sequentially made + max-parallel: 1 + matrix: + include: + - os: macos-13 # intel image + displayName: macOS + suffix: '' + - os: macos-14 + displayName: macOS (ARM64) + suffix: '-arm64' + runs-on: ${{ matrix.os }} + needs: [build] + if: ${{ startsWith(github.ref, 'refs/tags/') || inputs.notarization == true }} + steps: + - name: Check secrets presence + id: checksecrets + shell: bash + run: | + if [ "$BUILDJABREFPRIVATEKEY" == "" ]; then + echo "secretspresent=NO" >> $GITHUB_OUTPUT + echo "❌ Secret BUILDJABREFPRIVATEKEY not present" + else + echo "secretspresent=YES" >> $GITHUB_OUTPUT + echo "✔️ Secret BUILDJABREFPRIVATEKEY present" + fi + env: + BUILDJABREFPRIVATEKEY: ${{ secrets.buildJabRefPrivateKey }} + - name: Download from GitHub workflow artifacts store (macOS) + if: (steps.checksecrets.outputs.secretspresent == 'YES') + uses: actions/download-artifact@v4 + with: + name: JabRef-macOS-tbn-${{ matrix.os }} + path: jabgui/build/distribution/ + - name: Notarize dmg + if: (steps.checksecrets.outputs.secretspresent == 'YES') + shell: bash + run: | + cd jabgui + xcrun notarytool store-credentials "notarytool-profile" --apple-id "vorstand@jabref.org" --team-id "6792V39SK3" --password "${{ secrets.OSX_NOTARIZATION_APP_PWD }}" + xcrun notarytool submit build/distribution/JabRef-${{ needs.build.outputs.major }}.${{ needs.build.outputs.minor }}${{ matrix.suffix}}.dmg --keychain-profile "notarytool-profile" --wait + xcrun stapler staple build/distribution/JabRef-${{ needs.build.outputs.major }}.${{ needs.build.outputs.minor }}${{ matrix.suffix}}.dmg + - name: Notarize pkg + if: (steps.checksecrets.outputs.secretspresent == 'YES') + shell: bash + run: | + cd jabgui + xcrun notarytool store-credentials "notarytool-profile" --apple-id "vorstand@jabref.org" --team-id "6792V39SK3" --password "${{ secrets.OSX_NOTARIZATION_APP_PWD }}" + xcrun notarytool submit build/distribution/JabRef-${{ needs.build.outputs.major }}.${{ needs.build.outputs.minor }}${{ matrix.suffix}}.pkg --keychain-profile "notarytool-profile" --wait + xcrun stapler staple build/distribution/JabRef-${{ needs.build.outputs.major }}.${{ needs.build.outputs.minor }}${{ matrix.suffix}}.pkg + - name: Upload to builds.jabref.org + if: (steps.checksecrets.outputs.secretspresent == 'YES') + shell: bash + run: | + echo "${{ secrets.buildJabRefPrivateKey }}" > sshkey + chmod 600 sshkey + rsync -rt --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --itemize-changes --stats --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ needs.build.outputs.branchname }} && rsync" -e 'ssh -p 9922 -i sshkey -o StrictHostKeyChecking=no' jabgui/build/distribution/ jrrsync@build-upload.jabref.org:/var/www/builds.jabref.org/www/${{ needs.build.outputs.branchname }}/ diff --git a/build-logic/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts b/build-logic/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts index a8de214c1ae..2eeebbe70af 100644 --- a/build-logic/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts @@ -35,6 +35,8 @@ testing { } java { + sourceCompatibility = JavaVersion.VERSION_24 + targetCompatibility = JavaVersion.VERSION_24 toolchain { // If this is updated, also update // - build.gradle -> jacoco -> toolVersion (because JaCoCo does not support newest JDK out of the box. Check versions at https://www.jacoco.org/jacoco/trunk/doc/changes.html) @@ -49,6 +51,6 @@ java { // See https://docs.gradle.org/current/javadoc/org/gradle/jvm/toolchain/JvmVendorSpec.html for a full list // See https://docs.gradle.org/current/javadoc/org/gradle/jvm/toolchain/JvmVendorSpec.html for a full list // Temurin does not ship jmods, thus we need to use another JDK -- see https://github.com/actions/setup-java/issues/804 - vendor = JvmVendorSpec.AZUL + // vendor = JvmVendorSpec.AZUL } } diff --git a/jabgui/build.gradle.kts b/jabgui/build.gradle.kts index 6dfc73851aa..caaa9a20ef7 100644 --- a/jabgui/build.gradle.kts +++ b/jabgui/build.gradle.kts @@ -1,3 +1,4 @@ +import org.apache.tools.ant.filters.ReplaceTokens import org.gradle.internal.os.OperatingSystem import org.javamodularity.moduleplugin.extensions.CompileModuleOptions import org.javamodularity.moduleplugin.extensions.RunModuleOptions @@ -121,7 +122,10 @@ dependencies { testImplementation("org.testfx:testfx-core:4.0.16-alpha") testImplementation("org.testfx:testfx-junit5:4.0.16-alpha") - testImplementation("org.mockito:mockito-core:5.17.0") + testImplementation("org.mockito:mockito-core:5.17.0") { + exclude(group = "net.bytebuddy", module = "byte-buddy") + } + testImplementation("net.bytebuddy:byte-buddy:1.17.5") // recommended by https://github.com/wiremock/wiremock/issues/2149#issuecomment-1835775954 testImplementation("org.wiremock:wiremock-standalone:3.12.1") @@ -258,7 +262,34 @@ tasks.named("jlinkZip") { } tasks.register("deleteInstallerTemp") { - delete(file("$buildDir/installer")) + delete(layout.buildDirectory.dir("installer")) +} + +var jpackageResourceDir: String = "" + +if (OperatingSystem.current().isWindows) { + jpackageResourceDir = "${layout.buildDirectory.get().asFile}/jpackage-resource-dir" + + tasks.register("copyJPackageResourceDir") { + from("${projectDir}/buildres/windows") { + include("JabRef-post-image.wsf") + filter(ReplaceTokens::class, mapOf("tokens" to mapOf( + "jabRefRoot" to project.projectDir.toString().replace('\\', '/') + ))) + } + from("${projectDir}/buildres/windows") { + exclude("JabRef-post-image.wsf") + } + into(jpackageResourceDir) + } + + tasks.named("jpackage").configure { + dependsOn("copyJPackageResourceDir") + } +} else if (OperatingSystem.current().isLinux) { + jpackageResourceDir = "${projectDir}/buildres/linux" +} else if (OperatingSystem.current().isMacOsX) { + jpackageResourceDir = "${projectDir}/buildres/mac" } jlink { @@ -413,7 +444,7 @@ jlink { ) requires( "org.tukaani.xz" - ); + ) uses( "ai.djl.engine.EngineProvider" ) @@ -496,8 +527,8 @@ jlink { "--win-shortcut", "--win-menu", "--win-menu-group", "JabRef", - "--temp", "$buildDir/installer", - "--resource-dir", "$projectDir/buildres/windows", + "--temp", "${layout.buildDirectory.get()}/installer", + "--resource-dir", jpackageResourceDir, "--license-file", "$projectDir/buildres/LICENSE_with_Privacy.md", "--file-associations", "$projectDir/buildres/windows/bibtexAssociations.properties" ) @@ -516,7 +547,7 @@ jlink { "--vendor", "JabRef", "--app-version", "$version", // "--temp", "$buildDir/installer", - "--resource-dir", "$projectDir/buildres/linux", + "--resource-dir", jpackageResourceDir, "--linux-menu-group", "Office;", "--linux-rpm-license-type", "MIT", // "--license-file", "$projectDir/LICENSE.md", @@ -543,7 +574,7 @@ jlink { "--mac-package-name", "JabRef", "--app-version", "$version", "--file-associations", "$projectDir/buildres/mac/bibtexAssociations.properties", - "--resource-dir", "$projectDir/buildres/mac" + "--resource-dir", jpackageResourceDir ) ) } diff --git a/jabgui/buildres/windows/JabRef-post-image.wsf b/jabgui/buildres/windows/JabRef-post-image.wsf new file mode 100644 index 00000000000..762c9412cb6 --- /dev/null +++ b/jabgui/buildres/windows/JabRef-post-image.wsf @@ -0,0 +1,40 @@ + + + + + + diff --git a/jabgui/buildres/windows/main.wxs b/jabgui/buildres/windows/main.wxs deleted file mode 100644 index 5c830545e1f..00000000000 --- a/jabgui/buildres/windows/main.wxs +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Not Installed - Not Installed - Not Installed - Not Installed - - Not Installed - - - Not Installed - - - Not Installed - - - - JP_UPGRADABLE_FOUND - - - JP_DOWNGRADABLE_FOUND - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jabkit/build.gradle.kts b/jabkit/build.gradle.kts index 5d2b49756a4..a4552fcf488 100644 --- a/jabkit/build.gradle.kts +++ b/jabkit/build.gradle.kts @@ -53,7 +53,10 @@ dependencies { implementation("org.apache.lucene:lucene-queryparser:${luceneVersion}") testImplementation(project(":test-support")) - testImplementation("org.mockito:mockito-core:5.17.0") + testImplementation("org.mockito:mockito-core:5.17.0") { + exclude(group = "net.bytebuddy", module = "byte-buddy") + } + testImplementation("net.bytebuddy:byte-buddy:1.17.5") } /* diff --git a/jablib/build.gradle.kts b/jablib/build.gradle.kts index ee05abfa73d..7be96a96f5e 100644 --- a/jablib/build.gradle.kts +++ b/jablib/build.gradle.kts @@ -207,7 +207,10 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter-params:5.12.2") testImplementation("org.junit.platform:junit-platform-launcher:1.12.2") - testImplementation("org.mockito:mockito-core:5.17.0") + testImplementation("org.mockito:mockito-core:5.17.0") { + exclude(group = "net.bytebuddy", module = "byte-buddy") + } + testImplementation("net.bytebuddy:byte-buddy:1.17.5") testImplementation("org.xmlunit:xmlunit-core:2.10.0") testImplementation("org.xmlunit:xmlunit-matchers:2.10.0") diff --git a/jabsrv/build.gradle.kts b/jabsrv/build.gradle.kts index 56399ae4704..6078d65d56d 100644 --- a/jabsrv/build.gradle.kts +++ b/jabsrv/build.gradle.kts @@ -72,7 +72,10 @@ dependencies { exclude(group = "org.antlr") } - testImplementation("org.mockito:mockito-core:5.17.0") + testImplementation("org.mockito:mockito-core:5.17.0") { + exclude(group = "net.bytebuddy", module = "byte-buddy") + } + testImplementation("net.bytebuddy:byte-buddy:1.17.5") } javafx { diff --git a/test-support/build.gradle.kts b/test-support/build.gradle.kts index 3f64ca5e1d5..d349f3182ef 100644 --- a/test-support/build.gradle.kts +++ b/test-support/build.gradle.kts @@ -17,7 +17,11 @@ dependencies { implementation("org.apache.logging.log4j:log4j-to-slf4j:2.24.3") implementation("org.junit.jupiter:junit-jupiter-api:5.12.2") - implementation("org.mockito:mockito-core:5.17.0") + + implementation("org.mockito:mockito-core:5.17.0") { + exclude(group = "net.bytebuddy", module = "byte-buddy") + } + implementation("net.bytebuddy:byte-buddy:1.17.5") implementation("org.jspecify:jspecify:1.0.0") }