8258755: jpackage: Invalid 32-bit exe when building app-image

Reviewed-by: asemenyuk, almatvee, kizune
This commit is contained in:
Andy Herrick 2021-01-16 14:38:57 +00:00
parent c3bdbf9dda
commit da4cf05dc6
3 changed files with 14 additions and 4 deletions

View File

@ -33,6 +33,11 @@
#include "Toolbox.h"
#include "ErrorHandling.h"
#if defined(_WIN32) && !defined(_WIN64)
#define LAUNCH_FUNC "_JLI_Launch@56"
#else
#define LAUNCH_FUNC "JLI_Launch"
#endif
Jvm& Jvm::initFromConfigFile(const CfgFile& cfgFile) {
const CfgFile::Properties& appOptions = cfgFile.getProperties(
@ -204,7 +209,7 @@ void Jvm::launch() {
LOG_TRACE(tstrings::any() << "JVM library: \"" << jvmPath << "\"");
DllFunction<LaunchFuncType> func(Dll(jvmPath), "JLI_Launch");
DllFunction<LaunchFuncType> func(Dll(jvmPath), LAUNCH_FUNC);
int exitStatus = func(argc, argv.data(),
0, 0,
0, 0,

View File

@ -112,7 +112,7 @@ public class WixPipeline {
"-nologo",
adjustPath.apply(wixSource.source).toString(),
"-ext", "WixUtilExtension",
"-arch", "x64",
"-arch", WixSourcesBuilder.is64Bit() ? "x64" : "x86",
"-out", wixObj.toAbsolutePath().toString()
));

View File

@ -157,6 +157,10 @@ class WixSourcesBuilder {
}
}
static boolean is64Bit() {
return !("x86".equals(System.getProperty("os.arch")));
}
private void normalizeFileAssociation(FileAssociation fa) {
fa.launcherPath = addExeSuffixToPath(
installedAppImage.launchersDirectory().resolve(fa.launcherPath));
@ -301,7 +305,7 @@ class WixSourcesBuilder {
static void startElement(XMLStreamWriter xml, String componentId,
String componentGuid) throws XMLStreamException, IOException {
xml.writeStartElement("Component");
xml.writeAttribute("Win64", "yes");
xml.writeAttribute("Win64", is64Bit() ? "yes" : "no");
xml.writeAttribute("Id", componentId);
xml.writeAttribute("Guid", componentGuid);
}
@ -823,7 +827,8 @@ class WixSourcesBuilder {
private final static Path DESKTOP_PATH = TARGETDIR.resolve("DesktopFolder");
private final static Path PROGRAM_FILES = TARGETDIR.resolve("ProgramFiles64Folder");
private final static Path PROGRAM_FILES = TARGETDIR.resolve(
is64Bit() ? "ProgramFiles64Folder" : "ProgramFilesFolder");
private final static Path LOCAL_PROGRAM_FILES = TARGETDIR.resolve("LocalAppDataFolder");