Refactored advanced installer script

This commit is contained in:
Jeff Wallace 2013-08-22 15:19:50 -04:00
parent 65bb4a05ed
commit 2d0218d8a4

View File

@ -3,22 +3,51 @@
<!-- Need a way to specify TSK Debug versus Release -->
<property name="TSK_BUILD_TYPE">Release</property>
<target name="autoAIPath" >
<property name="AI.path">C:\Program Files (x86)\Caphyon\Advanced Installer 10.3\bin\x86\AdvancedInstaller.com</property>
<target name="build-installer-windows" depends="init-advanced-installer"
description="Makes an installer from the opened ZIP file">
<antcall target="run-advanced-installer" />
<!--<delete dir="${nbdist.dir}/${app.name}-installer"/>-->
<delete dir="${nbdist.dir}/installer_${app.name}-cache"/>
<move file="${nbdist.dir}/installer_${app.name}-SetupFiles/installer_${app.name}.msi" tofile="${nbdist.dir}/installer_${app.name}-${app.version}.msi" />
</target>
<target name="init-advanced-installer" depends="autoAIPath,inputAIPath"
description="Find AdvancedInstaller executable.">
<fail unless="ai-exe-path" message="Could not locate Advanced Installer."/>
<!-- Copy the template file to add details to -->
<copy file="${basedir}/installer_${app.name}/installer_${app.name}.aip" tofile="${nbdist.dir}/installer_${app.name}.aip" overwrite="true"/>
<property name="inst-path" value="${nbdist.dir}\${app.name}-installer"/>
<property name="aip-path" value="${nbdist.dir}\installer_${app.name}.aip"/>
<echo message="${ai-exe-path}" />
</target>
<target name="autoAIPath" description="Attempt to find the AI path based on standard installation location">
<property name="AI.path" value="C:\Program Files (x86)\Caphyon\Advanced Installer 10.3\bin\x86\AdvancedInstaller.com" />
<available file="${AI.path}"
property="ai-exe-path"
value="${AI.path}"/>
<echo message="${ai-exe-path}" />
</target>
<target name="inputAIPath" unless="ai-exe-path">
<target name="inputAIPath" unless="ai-exe-path" description="Have the user input the path to the AI executable">
<input addProperty="ai-exe-path"
message="Enter the location of AdvancedInstaller.com"/>
</target>
<target name="run-advanced-installer" depends="autoAIPath,inputAIPath">
<fail unless="ai-exe-path" message="Could not locate Advanced Installer."/>
<!-- Copy the template file to add details to -->
<copy file="${basedir}/installer_${app.name}/installer_${app.name}.aip" tofile="${nbdist.dir}/installer_${app.name}.aip" overwrite="true"/>
<target name="run-advanced-installer" depends="add-ai-productinfo,add-ai-files,add-ai-shortcuts,add-ai-env">
<!-- Leaving this commented out bit for documentation purposes. Not sure what its supposed to do. -->
<!-- Need to find a way to deal with beta version -->
<!--<echo message="Setting ${app.name} version to ${app.version}..."/>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /SetVersion ${app.version}"/>
</exec>-->
<!--<delete file="${aip-path}"/>-->
</target>
<target name="add-ai-productinfo" description="Add product information to the aip file">
<scriptdef name="generateguid" language="javascript">
<attribute name="property" />
<![CDATA[
@ -28,8 +57,6 @@
]]>
</scriptdef>
<generateguid property="guid1" />
<property name="inst-path" value="${nbdist.dir}\${app.name}-installer"/>
<property name="aip-path" value="${nbdist.dir}\installer_${app.name}.aip"/>
<!-- automatically replace version name and productcode in the .aip file -->
<echo>Product Code: ${guid1}</echo>
<echo>Product Version: ${app.version}</echo>
@ -42,55 +69,36 @@
<replaceregexp file="${aip-path}"
match="ProductVersion&quot; Value=&quot;\d+\.{1}\d+\.{1}\d+"
replace="ProductVersion&quot; Value=&quot;${app.version}" />
<!-- Use Advanced Installer to configure files to add -->
<echo message="Adding files to installer..."/>
</target>
<target name="add-ai-files" description="Add the files in the installation path to the installer file">
<foreach target="add-file-or-dir" param="theFile" inheritall="true" inheritrefs="true">
<path>
<fileset dir="${inst-path}">
<include name="*" />
</fileset>
<dirset dir="${inst-path}">
<include name="*"/>
</dirset>
</path>
</foreach>
</target>
<target name="add-file-or-dir" depends="is-file-or-folder">
<echo message="${ai-exe-path}" />
<echo message="Adding ${file-or-folder} to installer: ${theFile}"/>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFolder APPDIR ${inst-path}\bin"/>
<arg line="/edit ${aip-path} /Add${file-or-folder} APPDIR ${theFile}" />
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFolder APPDIR ${inst-path}\etc"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFolder APPDIR ${inst-path}\gstreamer"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFolder APPDIR ${inst-path}\harness"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFolder APPDIR ${inst-path}\java"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFolder APPDIR ${inst-path}\jre"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFolder APPDIR ${inst-path}\platform"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFolder APPDIR ${inst-path}\${app.name}"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFile APPDIR ${inst-path}\icon.ico"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFile APPDIR ${inst-path}\KNOWN_ISSUES.txt"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFile APPDIR ${inst-path}\LICENSE-2.0.txt"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFile APPDIR ${inst-path}\NEWS.txt"/>
</exec>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFile APPDIR ${inst-path}\README.txt"/>
</exec>
<!-- Need to find a way to deal with beta version -->
<!--<echo message="Setting ${app.name} version to ${app.version}..."/>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /SetVersion ${app.version}"/>
</exec>-->
</target>
<target name="is-file-or-folder">
<condition property="file-or-folder" value="File" else="Folder">
<available file="${theFile}" type="file" />
</condition>
</target>
<target name="add-ai-shortcuts" description="Add shortcuts to the aip file">
<echo message="Adding desktop/menu shortcuts..."/>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /NewShortcut -name ${app.title} -dir DesktopFolder -target APPDIR\bin\${app.name}.exe -icon ${inst-path}\icon.ico"/>
@ -98,7 +106,10 @@
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /NewShortcut -name ${app.title} -dir SHORTCUTDIR -target APPDIR\bin\${app.name}.exe -icon ${inst-path}\icon.ico"/>
</exec>
</target>
<!-- TODO: does this always need to be done, or just for 64 bit files? -->
<target name="add-ai-env" description="Add the enviornment variables to the aip file">
<echo message="Setting environment variables..."/>
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /NewEnvironment -name GSTREAMER_PATH -value [APPDIR]gstreamer\bin -install_operation CreateUpdate -behavior Append -system_variable"/>
@ -112,14 +123,6 @@
<exec executable="${ai-exe-path}">
<arg line="/build ${aip-path}"/>
</exec>
<!--<delete file="${aip-path}"/>-->
</target>
<!-- Makes an installer from the opened ZIP file -->
<target name="build-installer-windows">
<antcall target="run-advanced-installer" />
<!--<delete dir="${nbdist.dir}/${app.name}-installer"/>-->
<delete dir="${nbdist.dir}/installer_${app.name}-cache"/>
<move file="${nbdist.dir}/installer_${app.name}-SetupFiles/installer_${app.name}.msi" tofile="${nbdist.dir}/installer_${app.name}-${app.version}.msi" />
</target>
</project>