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 committed 2007-05-02 00:09:07 +00:00
1 parent 3db1214e10
commit d4ce382112
6 files changed
+491 -105

No files matched your search

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