autopsy-flatpak/build.xml
2014-03-10 17:22:07 -04:00

266 lines
12 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="Autopsy3" basedir=".">
<description>Builds the module suite Autopsy3.</description>
<import file="nbproject/build-impl.xml"/>
<property name="netbeans-plat-version" value="7.3" />
<property name="nbplatform.active.dir" value="${basedir}/netbeans-plat/${netbeans-plat-version}" />
<condition property="os.family" value="unix">
<os family="unix"/>
</condition>
<condition property="os.family" value="windows">
<os family="windows"/>
</condition>
<import file="build-${os.family}.xml"/>
<property name="test-input" location="Test/input"/>
<property name="thirdparty.dir" value="${basedir}/thirdparty" />
<!-- import ant-contrib tools -->
<property name="ant-contrib.dir" value="${thirdparty.dir}/ant-contrib/1.0b3" />
<property name="ant.contrib.jar" value="${ant-contrib.dir}/ant-contrib.jar" />
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${ant.contrib.jar}"/>
</classpath>
</taskdef>
<!-- This seems really bad to be hard coded, but I couldn't find a better solution -->
<path id="jni-path">
<pathelement location="${basedir}/build/cluster/modules/org-sleuthkit-datamodel.jar"/>
<path refid="cluster.path.id" />
</path>
<!-- Verify that the TSK_HOME env variable is set -->
<target name="findTSK">
<property environment="env"/>
<condition property="tskFound">
<isset property="env.TSK_HOME"/>
</condition>
<fail unless="tskFound" message="TSK_HOME must be set as an environment variable."/>
<echo> TSK_HOME: ${env.TSK_HOME}</echo>
</target>
<target name="getJunit">
<property name="junit.dir" value="${thirdparty.dir}/junit/${netbeans-plat-version}" />
<unzip src="${junit.dir}/junit.zip" dest="${nbplatform.active.dir}"/>
</target>
<!-- This target will create a custom ZIP file for us. It first uses the general
ZIP target and then opens it up and adds in any files that we want. This is where we customize the
version number. -->
<target name="build-zip" depends="suite.build-zip"> <!--,findJRE" -->
<property name="nbdist.dir" value="dist"/>
<property name="release.dir" value="${nbdist.dir}/${app.name}"/>
<!-- step (2) unzip the result -->
<property name="zip-tmp" value="${nbdist.dir}/tmp"/>
<delete dir="${zip-tmp}"/>
<mkdir dir="${zip-tmp}"/>
<unzip src="${nbdist.dir}/${app.name}.zip" dest="${zip-tmp}"/>
<!-- step (3) do your copying stuff here, check the ant doc for copy, move, etc file -->
<copy file="${basedir}/README.txt" tofile="${zip-tmp}/${app.name}/README.txt"/>
<copy file="${basedir}/LICENSE-2.0.txt" tofile="${zip-tmp}/${app.name}/LICENSE-2.0.txt"/>
<copy file="${basedir}/NEWS.txt" tofile="${zip-tmp}/${app.name}/NEWS.txt"/>
<copy file="${basedir}/KNOWN_ISSUES.txt" tofile="${zip-tmp}/${app.name}/KNOWN_ISSUES.txt"/>
<unzip src="${thirdparty.dir}/gstreamer/${os.family}/i386/0.10.7/gstreamer.zip" dest="${zip-tmp}/${app.name}/gstreamer"/>
<copy file="${basedir}/icons/icon.ico" tofile="${zip-tmp}/${app.name}/icon.ico" overwrite="true"/>
<if>
<equals arg1="${os.family}" arg2="windows"/>
<then>
<antcall target="copyExternalLibsToZip"/>
</then>
</if>
<property name="app.property.file" value="${zip-tmp}/${app.name}/etc/${app.name}.conf" />
<!-- for Japanese localized version add option: -Duser.language=ja -->
<property name="jvm.options" value="&quot;--branding ${app.name} -J-Xms24m -J-XX:MaxPermSize=128M -J-Xverify:none -J-Xdock:name=${app.title}&quot;" />
<propertyfile file="${app.property.file}">
<!-- Note: can be higher on 64 bit systems, should be in sync with project.properties -->
<entry key="default_options" value="@JVM_OPTIONS" />
</propertyfile>
<!-- workaround for ant escaping : and = when setting properties -->
<replace file="${app.property.file}" token="@JVM_OPTIONS" value="${jvm.options}" />
<!-- We want to remove the dlls in autopsy/modules/lib because they will
shadow the files in the autopsy/modules/lib/ARCHITECTURE folder in the JAR.
These files are legacy from when we used to copy the dlls to this location.
This check should do away in the future. Added Sept '13-->
<delete failonerror="false">
<fileset dir="${zip-tmp}/${app.name}/autopsy/modules/lib">
<include name="libtsk_jni.dll" />
<include name="libewf.dll" />
<include name="zlib.dll" />
</fileset>
</delete>
<!-- step (4) zip again, but with the version numbers in the dir -->
<zip destfile="${nbdist.dir}/${app.name}-${app.version}.zip">
<zipfileset dir="${zip-tmp}/${app.name}"/>
</zip>
<delete dir="${zip-tmp}"/>
<!-- <delete file="${nbdist.dir}/${app.name}.zip"/> -->
<echo message=" "/>
<echo message="cleaning and finalizing release" />
<delete dir="${release.dir}"/>
</target>
<target name="getProps" depends="prop-files,input-build-type,input-version"></target>
<target name="prop-files">
<property file="nbproject/private/private.properties"/>
<property file="nbproject/project.properties"/>
</target>
<target name="input-build-type" unless="build.type">
<input addProperty="build.type"
message="Enter the desired build type:"
validargs="DEVELOPMENT,RELEASE"
defaultvalue="DEVELOPMENT"/>
</target>
<target name="input-version" unless="app.version">
<tstamp/>
<property name="app.version" value="${DSTAMP}"/>
</target>
<target name="getExternals">
<if>
<equals arg1="${os.family}" arg2="windows"/>
<then>
<antcall target="copyLibs"/>
</then>
</if>
</target>
<target name="-init" depends="-taskdefs,-convert-old-project,getProps,getJunit,getExternals">
<convertclusterpath from="${cluster.path.evaluated}" to="cluster.path.final" id="cluster.path.id"/>
<sortsuitemodules unsortedmodules="${modules}" sortedmodulesproperty="modules.sorted"/>
<property name="cluster" location="build/cluster"/>
<echo level="verbose">Suite in ${basedir} with clusters ${cluster.path.final}, build cluster ${cluster}, and sorted modules ${modules.sorted}</echo>
<!-- synchronize with SuiteProject -->
<property name="disabled.modules" value=""/>
<property name="enabled.clusters" value=""/>
<property name="disabled.clusters" value=""/>
<property name="branding.dir" location="branding"/>
<property name="dist.dir" location="dist"/>
<condition property="run.branding"> <!-- #84689 -->
<and>
<available file="${branding.dir}" type="dir"/>
<isset property="branding.token"/>
</and>
</condition>
</target>
<!-- override build to add branding -->
<target name="build" depends="build-brand,suite.build" description="Compiles autopsy and produces a basic branded build that can run on a dev. system" />
<target name="build-brand" depends="-init">
<echo>${app.name} branding</echo>
<propertyfile
file="${branding.dir}/core/core.jar/org/netbeans/core/startup/Bundle.properties"
comment="Updated by build script">
<entry key="currentVersion" value="${app.title} ${app.version}" />
</propertyfile>
<propertyfile
file="${branding.dir}/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties"
comment="Updated by build script">
<entry key="CTL_MainWindow_Title" value="${app.title} ${app.version}" />
<entry key="CTL_MainWindow_Title_No_Project" value="${app.title} ${app.version}" />
</propertyfile>
<propertyfile
file="${basedir}/Core/src/org/sleuthkit/autopsy/coreutils/Version.properties"
comment="Updated by build script">
<entry key="app.name" value="${app.title}" />
<entry key="app.version" value="${app.version}" />
<entry key="build.type" value="${build.type}" />
</propertyfile>
</target>
<target name="jni" depends="build,findTSK">
<javah verbose="yes" outputFile="${env.TSK_HOME}/bindings/java/tsk_jni/tsk_jni/dataModel_SleuthkitJNI.h">
<class name="org.sleuthkit.datamodel.SleuthkitJNI" />
<classpath refid="jni-path"/>
</javah>
</target>
<target name="doxygen" description="build doxygen docs, requires doxygen in PATH" depends="-init,-hide-excluded-modules">
<exec executable="doxygen" dir="${basedir}/docs/doxygen">
<arg value="Doxyfile"/>
</exec>
</target>
<target name="check-release">
<condition property="is-release">
<and>
<equals arg1="${build.type}" arg2="RELEASE"/>
<isset property="update_versions"/>
<equals arg1="${update_versions}" arg2="true"/>
</and>
</condition>
</target>
<target name="versioning-script-if-release" if="is-release">
<exec dir="${basedir}" executable="python" failonerror="true">
<arg line="update_versions.py -a" />
</exec>
</target>
<target name="versioning-script-if-not-release" unless="is-release">
<exec dir="${basedir}" executable="python" failonerror="true">
<arg value="update_versions.py" />
</exec>
</target>
<target name="versioning-script" depends="check-release, versioning-script-if-release, versioning-script-if-not-release"/>
<target name="build-installer-dir" depends="getProps, build-zip" description="Builds Autopsy with branding and all dependencies" >
<unzip src="${nbdist.dir}/${app.name}-${app.version}.zip" dest="${nbdist.dir}/${app.name}-installer"/>
</target>
<target name="build-installer" depends="build-installer-dir" description="Builds Autopsy installer.">
<antcall target="build-installer-${os.family}" />
</target>
<target name="test-download-imgs" description="Get test images and store them in the path represented by the test-input variable.">
<available file="${test-input}/nps-2008-jean.E01" property="img-present-1"/>
<available file="${test-input}/nps-2008-jean.E02" property="img-present-2"/>
<if>
<equals arg1="${img-present-1}" arg2="true"/>
<then>
<echo message = "nps-2008-jean.E01 already present."/>
</then>
<else>
<mkdir dir="${test-input}" />
<get src="http://digitalcorpora.org/corp/nps/drives/nps-2008-jean/nps-2008-jean.E01" dest="${test-input}"/>
</else>
</if>
<if>
<equals arg1="${img-present-2}" arg2="true"/>
<then>
<echo message = "nps-2008-jean.E02 already present."/>
</then>
<else>
<mkdir dir="${test-input}" />
<get src="http://digitalcorpora.org/corp/nps/drives/nps-2008-jean/nps-2008-jean.E02" dest="${test-input}"/>
</else>
</if>
</target>
</project>