mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6410 : Maven Integration for windows Wix tool to create msi installer thropugh maven build process
Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
This commit is contained in:
parent
b1dfeb9cf4
commit
54d3a3dc90
68
Wix-cloudstack-maven-plugin/pom.xml
Normal file
68
Wix-cloudstack-maven-plugin/pom.xml
Normal file
@ -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>
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -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>
|
||||
@ -648,6 +658,90 @@
|
||||
</plugins>
|
||||
</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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user