Use build number as context qualifier for Eclipse plugins

Change-Id: I22b5c0127c7534dadcb6f0c6f7543ba64592b420
diff --git a/eclipse/build.gradle b/eclipse/build.gradle
index 46405a9..8671690 100644
--- a/eclipse/build.gradle
+++ b/eclipse/build.gradle
@@ -29,6 +29,11 @@
             "pde"     : new File(eclipseBuildDeps, "pde/org.eclipse.pde-3.8.zip"),
             "egit"    : new File(eclipseBuildDeps, "egit/org.eclipse.egit.repository-2.2.0.201212191850-r.zip"),
     ]
+
+    buildNumber = System.getenv("BUILD_NUMBER")
+    if (buildNumber == null) {
+        buildNumber = "SNAPSHOT"
+    }
 }
 
 // a mapping from the library names as used inside the plugin's MANIFEST.MF to the Maven artifact id
@@ -141,7 +146,7 @@
     def androidOut = new File(projectDir, "../../out").getCanonicalPath()
     environment("M2_HOME", maven.getParentFile().getParentFile().getCanonicalPath())
     workingDir projectDir
-    commandLine maven.getCanonicalPath(), "-s", "settings.xml", "-DforceContextQualifier=M01", "-DANDROID_OUT=$androidOut", "package"
+    commandLine maven.getCanonicalPath(), "-s", "settings.xml", "-DforceContextQualifier=$project.buildNumber", "-DANDROID_OUT=$androidOut", "package"
 }
 
 private File getArtifact(ResolvedDependency dependency) {
diff --git a/eclipse/scripts/build_adt.sh b/eclipse/scripts/build_adt.sh
index d668aad..0e0f161 100755
--- a/eclipse/scripts/build_adt.sh
+++ b/eclipse/scripts/build_adt.sh
@@ -43,7 +43,7 @@
 
 # 3. Launch Tycho build
 echo Launching Tycho to build ADT plugins and bundle
-./tools/gradlew -i -b sdk/eclipse/build.gradle --no-daemon buildEclipse
+( set -x ; BUILD_NUMBER="$BNUM" ./tools/gradlew -i -b sdk/eclipse/build.gradle --no-daemon buildEclipse)
 
 echo Copying ADT plugins and bundle into destination folder
 cd "$ANDROID_SRC"