Compare commits
800 Commits
anandolee-
...
main
Author | SHA1 | Date | |
---|---|---|---|
2ca6abf87e | |||
|
9f58ee3f04 | ||
|
352444ecd5 | ||
|
1275ce88f9 | ||
|
c62c2340ca | ||
|
e09804591d | ||
|
046bde0017 | ||
|
1640336fcf | ||
|
3f0f59b00e | ||
|
a9d9c00bff | ||
|
0933faa9ba | ||
|
cecbb0a70e | ||
|
feb726159f | ||
|
7bb756c1cc | ||
|
24d0a3bed1 | ||
|
a075d2fb14 | ||
|
81491e034f | ||
|
e9668e41be | ||
|
dc7f4debbc | ||
|
126841ed7d | ||
|
a94d41960e | ||
|
8deb95bda9 | ||
|
4eeaacd3fd | ||
|
a3e1de0113 | ||
|
92ac51fd43 | ||
|
6e34912084 | ||
|
e04ca460fb | ||
|
87ac4650a3 | ||
|
772c98984a | ||
|
cacb096002 | ||
|
837db77ecf | ||
|
c38281dd20 | ||
|
a612a75b68 | ||
|
b53e63bae1 | ||
|
81fc22c8ab | ||
|
5a9bf6c7de | ||
|
9f53ec3996 | ||
|
24dad62f40 | ||
|
70e2923365 | ||
|
31ba940bfe | ||
|
ce537e8a3e | ||
|
85225b83c3 | ||
|
af699898d2 | ||
|
1bbf6f37cc | ||
|
2bc5f95fe3 | ||
|
922f5024cb | ||
|
2b19a8062a | ||
|
f5ba6c8610 | ||
|
9e24b1912e | ||
|
0f1574aae2 | ||
|
0a16bdfbe6 | ||
|
4d96482e72 | ||
|
3ba3c6a36f | ||
|
c0fc2e881b | ||
|
d37cbfd448 | ||
|
3380463ff8 | ||
|
594f2a9b0d | ||
|
238331b359 | ||
|
0663080c5a | ||
|
e7cc1aa970 | ||
|
4548b4ac0e | ||
|
f138d5de25 | ||
|
2ad33999ee | ||
|
b27dd18676 | ||
|
67f46d2495 | ||
|
dc14b4be42 | ||
|
45b7f62b1b | ||
|
bd85edfbd9 | ||
|
74b2c7c7ce | ||
|
c2e99db90b | ||
|
1ec6f26ce7 | ||
|
85fcd02e32 | ||
|
045172f35a | ||
|
a11fa4529f | ||
|
e16d9348d7 | ||
|
15e09f56b0 | ||
|
258514019f | ||
|
55fe00e35e | ||
|
fd896733a5 | ||
|
6bd7c2e48c | ||
|
7f02c3b16b | ||
|
569a0517fa | ||
|
38e3a11a29 | ||
|
e73ed1630f | ||
|
5bbb8f7b2c | ||
|
d4e1c668ad | ||
|
ceaae1b6a3 | ||
|
3b029b1f4f | ||
|
16a86804c0 | ||
|
6dd8af4ecf | ||
|
0e8b241eb4 | ||
|
f7e2e0b301 | ||
|
30f446820d | ||
|
f2e06fe042 | ||
|
698d760f8d | ||
|
e7e8f04a4f | ||
|
0e42bf9f58 | ||
|
7062d0a2d0 | ||
|
59c6ff83e9 | ||
|
34d749df72 | ||
|
043ee2e4e6 | ||
|
6641a420ff | ||
|
ec4c19b962 | ||
|
5e7b709564 | ||
|
8984184e54 | ||
|
586b72c1ac | ||
|
0b2cee6486 | ||
|
2dc7679cc1 | ||
|
a5a71fbbdf | ||
|
bbcc459aa0 | ||
|
e5e8378a62 | ||
|
6d2827b377 | ||
|
599b08ab1c | ||
|
942cec077a | ||
|
38f0bd4d15 | ||
|
bb27447f42 | ||
|
cdfd60f63d | ||
|
1407efb39f | ||
|
da481978af | ||
|
6673c7c48f | ||
|
30f6c7851b | ||
|
450d24ca82 | ||
|
ecaeadeced | ||
|
42ff77e55f | ||
|
053f698e90 | ||
|
7f2368933a | ||
|
d0a4dc7661 | ||
|
3740e6fa68 | ||
|
d87d99d931 | ||
|
cd5cc37624 | ||
|
71271ad1f8 | ||
|
1fa42c4be4 | ||
|
d031130582 | ||
|
bf771eb540 | ||
|
70afbd3c8d | ||
|
9806b0f57b | ||
|
a04d00312f | ||
|
fd3b5a36ab | ||
|
8a46882bf0 | ||
|
65a2a52df3 | ||
|
171a6b1155 | ||
|
d2292fc5f6 | ||
|
40e82cbd2a | ||
|
07303d6f54 | ||
|
fe3d67cb8e | ||
|
cbd1adc6cf | ||
|
364852e829 | ||
|
f868799366 | ||
|
22067bf523 | ||
|
c2c770e7ea | ||
|
e235147407 | ||
|
b3199d62be | ||
|
4e5b920625 | ||
|
0f3ee3b625 | ||
|
cf4075ac20 | ||
|
375b984715 | ||
|
8353e19756 | ||
|
d3edfa29b7 | ||
|
088281d84b | ||
|
9d7a449e5c | ||
|
abe77ae13e | ||
|
6da9b69efe | ||
|
9be7dd1c81 | ||
|
4049efc7b0 | ||
|
448d421250 | ||
|
193da6c8a9 | ||
|
380a9104b0 | ||
|
9254853796 | ||
|
366cb84282 | ||
|
08473bbe26 | ||
|
b23ab61719 | ||
|
c32d7ec2ab | ||
|
b3cbea18ea | ||
|
bb7e5824b2 | ||
|
43b1427c18 | ||
|
1978a6f723 | ||
|
20d9a4fed5 | ||
|
e9987578ac | ||
|
d60c0d2d35 | ||
|
b64cd5ac64 | ||
|
87c5475687 | ||
|
309e24e86a | ||
|
f91b078abf | ||
|
3cede25cef | ||
|
b2a51f8525 | ||
|
9a31dea61e | ||
|
d259bd3287 | ||
|
bf5e800447 | ||
|
7303304585 | ||
|
6018e9edef | ||
|
915d439df0 | ||
|
14803e6f63 | ||
|
1f3c00eaac | ||
|
354aba886e | ||
|
b180b2809f | ||
|
32d99bb00a | ||
|
b6ee841d7c | ||
|
637a699969 | ||
|
52655b1f5e | ||
|
e305932431 | ||
|
4ebe8ffef4 | ||
|
d8b0884442 | ||
|
48cb9d10fe | ||
|
f026a14caa | ||
|
0e6ac3d789 | ||
|
29d5ca825a | ||
|
49d6b35576 | ||
|
5ebde5bd20 | ||
|
152249204b | ||
|
67823fe8dc | ||
|
df00695437 | ||
|
a3193ed5ee | ||
|
f744bddb63 | ||
|
e94aa9ff0b | ||
|
3c5ad8c524 | ||
|
a1fca10ddc | ||
|
f2a126e349 | ||
|
24ec0b9ffb | ||
|
7bd1da828b | ||
|
35e2f8cd5a | ||
|
0a73ec7e88 | ||
|
c03eb88a87 | ||
|
d93d6cc295 | ||
|
5718cfc757 | ||
|
c693ba3c87 | ||
|
5eafa23c98 | ||
|
b37b613436 | ||
|
ec91c0e929 | ||
|
cdc11c2d2d | ||
|
95da0ba5b4 | ||
|
cd4a8156fa | ||
|
7d48c4accd | ||
|
53002af603 | ||
|
244bbd6f95 | ||
|
c4ddd84918 | ||
|
4e5e8d325a | ||
|
e22db322e4 | ||
|
860f8ad171 | ||
|
1927520278 | ||
|
868ab1469f | ||
|
cd1baaec08 | ||
|
d62c6240c3 | ||
|
9c8c3dea30 | ||
|
d2b669a4dd | ||
|
37b782198c | ||
|
4152d8d160 | ||
|
ece5ef6b9b | ||
|
ec79d0d328 | ||
|
01691f6092 | ||
|
2c5863ecde | ||
|
20a30c675a | ||
|
dc4aad931e | ||
|
65236e967e | ||
|
ac25235fa7 | ||
|
4d56f2d83c | ||
|
35fcbfd298 | ||
|
125dfd343e | ||
|
089e09168b | ||
|
6718fa9dcc | ||
|
4f552e36bd | ||
|
a6901f057e | ||
|
6888c031a4 | ||
|
f53fd52d7b | ||
|
a52e5ad5bb | ||
|
d76f8c868c | ||
|
5283ef4b82 | ||
|
baca239033 | ||
|
62e60833b8 | ||
|
5b0a961188 | ||
|
a2a0c3c118 | ||
|
bfc956bc3a | ||
|
16e89fce85 | ||
|
095e4c0679 | ||
|
a27ce12d3a | ||
|
f80137c46d | ||
|
21027a27c4 | ||
|
e81c678e7d | ||
|
83303ba906 | ||
|
634a5681b8 | ||
|
08b39f4274 | ||
|
9bd67b6aac | ||
|
e4da73fab7 | ||
|
87edf7b558 | ||
|
dcfeaf712b | ||
|
c80808ce1d | ||
|
616a7ef54d | ||
|
46710cabc4 | ||
|
296c1fdaff | ||
|
6387f95aa9 | ||
|
653de45a21 | ||
|
f7b9886f9d | ||
|
654c25352e | ||
|
37f464590c | ||
|
3a477b1952 | ||
|
81e5139679 | ||
|
d2fd441953 | ||
|
9ba808b798 | ||
|
cc8ae4c154 | ||
|
46ae74c55c | ||
|
b27bf8b437 | ||
|
bbc4f8dff8 | ||
|
e9246cd789 | ||
|
6f99f12a6b | ||
|
bba2fca119 | ||
|
13f646f026 | ||
|
9e09343a49 | ||
|
119f7d7dab | ||
|
acd24bcd8d | ||
|
82d04fabd9 | ||
|
eb27c201f1 | ||
|
8077ac24b7 | ||
|
5abf802bc2 | ||
|
a85bbad379 | ||
|
9bf0aca7db | ||
|
7ffe9402db | ||
|
e3b00bb58a | ||
|
26d11fdba2 | ||
|
85aa87cbc9 | ||
|
88eb7550a6 | ||
|
044cb7fd45 | ||
|
55177c3574 | ||
|
061dead753 | ||
|
05df37d35c | ||
|
d54cafb7c8 | ||
|
a8b12d5b6e | ||
|
b55c8e4084 | ||
|
5f920d1507 | ||
|
b7980cd859 | ||
|
9a4c48a566 | ||
|
7db4eca77f | ||
|
803e371946 | ||
|
464d626d1a | ||
|
5edc8442a4 | ||
|
7f9901c5f6 | ||
|
ca30339529 | ||
|
205117c44b | ||
|
6d068f8c6b | ||
|
75dd25b0fd | ||
|
1e60bd62ed | ||
|
e1d39a744f | ||
|
56067d1498 | ||
|
92c11a45c6 | ||
|
97533f5243 | ||
|
1ac05394a5 | ||
|
701650b7d0 | ||
|
a29e0e3f44 | ||
|
d24edbca53 | ||
|
f0936d26e1 | ||
|
feef319e85 | ||
|
82ff86cb8a | ||
|
e097b36732 | ||
|
d85f03d66a | ||
|
3be07ab320 | ||
|
7508ae82d3 | ||
|
ffe4b0cfe6 | ||
|
31a6482b85 | ||
|
7fa212bba1 | ||
|
eb8976a56d | ||
|
61dcf50b85 | ||
|
5b2c7b8373 | ||
|
0dcf31d981 | ||
|
9e6e4eb425 | ||
|
e2f845b2f1 | ||
|
81c5e1a712 | ||
|
d7ef9cd2ba | ||
|
520c601c99 | ||
|
5b67e77876 | ||
|
faa42e900c | ||
|
6b2627718b | ||
|
a3347c27a3 | ||
|
9f597a4c59 | ||
|
afb0ca40b3 | ||
|
e1e9d3e6da | ||
|
43bb1bfe42 | ||
|
3dee6efa54 | ||
|
615a8d99f8 | ||
|
a114b008a2 | ||
|
d0fc2794c4 | ||
|
5b28ae70c0 | ||
|
8e7f936696 | ||
|
b5a35bcc7e | ||
|
fb6016eaed | ||
|
7f9f75f30e | ||
|
25045e3f69 | ||
|
10df21ed5e | ||
|
bc799d78f8 | ||
|
236d04c5b4 | ||
|
75418a54ae | ||
|
b012ef28b9 | ||
|
d06af454b5 | ||
|
40db3dabf0 | ||
|
744baa96ec | ||
|
d255f09036 | ||
|
85cb72481c | ||
|
80308c85a1 | ||
|
575d56bf85 | ||
|
8e3746559d | ||
|
a4c9effec1 | ||
|
8c170146ee | ||
|
e5ae3bb763 | ||
|
405913c712 | ||
|
dbb9619a9d | ||
|
a69354f31b | ||
|
db80d59966 | ||
|
d2256ed112 | ||
|
5ead3ba171 | ||
|
2f09990544 | ||
|
a336ba0346 | ||
|
46c3651c31 | ||
|
2099298e08 | ||
|
523d94a445 | ||
|
7f1acff2a4 | ||
|
abdfd093af | ||
|
85eb57d267 | ||
|
854d86bb09 | ||
|
b04d397d04 | ||
|
40cb0e43c0 | ||
|
faae704730 | ||
|
557f6fbfc8 | ||
|
58e320a732 | ||
|
a6133534e2 | ||
|
ebfa0d345e | ||
|
178ebc179e | ||
|
fa11ed4719 | ||
|
e0cec17c71 | ||
|
2a9f806a69 | ||
|
16dccd6820 | ||
|
7ecf43f0ce | ||
|
202ec9ed9b | ||
|
5f477fc440 | ||
|
5dab09408c | ||
|
bd935e101d | ||
|
1722b16e03 | ||
|
1ddad63dd9 | ||
|
b20209f321 | ||
|
f4d22f80a2 | ||
|
3adfa9afc5 | ||
|
7d5af9d539 | ||
|
75554b80a1 | ||
|
02be7a09f1 | ||
|
426866285b | ||
|
def70d725a | ||
|
14cab5b909 | ||
|
5ad0697c86 | ||
|
d1d13ed6fa | ||
|
357e71679e | ||
|
24a0659f95 | ||
|
276add0b5c | ||
|
1cec803182 | ||
|
92cdf87f1a | ||
|
f2002f6022 | ||
|
349d74d92e | ||
|
aff13048c5 | ||
|
23e7cfd54a | ||
|
388df0041a | ||
|
88a18db91e | ||
|
0a246e23f8 | ||
|
f59a5845a3 | ||
|
839f0f8e06 | ||
|
bb4302e878 | ||
|
e29b4e3bc2 | ||
|
615d214ade | ||
|
b0f9799a7c | ||
|
5f632bef38 | ||
|
038b479119 | ||
|
5faa6123d1 | ||
|
1c51f9fb39 | ||
|
f7232f2aa3 | ||
|
23b2fe6e39 | ||
|
76398dab31 | ||
|
0ece18cf2e | ||
|
1d13b60904 | ||
|
2a001f792f | ||
|
020e4e33d1 | ||
|
4b0871e205 | ||
|
76ba220c38 | ||
|
d9048081b2 | ||
|
14e445bc34 | ||
|
933239f8c3 | ||
|
c578f59fc8 | ||
|
93b4fa6fc7 | ||
|
aafcb92f62 | ||
|
6c8bda86fe | ||
|
cbc9826db7 | ||
|
ee429aea17 | ||
|
b44784cf30 | ||
|
1a10c58c2f | ||
|
4738b8ee08 | ||
|
5b3f853d7d | ||
|
89c40311db | ||
|
b9bcec8ac3 | ||
|
df0999141e | ||
|
6a77c9bab4 | ||
|
e8470340e0 | ||
|
a5168a6e96 | ||
|
a112c4ab96 | ||
|
023fe6ff4d | ||
|
d0c06bcd93 | ||
|
db56692883 | ||
|
2f91da585e | ||
|
951582e893 | ||
|
7ba5fa3d96 | ||
|
3ab97ce830 | ||
|
763d85293d | ||
|
ddfc233f57 | ||
|
20c5b6fd14 | ||
|
2fbda76fad | ||
|
cf05c9f84f | ||
|
2f7ee91e32 | ||
|
a6c9a5f69d | ||
|
1ba1d73e0d | ||
|
972b122a30 | ||
|
97d78281de | ||
|
b0bf163c78 | ||
|
9d01899322 | ||
|
8bfa7d0083 | ||
|
0f253ca64f | ||
|
67b74dd169 | ||
|
2a2a9b6e64 | ||
|
479500a091 | ||
|
9eb5b19964 | ||
|
250fafa7c4 | ||
|
013e115231 | ||
|
79848b5f4c | ||
|
14c62a025c | ||
|
f1085e9bbc | ||
|
a32a2a3b57 | ||
|
fe87de31bf | ||
|
e760984a59 | ||
|
2ce9604227 | ||
|
2495d220fa | ||
|
c946f0bb70 | ||
|
ce57b5bab6 | ||
|
dfcbdb8ca0 | ||
|
d5ef16c6eb | ||
|
9748e4c52c | ||
|
fbe6ab2487 | ||
|
4ed3941e27 | ||
|
ce731e2f52 | ||
|
73f772b666 | ||
|
09b2c6a2b4 | ||
|
5c5cd186b0 | ||
|
fb9f5862d3 | ||
|
b175176124 | ||
|
06196e9b4c | ||
|
dce403a8b3 | ||
|
2d69d44cc1 | ||
|
53d409ca54 | ||
|
5aacba062b | ||
|
42e806fbf2 | ||
|
301d315dc4 | ||
|
f739286b1a | ||
|
b5ab0b7a18 | ||
|
9ebb31726c | ||
|
18c951efb1 | ||
|
5a0887fc65 | ||
|
7f474c6c64 | ||
|
3ea30d8084 | ||
|
867436c0b8 | ||
|
c8b388a6cb | ||
|
8dc77b9957 | ||
|
5e0fc2f1df | ||
|
3be46483ba | ||
|
937b56f57b | ||
|
ab2593041d | ||
|
369388b472 | ||
|
b2ff4f82c2 | ||
|
fa4ba87aff | ||
|
8495372e1e | ||
|
2d87ce3cfe | ||
|
a2f7cfab27 | ||
|
8c8fb0ec97 | ||
|
7dff52929f | ||
|
000da39ada | ||
|
d2ca349c2a | ||
|
e56d6936f3 | ||
|
55645ca513 | ||
|
fc9fb726f1 | ||
|
a9cf69a0ed | ||
|
349738dde5 | ||
|
7e5bfe8883 | ||
|
b7fe12e367 | ||
|
ab4585a695 | ||
|
aa896f6389 | ||
|
a6a66a9ac8 | ||
|
c756e61878 | ||
|
15add1af49 | ||
|
fa57149caa | ||
|
749243db7e | ||
|
18521f6055 | ||
|
b926a7d209 | ||
|
22d0e265de | ||
|
afeb6d8181 | ||
|
98b8e055d5 | ||
|
eb301e1a33 | ||
|
aceff710f4 | ||
|
35a21c1249 | ||
|
67995fb4e9 | ||
|
779b97260d | ||
|
b48ba578dd | ||
|
a30167f016 | ||
|
4c03fcf8fb | ||
|
82372d8fe6 | ||
|
a035bd0882 | ||
|
a78b89ef2a | ||
|
b696347f80 | ||
|
f180289c46 | ||
|
3e724d8a2e | ||
|
6a3f3840f6 | ||
|
110d6c10b2 | ||
|
5ef010cb85 | ||
|
012c8892ab | ||
|
79951dac84 | ||
|
90065d39a7 | ||
|
706ed2d17a | ||
|
c153dd9bf7 | ||
|
e554bd6cbf | ||
|
f41049a0f0 | ||
|
a03ff9c3e8 | ||
|
86bb6f9de0 | ||
|
16941420c9 | ||
|
c62cbe97de | ||
|
70131e0495 | ||
|
6e8b0dfcbf | ||
|
f689268ca3 | ||
|
bfe33d7d08 | ||
|
639551d445 | ||
|
41e22cde8d | ||
|
a784e515e1 | ||
|
9e65df20a7 | ||
|
58d22b8cac | ||
|
0476a893e2 | ||
|
01f09b3425 | ||
|
7924cd6726 | ||
|
ab7cf573ab | ||
|
dfd99e7ec0 | ||
|
c160ae52a9 | ||
|
f96050a05d | ||
|
b3093dce58 | ||
|
24a801287f | ||
|
5bb34e9930 | ||
|
49b184b163 | ||
|
cc7b1b5323 | ||
|
ee432e55b8 | ||
|
203c593b96 | ||
|
922a7ec189 | ||
|
558d128fc7 | ||
|
3d995aaf98 | ||
|
0ac74b8126 | ||
|
c7808a87fa | ||
|
864aa49c6d | ||
|
d8ccfbf005 | ||
|
ee648b76a7 | ||
|
fabe73db6f | ||
|
50b0bed121 | ||
|
b73f78d32c | ||
|
c997582f7c | ||
|
cb46755e64 | ||
|
eb94f17a8b | ||
|
ea9a01a0f5 | ||
|
9638a5e531 | ||
|
0e02f95b87 | ||
|
c555c3dd14 | ||
|
f681c8d9e6 | ||
|
c26b1c87d7 | ||
|
b17c8ca979 | ||
|
c4bb4c9206 | ||
|
6f8d82c2b1 | ||
|
ea60c9cb08 | ||
|
7857b15afc | ||
|
0906af9870 | ||
|
9057466a7a | ||
|
9227f60f85 | ||
|
1fe07f9ce2 | ||
|
01e84b1293 | ||
|
b79dbb7db0 | ||
|
8f6c3c6824 | ||
|
cb1f49ae73 | ||
|
bb5094881c | ||
|
b360b9e388 | ||
|
911c940569 | ||
|
338863f043 | ||
|
a16629667a | ||
|
41606730da | ||
|
a35c973b7f | ||
|
b10578c9e5 | ||
|
de5eb0a3e3 | ||
|
a7089254d1 | ||
|
214180c5a2 | ||
|
5711cab189 | ||
|
8c29dc2c4d | ||
|
9e896e2e92 | ||
|
29b3d01572 | ||
|
88384c99ec | ||
|
0fba541a69 | ||
|
4812107b9d | ||
|
88076658f1 | ||
|
3c0bc69033 | ||
|
a863972644 | ||
|
9a1d5dfa4b | ||
|
b79ac0e6e2 | ||
|
d69e482e5a | ||
|
667d5e9e9f | ||
|
473ff00de3 | ||
|
278dfb2496 | ||
|
19eaec02e1 | ||
|
f2ffe4fbef | ||
|
7d9c9ebd5d | ||
|
1ced82f8fd | ||
|
bf481851d8 | ||
|
e4e26dfdf7 | ||
|
4eb8840544 | ||
|
b9e31eaa9d | ||
|
73c57034aa | ||
|
61e0395c89 | ||
|
221169d2ac | ||
|
8f034a8d77 | ||
|
3ad04bd4d9 | ||
|
ed10979c5e | ||
|
a49dbd73d6 | ||
|
6af72f96c5 | ||
|
ba5eb3a7e9 | ||
|
ef9b7036e7 | ||
|
f7a58bb060 | ||
|
93f7659565 | ||
|
8608ee97da | ||
|
22462b0c52 | ||
|
edc8a31828 | ||
|
6cc68c5c59 | ||
|
840a4f721d | ||
|
25c818e3f1 | ||
|
be9fba9fd1 | ||
|
a162273515 | ||
|
845db63ced | ||
|
83641bd36e | ||
|
cc411dcdf8 | ||
|
76f57fd6df | ||
|
e75207f009 | ||
|
4c09e43f74 | ||
|
0ca4c1a768 | ||
|
7569df0f58 | ||
|
c685d79368 | ||
|
90afe0cfc6 | ||
|
627bb4b60e | ||
|
47e05427e3 | ||
|
ef1c9fd907 | ||
|
d5b7f705f3 | ||
|
97c901cfb6 | ||
|
a5fa4fb019 | ||
|
0f33dc4380 | ||
|
aa15931050 | ||
|
d37dcf9e34 | ||
|
13d559beb6 | ||
|
3a4d9316aa | ||
|
11de748d66 | ||
|
d88c8d5d4b | ||
|
7ccf4d8f67 | ||
|
c4c7e2b8f9 | ||
|
6a9cf18cba | ||
|
26603a1466 | ||
|
201c1fc918 | ||
|
85c4bc4205 | ||
|
bbdcea8547 | ||
|
65852d6e9c | ||
|
1d2e8d9302 | ||
|
935d099ad9 | ||
|
4d94a7cd93 | ||
|
9c3af64ae4 | ||
|
247649cdb0 | ||
|
e350ef8c20 | ||
|
947a51a464 | ||
|
b3b3162219 | ||
|
d630f96dce | ||
|
2007a39db0 | ||
|
84c2e1e502 | ||
|
3a18299cc0 | ||
|
3370cc4456 | ||
|
02d2e5fdd7 | ||
|
0707f2e7f5 | ||
|
adc1f931e3 | ||
|
f4af0bc931 | ||
|
c8dfe32b5a | ||
|
42db8a3f96 | ||
|
e6430dd4a0 | ||
|
1e1c1cd884 | ||
|
63f952b987 | ||
|
21478b371e | ||
|
e4ce58cd60 | ||
|
d08bc71c96 | ||
|
62d59d7d4c | ||
|
454778d011 | ||
|
d0a2c395e9 | ||
|
df5b7fabb8 | ||
|
6c0168bd65 | ||
|
8a0aa4b372 | ||
|
f367bfb13d | ||
|
ef0bd1343b | ||
|
5100be2b77 | ||
|
4e176f29b4 | ||
|
ef70acbc03 |
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -16,7 +16,7 @@ Stack Overflow is also a useful if unofficial resource https://stackoverflow.com
|
||||
-->
|
||||
|
||||
**What version of protobuf and what language are you using?**
|
||||
Version: master/v3.6.0/v3.5.0 etc.
|
||||
Version: main/v3.6.0/v3.5.0 etc.
|
||||
Language: C++/Java/Python/C#/Ruby/PHP/Objective-C/Javascript
|
||||
|
||||
**What operating system (Linux, Windows, ...) and version?**
|
||||
|
6
.github/mergeable.yml
vendored
6
.github/mergeable.yml
vendored
@ -9,10 +9,10 @@ mergeable:
|
||||
- and:
|
||||
- must_include:
|
||||
regex: 'release notes: yes'
|
||||
message: 'Please include release notes: yes'
|
||||
message: 'Include release notes: yes'
|
||||
- must_include:
|
||||
regex: '^(autotools|bazel|c#|c\+\+|cleanup|cmake|conformance tests|integration|go|java|javascript|objective-c|php|protoc|python|ruby|kotlin)'
|
||||
message: 'Please include at least a language label (e.g., c++, java, python). Or apply one of the following labels: autotools, bazel, cmake, cleanup, conformance tests, integration, protoc.'
|
||||
message: 'at least a language label (e.g., c++, java, python). Or apply one of the following labels: autotools, bazel, cmake, cleanup, conformance tests, integration, protoc.'
|
||||
- must_include:
|
||||
regex: 'release notes: no'
|
||||
message: 'Please include release notes: no'
|
||||
message: 'Include release notes: no'
|
||||
|
2
.github/workflows/codespell.yml
vendored
2
.github/workflows/codespell.yml
vendored
@ -13,4 +13,4 @@ jobs:
|
||||
with:
|
||||
check_filenames: true
|
||||
skip: ./.git,./conformance/third_party,*.snk,*.pb,*.pb.cc,*.pb.h,./src/google/protobuf/testdata,./objectivec/Tests,./python/compatibility_tests/v2.5.0/tests/google/protobuf/internal,./.github/workflows/codespell.yml
|
||||
ignore_words_list: "alow,alse,ba,cleare,copyable,cloneable,dedup,dur,errorprone,files',fo,fundementals,hel,importd,inout,leapyear,nd,nin,ois,ons,parseable,process',te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od,optin,sur"
|
||||
ignore_words_list: "alow,alse,ba,cleare,copyable,cloneable,dedup,dur,errorprone,files',fo,fundementals,hel,importd,inout,leapyear,nd,nin,ois,ons,parseable,process',te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od,optin,streem,sur"
|
||||
|
36
.github/workflows/objc_cocoapods.yml
vendored
Normal file
36
.github/workflows/objc_cocoapods.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
name: 'ObjC CocoaPods'
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/objc_cocoapods.yml'
|
||||
- 'Protobuf.podspec'
|
||||
- 'objectivec/**'
|
||||
- '!objectivec/DevTools/**'
|
||||
- '!objectivec/ProtocolBuffers_*.xcodeproj/**'
|
||||
- '!objectivec/Tests/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/objc_cocoapods.yml'
|
||||
- 'Protobuf.podspec'
|
||||
- 'objectivec/**'
|
||||
- '!objectivec/DevTools/**'
|
||||
- '!objectivec/ProtocolBuffers_*.xcodeproj/**'
|
||||
- '!objectivec/Tests/**'
|
||||
|
||||
jobs:
|
||||
pod-lib-lint:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
PLATFORM: ["ios", "macos", "tvos", "watchos"]
|
||||
CONFIGURATION: ["Debug", "Release"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Pod lib lint
|
||||
run: |
|
||||
pod lib lint --verbose \
|
||||
--configuration=${{ matrix.CONFIGURATION }} \
|
||||
--platforms=${{ matrix.PLATFORM }} \
|
||||
Protobuf.podspec
|
43
.github/workflows/php-ext.yml
vendored
Normal file
43
.github/workflows/php-ext.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
name: PHP extension
|
||||
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
build-php:
|
||||
name: Build PHP extension
|
||||
runs-on: ubuntu-latest
|
||||
container: ${{ matrix.php-image }}
|
||||
strategy:
|
||||
matrix:
|
||||
php-image:
|
||||
- php:7.4-cli
|
||||
- php:8.1-cli
|
||||
steps:
|
||||
- name: Install git
|
||||
run: |
|
||||
apt-get update -q
|
||||
apt-get install -qy --no-install-recommends git
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Prepare source code
|
||||
run: |
|
||||
rm -rf "$GITHUB_WORKSPACE/php/ext/google/protobuf/third_party"
|
||||
cp -r "$GITHUB_WORKSPACE/third_party" "$GITHUB_WORKSPACE/php/ext/google/protobuf"
|
||||
cp "$GITHUB_WORKSPACE/LICENSE" "$GITHUB_WORKSPACE/php/ext/google/protobuf"
|
||||
- name: Create package
|
||||
run: |
|
||||
cd /tmp
|
||||
rm -rf protobuf-*.tgz
|
||||
pecl package "$GITHUB_WORKSPACE/php/ext/google/protobuf/package.xml"
|
||||
- name: Compile extension
|
||||
run: |
|
||||
cd /tmp
|
||||
MAKE="make -j$(nproc)" pecl install protobuf-*.tgz
|
||||
- name: Enable extension
|
||||
run: docker-php-ext-enable protobuf
|
||||
- name: Inspect extension
|
||||
run: php --ri protobuf
|
31
.gitignore
vendored
31
.gitignore
vendored
@ -9,6 +9,7 @@ depcomp
|
||||
install-sh
|
||||
ltmain.sh
|
||||
missing
|
||||
configure~
|
||||
|
||||
aclocal.m4
|
||||
m4/libtool.m4
|
||||
@ -46,7 +47,7 @@ src/.libs
|
||||
any_test.pb.*
|
||||
map*unittest.pb.*
|
||||
unittest*.pb.*
|
||||
cpp_test*.pb.*
|
||||
src/google/protobuf/compiler/cpp/test*.pb.*
|
||||
src/google/protobuf/util/**/*.pb.cc
|
||||
src/google/protobuf/util/**/*.pb.h
|
||||
|
||||
@ -89,6 +90,10 @@ java/**/*.iml
|
||||
# Windows native output.
|
||||
cmake/build
|
||||
build_msvc
|
||||
# Directories suggested by cmake/README.md
|
||||
/debug/
|
||||
/solution/
|
||||
/release/
|
||||
|
||||
# NuGet packages: we want the repository configuration, but not the
|
||||
# packages themselves.
|
||||
@ -164,21 +169,6 @@ php/ext/google/protobuf/run-tests.php
|
||||
php/ext/google/protobuf/third_party/
|
||||
vendor/
|
||||
|
||||
# JavaScript artifacts
|
||||
js/commonjs_out/
|
||||
js/compatibility_tests/v3.0.0/commonjs_out*
|
||||
js/compatibility_tests/v3.0.0/protoc
|
||||
js/compatibility_tests/v3.0.0/testproto_libs1.js
|
||||
js/compatibility_tests/v3.0.0/testproto_libs1_new.js
|
||||
js/compatibility_tests/v3.0.0/testproto_libs2.js
|
||||
js/compatibility_tests/v3.0.0/testproto_libs2_new.js
|
||||
js/deps.js
|
||||
js/google-protobuf.js
|
||||
js/google/
|
||||
js/node_modules/
|
||||
js/testproto_libs1.js
|
||||
js/testproto_libs2.js
|
||||
|
||||
# Ignore the bazel symlinks
|
||||
/bazel-*
|
||||
|
||||
@ -215,5 +205,14 @@ _build/
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
# Eclipse
|
||||
**/.settings
|
||||
**/.project
|
||||
**/.classpath
|
||||
|
||||
# BenchmarkDotNet
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# Clangd uses these common ephemeral files
|
||||
.cache
|
||||
compile_commands.json
|
||||
|
1
.gitmodules
vendored
1
.gitmodules
vendored
@ -1,6 +1,7 @@
|
||||
[submodule "third_party/benchmark"]
|
||||
path = third_party/benchmark
|
||||
url = https://github.com/google/benchmark.git
|
||||
ignore = dirty
|
||||
[submodule "third_party/googletest"]
|
||||
path = third_party/googletest
|
||||
url = https://github.com/google/googletest.git
|
||||
|
29
Aurora.json
Normal file
29
Aurora.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "protobuf",
|
||||
"type": "generic",
|
||||
"sources": ["src/google/protobuf/**.cc",
|
||||
"src/google/protobuf/**.h",
|
||||
"src/google/protobuf/**.inc"],
|
||||
"excludes": [
|
||||
"**/*_test*.*",
|
||||
"**/*test*.*",
|
||||
"**/testing/**",
|
||||
"**/*unittest.*",
|
||||
"**/mock*.*"
|
||||
],
|
||||
"includes": "src/",
|
||||
"actions": [
|
||||
{
|
||||
"filter": {
|
||||
"platforms": "win32"
|
||||
},
|
||||
"then": {
|
||||
"defines": [
|
||||
"PROTOBUF_FUCK_GOOGLE_IVE_YET_TO_SEE_ONE_GOOGLE_PRODUCT_THAT_BUILDS_ON_THEIR_SUPPORED_PLATFORMS",
|
||||
"PROTOBUF_CONSTINIT_FORCE=",
|
||||
"PROTOBUF_CONSTEXPR_FORCE=constexpr"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
521
BUILD.bazel
Normal file
521
BUILD.bazel
Normal file
@ -0,0 +1,521 @@
|
||||
# Bazel (https://bazel.build/) BUILD file for Protobuf.
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library", "cc_test")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library")
|
||||
load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS", "PROTOC_LINK_OPTS")
|
||||
load(":protobuf.bzl", "py_proto_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
exports_files(["LICENSE"])
|
||||
|
||||
################################################################################
|
||||
# Well Known Types Proto Library Rules
|
||||
#
|
||||
# https://developers.google.com/protocol-buffers/docs/reference/google.protobuf
|
||||
################################################################################
|
||||
# These proto_library rules can be used with one of the language specific proto
|
||||
# library rules i.e. java_proto_library:
|
||||
#
|
||||
# java_proto_library(
|
||||
# name = "any_java_proto",
|
||||
# deps = ["@com_google_protobuf//:any_proto"],
|
||||
# )
|
||||
################################################################################
|
||||
|
||||
alias(
|
||||
name = "any_proto",
|
||||
actual = "//src/google/protobuf:any_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "api_proto",
|
||||
actual = "//src/google/protobuf:api_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "duration_proto",
|
||||
actual = "//src/google/protobuf:duration_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "empty_proto",
|
||||
actual = "//src/google/protobuf:empty_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "field_mask_proto",
|
||||
actual = "//src/google/protobuf:field_mask_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "source_context_proto",
|
||||
actual = "//src/google/protobuf:source_context_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "struct_proto",
|
||||
actual = "//src/google/protobuf:struct_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "timestamp_proto",
|
||||
actual = "//src/google/protobuf:timestamp_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "type_proto",
|
||||
actual = "//src/google/protobuf:type_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "wrappers_proto",
|
||||
actual = "//src/google/protobuf:wrappers_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Source files: these are aliases to a filegroup, not a `proto_library`.
|
||||
#
|
||||
# (This is _probably_ not what you want.)
|
||||
alias(
|
||||
name = "lite_well_known_protos",
|
||||
actual = "//src/google/protobuf:well_known_type_protos", # filegroup
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "well_known_type_protos",
|
||||
actual = "//src/google/protobuf:well_known_type_protos", # filegroup
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Built-in runtime protos: these are part of protobuf's internal
|
||||
# implementation, but are not Well-Known Types.
|
||||
|
||||
alias(
|
||||
name = "descriptor_proto",
|
||||
actual = "//src/google/protobuf:descriptor_proto", # proto_library
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "descriptor_proto_srcs",
|
||||
actual = "//src/google/protobuf:descriptor_proto_srcs", # filegroup
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "compiler_plugin_proto",
|
||||
actual = "//src/google/protobuf/compiler:plugin_proto", # proto_library
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "cc_wkt_protos",
|
||||
deprecation = "Only for backward compatibility. Do not use.",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Source protos that are typically part of the protobuf runtime.
|
||||
#
|
||||
# DEPRECATED: Prefer :well_known_type_protos for the Well-Known Types
|
||||
# (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf)
|
||||
# or :descriptor_proto(_srcs) for descriptor.proto (source), or
|
||||
# :compiler_plugin_proto for compiler/plugin.proto.
|
||||
filegroup(
|
||||
name = "well_known_protos",
|
||||
srcs = [
|
||||
":descriptor_proto_srcs",
|
||||
":well_known_type_protos",
|
||||
"//src/google/protobuf/compiler:plugin.proto",
|
||||
],
|
||||
deprecation = "Prefer :well_known_type_protos instead.",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Protocol Buffers Compiler
|
||||
################################################################################
|
||||
|
||||
cc_binary(
|
||||
name = "protoc",
|
||||
linkopts = LINK_OPTS + PROTOC_LINK_OPTS,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//src/google/protobuf/compiler:protoc_lib"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# C++ runtime
|
||||
################################################################################
|
||||
|
||||
# The "lite" runtime works for .proto files that specify the option:
|
||||
# optimize_for = LITE_RUNTIME;
|
||||
#
|
||||
# The lite runtime does not include the `Reflection` APIs (including
|
||||
# `Descriptor` and related types) or Well-Known Types.
|
||||
#
|
||||
# See also:
|
||||
# https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#message
|
||||
# https://developers.google.com/protocol-buffers/docs/reference/google.protobuf
|
||||
alias(
|
||||
name = "protobuf_lite",
|
||||
actual = "//src/google/protobuf:protobuf_lite",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "protobuf",
|
||||
hdrs = glob([
|
||||
"src/**/*.h",
|
||||
"src/**/*.inc",
|
||||
]),
|
||||
copts = COPTS,
|
||||
include_prefix = "google/protobuf/io",
|
||||
linkopts = LINK_OPTS,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//src/google/protobuf",
|
||||
"//src/google/protobuf/compiler:importer",
|
||||
"//src/google/protobuf/util:delimited_message_util",
|
||||
"//src/google/protobuf/util:differencer",
|
||||
"//src/google/protobuf/util:field_mask_util",
|
||||
"//src/google/protobuf/util:json_util",
|
||||
"//src/google/protobuf/util:time_util",
|
||||
"//src/google/protobuf/util:type_resolver_util",
|
||||
],
|
||||
)
|
||||
|
||||
# This provides just the header files for use in projects that need to build
|
||||
# shared libraries for dynamic loading. This target is available until Bazel
|
||||
# adds native support for such use cases.
|
||||
# TODO(keveman): Remove this target once the support gets added to Bazel.
|
||||
alias(
|
||||
name = "protobuf_headers",
|
||||
actual = "//src/google/protobuf:protobuf_headers",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Java support
|
||||
################################################################################
|
||||
|
||||
alias(
|
||||
name = "protobuf_java",
|
||||
actual = "//java/core",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "protobuf_javalite",
|
||||
actual = "//java/lite",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "protobuf_java_util",
|
||||
actual = "//java/util",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "java_toolchain",
|
||||
actual = "//java/core:toolchain",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "javalite_toolchain",
|
||||
actual = "//java/lite:toolchain",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Python support
|
||||
################################################################################
|
||||
|
||||
alias(
|
||||
name = "protobuf_python",
|
||||
actual = "//python:protobuf_python",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "python_srcs",
|
||||
actual = "//python:python_srcs",
|
||||
visibility = ["@upb//:__subpackages__"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "python_test_srcs",
|
||||
actual = "//python:python_test_srcs",
|
||||
visibility = ["@upb//:__subpackages__"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "well_known_types_py_pb2",
|
||||
actual = "//python:well_known_types_py_pb2",
|
||||
visibility = ["@upb//:__subpackages__"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "python_common_test_protos",
|
||||
actual = "//python:python_common_test_protos",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "python_specific_test_protos",
|
||||
actual = "//python:python_specific_test_protos",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
proto_lang_toolchain(
|
||||
name = "cc_toolchain",
|
||||
blacklisted_protos = [
|
||||
"@com_google_protobuf//:any_proto",
|
||||
"@com_google_protobuf//:api_proto",
|
||||
"@com_google_protobuf//:compiler_plugin_proto",
|
||||
"@com_google_protobuf//:descriptor_proto",
|
||||
"@com_google_protobuf//:duration_proto",
|
||||
"@com_google_protobuf//:empty_proto",
|
||||
"@com_google_protobuf//:field_mask_proto",
|
||||
"@com_google_protobuf//:source_context_proto",
|
||||
"@com_google_protobuf//:struct_proto",
|
||||
"@com_google_protobuf//:timestamp_proto",
|
||||
"@com_google_protobuf//:type_proto",
|
||||
"@com_google_protobuf//:wrappers_proto",
|
||||
],
|
||||
command_line = "--cpp_out=$(OUT)",
|
||||
runtime = ":protobuf",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "objectivec",
|
||||
actual = "//objectivec",
|
||||
tags = ["manual"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "protobuf_objc",
|
||||
actual = "//objectivec",
|
||||
tags = ["manual"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Test protos
|
||||
################################################################################
|
||||
|
||||
alias(
|
||||
name = "lite_test_protos",
|
||||
actual = "//src/google/protobuf:lite_test_protos", # proto_library
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "test_proto_srcs",
|
||||
actual = "//src/google/protobuf:test_proto_srcs", # filegroup
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "test_protos",
|
||||
actual = "//src/google/protobuf:test_protos", # proto_library
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
# Validate generated proto source inputs:
|
||||
|
||||
genrule(
|
||||
name = "generated_protos",
|
||||
testonly = 1,
|
||||
srcs = ["//src/google/protobuf:test_proto_srcs"],
|
||||
outs = ["unittest_gen_import.proto"],
|
||||
cmd = "cat src/google/protobuf/unittest_import.proto > $@",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "generated_protos_proto",
|
||||
testonly = 1,
|
||||
srcs = [":generated_protos"],
|
||||
deps = ["//src/google/protobuf:generic_test_protos"],
|
||||
)
|
||||
|
||||
py_proto_library(
|
||||
name = "generated_protos_py",
|
||||
testonly = 1,
|
||||
srcs = [":generated_protos"],
|
||||
default_runtime = "",
|
||||
protoc = ":protoc",
|
||||
deps = ["//python:python_common_test_protos"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Conformance tests
|
||||
################################################################################
|
||||
|
||||
alias(
|
||||
name = "conformance_test_runner",
|
||||
actual = "//conformance:conformance_test_runner",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "test_messages_proto2_proto",
|
||||
actual = "//src/google/protobuf:test_messages_proto2_proto", # proto_library
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "test_messages_proto3_proto",
|
||||
actual = "//src/google/protobuf:test_messages_proto3_proto", # proto_library
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# TODO: re-enable this test if appropriate, or replace with something that
|
||||
# uses the new setup.
|
||||
# sh_test(
|
||||
# name = "build_files_updated_unittest",
|
||||
# srcs = [
|
||||
# "build_files_updated_unittest.sh",
|
||||
# ],
|
||||
# data = [
|
||||
# "BUILD",
|
||||
# "cmake/extract_includes.bat.in",
|
||||
# "cmake/libprotobuf.cmake",
|
||||
# "cmake/libprotobuf-lite.cmake",
|
||||
# "cmake/libprotoc.cmake",
|
||||
# "cmake/tests.cmake",
|
||||
# "src/Makefile.am",
|
||||
# "update_file_lists.sh",
|
||||
# ],
|
||||
# )
|
||||
|
||||
java_proto_library(
|
||||
name = "test_messages_proto2_java_proto",
|
||||
visibility = [
|
||||
"//conformance:__pkg__",
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":test_messages_proto2_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "test_messages_proto3_java_proto",
|
||||
visibility = [
|
||||
"//conformance:__pkg__",
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":test_messages_proto3_proto"],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "test_messages_proto2_java_proto_lite",
|
||||
visibility = [
|
||||
"//conformance:__pkg__",
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":test_messages_proto2_proto"],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "test_messages_proto3_java_proto_lite",
|
||||
visibility = [
|
||||
"//conformance:__pkg__",
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":test_messages_proto3_proto"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "bzl_srcs",
|
||||
srcs = glob(["**/*.bzl"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Packaging rules
|
||||
################################################################################
|
||||
|
||||
# Files included in all source distributions
|
||||
pkg_files(
|
||||
name = "common_dist_files",
|
||||
srcs = glob(
|
||||
[
|
||||
"*.bzl",
|
||||
"cmake/*.cmake",
|
||||
"cmake/*.in",
|
||||
"editors/*",
|
||||
|
||||
# Several of these files are generated by autogen.sh, so using
|
||||
# glob() lets us ignore them if they are missing. (This is not good
|
||||
# practice, though.)
|
||||
"Makefile.in",
|
||||
"aclocal.m4",
|
||||
"ar-lib",
|
||||
"compile",
|
||||
"config*",
|
||||
"depcomp",
|
||||
"install-sh",
|
||||
"ltmain.sh",
|
||||
"m4/*.m4",
|
||||
"missing",
|
||||
"protobuf*.pc.in",
|
||||
"test-driver",
|
||||
],
|
||||
allow_empty = True,
|
||||
) + [
|
||||
"BUILD.bazel",
|
||||
"CHANGES.txt",
|
||||
"CMakeLists.txt",
|
||||
"CONTRIBUTORS.txt",
|
||||
"LICENSE",
|
||||
"Makefile.am",
|
||||
"README.md",
|
||||
"WORKSPACE",
|
||||
"autogen.sh",
|
||||
"build_files_updated_unittest.sh",
|
||||
"cmake/CMakeLists.txt",
|
||||
"cmake/README.md",
|
||||
"generate_descriptor_proto.sh",
|
||||
"maven_install.json",
|
||||
"update_file_lists.sh",
|
||||
"//third_party:BUILD.bazel",
|
||||
"//third_party:zlib.BUILD",
|
||||
"//util/python:BUILD.bazel",
|
||||
],
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
||||
|
||||
# Additional files for C#
|
||||
pkg_files(
|
||||
name = "csharp_dist_files",
|
||||
srcs = [
|
||||
"global.json",
|
||||
],
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
||||
|
||||
# Additional files for ObjC
|
||||
pkg_files(
|
||||
name = "objectivec_dist_files",
|
||||
srcs = [
|
||||
"Protobuf.podspec",
|
||||
],
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
333
CHANGES.txt
333
CHANGES.txt
@ -1,3 +1,336 @@
|
||||
|
||||
Unreleased version
|
||||
* Handle reflection for message splitting.
|
||||
* make metadata fields lazy.
|
||||
* Extend visibility of plugin library to upb
|
||||
* Modernize conformance_cpp.cc.
|
||||
* Don't request 64-byte alignment unless the toolchain supports it.
|
||||
|
||||
|
||||
2022-05-27 version 21.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby)
|
||||
|
||||
C++
|
||||
* cmake: Revert "Fix cmake install targets (#9822)" (#10060)
|
||||
* Remove Abseil dependency from CMake build (#10056)
|
||||
|
||||
Python
|
||||
* Update python wheel metadata with more information incl. required python version (#10058)
|
||||
* Fix segmentation fault when instantiating field via repeated field assignment (#10066)
|
||||
|
||||
2022-05-25 version 21.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby)
|
||||
|
||||
C++
|
||||
* cmake: Call get_filename_component() with DIRECTORY mode instead of PATH mode (#9614)
|
||||
* Escape GetObject macro inside protoc-generated code (#9739)
|
||||
* Update CMake configuration to add a dependency on Abseil (#9793)
|
||||
* Fix cmake install targets (#9822)
|
||||
* Use __constinit only in GCC 12.2 and up (#9936)
|
||||
|
||||
Java
|
||||
* Update protobuf_version.bzl to separate protoc and per-language java … (#9900)
|
||||
|
||||
Python
|
||||
* Increment python major version to 4 in version.json for python upb (#9926)
|
||||
* The C extension module for Python has been rewritten to use the upb library.
|
||||
This is expected to deliver significant performance benefits, especially when
|
||||
parsing large payloads. There are some minor breaking changes, but these
|
||||
should not impact most users. For more information see:
|
||||
https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
|
||||
* Fixed win32 build and fixed str(message) on all Windows platforms. (#9976)
|
||||
* The binary wheel for macOS now supports Apple silicon.
|
||||
|
||||
PHP
|
||||
* [PHP] fix PHP build system (#9571)
|
||||
* Fix building packaged PHP extension (#9727)
|
||||
* fix: reserve "ReadOnly" keyword for PHP 8.1 and add compatibility (#9633)
|
||||
* fix: phpdoc syntax for repeatedfield parameters (#9784)
|
||||
* fix: phpdoc for repeatedfield (#9783)
|
||||
* Change enum string name for reserved words (#9780)
|
||||
* chore: [PHP] fix phpdoc for MapField keys (#9536)
|
||||
* Fixed PHP SEGV by not writing to shared memory for zend_class_entry. (#9996)
|
||||
|
||||
Ruby
|
||||
* Allow pre-compiled binaries for ruby 3.1.0 (#9566)
|
||||
* Implement `respond_to?` in RubyMessage (#9677)
|
||||
* [Ruby] Fix RepeatedField#last, #first inconsistencies (#9722)
|
||||
* Do not use range based UTF-8 validation in truffleruby (#9769)
|
||||
* Improve range handling logic of `RepeatedField` (#9799)
|
||||
* Support x64-mingw-ucrt platform
|
||||
|
||||
Other
|
||||
* [Kotlin] remove redundant public modifiers for compiled code (#9642)
|
||||
* [C#] Update GetExtension to support getting typed value (#9655)
|
||||
* Fix invalid dependency manifest when using `descriptor_set_out` (#9647)
|
||||
* Fix C# generator handling of a field named "none" in a oneof (#9636)
|
||||
* Add initial version.json file for 21-dev (#9840)
|
||||
* Remove duplicate java generated code (#9909)
|
||||
* Cherry-pick PR #9981 into 21.x branch (#10000)
|
||||
|
||||
|
||||
2022-05-19 version 21.0-rc2(C++/Java/Python/PHP/Objective-C/C#/Ruby)
|
||||
|
||||
Python
|
||||
* Fix windows builds
|
||||
* Throw more helpful error if generated code is out of date
|
||||
* Fixed two reference leaks
|
||||
|
||||
Ruby
|
||||
* Support x64-mingw-ucrt platform
|
||||
|
||||
PHP
|
||||
* Fix SEGV by not writing to shared memory for zend_class_entry
|
||||
|
||||
C#
|
||||
* Suppress warning CS8981
|
||||
|
||||
Other
|
||||
* Fix Maven release to release actual osx_aarch64 binary
|
||||
* Fix protoc zips to have the proto files for well known types
|
||||
|
||||
2022-05-10 version 21.0-rc1 (C++/Java/Python/PHP/Objective-C/C#/Ruby)
|
||||
|
||||
C++
|
||||
* Rename main cmake/CMakeLists.txt to CMakeLists.txt (#9603)
|
||||
* avoid allocating memory if all extension are cleared (#9345)
|
||||
* cmake: Call get_filename_component() with DIRECTORY mode instead of PATH mode (#9614)
|
||||
* Escape GetObject macro inside protoc-generated code (#9739)
|
||||
* Update CMake configuration to add a dependency on Abseil (#9793)
|
||||
* Use __constinit only in GCC 12.2 and up (#9936)
|
||||
* Refactor generated message class layout
|
||||
* Optimize tokenizer ParseInteger by removing division
|
||||
* Reserve exactly the right amount of capacity in ExtensionSet::MergeFrom
|
||||
* Parse FLT_MAX correctly when represented in JSON
|
||||
|
||||
Java
|
||||
* Update protobuf_version.bzl to separate protoc and per-language java … (#9900)
|
||||
* 6x speedup in ArrayEncoder.writeUInt32NotTag
|
||||
* Java generated code is no longer compatible with runtimes 2.6.1 and earlier
|
||||
|
||||
Python
|
||||
* Increment python major version to 4 in version.json for python upb (#9926)
|
||||
* The C extension module for Python has been rewritten to use the upb library.
|
||||
This is expected to deliver significant performance benefits, especially when
|
||||
parsing large payloads. There are some minor breaking changes, but these
|
||||
should not impact most users. For more information see:
|
||||
https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
|
||||
* Due to the breaking changes for Python, the major version number for Python
|
||||
has been incremented.
|
||||
* The binary wheel for macOS now supports Apple silicon.
|
||||
* In TextFormat, transform UnicodeDecodeError into ParseError.
|
||||
|
||||
|
||||
PHP
|
||||
* chore: [PHP] fix phpdoc for MapField keys (#9536)
|
||||
* [PHP] Remove unnecessary zval initialization (#9600)
|
||||
* [PHP] fix PHP build system (#9571)
|
||||
* Fix building packaged PHP extension (#9727)
|
||||
* fix: reserve "ReadOnly" keyword for PHP 8.1 and add compatibility (#9633)
|
||||
* fix: phpdoc syntax for repeatedfield parameters (#9784)
|
||||
* fix: phpdoc for repeatedfield (#9783)
|
||||
* Change enum string name for reserved words (#9780)
|
||||
* Fixed composer.json to only advertise compatibility with PHP 7.0+. (#9819)
|
||||
|
||||
Ruby
|
||||
* Allow pre-compiled binaries for ruby 3.1.0 (#9566)
|
||||
* Implement `respond_to?` in RubyMessage (#9677)
|
||||
* [Ruby] Fix RepeatedField#last, #first inconsistencies (#9722)
|
||||
* Do not use range based UTF-8 validation in truffleruby (#9769)
|
||||
* Improve range handling logic of `RepeatedField` (#9799)
|
||||
* Disable the aarch64 build on macOS until it can be fixed. (#9816)
|
||||
|
||||
Other
|
||||
* [Kotlin] remove redundant public modifiers for compiled code (#9642)
|
||||
* [C#] Update GetExtension to support getting typed value (#9655)
|
||||
* Fix invalid dependency manifest when using `descriptor_set_out` (#9647)
|
||||
* Fix C# generator handling of a field named "none" in a oneof (#9636)
|
||||
* Add initial version.json file for 21-dev (#9840)
|
||||
* Remove duplicate java generated code (#9909)
|
||||
* Fix versioning issues in 3.20.0
|
||||
|
||||
Compiler
|
||||
* Protoc outputs the list of suggested field numbers when invalid field
|
||||
numbers are specified in the .proto file.
|
||||
* Require package names to be less than 512 bytes in length
|
||||
|
||||
2022-04-21 version 3.20.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
|
||||
PHP
|
||||
* Fix building packaged PHP extension (#9727)
|
||||
|
||||
Other
|
||||
* Fix versioning issues in 3.20.0
|
||||
|
||||
2022-03-04 version 3.20.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
|
||||
Ruby
|
||||
* Dropped Ruby 2.3 and 2.4 support for CI and releases. (#9311)
|
||||
* Added Ruby 3.1 support for CI and releases (#9566).
|
||||
* Message.decode/encode: Add recursion_limit option (#9218/#9486)
|
||||
* Allocate with xrealloc()/xfree() so message allocation is visible to the
|
||||
Ruby GC. In certain tests this leads to much lower memory usage due to more
|
||||
frequent GC runs (#9586).
|
||||
* Fix conversion of singleton classes in Ruby (#9342)
|
||||
* Suppress warning for intentional circular require (#9556)
|
||||
* JSON will now output shorter strings for double and float fields when possible
|
||||
without losing precision.
|
||||
* Encoding and decoding of binary format will now work properly on big-endian
|
||||
systems.
|
||||
* UTF-8 verification was fixed to properly reject surrogate code points.
|
||||
* Unknown enums for proto2 protos now properly implement proto2's behavior of
|
||||
putting such values in unknown fields.
|
||||
|
||||
Java
|
||||
* Revert "Standardize on Array copyOf" (#9400)
|
||||
* Resolve more java field accessor name conflicts (#8198)
|
||||
* Don't support map fields in DynamicMessage.Builder.{getFieldBuilder,getRepeatedFieldBuilder}
|
||||
* Fix parseFrom to only throw InvalidProtocolBufferException
|
||||
* InvalidProtocolBufferException now allows arbitrary wrapped Exception types.
|
||||
* Fix bug in `FieldSet.Builder.mergeFrom`
|
||||
* Flush CodedOutputStream also flushes underlying OutputStream
|
||||
* When oneof case is the same and the field type is Message, merge the
|
||||
subfield. (previously it was replaced.)’
|
||||
* Add @CheckReturnValue to some protobuf types
|
||||
* Report original exceptions when parsing JSON
|
||||
* Add more info to @deprecated javadoc for set/get/has methods
|
||||
* Fix initialization bug in doc comment line numbers
|
||||
* Fix comments for message set wire format.
|
||||
|
||||
Kotlin
|
||||
* Add test scope to kotlin-test for protobuf-kotlin-lite (#9518)
|
||||
* Add orNull extensions for optional message fields.
|
||||
* Add orNull extensions to all proto3 message fields.
|
||||
|
||||
Python
|
||||
* Dropped support for Python < 3.7 (#9480)
|
||||
* Protoc is now able to generate python stubs (.pyi) with --pyi_out
|
||||
* Pin multibuild scripts to get manylinux1 wheels back (#9216)
|
||||
* Fix type annotations of some Duration and Timestamp methods.
|
||||
* Repeated field containers are now generic in field types and could be used
|
||||
in type annotations.
|
||||
* Protobuf python generated codes are simplified. Descriptors and message
|
||||
classes' definitions are now dynamic created in internal/builder.py.
|
||||
Insertion Points for messages classes are discarded.
|
||||
* has_presence is added for FieldDescriptor in python
|
||||
* Loosen indexing type requirements to allow valid __index__() implementations
|
||||
rather than only PyLongObjects.
|
||||
* Fix the deepcopy bug caused by not copying message_listener.
|
||||
* Added python JSON parse recursion limit (default 100)
|
||||
* Path info is added for python JSON parse errors
|
||||
* Pure python repeated scalar fields will not able to pickle. Convert to list
|
||||
first.
|
||||
* Timestamp.ToDatetime() now accepts an optional tzinfo parameter. If
|
||||
specified, the function returns a timezone-aware datetime in the given time
|
||||
zone. If omitted or None, the function returns a timezone-naive UTC datetime
|
||||
(as previously).
|
||||
* Adds client_streaming and server_streaming fields to MethodDescriptor.
|
||||
* Add "ensure_ascii" parameter to json_format.MessageToJson. This allows smaller
|
||||
JSON serializations with UTF-8 or other non-ASCII encodings.
|
||||
* Added experimental support for directly assigning numpy scalars and array.
|
||||
* Improve the calculation of public_dependencies in DescriptorPool.
|
||||
* [Breaking Change] Disallow setting fields to numpy singleton arrays or repeated fields to numpy
|
||||
multi-dimensional arrays. Numpy arrays should be indexed or flattened explicitly before assignment.
|
||||
|
||||
Compiler
|
||||
* Migrate IsDefault(const std::string*) and UnsafeSetDefault(const std::string*)
|
||||
* Implement strong qualified tags for TaggedPtr
|
||||
* Rework allocations to power-of-two byte sizes.
|
||||
* Migrate IsDefault(const std::string*) and UnsafeSetDefault(const std::string*)
|
||||
* Implement strong qualified tags for TaggedPtr
|
||||
* Make TaggedPtr Set...() calls explicitly spell out the content type.
|
||||
* Check for parsing error before verifying UTF8.
|
||||
* Enforce a maximum message nesting limit of 32 in the descriptor builder to
|
||||
guard against stack overflows
|
||||
* Fixed bugs in operators for RepeatedPtrIterator
|
||||
* Assert a maximum map alignment for allocated values
|
||||
* Fix proto1 group extension protodb parsing error
|
||||
* Do not log/report the same descriptor symbol multiple times if it contains
|
||||
more than one invalid character.
|
||||
* Add UnknownFieldSet::SerializeToString and SerializeToCodedStream.
|
||||
* Remove explicit default pointers and deprecated API from protocol compiler
|
||||
|
||||
Arenas
|
||||
* Change Repeated*Field to reuse memory when using arenas.
|
||||
* Implements pbarenaz for profiling proto arenas
|
||||
* Introduce CreateString() and CreateArenaString() for cleaner semantics
|
||||
* Fix unreferenced parameter for MSVC builds
|
||||
* Add UnsafeSetAllocated to be used for one-of string fields.
|
||||
* Make Arena::AllocateAligned() a public function.
|
||||
* Determine if ArenaDtor related code generation is necessary in one place.
|
||||
* Implement on demand register ArenaDtor for InlinedStringField
|
||||
|
||||
C++
|
||||
* Enable testing via CTest (#8737)
|
||||
* Add option to use external GTest in CMake (#8736)
|
||||
* CMake: Set correct sonames for libprotobuf-lite.so and libprotoc.so (#8635) (#9529)
|
||||
* Add cmake option `protobuf_INSTALL` to not install files (#7123)
|
||||
* CMake: Allow custom plugin options e.g. to generate mocks (#9105)
|
||||
* CMake: Use linker version scripts (#9545)
|
||||
* Manually *struct Cord fields to work better with arenas.
|
||||
* Manually destruct map fields.
|
||||
* Generate narrower code
|
||||
* Fix https://github.com/protocolbuffers/protobuf/issues/9378 by removing
|
||||
shadowed _cached_size_ field
|
||||
* Remove GetPointer() and explicit nullptr defaults.
|
||||
* Add proto_h flag for speeding up large builds
|
||||
* Add missing overload for reference wrapped fields.
|
||||
* Add MergedDescriptorDatabase::FindAllFileNames()
|
||||
* RepeatedField now defines an iterator type instead of using a pointer.
|
||||
* Remove obsolete macros GOOGLE_PROTOBUF_HAS_ONEOF and GOOGLE_PROTOBUF_HAS_ARENAS.
|
||||
|
||||
PHP
|
||||
* Fix: add missing reserved classnames (#9458)
|
||||
* PHP 8.1 compatibility (#9370)
|
||||
|
||||
C#
|
||||
* Fix trim warnings (#9182)
|
||||
* Fixes NullReferenceException when accessing FieldDescriptor.IsPacked (#9430)
|
||||
* Add ToProto() method to all descriptor classes (#9426)
|
||||
* Add an option to preserve proto names in JsonFormatter (#6307)
|
||||
|
||||
Objective-C
|
||||
* Add prefix_to_proto_package_mappings_path option. (#9498)
|
||||
* Rename `proto_package_to_prefix_mappings_path` to `package_to_prefix_mappings_path`. (#9552)
|
||||
* Add a generation option to control use of forward declarations in headers. (#9568)
|
||||
|
||||
2022-01-28 version 3.19.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
|
||||
Python
|
||||
* Make libprotobuf symbols local on OSX to fix issue #9395 (#9435)
|
||||
|
||||
Ruby
|
||||
* Fixed a data loss bug that could occur when the number of `optional`
|
||||
fields in a message is an exact multiple of 32. (#9440).
|
||||
|
||||
PHP
|
||||
* Fixed a data loss bug that could occur when the number of `optional`
|
||||
fields in a message is an exact multiple of 32. (#9440).
|
||||
|
||||
2022-01-10 version 3.19.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
|
||||
Python
|
||||
* Fix missing Windows wheel for Python 3.10 on PyPI
|
||||
|
||||
2022-01-05 version 3.19.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
|
||||
Java
|
||||
* Improve performance characteristics of UnknownFieldSet parsing (#9371)
|
||||
* This release addresses a Security Advisory for Java users
|
||||
(https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-wrvw-hg22-4m67)
|
||||
|
||||
2022-01-05 version 3.18.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
|
||||
Java
|
||||
* Improve performance characteristics of UnknownFieldSet parsing (#9371)
|
||||
* This release addresses a Security Advisory for Java users
|
||||
(https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-wrvw-hg22-4m67)
|
||||
|
||||
2022-01-05 version 3.16.1 (Java)
|
||||
|
||||
Java
|
||||
* Improve performance characteristics of UnknownFieldSet parsing (#9371)
|
||||
* This release addresses a Security Advisory for Java users
|
||||
(https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-wrvw-hg22-4m67)
|
||||
|
||||
2021-10-28 version 3.19.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
|
||||
Bazel
|
||||
|
351
CMakeLists.txt
Normal file
351
CMakeLists.txt
Normal file
@ -0,0 +1,351 @@
|
||||
# Minimum CMake required
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
if(protobuf_VERBOSE)
|
||||
message(STATUS "Protocol Buffers Configuring...")
|
||||
endif()
|
||||
|
||||
# CMake policies
|
||||
cmake_policy(SET CMP0022 NEW)
|
||||
# On MacOS use @rpath/ for target's install name prefix path
|
||||
if (POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif ()
|
||||
# Clear VERSION variables when no VERSION is given to project()
|
||||
if(POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
endif()
|
||||
# MSVC runtime library flags are selected by an abstraction.
|
||||
if(POLICY CMP0091)
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
endif()
|
||||
|
||||
# Project
|
||||
project(protobuf C CXX)
|
||||
|
||||
if(protobuf_DEPRECATED_CMAKE_SUBDIRECTORY_USAGE)
|
||||
if(CMAKE_PROJECT_NAME STREQUAL "protobuf")
|
||||
get_filename_component(CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR} DIRECTORY)
|
||||
endif()
|
||||
get_filename_component(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
|
||||
get_filename_component(PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
|
||||
get_filename_component(protobuf_SOURCE_DIR ${protobuf_SOURCE_DIR} DIRECTORY)
|
||||
endif()
|
||||
|
||||
# Add c++11 flags
|
||||
if (CYGWIN)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
|
||||
# The Intel compiler isn't able to deal with noinline member functions of
|
||||
# template classes defined in headers. As such it spams the output with
|
||||
# warning #2196: routine is both "inline" and "noinline"
|
||||
# This silences that warning.
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES Intel)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -diag-disable=2196")
|
||||
endif()
|
||||
|
||||
# Options
|
||||
option(protobuf_INSTALL "Install protobuf binaries and files" ON)
|
||||
if(WITH_PROTOC)
|
||||
set(protobuf_PROTOC_EXE ${WITH_PROTOC} CACHE FILEPATH "Protocol Buffer Compiler executable" FORCE)
|
||||
endif()
|
||||
option(protobuf_BUILD_TESTS "Build tests" ON)
|
||||
option(protobuf_BUILD_CONFORMANCE "Build conformance tests" OFF)
|
||||
option(protobuf_BUILD_EXAMPLES "Build examples" OFF)
|
||||
option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON)
|
||||
option(protobuf_BUILD_LIBPROTOC "Build libprotoc" OFF)
|
||||
option(protobuf_DISABLE_RTTI "Remove runtime type information in the binaries" OFF)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(protobuf_BUILD_SHARED_LIBS_DEFAULT ON)
|
||||
else (BUILD_SHARED_LIBS)
|
||||
set(protobuf_BUILD_SHARED_LIBS_DEFAULT OFF)
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHARED_LIBS_DEFAULT})
|
||||
include(CMakeDependentOption)
|
||||
cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON
|
||||
"NOT protobuf_BUILD_SHARED_LIBS" OFF)
|
||||
set(protobuf_WITH_ZLIB_DEFAULT ON)
|
||||
option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT})
|
||||
set(protobuf_DEBUG_POSTFIX "d"
|
||||
CACHE STRING "Default debug postfix")
|
||||
mark_as_advanced(protobuf_DEBUG_POSTFIX)
|
||||
# User options
|
||||
include(${protobuf_SOURCE_DIR}/cmake/protobuf-options.cmake)
|
||||
|
||||
# Overrides for option dependencies
|
||||
if (protobuf_BUILD_PROTOC_BINARIES OR protobuf_BUILD_TESTS)
|
||||
set(protobuf_BUILD_LIBPROTOC ON)
|
||||
endif ()
|
||||
# Path to main configure script
|
||||
set(protobuf_CONFIGURE_SCRIPT "${protobuf_SOURCE_DIR}/configure.ac")
|
||||
|
||||
# Parse configure script
|
||||
set(protobuf_AC_INIT_REGEX
|
||||
"^AC_INIT\\(\\[([^]]+)\\],\\[([^]]+)\\],\\[([^]]+)\\],\\[([^]]+)\\]\\)$")
|
||||
file(STRINGS "${protobuf_CONFIGURE_SCRIPT}" protobuf_AC_INIT_LINE
|
||||
LIMIT_COUNT 1 REGEX "^AC_INIT")
|
||||
# Description
|
||||
string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\1"
|
||||
protobuf_DESCRIPTION "${protobuf_AC_INIT_LINE}")
|
||||
# Version
|
||||
string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\2"
|
||||
protobuf_VERSION_STRING "${protobuf_AC_INIT_LINE}")
|
||||
# Contact
|
||||
string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\3"
|
||||
protobuf_CONTACT "${protobuf_AC_INIT_LINE}")
|
||||
# Parse version tweaks
|
||||
set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)([-]rc[-]|\\.)?([0-9]*)$")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\1"
|
||||
protobuf_VERSION_MAJOR "${protobuf_VERSION_STRING}")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\2"
|
||||
protobuf_VERSION_MINOR "${protobuf_VERSION_STRING}")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\3"
|
||||
protobuf_VERSION_PATCH "${protobuf_VERSION_STRING}")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\5"
|
||||
protobuf_VERSION_PRERELEASE "${protobuf_VERSION_STRING}")
|
||||
|
||||
message(STATUS "${protobuf_VERSION_PRERELEASE}")
|
||||
|
||||
# Package version
|
||||
set(protobuf_VERSION
|
||||
"${protobuf_VERSION_MAJOR}.${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}")
|
||||
|
||||
if(protobuf_VERSION_PRERELEASE)
|
||||
set(protobuf_VERSION "${protobuf_VERSION}.${protobuf_VERSION_PRERELEASE}")
|
||||
else()
|
||||
set(protobuf_VERSION "${protobuf_VERSION}.0")
|
||||
endif()
|
||||
message(STATUS "${protobuf_VERSION}")
|
||||
|
||||
if(protobuf_VERBOSE)
|
||||
message(STATUS "Configuration script parsing status [")
|
||||
message(STATUS " Description : ${protobuf_DESCRIPTION}")
|
||||
message(STATUS " Version : ${protobuf_VERSION} (${protobuf_VERSION_STRING})")
|
||||
message(STATUS " Contact : ${protobuf_CONTACT}")
|
||||
message(STATUS "]")
|
||||
endif()
|
||||
|
||||
add_definitions(-DGOOGLE_PROTOBUF_CMAKE_BUILD)
|
||||
|
||||
if (protobuf_DISABLE_RTTI)
|
||||
add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)
|
||||
endif()
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map
|
||||
"{
|
||||
global:
|
||||
main;
|
||||
local:
|
||||
*;
|
||||
};")
|
||||
# CheckLinkerFlag module available in CMake >=3.18.
|
||||
if(${CMAKE_VERSION} VERSION_GREATER 3.18 OR ${CMAKE_VERSION} VERSION_EQUAL 3.18)
|
||||
include(CheckLinkerFlag)
|
||||
check_linker_flag(CXX -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
else()
|
||||
include(CheckCXXSourceCompiles)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map)
|
||||
check_cxx_source_compiles("
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
" protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
endif()
|
||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
set(_protobuf_FIND_ZLIB)
|
||||
if (protobuf_WITH_ZLIB)
|
||||
find_package(ZLIB)
|
||||
if (ZLIB_FOUND)
|
||||
set(HAVE_ZLIB 1)
|
||||
# FindZLIB module define ZLIB_INCLUDE_DIRS variable
|
||||
# Set ZLIB_INCLUDE_DIRECTORIES for compatible
|
||||
set(ZLIB_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRECTORIES} ${ZLIB_INCLUDE_DIRS})
|
||||
# Using imported target if exists
|
||||
if (TARGET ZLIB::ZLIB)
|
||||
set(ZLIB_LIBRARIES ZLIB::ZLIB)
|
||||
set(_protobuf_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()")
|
||||
endif (TARGET ZLIB::ZLIB)
|
||||
else (ZLIB_FOUND)
|
||||
set(HAVE_ZLIB 0)
|
||||
# Explicitly set these to empty (override NOT_FOUND) so cmake doesn't
|
||||
# complain when we use them later.
|
||||
set(ZLIB_INCLUDE_DIRECTORIES)
|
||||
set(ZLIB_LIBRARIES)
|
||||
endif (ZLIB_FOUND)
|
||||
endif (protobuf_WITH_ZLIB)
|
||||
|
||||
if (HAVE_ZLIB)
|
||||
add_definitions(-DHAVE_ZLIB)
|
||||
endif (HAVE_ZLIB)
|
||||
|
||||
# We need to link with libatomic on systems that do not have builtin atomics, or
|
||||
# don't have builtin support for 8 byte atomics
|
||||
set(protobuf_LINK_LIBATOMIC false)
|
||||
if (NOT MSVC)
|
||||
include(CheckCXXSourceCompiles)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++11)
|
||||
check_cxx_source_compiles("
|
||||
#include <atomic>
|
||||
int main() {
|
||||
return std::atomic<int64_t>{};
|
||||
}
|
||||
" protobuf_HAVE_BUILTIN_ATOMICS)
|
||||
if (NOT protobuf_HAVE_BUILTIN_ATOMICS)
|
||||
set(protobuf_LINK_LIBATOMIC true)
|
||||
endif (NOT protobuf_HAVE_BUILTIN_ATOMICS)
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
endif (NOT MSVC)
|
||||
|
||||
if (protobuf_BUILD_SHARED_LIBS)
|
||||
set(protobuf_SHARED_OR_STATIC "SHARED")
|
||||
else (protobuf_BUILD_SHARED_LIBS)
|
||||
set(protobuf_SHARED_OR_STATIC "STATIC")
|
||||
# The CMAKE_<LANG>_FLAGS(_<BUILD_TYPE>)? is meant to be user controlled.
|
||||
# Prior to CMake 3.15, the MSVC runtime library was pushed into the same flags
|
||||
# making programmatic control difficult. Prefer the functionality in newer
|
||||
# CMake versions when available.
|
||||
if(${CMAKE_VERSION} VERSION_GREATER 3.15 OR ${CMAKE_VERSION} VERSION_EQUAL 3.15)
|
||||
if (protobuf_MSVC_STATIC_RUNTIME)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)
|
||||
else()
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>DLL)
|
||||
endif()
|
||||
else()
|
||||
# In case we are building static libraries, link also the runtime library statically
|
||||
# so that MSVCR*.DLL is not required at runtime.
|
||||
# https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
|
||||
# This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd
|
||||
# http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
|
||||
if (MSVC AND protobuf_MSVC_STATIC_RUNTIME)
|
||||
foreach(flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if(${flag_var} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endif(${flag_var} MATCHES "/MD")
|
||||
endforeach(flag_var)
|
||||
endif (MSVC AND protobuf_MSVC_STATIC_RUNTIME)
|
||||
endif()
|
||||
endif (protobuf_BUILD_SHARED_LIBS)
|
||||
|
||||
if (MSVC)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# Build with multiple processes
|
||||
add_definitions(/MP)
|
||||
endif()
|
||||
# Set source file and execution character sets to UTF-8
|
||||
add_definitions(/utf-8)
|
||||
# MSVC warning suppressions
|
||||
add_definitions(
|
||||
/wd4065 # switch statement contains 'default' but no 'case' labels
|
||||
/wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
/wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
|
||||
/wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
|
||||
/wd4305 # 'identifier' : truncation from 'type1' to 'type2'
|
||||
/wd4307 # 'operator' : integral constant overflow
|
||||
/wd4309 # 'conversion' : truncation of constant value
|
||||
/wd4334 # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
|
||||
/wd4355 # 'this' : used in base member initializer list
|
||||
/wd4506 # no definition for inline function 'function'
|
||||
/wd4800 # 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
/wd4996 # The compiler encountered a deprecated declaration.
|
||||
)
|
||||
# Allow big object
|
||||
add_definitions(/bigobj)
|
||||
string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR})
|
||||
string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR})
|
||||
string(REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION}")
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in extract_includes.bat)
|
||||
|
||||
# Suppress linker warnings about files with no symbols defined.
|
||||
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# Configure Resource Compiler
|
||||
enable_language(RC)
|
||||
# use English language (0x409) in resource compiler
|
||||
set(rc_flags "/l0x409")
|
||||
# fix rc.exe invocations because of usage of add_definitions()
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
|
||||
endif()
|
||||
|
||||
# Generate the version.rc file used elsewhere.
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
|
||||
set(protobuf_version_rc_file ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
||||
|
||||
# Add the "lib" prefix for generated .lib outputs.
|
||||
set(LIB_PREFIX lib)
|
||||
else (MSVC)
|
||||
# No version.rc file.
|
||||
set(protobuf_version_rc_file)
|
||||
|
||||
# When building with "make", "lib" prefix will be added automatically by
|
||||
# the build tool.
|
||||
set(LIB_PREFIX)
|
||||
endif (MSVC)
|
||||
|
||||
include_directories(
|
||||
${ZLIB_INCLUDE_DIRECTORIES}
|
||||
${protobuf_BINARY_DIR}
|
||||
${protobuf_SOURCE_DIR}/src)
|
||||
|
||||
if (protobuf_UNICODE)
|
||||
add_definitions(-DUNICODE -D_UNICODE)
|
||||
endif (protobuf_UNICODE)
|
||||
|
||||
include(${protobuf_SOURCE_DIR}/cmake/libprotobuf-lite.cmake)
|
||||
include(${protobuf_SOURCE_DIR}/cmake/libprotobuf.cmake)
|
||||
if (protobuf_BUILD_LIBPROTOC)
|
||||
include(${protobuf_SOURCE_DIR}/cmake/libprotoc.cmake)
|
||||
endif (protobuf_BUILD_LIBPROTOC)
|
||||
if (protobuf_BUILD_PROTOC_BINARIES)
|
||||
include(${protobuf_SOURCE_DIR}/cmake/protoc.cmake)
|
||||
if (NOT DEFINED protobuf_PROTOC_EXE)
|
||||
set(protobuf_PROTOC_EXE protoc)
|
||||
endif (NOT DEFINED protobuf_PROTOC_EXE)
|
||||
endif (protobuf_BUILD_PROTOC_BINARIES)
|
||||
|
||||
# Ensure we have a protoc executable if we need one
|
||||
if (protobuf_BUILD_TESTS OR protobuf_BUILD_CONFORMANCE OR protobuf_BUILD_EXAMPLES)
|
||||
if (NOT DEFINED protobuf_PROTOC_EXE)
|
||||
find_program(protobuf_PROTOC_EXE protoc)
|
||||
if (NOT protobuf_PROTOC_EXE)
|
||||
message(FATAL "Build requires 'protoc' but binary not found and not building protoc.")
|
||||
endif ()
|
||||
endif ()
|
||||
if(protobuf_VERBOSE)
|
||||
message(STATUS "Using protoc : ${protobuf_PROTOC_EXE}")
|
||||
endif(protobuf_VERBOSE)
|
||||
endif ()
|
||||
|
||||
if (protobuf_BUILD_TESTS)
|
||||
enable_testing()
|
||||
include(${protobuf_SOURCE_DIR}/cmake/tests.cmake)
|
||||
endif (protobuf_BUILD_TESTS)
|
||||
|
||||
if (protobuf_BUILD_CONFORMANCE)
|
||||
include(${protobuf_SOURCE_DIR}/cmake/conformance.cmake)
|
||||
endif (protobuf_BUILD_CONFORMANCE)
|
||||
|
||||
if (protobuf_INSTALL)
|
||||
include(${protobuf_SOURCE_DIR}/cmake/install.cmake)
|
||||
endif (protobuf_INSTALL)
|
||||
|
||||
if (protobuf_BUILD_EXAMPLES)
|
||||
include(${protobuf_SOURCE_DIR}/cmake/examples.cmake)
|
||||
endif (protobuf_BUILD_EXAMPLES)
|
||||
|
||||
if(protobuf_VERBOSE)
|
||||
message(STATUS "Protocol Buffers Configuring done")
|
||||
endif(protobuf_VERBOSE)
|
@ -53,11 +53,11 @@ conforming.
|
||||
|
||||
## Contributing Process
|
||||
|
||||
Most pull requests should go to the master branch and the change will be
|
||||
Most pull requests should go to the main branch and the change will be
|
||||
included in the next major/minor version release (e.g., 3.6.0 release). If you
|
||||
need to include a bug fix in a patch release (e.g., 3.5.2), make sure it’s
|
||||
already merged to master, and then create a pull request cherry-picking the
|
||||
commits from master branch to the release branch (e.g., branch 3.5.x).
|
||||
already merged to main, and then create a pull request cherry-picking the
|
||||
commits from main branch to the release branch (e.g., branch 3.5.x).
|
||||
|
||||
For each pull request, a protobuf team member will be assigned to review the
|
||||
pull request. For minor cleanups, the pull request may be merged right away
|
||||
@ -96,9 +96,9 @@ the final release.
|
||||
of inactivity.
|
||||
* Maintain clean commit history and use meaningful commit messages. PRs with
|
||||
messy commit history are difficult to review and won't be merged. Use rebase
|
||||
-i upstream/master to curate your commit history and/or to bring in latest
|
||||
changes from master (but avoid rebasing in the middle of a code review).
|
||||
* Keep your PR up to date with upstream/master (if there are merge conflicts,
|
||||
-i upstream/main to curate your commit history and/or to bring in latest
|
||||
changes from main (but avoid rebasing in the middle of a code review).
|
||||
* Keep your PR up to date with upstream/main (if there are merge conflicts,
|
||||
we can't really merge your change).
|
||||
* All tests need to be passing before your change can be merged. We recommend
|
||||
you run tests locally before creating your PR to catch breakages early on.
|
||||
|
@ -100,3 +100,8 @@ Patch contributors:
|
||||
Andrew Paprocki <andrew@ishiboo.com>
|
||||
* Fixed minor IBM xlC compiler build issues
|
||||
* Added atomicops for AIX (POWER)
|
||||
Nipunn Koorapati <nipunn1313@gmail.com>
|
||||
* Provide a type alias field ValueType on EnumTypeWrapper
|
||||
* Match service argument names to abstract interface
|
||||
|
||||
|
||||
|
409
Makefile.am
409
Makefile.am
@ -9,6 +9,9 @@ AUTOMAKE_OPTIONS = foreign
|
||||
SUBDIRS = . src
|
||||
|
||||
# Always include third_party directories in distributions.
|
||||
#
|
||||
# Note that distribution artifacts will be produced by Bazel in the future.
|
||||
# See pkg/BUILD.bazel for overall definitions.
|
||||
DIST_SUBDIRS = src conformance benchmarks third_party/googletest
|
||||
|
||||
# Build gmock before we build protobuf tests. We don't add gmock to SUBDIRS
|
||||
@ -48,12 +51,15 @@ clean-local:
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = protobuf.pc protobuf-lite.pc
|
||||
|
||||
# Note: please keep this in sync with the dist_files rule in csharp/BUILD.bazel.
|
||||
csharp_EXTRA_DIST= \
|
||||
global.json \
|
||||
csharp/.editorconfig \
|
||||
csharp/.gitignore \
|
||||
csharp/CHANGES.txt \
|
||||
csharp/Google.Protobuf.Tools.targets \
|
||||
csharp/Google.Protobuf.Tools.nuspec \
|
||||
csharp/NuGet.Config \
|
||||
csharp/README.md \
|
||||
csharp/build_packages.bat \
|
||||
csharp/build_tools.sh \
|
||||
@ -86,6 +92,7 @@ csharp_EXTRA_DIST= \
|
||||
csharp/src/AddressBook/ListPeople.cs \
|
||||
csharp/src/AddressBook/Program.cs \
|
||||
csharp/src/AddressBook/SampleUsage.cs \
|
||||
csharp/src/Directory.Build.props \
|
||||
csharp/src/Google.Protobuf.Benchmarks/BenchmarkDatasetConfig.cs \
|
||||
csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs \
|
||||
csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs \
|
||||
@ -113,7 +120,6 @@ csharp_EXTRA_DIST= \
|
||||
csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs \
|
||||
csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs \
|
||||
csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs \
|
||||
csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs \
|
||||
csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs \
|
||||
csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs \
|
||||
csharp/src/Google.Protobuf.Test/EqualityTester.cs \
|
||||
@ -179,12 +185,13 @@ csharp_EXTRA_DIST= \
|
||||
csharp/src/Google.Protobuf/Collections/Lists.cs \
|
||||
csharp/src/Google.Protobuf/Collections/MapField.cs \
|
||||
csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs \
|
||||
csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs \
|
||||
csharp/src/Google.Protobuf/Collections/RepeatedField.cs \
|
||||
csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs \
|
||||
csharp/src/Google.Protobuf/Compatibility/DynamicallyAccessedMembersAttribute.cs \
|
||||
csharp/src/Google.Protobuf/Compatibility/DynamicallyAccessedMemberTypes.cs \
|
||||
csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs \
|
||||
csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs \
|
||||
csharp/src/Google.Protobuf/Compatibility/RequiresUnreferencedCodeAttribute.cs \
|
||||
csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs \
|
||||
csharp/src/Google.Protobuf/Compatibility/UnconditionalSuppressMessageAttribute.cs \
|
||||
csharp/src/Google.Protobuf/Extension.cs \
|
||||
csharp/src/Google.Protobuf/ExtensionRegistry.cs \
|
||||
csharp/src/Google.Protobuf/ExtensionSet.cs \
|
||||
@ -273,10 +280,11 @@ csharp_EXTRA_DIST= \
|
||||
csharp/src/Google.Protobuf/UnknownFieldSet.cs \
|
||||
csharp/src/Google.Protobuf/UnsafeByteOperations.cs
|
||||
|
||||
# Note: please keep this in sync with the dist_files rules under java/.../BUILD.bazel.
|
||||
java_EXTRA_DIST= \
|
||||
java/README.md \
|
||||
java/bom/pom.xml \
|
||||
java/core/BUILD \
|
||||
java/core/BUILD.bazel \
|
||||
java/core/generate-sources-build.xml \
|
||||
java/core/generate-test-sources-build.xml \
|
||||
java/core/pom.xml \
|
||||
@ -303,6 +311,7 @@ java_EXTRA_DIST=
|
||||
java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java \
|
||||
java/core/src/main/java/com/google/protobuf/CodedOutputStream.java \
|
||||
java/core/src/main/java/com/google/protobuf/CodedOutputStreamWriter.java \
|
||||
java/core/src/main/java/com/google/protobuf/CompileTimeConstant.java \
|
||||
java/core/src/main/java/com/google/protobuf/DescriptorMessageInfoFactory.java \
|
||||
java/core/src/main/java/com/google/protobuf/Descriptors.java \
|
||||
java/core/src/main/java/com/google/protobuf/DiscardUnknownFieldsParser.java \
|
||||
@ -326,6 +335,7 @@ java_EXTRA_DIST=
|
||||
java/core/src/main/java/com/google/protobuf/GeneratedMessageInfoFactory.java \
|
||||
java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java \
|
||||
java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java \
|
||||
java/core/src/main/java/com/google/protobuf/InlineMe.java \
|
||||
java/core/src/main/java/com/google/protobuf/IntArrayList.java \
|
||||
java/core/src/main/java/com/google/protobuf/Internal.java \
|
||||
java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java \
|
||||
@ -437,9 +447,9 @@ java_EXTRA_DIST=
|
||||
java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java \
|
||||
java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/IntArrayListTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/InvalidProtocolBufferExceptionTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java \
|
||||
java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java \
|
||||
java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java \
|
||||
@ -464,15 +474,12 @@ java_EXTRA_DIST=
|
||||
java/core/src/test/java/com/google/protobuf/Proto2ExtensionLookupSchemaTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto2LiteSchemaTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto2MessageFactory.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto2MessageInfoFactory.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto2MessageLiteFactory.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto2SchemaTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto2UnknownEnumValueTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto3LiteSchemaTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto3MessageFactory.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto3MessageInfoFactory.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto3MessageLiteFactory.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto3MessageLiteInfoFactory.java \
|
||||
java/core/src/test/java/com/google/protobuf/Proto3SchemaTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java \
|
||||
@ -493,9 +500,9 @@ java_EXTRA_DIST=
|
||||
java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/Utf8Test.java \
|
||||
java/core/src/test/java/com/google/protobuf/Utf8Utils.java \
|
||||
java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/WireFormatLiteTest.java \
|
||||
java/core/src/test/java/com/google/protobuf/WireFormatTest.java \
|
||||
@ -504,6 +511,7 @@ java_EXTRA_DIST=
|
||||
java/core/src/test/proto/com/google/protobuf/any_test.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/cached_field_size_test.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/deprecated_file.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/dynamic_message_test.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/field_presence_test.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto \
|
||||
@ -512,7 +520,6 @@ java_EXTRA_DIST=
|
||||
java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/map_lite_test.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/map_test.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/message_lite_extension_util_test.proto\
|
||||
java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/nested_extension.proto \
|
||||
@ -533,21 +540,24 @@ java_EXTRA_DIST=
|
||||
java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/test_custom_options.proto \
|
||||
java/core/src/test/proto/com/google/protobuf/wrappers_test.proto \
|
||||
java/internal/BUILD \
|
||||
java/internal/BUILD.bazel \
|
||||
java/internal/testing.bzl \
|
||||
java/kotlin/BUILD.bazel \
|
||||
java/kotlin/generate-sources-build.xml \
|
||||
java/kotlin/generate-test-sources-build.xml \
|
||||
java/kotlin/pom.xml \
|
||||
java/kotlin/pom_template.xml \
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/Anies.kt \
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/ByteStrings.kt \
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt \
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt \
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/DslProxy.kt \
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt \
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt\
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt \
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt\
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt \
|
||||
java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt \
|
||||
java/kotlin/src/test/kotlin/com/google/protobuf/AniesTest.kt \
|
||||
java/kotlin/src/test/kotlin/com/google/protobuf/ByteStringsTest.kt \
|
||||
java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt \
|
||||
java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt \
|
||||
@ -559,15 +569,18 @@ java_EXTRA_DIST=
|
||||
java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto \
|
||||
java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto \
|
||||
java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto \
|
||||
java/kotlin-lite/BUILD.bazel \
|
||||
java/kotlin-lite/generate-sources-build.xml \
|
||||
java/kotlin-lite/generate-test-sources-build.xml \
|
||||
java/kotlin-lite/lite.awk \
|
||||
java/kotlin-lite/pom.xml \
|
||||
java/kotlin-lite/pom_template.xml \
|
||||
java/kotlin-lite/process-lite-sources-build.xml \
|
||||
java/kotlin-lite/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt\
|
||||
java/kotlin-lite/src/test/kotlin/com/google/protobuf/ExtendableMessageLiteExtensionsTest.kt\
|
||||
java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt \
|
||||
java/lite.md \
|
||||
java/lite/BUILD \
|
||||
java/lite/BUILD.bazel \
|
||||
java/lite/generate-sources-build.xml \
|
||||
java/lite/generate-test-sources-build.xml \
|
||||
java/lite/lite.awk \
|
||||
@ -575,10 +588,9 @@ java_EXTRA_DIST=
|
||||
java/lite/pom_template.xml \
|
||||
java/lite/process-lite-sources-build.xml \
|
||||
java/lite/src/test/java/com/google/protobuf/LiteTest.java \
|
||||
java/lite/src/test/java/com/google/protobuf/Proto2MessageLiteInfoFactory.java \
|
||||
java/BUILD \
|
||||
java/BUILD.bazel \
|
||||
java/pom.xml \
|
||||
java/util/BUILD \
|
||||
java/util/BUILD.bazel \
|
||||
java/util/pom.xml \
|
||||
java/util/pom_template.xml \
|
||||
java/util/src/main/java/com/google/protobuf/util/Durations.java \
|
||||
@ -588,16 +600,19 @@ java_EXTRA_DIST=
|
||||
java/util/src/main/java/com/google/protobuf/util/Structs.java \
|
||||
java/util/src/main/java/com/google/protobuf/util/Timestamps.java \
|
||||
java/util/src/main/java/com/google/protobuf/util/Values.java \
|
||||
java/util/src/test/java/com/google/protobuf/util/DurationsTest.java \
|
||||
java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java \
|
||||
java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java \
|
||||
java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java \
|
||||
java/util/src/test/java/com/google/protobuf/util/StructsTest.java \
|
||||
java/util/src/test/java/com/google/protobuf/util/TimestampsTest.java \
|
||||
java/util/src/test/java/com/google/protobuf/util/ValuesTest.java \
|
||||
java/util/src/test/proto/com/google/protobuf/util/json_test.proto
|
||||
|
||||
# Note: please keep this in sync with the dist_files rule in objectivec/BUILD.bazel.
|
||||
objectivec_EXTRA_DIST= \
|
||||
objectivec/.clang-format \
|
||||
objectivec/BUILD \
|
||||
objectivec/BUILD.bazel \
|
||||
objectivec/DevTools/check_version_stamps.sh \
|
||||
objectivec/DevTools/compile_testing_protos.sh \
|
||||
objectivec/DevTools/full_mac_build.sh \
|
||||
@ -696,33 +711,6 @@ objectivec_EXTRA_DIST= \
|
||||
objectivec/ProtocolBuffers_tvOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \
|
||||
objectivec/ProtocolBuffers_tvOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \
|
||||
objectivec/README.md \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/OSXCocoaPodsTester.xcscheme \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework \
|
||||
objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static \
|
||||
objectivec/Tests/CocoaPods/README.md \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.pbxproj \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/iOSCocoaPodsTester.xcscheme \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m \
|
||||
objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m \
|
||||
objectivec/Tests/CocoaPods/run_tests.sh \
|
||||
objectivec/Tests/golden_message \
|
||||
objectivec/Tests/golden_packed_fields_message \
|
||||
objectivec/Tests/GPBARCUnittestProtos.m \
|
||||
@ -803,11 +791,12 @@ objectivec_EXTRA_DIST= \
|
||||
objectivec/Tests/UnitTests-Info.plist \
|
||||
Protobuf.podspec
|
||||
|
||||
# Note: please keep this in sync with the dist_files rule in php/BUILD.bazel.
|
||||
php_EXTRA_DIST= \
|
||||
composer.json \
|
||||
php/README.md \
|
||||
php/REFCOUNTING.md \
|
||||
php/composer.json \
|
||||
php/composer.json.dist \
|
||||
php/ext/google/protobuf/arena.c \
|
||||
php/ext/google/protobuf/arena.h \
|
||||
php/ext/google/protobuf/array.c \
|
||||
@ -826,9 +815,11 @@ php_EXTRA_DIST= \
|
||||
php/ext/google/protobuf/package.xml \
|
||||
php/ext/google/protobuf/php-upb.c \
|
||||
php/ext/google/protobuf/php-upb.h \
|
||||
php/ext/google/protobuf/php_protobuf.h \
|
||||
php/ext/google/protobuf/protobuf.c \
|
||||
php/ext/google/protobuf/protobuf.h \
|
||||
php/ext/google/protobuf/wkt.inc \
|
||||
php/ext/google/protobuf/tests/unnecessary_zval.phpt \
|
||||
php/generate_descriptor_protos.sh \
|
||||
php/generate_test_protos.sh \
|
||||
php/release.sh \
|
||||
@ -997,7 +988,9 @@ php_EXTRA_DIST= \
|
||||
php/tests/WellKnownTest.php \
|
||||
php/tests/WrapperTypeSettersTest.php
|
||||
|
||||
# Note: please keep this in sync with the python_dist_files rule in BUILD.bazel.
|
||||
python_EXTRA_DIST= \
|
||||
python/BUILD.bazel \
|
||||
python/MANIFEST.in \
|
||||
python/google/__init__.py \
|
||||
python/google/protobuf/__init__.py \
|
||||
@ -1011,6 +1004,7 @@ python_EXTRA_DIST= \
|
||||
python/google/protobuf/internal/any_test.proto \
|
||||
python/google/protobuf/internal/api_implementation.cc \
|
||||
python/google/protobuf/internal/api_implementation.py \
|
||||
python/google/protobuf/internal/builder.py \
|
||||
python/google/protobuf/internal/containers.py \
|
||||
python/google/protobuf/internal/decoder.py \
|
||||
python/google/protobuf/internal/descriptor_database_test.py \
|
||||
@ -1025,7 +1019,10 @@ python_EXTRA_DIST= \
|
||||
python/google/protobuf/internal/factory_test2.proto \
|
||||
python/google/protobuf/internal/file_options_test.proto \
|
||||
python/google/protobuf/internal/generator_test.py \
|
||||
python/google/protobuf/internal/import_test.py \
|
||||
python/google/protobuf/internal/import_test_package/__init__.py \
|
||||
python/google/protobuf/internal/import_test_package/import_public.proto \
|
||||
python/google/protobuf/internal/import_test_package/import_public_nested.proto \
|
||||
python/google/protobuf/internal/import_test_package/inner.proto \
|
||||
python/google/protobuf/internal/import_test_package/outer.proto \
|
||||
python/google/protobuf/internal/json_format_test.py \
|
||||
@ -1097,6 +1094,8 @@ python_EXTRA_DIST= \
|
||||
python/google/protobuf/pyext/repeated_scalar_container.h \
|
||||
python/google/protobuf/pyext/safe_numerics.h \
|
||||
python/google/protobuf/pyext/scoped_pyobject_ptr.h \
|
||||
python/google/protobuf/pyext/unknown_field_set.cc \
|
||||
python/google/protobuf/pyext/unknown_field_set.h \
|
||||
python/google/protobuf/python_protobuf.h \
|
||||
python/google/protobuf/reflection.py \
|
||||
python/google/protobuf/service.py \
|
||||
@ -1104,7 +1103,9 @@ python_EXTRA_DIST= \
|
||||
python/google/protobuf/symbol_database.py \
|
||||
python/google/protobuf/text_encoding.py \
|
||||
python/google/protobuf/text_format.py \
|
||||
python/google/protobuf/unknown_fields.py \
|
||||
python/google/protobuf/util/__init__.py \
|
||||
python/internal.bzl \
|
||||
python/release.sh \
|
||||
python/mox.py \
|
||||
python/setup.cfg \
|
||||
@ -1113,6 +1114,7 @@ python_EXTRA_DIST= \
|
||||
python/tox.ini \
|
||||
python/README.md
|
||||
|
||||
# Note: please keep this in sync with the dist_files rule in ruby/BUILD.bazel.
|
||||
ruby_EXTRA_DIST= \
|
||||
ruby/Gemfile \
|
||||
ruby/.gitignore \
|
||||
@ -1188,250 +1190,79 @@ ruby_EXTRA_DIST= \
|
||||
ruby/tests/type_errors.rb \
|
||||
ruby/travis-test.sh
|
||||
|
||||
js_EXTRA_DIST= \
|
||||
js/README.md \
|
||||
js/binary/arith.js \
|
||||
js/binary/arith_test.js \
|
||||
js/binary/constants.js \
|
||||
js/binary/decoder.js \
|
||||
js/binary/decoder_test.js \
|
||||
js/binary/encoder.js \
|
||||
js/binary/message_test.js \
|
||||
js/binary/proto_test.js \
|
||||
js/binary/reader.js \
|
||||
js/binary/reader_test.js \
|
||||
js/binary/utils.js \
|
||||
js/binary/utils_test.js \
|
||||
js/binary/writer.js \
|
||||
js/binary/writer_test.js \
|
||||
js/commonjs/export.js \
|
||||
js/commonjs/export_asserts.js \
|
||||
js/commonjs/export_testdeps.js \
|
||||
js/commonjs/import_test.js \
|
||||
js/commonjs/jasmine.json \
|
||||
js/commonjs/rewrite_tests_for_commonjs.js \
|
||||
js/commonjs/strict_test.js \
|
||||
js/commonjs/test6/test6.proto \
|
||||
js/commonjs/test7/test7.proto \
|
||||
js/compatibility_tests/v3.0.0/binary/arith_test.js \
|
||||
js/compatibility_tests/v3.0.0/binary/decoder_test.js \
|
||||
js/compatibility_tests/v3.0.0/binary/proto_test.js \
|
||||
js/compatibility_tests/v3.0.0/binary/reader_test.js \
|
||||
js/compatibility_tests/v3.0.0/binary/utils_test.js \
|
||||
js/compatibility_tests/v3.0.0/binary/writer_test.js \
|
||||
js/compatibility_tests/v3.0.0/commonjs/export_asserts.js \
|
||||
js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js \
|
||||
js/compatibility_tests/v3.0.0/commonjs/import_test.js \
|
||||
js/compatibility_tests/v3.0.0/commonjs/jasmine.json \
|
||||
js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js \
|
||||
js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto \
|
||||
js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto \
|
||||
js/compatibility_tests/v3.0.0/data.proto \
|
||||
js/compatibility_tests/v3.0.0/debug_test.js \
|
||||
js/compatibility_tests/v3.0.0/jasmine1.json \
|
||||
js/compatibility_tests/v3.0.0/jasmine2.json \
|
||||
js/compatibility_tests/v3.0.0/jasmine3.json \
|
||||
js/compatibility_tests/v3.0.0/message_test.js \
|
||||
js/compatibility_tests/v3.0.0/proto3_test.js \
|
||||
js/compatibility_tests/v3.0.0/proto3_test.proto \
|
||||
js/compatibility_tests/v3.0.0/test2.proto \
|
||||
js/compatibility_tests/v3.0.0/test3.proto \
|
||||
js/compatibility_tests/v3.0.0/test4.proto \
|
||||
js/compatibility_tests/v3.0.0/test5.proto \
|
||||
js/compatibility_tests/v3.0.0/testbinary.proto \
|
||||
js/compatibility_tests/v3.0.0/testempty.proto \
|
||||
js/compatibility_tests/v3.0.0/test.proto \
|
||||
js/compatibility_tests/v3.0.0/test.sh \
|
||||
js/compatibility_tests/v3.1.0/testempty.proto \
|
||||
js/compatibility_tests/v3.1.0/testbinary.proto \
|
||||
js/compatibility_tests/v3.1.0/test5.proto \
|
||||
js/compatibility_tests/v3.1.0/test4.proto \
|
||||
js/compatibility_tests/v3.1.0/test3.proto \
|
||||
js/compatibility_tests/v3.1.0/test2.proto \
|
||||
js/compatibility_tests/v3.1.0/test.proto \
|
||||
js/compatibility_tests/v3.1.0/proto3_test.proto \
|
||||
js/compatibility_tests/v3.1.0/proto3_test.js \
|
||||
js/compatibility_tests/v3.1.0/message_test.js \
|
||||
js/compatibility_tests/v3.1.0/maps_test.js \
|
||||
js/compatibility_tests/v3.1.0/debug_test.js \
|
||||
js/compatibility_tests/v3.1.0/data.proto \
|
||||
js/compatibility_tests/v3.1.0/commonjs/test7/test7.proto \
|
||||
js/compatibility_tests/v3.1.0/commonjs/test6/test6.proto \
|
||||
js/compatibility_tests/v3.1.0/binary/writer_test.js \
|
||||
js/compatibility_tests/v3.1.0/binary/utils_test.js \
|
||||
js/compatibility_tests/v3.1.0/binary/reader_test.js \
|
||||
js/compatibility_tests/v3.1.0/binary/proto_test.js \
|
||||
js/compatibility_tests/v3.1.0/binary/decoder_test.js \
|
||||
js/compatibility_tests/v3.1.0/binary/arith_test.js \
|
||||
js/data.proto \
|
||||
js/debug.js \
|
||||
js/debug_test.js \
|
||||
js/experimental/runtime/kernel/message_set.js \
|
||||
js/experimental/runtime/kernel/message_set_test.js \
|
||||
js/experimental/runtime/kernel/tag.js \
|
||||
js/experimental/runtime/kernel/tag_test.js \
|
||||
js/gulpfile.js \
|
||||
js/jasmine.json \
|
||||
js/map.js \
|
||||
js/maps_test.js \
|
||||
js/message.js \
|
||||
js/message_test.js \
|
||||
js/node_loader.js \
|
||||
js/package.json \
|
||||
js/proto3_test.js \
|
||||
js/proto3_test.proto \
|
||||
js/test.proto \
|
||||
js/test2.proto \
|
||||
js/test3.proto \
|
||||
js/test4.proto \
|
||||
js/test5.proto \
|
||||
js/test8.proto \
|
||||
js/test9.proto \
|
||||
js/test10.proto \
|
||||
js/test11.proto \
|
||||
js/test12.proto \
|
||||
js/test13.proto \
|
||||
js/test14.proto \
|
||||
js/test15.proto \
|
||||
js/test_bootstrap.js \
|
||||
js/testbinary.proto \
|
||||
js/testempty.proto \
|
||||
js/testlargenumbers.proto \
|
||||
js/experimental/runtime/testing/jasmine_protobuf.js \
|
||||
js/experimental/runtime/testing/ensure_custom_equality_test.js \
|
||||
js/experimental/runtime/testing/binary/test_message.js \
|
||||
js/experimental/runtime/kernel/writer_test.js \
|
||||
js/experimental/runtime/kernel/writer.js \
|
||||
js/experimental/runtime/kernel/wire_type.js \
|
||||
js/experimental/runtime/kernel/uint8arrays_test.js \
|
||||
js/experimental/runtime/kernel/uint8arrays.js \
|
||||
js/experimental/runtime/kernel/uint32_test_pairs.js \
|
||||
js/experimental/runtime/kernel/typed_arrays_test.js \
|
||||
js/experimental/runtime/kernel/typed_arrays.js \
|
||||
js/experimental/runtime/kernel/textencoding_test.js \
|
||||
js/experimental/runtime/kernel/textencoding.js \
|
||||
js/experimental/runtime/kernel/storage.js \
|
||||
js/experimental/runtime/kernel/sint64_test_pairs.js \
|
||||
js/experimental/runtime/kernel/sint32_test_pairs.js \
|
||||
js/experimental/runtime/kernel/sfixed64_test_pairs.js \
|
||||
js/experimental/runtime/kernel/sfixed32_test_pairs.js \
|
||||
js/experimental/runtime/kernel/reader_test.js \
|
||||
js/experimental/runtime/kernel/reader.js \
|
||||
js/experimental/runtime/kernel/packed_uint32_test_pairs.js \
|
||||
js/experimental/runtime/kernel/packed_sint64_test_pairs.js \
|
||||
js/experimental/runtime/kernel/packed_sint32_test_pairs.js \
|
||||
js/experimental/runtime/kernel/packed_sfixed64_test_pairs.js \
|
||||
js/experimental/runtime/kernel/packed_sfixed32_test_pairs.js \
|
||||
js/experimental/runtime/kernel/packed_int64_test_pairs.js \
|
||||
js/experimental/runtime/kernel/packed_int32_test_pairs.js \
|
||||
js/experimental/runtime/kernel/packed_float_test_pairs.js \
|
||||
js/experimental/runtime/kernel/packed_fixed32_test_pairs.js \
|
||||
js/experimental/runtime/kernel/packed_double_test_pairs.js \
|
||||
js/experimental/runtime/kernel/packed_bool_test_pairs.js \
|
||||
js/experimental/runtime/kernel/kernel_test.js \
|
||||
js/experimental/runtime/kernel/kernel_repeated_test.js \
|
||||
js/experimental/runtime/kernel/kernel_compatibility_test.js \
|
||||
js/experimental/runtime/kernel/kernel.js \
|
||||
js/experimental/runtime/kernel/internal_message.js \
|
||||
js/experimental/runtime/kernel/int64_test_pairs.js \
|
||||
js/experimental/runtime/kernel/int32_test_pairs.js \
|
||||
js/experimental/runtime/kernel/indexer_test.js \
|
||||
js/experimental/runtime/kernel/indexer.js \
|
||||
js/experimental/runtime/kernel/float_test_pairs.js \
|
||||
js/experimental/runtime/kernel/fixed32_test_pairs.js \
|
||||
js/experimental/runtime/kernel/field.js \
|
||||
js/experimental/runtime/kernel/double_test_pairs.js \
|
||||
js/experimental/runtime/kernel/conformance/wire_format.js \
|
||||
js/experimental/runtime/kernel/conformance/test_all_types_proto3.js \
|
||||
js/experimental/runtime/kernel/conformance/test_all_types_proto2.js \
|
||||
js/experimental/runtime/kernel/conformance/conformance_testee_runner_node.js \
|
||||
js/experimental/runtime/kernel/conformance/conformance_testee.js \
|
||||
js/experimental/runtime/kernel/conformance/conformance_response.js \
|
||||
js/experimental/runtime/kernel/conformance/conformance_request.js \
|
||||
js/experimental/runtime/kernel/buffer_decoder_test.js \
|
||||
js/experimental/runtime/kernel/buffer_decoder_helper.js \
|
||||
js/experimental/runtime/kernel/buffer_decoder.js \
|
||||
js/experimental/runtime/kernel/bool_test_pairs.js \
|
||||
js/experimental/runtime/kernel/binary_storage_test.js \
|
||||
js/experimental/runtime/kernel/binary_storage.js \
|
||||
js/experimental/runtime/internal/checks_test.js \
|
||||
js/experimental/runtime/internal/checks.js \
|
||||
js/experimental/runtime/int64_test.js \
|
||||
js/experimental/runtime/int64.js \
|
||||
js/experimental/runtime/bytestring_test.js \
|
||||
js/experimental/runtime/bytestring_internal.js \
|
||||
js/experimental/runtime/bytestring.js \
|
||||
js/experimental/benchmarks/code_size/kernel/popular_types.js \
|
||||
js/experimental/benchmarks/code_size/kernel/all_types.js \
|
||||
js/experimental/benchmarks/code_size/code_size_base.js \
|
||||
js/experimental/benchmarks/code_size/apps_jspb/popular_types_proto3.js \
|
||||
js/experimental/benchmarks/code_size/apps_jspb/popular_types_proto2.js \
|
||||
js/experimental/benchmarks/code_size/apps_jspb/all_types_proto3.js \
|
||||
js/experimental/benchmarks/code_size/apps_jspb/all_types_proto2.js
|
||||
|
||||
all_EXTRA_DIST=$(csharp_EXTRA_DIST) $(java_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(php_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST) $(js_EXTRA_DIST)
|
||||
|
||||
EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
|
||||
autogen.sh \
|
||||
generate_descriptor_proto.sh \
|
||||
README.md \
|
||||
LICENSE \
|
||||
CONTRIBUTORS.txt \
|
||||
CHANGES.txt \
|
||||
update_file_lists.sh \
|
||||
BUILD \
|
||||
WORKSPACE \
|
||||
cmake/CMakeLists.txt \
|
||||
cmake/README.md \
|
||||
cmake/conformance.cmake \
|
||||
cmake/examples.cmake \
|
||||
cmake/extract_includes.bat.in \
|
||||
cmake/install.cmake \
|
||||
cmake/libprotobuf.cmake \
|
||||
cmake/libprotobuf-lite.cmake \
|
||||
cmake/libprotoc.cmake \
|
||||
cmake/protobuf-config-version.cmake.in \
|
||||
cmake/protobuf-config.cmake.in \
|
||||
cmake/protobuf-lite.pc.cmake \
|
||||
cmake/protobuf-module.cmake.in \
|
||||
cmake/protobuf-options.cmake \
|
||||
cmake/protobuf.pc.cmake \
|
||||
cmake/protoc.cmake \
|
||||
cmake/tests.cmake \
|
||||
cmake/version.rc.in \
|
||||
compiler_config_setting.bzl \
|
||||
build_files_updated_unittest.sh \
|
||||
cc_proto_blacklist_test.bzl \
|
||||
editors/README.txt \
|
||||
editors/proto.vim \
|
||||
editors/protobuf-mode.el \
|
||||
examples/AddPerson.java \
|
||||
examples/BUILD \
|
||||
examples/CMakeLists.txt \
|
||||
examples/ListPeople.java \
|
||||
examples/Makefile \
|
||||
examples/README.md \
|
||||
examples/WORKSPACE \
|
||||
examples/add_person.cc \
|
||||
examples/add_person.dart \
|
||||
examples/add_person.go \
|
||||
examples/add_person.py \
|
||||
examples/add_person_test.go \
|
||||
examples/addressbook.proto \
|
||||
examples/list_people.cc \
|
||||
examples/list_people.dart \
|
||||
examples/list_people.go \
|
||||
examples/list_people.py \
|
||||
examples/list_people_test.go \
|
||||
examples/pubspec.yaml \
|
||||
maven_install.json \
|
||||
protobuf.bzl \
|
||||
protobuf_deps.bzl \
|
||||
protobuf_version.bzl \
|
||||
third_party/zlib.BUILD \
|
||||
util/python/BUILD \
|
||||
internal.bzl
|
||||
all_EXTRA_DIST=$(csharp_EXTRA_DIST) $(java_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(php_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST)
|
||||
|
||||
# Note: please keep this in sync with the common_dist_files rule in BUILD.bazel.
|
||||
EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
|
||||
autogen.sh \
|
||||
generate_descriptor_proto.sh \
|
||||
README.md \
|
||||
LICENSE \
|
||||
CONTRIBUTORS.txt \
|
||||
CHANGES.txt \
|
||||
update_file_lists.sh \
|
||||
BUILD.bazel \
|
||||
WORKSPACE \
|
||||
CMakeLists.txt \
|
||||
build_defs/BUILD.bazel \
|
||||
build_defs/cc_proto_blacklist_test.bzl \
|
||||
build_defs/compiler_config_setting.bzl \
|
||||
build_defs/cpp_opts.bzl \
|
||||
build_files_updated_unittest.sh \
|
||||
cmake/CMakeLists.txt \
|
||||
cmake/README.md \
|
||||
cmake/conformance.cmake \
|
||||
cmake/examples.cmake \
|
||||
cmake/extract_includes.bat.in \
|
||||
cmake/install.cmake \
|
||||
cmake/libprotobuf-lite.cmake \
|
||||
cmake/libprotobuf.cmake \
|
||||
cmake/libprotoc.cmake \
|
||||
cmake/protobuf-config-version.cmake.in \
|
||||
cmake/protobuf-config.cmake.in \
|
||||
cmake/protobuf-lite.pc.cmake \
|
||||
cmake/protobuf-module.cmake.in \
|
||||
cmake/protobuf-options.cmake \
|
||||
cmake/protobuf.pc.cmake \
|
||||
cmake/protoc.cmake \
|
||||
cmake/tests.cmake \
|
||||
cmake/version.rc.in \
|
||||
csharp/BUILD.bazel \
|
||||
editors/README.txt \
|
||||
editors/proto.vim \
|
||||
editors/protobuf-mode.el \
|
||||
examples/AddPerson.java \
|
||||
examples/BUILD.bazel \
|
||||
examples/CMakeLists.txt \
|
||||
examples/ListPeople.java \
|
||||
examples/Makefile \
|
||||
examples/README.md \
|
||||
examples/WORKSPACE \
|
||||
examples/add_person.cc \
|
||||
examples/add_person.dart \
|
||||
examples/add_person.py \
|
||||
examples/addressbook.proto \
|
||||
examples/go/cmd/add_person/add_person.go \
|
||||
examples/go/cmd/add_person/add_person_test.go \
|
||||
examples/go/cmd/list_people/list_people.go \
|
||||
examples/go/cmd/list_people/list_people_test.go \
|
||||
examples/go/go.sum \
|
||||
examples/go/go.mod \
|
||||
examples/list_people.cc \
|
||||
examples/list_people.dart \
|
||||
examples/list_people.py \
|
||||
examples/pubspec.yaml \
|
||||
conformance/BUILD.bazel \
|
||||
conformance/defs.bzl \
|
||||
maven_install.json \
|
||||
php/BUILD.bazel \
|
||||
protobuf.bzl \
|
||||
protobuf_deps.bzl \
|
||||
protobuf_release.bzl \
|
||||
protobuf_version.bzl \
|
||||
ruby/BUILD.bazel \
|
||||
third_party/zlib.BUILD \
|
||||
util/python/BUILD.bazel
|
||||
|
||||
# Deletes all the files generated by autogen.sh.
|
||||
MAINTAINERCLEANFILES = \
|
||||
|
@ -1,9 +1,9 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'Protobuf-C++'
|
||||
s.version = '3.19.1'
|
||||
s.version = '3.21.1'
|
||||
s.summary = 'Protocol Buffers v3 runtime library for C++.'
|
||||
s.homepage = 'https://github.com/google/protobuf'
|
||||
s.license = '3-Clause BSD License'
|
||||
s.license = 'BSD-3-Clause'
|
||||
s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' }
|
||||
s.cocoapods_version = '>= 1.0'
|
||||
|
||||
@ -35,6 +35,7 @@ Pod::Spec.new do |s|
|
||||
# Do not let src/google/protobuf/stubs/time.h override system API
|
||||
'USE_HEADERMAP' => 'NO',
|
||||
'ALWAYS_SEARCH_USER_PATHS' => 'NO',
|
||||
'HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)/src"'
|
||||
}
|
||||
|
||||
end
|
||||
|
@ -5,10 +5,10 @@
|
||||
# dependent projects use the :git notation to refer to the library.
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'Protobuf'
|
||||
s.version = '3.19.1'
|
||||
s.version = '3.21.1'
|
||||
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
|
||||
s.homepage = 'https://github.com/protocolbuffers/protobuf'
|
||||
s.license = '3-Clause BSD License'
|
||||
s.license = 'BSD-3-Clause'
|
||||
s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' }
|
||||
s.cocoapods_version = '>= 1.0'
|
||||
|
||||
@ -39,4 +39,12 @@ Pod::Spec.new do |s|
|
||||
s.tvos.deployment_target = '9.0'
|
||||
s.watchos.deployment_target = '2.0'
|
||||
s.requires_arc = false
|
||||
|
||||
# The unittest need the generate sources from the testing related .proto
|
||||
# files. So to add a `test_spec`, there would also need to be something like a
|
||||
# `script_phases` to generate them, but there would also need to be a way to
|
||||
# ensure `protoc` had be built. Another option would be to move to a model
|
||||
# where the needed files are always generated and checked in. Neither of these
|
||||
# seem that great at the moment, so the tests have *not* been wired into here
|
||||
# at this time.
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ page, check out the maven repo here:
|
||||
[https://repo1.maven.org/maven2/com/google/protobuf/protoc/](https://repo1.maven.org/maven2/com/google/protobuf/protoc/)
|
||||
|
||||
These pre-built binaries are only provided for released versions. If you want
|
||||
to use the github master version at HEAD, or you need to modify protobuf code,
|
||||
to use the github main version at HEAD, or you need to modify protobuf code,
|
||||
or you are using C++, it's recommended to build your own protoc binary from
|
||||
source.
|
||||
|
||||
@ -59,7 +59,6 @@ how to install protobuf runtime for that specific language:
|
||||
| Python | [python](python) |
|
||||
| Objective-C | [objectivec](objectivec) |
|
||||
| C# | [csharp](csharp) |
|
||||
| JavaScript | [js](js) |
|
||||
| Ruby | [ruby](ruby) |
|
||||
| Go | [protocolbuffers/protobuf-go](https://github.com/protocolbuffers/protobuf-go)|
|
||||
| PHP | [php](php) |
|
||||
|
13
WORKSPACE
13
WORKSPACE
@ -56,3 +56,16 @@ pinned_maven_install()
|
||||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
||||
|
||||
bazel_skylib_workspace()
|
||||
|
||||
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
|
||||
rules_pkg_dependencies()
|
||||
|
||||
# For `kt_jvm_library`
|
||||
load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
|
||||
kotlin_repositories()
|
||||
|
||||
load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
|
||||
kt_register_toolchains()
|
||||
|
||||
load("@upb//bazel:workspace_deps.bzl", "upb_deps")
|
||||
upb_deps()
|
||||
|
@ -38,7 +38,7 @@ dotnet restore
|
||||
dotnet build -c %configuration% || goto error
|
||||
|
||||
echo Testing C#
|
||||
dotnet test -c %configuration% -f netcoreapp2.1 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
|
||||
dotnet test -c %configuration% -f netcoreapp3.1 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
|
||||
dotnet test -c %configuration% -f net451 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
|
||||
|
||||
goto :EOF
|
||||
|
@ -1,5 +1,6 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
|
||||
load("@rules_java//java:defs.bzl", "java_proto_library")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
|
||||
proto_library(
|
||||
@ -63,3 +64,35 @@ java_proto_library(
|
||||
"google_size_proto",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = glob(
|
||||
[
|
||||
"*",
|
||||
"python/*.cc",
|
||||
"util/*.cc",
|
||||
],
|
||||
exclude = [
|
||||
"__init__.py", # not in autotools dist
|
||||
"go/*",
|
||||
],
|
||||
),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
)
|
||||
|
||||
# Convenience filegroup for all files that should be packaged.
|
||||
pkg_filegroup(
|
||||
name = "all_dist_files",
|
||||
srcs = [
|
||||
":dist_files",
|
||||
"//benchmarks/cpp:dist_files",
|
||||
"//benchmarks/datasets:dist_files", # not in autotools dist
|
||||
"//benchmarks/datasets/google_message1/proto2:dist_files",
|
||||
"//benchmarks/datasets/google_message1/proto3:dist_files",
|
||||
"//benchmarks/datasets/google_message2:dist_files",
|
||||
"//benchmarks/datasets/google_message3:dist_files",
|
||||
"//benchmarks/datasets/google_message4:dist_files",
|
||||
],
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
@ -4,8 +4,8 @@
|
||||
This directory contains benchmarking schemas and data sets that you
|
||||
can use to test a variety of performance scenarios against your
|
||||
protobuf language runtime. If you are looking for performance
|
||||
numbers of officially support languages, see [here](
|
||||
https://github.com/protocolbuffers/protobuf/blob/master/docs/performance.md)
|
||||
numbers of officially supported languages, see [Protobuf Performance](
|
||||
https://github.com/protocolbuffers/protobuf/blob/main/docs/performance.md).
|
||||
|
||||
## Prerequisite
|
||||
|
||||
@ -61,7 +61,7 @@ PHP benchmark's requirement is the same as PHP protobuf's requirements. The benc
|
||||
include PHP protobuf's src and build the c extension if required.
|
||||
|
||||
### Node.js
|
||||
Node.js benchmark need [node](https://nodejs.org/en/)(higher than V6) and [npm](https://www.npmjs.com/) package manager installed. This benchmark is using the [benchmark](https://www.npmjs.com/package/benchmark) framework to test, which needn't to manually install. And another prerequisite is [protobuf js](https://github.com/protocolbuffers/protobuf/tree/master/js), which needn't to manually install either
|
||||
Node.js benchmark need [node](https://nodejs.org/en/)(higher than V6) and [npm](https://www.npmjs.com/) package manager installed. This benchmark is using the [benchmark](https://www.npmjs.com/package/benchmark) framework to test, which needn't to manually install. And another prerequisite is [protobuf js](https://github.com/protocolbuffers/protobuf/tree/main/js), which needn't to manually install either
|
||||
|
||||
### C#
|
||||
The C# benchmark code is built as part of the main Google.Protobuf
|
||||
@ -69,25 +69,23 @@ solution. It requires the .NET Core SDK, and depends on
|
||||
[BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet), which
|
||||
will be downloaded automatically.
|
||||
|
||||
### Big data
|
||||
|
||||
There's some optional big testing data which is not included in the directory
|
||||
initially, you need to run the following command to download the testing data:
|
||||
|
||||
```
|
||||
$ ./download_data.sh
|
||||
```
|
||||
|
||||
After doing this the big data file will automatically generated in the
|
||||
benchmark directory.
|
||||
|
||||
## Run instructions
|
||||
|
||||
To run all the benchmark dataset:
|
||||
|
||||
### Java:
|
||||
|
||||
First build the Java binary in the usual way with Maven:
|
||||
|
||||
```
|
||||
$ cd java
|
||||
$ mvn install
|
||||
```
|
||||
|
||||
Assuming that completes successfully,
|
||||
|
||||
```
|
||||
$ cd ../benchmarks
|
||||
$ make java
|
||||
```
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
|
||||
cc_binary(
|
||||
name = "cpp",
|
||||
@ -13,3 +14,13 @@ cc_binary(
|
||||
"@com_github_google_benchmark//:benchmark_main",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = [
|
||||
"BUILD.bazel",
|
||||
"cpp_benchmark.cc",
|
||||
],
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//benchmarks:__pkg__"],
|
||||
)
|
@ -1,5 +1,6 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@rules_java//java:defs.bzl", "java_library")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
|
||||
filegroup(
|
||||
@ -57,3 +58,10 @@ java_library(
|
||||
"//benchmarks/datasets/google_message4:benchmark_message4_java_proto",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = ["BUILD.bazel"],
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//benchmarks:__pkg__"],
|
||||
)
|
@ -1,5 +1,6 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
|
||||
load("@rules_java//java:defs.bzl", "java_proto_library")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
|
||||
filegroup(
|
||||
@ -42,3 +43,10 @@ java_proto_library(
|
||||
"benchmark_message1_proto2_proto",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = glob(["*"]),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//benchmarks:__pkg__"],
|
||||
)
|
@ -1,6 +1,7 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
|
||||
load("@rules_java//java:defs.bzl", "java_proto_library")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
|
||||
filegroup(
|
||||
name = "datasets",
|
||||
@ -42,3 +43,10 @@ java_proto_library(
|
||||
"benchmark_message1_proto3_proto",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = glob(["*"]),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//benchmarks:__pkg__"],
|
||||
)
|
@ -1,5 +1,6 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
|
||||
load("@rules_java//java:defs.bzl", "java_proto_library")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
|
||||
filegroup(
|
||||
@ -42,3 +43,10 @@ java_proto_library(
|
||||
"benchmark_message2_proto",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = glob(["*"]),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//benchmarks:__pkg__"],
|
||||
)
|
@ -1,5 +1,6 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
|
||||
load("@rules_java//java:defs.bzl", "java_proto_library")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
|
||||
filegroup(
|
||||
@ -48,3 +49,10 @@ java_proto_library(
|
||||
"benchmark_message3_proto",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = glob(["*"]),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//benchmarks:__pkg__"],
|
||||
)
|
@ -1,5 +1,6 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
|
||||
load("@rules_java//java:defs.bzl", "java_proto_library")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
|
||||
filegroup(
|
||||
@ -43,3 +44,10 @@ java_proto_library(
|
||||
"benchmark_message4_proto",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = glob(["*"]),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//benchmarks:__pkg__"],
|
||||
)
|
@ -1,38 +1,27 @@
|
||||
|
||||
package com.google.protobuf;
|
||||
|
||||
import com.google.caliper.BeforeExperiment;
|
||||
import com.google.caliper.AfterExperiment;
|
||||
import com.google.caliper.Benchmark;
|
||||
import com.google.caliper.Param;
|
||||
import com.google.caliper.api.VmOptions;
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.CodedOutputStream;
|
||||
import com.google.protobuf.ExtensionRegistry;
|
||||
import com.google.protobuf.Message;
|
||||
import com.google.protobuf.benchmarks.Benchmarks.BenchmarkDataset;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// Caliper set CICompilerCount to 1 for making sure compilation doesn't run in parallel with itself,
|
||||
// This makes TieredCompilation not working. We just disable TieredCompilation by default. In master
|
||||
// branch this has been disabled by default in caliper:
|
||||
// https://github.com/google/caliper/blob/master/caliper-runner/src/main/java/com/google/caliper/runner/target/Jvm.java#L38:14
|
||||
// But this haven't been added into most recent release.
|
||||
@VmOptions("-XX:-TieredCompilation")
|
||||
/**
|
||||
* Basic benchmarks for Java protobuf parsing.
|
||||
*/
|
||||
public class ProtoCaliperBenchmark {
|
||||
public enum BenchmarkMessageType {
|
||||
GOOGLE_MESSAGE1_PROTO3 {
|
||||
@Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); }
|
||||
@Override
|
||||
ExtensionRegistry getExtensionRegistry() {
|
||||
return ExtensionRegistry.newInstance();
|
||||
}
|
||||
@Override
|
||||
Message getDefaultInstance() {
|
||||
return com.google.protobuf.benchmarks.BenchmarkMessage1Proto3.GoogleMessage1
|
||||
@ -40,7 +29,9 @@ public class ProtoCaliperBenchmark {
|
||||
}
|
||||
},
|
||||
GOOGLE_MESSAGE1_PROTO2 {
|
||||
@Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); }
|
||||
@Override ExtensionRegistry getExtensionRegistry() {
|
||||
return ExtensionRegistry.newInstance();
|
||||
}
|
||||
@Override
|
||||
Message getDefaultInstance() {
|
||||
return com.google.protobuf.benchmarks.BenchmarkMessage1Proto2.GoogleMessage1
|
||||
@ -48,7 +39,10 @@ public class ProtoCaliperBenchmark {
|
||||
}
|
||||
},
|
||||
GOOGLE_MESSAGE2 {
|
||||
@Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); }
|
||||
@Override
|
||||
ExtensionRegistry getExtensionRegistry() {
|
||||
return ExtensionRegistry.newInstance();
|
||||
}
|
||||
@Override
|
||||
Message getDefaultInstance() {
|
||||
return com.google.protobuf.benchmarks.BenchmarkMessage2.GoogleMessage2.getDefaultInstance();
|
||||
@ -157,7 +151,7 @@ public class ProtoCaliperBenchmark {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"IgnoredPureGetter", "CheckReturnValue"})
|
||||
@Benchmark
|
||||
void serializeToByteArray(int reps) throws IOException {
|
||||
if (sampleMessageList.size() == 0) {
|
||||
|
@ -18,8 +18,7 @@ static struct PyModuleDef _module = {PyModuleDef_HEAD_INIT,
|
||||
NULL};
|
||||
|
||||
extern "C" {
|
||||
PyMODINIT_FUNC
|
||||
PyInit_libbenchmark_messages() {
|
||||
PyMODINIT_FUNC PyInit_libbenchmark_messages() {
|
||||
benchmarks::BenchmarkDataset().descriptor();
|
||||
benchmarks::proto3::GoogleMessage1().descriptor();
|
||||
benchmarks::proto2::GoogleMessage1().descriptor();
|
||||
|
173
build_defs/BUILD.bazel
Normal file
173
build_defs/BUILD.bazel
Normal file
@ -0,0 +1,173 @@
|
||||
# Internal Starlark definitions for Protobuf.
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", starlark_cc_proto_library = "cc_proto_library")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test")
|
||||
load(":compiler_config_setting.bzl", "create_compiler_config_setting")
|
||||
|
||||
package(
|
||||
default_visibility = [
|
||||
# Public, but Protobuf only visibility.
|
||||
"//:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
||||
create_compiler_config_setting(
|
||||
name = "config_msvc",
|
||||
value = "msvc-cl",
|
||||
)
|
||||
|
||||
# Android NDK builds can specify different crosstool_top flags to choose which
|
||||
# STL they use for C++. We need these multiple variants to catch all of those
|
||||
# versions of crosstool_top and reliably detect Android.
|
||||
#
|
||||
# For more info on the various crosstool_tops used by NDK Bazel builds, see:
|
||||
# https://docs.bazel.build/versions/master/android-ndk.html#configuring-the-stl
|
||||
|
||||
config_setting(
|
||||
name = "config_android",
|
||||
values = {
|
||||
"crosstool_top": "//external:android/crosstool",
|
||||
},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "config_android-stlport",
|
||||
values = {
|
||||
"crosstool_top": "@androidndk//:toolchain-stlport",
|
||||
},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "config_android-libcpp",
|
||||
values = {
|
||||
"crosstool_top": "@androidndk//:toolchain-libcpp",
|
||||
},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "config_android-gnu-libstdcpp",
|
||||
values = {
|
||||
"crosstool_top": "@androidndk//:toolchain-gnu-libstdcpp",
|
||||
},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "config_android-default",
|
||||
values = {
|
||||
"crosstool_top": "@androidndk//:default_crosstool",
|
||||
},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "config_win32",
|
||||
values = {
|
||||
"cpu": "win32",
|
||||
},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "config_win64",
|
||||
values = {
|
||||
"cpu": "win64",
|
||||
},
|
||||
)
|
||||
|
||||
# Internal testing:
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "any_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:any_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "api_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:api_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "compiler_plugin_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:compiler_plugin_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "descriptor_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:descriptor_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "duration_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:duration_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "empty_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:empty_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "field_mask_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:field_mask_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "source_context_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:source_context_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "struct_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:struct_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "timestamp_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:timestamp_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "type_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:type_proto"],
|
||||
)
|
||||
|
||||
starlark_cc_proto_library(
|
||||
name = "wrappers_cc_proto",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//:wrappers_proto"],
|
||||
)
|
||||
|
||||
cc_proto_blacklist_test(
|
||||
name = "cc_proto_blacklist_test",
|
||||
deps = [
|
||||
":any_cc_proto",
|
||||
":api_cc_proto",
|
||||
":compiler_plugin_cc_proto",
|
||||
":descriptor_cc_proto",
|
||||
":duration_cc_proto",
|
||||
":empty_cc_proto",
|
||||
":field_mask_cc_proto",
|
||||
":source_context_cc_proto",
|
||||
":struct_cc_proto",
|
||||
":timestamp_cc_proto",
|
||||
":type_cc_proto",
|
||||
":wrappers_cc_proto",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = glob(["*"]),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
@ -14,14 +14,14 @@ def _cc_proto_blacklist_test_impl(ctx):
|
||||
env = unittest.begin(ctx)
|
||||
|
||||
for dep in ctx.attr.deps:
|
||||
files = len(dep.files.to_list())
|
||||
files = dep.files.to_list()
|
||||
asserts.equals(
|
||||
env,
|
||||
0,
|
||||
[],
|
||||
files,
|
||||
"Expected that target '{}' does not provide files, got {}".format(
|
||||
dep.label,
|
||||
files,
|
||||
len(files),
|
||||
),
|
||||
)
|
||||
|
47
build_defs/cpp_opts.bzl
Normal file
47
build_defs/cpp_opts.bzl
Normal file
@ -0,0 +1,47 @@
|
||||
"""C++ compile/link options for Protobuf libraries."""
|
||||
|
||||
COPTS = select({
|
||||
"//build_defs:config_msvc": [
|
||||
"/wd4065", # switch statement contains 'default' but no 'case' labels
|
||||
"/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
"/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
|
||||
"/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data
|
||||
"/wd4305", # 'identifier' : truncation from 'type1' to 'type2'
|
||||
"/wd4307", # 'operator' : integral constant overflow
|
||||
"/wd4309", # 'conversion' : truncation of constant value
|
||||
"/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
|
||||
"/wd4355", # 'this' : used in base member initializer list
|
||||
"/wd4506", # no definition for inline function 'function'
|
||||
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
"/wd4996", # The compiler encountered a deprecated declaration.
|
||||
],
|
||||
"//conditions:default": [
|
||||
"-DHAVE_ZLIB",
|
||||
"-Woverloaded-virtual",
|
||||
"-Wno-sign-compare",
|
||||
],
|
||||
})
|
||||
|
||||
# Android and MSVC builds do not need to link in a separate pthread library.
|
||||
LINK_OPTS = select({
|
||||
"//build_defs:config_android": [],
|
||||
"//build_defs:config_android-stlport": [],
|
||||
"//build_defs:config_android-libcpp": [],
|
||||
"//build_defs:config_android-gnu-libstdcpp": [],
|
||||
"//build_defs:config_android-default": [],
|
||||
"//build_defs:config_msvc": [
|
||||
# Suppress linker warnings about files with no symbols defined.
|
||||
"-ignore:4221",
|
||||
],
|
||||
"//conditions:default": [
|
||||
"-lpthread",
|
||||
"-lm",
|
||||
],
|
||||
})
|
||||
|
||||
# When cross-compiling for Windows we need to statically link pthread and the C++ library.
|
||||
PROTOC_LINK_OPTS = select({
|
||||
"//build_defs:config_win32": ["-static"],
|
||||
"//build_defs:config_win64": ["-static"],
|
||||
"//conditions:default": [],
|
||||
})
|
@ -1,312 +1,9 @@
|
||||
# Minimum CMake required
|
||||
cmake_minimum_required(VERSION 3.1.3)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
if(protobuf_VERBOSE)
|
||||
message(STATUS "Protocol Buffers Configuring...")
|
||||
endif()
|
||||
message(WARNING "Calling of cmake with source directory set to \"cmake\" subdirectory of Protocol Buffers project is deprecated. Top-level directory of Protocol Buffers project should be used instead.")
|
||||
|
||||
# CMake policies
|
||||
cmake_policy(SET CMP0022 NEW)
|
||||
# On MacOS use @rpath/ for target's install name prefix path
|
||||
if (POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif ()
|
||||
# Clear VERSION variables when no VERSION is given to project()
|
||||
if(POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
endif()
|
||||
# MSVC runtime library flags are selected by an abstraction.
|
||||
if(POLICY CMP0091)
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
endif()
|
||||
|
||||
# Project
|
||||
project(protobuf C CXX)
|
||||
|
||||
# Add c++11 flags
|
||||
if (CYGWIN)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
set(protobuf_DEPRECATED_CMAKE_SUBDIRECTORY_USAGE TRUE)
|
||||
|
||||
# The Intel compiler isn't able to deal with noinline member functions of
|
||||
# template classes defined in headers. As such it spams the output with
|
||||
# warning #2196: routine is both "inline" and "noinline"
|
||||
# This silences that warning.
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES Intel)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -diag-disable=2196")
|
||||
endif()
|
||||
|
||||
# Options
|
||||
if(WITH_PROTOC)
|
||||
set(protobuf_PROTOC_EXE ${WITH_PROTOC} CACHE FILEPATH "Protocol Buffer Compiler executable" FORCE)
|
||||
endif()
|
||||
option(protobuf_BUILD_TESTS "Build tests" ON)
|
||||
option(protobuf_BUILD_CONFORMANCE "Build conformance tests" OFF)
|
||||
option(protobuf_BUILD_EXAMPLES "Build examples" OFF)
|
||||
option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON)
|
||||
option(protobuf_BUILD_LIBPROTOC "Build libprotoc" OFF)
|
||||
option(protobuf_DISABLE_RTTI "Remove runtime type information in the binaries" OFF)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(protobuf_BUILD_SHARED_LIBS_DEFAULT ON)
|
||||
else (BUILD_SHARED_LIBS)
|
||||
set(protobuf_BUILD_SHARED_LIBS_DEFAULT OFF)
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHARED_LIBS_DEFAULT})
|
||||
include(CMakeDependentOption)
|
||||
cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON
|
||||
"NOT protobuf_BUILD_SHARED_LIBS" OFF)
|
||||
set(protobuf_WITH_ZLIB_DEFAULT ON)
|
||||
option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT})
|
||||
set(protobuf_DEBUG_POSTFIX "d"
|
||||
CACHE STRING "Default debug postfix")
|
||||
mark_as_advanced(protobuf_DEBUG_POSTFIX)
|
||||
# User options
|
||||
include(protobuf-options.cmake)
|
||||
|
||||
# Overrides for option dependencies
|
||||
if (protobuf_BUILD_PROTOC_BINARIES OR protobuf_BUILD_TESTS)
|
||||
set(protobuf_BUILD_LIBPROTOC ON)
|
||||
endif ()
|
||||
# Path to main configure script
|
||||
set(protobuf_CONFIGURE_SCRIPT "../configure.ac")
|
||||
|
||||
# Parse configure script
|
||||
set(protobuf_AC_INIT_REGEX
|
||||
"^AC_INIT\\(\\[([^]]+)\\],\\[([^]]+)\\],\\[([^]]+)\\],\\[([^]]+)\\]\\)$")
|
||||
file(STRINGS "${protobuf_CONFIGURE_SCRIPT}" protobuf_AC_INIT_LINE
|
||||
LIMIT_COUNT 1 REGEX "^AC_INIT")
|
||||
# Description
|
||||
string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\1"
|
||||
protobuf_DESCRIPTION "${protobuf_AC_INIT_LINE}")
|
||||
# Version
|
||||
string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\2"
|
||||
protobuf_VERSION_STRING "${protobuf_AC_INIT_LINE}")
|
||||
# Contact
|
||||
string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\3"
|
||||
protobuf_CONTACT "${protobuf_AC_INIT_LINE}")
|
||||
# Parse version tweaks
|
||||
set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)([-]rc[-]|\\.)?([0-9]*)$")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\1"
|
||||
protobuf_VERSION_MAJOR "${protobuf_VERSION_STRING}")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\2"
|
||||
protobuf_VERSION_MINOR "${protobuf_VERSION_STRING}")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\3"
|
||||
protobuf_VERSION_PATCH "${protobuf_VERSION_STRING}")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\5"
|
||||
protobuf_VERSION_PRERELEASE "${protobuf_VERSION_STRING}")
|
||||
|
||||
message(STATUS "${protobuf_VERSION_PRERELEASE}")
|
||||
|
||||
# Package version
|
||||
set(protobuf_VERSION
|
||||
"${protobuf_VERSION_MAJOR}.${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}")
|
||||
|
||||
if(protobuf_VERSION_PRERELEASE)
|
||||
set(protobuf_VERSION "${protobuf_VERSION}.${protobuf_VERSION_PRERELEASE}")
|
||||
else()
|
||||
set(protobuf_VERSION "${protobuf_VERSION}.0")
|
||||
endif()
|
||||
message(STATUS "${protobuf_VERSION}")
|
||||
|
||||
if(protobuf_VERBOSE)
|
||||
message(STATUS "Configuration script parsing status [")
|
||||
message(STATUS " Description : ${protobuf_DESCRIPTION}")
|
||||
message(STATUS " Version : ${protobuf_VERSION} (${protobuf_VERSION_STRING})")
|
||||
message(STATUS " Contact : ${protobuf_CONTACT}")
|
||||
message(STATUS "]")
|
||||
endif()
|
||||
|
||||
add_definitions(-DGOOGLE_PROTOBUF_CMAKE_BUILD)
|
||||
|
||||
if (protobuf_DISABLE_RTTI)
|
||||
add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)
|
||||
endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
set(_protobuf_FIND_ZLIB)
|
||||
if (protobuf_WITH_ZLIB)
|
||||
find_package(ZLIB)
|
||||
if (ZLIB_FOUND)
|
||||
set(HAVE_ZLIB 1)
|
||||
# FindZLIB module define ZLIB_INCLUDE_DIRS variable
|
||||
# Set ZLIB_INCLUDE_DIRECTORIES for compatible
|
||||
set(ZLIB_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRECTORIES} ${ZLIB_INCLUDE_DIRS})
|
||||
# Using imported target if exists
|
||||
if (TARGET ZLIB::ZLIB)
|
||||
set(ZLIB_LIBRARIES ZLIB::ZLIB)
|
||||
set(_protobuf_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()")
|
||||
endif (TARGET ZLIB::ZLIB)
|
||||
else (ZLIB_FOUND)
|
||||
set(HAVE_ZLIB 0)
|
||||
# Explicitly set these to empty (override NOT_FOUND) so cmake doesn't
|
||||
# complain when we use them later.
|
||||
set(ZLIB_INCLUDE_DIRECTORIES)
|
||||
set(ZLIB_LIBRARIES)
|
||||
endif (ZLIB_FOUND)
|
||||
endif (protobuf_WITH_ZLIB)
|
||||
|
||||
if (HAVE_ZLIB)
|
||||
add_definitions(-DHAVE_ZLIB)
|
||||
endif (HAVE_ZLIB)
|
||||
|
||||
# We need to link with libatomic on systems that do not have builtin atomics, or
|
||||
# don't have builtin support for 8 byte atomics
|
||||
set(protobuf_LINK_LIBATOMIC false)
|
||||
if (NOT MSVC)
|
||||
include(CheckCXXSourceCompiles)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++11)
|
||||
check_cxx_source_compiles("
|
||||
#include <atomic>
|
||||
int main() {
|
||||
return std::atomic<int64_t>{};
|
||||
}
|
||||
" protobuf_HAVE_BUILTIN_ATOMICS)
|
||||
if (NOT protobuf_HAVE_BUILTIN_ATOMICS)
|
||||
set(protobuf_LINK_LIBATOMIC true)
|
||||
endif (NOT protobuf_HAVE_BUILTIN_ATOMICS)
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
endif (NOT MSVC)
|
||||
|
||||
if (protobuf_BUILD_SHARED_LIBS)
|
||||
set(protobuf_SHARED_OR_STATIC "SHARED")
|
||||
else (protobuf_BUILD_SHARED_LIBS)
|
||||
set(protobuf_SHARED_OR_STATIC "STATIC")
|
||||
# The CMAKE_<LANG>_FLAGS(_<BUILD_TYPE>)? is meant to be user controlled.
|
||||
# Prior to CMake 3.15, the MSVC runtime library was pushed into the same flags
|
||||
# making programmatic control difficult. Prefer the functionality in newer
|
||||
# CMake versions when available.
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)
|
||||
else()
|
||||
# In case we are building static libraries, link also the runtime library statically
|
||||
# so that MSVCR*.DLL is not required at runtime.
|
||||
# https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
|
||||
# This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd
|
||||
# http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
|
||||
if (MSVC AND protobuf_MSVC_STATIC_RUNTIME)
|
||||
foreach(flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if(${flag_var} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endif(${flag_var} MATCHES "/MD")
|
||||
endforeach(flag_var)
|
||||
endif (MSVC AND protobuf_MSVC_STATIC_RUNTIME)
|
||||
endif()
|
||||
endif (protobuf_BUILD_SHARED_LIBS)
|
||||
|
||||
if (MSVC)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# Build with multiple processes
|
||||
add_definitions(/MP)
|
||||
endif()
|
||||
# Set source file and execution character sets to UTF-8
|
||||
add_definitions(/utf-8)
|
||||
# MSVC warning suppressions
|
||||
add_definitions(
|
||||
/wd4018 # 'expression' : signed/unsigned mismatch
|
||||
/wd4065 # switch statement contains 'default' but no 'case' labels
|
||||
/wd4146 # unary minus operator applied to unsigned type, result still unsigned
|
||||
/wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
/wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
|
||||
/wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
|
||||
/wd4305 # 'identifier' : truncation from 'type1' to 'type2'
|
||||
/wd4307 # 'operator' : integral constant overflow
|
||||
/wd4309 # 'conversion' : truncation of constant value
|
||||
/wd4334 # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
|
||||
/wd4355 # 'this' : used in base member initializer list
|
||||
/wd4506 # no definition for inline function 'function'
|
||||
/wd4800 # 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
/wd4996 # The compiler encountered a deprecated declaration.
|
||||
)
|
||||
# Allow big object
|
||||
add_definitions(/bigobj)
|
||||
string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR})
|
||||
string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR})
|
||||
string(REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION}")
|
||||
configure_file(extract_includes.bat.in extract_includes.bat)
|
||||
|
||||
# Suppress linker warnings about files with no symbols defined.
|
||||
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# Configure Resource Compiler
|
||||
enable_language(RC)
|
||||
# use English language (0x409) in resource compiler
|
||||
set(rc_flags "/l0x409")
|
||||
# fix rc.exe invocations because of usage of add_definitions()
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
|
||||
endif()
|
||||
|
||||
configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
get_filename_component(protobuf_source_dir ${protobuf_SOURCE_DIR} PATH)
|
||||
|
||||
include_directories(
|
||||
${ZLIB_INCLUDE_DIRECTORIES}
|
||||
${protobuf_BINARY_DIR}
|
||||
${protobuf_source_dir}/src)
|
||||
|
||||
if (MSVC)
|
||||
# Add the "lib" prefix for generated .lib outputs.
|
||||
set(LIB_PREFIX lib)
|
||||
else (MSVC)
|
||||
# When building with "make", "lib" prefix will be added automatically by
|
||||
# the build tool.
|
||||
set(LIB_PREFIX)
|
||||
endif (MSVC)
|
||||
|
||||
if (protobuf_UNICODE)
|
||||
add_definitions(-DUNICODE -D_UNICODE)
|
||||
endif (protobuf_UNICODE)
|
||||
|
||||
include(libprotobuf-lite.cmake)
|
||||
include(libprotobuf.cmake)
|
||||
if (protobuf_BUILD_LIBPROTOC)
|
||||
include(libprotoc.cmake)
|
||||
endif (protobuf_BUILD_LIBPROTOC)
|
||||
if (protobuf_BUILD_PROTOC_BINARIES)
|
||||
include(protoc.cmake)
|
||||
if (NOT DEFINED protobuf_PROTOC_EXE)
|
||||
set(protobuf_PROTOC_EXE protoc)
|
||||
endif (NOT DEFINED protobuf_PROTOC_EXE)
|
||||
endif (protobuf_BUILD_PROTOC_BINARIES)
|
||||
|
||||
# Ensure we have a protoc executable if we need one
|
||||
if (protobuf_BUILD_TESTS OR protobuf_BUILD_CONFORMANCE OR protobuf_BUILD_EXAMPLES)
|
||||
if (NOT DEFINED protobuf_PROTOC_EXE)
|
||||
find_program(protobuf_PROTOC_EXE protoc)
|
||||
if (NOT protobuf_PROTOC_EXE)
|
||||
message(FATAL "Build requires 'protoc' but binary not found and not building protoc.")
|
||||
endif ()
|
||||
endif ()
|
||||
if(protobuf_VERBOSE)
|
||||
message(STATUS "Using protoc : ${protobuf_PROTOC_EXE}")
|
||||
endif(protobuf_VERBOSE)
|
||||
endif ()
|
||||
|
||||
if (protobuf_BUILD_TESTS)
|
||||
include(tests.cmake)
|
||||
endif (protobuf_BUILD_TESTS)
|
||||
|
||||
if (protobuf_BUILD_CONFORMANCE)
|
||||
include(conformance.cmake)
|
||||
endif (protobuf_BUILD_CONFORMANCE)
|
||||
|
||||
include(install.cmake)
|
||||
|
||||
if (protobuf_BUILD_EXAMPLES)
|
||||
include(examples.cmake)
|
||||
endif (protobuf_BUILD_EXAMPLES)
|
||||
|
||||
if(protobuf_VERBOSE)
|
||||
message(STATUS "Protocol Buffers Configuring done")
|
||||
endif(protobuf_VERBOSE)
|
||||
include(../CMakeLists.txt)
|
||||
|
182
cmake/README.md
182
cmake/README.md
@ -36,6 +36,10 @@ If *git* command is not available from *Command Prompt*, add it to system *PATH*
|
||||
|
||||
C:\Path\to>set PATH=%PATH%;C:\Program Files\Git\cmd
|
||||
|
||||
Optionally, you will want to download [ninja](https://ninja-build.org/) and add it to your *PATH* variable.
|
||||
|
||||
C:\Path\to>set PATH=%PATH%;C:\tools\ninja
|
||||
|
||||
Good. Now you are ready to continue.
|
||||
|
||||
Getting Sources
|
||||
@ -52,29 +56,25 @@ download `protobuf-all-[VERSION].tar.gz`.
|
||||
|
||||
Or you can use git to clone from protobuf git repository.
|
||||
|
||||
C:\Path\to> git clone -b [release_tag] https://github.com/protocolbuffers/protobuf.git
|
||||
C:\Path\to> mkdir src & cd src
|
||||
C:\Path\to\src> git clone -b [release_tag] https://github.com/protocolbuffers/protobuf.git
|
||||
|
||||
Where *[release_tag]* is a git tag like *v3.0.0-beta-1* or a branch name like *master*
|
||||
Where *[release_tag]* is a git tag like *v3.0.0-beta-1* or a branch name like *main*
|
||||
if you want to get the latest code.
|
||||
|
||||
Go to the project folder:
|
||||
|
||||
C:\Path\to>cd protobuf
|
||||
C:\Path\to\protobuf>
|
||||
C:\Path\to\src> cd protobuf
|
||||
C:\Path\to\src\protobuf>
|
||||
|
||||
Remember to update any submodules if you are using git clone (you can skip this
|
||||
step if you are using a release .tar.gz or .zip package):
|
||||
|
||||
```console
|
||||
C:\Path\to> git submodule update --init --recursive
|
||||
C:\Path\to\src\protobuf> git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Now go to *cmake* folder in protobuf sources:
|
||||
|
||||
C:\Path\to\protobuf>cd cmake
|
||||
C:\Path\to\protobuf\cmake>
|
||||
|
||||
Good. Now you are ready to *CMake* configuration.
|
||||
Good. Now you are ready for *CMake* configuration.
|
||||
|
||||
CMake Configuration
|
||||
===================
|
||||
@ -82,71 +82,119 @@ CMake Configuration
|
||||
*CMake* supports a lot of different
|
||||
[generators](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html)
|
||||
for various native build systems.
|
||||
We are only interested in
|
||||
[Makefile](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#makefile-generators)
|
||||
and
|
||||
[Visual Studio](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators)
|
||||
generators.
|
||||
|
||||
We will use shadow building to separate the temporary files from the protobuf source code.
|
||||
Of most interest to Windows programmers are the following:
|
||||
|
||||
* [Makefile](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#makefile-generators).
|
||||
This generates NMake Makefiles for Visual Studio. These work, but they are rather slow.
|
||||
|
||||
* [Visual Studio](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators)
|
||||
This generates a Visual Studio solution for the project.
|
||||
|
||||
* [Ninja](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#ninja-generator)
|
||||
This uses the external tool [Ninja](https://ninja-build.org/) to build. It is the fastest solution available.
|
||||
|
||||
Note that as of Visual Studio 2015, Visual Studio includes
|
||||
[support for opening directly CMake-based projects](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio).
|
||||
|
||||
It is considered good practice not to build CMake projects in the source tree but in a separate folder.
|
||||
|
||||
Create a temporary *build* folder and change your working directory to it:
|
||||
|
||||
C:\Path\to\protobuf\cmake>mkdir build & cd build
|
||||
C:\Path\to\protobuf\cmake\build>
|
||||
mkdir C:\Path\to\build\protobuf
|
||||
cd C:\Path\to\build\protobuf
|
||||
C:\Path\to\build\protobuf>
|
||||
|
||||
The *Makefile* generator can build the project in only one configuration, so you need to build
|
||||
The *Makefile* and *Ninja* generators can build the project in only one configuration, so you need to build
|
||||
a separate folder for each configuration.
|
||||
|
||||
To start using a *Release* configuration:
|
||||
To start using a *Release* configuration via the *NMmake* generator:
|
||||
|
||||
C:\Path\to\protobuf\cmake\build>mkdir release & cd release
|
||||
C:\Path\to\protobuf\cmake\build\release>cmake -G "NMake Makefiles" ^
|
||||
C:\Path\to\build\protobuf>mkdir release & cd release
|
||||
C:\Path\to\build\protobuf\release>cmake -G "NMake Makefiles" ^
|
||||
-DCMAKE_BUILD_TYPE=Release ^
|
||||
-DCMAKE_INSTALL_PREFIX=../../../../install ^
|
||||
../..
|
||||
-DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^
|
||||
C:\Path\to\src\protobuf
|
||||
|
||||
It will generate *nmake* *Makefile* in current directory.
|
||||
It will generate a *NMake* *Makefile* in the current directory.
|
||||
|
||||
To use *Debug* configuration:
|
||||
To use *Debug* configuration using *Ninja*:
|
||||
|
||||
C:\Path\to\protobuf\cmake\build>mkdir debug & cd debug
|
||||
C:\Path\to\protobuf\cmake\build\debug>cmake -G "NMake Makefiles" ^
|
||||
C:\Path\to\build\protobuf>mkdir debug & cd debug
|
||||
C:\Path\to\build\protobuf\debug>cmake -G "Ninja" ^
|
||||
-DCMAKE_BUILD_TYPE=Debug ^
|
||||
-DCMAKE_INSTALL_PREFIX=../../../../install ^
|
||||
../..
|
||||
-DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^
|
||||
C:\Path\to\src\protobuf
|
||||
|
||||
It will generate *nmake* *Makefile* in current directory.
|
||||
It will generate *Ninja* build scripts in current directory.
|
||||
|
||||
To create *Visual Studio* solution file:
|
||||
The *Visual Studio* generator is multi-configuration: it will generate a single *.sln* file that can be used for both *Debug* and *Release*:
|
||||
|
||||
C:\Path\to\protobuf\cmake\build>mkdir solution & cd solution
|
||||
C:\Path\to\protobuf\cmake\build\solution>cmake -G "Visual Studio 16 2019" ^
|
||||
-DCMAKE_INSTALL_PREFIX=../../../../install ^
|
||||
../..
|
||||
C:\Path\to\build\protobuf>mkdir solution & cd solution
|
||||
C:\Path\to\build\protobuf\solution>cmake -G "Visual Studio 16 2019" ^
|
||||
-DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^
|
||||
C:\Path\to\src\protobuf
|
||||
|
||||
It will generate *Visual Studio* solution file *protobuf.sln* in current directory.
|
||||
|
||||
If the *gmock* directory does not exist, and you do not want to build protobuf unit tests,
|
||||
you need to add *cmake* command argument `-Dprotobuf_BUILD_TESTS=OFF` to disable testing.
|
||||
Unit Tests
|
||||
----------
|
||||
|
||||
To make a *Visual Studio* file for Visual Studio 16 2019, create the *Visual Studio*
|
||||
solution file above and edit the CMakeCache file.
|
||||
Unit tests are being built along with the rest of protobuf. The unit tests require Google Mock (now a part of Google Test).
|
||||
|
||||
C:Path\to\protobuf\cmake\build\solution\CMakeCache
|
||||
A copy of [Google Test](https://github.com/google/googletest) is included as a Git submodule in the `third-party/googletest` folder.
|
||||
(You do need to initialize the Git submodules as explained above.)
|
||||
|
||||
Then create the *Visual Studio* solution file again
|
||||
Alternately, you may want to use protobuf in a larger set-up, you may want to use that standard CMake approach where
|
||||
you build and install a shared copy of Google Test.
|
||||
|
||||
After you've built and installed your Google Test copy, you need add the following definition to your *cmake* command line
|
||||
during the configuration step: `-Dprotobuf_USE_EXTERNAL_GTEST=ON`.
|
||||
This will cause the standard CMake `find_package(GTest REQUIRED)` to be used.
|
||||
|
||||
[find_package](https://cmake.org/cmake/help/latest/command/find_package.html) will search in a default location,
|
||||
which on Windows is *C:\Program Files*. This is most likely not what you want. You will want instead to search for
|
||||
Google Test in your project's root directory (i.e. the same directory you've passed to `CMAKE_INSTALL_PREFIX` when
|
||||
building Google Test). For this, you need to set the `CMAKE_PREFIX_PATH` CMake variable. (There are other ways in CMake,
|
||||
see the [manual](https://cmake.org/cmake/help/latest/command/find_package.html) for details.)
|
||||
|
||||
For example:
|
||||
|
||||
C:\Path\to\build\protobuf>mkdir solution & cd solution
|
||||
C:\Path\to\build\protobuf\solution>cmake -G "Visual Studio 16 2019" ^
|
||||
-DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^
|
||||
-DCMAKE_PREFIX_PATH=C:\Path\to\my_big_project ^
|
||||
-Dprotobuf_USE_EXTERNAL_GTEST=ON ^
|
||||
C:\Path\to\src\protobuf
|
||||
|
||||
In most cases, `CMAKE_PREFIX_PATH` and `CMAKE_INSTALL_PREFIX` will point to the same directory.
|
||||
|
||||
To disable testing completely, you need to add the following argument to you *cmake* command line: `-Dprotobuf_BUILD_TESTS=OFF`.
|
||||
|
||||
For example:
|
||||
|
||||
C:\Path\to\build\protobuf\solution>cmake -G "Visual Studio 16 2019" ^
|
||||
-DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^
|
||||
-Dprotobuf_BUILD_TESTS=OFF ^
|
||||
C:\Path\to\src\protobuf
|
||||
|
||||
Compiling
|
||||
=========
|
||||
|
||||
To compile protobuf:
|
||||
The standard way to compile a *CMake* project is `cmake --build <directory>`.
|
||||
|
||||
C:\Path\to\protobuf\cmake\build\release>nmake
|
||||
|
||||
Note that if your generator supports multiple configurations, you will probably want to specify which one to build:
|
||||
|
||||
cmake --build C:\Path\to\build\protobuf\solution --config Release
|
||||
|
||||
You can also run directly the build tool you've configured:
|
||||
|
||||
C:\Path\to\build\protobuf\release>nmake
|
||||
|
||||
or
|
||||
|
||||
C:\Path\to\protobuf\cmake\build\debug>nmake
|
||||
C:\Path\to\build\protobuf\debug>ninja
|
||||
|
||||
And wait for the compilation to finish.
|
||||
|
||||
@ -164,11 +212,15 @@ Testing
|
||||
To run unit-tests, first you must compile protobuf as described above.
|
||||
Then run:
|
||||
|
||||
C:\Path\to\protobuf\cmake\build\release>nmake check
|
||||
C:\Path\to\protobuf\cmake\build\release>ctest --progress --output-on-failure
|
||||
|
||||
You can also build the `check` target (not idiomatic CMake usage, though):
|
||||
|
||||
C:\Path\to\protobuf\cmake\build\release>cmake --build . --target check
|
||||
|
||||
or
|
||||
|
||||
C:\Path\to\protobuf\cmake\build\debug>nmake check
|
||||
C:\Path\to\build\protobuf\release>ninja check
|
||||
|
||||
You can also build project *check* from Visual Studio solution.
|
||||
Yes, it may sound strange, but it works.
|
||||
@ -183,9 +235,9 @@ You should see output similar to:
|
||||
[==========] 1546 tests from 165 test cases ran. (2529 ms total)
|
||||
[ PASSED ] 1546 tests.
|
||||
|
||||
To run specific tests:
|
||||
To run specific tests, you need to pass some command line arguments to the test program itself:
|
||||
|
||||
C:\Path\to\protobuf>cmake\build\release\tests.exe --gtest_filter=AnyTest*
|
||||
C:\Path\to\build\protobuf\release>tests.exe --gtest_filter=AnyTest*
|
||||
Running main() from gmock_main.cc
|
||||
Note: Google Test filter = AnyTest*
|
||||
[==========] Running 3 tests from 1 test case.
|
||||
@ -210,13 +262,17 @@ If all tests are passed, safely continue.
|
||||
Installing
|
||||
==========
|
||||
|
||||
To install protobuf to the specified *install* folder:
|
||||
To install protobuf to the *install* folder you've specified in the configuration step, you need to build the `install` target:
|
||||
|
||||
C:\Path\to\protobuf\cmake\build\release>nmake install
|
||||
cmake --build C:\Path\to\build\protobuf\solution --config Release --target install
|
||||
|
||||
Or if you prefer:
|
||||
|
||||
C:\Path\to\build\protobuf\release>nmake install
|
||||
|
||||
or
|
||||
|
||||
C:\Path\to\protobuf\cmake\build\debug>nmake install
|
||||
C:\Path\to\build\protobuf\debug>ninja install
|
||||
|
||||
You can also build project *INSTALL* from Visual Studio solution.
|
||||
It sounds not so strange and it works.
|
||||
@ -280,16 +336,16 @@ You can also compile it from source by yourself.
|
||||
|
||||
Getting sources:
|
||||
|
||||
C:\Path\to>git clone -b v1.2.8 https://github.com/madler/zlib.git
|
||||
C:\Path\to>cd zlib
|
||||
C:\Path\to\src>git clone -b v1.2.8 https://github.com/madler/zlib.git
|
||||
C:\Path\to\src>cd zlib
|
||||
|
||||
Compiling and Installing:
|
||||
|
||||
C:\Path\to\zlib>mkdir build & cd build
|
||||
C:\Path\to\zlib\build>mkdir release & cd release
|
||||
C:\Path\to\zlib\build\release>cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ^
|
||||
-DCMAKE_INSTALL_PREFIX=../../../install ../..
|
||||
C:\Path\to\zlib\build\release>nmake & nmake install
|
||||
C:\Path\to\src\zlib>mkdir C:\Path\to\build\zlib & cd C:\Path\to\build\zlib
|
||||
C:\Path\to\build\zlib>mkdir release & cd release
|
||||
C:\Path\to\build\zlib\release>cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ^
|
||||
-DCMAKE_INSTALL_PREFIX=C:\Path\to\install C:\Path\to\src\zlib
|
||||
C:\Path\to\src\zlib\build\release>cmake --build . --target install
|
||||
|
||||
You can make *debug* version or use *Visual Studio* generator also as before for the
|
||||
protobuf project.
|
||||
@ -308,8 +364,8 @@ the headers or the .lib file in the right directory.
|
||||
|
||||
If you already have ZLIB library and headers at some other location on your system then alternatively you can define following configuration flags to locate them:
|
||||
|
||||
-DZLIB_INCLUDE_DIR=<path to dir containing zlib headers>
|
||||
-DZLIB_LIB=<path to dir containing zlib>
|
||||
-DZLIB_INCLUDE_DIR=<path to dir containing zlib headers>
|
||||
-DZLIB_LIB=<path to dir containing zlib>
|
||||
|
||||
Build and testing protobuf as usual.
|
||||
|
||||
@ -320,8 +376,6 @@ The following warnings have been disabled while building the protobuf libraries
|
||||
and compiler. You may have to disable some of them in your own project as
|
||||
well, or live with them.
|
||||
|
||||
* C4018 - 'expression' : signed/unsigned mismatch
|
||||
* C4146 - unary minus operator applied to unsigned type, result still unsigned
|
||||
* C4244 - Conversion from 'type1' to 'type2', possible loss of data.
|
||||
* C4251 - 'identifier' : class 'type' needs to have dll-interface to be used by
|
||||
clients of class 'type2'
|
||||
|
@ -1,49 +1,49 @@
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${protobuf_source_dir}/conformance/conformance.pb.cc
|
||||
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/conformance/conformance.proto
|
||||
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/conformance/conformance.proto
|
||||
--proto_path=${protobuf_source_dir}/conformance
|
||||
--cpp_out=${protobuf_source_dir}/conformance
|
||||
OUTPUT ${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
|
||||
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/conformance/conformance.proto
|
||||
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/conformance/conformance.proto
|
||||
--proto_path=${protobuf_SOURCE_DIR}/conformance
|
||||
--cpp_out=${protobuf_SOURCE_DIR}/conformance
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto
|
||||
${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto
|
||||
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto
|
||||
--proto_path=${protobuf_source_dir}/src
|
||||
--cpp_out=${protobuf_source_dir}/src
|
||||
OUTPUT ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto
|
||||
${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.proto
|
||||
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.proto
|
||||
--proto_path=${protobuf_SOURCE_DIR}/src
|
||||
--cpp_out=${protobuf_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
add_executable(conformance_test_runner
|
||||
${protobuf_source_dir}/conformance/binary_json_conformance_suite.cc
|
||||
${protobuf_source_dir}/conformance/binary_json_conformance_suite.h
|
||||
${protobuf_source_dir}/conformance/conformance.pb.cc
|
||||
${protobuf_source_dir}/conformance/conformance_test.cc
|
||||
${protobuf_source_dir}/conformance/conformance_test_runner.cc
|
||||
${protobuf_source_dir}/conformance/third_party/jsoncpp/json.h
|
||||
${protobuf_source_dir}/conformance/third_party/jsoncpp/jsoncpp.cpp
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.h
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance_test.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance_test_runner.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/third_party/jsoncpp/json.h
|
||||
${protobuf_SOURCE_DIR}/conformance/third_party/jsoncpp/jsoncpp.cpp
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
)
|
||||
|
||||
add_executable(conformance_cpp
|
||||
${protobuf_source_dir}/conformance/conformance.pb.cc
|
||||
${protobuf_source_dir}/conformance/conformance_cpp.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance_cpp.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
conformance_test_runner
|
||||
PUBLIC ${protobuf_source_dir}/conformance)
|
||||
PUBLIC ${protobuf_SOURCE_DIR}/conformance)
|
||||
|
||||
target_include_directories(
|
||||
conformance_cpp
|
||||
PUBLIC ${protobuf_source_dir}/conformance)
|
||||
PUBLIC ${protobuf_SOURCE_DIR}/conformance)
|
||||
|
||||
target_link_libraries(conformance_test_runner libprotobuf)
|
||||
target_link_libraries(conformance_cpp libprotobuf)
|
||||
|
@ -2,7 +2,7 @@ if(protobuf_VERBOSE)
|
||||
message(STATUS "Protocol Buffers Examples Configuring...")
|
||||
endif()
|
||||
|
||||
get_filename_component(examples_dir "../examples" ABSOLUTE)
|
||||
get_filename_component(examples_dir "${protobuf_SOURCE_DIR}/examples" ABSOLUTE)
|
||||
|
||||
if(protobuf_VERBOSE)
|
||||
message(STATUS "Protocol Buffers Examples Configuring done")
|
||||
|
@ -5,7 +5,6 @@ mkdir include\google\protobuf\compiler
|
||||
mkdir include\google\protobuf\compiler\cpp
|
||||
mkdir include\google\protobuf\compiler\csharp
|
||||
mkdir include\google\protobuf\compiler\java
|
||||
mkdir include\google\protobuf\compiler\js
|
||||
mkdir include\google\protobuf\compiler\objectivec
|
||||
mkdir include\google\protobuf\compiler\php
|
||||
mkdir include\google\protobuf\compiler\python
|
||||
@ -19,27 +18,31 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.pb.h" include\goo
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena.h" include\google\protobuf\arena.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena_impl.h" include\google\protobuf\arena_impl.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenastring.h" include\google\protobuf\arenastring.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenaz_sampler.h" include\google\protobuf\arenaz_sampler.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\code_generator.h" include\google\protobuf\compiler\code_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\command_line_interface.h" include\google\protobuf\compiler\command_line_interface.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_file.h" include\google\protobuf\compiler\cpp\cpp_file.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\file.h" include\google\protobuf\compiler\cpp\file.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_generator.h" include\google\protobuf\compiler\cpp\cpp_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_helpers.h" include\google\protobuf\compiler\cpp\cpp_helpers.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_names.h" include\google\protobuf\compiler\cpp\cpp_names.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\generator.h" include\google\protobuf\compiler\cpp\generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\helpers.h" include\google\protobuf\compiler\cpp\helpers.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\names.h" include\google\protobuf\compiler\cpp\names.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_doc_comment.h" include\google\protobuf\compiler\csharp\csharp_doc_comment.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_generator.h" include\google\protobuf\compiler\csharp\csharp_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_names.h" include\google\protobuf\compiler\csharp\csharp_names.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_options.h" include\google\protobuf\compiler\csharp\csharp_options.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h" include\google\protobuf\compiler\importer.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\generator.h" include\google\protobuf\compiler\java\generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h" include\google\protobuf\compiler\java\java_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_kotlin_generator.h" include\google\protobuf\compiler\java\java_kotlin_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_names.h" include\google\protobuf\compiler\java\java_names.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\js_generator.h" include\google\protobuf\compiler\js\js_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\kotlin_generator.h" include\google\protobuf\compiler\java\kotlin_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\names.h" include\google\protobuf\compiler\java\names.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_generator.h" include\google\protobuf\compiler\objectivec\objectivec_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_helpers.h" include\google\protobuf\compiler\objectivec\objectivec_helpers.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\parser.h" include\google\protobuf\compiler\parser.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\php\php_generator.h" include\google\protobuf\compiler\php\php_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.h" include\google\protobuf\compiler\plugin.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.pb.h" include\google\protobuf\compiler\plugin.pb.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\generator.h" include\google\protobuf\compiler\python\generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\pyi_generator.h" include\google\protobuf\compiler\python\pyi_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_generator.h" include\google\protobuf\compiler\python\python_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\ruby\ruby_generator.h" include\google\protobuf\compiler\ruby\ruby_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.h" include\google\protobuf\descriptor.h
|
||||
@ -48,6 +51,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor_database.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h" include\google\protobuf\duration.pb.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h" include\google\protobuf\dynamic_message.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h" include\google\protobuf\empty.pb.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\endian.h" include\google\protobuf\endian.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\explicitly_constructed.h" include\google\protobuf\explicitly_constructed.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h" include\google\protobuf\extension_set.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set_inl.h" include\google\protobuf\extension_set_inl.h
|
||||
@ -57,11 +61,8 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflec
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_bases.h" include\google\protobuf\generated_message_bases.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven_lite.h" include\google\protobuf\generated_message_table_driven_lite.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_decl.h" include\google\protobuf\generated_message_tctable_decl.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.h" include\google\protobuf\generated_message_tctable_impl.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.inc" include\google\protobuf\generated_message_tctable_impl.inc
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h" include\google\protobuf\generated_message_util.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\has_bits.h" include\google\protobuf\has_bits.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\implicit_weak_message.h" include\google\protobuf\implicit_weak_message.h
|
||||
|
@ -1,8 +1,8 @@
|
||||
include(GNUInstallDirs)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf.pc.cmake
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf-lite.pc.cmake
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf-lite.pc.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc @ONLY)
|
||||
|
||||
set(_protobuf_libraries libprotobuf-lite libprotobuf)
|
||||
@ -13,7 +13,7 @@ endif (protobuf_BUILD_LIBPROTOC)
|
||||
foreach(_library ${_protobuf_libraries})
|
||||
set_property(TARGET ${_library}
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
$<BUILD_INTERFACE:${protobuf_source_dir}/src>
|
||||
$<BUILD_INTERFACE:${protobuf_SOURCE_DIR}/src>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
if (UNIX AND NOT APPLE)
|
||||
set_property(TARGET ${_library}
|
||||
@ -43,15 +43,15 @@ endif (protobuf_BUILD_PROTOC_BINARIES)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
file(STRINGS extract_includes.bat.in _extract_strings
|
||||
file(STRINGS ${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in _extract_strings
|
||||
REGEX "^copy")
|
||||
foreach(_extract_string ${_extract_strings})
|
||||
string(REGEX REPLACE "^.* .+ include\\\\(.+)$" "\\1"
|
||||
_header ${_extract_string})
|
||||
string(REPLACE "\\" "/" _header ${_header})
|
||||
get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/../src/${_header}" ABSOLUTE)
|
||||
get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/src/${_header}" ABSOLUTE)
|
||||
get_filename_component(_extract_name ${_header} NAME)
|
||||
get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" PATH)
|
||||
get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" DIRECTORY)
|
||||
if(EXISTS "${_extract_from}")
|
||||
install(FILES "${_extract_from}"
|
||||
DESTINATION "${_extract_to}"
|
||||
@ -84,65 +84,73 @@ function(_protobuf_auto_list FILE_NAME VARIABLE)
|
||||
endfunction()
|
||||
|
||||
# Install well-known type proto files
|
||||
_protobuf_auto_list("../src/Makefile.am" nobase_dist_proto_DATA)
|
||||
_protobuf_auto_list("${protobuf_SOURCE_DIR}/src/Makefile.am" nobase_dist_proto_DATA)
|
||||
foreach(_file ${nobase_dist_proto_DATA})
|
||||
get_filename_component(_file_from "../src/${_file}" ABSOLUTE)
|
||||
get_filename_component(_file_from "${protobuf_SOURCE_DIR}/src/${_file}" ABSOLUTE)
|
||||
get_filename_component(_file_name ${_file} NAME)
|
||||
get_filename_component(_file_path ${_file} PATH)
|
||||
get_filename_component(_dir ${_file} DIRECTORY)
|
||||
if(EXISTS "${_file_from}")
|
||||
install(FILES "${_file_from}"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_file_path}"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_dir}"
|
||||
COMPONENT protobuf-protos
|
||||
RENAME "${_file_name}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "The file \"${_file_from}\" is listed in "
|
||||
"\"${protobuf_SOURCE_DIR}/../src/Makefile.am\" as nobase_dist_proto_DATA "
|
||||
"\"${protobuf_SOURCE_DIR}/src/Makefile.am\" as nobase_dist_proto_DATA "
|
||||
"but there not exists. The file will not be installed.")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Install configuration
|
||||
set(_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the cmake configuration files")
|
||||
set(_install_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the cmake configuration files")
|
||||
set(_build_cmakedir_desc "Directory relative to CMAKE_CURRENT_BINARY_DIR for cmake configuration files")
|
||||
set(_exampledir_desc "Directory relative to CMAKE_INSTALL_DATA to install examples")
|
||||
set(_protobuf_subdir_desc "Subdirectory in which to install cmake configuration files")
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/protobuf" CACHE STRING "${_cmakedir_desc}")
|
||||
set(protobuf_CMAKE_SUBDIR "cmake/protobuf" CACHE STRING "${_protobuf_subdir_desc}")
|
||||
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/${protobuf_CMAKE_SUBDIR}" CACHE STRING "${_install_cmakedir_desc}")
|
||||
set(CMAKE_INSTALL_EXAMPLEDIR "${CMAKE_INSTALL_DATADIR}/protobuf/examples" CACHE STRING "${_exampledir_desc}")
|
||||
else()
|
||||
set(protobuf_CMAKE_SUBDIR "cmake" CACHE STRING "${_protobuf_subdir_desc}")
|
||||
set(CMAKE_INSTALL_CMAKEDIR "cmake" CACHE STRING "${_cmakedir_desc}")
|
||||
set(CMAKE_INSTALL_EXAMPLEDIR "examples" CACHE STRING "${_exampledir_desc}")
|
||||
endif()
|
||||
set(CMAKE_BUILD_CMAKEDIR "${CMAKE_CURRENT_BINARY_DIR}/${protobuf_CMAKE_SUBDIR}" CACHE STRING "${_build_cmakedir_desc}")
|
||||
mark_as_advanced(protobuf_CMAKE_SUBDIR)
|
||||
mark_as_advanced(CMAKE_BUILD_CMAKEDIR)
|
||||
mark_as_advanced(CMAKE_INSTALL_CMAKEDIR)
|
||||
mark_as_advanced(CMAKE_INSTALL_EXAMPLEDIR)
|
||||
|
||||
configure_file(protobuf-config.cmake.in
|
||||
${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake @ONLY)
|
||||
configure_file(protobuf-config-version.cmake.in
|
||||
${CMAKE_INSTALL_CMAKEDIR}/protobuf-config-version.cmake @ONLY)
|
||||
configure_file(protobuf-module.cmake.in
|
||||
${CMAKE_INSTALL_CMAKEDIR}/protobuf-module.cmake @ONLY)
|
||||
configure_file(protobuf-options.cmake
|
||||
${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-config.cmake.in
|
||||
${CMAKE_BUILD_CMAKEDIR}/protobuf-config.cmake @ONLY)
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-config-version.cmake.in
|
||||
${CMAKE_BUILD_CMAKEDIR}/protobuf-config-version.cmake @ONLY)
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-module.cmake.in
|
||||
${CMAKE_BUILD_CMAKEDIR}/protobuf-module.cmake @ONLY)
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-options.cmake
|
||||
${CMAKE_BUILD_CMAKEDIR}/protobuf-options.cmake @ONLY)
|
||||
|
||||
# Allows the build directory to be used as a find directory.
|
||||
|
||||
if (protobuf_BUILD_PROTOC_BINARIES)
|
||||
export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
|
||||
NAMESPACE protobuf::
|
||||
FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
|
||||
FILE ${CMAKE_BUILD_CMAKEDIR}/protobuf-targets.cmake
|
||||
)
|
||||
else (protobuf_BUILD_PROTOC_BINARIES)
|
||||
export(TARGETS libprotobuf-lite libprotobuf
|
||||
NAMESPACE protobuf::
|
||||
FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
|
||||
FILE ${CMAKE_BUILD_CMAKEDIR}/protobuf-targets.cmake
|
||||
)
|
||||
endif (protobuf_BUILD_PROTOC_BINARIES)
|
||||
|
||||
install(EXPORT protobuf-targets
|
||||
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
|
||||
NAMESPACE protobuf::
|
||||
COMPONENT protobuf-export)
|
||||
COMPONENT protobuf-export
|
||||
)
|
||||
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/
|
||||
install(DIRECTORY ${CMAKE_BUILD_CMAKEDIR}/
|
||||
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
|
||||
COMPONENT protobuf-export
|
||||
PATTERN protobuf-targets.cmake EXCLUDE
|
||||
@ -150,7 +158,7 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/
|
||||
|
||||
option(protobuf_INSTALL_EXAMPLES "Install the examples folder" OFF)
|
||||
if(protobuf_INSTALL_EXAMPLES)
|
||||
install(DIRECTORY ../examples/
|
||||
install(DIRECTORY examples/
|
||||
DESTINATION "${CMAKE_INSTALL_EXAMPLEDIR}"
|
||||
COMPONENT protobuf-examples)
|
||||
endif()
|
||||
|
@ -1,115 +1,36 @@
|
||||
set(libprotobuf_lite_files
|
||||
${protobuf_source_dir}/src/google/protobuf/any_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/arena.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/arenastring.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/extension_set.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_enum_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/inlined_string_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/io_win32.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/strtod.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/map.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/message_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/parse_context.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/repeated_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/repeated_ptr_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/common.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/int128.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/status.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/statusor.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/strutil.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/time.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.cc
|
||||
)
|
||||
# CMake definitions for libprotobuf_lite (the "lite" C++ protobuf runtime).
|
||||
|
||||
set(libprotobuf_lite_includes
|
||||
${protobuf_source_dir}/src/google/protobuf/any.h
|
||||
${protobuf_source_dir}/src/google/protobuf/arena.h
|
||||
${protobuf_source_dir}/src/google/protobuf/arena_impl.h
|
||||
${protobuf_source_dir}/src/google/protobuf/arenastring.h
|
||||
${protobuf_source_dir}/src/google/protobuf/explicitly_constructed.h
|
||||
${protobuf_source_dir}/src/google/protobuf/extension_set.h
|
||||
${protobuf_source_dir}/src/google/protobuf/extension_set_inl.h
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_enum_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.h
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.h
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_decl.h
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.h
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.inc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/has_bits.h
|
||||
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h
|
||||
${protobuf_source_dir}/src/google/protobuf/inlined_string_field.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/io_win32.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/strtod.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h
|
||||
${protobuf_source_dir}/src/google/protobuf/map.h
|
||||
${protobuf_source_dir}/src/google/protobuf/map_entry_lite.h
|
||||
${protobuf_source_dir}/src/google/protobuf/map_field_lite.h
|
||||
${protobuf_source_dir}/src/google/protobuf/map_type_handler.h
|
||||
${protobuf_source_dir}/src/google/protobuf/message_lite.h
|
||||
${protobuf_source_dir}/src/google/protobuf/metadata_lite.h
|
||||
${protobuf_source_dir}/src/google/protobuf/parse_context.h
|
||||
${protobuf_source_dir}/src/google/protobuf/port.h
|
||||
${protobuf_source_dir}/src/google/protobuf/repeated_field.h
|
||||
${protobuf_source_dir}/src/google/protobuf/repeated_ptr_field.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/callback.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/casts.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/common.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/hash.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/logging.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/macros.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/map_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/mutex.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/once.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/platform_macros.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/port.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/status.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/stl_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/strutil.h
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/template_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h
|
||||
)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(libprotobuf_lite_rc_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
||||
)
|
||||
endif()
|
||||
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
|
||||
|
||||
add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC}
|
||||
${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${libprotobuf_lite_rc_files})
|
||||
target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT})
|
||||
${libprotobuf_lite_srcs}
|
||||
${libprotobuf_lite_hdrs}
|
||||
${protobuf_version_rc_file})
|
||||
if(protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
|
||||
target_link_options(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
|
||||
elseif(protobuf_BUILD_SHARED_LIBS)
|
||||
target_link_libraries(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
|
||||
endif()
|
||||
set_target_properties(libprotobuf-lite PROPERTIES
|
||||
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
|
||||
endif()
|
||||
target_link_libraries(libprotobuf-lite PRIVATE ${CMAKE_THREAD_LIBS_INIT})
|
||||
if(protobuf_LINK_LIBATOMIC)
|
||||
target_link_libraries(libprotobuf-lite atomic)
|
||||
target_link_libraries(libprotobuf-lite PRIVATE atomic)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
|
||||
target_link_libraries(libprotobuf-lite log)
|
||||
target_link_libraries(libprotobuf-lite PRIVATE log)
|
||||
endif()
|
||||
target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src)
|
||||
if(MSVC AND protobuf_BUILD_SHARED_LIBS)
|
||||
target_include_directories(libprotobuf-lite PUBLIC ${protobuf_SOURCE_DIR}/src)
|
||||
if(protobuf_BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(libprotobuf-lite
|
||||
PUBLIC PROTOBUF_USE_DLLS
|
||||
PRIVATE LIBPROTOBUF_EXPORTS)
|
||||
endif()
|
||||
set_target_properties(libprotobuf-lite PROPERTIES
|
||||
VERSION ${protobuf_VERSION}
|
||||
SOVERSION 32
|
||||
OUTPUT_NAME ${LIB_PREFIX}protobuf-lite
|
||||
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
|
||||
add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)
|
||||
|
@ -1,130 +1,39 @@
|
||||
set(libprotobuf_files
|
||||
${protobuf_source_dir}/src/google/protobuf/any.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/any.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/api.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/importer.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/parser.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/descriptor.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/descriptor.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/descriptor_database.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/duration.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/dynamic_message.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/empty.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/extension_set_heavy.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/field_mask.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_bases.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_full.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/printer.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/tokenizer.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/map_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/message.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/reflection_ops.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/service.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/source_context.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/struct.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/substitute.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/text_format.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/timestamp.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/type.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/unknown_field_set.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/field_comparator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/proto_writer.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/utility.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/json_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/message_differencer.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/time_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/wire_format.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.cc
|
||||
)
|
||||
# CMake definitions for libprotobuf (the "full" C++ protobuf runtime).
|
||||
|
||||
set(libprotobuf_includes
|
||||
${protobuf_source_dir}/src/google/protobuf/any.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/api.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/importer.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/parser.h
|
||||
${protobuf_source_dir}/src/google/protobuf/descriptor.h
|
||||
${protobuf_source_dir}/src/google/protobuf/descriptor.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/descriptor_database.h
|
||||
${protobuf_source_dir}/src/google/protobuf/duration.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/dynamic_message.h
|
||||
${protobuf_source_dir}/src/google/protobuf/empty.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/field_access_listener.h
|
||||
${protobuf_source_dir}/src/google/protobuf/field_mask.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_enum_reflection.h
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_bases.h
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/printer.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/tokenizer.h
|
||||
${protobuf_source_dir}/src/google/protobuf/map_entry.h
|
||||
${protobuf_source_dir}/src/google/protobuf/map_field.h
|
||||
${protobuf_source_dir}/src/google/protobuf/map_field_inl.h
|
||||
${protobuf_source_dir}/src/google/protobuf/message.h
|
||||
${protobuf_source_dir}/src/google/protobuf/metadata.h
|
||||
${protobuf_source_dir}/src/google/protobuf/reflection.h
|
||||
${protobuf_source_dir}/src/google/protobuf/reflection_ops.h
|
||||
${protobuf_source_dir}/src/google/protobuf/service.h
|
||||
${protobuf_source_dir}/src/google/protobuf/source_context.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/struct.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/text_format.h
|
||||
${protobuf_source_dir}/src/google/protobuf/timestamp.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/type.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/unknown_field_set.h
|
||||
${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/util/field_comparator.h
|
||||
${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/util/json_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/util/message_differencer.h
|
||||
${protobuf_source_dir}/src/google/protobuf/util/time_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/util/type_resolver.h
|
||||
${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/wire_format.h
|
||||
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h
|
||||
)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(libprotobuf_rc_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
||||
)
|
||||
endif()
|
||||
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
|
||||
|
||||
add_library(libprotobuf ${protobuf_SHARED_OR_STATIC}
|
||||
${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${libprotobuf_rc_files})
|
||||
target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT})
|
||||
${libprotobuf_srcs}
|
||||
${libprotobuf_hdrs}
|
||||
${protobuf_version_rc_file})
|
||||
if(protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
|
||||
target_link_options(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map)
|
||||
elseif(protobuf_BUILD_SHARED_LIBS)
|
||||
target_link_libraries(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map)
|
||||
endif()
|
||||
set_target_properties(libprotobuf PROPERTIES
|
||||
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf.map)
|
||||
endif()
|
||||
target_link_libraries(libprotobuf PRIVATE ${CMAKE_THREAD_LIBS_INIT})
|
||||
if(protobuf_WITH_ZLIB)
|
||||
target_link_libraries(libprotobuf ${ZLIB_LIBRARIES})
|
||||
target_link_libraries(libprotobuf PRIVATE ${ZLIB_LIBRARIES})
|
||||
endif()
|
||||
if(protobuf_LINK_LIBATOMIC)
|
||||
target_link_libraries(libprotobuf atomic)
|
||||
target_link_libraries(libprotobuf PRIVATE atomic)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
|
||||
target_link_libraries(libprotobuf log)
|
||||
target_link_libraries(libprotobuf PRIVATE log)
|
||||
endif()
|
||||
target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src)
|
||||
if(MSVC AND protobuf_BUILD_SHARED_LIBS)
|
||||
target_include_directories(libprotobuf PUBLIC ${protobuf_SOURCE_DIR}/src)
|
||||
if(protobuf_BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(libprotobuf
|
||||
PUBLIC PROTOBUF_USE_DLLS
|
||||
PRIVATE LIBPROTOBUF_EXPORTS)
|
||||
endif()
|
||||
set_target_properties(libprotobuf PROPERTIES
|
||||
VERSION ${protobuf_VERSION}
|
||||
SOVERSION 32
|
||||
OUTPUT_NAME ${LIB_PREFIX}protobuf
|
||||
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
|
||||
add_library(protobuf::libprotobuf ALIAS libprotobuf)
|
||||
|
@ -1,125 +1,22 @@
|
||||
set(libprotoc_files
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc
|
||||
)
|
||||
# CMake definitions for libprotoc (the protobuf compiler library).
|
||||
|
||||
set(libprotoc_headers
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_names.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_names.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/importer.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_names.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/parser.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.h
|
||||
)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(libprotoc_rc_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
||||
)
|
||||
endif()
|
||||
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
|
||||
|
||||
add_library(libprotoc ${protobuf_SHARED_OR_STATIC}
|
||||
${libprotoc_files} ${libprotoc_headers} ${libprotoc_rc_files})
|
||||
target_link_libraries(libprotoc libprotobuf)
|
||||
if(MSVC AND protobuf_BUILD_SHARED_LIBS)
|
||||
${libprotoc_srcs}
|
||||
${libprotoc_hdrs}
|
||||
${protobuf_version_rc_file})
|
||||
if(protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
|
||||
target_link_options(libprotoc PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotoc.map)
|
||||
elseif(protobuf_BUILD_SHARED_LIBS)
|
||||
target_link_libraries(libprotoc PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotoc.map)
|
||||
endif()
|
||||
set_target_properties(libprotoc PROPERTIES
|
||||
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotoc.map)
|
||||
endif()
|
||||
target_link_libraries(libprotoc PRIVATE libprotobuf)
|
||||
if(protobuf_BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(libprotoc
|
||||
PUBLIC PROTOBUF_USE_DLLS
|
||||
PRIVATE LIBPROTOC_EXPORTS)
|
||||
@ -127,6 +24,7 @@ endif()
|
||||
set_target_properties(libprotoc PROPERTIES
|
||||
COMPILE_DEFINITIONS LIBPROTOC_EXPORTS
|
||||
VERSION ${protobuf_VERSION}
|
||||
SOVERSION 32
|
||||
OUTPUT_NAME ${LIB_PREFIX}protoc
|
||||
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
|
||||
add_library(protobuf::libprotoc ALIAS libprotoc)
|
||||
|
@ -11,7 +11,7 @@ function(protobuf_generate)
|
||||
include(CMakeParseArguments)
|
||||
|
||||
set(_options APPEND_PATH)
|
||||
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN)
|
||||
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS DEPENDENCIES)
|
||||
if(COMMAND target_sources)
|
||||
list(APPEND _singleargs TARGET)
|
||||
endif()
|
||||
@ -39,9 +39,18 @@ function(protobuf_generate)
|
||||
endif()
|
||||
|
||||
if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp)
|
||||
set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:")
|
||||
set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}")
|
||||
endif()
|
||||
|
||||
|
||||
foreach(_option ${_dll_export_decl} ${protobuf_generate_PLUGIN_OPTIONS})
|
||||
# append comma - not using CMake lists and string replacement as users
|
||||
# might have semicolons in options
|
||||
if(_plugin_options)
|
||||
set( _plugin_options "${_plugin_options},")
|
||||
endif()
|
||||
set(_plugin_options "${_plugin_options}${_option}")
|
||||
endforeach()
|
||||
|
||||
if(protobuf_generate_PLUGIN)
|
||||
set(_plugin "--plugin=${protobuf_generate_PLUGIN}")
|
||||
endif()
|
||||
@ -75,10 +84,10 @@ function(protobuf_generate)
|
||||
# Create an include path for each file specified
|
||||
foreach(_file ${protobuf_generate_PROTOS})
|
||||
get_filename_component(_abs_file ${_file} ABSOLUTE)
|
||||
get_filename_component(_abs_path ${_abs_file} PATH)
|
||||
list(FIND _protobuf_include_path ${_abs_path} _contains_already)
|
||||
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
||||
list(FIND _protobuf_include_path ${_abs_dir} _contains_already)
|
||||
if(${_contains_already} EQUAL -1)
|
||||
list(APPEND _protobuf_include_path -I ${_abs_path})
|
||||
list(APPEND _protobuf_include_path -I ${_abs_dir})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@ -127,12 +136,20 @@ function(protobuf_generate)
|
||||
endforeach()
|
||||
list(APPEND _generated_srcs_all ${_generated_srcs})
|
||||
|
||||
set(_comment "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}")
|
||||
if(protobuf_generate_PROTOC_OPTIONS)
|
||||
set(_comment "${_comment}, protoc-options: ${protobuf_generate_PROTOC_OPTIONS}")
|
||||
endif()
|
||||
if(_plugin_options)
|
||||
set(_comment "${_comment}, plugin-options: ${_plugin_options}")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${_generated_srcs}
|
||||
COMMAND protobuf::protoc
|
||||
ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file}
|
||||
DEPENDS ${_abs_file} protobuf::protoc
|
||||
COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}. Custom options: ${protobuf_generate_PROTOC_OPTIONS}"
|
||||
COMMAND protobuf::protoc
|
||||
ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file}
|
||||
DEPENDS ${_abs_file} protobuf::protoc ${protobuf_generate_DEPENDENCIES}
|
||||
COMMENT ${_comment}
|
||||
VERBATIM )
|
||||
endforeach()
|
||||
|
||||
|
@ -94,7 +94,7 @@ function(_protobuf_find_libraries name filename)
|
||||
elseif(${name}_LIBRARY)
|
||||
# Honor cache entry used by CMake 3.5 and lower.
|
||||
set(${name}_LIBRARIES "${${name}_LIBRARY}" PARENT_SCOPE)
|
||||
else()
|
||||
elseif(TARGET protobuf::lib${filename})
|
||||
get_target_property(${name}_LIBRARY_RELEASE protobuf::lib${filename}
|
||||
LOCATION_RELEASE)
|
||||
get_target_property(${name}_LIBRARY_RELWITHDEBINFO protobuf::lib${filename}
|
||||
@ -134,23 +134,25 @@ get_target_property(Protobuf_INCLUDE_DIRS protobuf::libprotobuf
|
||||
INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
# Set the protoc Executable
|
||||
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
|
||||
IMPORTED_LOCATION_RELEASE)
|
||||
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
if(NOT Protobuf_PROTOC_EXECUTABLE AND TARGET protobuf::protoc)
|
||||
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
|
||||
IMPORTED_LOCATION_RELWITHDEBINFO)
|
||||
endif()
|
||||
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
|
||||
IMPORTED_LOCATION_MINSIZEREL)
|
||||
endif()
|
||||
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
|
||||
IMPORTED_LOCATION_DEBUG)
|
||||
endif()
|
||||
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
|
||||
IMPORTED_LOCATION_NOCONFIG)
|
||||
IMPORTED_LOCATION_RELEASE)
|
||||
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
|
||||
IMPORTED_LOCATION_RELWITHDEBINFO)
|
||||
endif()
|
||||
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
|
||||
IMPORTED_LOCATION_MINSIZEREL)
|
||||
endif()
|
||||
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
|
||||
IMPORTED_LOCATION_DEBUG)
|
||||
endif()
|
||||
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
|
||||
IMPORTED_LOCATION_NOCONFIG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Version info variable
|
||||
|
@ -1,15 +1,12 @@
|
||||
set(protoc_files
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/main.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/main.cc
|
||||
)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(protoc_rc_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
||||
add_executable(protoc ${protoc_files} ${protobuf_version_rc_file})
|
||||
target_link_libraries(protoc
|
||||
libprotoc
|
||||
libprotobuf
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable(protoc ${protoc_files} ${protoc_rc_files})
|
||||
target_link_libraries(protoc libprotoc libprotobuf)
|
||||
add_executable(protobuf::protoc ALIAS protoc)
|
||||
|
||||
set_target_properties(protoc PROPERTIES
|
||||
|
@ -1,96 +1,64 @@
|
||||
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/../third_party/googletest/CMakeLists.txt")
|
||||
message(FATAL_ERROR
|
||||
"Cannot find third_party/googletest directory that's needed to "
|
||||
"build tests. If you use git, make sure you have cloned submodules:\n"
|
||||
" git submodule update --init --recursive\n"
|
||||
"If instead you want to skip tests, run cmake with:\n"
|
||||
" cmake -Dprotobuf_BUILD_TESTS=OFF\n")
|
||||
endif()
|
||||
option(protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF)
|
||||
|
||||
option(protobuf_TEST_XML_OUTDIR "Output directory for XML logs from tests." "")
|
||||
|
||||
option(protobuf_ABSOLUTE_TEST_PLUGIN_PATH
|
||||
"Using absolute test_plugin path in tests" ON)
|
||||
mark_as_advanced(protobuf_ABSOLUTE_TEST_PLUGIN_PATH)
|
||||
|
||||
set(googlemock_source_dir "${protobuf_source_dir}/third_party/googletest/googlemock")
|
||||
set(googletest_source_dir "${protobuf_source_dir}/third_party/googletest/googletest")
|
||||
include_directories(
|
||||
${googlemock_source_dir}
|
||||
${googletest_source_dir}
|
||||
${googletest_source_dir}/include
|
||||
${googlemock_source_dir}/include
|
||||
)
|
||||
if (protobuf_USE_EXTERNAL_GTEST)
|
||||
find_package(GTest REQUIRED)
|
||||
else()
|
||||
if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/googletest/CMakeLists.txt")
|
||||
message(FATAL_ERROR
|
||||
"Cannot find third_party/googletest directory that's needed to "
|
||||
"build tests. If you use git, make sure you have cloned submodules:\n"
|
||||
" git submodule update --init --recursive\n"
|
||||
"If instead you want to skip tests, run cmake with:\n"
|
||||
" cmake -Dprotobuf_BUILD_TESTS=OFF\n")
|
||||
endif()
|
||||
|
||||
add_library(gmock STATIC
|
||||
"${googlemock_source_dir}/src/gmock-all.cc"
|
||||
"${googletest_source_dir}/src/gtest-all.cc"
|
||||
)
|
||||
target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT})
|
||||
add_library(gmock_main STATIC "${googlemock_source_dir}/src/gmock_main.cc")
|
||||
target_link_libraries(gmock_main gmock)
|
||||
set(googlemock_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googlemock")
|
||||
set(googletest_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googletest")
|
||||
include_directories(
|
||||
${googlemock_source_dir}
|
||||
${googletest_source_dir}
|
||||
${googletest_source_dir}/include
|
||||
${googlemock_source_dir}/include
|
||||
)
|
||||
|
||||
add_library(gmock STATIC
|
||||
"${googlemock_source_dir}/src/gmock-all.cc"
|
||||
"${googletest_source_dir}/src/gtest-all.cc"
|
||||
)
|
||||
target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT})
|
||||
add_library(gmock_main STATIC "${googlemock_source_dir}/src/gmock_main.cc")
|
||||
target_link_libraries(gmock_main gmock)
|
||||
|
||||
add_library(GTest::gmock ALIAS gmock)
|
||||
add_library(GTest::gmock_main ALIAS gmock_main)
|
||||
endif()
|
||||
|
||||
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
|
||||
|
||||
set(lite_test_protos
|
||||
google/protobuf/map_lite_unittest.proto
|
||||
google/protobuf/unittest_import_lite.proto
|
||||
google/protobuf/unittest_import_public_lite.proto
|
||||
google/protobuf/unittest_lite.proto
|
||||
${protobuf_lite_test_protos_proto_srcs}
|
||||
)
|
||||
|
||||
set(tests_protos
|
||||
google/protobuf/any_test.proto
|
||||
google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto
|
||||
google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto
|
||||
google/protobuf/map_proto2_unittest.proto
|
||||
google/protobuf/map_unittest.proto
|
||||
google/protobuf/unittest.proto
|
||||
google/protobuf/unittest_arena.proto
|
||||
google/protobuf/unittest_custom_options.proto
|
||||
google/protobuf/unittest_drop_unknown_fields.proto
|
||||
google/protobuf/unittest_embed_optimize_for.proto
|
||||
google/protobuf/unittest_empty.proto
|
||||
google/protobuf/unittest_import.proto
|
||||
google/protobuf/unittest_import_public.proto
|
||||
google/protobuf/unittest_lazy_dependencies.proto
|
||||
google/protobuf/unittest_lazy_dependencies_custom_option.proto
|
||||
google/protobuf/unittest_lazy_dependencies_enum.proto
|
||||
google/protobuf/unittest_lite_imports_nonlite.proto
|
||||
google/protobuf/unittest_mset.proto
|
||||
google/protobuf/unittest_mset_wire_format.proto
|
||||
google/protobuf/unittest_no_field_presence.proto
|
||||
google/protobuf/unittest_no_generic_services.proto
|
||||
google/protobuf/unittest_optimize_for.proto
|
||||
google/protobuf/unittest_preserve_unknown_enum.proto
|
||||
google/protobuf/unittest_preserve_unknown_enum2.proto
|
||||
google/protobuf/unittest_proto3.proto
|
||||
google/protobuf/unittest_proto3_arena.proto
|
||||
google/protobuf/unittest_proto3_arena_lite.proto
|
||||
google/protobuf/unittest_proto3_lite.proto
|
||||
google/protobuf/unittest_proto3_optional.proto
|
||||
google/protobuf/unittest_well_known_types.proto
|
||||
google/protobuf/util/internal/testdata/anys.proto
|
||||
google/protobuf/util/internal/testdata/books.proto
|
||||
google/protobuf/util/internal/testdata/default_value.proto
|
||||
google/protobuf/util/internal/testdata/default_value_test.proto
|
||||
google/protobuf/util/internal/testdata/field_mask.proto
|
||||
google/protobuf/util/internal/testdata/maps.proto
|
||||
google/protobuf/util/internal/testdata/oneofs.proto
|
||||
google/protobuf/util/internal/testdata/proto3.proto
|
||||
google/protobuf/util/internal/testdata/struct.proto
|
||||
google/protobuf/util/internal/testdata/timestamp_duration.proto
|
||||
google/protobuf/util/internal/testdata/wrappers.proto
|
||||
google/protobuf/util/json_format.proto
|
||||
google/protobuf/util/json_format_proto3.proto
|
||||
google/protobuf/util/message_differencer_unittest.proto
|
||||
${protobuf_test_protos_proto_srcs}
|
||||
${compiler_test_protos_files}
|
||||
${util_test_protos_files}
|
||||
)
|
||||
|
||||
macro(compile_proto_file filename)
|
||||
get_filename_component(dirname ${filename} PATH)
|
||||
get_filename_component(basename ${filename} NAME_WE)
|
||||
string(REPLACE .proto .pb.cc pb_file ${filename})
|
||||
add_custom_command(
|
||||
OUTPUT ${protobuf_source_dir}/src/${dirname}/${basename}.pb.cc
|
||||
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/${dirname}/${basename}.proto
|
||||
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/${dirname}/${basename}.proto
|
||||
--proto_path=${protobuf_source_dir}/src
|
||||
--cpp_out=${protobuf_source_dir}/src
|
||||
OUTPUT ${pb_file}
|
||||
DEPENDS ${protobuf_PROTOC_EXE} ${filename}
|
||||
COMMAND ${protobuf_PROTOC_EXE} ${filename}
|
||||
--proto_path=${protobuf_SOURCE_DIR}/src
|
||||
--cpp_out=${protobuf_SOURCE_DIR}/src
|
||||
--experimental_allow_proto3_optional
|
||||
)
|
||||
endmacro(compile_proto_file)
|
||||
@ -98,112 +66,38 @@ endmacro(compile_proto_file)
|
||||
set(lite_test_proto_files)
|
||||
foreach(proto_file ${lite_test_protos})
|
||||
compile_proto_file(${proto_file})
|
||||
string(REPLACE .proto .pb.cc pb_file ${proto_file})
|
||||
set(lite_test_proto_files ${lite_test_proto_files}
|
||||
${protobuf_source_dir}/src/${pb_file})
|
||||
set(lite_test_proto_files ${lite_test_proto_files} ${pb_file})
|
||||
endforeach(proto_file)
|
||||
|
||||
set(tests_proto_files)
|
||||
foreach(proto_file ${tests_protos})
|
||||
compile_proto_file(${proto_file})
|
||||
string(REPLACE .proto .pb.cc pb_file ${proto_file})
|
||||
set(tests_proto_files ${tests_proto_files}
|
||||
${protobuf_source_dir}/src/${pb_file})
|
||||
set(tests_proto_files ${tests_proto_files} ${pb_file})
|
||||
endforeach(proto_file)
|
||||
|
||||
set(common_lite_test_files
|
||||
${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/map_lite_test_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_util_lite.cc
|
||||
)
|
||||
add_library(protobuf-lite-test-common STATIC
|
||||
${lite_test_util_srcs} ${lite_test_proto_files})
|
||||
target_link_libraries(protobuf-lite-test-common libprotobuf-lite GTest::gmock)
|
||||
|
||||
set(common_test_files
|
||||
${common_lite_test_files}
|
||||
${protobuf_source_dir}/src/google/protobuf/map_test_util.inc
|
||||
${protobuf_source_dir}/src/google/protobuf/reflection_tester.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_util.inc
|
||||
${protobuf_source_dir}/src/google/protobuf/testing/file.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc
|
||||
${lite_test_util_srcs}
|
||||
${test_util_hdrs}
|
||||
${test_util_srcs}
|
||||
${mock_code_generator_srcs}
|
||||
${testing_srcs}
|
||||
)
|
||||
|
||||
add_library(protobuf-test-common STATIC
|
||||
${common_test_files} ${tests_proto_files})
|
||||
target_link_libraries(protobuf-test-common libprotobuf GTest::gmock)
|
||||
|
||||
set(tests_files
|
||||
${protobuf_source_dir}/src/google/protobuf/any_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/arena_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/arenastring_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.inc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/metadata_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/importer_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_plugin_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/parser_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_plugin_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/descriptor_database_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/descriptor_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/drop_unknown_fields_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/dynamic_message_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/extension_set_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/inlined_string_field_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/coded_stream_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/io_win32_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/printer_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/tokenizer_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/map_field_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/map_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/map_test.inc
|
||||
${protobuf_source_dir}/src/google/protobuf/message_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/message_unittest.inc
|
||||
${protobuf_source_dir}/src/google/protobuf/no_field_presence_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/preserve_unknown_enum_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/proto3_arena_lite_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/proto3_arena_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/proto3_lite_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/proto3_lite_unittest.inc
|
||||
${protobuf_source_dir}/src/google/protobuf/reflection_ops_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/repeated_field_reflection_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/repeated_field_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/common_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/int128_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/status_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/statusor_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/strutil_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/template_util_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/time_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/text_format_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/unknown_field_set_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/field_comparator_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/field_mask_util_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/json_util_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/message_differencer_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/time_util_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util_test.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/well_known_types_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.inc
|
||||
${protobuf_test_files}
|
||||
${compiler_test_files}
|
||||
${annotation_test_util_srcs}
|
||||
${io_test_files}
|
||||
${util_test_files}
|
||||
${stubs_test_files}
|
||||
)
|
||||
|
||||
if(protobuf_ABSOLUTE_TEST_PLUGIN_PATH)
|
||||
@ -221,32 +115,43 @@ if(MINGW)
|
||||
|
||||
endif()
|
||||
|
||||
add_executable(tests ${tests_files} ${common_test_files} ${tests_proto_files} ${lite_test_proto_files})
|
||||
target_link_libraries(tests libprotoc libprotobuf gmock_main)
|
||||
if(protobuf_TEST_XML_OUTDIR)
|
||||
if(NOT "${protobuf_TEST_XML_OUTDIR}" MATCHES "[/\\]$")
|
||||
string(APPEND protobuf_TEST_XML_OUTDIR "/")
|
||||
endif()
|
||||
set(protobuf_GTEST_ARGS "--gtest_output=xml:${protobuf_TEST_XML_OUTDIR}")
|
||||
else()
|
||||
set(protobuf_GTEST_ARGS)
|
||||
endif()
|
||||
|
||||
add_executable(tests ${tests_files})
|
||||
if (MSVC)
|
||||
target_compile_options(tests PRIVATE
|
||||
/wd4146 # unary minus operator applied to unsigned type, result still unsigned
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(tests protobuf-lite-test-common protobuf-test-common libprotoc libprotobuf GTest::gmock_main)
|
||||
|
||||
set(test_plugin_files
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/test_plugin.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/testing/file.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/testing/file.h
|
||||
${test_plugin_files}
|
||||
${mock_code_generator_srcs}
|
||||
${testing_srcs}
|
||||
)
|
||||
|
||||
add_executable(test_plugin ${test_plugin_files})
|
||||
target_link_libraries(test_plugin libprotoc libprotobuf gmock)
|
||||
target_link_libraries(test_plugin libprotoc libprotobuf GTest::gmock)
|
||||
|
||||
set(lite_test_files
|
||||
${protobuf_source_dir}/src/google/protobuf/lite_unittest.cc
|
||||
)
|
||||
add_executable(lite-test ${lite_test_files} ${common_lite_test_files} ${lite_test_proto_files})
|
||||
target_link_libraries(lite-test libprotobuf-lite gmock_main)
|
||||
add_executable(lite-test ${protobuf_lite_test_files})
|
||||
target_link_libraries(lite-test protobuf-lite-test-common libprotobuf-lite GTest::gmock_main)
|
||||
|
||||
set(lite_arena_test_files
|
||||
${protobuf_source_dir}/src/google/protobuf/lite_arena_unittest.cc
|
||||
)
|
||||
add_executable(lite-arena-test ${lite_arena_test_files} ${common_lite_test_files} ${lite_test_proto_files})
|
||||
target_link_libraries(lite-arena-test libprotobuf-lite gmock_main)
|
||||
add_test(NAME lite-test
|
||||
COMMAND lite-test ${protobuf_GTEST_ARGS})
|
||||
|
||||
add_custom_target(check
|
||||
COMMAND tests
|
||||
DEPENDS tests test_plugin
|
||||
WORKING_DIRECTORY ${protobuf_source_dir})
|
||||
WORKING_DIRECTORY ${protobuf_SOURCE_DIR})
|
||||
|
||||
add_test(NAME check
|
||||
COMMAND tests ${protobuf_GTEST_ARGS}
|
||||
WORKING_DIRECTORY "${protobuf_SOURCE_DIR}")
|
||||
|
@ -17,7 +17,7 @@ AC_PREREQ(2.59)
|
||||
# In the SVN trunk, the version should always be the next anticipated release
|
||||
# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
|
||||
# the size of one file name in the dist tarfile over the 99-char limit.)
|
||||
AC_INIT([Protocol Buffers],[3.19.1],[protobuf@googlegroups.com],[protobuf])
|
||||
AC_INIT([Protocol Buffers],[3.21.1],[protobuf@googlegroups.com],[protobuf])
|
||||
|
||||
AM_MAINTAINER_MODE([enable])
|
||||
|
||||
@ -31,7 +31,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_ARG_VAR(DIST_LANG, [language to include in the distribution package (i.e., make dist)])
|
||||
case "$DIST_LANG" in
|
||||
"") DIST_LANG=all ;;
|
||||
all | cpp | csharp | java | python | javanano | objectivec | ruby | js | php) ;;
|
||||
all | cpp | csharp | java | python | javanano | objectivec | ruby | php) ;;
|
||||
*) AC_MSG_FAILURE([unknown language: $DIST_LANG]) ;;
|
||||
esac
|
||||
AC_SUBST(DIST_LANG)
|
||||
@ -80,7 +80,7 @@ AC_LANG([C++])
|
||||
ACX_USE_SYSTEM_EXTENSIONS
|
||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
|
||||
AC_PROG_OBJC
|
||||
AS_CASE([$target_os], [darwin*], [AC_PROG_OBJC], [AM_CONDITIONAL([am__fastdepOBJC], [false])])
|
||||
|
||||
# test_util.cc takes forever to compile with GCC and optimization turned on.
|
||||
AC_MSG_CHECKING([C++ compiler flags...])
|
||||
|
183
conformance/BUILD.bazel
Normal file
183
conformance/BUILD.bazel
Normal file
@ -0,0 +1,183 @@
|
||||
# Conformance testing for Protobuf.
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library")
|
||||
load(
|
||||
"@rules_pkg//:mappings.bzl",
|
||||
"pkg_attributes",
|
||||
"pkg_filegroup",
|
||||
"pkg_files",
|
||||
"strip_prefix",
|
||||
)
|
||||
|
||||
exports_files([
|
||||
"conformance_test_runner.sh",
|
||||
"failure_list_java.txt",
|
||||
"failure_list_java_lite.txt",
|
||||
"text_format_failure_list_java.txt",
|
||||
"text_format_failure_list_java_lite.txt",
|
||||
])
|
||||
|
||||
cc_proto_library(
|
||||
name = "test_messages_proto2_proto_cc",
|
||||
deps = ["//:test_messages_proto2_proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "test_messages_proto3_proto_cc",
|
||||
deps = ["//:test_messages_proto3_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "conformance_proto",
|
||||
srcs = ["conformance.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "conformance_proto_cc",
|
||||
deps = [":conformance_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "conformance_java_proto",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":conformance_proto"],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "conformance_java_proto_lite",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":conformance_proto"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "jsoncpp",
|
||||
srcs = ["third_party/jsoncpp/jsoncpp.cpp"],
|
||||
hdrs = ["third_party/jsoncpp/json.h"],
|
||||
includes = ["."],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "conformance_test",
|
||||
srcs = [
|
||||
"conformance_test.cc",
|
||||
"conformance_test_runner.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"conformance_test.h",
|
||||
],
|
||||
includes = ["."],
|
||||
deps = [":conformance_proto_cc"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "binary_json_conformance_suite",
|
||||
srcs = ["binary_json_conformance_suite.cc"],
|
||||
hdrs = ["binary_json_conformance_suite.h"],
|
||||
deps = [
|
||||
":conformance_test",
|
||||
":jsoncpp",
|
||||
":test_messages_proto2_proto_cc",
|
||||
":test_messages_proto3_proto_cc",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "text_format_conformance_suite",
|
||||
srcs = ["text_format_conformance_suite.cc"],
|
||||
hdrs = ["text_format_conformance_suite.h"],
|
||||
deps = [
|
||||
":conformance_test",
|
||||
":test_messages_proto2_proto_cc",
|
||||
":test_messages_proto3_proto_cc",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "conformance_test_runner",
|
||||
srcs = ["conformance_test_main.cc"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":binary_json_conformance_suite",
|
||||
":conformance_test",
|
||||
":text_format_conformance_suite",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "conformance_java",
|
||||
srcs = ["ConformanceJava.java"],
|
||||
main_class = "ConformanceJava",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
":conformance_java_proto",
|
||||
"//:protobuf_java",
|
||||
"//:protobuf_java_util",
|
||||
"//:test_messages_proto2_java_proto",
|
||||
"//:test_messages_proto3_java_proto",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "conformance_java_lite",
|
||||
srcs = ["ConformanceJavaLite.java"],
|
||||
main_class = "ConformanceJavaLite",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
":conformance_java_proto_lite",
|
||||
"//:protobuf_java_util",
|
||||
"//:protobuf_javalite",
|
||||
"//:test_messages_proto2_java_proto_lite",
|
||||
"//:test_messages_proto3_java_proto_lite",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all_files",
|
||||
srcs = glob(["**/*"]),
|
||||
visibility = ["//src/google/protobuf/compiler/csharp:__pkg__"],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = glob(
|
||||
["**/*"],
|
||||
exclude = [
|
||||
# Handled by dist_scripts:
|
||||
"conformance_test_runner.sh",
|
||||
|
||||
# The following are not in autotools dist:
|
||||
"autoload.php",
|
||||
"conformance_nodejs.js",
|
||||
"failure_list_jruby.txt",
|
||||
"update_failure_list.py",
|
||||
],
|
||||
),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_scripts",
|
||||
srcs = ["conformance_test_runner.sh"],
|
||||
attributes = pkg_attributes(mode = "0555"),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
||||
|
||||
pkg_filegroup(
|
||||
name = "all_dist_files",
|
||||
srcs = [
|
||||
":dist_files",
|
||||
":dist_scripts",
|
||||
],
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
@ -229,11 +229,12 @@ class ConformanceJava {
|
||||
}
|
||||
|
||||
private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) {
|
||||
com.google.protobuf.AbstractMessage testMessage;
|
||||
AbstractMessage testMessage;
|
||||
String messageType = request.getMessageType();
|
||||
boolean isProto3 =
|
||||
request.getMessageType().equals("protobuf_test_messages.proto3.TestAllTypesProto3");
|
||||
messageType.equals("protobuf_test_messages.proto3.TestAllTypesProto3");
|
||||
boolean isProto2 =
|
||||
request.getMessageType().equals("protobuf_test_messages.proto2.TestAllTypesProto2");
|
||||
messageType.equals("protobuf_test_messages.proto2.TestAllTypesProto2");
|
||||
|
||||
switch (request.getPayloadCase()) {
|
||||
case PROTOBUF_PAYLOAD:
|
||||
@ -263,7 +264,8 @@ class ConformanceJava {
|
||||
.build();
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Protobuf request doesn't have specific payload type.");
|
||||
throw new IllegalArgumentException(
|
||||
"Protobuf request has unexpected payload type: " + messageType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -286,7 +288,8 @@ class ConformanceJava {
|
||||
parser.merge(request.getJsonPayload(), builder);
|
||||
testMessage = builder.build();
|
||||
} else {
|
||||
throw new RuntimeException("Protobuf request doesn't have specific payload type.");
|
||||
throw new IllegalArgumentException(
|
||||
"Protobuf request has unexpected payload type: " + messageType);
|
||||
}
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
return Conformance.ConformanceResponse.newBuilder()
|
||||
@ -320,24 +323,25 @@ class ConformanceJava {
|
||||
.build();
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Protobuf request doesn't have specific payload type.");
|
||||
throw new IllegalArgumentException(
|
||||
"Protobuf request has unexpected payload type: " + messageType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PAYLOAD_NOT_SET:
|
||||
{
|
||||
throw new RuntimeException("Request didn't have payload.");
|
||||
throw new IllegalArgumentException("Request didn't have payload.");
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
throw new RuntimeException("Unexpected payload case.");
|
||||
throw new IllegalArgumentException("Unexpected payload case.");
|
||||
}
|
||||
}
|
||||
|
||||
switch (request.getRequestedOutputFormat()) {
|
||||
case UNSPECIFIED:
|
||||
throw new RuntimeException("Unspecified output format.");
|
||||
throw new IllegalArgumentException("Unspecified output format.");
|
||||
|
||||
case PROTOBUF:
|
||||
{
|
||||
@ -361,12 +365,12 @@ class ConformanceJava {
|
||||
|
||||
case TEXT_FORMAT:
|
||||
return Conformance.ConformanceResponse.newBuilder()
|
||||
.setTextPayload(TextFormat.printToString(testMessage))
|
||||
.setTextPayload(TextFormat.printer().printToString(testMessage))
|
||||
.build();
|
||||
|
||||
default:
|
||||
{
|
||||
throw new RuntimeException("Unexpected request output.");
|
||||
throw new IllegalArgumentException("Unexpected request output.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,9 +260,9 @@ if USE_EXTERNAL_PROTOC
|
||||
|
||||
# Some implementations include pre-generated versions of well-known types.
|
||||
protoc_middleman: $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf
|
||||
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --objc_out=. --python_out=. --php_out=. --js_out=import_style=commonjs,binary:. $(conformance_protoc_inputs)
|
||||
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --objc_out=. --python_out=. --js_out=import_style=commonjs,binary:. $(conformance_proto2_protoc_inputs)
|
||||
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --python_out=. --js_out=import_style=commonjs,binary:google-protobuf $(well_known_type_protoc_inputs)
|
||||
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --objc_out=. --python_out=. --php_out=. $(conformance_protoc_inputs)
|
||||
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --objc_out=. --python_out=. $(conformance_proto2_protoc_inputs)
|
||||
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --python_out=. $(well_known_type_protoc_inputs)
|
||||
## $(PROTOC) -I$(srcdir) -I$(top_srcdir) --java_out=lite:lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs)
|
||||
touch protoc_middleman
|
||||
|
||||
@ -272,9 +272,9 @@ else
|
||||
# relative to srcdir, which may not be the same as the current directory when
|
||||
# building out-of-tree.
|
||||
protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf
|
||||
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --objc_out=$$oldpwd --python_out=$$oldpwd --php_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_protoc_inputs) )
|
||||
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --objc_out=$$oldpwd --python_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_proto2_protoc_inputs) )
|
||||
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --python_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd/google-protobuf $(well_known_type_protoc_inputs) )
|
||||
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --objc_out=$$oldpwd --python_out=$$oldpwd --php_out=$$oldpwd $(conformance_protoc_inputs) )
|
||||
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --objc_out=$$oldpwd --python_out=$$oldpwd $(conformance_proto2_protoc_inputs) )
|
||||
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --python_out=$$oldpwd $(well_known_type_protoc_inputs) )
|
||||
## @mkdir -p lite
|
||||
## oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --java_out=lite:$$oldpwd/lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs) )
|
||||
touch protoc_middleman
|
||||
@ -316,7 +316,7 @@ conformance-java-lite: javac_middleman_lite
|
||||
conformance-csharp: $(other_language_protoc_outputs)
|
||||
@echo "Writing shortcut script conformance-csharp..."
|
||||
@echo '#! /bin/sh' > conformance-csharp
|
||||
@echo 'dotnet ../csharp/src/Google.Protobuf.Conformance/bin/Release/netcoreapp2.1/Google.Protobuf.Conformance.dll "$$@"' >> conformance-csharp
|
||||
@echo 'dotnet ../csharp/src/Google.Protobuf.Conformance/bin/Release/netcoreapp3.1/Google.Protobuf.Conformance.dll "$$@"' >> conformance-csharp
|
||||
@chmod +x conformance-csharp
|
||||
|
||||
conformance-php:
|
||||
@ -364,9 +364,6 @@ test_python: protoc_middleman conformance-test-runner
|
||||
test_python_cpp: protoc_middleman conformance-test-runner
|
||||
./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt --text_format_failure_list text_format_failure_list_python_cpp.txt ./conformance_python.py
|
||||
|
||||
test_nodejs: protoc_middleman conformance-test-runner $(other_language_protoc_outputs)
|
||||
NODE_PATH=../js:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_js.txt ./conformance_nodejs.js
|
||||
|
||||
if OBJC_CONFORMANCE_TEST
|
||||
|
||||
test_objc: protoc_middleman conformance-test-runner conformance-objc
|
||||
|
@ -49,7 +49,7 @@ Running the tests for other languages
|
||||
Most of the languages in the Protobuf source tree are set up to run
|
||||
conformance tests. However some of them are more tricky to set up
|
||||
properly. See `tests.sh` in the base of the repository to see how
|
||||
Travis runs the tests.
|
||||
Kokoro runs the tests.
|
||||
|
||||
Testing other Protocol Buffer implementations
|
||||
---------------------------------------------
|
||||
@ -57,10 +57,10 @@ Testing other Protocol Buffer implementations
|
||||
To run these tests against a new Protocol Buffers implementation, write a
|
||||
program in your language that uses the protobuf implementation you want
|
||||
to test. This program should implement the testing protocol defined in
|
||||
[conformance.proto](https://github.com/protocolbuffers/protobuf/blob/master/conformance/conformance.proto).
|
||||
[conformance.proto](https://github.com/protocolbuffers/protobuf/blob/main/conformance/conformance.proto).
|
||||
This is designed to be as easy as possible: the C++ version is only
|
||||
150 lines and is a good example for what this program should look like
|
||||
(see [conformance_cpp.cc](https://github.com/protocolbuffers/protobuf/blob/master/conformance/conformance_cpp.cc)).
|
||||
(see [conformance_cpp.cc](https://github.com/protocolbuffers/protobuf/blob/main/conformance/conformance_cpp.cc)).
|
||||
The program only needs to be able to read from stdin and write to stdout.
|
||||
|
||||
Portability
|
||||
|
@ -2226,11 +2226,11 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForNonRepeatedTypes() {
|
||||
"optional_aliased_enum: ALIAS_BAZ");
|
||||
RunValidJsonTest(
|
||||
"EnumFieldWithAliasUseAlias", REQUIRED,
|
||||
R"({"optionalAliasedEnum": "QUX"})",
|
||||
R"({"optionalAliasedEnum": "MOO"})",
|
||||
"optional_aliased_enum: ALIAS_BAZ");
|
||||
RunValidJsonTest(
|
||||
"EnumFieldWithAliasLowerCase", REQUIRED,
|
||||
R"({"optionalAliasedEnum": "qux"})",
|
||||
R"({"optionalAliasedEnum": "moo"})",
|
||||
"optional_aliased_enum: ALIAS_BAZ");
|
||||
RunValidJsonTest(
|
||||
"EnumFieldWithAliasDifferentCase", REQUIRED,
|
||||
|
@ -32,165 +32,176 @@
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <google/protobuf/stubs/logging.h>
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include <google/protobuf/util/json_util.h>
|
||||
#include <google/protobuf/util/type_resolver_util.h>
|
||||
#include <google/protobuf/stubs/status.h>
|
||||
#include <google/protobuf/stubs/statusor.h>
|
||||
#include "conformance.pb.h"
|
||||
#include "conformance.pb.h"
|
||||
#include <google/protobuf/test_messages_proto2.pb.h>
|
||||
#include <google/protobuf/test_messages_proto3.pb.h>
|
||||
#include <google/protobuf/test_messages_proto3.pb.h>
|
||||
#include <google/protobuf/util/type_resolver.h>
|
||||
#include <google/protobuf/stubs/status.h>
|
||||
#include <google/protobuf/stubs/status_macros.h>
|
||||
|
||||
using conformance::ConformanceRequest;
|
||||
using conformance::ConformanceResponse;
|
||||
using google::protobuf::Descriptor;
|
||||
using google::protobuf::DescriptorPool;
|
||||
using google::protobuf::Message;
|
||||
using google::protobuf::MessageFactory;
|
||||
using google::protobuf::TextFormat;
|
||||
using google::protobuf::util::BinaryToJsonString;
|
||||
using google::protobuf::util::JsonParseOptions;
|
||||
using google::protobuf::util::JsonToBinaryString;
|
||||
using google::protobuf::util::NewTypeResolverForDescriptorPool;
|
||||
using google::protobuf::util::TypeResolver;
|
||||
using protobuf_test_messages::proto3::TestAllTypesProto3;
|
||||
using protobuf_test_messages::proto2::TestAllTypesProto2;
|
||||
using std::string;
|
||||
|
||||
static const char kTypeUrlPrefix[] = "type.googleapis.com";
|
||||
|
||||
const char* kFailures[] = {
|
||||
};
|
||||
|
||||
static string GetTypeUrl(const Descriptor* message) {
|
||||
return string(kTypeUrlPrefix) + "/" + message->full_name();
|
||||
}
|
||||
|
||||
int test_count = 0;
|
||||
bool verbose = false;
|
||||
TypeResolver* type_resolver;
|
||||
string* type_url;
|
||||
// Must be included last.
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
namespace {
|
||||
using ::conformance::ConformanceRequest;
|
||||
using ::conformance::ConformanceResponse;
|
||||
using ::google::protobuf::util::BinaryToJsonString;
|
||||
using ::google::protobuf::util::JsonParseOptions;
|
||||
using ::google::protobuf::util::JsonToBinaryString;
|
||||
using ::google::protobuf::util::NewTypeResolverForDescriptorPool;
|
||||
using ::google::protobuf::util::TypeResolver;
|
||||
using ::protobuf_test_messages::proto2::TestAllTypesProto2;
|
||||
using ::protobuf_test_messages::proto3::TestAllTypesProto3;
|
||||
|
||||
using util::Status;
|
||||
|
||||
bool CheckedRead(int fd, void *buf, size_t len) {
|
||||
size_t ofs = 0;
|
||||
util::Status ReadFd(int fd, char* buf, size_t len) {
|
||||
while (len > 0) {
|
||||
ssize_t bytes_read = read(fd, (char*)buf + ofs, len);
|
||||
ssize_t bytes_read = read(fd, buf, len);
|
||||
|
||||
if (bytes_read == 0) return false;
|
||||
if (bytes_read == 0) {
|
||||
return util::DataLossError("unexpected EOF");
|
||||
}
|
||||
|
||||
if (bytes_read < 0) {
|
||||
GOOGLE_LOG(FATAL) << "Error reading from test runner: " << strerror(errno);
|
||||
return util::ErrnoToStatus(errno, "error reading from test runner");
|
||||
}
|
||||
|
||||
len -= bytes_read;
|
||||
ofs += bytes_read;
|
||||
buf += bytes_read;
|
||||
}
|
||||
|
||||
return true;
|
||||
return util::OkStatus();
|
||||
}
|
||||
|
||||
void CheckedWrite(int fd, const void *buf, size_t len) {
|
||||
util::Status WriteFd(int fd, const void* buf, size_t len) {
|
||||
if (write(fd, buf, len) != len) {
|
||||
GOOGLE_LOG(FATAL) << "Error writing to test runner: " << strerror(errno);
|
||||
return util::ErrnoToStatus(errno, "error reading to test runner");
|
||||
}
|
||||
return util::OkStatus();
|
||||
}
|
||||
|
||||
void DoTest(const ConformanceRequest& request, ConformanceResponse* response) {
|
||||
Message *test_message;
|
||||
google::protobuf::LinkMessageReflection<TestAllTypesProto2>();
|
||||
google::protobuf::LinkMessageReflection<TestAllTypesProto3>();
|
||||
const Descriptor *descriptor = DescriptorPool::generated_pool()->FindMessageTypeByName(
|
||||
request.message_type());
|
||||
if (!descriptor) {
|
||||
GOOGLE_LOG(FATAL) << "No such message type: " << request.message_type();
|
||||
class Harness {
|
||||
public:
|
||||
Harness() {
|
||||
google::protobuf::LinkMessageReflection<TestAllTypesProto2>();
|
||||
google::protobuf::LinkMessageReflection<TestAllTypesProto3>();
|
||||
|
||||
resolver_.reset(NewTypeResolverForDescriptorPool(
|
||||
"type.googleapis.com", DescriptorPool::generated_pool()));
|
||||
type_url_ = StrCat("type.googleapis.com/",
|
||||
TestAllTypesProto3::GetDescriptor()->full_name());
|
||||
}
|
||||
test_message = MessageFactory::generated_factory()->GetPrototype(descriptor)->New();
|
||||
|
||||
util::StatusOr<ConformanceResponse> RunTest(
|
||||
const ConformanceRequest& request);
|
||||
|
||||
// Returns Ok(true) if we're done processing requests.
|
||||
util::StatusOr<bool> ServeConformanceRequest();
|
||||
|
||||
private:
|
||||
bool verbose_ = false;
|
||||
std::unique_ptr<TypeResolver> resolver_;
|
||||
std::string type_url_;
|
||||
};
|
||||
|
||||
util::StatusOr<ConformanceResponse> Harness::RunTest(
|
||||
const ConformanceRequest& request) {
|
||||
const Descriptor* descriptor =
|
||||
DescriptorPool::generated_pool()->FindMessageTypeByName(
|
||||
request.message_type());
|
||||
if (descriptor == nullptr) {
|
||||
return util::NotFoundError(
|
||||
StrCat("No such message type: ", request.message_type()));
|
||||
}
|
||||
|
||||
std::unique_ptr<Message> test_message(
|
||||
MessageFactory::generated_factory()->GetPrototype(descriptor)->New());
|
||||
ConformanceResponse response;
|
||||
|
||||
switch (request.payload_case()) {
|
||||
case ConformanceRequest::kProtobufPayload: {
|
||||
if (!test_message->ParseFromString(request.protobuf_payload())) {
|
||||
// Getting parse details would involve something like:
|
||||
// http://stackoverflow.com/questions/22121922/how-can-i-get-more-details-about-errors-generated-during-protobuf-parsing-c
|
||||
response->set_parse_error("Parse error (no more details available).");
|
||||
return;
|
||||
response.set_parse_error("parse error (no more details available)");
|
||||
return response;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ConformanceRequest::kJsonPayload: {
|
||||
string proto_binary;
|
||||
JsonParseOptions options;
|
||||
options.ignore_unknown_fields =
|
||||
(request.test_category() ==
|
||||
conformance::JSON_IGNORE_UNKNOWN_PARSING_TEST);
|
||||
conformance::JSON_IGNORE_UNKNOWN_PARSING_TEST);
|
||||
|
||||
std::string proto_binary;
|
||||
util::Status status =
|
||||
JsonToBinaryString(type_resolver, *type_url, request.json_payload(),
|
||||
JsonToBinaryString(resolver_.get(), type_url_, request.json_payload(),
|
||||
&proto_binary, options);
|
||||
if (!status.ok()) {
|
||||
response->set_parse_error(string("Parse error: ") +
|
||||
std::string(status.message()));
|
||||
return;
|
||||
response.set_parse_error(
|
||||
StrCat("parse error: ", status.message()));
|
||||
return response;
|
||||
}
|
||||
|
||||
if (!test_message->ParseFromString(proto_binary)) {
|
||||
response->set_runtime_error(
|
||||
"Parsing JSON generates invalid proto output.");
|
||||
return;
|
||||
response.set_runtime_error(
|
||||
"parsing JSON generated invalid proto output");
|
||||
return response;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ConformanceRequest::kTextPayload: {
|
||||
if (!TextFormat::ParseFromString(request.text_payload(), test_message)) {
|
||||
response->set_parse_error("Parse error");
|
||||
return;
|
||||
if (!TextFormat::ParseFromString(request.text_payload(),
|
||||
test_message.get())) {
|
||||
response.set_parse_error("parse error (no more details available)");
|
||||
return response;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ConformanceRequest::PAYLOAD_NOT_SET:
|
||||
GOOGLE_LOG(FATAL) << "Request didn't have payload.";
|
||||
break;
|
||||
return util::InvalidArgumentError("request didn't have payload");
|
||||
|
||||
default:
|
||||
GOOGLE_LOG(FATAL) << "unknown payload type: " << request.payload_case();
|
||||
break;
|
||||
}
|
||||
|
||||
conformance::FailureSet failures;
|
||||
if (descriptor == failures.GetDescriptor()) {
|
||||
for (const char* s : kFailures) failures.add_failure(s);
|
||||
test_message = &failures;
|
||||
return util::InvalidArgumentError(
|
||||
StrCat("unknown payload type", request.payload_case()));
|
||||
}
|
||||
|
||||
switch (request.requested_output_format()) {
|
||||
case conformance::UNSPECIFIED:
|
||||
GOOGLE_LOG(FATAL) << "Unspecified output format";
|
||||
break;
|
||||
return util::InvalidArgumentError("unspecified output format");
|
||||
|
||||
case conformance::PROTOBUF: {
|
||||
GOOGLE_CHECK(test_message->SerializeToString(
|
||||
response->mutable_protobuf_payload()));
|
||||
GOOGLE_CHECK(
|
||||
test_message->SerializeToString(response.mutable_protobuf_payload()));
|
||||
break;
|
||||
}
|
||||
|
||||
case conformance::JSON: {
|
||||
string proto_binary;
|
||||
std::string proto_binary;
|
||||
GOOGLE_CHECK(test_message->SerializeToString(&proto_binary));
|
||||
util::Status status =
|
||||
BinaryToJsonString(type_resolver, *type_url, proto_binary,
|
||||
response->mutable_json_payload());
|
||||
BinaryToJsonString(resolver_.get(), type_url_, proto_binary,
|
||||
response.mutable_json_payload());
|
||||
if (!status.ok()) {
|
||||
response->set_serialize_error(
|
||||
string("Failed to serialize JSON output: ") +
|
||||
std::string(status.message()));
|
||||
return;
|
||||
response.set_serialize_error(StrCat(
|
||||
"failed to serialize JSON output: ", status.message()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -199,70 +210,66 @@ void DoTest(const ConformanceRequest& request, ConformanceResponse* response) {
|
||||
TextFormat::Printer printer;
|
||||
printer.SetHideUnknownFields(!request.print_unknown_fields());
|
||||
GOOGLE_CHECK(printer.PrintToString(*test_message,
|
||||
response->mutable_text_payload()));
|
||||
response.mutable_text_payload()));
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
GOOGLE_LOG(FATAL) << "Unknown output format: "
|
||||
<< request.requested_output_format();
|
||||
return util::InvalidArgumentError(StrCat(
|
||||
"unknown output format", request.requested_output_format()));
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
bool DoTestIo() {
|
||||
string serialized_input;
|
||||
string serialized_output;
|
||||
util::StatusOr<bool> Harness::ServeConformanceRequest() {
|
||||
uint32_t in_len;
|
||||
if (!ReadFd(STDIN_FILENO, reinterpret_cast<char*>(&in_len), sizeof(in_len))
|
||||
.ok()) {
|
||||
// EOF means we're done.
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string serialized_input;
|
||||
serialized_input.resize(in_len);
|
||||
RETURN_IF_ERROR(ReadFd(STDIN_FILENO, serialized_input.data(), in_len));
|
||||
|
||||
ConformanceRequest request;
|
||||
ConformanceResponse response;
|
||||
uint32_t bytes;
|
||||
GOOGLE_CHECK(request.ParseFromString(serialized_input));
|
||||
|
||||
if (!CheckedRead(STDIN_FILENO, &bytes, sizeof(uint32_t))) {
|
||||
// EOF.
|
||||
return false;
|
||||
util::StatusOr<ConformanceResponse> response = RunTest(request);
|
||||
RETURN_IF_ERROR(response.status());
|
||||
|
||||
std::string serialized_output;
|
||||
response->SerializeToString(&serialized_output);
|
||||
|
||||
uint32_t out_len = static_cast<uint32_t>(serialized_output.size());
|
||||
RETURN_IF_ERROR(WriteFd(STDOUT_FILENO, &out_len, sizeof(out_len)));
|
||||
RETURN_IF_ERROR(WriteFd(STDOUT_FILENO, serialized_output.data(), out_len));
|
||||
|
||||
if (verbose_) {
|
||||
GOOGLE_LOG(INFO) << "conformance-cpp: request=" << request.ShortDebugString()
|
||||
<< ", response=" << response->ShortDebugString();
|
||||
}
|
||||
|
||||
serialized_input.resize(bytes);
|
||||
|
||||
if (!CheckedRead(STDIN_FILENO, (char*)serialized_input.c_str(), bytes)) {
|
||||
GOOGLE_LOG(ERROR) << "Unexpected EOF on stdin. " << strerror(errno);
|
||||
}
|
||||
|
||||
if (!request.ParseFromString(serialized_input)) {
|
||||
GOOGLE_LOG(FATAL) << "Parse of ConformanceRequest proto failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
DoTest(request, &response);
|
||||
|
||||
response.SerializeToString(&serialized_output);
|
||||
|
||||
bytes = serialized_output.size();
|
||||
CheckedWrite(STDOUT_FILENO, &bytes, sizeof(uint32_t));
|
||||
CheckedWrite(STDOUT_FILENO, serialized_output.c_str(), bytes);
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "conformance-cpp: request=%s, response=%s\n",
|
||||
request.ShortDebugString().c_str(),
|
||||
response.ShortDebugString().c_str());
|
||||
}
|
||||
|
||||
test_count++;
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
int main() {
|
||||
type_resolver = NewTypeResolverForDescriptorPool(
|
||||
kTypeUrlPrefix, DescriptorPool::generated_pool());
|
||||
type_url = new string(GetTypeUrl(TestAllTypesProto3::descriptor()));
|
||||
while (1) {
|
||||
if (!google::protobuf::DoTestIo()) {
|
||||
fprintf(stderr, "conformance-cpp: received EOF from test runner "
|
||||
"after %d tests, exiting\n", test_count);
|
||||
return 0;
|
||||
google::protobuf::Harness harness;
|
||||
int total_runs = 0;
|
||||
while (true) {
|
||||
auto is_done = harness.ServeConformanceRequest();
|
||||
if (!is_done.ok()) {
|
||||
GOOGLE_LOG(FATAL) << is_done.status();
|
||||
}
|
||||
if (*is_done) {
|
||||
break;
|
||||
}
|
||||
total_runs++;
|
||||
}
|
||||
GOOGLE_LOG(INFO) << "conformance-cpp: received EOF from test runner after "
|
||||
<< total_runs << " tests";
|
||||
}
|
||||
|
@ -41,11 +41,17 @@ function doTest(request) {
|
||||
var response = new conformance.ConformanceResponse();
|
||||
|
||||
try {
|
||||
if (request.getRequestedOutputFormat() === conformance.WireFormat.JSON) {
|
||||
if (request.getRequestedOutputFormat() == conformance.WireFormat.JSON) {
|
||||
response.setSkipped("JSON not supported.");
|
||||
return response;
|
||||
}
|
||||
|
||||
if (request.getRequestedOutputFormat() ==
|
||||
conformance.WireFormat.TEXT_FORMAT) {
|
||||
response.setSkipped('Text format is not supported as output format.');
|
||||
return response;
|
||||
}
|
||||
|
||||
switch (request.getPayloadCase()) {
|
||||
case conformance.ConformanceRequest.PayloadCase.PROTOBUF_PAYLOAD: {
|
||||
if (request.getMessageType() == "protobuf_test_messages.proto3.TestAllTypesProto3") {
|
||||
@ -67,7 +73,7 @@ function doTest(request) {
|
||||
} else {
|
||||
throw "Protobuf request doesn\'t have specific payload type";
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case conformance.ConformanceRequest.PayloadCase.JSON_PAYLOAD:
|
||||
response.setSkipped("JSON not supported.");
|
||||
|
@ -350,7 +350,17 @@ bool ConformanceTestSuite::CheckSetEmpty(
|
||||
StringAppendF(&output_, "\n");
|
||||
|
||||
if (!write_to_file.empty()) {
|
||||
std::ofstream os(write_to_file);
|
||||
std::string full_filename;
|
||||
const std::string* filename = &write_to_file;
|
||||
if (!output_dir_.empty()) {
|
||||
full_filename = output_dir_;
|
||||
if (*output_dir_.rbegin() != '/') {
|
||||
full_filename.push_back('/');
|
||||
}
|
||||
full_filename += write_to_file;
|
||||
filename = &full_filename;
|
||||
}
|
||||
std::ofstream os(*filename);
|
||||
if (os) {
|
||||
for (std::set<string>::const_iterator iter = set_to_check.begin();
|
||||
iter != set_to_check.end(); ++iter) {
|
||||
@ -358,7 +368,7 @@ bool ConformanceTestSuite::CheckSetEmpty(
|
||||
}
|
||||
} else {
|
||||
StringAppendF(&output_, "Failed to open file: %s\n",
|
||||
write_to_file.c_str());
|
||||
filename->c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,6 +174,11 @@ class ConformanceTestSuite {
|
||||
failure_list_flag_name_ = failure_list_flag_name;
|
||||
}
|
||||
|
||||
// Sets the path of the output directory.
|
||||
void SetOutputDir(const char* output_dir) {
|
||||
output_dir_ = output_dir;
|
||||
}
|
||||
|
||||
// Run all the conformance tests against the given test runner.
|
||||
// Test output will be stored in "output".
|
||||
//
|
||||
@ -296,6 +301,7 @@ class ConformanceTestSuite {
|
||||
bool verbose_;
|
||||
bool enforce_recommended_;
|
||||
std::string output_;
|
||||
std::string output_dir_;
|
||||
std::string failure_list_flag_name_;
|
||||
std::string failure_list_filename_;
|
||||
|
||||
|
@ -141,6 +141,9 @@ void UsageError() {
|
||||
" strictly conforming to protobuf\n");
|
||||
fprintf(stderr,
|
||||
" spec.\n");
|
||||
fprintf(stderr,
|
||||
" --output_dir <dirname> Directory to write\n"
|
||||
" output files.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -162,7 +165,7 @@ void ForkPipeRunner::RunTest(
|
||||
// We failed to read from the child, assume a crash and try to reap.
|
||||
GOOGLE_LOG(INFO) << "Trying to reap child, pid=" << child_pid_;
|
||||
|
||||
int status;
|
||||
int status = 0;
|
||||
waitpid(child_pid_, &status, WEXITED);
|
||||
|
||||
string error_msg;
|
||||
@ -208,6 +211,9 @@ int ForkPipeRunner::Run(
|
||||
suite->SetVerbose(true);
|
||||
} else if (strcmp(argv[arg], "--enforce_recommended") == 0) {
|
||||
suite->SetEnforceRecommended(true);
|
||||
} else if (strcmp(argv[arg], "--output_dir") == 0) {
|
||||
if (++arg == argc) UsageError();
|
||||
suite->SetOutputDir(argv[arg]);
|
||||
} else if (argv[arg][0] == '-') {
|
||||
bool recognized_flag = false;
|
||||
for (ConformanceTestSuite* suite : suites) {
|
||||
|
@ -40,7 +40,7 @@ while [[ -n "$@" ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
conformance_test_runner=$(rlocation com_google_protobuf/conformance_test_runner)
|
||||
conformance_test_runner=$(rlocation com_google_protobuf/conformance/conformance_test_runner)
|
||||
conformance_testee=$(rlocation $TESTEE)
|
||||
args=(--enforce_recommended)
|
||||
|
||||
|
44
conformance/defs.bzl
Normal file
44
conformance/defs.bzl
Normal file
@ -0,0 +1,44 @@
|
||||
"""Starlark definitions for Protobuf conformance tests.
|
||||
|
||||
PLEASE DO NOT DEPEND ON THE CONTENTS OF THIS FILE, IT IS UNSTABLE.
|
||||
"""
|
||||
|
||||
def conformance_test(
|
||||
name,
|
||||
testee,
|
||||
failure_list = None,
|
||||
text_format_failure_list = None):
|
||||
"""Conformance test runner.
|
||||
|
||||
Args:
|
||||
name: the name for the test.
|
||||
testee: a conformance test client binary.
|
||||
failure_list: a text file with known failures, one per line.
|
||||
text_format_failure_list: a text file with known failures (one per line)
|
||||
for the text format conformance suite.
|
||||
"""
|
||||
args = ["--testee %s" % _strip_bazel(testee)]
|
||||
failure_lists = []
|
||||
if failure_list:
|
||||
args = args + ["--failure_list %s" % _strip_bazel(failure_list)]
|
||||
failure_lists = failure_lists + [failure_list]
|
||||
if text_format_failure_list:
|
||||
args = args + ["--text_format_failure_list %s" % _strip_bazel(text_format_failure_list)]
|
||||
failure_lists = failure_lists + [text_format_failure_list]
|
||||
|
||||
native.sh_test(
|
||||
name = name,
|
||||
srcs = ["//conformance:conformance_test_runner.sh"],
|
||||
data = [testee] + failure_lists + [
|
||||
"//conformance:conformance_test_runner",
|
||||
],
|
||||
args = args,
|
||||
deps = [
|
||||
"@bazel_tools//tools/bash/runfiles",
|
||||
],
|
||||
)
|
||||
|
||||
def _strip_bazel(testee):
|
||||
if testee.startswith("//"):
|
||||
testee = testee.replace("//", "com_google_protobuf/")
|
||||
return testee.replace(":", "/")
|
@ -0,0 +1,162 @@
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[4].ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[5].ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED64[2].ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[7].ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT64[2].ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED64[2].ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT64[2].ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[8].ProtobufOutput
|
||||
Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT64[2].ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[4].ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[5].ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FIXED64[2].ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[7].ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT64[2].ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED64[2].ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT64[2].ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[8].ProtobufOutput
|
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT64[2].ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.ENUM.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[4].ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[5].ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataScalar.FIXED64[2].ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataScalar.INT32[7].ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataScalar.INT64[2].ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED64[2].ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataScalar.SINT64[2].ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[8].ProtobufOutput
|
||||
Required.Proto2.ProtobufInput.ValidDataScalar.UINT64[2].ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.ENUM.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[4].ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[5].ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataScalar.FIXED64[2].ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataScalar.INT32[7].ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataScalar.INT64[2].ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED64[2].ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[2].ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[8].ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.ValidDataScalar.UINT64[2].ProtobufOutput
|
17
csharp/.editorconfig
Normal file
17
csharp/.editorconfig
Normal file
@ -0,0 +1,17 @@
|
||||
# Remove the line below if you want to inherit .editorconfig settings from higher directories
|
||||
root = true
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
# Indentation and spacing
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
tab_width = 4
|
||||
|
||||
# New line preferences
|
||||
end_of_line = lf
|
||||
insert_final_newline = false
|
||||
trim_trailing_whitespace = true
|
1
csharp/.gitignore
vendored
1
csharp/.gitignore
vendored
@ -18,6 +18,7 @@ lib/NUnit
|
||||
# Untracked files
|
||||
#
|
||||
.vs
|
||||
.cr
|
||||
*.user
|
||||
*.suo
|
||||
*.nupkg
|
||||
|
53
csharp/BUILD.bazel
Normal file
53
csharp/BUILD.bazel
Normal file
@ -0,0 +1,53 @@
|
||||
# Protobuf C# runtime
|
||||
#
|
||||
# See also code generation logic under /src/google/protobuf/compiler/csharp.
|
||||
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
|
||||
filegroup(
|
||||
name = "wkt_cs_srcs",
|
||||
data = [
|
||||
"src/Google.Protobuf.Conformance/Conformance.cs",
|
||||
"src/Google.Protobuf/Reflection/Descriptor.cs",
|
||||
"src/Google.Protobuf/WellKnownTypes/Any.cs",
|
||||
"src/Google.Protobuf/WellKnownTypes/Api.cs",
|
||||
"src/Google.Protobuf/WellKnownTypes/Duration.cs",
|
||||
"src/Google.Protobuf/WellKnownTypes/Empty.cs",
|
||||
"src/Google.Protobuf/WellKnownTypes/FieldMask.cs",
|
||||
"src/Google.Protobuf/WellKnownTypes/SourceContext.cs",
|
||||
"src/Google.Protobuf/WellKnownTypes/Struct.cs",
|
||||
"src/Google.Protobuf/WellKnownTypes/Timestamp.cs",
|
||||
"src/Google.Protobuf/WellKnownTypes/Type.cs",
|
||||
"src/Google.Protobuf/WellKnownTypes/Wrappers.cs",
|
||||
],
|
||||
visibility = ["//src/google/protobuf/compiler/csharp:__pkg__"],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = glob([
|
||||
"keys/*",
|
||||
"protos/*",
|
||||
"src/**/*.cs*", # .cs and .csproj
|
||||
]) + [
|
||||
".editorconfig",
|
||||
".gitignore",
|
||||
"BUILD.bazel",
|
||||
"CHANGES.txt",
|
||||
"Google.Protobuf.Tools.nuspec",
|
||||
"Google.Protobuf.Tools.targets",
|
||||
"NuGet.Config",
|
||||
"README.md",
|
||||
"build_packages.bat",
|
||||
"build_tools.sh",
|
||||
"buildall.bat",
|
||||
"buildall.sh",
|
||||
"generate_protos.sh",
|
||||
"install_dotnet_sdk.ps1",
|
||||
"src/Google.Protobuf.Benchmarks/wrapper_benchmark_messages.proto",
|
||||
"src/Google.Protobuf.Test/testprotos.pb",
|
||||
"src/Google.Protobuf.sln",
|
||||
],
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
@ -5,10 +5,10 @@
|
||||
<title>Google Protocol Buffers tools</title>
|
||||
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
|
||||
<description>See project site for more info.</description>
|
||||
<version>3.19.1</version>
|
||||
<version>3.21.1</version>
|
||||
<authors>Google Inc.</authors>
|
||||
<owners>protobuf-packages</owners>
|
||||
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/master/LICENSE</licenseUrl>
|
||||
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/main/LICENSE</licenseUrl>
|
||||
<projectUrl>https://github.com/protocolbuffers/protobuf</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<releaseNotes>Tools for Protocol Buffers</releaseNotes>
|
||||
|
8
csharp/NuGet.Config
Normal file
8
csharp/NuGet.Config
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
|
||||
<clear />
|
||||
<add key="NuGet.org (v3)" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
@ -23,6 +23,7 @@ The runtime library is built as a portable class library, supporting:
|
||||
- Windows Phone Silverlight 8
|
||||
- Windows Phone 8.1
|
||||
- .NET Core
|
||||
- .NET 5
|
||||
|
||||
You should be able to use Protocol Buffers in Visual Studio 2012 and
|
||||
all later versions. This includes all code generated by `protoc`,
|
||||
@ -31,15 +32,15 @@ which only uses features from C# 3 and earlier.
|
||||
Building
|
||||
========
|
||||
|
||||
Open the `src/Google.Protobuf.sln` solution in Visual Studio 2017 or
|
||||
Open the `src/Google.Protobuf.sln` solution in Visual Studio 2022 or
|
||||
later.
|
||||
|
||||
Although *users* of this project are only expected to have Visual
|
||||
Studio 2012 or later, *developers* of the library are required to
|
||||
have Visual Studio 2017 or later, as the library uses C# 6 features
|
||||
in its implementation, as well as the new Visual Studio 2017 csproj
|
||||
format. These features have no impact when using the compiled code -
|
||||
they're only relevant when building the `Google.Protobuf` assembly.
|
||||
have Visual Studio 2022 or later, as the library uses C# 10 features
|
||||
in its implementation and runs tests under .NET 6. These features
|
||||
have no impact when using the compiled code - they're only relevant
|
||||
when building the `Google.Protobuf` assembly.
|
||||
|
||||
In order to run and debug the AddressBook example in the IDE, you must
|
||||
install the optional component, ".Net Core 1.0 - 1.1 development tools
|
||||
|
@ -1,7 +1,7 @@
|
||||
@rem Builds Google.Protobuf NuGet packages
|
||||
|
||||
dotnet restore src/Google.Protobuf.sln
|
||||
dotnet pack -c Release src/Google.Protobuf.sln || goto :error
|
||||
dotnet pack -c Release src/Google.Protobuf.sln -p:ContinuousIntegrationBuild=true || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
|
@ -10,8 +10,8 @@ dotnet restore $SRC/Google.Protobuf.sln
|
||||
dotnet build -c $CONFIG $SRC/Google.Protobuf.sln
|
||||
|
||||
echo Running tests.
|
||||
# Only test netcoreapp2.1, which uses the .NET Core runtime.
|
||||
# Only test netcoreapp3.1, which uses the .NET Core runtime.
|
||||
# If we want to test the .NET 4.5 version separately, we could
|
||||
# run Mono explicitly. However, we don't have any differences between
|
||||
# the .NET 4.5 and netstandard2.1 assemblies.
|
||||
dotnet test -c $CONFIG -f netcoreapp2.1 $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj
|
||||
dotnet test -c $CONFIG -f netcoreapp3.1 $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj
|
||||
|
@ -1,171 +1,171 @@
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
public class ByteStringTest
|
||||
{
|
||||
[Test]
|
||||
public void Equality()
|
||||
{
|
||||
ByteString b1 = ByteString.CopyFrom(1, 2, 3);
|
||||
ByteString b2 = ByteString.CopyFrom(1, 2, 3);
|
||||
ByteString b3 = ByteString.CopyFrom(1, 2, 4);
|
||||
ByteString b4 = ByteString.CopyFrom(1, 2, 3, 4);
|
||||
EqualityTester.AssertEquality(b1, b1);
|
||||
EqualityTester.AssertEquality(b1, b2);
|
||||
EqualityTester.AssertInequality(b1, b3);
|
||||
EqualityTester.AssertInequality(b1, b4);
|
||||
EqualityTester.AssertInequality(b1, null);
|
||||
#pragma warning disable 1718 // Deliberately calling ==(b1, b1) and !=(b1, b1)
|
||||
Assert.IsTrue(b1 == b1);
|
||||
Assert.IsTrue(b1 == b2);
|
||||
Assert.IsFalse(b1 == b3);
|
||||
Assert.IsFalse(b1 == b4);
|
||||
Assert.IsFalse(b1 == null);
|
||||
Assert.IsTrue((ByteString) null == null);
|
||||
Assert.IsFalse(b1 != b1);
|
||||
Assert.IsFalse(b1 != b2);
|
||||
#pragma warning disable 1718
|
||||
Assert.IsTrue(b1 != b3);
|
||||
Assert.IsTrue(b1 != b4);
|
||||
Assert.IsTrue(b1 != null);
|
||||
Assert.IsFalse((ByteString) null != null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EmptyByteStringHasZeroSize()
|
||||
{
|
||||
Assert.AreEqual(0, ByteString.Empty.Length);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyFromStringWithExplicitEncoding()
|
||||
{
|
||||
ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode);
|
||||
Assert.AreEqual(4, bs.Length);
|
||||
Assert.AreEqual(65, bs[0]);
|
||||
Assert.AreEqual(0, bs[1]);
|
||||
Assert.AreEqual(66, bs[2]);
|
||||
Assert.AreEqual(0, bs[3]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsEmptyWhenEmpty()
|
||||
{
|
||||
Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsEmptyWhenNotEmpty()
|
||||
{
|
||||
Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyFromByteArrayCopiesContents()
|
||||
{
|
||||
byte[] data = new byte[1];
|
||||
data[0] = 10;
|
||||
ByteString bs = ByteString.CopyFrom(data);
|
||||
Assert.AreEqual(10, bs[0]);
|
||||
data[0] = 5;
|
||||
Assert.AreEqual(10, bs[0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToByteArrayCopiesContents()
|
||||
{
|
||||
ByteString bs = ByteString.CopyFromUtf8("Hello");
|
||||
byte[] data = bs.ToByteArray();
|
||||
Assert.AreEqual((byte)'H', data[0]);
|
||||
Assert.AreEqual((byte)'H', bs[0]);
|
||||
data[0] = 0;
|
||||
Assert.AreEqual(0, data[0]);
|
||||
Assert.AreEqual((byte)'H', bs[0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyFromUtf8UsesUtf8()
|
||||
{
|
||||
ByteString bs = ByteString.CopyFromUtf8("\u20ac");
|
||||
Assert.AreEqual(3, bs.Length);
|
||||
Assert.AreEqual(0xe2, bs[0]);
|
||||
Assert.AreEqual(0x82, bs[1]);
|
||||
Assert.AreEqual(0xac, bs[2]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyFromPortion()
|
||||
{
|
||||
byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6};
|
||||
ByteString bs = ByteString.CopyFrom(data, 2, 3);
|
||||
Assert.AreEqual(3, bs.Length);
|
||||
Assert.AreEqual(2, bs[0]);
|
||||
Assert.AreEqual(3, bs[1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToStringUtf8()
|
||||
{
|
||||
ByteString bs = ByteString.CopyFromUtf8("\u20ac");
|
||||
Assert.AreEqual("\u20ac", bs.ToStringUtf8());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToStringWithExplicitEncoding()
|
||||
{
|
||||
ByteString bs = ByteString.CopyFrom("\u20ac", Encoding.Unicode);
|
||||
Assert.AreEqual("\u20ac", bs.ToString(Encoding.Unicode));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FromBase64_WithText()
|
||||
{
|
||||
byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6};
|
||||
string base64 = Convert.ToBase64String(data);
|
||||
ByteString bs = ByteString.FromBase64(base64);
|
||||
Assert.AreEqual(data, bs.ToByteArray());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FromBase64_Empty()
|
||||
{
|
||||
// Optimization which also fixes issue 61.
|
||||
Assert.AreSame(ByteString.Empty, ByteString.FromBase64(""));
|
||||
}
|
||||
}
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
public class ByteStringTest
|
||||
{
|
||||
[Test]
|
||||
public void Equality()
|
||||
{
|
||||
ByteString b1 = ByteString.CopyFrom(1, 2, 3);
|
||||
ByteString b2 = ByteString.CopyFrom(1, 2, 3);
|
||||
ByteString b3 = ByteString.CopyFrom(1, 2, 4);
|
||||
ByteString b4 = ByteString.CopyFrom(1, 2, 3, 4);
|
||||
EqualityTester.AssertEquality(b1, b1);
|
||||
EqualityTester.AssertEquality(b1, b2);
|
||||
EqualityTester.AssertInequality(b1, b3);
|
||||
EqualityTester.AssertInequality(b1, b4);
|
||||
EqualityTester.AssertInequality(b1, null);
|
||||
#pragma warning disable 1718 // Deliberately calling ==(b1, b1) and !=(b1, b1)
|
||||
Assert.IsTrue(b1 == b1);
|
||||
Assert.IsTrue(b1 == b2);
|
||||
Assert.IsFalse(b1 == b3);
|
||||
Assert.IsFalse(b1 == b4);
|
||||
Assert.IsFalse(b1 == null);
|
||||
Assert.IsTrue((ByteString) null == null);
|
||||
Assert.IsFalse(b1 != b1);
|
||||
Assert.IsFalse(b1 != b2);
|
||||
#pragma warning disable 1718
|
||||
Assert.IsTrue(b1 != b3);
|
||||
Assert.IsTrue(b1 != b4);
|
||||
Assert.IsTrue(b1 != null);
|
||||
Assert.IsFalse((ByteString) null != null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EmptyByteStringHasZeroSize()
|
||||
{
|
||||
Assert.AreEqual(0, ByteString.Empty.Length);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyFromStringWithExplicitEncoding()
|
||||
{
|
||||
ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode);
|
||||
Assert.AreEqual(4, bs.Length);
|
||||
Assert.AreEqual(65, bs[0]);
|
||||
Assert.AreEqual(0, bs[1]);
|
||||
Assert.AreEqual(66, bs[2]);
|
||||
Assert.AreEqual(0, bs[3]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsEmptyWhenEmpty()
|
||||
{
|
||||
Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsEmptyWhenNotEmpty()
|
||||
{
|
||||
Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyFromByteArrayCopiesContents()
|
||||
{
|
||||
byte[] data = new byte[1];
|
||||
data[0] = 10;
|
||||
ByteString bs = ByteString.CopyFrom(data);
|
||||
Assert.AreEqual(10, bs[0]);
|
||||
data[0] = 5;
|
||||
Assert.AreEqual(10, bs[0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToByteArrayCopiesContents()
|
||||
{
|
||||
ByteString bs = ByteString.CopyFromUtf8("Hello");
|
||||
byte[] data = bs.ToByteArray();
|
||||
Assert.AreEqual((byte)'H', data[0]);
|
||||
Assert.AreEqual((byte)'H', bs[0]);
|
||||
data[0] = 0;
|
||||
Assert.AreEqual(0, data[0]);
|
||||
Assert.AreEqual((byte)'H', bs[0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyFromUtf8UsesUtf8()
|
||||
{
|
||||
ByteString bs = ByteString.CopyFromUtf8("\u20ac");
|
||||
Assert.AreEqual(3, bs.Length);
|
||||
Assert.AreEqual(0xe2, bs[0]);
|
||||
Assert.AreEqual(0x82, bs[1]);
|
||||
Assert.AreEqual(0xac, bs[2]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyFromPortion()
|
||||
{
|
||||
byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6};
|
||||
ByteString bs = ByteString.CopyFrom(data, 2, 3);
|
||||
Assert.AreEqual(3, bs.Length);
|
||||
Assert.AreEqual(2, bs[0]);
|
||||
Assert.AreEqual(3, bs[1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToStringUtf8()
|
||||
{
|
||||
ByteString bs = ByteString.CopyFromUtf8("\u20ac");
|
||||
Assert.AreEqual("\u20ac", bs.ToStringUtf8());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToStringWithExplicitEncoding()
|
||||
{
|
||||
ByteString bs = ByteString.CopyFrom("\u20ac", Encoding.Unicode);
|
||||
Assert.AreEqual("\u20ac", bs.ToString(Encoding.Unicode));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FromBase64_WithText()
|
||||
{
|
||||
byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6};
|
||||
string base64 = Convert.ToBase64String(data);
|
||||
ByteString bs = ByteString.FromBase64(base64);
|
||||
Assert.AreEqual(data, bs.ToByteArray());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FromBase64_Empty()
|
||||
{
|
||||
// Optimization which also fixes issue 61.
|
||||
Assert.AreSame(ByteString.Empty, ByteString.FromBase64(""));
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,419 +1,419 @@
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Google.Protobuf.TestProtos;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
public class CodedOutputStreamTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes the given value using WriteRawVarint32() and WriteRawVarint64() and
|
||||
/// checks that the result matches the given bytes
|
||||
/// </summary>
|
||||
private static void AssertWriteVarint(byte[] data, ulong value)
|
||||
{
|
||||
// Only do 32-bit write if the value fits in 32 bits.
|
||||
if ((value >> 32) == 0)
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput);
|
||||
output.WriteRawVarint32((uint) value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
// Also try computing size.
|
||||
Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint32Size((uint) value));
|
||||
}
|
||||
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput);
|
||||
output.WriteRawVarint64(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
|
||||
// Also try computing size.
|
||||
Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint64Size(value));
|
||||
}
|
||||
|
||||
// Try different buffer sizes.
|
||||
for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2)
|
||||
{
|
||||
// Only do 32-bit write if the value fits in 32 bits.
|
||||
if ((value >> 32) == 0)
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output =
|
||||
new CodedOutputStream(rawOutput, bufferSize);
|
||||
output.WriteRawVarint32((uint) value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
}
|
||||
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput, bufferSize);
|
||||
output.WriteRawVarint64(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests WriteRawVarint32() and WriteRawVarint64()
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void WriteVarint()
|
||||
{
|
||||
AssertWriteVarint(new byte[] {0x00}, 0);
|
||||
AssertWriteVarint(new byte[] {0x01}, 1);
|
||||
AssertWriteVarint(new byte[] {0x7f}, 127);
|
||||
// 14882
|
||||
AssertWriteVarint(new byte[] {0xa2, 0x74}, (0x22 << 0) | (0x74 << 7));
|
||||
// 2961488830
|
||||
AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x0b},
|
||||
(0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
|
||||
(0x0bL << 28));
|
||||
|
||||
// 64-bit
|
||||
// 7256456126
|
||||
AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x1b},
|
||||
(0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
|
||||
(0x1bL << 28));
|
||||
// 41256202580718336
|
||||
AssertWriteVarint(
|
||||
new byte[] {0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49},
|
||||
(0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) |
|
||||
(0x43UL << 28) | (0x49L << 35) | (0x24UL << 42) | (0x49UL << 49));
|
||||
// 11964378330978735131
|
||||
AssertWriteVarint(
|
||||
new byte[] {0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01},
|
||||
unchecked((ulong)
|
||||
((0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) |
|
||||
(0x3bL << 28) | (0x56L << 35) | (0x00L << 42) |
|
||||
(0x05L << 49) | (0x26L << 56) | (0x01L << 63))));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses the given bytes using WriteRawLittleEndian32() and checks
|
||||
/// that the result matches the given value.
|
||||
/// </summary>
|
||||
private static void AssertWriteLittleEndian32(byte[] data, uint value)
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput);
|
||||
output.WriteRawLittleEndian32(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
|
||||
// Try different buffer sizes.
|
||||
for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2)
|
||||
{
|
||||
rawOutput = new MemoryStream();
|
||||
output = new CodedOutputStream(rawOutput, bufferSize);
|
||||
output.WriteRawLittleEndian32(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses the given bytes using WriteRawLittleEndian64() and checks
|
||||
/// that the result matches the given value.
|
||||
/// </summary>
|
||||
private static void AssertWriteLittleEndian64(byte[] data, ulong value)
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput);
|
||||
output.WriteRawLittleEndian64(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
|
||||
// Try different block sizes.
|
||||
for (int blockSize = 1; blockSize <= 16; blockSize *= 2)
|
||||
{
|
||||
rawOutput = new MemoryStream();
|
||||
output = new CodedOutputStream(rawOutput, blockSize);
|
||||
output.WriteRawLittleEndian64(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests writeRawLittleEndian32() and writeRawLittleEndian64().
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void WriteLittleEndian()
|
||||
{
|
||||
AssertWriteLittleEndian32(new byte[] {0x78, 0x56, 0x34, 0x12}, 0x12345678);
|
||||
AssertWriteLittleEndian32(new byte[] {0xf0, 0xde, 0xbc, 0x9a}, 0x9abcdef0);
|
||||
|
||||
AssertWriteLittleEndian64(
|
||||
new byte[] {0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12},
|
||||
0x123456789abcdef0L);
|
||||
AssertWriteLittleEndian64(
|
||||
new byte[] {0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a},
|
||||
0x9abcdef012345678UL);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WriteWholeMessage_VaryingBlockSizes()
|
||||
{
|
||||
TestAllTypes message = SampleMessages.CreateFullTestAllTypes();
|
||||
|
||||
byte[] rawBytes = message.ToByteArray();
|
||||
|
||||
// Try different block sizes.
|
||||
for (int blockSize = 1; blockSize < 256; blockSize *= 2)
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput, blockSize);
|
||||
message.WriteTo(output);
|
||||
output.Flush();
|
||||
Assert.AreEqual(rawBytes, rawOutput.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EncodeZigZag32()
|
||||
{
|
||||
Assert.AreEqual(0u, WritingPrimitives.EncodeZigZag32(0));
|
||||
Assert.AreEqual(1u, WritingPrimitives.EncodeZigZag32(-1));
|
||||
Assert.AreEqual(2u, WritingPrimitives.EncodeZigZag32(1));
|
||||
Assert.AreEqual(3u, WritingPrimitives.EncodeZigZag32(-2));
|
||||
Assert.AreEqual(0x7FFFFFFEu, WritingPrimitives.EncodeZigZag32(0x3FFFFFFF));
|
||||
Assert.AreEqual(0x7FFFFFFFu, WritingPrimitives.EncodeZigZag32(unchecked((int) 0xC0000000)));
|
||||
Assert.AreEqual(0xFFFFFFFEu, WritingPrimitives.EncodeZigZag32(0x7FFFFFFF));
|
||||
Assert.AreEqual(0xFFFFFFFFu, WritingPrimitives.EncodeZigZag32(unchecked((int) 0x80000000)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EncodeZigZag64()
|
||||
{
|
||||
Assert.AreEqual(0u, WritingPrimitives.EncodeZigZag64(0));
|
||||
Assert.AreEqual(1u, WritingPrimitives.EncodeZigZag64(-1));
|
||||
Assert.AreEqual(2u, WritingPrimitives.EncodeZigZag64(1));
|
||||
Assert.AreEqual(3u, WritingPrimitives.EncodeZigZag64(-2));
|
||||
Assert.AreEqual(0x000000007FFFFFFEuL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0x000000003FFFFFFFUL)));
|
||||
Assert.AreEqual(0x000000007FFFFFFFuL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0xFFFFFFFFC0000000UL)));
|
||||
Assert.AreEqual(0x00000000FFFFFFFEuL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0x000000007FFFFFFFUL)));
|
||||
Assert.AreEqual(0x00000000FFFFFFFFuL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0xFFFFFFFF80000000UL)));
|
||||
Assert.AreEqual(0xFFFFFFFFFFFFFFFEL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0x7FFFFFFFFFFFFFFFUL)));
|
||||
Assert.AreEqual(0xFFFFFFFFFFFFFFFFL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0x8000000000000000UL)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RoundTripZigZag32()
|
||||
{
|
||||
// Some easier-to-verify round-trip tests. The inputs (other than 0, 1, -1)
|
||||
// were chosen semi-randomly via keyboard bashing.
|
||||
Assert.AreEqual(0, ParsingPrimitives.DecodeZigZag32(WritingPrimitives.EncodeZigZag32(0)));
|
||||
Assert.AreEqual(1, ParsingPrimitives.DecodeZigZag32(WritingPrimitives.EncodeZigZag32(1)));
|
||||
Assert.AreEqual(-1, ParsingPrimitives.DecodeZigZag32(WritingPrimitives.EncodeZigZag32(-1)));
|
||||
Assert.AreEqual(14927, ParsingPrimitives.DecodeZigZag32(WritingPrimitives.EncodeZigZag32(14927)));
|
||||
Assert.AreEqual(-3612, ParsingPrimitives.DecodeZigZag32(WritingPrimitives.EncodeZigZag32(-3612)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RoundTripZigZag64()
|
||||
{
|
||||
Assert.AreEqual(0, ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(0)));
|
||||
Assert.AreEqual(1, ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(1)));
|
||||
Assert.AreEqual(-1, ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(-1)));
|
||||
Assert.AreEqual(14927, ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(14927)));
|
||||
Assert.AreEqual(-3612, ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(-3612)));
|
||||
|
||||
Assert.AreEqual(856912304801416L,
|
||||
ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(856912304801416L)));
|
||||
Assert.AreEqual(-75123905439571256L,
|
||||
ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(-75123905439571256L)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNegativeEnumNoTag()
|
||||
{
|
||||
Assert.AreEqual(10, CodedOutputStream.ComputeInt32Size(-2));
|
||||
Assert.AreEqual(10, CodedOutputStream.ComputeEnumSize((int) SampleEnum.NegativeValue));
|
||||
|
||||
byte[] bytes = new byte[10];
|
||||
CodedOutputStream output = new CodedOutputStream(bytes);
|
||||
output.WriteEnum((int) SampleEnum.NegativeValue);
|
||||
|
||||
Assert.AreEqual(0, output.SpaceLeft);
|
||||
Assert.AreEqual("FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCodedInputOutputPosition()
|
||||
{
|
||||
byte[] content = new byte[110];
|
||||
for (int i = 0; i < content.Length; i++)
|
||||
content[i] = (byte)i;
|
||||
|
||||
byte[] child = new byte[120];
|
||||
{
|
||||
MemoryStream ms = new MemoryStream(child);
|
||||
CodedOutputStream cout = new CodedOutputStream(ms, 20);
|
||||
// Field 11: numeric value: 500
|
||||
cout.WriteTag(11, WireFormat.WireType.Varint);
|
||||
Assert.AreEqual(1, cout.Position);
|
||||
cout.WriteInt32(500);
|
||||
Assert.AreEqual(3, cout.Position);
|
||||
//Field 12: length delimited 120 bytes
|
||||
cout.WriteTag(12, WireFormat.WireType.LengthDelimited);
|
||||
Assert.AreEqual(4, cout.Position);
|
||||
cout.WriteBytes(ByteString.CopyFrom(content));
|
||||
Assert.AreEqual(115, cout.Position);
|
||||
// Field 13: fixed numeric value: 501
|
||||
cout.WriteTag(13, WireFormat.WireType.Fixed32);
|
||||
Assert.AreEqual(116, cout.Position);
|
||||
cout.WriteSFixed32(501);
|
||||
Assert.AreEqual(120, cout.Position);
|
||||
cout.Flush();
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[130];
|
||||
{
|
||||
CodedOutputStream cout = new CodedOutputStream(bytes);
|
||||
// Field 1: numeric value: 500
|
||||
cout.WriteTag(1, WireFormat.WireType.Varint);
|
||||
Assert.AreEqual(1, cout.Position);
|
||||
cout.WriteInt32(500);
|
||||
Assert.AreEqual(3, cout.Position);
|
||||
//Field 2: length delimited 120 bytes
|
||||
cout.WriteTag(2, WireFormat.WireType.LengthDelimited);
|
||||
Assert.AreEqual(4, cout.Position);
|
||||
cout.WriteBytes(ByteString.CopyFrom(child));
|
||||
Assert.AreEqual(125, cout.Position);
|
||||
// Field 3: fixed numeric value: 500
|
||||
cout.WriteTag(3, WireFormat.WireType.Fixed32);
|
||||
Assert.AreEqual(126, cout.Position);
|
||||
cout.WriteSFixed32(501);
|
||||
Assert.AreEqual(130, cout.Position);
|
||||
cout.Flush();
|
||||
}
|
||||
// Now test Input stream:
|
||||
{
|
||||
CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0, false);
|
||||
Assert.AreEqual(0, cin.Position);
|
||||
// Field 1:
|
||||
uint tag = cin.ReadTag();
|
||||
Assert.AreEqual(1, tag >> 3);
|
||||
Assert.AreEqual(1, cin.Position);
|
||||
Assert.AreEqual(500, cin.ReadInt32());
|
||||
Assert.AreEqual(3, cin.Position);
|
||||
//Field 2:
|
||||
tag = cin.ReadTag();
|
||||
Assert.AreEqual(2, tag >> 3);
|
||||
Assert.AreEqual(4, cin.Position);
|
||||
int childlen = cin.ReadLength();
|
||||
Assert.AreEqual(120, childlen);
|
||||
Assert.AreEqual(5, cin.Position);
|
||||
int oldlimit = cin.PushLimit((int)childlen);
|
||||
Assert.AreEqual(5, cin.Position);
|
||||
// Now we are reading child message
|
||||
{
|
||||
// Field 11: numeric value: 500
|
||||
tag = cin.ReadTag();
|
||||
Assert.AreEqual(11, tag >> 3);
|
||||
Assert.AreEqual(6, cin.Position);
|
||||
Assert.AreEqual(500, cin.ReadInt32());
|
||||
Assert.AreEqual(8, cin.Position);
|
||||
//Field 12: length delimited 120 bytes
|
||||
tag = cin.ReadTag();
|
||||
Assert.AreEqual(12, tag >> 3);
|
||||
Assert.AreEqual(9, cin.Position);
|
||||
ByteString bstr = cin.ReadBytes();
|
||||
Assert.AreEqual(110, bstr.Length);
|
||||
Assert.AreEqual((byte) 109, bstr[109]);
|
||||
Assert.AreEqual(120, cin.Position);
|
||||
// Field 13: fixed numeric value: 501
|
||||
tag = cin.ReadTag();
|
||||
Assert.AreEqual(13, tag >> 3);
|
||||
// ROK - Previously broken here, this returned 126 failing to account for bufferSizeAfterLimit
|
||||
Assert.AreEqual(121, cin.Position);
|
||||
Assert.AreEqual(501, cin.ReadSFixed32());
|
||||
Assert.AreEqual(125, cin.Position);
|
||||
Assert.IsTrue(cin.IsAtEnd);
|
||||
}
|
||||
cin.PopLimit(oldlimit);
|
||||
Assert.AreEqual(125, cin.Position);
|
||||
// Field 3: fixed numeric value: 501
|
||||
tag = cin.ReadTag();
|
||||
Assert.AreEqual(3, tag >> 3);
|
||||
Assert.AreEqual(126, cin.Position);
|
||||
Assert.AreEqual(501, cin.ReadSFixed32());
|
||||
Assert.AreEqual(130, cin.Position);
|
||||
Assert.IsTrue(cin.IsAtEnd);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Dispose_DisposesUnderlyingStream()
|
||||
{
|
||||
var memoryStream = new MemoryStream();
|
||||
Assert.IsTrue(memoryStream.CanWrite);
|
||||
using (var cos = new CodedOutputStream(memoryStream))
|
||||
{
|
||||
cos.WriteRawBytes(new byte[] {0});
|
||||
Assert.AreEqual(0, memoryStream.Position); // Not flushed yet
|
||||
}
|
||||
Assert.AreEqual(1, memoryStream.ToArray().Length); // Flushed data from CodedOutputStream to MemoryStream
|
||||
Assert.IsFalse(memoryStream.CanWrite); // Disposed
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Dispose_WithLeaveOpen()
|
||||
{
|
||||
var memoryStream = new MemoryStream();
|
||||
Assert.IsTrue(memoryStream.CanWrite);
|
||||
using (var cos = new CodedOutputStream(memoryStream, true))
|
||||
{
|
||||
cos.WriteRawBytes(new byte[] {0});
|
||||
Assert.AreEqual(0, memoryStream.Position); // Not flushed yet
|
||||
}
|
||||
Assert.AreEqual(1, memoryStream.Position); // Flushed data from CodedOutputStream to MemoryStream
|
||||
Assert.IsTrue(memoryStream.CanWrite); // We left the stream open
|
||||
}
|
||||
}
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Google.Protobuf.TestProtos;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
public class CodedOutputStreamTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes the given value using WriteRawVarint32() and WriteRawVarint64() and
|
||||
/// checks that the result matches the given bytes
|
||||
/// </summary>
|
||||
private static void AssertWriteVarint(byte[] data, ulong value)
|
||||
{
|
||||
// Only do 32-bit write if the value fits in 32 bits.
|
||||
if ((value >> 32) == 0)
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput);
|
||||
output.WriteRawVarint32((uint) value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
// Also try computing size.
|
||||
Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint32Size((uint) value));
|
||||
}
|
||||
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput);
|
||||
output.WriteRawVarint64(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
|
||||
// Also try computing size.
|
||||
Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint64Size(value));
|
||||
}
|
||||
|
||||
// Try different buffer sizes.
|
||||
for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2)
|
||||
{
|
||||
// Only do 32-bit write if the value fits in 32 bits.
|
||||
if ((value >> 32) == 0)
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output =
|
||||
new CodedOutputStream(rawOutput, bufferSize);
|
||||
output.WriteRawVarint32((uint) value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
}
|
||||
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput, bufferSize);
|
||||
output.WriteRawVarint64(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests WriteRawVarint32() and WriteRawVarint64()
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void WriteVarint()
|
||||
{
|
||||
AssertWriteVarint(new byte[] {0x00}, 0);
|
||||
AssertWriteVarint(new byte[] {0x01}, 1);
|
||||
AssertWriteVarint(new byte[] {0x7f}, 127);
|
||||
// 14882
|
||||
AssertWriteVarint(new byte[] {0xa2, 0x74}, (0x22 << 0) | (0x74 << 7));
|
||||
// 2961488830
|
||||
AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x0b},
|
||||
(0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
|
||||
(0x0bL << 28));
|
||||
|
||||
// 64-bit
|
||||
// 7256456126
|
||||
AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x1b},
|
||||
(0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
|
||||
(0x1bL << 28));
|
||||
// 41256202580718336
|
||||
AssertWriteVarint(
|
||||
new byte[] {0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49},
|
||||
(0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) |
|
||||
(0x43UL << 28) | (0x49L << 35) | (0x24UL << 42) | (0x49UL << 49));
|
||||
// 11964378330978735131
|
||||
AssertWriteVarint(
|
||||
new byte[] {0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01},
|
||||
unchecked((ulong)
|
||||
((0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) |
|
||||
(0x3bL << 28) | (0x56L << 35) | (0x00L << 42) |
|
||||
(0x05L << 49) | (0x26L << 56) | (0x01L << 63))));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses the given bytes using WriteRawLittleEndian32() and checks
|
||||
/// that the result matches the given value.
|
||||
/// </summary>
|
||||
private static void AssertWriteLittleEndian32(byte[] data, uint value)
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput);
|
||||
output.WriteRawLittleEndian32(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
|
||||
// Try different buffer sizes.
|
||||
for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2)
|
||||
{
|
||||
rawOutput = new MemoryStream();
|
||||
output = new CodedOutputStream(rawOutput, bufferSize);
|
||||
output.WriteRawLittleEndian32(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses the given bytes using WriteRawLittleEndian64() and checks
|
||||
/// that the result matches the given value.
|
||||
/// </summary>
|
||||
private static void AssertWriteLittleEndian64(byte[] data, ulong value)
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput);
|
||||
output.WriteRawLittleEndian64(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
|
||||
// Try different block sizes.
|
||||
for (int blockSize = 1; blockSize <= 16; blockSize *= 2)
|
||||
{
|
||||
rawOutput = new MemoryStream();
|
||||
output = new CodedOutputStream(rawOutput, blockSize);
|
||||
output.WriteRawLittleEndian64(value);
|
||||
output.Flush();
|
||||
Assert.AreEqual(data, rawOutput.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests writeRawLittleEndian32() and writeRawLittleEndian64().
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void WriteLittleEndian()
|
||||
{
|
||||
AssertWriteLittleEndian32(new byte[] {0x78, 0x56, 0x34, 0x12}, 0x12345678);
|
||||
AssertWriteLittleEndian32(new byte[] {0xf0, 0xde, 0xbc, 0x9a}, 0x9abcdef0);
|
||||
|
||||
AssertWriteLittleEndian64(
|
||||
new byte[] {0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12},
|
||||
0x123456789abcdef0L);
|
||||
AssertWriteLittleEndian64(
|
||||
new byte[] {0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a},
|
||||
0x9abcdef012345678UL);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WriteWholeMessage_VaryingBlockSizes()
|
||||
{
|
||||
TestAllTypes message = SampleMessages.CreateFullTestAllTypes();
|
||||
|
||||
byte[] rawBytes = message.ToByteArray();
|
||||
|
||||
// Try different block sizes.
|
||||
for (int blockSize = 1; blockSize < 256; blockSize *= 2)
|
||||
{
|
||||
MemoryStream rawOutput = new MemoryStream();
|
||||
CodedOutputStream output = new CodedOutputStream(rawOutput, blockSize);
|
||||
message.WriteTo(output);
|
||||
output.Flush();
|
||||
Assert.AreEqual(rawBytes, rawOutput.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EncodeZigZag32()
|
||||
{
|
||||
Assert.AreEqual(0u, WritingPrimitives.EncodeZigZag32(0));
|
||||
Assert.AreEqual(1u, WritingPrimitives.EncodeZigZag32(-1));
|
||||
Assert.AreEqual(2u, WritingPrimitives.EncodeZigZag32(1));
|
||||
Assert.AreEqual(3u, WritingPrimitives.EncodeZigZag32(-2));
|
||||
Assert.AreEqual(0x7FFFFFFEu, WritingPrimitives.EncodeZigZag32(0x3FFFFFFF));
|
||||
Assert.AreEqual(0x7FFFFFFFu, WritingPrimitives.EncodeZigZag32(unchecked((int) 0xC0000000)));
|
||||
Assert.AreEqual(0xFFFFFFFEu, WritingPrimitives.EncodeZigZag32(0x7FFFFFFF));
|
||||
Assert.AreEqual(0xFFFFFFFFu, WritingPrimitives.EncodeZigZag32(unchecked((int) 0x80000000)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EncodeZigZag64()
|
||||
{
|
||||
Assert.AreEqual(0u, WritingPrimitives.EncodeZigZag64(0));
|
||||
Assert.AreEqual(1u, WritingPrimitives.EncodeZigZag64(-1));
|
||||
Assert.AreEqual(2u, WritingPrimitives.EncodeZigZag64(1));
|
||||
Assert.AreEqual(3u, WritingPrimitives.EncodeZigZag64(-2));
|
||||
Assert.AreEqual(0x000000007FFFFFFEuL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0x000000003FFFFFFFUL)));
|
||||
Assert.AreEqual(0x000000007FFFFFFFuL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0xFFFFFFFFC0000000UL)));
|
||||
Assert.AreEqual(0x00000000FFFFFFFEuL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0x000000007FFFFFFFUL)));
|
||||
Assert.AreEqual(0x00000000FFFFFFFFuL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0xFFFFFFFF80000000UL)));
|
||||
Assert.AreEqual(0xFFFFFFFFFFFFFFFEL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0x7FFFFFFFFFFFFFFFUL)));
|
||||
Assert.AreEqual(0xFFFFFFFFFFFFFFFFL,
|
||||
WritingPrimitives.EncodeZigZag64(unchecked((long) 0x8000000000000000UL)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RoundTripZigZag32()
|
||||
{
|
||||
// Some easier-to-verify round-trip tests. The inputs (other than 0, 1, -1)
|
||||
// were chosen semi-randomly via keyboard bashing.
|
||||
Assert.AreEqual(0, ParsingPrimitives.DecodeZigZag32(WritingPrimitives.EncodeZigZag32(0)));
|
||||
Assert.AreEqual(1, ParsingPrimitives.DecodeZigZag32(WritingPrimitives.EncodeZigZag32(1)));
|
||||
Assert.AreEqual(-1, ParsingPrimitives.DecodeZigZag32(WritingPrimitives.EncodeZigZag32(-1)));
|
||||
Assert.AreEqual(14927, ParsingPrimitives.DecodeZigZag32(WritingPrimitives.EncodeZigZag32(14927)));
|
||||
Assert.AreEqual(-3612, ParsingPrimitives.DecodeZigZag32(WritingPrimitives.EncodeZigZag32(-3612)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RoundTripZigZag64()
|
||||
{
|
||||
Assert.AreEqual(0, ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(0)));
|
||||
Assert.AreEqual(1, ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(1)));
|
||||
Assert.AreEqual(-1, ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(-1)));
|
||||
Assert.AreEqual(14927, ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(14927)));
|
||||
Assert.AreEqual(-3612, ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(-3612)));
|
||||
|
||||
Assert.AreEqual(856912304801416L,
|
||||
ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(856912304801416L)));
|
||||
Assert.AreEqual(-75123905439571256L,
|
||||
ParsingPrimitives.DecodeZigZag64(WritingPrimitives.EncodeZigZag64(-75123905439571256L)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNegativeEnumNoTag()
|
||||
{
|
||||
Assert.AreEqual(10, CodedOutputStream.ComputeInt32Size(-2));
|
||||
Assert.AreEqual(10, CodedOutputStream.ComputeEnumSize((int) SampleEnum.NegativeValue));
|
||||
|
||||
byte[] bytes = new byte[10];
|
||||
CodedOutputStream output = new CodedOutputStream(bytes);
|
||||
output.WriteEnum((int) SampleEnum.NegativeValue);
|
||||
|
||||
Assert.AreEqual(0, output.SpaceLeft);
|
||||
Assert.AreEqual("FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCodedInputOutputPosition()
|
||||
{
|
||||
byte[] content = new byte[110];
|
||||
for (int i = 0; i < content.Length; i++)
|
||||
content[i] = (byte)i;
|
||||
|
||||
byte[] child = new byte[120];
|
||||
{
|
||||
MemoryStream ms = new MemoryStream(child);
|
||||
CodedOutputStream cout = new CodedOutputStream(ms, 20);
|
||||
// Field 11: numeric value: 500
|
||||
cout.WriteTag(11, WireFormat.WireType.Varint);
|
||||
Assert.AreEqual(1, cout.Position);
|
||||
cout.WriteInt32(500);
|
||||
Assert.AreEqual(3, cout.Position);
|
||||
//Field 12: length delimited 120 bytes
|
||||
cout.WriteTag(12, WireFormat.WireType.LengthDelimited);
|
||||
Assert.AreEqual(4, cout.Position);
|
||||
cout.WriteBytes(ByteString.CopyFrom(content));
|
||||
Assert.AreEqual(115, cout.Position);
|
||||
// Field 13: fixed numeric value: 501
|
||||
cout.WriteTag(13, WireFormat.WireType.Fixed32);
|
||||
Assert.AreEqual(116, cout.Position);
|
||||
cout.WriteSFixed32(501);
|
||||
Assert.AreEqual(120, cout.Position);
|
||||
cout.Flush();
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[130];
|
||||
{
|
||||
CodedOutputStream cout = new CodedOutputStream(bytes);
|
||||
// Field 1: numeric value: 500
|
||||
cout.WriteTag(1, WireFormat.WireType.Varint);
|
||||
Assert.AreEqual(1, cout.Position);
|
||||
cout.WriteInt32(500);
|
||||
Assert.AreEqual(3, cout.Position);
|
||||
//Field 2: length delimited 120 bytes
|
||||
cout.WriteTag(2, WireFormat.WireType.LengthDelimited);
|
||||
Assert.AreEqual(4, cout.Position);
|
||||
cout.WriteBytes(ByteString.CopyFrom(child));
|
||||
Assert.AreEqual(125, cout.Position);
|
||||
// Field 3: fixed numeric value: 500
|
||||
cout.WriteTag(3, WireFormat.WireType.Fixed32);
|
||||
Assert.AreEqual(126, cout.Position);
|
||||
cout.WriteSFixed32(501);
|
||||
Assert.AreEqual(130, cout.Position);
|
||||
cout.Flush();
|
||||
}
|
||||
// Now test Input stream:
|
||||
{
|
||||
CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0, false);
|
||||
Assert.AreEqual(0, cin.Position);
|
||||
// Field 1:
|
||||
uint tag = cin.ReadTag();
|
||||
Assert.AreEqual(1, tag >> 3);
|
||||
Assert.AreEqual(1, cin.Position);
|
||||
Assert.AreEqual(500, cin.ReadInt32());
|
||||
Assert.AreEqual(3, cin.Position);
|
||||
//Field 2:
|
||||
tag = cin.ReadTag();
|
||||
Assert.AreEqual(2, tag >> 3);
|
||||
Assert.AreEqual(4, cin.Position);
|
||||
int childlen = cin.ReadLength();
|
||||
Assert.AreEqual(120, childlen);
|
||||
Assert.AreEqual(5, cin.Position);
|
||||
int oldlimit = cin.PushLimit((int)childlen);
|
||||
Assert.AreEqual(5, cin.Position);
|
||||
// Now we are reading child message
|
||||
{
|
||||
// Field 11: numeric value: 500
|
||||
tag = cin.ReadTag();
|
||||
Assert.AreEqual(11, tag >> 3);
|
||||
Assert.AreEqual(6, cin.Position);
|
||||
Assert.AreEqual(500, cin.ReadInt32());
|
||||
Assert.AreEqual(8, cin.Position);
|
||||
//Field 12: length delimited 120 bytes
|
||||
tag = cin.ReadTag();
|
||||
Assert.AreEqual(12, tag >> 3);
|
||||
Assert.AreEqual(9, cin.Position);
|
||||
ByteString bstr = cin.ReadBytes();
|
||||
Assert.AreEqual(110, bstr.Length);
|
||||
Assert.AreEqual((byte) 109, bstr[109]);
|
||||
Assert.AreEqual(120, cin.Position);
|
||||
// Field 13: fixed numeric value: 501
|
||||
tag = cin.ReadTag();
|
||||
Assert.AreEqual(13, tag >> 3);
|
||||
// ROK - Previously broken here, this returned 126 failing to account for bufferSizeAfterLimit
|
||||
Assert.AreEqual(121, cin.Position);
|
||||
Assert.AreEqual(501, cin.ReadSFixed32());
|
||||
Assert.AreEqual(125, cin.Position);
|
||||
Assert.IsTrue(cin.IsAtEnd);
|
||||
}
|
||||
cin.PopLimit(oldlimit);
|
||||
Assert.AreEqual(125, cin.Position);
|
||||
// Field 3: fixed numeric value: 501
|
||||
tag = cin.ReadTag();
|
||||
Assert.AreEqual(3, tag >> 3);
|
||||
Assert.AreEqual(126, cin.Position);
|
||||
Assert.AreEqual(501, cin.ReadSFixed32());
|
||||
Assert.AreEqual(130, cin.Position);
|
||||
Assert.IsTrue(cin.IsAtEnd);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Dispose_DisposesUnderlyingStream()
|
||||
{
|
||||
var memoryStream = new MemoryStream();
|
||||
Assert.IsTrue(memoryStream.CanWrite);
|
||||
using (var cos = new CodedOutputStream(memoryStream))
|
||||
{
|
||||
cos.WriteRawBytes(new byte[] {0});
|
||||
Assert.AreEqual(0, memoryStream.Position); // Not flushed yet
|
||||
}
|
||||
Assert.AreEqual(1, memoryStream.ToArray().Length); // Flushed data from CodedOutputStream to MemoryStream
|
||||
Assert.IsFalse(memoryStream.CanWrite); // Disposed
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Dispose_WithLeaveOpen()
|
||||
{
|
||||
var memoryStream = new MemoryStream();
|
||||
Assert.IsTrue(memoryStream.CanWrite);
|
||||
using (var cos = new CodedOutputStream(memoryStream, true))
|
||||
{
|
||||
cos.WriteRawBytes(new byte[] {0});
|
||||
Assert.AreEqual(0, memoryStream.Position); // Not flushed yet
|
||||
}
|
||||
Assert.AreEqual(1, memoryStream.Position); // Flushed data from CodedOutputStream to MemoryStream
|
||||
Assert.IsTrue(memoryStream.CanWrite); // We left the stream open
|
||||
}
|
||||
}
|
||||
}
|
@ -1,55 +1,55 @@
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2015 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Google.Protobuf.TestProtos;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
public class DeprecatedMemberTest
|
||||
{
|
||||
private static void AssertIsDeprecated(MemberInfo member)
|
||||
{
|
||||
Assert.NotNull(member);
|
||||
Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDepreatedPrimitiveValue()
|
||||
{
|
||||
AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty("DeprecatedInt32"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2015 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Google.Protobuf.TestProtos;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
public class DeprecatedMemberTest
|
||||
{
|
||||
private static void AssertIsDeprecated(MemberInfo member)
|
||||
{
|
||||
Assert.NotNull(member);
|
||||
Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDepreatedPrimitiveValue()
|
||||
{
|
||||
AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty("DeprecatedInt32"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,10 +2,11 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net451;netcoreapp2.1</TargetFrameworks>
|
||||
<TargetFrameworks>net451;netcoreapp3.1</TargetFrameworks>
|
||||
<AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<IsPackable>False</IsPackable>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,82 +1,82 @@
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using Google.Protobuf.Reflection;
|
||||
using UnitTest.Issues.TestProtos;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for issues which aren't easily compartmentalized into other unit tests.
|
||||
/// </summary>
|
||||
public class IssuesTest
|
||||
{
|
||||
// Issue 45
|
||||
[Test]
|
||||
public void FieldCalledItem()
|
||||
{
|
||||
ItemField message = new ItemField { Item = 3 };
|
||||
FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");
|
||||
Assert.NotNull(field);
|
||||
Assert.AreEqual(3, (int)field.Accessor.GetValue(message));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReservedNames()
|
||||
{
|
||||
var message = new ReservedNames { Types_ = 10, Descriptor_ = 20 };
|
||||
// Underscores aren't reflected in the JSON.
|
||||
Assert.AreEqual("{ \"types\": 10, \"descriptor\": 20 }", message.ToString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void JsonNameParseTest()
|
||||
{
|
||||
var settings = new JsonParser.Settings(10, TypeRegistry.FromFiles(UnittestIssuesReflection.Descriptor));
|
||||
var parser = new JsonParser(settings);
|
||||
|
||||
// It is safe to use either original field name or explicitly specified json_name
|
||||
Assert.AreEqual(new TestJsonName { Name = "test", Description = "test2", Guid = "test3" },
|
||||
parser.Parse<TestJsonName>("{ \"name\": \"test\", \"desc\": \"test2\", \"guid\": \"test3\" }"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void JsonNameFormatTest()
|
||||
{
|
||||
var message = new TestJsonName { Name = "test", Description = "test2", Guid = "test3" };
|
||||
Assert.AreEqual("{ \"name\": \"test\", \"desc\": \"test2\", \"exid\": \"test3\" }",
|
||||
JsonFormatter.Default.Format(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using Google.Protobuf.Reflection;
|
||||
using UnitTest.Issues.TestProtos;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for issues which aren't easily compartmentalized into other unit tests.
|
||||
/// </summary>
|
||||
public class IssuesTest
|
||||
{
|
||||
// Issue 45
|
||||
[Test]
|
||||
public void FieldCalledItem()
|
||||
{
|
||||
ItemField message = new ItemField { Item = 3 };
|
||||
FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");
|
||||
Assert.NotNull(field);
|
||||
Assert.AreEqual(3, (int)field.Accessor.GetValue(message));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReservedNames()
|
||||
{
|
||||
var message = new ReservedNames { Types_ = 10, Descriptor_ = 20 };
|
||||
// Underscores aren't reflected in the JSON.
|
||||
Assert.AreEqual("{ \"types\": 10, \"descriptor\": 20 }", message.ToString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void JsonNameParseTest()
|
||||
{
|
||||
var settings = new JsonParser.Settings(10, TypeRegistry.FromFiles(UnittestIssuesReflection.Descriptor));
|
||||
var parser = new JsonParser(settings);
|
||||
|
||||
// It is safe to use either original field name or explicitly specified json_name
|
||||
Assert.AreEqual(new TestJsonName { Name = "test", Description = "test2", Guid = "test3" },
|
||||
parser.Parse<TestJsonName>("{ \"name\": \"test\", \"desc\": \"test2\", \"guid\": \"test3\" }"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void JsonNameFormatTest()
|
||||
{
|
||||
var message = new TestJsonName { Name = "test", Description = "test2", Guid = "test3" };
|
||||
Assert.AreEqual("{ \"name\": \"test\", \"desc\": \"test2\", \"exid\": \"test3\" }",
|
||||
JsonFormatter.Default.Format(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,62 +1,62 @@
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using UnitTest.Issues.TestProtos;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
public class TestCornerCases
|
||||
{
|
||||
[Test]
|
||||
public void TestRoundTripNegativeEnums()
|
||||
{
|
||||
NegativeEnumMessage msg = new NegativeEnumMessage
|
||||
{
|
||||
Value = NegativeEnum.MinusOne,
|
||||
Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow },
|
||||
PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }
|
||||
};
|
||||
|
||||
Assert.AreEqual(58, msg.CalculateSize());
|
||||
|
||||
byte[] bytes = new byte[58];
|
||||
CodedOutputStream output = new CodedOutputStream(bytes);
|
||||
|
||||
msg.WriteTo(output);
|
||||
Assert.AreEqual(0, output.SpaceLeft);
|
||||
|
||||
NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(bytes);
|
||||
Assert.AreEqual(msg, copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using UnitTest.Issues.TestProtos;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
public class TestCornerCases
|
||||
{
|
||||
[Test]
|
||||
public void TestRoundTripNegativeEnums()
|
||||
{
|
||||
NegativeEnumMessage msg = new NegativeEnumMessage
|
||||
{
|
||||
Value = NegativeEnum.MinusOne,
|
||||
Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow },
|
||||
PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }
|
||||
};
|
||||
|
||||
Assert.AreEqual(58, msg.CalculateSize());
|
||||
|
||||
byte[] bytes = new byte[58];
|
||||
CodedOutputStream output = new CodedOutputStream(bytes);
|
||||
|
||||
msg.WriteTo(output);
|
||||
Assert.AreEqual(0, output.SpaceLeft);
|
||||
|
||||
NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(bytes);
|
||||
Assert.AreEqual(msg, copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ function run_test() {
|
||||
dotnet restore src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
|
||||
dotnet build -c Release src/Google.Protobuf/Google.Protobuf.csproj
|
||||
dotnet build -c Release src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
|
||||
dotnet run -c Release -f netcoreapp2.1 -p src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
|
||||
dotnet run -c Release -f netcoreapp3.1 -p src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
|
||||
}
|
||||
|
||||
set -ex
|
||||
|
@ -13,7 +13,9 @@ pushd $(dirname $0)/..
|
||||
# Windows and Unix.
|
||||
if [ -z "$PROTOC" ]; then
|
||||
# TODO(jonskeet): Use an array and a for loop instead?
|
||||
if [ -x cmake/build/Debug/protoc.exe ]; then
|
||||
if [ -x solution/Debug/protoc.exe ]; then
|
||||
PROTOC=solution/Debug/protoc.exe
|
||||
elif [ -x cmake/build/Debug/protoc.exe ]; then
|
||||
PROTOC=cmake/build/Debug/protoc.exe
|
||||
elif [ -x cmake/build/Release/protoc.exe ]; then
|
||||
PROTOC=cmake/build/Release/protoc.exe
|
||||
|
@ -16,5 +16,5 @@ Invoke-WebRequest -Uri $InstallScriptUrl -OutFile $InstallScriptPath
|
||||
|
||||
# The SDK versions to install should be kept in sync with versions
|
||||
# installed by kokoro/linux/dockerfile/test/csharp/Dockerfile
|
||||
&$InstallScriptPath -Version 2.1.802
|
||||
&$InstallScriptPath -Version 5.0.102
|
||||
&$InstallScriptPath -Version 3.1.415
|
||||
&$InstallScriptPath -Version 6.0.100
|
||||
|
@ -156,3 +156,17 @@ message MixedRegularAndOptional {
|
||||
string regular_field = 1;
|
||||
optional string optional_field = 2;
|
||||
}
|
||||
|
||||
message OneofWithNoneField {
|
||||
oneof test {
|
||||
string x = 1;
|
||||
string none = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message OneofWithNoneName {
|
||||
oneof none {
|
||||
string x = 1;
|
||||
string y = 2;
|
||||
}
|
||||
}
|
@ -1,132 +1,130 @@
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Google.Protobuf.Examples.AddressBook
|
||||
{
|
||||
internal class AddPerson
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds a person based on user input
|
||||
/// </summary>
|
||||
private static Person PromptForAddress(TextReader input, TextWriter output)
|
||||
{
|
||||
Person person = new Person();
|
||||
|
||||
output.Write("Enter person ID: ");
|
||||
person.Id = int.Parse(input.ReadLine());
|
||||
|
||||
output.Write("Enter name: ");
|
||||
person.Name = input.ReadLine();
|
||||
|
||||
output.Write("Enter email address (blank for none): ");
|
||||
string email = input.ReadLine();
|
||||
if (email.Length > 0)
|
||||
{
|
||||
person.Email = email;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
output.Write("Enter a phone number (or leave blank to finish): ");
|
||||
string number = input.ReadLine();
|
||||
if (number.Length == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Person.Types.PhoneNumber phoneNumber = new Person.Types.PhoneNumber { Number = number };
|
||||
|
||||
output.Write("Is this a mobile, home, or work phone? ");
|
||||
String type = input.ReadLine();
|
||||
switch (type)
|
||||
{
|
||||
case "mobile":
|
||||
phoneNumber.Type = Person.Types.PhoneType.Mobile;
|
||||
break;
|
||||
case "home":
|
||||
phoneNumber.Type = Person.Types.PhoneType.Home;
|
||||
break;
|
||||
case "work":
|
||||
phoneNumber.Type = Person.Types.PhoneType.Work;
|
||||
break;
|
||||
default:
|
||||
output.Write("Unknown phone type. Using default.");
|
||||
break;
|
||||
}
|
||||
|
||||
person.Phones.Add(phoneNumber);
|
||||
}
|
||||
return person;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry point - loads an existing addressbook or creates a new one,
|
||||
/// then writes it back to the file.
|
||||
/// </summary>
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
Console.Error.WriteLine("Usage: AddPerson ADDRESS_BOOK_FILE");
|
||||
return -1;
|
||||
}
|
||||
|
||||
AddressBook addressBook;
|
||||
|
||||
if (File.Exists(args[0]))
|
||||
{
|
||||
using (Stream file = File.OpenRead(args[0]))
|
||||
{
|
||||
addressBook = AddressBook.Parser.ParseFrom(file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("{0}: File not found. Creating a new file.", args[0]);
|
||||
addressBook = new AddressBook();
|
||||
}
|
||||
|
||||
// Add an address.
|
||||
addressBook.People.Add(PromptForAddress(Console.In, Console.Out));
|
||||
|
||||
// Write the new address book back to disk.
|
||||
using (Stream output = File.OpenWrite(args[0]))
|
||||
{
|
||||
addressBook.WriteTo(output);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Google.Protobuf.Examples.AddressBook
|
||||
{
|
||||
internal class AddPerson
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds a person based on user input
|
||||
/// </summary>
|
||||
private static Person PromptForAddress(TextReader input, TextWriter output)
|
||||
{
|
||||
Person person = new Person();
|
||||
|
||||
output.Write("Enter person ID: ");
|
||||
person.Id = int.Parse(input.ReadLine());
|
||||
|
||||
output.Write("Enter name: ");
|
||||
person.Name = input.ReadLine();
|
||||
|
||||
output.Write("Enter email address (blank for none): ");
|
||||
string email = input.ReadLine();
|
||||
if (email.Length > 0)
|
||||
{
|
||||
person.Email = email;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
output.Write("Enter a phone number (or leave blank to finish): ");
|
||||
string number = input.ReadLine();
|
||||
if (number.Length == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Person.Types.PhoneNumber phoneNumber = new Person.Types.PhoneNumber { Number = number };
|
||||
|
||||
output.Write("Is this a mobile, home, or work phone? ");
|
||||
String type = input.ReadLine();
|
||||
switch (type)
|
||||
{
|
||||
case "mobile":
|
||||
phoneNumber.Type = Person.Types.PhoneType.Mobile;
|
||||
break;
|
||||
case "home":
|
||||
phoneNumber.Type = Person.Types.PhoneType.Home;
|
||||
break;
|
||||
case "work":
|
||||
phoneNumber.Type = Person.Types.PhoneType.Work;
|
||||
break;
|
||||
default:
|
||||
output.Write("Unknown phone type. Using default.");
|
||||
break;
|
||||
}
|
||||
|
||||
person.Phones.Add(phoneNumber);
|
||||
}
|
||||
return person;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry point - loads an existing addressbook or creates a new one,
|
||||
/// then writes it back to the file.
|
||||
/// </summary>
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
Console.Error.WriteLine("Usage: AddPerson ADDRESS_BOOK_FILE");
|
||||
return -1;
|
||||
}
|
||||
|
||||
AddressBook addressBook;
|
||||
|
||||
if (File.Exists(args[0]))
|
||||
{
|
||||
using Stream file = File.OpenRead(args[0]);
|
||||
addressBook = AddressBook.Parser.ParseFrom(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("{0}: File not found. Creating a new file.", args[0]);
|
||||
addressBook = new AddressBook();
|
||||
}
|
||||
|
||||
// Add an address.
|
||||
addressBook.People.Add(PromptForAddress(Console.In, Console.Out));
|
||||
|
||||
// Write the new address book back to disk.
|
||||
using (Stream output = File.OpenWrite(args[0]))
|
||||
{
|
||||
addressBook.WriteTo(output);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<StartupObject>Google.Protobuf.Examples.AddressBook.Program</StartupObject>
|
||||
<IsPackable>False</IsPackable>
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: addressbook.proto
|
||||
// </auto-generated>
|
||||
#pragma warning disable 1591, 0612, 3021
|
||||
#pragma warning disable 1591, 0612, 3021, 8981
|
||||
#region Designer generated code
|
||||
|
||||
using pb = global::Google.Protobuf;
|
||||
@ -32,9 +32,10 @@ namespace Google.Protobuf.Examples.AddressBook {
|
||||
"Eg4KBm51bWJlchgBIAEoCRIoCgR0eXBlGAIgASgOMhoudHV0b3JpYWwuUGVy",
|
||||
"c29uLlBob25lVHlwZSIrCglQaG9uZVR5cGUSCgoGTU9CSUxFEAASCAoESE9N",
|
||||
"RRABEggKBFdPUksQAiIvCgtBZGRyZXNzQm9vaxIgCgZwZW9wbGUYASADKAsy",
|
||||
"EC50dXRvcmlhbC5QZXJzb25CZgobY29tLmV4YW1wbGUudHV0b3JpYWwucHJv",
|
||||
"dG9zQhFBZGRyZXNzQm9va1Byb3Rvc1ABWgsuLi90dXRvcmlhbKoCJEdvb2ds",
|
||||
"ZS5Qcm90b2J1Zi5FeGFtcGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z"));
|
||||
"EC50dXRvcmlhbC5QZXJzb25ClQEKG2NvbS5leGFtcGxlLnR1dG9yaWFsLnBy",
|
||||
"b3Rvc0IRQWRkcmVzc0Jvb2tQcm90b3NQAVo6Z2l0aHViLmNvbS9wcm90b2Nv",
|
||||
"bGJ1ZmZlcnMvcHJvdG9idWYvZXhhbXBsZXMvZ28vdHV0b3JpYWxwYqoCJEdv",
|
||||
"b2dsZS5Qcm90b2J1Zi5FeGFtcGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z"));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, },
|
||||
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
|
||||
|
@ -1,99 +1,99 @@
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Google.Protobuf.Examples.AddressBook
|
||||
{
|
||||
internal class ListPeople
|
||||
{
|
||||
/// <summary>
|
||||
/// Iterates though all people in the AddressBook and prints info about them.
|
||||
/// </summary>
|
||||
private static void Print(AddressBook addressBook)
|
||||
{
|
||||
foreach (Person person in addressBook.People)
|
||||
{
|
||||
Console.WriteLine("Person ID: {0}", person.Id);
|
||||
Console.WriteLine(" Name: {0}", person.Name);
|
||||
if (person.Email != "")
|
||||
{
|
||||
Console.WriteLine(" E-mail address: {0}", person.Email);
|
||||
}
|
||||
|
||||
foreach (Person.Types.PhoneNumber phoneNumber in person.Phones)
|
||||
{
|
||||
switch (phoneNumber.Type)
|
||||
{
|
||||
case Person.Types.PhoneType.Mobile:
|
||||
Console.Write(" Mobile phone #: ");
|
||||
break;
|
||||
case Person.Types.PhoneType.Home:
|
||||
Console.Write(" Home phone #: ");
|
||||
break;
|
||||
case Person.Types.PhoneType.Work:
|
||||
Console.Write(" Work phone #: ");
|
||||
break;
|
||||
}
|
||||
Console.WriteLine(phoneNumber.Number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry point - loads the addressbook and then displays it.
|
||||
/// </summary>
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
Console.Error.WriteLine("Usage: ListPeople ADDRESS_BOOK_FILE");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!File.Exists(args[0]))
|
||||
{
|
||||
Console.WriteLine("{0} doesn't exist. Add a person to create the file first.", args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Read the existing address book.
|
||||
using (Stream stream = File.OpenRead(args[0]))
|
||||
{
|
||||
AddressBook addressBook = AddressBook.Parser.ParseFrom(stream);
|
||||
Print(addressBook);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Google.Protobuf.Examples.AddressBook
|
||||
{
|
||||
internal class ListPeople
|
||||
{
|
||||
/// <summary>
|
||||
/// Iterates though all people in the AddressBook and prints info about them.
|
||||
/// </summary>
|
||||
private static void Print(AddressBook addressBook)
|
||||
{
|
||||
foreach (Person person in addressBook.People)
|
||||
{
|
||||
Console.WriteLine("Person ID: {0}", person.Id);
|
||||
Console.WriteLine(" Name: {0}", person.Name);
|
||||
if (person.Email != "")
|
||||
{
|
||||
Console.WriteLine(" E-mail address: {0}", person.Email);
|
||||
}
|
||||
|
||||
foreach (Person.Types.PhoneNumber phoneNumber in person.Phones)
|
||||
{
|
||||
switch (phoneNumber.Type)
|
||||
{
|
||||
case Person.Types.PhoneType.Mobile:
|
||||
Console.Write(" Mobile phone #: ");
|
||||
break;
|
||||
case Person.Types.PhoneType.Home:
|
||||
Console.Write(" Home phone #: ");
|
||||
break;
|
||||
case Person.Types.PhoneType.Work:
|
||||
Console.Write(" Work phone #: ");
|
||||
break;
|
||||
}
|
||||
Console.WriteLine(phoneNumber.Number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry point - loads the addressbook and then displays it.
|
||||
/// </summary>
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
Console.Error.WriteLine("Usage: ListPeople ADDRESS_BOOK_FILE");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!File.Exists(args[0]))
|
||||
{
|
||||
Console.WriteLine("{0} doesn't exist. Add a person to create the file first.", args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Read the existing address book.
|
||||
using (Stream stream = File.OpenRead(args[0]))
|
||||
{
|
||||
AddressBook addressBook = AddressBook.Parser.ParseFrom(stream);
|
||||
Print(addressBook);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,95 +1,95 @@
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace Google.Protobuf.Examples.AddressBook
|
||||
{
|
||||
/// <summary>
|
||||
/// Entry point. Repeatedly prompts user for an action to take, delegating actual behaviour
|
||||
/// to individual actions. Each action has its own Main method, so that it can be used as an
|
||||
/// individual complete program.
|
||||
/// </summary>
|
||||
internal class Program
|
||||
{
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
if (args.Length > 1)
|
||||
{
|
||||
Console.Error.WriteLine("Usage: AddressBook [file]");
|
||||
Console.Error.WriteLine("If the filename isn't specified, \"addressbook.data\" is used instead.");
|
||||
return 1;
|
||||
}
|
||||
string addressBookFile = args.Length > 0 ? args[0] : "addressbook.data";
|
||||
|
||||
bool stopping = false;
|
||||
while (!stopping)
|
||||
{
|
||||
Console.WriteLine("Options:");
|
||||
Console.WriteLine(" L: List contents");
|
||||
Console.WriteLine(" A: Add new person");
|
||||
Console.WriteLine(" Q: Quit");
|
||||
Console.Write("Action? ");
|
||||
Console.Out.Flush();
|
||||
char choice = Console.ReadKey().KeyChar;
|
||||
Console.WriteLine();
|
||||
try
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case 'A':
|
||||
case 'a':
|
||||
AddPerson.Main(new string[] {addressBookFile});
|
||||
break;
|
||||
case 'L':
|
||||
case 'l':
|
||||
ListPeople.Main(new string[] {addressBookFile});
|
||||
break;
|
||||
case 'Q':
|
||||
case 'q':
|
||||
stopping = true;
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Unknown option: {0}", choice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception executing action: {0}", e);
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace Google.Protobuf.Examples.AddressBook
|
||||
{
|
||||
/// <summary>
|
||||
/// Entry point. Repeatedly prompts user for an action to take, delegating actual behaviour
|
||||
/// to individual actions. Each action has its own Main method, so that it can be used as an
|
||||
/// individual complete program.
|
||||
/// </summary>
|
||||
internal class Program
|
||||
{
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
if (args.Length > 1)
|
||||
{
|
||||
Console.Error.WriteLine("Usage: AddressBook [file]");
|
||||
Console.Error.WriteLine("If the filename isn't specified, \"addressbook.data\" is used instead.");
|
||||
return 1;
|
||||
}
|
||||
string addressBookFile = args.Length > 0 ? args[0] : "addressbook.data";
|
||||
|
||||
bool stopping = false;
|
||||
while (!stopping)
|
||||
{
|
||||
Console.WriteLine("Options:");
|
||||
Console.WriteLine(" L: List contents");
|
||||
Console.WriteLine(" A: Add new person");
|
||||
Console.WriteLine(" Q: Quit");
|
||||
Console.Write("Action? ");
|
||||
Console.Out.Flush();
|
||||
char choice = Console.ReadKey().KeyChar;
|
||||
Console.WriteLine();
|
||||
try
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case 'A':
|
||||
case 'a':
|
||||
AddPerson.Main(new string[] {addressBookFile});
|
||||
break;
|
||||
case 'L':
|
||||
case 'l':
|
||||
ListPeople.Main(new string[] {addressBookFile});
|
||||
break;
|
||||
case 'Q':
|
||||
case 'q':
|
||||
stopping = true;
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Unknown option: {0}", choice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception executing action: {0}", e);
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,73 +1,73 @@
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Google.Protobuf.Examples.AddressBook
|
||||
{
|
||||
internal class SampleUsage
|
||||
{
|
||||
private static void Main()
|
||||
{
|
||||
byte[] bytes;
|
||||
// Create a new person
|
||||
Person person = new Person
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Foo",
|
||||
Email = "foo@bar",
|
||||
Phones = { new Person.Types.PhoneNumber { Number = "555-1212" } }
|
||||
};
|
||||
using (MemoryStream stream = new MemoryStream())
|
||||
{
|
||||
// Save the person to a stream
|
||||
person.WriteTo(stream);
|
||||
bytes = stream.ToArray();
|
||||
}
|
||||
Person copy = Person.Parser.ParseFrom(bytes);
|
||||
|
||||
AddressBook book = new AddressBook
|
||||
{
|
||||
People = { copy }
|
||||
};
|
||||
bytes = book.ToByteArray();
|
||||
// And read the address book back again
|
||||
AddressBook restored = AddressBook.Parser.ParseFrom(bytes);
|
||||
// The message performs a deep-comparison on equality:
|
||||
if (restored.People.Count != 1 || !person.Equals(restored.People[0]))
|
||||
{
|
||||
throw new Exception("There is a bad person in here!");
|
||||
}
|
||||
}
|
||||
}
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Google.Protobuf.Examples.AddressBook
|
||||
{
|
||||
internal class SampleUsage
|
||||
{
|
||||
private static void Main()
|
||||
{
|
||||
byte[] bytes;
|
||||
// Create a new person
|
||||
Person person = new Person
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Foo",
|
||||
Email = "foo@bar",
|
||||
Phones = { new Person.Types.PhoneNumber { Number = "555-1212" } }
|
||||
};
|
||||
using (MemoryStream stream = new MemoryStream())
|
||||
{
|
||||
// Save the person to a stream
|
||||
person.WriteTo(stream);
|
||||
bytes = stream.ToArray();
|
||||
}
|
||||
Person copy = Person.Parser.ParseFrom(bytes);
|
||||
|
||||
AddressBook book = new AddressBook
|
||||
{
|
||||
People = { copy }
|
||||
};
|
||||
bytes = book.ToByteArray();
|
||||
// And read the address book back again
|
||||
AddressBook restored = AddressBook.Parser.ParseFrom(bytes);
|
||||
// The message performs a deep-comparison on equality:
|
||||
if (restored.People.Count != 1 || !person.Equals(restored.People[0]))
|
||||
{
|
||||
throw new Exception("There is a bad person in here!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
csharp/src/Directory.Build.props
Normal file
7
csharp/src/Directory.Build.props
Normal file
@ -0,0 +1,7 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -72,16 +72,14 @@ namespace Google.Protobuf.Benchmarks
|
||||
|
||||
private static byte[] LoadData(string resource)
|
||||
{
|
||||
using (var stream = typeof(GoogleMessageBenchmark).Assembly.GetManifestResourceStream($"Google.Protobuf.Benchmarks.{resource}"))
|
||||
using var stream = typeof(GoogleMessageBenchmark).Assembly.GetManifestResourceStream($"Google.Protobuf.Benchmarks.{resource}");
|
||||
if (stream == null)
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentException($"Unable to load embedded resource {resource}");
|
||||
}
|
||||
var copy = new MemoryStream();
|
||||
stream.CopyTo(copy);
|
||||
return copy.ToArray();
|
||||
throw new ArgumentException($"Unable to load embedded resource {resource}");
|
||||
}
|
||||
var copy = new MemoryStream();
|
||||
stream.CopyTo(copy);
|
||||
return copy.ToArray();
|
||||
}
|
||||
|
||||
public override string ToString() => Name;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: datasets/google_message1/proto3/benchmark_message1_proto3.proto
|
||||
// </auto-generated>
|
||||
#pragma warning disable 1591, 0612, 3021
|
||||
#pragma warning disable 1591, 0612, 3021, 8981
|
||||
#region Designer generated code
|
||||
|
||||
using pb = global::Google.Protobuf;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: benchmarks.proto
|
||||
// </auto-generated>
|
||||
#pragma warning disable 1591, 0612, 3021
|
||||
#pragma warning disable 1591, 0612, 3021, 8981
|
||||
#region Designer generated code
|
||||
|
||||
using pb = global::Google.Protobuf;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<IsPackable>False</IsPackable>
|
||||
@ -15,7 +15,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
|
||||
<ProjectReference Include="..\Google.Protobuf\Google.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -41,8 +41,8 @@ namespace Google.Protobuf.Benchmarks
|
||||
/// Benchmark for serializing and deserializing of standard datasets that are also
|
||||
/// measured by benchmarks in other languages.
|
||||
/// Over time we may wish to test the various different approaches to serialization and deserialization separately.
|
||||
/// See https://github.com/protocolbuffers/protobuf/blob/master/benchmarks/README.md
|
||||
/// See https://github.com/protocolbuffers/protobuf/blob/master/docs/performance.md
|
||||
/// See https://github.com/protocolbuffers/protobuf/blob/main/benchmarks/README.md
|
||||
/// See https://github.com/protocolbuffers/protobuf/blob/main/docs/performance.md
|
||||
/// </summary>
|
||||
[MemoryDiagnoser]
|
||||
public class GoogleMessageBenchmark
|
||||
|
@ -49,10 +49,10 @@ namespace Google.Protobuf.Benchmarks
|
||||
{
|
||||
const int MaxMessages = 100;
|
||||
|
||||
SubTest manyWrapperFieldsTest = new SubTest(CreateManyWrapperFieldsMessage(), ManyWrapperFieldsMessage.Parser, () => new ManyWrapperFieldsMessage(), MaxMessages);
|
||||
SubTest manyPrimitiveFieldsTest = new SubTest(CreateManyPrimitiveFieldsMessage(), ManyPrimitiveFieldsMessage.Parser, () => new ManyPrimitiveFieldsMessage(), MaxMessages);
|
||||
SubTest repeatedFieldTest = new SubTest(CreateRepeatedFieldMessage(), GoogleMessage1.Parser, () => new GoogleMessage1(), MaxMessages);
|
||||
SubTest emptyMessageTest = new SubTest(new Empty(), Empty.Parser, () => new Empty(), MaxMessages);
|
||||
private readonly SubTest manyWrapperFieldsTest = new(CreateManyWrapperFieldsMessage(), ManyWrapperFieldsMessage.Parser, () => new ManyWrapperFieldsMessage(), MaxMessages);
|
||||
private readonly SubTest manyPrimitiveFieldsTest = new(CreateManyPrimitiveFieldsMessage(), ManyPrimitiveFieldsMessage.Parser, () => new ManyPrimitiveFieldsMessage(), MaxMessages);
|
||||
private readonly SubTest repeatedFieldTest = new(CreateRepeatedFieldMessage(), GoogleMessage1.Parser, () => new GoogleMessage1(), MaxMessages);
|
||||
private readonly SubTest emptyMessageTest = new(new Empty(), Empty.Parser, () => new Empty(), MaxMessages);
|
||||
|
||||
public IEnumerable<int> MessageCountValues => new[] { 10, 100 };
|
||||
|
||||
@ -204,8 +204,8 @@ namespace Google.Protobuf.Benchmarks
|
||||
private readonly byte[] data;
|
||||
private readonly byte[] multipleMessagesData;
|
||||
|
||||
private ReadOnlySequence<byte> dataSequence;
|
||||
private ReadOnlySequence<byte> multipleMessagesDataSequence;
|
||||
private readonly ReadOnlySequence<byte> dataSequence;
|
||||
private readonly ReadOnlySequence<byte> multipleMessagesDataSequence;
|
||||
|
||||
public SubTest(IMessage message, MessageParser parser, Func<IMessage> factory, int maxMessageCount)
|
||||
{
|
||||
|
@ -418,7 +418,7 @@ namespace Google.Protobuf.Benchmarks
|
||||
private static byte[] CreateBufferWithRandomData(Random random, int valueCount, int encodedSize, int paddingValueCount)
|
||||
{
|
||||
int bufferSize = (valueCount + paddingValueCount) * encodedSize;
|
||||
byte[] buffer = new byte[bufferSize];
|
||||
var buffer = new byte[bufferSize];
|
||||
random.NextBytes(buffer);
|
||||
return buffer;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace Google.Protobuf.Benchmarks
|
||||
{
|
||||
class Program
|
||||
{
|
||||
// typical usage: dotnet run -c Release -f netcoreapp2.1
|
||||
// typical usage: dotnet run -c Release -f netcoreapp3.1
|
||||
// (this can profile both .net core and .net framework; for some reason
|
||||
// if you start from "-f net461", it goes horribly wrong)
|
||||
public static void Main(string[] args)
|
||||
@ -44,6 +44,4 @@ namespace Google.Protobuf.Benchmarks
|
||||
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: wrapper_benchmark_messages.proto
|
||||
// </auto-generated>
|
||||
#pragma warning disable 1591, 0612, 3021
|
||||
#pragma warning disable 1591, 0612, 3021, 8981
|
||||
#region Designer generated code
|
||||
|
||||
using pb = global::Google.Protobuf;
|
||||
|
@ -32,10 +32,7 @@
|
||||
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using System;
|
||||
using System.Buffers.Binary;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Buffers;
|
||||
using System.Text;
|
||||
|
||||
namespace Google.Protobuf.Benchmarks
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: conformance.proto
|
||||
// </auto-generated>
|
||||
#pragma warning disable 1591, 0612, 3021
|
||||
#pragma warning disable 1591, 0612, 3021, 8981
|
||||
#region Designer generated code
|
||||
|
||||
using pb = global::Google.Protobuf;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user