Mercurial > cgi-bin > hgweb.cgi > JpegWasher
diff build.xml @ 42:4076f1bbf21d
Got ant winapp working!
author | davidb |
---|---|
date | Sat, 02 May 2020 10:38:33 -0700 |
parents | 89d7f4d91f67 |
children | 8aada13933c6 |
line wrap: on
line diff
--- a/build.xml Fri May 01 23:12:35 2020 -0700 +++ b/build.xml Sat May 02 10:38:33 2020 -0700 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <project name="JpegWasher" default="help" basedir="." - xmlns:contrib="antlib:net.sf.antcontrib" xmlns:launch4j="antlib:net.sf.launch4j.ant"> <!-- import all environment variables as env.* --> <property environment="env"/> @@ -30,6 +29,7 @@ ]]> </scriptdef> + <!-- estimate disk usage --> <scriptdef language="javascript" name="du"> <attribute name="path" /> <attribute name="target" /> @@ -54,11 +54,33 @@ ]]> </scriptdef> + <!-- launch4j demands 4-part version numbers, grumble... --> + <scriptdef language="javascript" name="l4jversion"> + <attribute name="value" /> + <attribute name="target" /> + <![CDATA[ + "use strict"; + var IllegalArgumentException = Java.type('java.lang.IllegalArgumentException'); + var value = attributes.get("value"); + var ret = null; + if (value.match(/\d+\.\d+\.\d+\.\d+/)) + ret = value; + else if(value.match(/\d+\.\d+\.\d+/)) + ret = value + ".0"; + else if(value.match(/\d+\.\d+/)) + ret = value + ".0.0"; + else + throw new IllegalArgumentException("invalid version: " + value); + project.setProperty(attributes.get("target"), ret); + ]]> + </scriptdef> + <!-- Define the properties used by the build --> <property name="app.name" value="${ant.project.name}"/> <property name="app.version" value="1.03"/> <property name="app.domain" value="name.blackcap.exifwasher"/> <property name="app.entry" value="${app.domain}.MainKt"/> + <property name="app.copyright" value="Copyright © 2020, David W. Barts."/> <toLowerCase target="lc.app.name" value="${app.name}"/> <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/> <property name="work.jar" value="${basedir}/work.jar"/> @@ -70,29 +92,6 @@ <property name="bin.dir" value="${src.home}/name/blackcap/exifwasher/binaries"/> <property name="jvm.version" value="1.8"/> - <!-- load the ant-contrib tasks --> - <!-- TODO: see if we need this, remove if not (also see xmlns above) --> - <taskdef resource="net/sf/antcontrib/antlib.xml" - uri="antlib:net.sf.antcontrib"> - <classpath> - <fileset dir="${lib.home}/ant-contrib" includes="*.jar"/> - </classpath> - </taskdef> - - <!-- load launch4j (Windows app bundler) tasks --> - <contrib:if> - <os family="windows"/> - <contrib:then> - <taskdef name="create" - classname="net.sf.launch4j.ant.Launch4jTask" - uri="antlib:net.sf.launch4j.ant"> - <classpath> - <fileset dir="${lib.home}/launch4j" includes="*.jar"/> - </classpath> - </taskdef> - </contrib:then> - </contrib:if> - <!-- define the kotlin task --> <property name="kotlin.lib" value="${env.KOTLIN_HOME}/lib"/> <typedef resource="org/jetbrains/kotlin/ant/antlib.xml" @@ -200,6 +199,7 @@ <fileset file="${pf.home}/osx/Info.plist"/> <!-- XXX will break if any tokens contain <, >, or & --> <filterset> + <filter token="app.copyright" value="${app.copyright}"/> <filter token="app.domain" value="${app.domain}"/> <filter token="app.entry" value="${app.entry}"/> <filter token="app.name" value="${app.name}"/> @@ -256,7 +256,37 @@ </target> <target name="winapp" depends="jar" description="Create app bundle."> - <!-- not finished --> + <fail message="The Windows application can only be built on Windows."> + <condition> + <not><os family="windows"/></not> + </condition> + </fail> + <sequential> + <env-require name="LAUNCH4J_HOME"/> + <taskdef name="create" + classname="net.sf.launch4j.ant.Launch4jTask" + uri="antlib:net.sf.launch4j.ant"> + <classpath> + <fileset dir="${env.LAUNCH4J_HOME}" includes="launch4j.jar"/> + </classpath> + </taskdef> + <l4jversion value="${app.version}" target="l4j.version"/> + <copy todir="${dist.home}/" encoding="UTF-8" overwrite="true"> + <fileset file="${pf.home}/windows/exifwasher_l4j.xml"/> + <filterset> + <filter token="app.copyright" value="${app.copyright}"/> + <filter token="app.entry" value="${app.entry}"/> + <filter token="app.name" value="${app.name}"/> + <filter token="app.version" value="${app.version}"/> + <filter token="base.dir" value="${basedir}"/> + <filter token="dist.home" value="${dist.home}"/> + <filter token="jar.filename" value="${jar.name}"/> + <filter token="l4j.version" value="${l4j.version}"/> + <filter token="target.java.version" value="${jvm.version}"/> + </filterset> + </copy> + <launch4j:create configFile="${dist.home}/exifwasher_l4j.xml"/> + </sequential> </target> <target name="deb" depends="jar" description="Create Debian package."> @@ -277,7 +307,12 @@ <mkdir dir="${dist.home}/data/usr/share/doc/jpegwasher"/> <copy todir="${dist.home}/data/usr/share/doc/jpegwasher"> <filelist dir="${basedir}" files="Readme.html,Readme.rst"/> + </copy> + <copy todir="${dist.home}/data/usr/share/doc/jpegwasher" encoding="UTF-8" overwrite="true"> <fileset file="${pf.home}/linux/deb/copyright"/> + <filterset> + <filter token="app.copyright" value="${app.copyright}"/> + </filterset> </copy> <gzip src="${pf.home}/linux/deb/changelog" destfile="${dist.home}/data/usr/share/doc/jpegwasher/changelog.gz"/>