blob: a0dad8347fafefa38292f13ffbc1dd132d5934d3 [file] [log] [blame]
Thomas Vachuska683b31b2015-01-26 11:54:31 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Changes ONOS version in POM files, and other release artifacts.
4# -----------------------------------------------------------------------------
5
Brian O'Connorf5d93632015-09-04 20:18:31 -07006set -e
7
Thomas Vachuska683b31b2015-01-26 11:54:31 -08008[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
9. $ONOS_ROOT/tools/build/envDefaults
10
11export NEW_VERSION=$1
12[ -z "$NEW_VERSION" ] && echo "New ONOS version not specified" && exit 1
13
14export NEW_VERSION_SHORT=${NEW_VERSION%-SNAPSHOT}
15
16cd $ONOS_ROOT
17
Thomas Vachuska683b31b2015-01-26 11:54:31 -080018# Augment the version in envDefaults, onos.py and archetypes test
Ray Milkey85b87e42017-11-02 14:09:38 -070019sed -i".VERBACK" -E "s/ONOS_VERSION:-[^$]*/ONOS_VERSION:-$NEW_VERSION_SHORT./" $ONOS_ROOT/tools/build/envDefaults
20sed -i".VERBACK" -E "s/features\/.*\/xml/features\/$NEW_VERSION\/xml/" $ONOS_ROOT/tools/dev/mininet/onos.py
21sed -i".VERBACK" -E "s/ -Dversion=.*\"/ -Dversion=$NEW_VERSION\"/" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
22sed -i".VERBACK" -E "s/ONOS_POM_VERSION=.*\"/ONOS_POM_VERSION=\"$NEW_VERSION\"/" $ONOS_ROOT/tools/build/envDefaults
Thomas Vachuska683b31b2015-01-26 11:54:31 -080023
Jordan Haltermanf70bf462017-07-29 13:12:00 -070024# Augment fallback version in VersionManager
Ray Milkey85b87e42017-11-02 14:09:38 -070025sed -i".VERBACK" -E "s/Version\.version\(\"[^\"]*\"\)/Version.version(\"$NEW_VERSION\")/" \
Jordan Haltermanf70bf462017-07-29 13:12:00 -070026 $ONOS_ROOT/core/net/src/main/java/org/onosproject/core/impl/VersionManager.java
Brian O'Connor68ddd742015-03-25 14:11:17 -070027
Thomas Vachuska683b31b2015-01-26 11:54:31 -080028# Augment the version in archetypes tree.
Ray Milkey548768f2019-07-02 15:01:56 -070029mvn -q -B -f tools/package/archetypes/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
Sean Condona36f65c2019-05-20 08:21:41 +010030for atype in api bundle cli rest ui ui2 uitab uitopo; do
Carmelo Cascone27b97122019-11-12 10:34:05 -080031 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 Vachuska683b31b2015-01-26 11:54:31 -080033done
Ray Milkey85b87e42017-11-02 14:09:38 -070034sed -i".VERBACK" -E "s/-DarchetypeVersion=[^\"]*/-DarchetypeVersion=$NEW_VERSION/g" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
Thomas Vachuska683b31b2015-01-26 11:54:31 -080035
Ray Milkeyf77ea412018-08-10 17:37:28 -070036# Version the bazel artifacts
37sed -i".VERBACK" -E "s/ONOS_VERSION.*/ONOS_VERSION = \"$NEW_VERSION\"/" tools/build/bazel/variables.bzl
Ray Milkeyf77ea412018-08-10 17:37:28 -070038
Ray Milkey85b87e42017-11-02 14:09:38 -070039find . -name "*.VERBACK" | xargs rm -f