Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build jpackage app-image then other packages after #1319

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 47 additions & 22 deletions desktop/package/package.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -263,27 +263,47 @@ task packageInstallers {
" --app-version ${appVersion}" +
" --copyright \"${appCopyright}\"" +
" --vendor ${appNameAndVendor}" +
" --temp \"${jpackageTempDir}\"" +

// Options for creating the application image
" --input ${fatJarFolderPath}" +

// Options for creating the application launcher
" --main-jar ${mainJarName}" +
" --main-class haveno.desktop.app.HavenoAppMain" +
" --java-options -Xss1280k" +
" --java-options -XX:MaxRAM=4g" +
" --java-options --add-opens=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED" +
" --java-options --add-opens=javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED" +
" --java-options --add-opens=java.base/java.lang.reflect=ALL-UNNAMED" +
" --java-options --add-opens=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED" +
" --java-options -Djava.net.preferIPv4Stack=true" +
" --arguments --baseCurrencyNetwork=XMR_STAGENET"
" --temp \"${jpackageTempDir}\""
)

// stores temporary app-image directory
File jpackageAppImageContainer = new File(tempRootDir, "jpackage-app-image")
File jpackageAppImage = new File(jpackageAppImageContainer, "Haveno")
jpackageAppImageContainer.mkdirs()

String buildingOpts = new String(
// Options for creating the application launcher
" --main-jar ${mainJarName}" +
Copy link
Contributor

@woodser woodser Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting a CI failure for macOS.

I see that these options will not be part of commonOpts for the executeCmd commands below, in case that could have anything to do with it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting a CI failure for macOS.

The CI build error is mv: rename desktop/build/temp-*/binaries/Haveno-*.dmg to /Users/runner/work/haveno/haveno/release/Haveno-1.0.11-mac-installer.dmg: No such file or directory, so looks like the macOS installer isn't built for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking it out now

" --main-class haveno.desktop.app.HavenoAppMain" +
" --java-options -Xss1280k" +
" --java-options -XX:MaxRAM=4g" +
" --java-options --add-opens=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED" +
" --java-options --add-opens=javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED" +
" --java-options --add-opens=java.base/java.lang.reflect=ALL-UNNAMED" +
" --java-options --add-opens=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED" +
" --java-options -Djava.net.preferIPv4Stack=true" +
// Warning: this will cause guice reflection exceptions and lead to issues with the guice internal cache
// resulting in the UI not loading
// " --java-options -Djdk.module.illegalAccess=deny" +
// " --java-options -Djdk.module.illegalAccess=deny" +
" --arguments --baseCurrencyNetwork=XMR_STAGENET" +
" --input ${fatJarFolderPath}"
)

// package generic app-image if not on macos
if (!Os.isFamily(Os.FAMILY_MAC)) {
executeCmd(jPackageFilePath + commonOpts + buildingOpts
" --dest \"${jpackageAppImageContainer}\"" +
" --type app-image")
}

// Clean jpackage temp folder, needs to be empty for the next packaging step.
jpackageTempDir.deleteDir()
jpackageTempDir.mkdirs()

// Make future packaging attempts use existing app-image
String originalCommonOpts = commonOpts;
commonOpts += " --app-image \"${jpackageAppImage}\""

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
String windowsOpts = new String(
" --icon \"${project(':desktop').projectDir}/package/windows/Haveno.ico\"" +
Expand All @@ -303,7 +323,7 @@ task packageInstallers {
" --resource-dir \"${project(':desktop').projectDir}/package/macosx\""
)

executeCmd(jPackageFilePath + commonOpts + macOpts + " --type dmg")
executeCmd(jPackageFilePath + originalCommonOpts + macOpts + buildingOpts + " --type dmg")
} else {
String linuxOpts = new String(
" --icon ${project(':desktop').projectDir}/package/linux/icon.png" +
Expand All @@ -328,12 +348,14 @@ task packageInstallers {
jpackageTempDir.deleteDir()
jpackageTempDir.mkdirs()

executeCmd(jPackageFilePath + commonOpts +
" --dest \"${jpackageTempDir}\"" +
" --type app-image")
// Copy over app-image for AppImage packaging
copy {
from jpackageAppImage
into new File(jpackageTempDir, "Haveno")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this hardcoded string "Haveno" used?

Just ensuring it's only temporary in the build process, since the application name / data directory can be customized for different networks, e.g. "Haveno-example" in other places like build.yml and HavenoExecutable.java

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, the AppImage building process expects a directory Haveno as a result of making an app-image directory so this is required to prevent changing the AppImage building process.

}

// Path to the app-image directory: THIS IS NOT THE ACTUAL .AppImage FILE.
// See JPackage documentation on --type app-image for more.
// See JPackage documentation on `--type app-image` for more.
String appImagePath = new String(
"\"${binariesFolderPath}/${appNameAndVendor}\""
)
Expand Down Expand Up @@ -396,6 +418,9 @@ task packageInstallers {
" --linux-rpm-license-type AGPLv3" + // https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
" --type rpm")

// Clean jpackage temp folder, needs to be empty for the next packaging step (rpm)
jpackageTempDir.deleteDir()
jpackageTempDir.mkdirs()


// Define Flatpak-related properties
Expand Down
Loading