-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathBuild.xml
More file actions
165 lines (153 loc) · 9.13 KB
/
Copy pathBuild.xml
File metadata and controls
165 lines (153 loc) · 9.13 KB
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
<?xml version="1.0" ?>
<project name="launcher" 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"/>
<property name="workspace.target" value="${basedir}/Target"/>
<property name="workspace.target.release" value="${workspace.target}/bin/Release"/>
<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="(Version\s*)\d+(?:\.\d+)+ \d+" replace="\1${release.info.version} ${release.info.date}">
<fileset dir="${workspace}" includes="${workspace.sources.filter}"/>
</replaceregexp>
<replaceregexp match="(AssemblyCopyright\(".*?\s)\d{4}(\s.*?"\))" replace="\1${release.info.year}\2">
<fileset dir="${workspace}" includes="${workspace.sources.filter}"/>
</replaceregexp>
<replaceregexp match="(AssemblyVersion\(")\d+(?:\.\d)+("\))" replace="\1${release.info.version}\2">
<fileset dir="${workspace}" includes="${workspace.sources.filter}"/>
</replaceregexp>
<replaceregexp match="(AssemblyFileVersion\(")\d+(?:\.\d)+("\))" replace="\1${release.info.version}\2">
<fileset dir="${workspace}" includes="${workspace.sources.filter}"/>
</replaceregexp>
<replaceregexp match="(AssemblyMetadata\("Build",\s*")\d+("\))" replace="\1${release.info.date}\2">
<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">
<release-info-locate/>
<release-info-insert/>
<replaceregexp match="(Copyright\s+[\x21-\x7E]+)\s+\d+" replace="\1 ${release.year}">
<fileset dir="${workspace}" includes="**/*.cs"/>
</replaceregexp>
<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 includeemptydirs="true">
<fileset casesensitive="false" dir="${workspace.target.release}" excludes="${ant.project.name}.exe"/>
</delete>
<copy todir="${workspace.target.release}" file="CHANGES"/>
<copy todir="${workspace.target.release}" file="LICENSE"/>
<copy todir="${workspace.target.release}" file="README.md"/>
<copy tofile="${workspace.target.release}/${ant.project.name}.xml" file="${workspace}/Sources/Settings.xml"/>
<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>
<delete dir="${workspace.release}"/>
<mkdir dir="${workspace.release}"/>
<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"/>
<copy file="${workspace.target.release}/${ant.project.name}.exe" overwrite="true"
todir="../platform/Resources/platform/Programs/Platform"/>
<release-info-reset/>
</target>
</project>