Skip to content

Commit

Permalink
[fix] Better path handling in gapic.sh (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-fenster authored Oct 28, 2019
1 parent e9c27b6 commit 2828705
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions gapic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ if [ -z "$IMAGE" ] || [ -z "$IN" ] || [ -z "$OUT" ]; then
fi

# Ensure that the input directory exists (and is a directory).
if ! [ -d $IN ]; then
>&2 echo "Directory does not exist: $IN"
if ! [ -d "${PROTO_PATH}/$IN" ]; then
>&2 echo "Directory does not exist: ${PROTO_PATH}/$IN"
exit 2
fi

Expand All @@ -85,10 +85,19 @@ if [ "$(ls -A $OUT )"]; then
>&2 echo "Warning: Output directory is not empty."
fi

# Convert IN and OUT to absolute paths for Docker
CWD=`pwd`
cd ${PROTO_PATH}/$IN
ABS_IN=`pwd`
cd $CWD
cd $OUT
ABS_OUT=`pwd`
cd $CWD

# Generate the client library.
docker run \
--mount type=bind,source=${PROTO_PATH}/${IN},destination=/in/${IN},readonly \
--mount type=bind,source=$OUT,destination=/out \
--mount type=bind,source=${ABS_IN},destination=/in/${IN},readonly \
--mount type=bind,source=${ABS_OUT},destination=/out \
--rm \
--user $UID \
$IMAGE \
Expand Down

0 comments on commit 2828705

Please sign in to comment.