-
Notifications
You must be signed in to change notification settings - Fork 25
/
Build.xml
198 lines (181 loc) · 10.8 KB
/
Build.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
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
<?xml version="1.0" ?>
<project name="platform" default="usage" basedir=".">
<target name="usage">
<echo>Following targets are available: </echo>
<echo> </echo>
<echo> changes Synchronizes README.md with CHANGES </echo>
<echo> </echo>
<echo> release Builds the complete release </echo>
<echo> Synchronizes the version in README.md </echo>
</target>
<property environment="env"/>
<property name="workspace" value="${basedir}"/>
<property name="workspace.sources.filter" value="**/*.cs,**/*.resx,**/*.csproj,**/*.sln,**/*.manifest,**/*.ini"/>
<property name="workspace.target" value="${basedir}/Target"/>
<property name="workspace.target.release" value="${workspace.target}/bin/Release"/>
<property name="workspace.target.update" value="${workspace.target}/bin/Update"/>
<property name="workspace.release" value="${basedir}/Release"/>
<property name="workspace.build.tool" value="${env.APPSPATH}/Rider/tools/MSBuild/Current/Bin/MSBuild.exe"/>
<macrodef name="release-info-locate">
<sequential>
<copy file="${workspace}/CHANGES" tofile="${workspace}/CHANGES.tmp" overwrite="true"/>
<replaceregexp file="${workspace}/CHANGES.tmp"
match="(?s)^\s*([\d\.x]+) (\d{4})([\dx]+).*$" flags="g" byline="false"
replace="release.version=\1
release.year=\2
release.date=\2\3
"/>
<replaceregexp file="${workspace}/CHANGES.tmp" match="x" replace="0" flags="g" byline="false"/>
<loadproperties srcfile="${workspace}/CHANGES.tmp"/>
<delete file="${workspace}/CHANGES.tmp"/>
<echo file="${workspace}/CHANGES.tmp" message="release.major=${release.version}"/>
<replaceregexp file="${workspace}/CHANGES.tmp"
match="(?<=\d+)\." byline="true" replace="
release.minor="/>
<replaceregexp file="${workspace}/CHANGES.tmp"
match="(?<=\d+)\." byline="true" replace="
release.patch="/>
<loadproperties srcfile="${workspace}/CHANGES.tmp"/>
<delete file="${workspace}/CHANGES.tmp"/>
</sequential>
</macrodef>
<macrodef name="release-info-insert">
<attribute name="version" default="${release.version} ${release.date}"/>
<sequential>
<echo file="release-info.tmp" message="@{version}"/>
<replaceregexp file="release-info.tmp" match="[^\d\.\s]" replace="0" flags="g"/>
<replaceregexp file="release-info.tmp" match="^([^\s]+)\s+(\d{4})(\d{4})"
replace="release.info.version=\1
release.info.year=\2
release.info.date=\2\3
"/>
<local name="release.info.version"/>
<local name="release.info.year"/>
<local name="release.info.date"/>
<loadproperties srcfile="release-info.tmp"/>
<delete file="release-info.tmp"/>
<replaceregexp match="(?<!//\s)(Copyright\s+[^\s]+)\s+\d+" replace="\1 ${release.info.year}">
<fileset dir="${workspace}" includes="${workspace.sources.filter}"/>
</replaceregexp>
<replaceregexp match="(Version) \d+(?:\.\d+)+ \d+" replace="\1 ${release.info.version} ${release.info.date}">
<fileset dir="${workspace}" includes="${workspace.sources.filter}"/>
</replaceregexp>
<replaceregexp match="(AssemblyVersion)\("\d+(?:\.\d)+"\)" replace="\1("${release.info.version}")">
<fileset dir="${workspace}" includes="${workspace.sources.filter}"/>
</replaceregexp>
<replaceregexp match="(AssemblyFileVersion)\("\d+(?:\.\d)+"\)" replace="\1("${release.info.version}")">
<fileset dir="${workspace}" includes="${workspace.sources.filter}"/>
</replaceregexp>
<replaceregexp match="(<assemblyIdentity version=")\d+(?:\.\d+)+(")" replace="\1${release.info.version}.0\2">
<fileset dir="${workspace}" includes="${workspace.sources.filter}"/>
</replaceregexp>
<replaceregexp match="\[\d[\.\d]+\s+\d{8}\]" replace="[${release.info.version} ${release.info.date}]">
<fileset dir="${workspace}" includes="${workspace.sources.filter}"/>
</replaceregexp>
</sequential>
</macrodef>
<macrodef name="release-info-reset">
<sequential>
<release-info-insert version="0.0.0 00000000"/>
</sequential>
</macrodef>
<target name="changes">
<release-info-locate/>
<replaceregexp file="${workspace}/CHANGES" match="ä" replace="ae" flags="g"/>
<replaceregexp file="${workspace}/CHANGES" match="Ä" replace="Ae" flags="g"/>
<replaceregexp file="${workspace}/CHANGES" match="ö" replace="oe" flags="g"/>
<replaceregexp file="${workspace}/CHANGES" match="Ö" replace="Oe" flags="g"/>
<replaceregexp file="${workspace}/CHANGES" match="ü" replace="ue" flags="g"/>
<replaceregexp file="${workspace}/CHANGES" match="Ü" replace="Ue" flags="g"/>
<replaceregexp file="${workspace}/CHANGES" match="\s+$" replace="" flags="g" byline="true"/>
<copy file="${workspace}/CHANGES" tofile="${workspace}/CHANGES.tmp" overwrite="true"/>
<replaceregexp file="${workspace}/CHANGES.tmp" match="^\s+" replace="" byline="false"/>
<replaceregexp file="${workspace}/CHANGES.tmp" match="(?s)^(.*?)[\r\n]+\d[\d\. x]+.*$" replace="\1" byline="false"/>
<replaceregexp file="${workspace}/CHANGES.tmp" match="^(.*?)\s*$" replace="\1 " flags="g" byline="true"/>
<replaceregexp file="${workspace}/CHANGES.tmp" match="^(\d[\.\d x]+)[^\r\n]*" replace="## \1" byline="false"/>
<replaceregexp file="${workspace}/CHANGES.tmp" match="^ {0,4}([A-Z]+:.*)\s*$" replace="\1" byline="true"/>
<replaceregexp file="${workspace}/CHANGES.tmp" match="(?s)[\r\n]+ [^\r\n]+" replace="" flags="g" byline="false"/>
<replaceregexp file="${workspace}/CHANGES.tmp" match="^(## \d[\.\d]+ \d+)( )" replace="\1\2" flags="g" byline="true"/>
<replaceregexp file="${workspace}/CHANGES.tmp" match="^(## \d[\.\d]+ \d+x+)( )" replace="\1 (upcoming version)\2" flags="g" byline="true"/>
<loadresource property="changes">
<file file="${workspace}/CHANGES.tmp"/>
</loadresource>
<delete file="${workspace}/CHANGES.tmp"/>
<replaceregexp file="${workspace}/README.md"
match="(?si)(# Changes\s+).*?(\[Read more\])" flags="g" byline="false"
replace="\1${changes}${line.separator}${line.separator}\2"/>
<tstamp>
<format property="now.year" pattern="yyyy"/>
</tstamp>
<replaceregexp file="${workspace}/README.md"
match="(?si)(?<=\(C\)\s)\d{4}\b" flags="g" byline="true"
replace="${now.year}"/>
</target>
<target name="release" depends="changes">
<ant dir="..\launcher" antfile="build.xml" target="release"
useNativeBasedir="false" inheritAll="false" inheritrefs="false"/>
<ant dir="..\startup" antfile="build.xml" target="release"
useNativeBasedir="false" inheritAll="false" inheritrefs="false"/>
<release-info-locate/>
<release-info-insert/>
<delete dir="${workspace.target.release}"/>
<mkdir dir="${workspace.target.release}"/>
<exec executable="${workspace.build.tool}" dir="${workspace}" resultproperty="workspace.build.exit.code"
output="${workspace.target.release}/output.log" error="${workspace.target.release}/error.log">
<arg line="${ant.project.name}.sln /t:Clean,Build /P:Configuration=Release"/>
</exec>
<fail message="Build failed with exit code ${workspace.build.exit.code}
${line.separator}	For more details see in the log files:
${line.separator}${workspace.target.release}/output.log
${line.separator}${workspace.target.release}/error.log">
<condition>
<not>
<equals arg1="${workspace.build.exit.code}" arg2="0"/>
</not>
</condition>
</fail>
<delete dir="${workspace.release}"/>
<mkdir dir="${workspace.release}"/>
<copy todir="${workspace.target.release}" file="CHANGES"/>
<copy todir="${workspace.target.release}" file="LICENSE"/>
<copy todir="${workspace.target.release}" file="README.md"/>
<copy todir="${workspace.target.release}" file="${workspace}/Resources/platform/Resources/manual.txt"/>
<exec executable="cmd" dir="${workspace.target.release}">
<arg line="/C ren ${ant.project.name}.* ${ant.project.name}.*"/>
</exec>
<touch datetime="${release.date}" pattern="yyyyMMdd">
<fileset dir="${workspace.target.release}"/>
</touch>
<mkdir dir="${workspace.release}"/>
<delete file="${workspace.release}/seanox-${ant.project.name}-${release.version}.zip"/>
<zip destfile="${workspace.release}/seanox-${ant.project.name}-${release.version}.zip"
basedir="${workspace.target.release}" compress="true" level="9" filesonly="true"
excludes="*.log,*.pdb"/>
<touch datetime="${release.date}" pattern="yyyyMMdd" file="${workspace.release}/seanox-${ant.project.name}-${release.version}.zip"/>
<delete dir="${workspace.target.update}"/>
<mkdir dir="${workspace.target.update}"/>
<copy file="${workspace.target.release}/${ant.project.name}.exe"
tofile="${workspace.target.update}/${ant.project.name}.exe_${release.version}"/>
<copy file="${workspace}/Resources/settings.ini"
tofile="${workspace.target.update}/${ant.project.name}.ini_${release.version}"/>
<copy todir="${workspace.target.update}">
<fileset casesensitive="false" dir="${workspace}/Resources/platform" includes="**"/>
<regexpmapper from="(.*\..*)" to="\1_${release.version}"/>
</copy>
<echo file="${workspace.target.update}/readme.txt_${release.version}">
The update is intended to help with the manual update of an existing
environment. It contains all new file structures and files. The updated files
end with the version number so that no existing files are overwritten.
Recommended Approach
----
- Attach virtual disk manually
- Unpack the update to the root directory of the virtual disk
- Check all new files (with the version number in the file extension)
- Activate what you need, delete what you don't need
- Merge the changes if necessary in the configuration files and scripts
- Replace the platform.exe outside of the virtual disk
- Detach virtual disk manually
That's it...
</echo>
<touch datetime="${release.date}" pattern="yyyyMMdd">
<fileset dir="${workspace.target.update}" includes="**"/>
</touch>
<delete file="${workspace.release}/seanox-${ant.project.name}-${release.version}-update.zip"/>
<zip destfile="${workspace.release}/seanox-${ant.project.name}-${release.version}-update.zip"
basedir="${workspace.target.update}" compress="true" level="9" filesonly="true"/>
<touch datetime="${release.date}" pattern="yyyyMMdd" file="${workspace.release}/seanox-${ant.project.name}-${release.version}-update.zip"/>
<release-info-reset/>
</target>
</project>