From 28be33f9ec82d50e965010b2d9445056d4c5a89c Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Tue, 29 Apr 2025 12:28:59 -0400 Subject: [PATCH 1/3] Fix JabRef-post-image.wsf to make it agnostic to the location of the project build directory --- build.gradle | 34 ++++++++++++++++++++++---- buildres/windows/JabRef-post-image.wsf | 12 ++++++--- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 6f5c74cae09..aa737a2c1a8 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ import org.gradle.internal.os.OperatingSystem import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform import org.jabref.build.xjc.XjcPlugin import org.jabref.build.xjc.XjcTask +import org.apache.tools.ant.filters.ReplaceTokens plugins { id 'application' @@ -811,6 +812,30 @@ tasks.register('deleteInstallerTemp', Delete) { delete "$buildDir/installer" } +def jpackageResourceDir; +if (OperatingSystem.current().isWindows()) { + jpackageResourceDir = "${buildDir}/jpackage-resource-dir" + tasks.register('copyJPackageResourceDir', Copy) { + from("${projectDir}/buildres/windows") { + include 'JabRef-post-image.wsf' + filter(ReplaceTokens, tokens: [jabRefRoot: "${projectDir}".replace('\\', '/')]) + } + from("${projectDir}/buildres/windows") { + exclude 'JabRef-post-image.wsf' + } + into jpackageResourceDir + } + jpackage.dependsOn copyJPackageResourceDir +} + +if (OperatingSystem.current().isLinux()) { + jpackageResourceDir = "${projectDir}/buildres/linux" +} + +if (OperatingSystem.current().isMacOsX()) { + jpackageResourceDir = "${projectDir}/buildres/mac" +} + jpackage.dependsOn deleteInstallerTemp jlinkZip.dependsOn jpackage jlink { @@ -933,8 +958,7 @@ jlink { '--win-shortcut', '--win-menu', '--win-menu-group', "JabRef", - '--temp', "$buildDir/installer", - '--resource-dir', "${projectDir}/buildres/windows", + '--resource-dir', jpackageResourceDir, '--license-file', "${projectDir}/buildres/LICENSE_with_Privacy.md", '--file-associations', "${projectDir}/buildres/windows/bibtexAssociations.properties" ] @@ -950,7 +974,7 @@ jlink { '--vendor', 'JabRef', '--app-version', "${project.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", @@ -963,7 +987,7 @@ jlink { if (OperatingSystem.current().isMacOsX()) { imageOptions = [ '--icon', "${projectDir}/src/main/resources/icons/jabref.icns", - '--resource-dir', "${projectDir}/buildres/mac" + '--resource-dir', jpackageResourceDir ] // Notarized mac images and packages are built on the pipeline only skipInstaller = true @@ -974,7 +998,7 @@ jlink { '--mac-package-name', "JabRef", '--app-version', "${project.version}", '--file-associations', "${projectDir}/buildres/mac/bibtexAssociations.properties", - '--resource-dir', "${projectDir}/buildres/mac" + '--resource-dir', jpackageResourceDir ] } } diff --git a/buildres/windows/JabRef-post-image.wsf b/buildres/windows/JabRef-post-image.wsf index 96717d1da55..762c9412cb6 100644 --- a/buildres/windows/JabRef-post-image.wsf +++ b/buildres/windows/JabRef-post-image.wsf @@ -9,13 +9,17 @@ // DEBUG Output // var shell = new ActiveXObject("WScript.Shell"); // shell.Popup(fileSystem.GetFolder(".")); - var jabRefRoot = fileSystem.GetFolder(".").ParentFolder.ParentFolder.ParentFolder.ParentFolder.Path; - var installerConfig = jabRefRoot + "/build/installer/config/"; + var jabRefRoot = fileSystem.GetFolder('@jabRefRoot@'); + // jpackage will run a copy of the script from the "config" directory. + var installerConfig = fileSystem.GetFile(WScript.ScriptFullName).ParentFolder; + + WScript.Echo("jabRefRoot: " + jabRefRoot) + WScript.Echo("installerConfig: " + installerConfig) // Copy additional installer resources - fileSystem.CopyFile(jabRefRoot + "/buildres/windows/JabRefTopBanner.bmp", installerConfig); + fileSystem.CopyFile(jabRefRoot + "/buildres/windows/JabRefTopBanner.bmp", installerConfig + "/JabRefTopBanner.bmp"); - var wxsFilePath = installerConfig + "main.wxs"; + var wxsFilePath = installerConfig + "/main.wxs"; wxsFile = fileSystem.OpenTextFile(wxsFilePath, 1); var contents = wxsFile.ReadAll(); wxsFile.Close(); From 65eb404b12173d34e6979cb62e5e01417e72cddb Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Tue, 29 Apr 2025 20:00:53 +0200 Subject: [PATCH 2/3] fix errors and convert to build dir from layout --- jabgui/build.gradle.kts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/jabgui/build.gradle.kts b/jabgui/build.gradle.kts index 7faf4473b9d..444b8cdea3d 100644 --- a/jabgui/build.gradle.kts +++ b/jabgui/build.gradle.kts @@ -259,18 +259,18 @@ tasks.named("jlinkZip") { } tasks.register("deleteInstallerTemp") { - delete(file("$buildDir/installer")) + delete(layout.buildDirectory.dir("installer")) } -var jpackageResourceDir: String = "" +var jpackageResourceDir: String = "" if (OperatingSystem.current().isWindows) { - jpackageResourceDir = "${buildDir}/jpackage-resource-dir" + jpackageResourceDir = "${layout.buildDirectory.get().asFile}/jpackage-resource-dir" tasks.register("copyJPackageResourceDir") { from("${projectDir}/buildres/windows") { include("JabRef-post-image.wsf") - filter(mapOf("jabRefRoot" to "${projectDir}".replace('\\', '/'))) + filter(mapOf("jabRefRoot" to "$projectDir".replace('\\', '/'))) } from("${projectDir}/buildres/windows") { exclude("JabRef-post-image.wsf") @@ -287,7 +287,6 @@ if (OperatingSystem.current().isWindows) { jpackageResourceDir = "${projectDir}/buildres/mac" } - jlink { // https://github.com/beryx/badass-jlink-plugin/issues/61#issuecomment-504640018 addExtraDependencies( @@ -440,7 +439,7 @@ jlink { ) requires( "org.tukaani.xz" - ); + ) uses( "ai.djl.engine.EngineProvider" ) @@ -523,7 +522,7 @@ jlink { "--win-shortcut", "--win-menu", "--win-menu-group", "JabRef", - "--temp", "$buildDir/installer", + "--temp", "${layout.buildDirectory.get()}/installer", "--resource-dir", jpackageResourceDir, "--license-file", "$projectDir/buildres/LICENSE_with_Privacy.md", "--file-associations", "$projectDir/buildres/windows/bibtexAssociations.properties" @@ -543,7 +542,7 @@ jlink { "--vendor", "JabRef", "--app-version", "$version", // "--temp", "$buildDir/installer", - "--resource-dir", jpackageResourceDir + "--resource-dir", jpackageResourceDir, "--linux-menu-group", "Office;", "--linux-rpm-license-type", "MIT", // "--license-file", "$projectDir/LICENSE.md", From 2effd789da221441d13898b0f79d746e435d21f3 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Wed, 30 Apr 2025 12:56:50 +0200 Subject: [PATCH 3/3] Delete jabgui/buildres/windows/main.wxs --- jabgui/buildres/windows/main.wxs | 165 ------------------------------- 1 file changed, 165 deletions(-) delete mode 100644 jabgui/buildres/windows/main.wxs 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -