mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 08:48:51 -05:00
920 lines
36 KiB
XML
920 lines
36 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||
<project name="filebot" default="fatjar" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:cmp="antlib:org.apache.ant.compress">
|
||
|
||
<!-- define source dirs -->
|
||
<property name="dir.source" location="${basedir}/source" />
|
||
<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" />
|
||
|
||
<!-- import property files -->
|
||
<property file="${basedir}/profile.properties" />
|
||
<property file="${dir.installer}/ant/ant.properties" />
|
||
<property file="${dir.source}/net/filebot/Settings.properties" />
|
||
|
||
<property name="release" value="${application.name}_${application.version}" />
|
||
<property name="version" value="${application.version}" />
|
||
|
||
<!-- define output paths -->
|
||
<property name="dir.cache" location="${basedir}/cache/${release}" />
|
||
<property name="dir.release" location="${basedir}/release/${release}" />
|
||
<property name="path.fatjar" location="${dir.dist}/${release}.jar" />
|
||
|
||
|
||
<!-- timestamp variables -->
|
||
<tstamp prefix="tstamp">
|
||
<format property="date" pattern="yyyy-MM-dd" />
|
||
<format property="year" pattern="yyyy" />
|
||
</tstamp>
|
||
|
||
|
||
<!-- copy and replace ant variables macro -->
|
||
<macrodef name="copy-replace">
|
||
<attribute name="todir" />
|
||
<element name="filesets" implicit="yes" />
|
||
<sequential>
|
||
<copy todir="@{todir}" encoding="utf-8" overwrite="yes" verbose="yes">
|
||
<filesets />
|
||
<filterset begintoken="@{" endtoken="}">
|
||
<propertyset>
|
||
<propertyref builtin="all" />
|
||
</propertyset>
|
||
</filterset>
|
||
</copy>
|
||
</sequential>
|
||
</macrodef>
|
||
|
||
|
||
<target name="resolve" description="Retrieve dependencies with Apache Ivy">
|
||
<delete dir="${dir.lib}/ivy" />
|
||
<ivy:retrieve pattern="${dir.lib}/ivy/[type]/[artifact].[ext]" />
|
||
|
||
<antcall target="resolve-import-native">
|
||
<param name="arch" value="mac-x86_64" />
|
||
<param name="arch.jna" value="darwin" />
|
||
<param name="arch.7zj" value="Mac-x86_64" />
|
||
</antcall>
|
||
<antcall target="resolve-import-native">
|
||
<param name="arch" value="win32-x64" />
|
||
<param name="arch.jna" value="win32-x86-64" />
|
||
<param name="arch.7zj" value="Windows-amd64" />
|
||
</antcall>
|
||
<antcall target="resolve-import-native">
|
||
<param name="arch" value="win32-x86" />
|
||
<param name="arch.jna" value="win32-x86/" />
|
||
<param name="arch.7zj" value="Windows-x86" />
|
||
</antcall>
|
||
<antcall target="resolve-import-native">
|
||
<param name="arch" value="linux-amd64" />
|
||
<param name="arch.jna" value="linux-x86-64" />
|
||
<param name="arch.7zj" value="Linux-amd64" />
|
||
</antcall>
|
||
<antcall target="resolve-import-native">
|
||
<param name="arch" value="linux-i686" />
|
||
<param name="arch.jna" value="linux-x86" />
|
||
<param name="arch.7zj" value="Linux-i386" />
|
||
</antcall>
|
||
<antcall target="resolve-import-native">
|
||
<param name="arch" value="linux-arm" />
|
||
<param name="arch.jna" value="linux-arm" />
|
||
<param name="arch.7zj" value="Linux-arm" />
|
||
</antcall>
|
||
</target>
|
||
|
||
|
||
<target name="resolve-import-native">
|
||
<unzip src="${dir.lib}/ivy/jar/jna.jar" dest="${dir.lib}/native/${arch}" overwrite="yes">
|
||
<patternset>
|
||
<include name="**/${arch.jna}/*.dll" />
|
||
<include name="**/${arch.jna}/*.so" />
|
||
<include name="**/${arch.jna}/*.jnilib" />
|
||
</patternset>
|
||
<chainedmapper>
|
||
<flattenmapper />
|
||
<compositemapper>
|
||
<globmapper from="*.jnilib" to="*.dylib" />
|
||
<identitymapper />
|
||
</compositemapper>
|
||
</chainedmapper>
|
||
</unzip>
|
||
<unzip src="${dir.lib}/ivy/jar/sevenzipjbinding-all-platforms.jar" dest="${dir.lib}/native/${arch}" overwrite="yes">
|
||
<patternset>
|
||
<include name="**/${arch.7zj}/*.dll" />
|
||
<include name="**/${arch.7zj}/*.so" />
|
||
<include name="**/${arch.7zj}/*.dylib" />
|
||
</patternset>
|
||
<chainedmapper>
|
||
<flattenmapper />
|
||
<compositemapper>
|
||
<globmapper from="lib*.dll" to="*.dll" />
|
||
<identitymapper />
|
||
</compositemapper>
|
||
</chainedmapper>
|
||
</unzip>
|
||
</target>
|
||
|
||
|
||
<target name="jar" depends="build">
|
||
<!-- main jar -->
|
||
<jar destfile="${dir.dist}/filebot.jar">
|
||
<fileset dir="${dir.build}" />
|
||
<manifest>
|
||
<attribute name="Build-Date" value="${tstamp.date}" />
|
||
<attribute name="Build-Revision" value="${revision}" />
|
||
<attribute name="Main-Class" value="${main.class}" />
|
||
</manifest>
|
||
</jar>
|
||
</target>
|
||
|
||
|
||
<target name="fatjar" depends="jar" description="Build executable jar">
|
||
<jar destfile="${path.fatjar}" filesetmanifest="merge" duplicate="fail" index="yes" compress="no">
|
||
<!-- include main jar -->
|
||
<zipfileset src="${dir.dist}/filebot.jar" />
|
||
|
||
<!-- include libs -->
|
||
<zipfileset src="${dir.lib}/ivy/bundle/json-io.jar">
|
||
<include name="com/cedarsoftware/util/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/glazedlists_java15.jar">
|
||
<include name="ca/odell/glazedlists/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/miglayout-core.jar">
|
||
<include name="net/miginfocom/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/miglayout-swing.jar">
|
||
<include name="net/miginfocom/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/rsyntaxtextarea.jar">
|
||
<include name="org/fife/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/jars/simmetrics.jar">
|
||
<include name="uk/ac/shef/wit/simmetrics/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/jars/xmlrpc.jar">
|
||
<include name="redstone/xmlrpc/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/bundle/args4j.jar">
|
||
<include name="org/kohsuke/args4j/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/xz.jar">
|
||
<include name="org/tukaani/xz/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/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}/ivy/jar/slf4j-api.jar">
|
||
<include name="org/slf4j/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/slf4j-jdk14.jar">
|
||
<include name="org/slf4j/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/commons-io.jar">
|
||
<include name="org/apache/commons/io/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/icu4j.jar">
|
||
<include name="com/ibm/icu/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/jars/jacksum.jar">
|
||
<include name="jonelo/jacksum/adapt/**" />
|
||
<include name="jonelo/jacksum/algorithm/**" />
|
||
<include name="jonelo/sugar/util/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/groovy-all.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}/ivy/jar/sevenzipjbinding.jar">
|
||
<include name="net/sf/sevenzipjbinding/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/jars/ObjCBridge.jar">
|
||
<include name="ca/weblite/**" />
|
||
<include name="com/sun/jna/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/commons-vfs2.jar">
|
||
<include name="org/apache/commons/vfs2/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/commons-logging.jar">
|
||
<include name="org/apache/commons/logging/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/junrar.jar">
|
||
<include name="com/github/junrar/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/language-detector.jar">
|
||
<include name="be/frma/langguess/**" />
|
||
<include name="com/cybozu/labs/langdetect/**" />
|
||
<include name="com/optimaize/langdetect/**" />
|
||
<include name="languages/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/bundle/guava.jar">
|
||
<include name="com/google/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/streamex.jar">
|
||
<include name="one/util/streamex/**" />
|
||
</zipfileset>
|
||
|
||
<zipfileset src="${dir.lib}/ivy/jar/controlsfx.jar">
|
||
<include name="org/controlsfx/dialog/**" />
|
||
<include name="impl/org/controlsfx/i18n/**" />
|
||
<include name="controlsfx.properties" />
|
||
</zipfileset>
|
||
|
||
<!-- include classes and native libraries -->
|
||
<zipfileset src="${dir.lib}/ivy/jar/jna.jar">
|
||
<include name="com/sun/jna/**" />
|
||
</zipfileset>
|
||
<zipfileset src="${dir.lib}/ivy/jar/jna-platform.jar">
|
||
<include name="com/sun/jna/platform/**" />
|
||
</zipfileset>
|
||
|
||
<!-- libraries used in external scripts -->
|
||
<zipfileset src="${dir.lib}/ivy/jar/jsoup.jar">
|
||
<include name="org/jsoup/**" />
|
||
</zipfileset>
|
||
|
||
<!-- Ivy for @Grapes automatic dependency management -->
|
||
<zipfileset src="${dir.lib}/ivy/jar/ivy.jar">
|
||
<include name="org/apache/ivy/**" />
|
||
</zipfileset>
|
||
|
||
<!-- AntBuilder including dependencies for ant-javamail, ant-commons-net and ant-jsch -->
|
||
<zipfileset src="${dir.lib}/ivy/jar/ant.jar">
|
||
<include name="org/apache/tools/**" />
|
||
</zipfileset>
|
||
<zipfileset src="${dir.lib}/ivy/jar/ant-launcher.jar">
|
||
<include name="org/apache/tools/**" />
|
||
</zipfileset>
|
||
<zipfileset src="${dir.lib}/ivy/jar/ant-commons-net.jar">
|
||
<include name="org/apache/tools/**" />
|
||
</zipfileset>
|
||
<zipfileset src="${dir.lib}/ivy/jar/ant-jsch.jar">
|
||
<include name="org/apache/tools/**" />
|
||
</zipfileset>
|
||
<zipfileset src="${dir.lib}/ivy/jar/ant-javamail.jar">
|
||
<include name="org/apache/tools/**" />
|
||
</zipfileset>
|
||
<zipfileset src="${dir.lib}/ivy/jar/commons-net.jar">
|
||
<include name="org/apache/commons/net/**" />
|
||
</zipfileset>
|
||
<zipfileset src="${dir.lib}/ivy/jar/jsch.jar">
|
||
<include name="com/jcraft/jsch/**" />
|
||
</zipfileset>
|
||
<zipfileset src="${dir.lib}/ivy/jar/mail.jar">
|
||
<include name="javax/mail/**" />
|
||
<include name="com/sun/mail/**" />
|
||
<include name="META-INF/*mail*" />
|
||
</zipfileset>
|
||
</jar>
|
||
</target>
|
||
|
||
|
||
<target name="appbundle" description="Build Mac application bundle" depends="revision">
|
||
<bundleapp outputdirectory="${dir.dist}" executablename="purchase.sh" hidedockicon="true" minimumsystemversion="${mac.version}" jvmrequired="${jvm.version}" name="${application.name}" displayname="${application.name} ${version}" version="${revision}" shortversion="${version}" identifier="net.filebot.Main" mainclassname="${main.class}" icon="${dir.installer}/appbundle/filebot.icns" copyright="${tstamp.year} ${package.developer}" applicationcategory="${mac.application.category}" highresolutioncapable="true" supportsautomaticgraphicsswitching="true" debug="true">
|
||
<classpath file="${path.fatjar}" />
|
||
<librarypath dir="${dir.lib}/native/mac-x86_64" />
|
||
<librarypath dir="${dir.installer}/appbundle/MacOS" />
|
||
|
||
<arch name="x86_64" />
|
||
|
||
<option value="-Dnet.filebot.UserFiles.fileChooser=COCOA" />
|
||
<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="-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=${application.name}" />
|
||
<option value="-Xdock:icon=Contents/Resources/filebot.icns" />
|
||
<option value="-Dapple.laf.useScreenMenuBar=true" />
|
||
|
||
<bundledocument role="viewer" handlerRank="none" contentTypes="public.movie" name="Video file" />
|
||
<bundledocument role="viewer" handlerRank="none" contentTypes="public.audio" name="Audio file" />
|
||
<bundledocument role="viewer" handlerRank="none" contentTypes="public.folder" name="Media folder" />
|
||
</bundleapp>
|
||
|
||
<!-- application bundle folder as .tar -->
|
||
<cmp:xz destfile="${dir.dist}/${release}-darwin.tar.xz">
|
||
<cmp:tar format="gnu" encoding="utf-8">
|
||
<cmp:tarfileset dir="${dir.dist}" includes="${application.name}.app/**" excludes="**/MacOS/**" />
|
||
<cmp:tarfileset dir="${dir.dist}" includes="${application.name}.app/**/**.dylib" />
|
||
|
||
<cmp:tarfileset dir="${dir.dist}" includes="${application.name}.app/**/fpcalc" filemode="755" />
|
||
<cmp:tarfileset dir="${dir.dist}" includes="${application.name}.app/**/**.sh" filemode="755" />
|
||
</cmp:tar>
|
||
</cmp:xz>
|
||
</target>
|
||
|
||
|
||
<target name="appbundle-maspkg-core">
|
||
<antcall target="appbundle-maspkg">
|
||
<param name="application.name" value="FileBot" />
|
||
<param name="application.executable" value="filebot.launcher" />
|
||
<param name="application.identifier" value="net.filebot.FileBot" />
|
||
<param name="application.icon" value="${dir.installer}/appbundle/filebot.icns" />
|
||
<param name="application.cert.appbundle" value="3rd Party Mac Developer Application: ${package.company}" />
|
||
<param name="application.cert.installer" value="3rd Party Mac Developer Installer: ${package.company}" />
|
||
|
||
<!-- MAS does not allow subtitle apps -->
|
||
<param name="application.mode" value="Rename|Episodes|SFV|Filter|List" />
|
||
|
||
<!-- libjfxwebkit.dylib cannot be deployed on the MAS due to deprecated dependencies -->
|
||
<param name="application.help" value="ask" />
|
||
</antcall>
|
||
</target>
|
||
|
||
|
||
<target name="appbundle-maspkg-subtitles">
|
||
<antcall target="appbundle-maspkg">
|
||
<param name="application.name" value="FileBot Subtitles" />
|
||
<param name="application.executable" value="filebot.subtitles.launcher" />
|
||
<param name="application.identifier" value="net.filebot.FileBot.Subtitles" />
|
||
<param name="application.icon" value="${dir.installer}/appbundle/subtitles.icns" />
|
||
<param name="application.cert.appbundle" value="Developer ID Application: ${package.company}" />
|
||
<param name="application.cert.installer" value="Developer ID Installer: ${package.company}" />
|
||
<param name="application.mode" value="Subtitles" />
|
||
<param name="application.help" value="skip" />
|
||
</antcall>
|
||
</target>
|
||
|
||
|
||
<target name="appbundle-maspkg" depends="revision">
|
||
<property name="path.app" value="${application.name}.app" />
|
||
<property name="path.pkg" value="${application.identifier}_${version}_r${revision}.pkg" />
|
||
|
||
<property name="jre.version" value="jdk1.${jre.major}.0_${jre.build}.jdk" />
|
||
<property name="jre.path" value="/Library/Java/JavaVirtualMachines/${jre.version}/Contents/Home" />
|
||
|
||
<bundleapp jvmrequired="${jvm.version}" minimumsystemversion="${mac.version}" outputdirectory="${dir.dist}" executablename="${application.executable}" name="${application.name}" displayname="${application.name}" version="${revision}" shortversion="${version}" identifier="${application.identifier}" mainclassname="${main.class}" icon="${application.icon}" copyright="${tstamp.year} ${package.company}" applicationcategory="${mac.application.category}" highresolutioncapable="true" supportsautomaticgraphicsswitching="true" debug="true">
|
||
<classpath file="${path.fatjar}" />
|
||
<librarypath dir="${dir.lib}/native/mac-x86_64" />
|
||
<librarypath dir="${dir.installer}/appbundle/MacOS" excludes="purchase.sh" />
|
||
|
||
<arch name="x86_64" />
|
||
<runtime dir="${jre.path}" />
|
||
|
||
<argument value="--mode" />
|
||
<argument value="${application.mode}" />
|
||
|
||
<!-- 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=COCOA" />
|
||
<option value="-Dapplication.name=${application.name}" />
|
||
<option value="-Dapplication.help=${application.help}" />
|
||
<option value="-Dapplication.deployment=mas" />
|
||
<option value="-Dapplication.update=skip" />
|
||
<option value="-Dunixfs=false" />
|
||
<option value="-DuseExtendedFileAttributes=true" />
|
||
<option value="-DuseCreationDate=false" />
|
||
|
||
<option value="-Djava.net.useSystemProxies=true" />
|
||
<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="-Dapple.laf.useScreenMenuBar=true" />
|
||
|
||
<bundledocument role="viewer" handlerRank="none" contentTypes="public.movie" name="Video file" />
|
||
<bundledocument role="viewer" handlerRank="none" contentTypes="public.audio" name="Audio file" />
|
||
<bundledocument role="viewer" handlerRank="none" contentTypes="public.folder" name="Media folder" />
|
||
</bundleapp>
|
||
|
||
<!-- fix code signing and submission issues -->
|
||
<delete verbose="yes" includeEmptyDirs="yes">
|
||
<fileset dir="${dir.dist}/${path.app}/Contents/PlugIns">
|
||
<include name="**/libjfxmedia_qtkit.dylib" />
|
||
<include name="**/libjfxwebkit.dylib" />
|
||
<include name="**/Contents/Info.plist" />
|
||
<include name="**/Contents/MacOS/libjli.dylib" />
|
||
</fileset>
|
||
<fileset dir="${dir.dist}/${path.app}/Contents/Resources">
|
||
<exclude name="en.lproj/**" />
|
||
<exclude name="*.icns" />
|
||
</fileset>
|
||
</delete>
|
||
<copy verbose="yes" failonerror="yes" overwrite="yes" file="/Library/Java/JavaVirtualMachines/${jre.version}/Contents/Info.plist" tofile="${dir.dist}/${path.app}/Contents/PlugIns/${jre.version}/Contents/Info.plist" />
|
||
<copy verbose="yes" failonerror="yes" overwrite="yes" file="/Library/Java/JavaVirtualMachines/${jre.version}/Contents/MacOS/libjli.dylib" tofile="${dir.dist}/${path.app}/Contents/PlugIns/${jre.version}/Contents/MacOS/libjli.dylib" />
|
||
|
||
<!-- fix permissions -->
|
||
<chmod verbose="yes" dir="${dir.dist}" includes="**/fpcalc" perm="+x" />
|
||
<chmod verbose="yes" dir="${dir.dist}" includes="**/*.sh" perm="+x" />
|
||
<chmod verbose="yes" dir="${dir.dist}/${path.app}/Contents/PlugIns" perm="+rw" />
|
||
|
||
<!-- JRE sign all jars, dylibs and executables -->
|
||
<property name="codesign.opts" value="--verbose=4 --force --sign '${application.cert.appbundle}'" />
|
||
<property name="codesign.entitlements" value="--entitlements '${dir.installer}/appbundle/FileBot.entitlements'" />
|
||
<property name="codesign.entitlements.inherit" value="--entitlements '${dir.installer}/appbundle/inherit.entitlements'" />
|
||
|
||
<apply executable="codesign">
|
||
<arg line="${codesign.opts} ${codesign.entitlements.inherit}" />
|
||
<srcfile />
|
||
<fileset dir="${dir.dist}/${path.app}/Contents/PlugIns">
|
||
<include name="**/jspawnhelper" />
|
||
<include name="**/*.dylib" />
|
||
<include name="**/*.jar" />
|
||
</fileset>
|
||
</apply>
|
||
|
||
<!-- sign cmdline tool first -->
|
||
<exec dir="${dir.dist}/${path.app}" executable="codesign">
|
||
<arg line="${codesign.opts} ${codesign.entitlements.inherit} Contents/MacOS/fpcalc" />
|
||
</exec>
|
||
|
||
<!-- APP sign all jars, dylibs and executables -->
|
||
<apply executable="codesign">
|
||
<arg line="${codesign.opts} ${codesign.entitlements}" />
|
||
<srcfile />
|
||
<fileset dir="${dir.dist}/${path.app}/Contents">
|
||
<include name="MacOS/*.dylib" />
|
||
<include name="MacOS/*.sh" />
|
||
<include name="Java/*.jar" />
|
||
</fileset>
|
||
</apply>
|
||
|
||
<!-- sign app with entitlements -->
|
||
<exec dir="${dir.dist}" executable="codesign">
|
||
<arg line="${codesign.opts} ${codesign.entitlements} '${path.app}/Contents/PlugIns/${jre.version}'" />
|
||
</exec>
|
||
<exec dir="${dir.dist}" executable="codesign">
|
||
<arg line="${codesign.opts} ${codesign.entitlements} '${path.app}'" />
|
||
</exec>
|
||
|
||
<!-- verify signature & build pkg -->
|
||
<exec dir="${dir.dist}" executable="codesign" failonerror="on">
|
||
<arg line="--verify '${path.app}/Contents/PlugIns/${jre.version}'" />
|
||
</exec>
|
||
<exec dir="${dir.dist}" executable="codesign" failonerror="on">
|
||
<arg line="--verify '${path.app}'" />
|
||
</exec>
|
||
<exec dir="${dir.dist}" executable="productbuild" failonerror="on">
|
||
<arg line="--component '${path.app}' /Applications --sign '${application.cert.installer}' '${path.pkg}'" />
|
||
</exec>
|
||
|
||
<!-- store as release build-->
|
||
<copy todir="${dir.release}" file="${dir.dist}/${path.pkg}" verbose="yes" />
|
||
</target>
|
||
|
||
|
||
<target name="snap" depends="revision">
|
||
<copy tofile="${dir.dist}/snappy/filebot/FileBot.jar" file="${path.fatjar}" />
|
||
<copy todir="${dir.dist}/snappy/filebot/lib/amd64">
|
||
<fileset dir="${dir.lib}/native/linux-amd64" excludes="fpcalc, libmediainfo.so, libzen.so" />
|
||
</copy>
|
||
|
||
<!-- copy files and resolve ant variables -->
|
||
<copy-replace todir="${dir.dist}/snappy">
|
||
<fileset dir="${dir.installer}/snappy" />
|
||
</copy-replace>
|
||
<chmod perm="+x" file="${dir.dist}/snappy/filebot/filebot.sh" verbose="yes" />
|
||
|
||
<exec executable="snapcraft" dir="${dir.dist}/snappy" failonerror="yes">
|
||
<arg line="snap" />
|
||
</exec>
|
||
</target>
|
||
|
||
|
||
<target name="deb" description="Build Debian Linux packages" depends="revision">
|
||
<!-- arch i686 not allowed by deb specification, must be i386 for 32-bit x86 systems -->
|
||
<antcall target="deb-arch">
|
||
<param name="arch" value="i686" />
|
||
<param name="deb.arch" value="i386" />
|
||
<param name="deb.pkg" value="deb" />
|
||
<param name="deb.prefix" value="/usr" />
|
||
</antcall>
|
||
<antcall target="deb-arch">
|
||
<param name="arch" value="amd64" />
|
||
<param name="deb.arch" value="amd64" />
|
||
<param name="deb.pkg" value="deb" />
|
||
<param name="deb.prefix" value="/usr" />
|
||
</antcall>
|
||
</target>
|
||
|
||
|
||
<target name="ipkg" description="Build embedded Linux packages" depends="revision">
|
||
<antcall target="deb-arch">
|
||
<param name="arch" value="noarch" />
|
||
<param name="deb.arch" value="noarch" />
|
||
<param name="deb.pkg" value="ipk" />
|
||
<param name="deb.prefix" value="/opt" />
|
||
</antcall>
|
||
</target>
|
||
|
||
|
||
<target name="deb-arch">
|
||
<property name="dir.staging" location="${dir.dist}/${deb.pkg}/${arch}" />
|
||
|
||
<copy-replace todir="${dir.staging}">
|
||
<fileset dir="${dir.installer}/deb/${deb.pkg}" />
|
||
<fileset dir="${dir.installer}/deb" includes="control/**" />
|
||
</copy-replace>
|
||
<copy todir="${dir.staging}" verbose="true" failonerror="false">
|
||
<fileset dir="${dir.lib}/native/linux-${arch}" />
|
||
<fileset file="${dir.installer}/icons/icon.svg" />
|
||
</copy>
|
||
<copy file="${path.fatjar}" tofile="${dir.staging}/FileBot.jar" verbose="true" />
|
||
|
||
<jdeb destfile="${dir.dist}/filebot_${version}_${deb.arch}.${deb.pkg}" control="${dir.staging}/control" compression="xz" changesIn="${dir.staging}/changes.txt" changesOut="${dir.dist}/filebot_${version}_${deb.arch}.${deb.pkg}.changes" verbose="true">
|
||
<tarfileset prefix="${deb.prefix}/share/filebot" dir="${dir.staging}" includes="*.sh, fpcalc" filemode="755" />
|
||
<tarfileset prefix="${deb.prefix}/share/filebot" dir="${dir.staging}" includes="*.jar, *.so, *.svg" />
|
||
<tarfileset prefix="${deb.prefix}/share/applications" dir="${dir.staging}" includes="*.desktop" />
|
||
</jdeb>
|
||
</target>
|
||
|
||
|
||
<target name="appx" description="Build Windows 10 package" depends="revision">
|
||
<copy tofile="${dir.dist}/appx/FileBot.jar" file="${path.fatjar}" />
|
||
<copy todir="${dir.dist}/appx">
|
||
<fileset dir="${dir.installer}/appx" includes="*.exe, *.ini, *.properties, *.png" />
|
||
<fileset dir="${dir.lib}/native/win32-x64" />
|
||
</copy>
|
||
|
||
<!-- fetch latest JRE -->
|
||
<exec executable="powershell" dir="${dir.cache}" failonerror="yes">
|
||
<arg line="–NoProfile –ExecutionPolicy Bypass -Command 'Invoke-WebRequest https://raw.githubusercontent.com/rednoah/java-installer/master/release/install-jre.ps1 | Invoke-Expression'" />
|
||
</exec>
|
||
<copy todir="${dir.dist}/appx/jre">
|
||
<tarfileset>
|
||
<gzipresource>
|
||
<file file="${dir.cache}/jre-${jre.major}u${jre.build}-windows-x64.tar.gz" />
|
||
</gzipresource>
|
||
</tarfileset>
|
||
<cutdirsmapper dirs="1" />
|
||
</copy>
|
||
|
||
<!-- copy files and resolve ant variables -->
|
||
<copy-replace todir="${dir.dist}/appx">
|
||
<fileset dir="${dir.installer}/appx" includes="*.xml, *.ini" excludes="*.l4j.xml" />
|
||
</copy-replace>
|
||
|
||
<exec executable="makeappx" dir="${dir.dist}" failonerror="yes">
|
||
<arg line="pack /d appx /p ${release}_r${revision}.appx" />
|
||
</exec>
|
||
</target>
|
||
|
||
|
||
<target name="msi" description="Build Windows Installer packages" depends="revision">
|
||
<antcall target="msi-arch">
|
||
<param name="arch" value="x86" />
|
||
</antcall>
|
||
<antcall target="msi-arch">
|
||
<param name="arch" value="x64" />
|
||
</antcall>
|
||
|
||
<apply executable="signtool" dir="${dir.installer}/msi" parallel="true" failonerror="true">
|
||
<arg line="sign /fd SHA256 /t http://time.certum.pl/ /v /a" />
|
||
<srcfile />
|
||
<fileset dir="${dir.dist}" includes="*.msi" />
|
||
</apply>
|
||
</target>
|
||
|
||
|
||
<target name="msi-arch">
|
||
<property name="dir.staging" location="${dir.dist}/msi/${arch}" />
|
||
|
||
<copy todir="${dir.staging}">
|
||
<fileset dir="${dir.installer}/msi" includes="*.exe, *.rtf, *.bmp" />
|
||
</copy>
|
||
<copy todir="${dir.staging}">
|
||
<fileset dir="${dir.lib}/native/win32-${arch}" />
|
||
</copy>
|
||
<copy todir="${dir.staging}">
|
||
<fileset dir="${dir.installer}/icons" includes="*.ico" />
|
||
</copy>
|
||
<copy-replace todir="${dir.staging}">
|
||
<fileset dir="${dir.installer}/msi" includes="*.wix, *.ini, *.properties" />
|
||
</copy-replace>
|
||
|
||
<exec executable="candle" dir="${dir.staging}" failonerror="true">
|
||
<arg line="filebot.wix -out msi.wixobj" />
|
||
</exec>
|
||
<exec executable="light" dir="${dir.staging}" failonerror="true">
|
||
<arg line="msi.wixobj -sval -ext WixUIExtension -out ${dir.dist}/${release}_${arch}.msi" />
|
||
</exec>
|
||
</target>
|
||
|
||
|
||
<target name="portable" description="Build portable package" depends="revision">
|
||
<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>
|
||
|
||
<cmp:xz destfile="${dir.dist}/${release}-portable.tar.xz">
|
||
<cmp:tar format="gnu" encoding="utf-8">
|
||
<cmp:tarfileset dir="${dir.dist}/portable" includes="*.jar, *.exe, *.ini, *.cmd" />
|
||
<cmp:tarfileset dir="${dir.dist}/portable" includes="*.sh" filemode="755" />
|
||
</cmp:tar>
|
||
</cmp:xz>
|
||
</target>
|
||
|
||
|
||
<target name="spk" description="Build Synology NAS package" depends="revision">
|
||
<spk destdir="${dir.dist}" name="${package.name}" version="${version}" arch="noarch" compression="xz">
|
||
<info name="displayname" value="${application.name}" />
|
||
<info name="description" value="${package.description}" />
|
||
<info name="maintainer" value="${package.project}" />
|
||
<info name="maintainer_url" value="${package.homepage}" />
|
||
<info name="distributor" value="${package.project}" />
|
||
<info name="distributor_url" value="${package.homepage}" />
|
||
<info name="support_url" value="${link.help.synology}" />
|
||
<info name="helpurl" value="${link.help.manpage}" />
|
||
<info name="firmware" value="6.0" />
|
||
<info name="startable" value="no" />
|
||
<info name="silent_install" value="yes" />
|
||
<info name="silent_uninstall" value="yes" />
|
||
<info name="silent_upgrade" value="yes" />
|
||
<info name="thirdparty" value="yes" />
|
||
|
||
<!-- Dependencies are troublesome for some users because they cannot be skipped or ignored (i.e. DSM does not support optional or recommended dependencies) -->
|
||
<!-- <info name="start_dep_services" value="ssh" /> -->
|
||
<!-- <info name="install_dep_packages" value="oracle-java" /> -->
|
||
|
||
<icon size="72" file="${dir.installer}/icons/icon72.png" />
|
||
<icon size="256" file="${dir.installer}/icons/icon256.png" />
|
||
|
||
<scripts dir="${dir.installer}/spk/scripts" filemode="755" />
|
||
<package dir="${dir.installer}/spk/package" includes="*.sh" filemode="755" />
|
||
<package file="${path.fatjar}" fullpath="FileBot.jar" />
|
||
|
||
<codesign secring="${dir.installer}/gpg/secring.gpg" keyid="${gpg.key}" password="${gpg.pwd}" />
|
||
</spk>
|
||
</target>
|
||
|
||
|
||
<target name="build" depends="revision">
|
||
<!-- compile -->
|
||
<javac srcdir="${dir.source}" destdir="${dir.build}" target="${jvm.version}" source="${jvm.version}" encoding="utf-8" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
||
<classpath>
|
||
<fileset dir="${dir.lib}" includes="**/*.jar" />
|
||
</classpath>
|
||
</javac>
|
||
|
||
<!-- copy resources -->
|
||
<copy todir="${dir.build}">
|
||
<fileset dir="${dir.source}">
|
||
<exclude name="**/*.java" />
|
||
<exclude name="**/*.properties" />
|
||
</fileset>
|
||
</copy>
|
||
|
||
<!-- update application properties -->
|
||
<copy-replace todir="${dir.build}">
|
||
<fileset dir="${dir.source}" includes="**/*.properties" />
|
||
</copy-replace>
|
||
</target>
|
||
|
||
|
||
<target name="clean" description="Delete build folders">
|
||
<delete dir="${dir.dist}" />
|
||
<delete dir="${dir.build}" />
|
||
</target>
|
||
|
||
|
||
<target name="revision" depends="init">
|
||
<exec executable="git" outputproperty="revision" failonerror="true">
|
||
<arg line="rev-list --count master" />
|
||
</exec>
|
||
<echo>Revision: ${revision}</echo>
|
||
</target>
|
||
|
||
|
||
<target name="init">
|
||
<mkdir dir="${dir.build}" />
|
||
<mkdir dir="${dir.dist}" />
|
||
<mkdir dir="${dir.release}" />
|
||
<mkdir dir="${dir.cache}" />
|
||
|
||
<path id="lib.classpath">
|
||
<fileset dir="${dir.lib}" includes="**/*.jar" excludes="**/*-jdk14.jar" />
|
||
</path>
|
||
<taskdef uri="antlib:org.apache.ant.compress" resource="org/apache/ant/compress/antlib.xml" classpathref="lib.classpath" />
|
||
<taskdef resource="net/filebot/ant/spk/antlib.xml" classpathref="lib.classpath" />
|
||
<taskdef resource="org/vafer/jdeb/ant/antlib.xml" classpathref="lib.classpath" />
|
||
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpathref="lib.classpath" />
|
||
</target>
|
||
|
||
|
||
<target name="stage-release" depends="fatjar, spk, deb, ipkg, portable, appbundle, msi">
|
||
<!-- ensure clean release dir -->
|
||
<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.xz" />
|
||
<include name="*.msi" />
|
||
<include name="*.deb" />
|
||
<include name="*.ipk" />
|
||
<include name="*.spk" />
|
||
</fileset>
|
||
</copy>
|
||
|
||
<checksum algorithm="SHA-256" pattern="{0} {1}" todir="${dir.cache}" fileext=".sha256">
|
||
<fileset dir="${dir.release}" />
|
||
</checksum>
|
||
<concat destfile="${dir.release}/README.md" overwrite="true" eol="unix" outputencoding="utf-8">
|
||
<fileset file="${dir.installer}/ant/digest.header.md" />
|
||
<fileset dir="${dir.cache}" includes="*.sha256" />
|
||
<fileset file="${dir.installer}/ant/digest.footer.md" />
|
||
</concat>
|
||
</target>
|
||
|
||
|
||
<target name="deploy-release" depends="stage-release" description="Upload release files to SourceForge.net FRS">
|
||
<!-- make sure to upload README.md first -->
|
||
<scp todir="${deploy.release}" trust="yes" verbose="true" sftp="true" keyfile="${deploy.keyfile}">
|
||
<fileset dir="${dir.release}/.." includes="**/README.md">
|
||
<date datetime="${tstamp.date}" pattern="yyyy-MM-dd" when="after" />
|
||
</fileset>
|
||
</scp>
|
||
|
||
<!-- upload starting with parent folders so scp will create the release folder for us -->
|
||
<scp todir="${deploy.release}" trust="yes" verbose="true" sftp="true" keyfile="${deploy.keyfile}">
|
||
<fileset dir="${dir.release}/.." excludes="**/README.md">
|
||
<date datetime="${tstamp.date}" pattern="yyyy-MM-dd" when="after" />
|
||
</fileset>
|
||
</scp>
|
||
</target>
|
||
|
||
|
||
<target name="deploy-website" description="Upload website resources" depends="init">
|
||
<!-- copy image resources -->
|
||
<copy todir="${dir.dist}/website/resources" preservelastmodified="yes" verbose="yes" flatten="true">
|
||
<fileset dir="${dir.source}/net/filebot/resources">
|
||
<include name="*.png" />
|
||
</fileset>
|
||
</copy>
|
||
|
||
<!-- copy static website resources -->
|
||
<copy todir="${dir.dist}/website" preservelastmodified="yes" verbose="yes">
|
||
<fileset dir="${dir.website}">
|
||
<include name=".htaccess" />
|
||
<include name="*.html" />
|
||
<include name="*.php" />
|
||
<include name="*.json" />
|
||
<include name="*.xml" />
|
||
<include name="*.css" />
|
||
<include name="*.js" />
|
||
<include name="*.png" />
|
||
<include name="*.ico" />
|
||
<include name="*.txt" />
|
||
<include name="syno/**" />
|
||
<include name="images/**" />
|
||
<include name="screenshots/**" />
|
||
<include name="getting-started/**" />
|
||
</fileset>
|
||
</copy>
|
||
|
||
<!-- copy files and resolve ant variables -->
|
||
<copy-replace todir="${dir.dist}/website">
|
||
<fileset dir="${dir.website}">
|
||
<include name="*.html" />
|
||
<include name="*.php" />
|
||
</fileset>
|
||
</copy-replace>
|
||
|
||
<!-- upload -->
|
||
<scp todir="${deploy.website}" trust="yes" verbose="true" sftp="true" keyfile="${deploy.keyfile}">
|
||
<fileset dir="${dir.dist}/website">
|
||
<modified>
|
||
<param name="cache.cachefile" value="${dir.cache}/scp.cache" />
|
||
</modified>
|
||
</fileset>
|
||
</scp>
|
||
</target>
|
||
|
||
|
||
<target name="deploy-synology" description="Update Synology Package Source">
|
||
<mkdir dir="${dir.dist}/website/syno" />
|
||
|
||
<!-- merge all filebot related packages into a single package source file -->
|
||
<package-source file="${dir.dist}/website/syno/index.json">
|
||
<keyring file="${dir.installer}/gpg/FileBot.pub" />
|
||
<spk file="${dir.release}/${package.name}-${version}-noarch.spk">
|
||
<info name="link" value="http://downloads.sourceforge.net/project/filebot/filebot/${release}/${package.name}-${version}-noarch.spk" />
|
||
<thumbnail url="http://app.filebot.net/syno/filebot-thumbnail.png" />
|
||
<snapshot url="http://app.filebot.net/syno/filebot-snapshot.png" />
|
||
</spk>
|
||
<source url="https://raw.githubusercontent.com/filebot/filebot-node/master/spksrc.json" />
|
||
<source url="https://raw.githubusercontent.com/rednoah/java-installer/master/spksrc.json" />
|
||
<source url="https://raw.githubusercontent.com/rednoah/ant-installer/master/spksrc.json" />
|
||
</package-source>
|
||
|
||
<!-- upload -->
|
||
<scp todir="${deploy.website}/syno" trust="yes" verbose="true" sftp="true" keyfile="${deploy.keyfile}">
|
||
<fileset dir="${dir.dist}/website/syno">
|
||
<include name="*.json" />
|
||
</fileset>
|
||
</scp>
|
||
</target>
|
||
|
||
|
||
<target name="deploy-chocolatey" description="Update Chocolatey Package Source">
|
||
<!-- prepare sha1 checksums -->
|
||
<checksum property="x86.msi.sha256" file="${dir.release}/${release}_x86.msi" algorithm="SHA-256" />
|
||
<checksum property="x64.msi.sha256" file="${dir.release}/${release}_x64.msi" algorithm="SHA-256" />
|
||
|
||
<!-- replace variables for new release -->
|
||
<copy-replace todir="${dir.dist}/chocolatey">
|
||
<fileset dir="${dir.installer}/chocolatey">
|
||
<include name="**/*.ps1" />
|
||
<include name="**/*.nuspec" />
|
||
</fileset>
|
||
</copy-replace>
|
||
|
||
<!-- chocolatey pack and push -->
|
||
<exec executable="chocolatey" dir="${dir.dist}/chocolatey" failonerror="true">
|
||
<arg value="pack" />
|
||
</exec>
|
||
<exec executable="chocolatey" dir="${dir.dist}/chocolatey" failonerror="true">
|
||
<arg value="push" />
|
||
<arg value="${dir.dist}/chocolatey/${package.name}.${version}.nupkg" />
|
||
</exec>
|
||
</target>
|
||
|
||
|
||
<target name="upload-data" description="Upload data files" depends="init">
|
||
<scp todir="${deploy.website}" trust="yes" verbose="true" sftp="true" keyfile="${deploy.keyfile}">
|
||
<fileset dir="${dir.website}">
|
||
<include name="data/*.txt" />
|
||
<include name="data/*.xz" />
|
||
<modified>
|
||
<param name="cache.cachefile" value="${dir.cache}/scp.cache" />
|
||
</modified>
|
||
</fileset>
|
||
</scp>
|
||
</target>
|
||
|
||
|
||
<target name="deploy-beta-jar" depends="fatjar" description="Build and deploy the latest jar">
|
||
<cmp:xz srcfile="${path.fatjar}" destfile="${path.fatjar}.xz" />
|
||
<scp file="${path.fatjar}.xz" remoteTofile="${deploy.release}/HEAD/filebot-r${revision}.jar.xz" trust="yes" verbose="true" sftp="true" keyfile="${deploy.keyfile}" />
|
||
<scp file="${path.fatjar}.xz" remoteTofile="${deploy.release}/HEAD/FileBot.jar.xz" trust="yes" verbose="true" sftp="true" keyfile="${deploy.keyfile}" />
|
||
</target>
|
||
|
||
|
||
<target name="deploy-beta-release" description="Build and deploy the latest release files">
|
||
<input addproperty="mark" message="Mark:" />
|
||
<antcall target="deploy-release">
|
||
<param name="dir.release" location="${dir.dist}/beta/release/${release}_${mark}" />
|
||
<param name="dir.cache" location="${dir.dist}/beta/cache/${release}_${mark}" />
|
||
<param name="deploy.release" value="${deploy.release}/HEAD" />
|
||
</antcall>
|
||
</target>
|
||
|
||
|
||
</project>
|