Files
rk35xx-android14/external/toolchain-utils/go/push_goroot
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

30 lines
872 B
Bash
Executable File

#!/bin/bash
set -e -o pipefail
# This script copies a locally built GOROOT to a remote device.
#
# Usage: push_goroot <target>...
#
# This script can work with both ChromeOS/Android devices.
#
# It uses "target_tmpdir" to figure out where to copy GOROOT on the device.
# It uses "target_sh" to remotely execute commands on the device.
# It uses "target_cp" to transfer files to the device.
goroot="$(target_tmpdir)/goroot"
for target in "$@"
do
echo -n "pushing goroot to ${target} ... "
target_sh ${target} "rm -rf ${goroot}"
target_sh ${target} "mkdir -p ${goroot}/pkg"
cd "$(go_${target} env GOROOT)"
pkgdir="pkg/$(go_${target} env GOOS)_$(go_${target} env GOARCH)"
target_cp "${pkgdir}" ${target}:${goroot}/pkg
target_cp "src" ${target}:${goroot}
target_cp "lib" ${target}:${goroot}
[[ -d test ]] && target_cp "test" ${target}:${goroot}
echo "done"
done