sbt / sbt-native-packager

sbt Native Packager
https://sbt-native-packager.readthedocs.io/en/stable/
BSD 2-Clause "Simplified" License
1.59k stars 437 forks source link

Duplicate identifiers for generated application scripts in WiX when JDKPackagerPlugin enabled #1529

Open Facsimiler opened 1 year ago

Facsimiler commented 1 year ago

When running sbt windows:packageBin, I get errors with duplicate script file entries in the generated WiX .wxs file, but only if the JDKPackagerPlugin is enabled; if this plugin is not enabled, the .wxs file is generated correctly.

Expected behaviour

Native packager should produce a single, valid component definition for the generated application Windows batch file, and Bash script.

For example:

          <!-- etc. --><DirectoryRef Id="_bin97543xxxx">
            <Component Id="_bin_myapp109803301" Guid="71797867-610c-4c9b-ae19-9cf3ffb1c107">
              <File Id="fl__bin_myapp109803301" Name="myapp" DiskId="1" Source="bin\myapp">

              </File>
            </Component>
          </DirectoryRef><DirectoryRef Id="_bin97543xxxx">
            <Component Id="_bin_myapp_bat147501657" Guid="c17fcd85-bd84-4fba-be80-523bc13af11f">
              <File Id="fl__bin_myapp_bat147501657" Name="myapp.bat" DiskId="1" Source="bin\myapp.bat">

              </File>
            </Component>
          </DirectoryRef><!-- etc. -->

Actual behaviour

Native packager creates duplicate component definitions for the generated Windows batch file, and Bash script, but only if the JDKPackagerPlugin is enabled.

For example:

          <!-- etc. --><DirectoryRef Id="_bin97543xxxx">
            <Component Id="_bin_myapp109803301" Guid="71797867-610c-4c9b-ae19-9cf3ffb1c107">
              <File Id="fl__bin_myapp109803301" Name="myapp" DiskId="1" Source="bin\myapp">

              </File>
            </Component>
          </DirectoryRef><DirectoryRef Id="_bin97543xxxx">
            <Component Id="_bin_myapp109803301" Guid="8ae1a323-04cb-4aad-9407-ef622628be9b">
              <File Id="fl__bin_myapp109803301" Name="myapp" DiskId="1" Source="bin\myapp">

              </File>
            </Component>
          </DirectoryRef><DirectoryRef Id="_bin97543xxxx">
            <Component Id="_bin_myapp_bat147501657" Guid="c17fcd85-bd84-4fba-be80-523bc13af11f">
              <File Id="fl__bin_myapp_bat147501657" Name="myapp.bat" DiskId="1" Source="bin\myapp.bat">

              </File>
            </Component>
          </DirectoryRef><DirectoryRef Id="_bin97543xxxx">
            <Component Id="_bin_myapp_bat147501657" Guid="ac150d21-40bb-417d-a919-3cb8d73292d9">
              <File Id="fl__bin_myapp_bat147501657" Name="myapp.bat" DiskId="1" Source="bin\myapp.bat">

              </File>
            </Component>
          </DirectoryRef><!-- etc. -->

Note the duplicate entries for bin\myapp and bin\myapp.bat. That is, there are two entries, with the same ID, for each file, but with different GUIDs.

Information

Relevant SBT configuration:

enablePlugins(JDKPackagerPlugin)
enablePlugins(WindowsPlugin)
enablePlugins(JavaAppPackaging)
maintainer := "Me <me@someplace.com>"
packageSummary := "MyApp Installer"
packageDescription := """MyApp is cool"""
wixProductId := "10cdf7e0-a6b0-4d92-8144-c2c60ae96236"
wixProductUpgradeId := "7558a7d4-6bc9-4e64-9e7d-1b4207034cfb"
Windows / name := s"MyApp-${version.value}"