-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
generate-sequential
make target (#259)
* Add generate-sequential make target * fix interface name * make generate-sequential
- Loading branch information
1 parent
5fd2dd9
commit 9386a44
Showing
9 changed files
with
105 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
# SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Gardener contributors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -e | ||
|
||
echo "> Generate" | ||
|
||
go generate $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//go:build tools | ||
// +build tools | ||
|
||
/* | ||
SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Gardener contributors | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// This package imports things required by build scripts, to force `go mod` to see them as dependencies | ||
package tools | ||
|
||
import ( | ||
_ "github.com/golang/mock/mockgen" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Gardener contributors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin | ||
MOCKGEN := $(TOOLS_BIN_DIR)/mockgen | ||
|
||
export TOOLS_BIN_DIR := $(TOOLS_BIN_DIR) | ||
export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH) | ||
|
||
######################################### | ||
# Common # | ||
######################################### | ||
|
||
# Tool targets should declare go.mod as a prerequisite, if the tool's version is managed via go modules. This causes | ||
# make to rebuild the tool in the desired version, when go.mod is changed. | ||
# For tools where the version is not managed via go.mod, we use a file per tool and version as an indicator for make | ||
# whether we need to install the tool or a different version of the tool (make doesn't rerun the rule if the rule is | ||
# changed). | ||
|
||
# Use this "function" to add the version file as a prerequisite for the tool target: e.g. | ||
# $(HELM): $(call tool_version_file,$(HELM),$(HELM_VERSION)) | ||
tool_version_file = $(TOOLS_BIN_DIR)/.version_$(subst $(TOOLS_BIN_DIR)/,,$(1))_$(2) | ||
|
||
# This target cleans up any previous version files for the given tool and creates the given version file. | ||
# This way, we can generically determine, which version was installed without calling each and every binary explicitly. | ||
$(TOOLS_BIN_DIR)/.version_%: | ||
@version_file=$@; rm -f $${version_file%_*}* | ||
@touch $@ | ||
|
||
.PHONY: clean-tools-bin | ||
clean-tools-bin: | ||
rm -rf $(TOOLS_BIN_DIR)/* | ||
|
||
######################################### | ||
# Tools # | ||
######################################### | ||
|
||
$(MOCKGEN): go.mod | ||
go build -o $(MOCKGEN) github.com/golang/mock/mockgen |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters