| 1 | ############################################################################### |
| 2 | # Copyright (c) 2016 Ericsson |
| 3 | # |
| 4 | # All rights reserved. This program and the accompanying materials |
| 5 | # are made available under the terms of the Eclipse Public License v1.0 |
| 6 | # which accompanies this distribution, and is available at |
| 7 | # http://www.eclipse.org/legal/epl-v10.html |
| 8 | ############################################################################### |
| 9 | |
| 10 | #args: filename oldversion newversion |
| 11 | |
| 12 | #Update root pom.xml versions. For example |
| 13 | # <artifactId>org.eclipse.tracecompass</artifactId> |
| 14 | #- <version>2.0.0-SNAPSHOT</version> |
| 15 | #+ <version>2.0.1-SNAPSHOT</version> |
| 16 | # |
| 17 | # Also the target plarform: |
| 18 | # |
| 19 | # <classifier>${target-platform}</classifier> |
| 20 | #- <version>2.0.0-SNAPSHOT</version> |
| 21 | #+ <version>2.0.1-SNAPSHOT</version> |
| 22 | # </artifact> |
| 23 | |
| 24 | import sys, re |
| 25 | fileContent = open(sys.argv[1]).read() |
| 26 | fileContent = re.sub("(<artifactId>org.eclipse.tracecompass.*</artifactId>\n\s+)<version>" + sys.argv[2] + "-SNAPSHOT</version>", "\g<1><version>" + sys.argv[3] + "-SNAPSHOT</version>", fileContent) |
| 27 | # Also the target platform version being used |
| 28 | fileContent = re.sub("<version>" + sys.argv[2] + "-SNAPSHOT</version>(\n\s+</artifact>)", "<version>" + sys.argv[3] + "-SNAPSHOT</version>\g<1>", fileContent) |
| 29 | open(sys.argv[1], "w").write(fileContent) |