go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/frontend/ui/scripts/gen_proto.sh (about)

     1  # Copyright 2024 The LUCI Authors.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #      http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  cd "$(dirname "$0")"
    16  
    17  rm -rf ../src/proto
    18  mkdir ../src/proto
    19  cd ../../../../../../ # cd to directory containing go.chromium.org/.
    20  
    21  # Use ts-proto instead of the official grpc-web because it is RPC framework
    22  # agnostic. This is curcial because we use a non-standard protocol (pRPC) for
    23  # client-server communication.
    24  protoc \
    25    --plugin=./go.chromium.org/luci/analysis/frontend/ui/node_modules/.bin/protoc-gen-ts_proto \
    26    -I=./go.chromium.org/luci/common/proto/googleapis \
    27    -I=./ \
    28    --ts_proto_out=./go.chromium.org/luci/analysis/frontend/ui/src/proto \
    29    \
    30    `# Add '.pb' so it can be ignored by presubmit upload checks.` \
    31    --ts_proto_opt=fileSuffix=.pb \
    32    \
    33    --ts_proto_opt=forceLong=string,esModuleInterop=true \
    34    --ts_proto_opt=removeEnumPrefix=true,unrecognizedEnum=false \
    35    --ts_proto_opt=useDate=string,useReadonlyTypes=true \
    36    --ts_proto_opt=lowerCaseServiceMethods=true \
    37    \
    38    ./go.chromium.org/luci/analysis/proto/v1/clusters.proto \
    39    ./go.chromium.org/luci/analysis/proto/v1/metrics.proto \
    40    ./go.chromium.org/luci/analysis/proto/v1/projects.proto \
    41    ./go.chromium.org/luci/analysis/proto/v1/rules.proto \
    42    ./go.chromium.org/luci/analysis/proto/v1/test_variants.proto