Skip to content

Commit

Permalink
Support building/packaging Windows client binaries.
Browse files Browse the repository at this point in the history
Ug -- .exe suffix is a pain.  These are largely untested.
  • Loading branch information
jbeda committed Nov 24, 2014
1 parent e82b88f commit 5bf4323
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
27 changes: 20 additions & 7 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,16 @@ function kube::release::package_client_tarballs() {
rm -rf "${release_stage}"
mkdir -p "${release_stage}/client/bin"

# This fancy expression will expand to prepend a path
# (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the
# KUBE_CLIENT_BINARIES array.
cp "${KUBE_CLIENT_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
"${release_stage}/client/bin/"
local client_bins=("${KUBE_CLIENT_BINARIES[@]}")
if [[ "${platform%/*}" == "windows" ]]; then
client_bins=("${KUBE_CLIENT_BINARIES_WIN[@]}")
fi

local bin
for bin in "${client_bins[@]}"; do
cp "${LOCAL_OUTPUT_BINPATH}/${platform}/${bin}" \
"${release_stage}/client/bin/"
done

local package_name="${RELEASE_DIR}/kubernetes-client-${platform_tag}.tar.gz"
kube::release::create_tarball "${package_name}" "${release_stage}/.."
Expand All @@ -518,7 +523,11 @@ function kube::release::package_server_tarballs() {
"${release_stage}/server/bin/"

# Include the client binaries here too as they are useful debugging tools.
cp "${KUBE_CLIENT_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
local client_bins=("${KUBE_CLIENT_BINARIES[@]}")
if [[ "${platform%/*}" == "windows" ]]; then
client_bins=("${KUBE_CLIENT_BINARIES_WIN[@]}")
fi
cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
"${release_stage}/server/bin/"

local package_name="${RELEASE_DIR}/kubernetes-server-${platform_tag}.tar.gz"
Expand Down Expand Up @@ -557,8 +566,12 @@ function kube::release::package_full_tarball() {
# The server binaries are included with the server binary tarball.
local platform
for platform in "${KUBE_CLIENT_PLATFORMS[@]}"; do
local client_bins=("${KUBE_CLIENT_BINARIES[@]}")
if [[ "${platform%/*}" == "windows" ]]; then
client_bins=("${KUBE_CLIENT_BINARIES_WIN[@]}")
fi
mkdir -p "${release_stage}/platforms/${platform}"
cp "${KUBE_CLIENT_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
"${release_stage}/platforms/${platform}"
done

Expand Down
5 changes: 5 additions & 0 deletions hack/lib/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ readonly KUBE_CLIENT_TARGETS=(
cmd/kubernetes
)
readonly KUBE_CLIENT_BINARIES=("${KUBE_CLIENT_TARGETS[@]##*/}")
readonly KUBE_CLIENT_BINARIES_WIN=("${KUBE_CLIENT_BINARIES[@]/%/.exe}")

# The set of test targets that we are building for all platforms
readonly KUBE_TEST_TARGETS=(
Expand All @@ -56,6 +57,7 @@ readonly KUBE_CLIENT_PLATFORMS=(
linux/arm
darwin/amd64
darwin/386
windows/amd64
)

readonly KUBE_ALL_TARGETS=(
Expand Down Expand Up @@ -280,6 +282,9 @@ kube::golang::build_binaries() {

for binary in "${binaries[@]}"; do
local bin=$(basename "${binary}")
if [[ ${GOOS} == "windows" ]]; then
bin="${bin}.exe"
fi
go build -o "${output_path}/${bin}" \
"${goflags[@]:+${goflags[@]}}" \
-ldflags "${version_ldflags}" \
Expand Down

0 comments on commit 5bf4323

Please sign in to comment.