xref: /aosp_15_r20/external/google-cloud-java/generation/generate_root_versions_txt.sh (revision 55e87721aa1bc457b326496a7ca40f3ea1a63287)
1#!/bin/bash
2
3# This script adds the contents of a module's versions.txt to root versions.txt and then deletes it.
4# This should be run during addition of a new-module to the monorepo
5
6set -e
7
8GENERATION_DIR=$(dirname -- "$0")
9
10module_list=$(find . -mindepth 2 -maxdepth 2 -name pom.xml | sort --dictionary-order |xargs dirname)
11
12for path in $module_list; do
13  FILE=${path}/versions.txt
14  if [ -f ${FILE} ]; then
15    cat ${path}/versions.txt | while read LINE; do
16      if ! [[ $LINE == *"#"* ]] && [ "$LINE" != "" ]; then
17        echo $LINE >> versions.txt
18      fi
19    done
20  fi
21  rm -f ${FILE}
22done
23
24