mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
Compare commits
447 commits
v5.36.0-rc
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b091ee68e | ||
|
|
6a21212800 | ||
|
|
b6ca8b9fb1 | ||
|
|
67322442bd | ||
|
|
d43953b4b9 | ||
|
|
b8ce5dceea | ||
|
|
f1c23cb216 | ||
|
|
ea0f2968ed | ||
|
|
ff9440f2ee | ||
|
|
734819d9dc | ||
|
|
2d75af0868 | ||
|
|
1cf5e73656 | ||
|
|
6836552e25 | ||
|
|
b445fe13b1 | ||
|
|
3df019d491 | ||
|
|
d17cf67434 | ||
|
|
d3daee4c68 | ||
|
|
9d98477ca9 | ||
|
|
7f86060aae | ||
|
|
44baf91cc1 | ||
|
|
11117398dd | ||
|
|
0258a65743 | ||
|
|
205d45b629 | ||
|
|
4d20214ca8 | ||
|
|
dee117a787 | ||
|
|
672eda6f1f | ||
|
|
f1a2ca97f8 | ||
|
|
a55c302e3f | ||
|
|
407b27d8da | ||
|
|
e712d276bc | ||
|
|
718a3e58b4 | ||
|
|
2901ce6db3 | ||
|
|
bf50167a85 | ||
|
|
39882988a9 | ||
|
|
035554bd86 | ||
|
|
e29507ff0d | ||
|
|
12d69dbd9f | ||
|
|
5957f0ecdb | ||
|
|
50c6c24a2b | ||
|
|
60a6b5f352 | ||
|
|
03e410d5f7 | ||
|
|
f6cd30a44e | ||
|
|
a972dac424 | ||
|
|
bca6336df1 | ||
|
|
8917ad8c48 | ||
|
|
9996b547f7 | ||
|
|
229a528948 | ||
|
|
2de70d7105 | ||
|
|
bdf71ccdd1 | ||
|
|
676d7209c3 | ||
|
|
e12fe75fc7 | ||
|
|
2c1ea6b8c9 | ||
|
|
d21931d398 | ||
|
|
7ef3576267 | ||
|
|
c1d8a858cd | ||
|
|
c5055727eb | ||
|
|
1a23830881 | ||
|
|
2256d8f028 | ||
|
|
6165c52793 | ||
|
|
d068b54ba6 | ||
|
|
37f78578e7 | ||
|
|
6e4f4ca54a | ||
|
|
f9f94388a3 | ||
|
|
86c32b72d9 | ||
|
|
b9c05c1d72 | ||
|
|
c8cc70ea9b | ||
|
|
bf0c808084 | ||
|
|
915853d5ef | ||
|
|
f930654518 | ||
|
|
53bc98a9f4 | ||
|
|
42879bb405 | ||
|
|
cfb934ad48 | ||
|
|
720e5468ce | ||
|
|
80d472933a | ||
|
|
857623168c | ||
|
|
d5d2b624a6 | ||
|
|
9ff0d2d197 | ||
|
|
c6b856d785 | ||
|
|
993604ee07 | ||
|
|
07eec573f3 | ||
|
|
4374cbf43b | ||
|
|
b43ac42ce0 | ||
|
|
45aa47c5a1 | ||
|
|
1e1a0a8c76 | ||
|
|
4de1634dd1 | ||
|
|
dc693bc891 | ||
|
|
d46a6ff074 | ||
|
|
b41fd533ea | ||
|
|
ced0495598 | ||
|
|
dc32c23f48 | ||
|
|
8fa07c6359 | ||
|
|
becdd958d1 | ||
|
|
944d9909ce | ||
|
|
e5c8ffa6cd | ||
|
|
169e0f9b47 | ||
|
|
228537eb47 | ||
|
|
8da17f0e28 | ||
|
|
e7e6ef07ba | ||
|
|
7bc3164ec0 | ||
|
|
9c38514c4a | ||
|
|
887e99f2f6 | ||
|
|
ea0cc34313 | ||
|
|
ace28407d0 | ||
|
|
93bb3d693c | ||
|
|
070ffcd902 | ||
|
|
6ac0b13685 | ||
|
|
5d9ce4859e | ||
|
|
07e0a39f1b | ||
|
|
cba090367e | ||
|
|
42ceed172e | ||
|
|
6e6f4048c4 | ||
|
|
917934ce44 | ||
|
|
3420ad2527 | ||
|
|
528ec6b9e8 | ||
|
|
3116a408b6 | ||
|
|
b4479d1d0b | ||
|
|
aa2364ea8c | ||
|
|
6b336e7038 | ||
|
|
090f4cbb88 | ||
|
|
0eafd3c3e4 | ||
|
|
838d639d29 | ||
|
|
3c13af10fa | ||
|
|
e1c5f3ac47 | ||
|
|
02a9c9dec8 | ||
|
|
d0be1f2cb0 | ||
|
|
7b59c75e36 | ||
|
|
0cb030f1ad | ||
|
|
ad90aff2bf | ||
|
|
97fcd43558 | ||
|
|
66d62e385d | ||
|
|
011fbe69e9 | ||
|
|
085b305c25 | ||
|
|
91b86b0535 | ||
|
|
bae5b79a43 | ||
|
|
e8bd2b5dcc | ||
|
|
e49cfc58ea | ||
|
|
8b7fbb5927 | ||
|
|
692daead2a | ||
|
|
4fb7ff55fc | ||
|
|
c2cbda5b47 | ||
|
|
f5fba07925 | ||
|
|
9c66da89e9 | ||
|
|
22677ce80d | ||
|
|
837a9ebe5d | ||
|
|
1b27892b8b | ||
|
|
0939462046 | ||
|
|
05ff89ea93 | ||
|
|
b67d2697ae | ||
|
|
3594d5ce74 | ||
|
|
0fff4dec59 | ||
|
|
dce0d24702 | ||
|
|
e788b3ce3d | ||
|
|
f0a3f38321 | ||
|
|
6d03e4f090 | ||
|
|
dd3d3e82fc | ||
|
|
45b99dc2a9 | ||
|
|
a362a3b2fc | ||
|
|
50f810693c | ||
|
|
86dfa627be | ||
|
|
7023abcb48 | ||
|
|
89081325d7 | ||
|
|
825d5be550 | ||
|
|
b1b5f993e8 | ||
|
|
081ecdd861 | ||
|
|
958a78d900 | ||
|
|
13a30ee71d | ||
|
|
c27007fc25 | ||
|
|
eed5007774 | ||
|
|
7d7d6ab836 | ||
|
|
3ad6d39dfc | ||
|
|
313966da6e | ||
|
|
3e67e13993 | ||
|
|
338190979e | ||
|
|
b2e184385f | ||
|
|
620c9cf483 | ||
|
|
3445511e7a | ||
|
|
075b97c2d3 | ||
|
|
68cb3eaca7 | ||
|
|
18ca7a50c1 | ||
|
|
94c7e8ebc1 | ||
|
|
c0a57498c6 | ||
|
|
2787402df4 | ||
|
|
f23e709bcf | ||
|
|
bff6c119b1 | ||
|
|
0343196277 | ||
|
|
de3eafeda5 | ||
|
|
817d6b1fad | ||
|
|
77eb569b42 | ||
|
|
acaaf9187d | ||
|
|
8c137c4e09 | ||
|
|
b5ec8626b9 | ||
|
|
c799f4d308 | ||
|
|
a80ee75adb | ||
|
|
fc01f49b72 | ||
|
|
f11e6f301a | ||
|
|
1a486b330c | ||
|
|
8b350fc187 | ||
|
|
1f449c5a9c | ||
|
|
caa4c0c8d9 | ||
|
|
dd9d2ad02d | ||
|
|
42c88bf5ce | ||
|
|
81fcdf44c5 | ||
|
|
42e27e00f5 | ||
|
|
deb792c460 | ||
|
|
4e7b3d8142 | ||
|
|
51dedb854d | ||
|
|
b38629a337 | ||
|
|
0c9ba64990 | ||
|
|
0e436a47e8 | ||
|
|
e5fbe9531a | ||
|
|
71e45486e3 | ||
|
|
c74a2ae4b3 | ||
|
|
ae3f25c964 | ||
|
|
b790ca9a4b | ||
|
|
8a178c26fd | ||
|
|
713b6a4a24 | ||
|
|
a5412936c7 | ||
|
|
c5cbcf787f | ||
|
|
fabd22a454 | ||
|
|
8acef15ff3 | ||
|
|
8a04a804c9 | ||
|
|
15de228074 | ||
|
|
7c02abb54a | ||
|
|
77f5b6bd09 | ||
|
|
ea6ec8d5b1 | ||
|
|
668f9d6a7b | ||
|
|
b861e63899 | ||
|
|
2a5f909e91 | ||
|
|
fb3b72f296 | ||
|
|
d33f914118 | ||
|
|
8baed752ce | ||
|
|
8111a7473d | ||
|
|
2a36520396 | ||
|
|
706656afeb | ||
|
|
cfe0723d8a | ||
|
|
36389c23f2 | ||
|
|
457e112357 | ||
|
|
bbe3b9e4f2 | ||
|
|
a772068fea | ||
|
|
01033aca05 | ||
|
|
6ca4388f09 | ||
|
|
b97149ff4f | ||
|
|
4838f0d46f | ||
|
|
e80f5fbcfd | ||
|
|
60f509fa40 | ||
|
|
33bca9296f | ||
|
|
b5d2e8db22 | ||
|
|
aed6a821d1 | ||
|
|
43b6c37509 | ||
|
|
90257a0983 | ||
|
|
b593483f36 | ||
|
|
3273dca565 | ||
|
|
2f32a3efb2 | ||
|
|
462509e64f | ||
|
|
54fe86b091 | ||
|
|
21bfc8ad38 | ||
|
|
b95796f8c2 | ||
|
|
785c35862d | ||
|
|
6d7f56cbac | ||
|
|
8f0e127cde | ||
|
|
2ac75aab07 | ||
|
|
6f2e31b2b8 | ||
|
|
efa7be94db | ||
|
|
1e4949d09b | ||
|
|
232f2fbd50 | ||
|
|
ad6a7e8b64 | ||
|
|
a0c493ce55 | ||
|
|
a045f8497e | ||
|
|
545f3bafe4 | ||
|
|
65cf893e66 | ||
|
|
3b45e7a88c | ||
|
|
a5ac4e924a | ||
|
|
160c306671 | ||
|
|
baa02c14da | ||
|
|
572ca36fd7 | ||
|
|
5d717fd0a9 | ||
|
|
8ce2a36efd | ||
|
|
fa52ce297c | ||
|
|
9eb63e4459 | ||
|
|
785d988985 | ||
|
|
7bdbfcd927 | ||
|
|
f8dfd63322 | ||
|
|
a105c7ef15 | ||
|
|
c4be7483cb | ||
|
|
b7491e2dc3 | ||
|
|
c251d1ab57 | ||
|
|
44fa35f860 | ||
|
|
414e4142cd | ||
|
|
95a1e90ce0 | ||
|
|
61b31adf84 | ||
|
|
bd3142f3e3 | ||
|
|
74feca102c | ||
|
|
e0337ad29e | ||
|
|
fcc343eac8 | ||
|
|
3094f87854 | ||
|
|
beb01ec89a | ||
|
|
b8859ce994 | ||
|
|
d03f760689 | ||
|
|
8080b024a7 | ||
|
|
732618dc70 | ||
|
|
e96bfb2169 | ||
|
|
4bd1598566 | ||
|
|
cb440834fd | ||
|
|
6a31b747f2 | ||
|
|
be5dad556d | ||
|
|
6d040c27a9 | ||
|
|
9d632771bc | ||
|
|
3c0275c485 | ||
|
|
8815f682d8 | ||
|
|
34abf03809 | ||
|
|
b67d62ecb4 | ||
|
|
ee50197f3a | ||
|
|
d9097da9f8 | ||
|
|
106f0f1be3 | ||
|
|
feaa31c4d7 | ||
|
|
b067e70a04 | ||
|
|
9a5a50290f | ||
|
|
63df0c298b | ||
|
|
32e4fa8de9 | ||
|
|
1c1032a6a5 | ||
|
|
4de1860d20 | ||
|
|
9f6ebb28ea | ||
|
|
df1394eabb | ||
|
|
aa6c04683e | ||
|
|
6e5ed56773 | ||
|
|
1aaaaaec9f | ||
|
|
56a40d3758 | ||
|
|
9bb4aebaf9 | ||
|
|
d1d263a827 | ||
|
|
65f520debd | ||
|
|
0a4f9bc4c6 | ||
|
|
e9aa0183c7 | ||
|
|
a13f6b6ecf | ||
|
|
c587029752 | ||
|
|
5557ce1f7e | ||
|
|
6402879057 | ||
|
|
4bb2c61094 | ||
|
|
bf735f2bba | ||
|
|
ad1064c841 | ||
|
|
8eb950cb85 | ||
|
|
ed612a8b43 | ||
|
|
8ad1ef74dd | ||
|
|
bcd3166b94 | ||
|
|
26ae04feca | ||
|
|
c07d90c745 | ||
|
|
fcd6b8a9fd | ||
|
|
baeb5723ee | ||
|
|
14d12e2723 | ||
|
|
59ab79a8fa | ||
|
|
c64603bc4e | ||
|
|
b472eb92ff | ||
|
|
b29e83c8fb | ||
|
|
d6fc95d0c3 | ||
|
|
d932381f90 | ||
|
|
a848d6a337 | ||
|
|
ea1a3d62ef | ||
|
|
65429e343d | ||
|
|
6ef18f6071 | ||
|
|
927dead4c8 | ||
|
|
6d5557a46f | ||
|
|
654e980895 | ||
|
|
79756f62ab | ||
|
|
1e4863aa6d | ||
|
|
6155df9cca | ||
|
|
42b1e8ed8e | ||
|
|
caa55cbeb3 | ||
|
|
48a0e0936e | ||
|
|
f849b03c4c | ||
|
|
d781b31418 | ||
|
|
917911a3bb | ||
|
|
52f68d2e34 | ||
|
|
dbe1410096 | ||
|
|
710c70bcb3 | ||
|
|
7c77f295c7 | ||
|
|
1a06ad89e7 | ||
|
|
cd28d3e186 | ||
|
|
e9e2415586 | ||
|
|
b1bdc1c684 | ||
|
|
aae12eab72 | ||
|
|
6128a90a69 | ||
|
|
bbe28f23d3 | ||
|
|
9c3a5143de | ||
|
|
dbd4729824 | ||
|
|
736b238729 | ||
|
|
cc2ba7bdd3 | ||
|
|
2ec58f6358 | ||
|
|
400cb8cce2 | ||
|
|
25e2bb7ca3 | ||
|
|
88d6fd37bc | ||
|
|
5f47275d2e | ||
|
|
0b1b3fa234 | ||
|
|
3bc006d2c1 | ||
|
|
5ddbde2d44 | ||
|
|
a04a9435f1 | ||
|
|
6555452be3 | ||
|
|
1868179cb1 | ||
|
|
5916749838 | ||
|
|
750e6be4b2 | ||
|
|
44a1a0bbc3 | ||
|
|
65fccf3b06 | ||
|
|
b0b22dd281 | ||
|
|
352d73a92e | ||
|
|
b1a0d1bb8f | ||
|
|
b2671496b8 | ||
|
|
ec4703bbd0 | ||
|
|
87102bc215 | ||
|
|
e92b2f0d9c | ||
|
|
54c6d2e34b | ||
|
|
e5cfe139bc | ||
|
|
9b0d074ea6 | ||
|
|
f0bc0d7503 | ||
|
|
e1acb1a02e | ||
|
|
7db08e8f1b | ||
|
|
a596ea688e | ||
|
|
255635a7fa | ||
|
|
687c7d5892 | ||
|
|
4db27e1f33 | ||
|
|
774721742b | ||
|
|
27e4846f28 | ||
|
|
bba54ac9ba | ||
|
|
52e15dc46c | ||
|
|
740fdc768a | ||
|
|
00538a473f | ||
|
|
7772bbf6e3 | ||
|
|
2288b33629 | ||
|
|
5de373b683 | ||
|
|
5820d6bbbe | ||
|
|
52e82c810c | ||
|
|
a1e10dfd69 | ||
|
|
0acf2a471d | ||
|
|
2737dfcc03 | ||
|
|
7a12b7edff | ||
|
|
5fe1a68149 | ||
|
|
cb2c93944e | ||
|
|
8d75c2aeea | ||
|
|
7a39a4e313 | ||
|
|
e71940f7c9 | ||
|
|
e8df82eaef | ||
|
|
4665f8f1fc | ||
|
|
51df91d19a | ||
|
|
927c504eea | ||
|
|
4b269eb436 | ||
|
|
b7c5ce1d3c | ||
|
|
2b0b5066bd | ||
|
|
604527297c | ||
|
|
e22cabffa4 | ||
|
|
3692b2bb22 |
747 changed files with 47539 additions and 26072 deletions
|
|
@ -4,110 +4,122 @@
|
|||
{
|
||||
"email": "protobuf-packages@google.com",
|
||||
"github": "protobuf-team-bot",
|
||||
"github_user_id": 105450428,
|
||||
"name": "Protobuf Team"
|
||||
},
|
||||
{
|
||||
"email": "sandyzhang@google.com",
|
||||
"github": "zhangskz",
|
||||
"github_user_id": 89936743,
|
||||
"name": "Sandy Zhang"
|
||||
},
|
||||
{
|
||||
"email": "mkruskal@google.com",
|
||||
"github": "mkruskal-google",
|
||||
"github_user_id": 62662355,
|
||||
"name": "Mike Kruskal"
|
||||
},
|
||||
{
|
||||
"email": "gberg@google.com",
|
||||
"github": "googleberg",
|
||||
"github_user_id": 107155935,
|
||||
"name": "Jerry Berg"
|
||||
},
|
||||
{
|
||||
"email": "deannagarcia@google.com",
|
||||
"github": "deannagarcia",
|
||||
"github_user_id": 69992229,
|
||||
"name": "Deanna Garcia",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "esrauch@google.com",
|
||||
"github": "esrauchg",
|
||||
"github_user_id": 140440793,
|
||||
"name": "Em Rauch",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "haberman@google.com",
|
||||
"github": "haberman",
|
||||
"github_user_id": 1270,
|
||||
"name": "Josh Haberman",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "hongshin@google.com",
|
||||
"github": "honglooker",
|
||||
"name": "Hong Shin",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "jatl@google.com",
|
||||
"github": "JasonLunn",
|
||||
"github_user_id": 778854,
|
||||
"name": "Jason Lunn",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "jieluo@google.com",
|
||||
"github": "anandolee",
|
||||
"github_user_id": 11618033,
|
||||
"name": "Jie Luo",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "salo@google.com",
|
||||
"github": "salo",
|
||||
"github_user_id": 152465,
|
||||
"name": "Eric Salo",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "sangki@google.com",
|
||||
"github": "jguamie",
|
||||
"github_user_id": 35405521,
|
||||
"name": "John Lee",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "sbenza@google.com",
|
||||
"github": "sbenzaquen",
|
||||
"github_user_id": 14094653,
|
||||
"name": "Samuel Benzaquen",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "shaod@google.com",
|
||||
"github": "shaod2",
|
||||
"github_user_id": 67387070,
|
||||
"name": "Dennis Shao",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "tonyliaoss@google.com",
|
||||
"github": "tonyliaoss",
|
||||
"github_user_id": 1459994,
|
||||
"name": "Tony Liao",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "rgoldfinger@google.com",
|
||||
"github": "rgoldfinger6",
|
||||
"github_user_id": 94469227,
|
||||
"name": "Rachel Goldfinger",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "jamiepilgrim@google.com",
|
||||
"github": "pilgrimmemoirs",
|
||||
"github_user_id": 8316393,
|
||||
"name": "Jamie Pilgrim",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "karenwuz@google.com",
|
||||
"github": "karenwuz",
|
||||
"github_user_id": 242015323,
|
||||
"name": "Karen Wu",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "runze@google.com",
|
||||
"github": "runzw",
|
||||
"github_user_id": 78052475,
|
||||
"name": "Runze Wang",
|
||||
"do_not_notify": true
|
||||
}
|
||||
|
|
|
|||
2
.github/workflows/release_bazel_module.yaml
vendored
2
.github/workflows/release_bazel_module.yaml
vendored
|
|
@ -16,7 +16,7 @@ permissions:
|
|||
contents: write
|
||||
jobs:
|
||||
release:
|
||||
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7.3.0
|
||||
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7.7.0
|
||||
with:
|
||||
release_files: protobuf-*.bazel.tar.gz
|
||||
prerelease: ${{ contains(inputs.tag_name, '-rc') }}
|
||||
|
|
|
|||
31
.github/workflows/release_prep.sh
vendored
31
.github/workflows/release_prep.sh
vendored
|
|
@ -20,43 +20,16 @@ git archive --format=tar --prefix=${PREFIX}/ ${TAG} > $ARCHIVE_TMP
|
|||
# Delete the placeholder file
|
||||
tar --file $ARCHIVE_TMP --delete $INTEGRITY_FILE
|
||||
|
||||
# Use jq to translate GitHub Releases json into a Starlark object
|
||||
filter_releases=$(cat <<'EOF'
|
||||
# Read the file assets already present on the release
|
||||
reduce .assets[] as $a (
|
||||
# Start with an empty dictionary, and for each asset, add
|
||||
{}; . + {
|
||||
# The format required in starlark, i.e. "release-name": "deadbeef123"
|
||||
($a.name): ($a.digest | sub("^sha256:"; ""))
|
||||
}
|
||||
)
|
||||
EOF
|
||||
)
|
||||
|
||||
mkdir -p "$(dirname "$INTEGRITY_FILE")"
|
||||
|
||||
# Fetch release payload once
|
||||
RELEASE_API_URL="https://api.github.com/repos/protocolbuffers/protobuf/releases/tags/${TAG}"
|
||||
RELEASE_JSON=$(curl -sSL "$RELEASE_API_URL")
|
||||
|
||||
# Extract the download URL for tool_integrity.bzl if it exists
|
||||
# Extract the download URL for tool_integrity.bzl
|
||||
INTEGRITY_ASSET_URL=$(echo "$RELEASE_JSON" | jq -r '.assets[] | select(.name=="tool_integrity.bzl") | .browser_download_url')
|
||||
|
||||
# Check if the asset was found (jq emits "null" or empty if missing)
|
||||
if [[ -n "$INTEGRITY_ASSET_URL" && "$INTEGRITY_ASSET_URL" != "null" ]]; then
|
||||
echo "Found pre-computed tool_integrity.bzl asset! Downloading."
|
||||
curl -sSL -o "${INTEGRITY_FILE}" "$INTEGRITY_ASSET_URL"
|
||||
else
|
||||
echo "No pre-computed tool_integrity.bzl found. Falling back to dynamic API dictionary assembly."
|
||||
cat >"${INTEGRITY_FILE}" <<EOF
|
||||
"""Generated during release by release_prep.sh"""
|
||||
|
||||
RELEASE_VERSION="${TAG}"
|
||||
RELEASED_BINARY_INTEGRITY = $(
|
||||
echo "$RELEASE_JSON" | jq -f <(echo "$filter_releases")
|
||||
)
|
||||
EOF
|
||||
fi
|
||||
curl -sSL -o "${INTEGRITY_FILE}" "$INTEGRITY_ASSET_URL"
|
||||
|
||||
# Append that generated file back into the archive
|
||||
tar --file $ARCHIVE_TMP --append ${INTEGRITY_FILE}
|
||||
|
|
|
|||
36
.github/workflows/release_prep_test.sh
vendored
36
.github/workflows/release_prep_test.sh
vendored
|
|
@ -66,11 +66,38 @@ ln -sf "$TAR" "$TEST_DIR/.mock_bin/tar"
|
|||
ln -sf "$(rlocation ${JQ_BIN#"external/"})" "$TEST_DIR/.mock_bin/jq"
|
||||
|
||||
##############################
|
||||
# Fixture: mock curl returning a GitHub Releases API response
|
||||
# Fixture: mock curl returning GitHub Releases API response & handling asset downloads
|
||||
# Handles two cases:
|
||||
# 1) When -o flag is provided, mocks downloading the integrity file .bzl,
|
||||
# writing to path specified by the flag
|
||||
# 2) Otherwise, mocks retrieving the GitHub Releases API JSON, writing to stdout
|
||||
##############################
|
||||
cat > "$TEST_DIR/.mock_bin/curl" <<'MOCK'
|
||||
#!/usr/bin/env bash
|
||||
cat <<'JSON'
|
||||
outfile=""
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-o)
|
||||
outfile="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n "$outfile" ]]; then
|
||||
cat <<'BZL' > "$outfile"
|
||||
RELEASE_VERSION="v99.0"
|
||||
RELEASED_BINARY_INTEGRITY = {
|
||||
"protoc-99.0-linux-x86_64.zip": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"protoc-99.0-osx-aarch_64.zip": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
||||
"protoc-99.0-win64.zip": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
|
||||
}
|
||||
BZL
|
||||
else
|
||||
cat <<'JSON'
|
||||
{
|
||||
"assets": [
|
||||
{
|
||||
|
|
@ -84,10 +111,15 @@ cat <<'JSON'
|
|||
{
|
||||
"name": "protoc-99.0-win64.zip",
|
||||
"digest": "sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
|
||||
},
|
||||
{
|
||||
"name": "tool_integrity.bzl",
|
||||
"browser_download_url": "https://github.com/protocolbuffers/protobuf/releases/download/v99.0/tool_integrity.bzl"
|
||||
}
|
||||
]
|
||||
}
|
||||
JSON
|
||||
fi
|
||||
MOCK
|
||||
chmod +x "$TEST_DIR/.mock_bin/curl"
|
||||
export PATH="$TEST_DIR/.mock_bin:$PATH"
|
||||
|
|
|
|||
2
.github/workflows/staleness_check.yml
vendored
2
.github/workflows/staleness_check.yml
vendored
|
|
@ -52,7 +52,7 @@ jobs:
|
|||
# commit.
|
||||
uses: protocolbuffers/protobuf-ci/bazel@v5
|
||||
with:
|
||||
version: 9.0.0 # Bazel version
|
||||
version: 9.2.0 # Bazel version
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: staleness
|
||||
bash: >
|
||||
|
|
|
|||
8
.github/workflows/test_bazel.yml
vendored
8
.github/workflows/test_bazel.yml
vendored
|
|
@ -26,7 +26,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
runner: [ ubuntu, windows, macos ]
|
||||
bazelversion: [ '8.6.0', '9.0.0' ]
|
||||
bazelversion: [ '8.7.0', '9.2.0' ]
|
||||
bzlmod: [ true, false ]
|
||||
toolchain_resolution:
|
||||
# Default flags, uses from prebuilt protoc
|
||||
|
|
@ -36,7 +36,7 @@ jobs:
|
|||
# Uses protoc from source.
|
||||
- "--@com_google_protobuf//bazel/flags:prefer_prebuilt_protoc=false"
|
||||
exclude:
|
||||
- bazelversion: '9.0.0'
|
||||
- bazelversion: '9.2.0'
|
||||
bzlmod: false
|
||||
runs-on: ${{ matrix.runner }}-latest
|
||||
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Examples ${{ matrix.runner }} ${{ matrix.bazelversion }}${{ matrix.bzlmod && ' (bzlmod)' || '' }} ${{ matrix.toolchain_resolution && ' (toolchain resolution)' || '' }}
|
||||
|
|
@ -94,7 +94,7 @@ jobs:
|
|||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.2.0-4d8e80ef93b0219fb907af9dd4596b92946995d8
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: "bazel-tests"
|
||||
bazel: test //bazel/...
|
||||
|
|
@ -117,4 +117,4 @@ jobs:
|
|||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: "bazel-tests-${{ matrix.runner }}"
|
||||
bazel: test //bazel/...
|
||||
version: 8.6.0
|
||||
version: 8.7.0
|
||||
|
|
|
|||
72
.github/workflows/test_cpp.yml
vendored
72
.github/workflows/test_cpp.yml
vendored
|
|
@ -37,25 +37,25 @@ jobs:
|
|||
- { name: No-RTTI, flags: --cxxopt=-fno-rtti, continuous-only: true }
|
||||
include:
|
||||
# Set defaults
|
||||
- image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:8.0.1-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
- image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:8.7.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
- targets: //pkg/... //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests
|
||||
# Override cases with custom images
|
||||
- config: { name: "Bazel8", flags: --cxxopt="-Wno-self-assign-overloaded" }
|
||||
cache_key: Bazel8
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.6.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c"
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.7.0-4d8e80ef93b0219fb907af9dd4596b92946995d8"
|
||||
targets: "//src/... //third_party/utf8_range/..."
|
||||
- config: { name: "Bazel9", flags: "--cxxopt=-Wno-self-assign-overloaded" }
|
||||
cache_key: Bazel9
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c"
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.2.0-4d8e80ef93b0219fb907af9dd4596b92946995d8"
|
||||
targets: "//src/... //third_party/utf8_range/..."
|
||||
- config: { name: "TCMalloc" }
|
||||
cache_key: TcMalloc
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc:8.0.1-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12"
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc:8.7.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 "
|
||||
targets: "//src/... //third_party/utf8_range/..."
|
||||
- config: { name: "aarch64", flags: "--platforms=//build_defs:linux-aarch_64" }
|
||||
cache_key: aarch64-bazel8
|
||||
targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test //third_party/utf8_range/..."
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.0.1-aarch64-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12"
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.7.0-aarch64-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 "
|
||||
name: ${{ matrix.config.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.config.name }}
|
||||
runs-on: ${{ matrix.config.runner || 'ubuntu-latest' }}
|
||||
steps:
|
||||
|
|
@ -64,6 +64,15 @@ jobs:
|
|||
uses: protocolbuffers/protobuf-ci/checkout@v5
|
||||
with:
|
||||
ref: ${{ inputs.safe-checkout }}
|
||||
- name: Prime the cache
|
||||
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
with:
|
||||
image: ${{ matrix.image }}
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: cpp_linux/${{ matrix.cache_key }}
|
||||
bazel: fetch ${{ matrix.targets }} ${{ matrix.config.flags }}
|
||||
exclude-targets: ${{ matrix.exclude-targets }}
|
||||
- name: Run tests
|
||||
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
|
|
@ -78,12 +87,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false # Don't cancel all jobs if one fails.
|
||||
matrix:
|
||||
version: ['7.5', '9.1', '9.5', '13.1']
|
||||
include:
|
||||
- version: 9.1
|
||||
continuous-only: true
|
||||
- version: 9.5
|
||||
continuous-only: true
|
||||
version: ['10.5', '13.4']
|
||||
name: ${{ matrix.config.continuous-only && inputs.continuous-prefix || '' }} Linux GCC ${{ matrix.version }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
@ -92,11 +96,19 @@ jobs:
|
|||
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
|
||||
with:
|
||||
ref: ${{ inputs.safe-checkout }}
|
||||
- name: Prime the cache
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.7.0-${{ matrix.version }}-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: cpp_linux/gcc-${{ matrix.version }}
|
||||
bazel: fetch //pkg/... //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests
|
||||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.0.1-${{ matrix.version }}-e78301df86b3e4c46ec9ac4d98be00e19305d8f3
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.7.0-${{ matrix.version }}-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: cpp_linux/gcc-${{ matrix.version }}
|
||||
bazel: test //pkg/... //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests
|
||||
|
|
@ -112,30 +124,46 @@ jobs:
|
|||
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux Release ${{ matrix.arch }}
|
||||
runs-on: ubuntu-22-4core
|
||||
steps:
|
||||
- name: Check initial disk space
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
shell: bash
|
||||
run: df -h
|
||||
- name: Checkout pending changes
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/checkout@v5
|
||||
with:
|
||||
ref: ${{ inputs.safe-checkout }}
|
||||
- name: Check disk space after checkout
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
shell: bash
|
||||
run: df -h
|
||||
- name: Cross compile protoc for ${{ matrix.arch }}
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
id: cross-compile
|
||||
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.6.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.7.0-4d8e80ef93b0219fb907af9dd4596b92946995d8
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
architecture: linux-${{ matrix.arch }}
|
||||
- name: Check disk space after cross compile
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
shell: bash
|
||||
run: df -h
|
||||
- name: Setup sccache
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/sccache@v5
|
||||
with:
|
||||
cache-prefix: linux-release-${{ matrix.arch }}
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
- name: Check disk space after setup sccache
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
shell: bash
|
||||
run: df -h
|
||||
- name: Run tests
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/docker@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.0.1-${{ matrix.arch }}-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.7.0-${{ matrix.arch }}-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
entrypoint: bash
|
||||
command: >
|
||||
|
|
@ -148,6 +176,10 @@ jobs:
|
|||
cmake --build . --parallel 20;
|
||||
ctest --no-tests=error --parallel 20;
|
||||
sccache -s"
|
||||
- name: Check disk space after run tests
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
shell: bash
|
||||
run: df -h
|
||||
|
||||
linux-cmake:
|
||||
strategy:
|
||||
|
|
@ -291,7 +323,7 @@ jobs:
|
|||
with:
|
||||
name: installed_files_${{ matrix.build }}
|
||||
path: ${{ matrix.build }}
|
||||
|
||||
|
||||
- name: Compare against golden
|
||||
run: |
|
||||
set +e
|
||||
|
|
@ -371,7 +403,7 @@ jobs:
|
|||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/docker@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.0.1-12.2-168f9c9d015a0fa16611e1e9eede796fe9bfbb69
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.7.0-12.5-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
entrypoint: bash
|
||||
command: >-
|
||||
|
|
@ -454,7 +486,7 @@ jobs:
|
|||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel: ${{ matrix.bazel }}
|
||||
bazel-cache: cpp_${{ matrix.cache_key }}
|
||||
version: ${{ matrix.bazel_version || '8.0.1' }}
|
||||
version: ${{ matrix.bazel_version || '8.7.0' }}
|
||||
|
||||
non-linux-cmake:
|
||||
strategy:
|
||||
|
|
@ -527,7 +559,7 @@ jobs:
|
|||
if: ${{ matrix.install-flags && (!matrix.continuous-only || inputs.continuous-run) }}
|
||||
uses: protocolbuffers/protobuf-ci/bash@v5
|
||||
with:
|
||||
bazel-version: 8.0.1
|
||||
bazel-version: 8.7.0
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
command: >-
|
||||
cmake . -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_TESTS=ON ${{ matrix.install-flags }}
|
||||
|
|
@ -554,7 +586,7 @@ jobs:
|
|||
uses: protocolbuffers/protobuf-ci/bash@v5
|
||||
with:
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-version: 8.0.1
|
||||
bazel-version: 8.7.0
|
||||
command: >-
|
||||
cmake . -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_TESTS=ON ${{ matrix.flags }}
|
||||
${{ env.SCCACHE_CMAKE_FLAGS }} -Dprotobuf_ALLOW_CCACHE=ON
|
||||
|
|
@ -593,7 +625,7 @@ jobs:
|
|||
if: ${{ inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-7932bf8b25fb76a111e7257d151a6a58d5c3c671
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.2.0-4d8e80ef93b0219fb907af9dd4596b92946995d8
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: cpp_linux/abseil_head
|
||||
bazel: test //src/... --override_module=abseil-cpp=abseil-cpp-head
|
||||
|
|
|
|||
6
.github/workflows/test_csharp.yml
vendored
6
.github/workflows/test_csharp.yml
vendored
|
|
@ -27,7 +27,7 @@ jobs:
|
|||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/docker@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:9.0.0-3.1.415-8.0.100-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:9.2.0-3.1.415-8.0.100-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
entrypoint: /bin/bash
|
||||
command: >-
|
||||
|
|
@ -43,7 +43,7 @@ jobs:
|
|||
- name: Run conformance tests
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:9.0.0-3.1.415-8.0.100-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:9.2.0-3.1.415-8.0.100-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: csharp_linux
|
||||
bazel: test //csharp:conformance_test --action_env=PATH --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=/home/bazel
|
||||
|
|
@ -65,7 +65,7 @@ jobs:
|
|||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/bash@v5
|
||||
with:
|
||||
bazel-version: 9.0.0
|
||||
bazel-version: 9.2.0
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
command: |
|
||||
dotnet build csharp/src/Google.Protobuf.sln
|
||||
|
|
|
|||
2
.github/workflows/test_hpb.yml
vendored
2
.github/workflows/test_hpb.yml
vendored
|
|
@ -22,7 +22,7 @@ jobs:
|
|||
|
||||
include:
|
||||
- targets: "//hpb/... //hpb_generator/..."
|
||||
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c"
|
||||
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.2.0-4d8e80ef93b0219fb907af9dd4596b92946995d8"
|
||||
- bazel_cmd: "test"
|
||||
|
||||
name: Linux ${{ matrix.config.name }}
|
||||
|
|
|
|||
12
.github/workflows/test_java.yml
vendored
12
.github/workflows/test_java.yml
vendored
|
|
@ -30,27 +30,27 @@ jobs:
|
|||
include:
|
||||
- name: OpenJDK 8
|
||||
cache_key: '8'
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:9.0.0-11-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:9.2.0-11-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
# TODO: b/318555165 - enable the layering check. Currently it does
|
||||
# not work correctly with the toolchain in this Docker image.
|
||||
targets: //java/... //java/internal:java_version --features=-layering_check
|
||||
flags: --java_language_version=8
|
||||
- name: OpenJDK 11
|
||||
cache_key: '11'
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:9.0.0-11-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:9.2.0-11-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
targets: //java/... //java/internal:java_version //compatibility/...
|
||||
continuous-only: true
|
||||
- name: OpenJDK 17
|
||||
cache_key: '17'
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:9.0.0-17-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:9.2.0-17-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
targets: //java/... //java/internal:java_version //compatibility/...
|
||||
- name: OpenJDK 21 bazel 8
|
||||
cache_key: 'bazel8'
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8.6.0-21-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8.7.0-21-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
targets: //java/... //java/internal:java_version //compatibility/...
|
||||
- name: OpenJDK 21
|
||||
cache_key: '21'
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:9.0.0-21-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:9.2.0-21-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
targets: //java/... //java/internal:java_version //compatibility/...
|
||||
# TODO: b/395623141 - restore this test once runtime uses / emulates aarch64.
|
||||
# - name: aarch64
|
||||
|
|
@ -105,7 +105,7 @@ jobs:
|
|||
- name: Generate maven artifacts with bazel and install using maven
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:9.0.0-11-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:9.2.0-11-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: java_linux/11
|
||||
bash: |
|
||||
|
|
|
|||
6
.github/workflows/test_objectivec.yml
vendored
6
.github/workflows/test_objectivec.yml
vendored
|
|
@ -70,7 +70,7 @@ jobs:
|
|||
CODE_SIGN_IDENTITY: "-"
|
||||
with:
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-version: 9.0.0
|
||||
bazel-version: 9.2.0
|
||||
command: |
|
||||
xcodebuild \
|
||||
-project "objectivec/${{ matrix.xc_project }}" \
|
||||
|
|
@ -113,7 +113,7 @@ jobs:
|
|||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel@v5
|
||||
with:
|
||||
version: 9.0.0 # Bazel version
|
||||
version: 9.2.0 # Bazel version
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: cocoapods/${{ matrix.XCODE }}
|
||||
bash: |
|
||||
|
|
@ -161,7 +161,7 @@ jobs:
|
|||
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel@v5
|
||||
with:
|
||||
version: 9.0.0 # Bazel version
|
||||
version: 9.2.0 # Bazel version
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel: ${{ matrix.config.bazel_action }} ${{ matrix.config.flags }} ${{ matrix.bazel_targets }}
|
||||
bazel-cache: objc_${{ matrix.platform }}_${{ matrix.config.name }}
|
||||
|
|
|
|||
10
.github/workflows/test_php.yml
vendored
10
.github/workflows/test_php.yml
vendored
|
|
@ -65,7 +65,7 @@ jobs:
|
|||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:9.0.0-${{ matrix.version }}-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:9.2.0-${{ matrix.version }}-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: php_linux/${{ matrix.version }}
|
||||
bash: |
|
||||
|
|
@ -115,7 +115,7 @@ jobs:
|
|||
id: cross-compile
|
||||
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.2.0-4d8e80ef93b0219fb907af9dd4596b92946995d8
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
architecture: linux-i386
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ jobs:
|
|||
id: cross-compile
|
||||
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.2.0-4d8e80ef93b0219fb907af9dd4596b92946995d8
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
architecture: linux-aarch64
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ jobs:
|
|||
uses: protocolbuffers/protobuf-ci/bash@v5
|
||||
with:
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-version: 9.0.0
|
||||
bazel-version: 9.2.0
|
||||
# TODO this shouldn't be necessary, remove it
|
||||
bazel-flags: --xcode_version_config=//.github:host_xcodes_macos15
|
||||
command: |
|
||||
|
|
@ -220,6 +220,6 @@ jobs:
|
|||
uses: protocolbuffers/protobuf-ci/bazel@v5
|
||||
with:
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
version: 9.0.0 # Bazel version
|
||||
version: 9.2.0 # Bazel version
|
||||
bazel-cache: php_macos15/${{ matrix.version }}
|
||||
bazel: test //php:conformance_test //php:conformance_test_c --action_env=PATH --test_env=PATH --xcode_version_config=//.github:host_xcodes_macos15
|
||||
|
|
|
|||
2
.github/workflows/test_php_ext.yml
vendored
2
.github/workflows/test_php_ext.yml
vendored
|
|
@ -35,7 +35,7 @@ jobs:
|
|||
- name: Package extension
|
||||
uses: protocolbuffers/protobuf-ci/bazel@v5
|
||||
with:
|
||||
version: 9.0.0 # Bazel version
|
||||
version: 9.2.0 # Bazel version
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: php_ext/${{ matrix.version }}
|
||||
bash: >
|
||||
|
|
|
|||
6
.github/workflows/test_python.yml
vendored
6
.github/workflows/test_python.yml
vendored
|
|
@ -50,7 +50,7 @@ jobs:
|
|||
targets: //python/... //python:aarch64_test
|
||||
# TODO Enable this once conformance tests are fixed.
|
||||
flags: --define=use_fast_cpp_protos=true --test_tag_filters=-conformance
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.0.1-aarch64-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.7.0-aarch64-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7
|
||||
|
||||
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.type }} ${{ matrix.version }} ${{ matrix.nobzlmod && 'No Bzlmod' || '' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -64,7 +64,7 @@ jobs:
|
|||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
with:
|
||||
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:9.0.0-{0}-7932bf8b25fb76a111e7257d151a6a58d5c3c671', matrix.version) }}
|
||||
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:9.2.0-{0}-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ', matrix.version) }}
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.version }}
|
||||
bazel: test ${{ matrix.targets }} ${{ matrix.flags }} ${{ matrix.nobzlmod && '--noenable_bzlmod' || '' }} --test_env=KOKORO_PYTHON_VERSION
|
||||
|
|
@ -115,7 +115,7 @@ jobs:
|
|||
env:
|
||||
KOKORO_PYTHON_VERSION: ${{ matrix.version }}
|
||||
with:
|
||||
version: 9.0.0 # Bazel version
|
||||
version: 9.2.0 # Bazel version
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: python_macos/${{ matrix.type }}_${{ matrix.version }}
|
||||
bazel: >-
|
||||
|
|
|
|||
2
.github/workflows/test_release_branches.yml
vendored
2
.github/workflows/test_release_branches.yml
vendored
|
|
@ -13,7 +13,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
branch: [25.x, 29.x, 33.x, 34.x, 35.x]
|
||||
branch: [25.x, 33.x, 35.x, 36.x]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
|
|
|
|||
31
.github/workflows/test_ruby.yml
vendored
31
.github/workflows/test_ruby.yml
vendored
|
|
@ -36,12 +36,12 @@ jobs:
|
|||
- { name: Ruby 3.4, ruby: ruby-3.4.1, continuous-only: true }
|
||||
- { name: Ruby 4.0, ruby: ruby-4.0.0, ffi: NATIVE }
|
||||
- { name: Ruby 4.0, ruby: ruby-4.0.0, ffi: FFI }
|
||||
- { name: Ruby 4.0 bazel 8, ruby: ruby-4.0.0, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.6.0-ruby-4.0.0-856ad422dddd3b8fbd85e36129496b37bba174ef' }
|
||||
- { name: Ruby 4.0 bazel 8, ruby: ruby-4.4.4, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.6.0-ruby-4.0.0-856ad422dddd3b8fbd85e36129496b37bba174ef' }
|
||||
- { name: Ruby 4.0 bazel 8, ruby: ruby-4.0.0, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.7.0-ruby-4.0.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ' }
|
||||
- { name: Ruby 4.0 bazel 8, ruby: ruby-4.4.4, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.7.0-ruby-4.0.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ' }
|
||||
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: NATIVE }
|
||||
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI }
|
||||
- { name: JRuby 9.4 bazel 8, ruby: jruby-9.4.9.0, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.6.0-jruby-9.4.9.0-856ad422dddd3b8fbd85e36129496b37bba174ef' }
|
||||
- { name: JRuby 9.4 bazel 8, ruby: jruby-9.4.9.0, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.6.0-jruby-9.4.9.0-856ad422dddd3b8fbd85e36129496b37bba174ef' }
|
||||
- { name: JRuby 9.4 bazel 8, ruby: jruby-9.4.9.0, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.7.0-jruby-9.4.9.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ' }
|
||||
- { name: JRuby 9.4 bazel 8, ruby: jruby-9.4.9.0, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.7.0-jruby-9.4.9.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ' }
|
||||
|
||||
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.name }} ${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -55,7 +55,7 @@ jobs:
|
|||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
with:
|
||||
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:9.0.0-{0}-9fc33a0c378b5affd3c85d3f5ae4f330993048f7', matrix.ruby) }}
|
||||
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:9.2.0-{0}-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ', matrix.ruby) }}
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: ruby_linux/${{ matrix.ruby }}
|
||||
bazel: test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }}
|
||||
|
|
@ -81,7 +81,7 @@ jobs:
|
|||
id: cross-compile
|
||||
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.6.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.7.0-4d8e80ef93b0219fb907af9dd4596b92946995d8
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
architecture: linux-i386
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ jobs:
|
|||
id: cross-compile
|
||||
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v5
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.6.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.7.0-4d8e80ef93b0219fb907af9dd4596b92946995d8
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
architecture: linux-aarch64
|
||||
|
||||
|
|
@ -122,8 +122,9 @@ jobs:
|
|||
if: ${{ inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/docker@v5
|
||||
with:
|
||||
image: arm64v8/ruby:3.2.11-bookworm
|
||||
image: ruby:3.2.11-bookworm
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
platform: linux/arm64
|
||||
command: >-
|
||||
/bin/bash -cex '
|
||||
gem install bundler -v 2.6.6;
|
||||
|
|
@ -160,7 +161,7 @@ jobs:
|
|||
|
||||
- name: Pin Ruby version
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: ruby/setup-ruby@ae195bbe749a7cef685ac729197124a48305c1cb # v1.276.0
|
||||
uses: ruby/setup-ruby@6e5d382445ae5590b7449d8b3bc8cb1c2c27f617 # v1.317.0
|
||||
with:
|
||||
ruby-version: ${{ matrix.version }}
|
||||
|
||||
|
|
@ -172,7 +173,7 @@ jobs:
|
|||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel@v5
|
||||
with:
|
||||
version: 9.0.0 # Bazel version
|
||||
version: 9.2.0 # Bazel version
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: ruby_macos/${{ matrix.version }}
|
||||
bazel: test //ruby/... --test_env=KOKORO_RUBY_VERSION=${{ matrix.version }} --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }}
|
||||
|
|
@ -191,12 +192,12 @@ jobs:
|
|||
- { name: Ruby 3.4, ruby: ruby-3.4.1, continuous-only: true }
|
||||
- { name: Ruby 4.0, ruby: ruby-4.0.0, ffi: NATIVE }
|
||||
- { name: Ruby 4.0, ruby: ruby-4.0.0, ffi: FFI }
|
||||
- { name: Ruby 4.0 bazel 8, ruby: ruby-4.0.0, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.6.0-ruby-4.0.0-856ad422dddd3b8fbd85e36129496b37bba174ef' }
|
||||
- { name: Ruby 4.0 bazel 8, ruby: ruby-4.4.4, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.6.0-ruby-4.0.0-856ad422dddd3b8fbd85e36129496b37bba174ef' }
|
||||
- { name: Ruby 4.0 bazel 8, ruby: ruby-4.0.0, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.7.0-ruby-4.0.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ' }
|
||||
- { name: Ruby 4.0 bazel 8, ruby: ruby-4.4.4, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.7.0-ruby-4.0.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ' }
|
||||
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: NATIVE }
|
||||
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI, continuous-only: true }
|
||||
- { name: JRuby 9.4 bazel 8, ruby: jruby-9.4.9.0, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.6.0-jruby-9.4.9.0-856ad422dddd3b8fbd85e36129496b37bba174ef' }
|
||||
- { name: JRuby 9.4 bazel 8, ruby: jruby-9.4.9.0, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.6.0-jruby-9.4.9.0-856ad422dddd3b8fbd85e36129496b37bba174ef' }
|
||||
- { name: JRuby 9.4 bazel 8, ruby: jruby-9.4.9.0, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.7.0-jruby-9.4.9.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ' }
|
||||
- { name: JRuby 9.4 bazel 8, ruby: jruby-9.4.9.0, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.7.0-jruby-9.4.9.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ' }
|
||||
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Install ${{ matrix.name }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
@ -209,7 +210,7 @@ jobs:
|
|||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
with:
|
||||
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:9.0.0-{0}-9fc33a0c378b5affd3c85d3f5ae4f330993048f7', matrix.ruby) }}
|
||||
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:9.2.0-{0}-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ', matrix.ruby) }}
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }}
|
||||
bash: >
|
||||
|
|
|
|||
4
.github/workflows/test_rust.yml
vendored
4
.github/workflows/test_rust.yml
vendored
|
|
@ -24,7 +24,7 @@ jobs:
|
|||
|
||||
include:
|
||||
- targets: "//rust/... //src/google/protobuf/compiler/rust/..."
|
||||
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c"
|
||||
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.2.0-4d8e80ef93b0219fb907af9dd4596b92946995d8"
|
||||
- bazel_cmd: "test"
|
||||
|
||||
# Override cases with custom images
|
||||
|
|
@ -73,4 +73,4 @@ jobs:
|
|||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel: run //rust/release_crates:cargo_test
|
||||
bazel-cache: windows-cargo
|
||||
version: 9.0.0
|
||||
version: 9.2.0
|
||||
|
|
|
|||
10
.github/workflows/test_upb.yml
vendored
10
.github/workflows/test_upb.yml
vendored
|
|
@ -30,8 +30,8 @@ jobs:
|
|||
config:
|
||||
- { name: "Fastbuild" }
|
||||
- { name: "Optimized", flags: "-c opt", continuous-only: true }
|
||||
- { name: "GCC Optimized", flags: "-c opt --force_pic --java_runtime_version=remotejdk_11 --copt=\"-Wno-error=maybe-uninitialized\"", image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.0.1-12.2-12e21b8dda91028bc14212a3ab582c7c4d149fac" }
|
||||
- { name: "GCC Static", flags: "-c opt --dynamic_mode=off --java_runtime_version=remotejdk_11 --copt=\"-Wno-error=maybe-uninitialized\"", image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.0.1-12.2-12e21b8dda91028bc14212a3ab582c7c4d149fac", continuous-only: true }
|
||||
- { name: "GCC Optimized", flags: "-c opt --force_pic --java_runtime_version=remotejdk_11 --copt=\"-Wno-error=maybe-uninitialized\" --copt=\"-Wno-error=deprecated-declarations\" --copt=\"-Wno-error=array-bounds\"", image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.7.0-12.5-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 " }
|
||||
- { name: "GCC Static", flags: "-c opt --dynamic_mode=off --java_runtime_version=remotejdk_11 --copt=\"-Wno-error=maybe-uninitialized\" --copt=\"-Wno-error=deprecated-declarations\" --copt=\"-Wno-error=array-bounds\"", image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.7.0-12.5-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ", continuous-only: true }
|
||||
- { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/...", runner: ubuntu-22-4core }
|
||||
- { name: "UBSAN", flags: "--config=ubsan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/... -//lua/...", continuous-only: true }
|
||||
- { name: "32-bit", flags: "--copt=-m32 --linkopt=-m32", exclude-targets: "-//benchmarks:benchmark -//python/..." }
|
||||
|
|
@ -51,7 +51,7 @@ jobs:
|
|||
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
|
||||
with:
|
||||
image: ${{ matrix.config.image || 'us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:8.0.1-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12' }}
|
||||
image: ${{ matrix.config.image || 'us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:8.7.0-5bb1a8fdfc30f8c21c1b38cf053d2db9fca865a7 ' }}
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: upb-bazel
|
||||
bazel: test //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }}
|
||||
|
|
@ -74,7 +74,7 @@ jobs:
|
|||
bazel-cache: "upb-bazel-windows"
|
||||
# TODO: Enable python tests here once rules_python supports Windows better.
|
||||
bazel: test //upb/... //upb_generator/...
|
||||
version: 9.0.0
|
||||
version: 9.2.0
|
||||
exclude-targets: -//python:conformance_test -//upb/reflection:def_builder_test
|
||||
|
||||
macos:
|
||||
|
|
@ -103,7 +103,7 @@ jobs:
|
|||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: "upb-bazel-macos"
|
||||
bazel: ${{ matrix.config.bazel-command }} ${{ matrix.config.flags }} //benchmarks/... //lua/... //python/... //upb/... //upb_generator/...
|
||||
version: 9.0.0
|
||||
version: 9.2.0
|
||||
|
||||
build_wheels:
|
||||
name: Build Wheels
|
||||
|
|
|
|||
|
|
@ -506,6 +506,12 @@ alias(
|
|||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "json_enumvalue_options_proto_srcs",
|
||||
actual = "//src/google/protobuf:json_enumvalue_options_proto_srcs",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "json_enumvalue_options_cc_proto",
|
||||
actual = "//src/google/protobuf:json_enumvalue_options_cc_proto",
|
||||
|
|
@ -596,7 +602,9 @@ proto_lang_toolchain(
|
|||
blacklisted_protos = [
|
||||
"//:compiler_plugin_proto",
|
||||
"//:cpp_features_proto",
|
||||
"//:cpp_file_options_proto",
|
||||
"//:descriptor_proto",
|
||||
"//:json_enumvalue_options_proto",
|
||||
],
|
||||
command_line = "--cpp_out=$(OUT)",
|
||||
plugin = "//src/google/protobuf/compiler/cpp:protoc-gen-cpp",
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ if (protobuf_BUILD_SHARED_LIBS)
|
|||
endif ()
|
||||
|
||||
# Version metadata
|
||||
set(protobuf_VERSION_STRING "7.36.0")
|
||||
set(protobuf_VERSION_STRING "7.37.0")
|
||||
set(protobuf_DESCRIPTION "Protocol Buffers")
|
||||
set(protobuf_CONTACT "protobuf@googlegroups.com")
|
||||
|
||||
|
|
@ -238,10 +238,17 @@ if (protobuf_BUILD_SHARED_LIBS)
|
|||
else (protobuf_BUILD_SHARED_LIBS)
|
||||
set(protobuf_SHARED_OR_STATIC "STATIC")
|
||||
set(ABSL_MSVC_STATIC_RUNTIME ${protobuf_MSVC_STATIC_RUNTIME})
|
||||
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)
|
||||
# Only choose an MSVC runtime library if the enclosing project has not already
|
||||
# set one. When protobuf is consumed via add_subdirectory/FetchContent, the
|
||||
# parent may set CMAKE_MSVC_RUNTIME_LIBRARY explicitly (for example to force
|
||||
# /MD in every configuration); overriding it here causes runtime-library
|
||||
# mismatches such as LNK2038 (MDd_DynamicDebug vs MD_DynamicRelease).
|
||||
if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
|
||||
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()
|
||||
endif()
|
||||
endif (protobuf_BUILD_SHARED_LIBS)
|
||||
|
||||
|
|
|
|||
95
MODULE.bazel
95
MODULE.bazel
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
module(
|
||||
name = "protobuf",
|
||||
version = "36.0-dev", # Automatically updated on release
|
||||
version = "37.0-dev", # Automatically updated on release
|
||||
bazel_compatibility = [">=8.0.0"],
|
||||
compatibility_level = 1,
|
||||
repo_name = "com_google_protobuf",
|
||||
|
|
@ -19,19 +19,16 @@ bazel_dep(name = "apple_support", version = "2.3.0", repo_name = "build_bazel_ap
|
|||
# Unused but must be pinned to avoid old broken versions
|
||||
bazel_dep(name = "rules_proto", version = "7.1.0")
|
||||
|
||||
#ifndef PROTO2_OPENSOURCE
|
||||
# LINT.IfChange
|
||||
#endif // PROTO2_OPENSOURCE
|
||||
# protoc dependencies
|
||||
bazel_dep(name = "abseil-cpp", version = "20250512.1")
|
||||
bazel_dep(name = "rules_cc", version = "0.2.18")
|
||||
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")
|
||||
#ifndef PROTO2_OPENSOURCE
|
||||
# LINT.ThenChange(//depot/google3/third_party/protobuf/compiler/notices.h)
|
||||
#endif // PROTO2_OPENSOURCE
|
||||
|
||||
# other dependencies
|
||||
bazel_dep(name = "bazel_features", version = "1.33.0", repo_name = "proto_bazel_features")
|
||||
proto_bazel_features = use_repo_rule("//bazel/private/oss:proto_bazel_features.bzl", "proto_bazel_features")
|
||||
|
||||
proto_bazel_features(name = "proto_bazel_features")
|
||||
|
||||
bazel_dep(name = "bazel_skylib", version = "1.9.0")
|
||||
bazel_dep(name = "jsoncpp", version = "1.9.6.bcr.2")
|
||||
bazel_dep(name = "rules_java", version = "8.6.1")
|
||||
|
|
@ -39,7 +36,7 @@ bazel_dep(name = "rules_jvm_external", version = "6.7")
|
|||
bazel_dep(name = "rules_kotlin", version = "2.3.20")
|
||||
bazel_dep(name = "rules_license", version = "1.0.0")
|
||||
bazel_dep(name = "rules_pkg", version = "1.0.1")
|
||||
bazel_dep(name = "rules_python", version = "1.6.0")
|
||||
bazel_dep(name = "rules_python", version = "2.3.0")
|
||||
bazel_dep(name = "rules_rust", version = "0.69.0")
|
||||
|
||||
bazel_dep(name = "rules_ruby", version = "0.20.1", dev_dependency = True)
|
||||
|
|
@ -75,6 +72,7 @@ ruby.toolchain(
|
|||
version = "system",
|
||||
)
|
||||
use_repo(ruby, "ruby")
|
||||
|
||||
ruby.bundle_fetch(
|
||||
name = "protobuf_bundle",
|
||||
gem_checksums = {
|
||||
|
|
@ -193,10 +191,10 @@ rust.toolchain(
|
|||
versions = ["1.85.0"],
|
||||
)
|
||||
|
||||
crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate")
|
||||
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
|
||||
crate.spec(
|
||||
package = "googletest",
|
||||
version = ">0.0.0",
|
||||
version = "0.14.2",
|
||||
)
|
||||
crate.spec(
|
||||
package = "linkme",
|
||||
|
|
@ -204,15 +202,16 @@ crate.spec(
|
|||
)
|
||||
crate.spec(
|
||||
package = "paste",
|
||||
version = ">=1",
|
||||
version = "1.0.15",
|
||||
)
|
||||
crate.spec(
|
||||
package = "quote",
|
||||
version = ">=1",
|
||||
version = "1.0.38",
|
||||
)
|
||||
crate.spec(
|
||||
features = ["full"],
|
||||
package = "syn",
|
||||
version = ">=2",
|
||||
version = ">=2, <3",
|
||||
)
|
||||
crate.from_specs()
|
||||
use_repo(crate, crate_index = "crates")
|
||||
|
|
@ -266,7 +265,6 @@ protobuf_maven_dev.install(
|
|||
use_repo(protobuf_maven_dev, "protobuf_maven_dev")
|
||||
|
||||
bazel_dep(name = "googletest", version = "1.17.0.bcr.2", dev_dependency = True)
|
||||
bazel_dep(name = "rules_buf", version = "0.3.0", dev_dependency = True)
|
||||
bazel_dep(name = "rules_testing", version = "0.9.0", dev_dependency = True)
|
||||
bazel_dep(
|
||||
name = "abseil-py",
|
||||
|
|
@ -306,18 +304,6 @@ archive_override(
|
|||
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz"],
|
||||
)
|
||||
|
||||
bazel_dep(name = "com_google_protobuf_previous_release", version = "33.0", dev_dependency = True)
|
||||
archive_override(
|
||||
module_name = "com_google_protobuf_previous_release",
|
||||
integrity = "sha256-y8U2BkcGtijc/lB77zhu8+IhTVY2V2EilvF4GqFV7gc=",
|
||||
patch_strip = 1,
|
||||
patches = [
|
||||
"@com_google_protobuf//:patches/protobuf_v33/0001-Update-module-name.patch",
|
||||
],
|
||||
strip_prefix = "protobuf-33.0",
|
||||
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v33.0/protobuf-33.0.tar.gz"],
|
||||
)
|
||||
|
||||
# Register C++ toolchains for cross-compilation. These are used for compiling release binaries of
|
||||
# protoc and the Python extension. They are disabled unless --//toolchain:release=true is passed.
|
||||
register_toolchains(
|
||||
|
|
@ -360,3 +346,58 @@ bazel_dep(name = "jq.bzl", version = "0.6.1", dev_dependency = True)
|
|||
|
||||
jq = use_extension("@jq.bzl//jq:extensions.bzl", "toolchains", dev_dependency = True)
|
||||
use_repo(jq, "jq_toolchains")
|
||||
|
||||
flag_alias(
|
||||
name = "experimental_proto_descriptor_sets_include_source_info",
|
||||
starlark_flag = "@//bazel/flags:experimental_proto_descriptor_sets_include_source_info",
|
||||
)
|
||||
|
||||
flag_alias(
|
||||
name = "experimental_protoc_opts",
|
||||
starlark_flag = "@//bazel/flags:protocopt",
|
||||
)
|
||||
|
||||
flag_alias(
|
||||
name = "protocopt",
|
||||
starlark_flag = "@//bazel/flags:protocopt",
|
||||
)
|
||||
|
||||
flag_alias(
|
||||
name = "proto_compiler",
|
||||
starlark_flag = "@//bazel/flags:proto_compiler",
|
||||
)
|
||||
|
||||
flag_alias(
|
||||
name = "proto_toolchain_for_cc",
|
||||
starlark_flag = "@//bazel/flags/cc:proto_toolchain_for_cc",
|
||||
)
|
||||
|
||||
flag_alias(
|
||||
name = "proto_toolchain_for_java",
|
||||
starlark_flag = "@//bazel/flags/java:proto_toolchain_for_java",
|
||||
)
|
||||
|
||||
flag_alias(
|
||||
name = "proto_toolchain_for_javalite",
|
||||
starlark_flag = "@//bazel/flags/java:proto_toolchain_for_javalite",
|
||||
)
|
||||
|
||||
flag_alias(
|
||||
name = "strict_proto_deps",
|
||||
starlark_flag = "@//bazel/flags:strict_proto_deps",
|
||||
)
|
||||
|
||||
flag_alias(
|
||||
name = "strict_public_imports",
|
||||
starlark_flag = "@//bazel/flags:strict_public_imports",
|
||||
)
|
||||
|
||||
flag_alias(
|
||||
name = "cc_proto_library_header_suffixes",
|
||||
starlark_flag = "@//bazel/flags/cc:cc_proto_library_header_suffixes",
|
||||
)
|
||||
|
||||
flag_alias(
|
||||
name = "cc_proto_library_source_suffixes",
|
||||
starlark_flag = "@//bazel/flags/cc:cc_proto_library_source_suffixes",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# dependent projects use the :git notation to refer to the library.
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'Protobuf'
|
||||
s.version = '5.36.0'
|
||||
s.version = '5.37.0'
|
||||
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
|
||||
s.homepage = 'https://github.com/protocolbuffers/protobuf'
|
||||
s.license = 'BSD-3-Clause'
|
||||
|
|
|
|||
403
SECURITY.md
403
SECURITY.md
|
|
@ -1,4 +1,401 @@
|
|||
To report security concerns or vulnerabilities within protobuf, please use
|
||||
Google's official channel for reporting these.
|
||||
# Security Policy
|
||||
|
||||
https://bughunters.google.com/report
|
||||
This document describes the security model, threat boundaries, and security
|
||||
recommendations for Protobuf. It is intended to help developers understand what
|
||||
security guarantees Protobuf provides, and how to safely parse and serialize
|
||||
messages.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you believe you have discovered a security vulnerability in Protobuf, please
|
||||
report it via
|
||||
[Google's official vulnerability disclosure channel](https://bughunters.google.com/report).
|
||||
|
||||
For reports that do not meet the criteria or bar for the Google Vulnerability
|
||||
Reward Program (VRP) but are still security-sensitive, you can privately report
|
||||
them by opening a
|
||||
[draft GitHub Security Advisory](https://github.com/protocolbuffers/protobuf/security/advisories/new).
|
||||
|
||||
If an issue relates to something which is listed as Best Effort or Out of Threat
|
||||
Model below, please open a
|
||||
[public issue](https://github.com/protocolbuffers/protobuf/issues) instead.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
## Best Practices
|
||||
|
||||
* Handle `.proto` files as "code" by default, similarly to the handling of
|
||||
`.java` or `.cc` files. Executing untrusted code can potentially be a supply
|
||||
chain attack vector.
|
||||
* Prefer to use the binary wire format encoding where possible: all
|
||||
Google-maintained Protobuf implementations treat binary wire format parsing
|
||||
as the primary use case to handle untrusted inputs. Other formats are
|
||||
considered secondary.
|
||||
* **Apply Defensive limits:** Prefer to have a layer that applies defensive
|
||||
limits or custom filtering around the Protobuf parse: for example gRPC
|
||||
enforces a 4 MiB payload limit by default. We recommend having sensible
|
||||
limits defensively applied on all untrusted inputs.
|
||||
* While all Google maintained Protobuf implementations are considered to be
|
||||
intended to be used with untrusted inputs, not all runtimes are equally
|
||||
hardened:
|
||||
* **JavaProto** (including the Kotlin bindings) is recommended as the
|
||||
default implementation for the best security posture, as it benefits
|
||||
from the JVM's memory safety guarantees.
|
||||
* **C++Proto** is recommended for applications requiring optimal
|
||||
performance, and has been extensively fuzzed and hardened such that
|
||||
Google uses it without sandboxing to parse untrusted binary format
|
||||
inputs in critical surfaces. When using C++, developers must remain
|
||||
aware of native memory management risks.
|
||||
* In languages that have multiple supported implementations, strongly
|
||||
prefer to use the default implementation for best security. The
|
||||
non-default implementations are generally supported for more exotic
|
||||
use-cases and may not have as much hardening attention. The default
|
||||
Python and PHP runtimes use a C extension that has been hardened more
|
||||
than the fallback behaviors that that do not use any C extension.
|
||||
* **Use latest releases:** Ensure that the generated code and the runtime
|
||||
library version match exactly and are kept up to date with the latest patch
|
||||
release. Certain obscure and low severity issues may only be patched on the
|
||||
latest release.
|
||||
|
||||
## Threat Model and Security Boundaries
|
||||
|
||||
Protobuf is a serialization format designed to parse data efficiently. Depending
|
||||
on the input format, language runtime, and integration context, different parts
|
||||
of the Protobuf ecosystem are hardened against adversarial inputs.
|
||||
|
||||
Our threat model divides surfaces into three tiers:
|
||||
|
||||
### Proactively Hardened
|
||||
|
||||
These surfaces are fully supported and hardened against adversarial inputs.
|
||||
|
||||
* Security vulnerabilities identified in these paths are treated with high
|
||||
priority, actively fixed, and issued CVEs.
|
||||
|
||||
* Where necessary, certain patches that are technically breaking may be done
|
||||
if it is inherently necessary to close a security issue. This also includes
|
||||
that gencode-runtime version compatibility guarantees may be broken if it is
|
||||
strictly necessary to close a security issue (see documentation
|
||||
[here](https://protobuf.dev/support/cross-version-runtime-guarantee/#exception)).
|
||||
These cases are rare and we will avoid this wherever it is possible to close
|
||||
the security concern without a breaking change.
|
||||
|
||||
* Google trusts these surfaces enough to use in sensitive, publicly exposed
|
||||
endpoints without sandboxing.
|
||||
|
||||
### Reactively hardened
|
||||
|
||||
The Protobuf team welcomes bug reports and pull requests to improve the
|
||||
hardening of these surfaces. However, we typically will not break backwards
|
||||
compatibility guarantees to address security issues in these areas (especially
|
||||
for lower severity risks).
|
||||
|
||||
Defensive hardening is applied to these surfaces, but with weaker guarantees
|
||||
compared to our hardened surfaces.
|
||||
|
||||
* Serious security issues are still highly prioritized for fixing on these
|
||||
surfaces.
|
||||
|
||||
* We do not break backwards compatibility guarantees to address lower severity
|
||||
issues on these surfaces outside of major version bumps. In some cases this
|
||||
means low-impact known issues may even be left open if they inherently
|
||||
cannot be closed without a breaking change. Serious issues (like RCE) would
|
||||
still be urgently addressed.
|
||||
|
||||
* When using these surfaces on potentially malicious inputs, especially
|
||||
security sensitive usages are recommended to consider application-level
|
||||
isolation (such as sandboxing) or other defensive handling.
|
||||
|
||||
### Outside of CVE Threat Model (Best-Effort Hardened)
|
||||
|
||||
These are surfaces where Protobuf libraries are not as hardened against
|
||||
adversarial inputs.
|
||||
|
||||
Outside of threat model does not mean we do not care at all about
|
||||
security-relevant behaviors on these surfaces: we still apply defensive
|
||||
hardening where feasible, and welcome reports on these surfaces. However, as
|
||||
these surfaces are expected to be used with trusted inputs, the higher priority
|
||||
for those cases is other topics including stability, performance, and developer
|
||||
ergonomics.
|
||||
|
||||
## Proactively Hardened
|
||||
|
||||
### Parsing of Binary Wire Format Encoded Data **(Primary Use Case)**
|
||||
|
||||
This is considered the primary surface of security concern in Protobuf
|
||||
libraries.
|
||||
|
||||
In this use case, the `.proto` schema files, the compiler (`protoc`), and the
|
||||
generated code are fully trusted. The incoming binary wire format bytes are
|
||||
untrusted and may be adversarial.
|
||||
|
||||
The parsing library will safely process or reject any arbitrary byte stream
|
||||
without exposing the server to memory corruption, out-of-bounds reads/writes, or
|
||||
remote code execution (RCE).
|
||||
|
||||
Note that the intended surface here is only parsing: once a message is in-memory
|
||||
it is treated as a trusted object in our threat model. For that reason,
|
||||
serialization or any other in-memory handling of parsed objects is not
|
||||
considered a surface within the threat model. For example, parsing an untrusted
|
||||
wire format payload should not be able to reach uncontrolled recursion, but
|
||||
serializing an arbitrarily in-memory object may. This is similar in nature to
|
||||
how modern browsers do not throw `RangeError` on `JSON.parse()`, but do on
|
||||
`JSON.stringify()`.
|
||||
|
||||
### Parsing of ProtoJSON Format
|
||||
|
||||
[ProtoJSON](https://protobuf.dev/programming-guides/json/) allows using `.proto`
|
||||
schemas with standard JSON encoding. This is considered an ancillary supported
|
||||
encoding, and the binary format should be preferred where feasible.
|
||||
|
||||
Under the same threat model as publicly exposed binary wire format services,
|
||||
ProtoJSON parsing is intended to be used with untrusted inputs. ProtoJSON
|
||||
serialization is similarly not considered within the threat model risks.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
## Reactively Hardened
|
||||
|
||||
These areas are defensive against malicious inputs, but application-level
|
||||
defense (such as sandboxing) is recommended.
|
||||
|
||||
### Parsing Text Format
|
||||
|
||||
Text Format is designed for local debugging, testing, and managing trusted
|
||||
configurations by developers. It is not intended to be used as an interchange
|
||||
format and is not recommended to expose public services which consume Text
|
||||
Format as an encoding.
|
||||
|
||||
Note: Text Format parsing currently does not enforce any depth limit in several
|
||||
supported runtimes (they support opt-in depth limits). We cannot enforce a depth
|
||||
limit by default without breaking backwards compatibility, but may begin to
|
||||
enforce depth limits by default as part of a future breaking change release.
|
||||
|
||||
### Lite Runtimes (C++ Lite, Java Lite) Denial of Service Risks
|
||||
|
||||
Lite runtimes target mobile and web usage: they are optimized for those
|
||||
constrained envirnoments, and prioritize small binary size at the expense of
|
||||
other properties.
|
||||
|
||||
Lite runtimes are still intended to be used to parse untrusted inputs, but DoS
|
||||
issues are considered to be much less severe in mobile contexts, as the
|
||||
opportunity and impact of an attacker successfully freezing one app is low
|
||||
compared to reducing the availability of a public service.
|
||||
|
||||
We still intend to mitigate such risks, but Lite gencode/runtimes are not
|
||||
recommended for servers exposing public endpoints.
|
||||
|
||||
### 'Wrong Kind of Exception Thrown'
|
||||
|
||||
In memory-safe runtimes (Java, Go, Python, C#), reaching a catchable exception
|
||||
or runtime error (such as `IndexOutOfBoundsException` or `StackOverflowError`)
|
||||
instead of the declared exception (such as `InvalidProtocolBufferException`) is
|
||||
treated as an important bug to fix, but is considered to be a minor security
|
||||
concern relative to serious issues like native heap corruption, data leakage,
|
||||
remote code execution, or DoS vectors from unbounded computation or memory use.
|
||||
|
||||
It is recommended that RPC handler code be defensive against unexpected
|
||||
exceptions if they are exceptionally sensitive to such behavior.
|
||||
|
||||
## Outside of CVE Threat Model (Best-effort Hardened)
|
||||
|
||||
### `protoc` CLI
|
||||
|
||||
The `protoc` CLI is an offline developer tool. `.proto` files are considered
|
||||
source code (equivalent to `.java` or `.cpp` source files).
|
||||
|
||||
A supported modality of the CLI is to parse untrusted `proto` files to emit
|
||||
`FileDescriptors` which can enable further machine processing of the schemas.
|
||||
|
||||
While `protoc` is hardened on a best-effort basis for this use case, we
|
||||
recommend using defensive validation and sandboxing whenever running `protoc`
|
||||
against potentially malicious inputs.
|
||||
|
||||
Untrusted flags being passed to `protoc` is fully outside of our threat model:
|
||||
CLI flags are never be adversarial and arbitrary behavior driven by CLI flags
|
||||
may be working as intended.
|
||||
|
||||
Caution: Compiling and executing generated code from untrusted schemas is
|
||||
functionally equivalent to compiling and running arbitrary third-party `.java`
|
||||
or `.cpp` source code and executing it: there may be intentional language
|
||||
features which act as intentional code injection into the generated code. You
|
||||
must treat untrusted `.proto` files the same as any other programming language
|
||||
code in terms of supply-chain risk in this way, and not blindly execute the
|
||||
gencode which was generated off of untrusted `.proto` files.
|
||||
|
||||
### DynamicMessage on Untrusted Descriptors
|
||||
|
||||
Protobuf supports encoding schemas into a Protobuf message format (e.g.
|
||||
`FileDescriptorSet` or `DescriptorProto`). These messages can be handled as any
|
||||
other Protobuf type. Parsing untrusted binary-encoded DescriptorProto falls
|
||||
within the "primary use-case" described above.
|
||||
|
||||
In addition to simply processing DescriptorProto, it is additionally possible in
|
||||
most runtimes to use a type named `DynamicMessage` which allows for using
|
||||
runtime-loaded descriptors instead of using generated code and to use that type
|
||||
with the reflection APIs.
|
||||
|
||||
For use-cases sensetive to DoS risks, it is recommended to use `DynamicMessage`
|
||||
only with trusted descriptors (via trusted side channel source / config pushes).
|
||||
When using `DynamicMessage` with a descriptor sourced from an untrusted source,
|
||||
you may need to validate and sanitize them as you would user provided SQL.
|
||||
|
||||
Caution: Usage of `DynamicMessage` with malicious descriptors reaching an RCE or
|
||||
information leak would still be treated as a high priority issue. However, there
|
||||
are inherently reachable cases of where malicious descriptors used with
|
||||
`DynamicMessage` can reach behavior which may otherwise be considered a Denial
|
||||
of Service risk under our primary threat model. For example, it will be
|
||||
reachable to hit memory use which is O(N*M) where N is "# of messages observed
|
||||
on the wire" and M is "size of the message definition". Since untrusted
|
||||
descriptors gives an affordance for arbitrarily large message definitions, using
|
||||
DynamicMessage with untrusted descriptors and untrusted binary format inherently
|
||||
can have memory amplification risks.
|
||||
|
||||
### Adversarial Application Code
|
||||
|
||||
Violating runtime API constraints or passing invalid arguments directly to a C++
|
||||
API is considered an application integration error rather than a library
|
||||
vulnerability.
|
||||
|
||||
Protobuf libraries do harden against the impact of certain classes of mistakes
|
||||
being worse; for example, we often will panic if we can detect that an out of
|
||||
bounds memory reads will occur in some cases. This is considered
|
||||
defense-in-depth and misuse is not considered a vulnerability.
|
||||
|
||||
Excepting the surfaces enumerated above as hardened, Protobuf APIs in
|
||||
memory-safe languages reaching memory safety problems on 'bad' parameters is
|
||||
considered an high priority bug, but typically not within scope for CVE
|
||||
disclosure.
|
||||
|
||||
In languages like PHP, this means that use of PHP Protobuf in an unconstrained
|
||||
multi-tenant system where malicious application code may try to attack other
|
||||
jobs concurrently running is not within our threat model.
|
||||
|
||||
Examples:
|
||||
|
||||
* Passing negative or invalid buffer size parameters directly to
|
||||
`ParseFromArray` in C++ is wrong application code. It may be hardened to
|
||||
panic instead of risk out of bounds memory reads, but is not intended to be
|
||||
gracefully handled as a malformed-wire-bytes input would be (following C++
|
||||
idioms).
|
||||
* In a memory language Python, if code like `msg.repeatedField[-2147483649]`
|
||||
can reach a segfault, that is considered an important bug to fix, but it is
|
||||
not considered to be within CVE scope.
|
||||
|
||||
### Differential Parsing (Gateway propagation of original payload)
|
||||
|
||||
Differential parsing is a risk stemming from by two different libraries parsing
|
||||
the same data with different interpretations.
|
||||
|
||||
In some contexts and for some formats differential parsing is considered a
|
||||
security-sensitive topic. The primary risk is around flows that would validate
|
||||
in a gateway, forwarding the data unmodified, and then a backend handles the
|
||||
original payload and interprets the data differently, bypassing the intended
|
||||
checks.
|
||||
|
||||
The Protobuf binary format is explicitly designed for propagation of unknown
|
||||
fields, where the gateway may not be aware of the content at all and forwarding
|
||||
will result in the next server who has an updated version of the schema will
|
||||
corresponding parse to a different interpretation because it is aware of those
|
||||
fields.
|
||||
|
||||
Additionally, there may be certain edge-case byte sequences where a few
|
||||
different interpretations which may be considered acceptable within spec. Google
|
||||
maintained runtimes will never encode these sequences, but they may successfully
|
||||
parse them.
|
||||
|
||||
When using ProtoJSON format, the underlying JSON format itself contains
|
||||
significant inherent ambiguities (as noted in ECMA-404 and RFC-8259, including
|
||||
that there is no spec around the handling of duplicate keys and numeric
|
||||
precision). As ProtoJSON is built on top of that foundation, ProtoJSON inherits
|
||||
these ambiguities where certain sequences may have multiple different spec
|
||||
permissible implementations. Spec Protobuf implementations strongly attempt to
|
||||
avoid ever encoding such sequences (including that they always quote large
|
||||
int64s, and don't emit duplicate fields), but the parsing behavior may differ in
|
||||
such sequences and ProtoJSON cannot spec behavior which is unimplementable when
|
||||
using ecosystem of JSON parsers.
|
||||
|
||||
For both formats, an architecture where a gateway performs validation and
|
||||
forwards the original user request to a second server which reparses the user's
|
||||
request but presumes validation has already occurred is outside of our threat
|
||||
model.
|
||||
|
||||
For best security practice, it is recommended to:
|
||||
|
||||
* Use a different set of messages schema for your public API and internal
|
||||
messages. Besides the security benefits, this decoupling also allows for
|
||||
easier evolution of your system, where public APIs often need to change
|
||||
slowly but internal ones can evolve faster.
|
||||
* Where you do propagate the same message type, always prefer for the gateway
|
||||
to parse and reserialize instead of forwarding the original payload
|
||||
verbatim, as this will commonly normalize edge case byte sequences.
|
||||
* Wherever possible to have each microservice verify any relevant ACLs for
|
||||
actions it is taking based on its interpretation of the request rather than
|
||||
rely on gateway validation.
|
||||
|
||||
### Specific depth cap exceeded but without uncontrolled recursion
|
||||
|
||||
Protobuf parsers apply depth limits (which are configurable): the purpose of
|
||||
these depth limits is to prevent resource exhaustion issues stemming from
|
||||
uncontrolled recursion.
|
||||
|
||||
To generally maintain consistent and interoperable behavior, we intend these
|
||||
depth limits to be consistent in behavior in what payloads will be accepted or
|
||||
rejected for a given integer depth.
|
||||
|
||||
Issues where an edge case is successfully parsed which is deeper than the exact
|
||||
intended limit, this is viewed as a simple bug as long as it does not expose
|
||||
meaningful resource exhaustion risks.
|
||||
|
||||
We welcome reports and patches for issues of that nature, but do not view it as
|
||||
a security concern and so these issues can be filed via our public GitHub Issues
|
||||
flow.
|
||||
|
||||
### Canonical Representation and Signature Verification
|
||||
|
||||
There is **no canonical representation** of Protobuf messages.
|
||||
|
||||
* **Deterministic Serialization:** Many runtimes support deterministic
|
||||
serialization, which guarantees that a given build of a binary will
|
||||
serialize the same message to the same sequence of bytes. However,
|
||||
deterministic does not mean canonical: rebuilding the binary, changing the
|
||||
compiler version, or minor schema modifications can legally result in an
|
||||
alternate serialized byte representation that would have the same
|
||||
interpretation when parsed. For more details, see
|
||||
[Protobuf Serialization is Not Canonical](https://protobuf.dev/programming-guides/serialization-not-canonical/).
|
||||
* **Recommendation:** Do not use the serialized byte output of Protobuf
|
||||
messages to compute stable cryptographic signatures. You may still sign a
|
||||
given encoded byte sequence, knowing that there are other byte sequences
|
||||
that would be equally valid representations of the same message. If you need
|
||||
a stable signature of a given message, you must define and implement your
|
||||
own canonicalization specification over the parsed message fields and not
|
||||
over the encoded messages.
|
||||
|
||||
### Risks if wire bytes are modified in-transit
|
||||
|
||||
In terms of transport security, Protobuf is functionally equivalent to a
|
||||
plaintext format: the encoding has no built-in signing or other integrity
|
||||
features.
|
||||
|
||||
Best practice is to transport Protobuf encoded data over https. If signing or
|
||||
other integrity features are needed, it is expected to be done in the layers
|
||||
built top of the Protobuf libraries.
|
||||
|
||||
### API surfaces which not intended for direct public use
|
||||
|
||||
Protobuf has APIs which are not advertised or intended for direct public use.
|
||||
These APIs may have non-obvious invariants for how they must be used.
|
||||
|
||||
Most notably, `upb` is a library which is used as an implementation detail API
|
||||
of our other Protobuf libraries to use. `upb` itself is a highly optimized C
|
||||
library which requires callers maintain invariants to be sound.
|
||||
|
||||
Security issues may arise if our language-specific runtimes which use `upb` do
|
||||
not maintain those necessary invariants, or if `upb` has reachable bad behavior
|
||||
when all intended invariants are maintained. However, it is not considered not a
|
||||
security topic if arbitrary bad behavior may be reachable if `upb` APIs are
|
||||
directly misused (including that `upb's` APIs accept MiniDescriptors/MiniTables
|
||||
which are considered trusted types, and so will have arbitrary behavior if those
|
||||
types do not meet the intended invariants).
|
||||
|
|
|
|||
23
WORKSPACE
23
WORKSPACE
|
|
@ -262,29 +262,6 @@ http_archive(
|
|||
url = "https://github.com/bazelbuild/rules_testing/releases/download/v0.9.0/rules_testing-v0.9.0.tar.gz",
|
||||
)
|
||||
|
||||
# For checking breaking changes to well-known types from the previous release version.
|
||||
http_archive(
|
||||
name = "com_google_protobuf_previous_release",
|
||||
integrity = "sha256-EKDVjzmhqQnpXgDougtbHcZNApl/dBFRlTorNln254w=",
|
||||
strip_prefix = "protobuf-29.0",
|
||||
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v29.0/protobuf-29.0.tar.gz"],
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "rules_buf",
|
||||
integrity = "sha256-Hr64Q/CaYr0E3ptAjEOgdZd1yc+cBjp7OG1wzuf3DIs=",
|
||||
strip_prefix = "rules_buf-0.3.0",
|
||||
urls = [
|
||||
"https://github.com/bufbuild/rules_buf/archive/refs/tags/v0.3.0.zip",
|
||||
],
|
||||
)
|
||||
|
||||
load("@rules_buf//buf:repositories.bzl", "rules_buf_dependencies", "rules_buf_toolchains")
|
||||
|
||||
rules_buf_dependencies()
|
||||
|
||||
rules_buf_toolchains(version = "v1.32.1")
|
||||
|
||||
register_toolchains(
|
||||
"//toolchain:osx-x86_64-toolchain",
|
||||
"//toolchain:osx-aarch_64-toolchain",
|
||||
|
|
|
|||
|
|
@ -74,6 +74,19 @@ def _get_import_path(proto_file):
|
|||
return repo_path
|
||||
|
||||
def _output_directory(proto_info, root):
|
||||
"""Returns the physical output directory path for generated proto files.
|
||||
|
||||
This computes the correct directory path, correctly routing outputs into the virtual imports
|
||||
directory if the `proto_library` uses `import_prefix` or `strip_import_prefix`.
|
||||
|
||||
Args:
|
||||
proto_info: (ProtoInfo) The ProtoInfo provider from the proto_library.
|
||||
root: (File|root) The root directory (e.g., `ctx.bin_dir` or `ctx.genfiles_dir`) under which
|
||||
the generated files should be placed.
|
||||
|
||||
Returns:
|
||||
(str) The physical output directory path.
|
||||
"""
|
||||
proto_source_root = proto_info.proto_source_root
|
||||
if proto_source_root.startswith(root.path):
|
||||
#TODO: remove this branch when bin_dir is removed from proto_source_root
|
||||
|
|
@ -344,6 +357,7 @@ proto_common = struct(
|
|||
experimental_should_generate_code = _experimental_should_generate_code,
|
||||
experimental_filter_sources = _experimental_filter_sources,
|
||||
get_import_path = _get_import_path,
|
||||
output_directory = _output_directory,
|
||||
ProtoLangToolchainInfo = ProtoLangToolchainInfo,
|
||||
INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION = toolchains.INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION,
|
||||
INCOMPATIBLE_PASS_TOOLCHAIN_TYPE = True,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag", "string_list_flag")
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
|
||||
load("//bazel/private:compat_flag.bzl", "compat_bool_flag", "compat_label_flag", "compat_string_list_flag")
|
||||
|
||||
package(
|
||||
default_applicable_licenses = ["//:license"],
|
||||
|
|
@ -25,20 +26,24 @@ filegroup(
|
|||
],
|
||||
)
|
||||
|
||||
bool_flag(
|
||||
compat_bool_flag(
|
||||
name = "experimental_proto_descriptor_sets_include_source_info",
|
||||
build_setting_default = False,
|
||||
fragment_field = "experimental_proto_descriptorsets_include_source_info",
|
||||
scope = "universal",
|
||||
)
|
||||
|
||||
label_flag(
|
||||
compat_label_flag(
|
||||
name = "proto_compiler",
|
||||
build_setting_default = "@bazel_tools//tools/proto:protoc",
|
||||
executable = True,
|
||||
fragment_field = "proto_compiler",
|
||||
)
|
||||
|
||||
string_list_flag(
|
||||
compat_string_list_flag(
|
||||
name = "protocopt",
|
||||
build_setting_default = [],
|
||||
fragment_field = "experimental_protoc_opts",
|
||||
scope = "universal",
|
||||
)
|
||||
|
||||
|
|
@ -75,39 +80,45 @@ config_setting(
|
|||
)
|
||||
|
||||
# TODO: deprecate this flag.
|
||||
string_flag(
|
||||
compat_bool_flag(
|
||||
name = "strict_proto_deps",
|
||||
build_setting_default = "error",
|
||||
build_setting_default = True,
|
||||
fragment_field = "strict_proto_deps",
|
||||
scope = "universal",
|
||||
values = [
|
||||
"off",
|
||||
"OFF",
|
||||
"warn",
|
||||
"WARN",
|
||||
"error",
|
||||
"ERROR",
|
||||
"strict",
|
||||
"STRICT",
|
||||
"default",
|
||||
"DEFAULT",
|
||||
],
|
||||
values = {
|
||||
False: [
|
||||
"off",
|
||||
"OFF",
|
||||
],
|
||||
True: [
|
||||
"warn",
|
||||
"WARN",
|
||||
"error",
|
||||
"ERROR",
|
||||
"strict",
|
||||
"STRICT",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
# TODO: deprecate this flag.
|
||||
string_flag(
|
||||
compat_bool_flag(
|
||||
name = "strict_public_imports",
|
||||
build_setting_default = "off",
|
||||
build_setting_default = False,
|
||||
fragment_field = "strict_public_imports",
|
||||
scope = "universal",
|
||||
values = [
|
||||
"off",
|
||||
"OFF",
|
||||
"warn",
|
||||
"WARN",
|
||||
"error",
|
||||
"ERROR",
|
||||
"strict",
|
||||
"STRICT",
|
||||
"default",
|
||||
"DEFAULT",
|
||||
],
|
||||
values = {
|
||||
False: [
|
||||
"off",
|
||||
"OFF",
|
||||
],
|
||||
True: [
|
||||
"warn",
|
||||
"WARN",
|
||||
"error",
|
||||
"ERROR",
|
||||
"strict",
|
||||
"STRICT",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_list_flag")
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
|
||||
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
|
||||
load("//bazel/private:compat_flag.bzl", "compat_label_flag", "compat_string_list_flag")
|
||||
|
||||
package(
|
||||
default_applicable_licenses = ["//:license"],
|
||||
|
|
@ -8,9 +9,10 @@ package(
|
|||
|
||||
exports_files(["BUILD"])
|
||||
|
||||
label_flag(
|
||||
compat_label_flag(
|
||||
name = "proto_toolchain_for_cc",
|
||||
build_setting_default = "@bazel_tools//tools/proto:cc_toolchain",
|
||||
fragment_field = "proto_toolchain_for_cc",
|
||||
)
|
||||
|
||||
alias(
|
||||
|
|
@ -19,14 +21,16 @@ alias(
|
|||
deprecation = "Use //bazel/flags:protocopt instead.",
|
||||
)
|
||||
|
||||
string_list_flag(
|
||||
compat_string_list_flag(
|
||||
name = "cc_proto_library_header_suffixes",
|
||||
build_setting_default = [".pb.h"],
|
||||
fragment_field = "cc_proto_library_header_suffixes",
|
||||
scope = "universal",
|
||||
)
|
||||
|
||||
string_list_flag(
|
||||
compat_string_list_flag(
|
||||
name = "cc_proto_library_source_suffixes",
|
||||
build_setting_default = [".pb.cc"],
|
||||
fragment_field = "cc_proto_library_source_suffixes",
|
||||
scope = "universal",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,75 +8,22 @@ visibility([
|
|||
"//third_party/grpc/bazel",
|
||||
])
|
||||
|
||||
# Maps flag names to their native reference
|
||||
_FLAGS = {
|
||||
"protocopt": struct(
|
||||
native = lambda ctx: getattr(ctx.fragments.proto, "experimental_protoc_opts"),
|
||||
default = [],
|
||||
),
|
||||
"experimental_proto_descriptor_sets_include_source_info": struct(
|
||||
native = lambda ctx: getattr(ctx.attr, "_experimental_proto_descriptor_sets_include_source_info_native")[BuildSettingInfo].value,
|
||||
default = False,
|
||||
),
|
||||
"proto_compiler": struct(native = lambda ctx: getattr(ctx.attr, "_proto_compiler_native")[BuildSettingInfo].value, default = "@bazel_tools//tools/proto:protoc"),
|
||||
"strict_proto_deps": struct(
|
||||
native = lambda ctx: getattr(ctx.attr, "_strict_proto_deps_native")[BuildSettingInfo].value,
|
||||
default = "error",
|
||||
),
|
||||
"strict_public_imports": struct(
|
||||
native = lambda ctx: getattr(ctx.attr, "_strict_public_imports_native")[BuildSettingInfo].value,
|
||||
default = "off",
|
||||
),
|
||||
"cc_proto_library_header_suffixes": struct(
|
||||
native = lambda ctx: getattr(ctx.fragments.proto, "cc_proto_library_header_suffixes"),
|
||||
default = [".pb.h"],
|
||||
),
|
||||
"cc_proto_library_source_suffixes": struct(
|
||||
native = lambda ctx: getattr(ctx.fragments.proto, "cc_proto_library_source_suffixes"),
|
||||
default = [".pb.cc"],
|
||||
),
|
||||
"proto_toolchain_for_java": struct(
|
||||
native = lambda ctx: "//:java_toolchain",
|
||||
default = "//:java_toolchain",
|
||||
),
|
||||
"proto_toolchain_for_javalite": struct(
|
||||
native = lambda ctx: "//:javalite_toolchain",
|
||||
default = "//:javalite_toolchain",
|
||||
),
|
||||
"proto_toolchain_for_cc": struct(
|
||||
native = lambda ctx: "//:cc_toolchain",
|
||||
default = "//:cc_toolchain",
|
||||
),
|
||||
}
|
||||
|
||||
def get_flag_value(ctx, flag_name):
|
||||
"""Returns the value of the given flag in Starlark if it's set, otherwise reads the Java flag value, if the proto fragment exists.
|
||||
"""Returns the value of the given flag attribute from rule context.
|
||||
|
||||
Args:
|
||||
ctx: The rule context.
|
||||
flag_name: The name of the flag to get the value for.
|
||||
|
||||
Returns:
|
||||
The value of the flag.
|
||||
The value of the flag. If the value is a list, returns a mutable copy.
|
||||
"""
|
||||
|
||||
# We probably got here from toolchains.find_toolchain. Leave the attribute alone.
|
||||
if flag_name not in _FLAGS:
|
||||
return getattr(ctx.attr, "_" + flag_name)
|
||||
|
||||
starlark_flag = getattr(ctx.attr, "_" + flag_name)
|
||||
|
||||
# Label flags don't have a BuildSettingInfo, just get the value.
|
||||
if "toolchain" in flag_name:
|
||||
starlark_flag_is_set = starlark_flag.label != _FLAGS[flag_name].default
|
||||
starlark_value = starlark_flag
|
||||
else:
|
||||
starlark_flag_is_set = starlark_flag[BuildSettingInfo].value != _FLAGS[flag_name].default
|
||||
starlark_value = starlark_flag[BuildSettingInfo].value
|
||||
|
||||
# Starlark flags take precedence over native flags.
|
||||
# Also of course, use the Starlark value if the proto fragment no longer exists.
|
||||
if starlark_flag_is_set or not hasattr(ctx.fragments, "proto"):
|
||||
return starlark_value
|
||||
else:
|
||||
return _FLAGS[flag_name].native(ctx)
|
||||
attr_val = getattr(ctx.attr, "_" + flag_name)
|
||||
if BuildSettingInfo in attr_val:
|
||||
val = attr_val[BuildSettingInfo].value
|
||||
if type(val) == "list":
|
||||
return list(val)
|
||||
return val
|
||||
if type(attr_val) == "list":
|
||||
return list(attr_val)
|
||||
return attr_val
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
load("//bazel/private:compat_flag.bzl", "compat_label_flag")
|
||||
|
||||
package(
|
||||
default_applicable_licenses = ["//:license"],
|
||||
default_visibility = [
|
||||
"//bazel/private:__pkg__",
|
||||
"//bazel/tests:__subpackages__",
|
||||
"//devtools/blaze/exoblaze/mac/integration:__subpackages__",
|
||||
"//devtools/blaze/integration:__subpackages__",
|
||||
],
|
||||
|
|
@ -11,12 +14,14 @@ exports_files(
|
|||
["BUILD"],
|
||||
)
|
||||
|
||||
label_flag(
|
||||
compat_label_flag(
|
||||
name = "proto_toolchain_for_java",
|
||||
build_setting_default = "@bazel_tools//tools/proto:java_toolchain",
|
||||
fragment_field = "proto_toolchain_for_java",
|
||||
)
|
||||
|
||||
label_flag(
|
||||
compat_label_flag(
|
||||
name = "proto_toolchain_for_javalite",
|
||||
build_setting_default = "@bazel_tools//tools/proto:javalite_toolchain",
|
||||
fragment_field = "proto_toolchain_for_javalite",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
load(":native_bool_flag.bzl", "native_bool_flag")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
|
|
@ -168,32 +167,9 @@ bzl_library(
|
|||
],
|
||||
)
|
||||
|
||||
native_bool_flag(
|
||||
name = "experimental_proto_descriptor_sets_include_source_info",
|
||||
flag = "experimental_proto_descriptor_sets_include_source_info",
|
||||
match_value = "true",
|
||||
visibility = ["//bazel:__subpackages__"],
|
||||
)
|
||||
|
||||
native_bool_flag(
|
||||
name = "strict_proto_deps",
|
||||
flag = "strict_proto_deps",
|
||||
match_value = "off",
|
||||
result = False,
|
||||
visibility = ["//bazel:__subpackages__"],
|
||||
)
|
||||
|
||||
native_bool_flag(
|
||||
name = "strict_public_imports",
|
||||
flag = "strict_public_imports",
|
||||
match_value = "off",
|
||||
result = False,
|
||||
visibility = ["//bazel:__subpackages__"],
|
||||
)
|
||||
|
||||
bzl_library(
|
||||
name = "native_bool_flag_bzl",
|
||||
srcs = ["native_bool_flag.bzl"],
|
||||
name = "compat_flag_bzl",
|
||||
srcs = ["compat_flag.bzl"],
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["@bazel_skylib//rules:common_settings"],
|
||||
)
|
||||
|
|
@ -203,8 +179,8 @@ filegroup(
|
|||
testonly = True,
|
||||
srcs = [
|
||||
"BUILD",
|
||||
":compat_flag_bzl",
|
||||
":java_proto_library_bzl",
|
||||
":native_bool_flag_bzl",
|
||||
":toolchain_helpers_bzl",
|
||||
"//bazel:for_bazel_tests",
|
||||
"//bazel/private/oss/toolchains:for_bazel_tests",
|
||||
|
|
|
|||
292
bazel/private/compat_flag.bzl
Normal file
292
bazel/private/compat_flag.bzl
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
# Protocol Buffers - Google's data interchange format
|
||||
# Copyright 2008 Google Inc. All rights reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://developers.google.com/open-source/licenses/bsd
|
||||
"""Helper rules and macros for custom proto flags."""
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
load("@rules_java//java/common:proguard_spec_info.bzl", "ProguardSpecInfo")
|
||||
load("//bazel/common:proto_lang_toolchain_info.bzl", "ProtoLangToolchainInfo")
|
||||
load("//bazel/private:native.bzl", "HAS_NATIVE_PROTO_FLAGS")
|
||||
|
||||
def _compat_bool_rule_impl(ctx):
|
||||
starlark_val = ctx.build_setting_value
|
||||
|
||||
# 1. Starlark flag takes precedence if explicitly passed (not "default")
|
||||
if starlark_val != "default":
|
||||
if starlark_val in ctx.attr.true_values:
|
||||
return [BuildSettingInfo(value = True)]
|
||||
if starlark_val in ctx.attr.false_values:
|
||||
return [BuildSettingInfo(value = False)]
|
||||
allowed = ctx.attr.true_values + ctx.attr.false_values + ["default"]
|
||||
fail("Invalid value '%s' for flag %s. Allowed values are: %s" % (
|
||||
starlark_val,
|
||||
ctx.label,
|
||||
allowed,
|
||||
))
|
||||
|
||||
# 2. Native flag fallback (if HAS_NATIVE_PROTO_FLAGS and present on ctx.fragments.proto)
|
||||
if HAS_NATIVE_PROTO_FLAGS and hasattr(ctx.fragments, "proto") and ctx.attr.fragment_field:
|
||||
if hasattr(ctx.fragments.proto, ctx.attr.fragment_field):
|
||||
native_val = getattr(ctx.fragments.proto, ctx.attr.fragment_field)()
|
||||
if native_val == True or native_val in ctx.attr.true_values:
|
||||
return [BuildSettingInfo(value = True)]
|
||||
if native_val == False or native_val in ctx.attr.false_values:
|
||||
return [BuildSettingInfo(value = False)]
|
||||
|
||||
# 3. Default fallback
|
||||
return [BuildSettingInfo(value = ctx.attr.default_value)]
|
||||
|
||||
_compat_bool_rule = rule(
|
||||
implementation = _compat_bool_rule_impl,
|
||||
build_setting = config.string(flag = True),
|
||||
fragments = ["proto"] if HAS_NATIVE_PROTO_FLAGS else [],
|
||||
attrs = {
|
||||
"fragment_field": attr.string(),
|
||||
"true_values": attr.string_list(default = []),
|
||||
"false_values": attr.string_list(default = []),
|
||||
"default_value": attr.bool(default = False),
|
||||
"scope": attr.string(),
|
||||
},
|
||||
)
|
||||
|
||||
def compat_bool_flag(
|
||||
*,
|
||||
name,
|
||||
fragment_field = None,
|
||||
build_setting_default = False,
|
||||
values = None,
|
||||
**kwargs):
|
||||
"""Creates a custom build setting flag reconciling Starlark/fragments.
|
||||
|
||||
Args:
|
||||
name: The target name for the Starlark build setting flag.
|
||||
fragment_field: The field name in ctx.fragments.proto (e.g. "strict_proto_deps"), if any.
|
||||
build_setting_default: Fallback default boolean value if neither Starlark nor fragment is set.
|
||||
values: Dict mapping booleans (True/False) to lists of accepted string flag values.
|
||||
Defaults to {True: ["true", "TRUE", "1"], False: ["false", "FALSE", "0"]}.
|
||||
**kwargs: Additional rule arguments (such as `scope`).
|
||||
"""
|
||||
if values == None:
|
||||
values = {
|
||||
True: ["true", "TRUE", "1"],
|
||||
False: ["false", "FALSE", "0"],
|
||||
}
|
||||
|
||||
true_vals = values.get(True, [])
|
||||
false_vals = values.get(False, [])
|
||||
|
||||
starlark_true_vals = [v for v in true_vals if v != "default"]
|
||||
starlark_false_vals = [v for v in false_vals if v != "default"]
|
||||
|
||||
_compat_bool_rule(
|
||||
name = name,
|
||||
build_setting_default = "default",
|
||||
fragment_field = fragment_field,
|
||||
true_values = starlark_true_vals,
|
||||
false_values = starlark_false_vals,
|
||||
default_value = build_setting_default,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def _compat_string_list_rule_impl(ctx):
|
||||
starlark_val = ctx.build_setting_value
|
||||
|
||||
# 1. Starlark flag takes precedence if explicitly passed (not empty)
|
||||
if starlark_val:
|
||||
return [BuildSettingInfo(value = starlark_val)]
|
||||
|
||||
# 2. Native flag fallback (if HAS_NATIVE_PROTO_FLAGS and present on ctx.fragments.proto)
|
||||
if HAS_NATIVE_PROTO_FLAGS and hasattr(ctx.fragments, "proto") and ctx.attr.fragment_field:
|
||||
if hasattr(ctx.fragments.proto, ctx.attr.fragment_field):
|
||||
val = getattr(ctx.fragments.proto, ctx.attr.fragment_field)
|
||||
if type(val) == "list":
|
||||
return [BuildSettingInfo(value = val)]
|
||||
else:
|
||||
return [BuildSettingInfo(value = val())]
|
||||
|
||||
# 3. Default fallback
|
||||
return [BuildSettingInfo(value = ctx.attr.default_value)]
|
||||
|
||||
_compat_string_list_rule = rule(
|
||||
implementation = _compat_string_list_rule_impl,
|
||||
build_setting = config.string_list(flag = True, repeatable = True),
|
||||
fragments = ["proto"] if HAS_NATIVE_PROTO_FLAGS else [],
|
||||
attrs = {
|
||||
"fragment_field": attr.string(),
|
||||
"default_value": attr.string_list(default = []),
|
||||
"scope": attr.string(),
|
||||
},
|
||||
)
|
||||
|
||||
def compat_string_list_flag(
|
||||
*,
|
||||
name,
|
||||
fragment_field = None,
|
||||
build_setting_default = None,
|
||||
**kwargs):
|
||||
"""Creates a custom string-list build setting reconciling Starlark/fragments.
|
||||
|
||||
Args:
|
||||
name: The target name for the Starlark build setting flag.
|
||||
fragment_field: The field name in ctx.fragments.proto (e.g. "experimental_protoc_opts"), if any.
|
||||
build_setting_default: Fallback default string list value if neither Starlark nor fragment is set.
|
||||
**kwargs: Additional rule arguments (such as `scope`).
|
||||
"""
|
||||
default_vals = build_setting_default if build_setting_default != None else []
|
||||
|
||||
_compat_string_list_rule(
|
||||
name = name,
|
||||
build_setting_default = default_vals,
|
||||
fragment_field = fragment_field,
|
||||
default_value = default_vals,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def _forward_providers(ctx, label_val, target = None, extra_providers = []):
|
||||
if target == None:
|
||||
target = ctx.attr.default_value
|
||||
providers = [BuildSettingInfo(value = label_val)] + extra_providers
|
||||
if ProtoLangToolchainInfo in target:
|
||||
providers.append(target[ProtoLangToolchainInfo])
|
||||
if target[ProtoLangToolchainInfo].runtime and JavaInfo in target[ProtoLangToolchainInfo].runtime:
|
||||
providers.append(target[ProtoLangToolchainInfo].runtime[JavaInfo])
|
||||
if target[ProtoLangToolchainInfo].runtime and ProguardSpecInfo in target[ProtoLangToolchainInfo].runtime:
|
||||
providers.append(target[ProtoLangToolchainInfo].runtime[ProguardSpecInfo])
|
||||
|
||||
if JavaInfo in target:
|
||||
providers.append(target[JavaInfo])
|
||||
|
||||
if ProguardSpecInfo in target:
|
||||
providers.append(target[ProguardSpecInfo])
|
||||
|
||||
if CcInfo in target:
|
||||
providers.append(target[CcInfo])
|
||||
|
||||
return providers
|
||||
|
||||
def _compat_label_rule_impl(ctx):
|
||||
target = ctx.attr.default_value
|
||||
label_val = target.label
|
||||
|
||||
starlark_val = ctx.build_setting_value
|
||||
|
||||
# 1. Starlark flag takes precedence if explicitly passed (not "default")
|
||||
if starlark_val != "default":
|
||||
label_val = Label(starlark_val)
|
||||
|
||||
# 2. Native flag fallback (if HAS_NATIVE_PROTO_FLAGS and _native_target present on ctx.attr)
|
||||
elif HAS_NATIVE_PROTO_FLAGS and hasattr(ctx.attr, "_native_target") and ctx.attr._native_target:
|
||||
native_target = ctx.attr._native_target
|
||||
if native_target.label != target.label:
|
||||
target = native_target
|
||||
label_val = native_target.label
|
||||
|
||||
return _forward_providers(ctx, label_val, target = target)
|
||||
|
||||
def _compat_executable_label_rule_impl(ctx):
|
||||
target = ctx.attr.default_value
|
||||
label_val = target.label
|
||||
|
||||
starlark_val = ctx.build_setting_value
|
||||
if starlark_val != "default":
|
||||
label_val = Label(starlark_val)
|
||||
elif HAS_NATIVE_PROTO_FLAGS and hasattr(ctx.attr, "_native_target") and ctx.attr._native_target:
|
||||
native_target = ctx.attr._native_target
|
||||
if native_target.label != target.label:
|
||||
target = native_target
|
||||
label_val = native_target.label
|
||||
|
||||
extra_providers = []
|
||||
if DefaultInfo in target:
|
||||
def_info = target[DefaultInfo]
|
||||
if def_info.files_to_run and def_info.files_to_run.executable:
|
||||
orig_exec = def_info.files_to_run.executable
|
||||
symlink = ctx.actions.declare_file(orig_exec.basename)
|
||||
ctx.actions.symlink(
|
||||
output = symlink,
|
||||
target_file = orig_exec,
|
||||
is_executable = True,
|
||||
)
|
||||
extra_providers.append(DefaultInfo(
|
||||
files = depset([symlink]),
|
||||
runfiles = def_info.default_runfiles,
|
||||
executable = symlink,
|
||||
))
|
||||
|
||||
return _forward_providers(ctx, label_val, target = target, extra_providers = extra_providers)
|
||||
|
||||
_COMMON_LABEL_FLAG_ATTRS = {
|
||||
"fragment_field": attr.string(),
|
||||
"default_value": attr.label(),
|
||||
"runtime": attr.label(),
|
||||
"scope": attr.string(),
|
||||
}
|
||||
|
||||
def _make_label_rule(fragment_name, executable = False):
|
||||
attrs = dict(_COMMON_LABEL_FLAG_ATTRS)
|
||||
if HAS_NATIVE_PROTO_FLAGS and fragment_name:
|
||||
attrs["_native_target"] = attr.label(
|
||||
default = configuration_field(fragment = "proto", name = fragment_name),
|
||||
)
|
||||
return rule(
|
||||
implementation = _compat_executable_label_rule_impl if executable else _compat_label_rule_impl,
|
||||
build_setting = config.string(flag = True),
|
||||
executable = executable,
|
||||
fragments = ["proto"] if HAS_NATIVE_PROTO_FLAGS and fragment_name else [],
|
||||
attrs = attrs,
|
||||
)
|
||||
|
||||
_compat_label_rule_compiler = _make_label_rule("proto_compiler", executable = False)
|
||||
_compat_executable_label_rule_compiler = _make_label_rule("proto_compiler", executable = True)
|
||||
_compat_label_rule_cc = _make_label_rule("proto_toolchain_for_cc", executable = False)
|
||||
_compat_label_rule_java = _make_label_rule("proto_toolchain_for_java", executable = False)
|
||||
_compat_label_rule_javalite = _make_label_rule("proto_toolchain_for_java_lite", executable = False)
|
||||
_compat_label_rule_default = _make_label_rule(None, executable = False)
|
||||
_compat_executable_label_rule_default = _make_label_rule(None, executable = True)
|
||||
|
||||
_LABEL_RULES = {
|
||||
("proto_compiler", False): _compat_label_rule_compiler,
|
||||
("proto_compiler", True): _compat_executable_label_rule_compiler,
|
||||
("proto_toolchain_for_cc", False): _compat_label_rule_cc,
|
||||
("proto_toolchain_for_java", False): _compat_label_rule_java,
|
||||
("proto_toolchain_for_javalite", False): _compat_label_rule_javalite,
|
||||
(None, False): _compat_label_rule_default,
|
||||
(None, True): _compat_executable_label_rule_default,
|
||||
}
|
||||
|
||||
def compat_label_flag(
|
||||
*,
|
||||
name,
|
||||
fragment_field = None,
|
||||
build_setting_default = None,
|
||||
executable = False,
|
||||
**kwargs):
|
||||
"""Creates a custom label build setting reconciling Starlark/fragments.
|
||||
|
||||
Args:
|
||||
name: The target name for the Starlark build setting flag.
|
||||
fragment_field: The field name in ctx.fragments.proto, if any.
|
||||
build_setting_default: Fallback default label target.
|
||||
executable: Whether the label setting points to an executable target.
|
||||
**kwargs: Additional rule arguments (such as `scope`).
|
||||
"""
|
||||
if fragment_field != None and (fragment_field, executable) not in _LABEL_RULES:
|
||||
fail("Unsupported fragment_field '%s' for compat_label_flag. Supported values are: %s" % (
|
||||
fragment_field,
|
||||
sorted([k[0] for k in _LABEL_RULES.keys() if k[0] != None]),
|
||||
))
|
||||
|
||||
rule_func = _LABEL_RULES.get((fragment_field, executable), _LABEL_RULES[(None, executable)])
|
||||
rule_func(
|
||||
name = name,
|
||||
build_setting_default = "default",
|
||||
fragment_field = fragment_field or "",
|
||||
default_value = build_setting_default,
|
||||
runtime = build_setting_default,
|
||||
**kwargs
|
||||
)
|
||||
|
|
@ -74,7 +74,7 @@ java_proto_aspect = aspect(
|
|||
attrs = (
|
||||
toolchains.if_legacy_toolchain({
|
||||
"_aspect_java_proto_toolchain": attr.label(
|
||||
default = "//bazel/flags/java:proto_toolchain_for_java",
|
||||
default = Label("//bazel/flags/java:proto_toolchain_for_java"),
|
||||
),
|
||||
})
|
||||
),
|
||||
|
|
@ -161,7 +161,7 @@ rules to generate Java code for.
|
|||
"licenses": attr.license() if hasattr(attr, "license") else attr.string_list(),
|
||||
} | toolchains.if_legacy_toolchain({
|
||||
"_aspect_java_proto_toolchain": attr.label(
|
||||
default = "//bazel/flags/java:proto_toolchain_for_java",
|
||||
default = Label("//bazel/flags/java:proto_toolchain_for_java"),
|
||||
),
|
||||
}), # buildifier: disable=attr-licenses (attribute called licenses)
|
||||
provides = [JavaInfo],
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
"""Renames toplevel symbols so they can be exported in Starlark under the same name"""
|
||||
|
||||
native_proto_common = proto_common_do_not_use
|
||||
load("@proto_bazel_features//:features.bzl", "bazel_features")
|
||||
|
||||
native_proto_common = getattr(native, "proto_common", None)
|
||||
HAS_NATIVE_PROTO_FLAGS = bazel_features.rules.has_proto_fragment
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
# Protocol Buffers - Google's data interchange format
|
||||
# Copyright 2008 Google Inc. All rights reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://developers.google.com/open-source/licenses/bsd
|
||||
"""
|
||||
A helper rule that reads a native boolean flag.
|
||||
"""
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
|
||||
def _impl(ctx):
|
||||
return [BuildSettingInfo(value = ctx.attr.value)]
|
||||
|
||||
_native_bool_flag_rule = rule(
|
||||
implementation = _impl,
|
||||
attrs = {"value": attr.bool()},
|
||||
)
|
||||
|
||||
def native_bool_flag(*, name, flag, match_value = "true", result = True, **kwargs):
|
||||
_native_bool_flag_rule(
|
||||
name = name,
|
||||
value = select({
|
||||
name + "_setting": result,
|
||||
"//conditions:default": not result,
|
||||
}),
|
||||
**kwargs
|
||||
)
|
||||
|
||||
native.config_setting(
|
||||
name = name + "_setting",
|
||||
values = {flag: match_value},
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
|
@ -7,11 +7,11 @@
|
|||
#
|
||||
"""Bazel's implementation of cc_proto_library"""
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
load("@rules_cc//cc:find_cc_toolchain.bzl", "use_cc_toolchain")
|
||||
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
|
||||
load("//bazel/common:proto_common.bzl", "proto_common")
|
||||
load("//bazel/common:proto_info.bzl", "ProtoInfo")
|
||||
load("//bazel/flags:flags.bzl", "get_flag_value")
|
||||
load("//bazel/private:cc_proto_support.bzl", "cc_proto_compile_and_link")
|
||||
load("//bazel/private:toolchain_helpers.bzl", "toolchains")
|
||||
|
||||
|
|
@ -30,7 +30,6 @@ def _get_output_files(actions, proto_info, suffixes):
|
|||
))
|
||||
return result
|
||||
|
||||
# TODO: Make this code actually work.
|
||||
def _get_strip_include_prefix(ctx, proto_info):
|
||||
proto_root = proto_info.proto_source_root
|
||||
if proto_root == "." or proto_root == ctx.label.workspace_root:
|
||||
|
|
@ -59,8 +58,8 @@ def _aspect_impl(target, ctx):
|
|||
|
||||
if should_generate_code:
|
||||
if len(proto_info.direct_sources) != 0:
|
||||
source_suffixes = get_flag_value(ctx, "cc_proto_library_source_suffixes")
|
||||
header_suffixes = get_flag_value(ctx, "cc_proto_library_header_suffixes")
|
||||
source_suffixes = ctx.attr._cc_proto_library_source_suffixes[BuildSettingInfo].value
|
||||
header_suffixes = ctx.attr._cc_proto_library_header_suffixes[BuildSettingInfo].value
|
||||
sources = _get_output_files(ctx.actions, proto_info, source_suffixes)
|
||||
headers = _get_output_files(ctx.actions, proto_info, header_suffixes)
|
||||
header_provider = _ProtoCcHeaderInfo(headers = depset(headers))
|
||||
|
|
@ -194,7 +193,7 @@ rules to generate C++ code for.""",
|
|||
),
|
||||
} | toolchains.if_legacy_toolchain({
|
||||
"_proto_toolchain_for_cc": attr.label(
|
||||
default = "//bazel/flags/cc:proto_toolchain_for_cc",
|
||||
default = Label("//bazel/flags/cc:proto_toolchain_for_cc"),
|
||||
),
|
||||
}),
|
||||
provides = [CcInfo],
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ _PROTO_BAZEL_FEATURES = """bazel_features = struct(
|
|||
),
|
||||
rules = struct(
|
||||
analysis_tests_can_transition_on_experimental_incompatible_flags = {analysis_tests_can_transition_on_experimental_incompatible_flags},
|
||||
has_proto_fragment = {has_proto_fragment},
|
||||
),
|
||||
globals = struct(
|
||||
PackageSpecificationInfo = {PackageSpecificationInfo},
|
||||
|
|
@ -40,6 +41,7 @@ def _proto_bazel_features_impl(rctx):
|
|||
protobuf_on_allowlist = major_version_int > 7
|
||||
ProtoInfo = "ProtoInfo" if major_version_int < 8 else "None"
|
||||
cc_proto_aspect = "cc_proto_aspect" if major_version_int < 8 else "None"
|
||||
has_proto_fragment = major_version_int < 9
|
||||
|
||||
rctx.file("BUILD.bazel", """
|
||||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
|
|
@ -58,6 +60,7 @@ exports_files(["features.bzl"])
|
|||
cc_proto_aspect = cc_proto_aspect,
|
||||
analysis_tests_can_transition_on_experimental_incompatible_flags =
|
||||
"True" if major_version_int > 8 or (major_version_int == 8 and minor_version_int >= 2) else "False",
|
||||
has_proto_fragment = repr(has_proto_fragment),
|
||||
))
|
||||
|
||||
proto_bazel_features = repository_rule(
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ def _protoc_authenticity_impl(ctx):
|
|||
mnemonic = "ProtocAuthenticityCheck",
|
||||
outputs = [validation_output],
|
||||
tools = [proto_lang_toolchain_info.proto_compiler],
|
||||
toolchain = toolchains.PROTO_TOOLCHAIN,
|
||||
command = """\
|
||||
{protoc} --version > {validation_output}
|
||||
grep -q -e "-dev$" {validation_output} && {{
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
#
|
||||
"""Implementation of the proto_lang_toolchain rule."""
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
load("@proto_bazel_features//:features.bzl", "bazel_features")
|
||||
load("//bazel/common:proto_common.bzl", "proto_common")
|
||||
load("//bazel/common:proto_info.bzl", "ProtoInfo")
|
||||
load("//bazel/common:proto_lang_toolchain_info.bzl", "ProtoLangToolchainInfo")
|
||||
load("//bazel/flags:flags.bzl", "get_flag_value")
|
||||
load("//bazel/private:toolchain_helpers.bzl", "toolchains")
|
||||
|
||||
def _rule_impl(ctx):
|
||||
|
|
@ -34,7 +34,7 @@ def _rule_impl(ctx):
|
|||
protoc_opts = ctx.toolchains[toolchains.PROTO_TOOLCHAIN].proto.protoc_opts
|
||||
else:
|
||||
proto_compiler = ctx.attr._proto_compiler.files_to_run
|
||||
protoc_opts = get_flag_value(ctx, "protocopt")
|
||||
protoc_opts = list(ctx.attr._protocopt[BuildSettingInfo].value)
|
||||
|
||||
if ctx.attr.protoc_minimal_do_not_use:
|
||||
proto_compiler = ctx.attr.protoc_minimal_do_not_use.files_to_run
|
||||
|
|
@ -150,14 +150,14 @@ Deprecated. Alias for <code>denylisted_protos</code>. Will be removed in a futur
|
|||
executable = True,
|
||||
),
|
||||
"_protocopt": attr.label(
|
||||
default = "//bazel/flags:protocopt",
|
||||
default = Label("//bazel/flags:protocopt"),
|
||||
),
|
||||
} | ({} if proto_common.INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION else {
|
||||
"_proto_compiler": attr.label(
|
||||
cfg = "exec",
|
||||
executable = True,
|
||||
allow_files = True,
|
||||
default = "//bazel/flags:proto_compiler",
|
||||
default = Label("//bazel/flags:proto_compiler"),
|
||||
),
|
||||
}),
|
||||
provides = [ProtoLangToolchainInfo],
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ Implementation of proto_library rule.
|
|||
"""
|
||||
|
||||
load("@bazel_skylib//lib:paths.bzl", "paths")
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
load("@proto_bazel_features//:features.bzl", "bazel_features")
|
||||
load("//bazel/common:proto_common.bzl", "proto_common")
|
||||
load("//bazel/common:proto_info.bzl", "ProtoInfo")
|
||||
load("//bazel/flags:flags.bzl", "get_flag_value")
|
||||
load("//bazel/private:toolchain_helpers.bzl", "toolchains")
|
||||
|
||||
DIRECT_DEPS_FLAG_TEMPLATE = (
|
||||
|
|
@ -177,15 +177,13 @@ def _write_descriptor_set(ctx, proto_info, deps, option_deps, exports, descripto
|
|||
|
||||
args = ctx.actions.args()
|
||||
|
||||
if get_flag_value(ctx, "experimental_proto_descriptor_sets_include_source_info"):
|
||||
if ctx.attr._experimental_proto_descriptor_sets_include_source_info[BuildSettingInfo].value:
|
||||
args.add("--include_source_info")
|
||||
args.add("--retain_options")
|
||||
|
||||
strict_deps = get_flag_value(ctx, "strict_proto_deps")
|
||||
strict_proto_deps = ctx.attr._strict_proto_deps[BuildSettingInfo].value
|
||||
|
||||
# Need to check for off because the starlark flag value doesn't have the sneaky
|
||||
# mapping from "off" to false.
|
||||
if strict_deps and strict_deps != "off":
|
||||
if strict_proto_deps:
|
||||
if proto_info.direct_sources:
|
||||
# Direct sources can be option imported in addition to `deps`.
|
||||
strict_importable_sources = depset(
|
||||
|
|
@ -226,11 +224,7 @@ def _write_descriptor_set(ctx, proto_info, deps, option_deps, exports, descripto
|
|||
# Set `-option_dependencies_violation_msg=`
|
||||
args.add(ctx.label, format = OPTION_DEPS_FLAG_TEMPLATE)
|
||||
|
||||
strict_imports = get_flag_value(ctx, "strict_public_imports")
|
||||
|
||||
# Need to check for off because the starlark flag value doesn't have the sneaky
|
||||
# mapping from "off" to false.
|
||||
if strict_imports and strict_imports != "OFF":
|
||||
if ctx.attr._strict_public_imports[BuildSettingInfo].value:
|
||||
public_import_protos = depset(transitive = [export.check_deps_sources for export in exports])
|
||||
if not public_import_protos:
|
||||
# This line is necessary to trigger the check.
|
||||
|
|
@ -255,7 +249,7 @@ def _write_descriptor_set(ctx, proto_info, deps, option_deps, exports, descripto
|
|||
mnemonic = "GenProtoDescriptorSet",
|
||||
progress_message = "Generating Descriptor Set proto_library %{label}",
|
||||
proto_compiler = ctx.executable._proto_compiler,
|
||||
protoc_opts = get_flag_value(ctx, "protocopt"),
|
||||
protoc_opts = ctx.attr._protocopt[BuildSettingInfo].value,
|
||||
plugin = None,
|
||||
)
|
||||
|
||||
|
|
@ -391,32 +385,21 @@ for use with MessageSet.
|
|||
),
|
||||
# buildifier: disable=attr-license (calling attr.license())
|
||||
"licenses": attr.license() if hasattr(attr, "license") else attr.string_list(),
|
||||
"_experimental_proto_descriptor_sets_include_source_info_native": attr.label(
|
||||
default = "//bazel/private:experimental_proto_descriptor_sets_include_source_info",
|
||||
),
|
||||
"_experimental_proto_descriptor_sets_include_source_info": attr.label(
|
||||
default = "//bazel/flags:experimental_proto_descriptor_sets_include_source_info",
|
||||
),
|
||||
"_strict_proto_deps_native": attr.label(
|
||||
default =
|
||||
"//bazel/private:strict_proto_deps",
|
||||
default = Label("//bazel/flags:experimental_proto_descriptor_sets_include_source_info"),
|
||||
),
|
||||
"_strict_proto_deps": attr.label(
|
||||
default =
|
||||
"//bazel/flags:strict_proto_deps",
|
||||
),
|
||||
"_strict_public_imports_native": attr.label(
|
||||
default = "//bazel/private:strict_public_imports",
|
||||
default = Label("//bazel/flags:strict_proto_deps"),
|
||||
),
|
||||
"_strict_public_imports": attr.label(
|
||||
default = "//bazel/flags:strict_public_imports",
|
||||
default = Label("//bazel/flags:strict_public_imports"),
|
||||
),
|
||||
} | toolchains.if_legacy_toolchain({
|
||||
"_proto_compiler": attr.label(
|
||||
cfg = "exec",
|
||||
executable = True,
|
||||
allow_files = True,
|
||||
default = "//src/google/protobuf/compiler:protoc_minimal",
|
||||
default = Label("//src/google/protobuf/compiler:protoc_minimal"),
|
||||
),
|
||||
}), # buildifier: disable=attr-licenses (attribute called licenses)
|
||||
fragments = [
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
#
|
||||
"""A Starlark implementation of the proto_toolchain rule."""
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
load("//bazel/common:proto_common.bzl", "proto_common")
|
||||
load("//bazel/common:proto_lang_toolchain_info.bzl", "ProtoLangToolchainInfo")
|
||||
load("//bazel/flags:flags.bzl", "get_flag_value")
|
||||
load("//bazel/private:toolchain_helpers.bzl", "toolchains")
|
||||
|
||||
def _impl(ctx):
|
||||
|
|
@ -25,7 +25,7 @@ def _impl(ctx):
|
|||
plugin = None,
|
||||
runtime = None,
|
||||
proto_compiler = ctx.attr.proto_compiler.files_to_run,
|
||||
protoc_opts = get_flag_value(ctx, "protocopt"),
|
||||
protoc_opts = list(ctx.attr._protocopt[BuildSettingInfo].value),
|
||||
progress_message = ctx.attr.progress_message,
|
||||
mnemonic = ctx.attr.mnemonic,
|
||||
**(dict(toolchain_type = toolchains.PROTO_TOOLCHAIN) if proto_common.INCOMPATIBLE_PASS_TOOLCHAIN_TYPE else {})
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ the migration is finished, the helpers can be removed.
|
|||
"""
|
||||
|
||||
load("//bazel/common:proto_lang_toolchain_info.bzl", "ProtoLangToolchainInfo")
|
||||
load("//bazel/flags:flags.bzl", "get_flag_value")
|
||||
load("//bazel/private:native.bzl", "native_proto_common")
|
||||
|
||||
_incompatible_toolchain_resolution = getattr(native_proto_common, "INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION", False)
|
||||
|
|
@ -27,7 +26,7 @@ def _find_toolchain(ctx, legacy_attr, toolchain_type):
|
|||
fail("No toolchains registered for '%s'." % toolchain_type)
|
||||
return toolchain.proto
|
||||
else:
|
||||
return get_flag_value(ctx, legacy_attr)[ProtoLangToolchainInfo]
|
||||
return getattr(ctx.attr, "_" + legacy_attr)[ProtoLangToolchainInfo]
|
||||
|
||||
def _use_toolchain(toolchain_type):
|
||||
if _incompatible_toolchain_resolution:
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ def bazel_proto_library_test_suite(name):
|
|||
_test_strip_import_prefix_without_deps,
|
||||
_test_strict_public_imports_enabled,
|
||||
_test_strict_public_imports_disabled,
|
||||
_test_strict_public_imports_default,
|
||||
_test_strict_public_imports_transitive_exports,
|
||||
_test_strip_import_prefix_with_deps,
|
||||
_test_exported_stripped_import_prefixes,
|
||||
|
|
@ -45,6 +46,8 @@ def bazel_proto_library_test_suite(name):
|
|||
_test_proto_library_without_sources,
|
||||
_test_proto_library_with_generated_sources,
|
||||
_test_proto_library_with_mixed_sources,
|
||||
_test_strict_proto_deps_starlark_override_native,
|
||||
_test_strict_proto_deps_starlark_off_native_on,
|
||||
]
|
||||
|
||||
# Flipping experimental flag in test requires Bazel 8
|
||||
|
|
@ -297,6 +300,7 @@ def _test_descriptor_set_output_strict_deps_disabled_impl(env, target):
|
|||
action = env.expect.that_target(target).action_generating(
|
||||
"{package}/{name}-descriptor-set.proto.bin",
|
||||
)
|
||||
|
||||
action.argv().not_contains("--direct_dependencies")
|
||||
action.argv().not_contains_predicate(matching.str_matches("--direct_dependencies_violation_msg=*"))
|
||||
|
||||
|
|
@ -357,6 +361,22 @@ def _test_strict_public_imports_disabled_impl(env, target):
|
|||
)
|
||||
action.argv().not_contains("--allowed_public_imports=")
|
||||
|
||||
def _test_strict_public_imports_default(name):
|
||||
util.helper_target(proto_library, name = name + "_foo", srcs = ["foo.proto"])
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_foo",
|
||||
impl = _test_strict_public_imports_default_impl,
|
||||
)
|
||||
|
||||
def _test_strict_public_imports_default_impl(env, target):
|
||||
action = env.expect.that_target(target).action_generating(
|
||||
"{package}/{name}-descriptor-set.proto.bin",
|
||||
)
|
||||
|
||||
action.argv().not_contains("--allowed_public_imports=")
|
||||
|
||||
def _test_strict_public_imports_transitive_exports(name):
|
||||
util.helper_target(
|
||||
proto_library,
|
||||
|
|
@ -649,7 +669,10 @@ def _test_experimental_proto_descriptor_sets_include_source_info(name):
|
|||
name = name,
|
||||
target = name + "_a_proto",
|
||||
impl = _test_experimental_proto_descriptor_sets_include_source_info_impl,
|
||||
config_settings = {"@@//bazel/flags:experimental_proto_descriptor_sets_include_source_info": True},
|
||||
config_settings = {
|
||||
"//command_line_option:experimental_proto_descriptor_sets_include_source_info": "true",
|
||||
"@@//bazel/flags:experimental_proto_descriptor_sets_include_source_info": "true",
|
||||
},
|
||||
)
|
||||
|
||||
def _test_experimental_proto_descriptor_sets_include_source_info_impl(env, target):
|
||||
|
|
@ -773,3 +796,27 @@ def _test_proto_library_with_mixed_sources_impl(env, target):
|
|||
target.label.package + "/a.proto",
|
||||
target.label.package + "/generated2.proto",
|
||||
])
|
||||
|
||||
def _test_strict_proto_deps_starlark_override_native(name):
|
||||
util.helper_target(proto_library, name = name + "_foo", srcs = ["foo.proto", "bar.proto"])
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_foo",
|
||||
impl = _test_descriptor_set_output_strict_deps_strict_impl,
|
||||
config_settings = {
|
||||
"@@//bazel/flags:strict_proto_deps": "error",
|
||||
},
|
||||
)
|
||||
|
||||
def _test_strict_proto_deps_starlark_off_native_on(name):
|
||||
util.helper_target(proto_library, name = name + "_foo", srcs = ["foo.proto"])
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_foo",
|
||||
impl = _test_descriptor_set_output_strict_deps_disabled_impl,
|
||||
config_settings = {
|
||||
"@@//bazel/flags:strict_proto_deps": "off",
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
load("@rules_testing//lib:util.bzl", "PREVENT_IMPLICIT_BUILDING_TAGS")
|
||||
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests:java_lite_proto_library_tests/test_utils.bzl", "java_info_subject_factory")
|
||||
load("//bazel/tests:proto_bzl_test_suite.bzl", "bzl_test_suite")
|
||||
load(":tests.bzl", "TESTS")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_library(
|
||||
name = "baz_proto",
|
||||
srcs = ["baz.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "bar_proto",
|
||||
srcs = ["bar.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":baz_proto"],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "bar_java_proto_lite",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = ["bar_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "foo_proto",
|
||||
srcs = ["foo.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":bar_proto"],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "foo_java_proto_lite",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":foo_proto"],
|
||||
)
|
||||
|
||||
bzl_test_suite(
|
||||
name = "tests",
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
tests = TESTS,
|
||||
)
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
"""Tests that a java_lite_proto_library only provides direct jars corresponding on the
|
||||
* proto_library rules it directly depends on, excluding anything that the proto_library rules
|
||||
* depends on themselves. This does not concern strict-deps in the compilation of the generated
|
||||
* Java code itself, only compilation of regular code in java_library/java_binary and similar
|
||||
* rules."""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
def _test_foo_correctly_defines_direct_jars(env, target):
|
||||
java_info = env.expect.that_target(target).provider(JavaInfo)
|
||||
java_info.compile_jars().contains_exactly([
|
||||
"{package}/libfoo_proto-lite-hjar.jar",
|
||||
])
|
||||
java_info.source_jars().contains_exactly([
|
||||
"{package}/foo_proto-lite-src.jar",
|
||||
])
|
||||
|
||||
def _test_bar_correctly_defines_direct_jars(env, target):
|
||||
java_info = env.expect.that_target(target).provider(JavaInfo)
|
||||
java_info.compile_jars().contains_exactly([
|
||||
"{package}/libbar_proto-lite-hjar.jar",
|
||||
])
|
||||
java_info.source_jars().contains_exactly([
|
||||
"{package}/bar_proto-lite-src.jar",
|
||||
])
|
||||
|
||||
TESTS = {
|
||||
":foo_java_proto_lite": [_test_foo_correctly_defines_direct_jars],
|
||||
":bar_java_proto_lite": [_test_bar_correctly_defines_direct_jars],
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
load("@rules_testing//lib:util.bzl", "PREVENT_IMPLICIT_BUILDING_TAGS")
|
||||
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests:java_lite_proto_library_tests/test_utils.bzl", "java_info_subject_factory")
|
||||
load("//bazel/tests:proto_bzl_test_suite.bzl", "bzl_test_suite")
|
||||
load(":tests.bzl", "TESTS")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_library(
|
||||
name = "bar_proto",
|
||||
srcs = ["bar.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "foo_proto",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":bar_proto"],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "foo_java_proto_lite",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":foo_proto"],
|
||||
)
|
||||
|
||||
bzl_test_suite(
|
||||
name = "tests",
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
tests = TESTS,
|
||||
)
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
"""
|
||||
Tests that a java_proto_library only provides direct jars corresponding on the proto_library
|
||||
rules it directly depends on, excluding anything that the proto_library rules depends on
|
||||
themselves. This does not concern strict-deps in the compilation of the generated Java code
|
||||
itself, only compilation of regular code in java_library/java_binary and similar rules.
|
||||
"""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
def _test_correctly_defines_direct_jars_alias_proto(env, target):
|
||||
java_info = env.expect.that_target(target).provider(JavaInfo)
|
||||
java_info.compile_jars().contains_exactly([
|
||||
"{package}/libbar_proto-lite-hjar.jar",
|
||||
])
|
||||
|
||||
TESTS = {
|
||||
":foo_java_proto_lite": [_test_correctly_defines_direct_jars_alias_proto],
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
load("@rules_testing//lib:util.bzl", "PREVENT_IMPLICIT_BUILDING_TAGS")
|
||||
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests:java_proto_library_tests/test_utils.bzl", "java_info_subject_factory")
|
||||
load("//bazel/tests:proto_bzl_test_suite.bzl", "bzl_test_suite")
|
||||
load(":tests.bzl", "TESTS")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_library(
|
||||
name = "empty_proto",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "empty_java_proto_lite",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":empty_proto"],
|
||||
)
|
||||
|
||||
bzl_test_suite(
|
||||
name = "tests",
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
tests = TESTS,
|
||||
)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
"""Tests for empty srcs interop."""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
def _test_empty_srcs(env, target):
|
||||
env.expect.that_target(target).has_provider(JavaInfo)
|
||||
|
||||
TESTS = {
|
||||
":empty_java_proto_lite": [_test_empty_srcs],
|
||||
}
|
||||
61
bazel/tests/java_lite_proto_library_tests/java_exports/BUILD
Normal file
61
bazel/tests/java_lite_proto_library_tests/java_exports/BUILD
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
load("@rules_java//java:java_library.bzl", "java_library")
|
||||
load("@rules_testing//lib:util.bzl", "PREVENT_IMPLICIT_BUILDING_TAGS")
|
||||
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests:java_lite_proto_library_tests/test_utils.bzl", "java_info_subject_factory")
|
||||
load("//bazel/tests:proto_bzl_test_suite.bzl", "bzl_test_suite")
|
||||
load(":tests.bzl", "TESTS")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_library(
|
||||
name = "exported1",
|
||||
srcs = ["exported1.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "exported2",
|
||||
srcs = ["exported2.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "notexported",
|
||||
srcs = ["notexported.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "top",
|
||||
srcs = ["top.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
exports = [
|
||||
":exported1",
|
||||
":exported2",
|
||||
],
|
||||
deps = [
|
||||
":exported1",
|
||||
":exported2",
|
||||
":notexported",
|
||||
],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "java_proto_lite",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":top"],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "java_lib",
|
||||
srcs = ["Foo.java"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":java_proto_lite"],
|
||||
)
|
||||
|
||||
bzl_test_suite(
|
||||
name = "tests",
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
tests = TESTS,
|
||||
)
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
"""Tests for java_lite_proto_library exports."""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
def _test_java_lib_depends_on_exports(env, target):
|
||||
java_info = env.expect.that_target(target).provider(JavaInfo)
|
||||
java_info.transitive_compile_time_jars_in_package().contains_at_least([
|
||||
"{package}/libtop-lite-hjar.jar",
|
||||
"{package}/libexported1-lite-hjar.jar",
|
||||
"{package}/libexported2-lite-hjar.jar",
|
||||
])
|
||||
|
||||
TESTS = {
|
||||
":java_lib": [_test_java_lib_depends_on_exports],
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
load("@rules_testing//lib:util.bzl", "PREVENT_IMPLICIT_BUILDING_TAGS")
|
||||
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests:java_proto_library_tests/test_utils.bzl", "java_info_subject_factory")
|
||||
load("//bazel/tests:proto_bzl_test_suite.bzl", "bzl_test_suite")
|
||||
load(":tests.bzl", "TESTS")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_library(
|
||||
name = "file_proto",
|
||||
srcs = ["file.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "file_java_proto_lite",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":file_proto"],
|
||||
)
|
||||
|
||||
bzl_test_suite(
|
||||
name = "tests",
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
tests = TESTS,
|
||||
)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
"""Tests tracking Java interop behaviors."""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
def _test_java_protos_exposes_java_provider(env, target):
|
||||
env.expect.that_target(target).has_provider(JavaInfo)
|
||||
|
||||
TESTS = {
|
||||
":file_java_proto_lite": [_test_java_protos_exposes_java_provider],
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
load("@rules_testing//lib:util.bzl", "PREVENT_IMPLICIT_BUILDING_TAGS")
|
||||
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests:java_proto_library_tests/test_utils.bzl", "java_info_subject_factory")
|
||||
load("//bazel/tests:proto_bzl_test_suite.bzl", "bzl_test_suite")
|
||||
load(":tests.bzl", "TESTS")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_library(
|
||||
name = "file_proto",
|
||||
srcs = ["file.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "file_java_proto_lite",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":file_proto"],
|
||||
)
|
||||
|
||||
bzl_test_suite(
|
||||
name = "tests",
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
tests = TESTS,
|
||||
)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
"""Tests tracking Java interop behaviors."""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
def _test_interop(env, target):
|
||||
env.expect.that_target(target).has_provider(JavaInfo)
|
||||
|
||||
TESTS = {
|
||||
":file_java_proto_lite": [_test_interop],
|
||||
}
|
||||
|
|
@ -33,6 +33,10 @@ def _java_info_subject(info, *, meta):
|
|||
_filter_inpackage(self.actual.transitive_source_jars, meta.ctx.label),
|
||||
meta = self.meta.derive("transitive_source_jars_in_package()"),
|
||||
),
|
||||
source_jars = lambda *a, **k: subjects.depset_file(
|
||||
self.actual.source_jars,
|
||||
meta = self.meta.derive("source_jars()"),
|
||||
),
|
||||
transitive_runtime_jars = lambda *a, **k: subjects.depset_file(
|
||||
self.actual.transitive_runtime_jars,
|
||||
meta = self.meta.derive("transitive_runtime_jars()"),
|
||||
|
|
@ -45,6 +49,10 @@ def _java_info_subject(info, *, meta):
|
|||
_filter_inpackage(self.actual.transitive_compile_time_jars, meta.ctx.label),
|
||||
meta = self.meta.derive("transitive_compile_time_jars_in_package()"),
|
||||
),
|
||||
compile_jars = lambda *a, **k: subjects.depset_file(
|
||||
self.actual.compile_jars,
|
||||
meta = self.meta.derive("compile_jars()"),
|
||||
),
|
||||
)
|
||||
return public
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
load("@rules_testing//lib:util.bzl", "PREVENT_IMPLICIT_BUILDING_TAGS")
|
||||
load("//bazel:java_proto_library.bzl", "java_proto_library")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests:java_proto_library_tests/test_utils.bzl", "java_info_subject_factory")
|
||||
load("//bazel/tests:proto_bzl_test_suite.bzl", "bzl_test_suite")
|
||||
load(":tests.bzl", "TESTS")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_library(
|
||||
name = "empty_proto",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "empty_java_proto",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":empty_proto"],
|
||||
)
|
||||
|
||||
bzl_test_suite(
|
||||
name = "tests",
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
tests = TESTS,
|
||||
)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
"""Tests for empty srcs interop."""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
def _test_empty_srcs(env, target):
|
||||
env.expect.that_target(target).has_provider(JavaInfo)
|
||||
|
||||
TESTS = {
|
||||
":empty_java_proto": [_test_empty_srcs],
|
||||
}
|
||||
26
bazel/tests/java_proto_library_tests/interop/BUILD
Normal file
26
bazel/tests/java_proto_library_tests/interop/BUILD
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
load("@rules_testing//lib:util.bzl", "PREVENT_IMPLICIT_BUILDING_TAGS")
|
||||
load("//bazel:java_proto_library.bzl", "java_proto_library")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests:java_proto_library_tests/test_utils.bzl", "java_info_subject_factory")
|
||||
load("//bazel/tests:proto_bzl_test_suite.bzl", "bzl_test_suite")
|
||||
load(":tests.bzl", "TESTS")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_library(
|
||||
name = "file_proto",
|
||||
srcs = ["file.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "file_java_proto",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":file_proto"],
|
||||
)
|
||||
|
||||
bzl_test_suite(
|
||||
name = "tests",
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
tests = TESTS,
|
||||
)
|
||||
10
bazel/tests/java_proto_library_tests/interop/tests.bzl
Normal file
10
bazel/tests/java_proto_library_tests/interop/tests.bzl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"""Tests tracking Java interop behaviors."""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
def _test_interop(env, target):
|
||||
env.expect.that_target(target).has_provider(JavaInfo)
|
||||
|
||||
TESTS = {
|
||||
":file_java_proto": [_test_interop],
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
load("@rules_testing//lib:util.bzl", "PREVENT_IMPLICIT_BUILDING_TAGS")
|
||||
load("//bazel:java_proto_library.bzl", "java_proto_library")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests:java_proto_library_tests/test_utils.bzl", "java_info_subject_factory")
|
||||
load("//bazel/tests:proto_bzl_test_suite.bzl", "bzl_test_suite")
|
||||
load(":tests.bzl", "TESTS")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_library(
|
||||
name = "file_proto",
|
||||
srcs = ["file.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "file_java_proto",
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":file_proto"],
|
||||
)
|
||||
|
||||
bzl_test_suite(
|
||||
name = "tests",
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
tests = TESTS,
|
||||
)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
"""Tests tracking Java interop behaviors."""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
def _test_java_protos_exposes_java_provider(env, target):
|
||||
env.expect.that_target(target).has_provider(JavaInfo)
|
||||
|
||||
TESTS = {
|
||||
":file_java_proto": [_test_java_protos_exposes_java_provider],
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
load("@rules_testing//lib:util.bzl", "PREVENT_IMPLICIT_BUILDING_TAGS")
|
||||
|
||||
# load("//bazel:java_proto_library.bzl", "java_proto_library")s
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests:java_proto_library_tests/test_utils.bzl", "JAVA_PROTO_TESTING_ASPECT", "java_info_subject_factory")
|
||||
load("//bazel/tests:proto_bzl_test_suite.bzl", "bzl_test_suite")
|
||||
load(":tests.bzl", "TESTS")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_library(
|
||||
name = "foo_proto",
|
||||
srcs = ["foo.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "baz_proto",
|
||||
srcs = ["baz.proto"],
|
||||
tags = PREVENT_IMPLICIT_BUILDING_TAGS,
|
||||
deps = [":foo_proto"],
|
||||
)
|
||||
|
||||
bzl_test_suite(
|
||||
name = "tests",
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
testing_aspect = JAVA_PROTO_TESTING_ASPECT,
|
||||
tests = TESTS,
|
||||
)
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
"""Tests for same version compiler arguments."""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
def _test_same_version_compiler_arguments(env, target):
|
||||
genproto = env.expect.that_target(target).action_named("GenProto")
|
||||
genproto.argv().contains("{package}/baz.proto")
|
||||
genproto.argv().contains_at_least([
|
||||
"--java_out={bindir}/{package}/baz_proto-speed-src.jar",
|
||||
"-I.",
|
||||
"{package}/baz.proto",
|
||||
]).in_order()
|
||||
genproto.argv().not_contains("--java_out=shared,immutable:{bindir}/{package}/foo_proto-speed-src.jar")
|
||||
java_info = env.expect.that_target(target).provider(JavaInfo)
|
||||
java_info.transitive_runtime_jars().contains_at_least([
|
||||
"{package}/libbaz_proto-speed.jar",
|
||||
"java/core/libcore.jar",
|
||||
])
|
||||
|
||||
TESTS = {
|
||||
":baz_proto": [_test_same_version_compiler_arguments],
|
||||
}
|
||||
|
|
@ -7,11 +7,13 @@
|
|||
#
|
||||
"""Tests for `proto_common.compile` function."""
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
load("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite")
|
||||
load("@rules_testing//lib:truth.bzl", "matching")
|
||||
load("@rules_testing//lib:util.bzl", "util")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests/testdata:compile_rule.bzl", "compile_rule")
|
||||
load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain")
|
||||
|
||||
protocol_compiler = "/protoc"
|
||||
|
||||
|
|
@ -34,9 +36,18 @@ def proto_common_compile_test_suite(name):
|
|||
_test_compile_additional_inputs,
|
||||
_test_compile_resource_set,
|
||||
_test_compile_protoc_opts,
|
||||
_test_compile_protoc_opts_starlark,
|
||||
_test_compile_direct_generated_protos,
|
||||
_test_compile_indirect_generated_protos,
|
||||
_test_compile_override_progress_message,
|
||||
_test_proto_compiler_flag_override,
|
||||
_test_proto_compiler_native_flag_override,
|
||||
_test_proto_toolchain_for_cc_flag_override,
|
||||
_test_proto_toolchain_for_cc_native_flag_override,
|
||||
_test_proto_toolchain_for_java_flag_override,
|
||||
_test_proto_toolchain_for_java_native_flag_override,
|
||||
_test_proto_toolchain_for_javalite_flag_override,
|
||||
_test_proto_toolchain_for_javalite_native_flag_override,
|
||||
],
|
||||
)
|
||||
|
||||
|
|
@ -291,7 +302,25 @@ def _test_compile_protoc_opts(name):
|
|||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_compile",
|
||||
config_settings = {"//command_line_option:protocopt": ["--foo", "--bar"]},
|
||||
config_settings = {
|
||||
"//command_line_option:protocopt": ["--foo", "--bar"],
|
||||
},
|
||||
impl = _test_compile_protoc_opts_impl,
|
||||
)
|
||||
|
||||
def _test_compile_protoc_opts_starlark(name):
|
||||
util.helper_target(
|
||||
compile_rule,
|
||||
name = name + "_compile",
|
||||
proto_dep = ":simple_proto",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_compile",
|
||||
config_settings = {
|
||||
"@@//bazel/flags:protocopt": ["--foo", "--bar"],
|
||||
},
|
||||
impl = _test_compile_protoc_opts_impl,
|
||||
)
|
||||
|
||||
|
|
@ -393,3 +422,185 @@ def _test_compile_override_progress_message(name):
|
|||
def _test_compile_override_progress_message_impl(env, target):
|
||||
action = env.expect.that_target(target).action_named("MyMnemonic")
|
||||
env.expect.that_str(repr(action.actual)).contains("My custom progress message //")
|
||||
|
||||
def _dummy_compiler_impl(ctx):
|
||||
exe = ctx.actions.declare_file(ctx.label.name)
|
||||
ctx.actions.write(exe, "#!/bin/sh\nexit 0\n", is_executable = True)
|
||||
return [DefaultInfo(executable = exe, files = depset([exe]))]
|
||||
|
||||
_dummy_compiler = rule(
|
||||
implementation = _dummy_compiler_impl,
|
||||
executable = True,
|
||||
)
|
||||
|
||||
def _test_proto_compiler_flag_override(name):
|
||||
util.helper_target(
|
||||
_dummy_compiler,
|
||||
name = name + "_custom_compiler",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = "@//bazel/flags:proto_compiler",
|
||||
impl = _test_proto_compiler_flag_override_impl,
|
||||
config_settings = {
|
||||
"@@//bazel/flags:proto_compiler": "//bazel/tests:" + name + "_custom_compiler",
|
||||
},
|
||||
)
|
||||
|
||||
def _test_proto_compiler_flag_override_impl(env, target):
|
||||
env.expect.that_target(target).has_provider(BuildSettingInfo)
|
||||
val = target[BuildSettingInfo].value
|
||||
env.expect.that_str(str(val)).contains("_custom_compiler")
|
||||
|
||||
def _test_proto_compiler_native_flag_override(name):
|
||||
util.helper_target(
|
||||
_dummy_compiler,
|
||||
name = name + "_custom_compiler_native",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = "@//bazel/flags:proto_compiler",
|
||||
impl = _test_proto_compiler_native_flag_override_impl,
|
||||
config_settings = {
|
||||
"//command_line_option:proto_compiler": str(Label("//bazel/tests:" + name + "_custom_compiler_native")),
|
||||
},
|
||||
)
|
||||
|
||||
def _test_proto_compiler_native_flag_override_impl(env, target):
|
||||
env.expect.that_target(target).has_provider(BuildSettingInfo)
|
||||
val = target[BuildSettingInfo].value
|
||||
env.expect.that_str(str(val)).contains("_custom_compiler_native")
|
||||
|
||||
def _test_proto_toolchain_for_cc_flag_override(name):
|
||||
util.helper_target(
|
||||
proto_lang_toolchain,
|
||||
name = name + "_custom_cc_toolchain",
|
||||
command_line = "$(OUT)",
|
||||
mnemonic = "CustomCcMnemonic",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = "@//bazel/flags/cc:proto_toolchain_for_cc",
|
||||
impl = _test_proto_toolchain_for_cc_flag_override_impl,
|
||||
config_settings = {
|
||||
"@@//bazel/flags/cc:proto_toolchain_for_cc": "//bazel/tests:" + name + "_custom_cc_toolchain",
|
||||
},
|
||||
)
|
||||
|
||||
def _test_proto_toolchain_for_cc_flag_override_impl(env, target):
|
||||
env.expect.that_target(target).has_provider(BuildSettingInfo)
|
||||
val = target[BuildSettingInfo].value
|
||||
env.expect.that_str(str(val)).contains("_custom_cc_toolchain")
|
||||
|
||||
def _test_proto_toolchain_for_cc_native_flag_override(name):
|
||||
util.helper_target(
|
||||
proto_lang_toolchain,
|
||||
name = name + "_custom_cc_toolchain_native",
|
||||
command_line = "$(OUT)",
|
||||
mnemonic = "CustomCcMnemonicNative",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = "@//bazel/flags/cc:proto_toolchain_for_cc",
|
||||
impl = _test_proto_toolchain_for_cc_native_flag_override_impl,
|
||||
config_settings = {
|
||||
"//command_line_option:proto_toolchain_for_cc": str(Label("//bazel/tests:" + name + "_custom_cc_toolchain_native")),
|
||||
},
|
||||
)
|
||||
|
||||
def _test_proto_toolchain_for_cc_native_flag_override_impl(env, target):
|
||||
env.expect.that_target(target).has_provider(BuildSettingInfo)
|
||||
val = target[BuildSettingInfo].value
|
||||
env.expect.that_str(str(val)).contains("_custom_cc_toolchain_native")
|
||||
|
||||
def _test_proto_toolchain_for_java_flag_override(name):
|
||||
util.helper_target(
|
||||
proto_lang_toolchain,
|
||||
name = name + "_custom_java_toolchain",
|
||||
command_line = "$(OUT)",
|
||||
mnemonic = "CustomJavaMnemonic",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = "@//bazel/flags/java:proto_toolchain_for_java",
|
||||
impl = _test_proto_toolchain_for_java_flag_override_impl,
|
||||
config_settings = {
|
||||
"@@//bazel/flags/java:proto_toolchain_for_java": "//bazel/tests:" + name + "_custom_java_toolchain",
|
||||
},
|
||||
)
|
||||
|
||||
def _test_proto_toolchain_for_java_flag_override_impl(env, target):
|
||||
env.expect.that_target(target).has_provider(BuildSettingInfo)
|
||||
val = target[BuildSettingInfo].value
|
||||
env.expect.that_str(str(val)).contains("_custom_java_toolchain")
|
||||
|
||||
def _test_proto_toolchain_for_java_native_flag_override(name):
|
||||
util.helper_target(
|
||||
proto_lang_toolchain,
|
||||
name = name + "_custom_java_toolchain_native",
|
||||
command_line = "$(OUT)",
|
||||
mnemonic = "CustomJavaMnemonicNative",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = "@//bazel/flags/java:proto_toolchain_for_java",
|
||||
impl = _test_proto_toolchain_for_java_native_flag_override_impl,
|
||||
config_settings = {
|
||||
"//command_line_option:proto_toolchain_for_java": str(Label("//bazel/tests:" + name + "_custom_java_toolchain_native")),
|
||||
},
|
||||
)
|
||||
|
||||
def _test_proto_toolchain_for_java_native_flag_override_impl(env, target):
|
||||
env.expect.that_target(target).has_provider(BuildSettingInfo)
|
||||
val = target[BuildSettingInfo].value
|
||||
env.expect.that_str(str(val)).contains("_custom_java_toolchain_native")
|
||||
|
||||
def _test_proto_toolchain_for_javalite_flag_override(name):
|
||||
util.helper_target(
|
||||
proto_lang_toolchain,
|
||||
name = name + "_custom_javalite_toolchain",
|
||||
command_line = "$(OUT)",
|
||||
mnemonic = "CustomJavaLiteMnemonic",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = "@//bazel/flags/java:proto_toolchain_for_javalite",
|
||||
impl = _test_proto_toolchain_for_javalite_flag_override_impl,
|
||||
config_settings = {
|
||||
"@@//bazel/flags/java:proto_toolchain_for_javalite": "//bazel/tests:" + name + "_custom_javalite_toolchain",
|
||||
},
|
||||
)
|
||||
|
||||
def _test_proto_toolchain_for_javalite_flag_override_impl(env, target):
|
||||
env.expect.that_target(target).has_provider(BuildSettingInfo)
|
||||
val = target[BuildSettingInfo].value
|
||||
env.expect.that_str(str(val)).contains("_custom_javalite_toolchain")
|
||||
|
||||
def _test_proto_toolchain_for_javalite_native_flag_override(name):
|
||||
util.helper_target(
|
||||
proto_lang_toolchain,
|
||||
name = name + "_custom_javalite_toolchain_native",
|
||||
command_line = "$(OUT)",
|
||||
mnemonic = "CustomJavaLiteMnemonicNative",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = "@//bazel/flags/java:proto_toolchain_for_javalite",
|
||||
impl = _test_proto_toolchain_for_javalite_native_flag_override_impl,
|
||||
config_settings = {
|
||||
"//command_line_option:proto_toolchain_for_javalite": str(Label("//bazel/tests:" + name + "_custom_javalite_toolchain_native")),
|
||||
},
|
||||
)
|
||||
|
||||
def _test_proto_toolchain_for_javalite_native_flag_override_impl(env, target):
|
||||
env.expect.that_target(target).has_provider(BuildSettingInfo)
|
||||
val = target[BuildSettingInfo].value
|
||||
env.expect.that_str(str(val)).contains("_custom_javalite_toolchain_native")
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ cc_test(
|
|||
"//upb/mini_table",
|
||||
"//upb/reflection",
|
||||
"//upb/reflection:internal",
|
||||
"//upb/reflection:reflection_cc",
|
||||
"//upb/wire",
|
||||
"@abseil-cpp//absl/container:flat_hash_set",
|
||||
"@abseil-cpp//absl/log:absl_check",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ if (echo "$previous_commit_title" | grep -q "^Auto-generate files"); then
|
|||
fi
|
||||
|
||||
export BAZEL=bazelisk
|
||||
export USE_BAZEL_VERSION=8.0.1
|
||||
|
||||
./regenerate_stale_files.sh
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ set(rules_proto-version "7.1.0")
|
|||
set(abseil-cpp-version "20250512.1")
|
||||
set(rules_cc-version "0.2.18")
|
||||
set(zlib-version "1.3.1")
|
||||
set(bazel_features-version "1.33.0")
|
||||
set(bazel_skylib-version "1.9.0")
|
||||
set(jsoncpp-version "1.9.6")
|
||||
set(rules_java-version "8.6.1")
|
||||
|
|
@ -23,7 +22,7 @@ set(rules_jvm_external-version "6.7")
|
|||
set(rules_kotlin-version "2.3.20")
|
||||
set(rules_license-version "1.0.0")
|
||||
set(rules_pkg-version "1.0.1")
|
||||
set(rules_python-version "1.6.0")
|
||||
set(rules_python-version "2.3.0")
|
||||
set(rules_rust-version "0.69.0")
|
||||
set(rules_ruby-version "0.20.1")
|
||||
set(rules_fuzzing-version "0.5.3")
|
||||
|
|
@ -31,14 +30,12 @@ set(rules_shell-version "0.6.1")
|
|||
set(platforms-version "0.0.11")
|
||||
set(re2-version "2024-07-02")
|
||||
set(googletest-version "1.17.0")
|
||||
set(rules_buf-version "0.3.0")
|
||||
set(rules_testing-version "0.9.0")
|
||||
set(abseil-py-version "2.1.0")
|
||||
set(lua-version "5.4.6")
|
||||
set(googleapis-version "0.0.0-20240819-fe8ba054a")
|
||||
set(google_benchmark-version "1.9.2")
|
||||
set(com_google_protobuf_v25-version "25.0")
|
||||
set(com_google_protobuf_previous_release-version "33.0")
|
||||
set(jq.bzl-version "0.6.1")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@ class ModuleFileFunctions(object):
|
|||
def register_toolchains(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def flag_alias(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def use_repo(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -98,15 +98,8 @@ include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
|
|||
set(protobuf_HEADERS
|
||||
${libprotobuf_hdrs}
|
||||
${libprotoc_public_hdrs}
|
||||
${wkt_protos_files}
|
||||
${cpp_file_options_proto_proto_srcs}
|
||||
${json_enumvalue_options_proto_proto_srcs}
|
||||
${cpp_features_proto_proto_srcs}
|
||||
${descriptor_proto_proto_srcs}
|
||||
${plugin_proto_proto_srcs}
|
||||
${c_sharp_features_proto_proto_srcs}
|
||||
${java_features_proto_proto_srcs}
|
||||
${go_features_proto_proto_srcs}
|
||||
${release_all_options_protos_files}
|
||||
)
|
||||
if (protobuf_BUILD_LIBUPB)
|
||||
list(APPEND protobuf_HEADERS ${libupb_hdrs})
|
||||
|
|
@ -115,6 +108,8 @@ if (protobuf_BUILD_LIBUPB)
|
|||
FILES
|
||||
${protobuf_SOURCE_DIR}/upb/reflection/cmake/google/protobuf/descriptor.upb.h
|
||||
${protobuf_SOURCE_DIR}/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.h
|
||||
${protobuf_SOURCE_DIR}/upb/reflection/cmake/google/protobuf/json_enumvalue_options.upb.h
|
||||
${protobuf_SOURCE_DIR}/upb/reflection/cmake/google/protobuf/json_enumvalue_options.upb_minitable.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/google/protobuf
|
||||
COMPONENT protobuf-headers
|
||||
)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ google/protobuf/compiler/php/names.h
|
|||
google/protobuf/compiler/plugin.h
|
||||
google/protobuf/compiler/plugin.pb.h
|
||||
google/protobuf/compiler/plugin.proto
|
||||
google/protobuf/compiler/python/names.h
|
||||
google/protobuf/compiler/retention.h
|
||||
google/protobuf/compiler/scc.h
|
||||
google/protobuf/compiler/subprocess.h
|
||||
|
|
@ -45,6 +46,7 @@ google/protobuf/cpp_features.pb.h
|
|||
google/protobuf/cpp_features.proto
|
||||
google/protobuf/cpp_file_options.pb.h
|
||||
google/protobuf/cpp_file_options.proto
|
||||
google/protobuf/cpp_options.proto
|
||||
google/protobuf/descriptor.h
|
||||
google/protobuf/descriptor.pb.h
|
||||
google/protobuf/descriptor.proto
|
||||
|
|
@ -95,6 +97,9 @@ google/protobuf/java_features.proto
|
|||
google/protobuf/json/json.h
|
||||
google/protobuf/json_enumvalue_options.pb.h
|
||||
google/protobuf/json_enumvalue_options.proto
|
||||
google/protobuf/json_enumvalue_options.upb.h
|
||||
google/protobuf/json_enumvalue_options.upb_minitable.h
|
||||
google/protobuf/json_options.proto
|
||||
google/protobuf/map.h
|
||||
google/protobuf/map_entry.h
|
||||
google/protobuf/map_field.h
|
||||
|
|
@ -107,6 +112,8 @@ google/protobuf/metadata.h
|
|||
google/protobuf/metadata_lite.h
|
||||
google/protobuf/micro_string.h
|
||||
google/protobuf/naming_style.h
|
||||
google/protobuf/offset_ptr.h
|
||||
google/protobuf/option_interpreter.h
|
||||
google/protobuf/os_macros_restore.inc
|
||||
google/protobuf/os_macros_undef.inc
|
||||
google/protobuf/parse_context.h
|
||||
|
|
@ -129,6 +136,7 @@ google/protobuf/serial_arena.h
|
|||
google/protobuf/service.h
|
||||
google/protobuf/source_context.pb.h
|
||||
google/protobuf/source_context.proto
|
||||
google/protobuf/static_message_factory.h
|
||||
google/protobuf/string_block.h
|
||||
google/protobuf/struct.pb.h
|
||||
google/protobuf/struct.proto
|
||||
|
|
@ -206,12 +214,12 @@ upb/mini_table/message.h
|
|||
upb/mini_table/sub.h
|
||||
upb/port/atomic.h
|
||||
upb/port/def.inc
|
||||
upb/port/overflow.h
|
||||
upb/port/sanitizers.h
|
||||
upb/port/undef.inc
|
||||
upb/port/vsnprintf_compat.h
|
||||
upb/reflection/common.h
|
||||
upb/reflection/def.h
|
||||
upb/reflection/def.hpp
|
||||
upb/reflection/def_pool.h
|
||||
upb/reflection/def_type.h
|
||||
upb/reflection/descriptor_bootstrap.h
|
||||
|
|
@ -221,8 +229,8 @@ upb/reflection/enum_value_def.h
|
|||
upb/reflection/extension_range.h
|
||||
upb/reflection/field_def.h
|
||||
upb/reflection/file_def.h
|
||||
upb/reflection/json_enumvalue_options_bootstrap.h
|
||||
upb/reflection/message.h
|
||||
upb/reflection/message.hpp
|
||||
upb/reflection/message_def.h
|
||||
upb/reflection/message_reserved_range.h
|
||||
upb/reflection/method_def.h
|
||||
|
|
@ -239,6 +247,7 @@ upb/wire/decode_fast/combinations.h
|
|||
upb/wire/decode_fast/data.h
|
||||
upb/wire/decode_fast/select.h
|
||||
upb/wire/encode.h
|
||||
upb/wire/encode_extension.h
|
||||
upb/wire/eps_copy_input_stream.h
|
||||
upb/wire/reader.h
|
||||
upb/wire/types.h
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ set(bootstrap_sources
|
|||
${bootstrap_cmake_dir}/google/protobuf/descriptor.upb.h
|
||||
${bootstrap_cmake_dir}/google/protobuf/descriptor.upb_minitable.h
|
||||
${bootstrap_cmake_dir}/google/protobuf/descriptor.upb_minitable.c
|
||||
${bootstrap_cmake_dir}/google/protobuf/json_enumvalue_options.upb.h
|
||||
${bootstrap_cmake_dir}/google/protobuf/json_enumvalue_options.upb_minitable.h
|
||||
${bootstrap_cmake_dir}/google/protobuf/json_enumvalue_options.upb_minitable.c
|
||||
)
|
||||
|
||||
# Note: upb does not support shared library builds, and is intended to be
|
||||
|
|
|
|||
|
|
@ -184,6 +184,8 @@ foreach(Camel
|
|||
Protobuf_LITE_LIBRARY
|
||||
Protobuf_LITE_LIBRARY_DEBUG
|
||||
)
|
||||
string(TOUPPER ${Camel} UPPER)
|
||||
set(${UPPER} ${${Camel}})
|
||||
if(DEFINED ${Camel})
|
||||
string(TOUPPER ${Camel} UPPER)
|
||||
set(${UPPER} ${${Camel}})
|
||||
endif()
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
load("@rules_buf//buf:defs.bzl", "buf_breaking_test")
|
||||
load("@rules_java//java:java_library.bzl", "java_library")
|
||||
|
||||
# Simple build tests for compatibility of gencode from previous major versions
|
||||
|
|
@ -23,122 +22,3 @@ java_library(
|
|||
visibility = ["//java/core:__pkg__"],
|
||||
deps = ["@com_google_protobuf_v25//java/core"],
|
||||
)
|
||||
|
||||
# Breaking change detection for well-known types and descriptor.proto.
|
||||
buf_breaking_test(
|
||||
name = "any_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:any_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:any_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "api_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:api_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:api_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "descriptor_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:descriptor_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:descriptor_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "duration_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:duration_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:duration_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "empty_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:empty_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:empty_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "field_mask_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:field_mask_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:field_mask_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "source_context_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:source_context_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:source_context_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "struct_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:struct_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:struct_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "timestamp_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:timestamp_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:timestamp_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "type_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:type_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:type_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "wrappers_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:wrappers_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:wrappers_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "compiler_plugin_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:compiler_plugin_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:compiler_plugin_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "cpp_features_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:cpp_features_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:cpp_features_proto"],
|
||||
)
|
||||
|
||||
buf_breaking_test(
|
||||
name = "java_features_proto_breaking",
|
||||
against = "@com_google_protobuf_previous_release//:java_features_proto",
|
||||
config = ":buf.yaml",
|
||||
targets = ["//:java_features_proto"],
|
||||
)
|
||||
|
||||
test_suite(
|
||||
name = "proto_breaking",
|
||||
tests = [
|
||||
"any_proto_breaking",
|
||||
"api_proto_breaking",
|
||||
"compiler_plugin_proto_breaking",
|
||||
"cpp_features_proto_breaking",
|
||||
"descriptor_proto_breaking",
|
||||
"duration_proto_breaking",
|
||||
"empty_proto_breaking",
|
||||
"field_mask_proto_breaking",
|
||||
"java_features_proto_breaking",
|
||||
"source_context_proto_breaking",
|
||||
"struct_proto_breaking",
|
||||
"timestamp_proto_breaking",
|
||||
"type_proto_breaking",
|
||||
"wrappers_proto_breaking",
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
version: v1
|
||||
|
|
@ -145,6 +145,7 @@ cc_library(
|
|||
"//src/google/protobuf",
|
||||
"//src/google/protobuf:protobuf_lite",
|
||||
"//src/google/protobuf/json",
|
||||
"//src/google/protobuf/util:differencer",
|
||||
"//src/google/protobuf/util:type_resolver",
|
||||
"@abseil-cpp//absl/log:absl_check",
|
||||
"@abseil-cpp//absl/log:absl_log",
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import com.google.protobuf.AbstractMessage;
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.CodedInputStream;
|
||||
import com.google.protobuf.ExtensionRegistry;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.google.protobuf.Parser;
|
||||
|
|
@ -73,11 +72,8 @@ class ConformanceJava {
|
|||
|
||||
private enum BinaryDecoderType {
|
||||
BYTE_STRING_DECODER,
|
||||
BYTE_ARRAY_DECODER,
|
||||
ARRAY_BYTE_BUFFER_DECODER,
|
||||
READONLY_ARRAY_BYTE_BUFFER_DECODER,
|
||||
DIRECT_BYTE_BUFFER_DECODER,
|
||||
READONLY_DIRECT_BYTE_BUFFER_DECODER,
|
||||
INPUT_STREAM_DECODER;
|
||||
}
|
||||
|
||||
|
|
@ -87,34 +83,20 @@ class ConformanceJava {
|
|||
throws InvalidProtocolBufferException {
|
||||
switch (type) {
|
||||
case BYTE_STRING_DECODER:
|
||||
case BYTE_ARRAY_DECODER:
|
||||
return parser.parseFrom(bytes, extensions);
|
||||
case ARRAY_BYTE_BUFFER_DECODER:
|
||||
{
|
||||
ByteBuffer buffer = ByteBuffer.allocate(bytes.size());
|
||||
bytes.copyTo(buffer);
|
||||
buffer.flip();
|
||||
return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions);
|
||||
}
|
||||
case READONLY_ARRAY_BYTE_BUFFER_DECODER:
|
||||
{
|
||||
return parser.parseFrom(
|
||||
CodedInputStream.newInstance(bytes.asReadOnlyByteBuffer()), extensions);
|
||||
return parser.parseFrom(buffer, extensions);
|
||||
}
|
||||
case DIRECT_BYTE_BUFFER_DECODER:
|
||||
{
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
|
||||
bytes.copyTo(buffer);
|
||||
buffer.flip();
|
||||
return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions);
|
||||
}
|
||||
case READONLY_DIRECT_BYTE_BUFFER_DECODER:
|
||||
{
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
|
||||
bytes.copyTo(buffer);
|
||||
buffer.flip();
|
||||
return parser.parseFrom(
|
||||
CodedInputStream.newInstance(buffer.asReadOnlyBuffer()), extensions);
|
||||
return parser.parseFrom(buffer, extensions);
|
||||
}
|
||||
case INPUT_STREAM_DECODER:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import com.google.protobuf.AbstractMessageLite;
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.CodedInputStream;
|
||||
import com.google.protobuf.ExtensionRegistryLite;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.google.protobuf.MessageLite;
|
||||
|
|
@ -70,11 +69,8 @@ class ConformanceJavaLite {
|
|||
|
||||
private enum BinaryDecoderType {
|
||||
BYTE_STRING_DECODER,
|
||||
BYTE_ARRAY_DECODER,
|
||||
ARRAY_BYTE_BUFFER_DECODER,
|
||||
READONLY_ARRAY_BYTE_BUFFER_DECODER,
|
||||
DIRECT_BYTE_BUFFER_DECODER,
|
||||
READONLY_DIRECT_BYTE_BUFFER_DECODER,
|
||||
INPUT_STREAM_DECODER;
|
||||
}
|
||||
|
||||
|
|
@ -87,34 +83,20 @@ class ConformanceJavaLite {
|
|||
throws InvalidProtocolBufferException {
|
||||
switch (type) {
|
||||
case BYTE_STRING_DECODER:
|
||||
case BYTE_ARRAY_DECODER:
|
||||
return parser.parseFrom(bytes, extensions);
|
||||
case ARRAY_BYTE_BUFFER_DECODER:
|
||||
{
|
||||
ByteBuffer buffer = ByteBuffer.allocate(bytes.size());
|
||||
bytes.copyTo(buffer);
|
||||
buffer.flip();
|
||||
return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions);
|
||||
}
|
||||
case READONLY_ARRAY_BYTE_BUFFER_DECODER:
|
||||
{
|
||||
return parser.parseFrom(
|
||||
CodedInputStream.newInstance(bytes.asReadOnlyByteBuffer()), extensions);
|
||||
return parser.parseFrom(buffer, extensions);
|
||||
}
|
||||
case DIRECT_BYTE_BUFFER_DECODER:
|
||||
{
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
|
||||
bytes.copyTo(buffer);
|
||||
buffer.flip();
|
||||
return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions);
|
||||
}
|
||||
case READONLY_DIRECT_BYTE_BUFFER_DECODER:
|
||||
{
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
|
||||
bytes.copyTo(buffer);
|
||||
buffer.flip();
|
||||
return parser.parseFrom(
|
||||
CodedInputStream.newInstance(buffer.asReadOnlyBuffer()), extensions);
|
||||
return parser.parseFrom(buffer, extensions);
|
||||
}
|
||||
case INPUT_STREAM_DECODER:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "google/protobuf/test_messages_proto3.pb.h"
|
||||
#include "google/protobuf/text_format.h"
|
||||
#include "google/protobuf/unknown_field_set.h"
|
||||
#include "google/protobuf/util/message_differencer.h"
|
||||
#include "google/protobuf/util/type_resolver_util.h"
|
||||
#include "google/protobuf/wire_format_lite.h"
|
||||
|
||||
|
|
@ -498,6 +499,64 @@ void BinaryAndJsonConformanceSuite::RunMessageSetTests() {
|
|||
})pb"
|
||||
// clang-format on
|
||||
);
|
||||
|
||||
// [type_id, value, type_id (different)] -> first type_id and value honored.
|
||||
RunValidBinaryProtobufTest<TestAllTypesProto2>(
|
||||
absl::StrCat("ValidMessageSetEncoding.DuplicateDifferentTypeId"),
|
||||
RECOMMENDED,
|
||||
len(500,
|
||||
group(
|
||||
1,
|
||||
absl::StrCat(
|
||||
field(2, WireFormatLite::WIRETYPE_VARINT, varint(4135312)),
|
||||
len(3, field(9, WireFormatLite::WIRETYPE_VARINT, varint(99))),
|
||||
field(2, WireFormatLite::WIRETYPE_VARINT, varint(1547769))))),
|
||||
// clang-format off
|
||||
R"pb(message_set_correct: {
|
||||
[protobuf_test_messages.proto2
|
||||
.TestAllTypesProto2.MessageSetCorrectExtension2]: { i: 99 }
|
||||
})pb"
|
||||
// clang-format on
|
||||
);
|
||||
|
||||
// [type_id, value, value] -> first value honored, no merge.
|
||||
RunValidBinaryProtobufTest<TestAllTypesProto2>(
|
||||
absl::StrCat("ValidMessageSetEncoding.DuplicateValue"), RECOMMENDED,
|
||||
len(500,
|
||||
group(
|
||||
1,
|
||||
absl::StrCat(
|
||||
field(2, WireFormatLite::WIRETYPE_VARINT, varint(4135312)),
|
||||
len(3, field(9, WireFormatLite::WIRETYPE_VARINT, varint(99))),
|
||||
len(3,
|
||||
field(9, WireFormatLite::WIRETYPE_VARINT, varint(88)))))),
|
||||
// clang-format off
|
||||
R"pb(message_set_correct: {
|
||||
[protobuf_test_messages.proto2
|
||||
.TestAllTypesProto2.MessageSetCorrectExtension2]: { i: 99 }
|
||||
})pb"
|
||||
// clang-format on
|
||||
);
|
||||
|
||||
// [value, type_id, value] -> first value honored, no merge.
|
||||
RunValidBinaryProtobufTest<TestAllTypesProto2>(
|
||||
absl::StrCat("ValidMessageSetEncoding.DuplicateValueOutOfOrder"),
|
||||
RECOMMENDED,
|
||||
len(500,
|
||||
group(
|
||||
1,
|
||||
absl::StrCat(
|
||||
len(3, field(9, WireFormatLite::WIRETYPE_VARINT, varint(99))),
|
||||
field(2, WireFormatLite::WIRETYPE_VARINT, varint(4135312)),
|
||||
len(3,
|
||||
field(9, WireFormatLite::WIRETYPE_VARINT, varint(88)))))),
|
||||
// clang-format off
|
||||
R"pb(message_set_correct: {
|
||||
[protobuf_test_messages.proto2
|
||||
.TestAllTypesProto2.MessageSetCorrectExtension2]: { i: 99 }
|
||||
})pb"
|
||||
// clang-format on
|
||||
);
|
||||
}
|
||||
|
||||
void BinaryAndJsonConformanceSuite::RunRecursionLimitTests() {
|
||||
|
|
@ -844,6 +903,66 @@ void BinaryAndJsonConformanceSuiteImpl<MessageType>::ExpectParseFailureForJson(
|
|||
}
|
||||
}
|
||||
|
||||
template <typename MessageType>
|
||||
void BinaryAndJsonConformanceSuiteImpl<MessageType>::
|
||||
RunValidJsonTestOrParseFailure(const std::string& test_name,
|
||||
ConformanceLevel level,
|
||||
const std::string& input_json,
|
||||
const std::string& equivalent_text_format) {
|
||||
MessageType prototype;
|
||||
ConformanceRequestSetting setting(
|
||||
level, ::conformance::JSON, ::conformance::PROTOBUF,
|
||||
::conformance::JSON_TEST, prototype, test_name, input_json);
|
||||
const ConformanceRequest& request = setting.GetRequest();
|
||||
ConformanceResponse response;
|
||||
std::string effective_test_name =
|
||||
absl::StrCat(setting.ConformanceLevelToString(level), ".",
|
||||
SyntaxIdentifier(), ".JsonInput.", test_name);
|
||||
|
||||
if (!suite_.RunTest(effective_test_name, request, &response)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TestStatus test;
|
||||
test.set_name(effective_test_name);
|
||||
if (response.result_case() == ConformanceResponse::kParseError) {
|
||||
suite_.ReportSuccess(test);
|
||||
} else if (response.result_case() == ConformanceResponse::kSkipped) {
|
||||
suite_.ReportSkip(test, request, response);
|
||||
} else {
|
||||
std::unique_ptr<Message> reference_message(setting.NewTestMessage());
|
||||
ABSL_CHECK(TextFormat::ParseFromString(equivalent_text_format,
|
||||
reference_message.get()))
|
||||
<< "Failed to parse data for test case: " << setting.GetTestName()
|
||||
<< ", data: " << equivalent_text_format;
|
||||
std::unique_ptr<Message> test_message(setting.NewTestMessage());
|
||||
bool parsed = false;
|
||||
if (response.result_case() == ConformanceResponse::kProtobufPayload) {
|
||||
parsed = test_message->ParseFromString(response.protobuf_payload());
|
||||
}
|
||||
if (!parsed) {
|
||||
test.set_failure_message("Malformed protobuf response");
|
||||
suite_.ReportFailure(test, level, request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
util::MessageDifferencer differencer;
|
||||
util::DefaultFieldComparator field_comparator;
|
||||
field_comparator.set_treat_nan_as_equal(true);
|
||||
differencer.set_field_comparator(&field_comparator);
|
||||
std::string differences;
|
||||
differencer.ReportDifferencesToString(&differences);
|
||||
if (differencer.Compare(*reference_message, *test_message)) {
|
||||
suite_.ReportSuccess(test);
|
||||
} else {
|
||||
test.set_failure_message(
|
||||
"Should have failed to parse or matched expected output but did "
|
||||
"not.");
|
||||
suite_.ReportFailure(test, level, request, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename MessageType>
|
||||
void BinaryAndJsonConformanceSuiteImpl<MessageType>::
|
||||
ExpectSerializeFailureForJson(const std::string& test_name,
|
||||
|
|
@ -2369,22 +2488,27 @@ void BinaryAndJsonConformanceSuiteImpl<
|
|||
ExpectParseFailureForJson(
|
||||
"MissingCommaMultiline", RECOMMENDED,
|
||||
"{\n \"optionalInt32\": 1\n \"optionalInt64\": 2\n}");
|
||||
// Duplicated field names are not allowed.
|
||||
ExpectParseFailureForJson("FieldNameDuplicate", RECOMMENDED,
|
||||
R"({
|
||||
"optionalNestedMessage": {"a": 1},
|
||||
"optionalNestedMessage": {}
|
||||
})");
|
||||
ExpectParseFailureForJson("FieldNameDuplicateDifferentCasing1", RECOMMENDED,
|
||||
R"({
|
||||
"optional_nested_message": {"a": 1},
|
||||
"optionalNestedMessage": {}
|
||||
})");
|
||||
ExpectParseFailureForJson("FieldNameDuplicateDifferentCasing2", RECOMMENDED,
|
||||
R"({
|
||||
"optionalNestedMessage": {"a": 1},
|
||||
"optional_nested_message": {}
|
||||
})");
|
||||
// Duplicated field names have either last-wins or parse failure.
|
||||
RunValidJsonTestOrParseFailure("FieldNameDuplicate", RECOMMENDED,
|
||||
R"({
|
||||
"optionalNestedMessage": {"a": 1},
|
||||
"optionalNestedMessage": {}
|
||||
})",
|
||||
"optional_nested_message: {}");
|
||||
RunValidJsonTestOrParseFailure("FieldNameDuplicateDifferentCasing1",
|
||||
RECOMMENDED,
|
||||
R"({
|
||||
"optional_nested_message": {"a": 1},
|
||||
"optionalNestedMessage": {}
|
||||
})",
|
||||
"optional_nested_message: {}");
|
||||
RunValidJsonTestOrParseFailure("FieldNameDuplicateDifferentCasing2",
|
||||
RECOMMENDED,
|
||||
R"({
|
||||
"optionalNestedMessage": {"a": 1},
|
||||
"optional_nested_message": {}
|
||||
})",
|
||||
"optional_nested_message: {}");
|
||||
// Serializers should use lowerCamelCase by default.
|
||||
RunValidJsonTestWithValidator("FieldNameInLowerCamelCase", REQUIRED,
|
||||
R"({
|
||||
|
|
@ -2525,6 +2649,12 @@ void BinaryAndJsonConformanceSuiteImpl<
|
|||
ExpectParseFailureForJson("Uint64FieldNotInteger", REQUIRED,
|
||||
R"({"optionalUint64": "0.5"})");
|
||||
|
||||
// Parser reject boolean values for integer fields.
|
||||
ExpectParseFailureForJson("Int32FieldTrueValue", REQUIRED,
|
||||
R"({"optionalInt32": true})");
|
||||
ExpectParseFailureForJson("Int32FieldFalseValue", REQUIRED,
|
||||
R"({"optionalInt32": false})");
|
||||
|
||||
// Parser reject non-numeric string values.
|
||||
ExpectParseFailureForJson("Int32FieldStringValuePartiallyNumeric", REQUIRED,
|
||||
R"({"optionalInt32": "12abc"})");
|
||||
|
|
@ -2696,6 +2826,12 @@ void BinaryAndJsonConformanceSuiteImpl<
|
|||
ExpectParseFailureForJson("FloatFieldStringValuePartiallyNumericUnicode",
|
||||
REQUIRED, R"({"optionalFloat": "12谷歌34"})");
|
||||
|
||||
// Parser reject boolean values for float fields.
|
||||
ExpectParseFailureForJson("FloatFieldTrueValue", REQUIRED,
|
||||
R"({"optionalFloat": true})");
|
||||
ExpectParseFailureForJson("FloatFieldFalseValue", REQUIRED,
|
||||
R"({"optionalFloat": false})");
|
||||
|
||||
// Double fields.
|
||||
RunValidJsonTest("DoubleFieldMinPositiveValue", REQUIRED,
|
||||
R"({"optionalDouble": 2.22507e-308})",
|
||||
|
|
@ -2761,6 +2897,12 @@ void BinaryAndJsonConformanceSuiteImpl<
|
|||
ExpectParseFailureForJson("DoubleFieldStringValueNonNumeric", REQUIRED,
|
||||
R"({"optionalDouble": "abc"})");
|
||||
|
||||
// Parser reject boolean values for double fields.
|
||||
ExpectParseFailureForJson("DoubleFieldTrueValue", REQUIRED,
|
||||
R"({"optionalDouble": true})");
|
||||
ExpectParseFailureForJson("DoubleFieldFalseValue", REQUIRED,
|
||||
R"({"optionalDouble": false})");
|
||||
|
||||
// Enum fields.
|
||||
RunValidJsonTest("EnumField", REQUIRED, R"({"optionalNestedEnum": "FOO"})",
|
||||
"optional_nested_enum: FOO");
|
||||
|
|
@ -2789,6 +2931,17 @@ void BinaryAndJsonConformanceSuiteImpl<
|
|||
R"({"optionalNestedEnum": 0})", "optional_nested_enum: FOO");
|
||||
RunValidJsonTest("EnumFieldNumericValueNonZero", REQUIRED,
|
||||
R"({"optionalNestedEnum": 1})", "optional_nested_enum: BAR");
|
||||
// Arrays are not allowed for non-repeated enum fields.
|
||||
ExpectParseFailureForJson("EnumFieldSingleElementArrayEnumName", REQUIRED,
|
||||
R"({"optionalNestedEnum": ["FOO"]})");
|
||||
ExpectParseFailureForJson("EnumFieldSingleElementArrayNumericValue", REQUIRED,
|
||||
R"({"optionalNestedEnum": [2]})");
|
||||
|
||||
// Booleans are not allowed for enum fields.
|
||||
ExpectParseFailureForJson("EnumFieldTrueValue", REQUIRED,
|
||||
R"({"optionalNestedEnum": true})");
|
||||
ExpectParseFailureForJson("EnumFieldFalseValue", REQUIRED,
|
||||
R"({"optionalNestedEnum": false})");
|
||||
|
||||
if (run_proto3_tests_) {
|
||||
// Unknown enum values are represented as numeric values.
|
||||
|
|
@ -2854,8 +3007,12 @@ void BinaryAndJsonConformanceSuiteImpl<
|
|||
"optional_nested_message: {a: 1234}");
|
||||
|
||||
// Oneof fields.
|
||||
ExpectParseFailureForJson("OneofFieldDuplicate", REQUIRED,
|
||||
R"({"oneofUint32": 1, "oneofString": "test"})");
|
||||
RunValidJsonTestOrParseFailure("OneofFieldDuplicate", REQUIRED,
|
||||
R"({"oneofUint32": 1, "oneofString": "test"})",
|
||||
"oneof_string: \"test\"");
|
||||
RunValidJsonTestOrParseFailure("OneofFieldDuplicate2", REQUIRED,
|
||||
R"({"oneofString": "test", "oneofUint32": 1})",
|
||||
"oneof_uint32: 1");
|
||||
RunValidJsonTest("OneofFieldNullFirst", REQUIRED,
|
||||
R"({"oneofUint32": null, "oneofString": "test"})",
|
||||
"oneof_string: \"test\"");
|
||||
|
|
@ -3376,6 +3533,71 @@ void BinaryAndJsonConformanceSuiteImpl<
|
|||
return value["optionalTimestamp"].asString() ==
|
||||
"1970-01-01T00:00:00.000000010Z";
|
||||
});
|
||||
|
||||
// Out of bounds / invalid components should JSON parse fail
|
||||
ExpectParseFailureForJson("TimestampJsonInputMonthTooLarge", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-13-01T00:00:00Z"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputMonthZero", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-00-01T00:00:00Z"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputDayTooLarge", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-32T00:00:00Z"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputDayZero", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-00T00:00:00Z"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputHourTooLarge", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-01T24:00:00Z"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputHourTooLarge25", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-01T25:00:00Z"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputMinuteTooLarge", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-01T00:60:00Z"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputSecondTooLarge", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-01T00:00:60Z"})");
|
||||
ExpectParseFailureForJson(
|
||||
"TimestampJsonInputInvalidOffsetHour", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-01T00:00:00+24:00"})");
|
||||
ExpectParseFailureForJson(
|
||||
"TimestampJsonInputInvalidOffsetMinute", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-01T00:00:00+00:60"})");
|
||||
ExpectParseFailureForJson(
|
||||
"TimestampJsonInputOffsetBoundaryUnderflow", REQUIRED,
|
||||
R"({"optionalTimestamp": "0001-01-01T00:00:00+00:01"})");
|
||||
ExpectParseFailureForJson(
|
||||
"TimestampJsonInputOffsetBoundaryOverflow", REQUIRED,
|
||||
R"({"optionalTimestamp": "9999-12-31T23:59:59-00:01"})");
|
||||
ExpectParseFailureForJson(
|
||||
"TimestampJsonInputInvalidNanos", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-01T00:00:00.1234567890Z"})");
|
||||
ExpectParseFailureForJson(
|
||||
"TimestampJsonInputInvalidCharsInNanos", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-01T00:00:00.123aZ"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputYearTooShort", REQUIRED,
|
||||
R"({"optionalTimestamp": "999-01-01T00:00:00Z"})");
|
||||
ExpectParseFailureForJson(
|
||||
"TimestampJsonInputYearTooLong", REQUIRED,
|
||||
R"({"optionalTimestamp": "00001-01-01T00:00:00Z"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputMonthTooShort", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-1-01T00:00:00Z"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputDayTooShort", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-1T00:00:00Z"})");
|
||||
ExpectParseFailureForJson("TimestampJsonInputNonLeapFeb29", REQUIRED,
|
||||
R"({"optionalTimestamp": "2001-02-29T00:00:00Z"})");
|
||||
|
||||
// Honoring time zones correctly
|
||||
RunValidJsonTest("TimestampJsonInputLeapFeb29", REQUIRED,
|
||||
R"({"optionalTimestamp": "2000-02-29T00:00:00Z"})",
|
||||
"optional_timestamp: {seconds: 951782400}");
|
||||
RunValidJsonTest("TimestampWithOffsetShiftsDay", REQUIRED,
|
||||
|
||||
R"({"optionalTimestamp": "1970-01-02T01:00:00+02:00"})",
|
||||
"optional_timestamp: {seconds: 82800}");
|
||||
RunValidJsonTest("TimestampWithOffsetBoundaryInBoundsMin", REQUIRED,
|
||||
R"({"optionalTimestamp": "0001-01-01T00:00:00-00:01"})",
|
||||
"optional_timestamp: {seconds: -62135596740}");
|
||||
RunValidJsonTest("TimestampWithOffsetBoundaryInBoundsMax", REQUIRED,
|
||||
R"({"optionalTimestamp": "9999-12-31T23:59:59+00:01"})",
|
||||
"optional_timestamp: {seconds: 253402300739}");
|
||||
RunValidJsonTest("TimestampWithComplexOffset", REQUIRED,
|
||||
R"({"optionalTimestamp": "1970-01-01T00:00:00-11:30"})",
|
||||
"optional_timestamp: {seconds: 41400}");
|
||||
}
|
||||
|
||||
template <typename MessageType>
|
||||
|
|
|
|||
|
|
@ -147,6 +147,9 @@ class BinaryAndJsonConformanceSuiteImpl {
|
|||
void ExpectParseFailureForJson(const std::string& test_name,
|
||||
ConformanceLevel level,
|
||||
const std::string& input_json);
|
||||
void RunValidJsonTestOrParseFailure(
|
||||
const std::string& test_name, ConformanceLevel level,
|
||||
const std::string& input_json, const std::string& equivalent_text_format);
|
||||
void ExpectSerializeFailureForJson(const std::string& test_name,
|
||||
ConformanceLevel level,
|
||||
const std::string& text_format);
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
Recommended.*.JsonInput.BoolFieldDoubleQuotedFalse # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.BoolFieldDoubleQuotedTrue # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameNotQuoted # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.MapFieldValueIsNull # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.RepeatedFieldMessageElementIsNull # Should have failed to parse, but didn't.
|
||||
|
|
@ -34,6 +34,17 @@ Recommended.*.FieldMaskTooManyUnderscore.JsonOutput
|
|||
Recommended.*.JsonInput.FieldMaskInvalidCharacter # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.SingleValueForRepeatedFieldInt32 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.SingleValueForRepeatedFieldMessage # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge25 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetHour # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetMinute # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMinuteTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputNonLeapFeb29 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputOffsetBoundaryOverflow # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputOffsetBoundaryUnderflow # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputSecondTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_FieldNumberSlightlyTooHigh # Should have failed to parse, but didn't.
|
||||
# TODO: Uncomment once conformance tests can express failures that are not expected to be fixed.
|
||||
# Recommended.Editions_Proto2.ProtobufInput.RejectInvalidUtf8.String.MapKey # Should have failed to parse, but didn't.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse, but didn't.
|
||||
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
|
||||
Recommended.Proto2.JsonInput.BytesFieldBase64Url.JsonOutput
|
||||
Recommended.Proto2.JsonInput.BytesFieldBase64Url.ProtobufOutput
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ Recommended.*.JsonInput.BoolMapFieldKeyNotQuoted
|
|||
Recommended.*.JsonInput.DoubleFieldInfinityNotQuoted # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.DoubleFieldNanNotQuoted # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.DoubleFieldNegativeInfinityNotQuoted # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameExtension.Validator # Expected JSON payload but got type 1
|
||||
Recommended.*.JsonInput.FieldNameNotQuoted # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FloatFieldInfinityNotQuoted # Should have failed to parse, but didn't.
|
||||
|
|
@ -36,12 +35,30 @@ Recommended.*.FieldMaskPathsDontRoundTrip.JsonOutput
|
|||
Recommended.*.FieldMaskTooManyUnderscore.JsonOutput # Should have failed to serialize, but didn't.
|
||||
Recommended.*.JsonInput.FieldMaskInvalidCharacter # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.EnumFieldNotQuoted # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.EnumFieldSingleElementArrayEnumName # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.EnumFieldSingleElementArrayNumericValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.Int32FieldLeadingZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.Int32FieldNegativeWithLeadingZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.Int32FieldPlusSign # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.StringFieldNotAString # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge25 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidNanos # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetHour # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetMinute # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMinuteTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputNonLeapFeb29 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputSecondTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputYearTooLong # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputYearTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.UnknownOrdering.ProtobufOutput # Unknown field mismatch
|
||||
Required.*.ProtobufInput.BadTag_FieldNumberTooHigh # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_FieldNumberSlightlyTooHigh # Should have failed to parse, but didn't.
|
||||
|
|
@ -53,3 +70,6 @@ Required.*.ProtobufInput.BadTag_OverlongVarint
|
|||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Oneof # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Repeated # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Singular # Should have failed to parse, but didn't.
|
||||
Recommended.Proto2.ProtobufInput.ValidMessageSetEncoding.DuplicateDifferentTypeId.ProtobufOutput # Output was not equivalent to reference message
|
||||
Recommended.Proto2.ProtobufInput.ValidMessageSetEncoding.DuplicateValue.ProtobufOutput # Output was not equivalent to reference message
|
||||
Recommended.Proto2.ProtobufInput.ValidMessageSetEncoding.DuplicateValueOutOfOrder.ProtobufOutput # Output was not equivalent to reference message
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
# By listing them here we can keep tabs on which ones are failing and be sure
|
||||
# that we don't introduce regressions in other tests.
|
||||
|
||||
Required.*.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_FieldNumberTooHigh # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_FieldNumberSlightlyTooHigh # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_OverlongVarint # Should have failed to parse, but didn't.
|
||||
|
|
@ -17,3 +15,4 @@ Recommended.Editions.ProtobufInput.RejectInvalidUtf8.String.Extension
|
|||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Oneof # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Repeated # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Singular # Should have failed to parse, but didn't.
|
||||
Recommended.Proto2.ProtobufInput.ValidMessageSetEncoding.DuplicateValue.ProtobufOutput # Output was not equivalent to reference message
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ Recommended.Proto2.JsonInput.BoolMapFieldKeyNotQuoted
|
|||
Recommended.Proto2.JsonInput.DoubleFieldInfinityNotQuoted
|
||||
Recommended.Proto2.JsonInput.DoubleFieldNanNotQuoted
|
||||
Recommended.Proto2.JsonInput.DoubleFieldNegativeInfinityNotQuoted
|
||||
Recommended.Proto2.JsonInput.FieldNameDuplicate
|
||||
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
|
||||
Recommended.Proto2.JsonInput.FieldNameNotQuoted
|
||||
Recommended.Proto2.JsonInput.FloatFieldInfinityNotQuoted
|
||||
|
|
@ -39,7 +38,6 @@ Recommended.Proto3.JsonInput.DoubleFieldInfinityNotQuoted
|
|||
Recommended.Proto3.JsonInput.DoubleFieldNanNotQuoted
|
||||
Recommended.Proto3.JsonInput.DoubleFieldNegativeInfinityNotQuoted
|
||||
Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
|
||||
Recommended.Proto3.JsonInput.FieldNameDuplicate
|
||||
Recommended.Proto3.JsonInput.FieldNameNotQuoted
|
||||
Recommended.Proto3.JsonInput.FloatFieldInfinityNotQuoted
|
||||
Recommended.Proto3.JsonInput.FloatFieldNanNotQuoted
|
||||
|
|
@ -56,6 +54,8 @@ Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate
|
|||
Recommended.Proto3.JsonInput.Uint32MapFieldKeyNotQuoted
|
||||
Recommended.Proto3.JsonInput.Uint64MapFieldKeyNotQuoted
|
||||
Required.Proto2.JsonInput.EnumFieldNotQuoted
|
||||
Required.Proto2.JsonInput.EnumFieldSingleElementArrayEnumName
|
||||
Required.Proto2.JsonInput.EnumFieldSingleElementArrayNumericValue
|
||||
Required.Proto2.JsonInput.Int32FieldLeadingZero
|
||||
Required.Proto2.JsonInput.Int32FieldNegativeWithLeadingZero
|
||||
Required.Proto2.JsonInput.Int32FieldPlusSign
|
||||
|
|
@ -63,6 +63,8 @@ Required.Proto2.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool
|
|||
Required.Proto2.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
|
||||
Required.Proto2.JsonInput.StringFieldNotAString
|
||||
Required.Proto3.JsonInput.EnumFieldNotQuoted
|
||||
Required.Proto3.JsonInput.EnumFieldSingleElementArrayEnumName
|
||||
Required.Proto3.JsonInput.EnumFieldSingleElementArrayNumericValue
|
||||
Required.Proto3.JsonInput.Int32FieldLeadingZero
|
||||
Required.Proto3.JsonInput.Int32FieldNegativeWithLeadingZero
|
||||
Required.Proto3.JsonInput.Int32FieldPlusSign
|
||||
|
|
@ -82,7 +84,6 @@ Recommended.Editions_Proto2.JsonInput.BoolMapFieldKeyNotQuoted
|
|||
Recommended.Editions_Proto2.JsonInput.DoubleFieldInfinityNotQuoted
|
||||
Recommended.Editions_Proto2.JsonInput.DoubleFieldNanNotQuoted
|
||||
Recommended.Editions_Proto2.JsonInput.DoubleFieldNegativeInfinityNotQuoted
|
||||
Recommended.Editions_Proto2.JsonInput.FieldNameDuplicate
|
||||
Recommended.Editions_Proto2.JsonInput.FieldNameExtension.Validator
|
||||
Recommended.Editions_Proto2.JsonInput.FieldNameNotQuoted
|
||||
Recommended.Editions_Proto2.JsonInput.FloatFieldInfinityNotQuoted
|
||||
|
|
@ -110,7 +111,6 @@ Recommended.Editions_Proto3.JsonInput.DoubleFieldInfinityNotQuoted
|
|||
Recommended.Editions_Proto3.JsonInput.DoubleFieldNanNotQuoted
|
||||
Recommended.Editions_Proto3.JsonInput.DoubleFieldNegativeInfinityNotQuoted
|
||||
Recommended.Editions_Proto3.JsonInput.FieldMaskInvalidCharacter
|
||||
Recommended.Editions_Proto3.JsonInput.FieldNameDuplicate
|
||||
Recommended.Editions_Proto3.JsonInput.FieldNameNotQuoted
|
||||
Recommended.Editions_Proto3.JsonInput.FloatFieldInfinityNotQuoted
|
||||
Recommended.Editions_Proto3.JsonInput.FloatFieldNanNotQuoted
|
||||
|
|
@ -127,6 +127,8 @@ Recommended.Editions_Proto3.JsonInput.StringFieldUnpairedLowSurrogate
|
|||
Recommended.Editions_Proto3.JsonInput.Uint32MapFieldKeyNotQuoted
|
||||
Recommended.Editions_Proto3.JsonInput.Uint64MapFieldKeyNotQuoted
|
||||
Required.Editions_Proto2.JsonInput.EnumFieldNotQuoted
|
||||
Required.Editions_Proto2.JsonInput.EnumFieldSingleElementArrayEnumName
|
||||
Required.Editions_Proto2.JsonInput.EnumFieldSingleElementArrayNumericValue
|
||||
Required.Editions_Proto2.JsonInput.Int32FieldLeadingZero
|
||||
Required.Editions_Proto2.JsonInput.Int32FieldNegativeWithLeadingZero
|
||||
Required.Editions_Proto2.JsonInput.Int32FieldPlusSign
|
||||
|
|
@ -134,6 +136,8 @@ Required.Editions_Proto2.JsonInput.RepeatedFieldWrongElementTypeExpectingStrings
|
|||
Required.Editions_Proto2.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
|
||||
Required.Editions_Proto2.JsonInput.StringFieldNotAString
|
||||
Required.Editions_Proto3.JsonInput.EnumFieldNotQuoted
|
||||
Required.Editions_Proto3.JsonInput.EnumFieldSingleElementArrayEnumName
|
||||
Required.Editions_Proto3.JsonInput.EnumFieldSingleElementArrayNumericValue
|
||||
Required.Editions_Proto3.JsonInput.Int32FieldLeadingZero
|
||||
Required.Editions_Proto3.JsonInput.Int32FieldNegativeWithLeadingZero
|
||||
Required.Editions_Proto3.JsonInput.Int32FieldPlusSign
|
||||
|
|
@ -154,3 +158,23 @@ Required.*.ProtobufInput.BadTag_OverlongVarint
|
|||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Oneof # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Repeated # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Singular # Should have failed to parse, but didn't.
|
||||
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge25 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidNanos # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetHour # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetMinute # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMinuteTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputNonLeapFeb29 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputSecondTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputYearTooLong # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputYearTooShort # Should have failed to parse, but didn't.
|
||||
Recommended.Proto2.ProtobufInput.ValidMessageSetEncoding.DuplicateDifferentTypeId.ProtobufOutput # Output was not equivalent to reference message
|
||||
Recommended.Proto2.ProtobufInput.ValidMessageSetEncoding.DuplicateValue.ProtobufOutput # Output was not equivalent to reference message
|
||||
Recommended.Proto2.ProtobufInput.ValidMessageSetEncoding.DuplicateValueOutOfOrder.ProtobufOutput # Output was not equivalent to reference message
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse or matched expected output but did not.
|
||||
Required.*.JsonInput.Int32FieldQuotedExponentialValue.* # Failed to parse input or produce output.
|
||||
Required.*.JsonInput.AnyWithNoType.* # Failed to parse input or produce output.
|
||||
# TODO: Uncomment once conformance tests can express failures that are not expected to be fixed.
|
||||
|
|
@ -14,3 +14,16 @@ Required.*.JsonInput.AnyWithNoType.* # Fa
|
|||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Oneof # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Repeated # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Singular # Should have failed to parse, but didn't.
|
||||
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge25 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetHour # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetMinute # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMinuteTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputNonLeapFeb29 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputOffsetBoundaryOverflow # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputSecondTooLarge # Should have failed to parse, but didn't.
|
||||
|
|
|
|||
|
|
@ -3,4 +3,3 @@
|
|||
#
|
||||
# By listing them here we can keep tabs on which ones are failing and be sure
|
||||
# that we don't introduce regressions in other tests.
|
||||
Recommended.Proto2.ProtobufInput.EnforceDepthLimit.MessageSetExtension # Should have failed to parse, but didn't.
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@ Recommended.*.FieldMaskTooManyUnderscore.JsonOutput
|
|||
Recommended.*.JsonInput.BytesFieldBase64Url.JsonOutput
|
||||
Recommended.*.JsonInput.BytesFieldBase64Url.ProtobufOutput
|
||||
Recommended.*.JsonInput.FieldMaskInvalidCharacter
|
||||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput
|
||||
Recommended.*.ValueRejectInfNumberValue.JsonOutput # Should have failed to serialize, but didn't.
|
||||
Recommended.*.ValueRejectNanNumberValue.JsonOutput # Should have failed to serialize, but didn't.
|
||||
|
|
@ -17,7 +16,6 @@ Required.*.JsonInput.FloatFieldTooLarge
|
|||
Required.*.JsonInput.FloatFieldTooSmall
|
||||
Required.*.JsonInput.Int32FieldNotInteger
|
||||
Required.*.JsonInput.Int64FieldNotInteger
|
||||
Required.*.JsonInput.OneofFieldDuplicate
|
||||
Required.*.JsonInput.OneofFieldNullSecond.JsonOutput
|
||||
Required.*.JsonInput.OneofFieldNullSecond.ProtobufOutput
|
||||
Required.*.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
|
||||
|
|
@ -52,3 +50,23 @@ Required.*.ProtobufInput.BadTag_FieldNumberTooHigh
|
|||
Required.*.ProtobufInput.BadTag_FieldNumberSlightlyTooHigh # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_OverlongVarint # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_VarintMoreThanTenBytes # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.DoubleFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.DoubleFieldTrueValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.FloatFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.FloatFieldTrueValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge25 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetHour # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetMinute # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMinuteTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputNonLeapFeb29 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputOffsetBoundaryOverflow # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputOffsetBoundaryUnderflow # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputSecondTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputYearTooShort # Should have failed to parse, but didn't.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
|
||||
Required.*.JsonInput.Int32FieldQuotedExponentialValue.* # Failed to parse input or produce output.
|
||||
Required.Proto2.JsonInput.BoolFieldFalse.JsonOutput
|
||||
|
|
@ -11,3 +11,15 @@ Required.Proto2.JsonInput.EnumFieldNumericValueZero.JsonOutput
|
|||
Required.Proto2.JsonInput.EnumFieldNumericValueZero.ProtobufOutput
|
||||
Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator
|
||||
Required.*.JsonInput.AnyWithNoType.*
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge25 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetHour # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetMinute # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMinuteTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputNonLeapFeb29 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputOffsetBoundaryOverflow # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputSecondTooLarge # Should have failed to parse, but didn't.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,15 @@
|
|||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse or matched expected output but did not.
|
||||
Required.*.JsonInput.DoubleFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.DoubleFieldTrueValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.EnumFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.EnumFieldTrueValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.FloatFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.FloatFieldTrueValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetHour # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetMinute # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_FieldNumberTooHigh # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_FieldNumberSlightlyTooHigh # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_OverlongVarint # Should have failed to parse, but didn't.
|
||||
|
|
|
|||
|
|
@ -7,8 +7,18 @@
|
|||
# TODO: insert links to corresponding bugs tracking the issue.
|
||||
# Should we use GitHub issues or the Google-internal bug tracker?
|
||||
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse or matched expected output but did not.
|
||||
Required.*.JsonInput.DoubleFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.DoubleFieldTrueValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.EnumFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.EnumFieldTrueValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.FloatFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.FloatFieldTrueValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetHour # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetMinute # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.ProtobufInput.BadTag_FieldNumberSlightlyTooHigh # Should have failed to parse, but didn't.
|
||||
# TODO: Uncomment once conformance tests can express failures that are not expected to be fixed.
|
||||
# Recommended.Editions_Proto2.ProtobufInput.RejectInvalidUtf8.String.MapKey # Should have failed to parse, but didn't.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse or matched expected output but did not.
|
||||
Required.*.JsonInput.DoubleFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.DoubleFieldTrueValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.EnumFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.EnumFieldTrueValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.FloatFieldFalseValue # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.FloatFieldTrueValue # Should have failed to parse, but didn't.
|
||||
# TODO: Uncomment once conformance tests can express failures that are not expected to be fixed.
|
||||
# Recommended.Editions_Proto2.ProtobufInput.RejectInvalidUtf8.String.MapKey # Should have failed to parse, but didn't.
|
||||
# Recommended.Editions_Proto2.ProtobufInput.RejectInvalidUtf8.String.MapValue # Should have failed to parse, but didn't.
|
||||
|
|
@ -11,3 +17,8 @@ Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Sh
|
|||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Oneof # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Repeated # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Singular # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooShort # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetHour # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetMinute # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooShort # Should have failed to parse, but didn't.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse, but didn't.
|
||||
Recommended.*.JsonInput.FieldNameDuplicate # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 # Should have failed to parse or matched expected output but did not.
|
||||
Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse or matched expected output but did not.
|
||||
Required.*.JsonInput.Int32FieldQuotedExponentialValue.* # Failed to parse input or produce output.
|
||||
Required.*.JsonInput.AnyWithNoType.*
|
||||
# TODO: Uncomment once conformance tests can express failures that are not expected to be fixed.
|
||||
|
|
@ -14,3 +14,16 @@ Required.*.JsonInput.AnyWithNoType.*
|
|||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Oneof # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Repeated # Should have failed to parse, but didn't.
|
||||
# Recommended.Proto2.ProtobufInput.RejectInvalidUtf8.String.Singular # Should have failed to parse, but didn't.
|
||||
|
||||
Required.*.JsonInput.TimestampJsonInputDayTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputDayZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputHourTooLarge25 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetHour # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputInvalidOffsetMinute # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMinuteTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthTooLarge # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputMonthZero # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputNonLeapFeb29 # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputOffsetBoundaryOverflow # Should have failed to parse, but didn't.
|
||||
Required.*.JsonInput.TimestampJsonInputSecondTooLarge # Should have failed to parse, but didn't.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ load("//upb/cmake:build_defs.bzl", "staleness_test")
|
|||
filegroup(
|
||||
name = "c_sharp_features_proto_srcs",
|
||||
srcs = ["google/protobuf/c_sharp_features.proto"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
visibility = ["//src/google/protobuf:__pkg__"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<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.36.0</version>
|
||||
<version>3.37.0</version>
|
||||
<authors>Google Inc.</authors>
|
||||
<owners>protobuf-packages</owners>
|
||||
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/main/LICENSE</licenseUrl>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
|
|||
src/google/protobuf/wrappers.proto \
|
||||
src/google/protobuf/compiler/plugin.proto
|
||||
|
||||
# JSON options
|
||||
$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
|
||||
--csharp_opt=file_extension=.pb.cs \
|
||||
src/google/protobuf/json_options.proto \
|
||||
src/google/protobuf/json_enumvalue_options.proto
|
||||
|
||||
# C# features
|
||||
$PROTOC -Icsharp -Isrc --csharp_out=csharp/src/Google.Protobuf \
|
||||
--csharp_opt=base_namespace=Google.Protobuf \
|
||||
|
|
@ -88,7 +94,8 @@ $PROTOC -Isrc -I. -Ijava/core/src/main/resources/ \
|
|||
src/google/protobuf/unittest_features.proto \
|
||||
src/google/protobuf/unittest_legacy_features.proto \
|
||||
src/google/protobuf/unittest_proto3_optional.proto \
|
||||
src/google/protobuf/unittest_retention.proto
|
||||
src/google/protobuf/unittest_retention.proto \
|
||||
src/google/protobuf/json/json_enumval_custom_string.proto
|
||||
|
||||
# We can safely ignore the unused import warning as the
|
||||
# purpose of the test is to work with the dependencies
|
||||
|
|
|
|||
|
|
@ -0,0 +1,344 @@
|
|||
// <auto-generated>
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/json/json_enumval_custom_string.proto
|
||||
// </auto-generated>
|
||||
#pragma warning disable 1591, 0612, 3021, 8981
|
||||
#region Designer generated code
|
||||
|
||||
using pb = global::Google.Protobuf;
|
||||
using pbc = global::Google.Protobuf.Collections;
|
||||
using pbr = global::Google.Protobuf.Reflection;
|
||||
using scg = global::System.Collections.Generic;
|
||||
namespace JsonEnumvalCustomString {
|
||||
|
||||
/// <summary>Holder for reflection information generated from google/protobuf/json/json_enumval_custom_string.proto</summary>
|
||||
public static partial class JsonEnumvalCustomStringReflection {
|
||||
|
||||
#region Descriptor
|
||||
/// <summary>File descriptor for google/protobuf/json/json_enumval_custom_string.proto</summary>
|
||||
public static pbr::FileDescriptor Descriptor {
|
||||
get { return descriptor; }
|
||||
}
|
||||
private static pbr::FileDescriptor descriptor;
|
||||
|
||||
static JsonEnumvalCustomStringReflection() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
string.Concat(
|
||||
"CjVnb29nbGUvcHJvdG9idWYvanNvbi9qc29uX2VudW12YWxfY3VzdG9tX3N0",
|
||||
"cmluZy5wcm90bxIaanNvbl9lbnVtdmFsX2N1c3RvbV9zdHJpbmcaImdvb2ds",
|
||||
"ZS9wcm90b2J1Zi9qc29uX29wdGlvbnMucHJvdG8ihgIKBktuaWdodBIwCgVh",
|
||||
"cm1vchgBIAEoDjIhLmpzb25fZW51bXZhbF9jdXN0b21fc3RyaW5nLkFybW9y",
|
||||
"EjEKBmFybW9ycxgCIAMoDjIhLmpzb25fZW51bXZhbF9jdXN0b21fc3RyaW5n",
|
||||
"LkFybW9yEkMKCWFybW9yX21hcBgDIAMoCzIwLmpzb25fZW51bXZhbF9jdXN0",
|
||||
"b21fc3RyaW5nLktuaWdodC5Bcm1vck1hcEVudHJ5GlIKDUFybW9yTWFwRW50",
|
||||
"cnkSCwoDa2V5GAEgASgJEjAKBXZhbHVlGAIgASgOMiEuanNvbl9lbnVtdmFs",
|
||||
"X2N1c3RvbV9zdHJpbmcuQXJtb3I6AjgBKtgCCgVBcm1vchIRCg1BUk1PUl9V",
|
||||
"TktOT1dOEAASIwoQQVJNT1JfR1JFQVRfSEVMTRABGg2yPgoKCGdyOCBoZWxt",
|
||||
"EhAKDEFSTU9SX0dPUkdFVBACEhwKDkFSTU9SX0dBVU5UTEVUEAMaCLI+BQoD",
|
||||
"YSJiEh0KC0FSTU9SX1BMQVRFEAQaDLI+CQoHInBsYXRlIhIVCgpBUk1PUl9D",
|
||||
"T0lGEAUaBbI+AgoAEiMKDkFSTU9SX1BBVUxEUk9OEAYaD7I+DAoKcAlhdWwK",
|
||||
"ZHJvbhIfCg1BUk1PUl9TQUJBVE9OEAcaDLI+CQoHc2FiYXRvbhIgCg5BUk1P",
|
||||
"Ul9TT0xMRVJFVBAHGgyyPgkKB3NhYmF0b24SHgoSQVJNT1JfSEFDSElfTUFJ",
|
||||
"X0RPEAgaBrI+AwoBOBIlCg1BUk1PUl9HUkVBVkVTEAkaErI+DwoNQVJNT1Jf",
|
||||
"R1JFQVZFUxoCEAFiCGVkaXRpb25zcOoH"));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { global::Pb.JsonOptionsReflection.Descriptor, },
|
||||
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::JsonEnumvalCustomString.Armor), }, null, new pbr::GeneratedClrTypeInfo[] {
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::JsonEnumvalCustomString.Knight), global::JsonEnumvalCustomString.Knight.Parser, new[]{ "Armor", "Armors", "ArmorMap" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, })
|
||||
}));
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Enums
|
||||
public enum Armor {
|
||||
[pbr::OriginalName("ARMOR_UNKNOWN")] Unknown = 0,
|
||||
[pbr::OriginalName("ARMOR_GREAT_HELM")] GreatHelm = 1,
|
||||
[pbr::OriginalName("ARMOR_GORGET")] Gorget = 2,
|
||||
[pbr::OriginalName("ARMOR_GAUNTLET")] Gauntlet = 3,
|
||||
[pbr::OriginalName("ARMOR_PLATE")] Plate = 4,
|
||||
[pbr::OriginalName("ARMOR_COIF")] Coif = 5,
|
||||
[pbr::OriginalName("ARMOR_PAULDRON")] Pauldron = 6,
|
||||
[pbr::OriginalName("ARMOR_SABATON")] Sabaton = 7,
|
||||
[pbr::OriginalName("ARMOR_SOLLERET", PreferredAlias = false)] Solleret = 7,
|
||||
[pbr::OriginalName("ARMOR_HACHI_MAI_DO")] HachiMaiDo = 8,
|
||||
[pbr::OriginalName("ARMOR_GREAVES")] Greaves = 9,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Messages
|
||||
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
|
||||
public sealed partial class Knight : pb::IMessage<Knight>
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
, pb::IBufferMessage
|
||||
#endif
|
||||
{
|
||||
private static readonly pb::MessageParser<Knight> _parser = new pb::MessageParser<Knight>(() => new Knight());
|
||||
private pb::UnknownFieldSet _unknownFields;
|
||||
private int _hasBits0;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pb::MessageParser<Knight> Parser { get { return _parser; } }
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pbr::MessageDescriptor Descriptor {
|
||||
get { return global::JsonEnumvalCustomString.JsonEnumvalCustomStringReflection.Descriptor.MessageTypes[0]; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
pbr::MessageDescriptor pb::IMessage.Descriptor {
|
||||
get { return Descriptor; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Knight() {
|
||||
OnConstruction();
|
||||
}
|
||||
|
||||
partial void OnConstruction();
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Knight(Knight other) : this() {
|
||||
_hasBits0 = other._hasBits0;
|
||||
armor_ = other.armor_;
|
||||
armors_ = other.armors_.Clone();
|
||||
armorMap_ = other.armorMap_.Clone();
|
||||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Knight Clone() {
|
||||
return new Knight(this);
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "armor" field.</summary>
|
||||
public const int ArmorFieldNumber = 1;
|
||||
private readonly static global::JsonEnumvalCustomString.Armor ArmorDefaultValue = global::JsonEnumvalCustomString.Armor.Unknown;
|
||||
|
||||
private global::JsonEnumvalCustomString.Armor armor_;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public global::JsonEnumvalCustomString.Armor Armor {
|
||||
get { if ((_hasBits0 & 1) != 0) { return armor_; } else { return ArmorDefaultValue; } }
|
||||
set {
|
||||
_hasBits0 |= 1;
|
||||
armor_ = value;
|
||||
}
|
||||
}
|
||||
/// <summary>Gets whether the "armor" field is set</summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public bool HasArmor {
|
||||
get { return (_hasBits0 & 1) != 0; }
|
||||
}
|
||||
/// <summary>Clears the value of the "armor" field</summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void ClearArmor() {
|
||||
_hasBits0 &= ~1;
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "armors" field.</summary>
|
||||
public const int ArmorsFieldNumber = 2;
|
||||
private static readonly pb::FieldCodec<global::JsonEnumvalCustomString.Armor> _repeated_armors_codec
|
||||
= pb::FieldCodec.ForEnum(18, x => (int) x, x => (global::JsonEnumvalCustomString.Armor) x);
|
||||
private readonly pbc::RepeatedField<global::JsonEnumvalCustomString.Armor> armors_ = new pbc::RepeatedField<global::JsonEnumvalCustomString.Armor>();
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public pbc::RepeatedField<global::JsonEnumvalCustomString.Armor> Armors {
|
||||
get { return armors_; }
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "armor_map" field.</summary>
|
||||
public const int ArmorMapFieldNumber = 3;
|
||||
private static readonly pbc::MapField<string, global::JsonEnumvalCustomString.Armor>.Codec _map_armorMap_codec
|
||||
= new pbc::MapField<string, global::JsonEnumvalCustomString.Armor>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::JsonEnumvalCustomString.Armor) x, global::JsonEnumvalCustomString.Armor.Unknown), 26);
|
||||
private readonly pbc::MapField<string, global::JsonEnumvalCustomString.Armor> armorMap_ = new pbc::MapField<string, global::JsonEnumvalCustomString.Armor>();
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public pbc::MapField<string, global::JsonEnumvalCustomString.Armor> ArmorMap {
|
||||
get { return armorMap_; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as Knight);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public bool Equals(Knight other) {
|
||||
if (ReferenceEquals(other, null)) {
|
||||
return false;
|
||||
}
|
||||
if (ReferenceEquals(other, this)) {
|
||||
return true;
|
||||
}
|
||||
if (Armor != other.Armor) return false;
|
||||
if(!armors_.Equals(other.armors_)) return false;
|
||||
if (!ArmorMap.Equals(other.ArmorMap)) return false;
|
||||
return Equals(_unknownFields, other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override int GetHashCode() {
|
||||
int hash = 1;
|
||||
if (HasArmor) hash ^= Armor.GetHashCode();
|
||||
hash ^= armors_.GetHashCode();
|
||||
hash ^= ArmorMap.GetHashCode();
|
||||
if (_unknownFields != null) {
|
||||
hash ^= _unknownFields.GetHashCode();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override string ToString() {
|
||||
return pb::JsonFormatter.ToDiagnosticString(this);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void WriteTo(pb::CodedOutputStream output) {
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
output.WriteRawMessage(this);
|
||||
#else
|
||||
if (HasArmor) {
|
||||
output.WriteRawTag(8);
|
||||
output.WriteEnum((int) Armor);
|
||||
}
|
||||
armors_.WriteTo(output, _repeated_armors_codec);
|
||||
armorMap_.WriteTo(output, _map_armorMap_codec);
|
||||
if (_unknownFields != null) {
|
||||
_unknownFields.WriteTo(output);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
|
||||
if (HasArmor) {
|
||||
output.WriteRawTag(8);
|
||||
output.WriteEnum((int) Armor);
|
||||
}
|
||||
armors_.WriteTo(ref output, _repeated_armors_codec);
|
||||
armorMap_.WriteTo(ref output, _map_armorMap_codec);
|
||||
if (_unknownFields != null) {
|
||||
_unknownFields.WriteTo(ref output);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public int CalculateSize() {
|
||||
int size = 0;
|
||||
if (HasArmor) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Armor);
|
||||
}
|
||||
size += armors_.CalculateSize(_repeated_armors_codec);
|
||||
size += armorMap_.CalculateSize(_map_armorMap_codec);
|
||||
if (_unknownFields != null) {
|
||||
size += _unknownFields.CalculateSize();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void MergeFrom(Knight other) {
|
||||
if (other == null) {
|
||||
return;
|
||||
}
|
||||
if (other.HasArmor) {
|
||||
Armor = other.Armor;
|
||||
}
|
||||
armors_.Add(other.armors_);
|
||||
armorMap_.MergeFrom(other.armorMap_);
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void MergeFrom(pb::CodedInputStream input) {
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
input.ReadRawMessage(this);
|
||||
#else
|
||||
uint tag;
|
||||
while ((tag = input.ReadTag()) != 0) {
|
||||
if ((tag & 7) == 4) {
|
||||
// Abort on any end group tag.
|
||||
return;
|
||||
}
|
||||
switch(tag) {
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||
break;
|
||||
case 8: {
|
||||
Armor = (global::JsonEnumvalCustomString.Armor) input.ReadEnum();
|
||||
break;
|
||||
}
|
||||
case 18:
|
||||
case 16: {
|
||||
armors_.AddEntriesFrom(input, _repeated_armors_codec);
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
armorMap_.AddEntriesFrom(input, _map_armorMap_codec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
|
||||
uint tag;
|
||||
while ((tag = input.ReadTag()) != 0) {
|
||||
if ((tag & 7) == 4) {
|
||||
// Abort on any end group tag.
|
||||
return;
|
||||
}
|
||||
switch(tag) {
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
|
||||
break;
|
||||
case 8: {
|
||||
Armor = (global::JsonEnumvalCustomString.Armor) input.ReadEnum();
|
||||
break;
|
||||
}
|
||||
case 18:
|
||||
case 16: {
|
||||
armors_.AddEntriesFrom(ref input, _repeated_armors_codec);
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
armorMap_.AddEntriesFrom(ref input, _map_armorMap_codec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#endregion Designer generated code
|
||||
|
|
@ -18,6 +18,7 @@ using static Google.Protobuf.JsonParserTest; // For WrapInQuotes
|
|||
using System.IO;
|
||||
using Google.Protobuf.Collections;
|
||||
using ProtobufUnittest;
|
||||
using JsonEnumvalCustomString;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
|
|
@ -957,6 +958,86 @@ namespace Google.Protobuf
|
|||
AssertWriteValue(value, "{ 'FieldName13': 0 }");
|
||||
}
|
||||
|
||||
[Test]
|
||||
// No custom value.
|
||||
[TestCase(Armor.Gorget, "ARMOR_GORGET")]
|
||||
// Simple custom value.
|
||||
[TestCase(Armor.GreatHelm, "gr8 helm")]
|
||||
// Escaping of quotes mid-value.
|
||||
[TestCase(Armor.Gauntlet, "a\\\"b")]
|
||||
// Escaping of quotes at start and end.
|
||||
[TestCase(Armor.Plate, "\\\"plate\\\"")]
|
||||
// Empty string.
|
||||
[TestCase(Armor.Coif, "")]
|
||||
// Escaping of tab and newline.
|
||||
[TestCase(Armor.Pauldron, "p\\taul\\ndron")]
|
||||
// Aliased enum values.
|
||||
[TestCase(Armor.Sabaton, "sabaton")]
|
||||
[TestCase(Armor.Solleret, "sabaton")]
|
||||
// Numeric string custom value.
|
||||
[TestCase(Armor.HachiMaiDo, "8")]
|
||||
// Custom value same as enum name.
|
||||
[TestCase(Armor.Greaves, "ARMOR_GREAVES")]
|
||||
public void Serialize(Armor value, string expectedSerializedJsonValue)
|
||||
{
|
||||
var msg = new Knight { Armor = value };
|
||||
var actualJson = JsonFormatter.Default.Format(msg);
|
||||
var expectedJson =
|
||||
$"{{ \"armor\": \"{expectedSerializedJsonValue}\" }}";
|
||||
Assert.AreEqual(expectedJson, actualJson);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SerializeUnknownValue()
|
||||
{
|
||||
var msg = new Knight { Armor = (Armor) 12345 };
|
||||
var actualJson = JsonFormatter.Default.Format(msg);
|
||||
var expectedJson = $"{{ \"armor\": 12345 }}";
|
||||
Assert.AreEqual(expectedJson, actualJson);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IntegerFormatSettingOverridesCustomString()
|
||||
{
|
||||
var msg = new Knight { Armor = Armor.GreatHelm };
|
||||
var settings = JsonFormatter.Settings.Default
|
||||
.WithFormatEnumsAsIntegers(true);
|
||||
var formatter = new JsonFormatter(settings);
|
||||
|
||||
var json = formatter.Format(msg);
|
||||
Assert.AreEqual("{ \"armor\": 1 }", json);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SerializeRepeated()
|
||||
{
|
||||
var msg = new Knight
|
||||
{
|
||||
Armors = { Armor.GreatHelm, Armor.Gorget, Armor.Gauntlet }
|
||||
};
|
||||
var actualJson = JsonFormatter.Default.Format(msg);
|
||||
var expectedJson =
|
||||
"{ \"armors\": [ \"gr8 helm\", \"ARMOR_GORGET\", \"a\\\"b\" ] }";
|
||||
Assert.AreEqual(expectedJson, actualJson);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SerializeMap()
|
||||
{
|
||||
var msg = new Knight
|
||||
{
|
||||
ArmorMap =
|
||||
{
|
||||
{ "primary", Armor.GreatHelm },
|
||||
{ "secondary", Armor.Gorget }
|
||||
}
|
||||
};
|
||||
var actualJson = JsonFormatter.Default.Format(msg);
|
||||
AssertJson(
|
||||
"{ 'armorMap': { 'primary': 'gr8 helm', 'secondary': 'ARMOR_GORGET' } }",
|
||||
actualJson);
|
||||
}
|
||||
|
||||
private static void AssertWriteValue(object value, string expectedJson, JsonFormatter.Settings settings = null)
|
||||
{
|
||||
var writer = new StringWriter { NewLine = "\n" };
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ using ProtobufUnittest;
|
|||
using System;
|
||||
using System.Linq;
|
||||
using UnitTest.Issues.TestProtos;
|
||||
using JsonEnumvalCustomString;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
|
|
@ -1265,5 +1266,98 @@ namespace Google.Protobuf
|
|||
Assert.AreEqual(0, message.MapBoolBool.Count);
|
||||
Assert.AreEqual(0, message.MapStringNestedMessage.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase(Armor.Gorget, "ARMOR_GORGET")]
|
||||
[TestCase(Armor.GreatHelm, "gr8 helm", "ARMOR_GREAT_HELM")]
|
||||
[TestCase(Armor.Gauntlet, "a\\\"b", "ARMOR_GAUNTLET")]
|
||||
[TestCase(Armor.Plate, "\\\"plate\\\"", "ARMOR_PLATE")]
|
||||
[TestCase(Armor.Coif, "", "ARMOR_COIF")]
|
||||
[TestCase(Armor.Pauldron, "p\\taul\\ndron", "ARMOR_PAULDRON")]
|
||||
[TestCase(
|
||||
Armor.Sabaton, "sabaton", "ARMOR_SABATON", "ARMOR_SOLLERET")]
|
||||
[TestCase(
|
||||
Armor.Solleret, "sabaton", "ARMOR_SOLLERET", "ARMOR_SABATON")]
|
||||
[TestCase(Armor.HachiMaiDo, "8", "ARMOR_HACHI_MAI_DO")]
|
||||
[TestCase(Armor.Greaves, "ARMOR_GREAVES")]
|
||||
[TestCase(Armor.Unknown, "ARMOR_UNKNOWN")]
|
||||
public void ParseString(Armor value, params string[] validJsonValues)
|
||||
{
|
||||
foreach (var validJsonValue in validJsonValues)
|
||||
{
|
||||
string json = $"{{ \"armor\": \"{validJsonValue}\" }}";
|
||||
var parsed = JsonParser.Default.Parse<Knight>(json);
|
||||
Assert.AreEqual(value, parsed.Armor);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseInteger()
|
||||
{
|
||||
foreach (
|
||||
var value in System.Enum.GetValues(typeof(Armor)).Cast<Armor>())
|
||||
{
|
||||
string json = $"{{ \"armor\": {(int) value} }}";
|
||||
var parsed = JsonParser.Default.Parse<Knight>(json);
|
||||
Assert.AreEqual(value, parsed.Armor);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase("\"UNKNOWN_1\"")]
|
||||
[TestCase("\"ARMOR_INVALID\"")]
|
||||
[TestCase("\"A\\\"b\"")]
|
||||
[TestCase("\"ARMOR_great_helm\"")]
|
||||
[TestCase("\"GR8 HELM\"")]
|
||||
[TestCase("true")]
|
||||
[TestCase("123.456")]
|
||||
[TestCase("{}")]
|
||||
[TestCase("[ \"gr8 helm\" ]")]
|
||||
[TestCase("[ \"ARMOR_GREAT_HELM\" ]")]
|
||||
public void ParseInvalidValueFails(string jsonValue)
|
||||
{
|
||||
string json = $"{{ \"armor\": {jsonValue} }}";
|
||||
Assert.Throws<InvalidProtocolBufferException>(
|
||||
() => JsonParser.Default.Parse<Knight>(json));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase("UNKNOWN_1")]
|
||||
[TestCase("ARMOR_great_helm")]
|
||||
[TestCase("GR8 HELM")]
|
||||
public void ParseUnknownString_IgnoreUnknownFields(
|
||||
string unrecognizedJsonValue)
|
||||
{
|
||||
var settings = JsonParser.Settings.Default
|
||||
.WithIgnoreUnknownFields(true);
|
||||
var parser = new JsonParser(settings);
|
||||
string json = $"{{ \"armor\": \"{unrecognizedJsonValue}\" }}";
|
||||
var parsed = parser.Parse<Knight>(json);
|
||||
Assert.AreEqual(Armor.Unknown, parsed.Armor);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseRepeated()
|
||||
{
|
||||
string json =
|
||||
"{ \"armors\": [ \"gr8 helm\", \"ARMOR_GORGET\", \"a\\\"b\" ] }";
|
||||
var parsed = JsonParser.Default.Parse<Knight>(json);
|
||||
Assert.AreEqual(3, parsed.Armors.Count);
|
||||
Assert.AreEqual(Armor.GreatHelm, parsed.Armors[0]);
|
||||
Assert.AreEqual(Armor.Gorget, parsed.Armors[1]);
|
||||
Assert.AreEqual(Armor.Gauntlet, parsed.Armors[2]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseMap()
|
||||
{
|
||||
string json =
|
||||
"{ \"armorMap\": { \"primary\": \"gr8 helm\"," +
|
||||
" \"secondary\": \"ARMOR_GORGET\" } }";
|
||||
var parsed = JsonParser.Default.Parse<Knight>(json);
|
||||
Assert.AreEqual(2, parsed.ArmorMap.Count);
|
||||
Assert.AreEqual(Armor.GreatHelm, parsed.ArmorMap["primary"]);
|
||||
Assert.AreEqual(Armor.Gorget, parsed.ArmorMap["secondary"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
|
@ -5,7 +5,7 @@
|
|||
<Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
|
||||
<Copyright>Copyright 2015, Google Inc.</Copyright>
|
||||
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
|
||||
<VersionPrefix>3.36.0</VersionPrefix>
|
||||
<VersionPrefix>3.37.0</VersionPrefix>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<Authors>Google Inc.</Authors>
|
||||
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue