blob: 558888b5e4a518190a475e467169dfcf8b29c46e [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
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
9export NEW_VERSION=$1
10[ -z "$NEW_VERSION" ] && echo "New ONOS version not specified" && exit 1
11
12export NEW_VERSION_SHORT=${NEW_VERSION%-SNAPSHOT}
13
14cd $ONOS_ROOT
15
16# Augment the version of the main pom and the modules nested underneath.
17mvn versions:set -DnewVersion=$NEW_VERSION versions:commit
18
19# Augment the version of the Java API pom files and the overview.html file.
20for pom in docs/pom.xml docs/external.xml; do
21 sed -i "" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" $pom
22 sed -i "" -E "1,/<doctitle>/s/<doctitle>ONOS Java API[^<]*</<doctitle>ONOS Java API ($NEW_VERSION)</g" $pom
23done
24
25# Augment the version in envDefaults, onos.py and archetypes test
26sed -i "" -E "s/ONOS_VERSION:-[^$]*/ONOS_VERSION:-$NEW_VERSION_SHORT./" $ONOS_ROOT/tools/build/envDefaults
27sed -i "" -E "s/features\/.*\/xml/features\/$NEW_VERSION\/xml/" $ONOS_ROOT/tools/test/topos/onos.py
28sed -i "" -E "s/ -Dversion=.*\"/ -Dversion=$NEW_VERSION\"/" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
Brian O'Connor988fc2a2015-03-17 20:29:21 -070029sed -i "" -E "s/ONOS_POM_VERSION=.*\"/ONOS_POM_VERSION=\"$NEW_VERSION\"/" $ONOS_ROOT/tools/build/envDefaults
Thomas Vachuska683b31b2015-01-26 11:54:31 -080030
Brian O'Connor68ddd742015-03-25 14:11:17 -070031# Augment fallback version in CoreManager
32sed -i "" -E "s/Version\.version\(\"[^\"]*\"\)/Version.version(\"$NEW_VERSION\")/" \
33 $ONOS_ROOT/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java
34
Thomas Vachuska683b31b2015-01-26 11:54:31 -080035# Augment the version in archetypes tree.
36mvn -f tools/package/archetypes/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
37for atype in api bundle cli; do
38 pom="tools/package/archetypes/$atype/src/main/resources/archetype-resources/pom.xml"
39 sed -i "" -E "1,/<onos.version>/s/<onos.version>[^<]*</<onos.version>$NEW_VERSION</g" $pom
40done
41
Brian O'Connor68ddd742015-03-25 14:11:17 -070042# FIXME do we really want to roll the version with every release?
43# ... we talked about dropping to a 2 place version that rolls independently
Brian O'Connord783f2f2015-03-17 19:11:40 -070044pushd tools/package/maven-plugin
45mvn versions:set -DnewVersion=$NEW_VERSION versions:commit
46popd