MPNSIS-15 : Add a new template using MODERN_UI macros for a better L&F

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@534280 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier 2007-05-02 00:09:07 +00:00
parent 3db1214e10
commit d4ce382112
6 changed files with 491 additions and 105 deletions

View File

@ -50,3 +50,12 @@ maven.nsis.build.dir=
# name of generated exe
maven.nsis.final.name=${maven.final.name}
#Specific settings for MUI setup (maven.nsis.setup.template=${plugin.resources}/templates/mui-setup.jelly)
#maven.nsis.mui.icon=
#maven.nsis.mui.unicon=
#maven.nsis.mui.headerbitmap=
#maven.nsis.mui.unheaderbitmap=
#maven.nsis.mui.welcomebitmap=
#maven.nsis.mui.unwelcomebitmap=
maven.nsis.mui.languages=English,French,Spanish,German

View File

@ -0,0 +1,215 @@
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<j:jelly
xmlns:ant="jelly:ant"
xmlns:j="jelly:core"
xmlns:maven="jelly:maven"
xmlns:util="jelly:util"
xmlns="dummy"
trim="false">
; Author Arnaud Heritier
; Setup Script for NSIS using Modern UI
; http://maven.apache.org/maven-1.x/plugins/nsis/
; Do a Cyclic Redundancy Check to make sure the installer is not corrupt
CRCCheck on
; Compress options
SetCompress force
SetCompressor /SOLID lzma
SetDatablockOptimize on
; add directories for the source if it exists, and the plugin
<util:available file="${maven.nsis.src}">
; add project source onto the include list
!addincludedir "${maven.nsis.src}"
</util:available>
; add generated files onto the include list
!addincludedir "${maven.build.dir}"
; add plugin supplied files onto the include list
!addincludedir "${plugin.resources}"
; macro to check if the jdk is installed
!include "JDK.nsh"
; Functions to set/remove environment variables
!include "Environment.nsh"
; include project specific details
!include "project.nsh"
; We have a problem with maven installer which create its env variable in the user's scope
!define ALL_USERS
; Extensions / Plugins
!include "MUI.nsh"
; Functions defined in natively in NSIS
!include "FileFunc.nsh"
;Options
Name "$${PROJECT_NAME} $${PROJECT_VERSION}"
OutFile "$${PROJECT_DIST_DIR}\$${PROJECT_FINAL_NAME}.exe"
; The default installation directory
InstallDir "$$PROGRAMFILES\$${PROJECT_ORGANIZATION}\$${PROJECT_NAME} $${PROJECT_VERSION}"
; Registry key to check for directory (so if you upgrade, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "$${PROJECT_REG_KEY}" "Install_Dir"
; Adds an XP manifest to the installer
XPStyle on
;Interface Settings
!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
!define MUI_HEADERIMAGE
<j:set var="icon" value="${maven.nsis.mui.icon}"/>
<j:if test="${!empty(icon)}">
<maven:makeAbsolutePath var="icon" basedir="${basedir}" path="${maven.nsis.mui.icon}"/>
!define MUI_ICON "${icon}"
</j:if>
<j:set var="unicon" value="${maven.nsis.mui.unicon}"/>
<j:if test="${!empty(unicon)}">
<maven:makeAbsolutePath var="unicon" basedir="${basedir}" path="${maven.nsis.mui.unicon}"/>
!define MUI_UNICON "${unicon}"
</j:if>
<j:set var="headerbitmap" value="${maven.nsis.mui.headerbitmap}"/>
<j:if test="${!empty(headerbitmap)}">
<maven:makeAbsolutePath var="headerbitmap" basedir="${basedir}" path="${maven.nsis.mui.headerbitmap}"/>
!define MUI_HEADERIMAGE_BITMAP "${headerbitmap}"
</j:if>
<j:set var="unheaderbitmap" value="${maven.nsis.mui.unheaderbitmap}"/>
<j:if test="${!empty(unheaderbitmap)}">
<maven:makeAbsolutePath var="unheaderbitmap" basedir="${basedir}" path="${maven.nsis.mui.unheaderbitmap}"/>
!define MUI_HEADERIMAGE_UNBITMAP "${unheaderbitmap}"
</j:if>
<j:set var="welcomebitmap" value="${maven.nsis.mui.welcomebitmap}"/>
<j:if test="${!empty(welcomebitmap)}">
<maven:makeAbsolutePath var="welcomebitmap" basedir="${basedir}" path="${maven.nsis.mui.welcomebitmap}"/>
!define MUI_WELCOMEFINISHPAGE_BITMAP "${welcomebitmap}"
</j:if>
<j:set var="unwelcomebitmap" value="${maven.nsis.mui.unwelcomebitmap}"/>
<j:if test="${!empty(unwelcomebitmap)}">
<maven:makeAbsolutePath var="unwelcomebitmap" basedir="${basedir}" path="${maven.nsis.mui.unwelcomebitmap}"/>
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${unwelcomebitmap}"
</j:if>
!define MUI_ABORTWARNING
!define MUI_UNABORTWARNING
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
; Pages
; Install
!insertmacro MUI_PAGE_WELCOME
!ifdef PROJECT_LICENSE_FILE
!insertmacro MUI_PAGE_LICENSE "$${PROJECT_LICENSE_FILE}"
!endif
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
; Uninstall
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;Languages
<util:tokenize var="languages" delim=",">${maven.nsis.mui.languages}</util:tokenize>
<j:forEach var="language" items="${languages}">
!insertmacro MUI_LANGUAGE "${language}"
</j:forEach>
; -------------------------------------------------------------- Package up the files to be installed
Section "$${PROJECT_NAME} v$${PROJECT_VERSION} Binaries"
; Set output path to the installation directory.
SetOutPath $$INSTDIR
; Put files and directories there
; the script will be run from a directory below Maven
File /r "$${PROJECT_DIST_BIN_DIR}\*.*"
; Write the installation path into the registry
WriteRegStr HKLM "$${PROJECT_REG_KEY}" "Install_Dir" "$$INSTDIR"
; Write the environment variables to the Registry
<util:available file="${maven.nsis.src}/registry.nsh">
!include "registry.nsh"
</util:available>
; Write the uninstall keys for Windows
WriteRegStr HKLM "$${PROJECT_REG_UNINSTALL_KEY}" "DisplayName" "$${PROJECT_NAME} $${PROJECT_VERSION} (remove only)"
WriteRegStr HKLM "$${PROJECT_REG_UNINSTALL_KEY}" "UninstallString" '"$$INSTDIR\Uninst.exe"'
SectionEnd
<util:available file="${maven.nsis.src}/startmenu-shortcuts.nsh">
; -------------------------------------------------------------- Create Shortcuts
Section "Create Start Menu Shortcut(s)"
CreateDirectory "$${PROJECT_STARTMENU_FOLDER}"
!include "startmenu-shortcuts.nsh"
SectionEnd
</util:available>
<util:available file="${maven.nsis.src}/desktop-shortcuts.nsh">
; OPTIONAL Desktop Shortcut
Section "Create Desktop Shortcut(s)"
!include "desktop-shortcuts.nsh"
SectionEnd
</util:available>
; -------------------------------------------------------------- Section to Install the Uninstaller
Section "Install Uninstaller"
; write the uninstaller to the installation directory
WriteUninstaller "$$INSTDIR\Uninst.exe"
SectionEnd
; -------------------------------------------------------------- Uninstaller
Section "Uninstall"
DetailPrint "Remove files"
Delete $$INSTDIR\*.*
; MUST REMOVE UNINSTALLER, too
Delete "$$INSTDIR\Uninst.exe"
!include "remove-shortcuts.nsh"
; Recursively remove files and directories used
; this should also take care of the installer
RMDir /r "$$INSTDIR"
DetailPrint "Remove registry keys"
DeleteRegKey HKLM "$${PROJECT_REG_UNINSTALL_KEY}"
DeleteRegKey HKLM "$${PROJECT_REG_KEY}"
<util:available file="${maven.nsis.src}/registry-uninstall.nsh">
!include "registry-uninstall.nsh"
</util:available>
SectionEnd
; -------------------------------------------------------------- Functions
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Function myGUIInit
<util:available file="${maven.nsis.src}/before-install.nsh">
!include "before-install.nsh"
</util:available>
FunctionEnd
Function un.onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
; -------------------------------------------------------------- End of File
</j:jelly>

View File

@ -53,5 +53,4 @@
!define PROJECT_LOGO "${logo}"
</j:if>
</j:jelly>

View File

@ -25,6 +25,7 @@
</properties>
<body>
<release version="2.1-SNAPSHOT" date="In SVN">
<action dev="aheritier" type="add" issue="MPNSIS-15">Add a new template using MODERN_UI macros for a better L&F</action>
<action dev="aheritier" type="add" issue="MPNSIS-13">The script "remove-shortcuts.nsh" can be used to remove shortcuts created in "startmenu-shortcuts.nsh" and "desktop-shortcuts.nsh".</action>
<action dev="aheritier" type="update">Set compress options (force/lzma).</action>
<action dev="aheritier" type="update" issue="MPNSIS-12">NSIS plugin does not support silent uninstall. Remove the final dialog box.</action>

View File

@ -59,7 +59,7 @@
<section name="Default Templates">
<p>
The plugin provides two templates by default:
The plugin provides three templates by default:
</p>
<ol>
<li>
@ -70,6 +70,10 @@
<code>setup.jelly</code> which generates the final script for NSIS
compilation.
</li>
<li>
<code>mui-setup.jelly</code> which generates the final script for NSIS
compilation using the <a href="http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html" target="_blank">NSIS Modern User Interface</a>.
</li>
</ol>
<subsection name="project.jelly">
<p>
@ -113,7 +117,7 @@
files which you want included.
</p>
<p>
The <code>setup.nsh</code> file that is generated uses following list
The <code>setup.nsi</code> file that is generated uses following list
of directories to search for files to include:
</p>
<ol>
@ -176,6 +180,15 @@
script.
</p>
</subsection>
<subsection name="mui-setup.jelly">
<p>
This template is very similar to setup.jelly. It uses NSIS Modern UI and allows more customization for the installer L&F.
It includes the same list of files, except for BrandingImage.nsh which isn't useful.
It doesn't use properties <a href="properties.html">maven.nsis.logo* but maven.nsis.mui*</a>.
</p>
<p>To use this template you just have to define this property in your project : </p>
<source>maven.nsis.setup.template=${plugin.resources}/templates/mui-setup.jelly</source>
</subsection>
</section>
<section name="Default Template Scripts">

View File

@ -23,6 +23,7 @@
</properties>
<body>
<section name="Maven NSIS Plug-in Settings">
<subsection name="General Settings">
<table>
<tr>
<th>Property</th>
@ -33,80 +34,228 @@
<td>maven.nsis.build.dir</td>
<td>Yes</td>
<td>
<p>The directory containing contents to be bundled.<br/>Default value is ${maven.dist.bin.assembly.dir}</p>
<p>
The directory containing contents to be bundled.
<br />
Default value is ${maven.dist.bin.assembly.dir}
</p>
</td>
</tr>
<tr>
<td>maven.nsis.final.name</td>
<td>Yes</td>
<td>
<p>name of generated exe.<br/>Default value is
<code>${maven.final.name}</code>.</p>
<p>
name of generated exe.
<br />
Default value is
<code>${maven.final.name}</code>
.
</p>
</td>
</tr>
<tr>
<td>maven.nsis.src</td>
<td>Yes</td>
<td>
<p>Source of extra files for nsis.<br/>Default value is
<code>${basedir}/src/nsis</code>.</p>
<p>
Source of extra files for nsis.
<br />
Default value is
<code>${basedir}/src/nsis</code>
.
</p>
</td>
</tr>
<tr>
<td>maven.nsis.exe</td>
<td>Yes</td>
<td>
<p>Location of makensis.exe.<br/>Default value is
<code>C:/Program Files/NSIS/makensis.exe</code>.</p>
<p>
Location of makensis.exe.
<br />
Default value is
<code>C:/Program Files/NSIS/makensis.exe</code>
.
</p>
</td>
</tr>
<tr>
<td>maven.nsis.setup.template</td>
<td>Yes</td>
<td>
<p>This is the jelly template used to create the setup.nsi file.<br/>Default value is
<code>${plugin.resources}/templates/setup.jelly</code>.</p>
<p>
This is the jelly template used to create the setup.nsi file.
<br />
Default value is
<code>${plugin.resources}/templates/setup.jelly</code>
.
<br />
To generate an insaller with a MUI interface set this property to :
<code>${plugin.resources}/templates/mui-setup.jelly</code>
</p>
</td>
</tr>
<tr>
<td>maven.nsis.project.template</td>
<td>Yes</td>
<td>
<p>This is the jelly template used to create the project.nsh file.<br/>Default value is
<code>${plugin.resources}/templates/project.jelly</code>.</p>
<p>
This is the jelly template used to create the project.nsh file.
<br />
Default value is
<code>${plugin.resources}/templates/project.jelly</code>
.
</p>
</td>
</tr>
</table>
</subsection>
<subsection name="Standard UI Settings">
<p>
Those properties are used only if
<code>maven.nsis.setup.template=${plugin.resources}/templates/setup.jelly</code>
</p>
<table>
<tr>
<th>Property</th>
<th>Optional?</th>
<th>Description</th>
</tr>
<tr>
<td>maven.nsis.license.text</td>
<td>Yes</td>
<td>
<p>The License Text.<br/>Default value is
<code>This program is Licensed under The Apache Software License, Version 2.0.</code>.</p>
<p>
The License Text.
<br />
Default value is
<code>This program is Licensed under The Apache Software License, Version 2.0.</code>
.
</p>
</td>
</tr>
<tr>
<td>maven.nsis.logo</td>
<td>Yes</td>
<td>
<p>Location of the logo file.<br/>Default value is blank.</p>
<p>
Location of the logo file.
<br />
Default value is blank.
</p>
</td>
</tr>
<tr>
<td>maven.nsis.logo.position</td>
<td>Yes</td>
<td>
<p>Position of the logo on the first page (left, right, top or bottom).<br/>Default value is
<code>left</code>.</p>
<p>
Position of the logo on the first page (left, right, top or bottom).
<br />
Default value is
<code>left</code>
.
</p>
</td>
</tr>
<tr>
<td>maven.nsis.logo.widthHeight</td>
<td>Yes</td>
<td>
<p>size of the logo on the first page.<br/>Default value is blank.</p>
<p>
size of the logo on the first page.
<br />
Default value is blank.
</p>
</td>
</tr>
</table>
</subsection>
<subsection name="Modern UI Settings">
<p>
Those properties are used only with the MUI template :
<code>maven.nsis.setup.template=${plugin.resources}/templates/mui-setup.jelly</code>
</p>
<table>
<tr>
<th>Property</th>
<th>Optional?</th>
<th>Description</th>
</tr>
<tr>
<td>maven.nsis.mui.icon</td>
<td>Yes</td>
<td>
<p>
Setup icon for install.
<br />
Default : not set (using NSIS MUI defaults)
</p>
</td>
</tr>
<tr>
<td>maven.nsis.mui.unicon</td>
<td>Yes</td>
<td>
<p>
Setup icon for uninstall.
<br />
Default : not set (using NSIS MUI defaults)
</p>
</td>
</tr>
<tr>
<td>maven.nsis.mui.headerbitmap</td>
<td>Yes</td>
<td>
<p>
Header bitmap for install.
<br />
Default : not set (using NSIS MUI defaults)
</p>
</td>
</tr>
<tr>
<td>maven.nsis.mui.unheaderbitmap</td>
<td>Yes</td>
<td>
<p>
Header bitmap for uninstall.
<br />
Default : not set (using NSIS MUI defaults)
</p>
</td>
</tr>
<tr>
<td>maven.nsis.mui.welcomebitmap</td>
<td>Yes</td>
<td>
<p>
Welcome bitmap for install.
<br />
Default : not set (using NSIS MUI defaults)
</p>
</td>
</tr>
<tr>
<td>maven.nsis.mui.unwelcomebitmap</td>
<td>Yes</td>
<td>
<p>
Welcome bitmap for uninstall.
<br />
Default : not set (using NSIS MUI defaults)
</p>
</td>
</tr>
<tr>
<td>maven.nsis.mui.languages</td>
<td>No</td>
<td>The list of languages to propose in the setup.<br/>Default : English,French,Spanish,German</td>
</tr>
</table>
</subsection>
</section>
</body>
</document>