Debian Codegraph @

plugins/gnostic-swift-sample/compile-protos

raw symbols SCIP
1 #!/bin/sh
2 #
3 # Copyright 2017 Google Inc. All Rights Reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # Use this script to run protoc and swift-proto to generate
18 # support code for gnostic protos.
19
20 GNOSTIC=$GOPATH/src/github.com/googleapis/gnostic
21
22 PROTOS=(
23 plugins/plugin.proto
24 OpenAPIv2/OpenAPIv2.proto
25 OpenAPIv3/OpenAPIv3.proto
26 surface/surface.proto
27 discovery/discovery.proto
28 )
29
30 # remove old compiled pb files
31 rm -rf Sources/Gnostic/*.pb.swift
32
33 # remove any prior compilations
34 rm -rf Sources/Gnostic/github.com
35
36 # compile protos
37 for proto in "${PROTOS[@]}"
38 do
39 echo "COMPILING $proto"
40 protoc $GNOSTIC/$proto \
41 --swift_opt=Visibility=Public \
42 --swift_out=Sources/Gnostic \
43 --proto_path=$GOPATH/src
44
45 # relocate compiled protos
46 find Sources/Gnostic/github.com -name "*.pb.swift" -exec mv {} Sources/Gnostic \;
47
48 # remove scaffolding of compilation
49 rm -rf Sources/Gnostic/github.com
50
51 done
52