-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathBuild.xml
90 lines (83 loc) · 5.02 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
<?xml version="1.0" ?>
<project name="environment" 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 name="workspace" value="${basedir}"/>
<property name="workspace.release" value="${basedir}/release"/>
<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="0000" 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>
<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="platform" antfile="build.xml" target="release"
useNativeBasedir="false" inheritAll="false" inheritrefs="false"/>
<delete dir="${workspace.release}"/>
<mkdir dir="${workspace.release}"/>
<copy todir="${workspace.release}">
<fileset dir="./launcher/Release"/>
<fileset dir="./platform/Release"/>
<fileset dir="./startup/Release"/>
</copy>
<replaceregexp file="${workspace}/README.md"
match="(Seanox Virtual Environment )\d+(\.\d+)*" flags="g" byline="false"
replace="\1${release.version}"/>
<replaceregexp file="${workspace}/README.md"
match="(seanox-platform-)\d+(?:\.\d+)*((?:-update)*\.zip)" flags="g" byline="false"
replace="\1${release.version}\2"/>
<replaceregexp file="${workspace}/README.md"
match="(https://github.com/seanox/virtual-environment/releases/download/)\d+(?:\.\d+)*" flags="g" byline="false"
replace="\1${release.version}"/>
</target>
</project>