Update change-version.py to handle build.gradle, and clean it up
This commit is contained in:
parent
c40c7e34f0
commit
5d7b4d5988
|
@ -5,6 +5,10 @@
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
def runAndPrint(cmd):
|
||||||
|
print cmd
|
||||||
|
subprocess.check_output(cmd, shell=True)
|
||||||
|
|
||||||
oldVersion = sys.argv[1]
|
oldVersion = sys.argv[1]
|
||||||
newVersion = sys.argv[2]
|
newVersion = sys.argv[2]
|
||||||
|
|
||||||
|
@ -13,13 +17,11 @@ print oldVersion + " --> " + newVersion
|
||||||
oldVersion = oldVersion.replace(".", "\.")
|
oldVersion = oldVersion.replace(".", "\.")
|
||||||
newVersion = newVersion.replace(".", "\.")
|
newVersion = newVersion.replace(".", "\.")
|
||||||
|
|
||||||
cleanCmd = "mvn clean -q"
|
runAndPrint("mvn clean -q")
|
||||||
print cleanCmd
|
|
||||||
subprocess.check_output(cleanCmd, shell=True)
|
|
||||||
|
|
||||||
xmlCmd = "find -E ./ -regex \".*(pom|mvncentral)\.xml\" | xargs -n 1 perl -pi -e \'s/" + oldVersion + "/" + newVersion + "/g\'"
|
runAndPrint("find -E ./ -regex \".*(pom|mvncentral)\.xml\" | xargs -n 1 perl -pi -e \'s/" + oldVersion + "/" + newVersion + "/g\'")
|
||||||
print xmlCmd
|
|
||||||
subprocess.check_output(xmlCmd, shell=True)
|
runAndPrint("perl -pi -e \'s/" + oldVersion + "/" + newVersion + "/g\' build.gradle")
|
||||||
|
|
||||||
oldIsSnapshot = oldVersion.endswith("SNAPSHOT")
|
oldIsSnapshot = oldVersion.endswith("SNAPSHOT")
|
||||||
newIsSnapShot = newVersion.endswith("SNAPSHOT")
|
newIsSnapShot = newVersion.endswith("SNAPSHOT")
|
||||||
|
@ -27,10 +29,7 @@ newIsSnapShot = newVersion.endswith("SNAPSHOT")
|
||||||
bundleOld = oldVersion if not oldIsSnapshot else oldVersion.replace("-SNAPSHOT","\.qualifier")
|
bundleOld = oldVersion if not oldIsSnapshot else oldVersion.replace("-SNAPSHOT","\.qualifier")
|
||||||
bundleNew = newVersion if not newIsSnapShot else newVersion.replace("-SNAPSHOT","\.qualifier")
|
bundleNew = newVersion if not newIsSnapShot else newVersion.replace("-SNAPSHOT","\.qualifier")
|
||||||
|
|
||||||
otherCmd = "find -E ./ -regex \".*(MANIFEST\.MF|feature\.xml)\" | xargs -n 1 perl -pi -e \'s/" + bundleOld + "/" + bundleNew + "/g\'"
|
runAndPrint("find -E ./ -regex \".*(MANIFEST\.MF|feature\.xml)\" | xargs -n 1 perl -pi -e \'s/" + bundleOld + "/" + bundleNew + "/g\'")
|
||||||
|
|
||||||
print otherCmd
|
|
||||||
subprocess.check_output(otherCmd, shell=True)
|
|
||||||
|
|
||||||
print "done"
|
print "done"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue