filebot/build.xml

810 lines
33 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project name="filebot" default="fatjar">
<!-- include default inputs (optional) -->
<property file="profile.properties" />
<!-- include application properties -->
<property file="source/net/filebot/Settings.properties" />
<property name="title" value="${application.name}" />
<property name="version" value="${application.version}" />
<tstamp>
<format property="today" pattern="yyyy-MM-dd" />
</tstamp>
<!-- define source dirs -->
<property name="dir.source" location="${basedir}/source" />
<property name="dir.test" location="${basedir}/test" />
<property name="dir.build" location="${basedir}/build" />
<property name="dir.dist" location="${basedir}/dist" />
<property name="dir.lib" location="${basedir}/lib" />
<property name="dir.website" location="${basedir}/website" />
<property name="dir.installer" location="${basedir}/installer" />
<!-- define output paths -->
<property name="path.fatjar" location="${dir.dist}/${title}_${version}.jar" />
<property name="path.appbundle.tar.gz" location="${dir.dist}/${title}_${version}.app.tar.gz" />
<property name="path.ubuntu-binary.tar.gz" location="${dir.dist}/filebot-${version}-ubuntu.tar.gz" />
<property name="path.source.zip" location="${dir.dist}/filebot-${version}-src.zip" />
<property name="basedir.release" location="${basedir}/release" />
<property name="dir.release" location="${basedir.release}/${title}_${version}" />
<property name="frs.release" value="web.sourceforge.net:/home/frs/project/f/fi/filebot/filebot" />
<property name="frs.website" value="web.sourceforge.net:htdocs" />
<target name="jar" depends="build">
<!-- create dist dir -->
<mkdir dir="${dir.dist}" />
<!-- main jar -->
<jar destfile="${dir.dist}/filebot.jar">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Built-Date" value="${today}" />
<attribute name="Built-Revision" value="${svn.revision}" />
<attribute name="Application-Name" value="${title}" />
<attribute name="Application-Version" value="${version}" />
<attribute name="Main-Class" value="net.filebot.Main" />
</manifest>
<fileset dir="${dir.build}" excludes="**/*Test*" />
</jar>
<!-- extra jar containing all the unit tests -->
<jar destfile="${dir.dist}/filebot-test.jar">
<fileset dir="${dir.build}" includes="**/*Test*" />
</jar>
<!-- source as zip -->
<zip destfile="${path.source.zip}">
<fileset dir="source" />
<fileset dir="test" />
</zip>
</target>
<target name="fatjar" depends="jar" description="Merge all class files into a single executable jar file">
<jar destfile="${path.fatjar}" filesetmanifest="merge" duplicate="fail" index="yes">
<!-- include main jar -->
<zipfileset src="${dir.dist}/filebot.jar" />
<!-- include libs -->
<zipfileset src="${dir.lib}/json-simple.jar">
<include name="org/json/simple/**" />
</zipfileset>
<zipfileset src="${dir.lib}/json-io.jar">
<include name="com/cedarsoftware/util/**" />
</zipfileset>
<zipfileset src="${dir.lib}/glazedlists.jar">
<include name="ca/odell/glazedlists/**" />
</zipfileset>
<zipfileset src="${dir.lib}/miglayout-core.jar">
<include name="net/miginfocom/**" />
</zipfileset>
<zipfileset src="${dir.lib}/miglayout-swing.jar">
<include name="net/miginfocom/**" />
</zipfileset>
<zipfileset src="${dir.lib}/rsyntaxtextarea.jar">
<include name="org/fife/**" />
</zipfileset>
<zipfileset src="${dir.lib}/simmetrics.jar">
<include name="uk/ac/shef/wit/simmetrics/**" />
</zipfileset>
<zipfileset src="${dir.lib}/xmlrpc.jar">
<include name="redstone/xmlrpc/**" />
</zipfileset>
<zipfileset src="${dir.lib}/args4j.jar">
<include name="org/kohsuke/args4j/**" />
</zipfileset>
<zipfileset src="${dir.lib}/xz.jar">
<include name="org/tukaani/xz/**" />
</zipfileset>
<zipfileset src="${dir.lib}/ehcache.jar">
<include name="META-INF/services/**" />
<include name="net/sf/ehcache/**" />
<include name="org/terracotta/**" />
<include name="ehcache-failsafe.xml" />
<include name="build-info.properties" />
</zipfileset>
<zipfileset src="${dir.lib}/slf4j-api.jar">
<include name="org/slf4j/**" />
</zipfileset>
<zipfileset src="${dir.lib}/slf4j-jdk14.jar">
<include name="org/slf4j/**" />
</zipfileset>
<zipfileset src="${dir.lib}/commons-io.jar">
<include name="org/apache/commons/io/**" />
</zipfileset>
<zipfileset src="${dir.lib}/icu4j.jar">
<include name="com/ibm/icu/**" />
</zipfileset>
<zipfileset src="${dir.lib}/jacksum.jar">
<include name="jonelo/jacksum/adapt/**" />
<include name="jonelo/jacksum/algorithm/**" />
<include name="jonelo/sugar/util/**" />
</zipfileset>
<zipfileset src="${dir.lib}/groovy.jar">
<include name="groovy*/**" />
<include name="org/codehaus/groovy/**" />
<include name="META-INF/dgminfo" />
<include name="META-INF/services/**" />
<include name="META-INF/*.properties" />
<!-- filebot already includes it's own extension modules -->
<exclude name="META-INF/services/org.codehaus.groovy.runtime.ExtensionModule" />
</zipfileset>
<zipfileset src="${dir.lib}/sevenzipjbinding.jar">
<include name="net/sf/sevenzipjbinding/**" />
</zipfileset>
<zipfileset src="${dir.lib}/ObjCBridge.jar">
<include name="ca/weblite/objc/**" />
<include name="com/sun/jna/**" />
</zipfileset>
<zipfileset src="${dir.lib}/jgat-custom.jar">
<include name="com/dmurph/tracking/**" />
</zipfileset>
<!-- include classes and native libraries -->
<zipfileset src="${dir.lib}/jna.jar">
<include name="com/sun/jna/**" />
</zipfileset>
<zipfileset src="${dir.lib}/jna-platform.jar">
<include name="com/sun/jna/platform/win32/**" />
</zipfileset>
<!-- libraries used in external scripts -->
<zipfileset src="${dir.lib}/jsoup.jar">
<include name="org/jsoup/**" />
</zipfileset>
<!-- Ivy for @Grapes automatic dependency management -->
<zipfileset src="${dir.lib}/scripting/ivy.jar">
<include name="org/apache/ivy/**" />
</zipfileset>
<!-- AntBuilder including dependencies for ant-javamail, ant-commons-net and ant-jsch -->
<zipfileset src="${dir.lib}/scripting/ant.jar">
<include name="org/apache/tools/**" />
</zipfileset>
<zipfileset src="${dir.lib}/scripting/ant-launcher.jar">
<include name="org/apache/tools/**" />
</zipfileset>
<zipfileset src="${dir.lib}/scripting/ant-commons-net.jar">
<include name="org/apache/tools/**" />
</zipfileset>
<zipfileset src="${dir.lib}/scripting/ant-jsch.jar">
<include name="org/apache/tools/**" />
</zipfileset>
<zipfileset src="${dir.lib}/scripting/ant-javamail.jar">
<include name="org/apache/tools/**" />
</zipfileset>
<zipfileset src="${dir.lib}/scripting/commons-net.jar">
<include name="org/apache/commons/net/**" />
</zipfileset>
<zipfileset src="${dir.lib}/scripting/jsch.jar">
<include name="com/jcraft/jsch/**" />
</zipfileset>
<zipfileset src="${dir.lib}/scripting/mail.jar">
<include name="javax/mail/**" />
<include name="com/sun/mail/**" />
<include name="META-INF/*mail*" />
</zipfileset>
</jar>
</target>
<target name="appbundle" description="Build an OSX application bundle">
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="${dir.lib}/build/appbundler.jar" />
<bundleapp outputdirectory="${dir.dist}" name="${title}" displayname="${title}" shortversion="${version}" identifier="net.sourceforge.FileBot" mainclassname="net.filebot.Main" icon="${dir.installer}/appbundle/filebot.icns" copyright="2014 Reinhard Pointner" applicationcategory="public.app-category.productivity">
<classpath file="${path.fatjar}" />
<librarypath dir="${dir.lib}/native/mac-x86_64" />
<option value="-Dapplication.deployment=app" />
<option value="-Dapplication.update=auto" />
<option value="-Dunixfs=false" />
<option value="-DuseExtendedFileAttributes=true" />
<option value="-DuseCreationDate=false" />
<option value="-Djava.net.useSystemProxies=true" />
<option value="-Dsun.net.client.defaultConnectTimeout=10000" />
<option value="-Dsun.net.client.defaultReadTimeout=60000" />
<option value="-Dfile.encoding=UTF-8" />
<option value="-Djna.nosys=true" />
<option value="-Djna.library.path=$APP_ROOT/Contents/MacOS" />
<option value="-Djava.library.path=$APP_ROOT/Contents/MacOS" />
<option value="-Dnet.filebot.AcoustID.fpcalc=$APP_ROOT/Contents/MacOS/fpcalc" />
<option value="-Xdock:name=${title}" />
<option value="-Xdock:icon=Contents/Resources/filebot.icns" />
<option value="-Dapple.laf.useScreenMenuBar=true" />
</bundleapp>
<!-- application bundle folder as .tar.gz -->
<tar destfile="${path.appbundle.tar.gz}" compression="gzip" longfile="gnu">
<tarfileset dir="${dir.dist}" includes="${title}.app/**" excludes="**/MacOS/**" />
<tarfileset dir="${dir.dist}" includes="${title}.app/**/**.dylib" />
<!-- IMPORTANT application stub must be executable!! -->
<tarfileset dir="${dir.dist}" includes="${title}.app/**/**Launcher" filemode="755" />
<tarfileset dir="${dir.dist}" includes="${title}.app/**/fpcalc" filemode="755" />
<tarfileset prefix="${title}.app/Contents/MacOS" dir="${dir.installer}/appbundle" includes="*.sh" filemode="755" />
</tar>
<!-- print SHA256 since we manually need to update brew cask filebot -->
<checksum file="${path.appbundle.tar.gz}" algorithm="SHA-256" fileext=".sha256" />
<checksum file="${path.appbundle.tar.gz}" algorithm="SHA-256" property="appbundle.sha256" />
<echo taskname="SHA256" message="${appbundle.sha256}" />
</target>
<target name="appbundle-maspkg" depends="svn-update, fatjar">
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="${dir.lib}/build/appbundler.jar" />
<bundleapp executablename="FileBotAppLauncher" version="${svn.revision}" outputdirectory="${dir.dist}" name="${title}" displayname="${title}" shortversion="${version}" identifier="net.filebot.FileBot" mainclassname="net.filebot.Main" icon="${dir.installer}/appbundle/filebot.icns" copyright="2014 Reinhard Pointner" applicationcategory="public.app-category.productivity">
<classpath file="${path.fatjar}" />
<librarypath dir="${dir.lib}/native/mac-x86_64" />
<arch name="x86_64" />
<runtime dir="/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home" />
<!-- WORKING_DIR is sandbox data folder -->
<option value="-Dapplication.dir=./Library/Application Support/User Data" />
<option value="-Dapplication.cache=./Library/Caches/ehcache.disk.store" />
<option value="-Djava.io.tmpdir=./Library/Caches/java.io.tmpdir" />
<option value="-Dnet.filebot.UserFiles.fileChooser=AWT" />
<option value="-Dapplication.deployment=mas" />
<option value="-Dapplication.update=skip" />
<option value="-Dapplication.analytics=false" />
<option value="-Dunixfs=false" />
<option value="-DuseExtendedFileAttributes=true" />
<option value="-DuseCreationDate=false" />
<option value="-Djava.net.useSystemProxies=true" />
<option value="-Dsun.net.client.defaultConnectTimeout=10000" />
<option value="-Dsun.net.client.defaultReadTimeout=60000" />
<option value="-Dfile.encoding=UTF-8" />
<option value="-Djna.nosys=true" />
<option value="-Djna.nounpack=true" />
<option value="-Djna.boot.library.name=jnidispatch" />
<option value="-Djna.boot.library.path=$APP_ROOT/Contents/MacOS" />
<option value="-Djna.library.path=$APP_ROOT/Contents/MacOS" />
<option value="-Djava.library.path=$APP_ROOT/Contents/MacOS" />
<option value="-Dnet.filebot.AcoustID.fpcalc=$APP_ROOT/Contents/MacOS/fpcalc" />
<option value="-Xdock:name=${title}" />
<option value="-Xdock:icon=Contents/Resources/filebot.icns" />
<option value="-Dapple.laf.useScreenMenuBar=true" />
<argument value="--log-file" />
<argument value="filebot.log" />
</bundleapp>
<!-- uses depricated Quicktime API -->
<copy file="/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Info.plist" tofile="${dir.dist}/FileBot.app/Contents/PlugIns/jdk1.8.0_11.jdk/Contents/Info.plist" verbose="true" overwrite="yes" />
<delete file="${dir.dist}/FileBot.app/Contents/PlugIns/jdk1.8.0_11.jdk/Contents/Home/jre/lib/libjfxmedia.dylib" verbose="true" />
<chmod dir="${dir.dist}/FileBot.app/Contents/PlugIns/jdk1.8.0_11.jdk" perm="+w" verbose="true" />
<!-- fix permissions -->
<chmod verbose="true" dir="${dir.dist}" includes="**/fpcalc" perm="755" />
<!-- JRE sign all jars, dylibs and executables -->
<apply executable="codesign">
<arg line="--verbose=4 --force --sign '3rd Party Mac Developer Application: Reinhard Pointner' --entitlements '${dir.installer}/appbundle/inherit.entitlements'" />
<srcfile />
<fileset dir="${dir.dist}/FileBot.app/Contents/PlugIns">
<include name="**/jspawnhelper" />
<include name="**/*.dylib" />
<include name="**/*.jar" />
</fileset>
</apply>
<!-- sign cmdline tool first -->
<exec dir="${dir.dist}/FileBot.app" executable="codesign">
<arg line="--verbose=4 --force --sign '3rd Party Mac Developer Application: Reinhard Pointner' --entitlements '${dir.installer}/appbundle/inherit.entitlements' Contents/MacOS/fpcalc" />
</exec>
<!-- APP sign all jars, dylibs and executables -->
<apply executable="codesign">
<arg line="--verbose=4 --force --sign '3rd Party Mac Developer Application: Reinhard Pointner' --entitlements '${dir.installer}/appbundle/FileBot.entitlements'" />
<srcfile />
<fileset dir="${dir.dist}/FileBot.app/Contents">
<include name="MacOS/*.dylib" />
<include name="Java/*.jar" />
</fileset>
</apply>
<!-- sign app with entitlements -->
<exec dir="${dir.dist}" executable="codesign">
<arg line="--verbose=4 --force --sign '3rd Party Mac Developer Application: Reinhard Pointner' --entitlements '${dir.installer}/appbundle/FileBot.entitlements' FileBot.app/Contents/PlugIns/jdk1.8.0_11.jdk" />
</exec>
<exec dir="${dir.dist}" executable="codesign">
<arg line="--verbose=4 --force --sign '3rd Party Mac Developer Application: Reinhard Pointner' --entitlements '${dir.installer}/appbundle/FileBot.entitlements' FileBot.app" />
</exec>
<!-- verify signature & build pkg -->
<exec dir="${dir.dist}" executable="codesign" failonerror="on">
<arg line="--verify FileBot.app/Contents/PlugIns/jdk1.8.0_11.jdk" />
</exec>
<exec dir="${dir.dist}" executable="codesign" failonerror="on">
<arg line="--verify FileBot.app" />
</exec>
<exec dir="${dir.dist}" executable="productbuild" failonerror="on">
<arg line="--component FileBot.app /Applications --sign '3rd Party Mac Developer Installer: Reinhard Pointner' FileBot_${version}.pkg" />
</exec>
<!-- store this build in releases -->
<mkdir dir="${dir.release}" />
<copy todir="${dir.release}" file="${dir.dist}/FileBot_${version}.pkg" verbose="yes" />
</target>
<target name="ppa-binary" depends="svn-update, fatjar">
<tar destfile="${path.ubuntu-binary.tar.gz}" compression="gzip" longfile="gnu">
<tarfileset fullpath="i686/opt/filebot/FileBot.jar" file="${path.fatjar}" />
<tarfileset fullpath="x86_64/opt/filebot/FileBot.jar" file="${path.fatjar}" />
<tarfileset prefix="i686/opt/filebot" dir="${dir.lib}/native/linux-i686" includes="*.so" />
<tarfileset prefix="x86_64/opt/filebot" dir="${dir.lib}/native/linux-amd64" includes="*.so" />
<tarfileset prefix="i686/opt/filebot/bin" file="${dir.installer}/ubuntu/filebot.sh" filemode="755" />
<tarfileset prefix="x86_64/opt/filebot/bin" file="${dir.installer}/ubuntu/filebot.sh" filemode="755" />
<tarfileset prefix="i686/opt/filebot" dir="${dir.lib}/native/linux-i686" includes="fpcalc" filemode="755" />
<tarfileset prefix="x86_64/opt/filebot" dir="${dir.lib}/native/linux-amd64" includes="fpcalc" filemode="755" />
<tarfileset fullpath="filebot.desktop" file="${dir.installer}/ubuntu/FileBot.desktop" />
<tarfileset fullpath="filebot.svg" file="${dir.installer}/icons/icon.svg" />
<!-- Include Java 8 JRE -->
<tarfileset prefix="i686/opt/filebot/jre" dir="${basedir}/jre/jdk-8u11-linux-i586/jdk1.8.0_11/jre" excludes="bin/**" />
<tarfileset prefix="i686/opt/filebot/jre" dir="${basedir}/jre/jdk-8u11-linux-i586/jdk1.8.0_11/jre" includes="bin/java" filemode="755" />
<tarfileset prefix="x86_64/opt/filebot/jre" dir="${basedir}/jre/jdk-8u11-linux-x64/jdk1.8.0_11/jre" excludes="bin/**" />
<tarfileset prefix="x86_64/opt/filebot/jre" dir="${basedir}/jre/jdk-8u11-linux-x64/jdk1.8.0_11/jre" includes="bin/java" filemode="755" />
</tar>
<!-- store this build in releases -->
<mkdir dir="${dir.release}" />
<copy todir="${dir.release}" file="${path.ubuntu-binary.tar.gz}" verbose="yes" />
</target>
<target name="deb" description="Build debian package for i686 and amd64">
<taskdef resource="ant_deb_task.properties" classpath="${dir.lib}/build/ant-deb.jar" />
<antcall target="deb-arch">
<param name="arch" value="i686" />
</antcall>
<antcall target="deb-arch">
<param name="arch" value="amd64" />
</antcall>
</target>
<target name="deb-arch">
<deb todir="${dir.dist}" package="filebot" version="${version}" architecture="${arch}" section="misc" homepage="http://www.filebot.net" priority="optional" postinst="${dir.installer}/deb/postinst.sh" prerm="${dir.installer}/deb/prerem.sh">
<maintainer name="Reinhard Pointner" email="rednoah@users.sourceforge.net" />
<description synopsis="The ultimate TV and Movie Renamer">FileBot is the ultimate tool for renaming your movies, tv shows or anime and even downloading subtitles. It's smart, streamlined for simplicity and just works. Putting the super-efficient UI aside, it's also got a full-featured command-line interface and scripting engine for all sorts of automation. Anything is possible.</description>
<tarfileset fullpath="usr/share/filebot/FileBot.jar" file="${path.fatjar}" />
<tarfileset prefix="usr/share/filebot" dir="${dir.lib}/native/linux-${arch}" includes="*.so" />
<tarfileset prefix="usr/share/filebot" file="${dir.lib}/native/linux-${arch}/fpcalc" filemode="755" />
<tarfileset prefix="usr/share/filebot" file="${dir.installer}/icons/icon.svg" />
<tarfileset prefix="usr/share/filebot/bin" file="${dir.installer}/deb/filebot.sh" filemode="755" />
<tarfileset prefix="usr/share/applications" file="${dir.installer}/deb/FileBot.desktop" />
</deb>
</target>
<target name="ipkg" description="Build ipkg package for ARM and ATOM">
<taskdef resource="ant_deb_task.properties" classpath="${dir.lib}/build/ant-deb.jar" />
<antcall target="ipkg-arch">
<param name="arch" value="arm" />
</antcall>
<antcall target="ipkg-arch">
<param name="arch" value="i686" />
</antcall>
</target>
<target name="ipkg-arch">
<!-- stage created .deb files in a temporary folder -->
<property name="ipkg.staging" location="${dir.dist}/deb-ipkg" />
<mkdir dir="${ipkg.staging}" />
<deb debfilenameproperty="staging.file.deb" todir="${ipkg.staging}" package="filebot" version="${version}" architecture="${arch}" section="misc" homepage="http://www.filebot.net" priority="optional" postinst="${dir.installer}/ipkg/postinst.sh" prerm="${dir.installer}/ipkg/prerem.sh">
<maintainer name="Reinhard Pointner" email="rednoah@users.sourceforge.net" />
<description synopsis="The ultimate TV and Movie Renamer">FileBot is the ultimate tool for renaming your movies, tv shows or anime and even downloading subtitles. It's smart, streamlined for simplicity and just works. Putting the super-efficient UI aside, it's also got a full-featured command-line interface and scripting engine for all sorts of automation. Anything is possible.</description>
<tarfileset fullpath="opt/share/filebot/FileBot.jar" file="${path.fatjar}" />
<tarfileset prefix="opt/share/filebot" dir="${dir.lib}/native/linux-${arch}" includes="*.so" />
<tarfileset prefix="opt/share/filebot" file="${dir.lib}/native/linux-${arch}/fpcalc" filemode="755" />
<tarfileset prefix="opt/share/filebot/bin" file="${dir.installer}/ipkg/filebot.sh" filemode="755" />
</deb>
<move tofile="${dir.dist}/filebot_${version}_${arch}.ipk" file="${staging.file.deb}" overwrite="no" failonerror="yes" />
<delete dir="${ipkg.staging}" />
</target>
<target name="msi" description="Build Windows Installer for x86 and x64">
<antcall target="msi-arch">
<param name="arch" value="x86" />
<param name="libgcc_name" value="mingwm10.dll" />
</antcall>
<antcall target="msi-arch">
<param name="arch" value="x64" />
<param name="libgcc_name" value="libgcc_s_sjlj-1.dll" />
</antcall>
</target>
<target name="msi-arch">
<property name="jnidispatch" location="${dir.lib}/native/win32-${arch}/jnidispatch.dll" />
<property name="mediainfo" location="${dir.lib}/native/win32-${arch}/MediaInfo.dll" />
<property name="lib7z_binding" location="${dir.lib}/native/win32-${arch}/7-Zip-JBinding.dll" />
<property name="libgcc_path" location="${dir.lib}/native/win32-${arch}/${libgcc_name}" />
<property name="fpcalc_path" location="${dir.lib}/native/win32-${arch}/fpcalc.exe" />
<property name="installer" location="${dir.dist}/FileBot_${version}_${arch}.msi" />
<exec executable="candle.exe" dir="${dir.installer}/msi" failonerror="true">
<arg line="filebot-wix.xml -out ${dir.dist}/msi.wixobj -darch=${arch} -dreleaseversion=${version} -dfatjar=${path.fatjar} -djnidispatch=${jnidispatch} -dmediainfo=${mediainfo} -dlib7z_binding=${lib7z_binding} -dlibgcc_name=${libgcc_name} -dlibgcc_path=${libgcc_path} -dfpcalc_path=${fpcalc_path}" />
</exec>
<exec executable="light.exe" dir="${dir.installer}/msi" failonerror="true">
<arg line="${dir.dist}/msi.wixobj -sval -ext WixUIExtension -out ${installer}" />
</exec>
</target>
<target name="portable" description="Portable application package">
<mkdir dir="${dir.dist}/portable" />
<copy file="${path.fatjar}" tofile="${dir.dist}/portable/FileBot.jar" />
<copy todir="${dir.dist}/portable">
<fileset dir="${dir.installer}/portable" includes="*.exe, *.ini, *.cmd, *.sh" />
</copy>
<zip destfile="${dir.dist}/FileBot_${version}-portable.zip">
<zipfileset dir="${dir.dist}/portable" includes="*.jar, *.exe, *.ini, *.cmd" />
<zipfileset dir="${dir.dist}/portable" includes="*.sh" filemode="755" />
</zip>
</target>
<target name="spk" description="Synology NAS package">
<taskdef name="spk" classname="net.filebot.ant.spk.SpkTask" classpath="${dir.lib}/build/ant-spk.jar" />
<spk destdir="${dir.dist}" name="filebot" version="${version}" arch="noarch">
<info name="displayname" value="FileBot" />
<info name="description" value="FileBot is the ultimate tool for organizing and renaming your movies, TV shows or anime, as well as downloading subtitles and artwork. It's smart and just works." />
<info name="maintainer" value="rednoah" />
<info name="distributor" value="FileBot" />
<info name="distributor_url" value="http://www.filebot.net/" />
<info name="support_url" value="http://www.filebot.net/forums/" />
<info name="firmware" value="5.0" />
<info name="startable" value="no" />
<info name="helpurl" value="http://www.filebot.net/cli.html" />
<icon size="72" file="${dir.installer}/icons/icon72.png" />
<icon size="120" file="${dir.installer}/icons/icon120.png" />
<package dir="${dir.installer}/spk/package" includes="*.sh" filemode="755" />
<package file="${path.fatjar}" fullpath="FileBot.jar" />
<scripts dir="${dir.installer}/spk/scripts" filemode="755" />
</spk>
</target>
<target name="webstart" depends="jar" description="Build and compress jars used for webstart deployment">
<!-- create dirs -->
<mkdir dir="${dir.dist}/webstart" />
<!-- copy jnlp descriptors and icons -->
<copy todir="${dir.dist}/webstart">
<fileset dir="${dir.installer}/webstart" />
<fileset dir="${dir.installer}/icons" />
</copy>
<!-- copy jars -->
<copy todir="${dir.dist}/webstart">
<fileset dir="${dir.lib}" includes="*.jar" excludes="jna.jar" />
</copy>
<!-- copy jna.jar without native libs -->
<jar destfile="${dir.dist}/webstart/jna.jar">
<zipfileset src="${dir.lib}/jna.jar" includes="**/*.class" />
</jar>
<!-- create mediainfo jar as seperate jar and use as trigger for lazy loading the native libs -->
<jar destfile="${dir.dist}/webstart/mediainfo.jar">
<fileset dir="${dir.build}" includes="net/filebot/mediainfo/**" />
</jar>
<!-- create indexed main jar -->
<jar destfile="${dir.dist}/webstart/filebot.jar" index="yes">
<fileset dir="${dir.build}" excludes="**/*Test*, net/filebot/mediainfo/**" />
<indexjars>
<!-- IMPORTANT if groovy is indexed things break during runtime!! -->
<fileset dir="${dir.dist}/webstart" includes="**/*.jar" excludes="filebot.jar, groovy.jar" />
</indexjars>
</jar>
<!-- create native lib jars -->
<antcall target="webstart-nativelib">
<param name="arch" value="win32-x86" />
</antcall>
<antcall target="webstart-nativelib">
<param name="arch" value="win32-x64" />
</antcall>
<antcall target="webstart-nativelib">
<param name="arch" value="linux-i686" />
</antcall>
<antcall target="webstart-nativelib">
<param name="arch" value="linux-amd64" />
</antcall>
<antcall target="webstart-nativelib">
<param name="arch" value="mac-x86_64" />
</antcall>
<!-- sign all jars -->
<apply executable="pack200">
<!-- workaround for bug 6575373, see http://bugs.sun.com/view_bug.do?bug_id=6575373 -->
<arg line="--segment-limit=-1" />
<arg line="--repack" />
<srcfile />
<fileset dir="${dir.dist}/webstart" includes="**/*.jar" />
</apply>
<signjar alias="filebot" keystore="filebot.keystore" storepass="secret">
<fileset id="signjar" dir="${dir.dist}/webstart" includes="**/*.jar" />
</signjar>
<!-- pack200 all jars -->
<apply executable="pack200" dest="${dir.dist}/webstart">
<!-- workaround for bug 6575373, see http://bugs.sun.com/view_bug.do?bug_id=6575373 -->
<arg line="--segment-limit=-1" />
<targetfile />
<srcfile />
<fileset dir="${dir.dist}/webstart" includes="*.jar" />
<mapper type="glob" from="*.jar" to="*.jar.pack.gz" />
</apply>
</target>
<target name="webstart-nativelib">
<!-- create temp dir -->
<mkdir dir="${dir.dist}/webstart/native/${arch}" />
<!-- copy native libs to temp dir -->
<copy todir="${dir.dist}/webstart/native/${arch}" flatten="true">
<zipfileset src="${dir.lib}/jna.jar" includes="com/sun/jna/${arch}/*" />
<fileset dir="${dir.lib}/native">
<include name="${arch}/**.dll" />
<include name="${arch}/**.dylib" />
<include name="${arch}/**.so" />
</fileset>
</copy>
<!-- create native lib jar -->
<jar destfile="${dir.dist}/webstart/native/${arch}.jar" basedir="${dir.dist}/webstart/native/${arch}" />
<!-- delete temp dir -->
<delete dir="${dir.dist}/webstart/native/${arch}" />
</target>
<target name="genkey">
<genkey alias="filebot" keystore="filebot.keystore" storepass="secret" validity="3650" dname="CN=${user.name}" />
</target>
<target name="build">
<!-- create build dir -->
<mkdir dir="${dir.build}" />
<!-- compile -->
<javac srcdir="${dir.source}:${dir.test}" destdir="${dir.build}" target="1.8" source="1.8" encoding="utf-8" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
<classpath>
<fileset dir="${dir.lib}" includes="*.jar" />
<pathelement location="${dir.lib}/build/junit.jar" />
</classpath>
</javac>
<!-- copy resources -->
<copy todir="${dir.build}">
<fileset dir="${dir.source}">
<exclude name="**/*.java" />
</fileset>
</copy>
<!-- update application properties -->
<replace dir="${dir.build}" encoding="utf-8" summary="yes">
<include name="**/*.properties" />
<replacefilter token="@{svn.revision}" value="${svn.revision}" />
<replacefilter token="@{version}" value="${version}" />
</replace>
</target>
<target name="clean">
<delete dir="${dir.dist}" />
<delete dir="${dir.build}" />
</target>
<target name="test" depends="jar">
<junit printsummary="yes" fork="true">
<classpath>
<fileset dir="${dir.dist}" includes="*.jar" />
<fileset dir="${dir.lib}" includes="*.jar" />
<pathelement location="${dir.lib}/build/junit.jar" />
</classpath>
<formatter type="plain" />
<test name="net.filebot.AllTests" outfile="test-report" />
</junit>
</target>
<target name="test-fatjar" depends="fatjar">
<junit printsummary="yes" fork="true">
<classpath>
<pathelement location="${path.fatjar}" />
<pathelement location="${dir.dist}/filebot-test.jar" />
<pathelement location="${dir.lib}/build/junit.jar" />
</classpath>
<formatter type="plain" />
<test name="net.filebot.AllTests" outfile="test-report" />
</junit>
</target>
<target name="svn-update">
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${dir.lib}/groovy.jar" />
<groovy outputproperty="svn.revision" fork="yes" failonerror="yes">
print 'svn update'.execute().text.split(/\D+/).last().toInteger()
</groovy>
<echo>Revision: ${svn.revision}</echo>
</target>
<target name="stage-release" depends="svn-update, fatjar, portable, spk, ipkg, deb, msi, appbundle">
<delete dir="${dir.release}" />
<mkdir dir="${dir.release}" />
<!-- prepare release packages -->
<copy todir="${dir.release}" preservelastmodified="yes" verbose="yes">
<path path="${path.fatjar}" />
<fileset dir="${dir.dist}">
<include name="*.tar.gz" />
<include name="*.deb" />
<include name="*.ipk" />
<include name="*.msi" />
<include name="*.spk" />
<include name="*-portable.zip" />
</fileset>
</copy>
</target>
<target name="deploy-release" depends="stage-release, login" description="Upload to SourceForge.net FRS">
<scp todir="${sf.user}:${sf.password}@${frs.release}" trust="yes" verbose="true" sftp="true">
<!-- upload starting with parent folders so scp will create the release folder for us -->
<fileset dir="${basedir.release}">
<date datetime="${today}" pattern="yyyy-MM-dd" when="after" />
</fileset>
</scp>
</target>
<target name="deploy-website" depends="login">
<!-- prepare website resources -->
<copy todir="${dir.dist}/website">
<fileset dir="${dir.website}">
<include name="*.json" />
<include name="*.xml" />
<include name="*.php" />
<include name="*.html" />
<include name="*.css" />
<include name="*.js" />
<include name="*.png" />
<include name="*.ico" />
<include name=".htaccess" />
<include name="syno/**" />
<!-- <include name="images/**" /> -->
<!-- <include name="screenshots/**" /> -->
</fileset>
</copy>
<!-- get MD5 sum for Synology Package -->
<checksum file="${dir.release}/filebot-${version}-noarch.spk" algorithm="MD5" property="spk.md5" />
<!-- replace variables for new release -->
<replace dir="${dir.dist}/website" encoding="utf-8" summary="yes">
<include name="**/*.html" />
<include name="**/*.php" />
<include name="**/*.json" />
<replacefilter token="@{version}" value="${version}" />
<replacefilter token="@{spk.md5}" value="${spk.md5}" />
</replace>
<!-- upload -->
<scp todir="${sf.user}:${sf.password}@${frs.website}" trust="yes" verbose="true" sftp="true">
<fileset dir="${dir.dist}/website" />
</scp>
</target>
<target name="chocolatey-push" description="chocolatey package">
<copy todir="${dir.dist}/chocolatey">
<fileset dir="${dir.installer}/chocolatey" />
</copy>
<!-- replace variables for new release -->
<replace dir="${dir.dist}/chocolatey" encoding="utf-8" summary="yes">
<include name="**/*.ps1" />
<include name="**/*.nuspec" />
<replacefilter token="@{version}" value="${version}" />
</replace>
<!-- chocolatey pack -->
<exec executable="C:\Chocolatey\bin\chocolatey.bat" dir="${dir.dist}\chocolatey" failonerror="true">
<arg line="pack" />
</exec>
<exec executable="C:\Chocolatey\bin\chocolatey.bat" dir="${dir.dist}\chocolatey" failonerror="true">
<arg line="push ${dir.dist}\chocolatey\filebot.${version}.nupkg" />
</exec>
</target>
<target name="upload-data" depends="login">
<scp todir="${sf.user}:${sf.password}@${frs.website}" trust="yes" verbose="true" sftp="true">
<fileset dir="${dir.website}">
<include name="data/.htaccess" />
<include name="data/*.txt" />
<include name="data/*.xz" />
</fileset>
</scp>
</target>
<target name="deploy-beta-jar" depends="svn-update, fatjar, login" description="Build and deploy fatjar for the latest revision">
<!-- deploy fatjar -->
<input message="Mark:" addproperty="mark" />
<scp file="${path.fatjar}" remoteTofile="${sf.user}:${sf.password}@${frs.release}/HEAD/filebot-${version}-r${svn.revision}-${mark}.jar" trust="yes" verbose="true" sftp="true" />
<scp file="${path.fatjar}" remoteTofile="${sf.user}:${sf.password}@${frs.release}/HEAD/FileBot.jar" trust="yes" verbose="true" sftp="true" />
</target>
<target name="deploy-beta-release">
<input message="Mark:" addproperty="mark" />
<antcall target="deploy-release">
<param name="dir.release" location="${basedir.release}/HEAD/${title}_${version}_${mark}" />
</antcall>
</target>
<target name="login">
<!-- ask for sourceforge password -->
<input message="Please enter sourceforge username:" addproperty="sf.user" />
<input message="Please enter sourceforge password:" addproperty="sf.password" />
</target>
</project>