Repository: cloudstack Updated Branches: refs/heads/master b1dfeb9cf -> b814783a6
CLOUDSTACK-6410 : Maven Integration for windows Wix tool to create msi installer thropugh maven build process Signed-off-by: Abhinandan Prateek <aprat...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/54d3a3dc Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/54d3a3dc Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/54d3a3dc Branch: refs/heads/master Commit: 54d3a3dc90bace7f85172ad8ada693566144d1d7 Parents: b1dfeb9 Author: Damodar Reddy <damoder.re...@citrix.com> Authored: Tue Apr 15 14:44:03 2014 +0530 Committer: Abhinandan Prateek <aprat...@apache.org> Committed: Wed Apr 16 11:07:10 2014 +0530 ---------------------------------------------------------------------- Wix-cloudstack-maven-plugin/pom.xml | 68 +++++++++++ .../src/org/apache/cloudstack/wix/HeatMojo.java | 121 +++++++++++++++++++ client/pom.xml | 94 ++++++++++++++ 3 files changed, 283 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54d3a3dc/Wix-cloudstack-maven-plugin/pom.xml ---------------------------------------------------------------------- diff --git a/Wix-cloudstack-maven-plugin/pom.xml b/Wix-cloudstack-maven-plugin/pom.xml new file mode 100644 index 0000000..e5b9bd1 --- /dev/null +++ b/Wix-cloudstack-maven-plugin/pom.xml @@ -0,0 +1,68 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>Wix-cloudstack-maven-plugin</artifactId> + <name>Wix-cloudstack-maven-plugin</name> + <packaging>maven-plugin</packaging> + <parent> + <groupId>org.apache.cloudstack</groupId> + <artifactId>cloudstack</artifactId> + <version>4.5.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>${maven-plugin-api.version}</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-exec</artifactId> + <version>${commons-exec.version}</version> + </dependency> + <dependency> + <groupId>org.bitbucket.joxley</groupId> + <artifactId>wix-maven-plugin</artifactId> + <version>${wix-maven-plugin.version}</version> + </dependency> + </dependencies> + + <properties> + <maven-plugin-api.version>2.0</maven-plugin-api.version> + <commons-exec.version>1.1</commons-exec.version> + <wix-maven-plugin.version>1.1.1</wix-maven-plugin.version> + </properties> + + <build> + <pluginManagement> + <plugins> + <!-- Ignore/Execute plugin execution --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <versionRange>[1.0.0,)</versionRange> + <goals> + <goal>enforce</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54d3a3dc/Wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java ---------------------------------------------------------------------- diff --git a/Wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java b/Wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java new file mode 100644 index 0000000..4724d76 --- /dev/null +++ b/Wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java @@ -0,0 +1,121 @@ +package org.apache.cloudstack.wix; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.exec.CommandLine; +import org.apache.commons.exec.DefaultExecutor; +import org.apache.commons.exec.ExecuteException; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.bitbucket.joxley.wix.AbstractWixMojo; + +/** + * + * @goal heat + * + * @phase package + * + */ +public class HeatMojo extends AbstractWixMojo { + + /** + * Directory name to be harvested + * + * @parameter expression="${dir}" + * @required + * + */ + private String dir; + + /** + * use template, one of: fragment,module,product + * @parameter expression="${template}" defaults to fragment + * + */ + private String template; + + /** + * Output file + * + * @parameter expression="${outputFile}" + */ + private File outputFile; + + /** + * + * variable names to be passed to heat command + * @parameter expression="${vars}" + */ + private String vars; + + /** + * + * variable names to be passed to heat command + * @parameter expression="${workingDirectory}" + */ + private File workingDirectory; + + /** + * + * <DirectoryName> directory reference to root directories + * @parameter expression="${directoryName}" + */ + private String directoryName; + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + try { + CommandLine commandLine = new CommandLine("heat"); + + if(dir != null && !dir.trim().isEmpty()) { + commandLine.addArgument("dir"); + commandLine.addArgument(dir); + } + + commandLine.addArgument("-gg"); + commandLine.addArgument("-cg"); + commandLine.addArgument("ClientPath"); + commandLine.addArgument("-ke"); + commandLine.addArgument("-sfrag"); + + if(template == null || template.trim().isEmpty()) { + commandLine.addArgument("-template"); + commandLine.addArgument("fragment"); + } else { + commandLine.addArgument("-template"); + commandLine.addArgument(template); + } + + if (outputFile != null) { + commandLine.addArgument("-out"); + commandLine.addArgument(outputFile.getAbsolutePath()); + } + + if (directoryName != null) { + commandLine.addArgument("-dr"); + commandLine.addArgument(directoryName); + } + + if (vars != null) { + commandLine.addArguments(vars, false); + } + + DefaultExecutor executor = new DefaultExecutor(); + getLog().debug("working directory " + commandLine.toString()); + executor.setWorkingDirectory(getWorkingDirectory(workingDirectory)); + int exitValue = executor.execute(commandLine); + + if (exitValue != 0) { + throw new MojoExecutionException( + "Problem executing heat, return code " + exitValue); + } + + } catch (ExecuteException e) { + throw new MojoExecutionException("Problem executing heat", e); + } catch (IOException e) { + throw new MojoExecutionException("Problem executing heat", e); + } + } + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54d3a3dc/client/pom.xml ---------------------------------------------------------------------- diff --git a/client/pom.xml b/client/pom.xml index d8dbde7..aee2672 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -515,6 +515,16 @@ <exclude name="*.in"/> </fileset> </copy> + <copy todir="./target"> + <fileset dir="../scripts/installer/windows/"> + <include name="start.bat"/> + </fileset> + </copy> + <copy todir="./target/client"> + <fileset dir="./target/generated-webapp"> + <include name="**/*"/> + </fileset> + </copy> </target> </configuration> </execution> @@ -649,6 +659,90 @@ </build> </profile> <profile> + <id>buildw</id> + <activation> + <property> + <name>buildw</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>2.3</version> + <configuration> + <webappDirectory>target/client</webappDirectory> + <webXml>./target/generated-webapp/WEB-INF/web.xml</webXml> + <warSourceDirectory>./target/generated-webapp</warSourceDirectory> + <archive> + <manifest> + <addDefaultImplementationEntries>true</addDefaultImplementationEntries> + </manifest> + <manifestEntries> + <Implementation-Revision>${git.revision}</Implementation-Revision> + <Implementation-Branch>${git.branch}</Implementation-Branch> + </manifestEntries> + </archive> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.cloudstack</groupId> + <artifactId>Wix-cloudstack-maven-plugin</artifactId> + <version>4.5.0-SNAPSHOT</version> + <configuration> + <vars>-var wix.SourceClient</vars> + <workingDirectory>${basedir}/target</workingDirectory> + <dir>client</dir> + <template>fragment</template> + <directoryName>WEBAPPS</directoryName> + <outputFile>target/client.wxs</outputFile> + </configuration> + <executions> + <execution> + <id>wix-cs</id> + <goals> + <goal>heat</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.bitbucket.joxley</groupId> + <artifactId>wix-maven-plugin</artifactId> + <version>1.1.1</version> + <configuration> + <workingDirectory>${basedir}/target</workingDirectory> + <extensions> + <extension>WixFirewallExtension</extension> + <extension>WixUIExtension</extension> + </extensions> + <arguments>-dSourceClient=SourceDir\client</arguments> + <sourceFiles> + <sourceFile>../scripts/installer/windows/acs.wxs</sourceFile> + <sourceFile>target/client.wxs</sourceFile> + </sourceFiles> + <outputDirectory>target</outputDirectory> + <objectFiles> + <objectFile>target/acs.wixobj</objectFile> + <objectFile>target/client.wixobj</objectFile> + </objectFiles> + <outputFile>target/acs.msi</outputFile> + </configuration> + <executions> + <execution> + <id>wix</id> + <goals> + <goal>candle</goal> + <goal>light</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> <id>simulator</id> <activation> <property>