Skip to content
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,25 @@ static boolean is64Bit() {
return Architecture.is64bit();
}

enum Arch {
X64,
X86,
AARCH64,
OTHER;
}

static Arch getArch() {
if (Architecture.isX64()) {
return Arch.X64;
} else if (Architecture.isX86()) {
return Arch.X86;
} else if (Architecture.isAARCH64()) {
return Arch.AARCH64;
} else {
return Arch.OTHER;
}
}

Comment on lines +148 to +166
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this enum definition redundant? Why not use Architecture.current() in WixPipeline's switch expressions?

protected final Path getConfigRoot() {
return configRoot;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static jdk.jpackage.internal.ShortPathUtils.adjustPath;
import static jdk.jpackage.internal.WixFragmentBuilder.Arch;
import static jdk.jpackage.internal.WixFragmentBuilder.getArch;
import jdk.jpackage.internal.util.PathUtils;

/**
Expand Down Expand Up @@ -201,14 +203,21 @@ private void buildMsiWix4(Path msi) throws IOException {
}).flatMap(Function.identity()).collect(Collectors.toMap(
Map.Entry::getKey, Map.Entry::getValue));

var archString = switch (WixFragmentBuilder.getArch()) {
case Arch.X64 -> "x64";
case Arch.X86 -> "x86";
case Arch.AARCH64 -> "arm64";
case Arch.OTHER -> throw new IOException("Unsupported architecture.");

Choose a reason for hiding this comment

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

This would rather be an instance of UnsupportedOperationException

};

List<String> cmdline = new ArrayList<>(List.of(
toolset.getToolPath(WixTool.Wix4).toString(),
"build",
"-nologo",
"-pdbtype", "none",
"-intermediatefolder", wixObjDir.toString(),
"-ext", "WixToolset.Util.wixext",
"-arch", WixFragmentBuilder.is64Bit() ? "x64" : "x86"
"-arch", archString
));

cmdline.addAll(lightOptions);
Expand Down Expand Up @@ -249,12 +258,18 @@ private Path compileWix3(WixSource wixSource) throws IOException {
Path wixObj = wixObjDir.toAbsolutePath().resolve(PathUtils.replaceSuffix(
wixSource.path.getFileName(), ".wixobj"));

var archString = switch (WixFragmentBuilder.getArch()) {
case Arch.X64 -> "x64";
case Arch.X86 -> "x86";
case Arch.AARCH64, Arch.OTHER -> throw new IOException("Unsupported architecture.");

Choose a reason for hiding this comment

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

Is aarch64 packaging unsupported by WiX3?

};

List<String> cmdline = new ArrayList<>(List.of(
toolset.getToolPath(WixTool.Candle3).toString(),
"-nologo",
wixSource.path.toString(),
"-ext", "WixUtilExtension",
"-arch", WixFragmentBuilder.is64Bit() ? "x64" : "x86",
"-arch", archString,
"-out", wixObj.toString()
));

Expand Down