Allow init.sh and protoc.sh to be sourced idempotently
This commit is contained in:
@@ -18,6 +18,9 @@ set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# Short-circuit if protoc.sh has already been sourced
|
||||
[[ $(type -t kube::protoc::loaded) == function ]] && return 0
|
||||
|
||||
# The root of the build/dist directory
|
||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
@@ -134,3 +137,8 @@ function kube::protoc::install() {
|
||||
kube::log::info "export PATH=\"$(pwd)/protoc:\${PATH}\""
|
||||
)
|
||||
}
|
||||
|
||||
# Marker function to indicate protoc.sh has been fully sourced
|
||||
kube::protoc::loaded() {
|
||||
return 0
|
||||
}
|
||||
|
Reference in New Issue
Block a user