From dba7e139ebd92bad8fe2e97662389c97b02de489 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Tue, 10 Nov 2015 15:41:28 +0000
Subject: [PATCH] OPENDJ-2401 Add msi package maven module

---
 opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/opendjbanner.bmp |    0 
 opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/package.wxs      |   68 +++++++++++++
 opendj-packages/opendj-msi/opendj-msi-standard/pom.xml                        |  154 ++++++++++++++++++++++++++++++
 opendj-packages/opendj-msi/pom.xml                                            |   76 +++++++++++++++
 opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/opendjdialog.bmp |    0 
 5 files changed, 298 insertions(+), 0 deletions(-)

diff --git a/opendj-packages/opendj-msi/opendj-msi-standard/pom.xml b/opendj-packages/opendj-msi/opendj-msi-standard/pom.xml
new file mode 100644
index 0000000..8d4e508
--- /dev/null
+++ b/opendj-packages/opendj-msi/opendj-msi-standard/pom.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ! CDDL HEADER START
+  !
+  ! The contents of this file are subject to the terms of the
+  ! Common Development and Distribution License, Version 1.0 only
+  ! (the "License").  You may not use this file except in compliance
+  ! with the License.
+  !
+  ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+  ! or http://forgerock.org/license/CDDLv1.0.html.
+  ! See the License for the specific language governing permissions
+  ! and limitations under the License.
+  !
+  ! When distributing Covered Code, include this CDDL HEADER in each
+  ! file and include the License file at
+  ! legal-notices/CDDLv1_0.txt.  If applicable,
+  ! add the following below this CDDL HEADER, with the fields enclosed
+  ! by brackets "[]" replaced with your own identifying information:
+  !      Portions Copyright [yyyy] [name of copyright owner]
+  !
+  ! CDDL HEADER END
+  !
+  !      Copyright 2015 ForgeRock AS.
+  !
+-->
+<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>
+
+    <parent>
+        <groupId>org.forgerock.opendj</groupId>
+        <artifactId>opendj-msi</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>opendj-msi-standard</artifactId>
+    <name>OpenDJ MSI Standard Package</name>
+
+    <packaging>pom</packaging>
+
+    <description>
+        This module generates an OpenDJ MSI package.
+    </description>
+
+    <properties>
+        <msi.resources>${basedir}/resources/msi</msi.resources>
+        <package.dir>${project.build.directory}/${product.name.lowercase}</package.dir>
+    </properties>
+
+    <profiles>
+        <profile>
+            <id>build-msi-plugin</id>
+            <activation>
+                <os><family>windows</family></os>
+            </activation>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>build-helper-maven-plugin</artifactId>
+                    </plugin>
+
+                    <plugin>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>build-msi-package</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                                <configuration>
+                                    <!-- Package the Directory Server for the MSI distribution. -->
+                                    <target>
+                                        <mkdir dir="${project.build.directory}/msi/files" />
+                                        <copy toDir="${project.build.directory}/msi/files">
+                                            <fileset dir="${package.dir}">
+                                                <!-- Exclude Mac apps -->
+                                                <exclude name="QuickSetup.app/**"/>
+                                                <exclude name="Uninstall.app/**"/>
+
+                                                <!-- Exclude shell scripts -->
+                                                <exclude name="bin/**"/>
+                                                <exclude name="setup"/>
+                                                <exclude name="uninstall"/>
+                                                <exclude name="upgrade"/>
+                                                <exclude name="**/*.sh"/>
+                                            </fileset>
+                                        </copy>
+
+                                        <mkdir dir="${project.build.directory}/msi/build" />
+                                        <copy file="${msi.resources}/package.wxs" toDir="${project.build.directory}/msi/build"/>
+                                        <copy file="${msi.resources}/opendjbanner.bmp" toDir="${project.build.directory}/msi/build"/>
+                                        <copy file="${msi.resources}/opendjdialog.bmp" toDir="${project.build.directory}/msi/build"/>
+                                        <mkdir dir="${project.build.directory}/msi/dist" />
+
+                                        <!-- Construct a .wxs file from the directory structure -->
+                                        <exec executable="heat.exe" dir="${project.build.directory}/msi/files">
+                                            <arg value="dir"/>
+                                            <arg value="."/>
+                                            <arg value="-nologo"/>
+                                            <arg value="-cg"/> <arg value="all"/>
+                                            <arg value="-gg"/>
+                                            <arg value="-sfrag"/>
+                                            <arg value="-srd"/>
+                                            <arg value="-ke"/>
+                                            <arg value="-dr"/> <arg value="OPENDJ"/>
+                                            <arg value="-var"/> <arg value="var.src"/>
+                                            <arg value="-template"/> <arg value="fragment"/>
+                                            <arg value="-o"/> <arg value="${project.build.directory}/msi/build/payload.wxs"/>
+                                        </exec>
+
+                                        <!-- Compile all .wxs files into .wixobj files (fast) -->
+                                        <exec executable="candle.exe" dir="${project.build.directory}/msi">
+                                            <arg value="-nologo"/>
+                                            <arg value="-out"/> <arg value="${project.build.directory}/msi/build/"/>
+                                            <arg value="-dsrc=files"/>
+                                            <arg value="-dname=${product.name}"/>
+                                            <arg value="-dmajor=${parsedVersion.majorVersion}"/>
+                                            <arg value="-dminor=${parsedVersion.minorVersion}"/>
+                                            <arg value="-dpoint=${parsedVersion.incrementalVersion}"/>
+                                            <arg value="build/package.wxs"/>
+                                            <arg value="build/payload.wxs"/>
+                                        </exec>
+
+                                        <!-- Build the package (slow) -->
+                                        <exec executable="light.exe" dir="${project.build.directory}/msi">
+                                            <arg value="-nologo"/>
+                                            <arg value="-ext"/> <arg value="WixUIExtension"/>
+                                            <arg value="-out"/> <arg value="dist/${product.name.lowercase}-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.msi"/>
+                                            <arg value="build/package.wixobj"/>
+                                            <arg value="build/payload.wixobj"/>
+                                        </exec>
+
+                                        <!-- Attach msi artifact to the build -->
+                                        <attachartifact file="${project.build.directory}/msi/dist/${product.name.lowercase}-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.msi"/>
+                                    </target>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
diff --git a/opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/opendjbanner.bmp b/opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/opendjbanner.bmp
new file mode 100644
index 0000000..332b89c
--- /dev/null
+++ b/opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/opendjbanner.bmp
Binary files differ
diff --git a/opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/opendjdialog.bmp b/opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/opendjdialog.bmp
new file mode 100644
index 0000000..d99ed06
--- /dev/null
+++ b/opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/opendjdialog.bmp
Binary files differ
diff --git a/opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/package.wxs b/opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/package.wxs
new file mode 100644
index 0000000..0dd1bbf
--- /dev/null
+++ b/opendj-packages/opendj-msi/opendj-msi-standard/resources/msi/package.wxs
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ! CDDL HEADER START
+ !
+ ! The contents of this file are subject to the terms of the
+ ! Common Development and Distribution License, Version 1.0 only
+ ! (the "License").  You may not use this file except in compliance
+ ! with the License.
+ !
+ ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ ! or http://forgerock.org/license/CDDLv1.0.html.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, include this CDDL HEADER in each
+ ! file and include the License file at legal-notices/CDDLv1_0.txt.
+ ! If applicable, add the following below this CDDL HEADER, with the
+ ! fields enclosed by brackets "[]" replaced with your own identifying
+ ! information:
+ !      Portions Copyright [yyyy] [name of copyright owner]
+ !
+ ! CDDL HEADER END
+ !
+ !
+ !      Copyright 2013-2015 ForgeRock AS
+ ! -->
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+  <Product Id="*" Codepage="1252" Language="1033" Manufacturer="ForgeRock"
+           Name="ForgeRock $(var.name) $(var.major).$(var.minor).$(var.point)" Version="$(var.major).$(var.minor).$(var.point)"
+           UpgradeCode="A3E82AC0-88E6-4DEE-9D8C-5AE3B7853274">
+    <Package Id="*" Comments="This package contains ForgeRock $(var.name) $(var.major).$(var.minor).$(var.point)."
+             Description="ForgeRock products" InstallerVersion="300" Languages="1033" Manufacturer="ForgeRock"
+             Platform="x86" Compressed="yes"/>
+    <Media Id="1" Cabinet="opendj.cab" DiskPrompt="Disk 1" EmbedCab="yes" CompressionLevel="high"/>
+    <Property Id="DiskPrompt" Value="ForgeRock $(var.name) $(var.major).$(var.minor).$(var.point) Installation"/>
+
+    <Property Id="ALLUSERS" Value="1"/>
+    <Property Id="ARPHELPLINK" Value="http://forgerock.com"/>
+
+    <!-- UI customization -->
+    <WixVariable Id="WixUIBannerBmp" Value="opendjbanner.bmp" />
+    <WixVariable Id="WixUIDialogBmp" Value="opendjdialog.bmp" />
+
+    <!-- Upgrading -->
+    <MajorUpgrade DowngradeErrorMessage="A newer version of $(var.name) is already installed."/>
+
+    <Directory Id="TARGETDIR" Name="SourceDir">
+      <Directory Id="ProgramFilesFolder" Name="PFiles">
+        <Directory Id="OPENDJ" Name="$(var.name)">
+        </Directory>
+      </Directory>
+    </Directory>
+
+    <Feature Id="All" Title="Server and tools" Level="1" ConfigurableDirectory="OPENDJ">
+      <ComponentGroupRef Id="all"/>
+    </Feature>
+
+    <!-- User interface -->
+    <Property Id="WIXUI_INSTALLDIR" Value="OPENDJ"/>
+    <UI Id="OpenDJ_Install">
+      <UIRef Id="WixUI_InstallDir"/>
+      <UIRef Id="WixUI_ErrorProgressText"/>
+      <!-- Don't show the license agreement in the install, just in setup -->
+      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>
+      <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
+    </UI>
+  </Product>
+</Wix>
diff --git a/opendj-packages/opendj-msi/pom.xml b/opendj-packages/opendj-msi/pom.xml
new file mode 100644
index 0000000..7bf63e2
--- /dev/null
+++ b/opendj-packages/opendj-msi/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ! CDDL HEADER START
+  !
+  ! The contents of this file are subject to the terms of the
+  ! Common Development and Distribution License, Version 1.0 only
+  ! (the "License").  You may not use this file except in compliance
+  ! with the License.
+  !
+  ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+  ! or http://forgerock.org/license/CDDLv1.0.html.
+  ! See the License for the specific language governing permissions
+  ! and limitations under the License.
+  !
+  ! When distributing Covered Code, include this CDDL HEADER in each
+  ! file and include the License file at
+  ! legal-notices/CDDLv1_0.txt.  If applicable,
+  ! add the following below this CDDL HEADER, with the fields enclosed
+  ! by brackets "[]" replaced with your own identifying information:
+  !      Portions Copyright [yyyy] [name of copyright owner]
+  !
+  ! CDDL HEADER END
+  !
+  !      Copyright 2015 ForgeRock AS.
+  !
+-->
+<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>
+
+    <parent>
+        <groupId>org.forgerock.opendj</groupId>
+        <artifactId>opendj-packages</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>opendj-msi</artifactId>
+    <name>OpenDJ MSI Packages Parent</name>
+
+    <packaging>pom</packaging>
+
+    <description>
+        This module contains configuration and generic plugin call to build OpenDJ MSI packages.
+    </description>
+
+    <modules>
+        <module>opendj-msi-standard</module>
+    </modules>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>check-windows</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                        <configuration>
+                            <rules>
+                                <requireOS>
+                                    <family>windows</family>
+                                </requireOS>
+                            </rules>
+                            <fail>false</fail>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

--
Gitblit v1.10.0