gitsigns.nvim/Makefile

113 lines
2.4 KiB
Makefile
Raw Normal View History

2020-10-23 00:51:41 +08:00
export PJ_ROOT=$(PWD)
2021-12-13 20:05:50 +08:00
FILTER ?= .*
NVIM_RUNNER_VERSION := v0.9.5
NVIM_TEST_VERSION ?= v0.9.5
2021-02-27 18:50:11 +08:00
2023-06-11 23:41:47 +08:00
ifeq ($(shell uname -s),Darwin)
2023-09-23 18:01:18 +08:00
UNAME ?= MACOS
2023-06-11 23:41:47 +08:00
else
2023-09-23 18:01:18 +08:00
UNAME ?= LINUX
2023-06-11 23:41:47 +08:00
endif
2022-10-07 22:13:15 +08:00
2023-09-23 18:01:18 +08:00
NVIM_PLATFORM_MACOS := macos
NVIM_PLATFORM_LINUX := linux64
NVIM_PLATFORM ?= $(NVIM_PLATFORM_$(UNAME))
2023-06-11 23:41:47 +08:00
NVIM_URL := https://github.com/neovim/neovim/releases/download
2023-06-11 23:41:47 +08:00
NVIM_RUNNER := nvim-runner-$(NVIM_RUNNER_VERSION)
NVIM_RUNNER_URL := $(NVIM_URL)/$(NVIM_RUNNER_VERSION)/nvim-$(NVIM_PLATFORM).tar.gz
2021-07-06 20:08:20 +08:00
2023-06-11 23:41:47 +08:00
NVIM_TEST := nvim-test-$(NVIM_TEST_VERSION)
NVIM_TEST_URL := $(NVIM_URL)/$(NVIM_TEST_VERSION)/nvim-$(NVIM_PLATFORM).tar.gz
2023-06-11 23:41:47 +08:00
export NVIM_PRG = $(NVIM_TEST)/bin/nvim
2023-06-11 23:41:47 +08:00
.DEFAULT_GOAL := build
2023-06-11 23:41:47 +08:00
define fetch_nvim
rm -rf $@
rm -rf nvim-$(NVIM_PLATFORM).tar.gz
wget $(1)
tar -xf nvim-$(NVIM_PLATFORM).tar.gz
rm -rf nvim-$(NVIM_PLATFORM).tar.gz
mv nvim-$(NVIM_PLATFORM) $@
endef
2023-06-11 23:41:47 +08:00
$(NVIM_RUNNER):
$(call fetch_nvim,$(NVIM_RUNNER_URL))
2023-06-11 23:41:47 +08:00
$(NVIM_TEST):
$(call fetch_nvim,$(NVIM_TEST_URL))
2020-12-03 07:08:28 +08:00
2023-06-11 23:41:47 +08:00
.PHONY: nvim
nvim: $(NVIM_RUNNER) $(NVIM_TEST)
2022-10-07 22:13:15 +08:00
2023-06-11 23:41:47 +08:00
LUAROCKS := luarocks --lua-version=5.1 --tree .luarocks
2023-06-11 23:41:47 +08:00
.luarocks/bin/busted:
$(LUAROCKS) install busted
2023-09-25 00:30:11 +08:00
.PHONY: busted
busted: .luarocks/bin/busted
.PHONY: test
2023-06-11 23:41:47 +08:00
test: $(NVIM_RUNNER) $(NVIM_TEST) .luarocks/bin/busted
eval $$($(LUAROCKS) path) && $(NVIM_RUNNER)/bin/nvim -ll test/busted/runner.lua -v \
--lazy \
--helper=$(PWD)/test/preload.lua \
2023-06-11 23:41:47 +08:00
--output test.busted.output_handler \
--lpath=$(PWD)/lua/?.lua \
2021-12-13 20:05:50 +08:00
--filter="$(FILTER)" \
$(PWD)/test
2021-07-22 00:22:35 +08:00
2021-06-19 23:05:37 +08:00
-@stty sane
2023-10-05 21:18:40 +08:00
.PHONY: test-all
test-all:
$(MAKE) test NVIM_TEST_VERSION=v0.8.3
$(MAKE) test NVIM_TEST_VERSION=v0.9.2
$(MAKE) test NVIM_TEST_VERSION=nightly
.PHONY: gen_help
2023-09-23 18:01:18 +08:00
gen_help: $(NVIM_RUNNER)
@$(NVIM_RUNNER)/bin/nvim -l ./gen_help.lua
@echo Updated help
2023-09-23 18:01:18 +08:00
STYLUA_PLATFORM_MACOS := macos-aarch64
STYLUA_PLATFORM_LINUX := linux-x86_64
STYLUA_PLATFORM := $(STYLUA_PLATFORM_$(UNAME))
STYLUA_VERSION := v0.18.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)
.INTERMEDIATE: $(STYLUA_ZIP)
$(STYLUA_ZIP):
wget $(STYLUA_URL)
stylua: $(STYLUA_ZIP)
unzip $<
.PHONY: stylua-check
stylua-check: stylua
./stylua --check lua/**/*.lua
.PHONY: stylua-run
stylua-run: stylua
2023-10-06 00:11:47 +08:00
./stylua \
lua/**/*.lua lua/*.lua \
test/*.lua test/**/*.lua
2023-09-23 18:01:18 +08:00
.PHONY: build
2023-09-23 18:01:18 +08:00
build: gen_help stylua-run
.PHONY: doc-check
doc-check: gen_help
git diff --exit-code -- doc