Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bufdev committed Jan 24, 2024
1 parent d73d376 commit 721b39b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.20

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-20231115204500-e097f827e652.1
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.14.0-20240103033507-2860fe703a60.1
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.32.0-20240103033507-2860fe703a60.1
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.14.0-20240124193556-c1b9aad65c81.1
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.32.0-20240124193556-c1b9aad65c81.1
connectrpc.com/connect v1.14.0
connectrpc.com/otelconnect v0.7.0
github.com/bufbuild/protocompile v0.8.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-2023111520450
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-20231115204500-e097f827e652.1/go.mod h1:tiTMKD8j6Pd/D2WzREoweufjzaJKHZg35f/VGcZ2v3I=
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.14.0-20240103033507-2860fe703a60.1 h1:tyOczeIHltbjCt0R1FqOUW6GYOFGtxfWmVROxZtGfNo=
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.14.0-20240103033507-2860fe703a60.1/go.mod h1:In1Pi5BipMwL3oumRdchqsf/xKZ8BM8+g2/8+qUIFAM=
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.14.0-20240124193556-c1b9aad65c81.1 h1:pFs/DMJMhNd+tlwkXbzx2bzWXiJPLHDyZjFZyNYICoE=
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.14.0-20240124193556-c1b9aad65c81.1/go.mod h1:czrtSW9UGDwm5munsVYBBIpRaL29UBCOE6qi7em+4qE=
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.32.0-20240103033507-2860fe703a60.1 h1:slGktetnGQEVfeAaDjpy/uv1XTJXrbW0sElbiMj4fEc=
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.32.0-20240103033507-2860fe703a60.1/go.mod h1:L+pboYag9Pd0vt+ErAHa7QSdqP0Dzd7S+4OLKlrXNXQ=
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.32.0-20240124193556-c1b9aad65c81.1 h1:ZiA3hFK2dF93c8uOLOB78dQ4xWas8KM04NDKguPWIUE=
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.32.0-20240124193556-c1b9aad65c81.1/go.mod h1:L+pboYag9Pd0vt+ErAHa7QSdqP0Dzd7S+4OLKlrXNXQ=
connectrpc.com/connect v1.14.0 h1:PDS+J7uoz5Oui2VEOMcfz6Qft7opQM9hPiKvtGC01pA=
connectrpc.com/connect v1.14.0/go.mod h1:uoAq5bmhhn43TwhaKdGKN/bZcGtzPW1v+ngDTn5u+8s=
connectrpc.com/otelconnect v0.7.0 h1:ZH55ZZtcJOTKWWLy3qmL4Pam4RzRWBJFOqTPyAqCXkY=
Expand Down
13 changes: 13 additions & 0 deletions private/bufpkg/bufmodule/bufmoduleapi/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,22 @@ func protoFilesToBucket(protoFiles []*modulev1beta1.File) (storage.ReadBucket, e
}

func protoFileToObjectData(protoFile *modulev1beta1.File) (bufmodule.ObjectData, error) {
if protoFile == nil {
return nil, nil
}
return bufmodule.NewObjectData(normalpath.Base(protoFile.Path), protoFile.Content)
}

func objectDataToProtoFile(objectData bufmodule.ObjectData) *modulev1beta1.File {
if objectData == nil {
return nil
}
return &modulev1beta1.File{
Path: objectData.Name(),
Content: objectData.Data(),
}
}

func labelNameToProtoScopedLabelRef(labelName string) *modulev1beta1.ScopedLabelRef {
return &modulev1beta1.ScopedLabelRef{
Value: &modulev1beta1.ScopedLabelRef_Name{
Expand Down
4 changes: 2 additions & 2 deletions private/bufpkg/bufmodule/bufmoduleapi/module_data_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ func (a *moduleDataProvider) getIndexedModuleDatasForRegistryAndIndexedModuleKey
},
func() ([]bufmodule.ModuleKey, error) { return depModuleKeys, nil },
func() (bufmodule.ObjectData, error) {
return protoFileToObjectData(protoContent.BufYamlFile)
return protoFileToObjectData(protoContent.V1BufYamlFile)
},
func() (bufmodule.ObjectData, error) {
return protoFileToObjectData(protoContent.BufLockFile)
return protoFileToObjectData(protoContent.V1BufLockFile)
},
),
Index: indexedModuleKey.Index,
Expand Down
6 changes: 5 additions & 1 deletion private/bufpkg/bufmodule/bufmoduleapi/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,12 @@ func Upload(
Files: protoFiles,
DepRefs: protoDepRefs,
ScopedLabelRefs: protoScopedLabelRefs,
// TODO: We may end up synthesizing v1 buf.yamls/buf.locks on bufmodule.Module,
// if we do, we should consider whether we should be sending them over, as the
// backend may come to rely on this.
V1BufYamlFile: objectDataToProtoFile(module.V1Beta1OrV1BufYAMLObjectData()),
V1BufLockFile: objectDataToProtoFile(module.V1Beta1OrV1BufLockObjectData()),
// TODO: vcs_commit
// TODO: buf.yaml, buf.lock
}, nil
},
)
Expand Down

0 comments on commit 721b39b

Please sign in to comment.