Skip to content

Commit

Permalink
chore: remove gensample (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahdietz authored Aug 3, 2021
1 parent 5faa9d0 commit 307bda7
Show file tree
Hide file tree
Showing 48 changed files with 10 additions and 5,031 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ jobs:
run: go get -u golang.org/x/lint/golint
if: ${{ always() }}
- name: Lint
# Exclude all gensample code and the grpc_service_config package (it is generated).
run: golint -set_exit_status $(go list ./... | grep -v 'sample\|grpc_service_config') > golint.txt
# Exclude all of the grpc_service_config package (it is generated).
run: golint -set_exit_status $(go list ./... | grep -v 'grpc_service_config') > golint.txt
if: ${{ always() }}
- name: Vet
# The mod download is there to prevent go vet from logging mod downloads
# which would mess up the empty vetting results check.
# Exclude all gensample code and the grpc_service_config package (it is generated).
run: go mod download && go vet $(go list ./... | grep -v 'sample\|grpc_service_config') > govet.txt && ! [ -s govet.txt ]
# Exclude all of the grpc_service_config package (it is generated).
run: go mod download && go vet $(go list ./... | grep -v 'grpc_service_config') > govet.txt && ! [ -s govet.txt ]
if: ${{ always() }}
- name: Check license
run: go run ./util/cmd/license
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Test everything and run Showcase integration tests:
make test

When opening a PR, please prefix the title with the main component the change effects,
separated from the message with a colon. This chould be one of `gapic`, `gencli`, `samples`,
separated from the message with a colon. This chould be one of `gapic`, `gencli`,
`bazel`, or `chore`. For example:

gapic: strip reference links in comments
Expand Down
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ The configuration supported by the plugin option includes:
* `api-service-config`: the path the service YAML file.
* This is used for service-level client documentation.

* `sample`: path to sample configuration files.
* This is used for sample generation. Refer to [sample generation guide](./cmd/gen-go-sample/README.md) for more details.

* `gapic`: path to the legacy gapic configuration file.
* This is used for sample generation only. Both gapic config itself and this option will be deprecated soon. Refer to [sample generation guide](./cmd/gen-go-sample/README.md) for more details.

Bazel
-----

Expand Down Expand Up @@ -152,14 +146,6 @@ following attributes:
* `service_yaml`: a label for a service YAML file.
* _Note: This option will eventually be deprecated._

* `samples`: a path to a sample config file. There
can exist multiples of this.

* `gapic_yaml`: path to a gapic configuration file.
* _Note: This config is only used to generate samples._

* `sample_only`: if present, directs the generator to forgo client generation and generate only samples.

* `metadata`: if `True`, [GapicMetadata](https://github.com/googleapis/googleapis/blob/master/gapic/metadata/gapic_metadata.proto) will be generated in JSON form. The default is `False`.

Docker Wrapper
Expand Down
20 changes: 0 additions & 20 deletions cmd/gen-go-sample/BUILD.bazel

This file was deleted.

105 changes: 0 additions & 105 deletions cmd/gen-go-sample/README.md

This file was deleted.

79 changes: 0 additions & 79 deletions cmd/gen-go-sample/main.go

This file was deleted.

41 changes: 0 additions & 41 deletions cmd/gen-go-sample/test.bash

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/protoc-gen-go_cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ go_library(
visibility = ["//visibility:private"],
deps = [
"//internal/gencli",
"@com_github_golang_protobuf//proto",
"@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto",
"@org_golang_google_protobuf//proto",
],
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/protoc-gen-go_cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"log"
"os"

"github.com/golang/protobuf/proto"
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
"github.com/googleapis/gapic-generator-go/internal/gencli"
"google.golang.org/protobuf/proto"
)

func main() {
Expand Down
3 changes: 1 addition & 2 deletions cmd/protoc-gen-go_gapic/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ go_library(
visibility = ["//visibility:private"],
deps = [
"//internal/gengapic",
"//internal/gensample",
"@com_github_golang_protobuf//proto",
"@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto",
"@org_golang_google_protobuf//proto",
],
)

Expand Down
22 changes: 1 addition & 21 deletions cmd/protoc-gen-go_gapic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ import (
"log"
"os"

"github.com/golang/protobuf/proto"
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
"github.com/googleapis/gapic-generator-go/internal/gengapic"
"github.com/googleapis/gapic-generator-go/internal/gensample"
"google.golang.org/protobuf/proto"
)

func main() {
Expand All @@ -40,12 +39,6 @@ func main() {
genResp.Error = proto.String(err.Error())
}

sampleResp, err := gensample.PluginEntry(&genReq)
if err != nil {
sampleResp.Error = proto.String(err.Error())
}

genResp = merge(genResp, sampleResp)
genResp.SupportedFeatures = proto.Uint64(uint64(plugin.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL))

outBytes, err := proto.Marshal(genResp)
Expand All @@ -56,16 +49,3 @@ func main() {
log.Fatal(err)
}
}

func merge(gapicResp, sampleResp *plugin.CodeGeneratorResponse) *plugin.CodeGeneratorResponse {
if gapicResp.GetError() != "" {
return gapicResp
}
if sampleResp.GetError() != "" {
return sampleResp
}
resp := plugin.CodeGeneratorResponse{}
resp.File = append(resp.File, gapicResp.GetFile()...)
resp.File = append(resp.File, sampleResp.GetFile()...)
return &resp
}
Loading

0 comments on commit 307bda7

Please sign in to comment.