Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(codegen): remove version replacement for modules. #1353

Merged
merged 4 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion generator/generate-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

WORKING_DIR=`pwd`

cd ../
# Compute the project version.
PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
cd generator

# runs generate-one.sh for each entry in library_list.txt
# repos are downloaded once before all generation jobs and then removed

Expand All @@ -12,7 +17,7 @@ while IFS=, read -r library_name googleapis_location coordinates_version; do
group_id=$(echo $coordinates_version | cut -f1 -d:)
artifact_id=$(echo $coordinates_version | cut -f2 -d:)
version=$(echo $coordinates_version | cut -f3 -d:)
bash $WORKING_DIR/generate-one.sh -c $library_name -v $version -i $artifact_id -g $group_id
bash $WORKING_DIR/generate-one.sh -c $library_name -v $version -i $artifact_id -g $group_id -p $PROJECT_VERSION
done <<< $libraries

rm -rf googleapis
Expand Down
6 changes: 4 additions & 2 deletions generator/generate-one.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@

# by default, do not download repos
download_repos=0
while getopts c:v:i:g:d: flag
while getopts c:v:i:g:d:p: flag
do
case "${flag}" in
c) client_lib_name=${OPTARG};;
v) version=${OPTARG};;
i) client_lib_artifactid=${OPTARG};;
g) client_lib_groupid=${OPTARG};;
p) parent_version=${OPTARG};;
d) download_repos=1;;
esac
done
echo "Client Library Name: $client_lib_name";
echo "Client Library Version: $version";
echo "Client Library GroupId: $client_lib_groupid";
echo "Client Library ArtifactId: $client_lib_artifactid";
echo "Parent Pom Version: $parent_version";

starter_artifactid="$client_lib_artifactid-spring-starter"

Expand Down Expand Up @@ -60,7 +62,7 @@ cat "$client_lib_name"/pom.xml
sed -i 's/{{client-library-group-id}}/'"$client_lib_groupid"'/' "$client_lib_name"/pom.xml
sed -i 's/{{client-library-artifact-id}}/'"$client_lib_artifactid"'/' "$client_lib_name"/pom.xml
sed -i 's/{{client-library-version}}/'"$version"'/' "$client_lib_name"/pom.xml
sed -i 's/{{starter-version}}/0.0.1-SNAPSHOT/' "$client_lib_name"/pom.xml
sed -i 's/{{parent-version}}/'"$parent_version"'/' "$client_lib_name"/pom.xml

# add module to parent, adds after the `<modules>` line, checks for existence
xmllint --debug --nsclean --xpath "//*[local-name()='module']/text()" pom.xml | sort | uniq | grep -q $client_lib_name
Expand Down