261020.9 · 689635063e33d8a9f5fd962a93ff3a5331be89c8
build: download win32 emmylua binaries on Windows
- detect MINGW/MSYS/CYGWIN and `Windows_NT` (coreutils shims) as
win32, alternate x64/arm64 from `uname -m`
- use the `.zip` win32 assets with `.exe` binary names; extract with
`unzip`, falling back to PowerShell `Expand-Archive` (Git for
Windows ships GNU tar which cannot read zip archives)
- pass `--clobber` so an interrupted download can be retried
- resolve the linux arm64 asset suffix ("aarch64-glibc.2.17"); darwin
and win32 keep the plain "arm64" suffix
reading declarations
@@ -22,17 +22,6 @@ jobs: neovim: true version: nightly - # - name: Install lua-language-server- # env:- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- # run: |- # cd- # gh release download 3.16.4 -R sumneko/lua-language-server -p '*-linux-x64.tar.gz' -D lua-language-server- # tar xzf lua-language-server/* -C lua-language-server- # echo "${PWD}/lua-language-server/bin" >> $GITHUB_PATH- # export PATH="${PWD}/lua-language-server/bin:${PATH}"- # lua-language-server --version- - name: Install Emmylua env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}@@ -43,4 +32,4 @@ jobs: run: | export XDG_DATA_HOME="$HOME/.local/share" make deps- make emmylua-check+ make lint
@@ -86,21 +86,33 @@ deps/fzf-lua: # if `gh` is available and they are not already on the system PATH. # Binaries are extracted into .emmylua/. EMMYLUA_DIR=.emmylua-EMMY_CHECK_BIN=$(EMMYLUA_DIR)/emmylua_check-LUA_FMT_BIN=$(EMMYLUA_DIR)/luafmt # Pin the emmylua release tag to download. Set to an empty # string (EMMYLUA_VERSION=) to fetch the latest release instead. EMMYLUA_VERSION=0.25.1-# OS arch detection for emmylua_check. Falls back to linux-x64 on-# unknown platforms; override by passing EMMY_CHECK_ASSET=<asset-# filename> on the make command line.-EMMY_CHECK_ASSET=$(strip \- $(if $(filter Darwin darwin,$(shell uname -s 2>/dev/null)),emmylua_check-darwin-x64.tar.gz,emmylua_check-linux-x64.tar.gz))-# OS arch detection for luafmt. Falls back to linux-x64 on unknown-# platforms; override by passing LUA_FMT_ASSET=<asset filename> on-# the make command line.-LUA_FMT_ASSET=$(strip \- $(if $(filter Darwin darwin,$(shell uname -s 2>/dev/null)),luafmt-darwin-x64.tar.gz,luafmt-linux-x64.tar.gz))+# OS arch detection for the emmylua binaries (Darwin/Linux/Windows,+# x64/arm64). Falls back to linux-x64 on unknown platforms; override+# by passing EMMY_CHECK_ASSET=<asset filename> or LUA_FMT_ASSET=<asset+# filename> on the make command line. Windows releases are shipped as+# `.zip` under the `win32-*` asset names.+EMMY_UNAME_S=$(shell uname -s 2>/dev/null)+EMMY_UNAME_M=$(shell uname -m 2>/dev/null)+EMMY_ARCH=$(if $(filter aarch64% arm64%,$(EMMY_UNAME_M)),arm64,x64)+ifeq ($(filter MINGW% MSYS% CYGWIN% Windows_NT,$(EMMY_UNAME_S)),)+ EMMY_OS=$(if $(filter Darwin darwin,$(EMMY_UNAME_S)),darwin,linux)+ EMMY_EXT:=+ EMMY_EXT_ARCHIVE:=.tar.gz+else+ EMMY_OS:=win32+ EMMY_EXT:=.exe+ EMMY_EXT_ARCHIVE:=.zip+endif+# Linux arm64 release assets are published with the "aarch64-glibc.2.17"+# suffix; darwin/win32 use the plain "arm64" suffix.+EMMY_ARCH_ASSET=$(if $(and $(filter linux,$(EMMY_OS)),$(filter arm64,$(EMMY_ARCH))),aarch64-glibc.2.17,$(EMMY_ARCH))+EMMY_CHECK_ASSET=emmylua_check-$(EMMY_OS)-$(EMMY_ARCH_ASSET)$(EMMY_EXT_ARCHIVE)+LUA_FMT_ASSET=luafmt-$(EMMY_OS)-$(EMMY_ARCH_ASSET)$(EMMY_EXT_ARCHIVE)+EMMY_CHECK_BIN=$(EMMYLUA_DIR)/emmylua_check$(EMMY_EXT)+LUA_FMT_BIN=$(EMMYLUA_DIR)/luafmt$(EMMY_EXT) .PHONY: deps/emmylua deps/emmylua:@@ -111,10 +123,14 @@ deps/emmylua: exit 1 ; \ fi ; \ echo "Downloading emmylua_check $(if $(EMMYLUA_VERSION),v$(EMMYLUA_VERSION),latest) [$(EMMY_CHECK_ASSET)]..." ; \- gh release download -R EmmyLuaLs/emmylua-analyzer-rust \+ gh release download --clobber -R EmmyLuaLs/emmylua-analyzer-rust \ $(if $(EMMYLUA_VERSION),"$(EMMYLUA_VERSION)") \ -p "$(EMMY_CHECK_ASSET)" -D $(EMMYLUA_DIR) && \- tar xzf "$(EMMYLUA_DIR)/$(EMMY_CHECK_ASSET)" -C $(EMMYLUA_DIR) && \+ case "$(EMMY_CHECK_ASSET)" in \+ *.zip) unzip -o "$(EMMYLUA_DIR)/$(EMMY_CHECK_ASSET)" -d $(EMMYLUA_DIR) 2>/dev/null || \+ powershell -NoProfile -Command "Expand-Archive -Force -LiteralPath '$(EMMYLUA_DIR)/$(EMMY_CHECK_ASSET)' -DestinationPath '$(EMMYLUA_DIR)'" ;; \+ *) tar xzf "$(EMMYLUA_DIR)/$(EMMY_CHECK_ASSET)" -C $(EMMYLUA_DIR) ;; \+ esac && \ rm -f "$(EMMYLUA_DIR)/$(EMMY_CHECK_ASSET)" ; \ fi ; \ if [ ! -x "$(LUA_FMT_BIN)" ] && ! command -v luafmt >/dev/null 2>&1; then \@@ -123,17 +139,19 @@ deps/emmylua: exit 1 ; \ fi ; \ echo "Downloading luafmt $(if $(EMMYLUA_VERSION),v$(EMMYLUA_VERSION),latest) [$(LUA_FMT_ASSET)]..." ; \- gh release download -R EmmyLuaLs/emmylua-analyzer-rust \+ gh release download --clobber -R EmmyLuaLs/emmylua-analyzer-rust \ $(if $(EMMYLUA_VERSION),"$(EMMYLUA_VERSION)") \ -p "$(LUA_FMT_ASSET)" -D $(EMMYLUA_DIR) && \- tar xzf "$(EMMYLUA_DIR)/$(LUA_FMT_ASSET)" -C $(EMMYLUA_DIR) && \+ case "$(LUA_FMT_ASSET)" in \+ *.zip) unzip -o "$(EMMYLUA_DIR)/$(LUA_FMT_ASSET)" -d $(EMMYLUA_DIR) 2>/dev/null || \+ powershell -NoProfile -Command "Expand-Archive -Force -LiteralPath '$(EMMYLUA_DIR)/$(LUA_FMT_ASSET)' -DestinationPath '$(EMMYLUA_DIR)'" ;; \+ *) tar xzf "$(EMMYLUA_DIR)/$(LUA_FMT_ASSET)" -C $(EMMYLUA_DIR) ;; \+ esac && \ rm -f "$(EMMYLUA_DIR)/$(LUA_FMT_ASSET)" ; \ fi .PHONY: lint-lint:- VIMRUNTIME="$$(nvim --clean --headless +'echo $$VIMRUNTIME' +q 2>&1)" \- lua-language-server --configpath=../.luarc.jsonc --check=.+lint: emmylua-check .PHONY: emmylua-check emmylua-check: | deps/emmylua