-
Notifications
You must be signed in to change notification settings - Fork 0
/
increment_versions.ant
168 lines (145 loc) · 6.18 KB
/
increment_versions.ant
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
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="IncrementVersionsTask" basedir="." default="set-version">
<!-- IMPORTANT: Make sure this points to the root folder of your project -->
<property name="WORKSPACE" location="${ant.file}/../../../../" />
<!--
IMPORTANT: this will update the first occurrence of <version> in POMs,
so if one of your POM inherits from an external parent with an unrelated number
make sure the <parent> part comes after the <version> part of the POM
you want to update. For example,
<groupId>your group id</groupId>
<artifactId>your artifact id</artifactId>
<version>the version you want to update</version>
<parent>
<groupId>external parent group id</groupId>
<artifactId>external parent artifact id</artifactId>
<version>external parent version that must not be updated</version>
</parent>
-->
<!--Set these properties manually when increasing versions -->
<property name="version.major" value="1" />
<property name="version.minor" value="17" />
<property name="version.patch" value="0" />
<!-- Compute the version properties -->
<property name="version.main" value="${version.major}.${version.minor}.${version.patch}" />
<property name="majorMinorVersion" value="${version.major}.${version.minor}" />
<target name="show-workspace-path">
<echo message="WORKSPACE: ${WORKSPACE}" />
</target>
<target name="set-version" description="Modifies artifacts to set a release version" >
<property name="version.osgi" value="${version.main}.qualifier"/>
<property name="version.mvn" value="${version.main}-SNAPSHOT"/>
<propertyfile file="release.properties" comment="Build version">
<entry key="version_main" value="${version.main}" />
<entry key="version_osgi" value="${version.osgi}" />
<entry key="version_mvn" value="${version.mvn}" />
<entry key="majorMinorVersion" value="${majorMinorVersion}" />
</propertyfile>
<antcall target="-modify-artifacts"/>
</target>
<!-- strip the -SNAPSHOT from the property project.version -->
<target name="set-version-release" description="Modifies artifacts to set a release version (without -SNAPSHOT)" >
<property name="version.osgi" value="${version.main}"/>
<property name="version.mvn" value="${version.main}"/>
<echo message="VERSION MAIN: ${version.main}" />
<echo message="VERSION OSGI: ${version.osgi}" />
<echo message="VERSION MVN : ${version.mvn}" />
<echo message="WORKSPACE : ${WORKSPACE}" />
<echo message="" />
<antcall target="-modify-artifacts"/>
</target>
<target name="bump-timestamps" >
<tstamp/>
<replaceregexp>
<regexp pattern=".*" />
<substitution expression="${DSTAMP}-${TSTAMP}" />
<fileset id="path.timestamp" dir="${WORKSPACE}">
<include name="**/timestamp" />
</fileset>
</replaceregexp>
</target>
<target name="-modify-artifacts" if="version.main" >
<echo message="VERSION MAIN: ${version.main}" />
<echo message="VERSION OSGI: ${version.osgi}" />
<echo message="VERSION MVN : ${version.mvn}" />
<echo message="major.minor : ${majorMinorVersion}" />
<echo message="WORKSPACE : ${WORKSPACE}" />
<echo message="" />
<!-- pom.xml -->
<replaceregexp>
<regexp pattern="<version>(.*)</version>" />
<substitution expression="<version>${version.mvn}</version>" />
<fileset id="path.pom" dir="${WORKSPACE}">
<include name="**/pom.xml" />
<exclude name="**/target/**" />
</fileset>
</replaceregexp>
<replaceregexp>
<regexp pattern="<p2\.versionMajorMinor>(.*)</p2\.versionMajorMinor>" />
<substitution expression="<p2\.versionMajorMinor>${majorMinorVersion}</p2\.versionMajorMinor>" />
<fileset id="path.pom" dir="${WORKSPACE}">
<include name="**/pom.xml" />
<exclude name="**/target/**" />
</fileset>
</replaceregexp>
<!-- category.xml if major.minor is mentioned -->
<replaceregexp flags="g" byline="true">
<regexp pattern="label="(\w+)(\s+)(\d+\.\d+)(\.x)" />
<substitution expression="label="\1\2${majorMinorVersion}\4" />
<fileset id="path.pom" dir="${WORKSPACE}">
<include name="**/category.xml" />
<exclude name="**/target/**" />
</fileset>
</replaceregexp>
<!-- MANIFEST.MF -->
<replaceregexp>
<regexp pattern="Bundle-Version: .*" />
<substitution expression="Bundle-Version: ${version.osgi}" />
<fileset id="path.manifest" dir="${WORKSPACE}">
<include name="**/META-INF/MANIFEST.MF" />
<exclude name="buildroot/**" />
<exclude name="examples/org.eclipse.emf.examples.library*/**" />
</fileset>
</replaceregexp>
<!-- feature.xml -->
<replaceregexp>
<regexp pattern="(\s\s+)version=".*"" />
<substitution expression="\1version="${version.osgi}"" />
<fileset id="path.feature" dir="${WORKSPACE}">
<include name="**/feature.xml" />
<exclude name="buildroot/**" />
</fileset>
</replaceregexp>
<!-- .product -->
<replaceregexp>
<regexp pattern="version=".*qualifier"" />
<substitution expression="version="${version.osgi}"" />
<fileset id="path.feature" dir="${WORKSPACE}">
<include name="**/*.product" />
<exclude name="buildroot/**" />
</fileset>
</replaceregexp>
</target>
<target name="set-version-xtext" description="Sets the Xtext version constraints in MANIFEST.MF">
<!-- Read the last entered values for defaults -->
<property file="version.properties" />
<input message="Please enter the new Xtext version:" addproperty="version.xtext" defaultvalue="${version_xtext}" />
<!-- MANIFEST.MF -->
<replaceregexp>
<regexp pattern='org\.eclipse\.xtext;bundle-version=".*\"(.*)' />
<substitution expression='org.eclipse.xtext;bundle-version="${version.xtext}"\1' />
<fileset id="path.manifest" dir="${WORKSPACE}">
<include name="**/META-INF/MANIFEST.MF" />
<exclude name="**/target/**" />
</fileset>
</replaceregexp>
<replaceregexp>
<regexp pattern='org\.eclipse\.xtext\.(?!example)(.*);bundle-version=".*\"(.*)' />
<substitution expression='org.eclipse.xtext.\1;bundle-version="${version.xtext}"\2' />
<fileset id="path.manifest" dir="${WORKSPACE}">
<include name="**/META-INF/MANIFEST.MF" />
<exclude name="**/target/**" />
</fileset>
</replaceregexp>
</target>
</project>