xref: /aosp_15_r20/external/grpc-grpc-java/buildscripts/sync-protos.sh (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1*e07d83d3SAndroid Build Coastguard Worker#!/bin/bash
2*e07d83d3SAndroid Build Coastguard Workerset -e
3*e07d83d3SAndroid Build Coastguard Worker
4*e07d83d3SAndroid Build Coastguard Workercd "$(dirname "$0")/.."
5*e07d83d3SAndroid Build Coastguard Worker
6*e07d83d3SAndroid Build Coastguard Workertmpdir="$(mktemp -d)"
7*e07d83d3SAndroid Build Coastguard Workercurl -Ls https://github.com/grpc/grpc-proto/archive/master.tar.gz | tar xz -C "$tmpdir"
8*e07d83d3SAndroid Build Coastguard Workerbase="$tmpdir/grpc-proto-master"
9*e07d83d3SAndroid Build Coastguard Worker
10*e07d83d3SAndroid Build Coastguard Worker# Copy protos in 'src/main/proto' from grpc-proto for these projects
11*e07d83d3SAndroid Build Coastguard Workerfor project in alts grpclb services rls interop-testing; do
12*e07d83d3SAndroid Build Coastguard Worker  while read -r proto; do
13*e07d83d3SAndroid Build Coastguard Worker    [ -f "$base/$proto" ] && cp "$base/$proto" "$project/src/main/proto/$proto"
14*e07d83d3SAndroid Build Coastguard Worker    echo "$proto"
15*e07d83d3SAndroid Build Coastguard Worker  done < <(cd "$project/src/main/proto" && find . -name "*.proto")
16*e07d83d3SAndroid Build Coastguard Workerdone | sort > "$tmpdir/grpc-java.lst"
17*e07d83d3SAndroid Build Coastguard Worker
18*e07d83d3SAndroid Build Coastguard Worker(cd "$base" && find . -name "*.proto") | sort > "$tmpdir/base.lst"
19*e07d83d3SAndroid Build Coastguard Workerecho "Files synced:"
20*e07d83d3SAndroid Build Coastguard Workercomm -12 "$tmpdir/grpc-java.lst" "$tmpdir/base.lst"
21*e07d83d3SAndroid Build Coastguard Worker
22*e07d83d3SAndroid Build Coastguard Workerecho
23*e07d83d3SAndroid Build Coastguard Workerecho "Files in grpc-proto not synced:"
24*e07d83d3SAndroid Build Coastguard Workercomm -13 "$tmpdir/grpc-java.lst" "$tmpdir/base.lst"
25*e07d83d3SAndroid Build Coastguard Worker
26*e07d83d3SAndroid Build Coastguard Workerecho
27*e07d83d3SAndroid Build Coastguard Workerecho "Files in grpc-java not synced:"
28*e07d83d3SAndroid Build Coastguard Workercomm -23 "$tmpdir/grpc-java.lst" "$tmpdir/base.lst"
29*e07d83d3SAndroid Build Coastguard Worker
30*e07d83d3SAndroid Build Coastguard Workerrm -r "$tmpdir"
31