- if [ "$(echo -n ${proto_patch} | tail -c 1)" == 'r' ]; then
- # Here 'r' means release. Useful for testing Nitrogen Odlparent changes.
- find . -name "*.xml" -print0 | xargs -0 sed -i 's/-SNAPSHOT//g'
+ cd "${BUILD_DIR}"
+done
+
+# Finally add distribution if there is no int/dist patch
+if [ "${distribution_status}" == "not_included" ]; then
+ echo "adding integration/distribution"
+ PROJECTS+=(distribution)
+ # clone distribution and add it as a module in root pom
+ git clone "https://git.opendaylight.org/gerrit/p/integration/distribution"
+ cd distribution
+ git checkout "${DISTRIBUTION_BRANCH_TO_BUILD}"
+ cd "${BUILD_DIR}"
+fi
+
+# If there is a patch for odlparent or yangtools (MRI projects), adjust version to mdsal project:
+# 1. Extract project version in patch
+# 2. Extract project MSI version from mdsal project
+# 3. Replace version in patch by MSI version
+# Otherwise release the MRI project
+if [[ -d "odlparent" ]]; then
+ if [[ -d "mdsal" ]]; then
+ # Extract patch and MSI used version
+ patch_version="$(xpath ./odlparent/odlparent-lite/pom.xml '/project/version/text()' 2> /dev/null)"
+ msi_version="$(xpath ./mdsal/pom.xml '/project/parent/version/text()' 2> /dev/null)"
+ # Replace version
+ find ./odlparent -name "*.xml" -print0 | xargs -0 sed -i "s/${patch_version}/${msi_version}/g"
+ else
+ # Release project
+ find ./odlparent -name "*.xml" -print0 | xargs -0 sed -i 's/-SNAPSHOT//g'