maven-plugins/nsis/plugin.jelly
2007-04-30 07:41:05 +00:00

159 lines
5.6 KiB
XML

<?xml version="1.0"?>
<!--
/*
* 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.
*/
-->
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:artifact="artifact"
xmlns:license="license"
xmlns:maven="jelly:maven"
xmlns:util="jelly:util">
<!--==================================================================-->
<!-- Generate NSIS Installer.exe file -->
<!--==================================================================-->
<goal name="nsis"
description="Generate NSIS Installer .exe"
prereqs="nsis:installer">
</goal>
<goal name="nsis:generate-project"
description="Generate NSIS project.nsh file">
<!-- if maven.nsis.build.dir isn't specified, grab the dist setting -->
<j:if test="${context.getVariable('maven.nsis.build.dir') == null}">
<maven:get var="maven.nsis.build.dir" plugin="maven-dist-plugin" property="maven.dist.bin.assembly.dir"/>
</j:if>
<maven:param-check value="${maven.nsis.build.dir}" fail="true"
message="'maven.nsis.build.dir' must be specified. It is the directory containing files to be placed in the installer"/>
<mkdir dir="${maven.build.dir}"/>
<j:set var="generatedFileName" value="${maven.build.dir}/project.nsh"/>
<ant:echo>Creating ${generatedFileName} ...</ant:echo>
<j:file name="${generatedFileName}" prettyPrint="false" xmlns="dummy" omitXmlDeclaration="true" escapeText="false">
<j:import file="${maven.nsis.project.template}" inherit="true"/>
</j:file>
</goal>
<goal name="nsis:generate-setup"
description="Generate NSIS .nsi file">
<mkdir dir="${maven.build.dir}"/>
<j:set var="generatedFileName" value="${maven.build.dir}/setup.nsi"/>
<ant:echo>Creating ${generatedFileName} ...</ant:echo>
<j:file name="${generatedFileName}" prettyPrint="false" xmlns="dummy" omitXmlDeclaration="true" escapeText="false">
<j:import file="${maven.nsis.setup.template}" inherit="true"/>
</j:file>
</goal>
<!--==================================================================-->
<!-- Generate NSIS .exe file -->
<!--==================================================================-->
<goal name="nsis:installer"
description="Generate NSIS .exe file"
prereqs="nsis:generate-project,nsis:generate-setup">
<j:set var="script" value="${maven.build.dir}/setup.nsi"/>
<util:file var="nsisExeFile" name="${maven.nsis.exe}" />
<j:if test="${!nsisExeFile.exists()}">
<fail>The NSIS executable '${maven.nsis.exe}' could not be found</fail>
</j:if>
<!-- call makensis.exe with the setup.nsi file -->
<ant:exec executable="${maven.nsis.exe}" failonerror="true">
<arg value="/V2"/>
<arg value="${script}"/>
</ant:exec>
<ant:echo>Installer ${maven.build.dir}/${maven.nsis.final.name}.exe generated successfully</ant:echo>
</goal>
<!-- ================================================================== -->
<!-- D E P L O Y S N A P S H O T E X E -->
<!-- ================================================================== -->
<goal
name="nsis:deploy-snapshot"
prereqs="nsis:installer"
description="Deploy a snapshot exe to the remote repository">
<artifact:deploy-snapshot
artifact="${maven.build.dir}/${maven.nsis.final.name}.exe"
type="exe"
project="${pom}"
/>
</goal>
<!-- ================================================================== -->
<!-- D E P L O Y E X E -->
<!-- ================================================================== -->
<goal
name="nsis:deploy"
prereqs="nsis:installer"
description="Deploy an exe to the remote repository">
<artifact:deploy
artifact="${maven.build.dir}/${maven.nsis.final.name}.exe"
type="exe"
project="${pom}"
/>
</goal>
<!-- ================================================================== -->
<!-- I N S T A L L E X E -->
<!-- ================================================================== -->
<goal name="nsis:install" prereqs="nsis:installer"
description="Install the exe in the local repository">
<artifact:install
artifact="${maven.build.dir}/${maven.nsis.final.name}.exe"
type="exe"
project="${pom}"
/>
</goal>
<!-- ================================================================== -->
<!-- I N S T A L L S N A P S H O T E X E -->
<!-- ================================================================== -->
<goal
name="nsis:install-snapshot" prereqs="nsis:installer"
description="Install a snapshot exe in the local repository">
<artifact:install-snapshot
artifact="${maven.build.dir}/${maven.nsis.final.name}.exe"
type="exe"
project="${pom}"
/>
</goal>
</project>