I am trying to package some files inside a msi installer for a Compose Multiplatform project. In a previous version I was able to add the following to the gradle file and it quite happily packaged the resources into the MSI and I was able to access them.
compose.desktop{
application {
mainClass = "MainKt"
fromFiles(project.file("config.properties"))
fromFiles(project.file("schemas"))
fromFiles(project.file("schemas.zip"))
fromFiles(project.file("adaptor.log"))
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "ControlPanel"
packageVersion = "1.0.0"
modules("java.instrument", "java.management", "java.naming", "java.sql", "jdk.unsupported")
windows*{*
menuGroup = "Control"
perUserInstall = true
}}}}Having now come back to this project for a customer, the fromFiles() method does not appear to be working within the compose multiplatform project, any ideas what this has changed to?
d
dbaelz
06/08/2023, 11:25 AM
Did you check the path for "project.file"? I had a similar problem in the past where I realized that it didn't reference the root but the nested gradle module
s
simon ballantyne
06/08/2023, 11:51 AM
ah that could be a good catch, ill give that a go
simon ballantyne
06/08/2023, 12:35 PM
turns out needed a change of method, the current docs on github are a little unclear, however I created a new dir under the gradle project root called packageResources/windows and added the files under there.
then used
appResourcesRootDir.set(project.layout.projectDirectory.dir("packageResources"))