wix-maven / wix-maven-plugin

A maven plugin to provide lifecycle of a Windows Installer build using WiX.
http://wix-maven.github.io/wix-maven-plugin
13 stars 6 forks source link

Add "heat" support #1

Open chrisridd opened 9 years ago

chrisridd commented 9 years ago

We have a very simple package that used heat to produce the payload information, when we built using ant.

There's no support for using heat in mvn. Could one please be added?

GregDomjan commented 9 years ago

Will add support for heat. As I don't use heat, It would help if you could provide some example integration test(s) showing how you might use it. What convention would there be for identifying files to run Heat on? Would it be

chrisridd commented 9 years ago

That's a good question! Currently our pom doesn't have any Windows packaging in at all, but I would envisage it being used in a similar way to our rpm/deb packaging support which are done as profiles.

We're open source - you can see the existing deb/rpm stuff starting around line 2012:

http://sources.forgerock.org/browse/~br=trunk/opendj/trunk/opendj/opendj-server-legacy/pom.xml

GregDomjan commented 9 years ago

Thanks for the reference, I'll have to look further into the deb/rpm config as it is substantial and I haven't used the plugins.

I did a quick search and also found your old build.xml with call to heat - pulling the attributes to do with convention I would see

<!-- Construct a .wxs file from the directory structure -->  
<exec executable="heat.exe" dir="${build.dir}/msi/files">  
<arg value="-o"/> <arg value="${build.dir}/msi/build/payload.wxs"/>  
</exec>

the input working dir like ${build.dir}/msi/files would perhaps be similar to 1 or more 'source' directories

Some of the harvest types might be more static than others. Assuming that source directories of binaries is unlikely to be checked in initial default locations might be

maybe under subfolders based on harvest type - the output file would be considered a generated source

target/generated-source/heat **/*.wxs would be automatically included in the candle source folders.

Leaves how to configure rest of settings for each call to heat.

     <arg value="-cg"/> <arg value="all"/>
     <arg value="-gg"/>
     <arg value="-sfrag"/>
     <arg value="-srd"/>
     <arg value="-dr"/> <arg value="OPENDJ"/>
     <arg value="-var"/> <arg value="var.src"/>
     <arg value="-template"/> <arg value="fragment"/>

It seems these might change between heat calls, especially between the dir groups.

leif81 commented 8 years ago

I'm interested in heat support too.

My use case for heat is to let it generate a wix fragment file for all my project dependencies (i.e. jar files).

heat dir target/appassembler/lib -gg -ke -cg Lib -sfrag -dr LibDir -srd -out target/wix/Lib.wxs

This would save me from having to update my main Product.wxs everytime I add or change a dependency in my pom.xml.

GregDomjan commented 8 years ago

I found some time to make a first cut, it should be on OSSRH It is limited to 'dir' type at the moment which seems to be what is desired most.

<dependency>
  <groupId>com.github.wix-maven</groupId>
  <artifactId>wix-maven-plugin</artifactId>
  <version>0.2.0-SNAPSHOT</version>
</dependency>
peanut006 commented 8 years ago

My use case is to build msi package from quite static files. Otherwise the command is quite same as in leif81's message.

I was able to create the xws using heat command using shell script. But there are one issue:

I tried to change the source root dir of the files to be in target directory. I assume that it should be done using variable like "-var var.schema.build.directory" etc. but now I would need to have way to give variables to candle command using the plugin.

I was unable to get 0.2.0-SNAPSHOT version to run properly. I'm missing the extension files from target/wix-tools/bin directory. What is proper way (dependency/configuration?) to obtain those extensions?

I'm currently creating test project that I can put here to show what I'm trying to do.

GregDomjan commented 8 years ago

Using

    <wixtools.version>3.9.2</wixtools.version>
    <wixtools.groupId>org.wixtoolset.maven</wixtools.groupId>

Heat requires the following dependencies

        <dependency>
            <groupId>${wixtools.groupId}</groupId>
            <artifactId>wix-toolset</artifactId>
            <version>${wixtools.version}</version>
            <type>wixext</type>
            <classifier>WixIISExtension</classifier>
        </dependency>
        <dependency>
            <groupId>${wixtools.groupId}</groupId>
            <artifactId>wix-toolset</artifactId>
            <version>${wixtools.version}</version>
            <type>wixext</type>
            <classifier>WixUtilExtension</classifier>
        </dependency>
        <dependency>
            <groupId>${wixtools.groupId}</groupId>
            <artifactId>wix-toolset</artifactId>
            <version>${wixtools.version}</version>
            <type>wixext</type>
            <classifier>WixVSExtension</classifier>
        </dependency>

harvest goal will copy these to same folder as heat when present, and should warn if not.

I need to do something about adding beta documentation to github without removing current harvest-mojo.html.txt

peanut006 commented 8 years ago

Thanks, I got it to work :)

https://github.com/peanut006/wix-maven-example

Done couple minor fixes to the plugin:

peanut006 commented 8 years ago

Sorry, I was in a little hurry last night..

The HarvestMojo.java 398: I mean that the listFiles method can return nulls and those for loops can't handle the nulls.

And the getHarvestID method should not use "-", it's not allowed character in wix Id attribute. Changed it to "_" underscore and it worked ok.

Let's see can I make proper pull request from these..

GregDomjan commented 5 years ago

@peanut006 @leif81 @chrisridd 0.2.0 is up and has changes for heat included. It's still rough I think, any inputs to make it better?

jochenschmich commented 5 years ago

I'd like to see the -srd parameter. It would be great if this could be included rather quick please as I rely on it. See: https://github.com/wix-maven/wix-maven-plugin/pull/16