-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest.sh
executable file
·61 lines (51 loc) · 2.43 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /usr/bin/env bash
set -eoux pipefail
os=$(echo $OS | awk '{print tolower($0)}' | cut -c -7)
if [ "$os" == "windows" ]; then
protoc_path='./Protoc/windows_x64/protoc.exe'
plugin_path='FSharp.GrpcCodeGenerator.exe'
else
protoc_path='./Protoc/linux_x64/protoc'
plugin_path='FSharp.GrpcCodeGenerator'
fi
function cleanup {
chmod -x $protoc_path
find ./test-protos -type f -name "*.proto" -print0 | xargs -0 sed -i 's/.*csharp_namespace.*/option csharp_namespace = "REPLACE_ME";/'
}
trap cleanup EXIT
dotnet build ./FSharp.GrpcCodeGenerator/FSharp.GrpcCodeGenerator.fsproj
find ./test-protos -type f -name "*.proto" -print0 | xargs -0 sed -i 's/.*csharp_namespace.*/option csharp_namespace = "FSharp.GrpcCodeGenerator.TestProtos.FSharp";/'
chmod +x $protoc_path && \
$protoc_path \
--plugin=protoc-gen-fsharp=./FSharp.GrpcCodeGenerator/bin/Debug/net6.0/$plugin_path \
--fsharp_out=./FSharp.GrpcCodeGenerator.TestProtos.FSharp \
-I ./test-protos \
-I ./Proto \
./test-protos/map_unittest_proto3.proto \
./test-protos/unittest_custom_options_proto3.proto \
./test-protos/unittest_import_proto3.proto \
./test-protos/unittest_import_public_proto3.proto \
./test-protos/unittest_proto3_optional.proto \
./test-protos/unittest_proto3.proto \
./test-protos/well_known_protos.proto \
./test-protos/google/api/annotations.proto \
./test-protos/google/api/http.proto \
find ./test-protos -type f -name "*.proto" -print0 | xargs -0 sed -i 's/.*csharp_namespace.*/option csharp_namespace = "FSharp.GrpcCodeGenerator.TestProtos.CSharp";/'
chmod +x $protoc_path && \
$protoc_path \
--csharp_out=./FSharp.GrpcCodeGenerator.TestProtos.CSharp \
-I ./test-protos \
-I ./Proto \
./test-protos/map_unittest_proto3.proto \
./test-protos/unittest_custom_options_proto3.proto \
./test-protos/unittest_import_proto3.proto \
./test-protos/unittest_import_public_proto3.proto \
./test-protos/unittest_proto3_optional.proto \
./test-protos/unittest_proto3.proto \
./test-protos/well_known_protos.proto
# We skip these protos for C# since we use the Google.Api.CommonProtos NuGet package instead
#./test-protos/google/api/annotations.proto \
#./test-protos/google/api/http.proto
dotnet build ./FSharp.GrpcCodeGenerator.TestProtos.FSharp/FSharp.GrpcCodeGenerator.TestProtos.FSharp.fsproj
dotnet build ./FSharp.GrpcCodeGenerator.TestProtos.CSharp/FSharp.GrpcCodeGenerator.TestProtos.CSharp.csproj
dotnet test ./FSharp.GrpcCodeGenerator.Tests/FSharp.GrpcCodeGenerator.Tests.fsproj