xref: /aosp_15_r20/external/google-cloud-java/generation/check_non_release_please_versions.sh (revision 55e87721aa1bc457b326496a7ca40f3ea1a63287)
1#!/bin/bash
2
3set -e
4
5violations=0
6for pomFile in $(find . -mindepth 2 -name pom.xml | sort ); do
7  if [[ "${pomFile}" =~ .*google-cloud-jar-parent.* ]] || \
8      [[ "${pomFile}" =~ .*google-cloud-pom-parent.* ]] || \
9      [[ "${pomFile}" =~ .*CoverageAggregator.* ]] || \
10      [[ "${pomFile}" =~ .*java-shared-dependencies*. ]]; then
11    continue
12  fi
13  if [[ "${pomFile}" =~ .*owl-bot-postprocessor.* ]]; then
14    # Skip the template files
15    continue
16  fi
17
18  if grep -n '<version>.*</version>' "$pomFile" | grep -v 'x-version-update'; then
19    echo "Found version declaration(s) without x-version-update in: $pomFile"
20    violations=$((violations + 1))
21    echo "---------------------------------------------------------"
22  fi
23done
24
25echo "FOUND $violations VIOLATIONS!"
26
27if [[ $violations -gt 0 ]]; then
28  exit 1
29fi