From b47a8c5e5d97f156a4372b1791f66dd5613229ae Mon Sep 17 00:00:00 2001 From: Daniel Spiewak Date: Thu, 6 Aug 2020 10:31:39 -0600 Subject: [PATCH] Removed windows symlinks hack, since it seems to no longer be necessary --- .github/workflows/ci.yml | 53 ----------------- .../scala/sbtghactions/GenerativePlugin.scala | 59 ------------------- 2 files changed, 112 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77faa63..9f93ca8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,59 +39,6 @@ jobs: with: java-version: ${{ matrix.java }} - - name: Setup rm-symlink alias - if: contains(runner.os, 'windows') - shell: bash - run: | - git config --global alias.rm-symlinks '!'"$(cat <<'ETX' - __git_rm_symlinks() { - case "$1" in (-h) - printf 'usage: git rm-symlinks [symlink] [symlink] [...]\n' - return 0 - esac - ppid=$$ - case $# in - (0) git ls-files -s | grep -E '^120000' | cut -f2 ;; - (*) printf '%s\n' "$@" ;; - esac | while IFS= read -r symlink; do - case "$symlink" in - (*/*) symdir=${symlink%/*} ;; - (*) symdir=. ;; - esac - git checkout -- "$symlink" - src="${symdir}/$(cat "$symlink")" - posix_to_dos_sed='s_^/\([A-Za-z]\)_\1:_;s_/_\\\\_g' - doslnk=$(printf '%s\n' "$symlink" | sed "$posix_to_dos_sed") - dossrc=$(printf '%s\n' "$src" | sed "$posix_to_dos_sed") - if [ -f "$src" ]; then - rm -f "$symlink" - cmd //C mklink //H "$doslnk" "$dossrc" - elif [ -d "$src" ]; then - rm -f "$symlink" - cmd //C mklink //J "$doslnk" "$dossrc" - else - printf 'error: git-rm-symlink: Not a valid source\n' >&2 - printf '%s =/=> %s (%s =/=> %s)...\n' \ - "$symlink" "$src" "$doslnk" "$dossrc" >&2 - false - fi || printf 'ESC[%d]: %d\n' "$ppid" "$?" - git update-index --assume-unchanged "$symlink" - done | awk ' - BEGIN { status_code = 0 } - /^ESC\['"$ppid"'\]: / { status_code = $2 ; next } - { print } - END { exit status_code } - ' - } - __git_rm_symlinks - ETX - )" - git config --global alias.rm-symlink '!git rm-symlinks' # for back-compat. - - - if: contains(runner.os, 'windows') - shell: bash - run: git rm-symlink - - name: Cache ivy2 uses: actions/cache@v1 with: diff --git a/src/main/scala/sbtghactions/GenerativePlugin.scala b/src/main/scala/sbtghactions/GenerativePlugin.scala index b678e5f..cae4c79 100644 --- a/src/main/scala/sbtghactions/GenerativePlugin.scala +++ b/src/main/scala/sbtghactions/GenerativePlugin.scala @@ -520,64 +520,6 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}""" }, githubWorkflowGeneratedCI := { - val windowsHacksOpt = if (githubWorkflowOSes.value.exists(_.contains("windows"))) { - // credit: https://stackoverflow.com/a/16754068/9815 - val aliasHack = """git config --global alias.rm-symlinks '!'"$(cat <<'ETX' -__git_rm_symlinks() { - case "$1" in (-h) - printf 'usage: git rm-symlinks [symlink] [symlink] [...]\n' - return 0 - esac - ppid=$$ - case $# in - (0) git ls-files -s | grep -E '^120000' | cut -f2 ;; - (*) printf '%s\n' "$@" ;; - esac | while IFS= read -r symlink; do - case "$symlink" in - (*/*) symdir=${symlink%/*} ;; - (*) symdir=. ;; - esac - git checkout -- "$symlink" - src="${symdir}/$(cat "$symlink")" - posix_to_dos_sed='s_^/\([A-Za-z]\)_\1:_;s_/_\\\\_g' - doslnk=$(printf '%s\n' "$symlink" | sed "$posix_to_dos_sed") - dossrc=$(printf '%s\n' "$src" | sed "$posix_to_dos_sed") - if [ -f "$src" ]; then - rm -f "$symlink" - cmd //C mklink //H "$doslnk" "$dossrc" - elif [ -d "$src" ]; then - rm -f "$symlink" - cmd //C mklink //J "$doslnk" "$dossrc" - else - printf 'error: git-rm-symlink: Not a valid source\n' >&2 - printf '%s =/=> %s (%s =/=> %s)...\n' \ - "$symlink" "$src" "$doslnk" "$dossrc" >&2 - false - fi || printf 'ESC[%d]: %d\n' "$ppid" "$?" - git update-index --assume-unchanged "$symlink" - done | awk ' - BEGIN { status_code = 0 } - /^ESC\['"$ppid"'\]: / { status_code = $2 ; next } - { print } - END { exit status_code } - ' -} -__git_rm_symlinks -ETX -)" -git config --global alias.rm-symlink '!git rm-symlinks' # for back-compat.""" - - List( - WorkflowStep.Run( - List(aliasHack), - name = Some("Setup rm-symlink alias"), - cond = windowsGuard), - - WorkflowStep.Run(List("git rm-symlink"), cond = windowsGuard)) - } else { - Nil - } - val autoCrlfOpt = if (githubWorkflowOSes.value.exists(_.contains("windows"))) { List( WorkflowStep.Run( @@ -591,7 +533,6 @@ git config --global alias.rm-symlink '!git rm-symlinks' # for back-compat.""" val preamble = autoCrlfOpt ::: List( WorkflowStep.Checkout, WorkflowStep.SetupScala) ::: - windowsHacksOpt ::: githubWorkflowGeneratedCacheSteps.value.toList val publicationCondPre =