[compile] Add support for the compilation process of the Sylixos platform
This commit is contained in:
parent
1946c2af35
commit
574923cb34
|
@ -90,6 +90,7 @@ func addExecChecks(checks []Checker, execer utilsexec.Interface) []Checker {
|
|||
return checks
|
||||
}
|
||||
|
||||
func checksFilter(name string) bool {
|
||||
// No-op for Linux.
|
||||
func checksRunFilter(name string) bool {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ readonly KUBE_GOPATH="${KUBE_GOPATH:-"${KUBE_OUTPUT}/go"}"
|
|||
export KUBE_GOPATH
|
||||
|
||||
# The server platform we are building on.
|
||||
# kube-apiserver, kube-controller-manager
|
||||
readonly KUBE_SUPPORTED_SERVER_PLATFORMS=(
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
|
@ -30,6 +31,7 @@ readonly KUBE_SUPPORTED_SERVER_PLATFORMS=(
|
|||
)
|
||||
|
||||
# The node platforms we build for
|
||||
# kubelet, kube-proxy
|
||||
readonly KUBE_SUPPORTED_NODE_PLATFORMS=(
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
|
@ -40,6 +42,7 @@ readonly KUBE_SUPPORTED_NODE_PLATFORMS=(
|
|||
|
||||
# If we update this we should also update the set of platforms whose standard
|
||||
# library is precompiled for in build/build-image/cross/Dockerfile
|
||||
# kubectl, kubectl-convert
|
||||
readonly KUBE_SUPPORTED_CLIENT_PLATFORMS=(
|
||||
linux/amd64
|
||||
linux/386
|
||||
|
@ -172,6 +175,7 @@ declare -a KUBE_NODE_PLATFORMS
|
|||
declare -a KUBE_TEST_PLATFORMS
|
||||
kube::golang::setup_platforms() {
|
||||
if [[ -n "${KUBE_BUILD_PLATFORMS:-}" ]]; then
|
||||
echo "setup_platforms..."
|
||||
# KUBE_BUILD_PLATFORMS needs to be read into an array before the next
|
||||
# step, or quoting treats it all as one element.
|
||||
local -a platforms
|
||||
|
@ -518,7 +522,7 @@ EOF
|
|||
# env-var GO15VENDOREXPERIMENT=1
|
||||
# current directory is within GOPATH
|
||||
kube::golang::setup_env() {
|
||||
kube::golang::verify_go_version
|
||||
# kube::golang::verify_go_version
|
||||
|
||||
# Set up GOPATH. We have tools which depend on being in a GOPATH (see
|
||||
# hack/run-in-gopath.sh).
|
||||
|
@ -540,7 +544,7 @@ kube::golang::setup_env() {
|
|||
# Eventually, when we no longer rely on run-in-gopath.sh we may be able to
|
||||
# simplify this some.
|
||||
kube::golang::create_gopath_tree
|
||||
export GOPATH="${KUBE_GOPATH}"
|
||||
export GOPATH="${KUBE_GOPATH}" # set GOPATH
|
||||
|
||||
# If these are not set, set them now. This ensures that any subsequent
|
||||
# scripts we run (which may call this function again) use the same values.
|
||||
|
@ -610,12 +614,14 @@ kube::golang::place_bins() {
|
|||
if [[ "${platform}" == "${host_platform}" ]]; then
|
||||
platform_src=""
|
||||
rm -f "${THIS_PLATFORM_BIN}"
|
||||
echo 'deleted ' ${THIS_PLATFORM_BIN}
|
||||
ln -s "${KUBE_OUTPUT_BINPATH}/${platform}" "${THIS_PLATFORM_BIN}"
|
||||
fi
|
||||
|
||||
local full_binpath_src="${KUBE_GOPATH}/bin${platform_src}"
|
||||
if [[ -d "${full_binpath_src}" ]]; then
|
||||
mkdir -p "${KUBE_OUTPUT_BINPATH}/${platform}"
|
||||
echo 'created ' ${KUBE_OUTPUT_BINPATH}/${platform}
|
||||
find "${full_binpath_src}" -maxdepth 1 -type f -exec \
|
||||
rsync -pc {} "${KUBE_OUTPUT_BINPATH}/${platform}" \;
|
||||
fi
|
||||
|
@ -636,7 +642,7 @@ kube::golang::outfile_for_binary() {
|
|||
if [[ ${GOOS} == "windows" ]]; then
|
||||
bin="${bin}.exe"
|
||||
fi
|
||||
echo "${output_path}/${bin}"
|
||||
echo "=====> ${output_path}/${bin}"
|
||||
}
|
||||
|
||||
# Argument: the name of a Kubernetes package.
|
||||
|
@ -724,7 +730,6 @@ kube::golang::build_some_binaries() {
|
|||
|
||||
kube::golang::create_coverage_dummy_test "${package}"
|
||||
kube::util::trap_add "kube::golang::delete_coverage_dummy_test \"${package}\"" EXIT
|
||||
|
||||
go test -c -o "$(kube::golang::outfile_for_binary "${package}" "${platform}")" \
|
||||
-covermode count \
|
||||
-coverpkg k8s.io/...,k8s.io/kubernetes/vendor/k8s.io/... \
|
||||
|
@ -737,14 +742,15 @@ kube::golang::build_some_binaries() {
|
|||
done
|
||||
if [[ "${#uncovered[@]}" != 0 ]]; then
|
||||
V=2 kube::log::info "Building ${uncovered[*]} without coverage..."
|
||||
GO111MODULE=on GOPROXY=off go install "${build_args[@]}" "${uncovered[@]}"
|
||||
GO111MODULE=on GOPROXY=off go install -mod=vendor -v "${build_args[@]}" "${uncovered[@]}"
|
||||
else
|
||||
V=2 kube::log::info "Nothing to build without coverage."
|
||||
fi
|
||||
else
|
||||
V=2 kube::log::info "Coverage is disabled."
|
||||
GO111MODULE=on GOPROXY=off go install "${build_args[@]}" "$@"
|
||||
GO111MODULE=on GOPROXY=off go install -mod=vendor -v "${build_args[@]}" "$@"
|
||||
fi
|
||||
echo 'build end!'
|
||||
}
|
||||
|
||||
# Args:
|
||||
|
@ -754,7 +760,6 @@ kube::golang::build_binaries_for_platform() {
|
|||
umask 0022
|
||||
|
||||
local platform=$1
|
||||
|
||||
local -a statics=()
|
||||
local -a nonstatics=()
|
||||
local -a tests=()
|
||||
|
@ -771,7 +776,6 @@ kube::golang::build_binaries_for_platform() {
|
|||
kube::log::info " ${binary} (non-static)"
|
||||
fi
|
||||
done
|
||||
|
||||
V=2 kube::log::info "Env for ${platform}: GOOS=${GOOS-} GOARCH=${GOARCH-} GOROOT=${GOROOT-} CGO_ENABLED=${CGO_ENABLED-} CC=${CC-}"
|
||||
V=3 kube::log::info "Building binaries with GCFLAGS=${gogcflags} ASMFLAGS=${goasmflags} LDFLAGS=${goldflags}"
|
||||
|
||||
|
@ -787,7 +791,7 @@ kube::golang::build_binaries_for_platform() {
|
|||
)
|
||||
CGO_ENABLED=0 kube::golang::build_some_binaries "${statics[@]}"
|
||||
fi
|
||||
|
||||
# process nonstatics
|
||||
if [[ "${#nonstatics[@]}" != 0 ]]; then
|
||||
build_args=(
|
||||
${goflags:+"${goflags[@]}"}
|
||||
|
|
|
@ -25,4 +25,4 @@ KUBE_VERBOSE="${KUBE_VERBOSE:-1}"
|
|||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::build_binaries "$@"
|
||||
kube::golang::place_bins
|
||||
#kube::golang::place_bins
|
||||
|
|
Loading…
Reference in New Issue
Block a user