forked from phatboyg/Magnum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversionBuilder.step
158 lines (145 loc) · 11 KB
/
versionBuilder.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
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
<?xml version="1.0" encoding="utf-8" ?>
<project name="VersionBuilder" 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="file.current.no_extension" value="versionBuilder" />
<property name="dirs.current" value="${directory::get-parent-directory(project::get-buildfile-path())}" />
<property name="path.to.toplevel" value=".." />
<property name="folder.build_scripts" value="build" overwrite="false" />
<property name="folder.build_scripts_custom" value="build.custom" overwrite="false" />
<property name="dirs.build_scripts_custom" value="${dirs.current}${path.separator}${path.to.toplevel}${path.separator}${folder.build_scripts_custom}" />
<property name="folder.code_build" value="build_output" overwrite="false" />
<property name="dirs.build" value="${dirs.current}${path.separator}${path.to.toplevel}${path.separator}${folder.code_build}" />
<property name="project.name" value="__SOLUTION_NAME_WITHOUT_SLN_EXTENSION__" overwrite="false" />
<property name="company.name" value="__COMPANY_NAME__" overwrite="false" />
<property name="path_to_solution" value="." overwrite="false" />
<property name="language.short" value="cs" overwrite="false" />
<property name="language.long" value="CSharp" />
<property name="file.version" value="SolutionVersion.${language.short}" overwrite="false" />
<property name="path.file.version" value="${dirs.current}${path.separator}${path.to.toplevel}${path.separator}${path_to_solution}${path.separator}${file.version}" overwrite="false" />
<property name="version.use_semanticversioning" value="false" overwrite="false" />
<property name="version.major" value="1" overwrite="false" />
<property name="version.minor" value="0" overwrite="false" />
<property name="version.patch" value="0" overwrite="false" />
<property name="version.build" value="0" overwrite="false" />
<property name="version.revision" value="0" overwrite="false" />
<property name="version.hash" value="${version.revision}" overwrite="false" />
<property name="assembly.description" value="${project.name} is a product of ${company.name}" overwrite="false" />
<property name="assembly.clscompliant" value="true" overwrite="false" />
<property name="allow.partially_trusted_callers" value="true" overwrite="false" />
<property name="sign.project_with_key" value="false" overwrite="false" />
<property name="sign.key.use_relative_pathing" value="false" overwrite="false" />
<property name="sign.key.relative_path_from_projects" value="..${path.separator}..${path.separator}" overwrite="false" />
<property name="app.strongname" value="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\sn.exe" overwrite="false" />
<property name="file.key.name.private" value="${dirs.current}${path.separator}${path.to.toplevel}${path.separator}${project.name}.snk" overwrite="false" />
<property name="file.key.name.private" value="${path.to.toplevel}${path.separator}${project.name}.snk" overwrite="false" if="${sign.key.use_relative_pathing}" />
<property name="file.key.name.public" value="${dirs.build}${path.separator}public.${project.name}.snk" overwrite="false" />
<property name="file.custom.step.before" value="${dirs.build_scripts_custom}${path.separator}${file.current.no_extension}.pre.step" />
<property name="file.custom.step.after" value="${dirs.build_scripts_custom}${path.separator}${file.current.no_extension}.post.step" />
<property name="file.custom.step.replace" value="${dirs.build_scripts_custom}${path.separator}${file.current.no_extension}.replace.step" />
<property name="is.replaced" value="false" />
<property name="fail.build.on.error" value="true" />
<target name="go" depends="run_tasks" />
<target name="run_tasks">
<echo message="Running ${project::get-name()} tasks." />
<call target="prepare" if="${target::exists('prepare')}" />
<call target="custom_tasks_before" if="${target::exists('custom_tasks_before')}" />
<call target="custom_tasks_replace" if="${target::exists('custom_tasks_replace')}" />
<call target="run_normal_tasks" if="${not is.replaced}" />
<call target="custom_tasks_after" if="${target::exists('custom_tasks_after')}" />
</target>
<target name="run_normal_tasks"
depends="error_check, determine_language, generate_key_file, generate_assembly_info"
description="Generating Assembly File." />
<target name="custom_tasks_before">
<echo message="Running custom tasks if ${file.custom.step.before} exists." />
<nant buildfile="${file.custom.step.before}" inheritall="true" if="${file::exists(file.custom.step.before)}" failonerror="${fail.build.on.error}" />
<exec program="powershell.exe" if="${file::exists(file.custom.step.before + '.ps1')}" failonerror="${fail.build.on.error}">
<arg value="${path::get-full-path(file.custom.step.before + '.ps1')}" />
</exec>
<exec program="ruby.exe" if="${file::exists(file.custom.step.before + '.rb')}" failonerror="${fail.build.on.error}">
<arg value="${path::get-full-path(file.custom.step.before + '.rb')}" />
</exec>
</target>
<target name="custom_tasks_replace">
<echo message="Running custom tasks instead of normal tasks if ${file.custom.step.replace} exists." />
<property name="is.replaced" value="true" if="${file::exists(file.custom.step.replace)}" />
<nant buildfile="${file.custom.step.replace}" inheritall="true" if="${file::exists(file.custom.step.replace)}" failonerror="${fail.build.on.error}" />
<property name="is.replaced" value="true" if="${file::exists(file.custom.step.replace + '.ps1')}" />
<exec program="powershell.exe" if="${file::exists(file.custom.step.replace + '.ps1')}" failonerror="${fail.build.on.error}" >
<arg value="${path::get-full-path(file.custom.step.replace + '.ps1')}" />
</exec>
<property name="is.replaced" value="true" if="${file::exists(file.custom.step.replace + '.rb')}" />
<exec program="ruby.exe" if="${file::exists(file.custom.step.replace + '.rb')}" failonerror="${fail.build.on.error}" >
<arg value="${path::get-full-path(file.custom.step.replace + '.rb')}" />
</exec>
</target>
<target name="error_check">
<fail message="You must fill out the project.name, repository.path, and company.name settings in the settings${path.separator}UppercuT.config file. Please do that and retry the build."
if="${project.name=='__SOLUTION_NAME_WITHOUT_SLN_EXTENSION__' or company.name=='__COMPANY_NAME__'}" />
</target>
<target name="generate_key_file" description="Generates a .snk using the sn.exe tool if none exists and strong naming is specified" if="${sign.project_with_key}">
<echo message="Generating a strong name key (${file.key.name.private}) using ${app.strongname} if the key file doesn't already exist." />
<exec
program="${app.strongname}"
commandline="-k ${file.key.name.private}"
if="${file::exists(app.strongname) and not file::exists(file.key.name.private)}"
/>
<exec
program="${app.strongname}"
commandline="-p ${file.key.name.private} ${file.key.name.public}"
if="${file::exists(app.strongname)}"
/>
</target>
<target name="determine_language">
<if test="${language.short=='vb'}">
<property name="language.long" value="VB" />
</if>
</target>
<target name="generate_assembly_info" description="Generate assembly info">
<property name="version.assembly" value="${version.major}.${version.minor}.${version.build}.${version.revision}" />
<property name="version.assembly" value="${version.major}.${version.minor}.${version.patch}.0" if="${version.use_semanticversioning}" />
<echo message="Generating SolutionVersion.${language.short} with assembly version ${version.assembly}." />
<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}" />
<property name="version.product" value="${version.major}.${version.minor}.${version.build}.${version.hash}" />
<property name="version.product" value="${version.major}.${version.minor}.${version.patch}.${version.hash}" if="${version.use_semanticversioning}" />
<asminfo output="${path.file.version}" language="${language.long}">
<imports>
<import namespace="System" />
<import namespace="System.Reflection" />
<import namespace="System.Runtime.InteropServices" />
<import namespace="System.Security" />
</imports>
<attributes>
<attribute type="ComVisibleAttribute" value="false" />
<attribute type="CLSCompliantAttribute" value="${assembly.clscompliant}" />
<attribute type="AssemblyCompanyAttribute" value="${company.name}" />
<attribute type="AssemblyVersionAttribute" value="${version.assembly}" />
<attribute type="AssemblyFileVersionAttribute" value="${version.file}" />
<attribute type="AssemblyInformationalVersionAttribute" value="${version.product}" />
<attribute type="AssemblyTitleAttribute" value="${project.name}" />
<attribute type="AssemblyProductAttribute" value="${project.name}" />
<attribute type="AssemblyDescriptionAttribute" value="${assembly.description}" />
<attribute type="AssemblyTrademarkAttribute" value="${project.name} - ${company.name}" />
<attribute type="AssemblyCopyrightAttribute" value="Copyright ${datetime::get-year(datetime::now())} ${company.name}, - Original author or authors" />
<attribute type="AllowPartiallyTrustedCallers" if="${allow.partially_trusted_callers}" asis="true" />
<attribute type="AssemblyKeyFileAttribute" value="${file.key.name.private}" if="${sign.project_with_key and not sign.key.use_relative_pathing}" />
<attribute type="AssemblyKeyFileAttribute" value="${sign.key.relative_path_from_projects}${path.separator}${path::get-file-name(file.key.name.private)}" if="${sign.project_with_key and sign.key.use_relative_pathing}" />
</attributes>
</asminfo>
</target>
<target name="custom_tasks_after">
<echo message="Running custom tasks if ${file.custom.step.after} exists." />
<nant buildfile="${file.custom.step.after}" inheritall="true" if="${file::exists(file.custom.step.after)}" failonerror="${fail.build.on.error}" />
<exec program="powershell.exe" if="${file::exists(file.custom.step.after + '.ps1')}" failonerror="${fail.build.on.error}" >
<arg value="${path::get-full-path(file.custom.step.after + '.ps1')}" />
</exec>
<exec program="ruby.exe" if="${file::exists(file.custom.step.after + '.rb')}" failonerror="${fail.build.on.error}" >
<arg value="${path::get-full-path(file.custom.step.after + '.rb')}" />
</exec>
</target>
</project>