Skip to content

Commit fc5218e

Browse files
fix: replace whole library source when generating libraries (#18824)
* fix: replace whole library source when generating libraries * improve comment
1 parent b1f413c commit fc5218e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/generate.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ pushd ${ROOT_DIR}/discovery-artifact-manager
4343
for DISCOVERY in `ls discoveries/${SERVICE}.*.json`
4444
do
4545
VERSION=$(basename ${DISCOVERY} | sed 's/\.json//' | cut -d. -f2-)
46-
OUTPUT_DIR=${ROOT_DIR}/google-api-java-client-services/clients/google-api-services-${SERVICE}/${VERSION}/${VARIANT}
46+
TARGET_DIR=${ROOT_DIR}/google-api-java-client-services/clients/google-api-services-${SERVICE}/${VERSION}/${VARIANT}
47+
OUTPUT_DIR=$(mktemp -d)
4748
echo ${DISCOVERY}
4849
echo ${VERSION}
4950
echo ${OUTPUT_DIR}
@@ -55,7 +56,17 @@ do
5556
--language_variant=${VARIANT} \
5657
--package_path=api/services
5758

59+
if [ $(find "${OUTPUT_DIR}" -mindepth 1 | wc -l) == '0' ]; then
60+
echo 'the generation produced no files'
61+
exit 1
62+
fi
63+
64+
# transfer generated source into the wiped-out service's source folder
65+
rm -rdf ${TARGET_DIR}/*
66+
cp -r ${OUTPUT_DIR}/* "${TARGET_DIR}"
67+
5868
# Copy the latest variant's README to the main service location
5969
# Generation of libraries with older variants should not update the root README
6070
cp ${ROOT_DIR}/google-api-java-client-services/clients/google-api-services-${SERVICE}/${VERSION}/${LATEST_VARIANT}/README.md ${ROOT_DIR}/google-api-java-client-services/clients/google-api-services-${SERVICE}/${VERSION}/README.md
6171
done
72+

0 commit comments

Comments
 (0)