-
Notifications
You must be signed in to change notification settings - Fork 657
Expand file tree
/
Copy pathbuild.xml
More file actions
executable file
·419 lines (355 loc) · 20.7 KB
/
build.xml
File metadata and controls
executable file
·419 lines (355 loc) · 20.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
<?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="Autopsy 4" default="build" basedir=".">
<description>Builds the module suite Autopsy 4.</description>
<import file="nbproject/build-impl.xml"/>
<import file="${basedir}/TSKVersion.xml"/>
<!-- IMPORTANT: nbproject/platform.properties has a netbeans-plat-version property that MUST be kept in sync (manually) -->
<property name="netbeans-plat-version" value="15" />
<property name="nbplatform.active.dir" value="${basedir}/netbeans-plat/${netbeans-plat-version}" />
<property name="nbplatform.default.harness.dir" value="${nbplatform.active.dir}/harness" />
<!-- Supported java versions.-->
<condition property="supported-java-versions">
<or>
<matches string="${java.version}" pattern="[1-9][0-9]\.*\.*"/>
<matches string="${ant.java.version}" pattern="[1-9][0-9]"/>
</or>
</condition>
<!-- Verify that the java version running is . -->
<fail message="Unsupported Java version: ${ant.java.version} with Ant java version ${ant.java.version}.
Make sure that the Java version is 11 or higher."
unless="supported-java-versions"/>
<!-- Determine platform and include specific file -->
<condition property="os.family" value="unix">
<os family="unix"/>
</condition>
<condition property="os.family" value="windows">
<os family="windows"/>
</condition>
<condition property="os.family" value="mac">
<os family="mac"/>
</condition>
<condition property="is.windows">
<os family="windows"/>
</condition>
<import file="build-${os.family}.xml"/>
<!-- Third party tools dependencies -->
<!-- import ant-contrib tools -->
<property name="thirdparty.dir" value="${basedir}/thirdparty" />
<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>
<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>
<!-- 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="clean" depends="suite.clean">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="docs\doxygen-user\user-docs" includes="**/*"/>
</delete>
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="docs\doxygen\doxygen_docs\api-docs" includes="**/*"/>
</delete>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${basedir}/docs/doxygen-dev/build-docs" includes="**/*"/>
</delete>
<!-- clean core test libs -->
<subant buildpath="${basedir}/CoreTestLibs/build.xml" target="clean" inheritrefs="false" inheritall="false">
<property name="nbplatform.active.dir" value="${nbplatform.active.dir}" />
<property name="nbplatform.default.harness.dir" value="${nbplatform.default.harness.dir}" />
</subant>
</target>
<!-- Compile the MCP STDIO exe only on Windows and only when the JS source is newer than the existing exe.
The exe is excluded from git; it must be built locally before packaging a release.
If compilation fails, make sure Claude Desktop is closed — it locks the EXE. -->
<target name="compile-mcp-stdio" if="is.windows" description="Compile autopsy-mcp-stdio.exe if source has changed (Windows only)">
<uptodate property="mcp.stdio.uptodate"
srcfile="${basedir}/Tools/autopsy-mcp-stdio/autopsy-mcp-stdio.js"
targetfile="${basedir}/Tools/autopsy-mcp-stdio/dist/autopsy-mcp-stdio.exe"/>
<antcall target="-compile-mcp-stdio-if-needed"/>
</target>
<target name="-compile-mcp-stdio-if-needed" unless="mcp.stdio.uptodate">
<available property="mcp.stdio.npm.installed"
file="${basedir}/Tools/autopsy-mcp-stdio/node_modules" type="dir"/>
<antcall target="-npm-install-if-needed"/>
<echo message="autopsy-mcp-stdio.js has changed — recompiling autopsy-mcp-stdio.exe..."/>
<echo message="NOTE: If this fails, close Claude Desktop first (it locks the EXE while running)."/>
<mkdir dir="${basedir}/Tools/autopsy-mcp-stdio/dist"/>
<exec executable="npm.cmd" dir="${basedir}/Tools/autopsy-mcp-stdio" failonerror="true">
<arg value="run"/>
<arg value="package"/>
</exec>
<echo message="autopsy-mcp-stdio.exe compiled successfully."/>
</target>
<target name="-npm-install-if-needed" unless="mcp.stdio.npm.installed">
<echo message="node_modules not found — running npm install in Tools/autopsy-mcp-stdio..."/>
<exec executable="npm.cmd" dir="${basedir}/Tools/autopsy-mcp-stdio" failonerror="true">
<arg value="install"/>
</exec>
</target>
<!-- This target is similar to the regular test target that calls test on all nbm's,
but this target excludes the Testing nbm which runs the regression tests -->
<target name="test-no-regression" depends="build" description="Runs tests for all modules in the suite excluding the regression tests of the Testing NBM.">
<!--taken from https://stackoverflow.com/a/1176101/2375948 ; remove "Testing" from the modules and provide 'modulesNoTesting' as result. -->
<propertyregex property="modulesNoTesting"
input="${modules}"
regexp="Testing[;:]?"
replace=""
global="true" />
<sortsuitemodules unsortedmodules="${modulesNoTesting}" sortedmodulesproperty="modules.test.sorted" sorttests="true"/>
<!-- continue on fail -->
<property name="continue.after.failing.tests" value="true"/>
<subant target="test" buildpath="${modules.test.sorted}" inheritrefs="false" inheritall="false">
<property name="cluster.path.evaluated" value="${cluster.path.evaluated}"/> <!-- Just for speed of pre-7.0 projects -->
<property name="harness.taskdefs.done" value="${harness.taskdefs.done}"/> <!-- optimization -->
<property name="continue.after.failing.tests" value="${continue.after.failing.tests}"/>
</subant>
</target>
<target name="set-release-build">
<property name="build.type" value="RELEASE"/>
</target>
<!-- This target takes the NB-built ZIP, unzips it into the dist folder, copies in
additional files, and renames the folder to include the version number. The folder
is left in place for manual signing before running build-installer. -->
<target name="build-zip" depends="set-release-build, build, suite.build-zip">
<property name="dist_app_dir" value="${nbdist.dir}/${app.name}"/>
<property name="dist_app_ver_dir" value="${nbdist.dir}/${app.name}-${app.version}"/>
<!-- step (2) unzip the result into the dist folder -->
<delete dir="${dist_app_dir}"/>
<delete dir="${dist_app_ver_dir}"/>
<unzip src="${nbdist.dir}/${app.name}.zip" dest="${nbdist.dir}"/>
<!-- Disable the Experimental module by default for the installed version. Need to update .lastModified time for change to be seen. -->
<replace file="${dist_app_dir}/autopsy/config/Modules/org-sleuthkit-autopsy-experimental.xml" token="<param name="enabled">true</param>" value="<param name="enabled">false</param>"/>
<echo file="${dist_app_dir}/autopsy/.lastModified" message="" />
<!-- step (3) do your copying stuff here, check the ant doc for copy, move, etc file -->
<copy file="${nbplatform.active.dir}/platform/modules/ext/junit-4.10.jar"
tofile="${dist_app_dir}/platform/modules/ext/junit-4.10.jar"/>
<copy file="${basedir}/README.txt" tofile="${dist_app_dir}/README.txt"/>
<copy file="${basedir}/LICENSE-2.0.txt" tofile="${dist_app_dir}/LICENSE-2.0.txt"/>
<copy file="${basedir}/NEWS.txt" tofile="${dist_app_dir}/NEWS.txt"/>
<copy file="${basedir}/Running_Linux_OSX.md" tofile="${dist_app_dir}/Running_Linux_OSX.md"/>
<copy file="${basedir}/unix_setup.sh" tofile="${dist_app_dir}/unix_setup.sh"/>
<copy flatten="false" todir="${dist_app_dir}/linux_macos_install_scripts">
<fileset dir="${basedir}/linux_macos_install_scripts"/>
</copy>
<copy file="${basedir}/Tools/ManifestTool/ManifestTool.exe" todir="${dist_app_dir}/bin"/>
<if>
<isset property="is.windows"/>
<then>
<copy file="${basedir}/Tools/autopsy-mcp-stdio/dist/autopsy-mcp-stdio.exe" todir="${dist_app_dir}/bin"/>
</then>
</if>
<copy file="${basedir}/icons/icon.ico" tofile="${dist_app_dir}/icon.ico" overwrite="true"/>
<property name="app.property.file" value="${dist_app_dir}/etc/${app.name}.conf" />
<var name="jvm-value" value="--branding ${app.name} -J-Xms24m -J-Xmx4G -J-XX:+UseStringDeduplication -J-Dprism.order=sw -J--add-opens=java.base/java.lang=ALL-UNNAMED -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-opens=javafx.controls/javafx.scene.control.skin=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-exports=javafx.controls/com.sun.javafx.scene.control.inputmap=ALL-UNNAMED -J--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED"/>
<!-- for Japanese localized version add option: -Duser.language=ja -->
<if>
<equals arg1="${os.family}" arg2="mac"/>
<then>
<property name="jvm.options" value=""${jvm-value} -J-Xdock:name=${app.title}""/>
</then>
<else>
<property name="jvm.options" value=""${jvm-value}""/>
</else>
</if>
<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="${dist_app_dir}/autopsy/modules/lib">
<include name="libtsk_jni.dll" />
<include name="libewf.dll" />
<include name="libvmdk.dll"/>
<include name="libvhdi.dll"/>
<include name="zlib.dll" />
<include name="libintl-8.dll"/>
<include name="libiconv-2.dll"/>
<include name="ssleay32.dll"/>
<include name="libeay32.dll"/>
<include name="libpq.dll"/>
</fileset>
</delete>
<!-- Remove 32-bit binaries; only 64-bit is shipped -->
<delete file="${dist_app_dir}/bin/${app.name}.exe" failonerror="false"/>
<delete dir="${dist_app_dir}/autopsy/ewfexport_exec/32-bit" failonerror="false"/>
<delete dir="${dist_app_dir}/autopsy/plaso/plaso-20180818-Win32" failonerror="false"/>
<!-- step (4) rename the folder to include the version number -->
<move file="${dist_app_dir}" tofile="${dist_app_ver_dir}"/>
<echo message=" "/>
<echo message="=== build-zip complete ===" />
<echo message=" Folder: ${dist_app_ver_dir}" />
<echo message=" "/>
<echo message="Manual steps before building the installer:" />
<echo message=" 1. Sign the EXEs in ${dist_app_ver_dir}/bin (autopsy64.exe, etc.)." />
<echo message=" 2. powershell.exe .\release_scripts\build_windows_installer.ps1 ${app.version}" />
</target>
<!-- build-installer uses the folder produced by build-zip after manual signing. -->
<target name="build-installer" depends="build-zip"
description="Sign EXEs in the build-zip output folder, ZIP it, then run this target.">
<echo message=" "/>
<echo message="To build the Windows installer:" />
<echo message=" 1. Sign the EXEs in ${nbdist.dir}/${app.name}-${app.version}/bin (autopsy64.exe, etc.)." />
<echo message=" 2. powershell.exe -ExecutionPolicy Bypass -File .\release_scripts\build_windows_installer.ps1 ${app.version}" />
<echo message=" "/>
</target>
<target name="getProps" depends="prop-files,input-build-type,input-version">
<property name="nbdist.dir" value="dist"/>
</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="-init" depends="-taskdefs,-convert-old-project,getProps,getJunit,copyLibsToBaseDir">
<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>
<target name="-build-minimal-platform" depends="-init,clean" description="Builds a minimal autopsy platform (i.e. just Core, CoreLibs, and Tika)">
<antcall inheritAll="false" target="suite.build-zip">
<param name="modules" value="CoreLibs:Tika:Core" />
</antcall>
<move file="${dist.dir}/${app.name}.zip" tofile="${dist.dir}/${app.name}-minimal.zip"/>
<property name="build-minimal-platform-renamed" location="${dist.dir}/${app.name}-minimal.zip" />
<echo>File moved to ${build-minimal-platform-renamed}</echo>
</target>
<target name="build-core-test-libs">
<subant buildpath="${basedir}/CoreTestLibs/build.xml" target="build" inheritrefs="false" inheritall="false">
<property name="nbplatform.active.dir" value="${nbplatform.active.dir}" />
<property name="nbplatform.default.harness.dir" value="${nbplatform.default.harness.dir}" />
<property name="nbplatform.download.harness.dir" value="${nbplatform.active.dir}/harness" />
<property name="nbplatform.download.netbeans.dest.dir" value="${nbplatform.active.dir}" />
</subant>
</target>
<!-- override build to add branding -->
<target name="build" depends="build-core-test-libs,build-brand,suite.build,chmod_executables,compile-mcp-stdio" 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>
<!-- 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>
<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">
<!-- Delete older versions -->
<delete includeemptydirs="true">
<fileset dir="${basedir}/docs/doxygen/doxygen_docs" includes="**/*"/>
</delete>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${basedir}/docs/doxygen-user/user-docs" includes="**/*"/>
</delete>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${basedir}/docs/doxygen-dev/build-docs" includes="**/*"/>
</delete>
<!-- Generate new -->
<exec executable="doxygen" dir="${basedir}/docs/doxygen">
<arg value="Doxyfile"/>
</exec>
<exec executable="doxygen" dir="${basedir}/docs/doxygen-user">
<arg value="Doxyfile"/>
</exec>
<exec executable="doxygen" dir="${basedir}/docs/doxygen-dev">
<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="chmod_executables" >
<chmod perm="a+x">
<fileset dir="${cluster}/markmckinnon" casesensitive="no" id="mm">
<include name="*_linux"/>
<include name="*_macos"/>
</fileset>
<fileset dir="${cluster}/solr/bin" casesensitive="no" id="solr">
<include name="autopsy-solr"/>
</fileset>
</chmod>
</target>
</project>