From 465ba717aa874884325e0e800dc20f80702306f4 Mon Sep 17 00:00:00 2001 From: Brian Jones Date: Tue, 16 Jun 2020 09:22:17 -0400 Subject: [PATCH 1/3] Feat(build): fix Makefile when building on MacOS macos default `date` command doesn't seem to have the `--rfc-3339=date` flag. So this switches to a presumably more universal format string. also adds the ability to override the default `DST` to `~/$(BIN)` directories other than ~/.bin, and pulls shared commands into Make variables. --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 770ab97..c0b7de1 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ +DATE := $$(date +%Y-%m-%dT%T%z) +VERSION := $$(git describe --tags) +COMMIT := $$(git rev-list -1 HEAD) +DST ?= ~/.bin/ + default: - go build -ldflags "-X main.GitCommit=$$(git rev-list -1 HEAD) -X main.Version=$$(git describe --tags) -X main.Date=$$(date --rfc-3339=date)" + go build -ldflags "-X main.GitCommit=$(COMMIT) -X main.Version=$(VERSION) -X main.Date=$(DATE)" copy: - go build -ldflags "-X main.GitCommit=$$(git rev-list -1 HEAD) -X main.Version=$$(git describe --tags) -X main.Date=$$(date --rfc-3339=date)" && cp ./terraform-lsp ~/.bin/ && cp ./terraform-lsp ~/ + go build -ldflags "-X main.GitCommit=$(COMMIT) -X main.Version=$(VERSION) -X main.Date=$(DATE)" && cp ./terraform-lsp $(DST) && cp ./terraform-lsp ~/ .PHONY: copy From ad53d84dec00301dc205de4a539fa5a95ca01d6e Mon Sep 17 00:00:00 2001 From: Brian Jones Date: Tue, 16 Jun 2020 09:29:53 -0400 Subject: [PATCH 2/3] Feat(docs): add example for the `DST` flag --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 83085ff..eb0aa92 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This is LSP (Language Server Protocol) for Terraform **IMPORTANT:** Currently there is two terraform lsp, one is this one and the other one is [terraform-ls](https://github.com/hashicorp/terraform-ls), which contain details about this repo as well. -The aim to have a unified lsp for terraform in the future, but for now there is two concurrent development with collabration to each other, this repo is aim for more experimental features, and the terraform-ls is aim for stableness +The aim to have a unified lsp for terraform in the future, but for now there is two concurrent development with collabration to each other, this repo is aim for more experimental features, and the terraform-ls is aim for stableness **NOTE:** This is first stage of the plugin, so is experimental @@ -48,6 +48,12 @@ make # Build the project. Alternatively run "go build" make copy # Install the project ``` +you may also specify a path to your preferred bin directory with the `DST` parameter + +```sh +make copy DST="$your_preferred_bin_path" # Install the project +``` + ### Nixpkgs - install nixpkgs @@ -101,7 +107,7 @@ All Todos are listed [here](Todo.md) ## Bugs - Order of completion items -- Issue with block +- Issue with block ## Credits - LSP structure using [Sourcegraph's go-lsp](https://github.com/sourcegraph/go-lsp) From f78c05b593daa565859972bb4598cc72ef5eca47 Mon Sep 17 00:00:00 2001 From: Brian Jones Date: Tue, 16 Jun 2020 10:26:51 -0400 Subject: [PATCH 3/3] Feat(build): make copy depend on build --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c0b7de1..e61f6a5 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,15 @@ VERSION := $$(git describe --tags) COMMIT := $$(git rev-list -1 HEAD) DST ?= ~/.bin/ -default: +terraform-lsp: go build -ldflags "-X main.GitCommit=$(COMMIT) -X main.Version=$(VERSION) -X main.Date=$(DATE)" -copy: - go build -ldflags "-X main.GitCommit=$(COMMIT) -X main.Version=$(VERSION) -X main.Date=$(DATE)" && cp ./terraform-lsp $(DST) && cp ./terraform-lsp ~/ +copy: terraform-lsp + cp ./terraform-lsp $(DST) && cp ./terraform-lsp ~/ -.PHONY: copy +clean: + rm -f terraform-lsp + +default: terraform-lsp + +.PHONY: clean copy