Skip to content

Commit

Permalink
build: store all deps in deps dir
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Feb 8, 2025
1 parent db252c4 commit 4baa135
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
doc/tags

scratch/dummy_ignored.txt

nvim-test
stylua
lua-language-server-*
luals_check
deps
43 changes: 26 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ endif

.DEFAULT_GOAL := build

nvim-test:
git clone --depth 1 --branch v1.1.0 https://github.com/lewis6991/nvim-test
nvim-test/bin/nvim-test --init
NVIM_TEST := deps/nvim-test

.PHONY: nvim-test
nvim-test: $(NVIM_TEST)

$(NVIM_TEST):
git clone --depth 1 --branch v1.1.0 https://github.com/lewis6991/nvim-test $@
$@/bin/nvim-test --init

.PHONY: test
test: nvim-test
test: $(NVIM_TEST)
NVIM_TEST_VERSION=$(NVIM_TEST_VERSION) \
nvim-test/bin/nvim-test test \
$(NVIM_TEST)/bin/nvim-test test \
--lpath=$(PWD)/lua/?.lua \
--verbose \
--filter="$(FILTER)"
Expand All @@ -48,7 +53,7 @@ export XDG_DATA_HOME ?= $(HOME)/.data
NVIM := $(XDG_DATA_HOME)/nvim-test/nvim-runner-$(NVIM_RUNNER_VERSION)/bin/nvim

.PHONY: gen_help
gen_help: nvim-test
gen_help: $(NVIM_TEST)
$(NVIM) -l ./gen_help.lua
@echo Updated help

Expand All @@ -60,23 +65,27 @@ STYLUA_VERSION := v2.0.2
STYLUA_ZIP := stylua-$(STYLUA_PLATFORM).zip
STYLUA_URL_BASE := https://github.com/JohnnyMorganz/StyLua/releases/download
STYLUA_URL := $(STYLUA_URL_BASE)/$(STYLUA_VERSION)/$(STYLUA_ZIP)
STYLUA := deps/stylua

.INTERMEDIATE: $(STYLUA_ZIP)
$(STYLUA_ZIP):
wget $(STYLUA_URL)

stylua: $(STYLUA_ZIP)
unzip $<
.PHONY: stylua
stylua: $(STYLUA)

$(STYLUA): $(STYLUA_ZIP)
unzip $< -d $(dir $@)

LUA_FILES := $(shell git ls-files lua test)

.PHONY: stylua-check
stylua-check: stylua
./stylua --check $(LUA_FILES)
stylua-check: $(STYLUA)
$(STYLUA) --check $(LUA_FILES)

.PHONY: stylua-run
stylua-run: stylua
./stylua $(LUA_FILES)
stylua-run: $(STYLUA)
$(STYLUA) $(LUA_FILES)

.PHONY: build
build: gen_help stylua-run
Expand All @@ -92,21 +101,21 @@ else
endif

LUALS_VERSION := 3.13.6
LUALS := lua-language-server-$(LUALS_VERSION)-$(shell uname -s)-$(LUALS_ARCH)
LUALS := deps/lua-language-server-$(LUALS_VERSION)-$(shell uname -s)-$(LUALS_ARCH)
LUALS_TARBALL := $(LUALS).tar.gz
LUALS_URL := https://github.com/LuaLS/lua-language-server/releases/download/$(LUALS_VERSION)/$(LUALS_TARBALL)
LUALS_URL := https://github.com/LuaLS/lua-language-server/releases/download/$(LUALS_VERSION)/$(notdir $(LUALS_TARBALL))

.PHONY: luals
luals: $(LUALS)

$(LUALS):
wget $(LUALS_URL)
mkdir $@
wget --directory-prefix=$(dir $@) $(LUALS_URL)
mkdir -p $@
tar -xf $(LUALS_TARBALL) -C $@
rm -rf $(LUALS_TARBALL)

.PHONY: luals-check
luals-check: $(LUALS) nvim-test
luals-check: $(LUALS) $(NVIM_TEST)
VIMRUNTIME=$(XDG_DATA_HOME)/nvim-test/nvim-test-$(NVIM_TEST_VERSION)/share/nvim/runtime \
$(LUALS)/bin/lua-language-server \
--configpath=../.luarc.json \
Expand Down

0 comments on commit 4baa135

Please sign in to comment.