forked from chocolatey/choco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobfuscate.step
74 lines (65 loc) · 3.81 KB
/
obfuscate.step
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
<?xml version="1.0" encoding="utf-8" ?>
<project name="Obfuscator" default="go">
<!-- Project UppercuT - http://projectuppercut.org -->
<!-- DO NOT EDIT THIS FILE - This creates the assembly file to be used by the rest of the application - find out more at http://uppercut.pbwiki.com -->
<property name="build.config.settings" value="__NONE__" overwrite="false" />
<include buildfile="${build.config.settings}" if="${file::exists(build.config.settings)}" />
<property name="path.separator" value="${string::trim(path::combine(' ', ' '))}" />
<property name="dirs.current.file" value="${directory::get-parent-directory(project::get-buildfile-path())}" />
<include buildfile="${dirs.current.file}${path.separator}default.build.settings" />
<property name="build.step.name" value="${project::get-name()}" />
<property name="build.step.path" value="${project::get-buildfile-path()}" />
<!-- build step customizations below this -->
<property name="args.obfuscator" value="" overwrite="false" />
<property name="dll.names" value="" />
<target name="go" depends="run_tasks" />
<!-- run_normal_tasks is called from run_tasks unless replace extension exists-->
<target name="run_normal_tasks"
depends="error_check, get_version, get_project_output_files, set_up_args, obfuscate"
description="Generating Assembly File."
/>
<target name="error_check">
<fail message="You must fill out the project.name, repository.path, and company.name settings in the ${build.config.settings} file. Please do that and retry the build."
if="${project.name=='__SOLUTION_NAME_WITHOUT_SLN_EXTENSION__' or company.name=='__COMPANY_NAME__'}" />
</target>
<target name="get_version">
<property name="version.file" value="${version.major}.${version.minor}.${version.build}.${version.revision}" />
<property name="version.file" value="${version.major}.${version.minor}.${version.patch}.${version.build}" if="${version.use_semanticversioning}" />
</target>
<target name="get_project_output_files">
<echo level="Warning" message="Getting all files with '${version.file}' as the file version." />
<foreach item="File" property="dll.filename">
<in>
<items>
<include name="${dirs.build.code}${path.separator}**${path.separator}*" />
</items>
</in>
<do>
<!--echo message="${dll.filename + ' - ' + version::to-string(fileversioninfo::get-file-version(fileversioninfo::get-version-info(dll.filename)))}" /-->
<property name="dll.names" value="${dll.names + ' ' + string::replace(string::replace(dll.filename,path::get-full-path(dirs.build.code) + '\',''),'\',path.separator) + ''}" if="${version::to-string(fileversioninfo::get-file-version(fileversioninfo::get-version-info(dll.filename))) == version.file}" />
</do>
</foreach>
</target>
<target name="set_up_args">
<property name="args.obfuscator" value="${args.obfuscator + ' -k ' + path.key.name.private}" if="${sign.project_with_key}" />
<property name="args.obfuscator" value="${args.obfuscator + ' ' + dll.names}" />
</target>
<target name="obfuscate" if="${run.obfuscator and file::exists(app.obfuscator)}">
<echo level="Warning" message="Attempting to obsfucate using Eazfuscator.NET with these arguments: ${path::get-full-path(app.obfuscator)} ${args.obfuscator}" />
<exec
program="${path::get-full-path(app.obfuscator)}"
workingdir="${dirs.build.code}"
failonerror="${fail.build.on.error}"
commandline="${args.obfuscator}"
if="${platform::is-windows()}" />
<exec
program="mono"
workingdir="${dirs.build.code}"
failonerror="${fail.build.on.error}"
if="${platform::is-unix()}"
>
<arg value='"${path::get-full-path(app.obfuscator)}"' />
<arg value='${args.obfuscator}' />
</exec>
</target>
</project>