blob: c4706ce36d261e4acba351dc6d343d1a80590a12 [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.
19mvn versions:set -DnewVersion=$NEW_VERSION versions:commit
Thomas Vachuska251016d2016-06-01 17:46:14 -070020mvn -f lib/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
21sed -i "" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" pom.xml
Thomas Vachuska683b31b2015-01-26 11:54:31 -080022
23# Augment the version of the Java API pom files and the overview.html file.
Brian O'Connor84e523c2015-09-04 20:21:36 -070024for pom in docs/internal.xml docs/external.xml; do
Thomas Vachuska683b31b2015-01-26 11:54:31 -080025 sed -i "" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" $pom
26 sed -i "" -E "1,/<doctitle>/s/<doctitle>ONOS Java API[^<]*</<doctitle>ONOS Java API ($NEW_VERSION)</g" $pom
27done
28
29# Augment the version in envDefaults, onos.py and archetypes test
30sed -i "" -E "s/ONOS_VERSION:-[^$]*/ONOS_VERSION:-$NEW_VERSION_SHORT./" $ONOS_ROOT/tools/build/envDefaults
31sed -i "" -E "s/features\/.*\/xml/features\/$NEW_VERSION\/xml/" $ONOS_ROOT/tools/test/topos/onos.py
32sed -i "" -E "s/ -Dversion=.*\"/ -Dversion=$NEW_VERSION\"/" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
Brian O'Connor988fc2a2015-03-17 20:29:21 -070033sed -i "" -E "s/ONOS_POM_VERSION=.*\"/ONOS_POM_VERSION=\"$NEW_VERSION\"/" $ONOS_ROOT/tools/build/envDefaults
Thomas Vachuska683b31b2015-01-26 11:54:31 -080034
Brian O'Connora7b33ca2015-06-05 20:50:34 -070035# Augment the version in jdvue/bin and stc/bin
36sed -i "" -E "s/VER=.*/VER=$NEW_VERSION/" $ONOS_ROOT/utils/jdvue/bin/jdvue
37sed -i "" -E "s/VER=.*/VER=$NEW_VERSION/" $ONOS_ROOT/utils/stc/bin/stc
38sed -i "" -E "s/VER=.*/VER=$NEW_VERSION/" $ONOS_ROOT/tools/test/bin/stc
39
Brian O'Connor68ddd742015-03-25 14:11:17 -070040# Augment fallback version in CoreManager
41sed -i "" -E "s/Version\.version\(\"[^\"]*\"\)/Version.version(\"$NEW_VERSION\")/" \
42 $ONOS_ROOT/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java
43
Thomas Vachuska683b31b2015-01-26 11:54:31 -080044# Augment the version in archetypes tree.
45mvn -f tools/package/archetypes/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
Thomas Vachuskabbb6c8e2015-12-11 15:16:54 -080046for atype in api bundle cli rest ui uitab uitopo; do
Thomas Vachuska683b31b2015-01-26 11:54:31 -080047 pom="tools/package/archetypes/$atype/src/main/resources/archetype-resources/pom.xml"
48 sed -i "" -E "1,/<onos.version>/s/<onos.version>[^<]*</<onos.version>$NEW_VERSION</g" $pom
49done
Brian O'Connor47c42a32015-09-04 22:11:58 -070050sed -i "" -E "s/-DarchetypeVersion=[^\"]*/-DarchetypeVersion=$NEW_VERSION/g" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
Thomas Vachuska683b31b2015-01-26 11:54:31 -080051
Brian O'Connor47c42a32015-09-04 22:11:58 -070052# Augment the version cord-gui
53perl -i -0pe "s#<artifactId>cord-gui<.*\n.*version>#<artifactId>cord-gui</artifactId>\n <version>$NEW_VERSION</version>#" $ONOS_ROOT/apps/demo/cord-gui/pom.xml
54sed -i "" -E "s#demo/cord-gui/target/cord-gui-.*\.war#demo/cord-gui/target/cord-gui-$NEW_VERSION.war#" $ONOS_ROOT/apps/demo/cord-gui/src/scripts/pullwar.sh
55sed -i "" -E "s#CORD=./cord-gui-.*\.war#CORD=./cord-gui-$NEW_VERSION.war#" $ONOS_ROOT/apps/demo/cord-gui/src/scripts/run.me
Thomas Vachuska251016d2016-06-01 17:46:14 -070056
57# Version the BUCK artifacts
58sed -i "" -E "s#/org/onosproject/onos-features/.*/#/org/onosproject/onos-features/$NEW_VERSION/#" $ONOS_ROOT/buck-tools/onos_stage.py
59sed -i "" -E "s#onos-features-.*-features.xml#onos-features-$NEW_VERSION-features.xml#" $ONOS_ROOT/buck-tools/onos_stage.py
60
61sed -i "" -E "s#ONOS_VERSION = .*#ONOS_VERSION = '$NEW_VERSION'#" $ONOS_ROOT/bucklets/onos.bucklet
62sed -i "" -E "s#ONOS_VERSION = .*#ONOS_VERSION = '$NEW_VERSION'#" $ONOS_ROOT/bucklets/onos_app.bucklet