blob: 07f2ae5e1e746425a2abcee1731f0353627144ae [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 Vachuska2dec3542016-06-01 17:46:14 -070020mvn -f lib/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
Ray Milkey55b53a02017-11-02 14:09:38 -070021sed -i".VERBACK" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" pom.xml
22sed -i".VERBACK" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" drivers/bti/pom.xml
Thomas Vachuska683b31b2015-01-26 11:54:31 -080023
24# Augment the version of the Java API pom files and the overview.html file.
Brian O'Connor84e523c2015-09-04 20:21:36 -070025for pom in docs/internal.xml docs/external.xml; do
Ray Milkey55b53a02017-11-02 14:09:38 -070026 sed -i".VERBACK" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" $pom
27 sed -i".VERBACK" -E "1,/<doctitle>/s/<doctitle>ONOS Java API[^<]*</<doctitle>ONOS Java API ($NEW_VERSION)</g" $pom
Thomas Vachuska683b31b2015-01-26 11:54:31 -080028done
29
30# Augment the version in envDefaults, onos.py and archetypes test
Ray Milkey55b53a02017-11-02 14:09:38 -070031sed -i".VERBACK" -E "s/ONOS_VERSION:-[^$]*/ONOS_VERSION:-$NEW_VERSION_SHORT./" $ONOS_ROOT/tools/build/envDefaults
32sed -i".VERBACK" -E "s/features\/.*\/xml/features\/$NEW_VERSION\/xml/" $ONOS_ROOT/tools/dev/mininet/onos.py
33sed -i".VERBACK" -E "s/ -Dversion=.*\"/ -Dversion=$NEW_VERSION\"/" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
34sed -i".VERBACK" -E "s/ONOS_POM_VERSION=.*\"/ONOS_POM_VERSION=\"$NEW_VERSION\"/" $ONOS_ROOT/tools/build/envDefaults
Thomas Vachuska683b31b2015-01-26 11:54:31 -080035
Brian O'Connor68ddd742015-03-25 14:11:17 -070036# Augment fallback version in CoreManager
Ray Milkeyef037322018-01-03 11:20:01 -080037sed -i".VERBACK" -E "s/Version\.version\(\"[^\"]*\"\)/Version.version(\"$NEW_VERSION\")/" \
Brian O'Connor68ddd742015-03-25 14:11:17 -070038 $ONOS_ROOT/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java
39
Thomas Vachuska683b31b2015-01-26 11:54:31 -080040# Augment the version in archetypes tree.
Ray Milkey6f5ea1b2017-11-02 14:29:26 -070041mvn -f tools/package/archetypes/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
Thomas Vachuskabbb6c8e2015-12-11 15:16:54 -080042for atype in api bundle cli rest ui uitab uitopo; do
Thomas Vachuska683b31b2015-01-26 11:54:31 -080043 pom="tools/package/archetypes/$atype/src/main/resources/archetype-resources/pom.xml"
Ray Milkey55b53a02017-11-02 14:09:38 -070044 sed -i".VERBACK" -E "1,/<onos.version>/s/<onos.version>[^<]*</<onos.version>$NEW_VERSION</g" $pom
Thomas Vachuska683b31b2015-01-26 11:54:31 -080045done
Ray Milkey55b53a02017-11-02 14:09:38 -070046sed -i".VERBACK" -E "s/-DarchetypeVersion=[^\"]*/-DarchetypeVersion=$NEW_VERSION/g" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
Thomas Vachuska683b31b2015-01-26 11:54:31 -080047
Ray Milkey4c29be22017-05-11 17:21:25 -070048# Fix the onos-build-conf version
Ray Milkey55b53a02017-11-02 14:09:38 -070049sed -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
Yuta HIGUCHIe0cac782017-05-15 13:29:05 -070050mvn -f tools/build/conf/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
Ray Milkey4c29be22017-05-11 17:21:25 -070051
Thomas Vachuska2dec3542016-06-01 17:46:14 -070052# Version the BUCK artifacts
Ray Milkey55b53a02017-11-02 14:09:38 -070053sed -i".VERBACK" -E "s/ONOS_VERSION.*/ONOS_VERSION = '$NEW_VERSION'/" onos.defs
54sed -i".VERBACK" -E "s/ONOS_VERSION=.*/ONOS_VERSION='$NEW_VERSION'/" tools/build/onos-prepare-sonar
55
56find . -name "*.VERBACK" | xargs rm -f