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. |
Ray Milkey | deb79f8 | 2018-06-04 12:05:27 -0700 | [diff] [blame] | 19 | mvn -B -f lib/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 20 | |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 21 | # Augment the version in envDefaults, onos.py and archetypes test |
Ray Milkey | 85b87e4 | 2017-11-02 14:09:38 -0700 | [diff] [blame] | 22 | sed -i".VERBACK" -E "s/ONOS_VERSION:-[^$]*/ONOS_VERSION:-$NEW_VERSION_SHORT./" $ONOS_ROOT/tools/build/envDefaults |
| 23 | sed -i".VERBACK" -E "s/features\/.*\/xml/features\/$NEW_VERSION\/xml/" $ONOS_ROOT/tools/dev/mininet/onos.py |
| 24 | sed -i".VERBACK" -E "s/ -Dversion=.*\"/ -Dversion=$NEW_VERSION\"/" $ONOS_ROOT/tools/test/bin/onos-archetypes-test |
| 25 | sed -i".VERBACK" -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] | 26 | |
Jordan Halterman | f70bf46 | 2017-07-29 13:12:00 -0700 | [diff] [blame] | 27 | # Augment fallback version in VersionManager |
Ray Milkey | 85b87e4 | 2017-11-02 14:09:38 -0700 | [diff] [blame] | 28 | sed -i".VERBACK" -E "s/Version\.version\(\"[^\"]*\"\)/Version.version(\"$NEW_VERSION\")/" \ |
Jordan Halterman | f70bf46 | 2017-07-29 13:12:00 -0700 | [diff] [blame] | 29 | $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] | 30 | |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 31 | # Augment the version in archetypes tree. |
Ray Milkey | deb79f8 | 2018-06-04 12:05:27 -0700 | [diff] [blame] | 32 | mvn -B -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] | 33 | for atype in api bundle cli rest ui uitab uitopo; do |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 34 | pom="tools/package/archetypes/$atype/src/main/resources/archetype-resources/pom.xml" |
Ray Milkey | 85b87e4 | 2017-11-02 14:09:38 -0700 | [diff] [blame] | 35 | sed -i".VERBACK" -E "1,/<onos.version>/s/<onos.version>[^<]*</<onos.version>$NEW_VERSION</g" $pom |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 36 | done |
Ray Milkey | 85b87e4 | 2017-11-02 14:09:38 -0700 | [diff] [blame] | 37 | sed -i".VERBACK" -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] | 38 | |
Ray Milkey | 4c29be2 | 2017-05-11 17:21:25 -0700 | [diff] [blame] | 39 | # Fix the onos-build-conf version |
Yuta HIGUCHI | 6083165 | 2018-05-02 13:46:13 -0700 | [diff] [blame] | 40 | sed -i".VERBACK" -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 |
Ray Milkey | 4c29be2 | 2017-05-11 17:21:25 -0700 | [diff] [blame] | 41 | |
Thomas Vachuska | 2dec354 | 2016-06-01 17:46:14 -0700 | [diff] [blame] | 42 | # Version the BUCK artifacts |
Ray Milkey | 85b87e4 | 2017-11-02 14:09:38 -0700 | [diff] [blame] | 43 | sed -i".VERBACK" -E "s/ONOS_VERSION.*/ONOS_VERSION = '$NEW_VERSION'/" onos.defs |
| 44 | sed -i".VERBACK" -E "s/ONOS_VERSION=.*/ONOS_VERSION='$NEW_VERSION'/" tools/build/onos-prepare-sonar |
| 45 | |
Ray Milkey | f77ea41 | 2018-08-10 17:37:28 -0700 | [diff] [blame] | 46 | # Version the bazel artifacts |
| 47 | sed -i".VERBACK" -E "s/ONOS_VERSION.*/ONOS_VERSION = \"$NEW_VERSION\"/" tools/build/bazel/variables.bzl |
Ray Milkey | f77ea41 | 2018-08-10 17:37:28 -0700 | [diff] [blame] | 48 | |
Ray Milkey | 85b87e4 | 2017-11-02 14:09:38 -0700 | [diff] [blame] | 49 | find . -name "*.VERBACK" | xargs rm -f |