-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsigcheck.xml
61 lines (51 loc) · 2.15 KB
/
sigcheck.xml
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
<project name = "Sigcheck" default = "executeSigcheck">
<!-- Define properties -->
<property name = "sigcheck" value = "sigcheck -q" />
<property name = "output.file" value = "sigcheck_output.txt" />
<!-- Define a property for the PHP extension DLL -->
<property name = "phpext.dll" value = "${phpext.dll}" />
<target name = "executeSigcheck">
<!-- Execute sigcheck and save the output to a file -->
<exec executable = "cmd" output = "${output.file}" failonerror = "false">
<arg value = "/c" />
<!-- Pass the value of ${phpext.dll} as an argument to sigcheck -->
<arg value = "${sigcheck}" />
<arg value = "${phpext.dll}" />
</exec>
<!-- Read the content of the output file and extract "MachineType" -->
<loadfile property = "arch" srcfile = "${output.file}">
<filterchain>
<linecontains>
<contains value = "MachineType:" />
</linecontains>
<tokenfilter>
<replaceregex pattern = "^.*MachineType:\s*(\S+).*$" replace = "\1" />
</tokenfilter>
</filterchain>
</loadfile>
<propertyregex property="filename" input="${phpext.dll}" regexp=".*/([^/]*)$" select="\1"/>
<!-- Echo the "MachineType" -->
<echo message = "MachineType: ${arch}" />
<echo message=".dll filename is: ${filename}"/>
<condition property = "property.matches.64">
<matches string = "${arch}" pattern = "64-bit" />
</condition>
<if>
<not>
<isset property = "property.matches.64" />
</not>
<then>
<echo message = "Your property does not match '64-bit'." />
<exec executable = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" failonerror = "true">
<arg value = "-NoLogo" />
<arg value = "-NoProfile" />
<arg value = "-Command" />
<arg value = "(New-Object -ComObject SAPI.SpVoice).Speak('OH NO!, the dll file ${filename}, is not built for x64, Halting build.')" />
</exec>
<fail message = " Architecture is not '64-bit'. Halting build." />
</then>
</if>
<!-- Delete sigchecks temp file -->
<delete file="sigcheck_output.txt"/>
</target>
</project>