blob: f46b029ad2a9551262e75ddca415cf5d9b523b32 [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
18# Augment the version of the main pom and the modules nested underneath.
Ray Milkeydeb79f82018-06-04 12:05:27 -070019mvn -B -f lib/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
Thomas Vachuska683b31b2015-01-26 11:54:31 -080020
Thomas Vachuska683b31b2015-01-26 11:54:31 -080021# Augment the version in envDefaults, onos.py and archetypes test
Ray Milkey85b87e42017-11-02 14:09:38 -070022sed -i".VERBACK" -E "s/ONOS_VERSION:-[^$]*/ONOS_VERSION:-$NEW_VERSION_SHORT./" $ONOS_ROOT/tools/build/envDefaults
23sed -i".VERBACK" -E "s/features\/.*\/xml/features\/$NEW_VERSION\/xml/" $ONOS_ROOT/tools/dev/mininet/onos.py
24sed -i".VERBACK" -E "s/ -Dversion=.*\"/ -Dversion=$NEW_VERSION\"/" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
25sed -i".VERBACK" -E "s/ONOS_POM_VERSION=.*\"/ONOS_POM_VERSION=\"$NEW_VERSION\"/" $ONOS_ROOT/tools/build/envDefaults
Thomas Vachuska683b31b2015-01-26 11:54:31 -080026
Jordan Haltermanf70bf462017-07-29 13:12:00 -070027# Augment fallback version in VersionManager
Ray Milkey85b87e42017-11-02 14:09:38 -070028sed -i".VERBACK" -E "s/Version\.version\(\"[^\"]*\"\)/Version.version(\"$NEW_VERSION\")/" \
Jordan Haltermanf70bf462017-07-29 13:12:00 -070029 $ONOS_ROOT/core/net/src/main/java/org/onosproject/core/impl/VersionManager.java
Brian O'Connor68ddd742015-03-25 14:11:17 -070030
Thomas Vachuska683b31b2015-01-26 11:54:31 -080031# Augment the version in archetypes tree.
Ray Milkeydeb79f82018-06-04 12:05:27 -070032mvn -B -f tools/package/archetypes/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
Thomas Vachuskabbb6c8e2015-12-11 15:16:54 -080033for atype in api bundle cli rest ui uitab uitopo; do
Thomas Vachuska683b31b2015-01-26 11:54:31 -080034 pom="tools/package/archetypes/$atype/src/main/resources/archetype-resources/pom.xml"
Ray Milkey85b87e42017-11-02 14:09:38 -070035 sed -i".VERBACK" -E "1,/<onos.version>/s/<onos.version>[^<]*</<onos.version>$NEW_VERSION</g" $pom
Thomas Vachuska683b31b2015-01-26 11:54:31 -080036done
Ray Milkey85b87e42017-11-02 14:09:38 -070037sed -i".VERBACK" -E "s/-DarchetypeVersion=[^\"]*/-DarchetypeVersion=$NEW_VERSION/g" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
Thomas Vachuska683b31b2015-01-26 11:54:31 -080038
Ray Milkey4c29be22017-05-11 17:21:25 -070039# Fix the onos-build-conf version
Yuta HIGUCHI60831652018-05-02 13:46:13 -070040sed -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 Milkey4c29be22017-05-11 17:21:25 -070041
Thomas Vachuska2dec3542016-06-01 17:46:14 -070042# Version the BUCK artifacts
Ray Milkey85b87e42017-11-02 14:09:38 -070043sed -i".VERBACK" -E "s/ONOS_VERSION.*/ONOS_VERSION = '$NEW_VERSION'/" onos.defs
44sed -i".VERBACK" -E "s/ONOS_VERSION=.*/ONOS_VERSION='$NEW_VERSION'/" tools/build/onos-prepare-sonar
45
Ray Milkeyf77ea412018-08-10 17:37:28 -070046# Version the bazel artifacts
47sed -i".VERBACK" -E "s/ONOS_VERSION.*/ONOS_VERSION = \"$NEW_VERSION\"/" tools/build/bazel/variables.bzl
Ray Milkeyf77ea412018-08-10 17:37:28 -070048
Ray Milkey85b87e42017-11-02 14:09:38 -070049find . -name "*.VERBACK" | xargs rm -f