Allow specifying individual tasks

This commit is contained in:
topjohnwu 2024-04-24 14:40:47 -07:00
parent b607dee4c0
commit 3832341ea0
5 changed files with 51 additions and 26 deletions

View File

@ -92,10 +92,8 @@ jobs:
python-version: "3.x"
- name: Build toolchain
env:
SKIP_DIST: 1
run: |
./build.sh
./build.sh clone build
mkdir tmp
tar c out | xz --x86 --lzma2 > tmp/out.x64.tar.xz
@ -124,7 +122,7 @@ jobs:
env:
SKIP_DIST: 1
run: |
./build.sh
./build.sh clone build
mkdir tmp
tar c out | xz > tmp/out.arm64.tar.xz

View File

@ -20,6 +20,7 @@ NDK_DIRNAME='windows-x86_64'
TRIPLE='x86_64-pc-windows-gnu'
DYN_EXT='dll'
PYTHON_CMD='python'
MINGW_URL='https://github.com/niXman/mingw-builds-binaries/releases/download/13.1.0-rt_v11-rev1/x86_64-13.1.0-release-win32-seh-ucrt-rt_v11-rev1.7z'
clean_storage() {
# Clean up storage to fit in all our build output
@ -81,6 +82,11 @@ ndk() {
rm -rf rust/llvm-bin
cd ../..
# Bundle the entire mingw toolchain
curl -o mingw.7z -OL "$MINGW_URL"
7z x mingw.7z
cp -af mingw64/. ndk/toolchains/rust/.
}
export PATH='/c/Program Files/Git/cmd':$PATH
@ -89,13 +95,4 @@ if [ -n "$GITHUB_ACTION" ]; then
clean_storage
fi
clone
build
ndk
# Bundle the entire mingw toolchain
curl -o mingw.7z -O -L "https://github.com/niXman/mingw-builds-binaries/releases/download/13.1.0-rt_v11-rev1/x86_64-13.1.0-release-win32-seh-ucrt-rt_v11-rev1.7z"
7z x mingw.7z
cp -af mingw64/. ndk/toolchains/rust/.
dist
parse_args $@

View File

@ -14,11 +14,9 @@ if [ $NATIVE_ARCH = "arm64" ]; then
NATIVE_ARCH='aarch64'
fi
if [ -z $1 ]; then
if [ -z $ARCH ]; then
# Build the native architecture by default
ARCH=$NATIVE_ARCH
else
ARCH=$1
fi
if [ $OS = "darwin" ]; then
@ -87,12 +85,5 @@ ndk() {
cd ../../../..
}
if [ -z "$SKIP_BUILD" ]; then
clone
build
fi
if [ -z "$SKIP_DIST" ]; then
ndk
dist
fi
parse_args $@

View File

@ -77,3 +77,42 @@ dist() {
mkdir dist
tar c "ondk-${OUTPUT_VERSION}" | xz --x86 --lzma2 > "dist/ondk-${OUTPUT_VERSION}-${OS}.tar.xz"
}
run_cmd() {
case $1 in
clone)
rm -rf rust llvm-project llvm_android toolchain-utils
clone
;;
build)
rm -rf out
build
;;
ndk)
rm -rf ndk
ndk
;;
dist)
rm -rf dist ondk-*
dist
;;
*)
echo "Unknown action \"$1\""
echo "./build.sh clone/build/ndk/dist"
exit 1
;;
esac
}
parse_args() {
if [ $# -eq 0 ]; then
run_cmd clone
run_cmd build
run_cmd ndk
run_cmd dist
else
for arg in $@; do
run_cmd $arg
done
fi
}

View File

@ -26,4 +26,4 @@ while IFS= read -r -d '' o; do
codesign -s - "$o"
done
SKIP_BUILD=1 ./build.sh
./build.sh ndk dist