blob: 7c729055bc8f4c2db2e1bce5229db970a7a2198d [file] [log] [blame]
#!/bin/bash
# -----------------------------------------------------------------------------
# Changes ONOS version in POM files, and other release artifacts.
# -----------------------------------------------------------------------------
set -e
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
export NEW_VERSION=$1
[ -z "$NEW_VERSION" ] && echo "New ONOS version not specified" && exit 1
export NEW_VERSION_SHORT=${NEW_VERSION%-SNAPSHOT}
cd $ONOS_ROOT
# Augment the version of the main pom and the modules nested underneath.
mvn -B -f lib/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
# Augment the version in envDefaults, onos.py and archetypes test
sed -i".VERBACK" -E "s/ONOS_VERSION:-[^$]*/ONOS_VERSION:-$NEW_VERSION_SHORT./" $ONOS_ROOT/tools/build/envDefaults
sed -i".VERBACK" -E "s/features\/.*\/xml/features\/$NEW_VERSION\/xml/" $ONOS_ROOT/tools/dev/mininet/onos.py
sed -i".VERBACK" -E "s/ -Dversion=.*\"/ -Dversion=$NEW_VERSION\"/" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
sed -i".VERBACK" -E "s/ONOS_POM_VERSION=.*\"/ONOS_POM_VERSION=\"$NEW_VERSION\"/" $ONOS_ROOT/tools/build/envDefaults
# Augment fallback version in VersionManager
sed -i".VERBACK" -E "s/Version\.version\(\"[^\"]*\"\)/Version.version(\"$NEW_VERSION\")/" \
$ONOS_ROOT/core/net/src/main/java/org/onosproject/core/impl/VersionManager.java
# Augment the version in archetypes tree.
mvn -B -f tools/package/archetypes/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
for atype in api bundle cli rest ui ui2 uitab uitopo; do
pom="tools/package/archetypes/$atype/src/main/resources/archetype-resources/pom.xml"
sed -i".VERBACK" -E "1,/<onos.version>/s/<onos.version>[^<]*</<onos.version>$NEW_VERSION</g" $pom
done
sed -i".VERBACK" -E "s/-DarchetypeVersion=[^\"]*/-DarchetypeVersion=$NEW_VERSION/g" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
# Fix the onos-build-conf version
sed -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
# Version the bazel artifacts
sed -i".VERBACK" -E "s/ONOS_VERSION.*/ONOS_VERSION = \"$NEW_VERSION\"/" tools/build/bazel/variables.bzl
find . -name "*.VERBACK" | xargs rm -f