Skip to content

Commit

Permalink
Switch to go-licenses for credits collection
Browse files Browse the repository at this point in the history
Signed-off-by: David Gageot <david@gageot.net>
  • Loading branch information
dgageot committed Jan 10, 2020
1 parent 391dfa7 commit e0bc0a7
Show file tree
Hide file tree
Showing 785 changed files with 2,798 additions and 138,019 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ quicktest:
@ ./hack/gotest.sh -short -timeout=60s ./...

.PHONY: install
install: generate-statik $(GO_FILES) $(BUILD_DIR)
install: $(GO_FILES) $(BUILD_DIR)
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=1 go install -tags $(GO_BUILD_TAGS_$(GOOS)) -ldflags $(GO_LDFLAGS_$(GOOS)) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) $(BUILD_PACKAGE)

.PHONY: integration
integration: install
integration: generate-statik install
ifeq ($(GCP_ONLY),true)
gcloud container clusters get-credentials \
$(GKE_CLUSTER_NAME) \
Expand Down Expand Up @@ -225,4 +225,4 @@ generate-schemas:

.PHONY: generate-statik
generate-statik:
hack/gen_statik.sh
hack/generate-statik.sh
38 changes: 22 additions & 16 deletions hack/gen_statik.sh → hack/generate-statik.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,38 @@

set -euo pipefail

export GOFLAGS="-mod=vendor"
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

BIN=${DIR}/bin
LICENSES=${BIN}/licenses
STATIK=${BIN}/statik
LICENSES=go-licenses

mkdir -p ${BIN}
TMP_DIR=$(mktemp -d)
trap "rm -rf $TMP_DIR" EXIT

if ! [[ -f ${LICENSES} ]]; then
pushd ${DIR}/tools
echo >&2 'Installing licenses tool'
GOBIN=${BIN} GO111MODULE=on go install -tags tools github.com/google/trillian/scripts/licenses
popd
if ! [ -x "$(command -v ${LICENSES})" ]; then
# See https://github.com/golang/go/issues/30515
# Also can't be easily installed from a vendor folder because it relies on non-go files
# from a dependency.
echo "Installing go-licenses"
pushd $(mktemp -d)
go mod init tmp; go get -mod='' github.com/google/go-licenses
popd
fi

TMP_DIR=$(mktemp -d)
trap "rm -rf $TMP_DIR" EXIT
echo "Collecting licenses"
cd ${DIR}/..
${LICENSES} save github.com/GoogleContainerTools/skaffold/cmd/skaffold --save_path="${TMP_DIR}/skaffold-credits"
chmod -R u+w "${TMP_DIR}/skaffold-credits"

${LICENSES} save "github.com/GoogleContainerTools/skaffold/cmd/skaffold" --save_path="${TMP_DIR}/skaffold-credits"
echo "Collecting schemas"
cp -R docs/content/en/schemas "${TMP_DIR}/schemas"

if ! [[ -f ${STATIK} ]]; then
pushd ${DIR}/tools
echo >&2 'Installing statik tool'
GOBIN=${BIN} GO111MODULE=on go install -tags tools github.com/rakyll/statik
popd
echo 'Installing statik tool'
pushd ${DIR}/tools
GOBIN=${BIN} GO111MODULE=on go install -mod=vendor -tags tools github.com/rakyll/statik
popd
fi

${STATIK} -f -src=${TMP_DIR} -m -dest cmd/skaffold/app/cmd
2 changes: 0 additions & 2 deletions hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ go 1.13

require (
github.com/corneliusweig/release-notes v0.0.0-20191014214505-0be5c7c66752
github.com/google/licenseclassifier v0.0.0-20190926221455-842c0d70d702 // indirect
github.com/google/trillian v1.3.2-0.20191031155000-9600d042b2e7
github.com/rakyll/statik v0.1.6
)
444 changes: 2 additions & 442 deletions hack/tools/go.sum

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion hack/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ package main

import (
_ "github.com/corneliusweig/release-notes"
_ "github.com/google/trillian/scripts/licenses"
_ "github.com/rakyll/statik"
)
42 changes: 0 additions & 42 deletions hack/tools/vendor.sh

This file was deleted.

41 changes: 0 additions & 41 deletions hack/tools/vendor/github.com/emirpasic/gods/LICENSE

This file was deleted.

This file was deleted.

This file was deleted.

109 changes: 0 additions & 109 deletions hack/tools/vendor/github.com/emirpasic/gods/containers/iterator.go

This file was deleted.

Loading

0 comments on commit e0bc0a7

Please sign in to comment.