Skip to content

Commit

Permalink
Improve update-codegen.sh.
Browse files Browse the repository at this point in the history
Signed-off-by: Vittorio Cozzolino <vittorio.cozzolino@huawei.com>
  • Loading branch information
vcozzolino committed Oct 25, 2021
1 parent 1d7bd48 commit 86e32f2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,17 @@ ${SEDNA_ROOT}/hack/generate-groups.sh "deepcopy,client,informer,lister" \
${SEDNA_GO_PACKAGE}/pkg/client ${SEDNA_GO_PACKAGE}/pkg/apis \
"sedna:v1alpha1" \
--go-header-file ${SEDNA_ROOT}/hack/boilerplate/boilerplate.generatego.txt

# Check if Sedna home is different from the standard directory where GO projects are located
if ! [[ "${GOPATH}/src/${SEDNA_GO_PACKAGE}/" -ef "${SEDNA_ROOT}/" ]]; then
# Copy generated code into SEDNA_ROOT
echo "Warning: ${SEDNA_ROOT} not included in $GOPATH which is required by code-gen"
echo "Moving generated code from ${GOPATH}/src/${SEDNA_GO_PACKAGE}/pkg/ to ${SEDNA_ROOT}/"
rsync -a ${GOPATH}/src/${SEDNA_GO_PACKAGE}/pkg ${SEDNA_ROOT}/
if [ $? -eq 0 ]; then
echo "Copy successful!"
rm -rf ${GOPATH}/src/${SEDNA_GO_PACKAGE}/pkg/*
else
echo "Error during copy!"
fi
fi

0 comments on commit 86e32f2

Please sign in to comment.