Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Changes ONOS version in POM files, and other release artifacts. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
Brian O'Connor | f5d9363 | 2015-09-04 20:18:31 -0700 | [diff] [blame] | 6 | set -e |
| 7 | |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 8 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 9 | . $ONOS_ROOT/tools/build/envDefaults |
| 10 | |
| 11 | export NEW_VERSION=$1 |
| 12 | [ -z "$NEW_VERSION" ] && echo "New ONOS version not specified" && exit 1 |
| 13 | |
| 14 | export NEW_VERSION_SHORT=${NEW_VERSION%-SNAPSHOT} |
| 15 | |
| 16 | cd $ONOS_ROOT |
| 17 | |
| 18 | # Augment the version of the main pom and the modules nested underneath. |
| 19 | mvn versions:set -DnewVersion=$NEW_VERSION versions:commit |
Thomas Vachuska | 2dec354 | 2016-06-01 17:46:14 -0700 | [diff] [blame] | 20 | mvn -f lib/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit |
| 21 | sed -i "" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" pom.xml |
Ray Milkey | 924c0e3 | 2016-11-18 13:47:14 -0800 | [diff] [blame] | 22 | sed -i "" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" drivers/bti/pom.xml |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 23 | |
| 24 | # Augment the version of the Java API pom files and the overview.html file. |
Brian O'Connor | 84e523c | 2015-09-04 20:21:36 -0700 | [diff] [blame] | 25 | for pom in docs/internal.xml docs/external.xml; do |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 26 | sed -i "" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" $pom |
| 27 | sed -i "" -E "1,/<doctitle>/s/<doctitle>ONOS Java API[^<]*</<doctitle>ONOS Java API ($NEW_VERSION)</g" $pom |
| 28 | done |
| 29 | |
| 30 | # Augment the version in envDefaults, onos.py and archetypes test |
| 31 | sed -i "" -E "s/ONOS_VERSION:-[^$]*/ONOS_VERSION:-$NEW_VERSION_SHORT./" $ONOS_ROOT/tools/build/envDefaults |
Brian O'Connor | 35cd800 | 2016-09-19 15:00:40 -0700 | [diff] [blame] | 32 | sed -i "" -E "s/features\/.*\/xml/features\/$NEW_VERSION\/xml/" $ONOS_ROOT/tools/dev/mininet/onos.py |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 33 | sed -i "" -E "s/ -Dversion=.*\"/ -Dversion=$NEW_VERSION\"/" $ONOS_ROOT/tools/test/bin/onos-archetypes-test |
Brian O'Connor | 988fc2a | 2015-03-17 20:29:21 -0700 | [diff] [blame] | 34 | sed -i "" -E "s/ONOS_POM_VERSION=.*\"/ONOS_POM_VERSION=\"$NEW_VERSION\"/" $ONOS_ROOT/tools/build/envDefaults |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 35 | |
Jordan Halterman | f70bf46 | 2017-07-29 13:12:00 -0700 | [diff] [blame^] | 36 | # Augment fallback version in VersionManager |
Brian O'Connor | 68ddd74 | 2015-03-25 14:11:17 -0700 | [diff] [blame] | 37 | sed -i "" -E "s/Version\.version\(\"[^\"]*\"\)/Version.version(\"$NEW_VERSION\")/" \ |
Jordan Halterman | f70bf46 | 2017-07-29 13:12:00 -0700 | [diff] [blame^] | 38 | $ONOS_ROOT/core/net/src/main/java/org/onosproject/core/impl/VersionManager.java |
Brian O'Connor | 68ddd74 | 2015-03-25 14:11:17 -0700 | [diff] [blame] | 39 | |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 40 | # Augment the version in archetypes tree. |
| 41 | mvn -f tools/package/archetypes/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit |
Thomas Vachuska | bbb6c8e | 2015-12-11 15:16:54 -0800 | [diff] [blame] | 42 | for atype in api bundle cli rest ui uitab uitopo; do |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 43 | pom="tools/package/archetypes/$atype/src/main/resources/archetype-resources/pom.xml" |
| 44 | sed -i "" -E "1,/<onos.version>/s/<onos.version>[^<]*</<onos.version>$NEW_VERSION</g" $pom |
| 45 | done |
Brian O'Connor | 47c42a3 | 2015-09-04 22:11:58 -0700 | [diff] [blame] | 46 | sed -i "" -E "s/-DarchetypeVersion=[^\"]*/-DarchetypeVersion=$NEW_VERSION/g" $ONOS_ROOT/tools/test/bin/onos-archetypes-test |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 47 | |
Ray Milkey | 4c29be2 | 2017-05-11 17:21:25 -0700 | [diff] [blame] | 48 | # Fix the onos-build-conf version |
| 49 | sed -i "" -E "s/\<onos-build-conf.version\>.*\<.onos-build-conf.version\>/\<onos-build-conf.version\>$NEW_VERSION\<\/onos-build-conf.version\>/g" $ONOS_ROOT/lib/pom.xml |
Yuta HIGUCHI | 0cc8b23 | 2017-05-15 13:29:05 -0700 | [diff] [blame] | 50 | mvn -f tools/build/conf/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit |
Ray Milkey | 4c29be2 | 2017-05-11 17:21:25 -0700 | [diff] [blame] | 51 | |
Thomas Vachuska | 2dec354 | 2016-06-01 17:46:14 -0700 | [diff] [blame] | 52 | # Version the BUCK artifacts |
Brian O'Connor | 35cd800 | 2016-09-19 15:00:40 -0700 | [diff] [blame] | 53 | sed -i "" -E "s/ONOS_VERSION.*/ONOS_VERSION = '$NEW_VERSION'/" onos.defs |
Ray Milkey | 924c0e3 | 2016-11-18 13:47:14 -0800 | [diff] [blame] | 54 | sed -i "" -E "s/ONOS_VERSION=.*/ONOS_VERSION='$NEW_VERSION'/" tools/build/onos-prepare-sonar |