mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-01 11:58:21 +00:00
800c990248
This initial textproto unmarshaling implementation covers messages without the use of extensions, Any expansion, nor weak. Updated encoding tests. Split some testcases to keep each simpler. Added TestRoundTrip for example messages like the well-known types. Change-Id: Icffab02834aa004fa8409a9da70624f687f604fb Reviewed-on: https://go-review.googlesource.com/c/153020 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
54 lines
1.9 KiB
Bash
Executable File
54 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# Copyright 2018 The Go Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style
|
|
# license that can be found in the LICENSE file.
|
|
|
|
set -e
|
|
|
|
# Install the working tree's protoc-gen-gen in a tempdir.
|
|
tmpdir=$(mktemp -d -t protobuf-regen.XXXXXX)
|
|
trap 'rm -rf $tmpdir' EXIT
|
|
mkdir -p $tmpdir/bin
|
|
PATH=$tmpdir/bin:$PATH
|
|
GOBIN=$tmpdir/bin go install ./cmd/protoc-gen-go
|
|
GOBIN=$tmpdir/bin go install ./cmd/protoc-gen-go-grpc
|
|
|
|
# Generate various test protos.
|
|
PROTO_DIRS=(
|
|
cmd/protoc-gen-go/testdata
|
|
cmd/protoc-gen-go-grpc/testdata
|
|
)
|
|
for dir in ${PROTO_DIRS[@]}; do
|
|
for p in `find $dir -name "*.proto"`; do
|
|
echo "# $p"
|
|
PROTOC_GEN_GO_ENABLE_REFLECT=1 protoc -I$dir \
|
|
--go_out=paths=source_relative:$dir \
|
|
--go-grpc_out=paths=source_relative:$dir \
|
|
$p
|
|
done
|
|
done
|
|
|
|
# Generate descriptor and plugin.
|
|
# TODO: Make this more automated.
|
|
|
|
echo "# types/descriptor/descriptor.proto"
|
|
mkdir -p $tmpdir/src/google/protobuf
|
|
cp ./types/descriptor/descriptor.proto $tmpdir/src/google/protobuf/descriptor.proto
|
|
PROTOC_GEN_GO_ENABLE_REFLECT=1 protoc -I$tmpdir/src \
|
|
--go_out=paths=source_relative:$tmpdir/src \
|
|
$tmpdir/src/google/protobuf/descriptor.proto
|
|
cp $tmpdir/src/google/protobuf/descriptor.pb.go ./types/descriptor/descriptor.pb.go
|
|
|
|
echo "# types/plugin/plugin.proto"
|
|
mkdir -p $tmpdir/src/google/protobuf/compiler
|
|
cp ./types/plugin/plugin.proto $tmpdir/src/google/protobuf/compiler/plugin.proto
|
|
PROTOC_GEN_GO_ENABLE_REFLECT=1 protoc -I$tmpdir/src \
|
|
--go_out=paths=source_relative:$tmpdir/src \
|
|
$tmpdir/src/google/protobuf/compiler/plugin.proto
|
|
cp $tmpdir/src/google/protobuf/compiler/plugin.pb.go ./types/plugin/plugin.pb.go
|
|
|
|
# TODO: Uncomment when test protos are ready.
|
|
# echo "# encoding/textpb/testprotos/pb?/test.proto"
|
|
# PROTOC_GEN_GO_ENABLE_REFLECT=1 protoc --go_out=paths=source_relative:. \
|
|
# encoding/textpb/testprotos/pb?/test.proto
|