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 | |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 18 | # Augment the version in envDefaults, onos.py and archetypes test |
Ray Milkey | 85b87e4 | 2017-11-02 14:09:38 -0700 | [diff] [blame] | 19 | sed -i".VERBACK" -E "s/ONOS_VERSION:-[^$]*/ONOS_VERSION:-$NEW_VERSION_SHORT./" $ONOS_ROOT/tools/build/envDefaults |
| 20 | sed -i".VERBACK" -E "s/features\/.*\/xml/features\/$NEW_VERSION\/xml/" $ONOS_ROOT/tools/dev/mininet/onos.py |
| 21 | sed -i".VERBACK" -E "s/ -Dversion=.*\"/ -Dversion=$NEW_VERSION\"/" $ONOS_ROOT/tools/test/bin/onos-archetypes-test |
| 22 | 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] | 23 | |
Jordan Halterman | f70bf46 | 2017-07-29 13:12:00 -0700 | [diff] [blame] | 24 | # Augment fallback version in VersionManager |
Ray Milkey | 85b87e4 | 2017-11-02 14:09:38 -0700 | [diff] [blame] | 25 | sed -i".VERBACK" -E "s/Version\.version\(\"[^\"]*\"\)/Version.version(\"$NEW_VERSION\")/" \ |
Jordan Halterman | f70bf46 | 2017-07-29 13:12:00 -0700 | [diff] [blame] | 26 | $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] | 27 | |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 28 | # Augment the version in archetypes tree. |
Ray Milkey | 548768f | 2019-07-02 15:01:56 -0700 | [diff] [blame] | 29 | mvn -q -B -f tools/package/archetypes/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit |
Sean Condon | a36f65c | 2019-05-20 08:21:41 +0100 | [diff] [blame] | 30 | for atype in api bundle cli rest ui ui2 uitab uitopo; do |
Carmelo Cascone | 27b9712 | 2019-11-12 10:34:05 -0800 | [diff] [blame^] | 31 | meta="tools/package/archetypes/$atype/src/main/resources/META-INF/maven/archetype-metadata.xml" |
| 32 | sed -i".VERBACK" -E "1,/<defaultValue>/s/<defaultValue>[^<]*</<defaultValue>$NEW_VERSION</g" $meta |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 33 | done |
Ray Milkey | 85b87e4 | 2017-11-02 14:09:38 -0700 | [diff] [blame] | 34 | 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] | 35 | |
Ray Milkey | f77ea41 | 2018-08-10 17:37:28 -0700 | [diff] [blame] | 36 | # Version the bazel artifacts |
| 37 | 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] | 38 | |
Ray Milkey | 85b87e4 | 2017-11-02 14:09:38 -0700 | [diff] [blame] | 39 | find . -name "*.VERBACK" | xargs rm -f |