On Wed, 21 May 2025 01:44:48 GMT, Alexander Matveev <almat...@openjdk.org> 
wrote:

>> src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java 
>> line 199:
>> 
>>> 197:                         }
>>> 198:                         return version;
>>> 199:                     },
>> 
>> I guess, this is a workaround for the case when the version comes from JDK's 
>> release file. This is the wrong place for this workaround. It should be a 
>> part of the code reading version from JDK's release file.
>
> Yes, this is workaround when the version comes from JDK's release file. In 
> this case name will be customeJDK-25.0.0.0 for example if we change it when 
> we read version form file. Other platform do not need it. Only 
> PRODUCT_VERSION in MSI needs to be 2 or 4 components, so I think it is 
> correct location for it.

For runtime packaging, the version can be taken from the command line or the 
"release" file. In the latter case the version should be valid for the current 
platform and packaging type. Version adjustments should be isolated in a 
function that reads a version from the "release" file. The result of this 
function call should be such that it will be used as-is without any 
modifications.

Ideally, we should have `Optional<String> 
readVersionFromRuntimeReleaseFile(String packageType, Path pathToReleaseFile)` 
function that we can unit test and that will return a valid version for the 
given packaging type ("packageType" parameter). It should return an empty 
Optional instance if it fails.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25314#discussion_r2099180763

Reply via email to