forked from square/wire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_tests.sh
executable file
·92 lines (70 loc) · 3.59 KB
/
gen_tests.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
set -e
mvn clean package -pl wire-compiler -am -Dmaven.test.skip
cd wire-runtime
PROTOS=`find src/test/proto -name '*.proto' | sed 's|^src/test/proto/||' | sort`
java -jar ../wire-compiler/target/wire-compiler-*-SNAPSHOT-jar-with-dependencies.jar \
--proto_path=../wire-runtime/src/test/proto \
--java_out=../wire-runtime/src/test/proto-java \
google/protobuf/descriptor.proto \
${PROTOS}
# NO OPTIONS
java -jar ../wire-compiler/target/wire-compiler-*-SNAPSHOT-jar-with-dependencies.jar \
--proto_path=../wire-runtime/src/test/proto \
--java_out=../wire-runtime/src/test/proto-java.noOptions \
--excludes=google.protobuf.* \
${PROTOS}
cp src/test/proto-java.noOptions/com/squareup/wire/protos/custom_options/FooBar.java \
src/test/proto-java/com/squareup/wire/protos/custom_options/FooBar.java.noOptions
cp src/test/proto-java.noOptions/com/squareup/wire/protos/custom_options/MessageWithOptions.java \
src/test/proto-java/com/squareup/wire/protos/custom_options/MessageWithOptions.java.noOptions
# INCLUDES / EXCLUDES
java -jar ../wire-compiler/target/wire-compiler-*-SNAPSHOT-jar-with-dependencies.jar \
--proto_path=../wire-runtime/src/test/proto \
--java_out=../wire-runtime/src/test/proto-java.pruned \
--includes=squareup.protos.roots.A,squareup.protos.roots.H \
--excludes=squareup.protos.roots.B \
roots.proto
cp src/test/proto-java.pruned/com/squareup/wire/protos/roots/A.java \
src/test/proto-java/com/squareup/wire/protos/roots/A.java.pruned
cp src/test/proto-java.pruned/com/squareup/wire/protos/roots/D.java \
src/test/proto-java/com/squareup/wire/protos/roots/D.java.pruned
cp src/test/proto-java.pruned/com/squareup/wire/protos/roots/E.java \
src/test/proto-java/com/squareup/wire/protos/roots/E.java.pruned
cp src/test/proto-java.pruned/com/squareup/wire/protos/roots/H.java \
src/test/proto-java/com/squareup/wire/protos/roots/H.java.pruned
# ANDROID
java -jar ../wire-compiler/target/wire-compiler-*-SNAPSHOT-jar-with-dependencies.jar \
--proto_path=../wire-runtime/src/test/proto \
--java_out=../wire-runtime/src/test/proto-java.android \
--android \
person.proto
cp src/test/proto-java.android/com/squareup/wire/protos/person/Person.java \
src/test/proto-java/com/squareup/wire/protos/person/Person.java.android
# ANDROID COMPACT
java -jar ../wire-compiler/target/wire-compiler-*-SNAPSHOT-jar-with-dependencies.jar \
--proto_path=../wire-runtime/src/test/proto \
--java_out=../wire-runtime/src/test/proto-java.android.compact \
--android \
--compact \
person.proto
cp src/test/proto-java.android.compact/com/squareup/wire/protos/person/Person.java \
src/test/proto-java/com/squareup/wire/protos/person/Person.java.android.compact
# COMPACT
java -jar ../wire-compiler/target/wire-compiler-*-SNAPSHOT-jar-with-dependencies.jar \
--proto_path=../wire-runtime/src/test/proto \
--java_out=../wire-runtime/src/test/proto-java.compact \
--compact \
all_types.proto
cp src/test/proto-java.compact/com/squareup/wire/protos/alltypes/AllTypes.java \
src/test/proto-java/com/squareup/wire/protos/alltypes/AllTypes.java.compact
# GSON (uses COMPACT)
cp src/test/proto-java.compact/com/squareup/wire/protos/alltypes/AllTypes.java \
../wire-gson-support/src/test/java/com/squareup/wire/protos/alltypes/AllTypes.java
cp src/test/proto-java/com/squareup/wire/protos/RepeatedPackedAndMap.java \
../wire-gson-support/src/test/java/com/squareup/wire/protos/RepeatedPackedAndMap.java
rm -r src/test/proto-java.noOptions
rm -r src/test/proto-java.pruned
rm -r src/test/proto-java.compact
rm -r src/test/proto-java.android
rm -r src/test/proto-java.android.compact