-
Notifications
You must be signed in to change notification settings - Fork 17
/
fxcop.step
90 lines (79 loc) · 5.13 KB
/
fxcop.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?xml version="1.0" encoding="utf-8" ?>
<project name="FxCop Code Analysis" default="go">
<!-- Project UppercuT - http://projectuppercut.org -->
<!-- DO NOT EDIT THIS FILE - Add custom tasks in BuildTasks.Custom folder with file by the same name - 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}..${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="folder.fxcop_results" value="fxcop" overwrite="false" />
<property name="dirs.fxcop_results" value="${path::combine(dirs.build_artifacts, folder.fxcop_results)}" overwrite="false" />
<property name="file.fxcop_results" value="${project.name}-results.xml" />
<property name="args.fxcop" value="/searchgac /o:"${dirs.fxcop_results}${path.separator}${file.fxcop_results}"" />
<property name="args.fxcop" value="/searchgac /o:"${dirs.fxcop_results}${path.separator}${file.fxcop_results}" /p:"${file.fxcop_project}"" if="${file::exists(file.fxcop_project)}" />
<property name="fail.build.on.error" value="false" />
<target name="go" depends="load_uppercut_assemblies, run_tasks" />
<target name="prepare">
<echo message="Removing and adding ${dirs.fxcop_results}."/>
<delete dir="${dirs.fxcop_results}" failonerror="false" />
<mkdir dir="${dirs.fxcop_results}" />
</target>
<!-- run_normal_tasks is called from run_tasks unless replace extension exists-->
<target name="run_normal_tasks"
depends="get_regular_dlls, analysis"
description="Using FxCop Code Analysis to report on the complexity and maintainability of your project(s)."
if="${run.fxcop and file::exists(app.fxcop)}" />
<target name="get_regular_dlls">
<echo message="Getting output dlls based on name in directory ${path::get-full-path(dirs.build.code)}." />
<property name="dll.names" value="" />
<property name="dll.args" value="" />
<foreach item="File" property="dll.filename">
<in>
<items>
<exclude name="${dirs.build.code}${path.separator}lib${path.separator}**" />
<exclude name="${dirs.build.code}${path.separator}_PublishedApplications${path.separator}**" />
<exclude name="${dirs.build.code}${path.separator}**${path.separator}NUnit*.dll" />
<exclude name="${dirs.build.code}${path.separator}**${path.separator}MbUnit*.dll" />
<exclude name="${dirs.build.code}${path.separator}**${path.separator}TestFu.dll" />
<exclude name="${dirs.build.code}${path.separator}**${path.separator}QuickGraph*.dll" />
<exclude name="${dirs.build.code}${path.separator}**${path.separator}Refly*.dll" />
<exclude name="${dirs.build.code}${path.separator}**${path.separator}Rhino.Mocks*.dll" />
<exclude name="${dirs.build.code}${path.separator}**${path.separator}*bdd*.dll" />
<exclude name="${dirs.build.code}${path.separator}**${path.separator}*Test*dll" />
<exclude name="${dirs.build.code}${path.separator}**${path.separator}*Spec*dll" />
<include name="${dirs.build.code}${path.separator}${project.name}*dll" />
<include name="${dirs.build.code}${path.separator}*exe" />
</items>
</in>
<do>
<property name="dll.names" value="${dll.names + ' ' + string::replace(string::replace(dll.filename,path::get-full-path(dirs.build.code) + '\',''),'\',path.separator) + ''}" />
<property name="dll.args" value="${dll.args + ' /f:"' + string::replace(string::replace(dll.filename,path::get-full-path(dirs.build.code) + '\',''),'\',path.separator) + '"'}" />
</do>
</foreach>
<property name="dlls.regular" value="${dll.names}" />
<echo level="Warning" message="Running FxCop Code Analysis against these files - ${dlls.regular}." />
<property name="args.fxcop" value="${dll.args} ${args.fxcop}" />
</target>
<target name="analysis" if="${file::exists(app.fxcop)}" >
<echo level="Warning" message="Attempting to run FxCop Code Analysis with args '${args.fxcop}'. Creating file at ${file.fxcop_results}." />
<exec program="${app.fxcop}"
workingdir="${dirs.build.code}"
failonerror="${fail.build.on.error}"
if="${platform::is-windows()}"
>
<arg value="${args.fxcop}" />
</exec>
<exec program="mono"
workingdir="${dirs.build.code}"
failonerror="${fail.build.on.error}"
if="${platform::is-unix()}"
>
<arg value='"${app.fxcop}"' />
<arg value="${args.fxcop}" />
</exec>
</target>
</project>