Skip to content

Commit

Permalink
use go modules to rack tools
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed Jul 28, 2021
1 parent 8352b07 commit 7a75db8
Show file tree
Hide file tree
Showing 7 changed files with 862 additions and 65 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "./hack/tools"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ logid
/server
swagger
dist/*
hack/*
hack/tools/bin/*
13 changes: 5 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ SRCS = $(shell find cmd -iname "*.go") $(shell find pkg -iname "*.go"|grep -v pk
TOOLS_DIR := hack/tools
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/bin)
BIN_DIR := $(abspath $(ROOT_DIR)/bin)
GO_INSTALL = ./scripts/go_install.sh


# Set version variables for LDFLAGS
GIT_VERSION ?= $(shell git describe --tags --always --dirty)
Expand All @@ -43,9 +41,7 @@ ifeq ($(DIFF), 1)
endif

# Binaries
SWAGGER_VER := v0.27.0
SWAGGER_BIN := swagger
SWAGGER := $(TOOLS_BIN_DIR)/$(SWAGGER_BIN)-$(SWAGGER_VER)
SWAGGER := $(TOOLS_BIN_DIR)/swagger

CLI_PKG=github.com/sigstore/rekor/cmd/rekor-cli/app
CLI_LDFLAGS="-X $(CLI_PKG).gitVersion=$(GIT_VERSION) -X $(CLI_PKG).gitCommit=$(GIT_HASH) -X $(CLI_PKG).gitTreeState=$(GIT_TREESTATE) -X $(CLI_PKG).buildDate=$(BUILD_DATE)"
Expand Down Expand Up @@ -84,7 +80,7 @@ test:

clean:
rm -rf dist
rm -rf hack/tools
rm -rf hack/tools/bin
rm -rf rekor-cli rekor-server

clean-gen: clean
Expand Down Expand Up @@ -128,9 +124,10 @@ dist-server:
.PHONY: dist
dist: dist-server dist-cli


## --------------------------------------
## Tooling Binaries
## --------------------------------------

$(SWAGGER): ## Build swagger from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/go-swagger/go-swagger/cmd/swagger $(SWAGGER_BIN) $(SWAGGER_VER)
$(SWAGGER): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go build -tags=tools -o $(TOOLS_BIN_DIR)/swagger github.com/go-swagger/go-swagger/cmd/swagger
5 changes: 5 additions & 0 deletions hack/tools/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/sigstore/rekor/hack/tools

go 1.16

require github.com/go-swagger/go-swagger v0.27.0
824 changes: 824 additions & 0 deletions hack/tools/go.sum

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions hack/tools/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// +build tools

// Copyright 2021 The Sigstore Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

// This package imports things required by build scripts, to force `go mod` to see them as dependencies
package tools

import (
_ "github.com/go-swagger/go-swagger/cmd/swagger"
)
56 changes: 0 additions & 56 deletions scripts/go_install.sh

This file was deleted.

0 comments on commit 7a75db8

Please sign in to comment.