Skip to content

Commit

Permalink
Merge main into dev (#2959)
Browse files Browse the repository at this point in the history
Co-authored-by: buf-release-bot[bot] <116301919+buf-release-bot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Stefan VanBuren <svanburen@buf.build>
  • Loading branch information
4 people committed May 8, 2024
1 parent c579c78 commit d34a269
Show file tree
Hide file tree
Showing 12 changed files with 1,034 additions and 616 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
#- uses: bufbuild/buf-setup-action@v1.30.0
#with:
#github_token: ${{ github.token }}
- uses: actions/setup-go@v5
- uses: bufbuild/buf-setup-action@v1.32.0-beta.1
with:
go-version: '1.22.x'
- run: go install ./cmd/buf
github_token: ${{ github.token }}
- uses: bufbuild/buf-lint-action@v1.1.1
with:
buf_token: ${{ secrets.BUF_TOKEN }}
breaking:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
#- uses: bufbuild/buf-setup-action@v1.30.0
#with:
#github_token: ${{ github.token }}
- uses: actions/setup-go@v5
- uses: bufbuild/buf-setup-action@v1.32.0-beta.1
with:
go-version: '1.22.x'
- run: go install ./cmd/buf
github_token: ${{ github.token }}
- uses: bufbuild/buf-breaking-action@v1.1.4
with:
against: buf.build/bufbuild/buf
Expand All @@ -41,13 +33,9 @@ jobs:
- breaking
steps:
- uses: actions/checkout@v4
#- uses: bufbuild/buf-setup-action@v1.30.0
#with:
#github_token: ${{ github.token }}
- uses: actions/setup-go@v5
- uses: bufbuild/buf-setup-action@v1.32.0-beta.1
with:
go-version: '1.22.x'
- run: go install ./cmd/buf
github_token: ${{ github.token }}
- uses: bufbuild/buf-push-action@v1.2.0
with:
input: 'proto'
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/bufbuild/protoplugin v0.0.0-20240323223605-e2735f6c31ee
github.com/bufbuild/protovalidate-go v0.6.2
github.com/bufbuild/protoyaml-go v0.1.9
github.com/docker/docker v26.1.0+incompatible
github.com/docker/docker v26.1.1+incompatible
github.com/go-chi/chi/v5 v5.0.12
github.com/gofrs/flock v0.8.1
github.com/gofrs/uuid/v5 v5.1.0
Expand Down Expand Up @@ -40,7 +40,7 @@ require (
golang.org/x/mod v0.17.0
golang.org/x/net v0.24.0
golang.org/x/sync v0.7.0
golang.org/x/term v0.19.0
golang.org/x/term v0.20.0
golang.org/x/tools v0.20.0
google.golang.org/protobuf v1.34.1
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -56,7 +56,7 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v26.1.0+incompatible // indirect
github.com/docker/cli v26.1.1+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.1 // indirect
github.com/docker/go-connections v0.5.0 // indirect
Expand All @@ -67,7 +67,7 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
github.com/google/pprof v0.0.0-20240430035430-e4905b036c4e // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
Expand All @@ -87,8 +87,8 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.2.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240429193739-8cf5692501f6 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 // indirect
)
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/cli v26.1.0+incompatible h1:+nwRy8Ocd8cYNQ60mozDDICICD8aoFGtlPXifX/UQ3Y=
github.com/docker/cli v26.1.0+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/cli v26.1.1+incompatible h1:bE1/uE2tCa08fMv+7ikLR/RDPoCqytwrLtkIkSzxLvw=
github.com/docker/cli v26.1.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v26.1.0+incompatible h1:W1G9MPNbskA6VZWL7b3ZljTh0pXI68FpINx0GKaOdaM=
github.com/docker/docker v26.1.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v26.1.1+incompatible h1:oI+4kkAgIwwb54b9OC7Xc3hSgu1RlJA/Lln/DF72djQ=
github.com/docker/docker v26.1.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo=
github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
Expand Down Expand Up @@ -93,8 +93,8 @@ github.com/google/go-containerregistry v0.19.1 h1:yMQ62Al6/V0Z7CqIrrS1iYoA5/oQCm
github.com/google/go-containerregistry v0.19.1/go.mod h1:YCMFNQeeXeLF+dnhhWkqDItx/JSkH01j1Kis4PsjzFI=
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg=
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg=
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
github.com/google/pprof v0.0.0-20240430035430-e4905b036c4e h1:RsXNnXE59RTt8o3DcA+w7ICdRfR2l+Bb5aE0YMpNTO8=
github.com/google/pprof v0.0.0-20240430035430-e4905b036c4e/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is=
github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w=
github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
Expand Down Expand Up @@ -221,14 +221,14 @@ golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
Expand All @@ -240,10 +240,10 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be h1:Zz7rLWqp0ApfsR/l7+zSHhY3PMiH2xqgxlfYfAfNpoU=
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be/go.mod h1:dvdCTIoAGbkWbcIKBniID56/7XHTt6WfxXNMxuziJ+w=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be h1:LG9vZxsWGOmUKieR8wPAUR3u3MpnYFQZROPIMaXh7/A=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
google.golang.org/genproto/googleapis/api v0.0.0-20240429193739-8cf5692501f6 h1:DTJM0R8LECCgFeUwApvcEJHz85HLagW8uRENYxHh1ww=
google.golang.org/genproto/googleapis/api v0.0.0-20240429193739-8cf5692501f6/go.mod h1:10yRODfgim2/T8csjQsMPgZOMvtytXKTDRzH6HRGzRw=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 h1:DujSIu+2tC9Ht0aPNA7jgj23Iq8Ewi5sgkQ++wdvonE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
Expand Down
50 changes: 50 additions & 0 deletions private/bufpkg/bufplugin/bufplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ func PluginToProtoPluginRegistryType(plugin Plugin) registryv1alpha1.PluginRegis
registryType = registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_SWIFT
} else if plugin.Registry().Python != nil {
registryType = registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_PYTHON
} else if plugin.Registry().Cargo != nil {
registryType = registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_CARGO
}
}
return registryType
Expand Down Expand Up @@ -195,6 +197,12 @@ func PluginRegistryToProtoRegistryConfig(pluginRegistry *bufpluginconfig.Registr
return nil, err
}
registryConfig.RegistryConfig = &registryv1alpha1.RegistryConfig_PythonConfig{PythonConfig: pythonConfig}
} else if pluginRegistry.Cargo != nil {
cargoConfig, err := CargoRegistryConfigToProtoCargoConfig(pluginRegistry.Cargo)
if err != nil {
return nil, err
}
registryConfig.RegistryConfig = &registryv1alpha1.RegistryConfig_CargoConfig{CargoConfig: cargoConfig}
}
return registryConfig, nil
}
Expand Down Expand Up @@ -264,10 +272,49 @@ func ProtoRegistryConfigToPluginRegistry(config *registryv1alpha1.RegistryConfig
return nil, err
}
registryConfig.Python = pythonConfig
} else if protoCargoConfig := config.GetCargoConfig(); protoCargoConfig != nil {
cargoConfig, err := ProtoCargoConfigToCargoRegistryConfig(protoCargoConfig)
if err != nil {
return nil, err
}
registryConfig.Cargo = cargoConfig
}
return registryConfig, nil
}

// ProtoCargoConfigToCargoRegistryConfig converts protoCargoConfig to an equivalent [*bufpluginconfig.CargoRegistryConfig].
func ProtoCargoConfigToCargoRegistryConfig(protoCargoConfig *registryv1alpha1.CargoConfig) (*bufpluginconfig.CargoRegistryConfig, error) {
cargoConfig := &bufpluginconfig.CargoRegistryConfig{
RustVersion: protoCargoConfig.RustVersion,
}
for _, dependency := range protoCargoConfig.RuntimeLibraries {
cargoConfig.Deps = append(cargoConfig.Deps, bufpluginconfig.CargoRegistryDependency{
Name: dependency.Name,
VersionRequirement: dependency.VersionRequirement,
DefaultFeatures: dependency.DefaultFeatures,
Features: dependency.Features,
})
}
return cargoConfig, nil
}

// CargoRegistryConfigToProtoCargoConfig converts cargoConfig to an equivalent [*registryv1alpha1.CargoConfig].
func CargoRegistryConfigToProtoCargoConfig(cargoConfig *bufpluginconfig.CargoRegistryConfig) (*registryv1alpha1.CargoConfig, error) {
protoCargoConfig := &registryv1alpha1.CargoConfig{
RustVersion: cargoConfig.RustVersion,
}
for _, dependency := range cargoConfig.Deps {
protoCargoConfig.RuntimeLibraries = append(protoCargoConfig.RuntimeLibraries, &registryv1alpha1.CargoConfig_RuntimeLibrary{
Name: dependency.Name,
VersionRequirement: dependency.VersionRequirement,
DefaultFeatures: dependency.DefaultFeatures,
Features: dependency.Features,
})
}
return protoCargoConfig, nil
}

// ProtoPythonConfigToPythonRegistryConfig converts protoPythonConfig to an equivalent [*bufpluginconfig.PythonRegistryConfig].
func ProtoPythonConfigToPythonRegistryConfig(protoPythonConfig *registryv1alpha1.PythonConfig) (*bufpluginconfig.PythonRegistryConfig, error) {
pythonConfig := &bufpluginconfig.PythonRegistryConfig{
RequiresPython: protoPythonConfig.RequiresPython,
Expand All @@ -286,6 +333,7 @@ func ProtoPythonConfigToPythonRegistryConfig(protoPythonConfig *registryv1alpha1
return pythonConfig, nil
}

// PythonRegistryConfigToProtoPythonConfig converts pythonConfig to an equivalent [*registryv1alpha1.PythonConfig].
func PythonRegistryConfigToProtoPythonConfig(pythonConfig *bufpluginconfig.PythonRegistryConfig) (*registryv1alpha1.PythonConfig, error) {
protoPythonConfig := &registryv1alpha1.PythonConfig{
RequiresPython: pythonConfig.RequiresPython,
Expand All @@ -306,6 +354,7 @@ func PythonRegistryConfigToProtoPythonConfig(pythonConfig *bufpluginconfig.Pytho
return protoPythonConfig, nil
}

// ProtoSwiftConfigToSwiftRegistryConfig converts protoSwiftConfig to an equivalent [*bufpluginconfig.SwiftRegistryConfig].
func ProtoSwiftConfigToSwiftRegistryConfig(protoSwiftConfig *registryv1alpha1.SwiftConfig) (*bufpluginconfig.SwiftRegistryConfig, error) {
swiftConfig := &bufpluginconfig.SwiftRegistryConfig{}
runtimeLibs := protoSwiftConfig.GetRuntimeLibraries()
Expand Down Expand Up @@ -340,6 +389,7 @@ func ProtoSwiftConfigToSwiftRegistryConfig(protoSwiftConfig *registryv1alpha1.Sw
return swiftConfig, nil
}

// SwiftRegistryConfigToProtoSwiftConfig converts swiftConfig to an equivalent [*registryv1alpha1.SwiftConfig].
func SwiftRegistryConfigToProtoSwiftConfig(swiftConfig *bufpluginconfig.SwiftRegistryConfig) *registryv1alpha1.SwiftConfig {
protoSwiftConfig := &registryv1alpha1.SwiftConfig{}
if swiftConfig.Dependencies != nil {
Expand Down
13 changes: 13 additions & 0 deletions private/bufpkg/bufplugin/bufplugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,19 @@ func TestPluginRegistryRoundTrip(t *testing.T) {
},
},
})
assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{
Cargo: &bufpluginconfig.CargoRegistryConfig{
RustVersion: "1.60",
Deps: []bufpluginconfig.CargoRegistryDependency{
{
Name: "prost",
VersionRequirement: "0.12.3",
DefaultFeatures: true,
Features: []string{"some/feature"},
},
},
},
})
}

func assertPluginRegistryRoundTrip(t testing.TB, config *bufpluginconfig.RegistryConfig) {
Expand Down
50 changes: 50 additions & 0 deletions private/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ type RegistryConfig struct {
Maven *MavenRegistryConfig
Swift *SwiftRegistryConfig
Python *PythonRegistryConfig
Cargo *CargoRegistryConfig
// Options is the set of options passed into the plugin for the
// remote registry.
//
Expand Down Expand Up @@ -241,6 +242,31 @@ type PythonRegistryConfig struct {
PackageType string
}

// CargoRegistryDependency defines a runtime dependency for a generated crate.
// It is the subset of a full Cargo dependency specification, which contains
// fields that are currently irrelevant for Generated SDKs.
// Ref: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html
type CargoRegistryDependency struct {
// Name specifies the name of the dependency.
Name string
// VersionRequirement specifies the version requirement of the dependency.
VersionRequirement string
// DefaultFeatures specifies whether or not the default features will
// be enabled for the dependency.
DefaultFeatures bool
// Features specifies the features enabled for the dependency.
Features []string
}

// CargoRegistryConfig is the registry configuration for a Cargo plugin.
type CargoRegistryConfig struct {
// RustVersion specifies the minimum supported Rust version (MSRV) for the generated crate.
// Ref: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
RustVersion string
// Deps specifies the runtime dependencies of the crate.
Deps []CargoRegistryDependency
}

// ConfigOption is an optional option used when loading a Config.
type ConfigOption func(*configOptions)

Expand Down Expand Up @@ -371,6 +397,7 @@ type ExternalRegistryConfig struct {
Maven *ExternalMavenRegistryConfig `json:"maven,omitempty" yaml:"maven,omitempty"`
Swift *ExternalSwiftRegistryConfig `json:"swift,omitempty" yaml:"swift,omitempty"`
Python *ExternalPythonRegistryConfig `json:"python,omitempty" yaml:"python,omitempty"`
Cargo *ExternalCargoRegistryConfig `json:"cargo,omitempty" yaml:"cargo,omitempty"`
Opts []string `json:"opts,omitempty" yaml:"opts,omitempty"`
}

Expand Down Expand Up @@ -479,6 +506,7 @@ type ExternalSwiftRegistryDependencyPlatformConfig struct {
WatchOS string `json:"watchos,omitempty" yaml:"watchos,omitempty"`
}

// ExternalPythonRegistryConfig is the registry configuration for a Python plugin.
type ExternalPythonRegistryConfig struct {
// Deps are dependency specifications for the generated SDK.
Deps []string `json:"deps,omitempty" yaml:"deps,omitempty"`
Expand All @@ -489,6 +517,28 @@ type ExternalPythonRegistryConfig struct {
PackageType string `json:"package_type,omitempty" yaml:"package_type,omitempty"`
}

// ExternalCargoDependency specifies a runtime dependency for a Cargo generated SDK.
type ExternalCargoDependency struct {
// Name specifies the name of the dependency.
Name string `json:"name,omitempty" yaml:"name,omitempty"`
// VersionRequirement specifies the version requirement of the dependency.
VersionRequirement string `json:"req,omitempty" yaml:"req,omitempty"`
// DefaultFeatures specifies whether or not the default features will
// be enabled for the dependency.
DefaultFeatures bool `json:"default_features,omitempty" yaml:"default_features,omitempty"`
// Features specifies the features enabled for the dependency.
Features []string `json:"features,omitempty" yaml:"features,omitempty"`
}

// ExternalCargoRegistryConfig is the registry configuration for a Rust plugin.
type ExternalCargoRegistryConfig struct {
// RustVersion specifies the minimum supported Rust version (MSRV) for the generated crate.
// Ref: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
RustVersion string `json:"rust_version,omitempty" yaml:"rust_version,omitempty"`
// Deps specifies the dependencies for the generated SDK.
Deps []ExternalCargoDependency `json:"deps,omitempty" yaml:"deps,omitempty"`
}

type externalConfigVersion struct {
Version string `json:"version,omitempty" yaml:"version,omitempty"`
}
Expand Down

0 comments on commit d34a269

Please sign in to comment.