sbt / sbt-native-packager

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

WindowsPlugin: candleOptions and lightOptions should be tasks #1333

Open nigredo-tori opened 4 years ago

nigredo-tori commented 4 years ago

Here's my motivation. I have a custom plugin that uses WindowsPlugin with custom wixFiles. I want that plugin to be able to find an icon at a predetermined location (so that the calling code doesn't have to wire the whole thing up), and use it in the installer (e.g. for shortcuts). Furthermore, if the icon is not found, I want to build an installer without one. The most straightforward way to achieve that would be to pass a variable to candle indicating whether the icon is present, and use WiX preprocessor to conditionally inject the icon. However, I can't really do that because candleOptions is a setting!

muuki88 commented 4 years ago

Thanks for the feature request @nigredo-tori :heart:

In general: feel free to open a PR to makes settings a task. Both settings don't seem to be used in other downstream settings, so this shouldn't be an issue. I'm also fine with adding this to the MiMa exception list.

Having that said: What is the task you are depending on? I couldn't quite figure it out from your description :smile: Side effects can be performed in a setting as well. Looking for an icon could be performed in a setting as well, e.g.

candleOptions := {
   val icon = baseDirectory.value / "icon.png"
   if (icon.exists) ... else ...
}

You have probably thought about that or this isn't working due to some reason I haven't understood yet :smile: