@@ -4459,6 +4459,94 @@ publish_sdk () { #
44594459 git --git-dir=" $sdk64 " /usr/src/build-extra/.git push origin " $tag "
44604460}
44614461
4462+ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitness=(32|64|auto)] [--force] <name>
4463+ git_sdk_path=/
4464+ output_path=
4465+ force=
4466+ while case " $1 " in
4467+ --out|-o)
4468+ shift
4469+ output_path=" $( cygpath -am " $1 " ) " || exit
4470+ ;;
4471+ --out=* |-o=* )
4472+ output_path=" $( cygpath -am " ${1#* =} " ) " || exit
4473+ ;;
4474+ -o* )
4475+ output_path=" $( cygpath -am " ${1# -?} " ) " || exit
4476+ ;;
4477+ --git-sdk|--sdk|-g)
4478+ shift
4479+ git_sdk_path=" $( cygpath -am " $1 " ) " || exit
4480+ ;;
4481+ --git-sdk=* |--sdk=* |-g=* )
4482+ git_sdk_path=" $( cygpath -am " ${1#* =} " ) " || exit
4483+ ;;
4484+ -o* )
4485+ git_sdk_path=" $( cygpath -am " ${1# -?} " ) " || exit
4486+ ;;
4487+ --force|-f)
4488+ force=t
4489+ ;;
4490+ -* ) die " Unknown option: %s\n" " $1 " ;;
4491+ * ) break ;;
4492+ esac ; do shift ; done
4493+ test $# = 1 ||
4494+ die " Expected one argument, got $# : %s\n" " $* "
4495+
4496+ test -n " $output_path " ||
4497+ output_path=" $( cygpath -am " $1 " ) "
4498+
4499+ mode=
4500+ case " $1 " in
4501+ minimal|git-sdk-minimal) mode=minimal-sdk;;
4502+ minimal-sdk) mode=$1 ;;
4503+ * ) die " Unhandled artifact: '%s'\n" " $1 " ;;
4504+ esac
4505+
4506+ test ! -d " $output_path " ||
4507+ if test -z " $force "
4508+ then
4509+ die " Directory exists already: '%s'\n" " $output_path "
4510+ elif test -f " $output_path /.git"
4511+ then
4512+ git -C " $( git -C " $output_path " rev-parse --git-common-dir) " worktree remove -f " $( cygpath -am " $output_path " ) "
4513+ else
4514+ rm -rf " $output_path "
4515+ fi ||
4516+ die " Could not remove '%s'\n" " $output_path "
4517+
4518+ if test -d " $git_sdk_path "
4519+ then
4520+ test ! -f " $git_sdk_path /.git" ||
4521+ git_sdk_path=" $( git -C " $git_sdk_path " rev-parse --git-dir) "
4522+ test ! -d " $git_sdk_path /.git" ||
4523+ git_sdk_path=" $git_sdk_path /.git"
4524+ test true = " $( git -C " $git_sdk_path " rev-parse --is-inside-git-dir) " ||
4525+ die " Not a Git repository: '%s'\n" " $git_sdk_path "
4526+ else
4527+ test " z$git_sdk_path " ! = " z${git_sdk_path% .git} " ||
4528+ git_sdk_path=" $git_sdk_path .git"
4529+ git clone --depth 1 --bare https://github.com/git-for-windows/git-sdk-64 " $git_sdk_path "
4530+ fi
4531+
4532+ git -C " $git_sdk_path " config extensions.worktreeConfig true &&
4533+ git -C " $git_sdk_path " worktree add --detach --no-checkout " $output_path " HEAD &&
4534+ sparse_checkout_file=" $( git -C " $output_path " rev-parse --git-path info/sparse-checkout) " &&
4535+ git -C " $output_path " config --worktree core.sparseCheckout true &&
4536+ git -C " $output_path " config --worktree core.bare false &&
4537+ mkdir -p " ${sparse_checkout_file%/* } " &&
4538+ git -C " $git_sdk_path " show HEAD:.sparse/$mode > " $sparse_checkout_file " &&
4539+ git -C " $output_path " checkout -- &&
4540+ if test ! -f " $output_path /etc/profile"
4541+ then
4542+ printf ' export MSYSTEM=MINGW64\nexport PATH=/mingw64/bin:/usr/bin/:/usr/bin/core_perl:$PATH\n' > " $output_path /etc/profile"
4543+ fi &&
4544+ rm -r " $( cat " $output_path /.git" | sed ' s/^gitdir: //' ) " &&
4545+ rm " $output_path /.git" &&
4546+ echo " Output written to '$output_path '" >&2 ||
4547+ die " Could not write artifact at '%s'\n" " $output_path "
4548+ }
4549+
44624550this_script_path=" $( cd " $( dirname " $0 " ) " && echo " $( pwd -W) /$( basename " $0 " ) " ) " ||
44634551die " Could not determine this script's path\n"
44644552
0 commit comments