Skip to content

Commit 18a5887

Browse files
committed
scripts: fix make generate and seperate tooling
Signed-off-by: Damien Grisonnet <[email protected]>
1 parent 0319ad3 commit 18a5887

File tree

6 files changed

+49
-7
lines changed

6 files changed

+49
-7
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
_output/
22
manifest-tool
3-
.idea/*
3+
.idea/*
4+
tmp

Makefile

+14-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ ALL_BINARIES ?= $(addprefix $(OUT_DIR)/$(BIN)-, \
2020
darwin-amd64 \
2121
windows-amd64.exe)
2222

23+
TOOLS_BIN_DIR?=$(shell pwd)/tmp/bin
24+
export PATH := $(TOOLS_BIN_DIR):$(PATH)
25+
26+
EMBEDMD_BINARY=$(TOOLS_BIN_DIR)/embedmd
27+
TOOLING=$(EMBEDMD_BINARY)
2328

2429
check-license:
2530
@echo ">> checking license headers"
@@ -82,14 +87,18 @@ test:
8287
test-e2e:
8388
go test -timeout 55m -v ./test/e2e/ $(TEST_RUN_ARGS) --kubeconfig=$(KUBECONFIG)
8489

85-
generate: build embedmd
90+
generate: build $(EMBEDMD_BINARY)
8691
@echo ">> generating examples"
8792
@./scripts/generate-examples.sh
8893
@echo ">> generating docs"
8994
@./scripts/generate-help-txt.sh
90-
@$(GOPATH)/bin/embedmd -w `find ./ -prune -o -name "*.md" -print`
95+
@$(EMBEDMD_BINARY) -w `find ./ -name "*.md" -print`
96+
97+
$(TOOLS_BIN_DIR):
98+
@mkdir -p $(TOOLS_BIN_DIR)
9199

92-
embedmd:
93-
@go get github.com/campoy/embedmd
100+
$(TOOLING): $(TOOLS_BIN_DIR)
101+
@echo Installing tools from scripts/tools.go
102+
@cat scripts/tools.go | grep _ | awk -F'"' '{print $$2}' | GOBIN=$(TOOLS_BIN_DIR) xargs -tI % go install -mod=readonly -modfile=scripts/go.mod %
94103

95-
.PHONY: all check-license crossbuild build container push push-% manifest-push curl-container test generate embedmd
104+
.PHONY: all check-license crossbuild build container push push-% manifest-push curl-container test generate

scripts/generate-help-txt.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
22

33
echo "$ kube-rbac-proxy -h" > _output/help.txt
4-
_output/linux/amd64/kube-rbac-proxy -h 2>> _output/help.txt
4+
_output/kube-rbac-proxy -h 2>> _output/help.txt
55
exit 0

scripts/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/brancz/kube-rbac-proxy/tooling
2+
3+
go 1.14
4+
5+
require github.com/campoy/embedmd v1.0.0

scripts/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/campoy/embedmd v1.0.0 h1:V4kI2qTJJLf4J29RzI/MAt2c3Bl4dQSYPuflzwFH2hY=
2+
github.com/campoy/embedmd v1.0.0/go.mod h1:oxyr9RCiSXg0M3VJ3ks0UGfp98BpSSGr0kpiX3MzVl8=
3+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

scripts/tools.go

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
Copyright 2020 Frederic Branczyk All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
//+build tools
18+
19+
package tools
20+
21+
import (
22+
_ "github.com/campoy/embedmd"
23+
)

0 commit comments

Comments
 (0)