Compare commits
1266 Commits
feat/HolyL
...
feat/mainc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee566c5fb7 | ||
|
|
40d5bdd560 | ||
|
|
01a2329d18 | ||
|
|
c52cf81b94 | ||
|
|
2a9c963fef | ||
|
|
0817bc1c9f | ||
|
|
c36e5cfd9a | ||
|
|
3fbda5b98d | ||
|
|
50cbc2e10d | ||
|
|
30dd7d0afa | ||
|
|
80280bb62d | ||
|
|
e7362d2d35 | ||
|
|
f77d85f542 | ||
|
|
00e577f6d2 | ||
|
|
6d32795ffa | ||
|
|
a72571ce90 | ||
|
|
59fa039a72 | ||
|
|
adb8863cf6 | ||
|
|
7bab2b2312 | ||
|
|
b55b2c6bd6 | ||
|
|
3d46fc1d0c | ||
|
|
e62a9a08a9 | ||
|
|
f7f9a4f44c | ||
|
|
9ab3265188 | ||
|
|
e1572d8bba | ||
|
|
761ea19e8b | ||
|
|
d9ad52053b | ||
|
|
1ddee84199 | ||
|
|
45b89b7089 | ||
|
|
c8a0c982b9 | ||
|
|
910cd47dfa | ||
|
|
63d499816d | ||
|
|
d734109155 | ||
|
|
c45e6a3d10 | ||
|
|
5e712c04eb | ||
|
|
dc9c9dfee6 | ||
|
|
ec7cbeeb1c | ||
|
|
c3ccd36d02 | ||
|
|
283309d3c1 | ||
|
|
43d5c429ae | ||
|
|
bb15f533b2 | ||
|
|
424b916265 | ||
|
|
656ba9d749 | ||
|
|
2a4cd8b7c8 | ||
|
|
e862101764 | ||
|
|
c095cc6d6f | ||
|
|
a0a6cf6739 | ||
|
|
f21f7cfd92 | ||
|
|
10989582ee | ||
|
|
a0b73022cd | ||
|
|
5bc7364eb6 | ||
|
|
7c3d531177 | ||
|
|
b4d75f194e | ||
|
|
f642273b7a | ||
|
|
3da747a59a | ||
|
|
cfb2a70ac3 | ||
|
|
3c763afa2d | ||
|
|
173d8f50ac | ||
|
|
867a7b5ea7 | ||
|
|
3469aa3777 | ||
|
|
f7c85a9803 | ||
|
|
19241cf186 | ||
|
|
51d6fc3ce1 | ||
|
|
d7f7614de6 | ||
|
|
5de1387402 | ||
|
|
08956dc9e8 | ||
|
|
d32484e366 | ||
|
|
206f5bf97c | ||
|
|
f1827ad99a | ||
|
|
a68f740fe3 | ||
|
|
483a484ae7 | ||
|
|
ad26721541 | ||
|
|
ba6f52f974 | ||
|
|
3782fb1fcb | ||
|
|
0ea2845b5b | ||
|
|
96b95bf5e4 | ||
|
|
256e3e3f58 | ||
|
|
9629226688 | ||
|
|
7dd93eb756 | ||
|
|
f91324fbe8 | ||
|
|
8eb62c2a7b | ||
|
|
d473c2c3f6 | ||
|
|
8785c9d00a | ||
|
|
02cf529bf8 | ||
|
|
2b8e88cdc5 | ||
|
|
e05fe43662 | ||
|
|
d84c5b3311 | ||
|
|
5162a77701 | ||
|
|
24c3e7e945 | ||
|
|
fc1643a728 | ||
|
|
86baa18ad9 | ||
|
|
45a6695a15 | ||
|
|
f39ae39f7d | ||
|
|
6c0bde0611 | ||
|
|
93b7d47cc7 | ||
|
|
8365874e28 | ||
|
|
cb03a617d2 | ||
|
|
a6f309fa88 | ||
|
|
9a214aaf0e | ||
|
|
ff97d59d58 | ||
|
|
d94961f737 | ||
|
|
3ad1c7096d | ||
|
|
9a5ad94920 | ||
|
|
d832875951 | ||
|
|
68a9a82107 | ||
|
|
42088719c5 | ||
|
|
c4f229930e | ||
|
|
5f0f0da82e | ||
|
|
a0a475764b | ||
|
|
59f848b7f7 | ||
|
|
6c0c84c649 | ||
|
|
fd18bfee21 | ||
|
|
b5bba18200 | ||
|
|
4149344318 | ||
|
|
8537612c37 | ||
|
|
6cc28ae344 | ||
|
|
67d73e8e2e | ||
|
|
7fe05d3261 | ||
|
|
4e94fdf133 | ||
|
|
cab1d602c9 | ||
|
|
8d983f2c8c | ||
|
|
a76ac22c13 | ||
|
|
c45f76785d | ||
|
|
1fde5dd93b | ||
|
|
630aae99bc | ||
|
|
cb50ad4a46 | ||
|
|
13d88119b3 | ||
|
|
156335da1c | ||
|
|
3eeb45b3b4 | ||
|
|
c9c587053a | ||
|
|
f7875e3033 | ||
|
|
58bf3b3a82 | ||
|
|
33716c8350 | ||
|
|
c822ad0310 | ||
|
|
647efc8ade | ||
|
|
759a81b03a | ||
|
|
3652fc4bea | ||
|
|
d51e971f3d | ||
|
|
99848bb7b3 | ||
|
|
f273a6f410 | ||
|
|
d68efb6333 | ||
|
|
13f9ccfc4d | ||
|
|
a0ef5f705a | ||
|
|
bfe7c0eabc | ||
|
|
36b776d42c | ||
|
|
9badef9093 | ||
|
|
6e895b50ae | ||
|
|
31832c411a | ||
|
|
7ca53518cc | ||
|
|
b836758ce4 | ||
|
|
97b5944216 | ||
|
|
5645e893e6 | ||
|
|
bfa2ab4e93 | ||
|
|
85df2a4059 | ||
|
|
3422cc375f | ||
|
|
5e36bac060 | ||
|
|
10d40be9f8 | ||
|
|
0e0c6665e8 | ||
|
|
7ad52310cf | ||
|
|
f18329cea9 | ||
|
|
012dd635de | ||
|
|
fe77da4391 | ||
|
|
295daad11d | ||
|
|
fcc40f97c8 | ||
|
|
875fc4ec6d | ||
|
|
d95523439b | ||
|
|
6f33c7a7ad | ||
|
|
066e836a6e | ||
|
|
8994cec168 | ||
|
|
14296d6a90 | ||
|
|
5a6f94b742 | ||
|
|
71566544b5 | ||
|
|
0fa1ae48e0 | ||
|
|
78848c5f3e | ||
|
|
d3532ab8ed | ||
|
|
bdd299a85e | ||
|
|
51a8837b09 | ||
|
|
d407a034c7 | ||
|
|
79027bc9f0 | ||
|
|
11a6f45481 | ||
|
|
52afaa37be | ||
|
|
a8b7ae2474 | ||
|
|
edcc7857ef | ||
|
|
ef1987e02a | ||
|
|
c95dd34533 | ||
|
|
dd9ce36953 | ||
|
|
102aa5dc85 | ||
|
|
f23e43cadc | ||
|
|
0e5097fe0b | ||
|
|
4ed05750e5 | ||
|
|
a64be68417 | ||
|
|
32b7cbbf9d | ||
|
|
8a075b7f05 | ||
|
|
07aeb4b354 | ||
|
|
5de92ba180 | ||
|
|
1e1e0f14fe | ||
|
|
5281d95710 | ||
|
|
38974951b9 | ||
|
|
73f7feec97 | ||
|
|
26dd914a79 | ||
|
|
c8b9147f19 | ||
|
|
ecbed74dd6 | ||
|
|
99f294d572 | ||
|
|
2d2d490f44 | ||
|
|
599cbfd5dc | ||
|
|
ebc5ec8047 | ||
|
|
7fefe97301 | ||
|
|
af96544893 | ||
|
|
33e7225119 | ||
|
|
9a456dcaec | ||
|
|
8634826c01 | ||
|
|
07068c14da | ||
|
|
02917c04dd | ||
|
|
e933074535 | ||
|
|
777d471a98 | ||
|
|
bde877c915 | ||
|
|
55c0c29589 | ||
|
|
819707fc42 | ||
|
|
86700994ba | ||
|
|
3c41f7662b | ||
|
|
3cf198e5e1 | ||
|
|
15c53df25b | ||
|
|
1bf5ae8e7f | ||
|
|
8fe346fac8 | ||
|
|
5f08be41b1 | ||
|
|
89b0b243f9 | ||
|
|
892e4e14cb | ||
|
|
abf8d62c30 | ||
|
|
01e35405d9 | ||
|
|
5b8c050e82 | ||
|
|
1c3ae38368 | ||
|
|
c7db3681be | ||
|
|
898fbea848 | ||
|
|
40057b0022 | ||
|
|
27d94c7de0 | ||
|
|
8612eead4e | ||
|
|
f179ca1822 | ||
|
|
0712fba4c4 | ||
|
|
17a08252f1 | ||
|
|
26e035dabe | ||
|
|
67e9ade712 | ||
|
|
c5c72d9ab0 | ||
|
|
18f76c918c | ||
|
|
cf1a6bbdae | ||
|
|
272c30a5d0 | ||
|
|
5d87a2c9ec | ||
|
|
b6f71355a8 | ||
|
|
49839ff439 | ||
|
|
a58a4b7383 | ||
|
|
d3611bbbf5 | ||
|
|
bc9d10316a | ||
|
|
f63da7c794 | ||
|
|
0ff111cc20 | ||
|
|
63e87aaabf | ||
|
|
0d7c54dd53 | ||
|
|
bcca9bbb8a | ||
|
|
ca2f4d5b8d | ||
|
|
dde61c5e6d | ||
|
|
5a0f94e8c3 | ||
|
|
66e44f45e7 | ||
|
|
e454290827 | ||
|
|
08b4f4eae1 | ||
|
|
1fd7f71f64 | ||
|
|
7d1e18fb39 | ||
|
|
289ba1d431 | ||
|
|
09df60e3d2 | ||
|
|
29ccd0f4ff | ||
|
|
d58b86cfb4 | ||
|
|
0fca6fda6d | ||
|
|
35d375a746 | ||
|
|
1f9222b7f0 | ||
|
|
f7b43bdac1 | ||
|
|
39e595d6fc | ||
|
|
af23150152 | ||
|
|
6ea89637ad | ||
|
|
0c4e81c4b3 | ||
|
|
e14b993890 | ||
|
|
22e17bac31 | ||
|
|
502c61e88e | ||
|
|
2951e5b5e9 | ||
|
|
690f4b4f62 | ||
|
|
964424a084 | ||
|
|
be674bc681 | ||
|
|
fd03b66f83 | ||
|
|
90de6f03b1 | ||
|
|
71ab040728 | ||
|
|
7b0589013b | ||
|
|
eac775dc83 | ||
|
|
31e7844ca1 | ||
|
|
566a1b1c30 | ||
|
|
d9daa078c0 | ||
|
|
4361b5dcbe | ||
|
|
24033e42af | ||
|
|
9c1216332d | ||
|
|
2fff5e4b7b | ||
|
|
8202acabe4 | ||
|
|
6ada0e0cb4 | ||
|
|
c3c21e8b5c | ||
|
|
dae67ed303 | ||
|
|
12791e94d1 | ||
|
|
092d46bac0 | ||
|
|
fcd29a0efb | ||
|
|
5c2451ba44 | ||
|
|
b71ab1c96b | ||
|
|
99e8dd707a | ||
|
|
a712d0bce1 | ||
|
|
ab624f8adc | ||
|
|
32b13dfc75 | ||
|
|
a2480d5286 | ||
|
|
c036a32a68 | ||
|
|
eeb78ee38f | ||
|
|
6a484e7926 | ||
|
|
e04b0b08e2 | ||
|
|
e813d62f4b | ||
|
|
bc72adb8f9 | ||
|
|
a44b4c7cbd | ||
|
|
407bca4bf5 | ||
|
|
192a106d8e | ||
|
|
f5ed9d60a6 | ||
|
|
9839f3b3d0 | ||
|
|
62043a97f2 | ||
|
|
0b073ed84f | ||
|
|
2c357840c8 | ||
|
|
45511c0a12 | ||
|
|
ccbc877034 | ||
|
|
e1b769a43c | ||
|
|
6d3440647d | ||
|
|
4eea1612f2 | ||
|
|
284553361a | ||
|
|
9f48a35118 | ||
|
|
34c8416527 | ||
|
|
6086b721e6 | ||
|
|
9626e1b5ce | ||
|
|
91b0b9a2b1 | ||
|
|
df5a776419 | ||
|
|
37ae3f0e61 | ||
|
|
24d229f383 | ||
|
|
780a8b3e9f | ||
|
|
ee9d73e4fc | ||
|
|
eadb0833e5 | ||
|
|
76f012c25a | ||
|
|
91cd39bae3 | ||
|
|
d64fe1c879 | ||
|
|
ab4d60b1c9 | ||
|
|
3fab803de2 | ||
|
|
0a1f510b66 | ||
|
|
75ec134118 | ||
|
|
344e43392b | ||
|
|
f96f8f46e2 | ||
|
|
69d5418eba | ||
|
|
9692a57069 | ||
|
|
8c51743ee5 | ||
|
|
885b747ca8 | ||
|
|
008673d9eb | ||
|
|
a5b6f17e83 | ||
|
|
1ed2952767 | ||
|
|
5099827e1f | ||
|
|
535625afcd | ||
|
|
1c1ad37797 | ||
|
|
4ef45c056a | ||
|
|
5fcf5dbd6a | ||
|
|
0ae353c15f | ||
|
|
d652661ca1 | ||
|
|
a7e4c79b7f | ||
|
|
5f364c5886 | ||
|
|
3bf073abdf | ||
|
|
1dfa49bda2 | ||
|
|
174a1b882d | ||
|
|
0fbed82550 | ||
|
|
954e9ad61f | ||
|
|
fa9f443bcf | ||
|
|
23f59ed2c9 | ||
|
|
cb3dd38f23 | ||
|
|
6c4819e909 | ||
|
|
0d21d3b909 | ||
|
|
b34c5f6909 | ||
|
|
9e1e7dc2e4 | ||
|
|
c3046c6411 | ||
|
|
e5b6ba5888 | ||
|
|
2c67e23334 | ||
|
|
ed08eb3d78 | ||
|
|
44b2d4d1f7 | ||
|
|
98758bfbec | ||
|
|
243e89d948 | ||
|
|
4ec68ce699 | ||
|
|
91ef092905 | ||
|
|
a46f17774c | ||
|
|
3943bb0d46 | ||
|
|
99294b9f67 | ||
|
|
b5eb6f2b19 | ||
|
|
c6c844626a | ||
|
|
b50eb305eb | ||
|
|
3e114a4d60 | ||
|
|
1d6c99f77c | ||
|
|
feffd27a35 | ||
|
|
0ba193f895 | ||
|
|
d6fa6c87b7 | ||
|
|
61614b8a6f | ||
|
|
6fe58eeceb | ||
|
|
349ea1078c | ||
|
|
8acbcaae11 | ||
|
|
af2e1879fb | ||
|
|
bf0f555233 | ||
|
|
78f0adf0a4 | ||
|
|
cf1f7ba5f5 | ||
|
|
7369c28a1e | ||
|
|
73badc0a67 | ||
|
|
f6d5887229 | ||
|
|
92f22ec499 | ||
|
|
a20f0f684f | ||
|
|
16f5331dc3 | ||
|
|
71b2186dc6 | ||
|
|
0c35daa458 | ||
|
|
1dabdd4043 | ||
|
|
0a3ee5676e | ||
|
|
c2ec6e0c0a | ||
|
|
7438df5ada | ||
|
|
a58c0c55d9 | ||
|
|
0f05a95c82 | ||
|
|
c27a79da36 | ||
|
|
26880c62c7 | ||
|
|
61d26fbe26 | ||
|
|
eee6c64d23 | ||
|
|
363da5be9d | ||
|
|
f5ce1e8728 | ||
|
|
656e774366 | ||
|
|
1e58932ea8 | ||
|
|
7c7916aa95 | ||
|
|
17b7b16069 | ||
|
|
eb85bf2f36 | ||
|
|
efc4a57d74 | ||
|
|
10c4b2d8ef | ||
|
|
aa3830ee91 | ||
|
|
ff11dfc080 | ||
|
|
f590bffcbf | ||
|
|
ad76ab4956 | ||
|
|
e4ece2cff0 | ||
|
|
4980fa1e8c | ||
|
|
e7d83dda91 | ||
|
|
921de77f9b | ||
|
|
ea085c600d | ||
|
|
54569e636e | ||
|
|
6a06789ece | ||
|
|
47f1d0c939 | ||
|
|
4230d695e7 | ||
|
|
f65cb918eb | ||
|
|
d276eea233 | ||
|
|
c54dd5450b | ||
|
|
8ac2b1bc58 | ||
|
|
8101f35923 | ||
|
|
20b317b07a | ||
|
|
4a42d1142b | ||
|
|
ed2594b5c7 | ||
|
|
cca39cf410 | ||
|
|
a14f7c3a3a | ||
|
|
430c389a90 | ||
|
|
dcbd843534 | ||
|
|
f3e0c6a527 | ||
|
|
279d9092a4 | ||
|
|
d25edcbbbd | ||
|
|
2751467878 | ||
|
|
95bc306404 | ||
|
|
776ee22d79 | ||
|
|
f6427b1f3f | ||
|
|
9fa2971da6 | ||
|
|
44d74846f4 | ||
|
|
f60af3f51e | ||
|
|
ff6660aa75 | ||
|
|
886f2a43dd | ||
|
|
4ebacda6be | ||
|
|
8deeea77d3 | ||
|
|
b9a850a8c1 | ||
|
|
58de47bca7 | ||
|
|
dd703da02f | ||
|
|
efadf87944 | ||
|
|
fae39b8fa4 | ||
|
|
6e0e3998b9 | ||
|
|
5a30197362 | ||
|
|
60e191adf7 | ||
|
|
a02e9b8fc0 | ||
|
|
224ede8c31 | ||
|
|
82ee510499 | ||
|
|
6f99eb5a7b | ||
|
|
04b7b11dfc | ||
|
|
352ae52ca1 | ||
|
|
1b98edc30a | ||
|
|
bb9fc88042 | ||
|
|
ccf6df9046 | ||
|
|
2c82a696d8 | ||
|
|
4ec4d33d49 | ||
|
|
df79e53b31 | ||
|
|
1bcb29ded2 | ||
|
|
96d2ccac88 | ||
|
|
6784e6fcab | ||
|
|
577399c1f6 | ||
|
|
a46387b28b | ||
|
|
cea14f843b | ||
|
|
6657421336 | ||
|
|
1091dfceb1 | ||
|
|
b385b472e4 | ||
|
|
91971ce650 | ||
|
|
d6723d93de | ||
|
|
58d71d79c1 | ||
|
|
31eb59e5ff | ||
|
|
2288392dde | ||
|
|
be4a96a06f | ||
|
|
34fa52495f | ||
|
|
b877be6b30 | ||
|
|
95d2d1dcf3 | ||
|
|
48ca14e835 | ||
|
|
cce5463e5c | ||
|
|
f98ccb6eaf | ||
|
|
c963384124 | ||
|
|
d3aaf5645e | ||
|
|
f6b4072780 | ||
|
|
f404eaa3c8 | ||
|
|
eab9143533 | ||
|
|
9456f73ea7 | ||
|
|
59db82e638 | ||
|
|
29f63322ba | ||
|
|
eac2d39834 | ||
|
|
4abf4d63d0 | ||
|
|
ab32660f41 | ||
|
|
c2b0c1f177 | ||
|
|
20c437b32b | ||
|
|
cfb973e037 | ||
|
|
7e962c4394 | ||
|
|
39d156cc26 | ||
|
|
7abd89480b | ||
|
|
a158b12ddf | ||
|
|
24aec64266 | ||
|
|
459c55df40 | ||
|
|
c151f97af1 | ||
|
|
a67e2b4fb9 | ||
|
|
e3734a715f | ||
|
|
27ec293dca | ||
|
|
3e9f19cc22 | ||
|
|
50e9767f0c | ||
|
|
22c0593343 | ||
|
|
3d42e5e55f | ||
|
|
c6037cc4d7 | ||
|
|
9cde16b262 | ||
|
|
5bd9a40560 | ||
|
|
c679542c5f | ||
|
|
2b222eae65 | ||
|
|
9feba528e2 | ||
|
|
dde55b8310 | ||
|
|
06f2740ce4 | ||
|
|
e1cf1ff24a | ||
|
|
154adf2266 | ||
|
|
e29c1243c6 | ||
|
|
7525028f36 | ||
|
|
a5c25fddda | ||
|
|
5467030be4 | ||
|
|
5fae60911d | ||
|
|
534ad0a7a0 | ||
|
|
8ed11ba8ec | ||
|
|
b404672b0b | ||
|
|
6ee4544d92 | ||
|
|
cc58382158 | ||
|
|
637ebc87ad | ||
|
|
2f3dbf55d2 | ||
|
|
215d76e38d | ||
|
|
0fd4b8185e | ||
|
|
c4d361a363 | ||
|
|
286908d41e | ||
|
|
bd4039d442 | ||
|
|
e87608411f | ||
|
|
a0e5f9b3a6 | ||
|
|
1456fbb91c | ||
|
|
6eaf74a289 | ||
|
|
edc8768b2e | ||
|
|
1ce8ff4262 | ||
|
|
d0b594cdc0 | ||
|
|
807adf92fa | ||
|
|
7397e1ac00 | ||
|
|
c7c8466b10 | ||
|
|
e0c226f7bb | ||
|
|
de4b86fda8 | ||
|
|
21181c2872 | ||
|
|
01b59f54fe | ||
|
|
03634ae516 | ||
|
|
2621b0a77b | ||
|
|
cf42b1a9fd | ||
|
|
f28c10a0b1 | ||
|
|
6ae3cb685c | ||
|
|
16e23a32b7 | ||
|
|
5fd5c8a90f | ||
|
|
9673b62ec7 | ||
|
|
fab4a272fd | ||
|
|
2dddb7b231 | ||
|
|
292624166f | ||
|
|
d85291a97a | ||
|
|
cd0273d321 | ||
|
|
c7d9fc37f6 | ||
|
|
5bc1d2835d | ||
|
|
2ecb2b7206 | ||
|
|
0943c48f4e | ||
|
|
a2c99dc72d | ||
|
|
d036a2594c | ||
|
|
0a89c82ba1 | ||
|
|
0224f51076 | ||
|
|
e7cc61eb9a | ||
|
|
25a9712102 | ||
|
|
3ac22778d8 | ||
|
|
be7159f554 | ||
|
|
da0445ddbc | ||
|
|
b5dff5a285 | ||
|
|
a5cd79a70e | ||
|
|
35d31555b0 | ||
|
|
aa34f54f22 | ||
|
|
824e774b2b | ||
|
|
9f002b8f16 | ||
|
|
e5cf3be9ed | ||
|
|
02bf291f85 | ||
|
|
32ab6ce890 | ||
|
|
e95f7e9a78 | ||
|
|
98e26cd9de | ||
|
|
be19d7c5a8 | ||
|
|
4741a8f6d2 | ||
|
|
d43b416837 | ||
|
|
5d20d86080 | ||
|
|
0d446c83dd | ||
|
|
2b4dc643ed | ||
|
|
b2cbde245e | ||
|
|
a7603b66cd | ||
|
|
66baf1be55 | ||
|
|
5433a52b24 | ||
|
|
2e0d0e1313 | ||
|
|
744605548c | ||
|
|
7585be794b | ||
|
|
822d509455 | ||
|
|
36d59a1f7f | ||
|
|
5949146267 | ||
|
|
9cf5b65be2 | ||
|
|
f5c5417f6b | ||
|
|
e935a04674 | ||
|
|
f2460215ac | ||
|
|
367b513cc8 | ||
|
|
d477412cab | ||
|
|
e3170cef94 | ||
|
|
54f40c2708 | ||
|
|
1944164d9c | ||
|
|
16d9d812b8 | ||
|
|
ade38a68a0 | ||
|
|
45ab2e7ba5 | ||
|
|
581df2fc7b | ||
|
|
a7a5d44276 | ||
|
|
52561a7a7c | ||
|
|
48c518c80b | ||
|
|
62c407c81d | ||
|
|
d368dca271 | ||
|
|
fc60270576 | ||
|
|
d7b1c83baa | ||
|
|
e68db16dce | ||
|
|
4f8bf54398 | ||
|
|
23d54a51c6 | ||
|
|
2a2cfec777 | ||
|
|
d988d2537c | ||
|
|
e1d0432e09 | ||
|
|
3835659ac9 | ||
|
|
ac8680d768 | ||
|
|
8c6b3bf559 | ||
|
|
aa1b267278 | ||
|
|
017c6bdce5 | ||
|
|
ccd5d30ac0 | ||
|
|
e20f02c5d2 | ||
|
|
925bb69111 | ||
|
|
232d4adb04 | ||
|
|
2bae56659b | ||
|
|
b70d662a3e | ||
|
|
25222f6e9a | ||
|
|
25786dabeb | ||
|
|
b8b020e839 | ||
|
|
45162e093e | ||
|
|
61fbba4b12 | ||
|
|
86376c9118 | ||
|
|
dcc2c05aee | ||
|
|
48315226dd | ||
|
|
7817b15929 | ||
|
|
b683cdc400 | ||
|
|
9d24679cab | ||
|
|
957f821976 | ||
|
|
b1d7950843 | ||
|
|
0bb546d1d8 | ||
|
|
49ad57dc2c | ||
|
|
42d8699e63 | ||
|
|
8dbc73e0fe | ||
|
|
0148b78711 | ||
|
|
dc50e93075 | ||
|
|
a5e7477b90 | ||
|
|
093320a4c8 | ||
|
|
db2dfbce78 | ||
|
|
c1a0d38037 | ||
|
|
2380db976b | ||
|
|
6f52b01076 | ||
|
|
4fd44e2315 | ||
|
|
1cbe7e2670 | ||
|
|
9d4a9b801b | ||
|
|
442474cce1 | ||
|
|
5880499330 | ||
|
|
419d3a6711 | ||
|
|
e0e037fd8d | ||
|
|
7ca6845b35 | ||
|
|
55beea8593 | ||
|
|
801d656329 | ||
|
|
0cd1d1b63e | ||
|
|
e71037a1b0 | ||
|
|
fef77f5780 | ||
|
|
ca9807ce09 | ||
|
|
32c6429825 | ||
|
|
56f6ef419c | ||
|
|
6532e29d88 | ||
|
|
1c294925d2 | ||
|
|
58a0e07854 | ||
|
|
e735da403c | ||
|
|
b4b1aa69c6 | ||
|
|
69bc5bcf83 | ||
|
|
250eebd81f | ||
|
|
9bdfc02de5 | ||
|
|
d75c028852 | ||
|
|
a3ea60b014 | ||
|
|
6d72632617 | ||
|
|
1fd8c03e32 | ||
|
|
f155bc4867 | ||
|
|
16da7903ba | ||
|
|
bee37d42ab | ||
|
|
a3d3b54fcf | ||
|
|
0072770349 | ||
|
|
38b5d0332b | ||
|
|
7937882099 | ||
|
|
74256dc3d2 | ||
|
|
c376af8dff | ||
|
|
4846ad64e3 | ||
|
|
573bd6f0a4 | ||
|
|
5c40c4b6e8 | ||
|
|
78a27ebfa6 | ||
|
|
ee4f966f75 | ||
|
|
14f331e964 | ||
|
|
18dd3b2034 | ||
|
|
9c12b659cf | ||
|
|
365af6653d | ||
|
|
b467138bee | ||
|
|
1539769b0c | ||
|
|
4400d05cfa | ||
|
|
970860d4f4 | ||
|
|
3824fb1c3e | ||
|
|
aa9dc2ee4d | ||
|
|
66b95cb1e7 | ||
|
|
c641e35ee5 | ||
|
|
389812279d | ||
|
|
e11a90e252 | ||
|
|
ebc980f154 | ||
|
|
d44735e969 | ||
|
|
3916aa0211 | ||
|
|
28267a5490 | ||
|
|
1bc27e05b2 | ||
|
|
4edcb7dad7 | ||
|
|
e6862591e8 | ||
|
|
2c3b95ddca | ||
|
|
fd5449d2de | ||
|
|
2f88a7e2e8 | ||
|
|
1f7dcde3f9 | ||
|
|
131b6c4983 | ||
|
|
03d814e211 | ||
|
|
be08678390 | ||
|
|
724326b309 | ||
|
|
3b50040cde | ||
|
|
28f1fbbc6a | ||
|
|
1fd58e846e | ||
|
|
3e9992598a | ||
|
|
fbb40d4a7e | ||
|
|
05fc329eb3 | ||
|
|
415fb7d8fc | ||
|
|
0f25d34076 | ||
|
|
07b808dc30 | ||
|
|
84b54d395a | ||
|
|
c80954862b | ||
|
|
6d8bab3588 | ||
|
|
90ecbb9a74 | ||
|
|
7143cd2a72 | ||
|
|
cffc52ae0a | ||
|
|
b62dc10967 | ||
|
|
0af9ee5e95 | ||
|
|
27c748ad89 | ||
|
|
e91efce7db | ||
|
|
46e2025699 | ||
|
|
11edd2a030 | ||
|
|
02b1e0e15e | ||
|
|
c7d947fc03 | ||
|
|
2106057d13 | ||
|
|
46c2464bb4 | ||
|
|
3b3383ef4b | ||
|
|
0abc18ef10 | ||
|
|
c154e24cf3 | ||
|
|
b956f1690a | ||
|
|
087dc66617 | ||
|
|
087c34a67d | ||
|
|
0b30335044 | ||
|
|
dd23959f41 | ||
|
|
3a7e5780b6 | ||
|
|
98fbcd1712 | ||
|
|
f3a1812eff | ||
|
|
e2d666785a | ||
|
|
e0c2338531 | ||
|
|
08cfe7c4c2 | ||
|
|
58d5b5c02b | ||
|
|
b5164c333c | ||
|
|
487df8ffc4 | ||
|
|
84182aa9c1 | ||
|
|
dc68f34960 | ||
|
|
d39074c831 | ||
|
|
5e54cabc80 | ||
|
|
d59e70d08a | ||
|
|
8020cafac4 | ||
|
|
7fd6ffae14 | ||
|
|
9a8df0ea4e | ||
|
|
199ab432f0 | ||
|
|
c897693363 | ||
|
|
ea623bbb16 | ||
|
|
08d7105a94 | ||
|
|
5b8a260deb | ||
|
|
79a658c8db | ||
|
|
3d796dec56 | ||
|
|
8a824c23af | ||
|
|
37d4185cbe | ||
|
|
8921ccf093 | ||
|
|
165ad9ecb0 | ||
|
|
1d3c2fd049 | ||
|
|
04615fb22c | ||
|
|
c7dbd48709 | ||
|
|
b2929100ba | ||
|
|
e5653427e0 | ||
|
|
2adc3699c6 | ||
|
|
0563565f80 | ||
|
|
51ee0fea1c | ||
|
|
5ff48c456c | ||
|
|
9fd19c908d | ||
|
|
7ebedec7b8 | ||
|
|
7b4aed0abe | ||
|
|
b6c34b8363 | ||
|
|
7d7221cd74 | ||
|
|
4f5afa8bef | ||
|
|
d8b728eebe | ||
|
|
035e2632a5 | ||
|
|
0845c19dd6 | ||
|
|
460eb6c6d6 | ||
|
|
1bb3132896 | ||
|
|
a233635d80 | ||
|
|
bb4af376d3 | ||
|
|
e835681bf7 | ||
|
|
2599e8d6be | ||
|
|
a1ff0cbee5 | ||
|
|
4deb53bb22 | ||
|
|
7eab0a76aa | ||
|
|
6893755bd4 | ||
|
|
a262337abd | ||
|
|
7d4c42822f | ||
|
|
e44e113190 | ||
|
|
a448cf0af8 | ||
|
|
0ce038a616 | ||
|
|
f9f08a69a6 | ||
|
|
3218989811 | ||
|
|
f775c6cfeb | ||
|
|
41572b1834 | ||
|
|
18c0fd6be7 | ||
|
|
8ac592d217 | ||
|
|
97dfaf6dcd | ||
|
|
0e6104e790 | ||
|
|
1acaab0b75 | ||
|
|
4eff8d066a | ||
|
|
300c5d06f9 | ||
|
|
0aecc50549 | ||
|
|
09bf45b307 | ||
|
|
02bfd3c8c7 | ||
|
|
07844d61d9 | ||
|
|
0effeb9b00 | ||
|
|
a5dfc573dd | ||
|
|
b6e236eda0 | ||
|
|
fb592fdab5 | ||
|
|
4cc0bc55d2 | ||
|
|
6c4c92f26b | ||
|
|
f198f93ac2 | ||
|
|
82fd1c074e | ||
|
|
04ac48c9db | ||
|
|
2947f9fe97 | ||
|
|
8796112363 | ||
|
|
bd0681a437 | ||
|
|
4feb2f109b | ||
|
|
765b9acb1c | ||
|
|
bdeebe80e0 | ||
|
|
df9f458a6f | ||
|
|
ee7a61974b | ||
|
|
b4887ae836 | ||
|
|
ca23e700c8 | ||
|
|
2a4b9097c3 | ||
|
|
97a45542f3 | ||
|
|
226b21d32a | ||
|
|
5b49d406c9 | ||
|
|
6dd412364b | ||
|
|
55b9ce4c7d | ||
|
|
0acdf51077 | ||
|
|
a92d429ab3 | ||
|
|
7eccc8674b | ||
|
|
b61e04dcfc | ||
|
|
dd7c6d0a85 | ||
|
|
79469f2047 | ||
|
|
0ea6626435 | ||
|
|
bde9b78a60 | ||
|
|
53498f0d54 | ||
|
|
ccdc37dbc3 | ||
|
|
746e62226f | ||
|
|
784baa5a2a | ||
|
|
849c34c7fe | ||
|
|
008252f3c8 | ||
|
|
d24bd20919 | ||
|
|
34acc37961 | ||
|
|
b2111f7d8b | ||
|
|
ab9faff55b | ||
|
|
aaa2cb8fd7 | ||
|
|
9336144892 | ||
|
|
131eda9dfb | ||
|
|
f2a3f84180 | ||
|
|
629bb9e576 | ||
|
|
56d311ebdb | ||
|
|
139d812c0b | ||
|
|
a373f7bf8e | ||
|
|
1bb6012cd8 | ||
|
|
426b785b21 | ||
|
|
8ec9023112 | ||
|
|
4edf912ecd | ||
|
|
07c01a6777 | ||
|
|
fbd2a6eb82 | ||
|
|
f4f7a9d5a1 | ||
|
|
d1cdd26176 | ||
|
|
f82ce2acad | ||
|
|
58d974184f | ||
|
|
eebdb0e9f0 | ||
|
|
18a65f3b39 | ||
|
|
1d4a84dcca | ||
|
|
69f3919b52 | ||
|
|
96d426f52c | ||
|
|
b460703cdd | ||
|
|
b7b010f97c | ||
|
|
fdc1184ea0 | ||
|
|
51c5fb44ee | ||
|
|
ffbb46ba52 | ||
|
|
d025969c82 | ||
|
|
c9f3fb8053 | ||
|
|
9c2d6c3a30 | ||
|
|
efda298a11 | ||
|
|
fec5edd021 | ||
|
|
ede4cd526e | ||
|
|
8ac9610d66 | ||
|
|
838790a6a1 | ||
|
|
cef398b417 | ||
|
|
f09dbd2f49 | ||
|
|
46b8d41998 | ||
|
|
695ca69da6 | ||
|
|
84fe358011 | ||
|
|
c4b363da3d | ||
|
|
3177e2a51d | ||
|
|
46cea84d7d | ||
|
|
753637609d | ||
|
|
4861e96ddc | ||
|
|
2003772ddf | ||
|
|
8c76a62230 | ||
|
|
3511a426de | ||
|
|
9f8da17db1 | ||
|
|
4eff74e5b1 | ||
|
|
fdb89a6d4e | ||
|
|
8a73d922e0 | ||
|
|
36084974d1 | ||
|
|
27027dbdfa | ||
|
|
d828cdb078 | ||
|
|
a778ff84d9 | ||
|
|
95133cfeae | ||
|
|
4f7ba196c3 | ||
|
|
e4644f7d2f | ||
|
|
12846c9689 | ||
|
|
4fef683612 | ||
|
|
a0547bee50 | ||
|
|
9f0e6e104c | ||
|
|
e0b67b1523 | ||
|
|
31520afb37 | ||
|
|
bf30c84b4f | ||
|
|
5c6f654762 | ||
|
|
127d3a670c | ||
|
|
58d001744e | ||
|
|
0d3a7ba48f | ||
|
|
9b8686778d | ||
|
|
61489e4890 | ||
|
|
16bccd9876 | ||
|
|
30fcea747b | ||
|
|
44aec32649 | ||
|
|
3cfcffbe16 | ||
|
|
3bec98b7ce | ||
|
|
889313fe36 | ||
|
|
9db5f5a43b | ||
|
|
d3f038b1ce | ||
|
|
46d0fd2e5c | ||
|
|
2503f2bc68 | ||
|
|
de8634bf29 | ||
|
|
2e3fe293e6 | ||
|
|
c1cb1ee978 | ||
|
|
fc61ff8ea2 | ||
|
|
285628a293 | ||
|
|
8e906402fb | ||
|
|
cf0a248ae1 | ||
|
|
f232eacbb4 | ||
|
|
c52f79cbaa | ||
|
|
0978c10dca | ||
|
|
b697fdc2c7 | ||
|
|
5c37d751c7 | ||
|
|
07982cfebd | ||
|
|
ca21c9bcca | ||
|
|
fbeed8083f | ||
|
|
9ae8ca3ba8 | ||
|
|
b70d6b6b7f | ||
|
|
d6dbbf194f | ||
|
|
fe134e2587 | ||
|
|
b3539e6f27 | ||
|
|
3f06c13ff8 | ||
|
|
036f1c55ae | ||
|
|
bba94660d7 | ||
|
|
0963e88112 | ||
|
|
bbb48127ff | ||
|
|
88acc9e83d | ||
|
|
38a7710387 | ||
|
|
9a7318942c | ||
|
|
48bb385211 | ||
|
|
cb897863f6 | ||
|
|
d25f8e934c | ||
|
|
5d75c247be | ||
|
|
f08fdd0548 | ||
|
|
06f793cf59 | ||
|
|
8b61cac331 | ||
|
|
807a3d472d | ||
|
|
4a71452841 | ||
|
|
d5b6d2fe60 | ||
|
|
ac7d449584 | ||
|
|
e9bc53cb6d | ||
|
|
990907fdb1 | ||
|
|
a4ca4ffda9 | ||
|
|
8e9c648f0e | ||
|
|
b2231e3392 | ||
|
|
70075152df | ||
|
|
d8000250dc | ||
|
|
37299f8758 | ||
|
|
bdd747fe2a | ||
|
|
e71ade9573 | ||
|
|
b77b8e55e5 | ||
|
|
222af5e23c | ||
|
|
0014167468 | ||
|
|
56a83bb8d7 | ||
|
|
fe71d9ea1c | ||
|
|
565b8fa7f9 | ||
|
|
b71f0b0a9f | ||
|
|
abe9affa44 | ||
|
|
e20508d46e | ||
|
|
6427fdd609 | ||
|
|
5c86b4b875 | ||
|
|
c3f870e51e | ||
|
|
b99f1d4776 | ||
|
|
0d13aed500 | ||
|
|
5a1ea3c186 | ||
|
|
2c8c319657 | ||
|
|
26a20755e1 | ||
|
|
e29d802c08 | ||
|
|
a84e87f5e7 | ||
|
|
6662457428 | ||
|
|
95ea200ede | ||
|
|
3ded8b574a | ||
|
|
d11582f39f | ||
|
|
eedee9e6ee | ||
|
|
0a768d8804 | ||
|
|
0ff3492415 | ||
|
|
a4d4e39257 | ||
|
|
89ab18ea6c | ||
|
|
332592d998 | ||
|
|
6a931760d6 | ||
|
|
f0a509fb6f | ||
|
|
f096131e12 | ||
|
|
8240390a8b | ||
|
|
80c8f03b24 | ||
|
|
39a89f6361 | ||
|
|
74cad75e74 | ||
|
|
376e929d96 | ||
|
|
d370b5d5fe | ||
|
|
e2ac3ff4e4 | ||
|
|
1c233d21c4 | ||
|
|
b7cca46076 | ||
|
|
bfacd31911 | ||
|
|
714e8e5511 | ||
|
|
0179825ff8 | ||
|
|
3fa5aa028a | ||
|
|
6192e7d02b | ||
|
|
e5c48504cd | ||
|
|
9b1bd1c70a | ||
|
|
5be311282e | ||
|
|
bb2325babc | ||
|
|
60fd50a3e5 | ||
|
|
4efef06aaa | ||
|
|
2bad5258e2 | ||
|
|
7941a599e9 | ||
|
|
0066d3364e | ||
|
|
7b72b729b8 | ||
|
|
a1d0dc9fea | ||
|
|
abc2e618c7 | ||
|
|
5771ede8a9 | ||
|
|
440d53e544 | ||
|
|
dff100d338 | ||
|
|
0b94d7464e | ||
|
|
ef46443681 | ||
|
|
8821df308b | ||
|
|
af81c25ba1 | ||
|
|
34843fab31 | ||
|
|
d1736e5dd4 | ||
|
|
6b4164e6eb | ||
|
|
2fb57d65df | ||
|
|
dce3780927 | ||
|
|
a0b1eaa804 | ||
|
|
3bfa21ee02 | ||
|
|
7c84863a20 | ||
|
|
ac539eb343 | ||
|
|
5e07116597 | ||
|
|
290261c50e | ||
|
|
f1c28c7258 | ||
|
|
74fd453a53 | ||
|
|
bfd9010ee2 | ||
|
|
eb8c024202 | ||
|
|
b2d0251b7e | ||
|
|
5e85d2c793 | ||
|
|
f54d012cb9 | ||
|
|
10179d1a0b | ||
|
|
43d88575c5 | ||
|
|
3fac78c0f9 | ||
|
|
88e27977e8 | ||
|
|
579def4704 | ||
|
|
3233653381 | ||
|
|
2a455c306a | ||
|
|
39c16790cd | ||
|
|
636ffff7b3 | ||
|
|
61cdb47c00 | ||
|
|
766c33c7b6 | ||
|
|
3bc0df7e4d | ||
|
|
dec2d2fef2 | ||
|
|
2ee56d2089 | ||
|
|
16bf17e9b1 | ||
|
|
66d4e9b298 | ||
|
|
15a333fd39 | ||
|
|
2c2b3c5b19 | ||
|
|
8eea7e49c5 | ||
|
|
bce6a6f259 | ||
|
|
676a470d2d | ||
|
|
c7db6347f9 | ||
|
|
45528c282d | ||
|
|
7b31ad3417 | ||
|
|
9842cb962e | ||
|
|
4edf48b2e5 | ||
|
|
9d58a1c5be | ||
|
|
b73377eb6a | ||
|
|
2394480583 | ||
|
|
e09b984a15 | ||
|
|
6a09f44a09 | ||
|
|
79f69ae511 | ||
|
|
defeedcd82 | ||
|
|
9b463e0a05 | ||
|
|
bda15f1074 | ||
|
|
7d3d40ab37 | ||
|
|
59ed067254 | ||
|
|
3d6541d337 | ||
|
|
62c3dbd126 | ||
|
|
866ed07d0c | ||
|
|
340a121528 | ||
|
|
76b5c3380a | ||
|
|
e40307f107 | ||
|
|
015dcbcc4f | ||
|
|
6b9612c356 | ||
|
|
a0513fcfac | ||
|
|
79fce90bf8 | ||
|
|
81793fc040 | ||
|
|
b3673409ac | ||
|
|
2fa55fe15d | ||
|
|
a1141d2574 | ||
|
|
6ba037ab4d | ||
|
|
011d953ffc | ||
|
|
cd88fd3c51 | ||
|
|
08105aa96d | ||
|
|
ba1fb36627 | ||
|
|
b459e7149e | ||
|
|
d20030ae98 | ||
|
|
0a566e4954 | ||
|
|
521dc3fc71 | ||
|
|
a781c316d3 | ||
|
|
ac01713331 | ||
|
|
70204e9047 | ||
|
|
48ace472a8 | ||
|
|
0ae7f8878d | ||
|
|
cd1b4231ec | ||
|
|
b63b4aa50e | ||
|
|
bbc09712c0 | ||
|
|
9e028b6c97 | ||
|
|
8fbe22396f | ||
|
|
e9a8773fdf | ||
|
|
f1c680c978 | ||
|
|
9b5419708a | ||
|
|
8b9f851a39 | ||
|
|
646691e47e | ||
|
|
cedd8f4d93 | ||
|
|
eca68a0504 | ||
|
|
4f9484c31a | ||
|
|
91ea7067f7 | ||
|
|
ae300aa00d | ||
|
|
cc50b58ca2 | ||
|
|
11d427786e | ||
|
|
02edf491c5 | ||
|
|
0f9dd867a9 | ||
|
|
4159c07437 | ||
|
|
2fe6583328 | ||
|
|
dbfea1e38a | ||
|
|
8ed6accb45 | ||
|
|
c9aa40f4ee | ||
|
|
576904acc1 | ||
|
|
f9366249e1 | ||
|
|
cd0d075d8d | ||
|
|
7332589d04 | ||
|
|
0101fde3c0 | ||
|
|
8c7c47251a | ||
|
|
d874df3c2c | ||
|
|
5b33ff3ab6 | ||
|
|
f5c6c96184 | ||
|
|
7e35a6499c | ||
|
|
529ca6a7fc | ||
|
|
3a75653fbb | ||
|
|
655ab65682 | ||
|
|
bffbe8d633 | ||
|
|
1dcf2a42a7 | ||
|
|
846d76f137 | ||
|
|
1ea6833ffe | ||
|
|
5e097de000 | ||
|
|
8a45b1717e | ||
|
|
fad876527a | ||
|
|
5b7fe1c7e9 | ||
|
|
6ee884772b | ||
|
|
69ea005af3 | ||
|
|
7caca829a1 | ||
|
|
d59144c549 | ||
|
|
2b245d291d | ||
|
|
a1e1df535a | ||
|
|
bdb49d8395 | ||
|
|
a3523789d1 | ||
|
|
39aca97640 | ||
|
|
04e454b3e0 | ||
|
|
4190e3c421 | ||
|
|
f19d49bf95 | ||
|
|
559ea25856 | ||
|
|
88b6ceb4d0 | ||
|
|
b126016538 | ||
|
|
06454db032 | ||
|
|
1d11f4c1a4 | ||
|
|
a17e997e38 | ||
|
|
df7207dfb0 | ||
|
|
a05a141fea | ||
|
|
4e52dba787 | ||
|
|
dc0751b1e2 |
@@ -2,29 +2,25 @@ FROM mcr.microsoft.com/devcontainers/base:ubuntu
|
||||
|
||||
USER vscode
|
||||
|
||||
ENV CONDA_DIR=/home/vscode/miniconda
|
||||
ENV PATH="$CONDA_DIR/bin:$PATH"
|
||||
ENV PATH="/home/vscode/.local/bin:${PATH}"
|
||||
|
||||
ARG PYTHON_VERSION=3.12
|
||||
ARG PYTHON_VERSION=3.12.11
|
||||
ARG NODEJS_VERSION=24
|
||||
|
||||
# Install Miniconda
|
||||
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh \
|
||||
&& bash ~/miniconda.sh -b -p $CONDA_DIR \
|
||||
&& rm ~/miniconda.sh \
|
||||
&& conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main \
|
||||
&& conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
|
||||
# Install and setup mise and uv
|
||||
RUN curl https://mise.run | sh
|
||||
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
|
||||
# Configure conda environment
|
||||
RUN eval "$(conda shell.bash hook)" \
|
||||
&& conda create -n maa \
|
||||
&& conda activate maa \
|
||||
&& conda install -y \
|
||||
python=$PYTHON_VERSION \
|
||||
conda-forge::nodejs=$NODEJS_VERSION \
|
||||
&& pip install pre-commit black isort
|
||||
# Activate mise
|
||||
RUN echo 'eval "$(mise activate bash)"' >> ~/.bashrc
|
||||
|
||||
# Finalize conda setup
|
||||
RUN conda init \
|
||||
&& conda config --set auto_activate false \
|
||||
&& echo "conda activate maa" >> ~/.bashrc
|
||||
# Setup Python and Node.js
|
||||
RUN mise use -g node@$NODEJS_VERSION
|
||||
RUN uv python install $PYTHON_VERSION
|
||||
|
||||
# Create and activate venv
|
||||
RUN uv venv --clear ~/.venv/maa
|
||||
RUN echo "source ~/.venv/maa/bin/activate" >> ~/.bashrc
|
||||
|
||||
# Install tools
|
||||
RUN uv tool install prek
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"nekosu.maa-support",
|
||||
"ms-python.python",
|
||||
"ms-python.black-formatter",
|
||||
"ms-python.isort",
|
||||
"esbenp.prettier-vscode",
|
||||
"DavidAnson.vscode-markdownlint",
|
||||
"yzhang.markdown-all-in-one",
|
||||
@@ -31,26 +28,13 @@
|
||||
"mkxml.vscode-filesize"
|
||||
],
|
||||
"settings": {
|
||||
// Color theme
|
||||
"workbench.colorTheme": "Default Dark Modern",
|
||||
|
||||
// Editor formatting
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
|
||||
// Language-specific formatting
|
||||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": "explicit"
|
||||
}
|
||||
},
|
||||
|
||||
// Python formatting and linting
|
||||
"isort.args": ["--profile", "black"],
|
||||
|
||||
// Python runtime
|
||||
"python.terminal.launchArgs": ["-u"],
|
||||
"python.defaultInterpreterPath": "/home/vscode/miniconda/envs/maa/bin/python",
|
||||
"python.terminal.activateEnvironment": false,
|
||||
|
||||
// Performance optimizations
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#!/bin/bash
|
||||
WORKSPACE=$(pwd)
|
||||
|
||||
# conda activate maa
|
||||
echo "===================="
|
||||
cd "$WORKSPACE"
|
||||
echo "Setting up git safe.directory..."
|
||||
git config --global --add safe.directory "$WORKSPACE"
|
||||
git submodule foreach --recursive 'git config --global --add safe.directory "$toplevel/$path"'
|
||||
|
||||
echo "===================="
|
||||
cd "$WORKSPACE"
|
||||
echo "Setting up git safe.directory for $WORKSPACE and its submodules..."
|
||||
git config --global --add safe.directory "$WORKSPACE"
|
||||
git submodule foreach --recursive 'git config --global --add safe.directory "$toplevel/$path"'
|
||||
echo "Updating submodules..."
|
||||
git submodule update --init --recursive
|
||||
|
||||
echo "===================="
|
||||
cd "$WORKSPACE"/docs
|
||||
|
||||
@@ -2,38 +2,51 @@ FROM mcr.microsoft.com/devcontainers/base:ubuntu
|
||||
|
||||
USER vscode
|
||||
|
||||
ENV CONDA_DIR=/home/vscode/miniconda
|
||||
ENV PATH="$CONDA_DIR/bin:$PATH"
|
||||
ENV PATH="/home/vscode/.local/bin:${PATH}"
|
||||
|
||||
ARG CLANGD_VERSION=20
|
||||
ARG PYTHON_VERSION=3.12
|
||||
ARG PYTHON_VERSION=3.12.11
|
||||
ARG NODEJS_VERSION=24
|
||||
|
||||
# Add kitware's apt repository (for cmake)
|
||||
RUN curl -fsSL https://apt.kitware.com/keys/kitware-archive-latest.asc | sudo gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg
|
||||
RUN cat <<EOF | sudo tee /etc/apt/sources.list.d/kitware.sources
|
||||
Types: deb
|
||||
URIs: https://apt.kitware.com/ubuntu
|
||||
Suites: $(lsb_release -cs)
|
||||
Components: main
|
||||
Architectures: $(dpkg --print-architecture)
|
||||
Signed-By: /usr/share/keyrings/kitware-archive-keyring.gpg
|
||||
EOF
|
||||
|
||||
# Install system dependencies
|
||||
RUN sudo apt update \
|
||||
&& sudo apt upgrade -y \
|
||||
&& sudo apt install -y \
|
||||
cmake clangd-${CLANGD_VERSION}
|
||||
cmake \
|
||||
fish \
|
||||
&& sudo rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-${CLANGD_VERSION} 100
|
||||
# Initialize fish
|
||||
RUN fish -c exit
|
||||
|
||||
# Install Miniconda
|
||||
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh \
|
||||
&& bash ~/miniconda.sh -b -p ${CONDA_DIR} \
|
||||
&& rm ~/miniconda.sh \
|
||||
&& conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main \
|
||||
&& conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
|
||||
# Install and setup mise and uv
|
||||
RUN curl https://mise.run | sh
|
||||
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
|
||||
# Configure conda environment
|
||||
RUN eval "$(conda shell.bash hook)" \
|
||||
&& conda create -n maa \
|
||||
&& conda activate maa \
|
||||
&& conda install -y \
|
||||
python=${PYTHON_VERSION} \
|
||||
conda-forge::nodejs=${NODEJS_VERSION} \
|
||||
&& pip install pre-commit black isort
|
||||
# Activate mise
|
||||
RUN echo 'eval "$(mise activate bash)"' >> ~/.bashrc
|
||||
RUN echo 'mise activate fish | source' >> ~/.config/fish/config.fish
|
||||
|
||||
# Finalize conda setup
|
||||
RUN conda init \
|
||||
&& conda config --set auto_activate false \
|
||||
&& echo "conda activate maa" >> ~/.bashrc
|
||||
# Setup Python and Node.js
|
||||
RUN mise use -g node@$NODEJS_VERSION
|
||||
RUN uv python install $PYTHON_VERSION
|
||||
|
||||
# Create and activate venv
|
||||
RUN uv venv --clear ~/.venv/maa
|
||||
RUN echo "source ~/.venv/maa/bin/activate" >> ~/.bashrc
|
||||
RUN echo "source ~/.venv/maa/bin/activate.fish" >> ~/.config/fish/config.fish
|
||||
|
||||
# Install tools
|
||||
RUN uv tool install prek
|
||||
RUN uv tool install ruff
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
"xaver.clang-format",
|
||||
"llvm-vs-code-extensions.vscode-clangd",
|
||||
"ms-python.python",
|
||||
"ms-python.black-formatter",
|
||||
"ms-python.isort",
|
||||
"charliermarsh.ruff",
|
||||
"esbenp.prettier-vscode",
|
||||
"DavidAnson.vscode-markdownlint",
|
||||
"yzhang.markdown-all-in-one",
|
||||
@@ -34,13 +33,16 @@
|
||||
"mkxml.vscode-filesize"
|
||||
],
|
||||
"settings": {
|
||||
// Color theme
|
||||
"workbench.colorTheme": "Default Dark Modern",
|
||||
|
||||
// Editor formatting
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
|
||||
// Language-specific formatting
|
||||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||
"editor.defaultFormatter": "charliermarsh.ruff",
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": "explicit"
|
||||
}
|
||||
@@ -52,19 +54,12 @@
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
},
|
||||
|
||||
// Python formatting and linting
|
||||
"isort.args": ["--profile", "black"],
|
||||
|
||||
// Python runtime
|
||||
"python.terminal.launchArgs": ["-u"],
|
||||
"python.defaultInterpreterPath": "/home/vscode/miniconda/envs/maa/bin/python",
|
||||
"python.defaultInterpreterPath": "/home/vscode/.venv/maa/bin/python",
|
||||
"python.terminal.activateEnvironment": false,
|
||||
|
||||
// CMake settings
|
||||
"cmake.configureSettings": {
|
||||
"BUILD_DEBUG_DEMO": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "MaaDeps/cmake/maa-x64-linux-toolchain.cmake"
|
||||
},
|
||||
"cmake.configureOnOpen": false,
|
||||
|
||||
// Performance optimizations
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#!/bin/bash
|
||||
WORKSPACE=$(pwd)
|
||||
|
||||
# conda activate maa
|
||||
echo "===================="
|
||||
cd "$WORKSPACE"
|
||||
echo "Setting up git safe.directory..."
|
||||
git config --global --add safe.directory "$WORKSPACE"
|
||||
git submodule foreach --recursive 'git config --global --add safe.directory "$toplevel/$path"'
|
||||
|
||||
echo "===================="
|
||||
cd "$WORKSPACE"
|
||||
echo "Setting up git safe.directory for $WORKSPACE and its submodules..."
|
||||
git config --global --add safe.directory "$WORKSPACE"
|
||||
git submodule foreach --recursive 'git config --global --add safe.directory "$toplevel/$path"'
|
||||
echo "Updating submodules..."
|
||||
git submodule update --init --recursive
|
||||
|
||||
echo "===================="
|
||||
cd "$WORKSPACE"/docs
|
||||
@@ -22,14 +25,14 @@ echo "Installing Python dependencies..."
|
||||
for req_file in tools/*/requirements.txt; do
|
||||
if [ -f "$req_file" ]; then
|
||||
echo "Installing from $req_file"
|
||||
pip install -r "$req_file"
|
||||
uv pip install -r "$req_file"
|
||||
fi
|
||||
done
|
||||
|
||||
for req_file in tools/*/requirements-dev.txt; do
|
||||
if [ -f "$req_file" ]; then
|
||||
echo "Installing from $req_file"
|
||||
pip install -r "$req_file"
|
||||
uv pip install -r "$req_file"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -38,5 +41,5 @@ cd "$WORKSPACE"
|
||||
echo "Installing MaaDeps..."
|
||||
python tools/maadeps-download.py
|
||||
# Link clang-format & clangd to /usr/local/bin for easy access
|
||||
sudo ln -s $WORKSPACE/MaaDeps/x-tools/llvm/bin/clang-format /usr/local/bin/clang-format
|
||||
# sudo ln -s $WORKSPACE/MaaDeps/x-tools/llvm/bin/clangd /usr/local/bin/clangd
|
||||
sudo ln -s $WORKSPACE/src/MaaUtils/MaaDeps/x-tools/llvm/bin/clang-format /usr/local/bin/clang-format
|
||||
sudo ln -s $WORKSPACE/src/MaaUtils/MaaDeps/x-tools/llvm/bin/clangd /usr/local/bin/clangd
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
{
|
||||
"name": "Plain Env (Nothing Installed)",
|
||||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
|
||||
"postCreateCommand": "git config --global --add safe.directory \"$(pwd)\" && git submodule foreach --recursive 'git config --global --add safe.directory \"$toplevel/$path\"'"
|
||||
"postCreateCommand": "bash .devcontainer/post-create.sh",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
// Color theme
|
||||
"workbench.colorTheme": "Default Dark Modern"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
.devcontainer/post-create.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
WORKSPACE=$(pwd)
|
||||
|
||||
echo "===================="
|
||||
cd "$WORKSPACE"
|
||||
echo "Setting up git safe.directory..."
|
||||
git config --global --add safe.directory "$WORKSPACE"
|
||||
git submodule foreach --recursive 'git config --global --add safe.directory "$toplevel/$path"'
|
||||
|
||||
echo "===================="
|
||||
cd "$WORKSPACE"
|
||||
echo "Updating submodules..."
|
||||
git submodule update --init --recursive
|
||||
@@ -46,9 +46,13 @@ e3d63894b28b2ef5e2405e144a32a6981de5e1b2
|
||||
# refactor: divide tasks.json into multiple jsons
|
||||
dce6e317c8e56836662b64ac4b3d1a69b4ff4dd8
|
||||
|
||||
# c# 统一使用文件范围限定的 namespace
|
||||
76252d42e3febae1aef396e8ee5482fa46d565c6
|
||||
|
||||
# usage: add "[blame ignore]" to the commit message
|
||||
# This file is managed by an automated workflow
|
||||
# Do not add, remove or modify lines below this comment
|
||||
# as they are automatically appended
|
||||
# --------------------------------------------------- #
|
||||
f7772bc814c52f9a5e65af02404cf54b70fe0a32
|
||||
ca9807ce099e5cae133293df8dfcd2b56b0e06bd
|
||||
|
||||
2
.github/.last-blame-ignore-commit
vendored
@@ -1 +1 @@
|
||||
272d71fa2938f945832f86232532b86a9e5406b8
|
||||
1944164d9c47549d71c3b25987e9299404cc16f3
|
||||
|
||||
20
.github/ISSUE_TEMPLATE/cn-bug-report.yaml
vendored
@@ -41,11 +41,9 @@ body:
|
||||
attributes:
|
||||
label: 日志和配置文件
|
||||
description: |
|
||||
**请在 MAA -> 设置 -> 问题反馈中找到生成日志压缩包按钮,点击并上传压缩包**
|
||||
|
||||
**请直接将完整的文件拖拽进来,而非自己裁切或复制的片段;若文件体积过大可压缩后再上传**
|
||||
|
||||
如果你在使用 MacBook,请点击屏幕左上角的“文件”,点击“打开日志文件夹”
|
||||
**请在 MAA -> 设置 -> 问题反馈中找到生成日志压缩包按钮,点击并上传压缩包**
|
||||
**若待上传压缩包大于 25MB,请转而上传该压缩包同日期文件夹中的若干小压缩包**
|
||||
若正在使用 macOS,请点击屏幕左上角的“文件”,点击“打开日志文件夹”
|
||||
placeholder: |
|
||||
请确认上传文件前已关闭 MAA
|
||||
validations:
|
||||
@@ -55,8 +53,8 @@ body:
|
||||
attributes:
|
||||
label: 配置信息
|
||||
description: |
|
||||
请说明操作系统及版本、模拟器品牌、模拟器分辨率、DPI、帧率;
|
||||
若正在使用 MuMu 或雷电 9,请说明截图增强是否开启;
|
||||
请说明操作系统及版本、模拟器品牌、模拟器分辨率、DPI、帧率
|
||||
若正在使用 MuMu 或雷电 9,请说明截图增强是否开启
|
||||
最后请说明 GPU 加速推理是否开启,若开启请提供 GPU 型号。
|
||||
validations:
|
||||
required: true
|
||||
@@ -65,11 +63,9 @@ body:
|
||||
attributes:
|
||||
label: 截图或录屏
|
||||
description: |
|
||||
`debug` 目录下按功能分类的文件夹内,有一些自动截图的错误图片,若有相关的,请一并打包上传
|
||||
|
||||
可上传屏幕截图或录制以帮助解释你的问题,包括但不限于 MAA 软件截图、游戏画面截图
|
||||
若是**识别相关问题**,请尽可能提供模拟器自带的截图工具截取的无遮挡的**原图**(或通过 adb 截取原图)
|
||||
用其他的工具(如QQ/微信)截取的图片包含窗口边框且长宽比、分辨率不固定,不利于我们排除bug
|
||||
可上传屏幕截图或录制以帮助解释你的问题,包括但不限于 MAA 软件截图、游戏画面截图
|
||||
若是**识别相关问题**,请尽可能提供模拟器自带的截图工具截取的无遮挡的**原图**(或通过 adb 截取原图)
|
||||
用其他的工具(如QQ/微信)截取的图片包含窗口边框且长宽比、分辨率不固定,不利于我们排除bug
|
||||
若文件体积过大可压缩后再上传
|
||||
validations:
|
||||
required: false
|
||||
|
||||
25
.github/ISSUE_TEMPLATE/en-bug-report.yaml
vendored
@@ -43,11 +43,9 @@ body:
|
||||
attributes:
|
||||
label: Log and config files
|
||||
description: |
|
||||
**Please locate the Generate Support Payload button under MAA Settings -> Issue Report, click the button, and upload the generated zip file**
|
||||
|
||||
**Please drag and drop the full file in, not your own cuttings or copies; compress it before uploading if too large.**
|
||||
|
||||
If you are using MacBook, please click the "File" option in the top-left corner of the screen, then click "Open Log Folder".
|
||||
**Please locate the Generate Support Payload button under MAA Settings -> Issue Report, click the button, and upload the generated zip file**
|
||||
**If the archive to upload is larger than 25MB, please upload smaller archives from the same date folder instead.**
|
||||
If you are using macOS, please click the "File" option in the top-left corner of the screen, then click "Open Log Folder".
|
||||
placeholder: |
|
||||
Please confirm that MAA is not running before uploading files.
|
||||
validations:
|
||||
@@ -57,8 +55,8 @@ body:
|
||||
attributes:
|
||||
label: Configuration information
|
||||
description: |
|
||||
Please specify the operating system and version, emulator brand, emulator resolution, DPI, and frame rate;
|
||||
If you are using MuMu or LDPlayer 9, please specify whether Screenshot Enhancement is enabled;
|
||||
Please specify the operating system and version, emulator brand, emulator resolution, DPI, and frame rate.
|
||||
If you are using MuMu or LDPlayer 9, please specify whether Screenshot Enhancement is enabled.
|
||||
Finally, please specify whether GPU accelerated inference is enabled, and if so, provide the GPU model.
|
||||
validations:
|
||||
required: true
|
||||
@@ -67,22 +65,15 @@ body:
|
||||
attributes:
|
||||
label: Screenshots or recordings
|
||||
description: |
|
||||
In the `debug` directory, within the functionally categorized folders,
|
||||
there are some error images captured automatically.
|
||||
If related to this issue, please upload them together.
|
||||
|
||||
If available, upload screenshots and recordings to help explain your problem,
|
||||
including but not limited to screenshots of MAA software,
|
||||
screenshots of game screens.
|
||||
|
||||
screenshots of game screens.
|
||||
If the problem is **recognition related**, please help by providing
|
||||
the **original image** taken by the emulator's own screenshot tool
|
||||
(or via adb).
|
||||
|
||||
(or via adb).
|
||||
Screenshots taken with other tools may contain the frames of the window/emulator
|
||||
and their aspect ratio and resolution are inconsistent,
|
||||
which makes it harder for us to debug.
|
||||
|
||||
which makes it harder for us to debug.
|
||||
If the file size is too large, you may compress it before uploading.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
1
.github/dependabot.yaml
vendored
@@ -9,6 +9,7 @@ updates:
|
||||
assignees:
|
||||
- AnnAngela
|
||||
- Constrat
|
||||
- lucienshawls
|
||||
groups:
|
||||
github-actions:
|
||||
patterns:
|
||||
|
||||
4
.github/issue-checker.yml
vendored
@@ -252,7 +252,7 @@ labels:
|
||||
# `module: fight`
|
||||
- name: fight
|
||||
content: "module: fight"
|
||||
regexes: "刷图|刷理智|剿灭|刷.{0,6}材料|关卡选择|战斗|作战|[戰戦][鬥闘]|[Ff]ight|[Bb]attle|[Aa]nihilation"
|
||||
regexes: "刷图|理智|剿灭|刷.{0,6}材料|关卡选择|战斗|作战|[戰戦][鬥闘]|[Ff]ight|[Bb]attle|[Aa]nihilation"
|
||||
skip-if:
|
||||
- skip all
|
||||
- skip module
|
||||
@@ -335,7 +335,7 @@ labels:
|
||||
# `MacGui`
|
||||
- name: MacGui
|
||||
content: "client: MacGui"
|
||||
regexes: '/mac(?:book|os|\s*(?:操作系统|系统|电脑|版))|playcover/i'
|
||||
regexes: '(?:[Mm][Aa][Cc](?:[Bb][Oo][Oo][Kk]|[Oo][Ss]|\s*(?:操作系统|系统|电脑|版|[Gg][Uu][Ii]))|[Pp][Ll][Aa][Yy][Cc][Oo][Vv][Ee][Rr]|[Mm][Aa][Cc]\s+[Gg][Uu][Ii])'
|
||||
skip-if:
|
||||
- skip all
|
||||
- skip client
|
||||
|
||||
62
.github/pr_cache_remover.ps1
vendored
@@ -1,38 +1,46 @@
|
||||
$totalClearedSize = 0
|
||||
$cacheList = gh cache list --json id,ref,sizeInBytes | ConvertFrom-Json
|
||||
$prCaches = $cacheList | Where-Object { $_.ref -like "*merge*" }
|
||||
|
||||
if (-not $prCaches) {
|
||||
Write-Output "No PR caches found."
|
||||
exit
|
||||
$branchSet = @{}
|
||||
git ls-remote --heads origin | ForEach-Object {
|
||||
if ($_ -match 'refs/heads/(.+)$') { $branchSet[$matches[1]] = $true }
|
||||
}
|
||||
|
||||
foreach ($cache in $prCaches) {
|
||||
$cacheId = $cache.id
|
||||
$cacheRef = $cache.ref
|
||||
$cacheSizeInBytes = $cache.sizeInBytes
|
||||
foreach ($cache in $cacheList) {
|
||||
$shouldDelete = $false
|
||||
|
||||
if ($cacheRef -match "refs/pull/(\d+)/merge") {
|
||||
if ($cache.ref -match "refs/pull/(\d+)/merge") {
|
||||
$prNumber = $matches[1]
|
||||
|
||||
Write-Host "PR #${prNumber}: " -NoNewline
|
||||
|
||||
$prStatus = gh pr view $prNumber --json state | ConvertFrom-Json
|
||||
|
||||
Write-Host $prStatus.state -NoNewline
|
||||
|
||||
if ($prStatus.state -eq "MERGED" -or $prStatus.state -eq "CLOSED") {
|
||||
Write-Host " -> DELETING"
|
||||
|
||||
gh cache delete $cacheId
|
||||
|
||||
try {
|
||||
$prStatus = (gh pr view $prNumber --json state | ConvertFrom-Json).state
|
||||
Write-Host "$prStatus" -NoNewline
|
||||
$shouldDelete = $prStatus -in @("MERGED", "CLOSED")
|
||||
}
|
||||
catch {
|
||||
Write-Host "NOT FOUND" -NoNewline
|
||||
$shouldDelete = $true
|
||||
}
|
||||
}
|
||||
elseif ($cache.ref -match "refs/heads/(.+)" -and $matches[1] -ne "dev") {
|
||||
$branchName = $matches[1]
|
||||
$exists = $branchSet.ContainsKey($branchName)
|
||||
|
||||
Write-Host "Branch '$branchName': $(if ($exists) { 'EXISTS' } else { 'DELETED' })" -NoNewline
|
||||
$shouldDelete = -not $exists
|
||||
}
|
||||
else {
|
||||
continue
|
||||
}
|
||||
|
||||
$totalClearedSize += $cacheSizeInBytes
|
||||
}
|
||||
else {
|
||||
Write-Host ""
|
||||
}
|
||||
if ($shouldDelete) {
|
||||
Write-Host " -> DELETING"
|
||||
gh cache delete $cache.id
|
||||
$totalClearedSize += $cache.sizeInBytes
|
||||
}
|
||||
else {
|
||||
Write-Host ""
|
||||
}
|
||||
}
|
||||
|
||||
$formattedSize = "{0:N2}" -f ($totalClearedSize / 1MB)
|
||||
Write-Output "Cleared size: $formattedSize MB"
|
||||
Write-Output "Cleared size: $("{0:N2}" -f ($totalClearedSize / 1MB)) MB"
|
||||
|
||||
3
.github/stale_cache_cleanup.ps1
vendored
@@ -11,7 +11,8 @@ $keyPatterns = @(
|
||||
"macOS-arm64-maadeps",
|
||||
"Linux-x64-maadeps",
|
||||
"Linux-arm64-maadeps",
|
||||
"Smoke-testing"
|
||||
"Smoke-testing",
|
||||
"prek-v1|Linux|X64"
|
||||
)
|
||||
|
||||
# Filter caches matching any of our key patterns
|
||||
|
||||
3
.github/stale_cache_dev.ps1
vendored
@@ -19,7 +19,8 @@ $keyPatterns = @(
|
||||
"macOS-arm64-maadeps",
|
||||
"Linux-x64-maadeps",
|
||||
"Linux-arm64-maadeps",
|
||||
"Smoke-testing"
|
||||
"Smoke-testing",
|
||||
"prek-v1|Linux|X64"
|
||||
)
|
||||
|
||||
foreach ($pattern in $keyPatterns) {
|
||||
|
||||
3
.github/workflows/blame-ignore.yml
vendored
@@ -13,13 +13,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false # Needed to bypass protection rules in Push changes
|
||||
|
||||
- name: Check blame
|
||||
id: check_changes
|
||||
continue-on-error: true
|
||||
run: |
|
||||
LAST_CHECKED_COMMIT=$(cat .github/.last-blame-ignore-commit 2>/dev/null || git rev-list --max-parents=0 HEAD)
|
||||
|
||||
|
||||
218
.github/workflows/ci.yml
vendored
@@ -4,18 +4,6 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
branches-ignore:
|
||||
- "master"
|
||||
paths:
|
||||
- ".github/workflows/ci.yml"
|
||||
- "3rdparty/include/**"
|
||||
- "cmake/**"
|
||||
- "CMakeLists.txt"
|
||||
- "include/**"
|
||||
- "src/**"
|
||||
- "tools/maadeps-download.py"
|
||||
- "!**/*.md"
|
||||
pull_request:
|
||||
branches:
|
||||
- "dev"
|
||||
paths:
|
||||
@@ -23,6 +11,18 @@ on:
|
||||
- "3rdparty/include/**"
|
||||
- "cmake/**"
|
||||
- "CMakeLists.txt"
|
||||
- "CMakePresets.json"
|
||||
- "include/**"
|
||||
- "src/**"
|
||||
- "tools/maadeps-download.py"
|
||||
- "!**/*.md"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/ci.yml"
|
||||
- "3rdparty/include/**"
|
||||
- "cmake/**"
|
||||
- "CMakeLists.txt"
|
||||
- "CMakePresets.json"
|
||||
- "include/**"
|
||||
- "src/**"
|
||||
- "tools/maadeps-download.py"
|
||||
@@ -30,24 +30,23 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }}${{ github.ref == 'refs/heads/dev' && format('-{0}', github.sha) || '' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
meta:
|
||||
name: Gather Meta Information
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
tag: ${{ steps.set_tag.outputs.tag }}
|
||||
prerelease: ${{ steps.set_pre.outputs.prerelease }}
|
||||
steps:
|
||||
- name: Show concurrency group
|
||||
run: |
|
||||
echo "Concurrency Group: ${{ github.workflow }}-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }}${{ github.ref == 'refs/heads/dev' && format('-{0}', github.sha) || '' }}"
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
show-progress: false
|
||||
@@ -89,7 +88,7 @@ jobs:
|
||||
echo "[已有 Mirror酱 CDK?前往 Mirror酱 高速下载](https://mirrorchyan.com/zh/projects?rid=MAA&source=maagh-release)" >> CHANGELOG.md
|
||||
|
||||
- name: Upload changelog to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
with:
|
||||
name: changelog
|
||||
@@ -97,11 +96,6 @@ jobs:
|
||||
|
||||
windows:
|
||||
name: Build for Windows
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
|
||||
needs: meta
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -111,20 +105,22 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --depth 1 src/MaaUtils
|
||||
git submodule update --init --depth 1 3rdparty/EmulatorExtras
|
||||
|
||||
- name: Cache MaaDeps
|
||||
id: cache-maadeps
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: |
|
||||
./MaaDeps
|
||||
./src/MaaUtils/MaaDeps
|
||||
key: ${{ runner.os }}-${{ matrix.arch }}-maadeps-${{ hashFiles('tools/maadeps-download.py') }}
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
@@ -134,23 +130,31 @@ jobs:
|
||||
run: |
|
||||
python3 tools/maadeps-download.py ${{ matrix.arch }}-windows
|
||||
|
||||
- name: Config cmake
|
||||
- name: Configure, build and install
|
||||
run: |
|
||||
mkdir -p build
|
||||
cmake -B build ${{ matrix.arch == 'arm64' && '-A ARM64' }} -DCMAKE_BUILD_TYPE=Release -DMAADEPS_TRIPLET='maa-${{ matrix.arch }}-windows' -DINSTALL_RESOURCE=ON -DINSTALL_PYTHON=ON -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' -DBUILD_WPF_GUI=OFF
|
||||
cmake -B build --preset ${{ matrix.arch == 'arm64' && 'windows-publish-arm64' || 'windows-publish-x64' }} -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}'
|
||||
cmake --build --preset ${{ matrix.arch == 'arm64' && 'windows-publish-arm64' || 'windows-publish-x64' }} --parallel $env:NUMBER_OF_PROCESSORS
|
||||
cmake --install build --config RelWithDebInfo
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build --config Release --parallel $env:NUMBER_OF_PROCESSORS
|
||||
- name: Download MaaFramework
|
||||
if: matrix.arch == 'x64'
|
||||
uses: robinraju/release-downloader@v1
|
||||
with:
|
||||
repository: MaaXYZ/MaaFramework
|
||||
latest: true
|
||||
fileName: '*win-x86_64*.zip'
|
||||
extract: true
|
||||
out-file-path: MaaFramework-temp
|
||||
|
||||
- name: Install
|
||||
- name: Copy MaaWin32ControlUnit
|
||||
if: matrix.arch == 'x64'
|
||||
run: |
|
||||
mkdir -p install
|
||||
cmake --install build --prefix install --config Release
|
||||
cp MaaFramework-temp/bin/*Win32ControlUnit* install/
|
||||
|
||||
- name: Cache .nuke/temp, ~/.nuget/packages
|
||||
id: cache-nuget
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: |
|
||||
.nuke/temp
|
||||
@@ -182,11 +186,24 @@ jobs:
|
||||
- name: Publish WPF GUI
|
||||
continue-on-error: true
|
||||
run: |
|
||||
dotnet publish src/MaaWpfGui/MaaWpfGui.csproj -c Release -o install
|
||||
dotnet publish src/MaaWpfGui/MaaWpfGui.csproj -c Release -p:Platform=${{ matrix.arch == 'arm64' && 'ARM64' || 'x64' }} -o install
|
||||
|
||||
- name: Collect PDB files
|
||||
run: |
|
||||
cp build/bin/RelWithDebInfo/*.pdb install/
|
||||
Compress-Archive -Path install/*.pdb -DestinationPath install/MAAComponent-DebugSymbol-${{ needs.meta.outputs.tag }}-win-${{ matrix.arch }}.zip
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload PDB files
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: MAAComponent-DebugSymbol-win-${{ matrix.arch }}
|
||||
path: install/MAAComponent-DebugSymbol-${{ needs.meta.outputs.tag }}-win-${{ matrix.arch }}.zip
|
||||
|
||||
- name: Organize install files
|
||||
shell: bash
|
||||
run: |
|
||||
rm -rf install/MAAComponent-DebugSymbol-*.zip
|
||||
rm -rf install/*.pdb
|
||||
rm -rf install/msvc-debug
|
||||
rm -rf install/*.h
|
||||
@@ -199,18 +216,13 @@ jobs:
|
||||
Compress-Archive -Destination MAA-${{ needs.meta.outputs.tag }}-win-${{ matrix.arch }}.zip -Path ./*
|
||||
|
||||
- name: Upload MAA to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: MAA-win-${{ matrix.arch }}
|
||||
path: install/*.zip
|
||||
path: install/MAA-*.zip
|
||||
|
||||
ubuntu:
|
||||
name: Build for Ubuntu
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
|
||||
needs: meta
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
@@ -219,20 +231,22 @@ jobs:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --depth 1 src/MaaUtils
|
||||
git submodule update --init --depth 1 3rdparty/EmulatorExtras
|
||||
git submodule update --init --depth 1 src/maa-cli
|
||||
|
||||
- name: Cache MaaDeps
|
||||
id: cache-maadeps
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: ./MaaDeps
|
||||
path: ./src/MaaUtils/MaaDeps
|
||||
key: ${{ runner.os }}-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-maadeps-${{ hashFiles('tools/maadeps-download.py') }}
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
@@ -242,40 +256,25 @@ jobs:
|
||||
run: |
|
||||
python3 tools/maadeps-download.py ${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-linux
|
||||
|
||||
- name: Config cmake
|
||||
- name: Configure, build and install
|
||||
run: |
|
||||
mkdir -p build
|
||||
cmake -B build \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DMAADEPS_TRIPLET='maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-linux' \
|
||||
-DINSTALL_RESOURCE=ON \
|
||||
-DINSTALL_PYTHON=ON \
|
||||
-DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' \
|
||||
-DCMAKE_TOOLCHAIN_FILE=MaaDeps/cmake/maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-linux-toolchain.cmake
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build --config Release --parallel $(nproc)
|
||||
cmake --preset ${{ matrix.arch == 'x86_64' && 'linux-publish-x64' || 'linux-publish-arm64' }} -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}'
|
||||
cmake --build --preset ${{ matrix.arch == 'x86_64' && 'linux-publish-x64' || 'linux-publish-arm64' }} --parallel $(nproc)
|
||||
cmake --install build --config RelWithDebInfo
|
||||
env:
|
||||
CLICOLOR_FORCE: 1
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
mkdir -p install
|
||||
cmake --install build --prefix install --config Release
|
||||
|
||||
- name: Setup cross compile toolchains for CLI
|
||||
uses: ./src/maa-cli/.github/actions/setup
|
||||
with:
|
||||
os: ubuntu-latest
|
||||
target_arch: ${{ matrix.arch }}
|
||||
|
||||
- name: Build CLI
|
||||
run: |
|
||||
cargo build --release --locked --package maa-cli --features vendored-openssl
|
||||
cargo build --release --locked --package maa-cli --features git2/vendored-openssl
|
||||
cp -v target/$CARGO_BUILD_TARGET/release/maa $GITHUB_WORKSPACE/install/maa
|
||||
cargo build --release --locked --package maa-cli --no-default-features \
|
||||
--features git2,vendored-openssl
|
||||
--features git2,git2/vendored-openssl
|
||||
cp -v target/$CARGO_BUILD_TARGET/release/maa $GITHUB_WORKSPACE/appimage-maa
|
||||
working-directory: src/maa-cli
|
||||
|
||||
@@ -322,7 +321,7 @@ jobs:
|
||||
tar czvf $GITHUB_WORKSPACE/release/MAA-${{ needs.meta.outputs.tag }}-linux-${{ matrix.arch }}.tar.gz .
|
||||
|
||||
- name: Upload MAA to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: MAA-linux-${{ matrix.arch }}
|
||||
path: |
|
||||
@@ -331,11 +330,6 @@ jobs:
|
||||
|
||||
macOS-Core:
|
||||
name: Build Core for macOS
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
|
||||
needs: meta
|
||||
runs-on: macos-26
|
||||
strategy:
|
||||
@@ -344,10 +338,14 @@ jobs:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --depth 1 src/MaaUtils
|
||||
|
||||
# ninja 1.13.1 is already installed and up-to-date.
|
||||
# - name: Install dependencies
|
||||
# run: |
|
||||
@@ -355,51 +353,37 @@ jobs:
|
||||
|
||||
- name: Cache MaaDeps
|
||||
id: cache-maadeps
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: ./MaaDeps
|
||||
path: ./src/MaaUtils/MaaDeps
|
||||
key: ${{ runner.os }}-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-maadeps-${{ hashFiles('tools/maadeps-download.py') }}
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
run: |
|
||||
[[ ${{ matrix.arch }} = "arm64" ]] && triplet="arm64-osx" || triplet="x64-osx"
|
||||
python3 tools/maadeps-download.py ${triplet}
|
||||
python3 tools/maadeps-download.py ${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-osx
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Config cmake
|
||||
- name: Configure, build and install
|
||||
run: |
|
||||
cmake -B build -GNinja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.arch }}' \
|
||||
-DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}'
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build --config Release --parallel $(sysctl -n hw.logicalcpu)
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
cmake --install build --prefix install --config Release
|
||||
cmake -B build --preset ${{ matrix.arch == 'x86_64' && 'macos-publish-x64' || 'macos-publish-arm64' }} -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}'
|
||||
cmake --build --preset ${{ matrix.arch == 'x86_64' && 'macos-publish-x64' || 'macos-publish-arm64' }} --parallel $(sysctl -n hw.logicalcpu)
|
||||
cmake --install build --config RelWithDebInfo
|
||||
|
||||
- name: Upload MAA to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: MAACore-macos-${{ matrix.arch }}
|
||||
path: "install/*.dylib"
|
||||
|
||||
macOS-GUI:
|
||||
name: Build GUI for macOS
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
|
||||
needs: [meta, macOS-Core]
|
||||
runs-on: macos-26
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
@@ -414,27 +398,27 @@ jobs:
|
||||
git submodule update --init --depth 1 src/MaaMacGui
|
||||
|
||||
- name: Download MAA (arm64) from GitHub
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: MAACore-macos-arm64
|
||||
path: install-arm64
|
||||
|
||||
- name: Download MAA (x64) from GitHub
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: MAACore-macos-x86_64
|
||||
path: install-x86_64
|
||||
|
||||
- name: Install Developer ID certificate
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: apple-actions/import-codesign-certs@v5
|
||||
uses: apple-actions/import-codesign-certs@v6
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.HGUANDL_SIGN_CERT_P12 }}
|
||||
p12-password: ${{ secrets.HGUANDL_SIGN_CERT_PASSWD }}
|
||||
|
||||
- name: Download provisioning profiles
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: apple-actions/download-provisioning-profiles@v4
|
||||
uses: apple-actions/download-provisioning-profiles@v5
|
||||
with:
|
||||
bundle-id: "com.hguandl.MeoAsstMac"
|
||||
issuer-id: ${{ secrets.HGUANDL_APPSTORE_ISSUER }}
|
||||
@@ -466,7 +450,7 @@ jobs:
|
||||
zip -yrX9 "$name.zip" "$name"
|
||||
|
||||
- name: Upload MAA runtime to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: MAA-macos-runtime-universal
|
||||
path: runtime/MAA-${{ needs.meta.outputs.tag }}-macos-runtime-universal.zip
|
||||
@@ -474,6 +458,7 @@ jobs:
|
||||
- name: Build XCFramework
|
||||
run: |
|
||||
xcodebuild -create-xcframework -library libMaaCore.dylib -headers ../include -output MaaCore.xcframework
|
||||
xcodebuild -create-xcframework -library libMaaUtils.dylib -output MaaUtils.xcframework
|
||||
xcodebuild -create-xcframework -library libfastdeploy_ppocr.dylib -output fastdeploy_ppocr.xcframework
|
||||
xcodebuild -create-xcframework -library libonnxruntime.*.dylib -output ONNXRuntime.xcframework
|
||||
xcodebuild -create-xcframework -library libopencv*.dylib -output OpenCV.xcframework
|
||||
@@ -547,23 +532,19 @@ jobs:
|
||||
working-directory: release
|
||||
|
||||
- name: Upload MAA to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: MAA-macos-universal
|
||||
path: ${{ startsWith(github.ref, 'refs/tags/v') && 'release/MAA*' || 'src/MaaMacGui/MAA.xcarchive/**' }}
|
||||
|
||||
release:
|
||||
name: Publish Release
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: (github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name) && startsWith(github.ref, 'refs/tags/v')
|
||||
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
needs: [meta, windows, ubuntu, macOS-Core, macOS-GUI]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download MAA from GitHub
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
path: assets
|
||||
|
||||
@@ -576,16 +557,19 @@ jobs:
|
||||
find . -type f | while read f; do mv -fvt . $f; done
|
||||
|
||||
- name: Publish release to GitHub
|
||||
uses: softprops/action-gh-release@v2.4.1
|
||||
uses: softprops/action-gh-release@v2.5.0
|
||||
with:
|
||||
body_path: CHANGELOG.md
|
||||
files: |
|
||||
assets/*
|
||||
prerelease: ${{ needs.meta.outputs.prerelease != 'false' }}
|
||||
|
||||
- name: Trigger MirrorChyan-related workflows
|
||||
- name: Trigger release distribution workflows
|
||||
run: |
|
||||
gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan.yml
|
||||
gh workflow run --repo $GITHUB_REPOSITORY release-package-distribution.yml \
|
||||
-f release_tag="${{ needs.meta.outputs.tag }}" \
|
||||
-f mirrorchyan=true \
|
||||
-f winget=${{ needs.meta.outputs.prerelease == 'false' }}
|
||||
gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_release_note.yml
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -596,7 +580,7 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.MISTEOWORKFLOW }}
|
||||
|
||||
- name: Create issue if failed
|
||||
- name: Create issue on failure
|
||||
if: failure()
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
|
||||
56
.github/workflows/codeql-core.yml
vendored
@@ -1,56 +0,0 @@
|
||||
name: CodeQL Code Analysis
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ["dev"]
|
||||
paths:
|
||||
- ".github/workflows/codeql-core.yml"
|
||||
- "3rdparty/include/**"
|
||||
- "cmake/**"
|
||||
- "CMakeLists.txt"
|
||||
- "include/**"
|
||||
- "src/**"
|
||||
- "!**/*.md"
|
||||
- "!**/*.xaml"
|
||||
schedule:
|
||||
- cron: "45 11 * * *" # Runs daily at 11:45 UTC
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
actions: write
|
||||
contents: read
|
||||
packages: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
analyze-manual:
|
||||
name: Analyze MaaCore and MaaWpfGui
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Setup CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: c-cpp,csharp
|
||||
build-mode: manual
|
||||
|
||||
- name: Run CodeQL
|
||||
uses: github/codeql-action/analyze@v4
|
||||
|
||||
- name: Delete old caches
|
||||
shell: pwsh
|
||||
run: |
|
||||
$oldCaches = gh cache list --key codeql --order asc --json key | ConvertFrom-Json | Select-Object -SkipLast 1
|
||||
foreach ($cache in $oldCaches) {
|
||||
if ($cache.key) {
|
||||
Write-Host "Deleting cache: $($cache.key)"
|
||||
gh cache delete $cache.key
|
||||
}
|
||||
}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
37
.github/workflows/codeql-wf.yml
vendored
@@ -1,37 +0,0 @@
|
||||
name: CodeQL Workflow Analysis
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ["dev"]
|
||||
paths:
|
||||
- ".github/**/*.yml"
|
||||
schedule:
|
||||
- cron: "00 12 * * *" # Runs daily at 12:00 UTC
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
actions: write
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
analyze-workflows:
|
||||
name: Analyze GitHub Workflows
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Setup CodeQL for GitHub Actions
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: actions
|
||||
build-mode: none
|
||||
|
||||
- name: Run CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v4
|
||||
with:
|
||||
category: "/language:multi-none"
|
||||
5
.github/workflows/markdown-checker.yml
vendored
@@ -31,12 +31,13 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Cache lychee responses
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: .lycheecache
|
||||
key: lychee-cache
|
||||
|
||||
72
.github/workflows/mirrorchyan.yml
vendored
@@ -1,72 +0,0 @@
|
||||
name: Release Package Distribution
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
mirrorchyan:
|
||||
name: Upload to MirrorChyan
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Upload MAA win x64
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
if: always()
|
||||
with:
|
||||
filetype: latest-release
|
||||
filename: "*MAA-*-win-x64.zip"
|
||||
mirrorchyan_rid: MAA
|
||||
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: win
|
||||
arch: x64
|
||||
|
||||
- name: Upload MAA win arm64
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
if: always()
|
||||
with:
|
||||
filetype: latest-release
|
||||
filename: "*MAA-*-win-arm64.zip"
|
||||
mirrorchyan_rid: MAA
|
||||
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: win
|
||||
arch: arm64
|
||||
|
||||
- name: Upload MAA macos arm64
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
if: always()
|
||||
with:
|
||||
filetype: latest-release
|
||||
filename: "MAA-*-macos-universal.dmg"
|
||||
extra_zip: true
|
||||
mirrorchyan_rid: MAA
|
||||
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: macos
|
||||
arch: arm64
|
||||
|
||||
- name: Upload MAA macos x64
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
if: always()
|
||||
with:
|
||||
filetype: latest-release
|
||||
filename: "MAA-*-macos-universal.dmg"
|
||||
extra_zip: true
|
||||
mirrorchyan_rid: MAA
|
||||
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: macos
|
||||
arch: x64
|
||||
14
.github/workflows/optimize-templates.yml
vendored
@@ -18,18 +18,19 @@ jobs:
|
||||
optimize-png:
|
||||
name: Optimize PNG Images
|
||||
# Skip workflow to prevent double consecutive runs
|
||||
# Skip workflow on PR merges
|
||||
if: github.repository_owner == 'MaaAssistantArknights' && ${{ github.event.head_commit.author.email != '41898282+github-actions[bot]@users.noreply.github.com' }}
|
||||
if: github.repository_owner == 'MaaAssistantArknights' && github.event.head_commit.author.email != '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Skip workflow on PR merges
|
||||
- name: Check if it is a direct push
|
||||
id: check_push
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
|
||||
pr_merge_status=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/commits/${{ github.event.after }}/pulls" | xargs)
|
||||
pr_count=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/commits/${{ github.event.after }}/pulls" \
|
||||
| jq 'length')
|
||||
|
||||
if [[ "$pr_merge_status" == "[ ]" ]]; then
|
||||
if [[ "$pr_count" == "0" ]]; then
|
||||
echo "Direct push detected. Proceeding..."
|
||||
echo "is_pr=False" >> $GITHUB_OUTPUT
|
||||
else
|
||||
@@ -43,7 +44,7 @@ jobs:
|
||||
|
||||
- name: Checkout repository
|
||||
if: steps.check_push.outputs.is_pr != 'True'
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
persist-credentials: false
|
||||
@@ -58,6 +59,7 @@ jobs:
|
||||
# id: cache_python
|
||||
# if: steps.check_push.outputs.is_pr != 'True' && always()
|
||||
# uses: actions/cache@v4
|
||||
# continue-on-error: true
|
||||
# with:
|
||||
# path: ${{ env.pythonLocation }}/lib/python3.11/site-packages
|
||||
# key: ${{ runner.os }}-pip-optimize-templates-${{ hashFiles('./tools/OptimizeTemplates/requirements.txt') }}
|
||||
|
||||
2
.github/workflows/pr-auto-tag.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.MAARELEASE_RELEASE }}
|
||||
|
||||
36
.github/workflows/pre-commit-scheduled.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Scheduled Pre-commit
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# 每天 UTC 21:00 运行(北京时间 5:00)
|
||||
- cron: "0 21 * * *"
|
||||
workflow_dispatch: # 允许手动触发
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
show-progress: false
|
||||
|
||||
- name: Setup and run Prek
|
||||
uses: j178/prek-action@v1
|
||||
id: pre-commit
|
||||
continue-on-error: true
|
||||
with:
|
||||
extra-args: '--all-files'
|
||||
|
||||
- name: Commit and push changes
|
||||
if: steps.pre-commit.outcome == 'failure' && github.repository_owner == 'MaaAssistantArknights'
|
||||
uses: actions-js/push@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
message: "chore: Auto update by pre-commit hooks
|
||||
|
||||
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
|
||||
[skip changelog]"
|
||||
branch: ${{ github.ref }}
|
||||
59
.github/workflows/release-nightly-ota.yml
vendored
@@ -40,7 +40,7 @@ jobs:
|
||||
changelog: ${{ steps.read_changelog.outputs.content }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
# repository: 'MaaAssistantArknights/MaaAssistantArknights'
|
||||
#ref: ${{ inputs.ref }}
|
||||
@@ -53,6 +53,7 @@ jobs:
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --depth 1 src/MaaUtils
|
||||
git submodule update --init --depth 1 3rdparty/EmulatorExtras
|
||||
|
||||
- name: Checkout ref (if provided)
|
||||
@@ -170,10 +171,11 @@ jobs:
|
||||
|
||||
- name: Cache MaaDeps
|
||||
id: cache-maadeps
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: |
|
||||
./MaaDeps
|
||||
./src/MaaUtils/MaaDeps
|
||||
key: ${{ runner.os }}-${{ matrix.arch }}-maadeps-${{ hashFiles('tools/maadeps-download.py') }}
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
@@ -183,23 +185,31 @@ jobs:
|
||||
run: |
|
||||
python3 tools/maadeps-download.py ${{ matrix.arch }}-windows
|
||||
|
||||
- name: Config cmake
|
||||
- name: Configure, build and install
|
||||
run: |
|
||||
mkdir -p build
|
||||
cmake -B build ${{ matrix.arch == 'arm64' && '-A ARM64' }} -DCMAKE_BUILD_TYPE=Release -DMAADEPS_TRIPLET='maa-${{ matrix.arch }}-windows' -DINSTALL_RESOURCE=ON -DINSTALL_PYTHON=ON -DMAA_HASH_VERSION='${{ steps.set_tag.outputs.tag }}' -DBUILD_WPF_GUI=OFF
|
||||
cmake -B build --preset ${{ matrix.arch == 'arm64' && 'windows-publish-arm64' || 'windows-publish-x64' }} -DMAA_HASH_VERSION='${{ steps.set_tag.outputs.tag }}'
|
||||
cmake --build --preset ${{ matrix.arch == 'arm64' && 'windows-publish-arm64' || 'windows-publish-x64' }} --parallel $env:NUMBER_OF_PROCESSORS
|
||||
cmake --install build --config RelWithDebInfo
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build --config Release --parallel $env:NUMBER_OF_PROCESSORS
|
||||
- name: Download MaaFramework
|
||||
if: matrix.arch == 'x64'
|
||||
uses: robinraju/release-downloader@v1
|
||||
with:
|
||||
repository: MaaXYZ/MaaFramework
|
||||
latest: true
|
||||
fileName: '*win-x86_64*.zip'
|
||||
extract: true
|
||||
out-file-path: MaaFramework-temp
|
||||
|
||||
- name: Install
|
||||
- name: Copy MaaWin32ControlUnit
|
||||
if: matrix.arch == 'x64'
|
||||
run: |
|
||||
mkdir -p install
|
||||
cmake --install build --prefix install --config Release
|
||||
cp MaaFramework-temp/bin/*Win32ControlUnit* install/
|
||||
|
||||
- name: Cache .nuke/temp, ~/.nuget/packages
|
||||
id: cache-nuget
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: |
|
||||
.nuke/temp
|
||||
@@ -230,11 +240,24 @@ jobs:
|
||||
|
||||
- name: Publish WPF GUI
|
||||
run: |
|
||||
dotnet publish src/MaaWpfGui/MaaWpfGui.csproj -c Release -o install
|
||||
dotnet publish src/MaaWpfGui/MaaWpfGui.csproj -c Release -p:Platform=${{ matrix.arch == 'arm64' && 'ARM64' || 'x64' }} -o install
|
||||
|
||||
- name: Collect PDB files
|
||||
run: |
|
||||
cp build/bin/RelWithDebInfo/*.pdb install/
|
||||
Compress-Archive -Path install/*.pdb -DestinationPath install/MAAComponent-DebugSymbol-${{ steps.set_tag.outputs.tag }}-win-${{ matrix.arch }}.zip
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload PDB files
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: MAAComponent-DebugSymbol-win-${{ matrix.arch }}
|
||||
path: install/MAAComponent-DebugSymbol-${{ steps.set_tag.outputs.tag }}-win-${{ matrix.arch }}.zip
|
||||
|
||||
- name: Organize install files
|
||||
shell: bash
|
||||
run: |
|
||||
rm -rf install/MAAComponent-DebugSymbol-*.zip
|
||||
rm -rf install/*.pdb
|
||||
rm -rf install/msvc-debug
|
||||
rm -rf install/*.h
|
||||
@@ -242,7 +265,7 @@ jobs:
|
||||
cp tools/DependencySetup_依赖库安装.bat install
|
||||
|
||||
- name: Upload MAA to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: MAA-win-${{ matrix.arch }}
|
||||
path: install
|
||||
@@ -265,7 +288,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout MaaRelease
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: ${{ format('{0}/{1}', github.repository_owner, 'MaaRelease') }}
|
||||
fetch-depth: 0
|
||||
@@ -296,14 +319,14 @@ jobs:
|
||||
echo ${{ needs.build-win-nightly.outputs.tag }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
path: MaaAssistantArknights
|
||||
token: ${{ secrets.MAARELEASE_RELEASE }}
|
||||
show-progress: false
|
||||
|
||||
- name: Download MAA from GitHub
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: MAA-win-${{ matrix.target }}
|
||||
path: ${{ format('{0}/{1}', 'build-ota', needs.build-win-nightly.outputs.tag) }}
|
||||
|
||||
14
.github/workflows/release-ota.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout MaaRelease
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
repository: ${{ format('{0}/{1}', github.repository_owner, 'MaaRelease') }}
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
PUSH_REMOTE: https://github-actions[bot]:${{ secrets.MAARELEASE_RELEASE }}@github.com/${{ github.repository_owner }}/MaaRelease
|
||||
|
||||
- name: Upload release config to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: MaaReleaseConfig
|
||||
path: ./build-ota/config
|
||||
@@ -96,13 +96,13 @@ jobs:
|
||||
- x64
|
||||
steps:
|
||||
- name: Download release config
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: MaaReleaseConfig
|
||||
path: ./MaaReleaseConfig
|
||||
|
||||
- name: Checkout MaaRelease
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
repository: ${{ format('{0}/{1}', github.repository_owner, 'MaaRelease') }}
|
||||
@@ -111,7 +111,7 @@ jobs:
|
||||
token: ${{ secrets.MAARELEASE_RELEASE }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
path: MaaAssistantArknights
|
||||
@@ -139,7 +139,7 @@ jobs:
|
||||
prerelease: ${{ fromJSON(needs.create-tag.outputs.prerelease) }}
|
||||
overwrite: true
|
||||
|
||||
- name: Create issue if failed
|
||||
- name: Create issue on failure
|
||||
if: failure()
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
@@ -192,7 +192,7 @@ jobs:
|
||||
prerelease: ${{ fromJSON(needs.create-tag.outputs.prerelease) }}
|
||||
overwrite: true
|
||||
|
||||
- name: Create issue if failed
|
||||
- name: Create issue on failure
|
||||
if: failure()
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
|
||||
154
.github/workflows/release-package-distribution.yml
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
name: Release Package Distribution
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_tag:
|
||||
description: "Release Tag (empty for latest)"
|
||||
type: string
|
||||
required: false
|
||||
default: ""
|
||||
mirrorchyan:
|
||||
description: "Upload to MirrorChyan"
|
||||
type: boolean
|
||||
required: false
|
||||
default: true
|
||||
winget:
|
||||
description: "Upload to WinGet"
|
||||
type: boolean
|
||||
required: false
|
||||
default: true
|
||||
maa_cos:
|
||||
description: "Upload to MAA COS"
|
||||
type: boolean
|
||||
required: false
|
||||
default: true
|
||||
|
||||
env:
|
||||
RELEASE_TAG_RAW: ${{ github.event.inputs.release_tag || 'latest' }}
|
||||
|
||||
jobs:
|
||||
meta:
|
||||
name: Define Release Tag
|
||||
if: ${{ github.repository_owner == 'MaaAssistantArknights' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
RELEASE_TAG: ${{ steps.define_release_tag.outputs.RELEASE_TAG }}
|
||||
|
||||
steps:
|
||||
- name: Get latest release tag
|
||||
id: get_latest
|
||||
if: ${{ env.RELEASE_TAG_RAW == 'latest' }}
|
||||
uses: pozetroninc/github-action-get-latest-release@master
|
||||
with:
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
excludes: "draft"
|
||||
|
||||
- name: Define release tag
|
||||
id: define_release_tag
|
||||
run: |
|
||||
if [ "${{ env.RELEASE_TAG_RAW }}" == "latest" ]; then
|
||||
echo "RELEASE_TAG=${{ steps.get_latest.outputs.release }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "RELEASE_TAG=${{ env.RELEASE_TAG_RAW }}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
mirrorchyan:
|
||||
name: Upload to MirrorChyan
|
||||
needs: meta
|
||||
if: ${{ github.event.inputs.mirrorchyan == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: win
|
||||
arch: x64
|
||||
filename: "*MAA-*-win-x64.zip"
|
||||
extra_zip: false
|
||||
- os: win
|
||||
arch: arm64
|
||||
filename: "*MAA-*-win-arm64.zip"
|
||||
extra_zip: false
|
||||
- os: macos
|
||||
arch: arm64
|
||||
filename: "MAA-*-macos-universal.dmg"
|
||||
extra_zip: true
|
||||
- os: macos
|
||||
arch: x64
|
||||
filename: "MAA-*-macos-universal.dmg"
|
||||
extra_zip: true
|
||||
|
||||
env:
|
||||
RELEASE_TAG: ${{ needs.meta.outputs.RELEASE_TAG }}
|
||||
|
||||
steps:
|
||||
- name: Upload MAA ${{ matrix.os }} ${{ matrix.arch }}
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
continue-on-error: true
|
||||
with:
|
||||
filetype: latest-release
|
||||
filename: ${{ matrix.filename }}
|
||||
extra_zip: ${{ matrix.extra_zip }}
|
||||
tag: ${{ env.RELEASE_TAG }}
|
||||
mirrorchyan_rid: MAA
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: ${{ matrix.os }}
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
winget:
|
||||
name: Upload to WinGet
|
||||
needs: meta
|
||||
if: ${{ github.event.inputs.winget == 'true' }}
|
||||
runs-on: windows-latest
|
||||
continue-on-error: true
|
||||
|
||||
env:
|
||||
RELEASE_TAG: ${{ needs.meta.outputs.RELEASE_TAG }}
|
||||
|
||||
steps:
|
||||
- name: Upload MAA to WinGet
|
||||
uses: vedantmgoyal9/winget-releaser@main
|
||||
with:
|
||||
identifier: MaaAssistantArknights.MaaAssistantArknights
|
||||
version: ""
|
||||
installers-regex: "-win-"
|
||||
max-versions-to-keep: 0
|
||||
release-tag: ${{ env.RELEASE_TAG }}
|
||||
fork-user: MaaAssistantArknights
|
||||
token: ${{ secrets.MAABOT_WINGET_TOKEN }}
|
||||
|
||||
maa_cos:
|
||||
name: Upload to MAA COS
|
||||
needs: meta
|
||||
if: ${{ github.event.inputs.maa_cos == 'true' && !contains(needs.meta.outputs.RELEASE_TAG, '-') }}
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
env:
|
||||
FILENAME: MAA-${{ needs.meta.outputs.RELEASE_TAG }}-win-x64.zip
|
||||
|
||||
steps:
|
||||
- uses: robinraju/release-downloader@v1
|
||||
with:
|
||||
repository: 'MaaAssistantArknights/MaaAssistantArknights'
|
||||
latest: true
|
||||
fileName: ${{ env.FILENAME }}
|
||||
out-file-path: 'downloads'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload to COS
|
||||
uses: zkqiang/tencent-cos-action@v0.1.0
|
||||
with:
|
||||
args: upload -rs downloads/${{ env.FILENAME }} MAA/${{ env.FILENAME }}
|
||||
secret_id: ${{ secrets.MISTEO_MAA_COS_SECRET_ID }}
|
||||
secret_key: ${{ secrets.MISTEO_MAA_COS_SECRET_KEY }}
|
||||
bucket: ${{ secrets.MISTEO_MAA_COS_BUCKET }}
|
||||
region: ${{ secrets.MISTEO_MAA_COS_REG }}
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Changelog Generation
|
||||
name: Release Preparation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -9,14 +9,14 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
gen:
|
||||
generate-changelog:
|
||||
name: Generate Changelog
|
||||
# startsWith 表达式不区分大小写
|
||||
if: github.event.pull_request.draft == false && startsWith(github.event.pull_request.title, 'Release v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
show-progress: false
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
git commit -m "$commit_msg"
|
||||
|
||||
- name: Create changelog PR
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
uses: peter-evans/create-pull-request@v8
|
||||
with:
|
||||
sign-commits: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -95,6 +95,17 @@ jobs:
|
||||
AnnAngela
|
||||
|
||||
- name: Assign reviewers to release PR
|
||||
uses: kentaro-m/auto-assign-action@v2.0.0
|
||||
uses: kentaro-m/auto-assign-action@v2.0.1
|
||||
with:
|
||||
configuration-path: ".github/release_reviewers.yaml"
|
||||
|
||||
update-submodules:
|
||||
name: Update Submodules
|
||||
if: github.event.pull_request.draft == false && startsWith(github.event.pull_request.title, 'Release v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger submodule update workflow
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh workflow run --repo $GITHUB_REPOSITORY update-submodules.yml
|
||||
182
.github/workflows/res-update-game.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone ArknightsGameResource for Official
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
repository: yuanyan3060/ArknightsGameResource
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
/gamedata/excel/activity_table.json
|
||||
|
||||
- name: Upload Official resources
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: official
|
||||
path: ./Official
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone ArknightsGameResource_Yostar for Overseas
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
repository: ArknightsAssets/ArknightsGamedata
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
/kr/gamedata/excel/activity_table.json
|
||||
|
||||
- name: Upload Overseas resources
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: overseas
|
||||
path: ./Overseas
|
||||
@@ -92,13 +92,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone arknights-toolbox-update for Taiwan
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
repository: arkntools/arknights-toolbox-update
|
||||
ref: data-tw
|
||||
repository: arkntools/arknights-data-tw-for-maa
|
||||
ref: main
|
||||
path: ./excel
|
||||
token: ${{ secrets.ARKNTOOLS_MAA_RESOURCE_UPDATER}}
|
||||
|
||||
- name: Download stages.json from Penguin Stats
|
||||
run: |
|
||||
@@ -108,20 +107,33 @@ jobs:
|
||||
|
||||
parameters=("CN" "US" "JP" "KR")
|
||||
|
||||
pids=()
|
||||
for param in "${parameters[@]}"; do
|
||||
{
|
||||
if curl -s -o "stages_${param}.json" "${baseUrl}${param}"; then
|
||||
if curl -f -s -o "stages_${param}.json" "${baseUrl}${param}"; then
|
||||
echo "Successfully fetched data for ${param}"
|
||||
else
|
||||
echo "Failed to fetch data for ${param}" >&2
|
||||
exit 1
|
||||
fi
|
||||
} &
|
||||
pids+=($!)
|
||||
done
|
||||
wait
|
||||
|
||||
failed=0
|
||||
for pid in "${pids[@]}"; do
|
||||
if ! wait "$pid"; then
|
||||
failed=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $failed -ne 0 ]; then
|
||||
echo "One or more downloads failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Upload Taiwan resources
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: txwy
|
||||
path: ./excel
|
||||
@@ -129,14 +141,11 @@ jobs:
|
||||
|
||||
update-game-resources:
|
||||
name: Update Game Resources
|
||||
# In case of rate limitations on the runners/instances, add dependency, by removing the comment
|
||||
|
||||
# needs: [clone-resources-official, clone-resources-overseas, clone-resources-txwy]
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
# TL;DR https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/9872#issuecomment-2251378371
|
||||
# actions/checkout uses ${{ secrets.GITHUB_TOKEN }} by default, meaning all steps will inherit it
|
||||
@@ -144,9 +153,14 @@ jobs:
|
||||
show-progress: false
|
||||
fetch-depth: 3
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --depth 1 src/MaaUtils
|
||||
|
||||
- name: Restore ResourceUpdater from cache
|
||||
id: resupd-cache
|
||||
uses: actions/cache/restore@v4
|
||||
uses: actions/cache/restore@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
key: ResourceUpdater-${{ runner.os }}-${{ hashFiles('tools/ResourceUpdater/main.cpp') }}
|
||||
path: |
|
||||
@@ -156,10 +170,11 @@ jobs:
|
||||
- name: Cache MaaDeps
|
||||
if: steps.resupd-cache.outputs.cache-hit != 'true'
|
||||
id: maadeps-cache
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: |
|
||||
./MaaDeps
|
||||
./src/MaaUtils/MaaDeps
|
||||
key: ${{ runner.os }}-arm64-maadeps-${{ hashFiles('tools/maadeps-download.py') }}
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
@@ -169,91 +184,48 @@ jobs:
|
||||
run: |
|
||||
python3 tools/maadeps-download.py arm64-osx
|
||||
|
||||
- name: Config cmake
|
||||
- name: Config, Build & Install ResourceUpdater
|
||||
if: steps.resupd-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd tools/ResourceUpdater
|
||||
mkdir -p build
|
||||
cmake -B build -GNinja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DMAADEPS_TRIPLET='maa-arm64-osx' \
|
||||
-DWITH_HASH_VERSION=ON
|
||||
|
||||
- name: Build
|
||||
if: steps.resupd-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cmake --build tools/ResourceUpdater/build --config Release --parallel $(sysctl -n hw.logicalcpu)
|
||||
|
||||
- name: Install
|
||||
if: steps.resupd-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cmake --install tools/ResourceUpdater/build --prefix tools/ResourceUpdater --config Release
|
||||
cmake --preset res-updater-macos-arm64
|
||||
cmake --build --preset res-updater-macos-arm64 --parallel $(sysctl -n hw.logicalcpu)
|
||||
cmake --install build --config Release
|
||||
|
||||
- name: Save ResourceUpdater to cache
|
||||
if: always() && steps.resupd-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
uses: actions/cache/save@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
key: ResourceUpdater-${{ runner.os }}-${{ hashFiles('tools/ResourceUpdater/main.cpp') }}
|
||||
path: |
|
||||
./tools/ResourceUpdater/libopencv_world4.4.11.0.dylib
|
||||
./tools/ResourceUpdater/res_updater
|
||||
|
||||
- name: Download txwy
|
||||
id: download-txwy
|
||||
uses: actions/download-artifact@v5
|
||||
continue-on-error: true
|
||||
- name: Wait for resource cloning
|
||||
uses: yogeshlonkar/wait-for-jobs@v0
|
||||
with:
|
||||
name: txwy
|
||||
path: ./tools/ResourceUpdater/Overseas/tw/gamedata/excel
|
||||
ignore-skipped: 'false'
|
||||
jobs: |
|
||||
Download Official Resources
|
||||
Download Overseas Resources
|
||||
Download Taiwan Resources
|
||||
ttl: 15
|
||||
|
||||
- name: Delay for txwy
|
||||
if: steps.download-txwy.outcome == 'failure'
|
||||
run: |
|
||||
sleep 30
|
||||
|
||||
- name: Re-download txwy
|
||||
if: steps.download-txwy.outcome == 'failure'
|
||||
uses: actions/download-artifact@v5
|
||||
- name: Download txwy
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: txwy
|
||||
path: ./tools/ResourceUpdater/Overseas/tw/gamedata/excel
|
||||
|
||||
- name: Download Overseas
|
||||
id: download-overseas
|
||||
uses: actions/download-artifact@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: overseas
|
||||
path: ./tools/ResourceUpdater/Overseas
|
||||
|
||||
- name: Delay for Overseas
|
||||
if: steps.download-overseas.outcome == 'failure'
|
||||
run: |
|
||||
sleep 30
|
||||
|
||||
- name: Re-download Overseas
|
||||
if: steps.download-overseas.outcome == 'failure'
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: overseas
|
||||
path: ./tools/ResourceUpdater/Overseas
|
||||
|
||||
- name: Download Official
|
||||
id: download-official
|
||||
uses: actions/download-artifact@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: official
|
||||
path: ./tools/ResourceUpdater/Official
|
||||
|
||||
- name: Delay for Official
|
||||
if: steps.download-official.outcome == 'failure'
|
||||
run: |
|
||||
sleep 30
|
||||
|
||||
- name: Re-download Official
|
||||
if: steps.download-official.outcome == 'failure'
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: official
|
||||
path: ./tools/ResourceUpdater/Official
|
||||
@@ -287,7 +259,8 @@ jobs:
|
||||
- name: Cache python packages
|
||||
if: always() && steps.update_version.outputs.contains_png == 'True'
|
||||
id: cache_python
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: ${{ env.pythonLocation }}/Lib/site-packages
|
||||
key: ${{ runner.os }}-pip-optimize-templates-${{ hashFiles('./tools/OptimizeTemplates/requirements.txt') }}
|
||||
@@ -306,7 +279,7 @@ jobs:
|
||||
- name: Optimize png images
|
||||
if: steps.update_version.outputs.contains_png == 'True'
|
||||
run: |
|
||||
python3 tools/OptimizeTemplates/optimize_templates.py -p resource/template/items/ resource/template/infrast/
|
||||
python3 tools/OptimizeTemplates/optimize_templates.py --no-cleanup -p resource/template/items/ resource/template/infrast/
|
||||
|
||||
- name: Commit changes
|
||||
if: steps.update_version.outputs.changes == 'True'
|
||||
@@ -355,25 +328,40 @@ jobs:
|
||||
# run: |
|
||||
# gh workflow run release-nightly-ota.yml -f release_body="Auto Release of Resource Updates"
|
||||
|
||||
- name: Comment on issue if failed
|
||||
- name: Upsert failure comment (single active)
|
||||
if: failure() && github.ref == 'refs/heads/dev'
|
||||
run: |
|
||||
# Minimize old failure comments
|
||||
comments=$(gh api repos/${{ github.repository }}/issues/14493/comments --jq '.[] | select(.user.login == "github-actions[bot]") | select(.body | contains("${{ github.server_url }}/${{ github.repository }}/actions/runs/")) | .node_id')
|
||||
for node_id in $comments; do
|
||||
gh api graphql -f query='
|
||||
mutation {
|
||||
minimizeComment(input: {subjectId: "'"$node_id"'", classifier: OUTDATED}) {
|
||||
minimizedComment {
|
||||
isMinimized
|
||||
}
|
||||
}
|
||||
}'
|
||||
done
|
||||
|
||||
# Add new failure comment
|
||||
gh issue comment 14493 -R ${{ github.repository }} --body "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
latest_id=$(gh api --paginate repos/${{ github.repository }}/issues/14493/comments | jq -r '.[] | select(.user.login=="github-actions[bot]") | .id' | tail -n 1)
|
||||
if [ -n "$latest_id" ]; then
|
||||
body=$(gh api repos/${{ github.repository }}/issues/comments/$latest_id --jq '.body')
|
||||
if echo "$body" | grep -q '/actions/runs/'; then
|
||||
# Count existing run URLs
|
||||
count=$(echo "$body" | grep -o 'https://github.com/[^[:space:]]*' | wc -l)
|
||||
# Collapse existing content
|
||||
old_content=$(echo "$body" | sed 's|https://github.com/[^[:space:]]*|<details>\n<summary>⚠️ Previous failures ('"$count"')</summary>\n\n###### &\n\n</details>|g')
|
||||
new_body="$run_url
|
||||
|
||||
@MistEO @ABA2396 @Constrat
|
||||
|
||||
$old_content"
|
||||
gh api repos/${{ github.repository }}/issues/comments/$latest_id -X PATCH -f body="$new_body" || echo "Patch failed"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
# Create new failure comment if none suitable
|
||||
gh issue comment 14493 -R ${{ github.repository }} --body "$run_url
|
||||
|
||||
@MistEO @ABA2396 @Constrat"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Minimize failure comment on success/cancelled
|
||||
if: ${{ !failure() && github.ref == 'refs/heads/dev' }}
|
||||
run: |
|
||||
latest_node=$(gh api --paginate repos/${{ github.repository }}/issues/14493/comments | jq -r '.[] | select(.user.login=="github-actions[bot]") | .node_id' | tail -n 1)
|
||||
if [ -n "$latest_node" ]; then
|
||||
gh api graphql -f query='mutation { minimizeComment(input: {subjectId: "'"$latest_node"'", classifier: OUTDATED}) { minimizedComment { isMinimized } } }' || true
|
||||
fi
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
56
.github/workflows/smoke-testing.yml
vendored
@@ -1,7 +1,11 @@
|
||||
name: Smoke Test
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "dev"
|
||||
paths:
|
||||
- ".github/workflows/smoke-testing.yml"
|
||||
- "3rdparty/include/**"
|
||||
@@ -29,33 +33,37 @@ on:
|
||||
- "!**/*.md"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }}${{ github.ref == 'refs/heads/dev' && format('-{0}', github.sha) || '' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
smoke-testing:
|
||||
name: Run Smoke Test
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Generate cache key
|
||||
id: cache_key
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo "key=Smoke-testing-${{ hashFiles('src/Cpp/**', 'src/MaaCore/**', '3rdparty/include/**', 'include/**', 'cmake/**', 'CMakeLists.txt', 'tools/maadeps-download.py', 'tools/linux-toolchain-download.py') }}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Restore cache for Smoke Test
|
||||
if: ${{ steps.cache_key.outputs.key != '' }}
|
||||
id: smoke-cache
|
||||
uses: actions/cache/restore@v4
|
||||
uses: actions/cache/restore@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
key: ${{ steps.cache_key.outputs.key }}
|
||||
path: |
|
||||
./install/libfastdeploy_ppocr.dylib
|
||||
./install/libMaaCore.dylib
|
||||
./install/libMaaUtils.dylib
|
||||
./install/libonnxruntime.1.19.2.dylib
|
||||
./install/libopencv_world4.4.11.0.dylib
|
||||
./install/smoke_test
|
||||
@@ -63,14 +71,15 @@ jobs:
|
||||
- name: Fetch submodules
|
||||
if: steps.smoke-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
git submodule update --init --depth 1 3rdparty/EmulatorExtras
|
||||
git submodule update --init --depth 1 src/MaaUtils
|
||||
|
||||
- name: Cache MaaDeps
|
||||
if: steps.smoke-cache.outputs.cache-hit != 'true'
|
||||
id: maadeps-cache
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: ./MaaDeps
|
||||
path: ./src/MaaUtils/MaaDeps
|
||||
key: ${{ runner.os }}-arm64-maadeps-${{ hashFiles('tools/maadeps-download.py') }}
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
@@ -80,27 +89,12 @@ jobs:
|
||||
run: |
|
||||
python3 tools/maadeps-download.py arm64-osx
|
||||
|
||||
- name: Config cmake
|
||||
- name: Configure, build and install
|
||||
if: steps.smoke-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
mkdir -p build
|
||||
cmake -B build -GNinja \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DMAADEPS_TRIPLET='maa-arm64-osx' \
|
||||
-DBUILD_SMOKE_TEST=ON \
|
||||
-DINSTALL_RESOURCE=ON \
|
||||
-DWITH_HASH_VERSION=ON
|
||||
|
||||
- name: Build
|
||||
if: steps.smoke-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cmake --build build --config Debug --parallel $(sysctl -n hw.logicalcpu)
|
||||
|
||||
- name: Install
|
||||
if: steps.smoke-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
mkdir -p install
|
||||
cmake --install build --prefix install --config Debug
|
||||
cmake -B build --preset smoke-test
|
||||
cmake --build build --preset smoke-test --parallel $(sysctl -n hw.logicalcpu)
|
||||
cmake --install build --config Debug
|
||||
|
||||
- name: Make link to Smoke Test cache
|
||||
if: steps.smoke-cache.outputs.cache-hit == 'true'
|
||||
@@ -113,19 +107,21 @@ jobs:
|
||||
|
||||
- name: Save cache for Smoke Test (only in dev)
|
||||
if: steps.smoke-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/dev'
|
||||
uses: actions/cache/save@v4
|
||||
uses: actions/cache/save@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
key: ${{ steps.cache_key.outputs.key }}
|
||||
path: |
|
||||
./install/libfastdeploy_ppocr.dylib
|
||||
./install/libMaaCore.dylib
|
||||
./install/libMaaUtils.dylib
|
||||
./install/libonnxruntime.1.19.2.dylib
|
||||
./install/libopencv_world4.4.11.0.dylib
|
||||
./install/smoke_test
|
||||
|
||||
- name: Upload logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: logs
|
||||
path: ./install/debug
|
||||
|
||||
4
.github/workflows/sync-resource.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
git show -s
|
||||
|
||||
- name: Checkout MaaResource
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: MaaAssistantArknights/MaaResource
|
||||
show-progress: false
|
||||
|
||||
33
.github/workflows/update-submodules.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Submodule Update
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "50 21 * * *" # Runs daily at 21:50 UTC (before `Release Pipeline (Nightly OTA)`)
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update-submodules:
|
||||
name: Update Submodules
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Update submodules
|
||||
run: |
|
||||
git submodule update --remote src/MaaMacGui
|
||||
git submodule update --remote src/maa-cli
|
||||
|
||||
- name: Commit and push changes
|
||||
uses: actions-js/push@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
message: "feat: Update Submodules MaaMacGui, maa-cli
|
||||
|
||||
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
|
||||
[skip changelog]"
|
||||
branch: ${{ github.ref }}
|
||||
25
.github/workflows/website-workflow.yml
vendored
@@ -24,45 +24,46 @@ concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
# required for peaceiris/actions-gh-pages
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Deploy Documentation Site
|
||||
name: Build and Deploy
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Setup Pages
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
package_json_file: "./docs/package.json"
|
||||
run_install: false
|
||||
|
||||
- name: Setup Node.js environment
|
||||
- name: Setup node.js environment
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24
|
||||
cache: pnpm
|
||||
cache-dependency-path: "./docs/pnpm-lock.yaml"
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Install node modules
|
||||
run: pnpm install --frozen-lockfile
|
||||
working-directory: "./docs"
|
||||
|
||||
- name: Build documentation site
|
||||
- name: Build
|
||||
run: pnpm run build
|
||||
working-directory: "./docs"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v4
|
||||
- name: Upload artifact to GitHub
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: dist
|
||||
path: "./docs/.vuepress/dist"
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
|
||||
15
.gitignore
vendored
@@ -411,10 +411,10 @@ FodyWeavers.xsd
|
||||
# VS Code files for those working on multiple tools
|
||||
**/.vscode/*
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
# !.vscode/settings.json
|
||||
# !.vscode/tasks.json
|
||||
# !.vscode/launch.json
|
||||
# !.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
@@ -434,7 +434,6 @@ FodyWeavers.xsd
|
||||
screen.png
|
||||
adb_screen.png
|
||||
tools/**/*.png
|
||||
.vscode
|
||||
enc_temp_folder/*
|
||||
|
||||
# RoguelikeRecruitmentTool 导出的 Excel 文件
|
||||
@@ -457,7 +456,8 @@ tools/RoguelikeRecruitmentTool/output
|
||||
.lycheecache
|
||||
|
||||
# MaaDeps
|
||||
/MaaDeps/*
|
||||
MaaDeps
|
||||
src/MaaUtils/*
|
||||
|
||||
# ResourceUpdater workflow
|
||||
/original/*
|
||||
@@ -478,3 +478,6 @@ install
|
||||
|
||||
# pnpm cache
|
||||
.pnpm-store
|
||||
|
||||
# CMake user presets
|
||||
CMakeUserPresets.json
|
||||
|
||||
3
.gitmodules
vendored
@@ -10,3 +10,6 @@
|
||||
[submodule "3rdparty/EmulatorExtras"]
|
||||
path = 3rdparty/EmulatorExtras
|
||||
url = https://github.com/MaaXYZ/EmulatorExtras.git
|
||||
[submodule "src/MaaUtils"]
|
||||
path = src/MaaUtils
|
||||
url = https://github.com/MaaXYZ/MaaUtils
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
default_install_hook_types: [pre-commit, prepare-commit-msg]
|
||||
ci:
|
||||
autofix_commit_msg: "chore: Auto update by pre-commit hooks [skip changelog]"
|
||||
autofix_prs: true
|
||||
repos:
|
||||
- repo: https://github.com/shssoichiro/oxipng
|
||||
rev: v9.1.5
|
||||
rev: v10.0.0
|
||||
hooks:
|
||||
- id: oxipng
|
||||
name: PNG Image Compression
|
||||
args: ["-q", "-o", "2", "-s", "--ng"]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v21.1.1
|
||||
rev: v21.1.8
|
||||
hooks:
|
||||
- id: clang-format
|
||||
name: Clang-Format (MaaCore)
|
||||
files: ^src/MaaCore/.*
|
||||
args: ["--assume-filename", ".clang-format"]
|
||||
|
||||
- repo: https://github.com/rbubley/mirrors-prettier
|
||||
rev: v3.6.2
|
||||
rev: v3.7.4
|
||||
hooks:
|
||||
- id: prettier
|
||||
name: Prettier (Config Files)
|
||||
@@ -28,17 +27,13 @@ repos:
|
||||
- id: prettier
|
||||
name: Prettier (Documentation)
|
||||
files: ^docs/.*
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 25.9.0
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.14.10
|
||||
hooks:
|
||||
- id: black
|
||||
name: Black Formatter (Python)
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 6.0.1
|
||||
hooks:
|
||||
- id: isort
|
||||
name: Isort (Python)
|
||||
args: ["--profile", "black", "--filter-files"]
|
||||
- id: ruff-format
|
||||
name: Ruff format (Python)
|
||||
|
||||
- repo: https://github.com/DavidAnson/markdownlint-cli2
|
||||
rev: v0.18.1
|
||||
hooks:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
**/pnpm-lock.yaml
|
||||
|
||||
MaaDeps/
|
||||
3rdparty/
|
||||
src/maa-cli
|
||||
src/MaaMacGui
|
||||
src/MaaUtils
|
||||
|
||||
resource/Arknights-Tile-Pos/
|
||||
tools/OptimizeTemplates/optimize_templates.json
|
||||
|
||||
3
.vscode/settings.json
vendored
@@ -15,5 +15,6 @@
|
||||
"files.associations": {
|
||||
"**/resource/tasks/**/*.json": "jsonc"
|
||||
},
|
||||
"C_Cpp.exclusionPolicy": "checkFilesAndFolders"
|
||||
"C_Cpp.exclusionPolicy": "checkFilesAndFolders",
|
||||
"cmake.outputLogEncoding": "UTF-8"
|
||||
}
|
||||
|
||||
@@ -115,15 +115,15 @@ static constexpr double rel_pos_x = 1.3143386840820312;
|
||||
static constexpr double rel_pos_y = 1.314337134361267;
|
||||
static constexpr double rel_pos_z = -0.3967874050140381;
|
||||
|
||||
inline auto get_retreat_screen_pos(const Level& level)
|
||||
inline auto get_retreat_screen_pos(const Level& level, bool has_multi_stages = false)
|
||||
{
|
||||
const vec3d relative_pos = { -rel_pos_x, +rel_pos_y, rel_pos_z };
|
||||
const vec3d relative_pos = { -rel_pos_x + (has_multi_stages ? level.view[0].x : 0), +rel_pos_y, rel_pos_z };
|
||||
return world_to_screen(level, relative_pos, true);
|
||||
}
|
||||
|
||||
inline auto get_skill_screen_pos(const Level& level)
|
||||
inline auto get_skill_screen_pos(const Level& level, bool has_multi_stages = false)
|
||||
{
|
||||
const vec3d relative_pos = { +rel_pos_x, -rel_pos_y, rel_pos_z };
|
||||
const vec3d relative_pos = { +rel_pos_x + (has_multi_stages ? level.view[0].x : 0), -rel_pos_y, rel_pos_z };
|
||||
return world_to_screen(level, relative_pos, true);
|
||||
}
|
||||
|
||||
|
||||
688
3rdparty/include/meojson/common/array.hpp
vendored
@@ -1,688 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <initializer_list>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "exception.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace json
|
||||
{
|
||||
template <typename string_t>
|
||||
class basic_array
|
||||
{
|
||||
friend class basic_value<string_t>;
|
||||
friend class basic_object<string_t>;
|
||||
|
||||
public:
|
||||
using raw_array = std::vector<basic_value<string_t>>;
|
||||
using value_type = typename raw_array::value_type;
|
||||
using iterator = typename raw_array::iterator;
|
||||
using const_iterator = typename raw_array::const_iterator;
|
||||
using reverse_iterator = typename raw_array::reverse_iterator;
|
||||
using const_reverse_iterator = typename raw_array::const_reverse_iterator;
|
||||
using char_t = typename string_t::value_type;
|
||||
|
||||
public:
|
||||
basic_array() = default;
|
||||
basic_array(const basic_array<string_t>& rhs) = default;
|
||||
basic_array(basic_array<string_t>&& rhs) noexcept = default;
|
||||
basic_array(std::initializer_list<value_type> init_list);
|
||||
basic_array(typename raw_array::size_type size);
|
||||
|
||||
// explicit basic_array(const basic_value<string_t>& val);
|
||||
// explicit basic_array(basic_value<string_t>&& val);
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_to_json_in_templ_spec<jsonization_t, string_t>::value
|
||||
&& !_utils::has_to_json_array_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
basic_array(const jsonization_t& value)
|
||||
: basic_array(ext::jsonization<string_t, jsonization_t>().to_json(value))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_to_json_array_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
basic_array(const jsonization_t& value)
|
||||
: basic_array(ext::jsonization<string_t, jsonization_t>().to_json_array(value))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
std::is_rvalue_reference_v<jsonization_t&&>
|
||||
&& _utils::has_move_to_json_in_templ_spec<jsonization_t, string_t>::value
|
||||
&& !_utils::has_move_to_json_array_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
basic_array(jsonization_t&& value)
|
||||
: basic_array(ext::jsonization<string_t, jsonization_t>().move_to_json(std::move(value)))
|
||||
{
|
||||
}
|
||||
|
||||
//template <
|
||||
// typename jsonization_t,
|
||||
// std::enable_if_t<
|
||||
// std::is_rvalue_reference_v<jsonization_t&&>
|
||||
// && _utils::has_move_to_json_array_in_templ_spec<jsonization_t, string_t>::value,
|
||||
// bool> = true>
|
||||
//basic_array(jsonization_t&& value)
|
||||
// : basic_array(
|
||||
// ext::jsonization<string_t, jsonization_t>().move_to_json_array(std::move(value)))
|
||||
//{
|
||||
//}
|
||||
|
||||
~basic_array() noexcept = default;
|
||||
|
||||
bool empty() const noexcept { return _array_data.empty(); }
|
||||
|
||||
size_t size() const noexcept { return _array_data.size(); }
|
||||
|
||||
bool contains(size_t pos) const { return pos < _array_data.size(); }
|
||||
|
||||
bool exists(size_t pos) const { return contains(pos); }
|
||||
|
||||
const basic_value<string_t>& at(size_t pos) const;
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const
|
||||
{
|
||||
return indent ? format(*indent) : to_string();
|
||||
}
|
||||
|
||||
string_t to_string() const;
|
||||
|
||||
string_t format(size_t indent = 4) const { return format(indent, 0); }
|
||||
|
||||
template <typename value_t>
|
||||
bool all() const;
|
||||
template <typename value_t, template <typename...> typename collection_t = std::vector>
|
||||
collection_t<value_t> as_collection() const;
|
||||
template <
|
||||
typename value_t,
|
||||
size_t Size,
|
||||
template <typename, size_t> typename fixed_array_t = std::array>
|
||||
fixed_array_t<value_t, Size> as_fixed_array() const;
|
||||
template <typename... elem_ts>
|
||||
std::tuple<elem_ts...> as_tuple() const;
|
||||
template <typename first_t, typename second_t>
|
||||
std::pair<first_t, second_t> as_pair() const;
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_from_json_array_in_templ_spec<value_t, string_t>::value,
|
||||
bool> = true>
|
||||
value_t as() const&
|
||||
{
|
||||
value_t res;
|
||||
ext::jsonization<string_t, value_t>().from_json_array(*this, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_move_from_json_array_in_templ_spec<value_t, string_t>::value,
|
||||
bool> = true>
|
||||
value_t as() &&
|
||||
{
|
||||
value_t res;
|
||||
ext::jsonization<string_t, value_t>().move_from_json_array(std::move(*this), res);
|
||||
return res;
|
||||
}
|
||||
|
||||
// Usage: get(key_1, key_2, ..., default_value);
|
||||
template <typename... key_then_default_value_t>
|
||||
auto get(key_then_default_value_t&&... keys_then_default_value) const;
|
||||
|
||||
template <typename value_t = basic_value<string_t>>
|
||||
std::optional<value_t> find(size_t pos) const;
|
||||
|
||||
template <typename... args_t>
|
||||
decltype(auto) emplace_back(args_t&&... args);
|
||||
template <typename... args_t>
|
||||
decltype(auto) push_back(args_t&&... args);
|
||||
|
||||
void clear() noexcept;
|
||||
bool erase(size_t pos);
|
||||
bool erase(iterator iter);
|
||||
|
||||
iterator begin() noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
reverse_iterator rbegin() noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
const basic_value<string_t>& operator[](size_t pos) const;
|
||||
basic_value<string_t>& operator[](size_t pos);
|
||||
|
||||
basic_array<string_t> operator+(const basic_array<string_t>& rhs) const&;
|
||||
basic_array<string_t> operator+(basic_array<string_t>&& rhs) const&;
|
||||
basic_array<string_t> operator+(const basic_array<string_t>& rhs) &&;
|
||||
basic_array<string_t> operator+(basic_array<string_t>&& rhs) &&;
|
||||
|
||||
basic_array<string_t>& operator+=(const basic_array<string_t>& rhs);
|
||||
basic_array<string_t>& operator+=(basic_array<string_t>&& rhs);
|
||||
|
||||
basic_array<string_t>& operator=(const basic_array<string_t>&) = default;
|
||||
basic_array<string_t>& operator=(basic_array<string_t>&&) noexcept = default;
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
std::enable_if_t<std::is_convertible_v<value_t, basic_array<string_t>>, bool> = true>
|
||||
basic_array<string_t>& operator=(value_t rhs)
|
||||
{
|
||||
return *this = basic_array<string_t>(std::move(rhs));
|
||||
}
|
||||
|
||||
bool operator==(const basic_array<string_t>& rhs) const;
|
||||
|
||||
bool operator!=(const basic_array<string_t>& rhs) const { return !(*this == rhs); }
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
template <typename...> typename collection_t = std::vector,
|
||||
std::enable_if_t<_utils::is_collection<collection_t<value_t>>, bool> = true>
|
||||
explicit operator collection_t<value_t>() const
|
||||
{
|
||||
return as_collection<value_t, collection_t>();
|
||||
}
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
size_t Size,
|
||||
template <typename, size_t> typename fixed_array_t = std::array,
|
||||
std::enable_if_t<_utils::is_fixed_array<fixed_array_t<value_t, Size>>, bool> = true>
|
||||
explicit operator fixed_array_t<value_t, Size>() const
|
||||
{
|
||||
return as<fixed_array_t<value_t, Size>>();
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value
|
||||
&& !_utils::has_from_json_array_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
explicit operator jsonization_t() const&
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<string_t, jsonization_t>().from_json(*this, dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_from_json_array_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
explicit operator jsonization_t() const&
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<string_t, jsonization_t>().from_json_array(*this, dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_move_from_json_in_templ_spec<jsonization_t, string_t>::value
|
||||
&& !_utils::has_move_from_json_array_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
explicit operator jsonization_t() &&
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<string_t, jsonization_t>().from_json(std::move(*this), dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_move_from_json_array_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
explicit operator jsonization_t() &&
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<string_t, jsonization_t>().move_from_json_array(
|
||||
std::move(*this),
|
||||
dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
auto
|
||||
get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
auto get_helper(const value_t& default_value, size_t pos, rest_keys_t&&... rest) const;
|
||||
template <typename value_t>
|
||||
auto get_helper(const value_t& default_value, size_t pos) const;
|
||||
|
||||
string_t format(size_t indent, size_t indent_times) const;
|
||||
|
||||
private:
|
||||
raw_array _array_data;
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>::basic_array(std::initializer_list<value_type> init_list)
|
||||
: _array_data(init_list)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>::basic_array(typename raw_array::size_type size)
|
||||
: _array_data(size)
|
||||
{
|
||||
}
|
||||
|
||||
// template <typename string_t>
|
||||
// inline basic_array<string_t>::basic_array(const basic_value<string_t>& val) :
|
||||
// basic_array<string_t>(val.as_array())
|
||||
//{}
|
||||
//
|
||||
// template <typename string_t>
|
||||
// inline basic_array<string_t>::basic_array(basic_value<string_t>&& val)
|
||||
// : basic_array<string_t>(std::move(val.as_array()))
|
||||
//{}
|
||||
|
||||
template <typename string_t>
|
||||
inline void basic_array<string_t>::clear() noexcept
|
||||
{
|
||||
_array_data.clear();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_array<string_t>::erase(size_t pos)
|
||||
{
|
||||
return erase(_array_data.begin() + pos);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_array<string_t>::erase(iterator iter)
|
||||
{
|
||||
return _array_data.erase(iter) != _array_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_array<string_t>::emplace_back(args_t&&... args)
|
||||
{
|
||||
static_assert(
|
||||
std::is_constructible_v<value_type, args_t...>,
|
||||
"Parameter can't be used to construct a raw_array::value_type");
|
||||
return _array_data.emplace_back(std::forward<args_t>(args)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_array<string_t>::push_back(args_t&&... args)
|
||||
{
|
||||
return emplace_back(std::forward<args_t>(args)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_value<string_t>& basic_array<string_t>::at(size_t pos) const
|
||||
{
|
||||
return _array_data.at(pos);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_array<string_t>::to_string() const
|
||||
{
|
||||
string_t str { '[' };
|
||||
for (auto iter = _array_data.cbegin(); iter != _array_data.cend();) {
|
||||
str += iter->to_string();
|
||||
if (++iter != _array_data.cend()) {
|
||||
str += ',';
|
||||
}
|
||||
}
|
||||
str += char_t(']');
|
||||
return str;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_array<string_t>::format(size_t indent, size_t indent_times) const
|
||||
{
|
||||
const string_t tail_indent(indent * indent_times, ' ');
|
||||
const string_t body_indent(indent * (indent_times + 1), ' ');
|
||||
|
||||
string_t str { '[', '\n' };
|
||||
for (auto iter = _array_data.cbegin(); iter != _array_data.cend();) {
|
||||
str += body_indent + iter->format(indent, indent_times + 1);
|
||||
if (++iter != _array_data.cend()) {
|
||||
str += ',';
|
||||
}
|
||||
str += '\n';
|
||||
}
|
||||
str += tail_indent + char_t(']');
|
||||
return str;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline bool basic_array<string_t>::all() const
|
||||
{
|
||||
for (const auto& elem : _array_data) {
|
||||
if (!elem.template is<value_t>()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, template <typename...> typename collection_t>
|
||||
inline collection_t<value_t> basic_array<string_t>::as_collection() const
|
||||
{
|
||||
return as<collection_t<value_t>>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, size_t Size, template <typename, size_t> typename fixed_array_t>
|
||||
inline fixed_array_t<value_t, Size> basic_array<string_t>::as_fixed_array() const
|
||||
{
|
||||
return as<fixed_array_t<value_t, Size>>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... elem_ts>
|
||||
inline std::tuple<elem_ts...> basic_array<string_t>::as_tuple() const
|
||||
{
|
||||
return as<std::tuple<elem_ts...>>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename first_t, typename second_t>
|
||||
inline std::pair<first_t, second_t> basic_array<string_t>::as_pair() const
|
||||
{
|
||||
return as<std::pair<first_t, second_t>>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t>
|
||||
inline auto basic_array<string_t>::get(key_then_default_value_t&&... keys_then_default_value) const
|
||||
{
|
||||
return get(
|
||||
std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
inline auto basic_array<string_t>::get(
|
||||
std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
{
|
||||
constexpr unsigned long default_value_index = sizeof...(key_then_default_value_t) - 1;
|
||||
return get_helper(
|
||||
std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
inline auto basic_array<string_t>::get_helper(
|
||||
const value_t& default_value,
|
||||
size_t pos,
|
||||
rest_keys_t&&... rest) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t>
|
||||
|| std::is_same_v<basic_array<string_t>, value_t>
|
||||
|| std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(pos)) {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
|
||||
return at(pos).get_helper(default_value, std::forward<rest_keys_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline auto basic_array<string_t>::get_helper(const value_t& default_value, size_t pos) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t>
|
||||
|| std::is_same_v<basic_array<string_t>, value_t>
|
||||
|| std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(pos)) {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
|
||||
auto val = _array_data.at(pos);
|
||||
if (val.template is<value_t>()) {
|
||||
if constexpr (is_string) {
|
||||
return val.template as<string_t>();
|
||||
}
|
||||
else {
|
||||
return val.template as<value_t>();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline std::optional<value_t> basic_array<string_t>::find(size_t pos) const
|
||||
{
|
||||
if (!contains(pos)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto& val = _array_data.at(pos);
|
||||
return val.template is<value_t>() ? std::optional<value_t>(val.template as<value_t>())
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::iterator basic_array<string_t>::begin() noexcept
|
||||
{
|
||||
return _array_data.begin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::iterator basic_array<string_t>::end() noexcept
|
||||
{
|
||||
return _array_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_iterator basic_array<string_t>::begin() const noexcept
|
||||
{
|
||||
return _array_data.begin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_iterator basic_array<string_t>::end() const noexcept
|
||||
{
|
||||
return _array_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_iterator basic_array<string_t>::cbegin() const noexcept
|
||||
{
|
||||
return _array_data.cbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_iterator basic_array<string_t>::cend() const noexcept
|
||||
{
|
||||
return _array_data.cend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::reverse_iterator basic_array<string_t>::rbegin() noexcept
|
||||
{
|
||||
return _array_data.rbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::reverse_iterator basic_array<string_t>::rend() noexcept
|
||||
{
|
||||
return _array_data.rend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator
|
||||
basic_array<string_t>::rbegin() const noexcept
|
||||
{
|
||||
return _array_data.rbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator
|
||||
basic_array<string_t>::rend() const noexcept
|
||||
{
|
||||
return _array_data.rend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator
|
||||
basic_array<string_t>::crbegin() const noexcept
|
||||
{
|
||||
return _array_data.crbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator
|
||||
basic_array<string_t>::crend() const noexcept
|
||||
{
|
||||
return _array_data.crend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_array<string_t>::operator[](size_t pos)
|
||||
{
|
||||
return _array_data[pos];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_value<string_t>& basic_array<string_t>::operator[](size_t pos) const
|
||||
{
|
||||
return _array_data[pos];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>
|
||||
basic_array<string_t>::operator+(const basic_array<string_t>& rhs) const&
|
||||
{
|
||||
basic_array<string_t> temp = *this;
|
||||
temp._array_data.insert(_array_data.end(), rhs.begin(), rhs.end());
|
||||
return temp;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t> basic_array<string_t>::operator+(basic_array<string_t>&& rhs) const&
|
||||
{
|
||||
basic_array<string_t> temp = *this;
|
||||
temp._array_data.insert(
|
||||
_array_data.end(),
|
||||
std::make_move_iterator(rhs.begin()),
|
||||
std::make_move_iterator(rhs.end()));
|
||||
return temp;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t> basic_array<string_t>::operator+(const basic_array<string_t>& rhs) &&
|
||||
{
|
||||
_array_data.insert(_array_data.end(), rhs.begin(), rhs.end());
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t> basic_array<string_t>::operator+(basic_array<string_t>&& rhs) &&
|
||||
{
|
||||
_array_data.insert(
|
||||
_array_data.end(),
|
||||
std::make_move_iterator(rhs.begin()),
|
||||
std::make_move_iterator(rhs.end()));
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>& basic_array<string_t>::operator+=(const basic_array<string_t>& rhs)
|
||||
{
|
||||
_array_data.insert(_array_data.end(), rhs.begin(), rhs.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>& basic_array<string_t>::operator+=(basic_array<string_t>&& rhs)
|
||||
{
|
||||
_array_data.insert(
|
||||
_array_data.end(),
|
||||
std::make_move_iterator(rhs.begin()),
|
||||
std::make_move_iterator(rhs.end()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_array<string_t>::operator==(const basic_array<string_t>& rhs) const
|
||||
{
|
||||
return _array_data == rhs._array_data;
|
||||
}
|
||||
|
||||
template <
|
||||
typename ostream_t,
|
||||
typename string_t,
|
||||
typename std_ostream_t = std::basic_ostream<
|
||||
typename string_t::value_type,
|
||||
std::char_traits<typename string_t::value_type>>,
|
||||
typename enable_t = std::enable_if_t<
|
||||
std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
ostream_t& operator<<(ostream_t& out, const basic_array<string_t>& arr)
|
||||
{
|
||||
out << arr.format();
|
||||
return out;
|
||||
}
|
||||
} // namespace json
|
||||
35
3rdparty/include/meojson/common/exception.hpp
vendored
@@ -1,35 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
namespace json
|
||||
{
|
||||
class exception : public std::exception
|
||||
{
|
||||
public:
|
||||
exception() = default;
|
||||
|
||||
exception(const std::string& msg)
|
||||
: _what(msg)
|
||||
{
|
||||
}
|
||||
|
||||
exception(const exception&) = default;
|
||||
exception& operator=(const exception&) = default;
|
||||
exception(exception&&) = default;
|
||||
exception& operator=(exception&&) = default;
|
||||
|
||||
virtual ~exception() noexcept override = default;
|
||||
|
||||
virtual const char* what() const noexcept override
|
||||
{
|
||||
return _what.empty() ? "Unknown exception" : _what.c_str();
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string _what;
|
||||
};
|
||||
}
|
||||
605
3rdparty/include/meojson/common/object.hpp
vendored
@@ -1,605 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <initializer_list>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#include "exception.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace json
|
||||
{
|
||||
template <typename string_t>
|
||||
class basic_object
|
||||
{
|
||||
friend class basic_value<string_t>;
|
||||
friend class basic_array<string_t>;
|
||||
|
||||
public:
|
||||
using raw_object = std::map<string_t, basic_value<string_t>>;
|
||||
using key_type = typename raw_object::key_type;
|
||||
using mapped_type = typename raw_object::mapped_type;
|
||||
using value_type = typename raw_object::value_type;
|
||||
using iterator = typename raw_object::iterator;
|
||||
using const_iterator = typename raw_object::const_iterator;
|
||||
using char_t = typename string_t::value_type;
|
||||
|
||||
public:
|
||||
basic_object() = default;
|
||||
basic_object(const basic_object<string_t>& rhs) = default;
|
||||
basic_object(basic_object<string_t>&& rhs) noexcept = default;
|
||||
basic_object(std::initializer_list<value_type> init_list);
|
||||
|
||||
// explicit basic_object(const basic_value<string_t>& val);
|
||||
// explicit basic_object(basic_value<string_t>&& val);
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_to_json_in_templ_spec<jsonization_t, string_t>::value
|
||||
&& !_utils::has_to_json_object_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
basic_object(const jsonization_t& value)
|
||||
: basic_object(ext::jsonization<string_t, jsonization_t>().to_json(value))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_to_json_object_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
basic_object(const jsonization_t& value)
|
||||
: basic_object(ext::jsonization<string_t, jsonization_t>().to_json_object(value))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
std::is_rvalue_reference_v<jsonization_t&&>
|
||||
&& _utils::has_move_to_json_in_templ_spec<jsonization_t, string_t>::value
|
||||
&& !_utils::has_move_to_json_object_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
basic_object(jsonization_t&& value)
|
||||
: basic_object(ext::jsonization<string_t, jsonization_t>().move_to_json(std::move(value)))
|
||||
{
|
||||
}
|
||||
|
||||
//template <
|
||||
// typename jsonization_t,
|
||||
// std::enable_if_t<
|
||||
// std::is_rvalue_reference_v<jsonization_t&&>
|
||||
// && _utils::has_move_to_json_object_in_templ_spec<jsonization_t, string_t>::value,
|
||||
// bool> = true>
|
||||
//basic_object(jsonization_t&& value)
|
||||
// : basic_object(
|
||||
// ext::jsonization<string_t, jsonization_t>().move_to_json_object(std::move(value)))
|
||||
//{
|
||||
//}
|
||||
|
||||
~basic_object() = default;
|
||||
|
||||
bool empty() const noexcept { return _object_data.empty(); }
|
||||
|
||||
size_t size() const noexcept { return _object_data.size(); }
|
||||
|
||||
bool contains(const string_t& key) const;
|
||||
|
||||
bool exists(const string_t& key) const { return contains(key); }
|
||||
|
||||
const basic_value<string_t>& at(const string_t& key) const;
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const
|
||||
{
|
||||
return indent ? format(*indent) : to_string();
|
||||
}
|
||||
|
||||
string_t to_string() const;
|
||||
|
||||
string_t format(size_t indent = 4) const { return format(indent, 0); }
|
||||
|
||||
template <typename value_t>
|
||||
bool all() const;
|
||||
template <typename value_t, template <typename...> typename map_t = std::map>
|
||||
map_t<string_t, value_t> as_map() const;
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_from_json_object_in_templ_spec<value_t, string_t>::value,
|
||||
bool> = true>
|
||||
value_t as() const&
|
||||
{
|
||||
value_t res;
|
||||
ext::jsonization<string_t, value_t>().from_json_object(*this, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_move_from_json_object_in_templ_spec<value_t, string_t>::value,
|
||||
bool> = true>
|
||||
value_t as() &&
|
||||
{
|
||||
value_t res;
|
||||
ext::jsonization<string_t, value_t>().move_from_json_object(std::move(*this), res);
|
||||
return res;
|
||||
}
|
||||
|
||||
// Usage: get(key_1, key_2, ..., default_value);
|
||||
template <typename... key_then_default_value_t>
|
||||
auto get(key_then_default_value_t&&... keys_then_default_value) const;
|
||||
|
||||
template <typename value_t = basic_value<string_t>>
|
||||
std::optional<value_t> find(const string_t& key) const;
|
||||
|
||||
template <typename... args_t>
|
||||
decltype(auto) emplace(args_t&&... args);
|
||||
template <typename... args_t>
|
||||
decltype(auto) insert(args_t&&... args);
|
||||
|
||||
void clear() noexcept;
|
||||
bool erase(const string_t& key);
|
||||
bool erase(iterator iter);
|
||||
|
||||
iterator begin() noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
basic_value<string_t>& operator[](const string_t& key);
|
||||
basic_value<string_t>& operator[](string_t&& key);
|
||||
|
||||
basic_object<string_t> operator|(const basic_object<string_t>& rhs) const&;
|
||||
basic_object<string_t> operator|(basic_object<string_t>&& rhs) const&;
|
||||
basic_object<string_t> operator|(const basic_object<string_t>& rhs) &&;
|
||||
basic_object<string_t> operator|(basic_object<string_t>&& rhs) &&;
|
||||
|
||||
basic_object<string_t>& operator|=(const basic_object<string_t>& rhs);
|
||||
basic_object<string_t>& operator|=(basic_object<string_t>&& rhs);
|
||||
|
||||
basic_object<string_t>& operator=(const basic_object<string_t>&) = default;
|
||||
basic_object<string_t>& operator=(basic_object<string_t>&&) = default;
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
std::enable_if_t<std::is_convertible_v<value_t, basic_object<string_t>>, bool> = true>
|
||||
basic_object<string_t>& operator=(value_t rhs)
|
||||
{
|
||||
return *this = basic_object<string_t>(std::move(rhs));
|
||||
}
|
||||
|
||||
bool operator==(const basic_object<string_t>& rhs) const;
|
||||
|
||||
bool operator!=(const basic_object<string_t>& rhs) const { return !(*this == rhs); }
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
template <typename...> typename map_t = std::map,
|
||||
std::enable_if_t<_utils::is_map<map_t<string_t, value_t>>, bool> = true>
|
||||
explicit operator map_t<string_t, value_t>() const
|
||||
{
|
||||
return as_map<value_t, map_t>();
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value
|
||||
&& !_utils::has_from_json_object_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
explicit operator jsonization_t() const&
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<string_t, jsonization_t>().from_json(*this, dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_from_json_object_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
explicit operator jsonization_t() const&
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<string_t, jsonization_t>().from_json_object(*this, dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_move_from_json_in_templ_spec<jsonization_t, string_t>::value
|
||||
&& !_utils::has_move_from_json_object_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
explicit operator jsonization_t() &&
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<string_t, jsonization_t>().from_json(std::move(*this), dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_move_from_json_object_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
explicit operator jsonization_t() &&
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<string_t, jsonization_t>().move_from_json_object(
|
||||
std::move(*this),
|
||||
dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
auto
|
||||
get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
auto get_helper(const value_t& default_value, const string_t& key, rest_keys_t&&... rest) const;
|
||||
template <typename value_t>
|
||||
auto get_helper(const value_t& default_value, const string_t& key) const;
|
||||
|
||||
string_t format(size_t indent, size_t indent_times) const;
|
||||
|
||||
private:
|
||||
raw_object _object_data;
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>::basic_object(std::initializer_list<value_type> init_list)
|
||||
: _object_data(
|
||||
std::make_move_iterator(init_list.begin()),
|
||||
std::make_move_iterator(init_list.end()))
|
||||
{
|
||||
}
|
||||
|
||||
// template <typename string_t>
|
||||
// inline basic_object<string_t>::basic_object(const basic_value<string_t>& val) :
|
||||
// basic_object<string_t>(val.as_object())
|
||||
//{}
|
||||
//
|
||||
// template <typename string_t>
|
||||
// inline basic_object<string_t>::basic_object(basic_value<string_t>&& val)
|
||||
// : basic_object<string_t>(std::move(val.as_object()))
|
||||
//{}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_object<string_t>::contains(const string_t& key) const
|
||||
{
|
||||
return _object_data.find(key) != _object_data.cend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_value<string_t>& basic_object<string_t>::at(const string_t& key) const
|
||||
{
|
||||
return _object_data.at(key);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline void basic_object<string_t>::clear() noexcept
|
||||
{
|
||||
_object_data.clear();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_object<string_t>::erase(const string_t& key)
|
||||
{
|
||||
return _object_data.erase(key) > 0 ? true : false;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_object<string_t>::erase(iterator iter)
|
||||
{
|
||||
return _object_data.erase(iter) != _object_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_object<string_t>::emplace(args_t&&... args)
|
||||
{
|
||||
static_assert(
|
||||
std::is_constructible_v<value_type, args_t...>,
|
||||
"Parameter can't be used to construct a raw_object::value_type");
|
||||
return _object_data.insert_or_assign(std::forward<args_t>(args)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_object<string_t>::insert(args_t&&... args)
|
||||
{
|
||||
return emplace(std::forward<args_t>(args)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_object<string_t>::to_string() const
|
||||
{
|
||||
string_t str { '{' };
|
||||
for (auto iter = _object_data.cbegin(); iter != _object_data.cend();) {
|
||||
const auto& [key, val] = *iter;
|
||||
str +=
|
||||
char_t('"') + _utils::unescape_string(key) + string_t { '\"', ':' } + val.to_string();
|
||||
if (++iter != _object_data.cend()) {
|
||||
str += ',';
|
||||
}
|
||||
}
|
||||
str += char_t('}');
|
||||
return str;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_object<string_t>::format(size_t indent, size_t indent_times) const
|
||||
{
|
||||
const string_t tail_indent(indent * indent_times, ' ');
|
||||
const string_t body_indent(indent * (indent_times + 1), ' ');
|
||||
|
||||
string_t str { '{', '\n' };
|
||||
for (auto iter = _object_data.cbegin(); iter != _object_data.cend();) {
|
||||
const auto& [key, val] = *iter;
|
||||
str += body_indent + char_t('"') + _utils::unescape_string(key)
|
||||
+ string_t { '\"', ':', ' ' } + val.format(indent, indent_times + 1);
|
||||
if (++iter != _object_data.cend()) {
|
||||
str += ',';
|
||||
}
|
||||
str += '\n';
|
||||
}
|
||||
str += tail_indent + char_t('}');
|
||||
return str;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline bool basic_object<string_t>::all() const
|
||||
{
|
||||
for (const auto& [_, val] : _object_data) {
|
||||
if (!val.template is<value_t>()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, template <typename...> typename map_t>
|
||||
inline map_t<string_t, value_t> basic_object<string_t>::as_map() const
|
||||
{
|
||||
return as<map_t<string_t, value_t>>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t>
|
||||
inline auto basic_object<string_t>::get(key_then_default_value_t&&... keys_then_default_value) const
|
||||
{
|
||||
return get(
|
||||
std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
inline auto basic_object<string_t>::get(
|
||||
std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
{
|
||||
constexpr unsigned long default_value_index = sizeof...(key_then_default_value_t) - 1;
|
||||
return get_helper(
|
||||
std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
inline auto basic_object<string_t>::get_helper(
|
||||
const value_t& default_value,
|
||||
const string_t& key,
|
||||
rest_keys_t&&... rest) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t>
|
||||
|| std::is_same_v<basic_array<string_t>, value_t>
|
||||
|| std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(key)) {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
|
||||
return at(key).get_helper(default_value, std::forward<rest_keys_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline auto
|
||||
basic_object<string_t>::get_helper(const value_t& default_value, const string_t& key) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t>
|
||||
|| std::is_same_v<basic_array<string_t>, value_t>
|
||||
|| std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(key)) {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
|
||||
auto val = _object_data.at(key);
|
||||
if (val.template is<value_t>()) {
|
||||
if constexpr (is_string) {
|
||||
return val.template as<string_t>();
|
||||
}
|
||||
else {
|
||||
return val.template as<value_t>();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline std::optional<value_t> basic_object<string_t>::find(const string_t& key) const
|
||||
{
|
||||
auto iter = _object_data.find(key);
|
||||
if (iter == _object_data.end()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto& val = iter->second;
|
||||
return val.template is<value_t>() ? std::optional<value_t>(val.template as<value_t>())
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::iterator basic_object<string_t>::begin() noexcept
|
||||
{
|
||||
return _object_data.begin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::iterator basic_object<string_t>::end() noexcept
|
||||
{
|
||||
return _object_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::const_iterator
|
||||
basic_object<string_t>::begin() const noexcept
|
||||
{
|
||||
return _object_data.begin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::const_iterator basic_object<string_t>::end() const noexcept
|
||||
{
|
||||
return _object_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::const_iterator
|
||||
basic_object<string_t>::cbegin() const noexcept
|
||||
{
|
||||
return _object_data.cbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::const_iterator basic_object<string_t>::cend() const noexcept
|
||||
{
|
||||
return _object_data.cend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_object<string_t>::operator[](const string_t& key)
|
||||
{
|
||||
return _object_data[key];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_object<string_t>::operator[](string_t&& key)
|
||||
{
|
||||
return _object_data[std::move(key)];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>
|
||||
basic_object<string_t>::operator|(const basic_object<string_t>& rhs) const&
|
||||
{
|
||||
basic_object<string_t> temp = *this;
|
||||
temp._object_data.insert(rhs.begin(), rhs.end());
|
||||
return temp;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t> basic_object<string_t>::operator|(basic_object<string_t>&& rhs) const&
|
||||
{
|
||||
basic_object<string_t> temp = *this;
|
||||
// temp._object_data.merge(std::move(rhs._object_data));
|
||||
temp._object_data.insert(
|
||||
std::make_move_iterator(rhs.begin()),
|
||||
std::make_move_iterator(rhs.end()));
|
||||
return temp;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>
|
||||
basic_object<string_t>::operator|(const basic_object<string_t>& rhs) &&
|
||||
{
|
||||
_object_data.insert(rhs.begin(), rhs.end());
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t> basic_object<string_t>::operator|(basic_object<string_t>&& rhs) &&
|
||||
{
|
||||
//_object_data.merge(std::move(rhs._object_data));
|
||||
_object_data.insert(std::make_move_iterator(rhs.begin()), std::make_move_iterator(rhs.end()));
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>& basic_object<string_t>::operator|=(const basic_object<string_t>& rhs)
|
||||
{
|
||||
_object_data.insert(rhs.begin(), rhs.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>& basic_object<string_t>::operator|=(basic_object<string_t>&& rhs)
|
||||
{
|
||||
_object_data.insert(std::make_move_iterator(rhs.begin()), std::make_move_iterator(rhs.end()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_object<string_t>::operator==(const basic_object<string_t>& rhs) const
|
||||
{
|
||||
return _object_data == rhs._object_data;
|
||||
}
|
||||
|
||||
template <
|
||||
typename ostream_t,
|
||||
typename string_t,
|
||||
typename std_ostream_t = std::basic_ostream<
|
||||
typename string_t::value_type,
|
||||
std::char_traits<typename string_t::value_type>>,
|
||||
typename enable_t = std::enable_if_t<
|
||||
std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
ostream_t& operator<<(ostream_t& out, const basic_object<string_t>& obj)
|
||||
{
|
||||
out << obj.format();
|
||||
return out;
|
||||
}
|
||||
} // namespace json
|
||||
207
3rdparty/include/meojson/common/serialization.hpp
vendored
@@ -1,207 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "types.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace json
|
||||
{
|
||||
namespace _serialization_helper
|
||||
{
|
||||
template <typename in_t, typename serializer_t>
|
||||
class is_serializable
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<serializer_t>()(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<in_t>(0))::value;
|
||||
};
|
||||
|
||||
struct empty_serializer
|
||||
{
|
||||
// sample:
|
||||
// json::value operator()(const type_1&) const { return ...; }
|
||||
// json::value operator()(const type_2&) const { return ...; }
|
||||
// json::value operator()(const type_3&) const { return ...; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void unable_to_serialize()
|
||||
{
|
||||
static_assert(
|
||||
!sizeof(T),
|
||||
"Unable to serialize T. "
|
||||
#ifdef _MSC_VER
|
||||
"See T below: " __FUNCSIG__
|
||||
#else
|
||||
// "See T below: " __PRETTY_FUNCTION__
|
||||
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
namespace _serialization_helper
|
||||
{
|
||||
template <typename out_t, typename deserializer_t, typename string_t = default_string_t>
|
||||
class is_deserializable
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<deserializer_t>()(std::declval<basic_value<string_t>>(), std::declval<U&>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<out_t>(0))::value;
|
||||
};
|
||||
|
||||
struct empty_deserializer
|
||||
{
|
||||
// sample:
|
||||
// bool operator()(const json::value&, type_1&) const { return ...; }
|
||||
// bool operator()(const json::value&, type_2&) const { return ...; }
|
||||
// bool operator()(const json::value&, type_3&) const { return ...; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void unable_to_deserialize()
|
||||
{
|
||||
static_assert(
|
||||
!sizeof(T),
|
||||
"Unable to deserialize T. "
|
||||
#ifdef _MSC_VER
|
||||
"See T below: " __FUNCSIG__
|
||||
#else
|
||||
// "See T below: " __PRETTY_FUNCTION__
|
||||
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
template <
|
||||
typename in_t,
|
||||
typename serializer_t = _serialization_helper::empty_serializer,
|
||||
typename string_t = default_string_t>
|
||||
basic_value<string_t> serialize(in_t&& in, const serializer_t& serializer = {})
|
||||
{
|
||||
if constexpr (_serialization_helper::is_serializable<in_t, serializer_t>::value) {
|
||||
return serializer(std::forward<in_t>(in));
|
||||
}
|
||||
else if constexpr (
|
||||
_utils::is_collection<std::decay_t<in_t>> || _utils::is_fixed_array<std::decay_t<in_t>>) {
|
||||
basic_array<string_t> arr;
|
||||
for (auto&& elem : in) {
|
||||
using elem_t = decltype(elem);
|
||||
|
||||
auto j_elem =
|
||||
serialize<elem_t, serializer_t, string_t>(std::forward<elem_t>(elem), serializer);
|
||||
arr.emplace_back(std::move(j_elem));
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
else if constexpr (_utils::is_map<std::decay_t<in_t>>) {
|
||||
basic_object<string_t> obj;
|
||||
for (auto&& [key, elem] : in) {
|
||||
using key_t = decltype(key);
|
||||
using elem_t = decltype(elem);
|
||||
|
||||
auto j_elem =
|
||||
serialize<elem_t, serializer_t, string_t>(std::forward<elem_t>(elem), serializer);
|
||||
obj.emplace(std::forward<key_t>(key), std::move(j_elem));
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
else if constexpr (std::is_constructible_v<basic_value<string_t>, in_t>) {
|
||||
return basic_value<string_t>(std::forward<in_t>(in));
|
||||
}
|
||||
else {
|
||||
_serialization_helper::unable_to_serialize<in_t>();
|
||||
}
|
||||
}
|
||||
|
||||
template <
|
||||
typename out_t,
|
||||
typename deserializer_t = _serialization_helper::empty_deserializer,
|
||||
typename string_t = default_string_t>
|
||||
bool deserialize(
|
||||
const basic_value<string_t>& in,
|
||||
out_t& out,
|
||||
const deserializer_t& deserializer = {})
|
||||
{
|
||||
if constexpr (_serialization_helper::is_deserializable<out_t, deserializer_t>::value) {
|
||||
return deserializer(in, out);
|
||||
}
|
||||
else if constexpr (_utils::is_collection<std::decay_t<out_t>>) {
|
||||
if (!in.is_array()) {
|
||||
return false;
|
||||
}
|
||||
for (auto&& j_elem : in.as_array()) {
|
||||
using elem_t = typename out_t::value_type;
|
||||
elem_t elem {};
|
||||
if (!deserialize<elem_t, deserializer_t, string_t>(j_elem, elem, deserializer)) {
|
||||
return false;
|
||||
}
|
||||
if constexpr (_as_collection_helper::has_emplace_back<out_t>::value) {
|
||||
out.emplace_back(std::move(elem));
|
||||
}
|
||||
else {
|
||||
out.emplace(std::move(elem));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if constexpr (_utils::is_fixed_array<std::decay_t<out_t>>) {
|
||||
if (!in.is_array()) {
|
||||
return false;
|
||||
}
|
||||
auto&& in_as_arr = in.as_array();
|
||||
constexpr size_t out_size = _utils::fixed_array_size<out_t>;
|
||||
if (in_as_arr.size() != out_size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < out_size; ++i) {
|
||||
auto&& j_elem = in_as_arr.at(i);
|
||||
using elem_t = typename out_t::value_type;
|
||||
elem_t elem {};
|
||||
if (!deserialize<elem_t, deserializer_t, string_t>(j_elem, elem, deserializer)) {
|
||||
return false;
|
||||
}
|
||||
out.at(i) = std::move(elem);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if constexpr (_utils::is_map<std::decay_t<out_t>>) {
|
||||
if (!in.is_object()) {
|
||||
return false;
|
||||
}
|
||||
for (auto&& [key, j_elem] : in.as_object()) {
|
||||
using elem_t = typename out_t::mapped_type;
|
||||
elem_t elem {};
|
||||
if (!deserialize<elem_t, deserializer_t, string_t>(j_elem, elem, deserializer)) {
|
||||
return false;
|
||||
}
|
||||
out.emplace(std::forward<decltype(key)>(key), std::move(elem));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if constexpr (std::is_constructible_v<out_t, basic_value<string_t>>) {
|
||||
out = out_t(in);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
_serialization_helper::unable_to_deserialize<out_t>();
|
||||
}
|
||||
}
|
||||
} // namespace json
|
||||
7
3rdparty/include/meojson/common/types.hpp
vendored
@@ -1,7 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "array.hpp"
|
||||
#include "object.hpp"
|
||||
#include "value.hpp"
|
||||
473
3rdparty/include/meojson/common/utils.hpp
vendored
@@ -1,473 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
namespace json
|
||||
{
|
||||
template <typename string_t>
|
||||
class basic_value;
|
||||
template <typename string_t>
|
||||
class basic_array;
|
||||
template <typename string_t>
|
||||
class basic_object;
|
||||
|
||||
using default_string_t = std::string;
|
||||
|
||||
using value = basic_value<default_string_t>;
|
||||
using array = basic_array<default_string_t>;
|
||||
using object = basic_object<default_string_t>;
|
||||
|
||||
using wvalue = basic_value<std::wstring>;
|
||||
using warray = basic_array<std::wstring>;
|
||||
using wobject = basic_object<std::wstring>;
|
||||
}
|
||||
|
||||
namespace json::ext
|
||||
{
|
||||
template <typename string_t, typename T, typename = void>
|
||||
class jsonization
|
||||
{
|
||||
public:
|
||||
// json::value to_json(const T&) const;
|
||||
// bool check_json(const json::value&) const;
|
||||
// bool from_json(const json::value&, T&) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace json::_utils
|
||||
{
|
||||
template <typename T>
|
||||
using iterator_t = decltype(std::declval<T&>().begin());
|
||||
template <typename T>
|
||||
using remove_cvref_t = std::remove_cv_t<std::remove_reference_t<T>>;
|
||||
template <typename T>
|
||||
using iter_value_t = typename std::iterator_traits<remove_cvref_t<T>>::value_type;
|
||||
template <typename R>
|
||||
using range_value_t = iter_value_t<iterator_t<R>>;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_string = false;
|
||||
template <typename T>
|
||||
constexpr bool is_string<T, std::void_t<typename T::traits_type>> =
|
||||
std::is_same_v<typename T::traits_type, std::char_traits<typename T::value_type>>;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_container = false;
|
||||
template <typename T>
|
||||
constexpr bool is_container<T, std::void_t<typename T::value_type, range_value_t<T>>> =
|
||||
std::is_same_v<typename T::value_type, range_value_t<T>> && !is_string<T>;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_map = false;
|
||||
template <typename T>
|
||||
constexpr bool is_map<T, std::void_t<typename T::key_type, typename T::mapped_type>> =
|
||||
is_container<T>;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_fixed_array = false;
|
||||
template <template <typename, size_t> typename arr_t, typename value_t, size_t size>
|
||||
constexpr bool is_fixed_array<arr_t<value_t, size>> = true;
|
||||
|
||||
template <typename T, typename = std::enable_if_t<is_fixed_array<T>>>
|
||||
constexpr size_t fixed_array_size = 0;
|
||||
template <template <typename, size_t> typename arr_t, typename value_t, size_t size>
|
||||
constexpr size_t fixed_array_size<arr_t<value_t, size>> = size;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_collection = false;
|
||||
template <typename T>
|
||||
constexpr bool is_collection<T> = is_container<T> && !is_map<T> && !is_fixed_array<T>;
|
||||
|
||||
template <typename T>
|
||||
constexpr bool is_variant = false;
|
||||
template <typename... args_t>
|
||||
constexpr bool is_variant<std::variant<args_t...>> = true;
|
||||
|
||||
template <typename T>
|
||||
constexpr bool is_tuple = false;
|
||||
template <typename... args_t>
|
||||
constexpr bool is_tuple<std::tuple<args_t...>> = true;
|
||||
|
||||
template <typename T>
|
||||
constexpr bool is_pair = false;
|
||||
template <typename... args_t>
|
||||
constexpr bool is_pair<std::pair<args_t...>> = true;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_tuple_like = false;
|
||||
template <template <typename...> typename tuple_t, typename... args_t>
|
||||
constexpr bool is_tuple_like<
|
||||
tuple_t<args_t...>,
|
||||
std::void_t<decltype(std::tuple_size<tuple_t<args_t...>>::value)>> =
|
||||
std::tuple_size<tuple_t<args_t...>>::value == sizeof...(args_t);
|
||||
|
||||
template <typename T>
|
||||
class has_emplace_back
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int) -> decltype(std::declval<U>().emplace_back(), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class has_to_json_in_member
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int) -> decltype(std::declval<U>().to_json(), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_check_json_in_member
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<U>().check_json(std::declval<json::basic_value<string_t>>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_from_json_in_member
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<U>().from_json(std::declval<json::basic_value<string_t>>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_to_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().to_json(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_check_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().check_json(std::declval<json::basic_value<string_t>>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_from_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().from_json(std::declval<json::basic_value<string_t>>(), std::declval<U&>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_move_to_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().move_to_json(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_move_from_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().move_from_json(std::declval<json::basic_value<string_t>>(), std::declval<U&>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_to_json_array_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().to_json_array(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_check_json_array_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().check_json_array(std::declval<json::basic_array<string_t>>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_from_json_array_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().from_json_array(std::declval<json::basic_array<string_t>>(), std::declval<U&>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_move_to_json_array_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().move_to_json_array(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_move_from_json_array_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().move_from_json_array(std::declval<json::basic_array<string_t>>(), std::declval<U&>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_to_json_object_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().to_json_object(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_check_json_object_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().check_json_object(std::declval<json::basic_object<string_t>>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_from_json_object_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().from_json_object(std::declval<json::basic_object<string_t>>(), std::declval<U&>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_move_to_json_object_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().move_to_json_object(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_move_from_json_object_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<string_t, U>>().move_from_json_object(std::declval<json::basic_object<string_t>>(), std::declval<U&>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
inline constexpr string_t unescape_string(const string_t& str)
|
||||
{
|
||||
using char_t = typename string_t::value_type;
|
||||
|
||||
string_t result {};
|
||||
auto cur = str.cbegin();
|
||||
auto end = str.cend();
|
||||
auto no_escape_beg = cur;
|
||||
char_t escape = 0;
|
||||
|
||||
for (; cur != end; ++cur) {
|
||||
switch (*cur) {
|
||||
case '"':
|
||||
escape = '"';
|
||||
break;
|
||||
case '\\':
|
||||
escape = '\\';
|
||||
break;
|
||||
case '\b':
|
||||
escape = 'b';
|
||||
break;
|
||||
case '\f':
|
||||
escape = 'f';
|
||||
break;
|
||||
case '\n':
|
||||
escape = 'n';
|
||||
break;
|
||||
case '\r':
|
||||
escape = 'r';
|
||||
break;
|
||||
case '\t':
|
||||
escape = 't';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (escape) {
|
||||
result += string_t(no_escape_beg, cur) + char_t('\\') + escape;
|
||||
no_escape_beg = cur + 1;
|
||||
escape = 0;
|
||||
}
|
||||
}
|
||||
result += string_t(no_escape_beg, cur);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline constexpr string_t true_string()
|
||||
{
|
||||
return { 't', 'r', 'u', 'e' };
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline constexpr string_t false_string()
|
||||
{
|
||||
return { 'f', 'a', 'l', 's', 'e' };
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline constexpr string_t null_string()
|
||||
{
|
||||
return { 'n', 'u', 'l', 'l' };
|
||||
}
|
||||
|
||||
template <typename string_t, typename any_t>
|
||||
inline string_t to_basic_string(any_t&& arg)
|
||||
{
|
||||
#ifdef MEOJSON_KEEP_FLOATING_PRECISION
|
||||
using real_type = std::remove_reference_t<any_t>;
|
||||
if constexpr (std::is_floating_point_v<real_type>) {
|
||||
if constexpr (std::is_same_v<string_t, std::string>) {
|
||||
std::ostringstream oss;
|
||||
oss << std::setprecision(std::numeric_limits<real_type>::max_digits10) << arg;
|
||||
return oss.str();
|
||||
}
|
||||
else if constexpr (std::is_same_v<string_t, std::wstring>) {
|
||||
std::wostringstream oss;
|
||||
oss << std::setprecision(std::numeric_limits<real_type>::max_digits10) << arg;
|
||||
return oss.str();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if constexpr (std::is_same_v<string_t, std::string>) {
|
||||
return std::to_string(std::forward<any_t>(arg));
|
||||
}
|
||||
else if constexpr (std::is_same_v<string_t, std::wstring>) {
|
||||
return std::to_wstring(std::forward<any_t>(arg));
|
||||
}
|
||||
else {
|
||||
static_assert(!sizeof(any_t), "Unsupported type");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace json::_utils
|
||||
|
||||
#include "../reflection/extensions.hpp"
|
||||
1142
3rdparty/include/meojson/common/value.hpp
vendored
9
3rdparty/include/meojson/json.hpp
vendored
@@ -1,9 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
|
||||
#include "common/types.hpp"
|
||||
#include "parser/parser.hpp"
|
||||
#include "reflection/jsonization.hpp"
|
||||
|
||||
// IWYU pragma: end_exports
|
||||
139
3rdparty/include/meojson/parser/bitops.hpp
vendored
@@ -1,139 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus >= 202002L || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)
|
||||
#include <bit>
|
||||
|
||||
namespace json::_bitops
|
||||
{
|
||||
using std::countl_one;
|
||||
using std::countl_zero;
|
||||
using std::countr_one;
|
||||
using std::countr_zero;
|
||||
|
||||
inline constexpr bool is_little_endian()
|
||||
{
|
||||
return std::endian::native == std::endian::little;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#include <cstdint>
|
||||
|
||||
namespace json::_bitops
|
||||
{
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
inline constexpr int countl_zero(uint32_t x)
|
||||
{
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned int)) {
|
||||
return x == 0 ? 32 : __builtin_clz(x);
|
||||
}
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned long)) {
|
||||
return x == 0 ? 32 : __builtin_clzl(x);
|
||||
}
|
||||
return x == 0 ? 32 : __builtin_clzll(x);
|
||||
}
|
||||
|
||||
inline constexpr int countr_zero(uint32_t x)
|
||||
{
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned int)) {
|
||||
return x == 0 ? 32 : __builtin_ctz(x);
|
||||
}
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned long)) {
|
||||
return x == 0 ? 32 : __builtin_ctzl(x);
|
||||
}
|
||||
return x == 0 ? 32 : __builtin_ctzll(x);
|
||||
}
|
||||
|
||||
inline constexpr int countl_zero(uint64_t x)
|
||||
{
|
||||
return x == 0 ? 64 : __builtin_clzll(x);
|
||||
}
|
||||
|
||||
inline constexpr int countr_zero(uint64_t x)
|
||||
{
|
||||
return x == 0 ? 64 : __builtin_ctzll(x);
|
||||
}
|
||||
#elif defined(_MSC_VER)
|
||||
#ifdef __AVX2__
|
||||
// lzcnt intrinsics is not constexpr
|
||||
inline int countl_zero(uint32_t x)
|
||||
{
|
||||
return __lzcnt(x);
|
||||
}
|
||||
|
||||
inline int countr_zero(uint32_t x)
|
||||
{
|
||||
return _tzcnt_u32(x);
|
||||
}
|
||||
|
||||
inline int countl_zero(uint64_t x)
|
||||
{
|
||||
return (int)__lzcnt64(x);
|
||||
}
|
||||
|
||||
inline int countr_zero(uint64_t x)
|
||||
{
|
||||
return (int)_tzcnt_u64(x);
|
||||
}
|
||||
#else
|
||||
inline constexpr int countl_zero(uint32_t x)
|
||||
{
|
||||
unsigned long index = 0;
|
||||
return _BitScanReverse(&index, x) ? 31 - index : 32;
|
||||
}
|
||||
|
||||
inline constexpr int countr_zero(uint32_t x)
|
||||
{
|
||||
unsigned long index = 0;
|
||||
return _BitScanForward(&index, x) ? index : 32;
|
||||
}
|
||||
|
||||
inline constexpr int countl_zero(uint64_t x)
|
||||
{
|
||||
unsigned long index = 0;
|
||||
return _BitScanReverse64(&index, x) ? 63 - index : 64;
|
||||
}
|
||||
|
||||
inline constexpr int countr_zero(uint64_t x)
|
||||
{
|
||||
unsigned long index = 0;
|
||||
return _BitScanForward64(&index, x) ? index : 64;
|
||||
}
|
||||
#endif // __AVX2__
|
||||
#else // compiler
|
||||
#error "bring your own bit counting implementation"
|
||||
#endif
|
||||
inline int countl_one(uint32_t x)
|
||||
{
|
||||
return countl_zero(~x);
|
||||
}
|
||||
|
||||
inline int countr_one(uint32_t x)
|
||||
{
|
||||
return countr_zero(~x);
|
||||
}
|
||||
|
||||
inline int countl_one(uint64_t x)
|
||||
{
|
||||
return countl_zero(~x);
|
||||
}
|
||||
|
||||
inline int countr_one(uint64_t x)
|
||||
{
|
||||
return countr_zero(~x);
|
||||
}
|
||||
|
||||
// no constexpr endian awareness before C++20
|
||||
inline bool is_little_endian()
|
||||
{
|
||||
union
|
||||
{
|
||||
uint32_t u32;
|
||||
uint8_t u8;
|
||||
} u = { 0x01020304 };
|
||||
|
||||
return u.u8 == 4;
|
||||
}
|
||||
} // namespace json::_bitops
|
||||
#endif // C++20
|
||||
161
3rdparty/include/meojson/parser/packed_bytes.hpp
vendored
@@ -1,161 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
|
||||
#include "bitops.hpp"
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define __packed_bytes_strong_inline __attribute__((always_inline))
|
||||
#elif defined(_MSC_VER)
|
||||
#define __packed_bytes_strong_inline __forceinline
|
||||
#else
|
||||
#define __packed_bytes_strong_inline inline
|
||||
#endif
|
||||
|
||||
namespace json::_packed_bytes
|
||||
{
|
||||
struct packed_bytes_trait_none
|
||||
{
|
||||
static constexpr bool available = false;
|
||||
};
|
||||
|
||||
template <size_t N>
|
||||
struct packed_bytes
|
||||
{
|
||||
using traits = packed_bytes_trait_none;
|
||||
};
|
||||
}
|
||||
|
||||
#ifndef MEOJSON_DISABLE_PACKED_BYTES
|
||||
#if defined(__SSE2__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP)
|
||||
#include "packed_bytes_x86.hpp"
|
||||
#elif defined(__ARM_NEON) || defined(_M_ARM) || defined(_M_ARM64)
|
||||
#include "packed_bytes_arm.hpp"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace json::_packed_bytes
|
||||
{
|
||||
struct packed_bytes_trait_uint64
|
||||
{
|
||||
static constexpr bool available = sizeof(void*) >= 8;
|
||||
static constexpr auto step = 8;
|
||||
using value_type = uint64_t;
|
||||
|
||||
__packed_bytes_strong_inline static value_type load_unaligned(const void* ptr)
|
||||
{
|
||||
value_type result;
|
||||
memcpy((void*)&result, ptr, 8);
|
||||
return result;
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type less(value_type x, uint8_t n)
|
||||
{
|
||||
return (((x)-UINT64_C(0x0101010101010101) * (n)) & ~(x)&UINT64_C(0x8080808080808080));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type is_zero_memberwise(value_type v)
|
||||
{
|
||||
return (((v)-UINT64_C(0x0101010101010101)) & ~(v)&UINT64_C(0x8080808080808080));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static bool is_all_zero(value_type v) { return v == UINT64_C(0); }
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, uint8_t n)
|
||||
{
|
||||
return is_zero_memberwise((x) ^ (UINT64_C(0x0101010101010101) * (n)));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b)
|
||||
{
|
||||
return a | b;
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static size_t first_nonzero_byte(value_type x)
|
||||
{
|
||||
if (_bitops::is_little_endian()) {
|
||||
return _bitops::countr_zero(x) / 8;
|
||||
}
|
||||
else {
|
||||
return _bitops::countl_zero(x) / 8;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct packed_bytes_trait_uint32
|
||||
{
|
||||
static constexpr bool available = true;
|
||||
static constexpr auto step = 4;
|
||||
using value_type = uint32_t;
|
||||
|
||||
__packed_bytes_strong_inline static value_type load_unaligned(const void* ptr)
|
||||
{
|
||||
value_type result;
|
||||
memcpy((void*)&result, ptr, 4);
|
||||
return result;
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type less(value_type x, uint8_t n)
|
||||
{
|
||||
return (((x) - ~UINT32_C(0) / 255 * (n)) & ~(x) & ~UINT32_C(0) / 255 * 128);
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type is_zero_memberwise(value_type v)
|
||||
{
|
||||
return (((v)-UINT32_C(0x01010101)) & ~(v)&UINT32_C(0x80808080));
|
||||
;
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static bool is_all_zero(value_type v) { return v == UINT32_C(0); }
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, uint8_t n)
|
||||
{
|
||||
return is_zero_memberwise((x) ^ (~UINT32_C(0) / 255 * (n)));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b)
|
||||
{
|
||||
return a | b;
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static size_t first_nonzero_byte(value_type x)
|
||||
{
|
||||
if (_bitops::is_little_endian()) {
|
||||
return _bitops::countr_zero(x) / 8;
|
||||
}
|
||||
else {
|
||||
return _bitops::countl_zero(x) / 8;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct packed_bytes<8>
|
||||
{
|
||||
using traits = packed_bytes_trait_uint64;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct packed_bytes<4>
|
||||
{
|
||||
using traits = packed_bytes_trait_uint32;
|
||||
};
|
||||
|
||||
template <size_t N>
|
||||
using packed_bytes_trait = typename packed_bytes<N>::traits;
|
||||
|
||||
using packed_bytes_trait_max = std::conditional_t<
|
||||
packed_bytes_trait<32>::available,
|
||||
packed_bytes_trait<32>,
|
||||
std::conditional_t<
|
||||
packed_bytes_trait<16>::available,
|
||||
packed_bytes_trait<16>,
|
||||
std::conditional_t<
|
||||
packed_bytes_trait<8>::available,
|
||||
packed_bytes_trait<8>,
|
||||
packed_bytes_trait<4>>>>;
|
||||
} // namespace json::_packed_bytes
|
||||
@@ -1,79 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
// current NEON implementation doesn't outperform 64-bit scalar implementation
|
||||
#ifdef MEOJSON_ENABLE_NEON
|
||||
#include "packed_bytes.hpp"
|
||||
#include <arm_neon.h>
|
||||
|
||||
#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)
|
||||
#define __packed_bytes_trait_arm64
|
||||
#endif
|
||||
|
||||
namespace json::_packed_bytes
|
||||
{
|
||||
struct packed_bytes_trait_neon
|
||||
{
|
||||
static constexpr bool available = true;
|
||||
static constexpr auto step = 16;
|
||||
using value_type = uint8x16_t;
|
||||
|
||||
__packed_bytes_strong_inline static value_type load_unaligned(const void* ptr)
|
||||
{
|
||||
return vld1q_u8((uint8_t*)ptr);
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type less(value_type x, uint8_t n)
|
||||
{
|
||||
auto bcast = vdupq_n_u8(n);
|
||||
auto is_less = vcltq_u8(x, bcast);
|
||||
return is_less;
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, uint8_t n)
|
||||
{
|
||||
return vceqq_u8(x, vdupq_n_u8(n));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, value_type y)
|
||||
{
|
||||
return vceqq_u8(x, y);
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b)
|
||||
{
|
||||
return vorrq_u8(a, b);
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static bool is_all_zero(value_type x)
|
||||
{
|
||||
#ifdef __packed_bytes_trait_arm64
|
||||
return vmaxvq_u8(x) == 0;
|
||||
#else
|
||||
auto fold64 = vorr_u64(
|
||||
vget_high_u64(vreinterpretq_u8_u64(x), 0),
|
||||
vget_low_u64(vreinterpretq_u8_u64(x), 1));
|
||||
auto fold32 = vget_lane_u32(vreinterpret_u64_u32(fold64), 0)
|
||||
| vget_lane_u32(vreinterpret_u64_u32(fold64), 1);
|
||||
return fold32 == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static size_t first_nonzero_byte(value_type x)
|
||||
{
|
||||
// https://community.arm.com/arm-community-blogs/b/infrastructure-solutions-blog/posts/porting-x86-vector-bitmask-optimizations-to-arm-neon
|
||||
auto cmp = equal(x, 0);
|
||||
auto res = vshrn_n_u16(cmp, 4);
|
||||
auto mask64 = vget_lane_u64(vreinterpret_u64_u8(res), 0);
|
||||
return _bitops::countr_one(mask64) >> 2;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct packed_bytes<16>
|
||||
{
|
||||
using traits = packed_bytes_trait_neon;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
140
3rdparty/include/meojson/parser/packed_bytes_x86.hpp
vendored
@@ -1,140 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "packed_bytes.hpp"
|
||||
|
||||
#include <emmintrin.h>
|
||||
#if defined(__SSE4_1__) || defined(__AVX2__) || defined(_MSC_VER)
|
||||
// MSVC enables all SSE4.1 intrinsics by default
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
|
||||
namespace json::_packed_bytes
|
||||
{
|
||||
struct packed_bytes_trait_sse
|
||||
{
|
||||
static constexpr bool available = true;
|
||||
static constexpr auto step = 16;
|
||||
using value_type = __m128i;
|
||||
|
||||
__packed_bytes_strong_inline static value_type load_unaligned(const void* ptr)
|
||||
{
|
||||
return _mm_loadu_si128(reinterpret_cast<const __m128i*>(ptr));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type less(value_type x, uint8_t n)
|
||||
{
|
||||
auto bcast = _mm_set1_epi8(static_cast<char>(n));
|
||||
auto all1 = _mm_set1_epi8(-1);
|
||||
auto max_with_n = _mm_max_epu8(x, bcast);
|
||||
auto is_greater_or_equal = _mm_cmpeq_epi8(max_with_n, x);
|
||||
auto is_less = _mm_andnot_si128(is_greater_or_equal, all1);
|
||||
return is_less;
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, uint8_t n)
|
||||
{
|
||||
return _mm_cmpeq_epi8(x, _mm_set1_epi8(static_cast<char>(n)));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, value_type y)
|
||||
{
|
||||
return _mm_cmpeq_epi8(x, y);
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b)
|
||||
{
|
||||
return _mm_or_si128(a, b);
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static bool is_all_zero(value_type x)
|
||||
{
|
||||
#if defined(__SSE4_1__) || defined(__AVX2__) || defined(_MSC_VER)
|
||||
// SSE4.1 path
|
||||
return !!_mm_testz_si128(x, x);
|
||||
#else
|
||||
// SSE2 path
|
||||
auto cmp = _mm_cmpeq_epi8(x, _mm_set1_epi8(0));
|
||||
auto mask = (uint16_t)_mm_movemask_epi8(cmp);
|
||||
return mask == UINT16_C(0xFFFF);
|
||||
#endif
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static size_t first_nonzero_byte(value_type x)
|
||||
{
|
||||
auto cmp = _mm_cmpeq_epi8(x, _mm_set1_epi8(0));
|
||||
auto mask = (uint16_t)_mm_movemask_epi8(cmp);
|
||||
return _bitops::countr_one((uint32_t)mask);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct packed_bytes<16>
|
||||
{
|
||||
using traits = packed_bytes_trait_sse;
|
||||
};
|
||||
}
|
||||
#ifdef __AVX2__
|
||||
#include <immintrin.h>
|
||||
|
||||
namespace json::_packed_bytes
|
||||
{
|
||||
struct packed_bytes_trait_avx2
|
||||
{
|
||||
static constexpr bool available = true;
|
||||
static constexpr auto step = 32;
|
||||
using value_type = __m256i;
|
||||
|
||||
__packed_bytes_strong_inline static value_type load_unaligned(const void* ptr)
|
||||
{
|
||||
return _mm256_loadu_si256(reinterpret_cast<const __m256i*>(ptr));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type less(value_type x, uint8_t n)
|
||||
{
|
||||
auto bcast = _mm256_set1_epi8(static_cast<char>(n));
|
||||
auto all1 = _mm256_set1_epi8(-1);
|
||||
auto max_with_n = _mm256_max_epu8(x, bcast);
|
||||
auto is_greater_or_equal = _mm256_cmpeq_epi8(max_with_n, x);
|
||||
auto is_less = _mm256_andnot_si256(is_greater_or_equal, all1);
|
||||
return is_less;
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, uint8_t n)
|
||||
{
|
||||
return _mm256_cmpeq_epi8(x, _mm256_set1_epi8(static_cast<char>(n)));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, value_type y)
|
||||
{
|
||||
return _mm256_cmpeq_epi8(x, y);
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b)
|
||||
{
|
||||
return _mm256_or_si256(a, b);
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static bool is_all_zero(value_type x)
|
||||
{
|
||||
return (bool)_mm256_testz_si256(x, x);
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static size_t first_nonzero_byte(value_type x)
|
||||
{
|
||||
auto cmp = _mm256_cmpeq_epi8(x, _mm256_set1_epi8(0));
|
||||
auto mask = (uint32_t)_mm256_movemask_epi8(cmp);
|
||||
// AVX512 alternative: _mm_cmpeq_epi8_mask
|
||||
return _bitops::countr_one(mask);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct packed_bytes<32>
|
||||
{
|
||||
using traits = packed_bytes_trait_avx2;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
862
3rdparty/include/meojson/parser/parser.hpp
vendored
@@ -1,862 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cctype>
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#include "../common/types.hpp"
|
||||
#include "packed_bytes.hpp"
|
||||
|
||||
namespace json
|
||||
{
|
||||
// ****************************
|
||||
// * parser declare *
|
||||
// ****************************
|
||||
|
||||
template <
|
||||
bool accept_jsonc = false,
|
||||
typename string_t = default_string_t,
|
||||
typename parsing_t = void,
|
||||
typename accel_traits = _packed_bytes::packed_bytes_trait_max>
|
||||
class parser
|
||||
{
|
||||
public:
|
||||
using parsing_iter_t = typename parsing_t::const_iterator;
|
||||
|
||||
public:
|
||||
~parser() noexcept = default;
|
||||
|
||||
static std::optional<basic_value<string_t>> parse(const parsing_t& content);
|
||||
|
||||
private:
|
||||
parser(parsing_iter_t cbegin, parsing_iter_t cend) noexcept
|
||||
: _cur(cbegin)
|
||||
, _end(cend)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
std::optional<basic_value<string_t>> parse();
|
||||
basic_value<string_t> parse_value();
|
||||
|
||||
basic_value<string_t> parse_null();
|
||||
basic_value<string_t> parse_boolean();
|
||||
basic_value<string_t> parse_number();
|
||||
// parse and return a basic_value<string_t> whose type is value_type::string
|
||||
basic_value<string_t> parse_string();
|
||||
basic_value<string_t> parse_array();
|
||||
basic_value<string_t> parse_object();
|
||||
|
||||
// parse and return a string_t
|
||||
std::optional<string_t> parse_stdstring();
|
||||
|
||||
bool skip_string_literal_with_accel();
|
||||
bool skip_whitespace() noexcept;
|
||||
bool skip_comment() noexcept;
|
||||
bool skip_digit();
|
||||
bool skip_unicode_escape(uint16_t& pair_high, string_t& result);
|
||||
|
||||
private:
|
||||
parsing_iter_t _cur;
|
||||
parsing_iter_t _end;
|
||||
};
|
||||
|
||||
// ***************************
|
||||
// * utils declare *
|
||||
// ***************************
|
||||
|
||||
template <typename parsing_t>
|
||||
auto parse(const parsing_t& content);
|
||||
|
||||
template <typename char_t>
|
||||
auto parse(char_t* content);
|
||||
|
||||
template <typename parsing_t>
|
||||
auto parsec(const parsing_t& content);
|
||||
|
||||
template <typename char_t>
|
||||
auto parsec(char_t* content);
|
||||
|
||||
template <
|
||||
typename istream_t,
|
||||
typename = std::enable_if_t<
|
||||
std::is_base_of_v<std::basic_istream<typename istream_t::char_type>, istream_t>>>
|
||||
auto parse(istream_t& istream, bool check_bom = false, bool with_commets = false);
|
||||
|
||||
template <typename ifstream_t = std::ifstream, typename path_t = void>
|
||||
auto open(const path_t& path, bool check_bom = false, bool with_commets = false);
|
||||
|
||||
namespace literals
|
||||
{
|
||||
value operator""_json(const char* str, size_t len);
|
||||
wvalue operator""_json(const wchar_t* str, size_t len);
|
||||
|
||||
value operator""_jvalue(const char* str, size_t len);
|
||||
wvalue operator""_jvalue(const wchar_t* str, size_t len);
|
||||
|
||||
array operator""_jarray(const char* str, size_t len);
|
||||
warray operator""_jarray(const wchar_t* str, size_t len);
|
||||
|
||||
object operator""_jobject(const char* str, size_t len);
|
||||
wobject operator""_jobject(const wchar_t* str, size_t len);
|
||||
}
|
||||
|
||||
template <typename string_t = default_string_t>
|
||||
const basic_value<string_t> invalid_value();
|
||||
|
||||
// *************************
|
||||
// * parser impl *
|
||||
// *************************
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline std::optional<basic_value<string_t>>
|
||||
parser<accept_jsonc, string_t, parsing_t, accel_traits>::parse(const parsing_t& content)
|
||||
{
|
||||
return parser<accept_jsonc, string_t, parsing_t, accel_traits>(content.cbegin(), content.cend())
|
||||
.parse();
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline std::optional<basic_value<string_t>>
|
||||
parser<accept_jsonc, string_t, parsing_t, accel_traits>::parse()
|
||||
{
|
||||
if (!skip_whitespace()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
basic_value<string_t> result_value;
|
||||
switch (*_cur) {
|
||||
case '[':
|
||||
result_value = parse_array();
|
||||
break;
|
||||
case '{':
|
||||
result_value = parse_object();
|
||||
break;
|
||||
default: // A JSON payload should be an basic_object or basic_array
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (!result_value.valid()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// After the parsing is complete, there should be no more content other than spaces behind
|
||||
if (skip_whitespace()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return result_value;
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<accept_jsonc, string_t, parsing_t, accel_traits>::parse_value()
|
||||
{
|
||||
switch (*_cur) {
|
||||
case 'n':
|
||||
return parse_null();
|
||||
case 't':
|
||||
case 'f':
|
||||
return parse_boolean();
|
||||
case '-':
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
return parse_number();
|
||||
case '"':
|
||||
return parse_string();
|
||||
case '[':
|
||||
return parse_array();
|
||||
case '{':
|
||||
return parse_object();
|
||||
default:
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<accept_jsonc, string_t, parsing_t, accel_traits>::parse_null()
|
||||
{
|
||||
for (const auto& ch : _utils::null_string<string_t>()) {
|
||||
if (_cur != _end && *_cur == ch) {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
|
||||
return basic_value<string_t>();
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t>
|
||||
parser<accept_jsonc, string_t, parsing_t, accel_traits>::parse_boolean()
|
||||
{
|
||||
switch (*_cur) {
|
||||
case 't':
|
||||
for (const auto& ch : _utils::true_string<string_t>()) {
|
||||
if (_cur != _end && *_cur == ch) {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case 'f':
|
||||
for (const auto& ch : _utils::false_string<string_t>()) {
|
||||
if (_cur != _end && *_cur == ch) {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<accept_jsonc, string_t, parsing_t, accel_traits>::parse_number()
|
||||
{
|
||||
const auto first = _cur;
|
||||
if (*_cur == '-') {
|
||||
++_cur;
|
||||
}
|
||||
|
||||
// numbers cannot have leading zeroes
|
||||
if (_cur != _end && *_cur == '0' && _cur + 1 != _end && std::isdigit(*(_cur + 1))) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (!skip_digit()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (*_cur == '.') {
|
||||
++_cur;
|
||||
if (!skip_digit()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
|
||||
if (*_cur == 'e' || *_cur == 'E') {
|
||||
if (++_cur == _end) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
if (*_cur == '+' || *_cur == '-') {
|
||||
++_cur;
|
||||
}
|
||||
if (!skip_digit()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
|
||||
return basic_value<string_t>(basic_value<string_t>::value_type::number, string_t(first, _cur));
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<accept_jsonc, string_t, parsing_t, accel_traits>::parse_string()
|
||||
{
|
||||
auto string_opt = parse_stdstring();
|
||||
if (!string_opt) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
return basic_value<string_t>(
|
||||
basic_value<string_t>::value_type::string,
|
||||
std::move(string_opt).value());
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<accept_jsonc, string_t, parsing_t, accel_traits>::parse_array()
|
||||
{
|
||||
if (*_cur == '[') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (!skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
else if (*_cur == ']') {
|
||||
++_cur;
|
||||
// empty basic_array
|
||||
return basic_array<string_t>();
|
||||
}
|
||||
|
||||
typename basic_array<string_t>::raw_array result;
|
||||
while (true) {
|
||||
if (!skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if constexpr (accept_jsonc) {
|
||||
if (*_cur == ']') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
basic_value<string_t> val = parse_value();
|
||||
|
||||
if (!val.valid() || !skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
result.emplace_back(std::move(val));
|
||||
|
||||
if (*_cur == ',') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (skip_whitespace() && *_cur == ']') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
return basic_array<string_t>(std::move(result));
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<accept_jsonc, string_t, parsing_t, accel_traits>::parse_object()
|
||||
{
|
||||
if (*_cur == '{') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (!skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
else if (*_cur == '}') {
|
||||
++_cur;
|
||||
// empty basic_object
|
||||
return basic_object<string_t>();
|
||||
}
|
||||
|
||||
typename basic_object<string_t>::raw_object result;
|
||||
while (true) {
|
||||
if (!skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if constexpr (accept_jsonc) {
|
||||
if (*_cur == '}') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto key_opt = parse_stdstring();
|
||||
|
||||
if (key_opt && skip_whitespace() && *_cur == ':') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (!skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
basic_value<string_t> val = parse_value();
|
||||
|
||||
if (!val.valid() || !skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
auto emplaced = result.emplace(std::move(*key_opt), std::move(val)).second;
|
||||
if (!emplaced) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (*_cur == ',') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (skip_whitespace() && *_cur == '}') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
return basic_object<string_t>(std::move(result));
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline std::optional<string_t>
|
||||
parser<accept_jsonc, string_t, parsing_t, accel_traits>::parse_stdstring()
|
||||
{
|
||||
if (*_cur == '"') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
string_t result;
|
||||
auto no_escape_beg = _cur;
|
||||
uint16_t pair_high = 0;
|
||||
|
||||
while (_cur != _end) {
|
||||
if constexpr (sizeof(*_cur) == 1 && accel_traits::available) {
|
||||
if (!skip_string_literal_with_accel()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
switch (*_cur) {
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\n':
|
||||
return std::nullopt;
|
||||
case '\\': {
|
||||
result += string_t(no_escape_beg, _cur++);
|
||||
if (_cur == _end) {
|
||||
return std::nullopt;
|
||||
}
|
||||
if (pair_high && *_cur != 'u') {
|
||||
return std::nullopt;
|
||||
}
|
||||
switch (*_cur) {
|
||||
case '"':
|
||||
result.push_back('"');
|
||||
break;
|
||||
case '\\':
|
||||
result.push_back('\\');
|
||||
break;
|
||||
case '/':
|
||||
result.push_back('/');
|
||||
break;
|
||||
case 'b':
|
||||
result.push_back('\b');
|
||||
break;
|
||||
case 'f':
|
||||
result.push_back('\f');
|
||||
break;
|
||||
case 'n':
|
||||
result.push_back('\n');
|
||||
break;
|
||||
case 'r':
|
||||
result.push_back('\r');
|
||||
break;
|
||||
case 't':
|
||||
result.push_back('\t');
|
||||
break;
|
||||
case 'u':
|
||||
if (!skip_unicode_escape(pair_high, result)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Illegal backslash escape
|
||||
return std::nullopt;
|
||||
}
|
||||
no_escape_beg = ++_cur;
|
||||
break;
|
||||
}
|
||||
case '"': {
|
||||
if (pair_high) {
|
||||
return std::nullopt;
|
||||
}
|
||||
result += string_t(no_escape_beg, _cur++);
|
||||
return result;
|
||||
}
|
||||
default:
|
||||
if (pair_high) {
|
||||
return std::nullopt;
|
||||
}
|
||||
++_cur;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline bool parser<accept_jsonc, string_t, parsing_t, accel_traits>::skip_unicode_escape(
|
||||
uint16_t& pair_high,
|
||||
string_t& result)
|
||||
{
|
||||
uint16_t cp = 0;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (++_cur == _end) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!std::isxdigit(static_cast<unsigned char>(*_cur))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
cp <<= 4;
|
||||
|
||||
if ('0' <= *_cur && *_cur <= '9') {
|
||||
cp |= *_cur - '0';
|
||||
}
|
||||
else if ('a' <= *_cur && *_cur <= 'f') {
|
||||
cp |= *_cur - 'a' + 10;
|
||||
}
|
||||
else if ('A' <= *_cur && *_cur <= 'F') {
|
||||
cp |= *_cur - 'A' + 10;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ext_cp = cp;
|
||||
uint16_t hi_cp = 0, lo_cp = 0;
|
||||
|
||||
if (0xD800 <= cp && cp <= 0xDBFF) {
|
||||
if (pair_high) {
|
||||
return false;
|
||||
}
|
||||
pair_high = cp;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (0xDC00 <= cp && cp <= 0xDFFF) {
|
||||
if (!pair_high) {
|
||||
return false;
|
||||
}
|
||||
ext_cp = (((pair_high - 0xD800) << 10) | (cp - 0xDC00)) + 0x10000;
|
||||
hi_cp = pair_high;
|
||||
lo_cp = cp;
|
||||
pair_high = 0;
|
||||
}
|
||||
|
||||
if constexpr (std::is_same_v<typename string_t::value_type, char>) {
|
||||
// utf8
|
||||
if (ext_cp <= 0x7F) {
|
||||
result.push_back(static_cast<char>(ext_cp));
|
||||
}
|
||||
else if (ext_cp <= 0x7FF) {
|
||||
result.push_back(static_cast<char>(((ext_cp >> 6) & 0b00011111) | 0b11000000u));
|
||||
result.push_back(static_cast<char>((ext_cp & 0b00111111) | 0b10000000u));
|
||||
}
|
||||
else if (ext_cp <= 0xFFFF) {
|
||||
result.push_back(static_cast<char>(((ext_cp >> 12) & 0b00001111) | 0b11100000u));
|
||||
result.push_back(static_cast<char>(((ext_cp >> 6) & 0b00111111) | 0b10000000u));
|
||||
result.push_back(static_cast<char>((ext_cp & 0b00111111) | 0b10000000u));
|
||||
}
|
||||
else {
|
||||
result.push_back(static_cast<char>(((ext_cp >> 18) & 0b00000111) | 0b11110000u));
|
||||
result.push_back(static_cast<char>(((ext_cp >> 12) & 0b00111111) | 0b10000000u));
|
||||
result.push_back(static_cast<char>(((ext_cp >> 6) & 0b00111111) | 0b10000000u));
|
||||
result.push_back(static_cast<char>((ext_cp & 0b00111111) | 0b10000000u));
|
||||
}
|
||||
}
|
||||
else if constexpr (std::is_same_v<typename string_t::value_type, wchar_t>) {
|
||||
if constexpr (sizeof(wchar_t) == 4) {
|
||||
result.push_back(static_cast<wchar_t>(ext_cp));
|
||||
}
|
||||
else if constexpr (sizeof(wchar_t) == 2) {
|
||||
if (ext_cp <= 0xFFFF) {
|
||||
result.push_back(static_cast<wchar_t>(ext_cp));
|
||||
}
|
||||
else {
|
||||
result.push_back(static_cast<wchar_t>(hi_cp));
|
||||
result.push_back(static_cast<wchar_t>(lo_cp));
|
||||
}
|
||||
}
|
||||
else {
|
||||
static_assert(!sizeof(typename string_t::value_type), "Unsupported wchar");
|
||||
}
|
||||
}
|
||||
else {
|
||||
static_assert(!sizeof(typename string_t::value_type), "Unsupported type");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline bool
|
||||
parser<accept_jsonc, string_t, parsing_t, accel_traits>::skip_string_literal_with_accel()
|
||||
{
|
||||
if constexpr (sizeof(*_cur) != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (_end - _cur >= accel_traits::step) {
|
||||
auto pack = accel_traits::load_unaligned(&(*_cur));
|
||||
auto result = accel_traits::less(pack, 32);
|
||||
result =
|
||||
accel_traits::bitwise_or(result, accel_traits::equal(pack, static_cast<uint8_t>('"')));
|
||||
result =
|
||||
accel_traits::bitwise_or(result, accel_traits::equal(pack, static_cast<uint8_t>('\\')));
|
||||
|
||||
if (accel_traits::is_all_zero(result)) {
|
||||
_cur += accel_traits::step;
|
||||
}
|
||||
else {
|
||||
auto index = accel_traits::first_nonzero_byte(result);
|
||||
_cur += index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return _cur != _end;
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline bool parser<accept_jsonc, string_t, parsing_t, accel_traits>::skip_whitespace() noexcept
|
||||
{
|
||||
while (_cur != _end) {
|
||||
switch (*_cur) {
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\n':
|
||||
++_cur;
|
||||
break;
|
||||
case '/':
|
||||
if constexpr (accept_jsonc) {
|
||||
if (!skip_comment()) {
|
||||
return false;
|
||||
}
|
||||
// else continue;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case '\0':
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
bool json::parser<accept_jsonc, string_t, parsing_t, accel_traits>::skip_comment() noexcept
|
||||
{
|
||||
if (_cur == _end || *_cur != '/') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (++_cur == _end) {
|
||||
return false;
|
||||
}
|
||||
|
||||
enum class comment_type
|
||||
{
|
||||
invalid,
|
||||
line,
|
||||
block,
|
||||
} t = comment_type::invalid;
|
||||
|
||||
switch (*_cur++) {
|
||||
case '/':
|
||||
t = comment_type::line;
|
||||
break;
|
||||
case '*':
|
||||
t = comment_type::block;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
while (_cur != _end) {
|
||||
switch (*_cur++) {
|
||||
case '\n':
|
||||
if (t == comment_type::line) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case '*':
|
||||
if (t == comment_type::block && _cur != _end && *_cur == '/') {
|
||||
++_cur;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// _cur == _end
|
||||
return t == comment_type::line;
|
||||
}
|
||||
|
||||
template <bool accept_jsonc, typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline bool parser<accept_jsonc, string_t, parsing_t, accel_traits>::skip_digit()
|
||||
{
|
||||
// At least one digit
|
||||
if (_cur != _end && std::isdigit(*_cur)) {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (_cur != _end && std::isdigit(*_cur)) {
|
||||
++_cur;
|
||||
}
|
||||
|
||||
if (_cur != _end) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// *************************
|
||||
// * utils impl *
|
||||
// *************************
|
||||
|
||||
template <typename parsing_t>
|
||||
auto parse(const parsing_t& content)
|
||||
{
|
||||
using string_t = std::basic_string<typename parsing_t::value_type>;
|
||||
return parser<false, string_t, parsing_t>::parse(content);
|
||||
}
|
||||
|
||||
template <typename char_t>
|
||||
auto parse(char_t* content)
|
||||
{
|
||||
return parse(std::basic_string_view<std::decay_t<char_t>> { content });
|
||||
}
|
||||
|
||||
template <typename istream_t, typename _>
|
||||
auto parse(istream_t& ifs, bool check_bom, bool with_commets)
|
||||
{
|
||||
using string_t = std::basic_string<typename istream_t::char_type>;
|
||||
|
||||
ifs.seekg(0, std::ios::end);
|
||||
auto file_size = ifs.tellg();
|
||||
|
||||
ifs.seekg(0, std::ios::beg);
|
||||
string_t str(file_size, '\0');
|
||||
|
||||
ifs.read(str.data(), file_size);
|
||||
|
||||
if (check_bom) {
|
||||
using uchar = unsigned char;
|
||||
static constexpr uchar Bom_0 = 0xEF;
|
||||
static constexpr uchar Bom_1 = 0xBB;
|
||||
static constexpr uchar Bom_2 = 0xBF;
|
||||
|
||||
if (str.size() >= 3 && static_cast<uchar>(str.at(0)) == Bom_0
|
||||
&& static_cast<uchar>(str.at(1)) == Bom_1 && static_cast<uchar>(str.at(2)) == Bom_2) {
|
||||
str.assign(str.begin() + 3, str.end());
|
||||
}
|
||||
}
|
||||
return with_commets ? parsec(str) : parse(str);
|
||||
}
|
||||
|
||||
template <typename ifstream_t, typename path_t>
|
||||
auto open(const path_t& filepath, bool check_bom, bool with_commets)
|
||||
{
|
||||
using char_t = typename ifstream_t::char_type;
|
||||
using string_t = std::basic_string<char_t>;
|
||||
using json_t = json::basic_value<string_t>;
|
||||
using return_t = std::optional<json_t>;
|
||||
|
||||
ifstream_t ifs(filepath, std::ios::in);
|
||||
if (!ifs.is_open()) {
|
||||
return return_t(std::nullopt);
|
||||
}
|
||||
auto opt = parse(ifs, check_bom, with_commets);
|
||||
ifs.close();
|
||||
return opt;
|
||||
}
|
||||
|
||||
template <typename parsing_t>
|
||||
auto parsec(const parsing_t& content)
|
||||
{
|
||||
using string_t = std::basic_string<typename parsing_t::value_type>;
|
||||
return parser<true, string_t, parsing_t>::parse(content);
|
||||
}
|
||||
|
||||
template <typename char_t>
|
||||
auto parsec(char_t* content)
|
||||
{
|
||||
return parsec(std::basic_string_view<std::decay_t<char_t>> { content });
|
||||
}
|
||||
|
||||
namespace literals
|
||||
{
|
||||
inline value operator""_json(const char* str, size_t len)
|
||||
{
|
||||
return operator""_jvalue(str, len);
|
||||
}
|
||||
|
||||
inline wvalue operator""_json(const wchar_t* str, size_t len)
|
||||
{
|
||||
return operator""_jvalue(str, len);
|
||||
}
|
||||
|
||||
inline value operator""_jvalue(const char* str, size_t len)
|
||||
{
|
||||
return parse(std::string_view(str, len)).value_or(value());
|
||||
}
|
||||
|
||||
inline wvalue operator""_jvalue(const wchar_t* str, size_t len)
|
||||
{
|
||||
return parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
}
|
||||
|
||||
inline array operator""_jarray(const char* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::string_view(str, len)).value_or(value());
|
||||
return val.is_array() ? val.as_array() : array();
|
||||
}
|
||||
|
||||
inline warray operator""_jarray(const wchar_t* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
return val.is_array() ? val.as_array() : warray();
|
||||
}
|
||||
|
||||
inline object operator""_jobject(const char* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::string_view(str, len)).value_or(value());
|
||||
return val.is_object() ? val.as_object() : object();
|
||||
}
|
||||
|
||||
inline wobject operator""_jobject(const wchar_t* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
return val.is_object() ? val.as_object() : wobject();
|
||||
}
|
||||
} // namespace literals
|
||||
|
||||
template <typename string_t>
|
||||
const basic_value<string_t> invalid_value()
|
||||
{
|
||||
return basic_value<string_t>(
|
||||
basic_value<string_t>::value_type::invalid,
|
||||
typename basic_value<string_t>::var_t());
|
||||
}
|
||||
} // namespace json
|
||||
656
3rdparty/include/meojson/reflection/extensions.hpp
vendored
@@ -1,656 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <filesystem>
|
||||
#include <queue>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
#include "../common/types.hpp"
|
||||
|
||||
namespace json::ext
|
||||
{
|
||||
|
||||
template <typename string_t, typename impl_t, typename var_t, size_t len> // (size_t)-1 for no
|
||||
// restriction
|
||||
class __jsonization_array
|
||||
{
|
||||
public:
|
||||
json::basic_value<string_t> to_json(const var_t& value) const
|
||||
{
|
||||
return static_cast<const impl_t*>(this)->to_json_array(value);
|
||||
}
|
||||
|
||||
bool check_json(const json::basic_value<string_t>& json) const
|
||||
{
|
||||
if (!json.is_array()) {
|
||||
return false;
|
||||
}
|
||||
const auto& arr = json.as_array();
|
||||
if constexpr (len != static_cast<size_t>(-1)) {
|
||||
if (len != arr.size()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return static_cast<const impl_t*>(this)->check_json_array(arr);
|
||||
}
|
||||
|
||||
bool from_json(const json::basic_value<string_t>& json, var_t& value) const
|
||||
{
|
||||
if (!json.is_array()) {
|
||||
return false;
|
||||
}
|
||||
const auto& arr = json.as_array();
|
||||
if constexpr (len != static_cast<size_t>(-1)) {
|
||||
if (len != arr.size()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return static_cast<const impl_t*>(this)->from_json_array(arr, value);
|
||||
}
|
||||
|
||||
json::basic_value<string_t> move_to_json(var_t value) const
|
||||
{
|
||||
return static_cast<const impl_t*>(this)->move_to_json_array(std::move(value));
|
||||
}
|
||||
|
||||
bool move_from_json(json::basic_value<string_t> json, var_t& value) const
|
||||
{
|
||||
if (!json.is_array()) {
|
||||
return false;
|
||||
}
|
||||
auto& arr = json.as_array();
|
||||
if constexpr (len != static_cast<size_t>(-1)) {
|
||||
if (len != arr.size()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return static_cast<const impl_t*>(this)->move_from_json_array(std::move(arr), value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename string_t, typename impl_t, typename var_t>
|
||||
class __jsonization_object
|
||||
{
|
||||
public:
|
||||
json::basic_value<string_t> to_json(const var_t& value) const
|
||||
{
|
||||
return static_cast<const impl_t*>(this)->to_json_object(value);
|
||||
}
|
||||
|
||||
bool check_json(const json::basic_value<string_t>& json) const
|
||||
{
|
||||
if (!json.is_object()) {
|
||||
return false;
|
||||
}
|
||||
const auto& obj = json.as_object();
|
||||
return static_cast<const impl_t*>(this)->check_json_object(obj);
|
||||
}
|
||||
|
||||
bool from_json(const json::basic_value<string_t>& json, var_t& value) const
|
||||
{
|
||||
if (!json.is_object()) {
|
||||
return false;
|
||||
}
|
||||
const auto& obj = json.as_object();
|
||||
return static_cast<const impl_t*>(this)->from_json_object(obj, value);
|
||||
}
|
||||
|
||||
json::basic_value<string_t> move_to_json(var_t value) const
|
||||
{
|
||||
return static_cast<const impl_t*>(this)->move_to_json_object(std::move(value));
|
||||
}
|
||||
|
||||
bool move_from_json(json::basic_value<string_t> json, var_t& value) const
|
||||
{
|
||||
if (!json.is_object()) {
|
||||
return false;
|
||||
}
|
||||
auto& obj = json.as_object();
|
||||
return static_cast<const impl_t*>(this)->move_from_json_object(std::move(obj), value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
class jsonization<string_t, std::nullptr_t>
|
||||
{
|
||||
public:
|
||||
json::basic_value<string_t> to_json(const std::nullptr_t&) const
|
||||
{
|
||||
return json::basic_value<string_t> {};
|
||||
}
|
||||
|
||||
bool check_json(const json::basic_value<string_t>& json) const { return json.is_null(); }
|
||||
|
||||
bool from_json(const json::basic_value<string_t>& json, std::nullptr_t&)
|
||||
{
|
||||
return check_json(json);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
class jsonization<
|
||||
string_t,
|
||||
std::filesystem::path,
|
||||
std::enable_if_t<
|
||||
std::is_same_v<string_t, std::filesystem::path::string_type>
|
||||
|| std::is_same_v<string_t, std::string>>>
|
||||
{
|
||||
public:
|
||||
json::basic_value<string_t> to_json(const std::filesystem::path& path) const
|
||||
{
|
||||
if constexpr (std::is_same_v<string_t, std::filesystem::path::string_type>) {
|
||||
return path.native();
|
||||
}
|
||||
else if constexpr (std::is_same_v<string_t, std::string>) {
|
||||
#if __cplusplus >= 202002L
|
||||
std::u8string u8str = path.u8string();
|
||||
return std::string { u8str.begin(), u8str.end() };
|
||||
#else
|
||||
return path.u8string();
|
||||
#endif
|
||||
}
|
||||
#if __cplusplus >= 202002L
|
||||
else if constexpr (std::is_same_v<string_t, std::u8string>) {
|
||||
return path.u8string();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool check_json(const json::basic_value<string_t>& json) const { return json.is_string(); }
|
||||
|
||||
bool from_json(const json::basic_value<string_t>& json, std::filesystem::path& path) const
|
||||
{
|
||||
path = json.as_string();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <
|
||||
typename string_t,
|
||||
template <typename, size_t> typename arr_t,
|
||||
typename value_t,
|
||||
size_t size>
|
||||
class jsonization<string_t, arr_t<value_t, size>>
|
||||
: public __jsonization_array<
|
||||
string_t,
|
||||
jsonization<string_t, arr_t<value_t, size>>,
|
||||
arr_t<value_t, size>,
|
||||
size>
|
||||
{
|
||||
public:
|
||||
json::basic_array<string_t> to_json_array(const arr_t<value_t, size>& value) const
|
||||
{
|
||||
json::basic_array<string_t> result;
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
result.emplace_back(value.at(i));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool check_json_array(const json::basic_array<string_t>& arr) const
|
||||
{
|
||||
return arr.template all<value_t>();
|
||||
}
|
||||
|
||||
bool from_json_array(const json::basic_array<string_t>& arr, arr_t<value_t, size>& value) const
|
||||
{
|
||||
if (!check_json_array(arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
value.at(i) = arr[i].template as<value_t>();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
json::basic_array<string_t> move_to_json_array(arr_t<value_t, size> value) const
|
||||
{
|
||||
json::basic_array<string_t> result;
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
result.emplace_back(std::move(value.at(i)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool move_from_json_array(json::basic_array<string_t> arr, arr_t<value_t, size>& value) const
|
||||
{
|
||||
if (!check_json_array(arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
value.at(i) = std::move(arr[i]).template as<value_t>();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename string_t, typename collection_t>
|
||||
class jsonization<string_t, collection_t, std::enable_if_t<_utils::is_collection<collection_t>>>
|
||||
: public __jsonization_array<
|
||||
string_t,
|
||||
jsonization<string_t, collection_t>,
|
||||
collection_t,
|
||||
(size_t)-1>
|
||||
{
|
||||
public:
|
||||
json::basic_array<string_t> to_json_array(const collection_t& value) const
|
||||
{
|
||||
json::basic_array<string_t> result;
|
||||
for (const auto& val : value) {
|
||||
result.emplace_back(val);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool check_json_array(const json::basic_array<string_t>& arr) const
|
||||
{
|
||||
return arr.template all<typename collection_t::value_type>();
|
||||
}
|
||||
|
||||
bool from_json_array(const json::basic_array<string_t>& arr, collection_t& value) const
|
||||
{
|
||||
if (!check_json_array(arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = {};
|
||||
for (const auto& val : arr) {
|
||||
if constexpr (_utils::has_emplace_back<collection_t>::value) {
|
||||
value.emplace_back(val.template as<typename collection_t::value_type>());
|
||||
}
|
||||
else {
|
||||
value.emplace(val.template as<typename collection_t::value_type>());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
json::basic_array<string_t> move_to_json_array(collection_t value) const
|
||||
{
|
||||
json::basic_array<string_t> result;
|
||||
for (auto& val : value) {
|
||||
result.emplace_back(std::move(val));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool move_from_json_array(json::basic_array<string_t> arr, collection_t& value) const
|
||||
{
|
||||
if (!check_json_array(arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto& val : arr) {
|
||||
if constexpr (_utils::has_emplace_back<collection_t>::value) {
|
||||
value.emplace_back(std::move(val).template as<typename collection_t::value_type>());
|
||||
}
|
||||
else {
|
||||
value.emplace(std::move(val).template as<typename collection_t::value_type>());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename string_t, template <typename...> typename tuple_t, typename... args_t>
|
||||
class jsonization<
|
||||
string_t,
|
||||
tuple_t<args_t...>,
|
||||
std::enable_if_t<_utils::is_tuple_like<tuple_t<args_t...>>>>
|
||||
: public __jsonization_array<
|
||||
string_t,
|
||||
jsonization<string_t, tuple_t<args_t...>>,
|
||||
tuple_t<args_t...>,
|
||||
std::tuple_size_v<tuple_t<args_t...>>>
|
||||
{
|
||||
public:
|
||||
constexpr static size_t tuple_size = std::tuple_size_v<tuple_t<args_t...>>;
|
||||
|
||||
json::basic_array<string_t> to_json_array(const tuple_t<args_t...>& value) const
|
||||
{
|
||||
json::basic_array<string_t> result;
|
||||
to_json_impl(result, value, std::make_index_sequence<tuple_size>());
|
||||
return result;
|
||||
}
|
||||
|
||||
template <std::size_t... Is>
|
||||
void to_json_impl(
|
||||
json::basic_array<string_t>& arr,
|
||||
const tuple_t<args_t...>& t,
|
||||
std::index_sequence<Is...>) const
|
||||
{
|
||||
using std::get;
|
||||
(arr.emplace_back(get<Is>(t)), ...);
|
||||
}
|
||||
|
||||
bool check_json_array(const json::basic_array<string_t>& arr) const
|
||||
{
|
||||
return check_json_impl(arr, std::make_index_sequence<tuple_size>());
|
||||
}
|
||||
|
||||
template <std::size_t... Is>
|
||||
bool check_json_impl(const json::basic_array<string_t>& arr, std::index_sequence<Is...>) const
|
||||
{
|
||||
return (arr[Is].template is<std::tuple_element_t<Is, tuple_t<args_t...>>>() && ...);
|
||||
}
|
||||
|
||||
bool from_json_array(const json::basic_array<string_t>& arr, tuple_t<args_t...>& value) const
|
||||
{
|
||||
if (!check_json_array(arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
from_json_impl(arr, value, std::make_index_sequence<tuple_size>());
|
||||
return true;
|
||||
}
|
||||
|
||||
template <std::size_t... Is>
|
||||
void from_json_impl(
|
||||
const json::basic_array<string_t>& arr,
|
||||
tuple_t<args_t...>& t,
|
||||
std::index_sequence<Is...>) const
|
||||
{
|
||||
using std::get;
|
||||
((get<Is>(t) = arr[Is].template as<std::tuple_element_t<Is, tuple_t<args_t...>>>()), ...);
|
||||
}
|
||||
|
||||
json::basic_array<string_t> move_to_json_array(tuple_t<args_t...> value) const
|
||||
{
|
||||
json::basic_array<string_t> result;
|
||||
move_to_json_impl(result, std::move(value), std::make_index_sequence<tuple_size>());
|
||||
return result;
|
||||
}
|
||||
|
||||
template <std::size_t... Is>
|
||||
void move_to_json_impl(
|
||||
json::basic_array<string_t>& arr,
|
||||
tuple_t<args_t...> t,
|
||||
std::index_sequence<Is...>) const
|
||||
{
|
||||
using std::get;
|
||||
(arr.emplace_back(std::move(get<Is>(t))), ...);
|
||||
}
|
||||
|
||||
bool move_from_json_array(json::basic_array<string_t> arr, tuple_t<args_t...>& value) const
|
||||
{
|
||||
if (!check_json_array(arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
move_from_json_impl(arr, value, std::make_index_sequence<tuple_size>());
|
||||
return true;
|
||||
}
|
||||
|
||||
template <std::size_t... Is>
|
||||
void move_from_json_impl(
|
||||
json::basic_array<string_t> arr,
|
||||
tuple_t<args_t...>& t,
|
||||
std::index_sequence<Is...>) const
|
||||
{
|
||||
using std::get;
|
||||
((get<Is>(t) =
|
||||
std::move(arr[Is]).template as<std::tuple_element_t<Is, tuple_t<args_t...>>>()),
|
||||
...);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename string_t, typename map_t>
|
||||
class jsonization<
|
||||
string_t,
|
||||
map_t,
|
||||
std::enable_if_t<_utils::is_map<map_t> && std::is_same_v<typename map_t::key_type, string_t>>>
|
||||
: public __jsonization_object<string_t, jsonization<string_t, map_t>, map_t>
|
||||
{
|
||||
public:
|
||||
json::basic_object<string_t> to_json_object(const map_t& value) const
|
||||
{
|
||||
json::basic_object<string_t> result;
|
||||
for (const auto& [key, val] : value) {
|
||||
result.emplace(key, val);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool check_json_object(const json::basic_object<string_t>& arr) const
|
||||
{
|
||||
for (const auto& [key, val] : arr) {
|
||||
if (!val.template is<typename map_t::mapped_type>()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool from_json_object(const json::basic_object<string_t>& arr, map_t& value) const
|
||||
{
|
||||
// TODO: 是不是直接from不check了算了
|
||||
if (!check_json_object(arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = {};
|
||||
for (const auto& [key, val] : arr) {
|
||||
value.emplace(key, val.template as<typename map_t::mapped_type>());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
json::basic_object<string_t> move_to_json_object(map_t value) const
|
||||
{
|
||||
json::basic_object<string_t> result;
|
||||
for (auto& [key, val] : value) {
|
||||
result.emplace(key, std::move(val));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool move_from_json_object(json::basic_object<string_t> arr, map_t& value) const
|
||||
{
|
||||
// TODO: 是不是直接from不check了算了
|
||||
if (!check_json_object(arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = {};
|
||||
for (auto& [key, val] : arr) {
|
||||
value.emplace(key, std::move(val).template as<typename map_t::mapped_type>());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename string_t, typename... args_t>
|
||||
class jsonization<string_t, std::variant<args_t...>>
|
||||
{
|
||||
public:
|
||||
using variant_t = std::variant<args_t...>;
|
||||
constexpr static size_t variant_size = std::variant_size_v<variant_t>;
|
||||
|
||||
json::basic_value<string_t> to_json(const variant_t& value) const
|
||||
{
|
||||
json::basic_value<string_t> result;
|
||||
to_json_impl(result, value, std::make_index_sequence<variant_size>());
|
||||
return result;
|
||||
}
|
||||
|
||||
template <std::size_t... Is>
|
||||
void to_json_impl(
|
||||
json::basic_value<string_t>& val,
|
||||
const variant_t& t,
|
||||
std::index_sequence<Is...>) const
|
||||
{
|
||||
using std::get;
|
||||
std::ignore = ((t.index() == Is ? (val = get<Is>(t), true) : false) || ...);
|
||||
}
|
||||
|
||||
bool check_json(const json::basic_value<string_t>& json) const
|
||||
{
|
||||
return check_json_impl(json, std::make_index_sequence<variant_size>());
|
||||
}
|
||||
|
||||
template <std::size_t... Is>
|
||||
bool check_json_impl(const json::basic_value<string_t>& val, std::index_sequence<Is...>) const
|
||||
{
|
||||
return (val.template is<std::variant_alternative_t<Is, variant_t>>() || ...);
|
||||
}
|
||||
|
||||
bool from_json(const json::basic_value<string_t>& json, variant_t& value) const
|
||||
{
|
||||
if (!check_json_impl(json, std::make_index_sequence<variant_size>())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
from_json_impl(json, value, std::make_index_sequence<variant_size>());
|
||||
return true;
|
||||
}
|
||||
|
||||
template <std::size_t... Is>
|
||||
void from_json_impl(
|
||||
const json::basic_value<string_t>& json,
|
||||
variant_t& t,
|
||||
std::index_sequence<Is...>) const
|
||||
{
|
||||
std::ignore =
|
||||
((json.template is<std::variant_alternative_t<Is, variant_t>>()
|
||||
? (t = json.template as<std::variant_alternative_t<Is, variant_t>>(), true)
|
||||
: false)
|
||||
|| ...);
|
||||
}
|
||||
|
||||
json::basic_value<string_t> move_to_json(variant_t value) const
|
||||
{
|
||||
json::basic_value<string_t> result;
|
||||
move_to_json_impl(result, std::move(value), std::make_index_sequence<variant_size>());
|
||||
return result;
|
||||
}
|
||||
|
||||
template <std::size_t... Is>
|
||||
void
|
||||
move_to_json_impl(json::basic_value<string_t>& val, variant_t t, std::index_sequence<Is...>)
|
||||
const
|
||||
{
|
||||
using std::get;
|
||||
std::ignore = ((t.index() == Is ? (val = std::move(get<Is>(t)), true) : false) || ...);
|
||||
}
|
||||
|
||||
bool move_from_json(json::basic_value<string_t> json, variant_t& value) const
|
||||
{
|
||||
if (!check_json_impl(json, std::make_index_sequence<variant_size>())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
move_from_json_impl(std::move(json), value, std::make_index_sequence<variant_size>());
|
||||
return true;
|
||||
}
|
||||
|
||||
template <std::size_t... Is>
|
||||
void move_from_json_impl(
|
||||
json::basic_value<string_t> json,
|
||||
variant_t& t,
|
||||
std::index_sequence<Is...>) const
|
||||
{
|
||||
std::ignore =
|
||||
((json.template is<std::variant_alternative_t<Is, variant_t>>()
|
||||
? (t = std::move(json).template as<std::variant_alternative_t<Is, variant_t>>(),
|
||||
true)
|
||||
: false)
|
||||
|| ...);
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: check if has move_xxx in member
|
||||
template <typename string_t, typename var_t>
|
||||
class jsonization<
|
||||
string_t,
|
||||
var_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_to_json_in_member<var_t>::value
|
||||
&& _utils::has_check_json_in_member<var_t, string_t>::value
|
||||
&& _utils::has_from_json_in_member<var_t, string_t>::value>>
|
||||
{
|
||||
public:
|
||||
json::basic_value<string_t> to_json(const var_t& value) const { return value.to_json(); }
|
||||
|
||||
bool check_json(const json::basic_value<string_t>& json) const
|
||||
{
|
||||
var_t value;
|
||||
return value.check_json(json);
|
||||
}
|
||||
|
||||
bool from_json(const json::basic_value<string_t>& json, var_t& value) const
|
||||
{
|
||||
return value.from_json(json);
|
||||
}
|
||||
|
||||
json::basic_value<string_t> move_to_json(var_t value) const { return to_json(value); }
|
||||
|
||||
bool move_from_json(json::basic_value<string_t> json, var_t& value) const
|
||||
{
|
||||
return from_json(json, value);
|
||||
}
|
||||
};
|
||||
|
||||
// really need this fucking queue?
|
||||
template <typename string_t, typename value_t>
|
||||
class jsonization<string_t, std::queue<value_t>>
|
||||
: public __jsonization_array<
|
||||
string_t,
|
||||
jsonization<string_t, std::queue<value_t>>,
|
||||
std::queue<value_t>,
|
||||
(size_t)-1>
|
||||
{
|
||||
public:
|
||||
json::basic_array<string_t> to_json_array(const std::queue<value_t>& value) const
|
||||
{
|
||||
return move_to_json_array(value);
|
||||
}
|
||||
|
||||
bool check_json_array(const json::basic_array<string_t>& arr) const
|
||||
{
|
||||
return arr.template all<value_t>();
|
||||
}
|
||||
|
||||
bool from_json_array(const json::basic_array<string_t>& arr, std::queue<value_t>& value) const
|
||||
{
|
||||
if (!check_json_array(arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = {};
|
||||
for (const auto& val : arr) {
|
||||
value.emplace(val.template as<value_t>());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
json::basic_array<string_t> move_to_json_array(std::queue<value_t> value) const
|
||||
{
|
||||
json::basic_array<string_t> result;
|
||||
while (!value.empty()) {
|
||||
result.emplace_back(std::move(value.front()));
|
||||
value.pop();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool move_from_json_array(json::basic_array<string_t> arr, std::queue<value_t>& value) const
|
||||
{
|
||||
if (!check_json_array(arr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto& val : arr) {
|
||||
value.emplace(std::move(val).template as<value_t>());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
648
3rdparty/include/meojson/reflection/jsonization.hpp
vendored
@@ -1,648 +0,0 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "../common/types.hpp"
|
||||
#include "extensions.hpp"
|
||||
|
||||
namespace json::_jsonization_helper
|
||||
{
|
||||
|
||||
template <typename value_t>
|
||||
struct is_optional_t : public std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename value_t>
|
||||
struct is_optional_t<std::optional<value_t>> : public std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename value_t>
|
||||
inline constexpr bool is_optional_v = is_optional_t<value_t>::value;
|
||||
|
||||
struct next_is_optional_t
|
||||
{
|
||||
};
|
||||
|
||||
struct next_override_key_t
|
||||
{
|
||||
const char* key;
|
||||
};
|
||||
|
||||
struct next_state_t
|
||||
{
|
||||
bool is_optional = false;
|
||||
const char* override_key = nullptr;
|
||||
};
|
||||
|
||||
struct va_arg_end
|
||||
{
|
||||
};
|
||||
|
||||
template <typename tag_t>
|
||||
struct is_tag_t : public std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_tag_t<next_is_optional_t> : public std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_tag_t<next_override_key_t> : public std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
struct dumper
|
||||
{
|
||||
void _to_json(json::object&, va_arg_end) const {}
|
||||
|
||||
template <typename... rest_t>
|
||||
void _to_json(json::object& result, const char* key, rest_t&&... rest) const
|
||||
{
|
||||
_to_json(result, next_state_t {}, key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <
|
||||
typename var_t,
|
||||
typename... rest_t,
|
||||
typename _ = std::enable_if_t<!is_tag_t<var_t>::value, void>>
|
||||
void _to_json(
|
||||
json::object& result,
|
||||
next_state_t state,
|
||||
const char* key,
|
||||
const var_t& var,
|
||||
rest_t&&... rest) const
|
||||
{
|
||||
if (state.override_key) {
|
||||
key = state.override_key;
|
||||
}
|
||||
if constexpr (is_optional_v<var_t>) {
|
||||
if (!state.is_optional) {
|
||||
throw exception("std::optional must be used with MEO_OPT");
|
||||
}
|
||||
|
||||
if (var.has_value()) {
|
||||
result.emplace(key, var.value());
|
||||
}
|
||||
}
|
||||
else {
|
||||
result.emplace(key, var);
|
||||
}
|
||||
_to_json(result, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename... rest_t>
|
||||
void _to_json(
|
||||
json::object& result,
|
||||
next_state_t state,
|
||||
const char*,
|
||||
next_is_optional_t,
|
||||
rest_t&&... rest) const
|
||||
{
|
||||
state.is_optional = true;
|
||||
_to_json(result, state, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename... rest_t>
|
||||
void _to_json(
|
||||
json::object& result,
|
||||
next_state_t state,
|
||||
const char*,
|
||||
next_override_key_t override_key,
|
||||
rest_t&&... rest) const
|
||||
{
|
||||
state.override_key = override_key.key;
|
||||
_to_json(result, state, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
};
|
||||
|
||||
struct checker
|
||||
{
|
||||
bool _check_json(const json::value&, std::string&, va_arg_end) const { return true; }
|
||||
|
||||
template <typename... rest_t>
|
||||
bool _check_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
const char* key,
|
||||
rest_t&&... rest) const
|
||||
{
|
||||
return _check_json(in, error_key, next_state_t {}, key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <
|
||||
typename var_t,
|
||||
typename... rest_t,
|
||||
typename _ = std::enable_if_t<!is_tag_t<var_t>::value, void>>
|
||||
bool _check_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
next_state_t state,
|
||||
const char* key,
|
||||
const var_t&,
|
||||
rest_t&&... rest) const
|
||||
{
|
||||
if (state.override_key) {
|
||||
key = state.override_key;
|
||||
}
|
||||
auto opt = in.find(key);
|
||||
if constexpr (is_optional_v<var_t>) {
|
||||
if (!state.is_optional) {
|
||||
throw exception("std::optional must be used with MEO_OPT");
|
||||
}
|
||||
|
||||
if (opt && !opt->is<typename var_t::value_type>()) {
|
||||
error_key = key;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (state.is_optional) {
|
||||
if (opt && !opt->is<var_t>()) {
|
||||
error_key = key;
|
||||
return false;
|
||||
} // is_optional, ignore key not found
|
||||
}
|
||||
else if (!opt || !opt->is<var_t>()) {
|
||||
error_key = key;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return _check_json(in, error_key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename... rest_t>
|
||||
bool _check_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
next_state_t state,
|
||||
const char*,
|
||||
next_is_optional_t,
|
||||
rest_t&&... rest) const
|
||||
{
|
||||
state.is_optional = true;
|
||||
return _check_json(in, error_key, state, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename... rest_t>
|
||||
bool _check_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
next_state_t state,
|
||||
const char*,
|
||||
next_override_key_t override_key,
|
||||
rest_t&&... rest) const
|
||||
{
|
||||
state.override_key = override_key.key;
|
||||
return _check_json(in, error_key, state, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
};
|
||||
|
||||
struct loader
|
||||
{
|
||||
bool _from_json(const json::value&, std::string&, va_arg_end) const { return true; }
|
||||
|
||||
template <typename... rest_t>
|
||||
bool
|
||||
_from_json(const json::value& in, std::string& error_key, const char* key, rest_t&&... rest)
|
||||
{
|
||||
return _from_json(in, error_key, next_state_t {}, key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <
|
||||
typename var_t,
|
||||
typename... rest_t,
|
||||
typename _ = std::enable_if_t<!is_tag_t<var_t>::value, void>>
|
||||
bool _from_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
next_state_t state,
|
||||
const char* key,
|
||||
var_t& var,
|
||||
rest_t&&... rest)
|
||||
{
|
||||
if (state.override_key) {
|
||||
key = state.override_key;
|
||||
}
|
||||
auto opt = in.find(key);
|
||||
if constexpr (is_optional_v<var_t>) {
|
||||
if (!state.is_optional) {
|
||||
throw exception("std::optional must be used with MEO_OPT");
|
||||
}
|
||||
|
||||
if (opt && !opt->is<typename var_t::value_type>()) {
|
||||
error_key = key;
|
||||
return false;
|
||||
}
|
||||
if (opt) {
|
||||
var = std::move(opt)->as<typename var_t::value_type>();
|
||||
}
|
||||
else {
|
||||
var = std::nullopt;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (state.is_optional) {
|
||||
if (opt && !opt->is<var_t>()) {
|
||||
error_key = key;
|
||||
return false;
|
||||
} // is_optional, ignore key not found
|
||||
}
|
||||
else if (!opt || !opt->is<var_t>()) {
|
||||
error_key = key;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (opt) {
|
||||
var = std::move(opt)->as<var_t>();
|
||||
}
|
||||
}
|
||||
|
||||
return _from_json(in, error_key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename... rest_t>
|
||||
bool _from_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
next_state_t state,
|
||||
const char*,
|
||||
next_is_optional_t,
|
||||
rest_t&&... rest)
|
||||
{
|
||||
state.is_optional = true;
|
||||
return _from_json(in, error_key, state, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename... rest_t>
|
||||
bool _from_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
next_state_t state,
|
||||
const char*,
|
||||
next_override_key_t override_key,
|
||||
rest_t&&... rest)
|
||||
{
|
||||
state.override_key = override_key.key;
|
||||
return _from_json(in, error_key, state, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
};
|
||||
} // namespace json::_jsonization_helper
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
#endif
|
||||
|
||||
namespace json::_private_macro
|
||||
{
|
||||
#define _MEOJSON_STRINGIZE(arg) _MEOJSON_STRINGIZE1(arg)
|
||||
#define _MEOJSON_STRINGIZE1(arg) _MEOJSON_STRINGIZE2(arg)
|
||||
#define _MEOJSON_STRINGIZE2(arg) #arg
|
||||
|
||||
#define _MEOJSON_CONCATENATE(arg1, arg2) _MEOJSON_CONCATENATE1(arg1, arg2)
|
||||
#define _MEOJSON_CONCATENATE1(arg1, arg2) _MEOJSON_CONCATENATE2(arg1, arg2)
|
||||
#define _MEOJSON_CONCATENATE2(arg1, arg2) arg1##arg2
|
||||
|
||||
#define _MEOJSON_EXPAND(x) x
|
||||
|
||||
#define _MEOJSON_FOR_EACH_1(pred, x) pred(x)
|
||||
#define _MEOJSON_FOR_EACH_2(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_1(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_3(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_2(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_4(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_3(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_5(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_4(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_6(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_5(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_7(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_6(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_8(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_7(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_9(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_8(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_10(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_9(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_11(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_10(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_12(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_11(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_13(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_12(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_14(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_13(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_15(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_14(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_16(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_15(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_17(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_16(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_18(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_17(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_19(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_18(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_20(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_19(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_21(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_20(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_22(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_21(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_23(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_22(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_24(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_23(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_25(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_24(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_26(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_25(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_27(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_26(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_28(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_27(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_29(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_28(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_30(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_29(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_31(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_30(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_32(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_31(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_33(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_32(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_34(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_33(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_35(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_34(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_36(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_35(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_37(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_36(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_38(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_37(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_39(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_38(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_40(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_39(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_41(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_40(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_42(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_41(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_43(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_42(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_44(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_43(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_45(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_44(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_46(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_45(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_47(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_46(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_48(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_47(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_49(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_48(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_50(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_49(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_51(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_50(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_52(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_51(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_53(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_52(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_54(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_53(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_55(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_54(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_56(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_55(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_57(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_56(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_58(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_57(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_59(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_58(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_60(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_59(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_61(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_60(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_62(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_61(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_63(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_62(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_64(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_63(pred, __VA_ARGS__))
|
||||
|
||||
#define _MEOJSON_ARG_COUNT(...) \
|
||||
_MEOJSON_EXPAND(_MEOJSON_ARG_COUNT1( \
|
||||
0, \
|
||||
##__VA_ARGS__, \
|
||||
64, \
|
||||
63, \
|
||||
62, \
|
||||
61, \
|
||||
60, \
|
||||
59, \
|
||||
58, \
|
||||
57, \
|
||||
56, \
|
||||
55, \
|
||||
54, \
|
||||
53, \
|
||||
52, \
|
||||
51, \
|
||||
50, \
|
||||
49, \
|
||||
48, \
|
||||
47, \
|
||||
46, \
|
||||
45, \
|
||||
44, \
|
||||
43, \
|
||||
42, \
|
||||
41, \
|
||||
40, \
|
||||
39, \
|
||||
38, \
|
||||
37, \
|
||||
36, \
|
||||
35, \
|
||||
34, \
|
||||
33, \
|
||||
32, \
|
||||
31, \
|
||||
30, \
|
||||
29, \
|
||||
28, \
|
||||
27, \
|
||||
26, \
|
||||
25, \
|
||||
24, \
|
||||
23, \
|
||||
22, \
|
||||
21, \
|
||||
20, \
|
||||
19, \
|
||||
18, \
|
||||
17, \
|
||||
16, \
|
||||
15, \
|
||||
14, \
|
||||
13, \
|
||||
12, \
|
||||
11, \
|
||||
10, \
|
||||
9, \
|
||||
8, \
|
||||
7, \
|
||||
6, \
|
||||
5, \
|
||||
4, \
|
||||
3, \
|
||||
2, \
|
||||
1, \
|
||||
0))
|
||||
#define _MEOJSON_ARG_COUNT1( \
|
||||
_0, \
|
||||
_1, \
|
||||
_2, \
|
||||
_3, \
|
||||
_4, \
|
||||
_5, \
|
||||
_6, \
|
||||
_7, \
|
||||
_8, \
|
||||
_9, \
|
||||
_10, \
|
||||
_11, \
|
||||
_12, \
|
||||
_13, \
|
||||
_14, \
|
||||
_15, \
|
||||
_16, \
|
||||
_17, \
|
||||
_18, \
|
||||
_19, \
|
||||
_20, \
|
||||
_21, \
|
||||
_22, \
|
||||
_23, \
|
||||
_24, \
|
||||
_25, \
|
||||
_26, \
|
||||
_27, \
|
||||
_28, \
|
||||
_29, \
|
||||
_30, \
|
||||
_31, \
|
||||
_32, \
|
||||
_33, \
|
||||
_34, \
|
||||
_35, \
|
||||
_36, \
|
||||
_37, \
|
||||
_38, \
|
||||
_39, \
|
||||
_40, \
|
||||
_41, \
|
||||
_42, \
|
||||
_43, \
|
||||
_44, \
|
||||
_45, \
|
||||
_46, \
|
||||
_47, \
|
||||
_48, \
|
||||
_49, \
|
||||
_50, \
|
||||
_51, \
|
||||
_52, \
|
||||
_53, \
|
||||
_54, \
|
||||
_55, \
|
||||
_56, \
|
||||
_57, \
|
||||
_58, \
|
||||
_59, \
|
||||
_60, \
|
||||
_61, \
|
||||
_62, \
|
||||
_63, \
|
||||
_64, \
|
||||
N, \
|
||||
...) \
|
||||
N
|
||||
|
||||
#define _MEOJSON_FOR_EACH_(N, pred, ...) \
|
||||
_MEOJSON_EXPAND(_MEOJSON_CONCATENATE(_MEOJSON_FOR_EACH_, N)(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH(pred, ...) \
|
||||
_MEOJSON_EXPAND( \
|
||||
_MEOJSON_FOR_EACH_(_MEOJSON_EXPAND(_MEOJSON_ARG_COUNT(__VA_ARGS__)), pred, __VA_ARGS__))
|
||||
|
||||
#define _MEOJSON_VARNAME(x) _MEOJSON_CONCATENATE(_meojson_jsonization_, x)
|
||||
#define _MEOJSON_KEY_VALUE(x) _MEOJSON_STRINGIZE(x), x,
|
||||
} // namespace json::_private_macro
|
||||
|
||||
#define MEO_TOJSON(...) \
|
||||
json::value to_json() const \
|
||||
{ \
|
||||
json::object result; \
|
||||
json::_jsonization_helper::dumper()._to_json( \
|
||||
result, \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) \
|
||||
json::_jsonization_helper::va_arg_end {}); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define MEO_CHECKJSON(...) \
|
||||
bool check_json(const json::value& _MEOJSON_VARNAME(in)) const \
|
||||
{ \
|
||||
std::string _MEOJSON_VARNAME(error_key); \
|
||||
return check_json(_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key)); \
|
||||
} \
|
||||
bool check_json( \
|
||||
const json::value& _MEOJSON_VARNAME(in), \
|
||||
std::string& _MEOJSON_VARNAME(error_key)) const \
|
||||
{ \
|
||||
return json::_jsonization_helper::checker()._check_json( \
|
||||
_MEOJSON_VARNAME(in), \
|
||||
_MEOJSON_VARNAME(error_key), \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) \
|
||||
json::_jsonization_helper::va_arg_end {}); \
|
||||
}
|
||||
|
||||
#define MEO_FROMJSON(...) \
|
||||
bool from_json(const json::value& _MEOJSON_VARNAME(in)) \
|
||||
{ \
|
||||
std::string _MEOJSON_VARNAME(error_key); \
|
||||
return from_json(_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key)); \
|
||||
} \
|
||||
bool from_json( \
|
||||
const json::value& _MEOJSON_VARNAME(in), \
|
||||
std::string& _MEOJSON_VARNAME(error_key)) \
|
||||
{ \
|
||||
return json::_jsonization_helper::loader()._from_json( \
|
||||
_MEOJSON_VARNAME(in), \
|
||||
_MEOJSON_VARNAME(error_key), \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) \
|
||||
json::_jsonization_helper::va_arg_end {}); \
|
||||
}
|
||||
|
||||
#define MEO_JSONIZATION(...) \
|
||||
_MEOJSON_EXPAND(MEO_TOJSON(__VA_ARGS__)) \
|
||||
_MEOJSON_EXPAND(MEO_CHECKJSON(__VA_ARGS__)) \
|
||||
_MEOJSON_EXPAND(MEO_FROMJSON(__VA_ARGS__))
|
||||
|
||||
#define MEO_OPT json::_jsonization_helper::next_is_optional_t {},
|
||||
#define MEO_KEY(key) json::_jsonization_helper::next_override_key_t { key },
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop // -Wgnu-zero-variadic-macro-arguments
|
||||
#endif
|
||||
322
CHANGELOG.md
@@ -1,84 +1,268 @@
|
||||
## v5.27.0-beta.1
|
||||
## v6.3.2
|
||||
|
||||
### 拉电线不知天地为何物 | Highlight
|
||||
|
||||
本次版本更新真的是千呼万唤始出来,也恰逢新年版本和 PC 端的发布,我们在这个版本提供了对 PC 端的初步支持,也合并了 SideStory 「辞岁行」 的数据。
|
||||
|
||||
#### Windows 端一键长草任务配置重构
|
||||
|
||||
本次更新我们对 Windows 端 「一键长草」 任务配置进行了重构,解决了一些痛点。
|
||||
|
||||
现在牛牛支持添加多个重复类型任务,并支持重命名。现在你可以通过 「一键长草」 任务左下角的加号按钮添加多个同类型任务,并可以通过拖拽任务来调整任务执行顺序,以及右键点击任务右侧的齿轮图标重命名和删除任务,这样你就可以更灵活地管理任务。
|
||||
|
||||
牛牛也新增了理智作战任务的周计划设置,可按星期数(如星期三、星期二、星期五等)设置任务是否执行。这样你就可以结合上面提到的添加任务,<u>在理智作战任务前添加另一个理智作战任务,并将其设置为仅打当期剿灭、仅在星期一运行</u>,更多用法等你探索~
|
||||
|
||||
另外,在牛牛执行一键长草流程时,各个任务的勾选框会根据其运行状态以不同颜色进行区分,直观反馈任务被跳过、已完成、运行中或执行失败等状态。
|
||||
|
||||
注:由于牛牛现已支持 「理智作战」 周计划并可添加多个同类型任务,本次更新**移除了原有 「剿灭作战」 任务失败后自动尝试下一个已开放的备选逻辑**,如有需要请参照上方的示例添加对应任务。
|
||||
|
||||
#### PC 端初步支持
|
||||
|
||||
本次更新,牛牛已支持控制 PC 端明日方舟了~不过有以下限制:
|
||||
|
||||
* 由于 Windows 的限制,PC 端在被控制时**不可以处于最小化窗口状态**,否则游戏画面不会被渲染,也就无法被牛牛识别;
|
||||
* 由于 Win32 API 和某反作弊软件的限制,牛牛在控制 PC 端时**必须要直接控制鼠标(不能模拟点击)**,期间不建议你使用鼠标。
|
||||
|
||||
另外,由于维护人手有限,PC 端的适配可能长期处于不稳定状态,部分功能可能出现异常或暂时无法使用。
|
||||
|
||||
我们非常欢迎社区开发者协助适配并提交改进,共同完善对 PC 端的支持。
|
||||
|
||||
#### 其他方面
|
||||
|
||||
* 我们继续对界园肉鸽进行适配,包括 DLC 2 的更新支持;
|
||||
* 我们优化了自动编队的识别,现在支持对作业要求的精英化、等级和模组的识别,如果发现你的干员不满足要求将会有对应提示;
|
||||
* 相应的,干员识别功能也支持显示精英化和等级了。
|
||||
|
||||
----
|
||||
|
||||
#### Restructuring of *Farming* Configuration for Windows
|
||||
|
||||
In this update, we have restructured the *Farming* configuration for Windows, addressing several pain points.
|
||||
|
||||
MAA now supports adding multiple tasks of the same type and renaming them. You can add multiple tasks of the same type using the plus button at the bottom left of the *Farming* panel, adjust the execution order by dragging tasks, and rename or delete tasks by right-clicking the gear icon on the right side of each task. This allows for more flexible task management.
|
||||
|
||||
MAA also supports weekly schedule settings for *Combat* tasks, allowing you to specify on which days of the week (e.g., Monday, Thursday) a task should run. For example, you can add another *Combat* task before your existing one and set it to only run Current Annihilation on Mondays. More usage scenarios await your exploration!
|
||||
|
||||
Additionally, when MAA executes the *Farming* process, the checkboxes for each task will be color-coded to indicate their status: skipped, completed, running, or failed, providing intuitive feedback.
|
||||
|
||||
Note: Since MAA now supports weekly schedules for *Combat* tasks and allows adding multiple tasks of the same type, this update **removes the previous logic that automatically attempted the next available alternative stage after a "Current Annihilation" task failure**. If needed, please refer to the example above to add corresponding tasks.
|
||||
|
||||
#### Preliminary PC Client Support (**[CN ONLY]**)
|
||||
|
||||
In this update, MAA now supports controlling the PC client of Arknights.
|
||||
|
||||
However, due to limited maintenance resources, PC client adaptation may remain unstable for a long period, and some features may experience issues or be temporarily unavailable.
|
||||
|
||||
We warmly welcome community developers to assist with adaptation and submit improvements to collectively enhance PC client support.
|
||||
|
||||
#### Other Updates
|
||||
|
||||
* Continued adaptation for *Sui's Garden of Grotesqueries*, including support for DLC 2 updates (**[CN ONLY]**)
|
||||
* Optimized recognition in *Auto Squad*, which now supports identifying elite, level, and module requirements. If your operators do not meet the requirements, you will receive corresponding prompts.
|
||||
* The operator recognition feature now also supports displaying elite and level information.
|
||||
|
||||
----
|
||||
|
||||
以下是详细内容:
|
||||
|
||||
## v6.3.2
|
||||
|
||||
### 新增 | New
|
||||
|
||||
* 界面主题「齐聚」 @SherkeyXD
|
||||
* 资源更新完成后等待空闲时再加载 @ABA2396
|
||||
* 界园 DLC 新关卡战斗逻辑 @Saratoga-Official
|
||||
* 不是我认识的主题,直接切换 @ABA2396
|
||||
* 界园 dlc2 通宝数据更新 @SherkeyXD
|
||||
* 支持剿灭关卡名识别 @ABA2396
|
||||
* 跳过使用未准备好的技能 && 全局计时器 (#13913) @Alan-Charred
|
||||
* 本次更新的公告右上角添加红点 @ABA2396
|
||||
* 添加刷常乐节点策略 (#13868) @travellerse
|
||||
* 睡眠休眠前增加倒计时弹窗 @ABA2396
|
||||
* 生息演算支援道具名称改为全字匹配 @ABA2396
|
||||
|
||||
### 改进 | Improved
|
||||
|
||||
* GetImageFromRoi 工具优化 @SherkeyXD
|
||||
* 进入新任务后重置任务超时计时器, 以避免非单任务卡阻的误报 @status102
|
||||
* 繁中服主線、肉鴿導航 UI 更新 (#14433) @momomochi987
|
||||
* ProcSubTask static @status102
|
||||
* 干员识别按照 稀有度->精英化->等级->潜能->Id 排序 @ABA2396
|
||||
* 优化识别工具中列表小于 5 时的显示效果 @ABA2396
|
||||
* optimize templates @Constrat
|
||||
* increase score for AddOperatorTradeAggressive EN @Constrat
|
||||
|
||||
### 修复 | Fix
|
||||
|
||||
* 降低萨米肉鸽进入 “诡秘的预感” 所需模版匹配分数阈值 (#14521) @Alan-Charred
|
||||
* 公招按钮 roi 错误 @Saratoga-Official
|
||||
* 掉落识别修复 (#14508) @Alan-Charred
|
||||
* 变更弃用的参数 @ABA2396
|
||||
* 开始唤醒会回到主界面 @ABA2396
|
||||
* 尝试为活动商店小游戏适配新的时装购买动画 (#14490) @Alan-Charred
|
||||
* 无人机协助点击无效时增加自动重试机制 @ABA2396
|
||||
* 每日任务领取延迟载荷移位 @SherkeyXD
|
||||
* 每日任务领取因为延迟卡住 @SherkeyXD
|
||||
* 繁中服無法進入資源收藏關卡 (#14469) @momomochi987
|
||||
* 为界园放弃探索任务添加备用模版 (#14466) @Alan-Charred
|
||||
* 肉鸽跳一战打一战刷钱 (#14450) @Alan-Charred
|
||||
* 傀影不期而遇选项 @Saratoga-Official
|
||||
* 界园 dlc 背景无法放弃探索 (#14425) @Alan-Charred
|
||||
* 界园狭路相逢选项 @Saratoga-Official
|
||||
* Award模板阈值还是小了 @Saratoga-Official
|
||||
* 掉落识别增加越界检查 (#14312) @MistEO @Alan-Charred
|
||||
* 界园杂疑选项 @Saratoga-Official
|
||||
* 修复 "设置-外部通知" 存在多个通知渠道时只会发送到第一个成功的渠道问题 (#14380) @Jim-Happy
|
||||
* 界园肉鸽选项 @Saratoga-Official
|
||||
* 给 ClickToStartPoint 加点延迟 @Saratoga-Official
|
||||
* 萨卡兹去伪存真弹窗有延迟无法退出 @Saratoga-Official
|
||||
* JP Task.png (#14516) @Daydreamer114
|
||||
* precommit maacore @Constrat
|
||||
* change default issue + remove always as not necessary @Constrat
|
||||
* add always() @Constrat
|
||||
* YostarKR RoguelikeCustom-HijackSquad squad recognition @HX3N
|
||||
* cleanup ifdef + fix AsstDestroy missed calls + lldb @Constrat
|
||||
|
||||
|
||||
* 4 星公招时间显示错误 @ABA2396
|
||||
* 刷理智自定义剿灭关卡在特定情况的绑定错误 @status102
|
||||
* 在禁用刷理智-自定义剿灭关卡后需要手动切换任务以刷新列表中显示的剿灭关卡, 尽管不影响实际运行 @status102
|
||||
* 会客室任务失败重试时尝试关闭赠送线索界面 @ABA2396
|
||||
* 肉鸽开局种子无法通过 Wpf 设置两位数难度 @status102
|
||||
* 小工具-公招识别 3~5 星选择时间无法修改 @status102
|
||||
* 小工具-干员识别 开始识别按钮启用状态绑定失效 @status102
|
||||
* 自动公招任务 3~5 星确认时间在修改后未能刷新 UI @status102
|
||||
* EN AveMujica terminal new template @Constrat
|
||||
* EN IS tentative fix increasing roi for encounter and more replace regex @Constrat
|
||||
* English text overflow on long strings in middle column @Constrat
|
||||
|
||||
### 文档 | Docs
|
||||
|
||||
* 补充模拟器相关文档和协议文档 (#14478) @Alan-Charred
|
||||
* 添加关于实体设备上账号切换问题的说明 (#14468) @Initial-heart-1 @lucienshawls @HX3N @Constrat @Manicsteiner @momomochi987
|
||||
* 在不支持列表中添加腾讯应用宝 (#14477) @JasonHuang79
|
||||
* 增加换行以提升文档在 GitHub 的阅读体验 (#14338) @status102
|
||||
* vscode 插件文档视觉优化 @SherkeyXD
|
||||
* 利用 tabs 优化视觉表现 @SherkeyXD
|
||||
* 利用步骤容器优化视觉效果 @SherkeyXD
|
||||
* 更新 algolia 配置 @SherkeyXD
|
||||
* 删除一些过时内容 (#15700) @JasonHuang79
|
||||
|
||||
### 其他 | Other
|
||||
|
||||
* 将 Copilot ActionType::ResetTimer 更改为更适合的 ResetStopwatch (#14507) @Alan-Charred
|
||||
* 调整截图 @ABA2396
|
||||
* 文件路径错误 @ABA2396
|
||||
* 我是铸币 @SherkeyXD
|
||||
* ALL~ the Announcements 中新公告标题中加 * @ABA2396
|
||||
* 拆出界园岁兽残识地图导航 (#14432) @Alan-Charred
|
||||
* 繁中服「輓歌燃燒殆盡」活動導航 (#14434) @momomochi987
|
||||
* remove global templates for 3294b29f54dadc4198a40538e85b71902c79c875 @Constrat
|
||||
* txwy add SwitchTheme@ConfirmThemeChange.png (#14511) @momomochi987
|
||||
* YostarJP SwitchTheme@ConfirmThemeChang @Manicsteiner
|
||||
* YostarKR add SwitchTheme@ConfirmThemeChang @HX3N
|
||||
* add SwitchTheme@ConfirmThemeChange.png @Constrat
|
||||
* remove cancelled() and add mentions @Constrat
|
||||
* YostarKR SSS#8 SSSBuffChoose @HX3N
|
||||
* update SSS#8 buff choose ocr for EN @Constrat
|
||||
* SSS#8 global changes (add acahuallan, remove dossoles and barrenbeasts) @Constrat
|
||||
* translate ElapsedTime ref: 1edd00698200b7c2a14406d7a29f51689f6871d1 @Constrat
|
||||
* 增加 id 格式验证 @ABA2396
|
||||
* 明确周计划和定时更新使用游戏时间而非现实时间 @ABA2396
|
||||
* 移除老主线导航逻辑 (#15644) @SherkeyXD
|
||||
* 繁中服「夢鄉」主題 (#15699) @momomochi987
|
||||
* Yostar servers SSS#9 and ShamareThumbnail (#15732) @Manicsteiner @Constrat
|
||||
|
||||
## v6.3.1
|
||||
|
||||
### 新增 | New
|
||||
|
||||
* OperNameAnalyzer 支持左对齐检测 (#15682) @ABA2396
|
||||
|
||||
### 改进 | Improved
|
||||
|
||||
* 配置迁移自动为启用备选且首个关卡为剿灭模式的刷理智任务自动添加额外的刷理智任务 @status102
|
||||
* 忽略干员属性要求 不再允许跳过精英化要求 (#15697) @status102 @Constrat @HX3N
|
||||
|
||||
### 修复 | Fix
|
||||
|
||||
* JP AveMujica event ocr @Manicsteiner
|
||||
* EN IS StageRefresh @Constrat
|
||||
* i'm kinda stupid @Constrat
|
||||
* update refresh node EN IS5 @Constrat
|
||||
* EN IS fix trader store templates AGAIN @Constrat
|
||||
* EN Yu OCR for Yutenji @Constrat
|
||||
* 自动编队选择技能时点击到技能描述/技能范围 @status102
|
||||
* 自动编队期间如有干员属性要求被忽略, 则禁用自动化投票 @status102
|
||||
|
||||
### 文档 | Docs
|
||||
|
||||
* 更新 api 链接 @ABA2396
|
||||
|
||||
### 其他 | Other
|
||||
|
||||
* UserAdditional 非 json 格式返回原始字符串 @status102
|
||||
* 使用屏幕宽高常量代替硬编码 @status102
|
||||
* 屏幕外的干员跳过技能就绪检测 @status102
|
||||
* 調整繁中服界園肉鴿 OCR (2/?) @momomochi987
|
||||
* color [INF] for smoke testing as well @Constrat
|
||||
* 调整单字干员正则 @ABA2396
|
||||
* 調整繁中服界園肉鴿 OCR (#15678) @momomochi987
|
||||
* 删除干员名开头/末尾的_<> @ABA2396
|
||||
* 添加响石、赤刃明霄陈基建技能加成 (#15674) @drway
|
||||
* 保全派驻自动战斗使用二值化结果识别干员名 @ABA2396
|
||||
* 删除无用的正则替换 @ABA2396
|
||||
* 自动战斗使用二值化结果识别干员名 @ABA2396
|
||||
* 仅在 VS Code 中添加辅助项目 (#15669) @status102
|
||||
* JP OperNameAnalyzer specialParams @Manicsteiner
|
||||
|
||||
## v6.3.0
|
||||
|
||||
### 新增 | New
|
||||
|
||||
* 支持 PC 端明日方舟 (#15407) @MistEO @ABA2396
|
||||
* SideStory「辞岁行」导航及地图数据更新 @SherkeyXD @status102
|
||||
* 界园肉鸽 DLC 2 分队更新、通宝数据更新、可选难度提高至 18、支持指定种子开局 (#15588) @SherkeyXD @status102 @HX3N @Manicsteiner
|
||||
* 繁中服界園肉鴿初步適配 (#15605) @momomochi987
|
||||
* 干员识别支持显示精英化、等级与潜能 @ABA2396
|
||||
* 自动编队识别精英化、等级及模组要求 (#15161) @status102 @Manicsteiner @Constrat @HX3N
|
||||
* 芯片本支持显示库存数量 @ABA2396
|
||||
* 新增注入弹窗不再提醒的勾选框,勾选后使用软件渲染 @ABA2396
|
||||
* WpfGui 清空缓存按钮 (#15582) @soundofautumn @Constrat @HX3N @momomochi987
|
||||
* 自定干员名称无效时的错误处理及本地化支持 (#15556) @yali-hzy @HX3N
|
||||
* 设置指引增加右键重命名/删除提示 @ABA2396
|
||||
* 新 Config 加载时移除旧 Config 中不存在的配置 @status102
|
||||
* 日志中额外记录 TaskChain 与 taskId ~~免得有人把 Fight 改成开始唤醒~~ @ABA2396
|
||||
* YostarEN/JP/KR Dreamland、JieGarden 和 AveMujica 主题支持 @Constrat @Manicsteiner @HX3N
|
||||
|
||||
### 改进 | Improved
|
||||
|
||||
* Wpf 一键长草任务配置重构,支持添加多个同类型任务、重命名和周计划设置 (#15385) @status102 @ABA2396 @momomochi987 @HX3N
|
||||
* 刷理智过期关卡逻辑/样式优化 @status102 @ABA2396
|
||||
* 关卡候选列表刷新及关卡选择下拉列表刷新 (#15562) @status102 @HX3N @Constrat @Manicsteiner @momomochi987
|
||||
* 优化自动战斗界面布局 (#15512) @yali-hzy
|
||||
* 优化任务设置按钮悬浮提示 @ABA2396
|
||||
* 优化设置右键菜单布局 @ABA2396
|
||||
* 优化干员识别、仓库识别显示 @ABA2396
|
||||
* 配置迁移检查优化与简化 @status102 @ABA2396
|
||||
* 开始唤醒任务未设置账号切换时,禁用手动切换按钮 @status102
|
||||
* 自动战斗掉线重连、自动肉鸽在战斗结束前延迟「停止」动作添加多任务共用提示 @ABA2396 @status102
|
||||
* 剿灭卡使用到上限时不报错停止 @ABA2396
|
||||
* 剿灭关卡通过 ends_with 判断 @ABA2396
|
||||
* 刷理智任务高级设置 UI 调整选项顺序和显示优化 @status102
|
||||
* 自动战斗自动编队检查`干员等级&精英化`及`技能等级`拆分 @status102
|
||||
* 自动战斗不支持技能重置说明中,干员名遵循干员名语言设置 @status102
|
||||
* 自动战斗作业列表使用相对路径代替绝对路径 @status102
|
||||
* TaskQueue 重命名与移除时显示任务序号 @status102
|
||||
* TaskQueue 任务开始&完成显示修改后的任务名 @status102
|
||||
* 追加自定干员允许不切换技能 @status102
|
||||
* 存在 crash.log 时,Wpf 尝试获取 dumps 文件 (#15432) @status102
|
||||
* 移除过时的参数兼容 @status102
|
||||
* 消除部分编译警告 (#15578) @yali-hzy
|
||||
* NumberOcrReplace 新增规则 (#14186) @Manicsteiner
|
||||
|
||||
### 修复 | Fix
|
||||
|
||||
* 配置迁移相关问题修复:迁移后切换回原配置、删除配置时未删除 .new、多配置用户删除 Default 配置时迁移异常、剩余理智启用状态和关卡选择迁移问题 @status102 @ABA2396
|
||||
* 刷理智任务相关修复:切换刷理智任务时读取错误关卡列表、运行时不允许添加关卡 @status102
|
||||
* 自动编队相关修复:识别技能等级匹配失败、干员技能描述过长时点击位置错误、禁用快速选中以修复外服干员技能描述过长的错误选中、干员等级跨精英化时判断出错、干员等级不足 i18n 未启用、干员组干员未解析精英化及等级属性、先兼容旧作业中不合理的技能选择 @status102
|
||||
* 公招加速券识别问题修复 @status102
|
||||
* LoadApiCache 路径拼接错误 @ABA2396
|
||||
* 主线导航及外服主线导航问题修复 @SherkeyXD @ABA2396
|
||||
* 在赠送线索时弹出上次线索交流结束的提示时无法返回 @ABA2396
|
||||
* 粘贴作业集代码后下方的链接未重置为作业站链接 @ABA2396
|
||||
* 修复移动已打开设置的任务后,当前的设置面板无法继续修改的问题 @ABA2396
|
||||
* 萨米肉鸽刷开局功能异常 @ABA2396
|
||||
* 肉鸽烧水分队切换界面后错误重置 @status102
|
||||
* 保证通宝优先级未定义时不会加载崩溃 fallback 到默认值 @SherkeyXD
|
||||
* SEH 错误终止运行 @status102
|
||||
* 启动 MAA 时若没有任何任务,则追加一套默认任务 @status102
|
||||
* 启动客户端绑定失效问题修复 @status102
|
||||
* 关卡列表显示不刷新 @status102
|
||||
* 选中完成后动作时添加新任务未能隐藏完成后动作设置 UI @status102
|
||||
* 刷理智使用源石 CheckBox 勾选后不生效 @status102
|
||||
* 退出 MAA 时重置变量不再刷新 UI @status102
|
||||
* 初始化 StartEnabled 属性为 true (#15596) @yali-hzy
|
||||
* 自动战斗切换活动类型未清空解析缓存 @status102
|
||||
* 修复任务出错日志可能晚于任务完成日志显示的问题 @ABA2396
|
||||
* 开始干员识别前重置潜能状态 @ABA2396
|
||||
* 修复生息演算商店无法正常购买皮肤的问题 (#15585) @drway
|
||||
* 手动输入关卡名时,不移除过期关卡 @status102
|
||||
* 过期关卡重置模式补充自动迁移 @status102
|
||||
* OR 关卡掉落界面关卡名识别问题 @ABA2396
|
||||
* EX 关符合时 1 被识别为 | @ABA2396
|
||||
* NumberOcrReplace 移除`|`和`/` (#15625) @status102
|
||||
* 移除单字干员 ocr 替换中的 +*?避免误判 @Saratoga-Official
|
||||
* 涤火杰西卡识别 @ABA2396
|
||||
* 日服酒神、見字祠识别 @Saratoga-Official
|
||||
* YostarKR Roguelike@ChooseOperConfirm @HX3N
|
||||
* YostarKR use ' ' in ocrReplace to preserve '\n' for InfrastTrainingTask @HX3N
|
||||
* EN Greyy Alter regex @Constrat
|
||||
* EN IS6 encounter @Constrat
|
||||
* EN IS TradeInvest templates text font change @Constrat
|
||||
* EN IS ShoppingConfirm text font change @Constrat
|
||||
* EN refresh node template @Constrat
|
||||
* JP AT minigame confirm (#15427) @Manicsteiner
|
||||
* JP JieGardenStrategyChange @Saratoga-Official
|
||||
* add MaaWin32ControlUnit to nightly build (#15447) @Manicsteiner
|
||||
|
||||
### 文档 | Docs
|
||||
|
||||
* 集成文档统一格式,同时显示 field-group 和示例代码 (#15409) @ABA2396 @Manicsteiner @Constrat @momomochi987
|
||||
* 繁中文件大更新 (#15480) @momomochi987
|
||||
* 修正开发文档中的格式错误及笔误 (#15516) @yali-hzy
|
||||
* 自动战斗作业文档干员技能值范围补上 0 @status102
|
||||
|
||||
### 其他 | Other
|
||||
|
||||
* 作业集 Parse 后不删除历史记录,避免错过作业抛出的错误 @ABA2396
|
||||
* 辞岁行地图 2026-02-10 Map 更新 @status102
|
||||
* 繁中服不上报企鹅物流 @ABA2396
|
||||
* devcontainer 适配 CMakePresets.json (#15606) @lucienshawls
|
||||
* 移除不再使用的 VirtualizingWrapPanel 与 NoAutomationDataGrid @ABA2396
|
||||
* 调整清理图片缓存样式,增加提示 @ABA2396
|
||||
* 补全缺少的翻译 @ABA2396
|
||||
* 优化 emoji @ABA2396
|
||||
* 自动战斗-自动编队干员不支持技能说明国际化 (#15609) @status102 @Constrat @HX3N @Manicsteiner
|
||||
* 自动战斗编队技能等级不足 i18n,CN 使用理智药及碎石文案 (#15435) @status102 @HX3N
|
||||
* 增加借助战 OF-1 在后续刷理智选择`当前/上次`导致禁用时的输出 (#15478) @status102 @Manicsteiner @Constrat @HX3N @ABA2396 @momomochi987
|
||||
* remove regex from `text` field in EN Sui IS @Constrat
|
||||
* KR AnnouncementNotFinishedConfirm、ReceptionOptionsRequireInfrast、CreditFightWhenOF-1Warning、MiniGame ConversationRoom and HoneyFruit 支持 @HX3N
|
||||
* EN minigame honeyfruit、IS6 tip 支持 @Constrat
|
||||
* JP MiniGame HoneyFruit 支持 @Manicsteiner
|
||||
* YostarJP ocr fix for roguelike @Manicsteiner
|
||||
* manual data for txwy @Constrat
|
||||
* optimize templates @Constrat
|
||||
* fix casing typo and related context (#15656) @ittuann @Daydreamer114
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
|
||||
project(MAA)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")
|
||||
|
||||
option(BUILD_WPF_GUI "build MaaWpfGui" ${WIN32})
|
||||
option(BUILD_DEBUG_DEMO "build debug demo" OFF)
|
||||
option(BUILD_XCFRAMEWORK "build xcframework for macOS app" OFF)
|
||||
@@ -17,35 +12,36 @@ option(INSTALL_FLATTEN "do not use bin lib include directory" ON)
|
||||
option(WITH_EMULATOR_EXTRAS "build with emulator extras" ${WIN32})
|
||||
option(WITH_HASH_VERSION "generate version from git hash" OFF)
|
||||
|
||||
include(${PROJECT_SOURCE_DIR}/MaaDeps/maadeps.cmake)
|
||||
if(INSTALL_FLATTEN)
|
||||
set(RPATH_LIBRARY_INSTALL_DIR .)
|
||||
set(MaaCore_install_flatten_args RUNTIME DESTINATION . LIBRARY DESTINATION . PUBLIC_HEADER DESTINATION .)
|
||||
endif()
|
||||
|
||||
include(src/MaaUtils/MaaUtils.cmake)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/config.cmake)
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/utils.cmake)
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
|
||||
|
||||
if(APPLE)
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/macos.cmake)
|
||||
endif()
|
||||
|
||||
if(INSTALL_FLATTEN)
|
||||
set(MaaCore_install_flatten_args RUNTIME DESTINATION . LIBRARY DESTINATION . PUBLIC_HEADER DESTINATION .)
|
||||
endif()
|
||||
|
||||
add_library(HeaderOnlyLibraries INTERFACE)
|
||||
target_include_directories(HeaderOnlyLibraries INTERFACE 3rdparty/include)
|
||||
|
||||
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs)
|
||||
find_package(Boost REQUIRED CONFIG COMPONENTS system)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(fastdeploy_ppocr REQUIRED)
|
||||
find_package(ONNXRuntime REQUIRED)
|
||||
|
||||
add_subdirectory(src/MaaCore)
|
||||
|
||||
if(BUILD_WPF_GUI)
|
||||
include_external_msproject(MaaWpfGui ${PROJECT_SOURCE_DIR}/src/MaaWpfGui/MaaWpfGui.csproj)
|
||||
|
||||
add_dependencies(MaaWpfGui MaaCore)
|
||||
if(DEFINED ENV{VSCODE_PID})
|
||||
add_custom_target(run-MaaWpfGui
|
||||
COMMAND "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/MAA.exe"
|
||||
DEPENDS MaaWpfGui
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/bin/$<CONFIG>"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(INSTALL_PYTHON)
|
||||
|
||||
348
CMakePresets.json
Normal file
@@ -0,0 +1,348 @@
|
||||
{
|
||||
"version": 10,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 23,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "windows-base",
|
||||
"hidden": true,
|
||||
"generator": "Visual Studio 18 2026",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"$comment": [
|
||||
"Base for Windows presets; Visual Studio is multi-config (Debug/Release/RelWithDebInfo in same build dir)",
|
||||
"see https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2018%202026.html"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"BUILD_WPF_GUI": "ON",
|
||||
"BUILD_DEBUG_DEMO": "ON",
|
||||
"INSTALL_RESOURCE": "OFF",
|
||||
"INSTALL_PYTHON": "OFF"
|
||||
},
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja Multi-Config",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"$comment": [
|
||||
"Base for Linux presets; Ninja is multi-config (Debug/Release/RelWithDebInfo in same build dir)",
|
||||
"see https://cmake.org/cmake/help/latest/generator/Ninja%20Multi-Config.html",
|
||||
"clangd uses compile_commands.json to provide code completion and navigation",
|
||||
"so CMAKE_EXPORT_COMPILE_COMMANDS is set to ON",
|
||||
"see https://clangd.llvm.org/installation.html"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
},
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Linux"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja Multi-Config",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"$comment": [
|
||||
"Base for macOS presets; Ninja is multi-config (Debug/Release/RelWithDebInfo in same build dir)",
|
||||
"see https://cmake.org/cmake/help/latest/generator/Ninja%20Multi-Config.html",
|
||||
"clangd uses compile_commands.json to provide code completion and navigation",
|
||||
"so CMAKE_EXPORT_COMPILE_COMMANDS is set to ON",
|
||||
"see https://clangd.llvm.org/installation.html"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
},
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Darwin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-x64",
|
||||
"inherits": "windows-base",
|
||||
"displayName": "Windows x64",
|
||||
"architecture": "x64",
|
||||
"cacheVariables": {
|
||||
"MAADEPS_TRIPLET": "maa-x64-windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-arm64",
|
||||
"inherits": "windows-base",
|
||||
"displayName": "Windows arm64",
|
||||
"architecture": "ARM64",
|
||||
"cacheVariables": {
|
||||
"MAADEPS_TRIPLET": "maa-arm64-windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-x64",
|
||||
"inherits": "linux-base",
|
||||
"displayName": "Linux x64",
|
||||
"toolchainFile": "src/MaaUtils/MaaDeps/cmake/maa-x64-linux-toolchain.cmake",
|
||||
"cacheVariables": {
|
||||
"MAADEPS_TRIPLET": "maa-x64-linux"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-arm64",
|
||||
"inherits": "linux-base",
|
||||
"displayName": "Linux arm64",
|
||||
"toolchainFile": "src/MaaUtils/MaaDeps/cmake/maa-arm64-linux-toolchain.cmake",
|
||||
"cacheVariables": {
|
||||
"MAADEPS_TRIPLET": "maa-arm64-linux"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64",
|
||||
"inherits": "macos-base",
|
||||
"displayName": "macOS arm64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_OSX_ARCHITECTURES": "arm64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-x64",
|
||||
"inherits": "macos-base",
|
||||
"displayName": "macOS x64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_OSX_ARCHITECTURES": "x86_64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "publish-base",
|
||||
"$comment":[
|
||||
"All the name contains 'publish' are used for github actions",
|
||||
"see .github/workflows/ci.yml"
|
||||
],
|
||||
"hidden": true,
|
||||
"installDir": "install",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
||||
"INSTALL_RESOURCE": "ON",
|
||||
"INSTALL_PYTHON": "ON",
|
||||
"BUILD_WPF_GUI": "OFF",
|
||||
"BUILD_DEBUG_DEMO": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-publish-x64",
|
||||
"inherits": ["publish-base", "windows-x64"],
|
||||
"$comment": [
|
||||
"github actions only support Visual Studio 17 2022",
|
||||
"see https://github.com/actions/runner-images/issues/13291"
|
||||
],
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"displayName": "Windows x64 Publish"
|
||||
},
|
||||
{
|
||||
"name": "windows-publish-arm64",
|
||||
"inherits": ["publish-base", "windows-arm64"],
|
||||
"$comment": [
|
||||
"github actions only support Visual Studio 17 2022",
|
||||
"see https://github.com/actions/runner-images/issues/13291"
|
||||
],
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"displayName": "Windows arm64 Publish"
|
||||
},
|
||||
{
|
||||
"name": "linux-publish-x64",
|
||||
"inherits": ["publish-base", "linux-x64"],
|
||||
"displayName": "Linux x64 Publish"
|
||||
},
|
||||
{
|
||||
"name": "linux-publish-arm64",
|
||||
"inherits": ["publish-base", "linux-arm64"],
|
||||
"displayName": "Linux arm64 Publish"
|
||||
},
|
||||
{
|
||||
"name": "macos-publish-x64",
|
||||
"inherits": ["publish-base", "macos-x64"],
|
||||
"displayName": "macOS x64 Publish"
|
||||
},
|
||||
{
|
||||
"name": "macos-publish-arm64",
|
||||
"inherits": ["publish-base", "macos-arm64"],
|
||||
"displayName": "macOS arm64 Publish"
|
||||
},
|
||||
{
|
||||
"name": "smoke-test",
|
||||
"$comment":[
|
||||
"this preset is used for smoke testing",
|
||||
"see .github/workflows/smoke-testing.yml"
|
||||
],
|
||||
"inherits": "macos-arm64",
|
||||
"displayName": "macOS arm64 Smoke Test",
|
||||
"installDir": "install",
|
||||
"cacheVariables": {
|
||||
"BUILD_SMOKE_TEST": "ON",
|
||||
"INSTALL_RESOURCE": "ON",
|
||||
"WITH_HASH_VERSION": "ON"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "windows-x64-Debug",
|
||||
"displayName": "Build Windows x64 Debug",
|
||||
"configurePreset": "windows-x64",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-Release",
|
||||
"displayName": "Build Windows x64 Release",
|
||||
"configurePreset": "windows-x64",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-RelWithDebInfo",
|
||||
"displayName": "Build Windows x64 RelWithDebInfo",
|
||||
"configurePreset": "windows-x64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "windows-arm64-Debug",
|
||||
"displayName": "Build Windows arm64 Debug",
|
||||
"configurePreset": "windows-arm64",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "windows-arm64-Release",
|
||||
"displayName": "Build Windows arm64 Release",
|
||||
"configurePreset": "windows-arm64",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "windows-arm64-RelWithDebInfo",
|
||||
"displayName": "Build Windows arm64 RelWithDebInfo",
|
||||
"configurePreset": "windows-arm64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "linux-x64-Debug",
|
||||
"displayName": "Build Linux x64 Debug",
|
||||
"configurePreset": "linux-x64",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "linux-x64-Release",
|
||||
"displayName": "Build Linux x64 Release",
|
||||
"configurePreset": "linux-x64",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "linux-x64-RelWithDebInfo",
|
||||
"displayName": "Build Linux x64 RelWithDebInfo",
|
||||
"configurePreset": "linux-x64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "linux-arm64-Debug",
|
||||
"displayName": "Build Linux arm64 Debug",
|
||||
"configurePreset": "linux-arm64",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "linux-arm64-Release",
|
||||
"displayName": "Build Linux arm64 Release",
|
||||
"configurePreset": "linux-arm64",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "linux-arm64-RelWithDebInfo",
|
||||
"displayName": "Build Linux arm64 RelWithDebInfo",
|
||||
"configurePreset": "linux-arm64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-Debug",
|
||||
"displayName": "Build macOS x64 Debug",
|
||||
"configurePreset": "macos-x64",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-Release",
|
||||
"displayName": "Build macOS x64 Release",
|
||||
"configurePreset": "macos-x64",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-RelWithDebInfo",
|
||||
"displayName": "Build macOS x64 RelWithDebInfo",
|
||||
"configurePreset": "macos-x64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-Debug",
|
||||
"displayName": "Build macOS arm64 Debug",
|
||||
"configurePreset": "macos-arm64",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-Release",
|
||||
"displayName": "Build macOS arm64 Release",
|
||||
"configurePreset": "macos-arm64",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-RelWithDebInfo",
|
||||
"displayName": "Build macOS arm64 RelWithDebInfo",
|
||||
"configurePreset": "macos-arm64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "windows-publish-x64",
|
||||
"displayName": "Build Windows x64 Publish",
|
||||
"configurePreset": "windows-publish-x64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "windows-publish-arm64",
|
||||
"displayName": "Build Windows arm64 Publish",
|
||||
"configurePreset": "windows-publish-arm64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "linux-publish-x64",
|
||||
"displayName": "Build Linux x64 Publish",
|
||||
"configurePreset": "linux-publish-x64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "linux-publish-arm64",
|
||||
"displayName": "Build Linux arm64 Publish",
|
||||
"configurePreset": "linux-publish-arm64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "macos-publish-x64",
|
||||
"displayName": "Build macOS x64 Publish",
|
||||
"configurePreset": "macos-publish-x64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "macos-publish-arm64",
|
||||
"displayName": "Build macOS arm64 Publish",
|
||||
"configurePreset": "macos-publish-arm64",
|
||||
"configuration": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "smoke-test",
|
||||
"displayName": "Build macOS arm64 Smoke Test",
|
||||
"configurePreset": "smoke-test",
|
||||
"configuration": "Debug"
|
||||
}
|
||||
]
|
||||
}
|
||||
41
README.md
@@ -21,6 +21,9 @@
|
||||
<img alt="stars" src="https://img.shields.io/github/stars/MaaAssistantArknights/MaaAssistantArknights?style=social">
|
||||
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/MaaAssistantArknights/MaaAssistantArknights/total?style=social">
|
||||
</div>
|
||||
<div>
|
||||
<a href="https://deepwiki.com/MaaAssistantArknights/MaaAssistantArknights"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
@@ -43,7 +46,7 @@ MAA 的意思是 MAA Assistant Arknights
|
||||
|
||||
## 亮点功能
|
||||
|
||||
- 刷理智,掉落识别及上传 [企鹅物流](https://penguin-stats.cn/),[一图流](https://ark.yituliu.cn/)
|
||||
- 理智作战,掉落识别及上传 [企鹅物流](https://penguin-stats.cn/),[一图流](https://ark.yituliu.cn/)
|
||||
- 智能基建换班,自动计算干员效率,单设施内最优解;同时也支持 [自定义排班](https://docs.maa.plus/zh-cn/protocol/base-scheduling-schema.html)
|
||||
- 自动公招,可选使用加急许可,一次全部刷完!公招数据自动上传 [企鹅物流](https://penguin-stats.cn/result/stage/recruit/recruit),[一图流](https://ark.yituliu.cn/survey/maarecruitdata)
|
||||
- 支持手动识别公招界面,方便对高星公招做出选择 ~~(你的这个高资回费出的是推王呢还是推王呢)~~
|
||||
@@ -110,15 +113,9 @@ MAA 以中文(简体)为第一语言,翻译词条均以中文(简体)
|
||||
|
||||
### 参与开发
|
||||
|
||||
#### Windows
|
||||
请参阅 [开发指南](https://docs.maa.plus/zh-cn/develop/development.html)。
|
||||
|
||||
请参阅 [开始开发](https://docs.maa.plus/zh-cn/develop/development.html)。
|
||||
|
||||
#### Linux | macOS
|
||||
|
||||
请参阅 [Linux 编译教程](https://docs.maa.plus/zh-cn/develop/linux-tutorial.html)。
|
||||
|
||||
#### API
|
||||
### API
|
||||
|
||||
- [C 接口](include/AsstCaller.h):[集成示例](src/Cpp/main.cpp)
|
||||
- [Python 接口](src/Python/asst/asst.py):[集成示例](src/Python/sample.py)
|
||||
@@ -134,33 +131,11 @@ MAA 以中文(简体)为第一语言,翻译词条均以中文(简体)
|
||||
- [任务流程协议](https://docs.maa.plus/zh-cn/protocol/task-schema.html)
|
||||
- [自动抄作业协议](https://docs.maa.plus/zh-cn/protocol/copilot-schema.html)
|
||||
|
||||
#### 外服适配
|
||||
### 外服适配
|
||||
|
||||
请参阅 [外服适配教程](https://docs.maa.plus/zh-cn/develop/overseas-client-adaptation.html),对于国服已支持的功能,绝大部分的外服适配工作仅需要截图 + 简单的 JSON 修改即可。
|
||||
|
||||
#### 想参与开发,但不太会用 GitHub?
|
||||
|
||||
[GitHub Pull Request 流程简述](https://docs.maa.plus/zh-cn/develop/development.html#github-pull-request-流程简述)
|
||||
|
||||
#### 想参与开发,但面对庞大的项目仓库望而却步?
|
||||
|
||||
请使用 GitHub Codespaces 在线开发环境,尽情尝试!
|
||||
|
||||
我们预置了多种不同的开发环境以供选择:
|
||||
|
||||
- 空白环境,裸 Linux 容器(默认)
|
||||
|
||||
[](https://codespaces.new/MaaAssistantArknights/MaaAssistantArknights?devcontainer_path=.devcontainer%2Fdevcontainer.json)
|
||||
|
||||
- 轻量环境,适合文档站前端开发
|
||||
|
||||
[](https://codespaces.new/MaaAssistantArknights/MaaAssistantArknights?devcontainer_path=.devcontainer%2F0%2Fdevcontainer.json)
|
||||
|
||||
- 全量环境,适合 MAA Core 相关开发
|
||||
|
||||
[](https://codespaces.new/MaaAssistantArknights/MaaAssistantArknights?devcontainer_path=.devcontainer%2F1%2Fdevcontainer.json)
|
||||
|
||||
#### Issue bot
|
||||
### Issue bot
|
||||
|
||||
请参阅 [Issue Bot 使用方法](https://docs.maa.plus/zh-cn/develop/issue-bot-usage.html)
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
## 受支持的版本 / Supported Versions
|
||||
|
||||
我们仅对 v4 和 v5 两个大版本的最新稳定版提供安全支持,如有安全问题,我们将会尽可能快地发布新的稳定版解决。
|
||||
我们仅对 v6 的最新稳定版提供安全支持,如有安全问题,我们将会尽可能快地发布新的稳定版解决。
|
||||
|
||||
内测版、公测版仅供测试,我们不会对其提供安全支持。
|
||||
|
||||
We only provide security support for the latest Stable Release versions of v4 and v5. If there are security issues, we will release a new stable version as soon as possible to solve them.
|
||||
We only provide security support for the latest Stable Release versions of v6. If there are security issues, we will release a new stable version as soon as possible to solve them.
|
||||
|
||||
The Nightly Release version and the Beta Release version are for testing only, and we will not provide security support for them.
|
||||
|
||||
|
||||
@@ -1,83 +1,2 @@
|
||||
set(debug_comp_defs "_DEBUG;ASST_DEBUG")
|
||||
add_compile_definitions("$<$<CONFIG:Debug>:${debug_comp_defs}>")
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_INSTALL_RPATH "@loader_path;@executable_path")
|
||||
set(CMAKE_BUILD_RPATH "@loader_path;@executable_path")
|
||||
elseif(UNIX)
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
||||
set(CMAKE_BUILD_RPATH "$ORIGIN")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_compile_options("/utf-8")
|
||||
add_compile_options("/MP")
|
||||
add_compile_options("/W4;/WX;/Gy;/permissive-;/sdl")
|
||||
add_compile_options("/wd4127") # conditional expression is constant
|
||||
add_compile_options("/wd4251") # export dll with templates
|
||||
|
||||
add_compile_options("/DWINVER=0x0A00")
|
||||
add_compile_options("/D_WIN32_WINNT=0x0A00")
|
||||
|
||||
# https://github.com/actions/runner-images/issues/10004 https://github.com/microsoft/STL/releases/tag/vs-2022-17.10
|
||||
add_compile_definitions("_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR")
|
||||
|
||||
set(release_link_options "/OPT:REF;/OPT:ICF")
|
||||
add_link_options("$<$<CONFIG:Release>:${release_link_options}>")
|
||||
SET(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RelWithDebInfo;Release;")
|
||||
SET(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "MinSizeRel;Release;")
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||
else()
|
||||
add_compile_options("-Wall;-Werror;-Wextra;-Wpedantic;-Wno-missing-field-initializers")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13)
|
||||
add_compile_options("-Wno-restrict")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
function(copy_and_add_rpath_library LIBNAME)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=${LIBNAME}.so.1 -target ${CMAKE_CXX_COMPILER_TARGET} --sysroot=${CMAKE_SYSROOT}
|
||||
OUTPUT_VARIABLE LIB_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if("${LIB_PATH}" STREQUAL "${LIBNAME}.so.1")
|
||||
message(FATAL_ERROR "Could not locate ${LIBNAME}.so.1 using compiler")
|
||||
endif()
|
||||
|
||||
file(READ_SYMLINK "${LIB_PATH}" LINK_TARGET)
|
||||
if(NOT LINK_TARGET)
|
||||
set(LIB_PATH_REAL "${LIB_PATH}")
|
||||
elseif(NOT IS_ABSOLUTE "${LINK_TARGET}")
|
||||
get_filename_component(LIB_PATH_DIR "${LIB_PATH}" DIRECTORY)
|
||||
file(REAL_PATH "${LIB_PATH_DIR}/${LINK_TARGET}" LIB_PATH_REAL)
|
||||
else()
|
||||
set(LIB_PATH_REAL "${LINK_TARGET}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${LIB_PATH_REAL}")
|
||||
message(FATAL_ERROR "File not found: ${LIB_PATH_REAL}")
|
||||
endif()
|
||||
|
||||
message(STATUS "${LIBNAME}.so.1 path: ${LIB_PATH_REAL}")
|
||||
|
||||
install(FILES "${LIB_PATH_REAL}" DESTINATION . RENAME "${LIBNAME}.so.1" COMPONENT libcxx)
|
||||
|
||||
get_filename_component(LIB_PATH_DIR "${LIB_PATH_REAL}" DIRECTORY)
|
||||
list(APPEND CMAKE_BUILD_RPATH "${LIB_PATH_DIR}")
|
||||
set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
copy_and_add_rpath_library(libc++)
|
||||
copy_and_add_rpath_library(libc++abi)
|
||||
copy_and_add_rpath_library(libunwind)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
|
||||
@@ -1,27 +1,81 @@
|
||||
if (BUILD_XCFRAMEWORK)
|
||||
add_custom_command(OUTPUT MaaCore.xcframework
|
||||
COMMAND rm -rf MaaCore.xcframework
|
||||
COMMAND xcodebuild -create-xcframework -library libMaaCore.dylib -headers ${PROJECT_SOURCE_DIR}/include -output MaaCore.xcframework
|
||||
set(XCFRAMEWORK_DIR "${CMAKE_BINARY_DIR}/xcframework")
|
||||
file(MAKE_DIRECTORY ${XCFRAMEWORK_DIR})
|
||||
|
||||
# Macro to find a unique library file
|
||||
macro(find_unique_library lib_name glob_pattern output_var)
|
||||
file(GLOB _libs CONFIGURE_DEPENDS "${MAADEPS_DIR}/runtime/${MAADEPS_TRIPLET}/${glob_pattern}")
|
||||
if(_libs)
|
||||
list(LENGTH _libs _cnt)
|
||||
if(_cnt EQUAL 1)
|
||||
list(GET _libs 0 ${output_var})
|
||||
message(STATUS "Found ${lib_name}: ${${output_var}}")
|
||||
else()
|
||||
message(FATAL_ERROR "Ambiguous ${lib_name} dylibs: ${_libs}")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "${lib_name} library not found in ${MAADEPS_DIR}/runtime/${MAADEPS_TRIPLET}/")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
add_custom_command(OUTPUT ${XCFRAMEWORK_DIR}/MaaCore.xcframework
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf "${XCFRAMEWORK_DIR}/MaaCore.xcframework"
|
||||
COMMAND xcodebuild -create-xcframework
|
||||
-library $<TARGET_FILE:MaaCore>
|
||||
-headers ${PROJECT_SOURCE_DIR}/include
|
||||
-output MaaCore.xcframework
|
||||
DEPENDS MaaCore
|
||||
WORKING_DIRECTORY ${XCFRAMEWORK_DIR}
|
||||
COMMENT "Generating MaaCore.xcframework"
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT ${XCFRAMEWORK_DIR}/MaaUtils.xcframework
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf "${XCFRAMEWORK_DIR}/MaaUtils.xcframework"
|
||||
COMMAND xcodebuild -create-xcframework
|
||||
-library $<TARGET_FILE:MaaUtils>
|
||||
-output MaaUtils.xcframework
|
||||
DEPENDS MaaUtils
|
||||
WORKING_DIRECTORY ${XCFRAMEWORK_DIR}
|
||||
COMMENT "Generating MaaUtils.xcframework"
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT OpenCV.xcframework
|
||||
COMMAND rm -rf OpenCV.xcframework
|
||||
COMMAND xcodebuild -create-xcframework -library "${PROJECT_SOURCE_DIR}/MaaDeps/runtime/${MAADEPS_TRIPLET}/libopencv_world4.408.dylib" -output OpenCV.xcframework
|
||||
find_unique_library("OpenCV" "libopencv_world*.dylib" OPENCV_LIB)
|
||||
add_custom_command(OUTPUT ${XCFRAMEWORK_DIR}/OpenCV.xcframework
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf "${XCFRAMEWORK_DIR}/OpenCV.xcframework"
|
||||
COMMAND xcodebuild -create-xcframework
|
||||
-library "${OPENCV_LIB}"
|
||||
-output OpenCV.xcframework
|
||||
WORKING_DIRECTORY ${XCFRAMEWORK_DIR}
|
||||
COMMENT "Generating OpenCV.xcframework"
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT ONNXRuntime.xcframework
|
||||
COMMAND rm -rf ONNXRuntime.xcframework
|
||||
COMMAND xcodebuild -create-xcframework -library "${PROJECT_SOURCE_DIR}/MaaDeps/runtime/${MAADEPS_TRIPLET}/libonnxruntime.1.18.0.dylib" -output ONNXRuntime.xcframework
|
||||
find_unique_library("ONNXRuntime" "libonnxruntime*.dylib" ONNXRUNTIME_LIB)
|
||||
add_custom_command(OUTPUT ${XCFRAMEWORK_DIR}/ONNXRuntime.xcframework
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf "${XCFRAMEWORK_DIR}/ONNXRuntime.xcframework"
|
||||
COMMAND xcodebuild -create-xcframework
|
||||
-library "${ONNXRUNTIME_LIB}"
|
||||
-output ONNXRuntime.xcframework
|
||||
WORKING_DIRECTORY ${XCFRAMEWORK_DIR}
|
||||
COMMENT "Generating ONNXRuntime.xcframework"
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT fastdeploy_ppocr.xcframework
|
||||
COMMAND rm -rf fastdeploy_ppocr.xcframework
|
||||
COMMAND xcodebuild -create-xcframework -library "${PROJECT_SOURCE_DIR}/MaaDeps/runtime/${MAADEPS_TRIPLET}/libfastdeploy_ppocr.dylib" -output fastdeploy_ppocr.xcframework
|
||||
add_custom_command(OUTPUT ${XCFRAMEWORK_DIR}/fastdeploy_ppocr.xcframework
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf "${XCFRAMEWORK_DIR}/fastdeploy_ppocr.xcframework"
|
||||
COMMAND xcodebuild -create-xcframework
|
||||
-library "${MAADEPS_DIR}/runtime/${MAADEPS_TRIPLET}/libfastdeploy_ppocr.dylib"
|
||||
-output fastdeploy_ppocr.xcframework
|
||||
WORKING_DIRECTORY ${XCFRAMEWORK_DIR}
|
||||
COMMENT "Generating fastdeploy_ppocr.xcframework"
|
||||
)
|
||||
|
||||
add_custom_target(MaaXCFramework ALL
|
||||
DEPENDS MaaCore MaaCore.xcframework OpenCV.xcframework ONNXRuntime.xcframework fastdeploy_ppocr.xcframework
|
||||
DEPENDS
|
||||
MaaCore
|
||||
${XCFRAMEWORK_DIR}/MaaCore.xcframework
|
||||
MaaUtils
|
||||
${XCFRAMEWORK_DIR}/MaaUtils.xcframework
|
||||
${XCFRAMEWORK_DIR}/OpenCV.xcframework
|
||||
${XCFRAMEWORK_DIR}/ONNXRuntime.xcframework
|
||||
${XCFRAMEWORK_DIR}/fastdeploy_ppocr.xcframework
|
||||
)
|
||||
endif (BUILD_XCFRAMEWORK)
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
find_path(ONNXRuntime_INCLUDE_DIR NAMES onnxruntime/onnxruntime_c_api.h)
|
||||
|
||||
find_library(ONNXRuntime_LIBRARY_IMP NAMES onnxruntime)
|
||||
|
||||
if (WIN32)
|
||||
get_filename_component(ONNXRuntime_PATH_LIB ${ONNXRuntime_LIBRARY_IMP} DIRECTORY)
|
||||
find_file(ONNXRuntime_LIBRARY NAMES onnxruntime_maa.dll PATHS "${ONNXRuntime_PATH_LIB}/../bin")
|
||||
|
||||
find_file(ONNXRuntime_LIBRARY_IMP_DEBUG NAMES onnxruntime.lib PATHS "${ONNXRuntime_PATH_LIB}/../debug/lib")
|
||||
find_file(ONNXRuntime_LIBRARY_DEBUG NAMES onnxruntime_maa.dll PATHS "${ONNXRuntime_PATH_LIB}/../debug/bin")
|
||||
else ()
|
||||
set(ONNXRuntime_LIBRARY ${ONNXRuntime_LIBRARY_IMP})
|
||||
endif (WIN32)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
ONNXRuntime
|
||||
REQUIRED_VARS ONNXRuntime_LIBRARY_IMP ONNXRuntime_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if(ONNXRuntime_FOUND)
|
||||
set(ONNXRuntime_INCLUDE_DIRS ${ONNXRuntime_INCLUDE_DIR})
|
||||
if(NOT TARGET ONNXRuntime::ONNXRuntime)
|
||||
add_library(ONNXRuntime::ONNXRuntime SHARED IMPORTED)
|
||||
set_property(TARGET ONNXRuntime::ONNXRuntime APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
if (WIN32)
|
||||
set_property(TARGET ONNXRuntime::ONNXRuntime APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(ONNXRuntime::ONNXRuntime PROPERTIES
|
||||
IMPORTED_IMPLIB_RELEASE "${ONNXRuntime_LIBRARY_IMP}"
|
||||
)
|
||||
set_target_properties(ONNXRuntime::ONNXRuntime PROPERTIES
|
||||
IMPORTED_IMPLIB_DEBUG "${ONNXRuntime_LIBRARY_IMP_DEBUG}"
|
||||
IMPORTED_LOCATION_DEBUG "${ONNXRuntime_LIBRARY_DEBUG}"
|
||||
)
|
||||
endif (WIN32)
|
||||
set_target_properties(ONNXRuntime::ONNXRuntime PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${ONNXRuntime_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ONNXRuntime_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,50 +1,3 @@
|
||||
function(download_and_decompress url filename sha256_checksum decompress_dir)
|
||||
if(EXISTS ${filename})
|
||||
file(SHA256 ${filename} CHECKSUM_VARIABLE)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${filename} OR NOT CHECKSUM_VARIABLE STREQUAL sha256_checksum)
|
||||
message("Downloading file from ${url} to ${filename} ...")
|
||||
file(
|
||||
DOWNLOAD ${url} "${filename}.tmp"
|
||||
SHOW_PROGRESS
|
||||
EXPECTED_HASH SHA256=${sha256_checksum})
|
||||
file(RENAME "${filename}.tmp" ${filename})
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${decompress_dir})
|
||||
file(MAKE_DIRECTORY ${decompress_dir})
|
||||
endif()
|
||||
|
||||
message("Decompress file ${filename} ...")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${filename} WORKING_DIRECTORY ${decompress_dir})
|
||||
endfunction()
|
||||
|
||||
function(get_osx_architecture)
|
||||
if(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
||||
set(CURRENT_OSX_ARCH
|
||||
"arm64"
|
||||
PARENT_SCOPE)
|
||||
elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
|
||||
set(CURRENT_OSX_ARCH
|
||||
"x86_64"
|
||||
PARENT_SCOPE)
|
||||
else()
|
||||
set(CURRENT_OSX_ARCH
|
||||
${CMAKE_HOST_SYSTEM_PROCESSOR}
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 13.4) # for to_chars
|
||||
get_osx_architecture()
|
||||
endif(APPLE)
|
||||
|
||||
if(NOT DEFINED MAADEPS_TRIPLET)
|
||||
detect_maadeps_triplet(MAADEPS_TRIPLET)
|
||||
endif()
|
||||
|
||||
# 创建资源目录链接的函数
|
||||
function(create_resource_link TARGET_NAME OUTPUT_DIR)
|
||||
if(WIN32)
|
||||
@@ -59,7 +12,7 @@ function(create_resource_link TARGET_NAME OUTPUT_DIR)
|
||||
COMMENT "Creating junction for resource directory for ${TARGET_NAME}"
|
||||
)
|
||||
else()
|
||||
# Unix/Linux/macOS 使用符号链接
|
||||
# UNIX/Linux/macOS 使用符号链接
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
POST_BUILD
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# define MAA_HASH_VERSION from git
|
||||
set(MAA_HASH_VERSION
|
||||
"DEBUG_VERSION"
|
||||
CACHE STRING "maa version")
|
||||
|
||||
if(WITH_HASH_VERSION AND MAA_HASH_VERSION STREQUAL "DEBUG_VERSION")
|
||||
find_package(Git)
|
||||
|
||||
if(GIT_FOUND)
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE err
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(result EQUAL 0)
|
||||
set(MAA_HASH_VERSION "${output}")
|
||||
else()
|
||||
message(WARNING "git rev-parse returning ${result}, output:\n${err}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "MAA_HASH_VERSION=${MAA_HASH_VERSION}")
|
||||
add_compile_definitions(MAA_VERSION="${MAA_HASH_VERSION}")
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineClientConfig } from 'vuepress/client'
|
||||
|
||||
import { getAsciiArt } from './plugins/asciiArt.mts'
|
||||
import { getAsciiArt } from './plugins/asciiArt'
|
||||
|
||||
import AsciiArt from './components/AsciiArt.vue'
|
||||
import ImageGrid from './components/ImageGrid.vue'
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { getAsciiArt, ThemeType, AsciiArtScope } from '../plugins/asciiArt.mts'
|
||||
import { getAsciiArt, ThemeType, AsciiArtScope } from '../plugins/asciiArt'
|
||||
|
||||
// -------- Props --------
|
||||
interface AsciiArtProps {
|
||||
|
||||
7
docs/.vuepress/env.d.ts
vendored
@@ -1,7 +0,0 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
}
|
||||
@@ -2,7 +2,7 @@ export default {
|
||||
provider: 'algolia' as const,
|
||||
appId: '9ARM1N4899',
|
||||
apiKey: 'f42bf1d18c786d5a46da30eccac5cb34',
|
||||
indexName: 'maa',
|
||||
indexName: 'MaaAssistantArknights',
|
||||
locales: {
|
||||
'/zh-cn/': {
|
||||
placeholder: '搜索',
|
||||
|
||||
|
Before Width: | Height: | Size: 691 KiB After Width: | Height: | Size: 690 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 420 KiB After Width: | Height: | Size: 419 KiB |
|
Before Width: | Height: | Size: 301 KiB After Width: | Height: | Size: 301 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 643 KiB After Width: | Height: | Size: 641 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 429 KiB After Width: | Height: | Size: 429 KiB |
BIN
docs/.vuepress/public/images/zh-cn/copper-explanation-1.png
Normal file
|
After Width: | Height: | Size: 931 KiB |
BIN
docs/.vuepress/public/images/zh-cn/copper-explanation-2.png
Normal file
|
After Width: | Height: | Size: 925 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |