Skip to content

Commit

Permalink
Move to buf.build/go/spdx
Browse files Browse the repository at this point in the history
  • Loading branch information
bufdev committed Sep 28, 2024
1 parent fd749ca commit 6c8be1c
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 1,842 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ require (

require (
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.34.2-20240828222655-5345c0a56177.2 // indirect
buf.build/go/spdx v0.2.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.12.6 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ buf.build/go/bufplugin v0.3.0 h1:0kxad9/q3nCEbHVYR02crapmRyVT0zTqC/gNkzxuWSs=
buf.build/go/bufplugin v0.3.0/go.mod h1:Znx3zF4ThDWGN1eGFMsbVT9LkMcVV4MKeAC9hiGdN6g=
buf.build/go/protoyaml v0.2.0 h1:2g3OHjtLDqXBREIOjpZGHmQ+U/4mkN1YiQjxNB68Ip8=
buf.build/go/protoyaml v0.2.0/go.mod h1:L/9QvTDkTWcDTzAL6HMfN+mYC6CmZRm2KnsUA054iL0=
buf.build/go/spdx v0.1.0 h1:+xqcRnV1RH8PZG14L9JraGxeN8G/0FxFov+e6YSmhnQ=
buf.build/go/spdx v0.1.0/go.mod h1:bXdwQFem9Si3nsbNy8aJKGPoaPi5DKwdeEp5/ArZ6w8=
buf.build/go/spdx v0.2.0 h1:IItqM0/cMxvFJJumcBuP8NrsIzMs/UYjp/6WSpq8LTw=
buf.build/go/spdx v0.2.0/go.mod h1:bXdwQFem9Si3nsbNy8aJKGPoaPi5DKwdeEp5/ArZ6w8=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
connectrpc.com/connect v1.17.0 h1:W0ZqMhtVzn9Zhn2yATuUokDLO5N+gIuBWMOnsQrfmZk=
connectrpc.com/connect v1.17.0/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8=
Expand Down
8 changes: 2 additions & 6 deletions make/buf/all.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ GO_BINS := $(GO_BINS) \
private/pkg/git/cmd/git-ls-files-unstaged \
private/pkg/storage/cmd/ddiff \
private/pkg/storage/cmd/storage-go-data \
private/pkg/licenseheader/cmd/license-header \
private/pkg/spdx/cmd/spdx-go-data
private/pkg/licenseheader/cmd/license-header
GO_TEST_BINS := $(GO_TEST_BINS) \
private/buf/cmd/buf/command/alpha/protoc/internal/protoc-gen-insertion-point-receiver \
private/buf/cmd/buf/command/alpha/protoc/internal/protoc-gen-insertion-point-writer \
Expand Down Expand Up @@ -82,13 +81,10 @@ bandeps: installbandeps
postlonglint:: bandeps

.PHONY: godata
godata: installspdx-go-data installwkt-go-data installbuf-legacyfederation-go-data $(PROTOC)
godata: installwkt-go-data installbuf-legacyfederation-go-data $(PROTOC)
rm -rf private/gen/data/datawkt
mkdir -p private/gen/data/datawkt
wkt-go-data "$(CACHE_INCLUDE)" --package datawkt --protobuf-version "$(PROTOC_VERSION)" > private/gen/data/datawkt/datawkt.gen.go
rm -rf private/gen/data/dataspdx
mkdir -p private/gen/data/dataspdx
spdx-go-data --package dataspdx > private/gen/data/dataspdx/dataspdx.gen.go
ifdef LEGACY_FEDERATION_FILE_PATH
rm -rf private/gen/data/datalegacyfederation
mkdir -p private/gen/data/datalegacyfederation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"fmt"
"strings"

"buf.build/go/spdx"
"github.com/bufbuild/buf/private/bufpkg/bufremoteplugin/bufremotepluginref"
"github.com/bufbuild/buf/private/gen/data/dataspdx"
"github.com/bufbuild/buf/private/pkg/slicesext"
"golang.org/x/mod/modfile"
"golang.org/x/mod/semver"
Expand Down Expand Up @@ -66,8 +66,8 @@ func newConfig(externalConfig ExternalConfig, options []ConfigOption) (*Config,
}
spdxLicenseID := externalConfig.SPDXLicenseID
if spdxLicenseID != "" {
if licenseInfo, ok := dataspdx.GetLicenseInfo(spdxLicenseID); ok {
spdxLicenseID = licenseInfo.ID()
if license, ok := spdx.LicenseForID(spdxLicenseID); ok {
spdxLicenseID = license.ID
} else {
return nil, fmt.Errorf("unknown SPDX License ID %q", spdxLicenseID)
}
Expand Down
Loading

0 comments on commit 6c8be1c

Please sign in to comment.