From d4ce382112dfce05a8dacd74993c2c037dadbe65 Mon Sep 17 00:00:00 2001
From: aheritier
Date: Wed, 2 May 2007 00:09:07 +0000
Subject: [PATCH] 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
---
nsis/plugin.properties | 11 +-
.../templates/mui-setup.jelly | 215 +++++++++++
.../plugin-resources/templates/project.jelly | 1 -
nsis/xdocs/changes.xml | 1 +
nsis/xdocs/customizing.xml | 17 +-
nsis/xdocs/properties.xml | 351 +++++++++++++-----
6 files changed, 491 insertions(+), 105 deletions(-)
create mode 100644 nsis/src/plugin-resources/templates/mui-setup.jelly
diff --git a/nsis/plugin.properties b/nsis/plugin.properties
index cbfab821..c101c5ee 100644
--- a/nsis/plugin.properties
+++ b/nsis/plugin.properties
@@ -49,4 +49,13 @@ maven.nsis.logo.position=left
maven.nsis.build.dir=
# name of generated exe
-maven.nsis.final.name=${maven.final.name}
\ No newline at end of file
+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
\ No newline at end of file
diff --git a/nsis/src/plugin-resources/templates/mui-setup.jelly b/nsis/src/plugin-resources/templates/mui-setup.jelly
new file mode 100644
index 00000000..fc90d321
--- /dev/null
+++ b/nsis/src/plugin-resources/templates/mui-setup.jelly
@@ -0,0 +1,215 @@
+
+
+
+; 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
+
+; add project source onto the include list
+!addincludedir "${maven.nsis.src}"
+
+; 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
+
+
+
+!define MUI_ICON "${icon}"
+
+
+
+
+!define MUI_UNICON "${unicon}"
+
+
+
+
+!define MUI_HEADERIMAGE_BITMAP "${headerbitmap}"
+
+
+
+
+!define MUI_HEADERIMAGE_UNBITMAP "${unheaderbitmap}"
+
+
+
+
+!define MUI_WELCOMEFINISHPAGE_BITMAP "${welcomebitmap}"
+
+
+
+
+!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${unwelcomebitmap}"
+
+!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
+${maven.nsis.mui.languages}
+
+!insertmacro MUI_LANGUAGE "${language}"
+
+
+; -------------------------------------------------------------- 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
+
+ !include "registry.nsh"
+
+
+ ; 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
+
+
+; -------------------------------------------------------------- Create Shortcuts
+Section "Create Start Menu Shortcut(s)"
+ CreateDirectory "$${PROJECT_STARTMENU_FOLDER}"
+ !include "startmenu-shortcuts.nsh"
+SectionEnd
+
+
+
+; OPTIONAL Desktop Shortcut
+Section "Create Desktop Shortcut(s)"
+ !include "desktop-shortcuts.nsh"
+SectionEnd
+
+
+; -------------------------------------------------------------- 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}"
+
+ !include "registry-uninstall.nsh"
+
+SectionEnd
+
+; -------------------------------------------------------------- Functions
+Function .onInit
+ !insertmacro MUI_LANGDLL_DISPLAY
+FunctionEnd
+
+Function myGUIInit
+
+ !include "before-install.nsh"
+
+FunctionEnd
+
+Function un.onInit
+ !insertmacro MUI_LANGDLL_DISPLAY
+FunctionEnd
+; -------------------------------------------------------------- End of File
+
\ No newline at end of file
diff --git a/nsis/src/plugin-resources/templates/project.jelly b/nsis/src/plugin-resources/templates/project.jelly
index 92a64508..e4da9e0b 100644
--- a/nsis/src/plugin-resources/templates/project.jelly
+++ b/nsis/src/plugin-resources/templates/project.jelly
@@ -53,5 +53,4 @@
!define PROJECT_LOGO "${logo}"
-
\ No newline at end of file
diff --git a/nsis/xdocs/changes.xml b/nsis/xdocs/changes.xml
index 5bf76b5c..13135850 100644
--- a/nsis/xdocs/changes.xml
+++ b/nsis/xdocs/changes.xml
@@ -25,6 +25,7 @@
+ Add a new template using MODERN_UI macros for a better L&FThe script "remove-shortcuts.nsh" can be used to remove shortcuts created in "startmenu-shortcuts.nsh" and "desktop-shortcuts.nsh".Set compress options (force/lzma).NSIS plugin does not support silent uninstall. Remove the final dialog box.
diff --git a/nsis/xdocs/customizing.xml b/nsis/xdocs/customizing.xml
index c171a0b2..c2fd4e2f 100644
--- a/nsis/xdocs/customizing.xml
+++ b/nsis/xdocs/customizing.xml
@@ -59,7 +59,7 @@
- The plugin provides two templates by default:
+ The plugin provides three templates by default:
@@ -70,6 +70,10 @@
setup.jelly which generates the final script for NSIS
compilation.
+
+ mui-setup.jelly which generates the final script for NSIS
+ compilation using the NSIS Modern User Interface.
+
@@ -113,7 +117,7 @@
files which you want included.
- The setup.nsh file that is generated uses following list
+ The setup.nsi file that is generated uses following list
of directories to search for files to include:
@@ -176,6 +180,15 @@
script.
+
+
+ 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 maven.nsis.logo* but maven.nsis.mui*.
+
+
To use this template you just have to define this property in your project :
+ maven.nsis.setup.template=${plugin.resources}/templates/mui-setup.jelly
+
diff --git a/nsis/xdocs/properties.xml b/nsis/xdocs/properties.xml
index 6a009461..edb35bf5 100644
--- a/nsis/xdocs/properties.xml
+++ b/nsis/xdocs/properties.xml
@@ -1,112 +1,261 @@
+ /*
+ * 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.
+ */
+-->
Maven NSIS Plug-in Properties
-
-
-
Property
-
Optional?
-
Description
-
-
-
maven.nsis.build.dir
-
Yes
-
-
The directory containing contents to be bundled. Default value is ${maven.dist.bin.assembly.dir}
-
-
-
-
maven.nsis.final.name
-
Yes
-
-
name of generated exe. Default value is
- ${maven.final.name}.
-
-
-
-
maven.nsis.src
-
Yes
-
-
Source of extra files for nsis. Default value is
- ${basedir}/src/nsis.
-
-
-
-
maven.nsis.exe
-
Yes
-
-
Location of makensis.exe. Default value is
- C:/Program Files/NSIS/makensis.exe.
-
-
-
-
maven.nsis.setup.template
-
Yes
-
-
This is the jelly template used to create the setup.nsi file. Default value is
- ${plugin.resources}/templates/setup.jelly.
-
-
-
-
maven.nsis.project.template
-
Yes
-
-
This is the jelly template used to create the project.nsh file. Default value is
- ${plugin.resources}/templates/project.jelly.
-
-
-
-
maven.nsis.license.text
-
Yes
-
-
The License Text. Default value is
- This program is Licensed under The Apache Software License, Version 2.0..
-
-
-
-
maven.nsis.logo
-
Yes
-
-
Location of the logo file. Default value is blank.
-
-
-
-
maven.nsis.logo.position
-
Yes
-
-
Position of the logo on the first page (left, right, top or bottom). Default value is
- left.
-
-
-
-
maven.nsis.logo.widthHeight
-
Yes
-
-
size of the logo on the first page. Default value is blank.
-
-
-
+
+
+
+
Property
+
Optional?
+
Description
+
+
+
maven.nsis.build.dir
+
Yes
+
+
+ The directory containing contents to be bundled.
+
+ Default value is ${maven.dist.bin.assembly.dir}
+
+
+
+
+
maven.nsis.final.name
+
Yes
+
+
+ name of generated exe.
+
+ Default value is
+ ${maven.final.name}
+ .
+
+
+
+
+
maven.nsis.src
+
Yes
+
+
+ Source of extra files for nsis.
+
+ Default value is
+ ${basedir}/src/nsis
+ .
+
+
+
+
+
maven.nsis.exe
+
Yes
+
+
+ Location of makensis.exe.
+
+ Default value is
+ C:/Program Files/NSIS/makensis.exe
+ .
+
+
+
+
+
maven.nsis.setup.template
+
Yes
+
+
+ This is the jelly template used to create the setup.nsi file.
+
+ Default value is
+ ${plugin.resources}/templates/setup.jelly
+ .
+
+ To generate an insaller with a MUI interface set this property to :
+ ${plugin.resources}/templates/mui-setup.jelly
+
+
+
+
+
maven.nsis.project.template
+
Yes
+
+
+ This is the jelly template used to create the project.nsh file.
+
+ Default value is
+ ${plugin.resources}/templates/project.jelly
+ .
+
+
+
+
+
+
+
+ Those properties are used only if
+ maven.nsis.setup.template=${plugin.resources}/templates/setup.jelly
+
+
+
+
Property
+
Optional?
+
Description
+
+
+
maven.nsis.license.text
+
Yes
+
+
+ The License Text.
+
+ Default value is
+ This program is Licensed under The Apache Software License, Version 2.0.
+ .
+
+
+
+
+
maven.nsis.logo
+
Yes
+
+
+ Location of the logo file.
+
+ Default value is blank.
+
+
+
+
+
maven.nsis.logo.position
+
Yes
+
+
+ Position of the logo on the first page (left, right, top or bottom).
+
+ Default value is
+ left
+ .
+
+
+
+
+
maven.nsis.logo.widthHeight
+
Yes
+
+
+ size of the logo on the first page.
+
+ Default value is blank.
+
+
+
+
+
+
+
+ Those properties are used only with the MUI template :
+ maven.nsis.setup.template=${plugin.resources}/templates/mui-setup.jelly
+
+
+
+
Property
+
Optional?
+
Description
+
+
+
maven.nsis.mui.icon
+
Yes
+
+
+ Setup icon for install.
+
+ Default : not set (using NSIS MUI defaults)
+
+
+
+
+
maven.nsis.mui.unicon
+
Yes
+
+
+ Setup icon for uninstall.
+
+ Default : not set (using NSIS MUI defaults)
+
+
+
+
+
maven.nsis.mui.headerbitmap
+
Yes
+
+
+ Header bitmap for install.
+
+ Default : not set (using NSIS MUI defaults)
+
+
+
+
+
maven.nsis.mui.unheaderbitmap
+
Yes
+
+
+ Header bitmap for uninstall.
+
+ Default : not set (using NSIS MUI defaults)
+
+
+
+
+
maven.nsis.mui.welcomebitmap
+
Yes
+
+
+ Welcome bitmap for install.
+
+ Default : not set (using NSIS MUI defaults)
+
+
+
+
+
maven.nsis.mui.unwelcomebitmap
+
Yes
+
+
+ Welcome bitmap for uninstall.
+
+ Default : not set (using NSIS MUI defaults)
+
+
+
+
+
maven.nsis.mui.languages
+
No
+
The list of languages to propose in the setup. Default : English,French,Spanish,German