Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed need for lib.major and lib.minor in build.properties by parsi…

…ng lib.version with propertyregexp from ant-contrib
  • Loading branch information...
commit 44f0c1fcfc3cc0376afb0f2a60dd7e04c6e8521f 1 parent c8b1048
@jyemin jyemin authored
View
12 build.properties
@@ -16,16 +16,4 @@
javac.source=1.5
-#
-# The major and minor values must also be updated.
-#
-# They are here to replace the need modify Mongo.java when the version changes.
-#
-# If anyone wants to parse lib.version in ant, please do :-)
-#
-
lib.version=2.8.0.BUILD-SNAPSHOT
-
-lib.major=2
-
-lib.minor=8
View
21 build.xml
@@ -17,6 +17,13 @@ limitations under the License.
-->
<project name="MongoDB Java Driver" default="compile" basedir=".">
+
+ <taskdef resource="net/sf/antcontrib/antcontrib.properties">
+ <classpath>
+ <pathelement location="lib/ant-contrib-1.0b3.jar"/>
+ </classpath>
+ </taskdef>
+
<property environment="env"/>
<property file="build.properties" prefix="build.conf"/>
@@ -84,8 +91,18 @@ limitations under the License.
<target name="compile" depends="init">
- <replaceregexp file="src/main/com/mongodb/Mongo.java" match="\sMAJOR_VERSION\s=\s\d+;" replace=" MAJOR_VERSION = ${build.conf.lib.major};" byline="false"/>
- <replaceregexp file="src/main/com/mongodb/Mongo.java" match="\sINOR_VERSION\s=\s\d+;" replace=" MINOR_VERSION = ${build.conf.lib.minor};" byline="false"/>
+ <propertyregex property="lib.major"
+ input="${build.conf.lib.version}"
+ regexp="(\d+)\.(\d+)\.(\d+)"
+ select="\1" />
+
+ <propertyregex property="lib.minor"
+ input="${build.conf.lib.version}"
+ regexp="(\d+)\.(\d+)\.(\d+)"
+ select="\2" />
+
+ <replaceregexp file="src/main/com/mongodb/Mongo.java" match="\sMAJOR_VERSION\s=\s\d+;" replace=" MAJOR_VERSION = ${lib.major};" byline="false"/>
+ <replaceregexp file="src/main/com/mongodb/Mongo.java" match="\sMINOR_VERSION\s=\s\d+;" replace=" MINOR_VERSION = ${lib.minor};" byline="false"/>
<javac
srcdir="src/main"
View
BIN  lib/ant-contrib-1.0b3.jar
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.