Skip to content

Commit

Permalink
improve the hack/update-generated-clientsets.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
mfojtik committed Sep 16, 2016
1 parent c42295f commit ed7c5c6
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions hack/update-generated-clientsets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ if [[ -z "$clientgen" ]]; then
exit 1
fi

os::build::get_version_vars
origin_version="v${OS_GIT_MAJOR}_${OS_GIT_MINOR%+}"

# list of package to generate client set for
packages=(
github.com/openshift/origin/pkg/authorization
github.com/openshift/origin/pkg/build
Expand All @@ -32,33 +30,32 @@ packages=(
github.com/openshift/origin/pkg/user
)


function generate_clientset_for() {
local package="$1";shift
local name="$1";shift
pushd ${OS_ROOT} >/dev/null
local common_args="--go-header-file=hack/boilerplate.txt"
echo "-> generating client set for ${package} ..."
echo "-- Generating ${name} client set for ${package} ..."
$clientgen --clientset-path="${package}/client/clientset_generated" \
--clientset-api-path="/oapi" \
--input-base="${package}/api" \
--output-base="../../.." \
--clientset-name="${name}" \
$common_args \
--go-header-file=hack/boilerplate.txt \
"$@"
popd >/dev/null
}

verify="${VERIFY:-}"

# remove the old client sets
for pkg in "${packages[@]}"; do
if [[ -z "${verify}" ]]; then
# Remove deprecated/old files
go list -f '{{.Dir}}' "${pkg}/client/clientset_generated/..." | xargs rm -rf
fi
done

os::build::setup_env
# get the tag name for the current origin release
os::build::get_version_vars
origin_version="v${OS_GIT_MAJOR}_${OS_GIT_MINOR%+}"

for pkg in "${packages[@]}"; do
generate_clientset_for "${pkg}" "internalclientset" --input=api/ "$@"
generate_clientset_for "${pkg}" "release_${origin_version}" --input=api/v1 "$@"
Expand Down

0 comments on commit ed7c5c6

Please sign in to comment.