On Mon, 11 Jan 2021 17:42:21 GMT, Andy Herrick <herr...@openjdk.org> wrote:

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

Changes requested by asemenyuk (Committer).

src/jdk.jpackage/share/native/applauncher/JvmLauncher.h line 37:

> 35: #define LAUNCH_FUNC "JLI_Launch"
> 36: #endif
> 37: 

I'd move this define in JvmLauncher.cpp. There is no need to make it visible 
outside of JvmLauncher implementation.

src/jdk.jpackage/share/classes/jdk/jpackage/internal/Platform.java line 127:

> 125:         return is64b;
> 126:     }
> 127: 

This function makes sense only on Windows platform. Why not add it to 
Windows-specific class, e.g. WixSourcesBuilder?

The value should not be based on arch of OS, but on arch of JDK. msi installer 
produced by jpackage from 32bit JDK (in case somebody would build 32bit 
OpenJDK) would contain 32bit Java runtime regardless on 64bit or 32bit Windows 
it will be executed. I'd use `sun.arch.data.model` instead of `os.arch`

src/jdk.jpackage/share/classes/jdk/jpackage/internal/Platform.java line 127:

> 125:         return is64b;
> 126:     }
> 127: 

This is Windows specific thing. There is no point to keep it in shared code. 
I'd suggest to move this function in WixSourcesBuilder class.

I think it is not correct to check for arch of the OS where jpackage runs. 
Jpackage from 32bit JDK (if somebody would build 32bit OpenJDK) would bake in 
32bit Java runtime in app image regardless Windows is 64bit or 32bit. So the 
arch of installer is determined by arch of Java runtime baked in the app image. 
For simplicity we can assume that arch of Java runtime is the same as the arch 
of jpackage (this might not be the case for external Java runtime case though, 
but let's leave this possibility aside as it is not supported anyways). If so, 
checking of `sun.arch.data.model` system property would be better alternative 
to `os.arch`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2030

Reply via email to