1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
|
# !!! DISCLAIMER! PLEASE DON'T IGNORE !!!
# The FAKEID value is huge hammer. It affects UIDs of all nodes in build graph including, but not limited to
# any resource fetch (think java contrib), build on any language (C++, Python, Java, Go), any code generation.
# Any build after this change will pay the price:
# - Local builds and Sandbox builds will reload all resources from Sandbox and cached data from YT (if ready).
# - Distributed (YT) cache warmup will take significant time to catch up and will need to recache everything.
# - Autocheck will rebuild and recache everything.
# Use this with extreme care and only change if it is ultimately needed. Consider more specific XXX_FAKEIDs below instead.
FAKEID=314159265358
SANDBOX_FAKEID=${FAKEID}.7600000
CPP_FAKEID=2023-06-06
GO_FAKEID=11100371
ANDROID_FAKEID=2023-05-17
CLANG_TIDY_FAKEID=2023-06-06
CYTHON_FAKE_ID=10784829
JAVA_FAKEID=10849009
# Change of this value will invalidate some parts of configure cache
# but will not affect builds anyhow (except tests referring build/ directory)
JSON_CACHE_FAKE_ID=11215402
REPORT_ALL_DUPSRC=yes
CURDIR=.
MODDIR=.
BINDIR=bin:/
SRCDIR=
YMAKE=ymake
ECHO=echo
INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i .ipp .ixx .ya_exposed
CPP_EXT=.cpp
OBJ_SUF=
CFLAGS=
EXTRA_C_FLAGS=
SFLAGS=
FORCE_COVERAGE_ENABLED=
FORCE_COVERAGE_DISABLED=
AUTOCHECK_BALANCING_OPTIONS=
SO_OUTPUTS=no
@import "${CONF_ROOT}/conf/settings.conf"
@import "${CONF_ROOT}/conf/opensource.conf"
@import "${CONF_ROOT}/conf/rules.conf"
@import "${CONF_ROOT}/conf/sysincl.conf"
@import "${CONF_ROOT}/conf/license.conf"
@import "${CONF_ROOT}/conf/ts/ts.conf"
@import "${CONF_ROOT}/conf/docs.conf"
@import "${CONF_ROOT}/conf/swig.conf"
@import "${CONF_ROOT}/conf/java.conf"
@import "${CONF_ROOT}/conf/project_specific/other.conf"
@import "${CONF_ROOT}/conf/project_specific/uservices.conf"
@import "${CONF_ROOT}/conf/project_specific/yt.conf"
USE_GLOBAL_CMD=no
when ($OS_WINDOWS != "yes") {
USE_GLOBAL_CMD=yes
}
when ($USE_PYTHON) {
C_DEFINES+= -DUSE_PYTHON
}
__COMMA__=${comma:""}
ARCADIA_TEST_ROOT=../arcadia_tests_data/
DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32
FAIL_PY2=no
_PREBUILT_TOOLS_ROOT=build/prebuilt
_TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
_TOOL_PROTOC_GEN_GO_V2=vendor/google.golang.org/protobuf/cmd/protoc-gen-go
_TOOL_PROTOC_GEN_GO_GRPC_V2=vendor/google.golang.org/grpc/cmd/protoc-gen-go-grpc
_TOOL_RESCOMPILER=tools/rescompiler
_TOOL_RESCOMPRESSOR=tools/rescompressor
_TOOL_RORESCOMPILER=tools/rorescompiler
when ($DISABLE_SEPARATE_AUX_CPP != "yes") {
SEPARATE_AUX_CPP=yes
}
when ($HOST_ARCH_X86_64 == "yes") {
when ($HOST_OS_DARWIN == "yes" || $HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes") {
VALID_HOST_PLATFORM_FOR_COMMON_PREBUILT_TOOLS=yes
when ($USE_PREBUILT_TOOLS == "yes" && $ARCH_X86_64 == "yes") {
_TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
}
}
}
FAIL_MODULE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
DEFAULT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
PROJECT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
TIDY=
TIDY_ENABLED=
when($TIDY == "yes") {
TIDY_ENABLED=yes
}
when ($TIDY_ENABLED == "yes") {
when ($TIDY_EXPORT_FIXES=="") {
TIDY_EXPORT_FIXES="no"
}
CLANG_TIDY_ARGS=${hide:CLANG_TIDY_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/clang_tidy.py"} "--ymake-python" $YMAKE_PYTHON "--clang-tidy-bin" "$(CLANG_TIDY_BIN)/bin/clang-tidy" "--config-validation-script" ${input:"build/tests/config/clang_tidy/tidy_config_validation.py"} "--testing-src" ${input:SRC} "--source-root" $(SOURCE_ROOT) "--build-root" $(BUILD_ROOT) "--tidy-json" ${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJ_CROSS_SUF}.tidyjson:SRC} "--export-fixes" $TIDY_EXPORT_FIXES
CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
when ($TIDY_CHECKS) {
CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
}
when ($TIDY_HEADER_FILTER) {
CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
}
TIDY_VALUE=USE_CONDITIONAL_SRCS
}
otherwise {
CLANG_TIDY_ARGS=
TIDY_VALUE=
}
# tag:codenav
when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.ydx.pb2:SRC}
}
otherwise {
PY_PROGRAM_LINK_EXE=$LINK_EXE
YNDEXER_ARGS=
YNDEXER_OUTPUT=
}
when ($RETRY == "yes") {
RETRY_ARGS=$YMAKE_PYTHON ${input:"build/scripts/wrapcc.py"}
}
otherwise {
RETRY_ARGS=
}
COVERAGE_FLAGS=
EXTRA_OUTPUT=
when ($CLANG == "yes" || $GCC == "yes") {
when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
EXTRA_OUTPUT=${output;noauto;hide;suf=${COMPILE_OUT_SUFFIX}${_CROSS_SUFFIX}.gcno:SRC}
}
}
when ($OS_CYGWIN == "yes") {
CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
USE_ASMLIB=no
FSTACK=
}
CFLAGS+=$COVERAGE_FLAGS
LDFLAGS+=$COVERAGE_FLAGS
CHECKFLAG=
NO_MAPREDUCE=
when ($NO_MAPREDUCE == "yes") {
C_DEFINES+=-DNO_MAPREDUCE
}
when ($OS_ANDROID == "yes") {
PIE=yes
}
# TODO: extract to conf/maps/maps.conf
when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
USE_STL_SYSTEM=yes
ARCADIA_CURL_DNS_RESOLVER=MULTITHREADED
}
when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_IOS == "yes") {
BUILD_IOS_APP=yes
when ($ARCH_ARM7 || $ARCH_ARM64) {
BOOSTTEST_IS_FAT_OBJECT=yes
}
}
when ($CLANG && $OS_DARWIN && $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
SO_OUTPUTS=yes
}
when ($OS_NONE == "yes") {
USE_STL_SYSTEM=yes
}
# USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
# select system standard C++ library when USE_INTERNAL_STL=no is set.
#
# USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
#
when ($USE_STL_SYSTEM == "yes") {
USE_INTERNAL_STL=no
}
when ($USE_INTERNAL_STL == "no") {
USE_STL_SYSTEM=yes
}
otherwise {
USE_INTERNAL_STL=yes
# TODO: Extract to conf/sysincl.conf
# This trigger doesn't work for module level since SYSINCL is processed at
# configuration stage (This means that NO_RUNTIME() macro called in ya.make
# won't affect SYSINCL and the only way to make this trigger work correctly
# is to define configuration variable NORUNTIME (-DNORUNTIME) on the command
# line when `ya make ...` is invoked.
when ($NORUNTIME != "yes") {
SYSINCL+=build/sysincl/stl-to-libcxx.yml
when ($MUSL == "yes") {
SYSINCL+=build/sysincl/libc-musl-libcxx.yml
}
}
}
# tag:linux-specific
when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") {
USE_UBUNTU_COMPATIBILITY=yes
}
USE_ARCADIA_PYTHON=yes
USE_ARCADIA_LIBM=no
USE_EAT_MY_DATA=no
HAVE_MKL=
when ($HAVE_MKL == "") {
when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
HAVE_MKL=yes
}
otherwise {
HAVE_MKL=no
}
}
SFDL_TMP_OUT= ${output;tmp:SRC.tmp}
# tag:perl-specific
when ($USE_LOCAL_TOOLS == "yes") {
PERL=$LOCAL_PERL
PERL_VERSION=$LOCAL_PERL_VERSION
PERL_PRIVLIB=$LOCAL_PERL_PRIVLIB
PERL_ARCHLIB=$LOCAL_PERL_ARCHLIB
when ($LOCAL_PERL_LIBS) {
PERL_LIBS=$LOCAL_PERL_LIBS
}
}
otherwise {
PERL=NO-PERL-SELECTED
PERL_VERSION=NO-PERL-SELECTED-VERSION
PERL_PRIVLIB=NO-PERL-SELECTED-PRIVLIB
PERL_ARCHLIB=NO-PERL-SELECTED-ARCHLIB
}
# tag:perl-specific
PERL_LD_LIBRARY_PATH=
PERL_INCLUDE=
USE_PERL_SYSTEM=yes
when ($USE_PERL_SYSTEM == "yes") {
select ($PERL_SDK) {
"ubuntu-12" ? {
PERL_VERSION=5.14
PERL_ROOT=${SYSTEM_PERL_514_RESOURCE_GLOBAL}/perl${PERL_VERSION}
PERL_LIB_ARCH=
}
"ubuntu-14" ? {
PERL_VERSION=5.18
PERL_ROOT=${SYSTEM_PERL_518_RESOURCE_GLOBAL}/perl${PERL_VERSION}
PERL_LIB_ARCH=
}
"ubuntu-16" ? {
PERL_VERSION=5.22
PERL_ROOT=${SYSTEM_PERL_522_RESOURCE_GLOBAL}/perl${PERL_VERSION}
PERL_LIB_ARCH=/x86_64-linux-gnu
}
"ubuntu-18" ? {
PERL_VERSION=5.26
PERL_ROOT=${SYSTEM_PERL_526_RESOURCE_GLOBAL}/perl${PERL_VERSION}
PERL_LIB_ARCH=/x86_64-linux-gnu
}
"ubuntu-20" ? {
PERL_VERSION=5.30
PERL_ROOT=${SYSTEM_PERL_530_RESOURCE_GLOBAL}/usr
PERL_LIB_ARCH=/x86_64-linux-gnu
}
}
PERL=${PERL_ROOT}/bin/perl
PERL_ARCHLIB=${PERL_ROOT}/lib$PERL_LIB_ARCH/perl/${PERL_VERSION}
PERL_PRIVLIB=${PERL_ROOT}/share/perl/${PERL_VERSION}
PERL_LIBS=${PERL_ROOT}/lib${PERL_LIB_ARCH}
PERL_LD_LIBRARY_PATH=${env:"LD_LIBRARY_PATH=${PERL_ROOT}/lib"}
# Perl searches it's modules in INC@ paths. They can not be sysrooted or disabled (at least I haven't found a way),
# so default Perl module directories should be prepended to perl command lines when using non-local perl.
PERL_INCLUDE=-I${PERL_ARCHLIB} -I${PERL_PRIVLIB}
}
PERL_DEFAULT_PEERDIR=yes
# tag:perl-specific
PERLSUFFIX=-csuffix .cpp
PERLOUTPUT=${stdout;output:SRC.cpp}
when ($PERLC == "yes") {
PERLSUFFIX=-csuffix .c
PERLOUTPUT=${stdout;output:SRC.c}
}
XSUBPPFLAGS=
_XSTYPEMAPS=
macro XSTYPEMAPS(Names...) {
SET_APPEND(_XSTYPEMAPS $Names)
}
# tag:tool-specific
ARCH_TOOL=${tool:"tools/archiver"}
# tag:tool-specific tag:proto
PROTOC=${tool:"contrib/tools/protoc"}
PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src
USE_VANILLA_PROTOC=no
PROTOC_TRANSITIVE_HEADERS=yes
_PROTOC_FLAGS=
# tag:tool-specific
FML_TOOL=${tool:"tools/relev_fml_codegen"}
FML_UNUSED_TOOL=${tool:"tools/relev_fml_unused"}
LUA_TOOL=${tool:"tools/lua"}
ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
# tag:python-specific tag:cython-specific
CYTHON_SCRIPT=${input:"${ARCADIA_ROOT}/contrib/tools/cython/cython.py"} ${hide:CYTHON_FAKE_ID} $CYTHON_PREDEFINED_INCLUDES
RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
PYTHON_TYPE_FOR_CYTHON=PY2
CYTHON_OUTPUT_INCLUDES=\
${output_include;hide:"contrib/libs/python/Include/compile.h"} \
${output_include;hide:"contrib/libs/python/Include/frameobject.h"} \
${output_include;hide:"contrib/libs/python/Include/longintrepr.h"} \
${output_include;hide:"contrib/libs/python/Include/pyconfig.h"} \
${output_include;hide:"contrib/libs/python/Include/Python.h"} \
${output_include;hide:"contrib/libs/python/Include/pythread.h"} \
${output_include;hide:"contrib/libs/python/Include/structmember.h"} \
${output_include;hide:"contrib/libs/python/Include/traceback.h"} \
${output_include;hide:"contrib/tools/cython/generated_c_headers.h"} \
${output_include;hide:"omp.h"}
# tag:cython-specific
CYTHON_CPP_OUTPUT_INCLUDES=${output_include;hide:"contrib/tools/cython/generated_cpp_headers.h"}
# tag:cython-specific
CYTHON_PREDEFINED_INCLUDES=\
${input;hide:"contrib/tools/cython/Cython/Utility/Buffer.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/Builtins.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/CMath.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/Capsule.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/CommonTypes.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/Complex.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/Coroutine.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/CythonFunction.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/Embed.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/Exceptions.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/ExtensionTypes.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/FunctionArguments.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/ImportExport.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/MemoryView_C.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/ModuleSetupCode.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/ObjectHandling.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/Optimize.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/Overflow.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/Printing.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/Profile.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/StringTools.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/TestUtilityLoader.c"} \
${input;hide:"contrib/tools/cython/Cython/Utility/TypeConversion.c"}
# tag:cython-specific
CYTHON_PREDEFINED_INDUCED=\
contrib/libs/python/Include/Python.h
# tag:cython-specific
CYTHON_OPTIONS=
when ($OS_LINUX) {
CYTHON_OPTIONS += -E UNAME_SYSNAME=Linux
}
elsewhen ($OS_DARWIN) {
CYTHON_OPTIONS += -E UNAME_SYSNAME=Darwin
}
elsewhen ($OS_WINDOWS) {
CYTHON_OPTIONS += -E UNAME_SYSNAME=Windows
}
FATAL_ERROR_MODULE=no
FATAL_ERROR_MESSAGE=
# tag:python-specific
# PYTHON_DISTR={ "default" | "macos-brew" } determine python system supply
# see build/platform/python/ya.make
PYTHON_DISTR="default"
when ($USE_SYSTEM_PYTHON) {
USE_ARCADIA_PYTHON=no
select ($USE_SYSTEM_PYTHON) {
"2.7" ? {
_SYSTEM_PYTHON27=yes
PY_VERSION=2.7
PY_FRAMEWORK_VERSION=2.7
}
"3.4" ? {
_SYSTEM_PYTHON34=yes
PY_VERSION=3.4m
PY_FRAMEWORK_VERSION=3.4
}
"3.5" ? {
_SYSTEM_PYTHON35=yes
PY_VERSION=3.5m
PY_FRAMEWORK_VERSION=3.5
}
"3.6" ? {
_SYSTEM_PYTHON36=yes
PY_VERSION=3.6m
PY_FRAMEWORK_VERSION=3.6
}
"3.7" ? {
_SYSTEM_PYTHON37=yes
PY_VERSION=3.7m
PY_FRAMEWORK_VERSION=3.7
}
"3.8" ? {
_SYSTEM_PYTHON38=yes
PY_VERSION=3.8
PY_FRAMEWORK_VERSION=3.8
}
"3.9" ? {
_SYSTEM_PYTHON39=yes
PY_VERSION=3.9
PY_FRAMEWORK_VERSION=3.9
}
"3.10" ? {
_SYSTEM_PYTHON310=yes
PY_VERSION=3.10
PY_FRAMEWORK_VERSION=3.10
}
"3.11" ? {
_SYSTEM_PYTHON311=yes
PY_VERSION=3.11
PY_FRAMEWORK_VERSION=3.11
}
default ? {
FATAL_ERROR_MESSAGE+=invalid USE_SYSTEM_PYTHON value
}
}
}
ANTLR_PYTHON=Python2
### @usage: NO_LTO()
###
### Disable any lto (link-time optimizations) for the module.
### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
### linking of entire program if global settings say so.
macro NO_LTO() {
DISABLE(USE_LTO)
DISABLE(USE_THINLTO)
}
when ($BUILD_PYTHON3_BIN) {
YMAKE_PYTHON3=${BUILD_PYTHON3_BIN}
YMAKE_PYTHON3_PEERDIR=
}
otherwise {
YMAKE_PYTHON3=${YMAKE_PYTHON3_RESOURCE_GLOBAL}/python3
}
# tag:python-specific
when ($USE_ARCADIA_PYTHON == "no") {
SYSINCL+=build/sysincl/python.yml
}
# tag:allocator
DEFAULT_ALLOCATOR=LF
# tag:allocator
when ($OS_ANDROID == "yes" || $MSVC == "yes" || $ARCH_TYPE_32 == "yes" || $ARCH_AARCH64 == "yes") {
DEFAULT_ALLOCATOR=J
}
# tag:allocator
when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
DEFAULT_ALLOCATOR=SYSTEM
}
# tag:allocator
when ($OS_DARWIN == "yes") {
DEFAULT_ALLOCATOR=SYSTEM
}
# tag:allocator
when ($OS_LINUX == "yes") {
when ($GCC) {
# tcmalloc broken build
}
elsewhen ($SANDBOXING) {
# broken
}
elsewhen ($ARCH_X86_64) {
DEFAULT_ALLOCATOR=TCMALLOC_TC
}
}
# tag:allocator
when ($SANITIZER_TYPE) {
when ($SANITIZER_TYPE != "no") {
DEFAULT_ALLOCATOR=SYSTEM
}
}
# tag:allocator
when ($ARCH_XTENSA == "yes") {
DEFAULT_ALLOCATOR=FAKE
}
# tag:internal
### @usage: CHECK_CONFIG_H(<conf_header>) # internal
###
### This internal macro adds checking code for configuration header in external (contrib) library.
### The check is needed to avoid conflicts on certain types and functions available in arcadia.
###
### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
macro CHECK_CONFIG_H(Conf) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/check_config_h.py"} ${input;rootrel:Conf} ${output;nopath;noext:Conf.config.cpp} ${kv;hide:"p CH"} ${kv;hide:"pc yellow"}
OUTPUT_INCLUDES=$Conf
}
REQUIRED_TRANSITIVE_PEERS=
### @usage REQUIRES(dirs...)
###
### Specify list of dirs which this module must depend on indirectly.
###
### This macro can be used if module depends on the directories specified but they can't be listed
### as direct PEERDIR dependencies (due to public include order or link order issues).
macro REQUIRES(DIRS[]) {
SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
}
CHECK_DEPENDENT_DIRS_TYPES=
CHECK_DEPENDENT_DIRS_RESTRICTIONS=
### @usage CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
###
### Specify project transitive dependencies constraints.
###
### @params:
### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
### 5. GLOB: next directory constraint is an ANT glob pattern.
### 6. EXCEPT: next constraint is an exception for the rest of other rules.
###
### Directory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
###
### Note: Can be used multiple times on the same module all specified constraints will be checked.
### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
}
# tag:proto
PY_PROTOS_FOR=no
BUILD_PROTO_AS_EVLOG=no
# tag:proto
PROTO_NAMESPACE=
# tag:proto tag:python-specific
GEN_PY_PROTOS=$YMAKE_PYTHON ${input:"build/scripts/gen_py_protos.py"}
# tag:proto tag:cpp-specific
PROTO_HEADER_EXTS=.pb.h
CPP_PROTO_CMDLINE=
CPP_PROTO_OPTS=
CPP_PROTO_OUTS=
CPP_PROTO_OUTS_SEM=
CPP_PROTO_SUFFIXES=.pb.h .pb.cc
CPP_PROTO_PLUGINS=
# tag:proto tag:cpp-specific
CPP_EV_OPTS=--plugin=protoc-gen-event2cpp=${tool:"tools/event2cpp"} --event2cpp_out=$ARCADIA_BUILD_ROOT -I=$ARCADIA_ROOT/library/cpp/eventlog
CPP_EV_OUTS=
CPP_EV_OUTS_SEM=
# tag:proto tag:python-specific
PY_PROTO_OPTS=
PY_PROTO_OUTS=
PY_PROTO_OUTS_INTERNAL=
PY_PROTO_DEPS=
PY_PROTO_SUFFIXES=_pb2.py
PY_EVLOG_SUFFIXES=_ev_pb2.py
# tag:proto tag:java-specific
JAVA_PROTO_ARGS=
# tag:proto tag:python-specific
OPTIMIZE_PY_PROTOS_FLAG=no
macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
.SEM=resources ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${tool;hide:"tools/rescompiler/bin"}
}
# tag:built-in
### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # built-in
### Add data (resources, random files, strings) to the program)
### The common usage is to place Src file into binary. The Key is used to access it using library/cpp/resource or library/python/resource.
### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
###
### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
###
### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
###
### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
###
### @example:
###
### LIBRARY()
### OWNER(user1)
###
### RESOURCE(
### path/to/file1 /key/in/program/1
### path/to/file2 /key2
### )
### END()
###
macro RESOURCE(Args...) {
PEERDIR(library/cpp/resource)
}
# tag:internal
### @usage: _ORDER_ADDINCL([BUILD ...] [SOURCE ...] Args...) # internal
###
### Order and filter ADDINCLs (Args - is intentionally omitted in ADDINCL macro)
macro _ORDER_ADDINCL(BUILD[], SOURCE[], ARGS...) {
ADDINCL($BUILD $SOURCE)
}
# tag:proto
### @usage: PROTO_ADDINCL([GLOBAL] [WITH_GEN] Path)
###
### This macro introduces proper ADDINCLs for .proto-files found in sources and
### .cpp/.h generated files, supplying them to appropriate commands and allowing
### proper dependency resolution at configure-time.
###
### Note: you normally shouldn't use this macro. ADDINCLs should be sent to user
### from dependency via PROTO_NAMESPACE macro
macro PROTO_ADDINCL(GLOBAL?"GLOBAL":"", Path, WITH_GEN?"BUILD":"") {
_ORDER_ADDINCL($WITH_GEN $GLOBAL FOR proto ${ARCADIA_BUILD_ROOT}/$Path SOURCE $GLOBAL FOR proto ${ARCADIA_ROOT}/$Path)
ADDINCL($GLOBAL ${ARCADIA_BUILD_ROOT}/$Path)
}
# tag:proto
### @usage: PROTO_NAMESPACE([WITH_GEN] Namespace)
###
### Defines protobuf namespace (import/export path prefix) which should be used for imports and
### which defines output path for .proto generation.
###
### For proper importing and configure-time dependency management it sets ADDINCLs
### for both .cpp headers includes and .proto imports. If .proto expected to be used outside of the
### processing module use GLOBAL to send proper ADDINCLs to all (transitive) users. PEERDIR to
### PROTO_LIBRARY with PROTO_NAMESPACE() is enough at user side to correctly use the library.
### If generated .proto files are going to be used for building a module than use of WITH_GEN
### parameter will add appropriate dir from the build root for .proto files search.
macro PROTO_NAMESPACE(GLOBAL?"GLOBAL":"", WITH_GEN?"WITH_GEN":"", Namespace) {
SET(PROTO_NAMESPACE $Namespace)
PROTO_ADDINCL(GLOBAL $WITH_GEN $Namespace)
}
# tag:proto
### @usage PROTOC_FATAL_WARNINGS()
###
### Treat protoc warnings as fatal errors that break the build, for example, unused imports
### Adds `--fatal_warnings` argument to protoc
macro PROTOC_FATAL_WARNINGS() {
SET_APPEND(_PROTOC_FLAGS --fatal_warnings)
}
# tag:proto tag:internal tag:python-specific
### @usage: OPTIMIZE_PY_PROTOS() # internal
###
### Enable Python proto optimization by embedding corresponding C++ code into binary.
### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
### This is default mode for most PROTO_LIBRARY's and PY2_LIBRARY's, some system ones being exceptions.
macro OPTIMIZE_PY_PROTOS() {
SET(OPTIMIZE_PY_PROTOS_FLAG yes)
}
# tag:proto tag:python-specific
### @usage: NO_OPTIMIZE_PY_PROTOS()
###
### Disable Python proto optimization using embedding corresponding C++ code into binary.
### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
### This is default mode only for some system libraries.
macro NO_OPTIMIZE_PY_PROTOS() {
SET(OPTIMIZE_PY_PROTOS_FLAG no)
}
# tag:proto tag:python-specific
macro _PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
.CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/\$PROTO_NAMESPACE ${pre=--${Name}_opt=:OutParm}
.SEM=IGNORED
}
# tag:proto tag:python-specific
macro _ADD_PY_PROTO_OUT(Suf) {
SET_APPEND(PY_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$Suf:File})
SET_APPEND(PY_PROTO_OUTS_INTERNAL \${output;hide;noauto;norel;nopath;noext;suf=__int__$Suf:File} \${hide;kv:"ext_out_name_for_\${nopath;noext;suf=__int__$Suf:File} \${nopath;noext;suf=$Suf:File}"})
# XXX fix variable expansion in plugins
SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
}
# tag:proto tag:python-specific
### @usage: PY_PROTO_PLUGIN(Name Ext Tool DEPS <Dependencies>)
###
### Define protoc plugin for python with given Name that emits extra output with provided Extension
### using Tool. Extra dependencies are passed via DEPS
macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
_ADD_PY_PROTO_OUT($EXT)
# XXX fix variable expansion in plugins
SET(PY_PROTO_DEPS $PY_PROTO_DEPS $DEPS)
}
# tag:proto tag:python-specific
### @usage: PY_PROTO_PLUGIN2(Name Ext1 Ext2 Tool DEPS <Dependencies>)
###
### Define protoc plugin for python with given Name that emits 2 extra outputs with provided Extensions
### using Tool. Extra dependencies are passed via DEPS
macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
_ADD_PY_PROTO_OUT($EXT2)
}
# tag:proto tag:java-specific
macro _JAVA_PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
.CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/java_out
}
# tag:proto tag:java-specific
### @usage: JAVA_PROTO_PLUGIN(Name Tool DEPS <Dependencies>)
###
### Define protoc plugin for Java with given Name that emits extra outputs
### using Tool. Extra dependencies are passed via DEPS
macro JAVA_PROTO_PLUGIN(NAME, TOOL, DEPS[]) {
SET_APPEND(JAVA_PROTO_ARGS $_JAVA_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
# XXX fix variable expansion in plugins
SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS $DEPS)
}
macro _ADD_SEM_PROP_IF_NON_EMPTY(Prop, Args...) {
.SEM=${pre=&& set_target_property $Prop :Args}
}
# tag:proto tag:cpp-specific
macro _ADD_CPP_PROTO_OUT(Suf) {
.SEM=append_target_property PROTOC_EXTRA_OUTS $Suf ${output;hide;suf=.o:Suf} $_ADD_SEM_PROP_IF_NON_EMPTY(PROTO_NAMESPACE $PROTO_NAMESPACE)
SET_APPEND(CPP_PROTO_OUTS \${output;hide;norel;nopath;noext;suf=$Suf:File})
# XXX fix variable expansion in plugins
SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES $Suf)
}
# tag:proto tag:cpp-specific
HAS_CPP_PROTOBUF_PEERS=no
CPP_PROTOBUF_PEERS=
# tag:proto tag:cpp-specific
### @usage: CPP_PROTO_PLUGIN0(Name Tool DEPS <Dependencies>)
###
### Define protoc plugin for C++ with given Name that emits code into regular outputs
### using Tool. Extra dependencies are passed via DEPS.
macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) {
.SEM=target_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME}
SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
# XXX fix variable expansion in plugins
ENABLE(HAS_CPP_PROTOBUF_PEERS)
SET(CPP_PROTOBUF_PEERS $CPP_PROTOBUF_PEERS $DEPS)
}
# tag:proto tag:cpp-specific
### @usage: CPP_PROTO_PLUGIN(Name Tool Suf DEPS <Dependencies>)
###
### Define protoc plugin for C++ with given Name that emits code into 1 extra output
### using Tool. Extra dependencies are passed via DEPS.
macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[]) {
CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS)
_ADD_CPP_PROTO_OUT($SUF)
}
# tag:proto tag:cpp-specific
### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 DEPS <Dependencies>)
###
### Define protoc plugin for C++ with given Name that emits code into 2 extra outputs
### using Tool. Extra dependencies are passed via DEPS.
macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[]) {
CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS)
_ADD_CPP_PROTO_OUT($SUF2)
SET_APPEND(CPP_PROTO_OUTS_SEM \${output;hide;norel;nopath;noext;suf=$SUF2:File})
}
# tag:proto
### @usage: USE_SKIFF() #wip, do not use
###
### Use mapreduce/yt/skiff_proto/plugin for C++
macro USE_SKIFF() {
# Move extra includes to INDUCED_DEPS macro in mapreduce/yt/skiff_proto/plugin/ya.make
CPP_PROTO_PLUGIN0(skiff mapreduce/yt/skiff_proto/plugin DEPS mapreduce/yt/skiff_proto/lib)
}
# tag:go-specific
_GO_COMMON_GOOGLE_APIS = \
vendor/google.golang.org/genproto/googleapis/api/annotations \
vendor/google.golang.org/genproto/googleapis/api/configchange \
vendor/google.golang.org/genproto/googleapis/api/distribution \
vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1 \
vendor/google.golang.org/genproto/googleapis/api/expr/v1beta1 \
vendor/google.golang.org/genproto/googleapis/api/httpbody \
vendor/google.golang.org/genproto/googleapis/api/label \
vendor/google.golang.org/genproto/googleapis/api/metric \
vendor/google.golang.org/genproto/googleapis/api/monitoredres \
vendor/google.golang.org/genproto/googleapis/api/serviceconfig \
vendor/google.golang.org/genproto/googleapis/api/servicecontrol/v1 \
vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1 \
vendor/google.golang.org/genproto/googleapis/iam/admin/v1 \
vendor/google.golang.org/genproto/googleapis/iam/credentials/v1 \
vendor/google.golang.org/genproto/googleapis/iam/v1 \
vendor/google.golang.org/genproto/googleapis/iam/v1/logging \
vendor/google.golang.org/genproto/googleapis/logging/type \
vendor/google.golang.org/genproto/googleapis/logging/v2 \
vendor/google.golang.org/genproto/googleapis/rpc/code \
vendor/google.golang.org/genproto/googleapis/rpc/errdetails \
vendor/google.golang.org/genproto/googleapis/rpc/status \
vendor/google.golang.org/genproto/googleapis/type/calendarperiod \
vendor/google.golang.org/genproto/googleapis/type/color \
vendor/google.golang.org/genproto/googleapis/type/date \
vendor/google.golang.org/genproto/googleapis/type/dayofweek \
vendor/google.golang.org/genproto/googleapis/type/expr \
vendor/google.golang.org/genproto/googleapis/type/fraction \
vendor/google.golang.org/genproto/googleapis/type/latlng \
vendor/google.golang.org/genproto/googleapis/type/money \
vendor/google.golang.org/genproto/googleapis/type/postaladdress \
vendor/google.golang.org/genproto/googleapis/type/quaternion \
vendor/google.golang.org/genproto/googleapis/type/timeofday
# tag:go-specific
_COMMON_GOOGLE_APIS=None
# tag:go-specific
### @usage: USE_COMMON_GOOGLE_APIS([apis...])
###
### Use common-google-apis library set. Pass optional apis list to be used or use them all.
### This macro is properly handled for all languages including Go, where apis come in
## pregenerated form. In other languages apis are generated from sources in Arcadia.
macro USE_COMMON_GOOGLE_APIS(APIS...) {
SET(_COMMON_GOOGLE_APIS ${pre=vendor/google.golang.org/genproto/googleapis/:APIS})
}
# tag:go-specific tag:proto
GO_PROTO_GEN_PLUGINS=
GO_PROTO_OPTS=
GO_PROTO_OUTS=
GO_PROTO_GRPC_OPTS=
GO_PROTO_GRPC_OUTS=
GO_PROTO_V2=no
_GO_PROTO_CHECK_OUTPUT=
# tag:go-specific tag:proto
GO_PROTOBUF_IMPORTS=\
${GOSTD}/sync \
${GOSTD}/reflect \
${GOSTD}/fmt \
${GOSTD}/math \
vendor/github.com/golang/protobuf/proto \
vendor/google.golang.org/protobuf/types/descriptorpb \
vendor/google.golang.org/protobuf/runtime/protoimpl \
vendor/google.golang.org/protobuf/runtime/protoiface \
vendor/google.golang.org/protobuf/reflect/protoreflect
# tag:go-specific tag:proto
GO_PROTOBUF_WELLKNOWN_TYPES=\
vendor/google.golang.org/protobuf/types/known/anypb \
vendor/google.golang.org/protobuf/types/known/apipb \
vendor/google.golang.org/protobuf/types/known/durationpb \
vendor/google.golang.org/protobuf/types/known/emptypb \
vendor/google.golang.org/protobuf/types/known/fieldmaskpb \
vendor/google.golang.org/protobuf/types/known/sourcecontextpb \
vendor/google.golang.org/protobuf/types/known/structpb \
vendor/google.golang.org/protobuf/types/known/timestamppb \
vendor/google.golang.org/protobuf/types/known/typepb \
vendor/google.golang.org/protobuf/types/known/wrapperspb
# tag:go-specific tag:proto
### @usage: GO_PROTO_PLUGIN(Name Ext Tool [DEPS dependencies...])
###
### Define protoc plugin for GO with given Name that emits extra output with provided extension
### Ext using Tool. Extra dependencies are passed via DEPS.
macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
SET_APPEND(GO_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$EXT:File})
PEERDIR(${DEPS})
}
# tag:go-specific tag:proto
GO_PROTO_CMDLINE=${cwd;rootdir;input:File} $YMAKE_PYTHON3 ${input:"build/scripts/go_proto_wrapper.py"} --arcadia-prefix $GO_ARCADIA_PROJECT_PREFIX --contrib-prefix $GO_CONTRIB_PROJECT_PREFIX --namespace ./$PROTO_NAMESPACE $_GO_PROTO_CHECK_OUTPUT --proto ${input;rootrel:File} -- $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH $_PROTOC_FLAGS
# tag:go-specific tag:proto
macro _GO_PROTO_CMD_IMPL(File, OPTS...) {
.CMD=$GO_PROTO_CMDLINE $OPTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
.PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES}
.ADDINCL=FOR proto contrib/libs/protobuf/src
}
# tag:go-specific tag:proto
macro _GO_PROTO_CMD(File) {
.CMD=$_GO_PROTO_CMD_IMPL($File $GO_PROTO_OPTS $GO_PROTO_OUTS)
}
# tag:proto
### @usage: YP_PROTO_YSON(Files... OUT_OPTS Opts...)
###
### Generate .yson.go from .proto using yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen
macro YP_PROTO_YSON(OUT_OPTS[], Files...) {
.CMD=${cwd:BINDIR} $PROTOC --plugin=protoc-gen-custom=${tool:"yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen"} -I=${ARCADIA_ROOT}/${PROTO_NAMESPACE} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} --custom_out="$OUT_OPTS paths=base_name:." --custom_opt="goroot=${GO_TOOLS_ROOT}" $_PROTOC_FLAGS ${input:Files} ${output;hide;noauto;nopath;noext;suf=.yson.go:Files}
.ADDINCL=FOR proto ${ARCADIA_ROOT}/${MODDIR} FOR proto ${ARCADIA_ROOT}/${GO_TEST_IMPORT_PATH} FOR proto yt ${ARCADIA_BUILD_ROOT}/yt FOR proto contrib/libs/protobuf/src
.PEERDIR=$GOSTD/strings $GOSTD/fmt $GOSTD/errors $GOSTD/encoding/json library/go/core/xerrors yt/go/yson yt/go/yterrors yp/go/yson/ytypes contrib/libs/protobuf
}
_SEM_CPP_PROTO_CMD=target_proto_messages PRIVATE ${input:File} $CPP_PROTO_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
&& set_global_flags COMMON_PROTOC_FLAGS \
&& target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
&& target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH
# tag:proto
macro _CPP_PROTO_CMD(File) {
.CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
.SEM=$_SEM_CPP_PROTO_CMD
.PEERDIR=contrib/libs/protobuf
}
# tag:proto
macro _CPP_VANILLA_PROTO_CMD(File) {
.CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
.PEERDIR=contrib/libs/protobuf_std
}
_SEM_CPP_EV_CMD=target_ev_messages PRIVATE ${input:File} $CPP_EV_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"tools/event2cpp/bin"} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
&& set_global_flags COMMON_PROTOC_FLAGS \
&& target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT --event2cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE \
&& target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH $ARCADIA_ROOT/library/cpp/eventlog
# tag:proto
macro _CPP_EVLOG_CMD(File) {
.CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_EV_OUTS ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
.SEM=$_SEM_CPP_EV_CMD
.PEERDIR=library/cpp/eventlog contrib/libs/protobuf
}
# tag:proto
macro _CPP_PROTO_EVLOG_CMD(File) {
# process .proto as .ev
.CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
.PEERDIR=library/cpp/eventlog contrib/libs/protobuf
}
# tag:proto
macro _CPP_CFGPROTO_CMD(File) {
# keep extension in output just as in EV: this is hard-coded behaviour of protoc for non-.proto extensions
.CMD=$CPP_PROTO_CMDLINE --plugin=protoc-gen-config=${tool:"library/cpp/proto_config/plugin"} --config_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $CPP_EV_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
.PEERDIR=library/cpp/proto_config/codegen library/cpp/proto_config/protos contrib/libs/protobuf
}
# tag:proto
PY_PROTO_MYPY_ENABLED=yes
PY_PROTO_MYPY_PLUGIN_BASE=--plugin=protoc-gen-mypy=${tool:"contrib/python/mypy-protobuf/bin/protoc-gen-mypy"} --mypy_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
# tag:proto tag:python-specific
PY_PROTO_MYPY_SUFFIX=
PY_PROTO_MYPY_PLUGIN=
PY_PROTO_MYPY_PLUGIN_INTERNAL=
# tag:proto tag:python-specific
macro NO_MYPY() {
DISABLE(PY_PROTO_MYPY_ENABLED)
}
# tag:proto tag:python-specific
macro _PY_PROTO_CMD_BASE(File, Suf, Args...) {
.CMD=$PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --python_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $_PROTOC_FLAGS ${input;rootrel:File} ${output;hide;noauto;norel;nopath;noext;suf=$Suf:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $Args
}
# tag:proto tag:python-specific
macro _PY_PROTO_CMD(File) {
.CMD=${cwd;rootdir;input:File} $_PY_PROTO_CMD_BASE($File _pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS $PY_PROTO_MYPY_PLUGIN)
}
# tag:proto tag:python-specific
macro _PY_PROTO_CMD_INTERNAL(File) {
.CMD=${cwd;rootdir;input:File} $GEN_PY_PROTOS --suffixes $PY_PROTO_SUFFIXES $PY_PROTO_MYPY_SUFFIX -- $_PY_PROTO_CMD_BASE($File __int___pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS_INTERNAL ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___pb2.py:File} ${nopath;noext;suf=_pb2.py:File}"} $PY_PROTO_MYPY_PLUGIN_INTERNAL)
}
# tag:proto tag:java-specific
JAVA_PROTO_RUNTIME=
# tag:proto tag:java-specific
### @usage: USE_JAVALITE()
### Use protobuf-javalite for Java
macro USE_JAVALITE() {
SET(JAVA_PROTO_RUNTIME javalite)
}
# tag:proto tag:java-specific
JAVA_PROTO_RUNTIME_VERSION = 3.21.12
JAVA_PROTO_COMMON_VERSION = 1.12.0
KOTLIN_PROTO=no
KOTLIN_PROTO_PEERS=
when ($JAVA_PROTO_RUNTIME == "javalite") {
_JAVA_PROTO_LITE_ARG=lite:
JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.43.2
JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.43.2
}
otherwise {
_JAVA_PROTO_LITE_ARG=
JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.43.2
JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.43.2
}
KOTLIN_PROTO_FLAGS=
# tag:proto tag:java-specific
macro _JAVA_PROTO_CMD(File) {
.CMD=${cwd;rootdir;input:File} $YMAKE_PYTHON ${input:"build/scripts/tared_protoc.py"} --tar-output ${output;norel;nopath;noext;suf=.jsrc:File} --protoc-out-dir $ARCADIA_BUILD_ROOT/java_out $PROTOC -I=./$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_ROOT --java_out=${_JAVA_PROTO_LITE_ARG}$ARCADIA_BUILD_ROOT/java_out ${KOTLIN_PROTO_FLAGS} $_PROTOC_FLAGS ${input;rootrel:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $JAVA_PROTO_ARGS
.SEM=proto_files ${input;rootrel:File} ${hide;output:File.jsrc}
}
# tag:proto tag:perl-specific tag:deprecated
### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
###
### Generate Perl code from protobuf.
### In order to use this macro one should predict all outputs protoc will emit from input_proto file and enlist those as outputs.
macro XS_PROTO(File, Dir, Outputs...) {
.CMD=$PROTOC -I=${ARCADIA_ROOT}/${Dir} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} -I=${PROTOBUF_PATH} --perlxs_out=${BINDIR} $_PROTOC_FLAGS ${input:File} ${hide;output:Outputs} ${induced_deps=h+cpp;hide;nopath;noext;suf=.pb.h:File}
PEERDIR(${Dir})
ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir})
}
# tag:proto tag:fbs
### @usage: PROTO2FBS(InputProto)
###
### Produce flatbuf schema out of protobuf description.
macro PROTO2FBS(File) {
.CMD=${cwd:BINDIR} ${tool:"contrib/tools/flatc"} -I . -I ${ARCADIA_ROOT} --proto ${input:File} ${output;hide;norel;noext:File.fbs} ${kv;hide:"p FBS"} ${kv;hide:"pc yellow"} && $MOVE_FILE ${BINDIR}/${nopath;noext:File.fbs} ${output;norel;noext:File.fbs}
}
# tag:proto tag:python-specific
when ($PY_PROTOS_FOR == "yes") {
PEERDIR+=contrib/libs/protobuf/python
}
# tag:python-specific
macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
.CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
.PEERDIR=library/cpp/eventlog/proto
}
# tag:python-specific tag:proto
macro _PY_EVLOG_CMD(File) {
.CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
}
# tag:python-specific tag:proto
macro _PY_EVLOG_CMD_INTERNAL(File) {
.CMD=${cwd;rootdir;input:File} $GEN_PY_PROTOS --suffixes $PY_EVLOG_SUFFIXES -- $_PY_EVLOG_CMD_BASE($File __int___ev_pb2.py ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___ev_pb2.py:File} ${nopath;noext;suf=_ev_pb2.py:File}"})
}
# tag:java-specific tag:proto
macro _JAVA_EVLOG_CMD(File) {
.CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
.PEERDIR=library/cpp/eventlog/proto
}
# tag:sanitize
RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
# tag:sanitize
when ($IS_CROSS_SANITIZE) {
RUN_NO_SANITIZE=
}
YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
WRITER_PY=$YMAKE_PYTHON ${input:"build/scripts/writer.py"} ${input;hide:"build/scripts/process_command_files.py"}
FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} ${input;hide:"build/scripts/process_command_files.py"}
FIX_MSVC_OUTPUT=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ${input;hide:"build/scripts/process_command_files.py"}
_PROCESS_WHOLE_ARCHIVE_SCRIPT=${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/process_whole_archive_option.py"}
COPY_CMD=$FS_TOOLS copy
LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
REMOVE_FILE=$FS_TOOLS remove
MOVE_FILE=$FS_TOOLS rename
# tag:allocator tag:windows-specific
MSVC_DYNAMICBASE=/DYNAMICBASE
when ($ALLOCATOR == "LF") {
MSVC_DYNAMICBASE=/DYNAMICBASE:NO
}
# tag:sanitize
SANITIZE_HEADERS=yes
SANITIZER_CFLAGS=
# tag:proto tag:grpc
_GRPC_ENABLED=no
# tag:proto tag:grpc
### @usage: GRPC()
###
### Emit GRPC code for all .proto files in a PROTO_LIBRARY.
### This works for all available PROTO_LIBRARY versions (C++, Python 2.x, Python 3.x, Java and Go).
macro GRPC() {
ENABLE(_GRPC_ENABLED)
# C++
CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp .grpc.pb.cc .grpc.pb.h DEPS contrib/libs/grpc)
# Python
PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/python/grpcio)
# Java
JAVA_PROTO_PLUGIN(grpc_java contrib/tools/protoc/plugins/grpc_java DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
SET_APPEND(JAVA_PROTOBUF_PEERS contrib/java/javax/annotation/javax.annotation-api/1.3.1)
}
macro GO_PROTO_USE_V2() {
ENABLE(GO_PROTO_V2)
}
# tag:fbs
FLATC_FLAGS_VALUE=
### @usage: FLATC_FLAGS(flags...)
###
### Add flags to flatc command line
macro FLATC_FLAGS(FLAGS...) {
SET_APPEND(FLATC_FLAGS_VALUE $FLAGS)
}
# tag:fbs
_PY_FBS_DEPS=contrib/python/flatbuffers
# tag:fbs tag:internal
### @usage: FBS_TO_PYSRC(output_base_name fbs_files...) # internal
###
### Create a tar archive of .py files generated by flatc for Python. Output tar
### archive will have .fbs.pysrc extension. This .fbs.pysrc extension is specially
### processed when --add-flatbuf-result flag is specified on the command line
### for 'ya make ...' (tar archive is extracted to output directory).
macro FBS_TO_PYSRC(OUT_NAME, IN_FBS_FILES...) {
.CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --python --gen-mutable ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR} ${input:IN_FBS_FILES} && $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --exts .py --input $BINDIR --output ${output;noauto;tared:OUT_NAME.fbs.pysrc} ${kv;hide:"p FP"} ${kv;hide:"pc light-green"} ${kv;hide:"tared_kind nodir"}
}
# tag:fbs tag:go-specific
# Implicit dependencies of generated code for Go
_GO_FLATC_IMPORTS=\
${GOSTD}/strconv \
vendor/github.com/google/flatbuffers/go
# tag:fbs tag:cpp-specific
macro _CPP_FLATC_CMD(SRC, SRCFLAGS...) {
.CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${input:"build/scripts/cpp_flatc_wrapper.py"} ${tool:"contrib/tools/flatc"} --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --yandex-maps-iter --gen-object-api --filename-suffix .fbs ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${output;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${input:SRC} ${output;hide;noext;norel:SRC.iter.fbs.h} ${output;noauto;hide;noext;norel:SRC.bfbs} ${kv;hide:"p FL"} ${kv;hide:"pc light-green"}
.SEM=target_fbs_source PRIVATE ${input:SRC} ${pre=-I :_FLATC__INCLUDE} ${output;hide;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${output;hide;noext;norel:SRC.iter.fbs.h} ${output;noauto;hide;noext;norel:SRC.bfbs} ${hide;tool:"contrib/tools/flatc/bin"} && set_global_flags FBS_CPP_FLAGS --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --yandex-maps-iter --gen-object-api --filename-suffix .fbs ${FLATC_FLAGS_VALUE} ${input;hide:"build/scripts/cpp_flatc_wrapper.py"}
.PEERDIR=contrib/libs/flatbuffers
}
# tag:fbs tag:cpp-specific
macro _CPP_FLATC64_CMD(SRC, SRCFLAGS...) {
.CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${input:"build/scripts/cpp_flatc_wrapper.py"} ${tool:"contrib/tools/flatc64"} --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --filename-suffix .fbs64 ${FLATC_FLAGS_VALUE} -I ${ARCADIA_ROOT} -I ${ARCADIA_BUILD_ROOT} -o ${output;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${input:SRC} ${output;noauto;hide;noext;norel:SRC.bfbs64} ${kv;hide:"p FL64"} ${kv;hide:"pc light-green"}
.PEERDIR=contrib/libs/flatbuffers64
}
# tag:fbs tag:go-specific tag:internal
### @usage: _GO_FLATC_CMD(fbs_file flags...) # internal
###
### Create a tar archive of .go files generated by flatc for Go. Output tar archive
### will have .fbs.gosrc extension. This .fbs.gosrc is specially processed when
### --add-protobuf-result flag is specified on the command line for 'ya make ...'
### (tar archive is extracted to output directory).
macro _GO_FLATC_CMD(SRC, PACKAGE_NAME) {
.CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --go --gen-mutable --go-namespace ${PACKAGE_NAME} ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR}/_generated ${input:SRC} && $YMAKE_PYTHON3 ${input:"build/scripts/postprocess_go_fbs.py"} --input-dir ${BINDIR} --map $_FBS_NAMESPACE_MAP_GLOBAL && $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --flat --input ${BINDIR}/_generated --output ${output;noext;tared:SRC.fbs.gosrc} --exts .go ${kv;hide:"p FG"} ${kv;hide:"pc light-green"} ${kv;hide:"tared_kind nodir"}
.PEERDIR=${_GO_FLATC_IMPORTS}
}
# tag:fbs tag:java-specific tag:internal
### @usage: _JAVA_FLATC_CMD(fbs_file) # internal
###
### Create a tar archive of .java files generated by flatc for Java. Output tar
### acrchive will have .fbs.jsrc extension. Files with .fbs.jsrc extension will
### be added to results when --add-flatbuf-result flag is specified on the command
### line for 'ya make ...'
macro _JAVA_FLATC_CMD(SRC) {
.CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --java --gen-mutable ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR} ${input:SRC} && $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --input $BINDIR --output ${output;nopath;noext:SRC.fbs.jsrc} --exts .java ${kv;hide:"p FJ"} ${kv;hide:"pc light-green"}
.PEERDIR=contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION}
}
# variables must be defined for all module types to make generate_mf.py work
MODULE_PREFIX=
MODULE_SUFFIX=
NEED_PLATFORM_PEERDIRS=yes
PEERDIR_TEST_TOOL=yes
# tag:python-specific
PYTHON2=no
PYTHON3=no
# tag:python-specific
when (!$ARCADIA_PYTHON_UNICODE_SIZE) {
when ($OS_WINDOWS) {
ARCADIA_PYTHON_UNICODE_SIZE=2
}
otherwise {
ARCADIA_PYTHON_UNICODE_SIZE=4
}
}
YMAKE_PYTHON3_PEERDIR=build/platform/python/ymake_python3
macro NO_YMAKE_PYTHON3() {
SET(YMAKE_PYTHON3_PEERDIR)
}
### @usage: _BARE_UNIT # internal
###
### The base of all modules describing default bare minimum for all modules.
### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
module _BARE_UNIT {
.EXTS=.*
.CMD=TOUCH_UNIT
.IGNORED=GO_PROTO_PLUGIN
.NODE_TYPE=Bundle
.PEERDIR_POLICY=as_include
.RESTRICTED=GRPC USE_SKIFF INDUCED_DEPS FUZZ_DICTS FUZZ_OPTS PACK EXPLICIT_OUTPUTS DOCS_DIR DOCS_CONFIG DOCS_VARS YT_SPEC USE_CXX USE_UTIL WHOLE_ARCHIVE PRIMARY_OUTPUT SECONDARY_OUTPUT DEPENDENCY_MANAGEMENT EXCLUDE NO_DOCTESTS EMBED_JAVA_VCS_INFO RESOURCE_FILES PACK_GLOBALS_IN_LIBRARY _EXPOSE GLOBAL_DEPS LIST_PROTO
.FINAL_TARGET=no
PEERDIR_TAGS=__EMPTY__
PEERDIR+=$YMAKE_PYTHON3_PEERDIR
when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
PEERDIR+=build/conf_fatal_error
}
DEFAULT(MODULE_VERSION)
DEFAULT(MODULE_PREFIX)
DEFAULT(MODULE_SUFFIX)
}
### @usage: GEN_LIBRARY()
###
### Definition of a module that brings generated artefacts. This module can PEERDIRed
### from any module. The resulted module is empty and cleaned up during construction
### of the build graph.
###
### NOTE! SRCS macro is not supported for this library.
module GEN_LIBRARY: _BARE_UNIT {
.PROXY=yes
.RESTRICTED=SRCS SRC
.SEM=IGNORED
# ENABLE(_FAKE_MODULE)
SET(MODULE_SUFFIX .pkg.fake)
}
### @usage: _BASE_UNIT # internal
###
### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
module _BASE_UNIT: _BARE_UNIT {
.GLOBAL=_FBS_NAMESPACE_MAP
PEERDIR_TAGS=CPP_PROTO CPP_FBS H_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB
CPP_PROTO_CMDLINE=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --cpp_out=${CPP_PROTO_PLUGINS}$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $_PROTOC_FLAGS $PROTOC_STYLEGUIDE_OUT $PROTOC_PLUGIN_STYLEGUIDE ${input;rootrel:File}
CPP_PROTO_OUTS+=${output;hide;norel;nopath;noext:File.pb.cc} ${output;main;hide;norel;nopath;noext:File.pb.h}
CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
CPP_EV_OUTS+=${output;hide;norel:File.pb.cc} ${output;hide;norel:File.pb.h}
CPP_EV_OUTS_SEM+=${output;hide;norel:File.pb.h}
when ($SWIG_LANG == "perl") {
_SWIG_CMD=$_SWIG_PERL_CMD
_SWIG_ADDINCLS=$_SWIG_PERL_ADDINCLS
_SWIG_PEERDIR=$_SWIG_PERL_PEERDIR
}
elsewhen ($SWIG_LANG == "python") {
_SWIG_CMD=$_SWIG_PYTHON_CMD
_SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
_SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
}
elsewhen ($SWIG_LANG == "jni_cpp") {
_SWIG_CMD=$_SWIG_JNI_CPP_CMD
_SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
_SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
}
elsewhen ($SWIG_LANG == "java") {
_SWIG_CMD=$_SWIG_JNI_CMD
_SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
_SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
}
when ($PY_PROTOS_FOR == "yes") {
MACRO_ALIAS(EVLOG_CMD _PY_EVLOG_CMD)
MACRO_ALIAS(PROTO_CMD _PY_PROTO_CMD)
}
otherwise {
MACRO_ALIAS(EVLOG_CMD _CPP_EVLOG_CMD)
MACRO_ALIAS(FBS_CMD _CPP_FLATC_CMD)
when ($BUILD_PROTO_AS_EVLOG == "yes") {
MACRO_ALIAS(PROTO_CMD _CPP_PROTO_EVLOG_CMD)
}
otherwise {
MACRO_ALIAS(PROTO_CMD _CPP_PROTO_CMD)
}
when ($USE_VANILLA_PROTOC == "yes") {
PROTOC=${tool:"contrib/tools/protoc_std"}
PROTOC_STYLEGUIDE_OUT=
PROTOC_PLUGIN_STYLEGUIDE=
PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std
MACRO_ALIAS(PROTO_CMD _CPP_VANILLA_PROTO_CMD)
}
when ($PROTOC_TRANSITIVE_HEADERS == "no") {
CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
}
}
SANITIZER_DEFINED=no
when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
LDFLAGS+=-fsanitize=$SANITIZER_TYPE
SANITIZER_DEFINED=yes
when ($CLANG) {
CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
}
}
when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
}
POPULATE_CPP_COVERAGE_FLAGS()
when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
CFLAGS+=-DNLG_COVERAGE
}
when ($GCC) {
select ($SANITIZER_TYPE) {
"address" ? {
LDFLAGS+=-static-libasan
}
"undefined" ? {
LDFLAGS+=-static-libubsan
}
"thread" ? {
PIE=yes
LDFLAGS+=-static-libtsan
}
}
}
when ($HARDENING == "yes") {
when ($CLANG) {
CFLAGS+=-fstack-protector-all -D_hardening_enabled_
LDFLAGS+=-z relro -z now -z noexecstack
PIE=yes
}
}
when ($USE_LTO == "yes") {
when ($GCC) {
CFLAGS+=-flto -fno-fat-lto-objects
LDFLAGS+=-flto
NO_LTO_CFLAGS=-fno-lto
}
when ($CLANG) {
CFLAGS+=-flto
LDFLAGS+=-flto
NO_LTO_CFLAGS=-fno-lto
}
}
when ($USE_THINLTO == "yes") {
when ($GCC) {
CFLAGS+=-flto=thin
LDFLAGS+=-flto=thin
NO_LTO_CFLAGS=-fno-lto
}
when ($CLANG) {
CFLAGS+=-flto=thin
LDFLAGS+=-flto=thin
NO_LTO_CFLAGS=-fno-lto
}
}
when ($CLANG) {
when ($PGO_ADD == "yes") {
CFLAGS+=-fprofile-instr-generate
LDFLAGS+=-fprofile-instr-generate
}
when ($PGO_PATH) {
CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
LDFLAGS+=-fprofile-instr-use=$PGO_PATH
}
}
when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
PEERDIR+=$COMPILER_PLATFORM
}
when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
PEERDIR+=contrib/libs/linux-headers
}
# Adding PEERDIR from trigger doesn't always work. In this case it
# cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl
# Workaround this issue by setting variable with PEERDIR in trigger
# and then adding PEERDIR to it's value unconditionally.
when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
_UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14
}
otherwise {
_UBUNTU_COMPAT_PEERDIR=
}
PEERDIR+=$_UBUNTU_COMPAT_PEERDIR
when ($NORUNTIME != "yes") {
PEERDIR+=contrib/libs/cxxsupp
when ($MAPSMOBI_BUILD_TARGET == "yes") {
PEERDIR+=build/platform/mapkit
}
}
when ($NOUTIL != "yes") {
PEERDIR+=util
}
when ($MUSL == "yes") {
CFLAGS += -D_musl_
LINK_DYN_LIB_FLAGS += --musl
LINK_SCRIPT_EXE_FLAGS += --musl
PEERDIR+=contrib/libs/musl/include
}
# g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
# The same problem exists for clang toolchain. On the other hand, the problem
# doesn't affect cl since it has united C/C++ library and doesn't need
# proxy C-headers.
# Disable all C++ headers including proxy C-headers when we use libc++.
when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
CXXFLAGS += -nostdinc++
}
otherwise {
CFLAGS += -DUSE_STL_SYSTEM
}
when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
PEERDIR += build/external_resources/codenavigation
}
when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
}
DEFAULT(USE_SSE4 yes)
when ($NOSSE != "yes") {
CFLAGS+=$SSE_CFLAGS
C_DEFINES+=$SSE_DEFINES
when ($USE_SSE4 == "yes") {
CFLAGS+=$SSE4_CFLAGS
C_DEFINES+=$SSE4_DEFINES
}
}
elsewhen ($MSVC != "yes") {
CFLAGS += -mno-sse
}
POPULATE_CPP_COVERAGE_FLAGS()
_REGISTER_NO_CHECK_IMPORTS()
DEFAULT(PACKAGE_PREFIX_ARGS)
DEFAULT(SWIG_LANG python)
DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
PEERDIR+=build/platform/binutils
}
}
_LINKER_ID=
# GCC does not support -fuse-ld with an executable path,
# only -fuse-ld=gold or -fuse-ld=lld.
when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
when ($_LINKER_ID in [ "gold", "lld" ]) {
PEERDIR+=build/platform/${_LINKER_ID}
}
}
macro _USE_LINKER_IMPL(LINKER_ID...) {
SET(_LINKER_ID $LINKER_ID)
}
macro _USE_LINKER() {
_USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
}
### @usage: USE_LINKER_GOLD()
### Use gold linker for a program. This doesn't work in libraries
macro USE_LINKER_GOLD() {
_USE_LINKER_IMPL(gold)
}
COMMON_LINK_SETTINGS=
LINK_ADDITIONAL_SECTIONS=
LINK_ADDITIONAL_SECTIONS_COMMAND=
when ($COMMON_LINK_SETTINGS == "yes") {
when ($_LINKER_ID == "lld" && ($OS_LINUX == "yes" || $OS_ANDROID == "yes")) {
LDFLAGS += -Wl,--gdb-index
}
when ($EMBED_LINKER_CREF == "yes") {
LDFLAGS+=-Wl,--cref ${tmp;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
}
elsewhen ($DUMP_LINKER_CREF == "yes") {
LDFLAGS+=-Wl,--cref ${output;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
}
when ($EMBED_LINKER_MAP == "yes") {
LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
}
elsewhen ($DUMP_LINKER_MAP == "yes") {
LDFLAGS+=-Wl,-Map=${output;rootrel;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
}
when ($USE_MKL == "yes") {
NOPLATFORM=yes
}
when (($USE_EAT_MY_DATA == "yes") && ($WIN32 != "yes") && ($DARWIN != "yes") && ($OS_ANDROID != "yes") && ($OS_IOS != "yes")) {
PEERDIR+=contrib/libs/libeatmydata/autocheck_wrapper
}
when ($USE_ARCADIA_LIBM == "yes") {
PEERDIR+=contrib/libs/libm
}
when ($USE_ARCADIA_LIBM == "no") {
C_SYSTEM_LIBRARIES+=-lm
}
when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
when ($ALLOCATOR in [ "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "J", "LF", "LF_YT", "LF_DBG", "B", "BM", "C", "LOCKLESS", "YT", "MIM", "HU", "PROFILED_HU" ]) {
PEERDIR+=library/cpp/malloc/system
}
}
otherwise {
select ($ALLOCATOR) {
"MIM" ? {
PEERDIR+=library/cpp/malloc/mimalloc
}
"HU" ? {
PEERDIR+=library/cpp/malloc/hu
}
"PROFILED_HU" ? {
PEERDIR+=library/cpp/malloc/profiled_hu
}
"TCMALLOC_256K" ? {
PEERDIR+=library/cpp/malloc/tcmalloc
PEERDIR+=contrib/libs/tcmalloc
}
"TCMALLOC_SMALL_BUT_SLOW" ? {
PEERDIR+=library/cpp/malloc/tcmalloc
PEERDIR+=contrib/libs/tcmalloc/small_but_slow
}
"TCMALLOC_NUMA_256K" ? {
PEERDIR+=library/cpp/malloc/tcmalloc
PEERDIR+=contrib/libs/tcmalloc/numa_256k
}
"TCMALLOC_NUMA_LARGE_PAGES" ? {
PEERDIR+=library/cpp/malloc/tcmalloc
PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
}
"TCMALLOC" ? {
PEERDIR+=library/cpp/malloc/tcmalloc
PEERDIR+=contrib/libs/tcmalloc/default
}
"TCMALLOC_TC" ? {
PEERDIR+=library/cpp/malloc/tcmalloc
PEERDIR+=contrib/libs/tcmalloc/no_percpu_cache
}
"GOOGLE" ? {
PEERDIR+=library/cpp/malloc/galloc
}
"J" ? {
when ($WIN32 == "yes") {
PEERDIR+=library/cpp/malloc/system
}
otherwise {
PEERDIR+=library/cpp/malloc/jemalloc
}
}
"LF" ? {
PEERDIR+=library/cpp/lfalloc
}
"LF_YT" ? {
PEERDIR+=library/cpp/lfalloc/yt
}
"LF_DBG" ? {
PEERDIR+=library/cpp/lfalloc/dbg
}
"B" ? {
PEERDIR+=library/cpp/balloc
}
"BM" ? {
PEERDIR+=library/cpp/balloc_market
}
"C" ? {
PEERDIR+=library/cpp/malloc/calloc
}
"LOCKLESS" ? {
PEERDIR+=library/cpp/malloc/lockless
}
"YT" ? {
PEERDIR+=library/cpp/ytalloc/impl
}
}
}
when ($ALLOCATOR == "SYSTEM") {
PEERDIR+=library/cpp/malloc/system
}
when ($WERROR != "no") {
when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
C_WARNING_OPTS += $WERROR_FLAG
}
}
when ($ICC == "yes") {
PEERDIR+=contrib/libs/intel/core
}
when ($WITH_VALGRIND == "yes") {
PEERDIR+=contrib/libs/valgrind
# https://st.yandex-team.ru/DTCC-122
CFLAGS+=-fdebug-default-version=4
}
}
when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
LINK_ADDITIONAL_SECTIONS_COMMAND+= \
$OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
}
_SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/:PEERS}
when ($OS_WINDOWS == "yes") {
_SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/:PEERS}
}
elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
_SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/:PEERS}
}
LINK_OR_COPY_SO_CMD=
RPATH_GLOBAL=
when ($SO_OUTPUTS == "yes") {
LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
LDFLAGS+=$RPATH_GLOBAL
}
# tag:restricted tag:DLL
### $usage: WITH_DYNAMIC_LIBS() # restricted
###
### Include dynamic libraries as extra PROGRAM/DLL outputs
macro WITH_DYNAMIC_LIBS() {
ENABLE(SO_OUTPUTS)
}
# tag:internal
### $usage: REAL_LINK_EXE_IMPL(peers...) # internal
macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
.CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
}
# tag:internal
### $usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
.CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
}
# tag:internal
### $usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
.CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
}
# tag:internal
### $usage: LINK_EXE_IMPL(peers...) # internal
macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
.CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
}
# tag:internal
### $usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
.CMD=$LINK_EXEC_DYN_LIB_CMDLINE
}
# tag:internal
### @usage: _LINK_UNIT # internal
###
### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
module _LINK_UNIT: _BASE_UNIT {
.EXTS=.o .obj .supp .tidyjson .ld
.CMD=LINK_EXE
.ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
.NODE_TYPE=Program
.PEERDIR_POLICY=as_build_from
.FINAL_TARGET=yes
.DEFAULT_NAME_GENERATOR=DirName
.ARGS_PARSER=Base
DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
_USE_LINKER()
#link with libunwind manually
when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
PEERDIR += contrib/libs/cxxsupp
}
when ($USE_LIBCXXRT == "yes") {
PEERDIR += contrib/libs/cxxsupp/libcxxrt
}
when ($USE_DYNAMIC_CUDA == "yes") {
LINK_DYN_LIB_FLAGS += --dynamic-cuda
LINK_SCRIPT_EXE_FLAGS += --dynamic-cuda
}
ENABLE(COMMON_LINK_SETTINGS)
CHECK_PROVIDES()
}
MODULE_TYPE=UNKNOWN
macro ADD_CLANG_TIDY() {
ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy)
when ($TIDY_ENABLED == "yes") {
_MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json
_MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json
}
}
# tag:internal
### @usage: _BASE_PROGRAM # internal
###
### The base of all programs. It adds dependencies to make final artefact complete and runnable.
module _BASE_PROGRAM: _LINK_UNIT {
.SYMLINK_POLICY=EXE
.ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
.GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
SET(MODULE_TYPE PROGRAM)
SET(MODULE_LANG CPP)
FORCE_COVERAGE_ENABLED=yes
when ($OS_IOS == "yes") {
EXTS+=.ios.interface
}
when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
MODULE_SUFFIX=.exe
}
when ($TIDY_ENABLED == "yes") {
MODULE_SUFFIX=.tidyjson
}
when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes" && $MUSL != "yes" && $SANITIZER_DEFINED != "yes" && $USE_THINLTO != "yes") {
PEERDIR+=contrib/libs/glibcasm
}
otherwise {
PEERDIR+=contrib/libs/asmlib
}
}
when ($MUSL == "yes") {
when ($MUSL_LITE == "yes") {
PEERDIR += contrib/libs/musl
}
otherwise {
PEERDIR += contrib/libs/musl/full
}
}
DEFAULT(CPU_CHECK yes)
when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
CPU_CHECK = no
}
when ($CPU_CHECK == "yes") {
PEERDIR += library/cpp/cpuid_check
}
when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
PEERDIR += library/cpp/execprofile/autostart
}
when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
PEERDIR += contrib/libs/cxxsupp/libsan
when ($CLANG) {
select ($TARGET_PLATFORM) {
"LINUX" ? {
PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/static
}
"DARWIN" ? {
# Memory sanitizer is not supported for darwin platform.
# https://clang.llvm.org/docs/MemorySanitizer.html#supported-platforms
when ($SANITIZER_TYPE != "memory") {
PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/dynamic
}
}
default ? {
FATAL_ERROR_MESSAGE+=Unsupported platform for sanitizer
}
}
}
when ($SANITIZE_HEADERS && $SANITIZE_HEADERS != "no") {
PEERDIR += library/cpp/sanitizer/include
}
}
when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
PEERDIR+=library/cpp/testing/dump_clang_coverage
}
when ($IDE_MSVS == "yes") {
PEERDIR+=build/scripts/c_templates
}
when ($_CUSTOM_LINK_STEP_SCRIPT) {
LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
}
}
VCS_INFO_SEM=vcs_info ${input;hide:"build/scripts/vcs_info.py"} ${input;hide:"build/scripts/c_templates/svn_interface.c"} ${input;hide:"build/scripts/c_templates/svnversion.h"}
CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
&& ${VCS_INFO_SEM} \
&& target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE \
&& target_include_directories PRIVATE $_C__INCLUDE_OWNED \
&& target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
&& target_compile_options PRIVATE $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
### @usage: PROGRAM([progname])
###
### Regular program module.
### If name is not specified it will be generated from the name of the containing project directory.
module PROGRAM: _BASE_PROGRAM {
.SEM=CPP_PROGRAM_SEM
ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
ADD_CLANG_TIDY()
}
# tag:python-specific tag:deprecated tag:internal
module _PY2_PROGRAM: _BASE_PY_PROGRAM {
SET(MODULE_LANG PY2)
# Looks like we cannot avoid copy-paste util ymake supports multiple inheritance
# We need to attach coverage.extractor to every py_program target, except pytest targets
ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
}
# tag:python-specific tag:deprecated
### @usage: PY2_PROGRAM([progname]) # deprecated
###
### Deprecated. Use PY3_PROGRAM instead.
### Python 2.x binary program. Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
### If name is not specified it will be generated from the name of the containing project directory.
### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
module PY2_PROGRAM: _PY2_PROGRAM {
.RESTRICTED=STYLE_PYTHON
when ($FAIL_PY2 == "yes") {
_OK=no
}
elsewhen ($OPENSOURCE != "yes") {
PEERDIR+=build/rules/py2_deprecation
}
ASSERT(_OK You are using deprecated Python2-only code (PY2_PROGRAM). Please consider rewriting to Python 3.)
}
# tag:python-specific
### @usage: NO_EXTENDED_SOURCE_SEARCH()
###
### Prevent module using in extended python source search.
### Use the macro if module contains python2-only files (or other python sources which shouldn't be imported by python3 interpreter)
### which resides in the same directories with python 3 useful code. contrib/python/future is a example.
### Anyway, preferred way is to move such files into separate dir and don't use this macro at all.
###
### Also see: https://docs.yandex-team.ru/ya-make/manual/python/vars#y_python_extended_source_search for details
macro NO_EXTENDED_SOURCE_SEARCH() {
SET(NO_EXTENDED_SOURCE_SEARCH yes)
}
# tag:python-specific
### @usage: PY3_PROGRAM([progname])
###
### Python 3.x binary program. Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
### If name is not specified it will be generated from the name of the containing project directory.
### This only compatible with PYTHON3-tagged modules and selects those from multimodules.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
multimodule PY3_PROGRAM {
module PY3_BIN: PY3_PROGRAM_BIN {
.PEERDIRSELF=PY3_BIN_LIB
.IGNORED=RESOURCE RESOURCE_FILES PEERDIR TASKLET_REG RUN_ANTLR4_PYTHON BUILDWITH_CYTHON_CPP _BUILDWITH_CYTHON_CPP_DEP _BUILDWITH_CYTHON_CPP_H BUILDWITH_CYTHON_C _BUILDWITH_CYTHON_C_DEP _BUILDWITH_CYTHON_C_H _BUILDWITH_CYTHON_C_API_H
# Notify pybuild to skip almost all PY_SRCS arguments except MAIN
ENABLE(PROCESS_PY_MAIN_ONLY)
_PY_PROGRAM()
NO_CLANG_TIDY()
}
module PY3_BIN_LIB: PY3_LIBRARY {
.IGNORED=RESTRICT_LICENSES
# Notify pybuild to skip all python main function definitions
ENABLE(IGNORE_PY_MAIN)
_REQUIRE_EXPLICIT_LICENSE()
NO_CLANG_TIDY()
}
}
### @usage: EXPORTS_SCRIPT(exports_file)
###
### Specify exports script within PROGRAM, DLL and DLL-derived modules.
### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
### The other option use EXPORTS parameter of the DLL module itself.
###
### @see: [DLL](#module_DLL)
macro EXPORTS_SCRIPT(Arg) {
SET(EXPORTS_FILE $Arg)
}
### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
###
### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
macro NO_EXPORT_DYNAMIC_SYMBOLS() {
ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
}
### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
###
### Export all non-hidden symbols as dynamic when linking a PROGRAM.
macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
# Dummy: default behaviour
ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
}
### @usage: USE_DYNAMIC_CUDA()
###
### Enable linking of PROGRAM with dynamic CUDA. By default CUDA uses static linking
macro USE_DYNAMIC_CUDA() {
LDFLAGS(-Wl,-rpath,$ORIGIN)
ENABLE(USE_DYNAMIC_CUDA)
}
### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
###
### Specifies name of a script for custom link step. The scripts
### should be placed in the build/scripts directory and are subject to
### review by devtools@.
macro CUSTOM_LINK_STEP_SCRIPT(Name) {
SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
}
### @usage: _BASE_UNITTEST # internal
###
### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
module _BASE_UNITTEST: _BASE_PROGRAM {
.FINAL_TARGET=no
.NODE_TYPE=Program
.ALLOWED=YT_SPEC
when ($UT_SKIP_EXCEPTIONS == "yes") {
C_DEFINES+=-DUT_SKIP_EXCEPTIONS
}
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
}
_TEST_SPLIT_FACTOR_SEM=1
_TEST_TIMEOUT_SEM=
_TEST_PARTITION_SEM=
UNITTEST_SEM=$CPP_PROGRAM_SEM \
&& set_property TARGET $REALPRJNAME PROPERTY SPLIT_FACTOR $_TEST_SPLIT_FACTOR_SEM \
$_TEST_PARTITION_SEM \
&& add_yunittest NAME $REALPRJNAME TEST_TARGET $REALPRJNAME TEST_ARG --print-before-suite --print-before-test --fork-tests --print-times --show-fails \
&& set_yunittest_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
&& add_ytest_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
$_TEST_TIMEOUT_SEM
# tag:test
### @usage: UNITTEST([name])
###
### Unit test module based on library/cpp/testing/unittest.
### It is recommended not to specify the name.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
module UNITTEST: _BASE_UNITTEST {
.SEM=UNITTEST_SEM
.DEFAULT_NAME_GENERATOR=FullPath
.ARGS_PARSER=Base
PEERDIR(library/cpp/testing/unittest_main)
ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
when ($TEST_FORK_MODE != "none") {
when ($TEST_SPLIT_FACTOR) {
_TEST_SPLIT_FACTOR_SEM=$TEST_SPLIT_FACTOR
}
otherwise {
_TEST_SPLIT_FACTOR_SEM=10
}
when ($TEST_PARTITION == "MODULO") {
_TEST_PARTITION_SEM=&& set_property TARGET $REALPRJNAME PROPERTY SPLIT_TYPE $TEST_PARTITION \
}
}
when ($TEST_TIMEOUT) {
_TEST_TIMEOUT_SEM=&& set_yunittest_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
}
}
# tag:yt-specific tag:test
### @usage: YT_UNITTEST([name])
###
### YT Unit test module based on library/cpp/testing/unittest with NYT::Initialize hook
module YT_UNITTEST: _BASE_UNITTEST {
PEERDIR(library/cpp/testing/unittest_main mapreduce/yt/tests/yt_initialize_hook)
ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
}
# tag:test
### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
###
### Generic unit test module.
module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
}
GTEST_SEM=$CPP_PROGRAM_SEM \
&& add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
&& set_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
&& add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
$_TEST_TIMEOUT_SEM
# tag:cpp-specific tag:test
### @usage: GTEST([name])
###
### Unit test module based on library/cpp/testing/gtest.
### It is recommended not to specify the name.
###
### Documentation: https://docs.yandex-team.ru/arcadia-cpp/cpp_test
module GTEST: _BASE_UNITTEST {
.SEM=GTEST_SEM
.DEFAULT_NAME_GENERATOR=FullPath
.ARGS_PARSER=Base
PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
when ($TEST_TIMEOUT) {
_TEST_TIMEOUT_SEM=&& set_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
}
}
USE_AFL=no
# tag:fuzzing
### @usage: FUZZ()
###
### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
###
### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
###
### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
module FUZZ: _BASE_PROGRAM {
.NODE_TYPE=Program
.FINAL_TARGET=no
.ALLOWED=FUZZ_DICTS FUZZ_OPTS
SET(LIBFUZZER_PATH contrib/libs/libfuzzer)
when ($USE_AFL == "no") {
PEERDIR+=$LIBFUZZER_PATH
}
when ($USE_AFL == "yes") {
PEERDIR+=$LIBFUZZER_PATH/afl
}
when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
PEERDIR+=devtools/nofuzz
}
ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
}
# tag:ios-specific
PACK_IOS_CMD=
when ($OS_IOS && $BUILD_IOS_APP) {
PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
}
LINK_BOOSTTEST_CMD=
BOOST_TEST_TYPE_STRING=
when ($BOOSTTEST_IS_FAT_OBJECT) {
LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
BOOST_TEST_TYPE_STRING=no.test
}
otherwise {
LINK_BOOSTTEST_CMD=$LINK_EXE
BOOST_TEST_TYPE_STRING=boost.test
}
# tag:deprecated
### @usage: BOOSTTEST([name]) #deprecated
###
### Test module based on boost/test/unit_test.hpp.
### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
module BOOSTTEST: _BASE_PROGRAM {
.NODE_TYPE=Program
.FINAL_TARGET=no
.CMD=LINK_BOOSTTEST_CMD
PEERDIR(library/cpp/testing/boost_test)
when ($BOOSTTEST_IS_FAT_OBJECT) {
MODULE_SUFFIX=.a
}
elsewhen ($OS_IOS && $BUILD_IOS_APP) {
PEERDIR+=devtools/boosttest_ios_wrapper/library
MODULE_SUFFIX=.ios.tar
}
ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
}
# tag:deprecated
### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated
###
### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
module BOOSTTEST_WITH_MAIN: BOOSTTEST {
PEERDIR(library/cpp/testing/boost_test_main)
}
FUZZ_DICTS_VALUE=
### @usage: FUZZ_DICTS(path1 [path2...])
###
### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
### Libfuzzer and AFL use a single syntax for dictionary descriptions.
### Should only be used in FUZZ modules.
###
### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
macro FUZZ_DICTS(Data...) {
SET_APPEND(FUZZ_DICTS_VALUE $Data)
}
FUZZ_OPTS_VALUE=
### @usage: FUZZ_OPTS(opt1 [Opt2...])
###
### Overrides or adds options to the corpus mining and fuzzer run.
### Currently supported only Libfuzzer, so you should use the options for it.
### Should only be used in FUZZ modules.
###
### @example:
###
### FUZZ_OPTS (
### -max_len=1024
### -rss_limit_mb=8192
### )
###
### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
macro FUZZ_OPTS(Data...) {
SET_APPEND(FUZZ_OPTS_VALUE $Data)
}
# tag:yt-specific tag:test
TEST_YT_SPEC_VALUE=
### @usage: YT_SPEC(path1 [path2...])
###
### Allows you to specify json-files with YT task and operation specs,
### which will be used to run test node in the YT.
### Test must be marked with ya:yt tag.
### Files must be relative to the root of Arcadia.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/
macro YT_SPEC(Data...) {
SET_APPEND(TEST_YT_SPEC_VALUE $Data)
}
# tag:test
TEST_SRCS_VALUE=
### @usage: TEST_SRCS(Files...)
###
### In PY2TEST, PY3TEST and PY*_LIBRARY modules used as PY_SRCS macro and additionally used to mine test cases to be executed by testing framework.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
macro TEST_SRCS(Tests...) {
SET_APPEND(TEST_SRCS_VALUE $Tests)
}
macro DISABLE_DATA_VALIDATION() {
DISABLE(VALIDATE_DATA)
}
# tag:test
TEST_DATA_VALUE=
### @usage: DATA([path...])
###
### Specifies the path to the data necessary test.
### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
### In the latter case resource will be brought to the working directory of the test before it is started
###
### Used only inside TEST modules.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
macro DATA(Data...) {
SET_APPEND(TEST_DATA_VALUE $Data)
ADD_CHECK(check.data $Data)
}
# tag:test
### @usage: DATA_FILES([path...])
###
### Specifies the path to the arcadia source data necessary test.
### Used only inside TEST modules.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
macro DATA_FILES(Paths...) {
SET_APPEND(TEST_DATA_VALUE ${pre=arcadia/:Paths})
_DATA_FILES($Paths)
}
# tag:test
### @usage: EXPLICIT_DATA()
###
### Disables implicit macro DATA(<module_path>).
ADD_SRCDIR_TO_TEST_DATA=yes
macro EXPLICIT_DATA() {
SET(ADD_SRCDIR_TO_TEST_DATA no)
}
# tag:test
TEST_TAGS_VALUE=
### @usage: TAG ([tag...])
###
### Each test can have one or more tags used to filter tests list for running.
### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
macro TAG(Tags...) {
SET_APPEND(TEST_TAGS_VALUE $Tags)
}
# tag:test
TEST_REQUIREMENTS_VALUE=
### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
###
### Allows you to specify the requirements of the test.
###
### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
macro REQUIREMENTS(Tags...) {
SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
}
# tag:test
TEST_ENV_VALUE=
### @usage: ENV(key[=value])
###
### Sets env variable key to value (gets value from system env by default).
macro ENV(Data...) {
SET_APPEND(TEST_ENV_VALUE ${quo:Data})
}
### @usage: CONFTEST_LOAD_POLICY_LOCAL()
###
### Loads conftest.py files in a way that pytest does it
macro CONFTEST_LOAD_POLICY_LOCAL() {
SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
}
# tag:test
TEST_RECIPES_VALUE=
### @usage: USE_RECIPE(path [arg1 arg2...])
###
### Provides prepared environment via recipe for test.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
macro USE_RECIPE(Data...) {
SET_APPEND(TEST_RECIPES_VALUE $Data)
SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
}
# tag:python-specific tag:test
TEST_PYTHON_PATH_VALUE=
# tag:python-specific tag:test
### @usage: PYTHON_PATH(Path)
###
### Set path to Python that will be used to runs scripts in tests
macro PYTHON_PATH(Path) {
SET(TEST_PYTHON_PATH_VALUE $Path)
}
# tag:test
SKIP_TEST_VALUE=
### @usage: SKIP_TEST(Reason)
###
### Skip the suite defined by test module. Provide a reason to be output in test execution report.
macro SKIP_TEST(Reason...) {
SET(SKIP_TEST_VALUE $Reason)
}
# tag:test
LINT_LEVEL_VALUE=extended
_NO_LINT_VALUE=
### @usage: NO_LINT([ktlint])
###
### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
### Ktlint can be disabled using NO_LINT(ktlint) explicitly.
macro NO_LINT(ktlint?"ktlint":"none") {
SET(_NO_LINT_VALUE ${ktlint})
}
### @usage: LINT(<none|base|strict>)
###
### Set linting level for sources of the module
macro LINT(level) {
SET(LINT_LEVEL_VALUE $level)
}
# tag:python-specific tag:test
STYLE_PYTHON_VALUE=no
STYLE_PYTHON_PYPROJECT_VALUE=
### @usage: STYLE_PYTHON([pyproject])
###
### Check python3 sources for style issues using black.
macro STYLE_PYTHON(pyproject...) {
SET(STYLE_PYTHON_VALUE yes)
SET(STYLE_PYTHON_PYPROJECT_VALUE ${pyproject})
}
# tag:python-specific tag:test
### @usage: NO_DOCTESTS()
###
### Disable doctests in PY[|3|23_]TEST
macro NO_DOCTESTS() {
ENV(YA_PYTEST_DISABLE_DOCTEST="yes")
}
# tag:python-specific tag:test
### @usage: _BASE_PYTEST # internal
###
### Base logic of Python 2.x py.test modules: common module properties and dependencies.
module _BASE_PYTEST: _BASE_PY_PROGRAM {
.NODE_TYPE=Program
.FINAL_TARGET=no
.ALLOWED=YT_SPEC NO_DOCTESTS
when ($USE_ARCADIA_PYTHON == "yes") {
PEERDIR+=library/python/pytest
}
when ($USE_ARCADIA_PYTHON == "no") {
MODULE_SUFFIX=.pkg.fake
PEERDIR+=library/python/pytest/empty
}
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
}
# tag:python-specific tag:deprecated tag:test
### @usage: PYTEST_BIN() #deprecated
###
### Same as PY2TEST. Don't use this, use PY2TEST instead.
module PYTEST_BIN: _BASE_PYTEST {
.NODE_TYPE=Program
.DEFAULT_NAME_GENERATOR=FullPath
.ARGS_PARSER=Base
SETUP_PYTEST_BIN()
}
# tag:python-specific tag:test
### @usage: PY2TEST([name])
###
### The test module for Python 2.x based on py.test
###
### This module is compatible only with PYTHON2-tagged modules and selects peers from multimodules accordingly.
### This module is compatible with non-Arcadia Python builds.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/#python
### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
module PY2TEST: PYTEST_BIN {
.RESTRICTED=STYLE_PYTHON
.DEFAULT_NAME_GENERATOR=FullPath
.ARGS_PARSER=Base
when ($FAIL_PY2 == "yes") {
_OK=no
}
elsewhen ($OPENSOURCE != "yes") {
PEERDIR+=build/rules/py2_deprecation
}
SET(MODULE_LANG PY2)
ASSERT(_OK You are using deprecated Python2-only code (PY2TEST). Please consider rewriting to Python 3.)
}
# tag:python-specific tag:deprecated tag:test
### @usage: PY3TEST_BIN() #deprecated
###
### Same as PY3TEST. Don't use this, use PY3TEST instead.
module PY3TEST_BIN: _BASE_PY3_PROGRAM {
.NODE_TYPE=Program
.FINAL_TARGET=no
.ALLOWED=YT_SPEC NO_DOCTESTS
.DEFAULT_NAME_GENERATOR=FullPath
.ARGS_PARSER=Base
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
SET(MODULE_LANG PY3)
SETUP_PYTEST_BIN()
PEERDIR+=library/python/pytest
}
# tag:python-specific tag:test
### Disable submodules with the specified name(s).
### Unlike EXCLUDE_TAGS this variable:
### - affects all projects in the build;
### - filter by module name and ignore MODULE_TAG.
EXCLUDE_SUBMODULES=PY3TEST_LIBRARY
# tag:python-specific tag:test
### @usage: PY3TEST([name])
###
### The test module for Python 3.x based on py.test
###
### This module is compatible only with PYTHON3-tagged modules and selects peers from multimodules accordingly.
### This module is only compatible with Arcadia Python build (to avoid tests duplication from Python2/3-tests). For non-Arcadia python use PYTEST.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
multimodule PY3TEST {
module PY3TEST_PROGRAM: PY3TEST_BIN {
.IGNORED=RUN_ANTLR4_PYTHON
.FINAL_TARGET=yes
}
module PY3TEST_LIBRARY: PY3_LIBRARY {
PEERDIR+=library/python/pytest
_REQUIRE_EXPLICIT_LICENSE()
}
}
# tag:cpp-specific tag:test
module CPP_STYLE_TEST_14: PY3TEST_BIN {
DEPENDS(contrib/libs/clang14/tools/clang-format)
PEERDIR+=library/python/cpp_test
}
macro STYLE(Globs...) {
_GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
_STYLE(${STYLE_SRCS_GLOB})
}
# tag:cpp-specific tag:deprecated tag:test
### @usage: GTEST_UGLY([name])
###
### Deprecated, do not use in new projects. Use GTEST instead.
###
### The test module based on gtest (contrib/libs/gtest contrib/libs/gmock).
### Use public documentation on gtest for details.
###
### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
module GTEST_UGLY: _BASE_PROGRAM {
.NODE_TYPE=Program
.FINAL_TARGET=no
PEERDIR(contrib/restricted/googletest/googlemock contrib/restricted/googletest/googletest)
ADD_YTEST($MODULE_PREFIX$REALPRJNAME gtest)
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
}
# tag:test
### @usage: EXECTEST()
###
### Module definition of generic test that executes a binary.
### Use macro RUN to specify binary to run.
###
### @example:
###
### EXECTEST()
### OWNER(g:yatool)
###
### RUN(
### cat input.txt
### )
### DATA(
### arcadia/devtools/ya/test/tests/exectest/data
### )
### DEPENDS(
### devtools/dummy_arcadia/cat
### )
### TEST_CWD(devtools/ya/test/tests/exectest/data)
### END()
###
### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
###
### @see: [RUN()](#macro_RUN)
module EXECTEST: _BARE_UNIT {
.NODE_TYPE=Program
.FINAL_TARGET=no
.ALLOWED=YT_SPEC
.RESTRICTED=FORK_TEST_FILES
.DEFAULT_NAME_GENERATOR=FullPath
.ARGS_PARSER=Base
SET(MODULE_SUFFIX .pkg.fake)
SETUP_EXECTEST()
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
}
# tag:cpp-specific tag:test
### @usage: Y_BENCHMARK([benchmarkname])
###
### Benchmark test based on the library/cpp/testing/benchmark.
###
### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
module Y_BENCHMARK: PROGRAM {
.SEM=CPP_PROGRAM_SEM
PEERDIR(library/cpp/testing/benchmark/main)
}
GBENCH_SEM=$CPP_PROGRAM_SEM \
&& add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
&& set_property TEST $REALPRJNAME PROPERTY LABELS SMALL $FILTER_ONLY_TEST_TAGS \
&& add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
$_TEST_TIMEOUT_SEM
# tag:cpp-specific tag:test
### @usage: G_BENCHMARK([benchmarkname])
###
### Benchmark test based on the google benchmark.
###
### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
module G_BENCHMARK: _BASE_PROGRAM {
.SEM=GBENCH_SEM
PEERDIR(library/cpp/testing/gbenchmark)
ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
}
# tag:test
TEST_ROOT=$(TESTS_DATA_ROOT)
RESULT_MAX_FILE=0
STRIP_FILES=--dont-strip-files
VERIFY_RESULTS=--verify-results
ADDITIONAL_PATH=
# set for tests variables to fill it by YA_DEV or YA
YA_ROOT=ya
when ($YA_DEV == "yes") {
YA_ROOT=ya-dev
}
# tag:test
### @usage: UNITTEST_FOR(path/to/lib)
###
### Convenience extension of UNITTEST module.
### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
### path/to/lib is the path to the directory with the LIBRARY project.
###
### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
module UNITTEST_FOR: UNITTEST {
.SEM=UNITTEST_SEM
PEERDIR(ADDINCL $UNITTEST_DIR)
SRCDIR($UNITTEST_DIR)
}
### @usage: _LIBRARY # internal
###
### Base module definition for all libraries.
### Contains basic logic like module properties, default variable values etc.
### All libraries similar to C++-libraries should be inherited from it.
module _LIBRARY: _BASE_UNIT {
.CMD=LINK_LIB
.NODE_TYPE=Library
.PEERDIR_POLICY=as_include
.EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
.ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
.GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
.RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
.FINAL_TARGET=no
.GLOBAL_CMD=GLOBAL_LINK_LIB
.GLOBAL_EXTS=.o .obj .tidyjson
GLOBAL_SUFFIX=.global$MODULE_SUFFIX
#TODO: Remove this hack (really we do not need add fake src at all)
ENABLE(NEED_ADD_FAKE_SRC)
_REQUIRE_EXPLICIT_LICENSE(contrib/deprecated contrib/libs contrib/restricted contrib/python)
CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
when ($USE_MKL == "yes") {
NOPLATFORM=yes
}
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_PREFIX=
MODULE_SUFFIX=.lib
}
otherwise {
when ($TIDY_ENABLED == "yes") {
MODULE_PREFIX=
MODULE_SUFFIX=.tidyjson
}
otherwise {
MODULE_PREFIX=lib
MODULE_SUFFIX=.a
}
}
when ($WERROR != "no") {
when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
C_WARNING_OPTS += $WERROR_FLAG
}
}
when ($WITH_VALGRIND == "yes") {
PEERDIR+=contrib/libs/valgrind
# https://st.yandex-team.ru/DTCC-1227
CFLAGS+=-fdebug-default-version=4
}
when ($USE_ARCADIA_LIBM == "yes") {
PEERDIR+=contrib/libs/libm
}
}
CPP_LIBRARY_INDUCED_SEM_PROPERTY=consumer_link_library
CPP_LIBRARY_SEM=add_library ${MODDIR} $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
&& library_fake_marker FAKE_MODULE ${FAKE_MODULE} \
&& ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET \
&& target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
&& target_include_directories PRIVATE $_C__INCLUDE_OWNED \
&& target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
&& target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
&& target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW \
&& add_language C && add_language CXX
CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:CMAKE_TARGET_NAME} $CMAKE_TARGET_NAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
&& target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
&& target_include_directories PRIVATE $_C__INCLUDE_OWNED \
&& target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
&& target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
CMAKE_FIND_PKG=
CMAKE_LINK_TARGET=$REALPRJNAME
CMAKE_FIND_PKG_COMP=
CONAN_REQUIRE=
CONAN_OPTS_SEM=
### @usage: LIBRARY()
###
### The regular static library module.
###
### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
###
### This is C++ library, and it selects peers from multimodules accordingly.
###
### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
### In order to use library in tests PEERDIR it to link into tests.
### If you think you need to distribute static library please contact devtools@ for assistance.
module LIBRARY: _LIBRARY {
.GLOBAL=_AARS _PROGUARD_RULES
.SEM=CPP_LIBRARY_SEM
.GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
.DEFAULT_NAME_GENERATOR=ThreeDirNames
.ARGS_PARSER=Base
when ($CMAKE_PACKAGE_COMPONENT != "") {
CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
}
when ($CMAKE_PACKAGE != "") {
CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
}
when ($CONAN_REFERENCE != "") {
CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
}
when ($CONAN_PKG_OPTS != "") {
CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
}
when ($OPENSOURCE_EXPORT == "no") {
CPP_LIBRARY_SEM=IGNORED
}
when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no" && $SANITIZE_HEADERS && $SANITIZE_HEADERS != "no") {
PEERDIR += library/cpp/sanitizer/include
}
when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
PEERDIR+=$CPP_PROTOBUF_PEERS
}
SET(MODULE_TYPE LIBRARY)
SET(MODULE_LANG CPP)
ADD_CLANG_TIDY()
}
# tag:internal
### @usage: _BARE_MODULE() # internal
###
### Remove unwanted dependencies for "empty" library module
macro _BARE_MODULE() {
SET(NEED_PLATFORM_PEERDIRS no)
SET(PEERDIR_TEST_TOOL no)
DISABLE(WITH_VALGRIND)
NO_CODENAVIGATION()
NO_PLATFORM()
NO_RUNTIME()
NO_UTIL()
NO_CLANG_TIDY()
}
# tag:internal
### @usage: _BARE_LINK_MODULE() # internal
###
### Remove unwanted dependencies for "empty" link module
macro _BARE_LINK_MODULE() {
_BARE_MODULE()
DISABLE(COMMON_LINK_SETTINGS)
ALLOCATOR(FAKE)
}
# tag:internal
### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
###
### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
SRCS($USE_CONDITIONAL_SRCS)
}
# XXX: dirty hack for correct LDFLAGS passing
RESOURCES_LIBRARY_LINK=$TOUCH_UNIT
RESOURCES_LIBRARY_SEM=IGNORED
### @usage: RESOURCES_LIBRARY()
###
### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
###
### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
module RESOURCES_LIBRARY: _BARE_UNIT {
.CMD=RESOURCES_LIBRARY_LINK
.SEM=RESOURCES_LIBRARY_SEM
.ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
.RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS PEERDIR SPLIT_DWARF
.NODE_TYPE=Library
.PEERDIR_POLICY=as_include
.EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
.GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
when ($CMAKE_PACKAGE_COMPONENT != "") {
CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
}
when ($CMAKE_PACKAGE != "") {
CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
}
when ($CONAN_REFERENCE != "") {
CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
}
when ($CONAN_PKG_OPTS != "") {
CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
}
MODULE_SUFFIX=.pkg.fake
ENABLE(NEED_ADD_FAKE_SRC)
WITHOUT_LICENSE_TEXTS()
}
FAT_OBJECT_SEM=add_fat_object ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
&& target_include_directories PRIVATE $_C__INCLUDE_OWNED \
&& target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
&& set_global_flags FAT_OBJECT_PREFIX ${MODULE_PREFIX} \
&& set_global_flags FAT_OBJECT_SUFFIX ${MODULE_SUFFIX}
### Do not turn visibility=hidden symbos into static symbos of partially linked object file
###
### Note: This variable do not have any effect on platforms other than MacOS and iOS.
KEEP_FAT_OBJECT_SYMBOLS=no
### @usage: FAT_OBJECT()
###
### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
### static libraries, local (from own SRCS) and global (from peers') object files.
###
### Designed for use in XCode projects for iOS.
module FAT_OBJECT: LIBRARY {
.ALLOWED=PACK_GLOBALS_IN_LIBRARY
.CMD=LINK_FAT_OBJECT
.SEM=FAT_OBJECT_SEM
.PEERDIR_POLICY=as_build_from
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_SUFFIX=.lib
}
otherwise {
MODULE_SUFFIX=.a
}
when (($OS_DARWIN == "yes" || $OS_IOS == "yes") && $KEEP_FAT_OBJECT_SYMBOLS == "yes") {
LDFLAGS_GLOBAL += -keep_private_externs
}
# FIXME: This is weird legacy
when ($OS_ANDROID == "yes") {
MODULE_PREFIX=lib
}
otherwise {
MODULE_PREFIX=
}
_USE_LINKER()
# This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
# ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
DISABLE(NEED_ADD_FAKE_SRC)
SRCS(build/scripts/_fake_src.cpp)
}
RECURSIVE_LIBRARY_SEM=add_recursive_library ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
&& target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
&& target_include_directories PRIVATE $_C__INCLUDE_OWNED \
&& target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
&& target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
&& target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW
### @usage: RECURSIVE_LIBRARY()
###
### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
### from static libraries, local (from own SRCS) and global (from peers') object files.
###
### Designed for use in XCode projects for iOS.
module RECURSIVE_LIBRARY: LIBRARY {
.CMD=LINK_RECURSIVE_LIBRARY
.SEM=RECURSIVE_LIBRARY_SEM
.PEERDIR_POLICY=as_build_from
# This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
# ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
DISABLE(NEED_ADD_FAKE_SRC)
SRCS(build/scripts/_fake_src.cpp)
}
_SONAME=
_EXPORT_SCRIPT_SEM=
_CLEAN_TEXTREL=
macro _ADD_DYNLYB_SEM(Libname) {
.SEM=add_library ${MODDIR} ${Libname} SHARED ${hide:TARGET} ${hide:AUTO_INPUT} && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && target_include_directories PRIVATE $_C__INCLUDE_OWNED && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE && ${VCS_INFO_SEM} $_EXPORT_SCRIPT_SEM
}
CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES
macro CLEAN_TEXTREL() {
SET(_CLEAN_TEXTREL yes)
}
### @usage: DLL_UNIT # internal
###
### Base module for all dynamically linked libraries as final artifacts.
### Contains all general logic for such kind of modules. Supports versioning and export files.
### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
module DLL_UNIT: _LINK_UNIT {
.CMD=LINK_DYN_LIB
.SEM=CPP_DYN_LIBRARY_SEM
.NODE_TYPE=Library
.SYMLINK_POLICY=SO
.GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
.ALLOWED=WHOLE_ARCHIVE
.DEFAULT_NAME_GENERATOR=TwoDirNames
.ARGS_PARSER=DLL
DYNAMIC_LINK=yes
ALLOCATOR(FAKE)
SET(MODULE_TYPE DLL)
SET(MODULE_TAG DLL)
SET(MODULE_LANG CPP)
ADD_CLANG_TIDY()
when ($EXPORTS_FILE) {
_EXPORT_SCRIPT_SEM=&& use_export_script ${input:EXPORTS_FILE}
}
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_SUFFIX=.dll
}
elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
MODULE_PREFIX=lib
MODULE_SUFFIX=.dylib
}
elsewhen ($TIDY_ENABLED == "yes") {
MODULE_PREFIX=
MODULE_SUFFIX=.tidyjson
}
otherwise {
MODULE_PREFIX=lib
MODULE_SUFFIX=.so
}
# This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
when ($MODULE_VERSION) {
LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
}
_SONAME=$SONAME$MODULE_VERSION
when ($LINUX == "yes") {
# '-z notext' is needed for linking mkl into shared libraries
when ($_CLEAN_TEXTREL != "yes") {
LDFLAGS += -Wl,-z,notext
}
}
when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes") {
when ($_NO_FIX_ELF != "yes") {
LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
}
}
when ($DARWIN == "yes") {
LDFLAGS += -undefined dynamic_lookup
}
when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
PEERDIR+=library/cpp/testing/dump_clang_coverage
}
when ($IDE_MSVS == "yes") {
PEERDIR+=build/scripts/c_templates
}
when ($_CUSTOM_LINK_STEP_SCRIPT) {
LINK_DYN_LIB_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
}
}
# tag:python-specific
### @usage: PY_ANY_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
###
### The Python external module for any versio of Arcadia or system Python.
### 1. major_ver and minor_ver must be integers.
### 2. The resulting .so will have the prefix "lib".
### 3. Processing EXPORTS and PREFIX is the same as for DLL module
### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
###
### Note: Use PYTHON2_MODULE()/PYTHON3_MODULE() in order to PEERDIR proper version of PY23_NATIVE_LIBRARY.
### Do not PEERDIR any PY*_LIBRARY: this will link Python in and render artifact unusable as Python module.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
module PY_ANY_MODULE: DLL_UNIT {
.SEM=CPP_DYN_LIBRARY_SEM
when ($MSVC != "yes" && $DARWIN != "yes") {
LDFLAGS+= -Wl,-Bsymbolic
}
when ($USE_ARCADIA_PYTHON == "no") {
when ($USE_SYSTEM_PYTHON) {
PEERDIR+=build/platform/python
}
otherwise {
when ($MSVC == "yes" || $CYGWIN == "yes") {
LDFLAGS+=$PYTHON_LIBRARIES
}
}
}
# This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
when ($MODULE_VERSION) {
LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
}
_SONAME=$SONAME$MODULE_VERSION
# -bundle
when ($DARWIN == "yes") {
LDFLAGS+=-flat_namespace
}
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_PREFIX=
MODULE_SUFFIX=.pyd
}
otherwise {
MODULE_PREFIX=
MODULE_SUFFIX=.so
}
.RESTRICTED=USE_PYTHON2 USE_PYTHON3 PY_SRCS PY_MAIN
}
# tag:python-specific
### @usage: PY2MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
###
### The Python external module for Python2 and any system Python
### 1. major_ver and minor_ver must be integers.
### 2. The resulting .so will have the prefix "lib".
### 3. Processing EXPORTS and PREFIX is the same as for DLL module
### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
###
### Note: this module will always PEERDIR Python2 version of PY23_NATIVE_LIBRARY.
### Do not PEERDIR PY2_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
module PY2MODULE: PY_ANY_MODULE {
PYTHON2_MODULE()
SET(MODULE_LANG PY2)
.RESTRICTED=PYTHON3_MODULE PYTHON3_ADDINCL
}
# tag:python-specific
### @usage: PY3MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
###
### The Python external module for Python3 and any system Python
### 1. major_ver and minor_ver must be integers.
### 2. The resulting .so will have the prefix "lib".
### 3. Processing EXPORTS and PREFIX is the same as for DLL module
### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
###
### Note: this module will always PEERDIR Python3 version of PY23_NATIVE_LIBRARY.
### Do not PEERDIR PY3_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
module PY3MODULE: PY_ANY_MODULE {
PYTHON3_MODULE()
SET(MODULE_LANG PY3)
.RESTRICTED=PYTHON2_MODULE PYTHON2_ADDINCL
}
# tag:python-specific
### @usage: PYTHON2_MODULE()
###
### Use in PY_ANY_MODULE to set it up for Python 2.x.
macro PYTHON2_MODULE() {
when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
PEERDIR+=contrib/tools/python/lib
}
SET(ANTLR_PYTHON Python2)
PYTHON2_ADDINCL()
}
# tag:python-specific
### @usage: PYTHON3_MODULE()
###
### Use in PY_ANY_MODULE to set it up for Python 3.x.
macro PYTHON3_MODULE() {
when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
PEERDIR+=contrib/tools/python3/lib
}
SET(ANTLR_PYTHON Python3)
PYTHON3_ADDINCL()
}
# tag:r-specific
### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
###
### The external module for R language.
### 1. major_ver and minor_ver must be integers.
### 2. The resulting .so will have the prefix "lib".
### 3. Processing EXPORTS and PREFIX is the same as for DLL module
### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
module R_MODULE: DLL_UNIT {
.SEM=CPP_DYN_LIBRARY_SEM
when ($DARWIN == "yes") {
LDFLAGS+=-flat_namespace -dynamiclib
}
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_PREFIX=lib
MODULE_SUFFIX=.dll
}
ADDINCL(contrib/libs/r-lang)
}
### @usage: DYNAMIC_LIBRARY_FROM(Paths)
###
### Use specified libraries as sources of DLL
macro DYNAMIC_LIBRARY_FROM(Path...) {
PEERDIR($Path)
WHOLE_ARCHIVE($Path)
}
### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
###
### Dynamic library module definition.
### 1. major_ver and minor_ver must be integers.
### 2. EXPORTS allows you to explicitly specify the list of exported functions. This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files
### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
###
### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
module DLL: DLL_UNIT {
.SEM=CPP_DYN_LIBRARY_SEM
SET(MAKE_ONLY_SHARED_LIB yes)
when ($OS_WINDOWS) {
MODULE_SUFFIX=.dll
}
# TODO: Make it possible to use this syntax
# DEFAULT(DLL_FOR_DIR no)
### FIXME: XXX
###when ($DLL_FOR_DIR != "no") {
### SRCDIR($DLL_FOR_DIR)
### ADDINCL($DLL_FOR_DIR)
###}
}
### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
module DLL_TOOL: DLL {
.SEM=CPP_DYN_LIBRARY_SEM
# ymake resolves only program nodes as tools.
.NODE_TYPE=Program
}
### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
###
### Executable dynamic library module definition.
### 1. major_ver and minor_ver must be integers.
### 2. EXPORTS allows you to explicitly specify the list of exported functions. This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files
### 3. PREFIX allows you to change the prefix of the output file.
module SO_PROGRAM: DLL {
.CMD=LINK_EXEC_DYN_LIB
SET(MODULE_TYPE PROGRAM)
MODULE_PREFIX=
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_SUFFIX=.exe
}
otherwise {
MODULE_SUFFIX=
}
}
DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
# tag:internal
### @usage: DEV_DLL_PROXY() # internal
###
### The use of this module is strictly prohibited!!!
### This is a temporary and project-specific solution.
module DEV_DLL_PROXY: _BARE_UNIT {
.NODE_TYPE=Library
.EXTS=.so .dll .dylib .mf
.CMD=DLL_PROXY_CMD_MF
DYNAMIC_LINK=yes
when ($OS_WINDOWS == "yes") {
MODULE_SUFFIX=.dll
}
elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
MODULE_PREFIX=lib
MODULE_SUFFIX=.dylib$MODULE_VERSION
}
otherwise {
MODULE_PREFIX=lib
MODULE_SUFFIX=.so$MODULE_VERSION
}
}
# tag:internal
### @usage: DLL_PROXY() # internal
###
### The use of this module is strictly prohibited!!!
### This is a temporary and project-specific solution.
module DLL_PROXY: DEV_DLL_PROXY {
.EXTS=.so .dylib .lib .mf
.PROXY=yes
.PEERDIR_POLICY=as_build_from
SET(PEERDIR_TAGS DLL __EMPTY__)
when ($OS_WINDOWS == "yes") {
MODULE_SUFFIX=.lib
}
}
# tag:internal
### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
###
### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
### This it needed to transfer their outputs through the library to PROGRAM
### or dependent DLL/DYNAMIC_LIBRARY.
###
### Note: this is temporary solution until support of `super-global` variables come
### which will enable transfer of some properties though final targets like DLLs.
macro DYNAMIC_DEPS(Path...) {
# PEERDIR as macro completely ignored in place where this macro applies
SET_APPEND(PEERDIR $Path)
}
# tag:internal
### @usage: DYNAMIC_LIBRARY() # internal
###
### The use of this module is strictly prohibited except LGPL-related opensourcing
### This provides linkable DLL module which brings its results to programs and tests
### for seamless testing and packaging
multimodule DYNAMIC_LIBRARY {
module DLL_BIN: DLL {
.PROXY=yes
.IGNORED=PROVIDES
SET(MODULE_TAG DLL)
}
module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
.CMD=TOUCH_UNIT_MF
.PEERDIRSELF=DLL_BIN
.IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
.ALLOWED=DYNAMIC_DEPS
SET(PEERDIR_TAGS DLL_LIB __EMPTY__)
_BARE_MODULE()
DYNAMIC_LINK=yes
MODULE_SUFFIX=.pkg.fake
PEERDIR+=build/platform/local_so
when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no" && $SANITIZE_HEADERS && $SANITIZE_HEADERS != "no") {
PEERDIR += library/cpp/sanitizer/include
}
# disable credits generation for static library
SET(CREDITS_FLAGS)
}
}
### @usage: GLOBAL_SRCS(filenames...)
###
### Make all source files listed as GLOBAL.
### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
### recognized for GLOBAL_SRCS in contrast to SRCS macro.
###
### @example:
### Consider the file to ya.make:
###
### LIBRARY()
### GLOBAL_SRCS(foo.cpp bar.cpp)
### END()
###
### @see: [SRCS()](#macro_SRCS)
macro GLOBAL_SRCS(Files...) {
SRCS(${pre=GLOBAL :Files})
}
### @usage: ALL_SRCS([GLOBAL] filenames...)
###
### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
### as the first argument and is equivalent to call to SRCS macro otherwise.
###
### @example:
###
### LIBRARY()
### SET(MAKE_IT_GLOBAL GLOBAL)
### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
### END()
###
### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
SRCS(${pre=$GLOBAL :Files})
}
### @usage: _DLL_COMPATIBLE_LIBRARY # internal
###
### Base module to place DLLs into multimodules back to back with libraries.
### In order to function properly all modules in multimodule shall have the
### same set of arguments. So this module is just library that accepts but
### ignores all DLL arguments.
module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
.DEFAULT_NAME_GENERATOR=TwoDirNames
.ARGS_PARSER=DLL
}
@import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
# as SRCS in packages use macro BUNDLE_SRCS!
PACKED_PACKAGE_ARGS=
PACKED_PACKAGE_EXT=
### @usage: PACK(archive_type)
###
### When placed inside the PACKAGE module, packs the build results tree to the archive with specified extension. Currently supported extensions are `tar` and `tar.gz`
###
### Is not allowed other module types than PACKAGE().
###
### @see: [PACKAGE()](#module_PACKAGE)
macro PACK(Ext) {
SET(PACKED_PACKAGE_EXT $Ext)
}
PACKAGE_STRICT_VALUE=
macro PACKAGE_STRICT() {
SET(PACKAGE_STRICT_VALUE yes)
}
### @usage: PACKAGE(name)
###
### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
### As a result, build directory of the project gets the structure of the accessible part of Arcadia, where the build result of each PEERDIR is placed to relevant Arcadia subpath.
### The data can be optionally packed if macro PACK() is used.
###
### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
###
### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
###
### @see: [PACK()](#macro_PACK)
multimodule PACKAGE {
module PACKAGE_FINAL: _BASE_UNIT {
.CMD=TOUCH_PACKAGE_MF
.ALIASES=SRCS=FILES
.ALLOWED=PACK
.PEERDIRSELF=PACKAGE_UNION
.USE_PEERS_LATE_OUTS=yes
.PEERDIR_POLICY=as_build_from
.FINAL_TARGET=yes
SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2 PY3 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM PACKAGE_UNION)
SET(MODULE_SUFFIX .final.pkg.fake)
SET(DONT_RESOLVE_INCLUDES yes)
NO_PLATFORM()
when ($PACKED_PACKAGE_EXT) {
PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
}
SET(NEED_PLATFORM_PEERDIRS no)
}
module PACKAGE_UNION: UNION {
.CMD=UNION_CMD
.FINAL_TARGET=no
.ALLOWED=PACK
.IGNORED=VCS_INFO_FILE
SET(MODULE_SUFFIX .pkg.fake)
SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2 PY3 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM PACKAGE_UNION)
DISABLE(START_TARGET)
}
}
TOUCH_GROUP=$TOUCH_PACKAGE ${kv;hide:"p CI"}
### @usage: CI_GROUP()
###
### Module collects what is described directly inside it transitively by PEERDIRs.
### No particular layout of built artifacts is implied. This module is needed primarily for CI dependency analysis and may not trigger builds at all.
###
### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
module CI_GROUP: _BARE_UNIT {
.CMD=TOUCH_GROUP
.PEERDIR_POLICY=as_build_from
.FINAL_TARGET=yes
.RESTRICTED=SRCS
.USE_PEERS_LATE_OUTS=yes
MODULE_SUFFIX=.ci.pkg.fake
PEERDIR_TAGS=CPP_PROTO PY3 PY3_NATIVE PY3_BIN PY3TEST_PROGRAM YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE DLL
}
# tag:generic tag:internal
TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
# tag:proto
### @usage: RESOLVE_PROTO()
###
### Enable include resolving within UNIONs and let system .proto being resolved
### among .proto/.gztproto imports
###
### Note: it is currently impossible to enable resolving only for .proto, so resolving is enabled for all supported files
### also we only add ADDINCL for stock protobuf. So use this macro with care: it may cause resolving problems those are
### to be addressed by either ADDINCLs or marking them as TEXT. Please contact devtools for details.
macro RESOLVE_PROTO() {
SET(DONT_RESOLVE_INCLUDES no)
ADDINCL(FOR proto $PROTOBUF_PATH)
}
### @usage: UNION(name)
###
### Collection of PEERDIR dependencies, files and artifacts.
### UNION doesn't build its peers, just provides those to modules depending on it.
### When specified in DEPENDS() macro the UNION is transitively closed, building all its peers and providing those by own paths (without adding this module path like PACKAGE does).
###
### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
###
### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
module UNION: _BASE_UNIT {
.CMD=UNION_CMD_MF
.FINAL_TARGET=no
.ALIASES=SRCS=FILES
.ALLOWED=EXPLICIT_OUTPUTS
.IGNORED=VCS_INFO_FILE
NO_PLATFORM()
SET(MODULE_SUFFIX .pkg.fake)
SET(DONT_RESOLVE_INCLUDES yes)
SET(NEED_PLATFORM_PEERDIRS no)
PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN DLL PACKAGE_UNION
UNION_OUTS=${hide;late_out:AUTO_INPUT}
when ($_UNION_EXPLICIT_OUTPUTS) {
UNION_OUTS=$_EXPAND_INS_OUTS($_UNION_EXPLICIT_OUTPUTS)
}
}
# tag:python-specific
module _PY_PACKAGE: UNION {
.EXTS=.py
.ALLOWED=GRPC USE_SKIFF
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
ENABLE(PY_PROTOS_FOR)
SET(PEERDIR_TAGS PY_PROTO)
SET(DONT_RESOLVE_INCLUDES no)
}
# tag:python-specific tag:deprecated tag:internal
### @usage: PY_PACKAGE(name) # internal, deprecated
###
### This is module created via PY_PROTOS_FOR() macro
module PY_PACKAGE: _PY_PACKAGE {
.ALIASES=SRCS=SRCS
.FINAL_TARGET=yes
}
# tag:internal
### @usage: _SET_FIRST_VALUE(name args...) # internal
###
### This macro sets the value of `name` variable to the value of next argument
macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
SET($NAME $VALUE)
}
# tag:python-specific
PY_NAMESPACE_VALUE=
# tag:python-specific
### @usage: PY_NAMESPACE(prefix)
###
### Sets default Python namespace for all python sources in the module.
### Especially suitable in PROTO_LIBRARY where Python sources are generated and there is no PY_SRCS to place NAMESPACE parameter.
macro PY_NAMESPACE(Arg) {
SET(PY_NAMESPACE_VALUE $Arg)
}
# tag:internal
### @usage: _SRCS_NO_GLOBAL(files...) # internal
###
### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
### Note: this macro changes order of source files.
macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
SRCS($GLOBAL $FILES)
}
# tag:java-specific
JAVA_VCS_MF_ARG=
COMPILE_JAVA_MF=${hide:JAVA_FAKEID} $COMPILE_JAVA $MAVEN_EXPORT_CMD
# tag:java-specific
when ($EXT_JAVA_VCS_INFO == "yes") {
JAVA_VCS_MF_ARG=--vcs-mf $VCS_JAVA
COMPILE_JAVA_MF=${hide:JAVA_FAKEID} $GENERATE_VCS_JAVA_INFO_NODEP && $COMPILE_JAVA $MAVEN_EXPORT_CMD
}
# tag:java-specific
EXT_JAVA_VCS_INFO=no
### @usage: EMBED_JAVA_VCS_INFO()
###
### Embed manifest with vcs info into `EXTERNAL_JAVA_LIBRARY`
### By default this is disabled.
macro EMBED_JAVA_VCS_INFO() {
.SEM=add_vcs_info_to_mf ${hide;output:"VcsInfoMfDummy.java"}
ENABLE(EXT_JAVA_VCS_INFO)
}
# tag:java-specific tag:internal
### @usage: EXTERNAL_JAVA_LIBRARY() #internal
###
### EXTERNAL_JAVA_LIBRARY() is a module for creating a .jar file using non-Java code (generators etc.)
### Unlike regular JAVA_LIBRARY this module doesn't produce .pom file, so it cannot be exported to Maven itself.
### PEERDIR it from JAVA_LIBRARY or JAVA_PROGRAM for export to Maven.
module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
.EXTS=.jsrc .java .jar .mf
.NODE_TYPE=Bundle
.CMD=COMPILE_JAVA_MF
# TODO(YMAKE-27) all contribs involved into opensource export must be JAVA_CONTRIB modules
# and this module must not be intended for export. Such hange will break JBUILD and thus is
# blocked on YMAKE-27
.SEM=JAVA_CONTRIB_SEM
.PEERDIR_POLICY=as_build_from
.FINAL_TARGET=no
.ALIASES=SRCS=_SRCS_NO_GLOBAL
.ALLOWED=EMBED_JAVA_VCS_INFO
.RESTRICTED=EXTERNAL_JAR
.GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS
PEERDIR(build/platform/java/jdk)
PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR
when ($KOTLIN_PROTO == "yes") {
PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION}
}
when ($MAVEN_EXPORT == "yes") {
when ($MAVEN_DEPLOY == "yes") {
PEERDIR+=build/external_resources/maven
MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM && $MAVEN_DEPLOY_CMD
}
otherwise {
MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM
}
MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GOUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
}
PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL PACKAGE_UNION
HAS_MANAGEABLE_PEERS=yes
DYNAMIC_LINK=yes
MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
when ($PACKAGE_PREFIX) {
PACKAGE_PREFIX_ARGS=--package-prefix=$PACKAGE_PREFIX
}
DISABLE(NEED_PLATFORM_PEERDIRS)
NO_PLATFORM()
SET(MODULE_SUFFIX .jar)
SET(MODULE_LANG JAVA)
_WHEN_EXPORT_GRADLE()
}
# tag:java-specific
ALL_JAR_SOURCES=
LINT_JAVA_SOURCES=
ALL_SRCDIRS=
LINK_JAR_RESOURCES=
LINK_JAR_JSOURCES=
JAR_GEN_SRCS=
JAR_GEN_JSRCS=
macro _JAR_SRCS(SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], RESOURCES?"yes":"no", Globs...) {
_CHECK_JAVA_SRCDIR($SRCDIR)
SET_APPEND(ALL_SRCDIRS $SRCDIR)
SET(VAR_SALT $SRCDIR $Globs $EXCLUDE $PACKAGE_PREFIX $RESOURCES $FILES)
SET(JAR_SRCS_GLOB uniq_${hash:VAR_SALT})
_LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE})
SET_APPEND(LINT_JAVA_SOURCES \${input;rootrel;ext=.java:${JAR_SRCS_GLOB}})
SET_APPEND(ALL_JAR_SOURCES --jsources ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt --resources ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt --srcdir ${quo:SRCDIR} \${input:${JAR_SRCS_GLOB}} ${pre=\$\{input\:\";suf=\"\}:FILES})
_FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_RESOURCES ${quo:SRCDIR} ${BINDIR}/cls ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt)
_FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_JSOURCES ${quo:SRCDIR} ${BINDIR}/src ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt)
_FILL_JAR_GEN_SRCS(JAR_GEN_SRCS JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst $KT_SRCLIST ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt $Globs EXCLUDE $EXCLUDE)
_FILL_JAR_GEN_SRCS(JAR_GEN_JSRCS SRC_JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst $KT_SRCLIST ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt $Globs EXCLUDE $EXCLUDE)
}
macro IDEA_JAR_SRCS(Args...) {
_JAR_SRCS($Args)
SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
}
macro _HASH_HELPER(Args...) {
.CMD=${hash:Args}
.SEM=${hash:Args}
}
macro _GENTAR_HELPER(OUT_DIR[], Args...) {
.CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --pack ${OUT_DIR} --outs ${output;tared;suf=.$_HASH_HELPER($Args).gentar:OUT_DIR} ${kv;hide:"tared_kind nodir"}
}
# tag:java-specific
RUN_JAR_PROG_CP_PRE=@
RUN_JAR_PROG_CP_SUF=.cplst
when($JDK_VERSION == "8") {
RUN_JAR_PROG_CP_PRE=
RUN_JAR_PROG_CP_SUF=
}
# tag:java-specific
JDK_LATEST_VERSION=19
JDK_LATEST_PEERDIR=build/platform/java/jdk/jdk${JDK_LATEST_VERSION}
# tag:java-specific
macro _DO_2_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq_", IN_DIRS_INPUTS[], IN{input}[], IN_NOPARSE{input}[], IN_DIR[], OUT_NOAUTO{output}[], OUT{output}[], TOOL{tool}[], OUT_DIR[], CLASSPATH[], ADD_SRCS_TO_CLASSPATH?"yes":"no", CWD="${ARCADIA_BUILD_ROOT}", STDOUT="", STDOUT_NOAUTO="", Args...) {
_LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR})
_CHECK_RUN_JAVA_PROG_CLASSPATH($CLASSPATH)
.PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
.CMD=${kv;hide:"p RJ"} ${kv;hide:"pc blue"} ${hide:JAVA_FAKEID} ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} ${OUT_DIR} && ${cwd:CWD} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} ${pre=--file=:STDOUT} ${output;hide:STDOUT} ${pre=--file=:STDOUT_NOAUTO} ${output;hide;noauto:STDOUT_NOAUTO} $YMAKE_PYTHON ${input:"build/scripts/fix_java_command_file_cp.py"} --build-root ${ARCADIA_BUILD_ROOT} $JDK_RESOURCE/bin/java -Dfile.encoding=utf8 -classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} ${Args} && $_GENTAR_HELPER($CLASSPATH $IN_DIR $IN $IN_NOPARSE $TOOL $Args OUT_DIR $OUT_DIR) ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output;noauto;hide:OUT_NOAUTO} ${output;hide:OUT} ${tool;hide:TOOL} ${IN_DIRS_INPUTS}
}
# tag:java-specific
macro _DO_1_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq", Args...) {
_DO_2_RUN_JAR_PROGRAM($Args IN_DIRS_VAR $IN_DIRS_VAR IN_DIRS_INPUTS ${"$"}{input;hide:$IN_DIRS_VAR})
}
# tag:java-specific
macro RUN_JAVA_PROGRAM(Args...) {
_DO_1_RUN_JAR_PROGRAM($Args IN_DIRS_VAR uniq_${hash:Args})
}
# tag:java-specific
_JAR_ANN_PROCESSORS=
_JAR_ANN_PROC_OPT_PREFIX=
macro JAR_ANNOTATION_PROCESSOR(Classes...) {
SET_APPEND(_JAR_ANN_PROCESSORS $Classes)
SET(_JAR_ANN_PROC_OPT_PREFIX -processor)
# for ya ide idea only
SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Classes)
}
# tag:java-specific
macro _JAR_ANN_PROC_OPTS(Classes...) {
.CMD=$_JAR_ANN_PROC_OPT_PREFIX ${join=,:Classes}
}
# tag:java-specific
macro _NOOP_MACRO(Args...) {
ENABLE(UNUSED_MACRO)
}
# tag:java-specific
module _JAR_BASE: _BARE_UNIT {
.NODE_TYPE=Bundle
.CMD=TOUCH_UNIT
.PEERDIR_POLICY=as_build_from
.FINAL_TARGET=no
.ALIASES=SRCS=_SRCS_NO_GLOBAL
.ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE
.DEFAULT_NAME_GENERATOR=TwoDirNames
.RESTRICTED=WITH_JDK RESOURCE RESOURCE_FILES
.GLOBAL=EXPORT_GRADLE_PROJECT_COORDS
PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__
HAS_MANAGEABLE_PEERS=yes
DYNAMIC_LINK=yes
MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
DISABLE(NEED_PLATFORM_PEERDIRS)
NO_PLATFORM()
VCS_JAVA=${suf=.__vcs_version__.mf:TARGET}
SET(MODULE_LANG JAVA)
_WHEN_EXPORT_GRADLE()
}
JAVA_CONTRIB_PROXY_SEM=IGNORED
# tag:java-specific
module JAVA_CONTRIB_PROXY: _JAR_BASE {
.SEM=JAVA_CONTRIB_PROXY_SEM
}
# tag:java-specific
macro _FETCH_CONTRIB(Id, Out, SBR="sbr:") {
.CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id --copy-to ${output:Out} ${input;hide:"build/scripts/fetch_from.py"} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
ADD_CHECK(check.resource $Id)
}
# tag:java-specific
LOCAL_JAR_PATH=
LOCAL_SOURCES_JAR_PATH=
JAR_RESOURCE_ID=
SRC_RESOURCE_ID=
FETCH_SRCS_JAR=
FETCH_TARGET_JAR=
FETCH_CONTRIB_JAR=${hide:JAVA_FAKEID} $FETCH_TARGET_JAR $FETCH_SRCS_JAR
# tag:java-specific
macro JAR_RESOURCE(Id) {
SET(JAR_RESOURCE_ID $Id)
}
# tag:java-specific
macro SRC_RESOURCE(Id) {
SET(SRC_RESOURCE_ID $Id)
}
# tag:java-specific
macro LOCAL_JAR(File) {
SET(LOCAL_JAR_PATH $File)
}
# tag:java-specific
macro LOCAL_SOURCES_JAR(File) {
SET(LOCAL_SOURCES_JAR_PATH $File)
}
JAVA_CONTRIB_SEM= \
consumer_classpath $EXPORT_GRADLE_PROJECT_COORDS ${hide:TARGET} ${hide:AUTO_INPUT} && \
peers_closure $MANAGED_PEERS_CLOSURE && \
peers_closure_coords $EXPORT_GRADLE_PROJECT_COORDS_GLOBAL && \
IGNORED
# tag:java-specific
module JAVA_CONTRIB: _JAR_BASE {
.CMD=FETCH_CONTRIB_JAR
.SEM=JAVA_CONTRIB_SEM
.FINAL_TARGET=yes
.GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS
when ($JAR_RESOURCE_ID) {
FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX})
}
otherwise {
when ($LOCAL_JAR_PATH) {
FETCH_TARGET_JAR= && $FS_TOOLS copy ${input:LOCAL_JAR_PATH} $TARGET
}
otherwise {
FETCH_TARGET_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:BINDIR} $JDK_RESOURCE/bin/jar cfvm $TARGET $VCS_JAVA .
PEERDIR+=build/platform/java/jdk
PEERDIR+=$JDK_RESOURCE_PEERDIR
}
}
when ($SRC_RESOURCE_ID) {
FETCH_SRCS_JAR= && $_FETCH_CONTRIB($SRC_RESOURCE_ID ${BINDIR}/${REALPRJNAME}-sources.jar)
}
otherwise {
when ($LOCAL_SOURCES_JAR_PATH) {
FETCH_SRCS_JAR= && $FS_TOOLS copy ${input:LOCAL_SOURCES_JAR_PATH} {output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME}
}
otherwise {
FETCH_SRCS_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && $FS_TOOLS md ${BINDIR}/fake-src && ${cwd;suf=/fake-src:BINDIR} $JDK_RESOURCE/bin/jar cfvm ${output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME} $VCS_JAVA .
PEERDIR+=build/platform/java/jdk
PEERDIR+=$JDK_RESOURCE_PEERDIR
}
}
when ($MAVEN_EXPORT == "yes") {
_MAKEFILE_INCLUDE_LIKE_DEPS+=pom.xml
FETCH_CONTRIB_JAR+= && $MAVEN_EXPORT_GEN_DEPLST
}
SET(MODULE_SUFFIX .jar)
_SETUP_MAVEN_EXPORT_COORDS_IF_NEED($MODDIR)
}
MAKE_JAVA_CLASSPATH_FILE=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} ${input;hide:"build/scripts/process_command_files.py"}
# tag:kotlin-specific
KOTLINC_OPTS_VALUE=
# tag:kotlin-specific
KT_SRCLIST=${BINDIR}/misc/all-kt-sources.txt
KT_SRSCLIST_FLAG=--kotlin $KT_SRCLIST
KT_CLASSES_DIR=${BINDIR}/kt_cls
KT_CLASSPATH=${BINDIR}/kt_cp.txt
COLLECT_KT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/kt_bfg.txt -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file
LINK_KT_CLASSPATH=${MAKE_JAVA_CLASSPATH_FILE} ${BINDIR}/kt_bfg.txt $KT_CLASSPATH && $FS_TOOLS md $KT_CLASSES_DIR
COMPILE_KT= \
${cwd:ARCADIA_BUILD_ROOT} ${env:"LC_ALL=en_US.UTF-8"} $YMAKE_PYTHON ${input:"build/scripts/with_pathsep_resolve.py"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} --kotlin --sources-list $KT_SRCLIST \
$JDK_RESOURCE/bin/java -jar $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} \
@$KT_SRCLIST -classpath @$KT_CLASSPATH $KOTLINC_FLAGS_VALUE -d $KT_CLASSES_DIR $KOTLINC_OPTS_VALUE
ALL_KT_COMMANDS=
KT_CLASSPATH_ITEM=
# tag:kotlin-specific
KT_KAPT_SOURCES_DIR=${BINDIR}/kapt_gen_src
KT_KAPT_STUBS_DIR=${BINDIR}/kapt_gen_stubs
KT_KAPT_AP_CLASSPATH=
KT_KAPT_PLUGIN_OPTS=-P plugin:org.jetbrains.kotlin.kapt3:sources=${KT_KAPT_SOURCES_DIR} -P plugin:org.jetbrains.kotlin.kapt3:classes=${KT_CLASSES_DIR} -P plugin:org.jetbrains.kotlin.kapt3:stubs=${KT_KAPT_STUBS_DIR} -P plugin:org.jetbrains.kotlin.kapt3:aptMode=stubsAndApt
### @usage: KAPT_OPTS(opts...)
###
### Used to specify annotation processor qualified class names.
### If specified multiple times, only last specification is used.
macro KAPT_OPTS(Args...) {
SET_APPEND(KT_KAPT_PLUGIN_OPTS ${pre=-P :Args})
}
### @usage: KAPT_ANNOTATION_PROCESSOR(processors...)
###
### Used to specify annotation processor qualified class names.
### If specified multiple times, only last specification is used.
macro KAPT_ANNOTATION_PROCESSOR(Args...) {
KAPT_OPTS(${pre="plugin:org.jetbrains.kotlin.kapt3:processors=":Args})
}
### @usage: KAPT_ANNOTATION_PROCESSOR_CLASSPATH(jars...)
###
### Used to specify classpath for annotation processors.
### If specified multiple times, all specifications are used.
macro KAPT_ANNOTATION_PROCESSOR_CLASSPATH(Args...) {
PEERDIR($Args)
SET_APPEND(KT_KAPT_AP_CLASSPATH $Args)
}
# tag:java-specific
JAVAC_CMD=$JDK_RESOURCE/bin/javac
ERROR_PRONE_JAVAC_CMD=${YMAKE_PYTHON} ${input:"build/scripts/build_java_with_error_prone2.py"} $JDK_RESOURCE/bin/java $JDK_RESOURCE/bin/javac $ERROR_PRONE_RESOURCE/error_prone.jar
# tag:java-specific tag:codenav
JAVA_YNDEXING=no
# tag:java-specific
when ($USE_SYSTEM_KYTHE) {
KYTHE_RESOURCE=$USE_SYSTEM_KYTHE
}
otherwise {
KYTHE_RESOURCE=$KYTHE_RESOURCE_GLOBAL
}
# tag:java-specific tag:codenav
_JAVA_YNDEXING_CMD=$YMAKE_PYTHON ${input:"build/scripts/build_java_codenav_index.py"} $TARGET $ARCADIA_BUILD_ROOT $ARCADIA_ROOT ${BINDIR}/all-java.srclst $JDK_RESOURCE/bin/java -jar $KYTHE_RESOURCE/kythe/extractors/javac_extractor.jar
_DO_JAVA_YNDEXING=
# tag:java-specific
SOURCES_JAR=no
when ($BUILD_TYPE == "DEBUG" && $NO_DEBUGINFO != "yes") {
SOURCES_JAR=yes
}
_PACK_SRC_JAR_IMPL=&& $FS_TOOLS md ${BINDIR}/src $JAR_GEN_JSRCS $LINK_JAR_JSOURCES && ${cwd;suf=/src:BINDIR} $JDK_RESOURCE/bin/jar cfvm ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME} $VCS_JAVA .
_PACK_SRC_JAR=
# tag:java-specific
_PACK_JNI=
_PACK_JNI_CMD= && $FS_TOOLS link_or_copy_to_dir --ya-start-command-file ${ext=.so:MANAGED_PEERS_CLOSURE} ${ext=.dll:MANAGED_PEERS_CLOSURE} ${ext=.dylib:MANAGED_PEERS_CLOSURE} --ya-end-command-file ${BINDIR}/cls
# tag:java-specific
_MAKE_JSTYLE_FILE_LIST=
# tag:java-specific
_LINK_UBERJAR=
_UBERJAR_SELF=
_DO_LINK_UBERJAR= && $JDK_RESOURCE/bin/java -cp $UBERJAR_RESOURCE/devtools-java_shader.jar ru.yandex.devtools.emigrante.Main --out-jar $TARGET $_UBERJAR_SELF ${ext=.jar;pre=--jar :MANAGED_PEERS_CLOSURE} ${UBERJAR_PREFIX_FLAG} ${UBERJAR_HIDE_EXCLUDE_FLAGS} $UBERJAR_PATH_EXCLUDES ${UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG} ${UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS} ${UBERJAR_APPENDING_TRANSFORMER_FLAGS} ${UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG} \
&& $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} $BINDIR/_empty/META-INF \
&& $YMAKE_PYTHON ${input:"build/scripts/touch.py"} $BINDIR/_empty/META-INF/MANIFEST.MF \
&& $UPDATE_VCS_JAVA_INFO_NODEP($TARGET) \
&& ${cwd;suf=/_empty:BINDIR} ${JDK_RESOURCE}/bin/jar ufv ${TARGET} META-INF/MANIFEST.MF \
&& $JDK_RESOURCE/bin/jar ufvm $TARGET $VCS_JAVA
# tag:java-specific
macro _PACK_JAR_HELPER(Out) {
.CMD=${cwd;suf=/cls:BINDIR} ${env:"LC_ALL=en_US.UTF-8"} $JDK_RESOURCE/bin/jar cfvm $Out $VCS_JAVA .
}
# tag:java-specific
macro _JAVAC_RUN_HELPER(JAVAC_CMD_WITH_ARGS...) {
.CMD=${cwd:ARCADIA_BUILD_ROOT} ${env:"LC_ALL=en_US.UTF-8"} $YMAKE_PYTHON ${input:"build/scripts/with_pathsep_resolve.py"} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} --sources-list ${BINDIR}/all-java.srclst ${JAVAC_CMD_WITH_ARGS} @${BINDIR}/all-java.srclst -classpath ${ARCADIA_BUILD_ROOT}/bfg.jar -Xpkginfo:always ${JAVAC_OPTS} $_JAR_ANN_PROC_OPTS($_JAR_ANN_PROCESSORS) -d ${BINDIR}/cls -g -encoding UTF-8
}
macro _ADD_HIDDEN_INPUTS(Inputs...) {
.CMD=${input;hide:Inputs}
}
# tag:java-specific
ERROR_PRONE_JDK16_ADD_OPENS=-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
ERROR_PRONE_2_7_1_FORCED_OPTS=-Xep:InlineMeInliner:OFF -Xep:SameNameButDifferent:OFF
# tag:java-specific
macro _ADD_OPTS_IF_NON_EMPTY(Opt, Args...) {
.CMD=${pre=$Opt :Args}
}
macro _ADD_GEN_POM_FROM_COORD_FILES_ARGS(Deps...) {
.CMD=${pre=--deps-coords ;ext=.jar;suf=.mvn_coords:Deps}
}
MAVEN_EXPORT_OUT_DIR_FLAG=$_ADD_OPTS_IF_NON_EMPTY(--output-dir ${MAVEN_EXPORT_OUT_DIR})
MAVEN_EXPORT_SOURCE_DIRS=$_ADD_OPTS_IF_NON_EMPTY(--source-dirs ${ALL_SRCDIRS})
MAVEN_EXPORT_DEPS_COORS=$_ADD_GEN_POM_FROM_COORD_FILES_ARGS(${MANAGED_PEERS_CLOSURE})
MAVEN_EXPORT_OUT_DIR=
MAVEN_EXPORT=no
MAVEN_DEPLOY=no
MAVEN_DEPLOY_SOURCES=
MAVEN_EXPORT_VERSION={vcs_revision}
MAVEN_EXPORT_GEN_DEPLST= \
$WRITER_PY \
--file ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mvn_coords:REALPRJNAME} \
--ya-start-command-file -m ${pre=D=:MAVEN_EXPORT_COORDS_GLOBAL} ${pre=E=:EXCLUDED_MAVEN_EXPORT_COORDS_GLOBAL} --ya-end-command-file \
${hide:APPLIED_EXCLUDES}
MAVEN_EXPORT_GEN_POM=${kv;hide:"mvn_export yes"} \
$YMAKE_PYTHON ${input:"build/scripts/generate_pom.py"} \
--from-coord-files \
--vcs-info $(VCS)/vcs.json \
--target-path $MODDIR \
$MAVEN_EXPORT_SOURCE_DIRS \
$MAVEN_EXPORT_DEPS_COORS \
$MAVEN_EXPORT_OUT_DIR_FLAG \
--target-coords ${suf=.mvn_coords:TARGET} \
--pom-path ${output:"pom.xml"}
MAVEN_DEPLOY_CMD=$YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} $MAVEN_BIN \
deploy:deploy-file -DpomFile=$BINDIR/pom.xml \
-Dfile=$TARGET -DrepositoryId=$MAVEN_REPO_ID -Durl=$MAVEN_REPO_URL -Djava.net.preferIPv4Addresses=false -Djava.net.preferIPv6Addresses=true \
${MAVEN_DEPLOY_SOURCES} \
$_ADD_OPTS_IF_NON_EMPTY(-gs $MAVEN_EXPORT_SETTINGS) \
$_ADD_OPTS_IF_NON_EMPTY(-s $MAVEN_EXPORT_SETTINGS)
MAVEN_EXPORT_CMD=
# tag:java-specific
JAVA_COVERAGE_SRCLIST_FLAG=--coverage ${output;pre=${MODULE_PREFIX};suf=.cpsf:REALPRJNAME} --source-root ${ARCADIA_ROOT}
JAVA_COVERAGE_SRCLIST=
PREPARE_JAVA_BUILD_DIRS=$FS_TOOLS md ${BINDIR}/cls && $FS_TOOLS md ${BINDIR}/misc
EXTRACT_GENDIRS=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --unpack --ext .gentar ${ext=.gentar:AUTO_INPUT}
COLLECT_JAVA_SRCLIST=${YMAKE_PYTHON} ${input:"build/scripts/make_java_srclists.py"} ${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/java_pack_to_file.py"} --moddir ${CURDIR} --java ${BINDIR}/all-java.srclst ${KT_SRSCLIST} ${JAVA_COVERAGE_SRCLIST} --ya-start-command-file ${ALL_JAR_SOURCES} ${ext=.java:AUTO_INPUT} ${ext=.kt:AUTO_INPUT} --ya-end-command-file
COLLECT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/bfg.txt -m --ya-start-command-file ${rootrel:MANAGED_PEERS_CLOSURE} $KT_CLASSPATH_ITEM --ya-end-command-file
LINK_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/bfg.txt ${ARCADIA_BUILD_ROOT}/bfg.jar
COMPILE_JAVA_SRCLIST=$_JAVAC_RUN_HELPER($JAVAC_CMD)
PACK_JAR=$_PACK_JAR_HELPER($TARGET)
# NOTE: No && before LINK_JAR_RESOURCES, ALL_KT_COMMANDS and JAR_GEN_SRCS needed since those vars either empty or starts with &&
LINK_JAR=${hide:JAVA_FAKEID} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"} \
$PREPARE_JAVA_BUILD_DIRS \
&& $EXTRACT_GENDIRS \
&& $COLLECT_JAVA_SRCLIST \
$JAR_GEN_SRCS \
$ALL_KT_COMMANDS \
&& $COLLECT_CLASSPATH \
&& $LINK_CLASSPATH \
&& $COMPILE_JAVA_SRCLIST \
$LINK_JAR_RESOURCES \
&& ${cwd;suf=/cls:BINDIR} $GENERATE_VCS_JAVA_INFO_NODEP . \
$_PACK_SRC_JAR \
$_PACK_JNI \
&& $PACK_JAR \
$_DO_JAVA_YNDEXING \
$_MAKE_JSTYLE_FILE_LIST \
$_LINK_UBERJAR \
$MAVEN_EXPORT_CMD \
$_ADD_HIDDEN_INPUTS($JAVA_EXTERNAL_DEPENDENCIES_VALUE)
# tag:java-specific
_EXT_SRC_JAR=
_EXT_JAR=
_COPY_EXT_SRC_JAR= && $FS_TOOLS md ${BINDIR}/empty && ${cwd;suf=/empty:BINDIR} $JDK_RESOURCE/bin/jar cfvM ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME} .
_DO_USE_EXT_JAR=${hide:JAVA_FAKEID} $FS_TOOLS copy ${input:_EXT_JAR} $TARGET $_COPY_EXT_SRC_JAR $MAVEN_EXPORT_CMD
_DO_COPY_EXT_SRC_JAR= && $FS_TOOLS copy $_EXT_SRC_JAR ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
macro JAVA_RESOURCE(JAR, SOURCES="") {
SET(_EXT_SRC_JAR $SOURCES)
SET(_EXT_JAR $JAR)
}
# tag:java-specific tag:fbs
JAVA_FLATBUFFERS_VERSION = 2.0.0
# tag:java-specific
module _COMPILABLE_JAR_BASE : _JAR_BASE {
# flatbuffers-java
DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
# protobuf-java
DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
# protobuf-javalite
DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
# protobuf-java-util
DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java-util EXCEPT contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
}
_JAR_MAIN_CLASS=
macro JAR_MAIN_CLASS(Class) {
SET(_JAR_MAIN_CLASS ${Class})
}
_JAR_MAIN_SEM=
_ADD_JAR_MAIN_SEM= && app_main_class ${_JAR_MAIN_CLASS}
GRADLE_EXPORT_PUBLISHING=no
_GRADLE_EXPORT_PUBLISHING_SEM=
PUBLISH_MAVEN_VERSION=no
_DO_GRADLE_EXPORT_PUBLISHING_SEM= && publish True && publish_group $MAVEN_EXPORT_GOUP_ID && publish_version $PUBLISH_MAVEN_VERSION
BUILD_JAR_SEM= \
jar $MODDIR $REALPRJNAME ${hide:TARGET} ${hide:AUTO_INPUT} && \
applied_excludes $EXCLUDED_EXPORT_GRADLE_PROJECT_COORDS_GLOBAL ${hide:APPLIED_EXCLUDES} && \
excludes_rules $EXCLUDE_VALUE && \
consumer_classpath $EXPORT_GRADLE_PROJECT_COORDS $_JAR_MAIN_SEM $_GRADLE_EXPORT_PUBLISHING_SEM
### _EXPORT_GRADLE_TARGET_ATTR(NAME, VALUE...)
###
### Add target attribute `NAME` for .SEM if `VALUE` is non-empty
### ` && $Name $Value
macro _EXPORT_GRADLE_TARGET_ATTR(NAME, VALUE...) {
.SEM=${pre= && $NAME :VALUE}
}
BUILD_PROTO_JAR_SEM= \
jar_proto $MODDIR $REALPRJNAME ${hide:target} ${hide:AUTO_INPUT} && \
consumer_classpath $EXPORT_GRADLE_PROJECT_COORDS $_EXPORT_GRADLE_TARGET_ATTR(proto_namespace $PROTO_NAMESPACE) $_EXPORT_GRADLE_TARGET_ATTR(proto_grpc ${ext=yes:_GRPC_ENABLED})
# tag:java-specific tag:internal
### @usage: JAR_LIBRARY() #internal
###
### Reimplementation of the JAVA_LIBRARY with ymake.core.conf and ymake based dependency management
module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
.EXTS=.jsrc .java .jar .mf .gentar .kt
.CMD=LINK_JAR
.SEM=BUILD_JAR_SEM
.FINAL_TARGET=yes
.ALIASES=JAVA_SRCS=IDEA_JAR_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
.RESTRICTED=EXTERNAL_JAR
.GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS
MODULE_SUFFIX=.jar
PEERDIR(build/platform/java/jdk)
PEERDIR+=$JDK_RESOURCE_PEERDIR
when ($_EXT_SRC_JAR) {
_COPY_EXT_SRC_JAR=_DO_COPY_EXT_SRC_JAR
}
when ($_EXT_JAR) {
LINK_JAR=$_DO_USE_EXT_JAR
}
when ($OPENSOURCE_EXPORT == "no") {
BUILD_JAR_SEM=IGNORED
}
when ($_JAR_MAIN_CLASS) {
_JAR_MAIN_SEM=$_ADD_JAR_MAIN_SEM
}
when ($GRADLE_EXPORT_PUBLISHING == "yes") {
_GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
}
# in the ideal world this statement must be under condition bellow
DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
when ($WITH_KOTLIN_VALUE) {
KT_SRSCLIST=$KT_SRSCLIST_FLAG
_MAKE_LINT_KT_FILES_LIST = $YMAKE_PYTHON ${input:"build/scripts/kt_copy.py"} $KT_SRCLIST ${output;noauto:"all-kt-sources.txt"} $(SOURCE_ROOT) $(BUILD_ROOT)
ALL_KT_COMMANDS=&& $COLLECT_KT_CLASSPATH && $LINK_KT_CLASSPATH
when ($WITH_KAPT_VALUE == "yes") {
# For Kapt usage see: https://kotlinlang.org/docs/kapt.html#using-in-cli
# See for kapt.kotlin.generated: https://github.com/JetBrains/kotlin/blob/master/plugins/kapt3/kapt3-cli/testData/integration/kotlinFileGeneration/build.txt
_KAPT_OPTS=-Xplugin=${tool:"contrib/java/org/jetbrains/kotlin/kotlin-annotation-processing/1.8.20"} $KT_KAPT_PLUGIN_OPTS
_RUN_KAPT=${YMAKE_PYTHON} ${input:"build/scripts/with_kapt_args.py"} ${pre=--ap-classpath :KT_KAPT_AP_CLASSPATH} -- $COMPILE_KT $_KAPT_OPTS
_APPEND_KAPT_GENERATED_SRCS=$YMAKE_PYTHON ${input:"build/scripts/resolve_java_srcs.py"} -d $KT_KAPT_SOURCES_DIR --include-patterns '**/*.java' '**/*.kt' --resolve-kotlin --append -s ${BINDIR}/all-java.srclst -k $KT_SRCLIST -r ${BINDIR}/not-used.txt
ALL_KT_COMMANDS+=&& $_RUN_KAPT && $_APPEND_KAPT_GENERATED_SRCS
}
ALL_KT_COMMANDS+=&& $COMPILE_KT && $_MAKE_LINT_KT_FILES_LIST
LINK_JAR_RESOURCES+=&& $FS_TOOLS copy_all_files ${KT_CLASSES_DIR} ${BINDIR}/cls
PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
}
when($WITH_KOTLINC_PLUGIN_LOMBOK) {
KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-lombok-plugin.jar
}
when($WITH_KOTLINC_PLUGIN_NOARG) {
KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
}
when($WITH_KOTLINC_PLUGIN_SERIALIZATION) {
KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-serialization-plugin.jar
}
# Must be in sync with KT_CLASSES_DIR!
# There are problems in JDK13 with abs paths in classpath baked into jar file manifest. Using relative path
# here assumes that jar file with classpath for javac located in the $ARCADIA_BUILD_ROOT
KT_CLASSPATH_ITEM=$MODDIR/kt_cls
}
otherwise {
KT_SRSCLIST=
ALL_KT_COMMANDS=
KT_CLASSES=
}
when ($MAVEN_EXPORT == "yes") {
when ($MAVEN_DEPLOY == "yes") {
PEERDIR+=build/external_resources/maven
MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM && $MAVEN_DEPLOY_CMD
}
otherwise {
MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM
}
MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GOUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
}
when ($SOURCES_JAR == "yes") {
_PACK_SRC_JAR=$_PACK_SRC_JAR_IMPL
MAVEN_DEPLOY_SOURCES=-Dsources=${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
}
when ($JAVA_COVERAGE == "yes") {
JAVA_COVERAGE_SRCLIST=$JAVA_COVERAGE_SRCLIST_FLAG
}
when ($MAKE_UBERJAR_VALUE == "yes") {
_LINK_UBERJAR=$_DO_LINK_UBERJAR
PACK_JAR=$_PACK_JAR_HELPER(${BINDIR}/${REALPRJNAME}.lib.jar)
# TODO: This condition is incorrect in case of autoinputs _UBERJAR_SELF should be empty only for
# modules without AUTO_INPUT and without JAVA_SRCS added inputs.
when($ALL_JAR_SOURCES) {
_UBERJAR_SELF=--jar ${BINDIR}/${REALPRJNAME}.lib.jar
}
PEERDIR+=build/platform/java/uberjar
PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
}
when($JAVA_YNDEXING == "yes") {
PEERDIR+=build/platform/java/kythe
_DO_JAVA_YNDEXING=&& $_JAVAC_RUN_HELPER($_JAVA_YNDEXING_CMD) && ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} kindex.tar .kzip ${output;hide;tared:"kindex.tar"}
}
when($ERROR_PRONE_VALUE) {
PEERDIR+=$ERROR_PRONE_PEERDIR
JAVAC_CMD=$ERROR_PRONE_JAVAC_CMD
}
when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
}
when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "17") {
JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
}
when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "18") {
JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
}
when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "19") {
JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
}
when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "20") {
JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
}
when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
JAVAC_OPTS+=$ERROR_PRONE_2_7_1_FORCED_OPTS
}
when ($JAVA_ADD_DLLS_VALUE == "yes") {
CONSUME_NON_MANAGEABLE_PEERS=yes
_PACK_JNI=$_PACK_JNI_CMD
}
when ($LINT_LEVEL_VALUE != "none") {
_MAKE_JSTYLE_FILE_LIST= && ${WRITER_PY} --file ${output;noauto:"lint-java.srclst"} -m --ya-start-command-file $LINT_JAVA_SOURCES --ya-end-command-file
}
SET(MODULE_TYPE JAVA_LIBRARY)
ENABLE(YMAKE_JAVA_TEST)
_ADD_KOTLIN_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/all-kt-sources.txt REQUIREMENTS cpu:2)
_ADD_JAVA_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/lint-java.srclst::$(SOURCE_ROOT))
_ADD_CLASSPATH_CLASH_CHECK()
JAVA_MODULE()
}
# tag:java-specific
_SCRIPTGEN_FLAGS=
macro _GEN_JAVA_SCRIPT_IMPL(Out, Template, Props...) {
.CMD=$SCRIPTGEN_RESOURCE_GLOBAL/scriptgen --java $JDK_RESOURCE/bin/java --output ${output:Out} --template ${input:Template} ${_SCRIPTGEN_FLAGS} -D JAR_NAME=${REALPRJNAME}.jar -D CLASSPATH=${nopath;join;ext=.jar;pre="::":MANAGED_PEERS_CLOSURE} -D PROJECT_DIR=${MODDIR} -D JAR_BASENAME=${REALPRJNAME} $Props
}
# tag:java-specific
_GEN_USERSCRIPTS=
macro _ADD_GEN_JAVA_SCRIPT(Out, Template, Props...) {
SET_APPEND(_GEN_USERSCRIPTS && \$_GEN_JAVA_SCRIPT_IMPL($Out $Template $Props))
}
# tag:java-specific
_PACK_JDK=
# tag:java-specific
DO_GEN_JAVA_RUN_SH=
_SOURCE_JARS=
_SOURCE_JARS_CPLIST=
GEN_JAVA_RUN_SH=$SCRIPTGEN_RESOURCE_GLOBAL/scriptgen --java $JDK_RESOURCE/bin/java --output ${output:"run.sh"} -D GENERATE_DEFAULT_RUNNER=yes -D JAR_NAME=${REALPRJNAME}.jar -D CLASSPATH=${nopath;join;pre="::":MANAGED_PEERS_CLOSURE} -D PROJECT_DIR=${REALPRJNAME} -D JAR_BASENAME=${REALPRJNAME}
GEN_RUN_CP=${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${nopath;qe;pre=$REALPRJNAME/:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET}
COLLECT_JAR_PROGRAM_CP=$FS_TOOLS link_or_copy_to_dir --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} ${ext=.so:MANAGED_PEERS_CLOSURE} ${ext=.dll:MANAGED_PEERS_CLOSURE} ${ext=.dylib:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS} --ya-end-command-file ${BINDIR}/${REALPRJNAME} ${hide;late_out;nopath;ext=.jar;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE}
MAKE_JAR_PROGRAM_CPLST=${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} --ya-start-command-file ${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS_CPLIST} --ya-end-command-file
TAR_CLASSPATH= && $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} ${output;pre=$MODULE_PREFIX;suf=.tar:REALPRJNAME} ${cwd;pre=$BINDIR/:REALPRJNAME}
DO_TAR_CLASSPATH=
LINK_JAR_PROGRAM=${hide:JAVA_FAKEID} $FS_TOOLS md ${BINDIR}/${REALPRJNAME} && $COLLECT_JAR_PROGRAM_CP && $DO_GEN_JAVA_RUN_SH && $GEN_RUN_CP && $MAKE_JAR_PROGRAM_CPLST $DO_TAR_CLASSPATH $_GEN_USERSCRIPTS $_PACK_JDK ${kv;hide:"p JP"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
# tag:java-specific
# UBERJAR program link command
LINK_UBERJAR_PROGRAM=${hide:JAVA_FAKEID} ${kv;hide:"p UJ"} ${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} $TARGET \
&& $FS_TOOLS md ${BINDIR}/${REALPRJNAME} \
&& $FS_TOOLS link_or_copy ${BINDIR}/${REALPRJNAME}.jar $TARGET \
&& $FS_TOOLS link_or_copy_to_dir --ya-start-command-file ${BINDIR}/${REALPRJNAME}.jar ${ext=.so:MANAGED_PEERS_CLOSURE} ${ext=.dll:MANAGED_PEERS_CLOSURE} ${ext=.dylib:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS} --ya-end-command-file ${BINDIR}/${REALPRJNAME} ${hide;output;ext=.jar;pre=$BINDIR/$REALPRJNAME/:REALPRJNAME} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} \
$DO_TAR_CLASSPATH \
$_GEN_USERSCRIPTS \
$_PACK_JDK
# tag:java-specific
RUN_WITH_SOURCES=no
# TODO jbuild creates tar with all classpath deps by default and some projects rely on this. In ymake build this tar file creation is not needed and should be disabled by default in future
TARED_CLASSPATH=yes
_JAR_SRCS_CALLED=no
# tag:java-specific
macro _MARK_JAVA_PROG_WITH_SOURCES(Args...) {
ENABLE(_JAR_SRCS_CALLED)
}
# tag:java-specific
module _JAR_RUNNABLE: _COMPILABLE_JAR_BASE {
.FINAL_TARGET=yes
.CMD=LINK_JAR_PROGRAM
.SEM=IGNORED
.ALIASES=JAVA_SRCS=_MARK_JAVA_PROG_WITH_SOURCES GENERATE_SCRIPT=_YMAKE_GENERATE_SCRIPT
.ALLOWED=WITH_JDK
MODULE_SUFFIX=.run.cp.jar
CONSUME_NON_MANAGEABLE_PEERS=yes
when ($RUN_WITH_SOURCES == "yes") {
_SOURCE_JARS=${ext=.jar;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE} ${hide;late_out;ext=.jar;nopath;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
_SOURCE_JARS_CPLIST=${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
}
when ($TARED_CLASSPATH == "yes") {
DO_TAR_CLASSPATH=$TAR_CLASSPATH
}
when ($DISABLE_SCRIPTGEN) {
DO_GEN_JAVA_RUN_SH=
}
otherwise {
DO_GEN_JAVA_RUN_SH=$GEN_JAVA_RUN_SH
PEERDIR+=build/platform/java/scriptgen
}
when ($WITH_JDK_VALUE) {
_PACK_JDK= && ${YMAKE_PYTHON} ${input:"build/scripts/tar_directory.py"} ${output;tared:"jdk.tar"} $WITH_JDK_RESOURCE $WITH_JDK_RESOURCE
}
when ($MAKE_UBERJAR_VALUE == "yes") {
LINK_JAR_PROGRAM=$LINK_UBERJAR_PROGRAM
DYNAMIC_LINK=no
_SCRIPTGEN_FLAGS=-D IS_UBERJAR=yes
}
otherwise {
_SCRIPTGEN_FLAGS=-D IS_UBERJAR=no
}
CHECK_PROVIDES()
}
# tag:java-specific
multimodule JAR_PROGRAM {
module JAR_RUNNABLE: _JAR_RUNNABLE {
.ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
.IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
.ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
.PEERDIRSELF=JAR_COMPILATION
SET(MODULE_TYPE JAVA_PROGRAM)
}
module JAR_COMPILATION: JAR_LIBRARY {
.ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
.FINAL_TARGET=no
SET(MODULE_TYPE JAVA_PROGRAM)
}
}
# tag:java-specific
LINK_JAR_TEST=${hide:JAVA_FAKEID} ${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET} ${kv;hide:"p JT"}
YMAKE_JAVA_TEST=
module _JAR_TEST: _COMPILABLE_JAR_BASE {
.FINAL_TARGET=yes
.CMD=LINK_JAR_TEST
.DEFAULT_NAME_GENERATOR=FullPath
CONSUME_NON_MANAGEABLE_PEERS=yes
SET(MODULE_SUFFIX .test.cp.jar)
ENABLE(YMAKE_JAVA_TEST)
JAVA_TEST()
CHECK_PROVIDES()
}
# tag:python-specific tag:deprecated
### @usage: PY2_LIBRARY() # deprecated
###
### Deprecated. Use PY23_LIBRARY or PY3_LIBRARY instead.
### Python 2.x binary built library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM.
### Adds dependencies to Python 2.x runtime library from Arcadia.
### This module is only compatible with PYTHON2-tagged modules and selects those from multimodules.
### This module is only compatible with Arcadia Python build.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
module PY2_LIBRARY: _LIBRARY {
_ARCADIA_PYTHON_ADDINCL()
when ($NO_PYTHON_INCLS != "yes") {
PEERDIR+=contrib/libs/python
}
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_PREFIX=py
}
otherwise {
MODULE_PREFIX=libpy
}
.ALLOWED=FORK_TESTS
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
.RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS STYLE_PYTHON
USE_GLOBAL_CMD=yes
when ($PY_PROTO_MYPY_ENABLED == "yes") {
PY_PROTO_MYPY_SUFFIX=_pb2.pyi
PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
PY_PROTO_MYPY_PLUGIN_INTERNAL=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=__int___pb2.pyi:File} ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___pb2.pyi:File} ${nopath;noext;suf=_pb2.pyi:File}"})
}
SET(MODULE_LANG PY2)
ADD_CLANG_TIDY()
}
# tag:python-specific
### @usage: PY3_LIBRARY()
###
### Python 3.x binary library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM
### Adds dependencies to Python 2.x runtime library from Arcadia.
### This module is only compatible with PYTHON3-tagged modules and selects those from multimodules.
### This module is only compatible with Arcadia Python build.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
module PY3_LIBRARY: _LIBRARY {
_ARCADIA_PYTHON3_ADDINCL()
when ($NO_PYTHON_INCLS != "yes") {
PEERDIR+=contrib/libs/python
}
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_PREFIX=py
}
otherwise {
MODULE_PREFIX=libpy
}
.ALLOWED=FORK_TESTS
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
.RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2 OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
USE_GLOBAL_CMD=yes
RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON3 $CYTHON_SCRIPT
PYTHON_TYPE_FOR_CYTHON=PY3
ANTLR_PYTHON=Python3
when ($PY_PROTO_MYPY_ENABLED == "yes") {
PY_PROTO_MYPY_SUFFIX=_pb2.pyi
PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
PY_PROTO_MYPY_PLUGIN_INTERNAL=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=__int___pb2.pyi:File} ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___pb2.pyi:File} ${nopath;noext;suf=_pb2.pyi:File}"})
}
SET(MODULE_LANG PY3)
ADD_CLANG_TIDY()
}
# tag:python-specific
### @usage: _BASE_PY_PROGRAM #internal
###
### The base module for all Python 2.x binary programs. Adds linking logic, relevant module properties and
### dependency on Python 2.x interpreter. Also adds import tests on all sources including PEERDIR'ed libraries.
### Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
module _BASE_PY_PROGRAM: _BASE_PROGRAM {
.CMD=PY_PROGRAM_LINK_EXE
_ARCADIA_PYTHON_ADDINCL()
when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
NO_CHECK_IMPORTS_FOR_VALUE=
}
ADD_CHECK_PY_IMPORTS()
when ($NO_PYTHON_INCLS != "yes") {
PEERDIR += contrib/libs/python
}
when ($USE_ARCADIA_PYTHON == "yes") {
PEERDIR += library/python/runtime/main
PEERDIR += contrib/deprecated/python/subprocess32
when ($PYTHON_SQLITE3 != "no") {
PEERDIR += contrib/tools/python/src/Modules/_sqlite
}
}
when ($PYTHON_COVERAGE == "yes") {
PEERDIR+=library/python/coverage
}
when ($ARCH_PPC64LE == "yes") {
_MY_ALLOCATOR=SYSTEM
}
otherwise {
_MY_ALLOCATOR=J
}
ALLOCATOR($_MY_ALLOCATOR)
STRIP()
when ($BUILD_TYPE == "DEBUG") {
NO_STRIP=yes
}
when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
NO_STRIP=yes
}
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
.RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
SET(MODULE_LANG PY2)
}
# tag:python-specific tag:codenav
when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
PY3_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"py3yndex $TARGET"}
}
otherwise {
PY3_PROGRAM_LINK_EXE=$LINK_EXE
}
# tag:python-specific
### @usage: _BASE_PY_PROGRAM #internal
###
### The base module for all Python 3.x binary programs. Adds linking logic, relevant module properties and
### dependency on Python 3.x interpreter. Also adds import tests on all sources including libraries.
### Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
### This only compatible with PYTHON3-tagged modules and selects those from multimodules
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
module _BASE_PY3_PROGRAM: _BASE_PROGRAM {
.CMD=PY3_PROGRAM_LINK_EXE
_ARCADIA_PYTHON3_ADDINCL()
RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON3 $CYTHON_SCRIPT
PYTHON_TYPE_FOR_CYTHON=PY3
PEERDIR(library/python/runtime_py3/main)
when ($PYTHON_SQLITE3 != "no") {
PEERDIR += contrib/tools/python3/src/Modules/_sqlite
}
when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
NO_CHECK_IMPORTS_FOR_VALUE=
}
ADD_CHECK_PY_IMPORTS()
when ($ARCH_PPC64LE == "yes") {
_MY_ALLOCATOR=SYSTEM
}
otherwise {
_MY_ALLOCATOR=J
}
ALLOCATOR($_MY_ALLOCATOR)
STRIP()
when ($NO_PYTHON_INCLS != "yes") {
PEERDIR+=contrib/libs/python
}
when ($BUILD_TYPE == "DEBUG") {
NO_STRIP=yes
}
when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
NO_STRIP=yes
}
when ($PYTHON_COVERAGE == "yes") {
PEERDIR+=library/python/coverage
}
when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
PEERDIR += contrib/python/six
}
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
.RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2
SET(MODULE_LANG PY3)
SET(ANTLR_PYTHON Python3)
}
# tag:python-specific
### @usage: PY3_PROGRAM_BIN([progname])
### Use instead of PY3_PROGRAM only if ya.make with PY3_PROGRAM() included in another ya.make
### In all other cases use PY3_PROGRAM
module PY3_PROGRAM_BIN: _BASE_PY3_PROGRAM {
# Look's like we cannot avoid copy-paste util ymake supports multiple inheritance
# We need to attach coverage.extractor to every py_program target, except pytest targets
ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
}
# tag:java-specific
JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
# tag:java-specific
JDK_REAL_VERSION=
JDK_VERSION=
when ($JDK_VERSION == "20") {
JDK_REAL_VERSION=20
}
elsewhen ($JDK_VERSION == "19") {
JDK_REAL_VERSION=19
}
elsewhen ($JDK_VERSION == "18") {
JDK_REAL_VERSION=18
}
elsewhen ($JDK_VERSION == "17") {
JDK_REAL_VERSION=17
}
elsewhen ($JDK_VERSION == "16") {
JDK_REAL_VERSION=16
}
elsewhen ($JDK_VERSION == "15") {
JDK_REAL_VERSION=15
}
elsewhen ($JDK_VERSION == "11") {
JDK_REAL_VERSION=11
}
elsewhen ($JDK_VERSION == "10") {
JDK_REAL_VERSION=10
}
elsewhen ($JDK_VERSION == "8") {
JDK_REAL_VERSION=8
}
elsewhen ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
JDK_REAL_VERSION=11
}
otherwise {
JDK_REAL_VERSION=17
}
# tag:java-specific
# remove extra peerdir to jdk11 after https://st.yandex-team.ru/DEVTOOLS-8851 is done
when ($USE_SYSTEM_JDK) {
JDK_RESOURCE_PEERDIR=
}
otherwise {
when ($JDK_REAL_VERSION == "20") {
JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk20 build/platform/java/jdk/jdk17
}
when ($JDK_REAL_VERSION == "19") {
JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk19 build/platform/java/jdk/jdk17
}
when ($JDK_REAL_VERSION == "18") {
JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk18 build/platform/java/jdk/jdk17
}
when ($JDK_REAL_VERSION == "17") {
# need jdk11 for spare parts in "host" platform
JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk17 build/platform/java/jdk/jdk11
}
when ($JDK_REAL_VERSION == "16") {
JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk16 build/platform/java/jdk/jdk17
}
when ($JDK_REAL_VERSION == "15") {
JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk15 build/platform/java/jdk/jdk17
}
when ($JDK_REAL_VERSION == "11") {
JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk11 build/platform/java/jdk/jdk17
}
when ($JDK_REAL_VERSION == "10") {
JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk10 build/platform/java/jdk/jdk17
}
when ($JDK_REAL_VERSION == "8") {
JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk8 build/platform/java/jdk/jdk17
}
}
# tag:java-specific
when ($JDK_REAL_VERSION == "20") {
UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar20
}
when ($JDK_REAL_VERSION == "19") {
UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
}
when ($JDK_REAL_VERSION == "18") {
UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
}
when ($JDK_REAL_VERSION == "17") {
UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar17
}
when ($JDK_REAL_VERSION == "16") {
UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar16
}
when ($JDK_REAL_VERSION == "15") {
UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar15
}
when ($JDK_REAL_VERSION == "11") {
UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar11
}
when ($JDK_REAL_VERSION == "10") {
UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar10
}
when ($JDK_REAL_VERSION == "8") {
UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar8
}
# tag:java-specific
JAVAC_OPTS=
when ($USE_SYSTEM_JDK) {
JDK_RESOURCE=$USE_SYSTEM_JDK
}
otherwise {
when ($JDK_REAL_VERSION == "20") {
JDK_RESOURCE=$JDK20_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "19") {
JDK_RESOURCE=$JDK19_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "18") {
JDK_RESOURCE=$JDK18_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "17") {
JDK_RESOURCE=$JDK17_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "16") {
JDK_RESOURCE=$JDK16_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "15") {
JDK_RESOURCE=$JDK15_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "11") {
JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "10") {
JDK_RESOURCE=$JDK10_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "8") {
JDK_RESOURCE=$JDK8_RESOURCE_GLOBAL
}
}
# tag:java-specific
when (!$USE_SYSTEM_ERROR_PRONE) {
# Still not done: DTCC-667
when ($JDK_REAL_VERSION == "8" || $JDK_REAL_VERSION == "10") {
ERROR_PRONE_VERSION=2.3.1
ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.3.1
ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_3_1_RESOURCE_GLOBAL
}
elsewhen ($JDK_REAL_VERSION == "11" || $JDK_REAL_VERSION == "15" || $JDK_REAL_VERSION == "16") {
ERROR_PRONE_VERSION=2.7.1
ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.7.1
ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_7_1_RESOURCE_GLOBAL
}
elsewhen ($JDK_REAL_VERSION == "17") {
ERROR_PRONE_VERSION=2.10.0
ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.10.0
ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_10_0_RESOURCE_GLOBAL
}
elsewhen ($JDK_REAL_VERSION == "18") {
ERROR_PRONE_VERSION=2.14.0
ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.14.0
ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_14_0_RESOURCE_GLOBAL
}
elsewhen ($JDK_REAL_VERSION == "19") {
ERROR_PRONE_VERSION=2.18.0
ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
}
elsewhen ($JDK_REAL_VERSION == "20") {
ERROR_PRONE_VERSION=2.18.0
ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
}
otherwise {
ERROR_PRONE_VERSION=2.7.1
ERROR_PRONE_PEERDIR=build/platform/java/error_prone
ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
}
}
otherwise {
ERROR_PRONE_VERSION=2.7.1
ERROR_PRONE_PEERDIR=build/platform/java/error_prone
ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
}
# tag:java-specific
when ($USE_SYSTEM_UBERJAR) {
UBERJAR_RESOURCE=$USE_SYSTEM_UBERJAR
}
otherwise {
when ($JDK_REAL_VERSION == "20") {
UBERJAR_RESOURCE=$UBERJAR20_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "19") {
UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "18") {
UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "17") {
UBERJAR_RESOURCE=$UBERJAR17_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "16") {
UBERJAR_RESOURCE=$UBERJAR16_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "15") {
UBERJAR_RESOURCE=$UBERJAR15_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "11") {
UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "10") {
UBERJAR_RESOURCE=$UBERJAR10_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "8") {
UBERJAR_RESOURCE=$UBERJAR8_RESOURCE_GLOBAL
}
}
# tag:java-specific
when ($JDK_REAL_VERSION == "20") {
WITH_JDK_RESOURCE=$WITH_JDK20_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "19") {
WITH_JDK_RESOURCE=$WITH_JDK19_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "18") {
WITH_JDK_RESOURCE=$WITH_JDK18_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "17") {
WITH_JDK_RESOURCE=$WITH_JDK17_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "16") {
WITH_JDK_RESOURCE=$WITH_JDK16_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "15") {
WITH_JDK_RESOURCE=$WITH_JDK15_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "11") {
WITH_JDK_RESOURCE=$WITH_JDK11_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "10") {
WITH_JDK_RESOURCE=$WITH_JDK10_RESOURCE_GLOBAL
}
when ($JDK_REAL_VERSION == "8") {
WITH_JDK_RESOURCE=$WITH_JDK8_RESOURCE_GLOBAL
}
# tag:java-specific
EXTERNAL_JAVA_JDK_RESOURCE=
EXTERNAL_JAVA_EXTRA_PEERDIR=
when ($USE_SYSTEM_JDK) {
EXTERNAL_JAVA_EXTRA_PEERDIR=
EXTERNAL_JAVA_JDK_RESOURCE=$USE_SYSTEM_JDK
}
elsewhen ($JDK_VERSION == "") {
EXTERNAL_JAVA_JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
EXTERNAL_JAVA_EXTRA_PEERDIR=build/platform/java/jdk/jdk11
}
otherwise {
EXTERNAL_JAVA_JDK_RESOURCE=$JDK_RESOURCE
}
COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_java.py"} --java-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/java --javac-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/jar --kotlin-compiler $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar $JAVA_VCS_MF_ARG $PACKAGE_PREFIX_ARGS --jar-output $TARGET --srcs-jar-output ${output;suf=-sources.jar:REALPRJNAME} $AUTO_INPUT DELIM $JAVAC_OPTS DELIM $MANAGED_PEERS_CLOSURE DELIM -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} ${KOTLINC_OPTS_VALUE} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"}
ARGS_DELIM="MACRO_CALLS_DELIM"
SYSTEM_PROPERTIES_VALUE=
### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
###
### List of Key,Value pairs that will be available to test via System.getProperty().
### FILE means that parst should be read from file specifies as Path.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/
macro SYSTEM_PROPERTIES(Args...) {
SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
}
# tag:java-specific
JVM_ARGS_VALUE=
### @usage: JVM_ARGS(Args...)
###
### Arguments to run Java programs in tests.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/
macro JVM_ARGS(Args...) {
SET_APPEND(JVM_ARGS_VALUE $Args)
}
# tag:java-specific
CHECK_JAVA_DEPS_VALUE=
### @usage: CHECK_JAVA_DEPS(<yes|no>)
###
### Check for different classes with duplicate name in classpath.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/
macro CHECK_JAVA_DEPS(Arg) {
SET(CHECK_JAVA_DEPS_VALUE $Arg)
}
ERROR_PRONE_VALUE=
### @usage: USE_ERROR_PRONE()
###
### Use errorprone instead of javac for .java compilation.
macro USE_ERROR_PRONE() {
SET(ERROR_PRONE_VALUE yes)
}
TEST_CWD_VALUE=
### @usage: TEST_CWD(path)
###
### Defines working directory for test runs. Often used in conjunction with DATA() macro.
### Is only used inside of the TEST modules.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/
macro TEST_CWD(Arg) {
SET(TEST_CWD_VALUE $Arg)
}
# tag:java-specific
MAKE_UBERJAR_VALUE=
### @usage: UBERJAR()
###
### UBERJAR is a single all-in-one jar-archive that includes all its Java dependencies (reachable PEERDIR).
### It also supports shading classes inside the archive by moving them to a different package (similar to the maven-shade-plugin).
### Use UBERJAR inside JAVA_PROGRAM module.
###
### You can use the following macros to configure the archive:
### 1. UBERJAR_HIDING_PREFIX prefix for classes to shade (classes remain in their packages by default)
### 2. UBERJAR_HIDE_EXCLUDE_PATTERN exclude classes matching this patterns from shading (if enabled).
### 3. UBERJAR_PATH_EXCLUDE_PREFIX the prefix for classes that should not get into the jar archive (all classes are placed into the archive by default)
### 4. UBERJAR_MANIFEST_TRANSFORMER_MAIN add ManifestResourceTransformer class to uberjar processing and specify main-class
### 5. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE add ManifestResourceTransformer class to uberjar processing and specify some attribute
### 6. UBERJAR_APPENDING_TRANSFORMER add AppendingTransformer class to uberjar processing
### 7. UBERJAR_SERVICES_RESOURCE_TRANSFORMER add ServicesResourceTransformer class to uberjar processing
###
### Documentation: https://wiki.yandex-team.ru/yatool/java/
###
### @see: [JAVA_PROGRAM](#module_JAVA_PROGRAM), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX), [UBERJAR_HIDE_EXCLUDE_PATTERN](#macro_UBERJAR_HIDE_EXCLUDE_PATTERN), [UBERJAR_PATH_EXCLUDE_PREFIX](#macro_UBERJAR_PATH_EXCLUDE_PREFIX)
macro UBERJAR() {
SET(MAKE_UBERJAR_VALUE yes)
DISABLE(PASS_PEERS)
}
# tag:java-specific
UBERJAR_PREFIX_VALUE=
UBERJAR_PREFIX_FLAG=
### @usage: UBERJAR_HIDING_PREFIX(Arg)
###
### Set prefix for classes to shade. All classes in UBERJAR will be moved into package prefixed with Arg.
### Classes remain in their packages by default.
###
### @see: [UBERJAR](#macro_UBERJAR)
macro UBERJAR_HIDING_PREFIX(Arg) {
SET(UBERJAR_PREFIX_VALUE $Arg)
SET(UBERJAR_PREFIX_FLAG ${pre=--shade-prefix :Arg})
}
# tag:java-specific
UBERJAR_HIDE_EXCLUDE_VALUE=
UBERJAR_HIDE_EXCLUDE_FLAGS=
### @usage: UBERJAR_HIDE_EXCLUDE_PATTERN(Args...)
###
### Exclude classes matching this patterns from shading (if enabled).
### Pattern may contain '*' and '**' globs.
### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
###
### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
macro UBERJAR_HIDE_EXCLUDE_PATTERN(Args...) {
SET_APPEND(UBERJAR_HIDE_EXCLUDE_VALUE $ARGS_DELIM $Args)
SET_APPEND(UBERJAR_HIDE_EXCLUDE_FLAGS ${pre=--shade-exclude :Args})
}
# tag:java-specific
UBERJAR_PATH_EXCLUDES=
UBERJAR_PATH_EXCLUDE_VALUE=
### @usage: UBERJAR_PATH_EXCLUDE_PREFIX(Args...)
###
### Exclude classes matching this patterns from UBERJAR.
### By default all dependencies of UBERJAR program will lend in a .jar archive.
###
### @see: [UBERJAR](#macro_UBERJAR)
macro UBERJAR_PATH_EXCLUDE_PREFIX(Args...) {
SET_APPEND(UBERJAR_PATH_EXCLUDE_VALUE $ARGS_DELIM $Args)
SET_APPEND(UBERJAR_PATH_EXCLUDES ${pre=--uber-exclude :Args})
}
# tag:java-specific
UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE=
UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG=
### @usage: UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main)
###
### Transform manifest.mf for UBERJAR() java programs, set main-class attribute
###
### @see: [UBERJAR](#macro_UBERJAR)
macro UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main) {
SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE $Main)
SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG --manifest-main $Main)
}
# tag:java-specific
UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE=
UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS=
### @usage: UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value)
###
### Transform manifest.mf for UBERJAR() java programs, set attribute
###
### @see: [UBERJAR](#macro_UBERJAR)
macro UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value) {
SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Value)
SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:${Value})
}
# tag:java-specific
UBERJAR_APPENDING_TRANSFORMER_VALUE=
UBERJAR_APPENDING_TRANSFORMER_FLAGS=
### @usage: UBERJAR_APPENDING_TRANSFORMER(Resource)
###
### Add AppendingTransformer for UBERJAR() java programs
###
### Parameters:
### - Resource - Resource name
###
### @see: [UBERJAR](#macro_UBERJAR)
macro UBERJAR_APPENDING_TRANSFORMER(Resources...) {
SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_VALUE $ARGS_DELIM $Resources)
SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_FLAGS ${pre=--append-transformer :Resources})
}
# tag:java-specific
UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE=
UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG=
### @usage: UBERJAR_SERVICES_RESOURCE_TRANSFORMER()
###
### Add ServicesResourceTransformer for UBERJAR() java programs
###
### @see: [UBERJAR](#macro_UBERJAR)
macro UBERJAR_SERVICES_RESOURCE_TRANSFORMER() {
SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE yes)
SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG --service-transformer)
}
# tag:idea-specific
IDEA_EXCLUDE_DIRS_VALUE=
### @usage: IDEA_EXCLUDE_DIRS(<excluded dirs>)
###
### Exclude specified directories from an idea project generated by ya ide idea
### Have no effect on regular build.
macro IDEA_EXCLUDE_DIRS(Args...) {
SET_APPEND(IDEA_EXCLUDE_DIRS_VALUE $Args)
}
# tag:idea-specific
IDEA_RESOURCE_DIRS_VALUE=
### @usage: IDEA_RESOURCE_DIRS(<additional dirs>)
###
### Set specified resource directories in an idea project generated by ya ide idea
### Have no effect on regular build.
macro IDEA_RESOURCE_DIRS(Args...) {
SET_APPEND(IDEA_RESOURCE_DIRS_VALUE $Args)
}
# tag:idea-specific
IDEA_MODULE_NAME_VALUE=
### @usage: IDEA_MODULE_NAME(module_name)
###
### Set module name in an idea project generated by ya ide idea
### Have no effect on regular build.
macro IDEA_MODULE_NAME(Name) {
SET(IDEA_MODULE_NAME_VALUE $Name)
}
# tag:java-specific
JAVAC_FLAGS_VALUE=
### @usage: JAVAC_FLAGS(Args...)
###
### Set additional Java compilation flags.
macro JAVAC_FLAGS(Args...) {
SET_APPEND(JAVAC_OPTS $Args)
SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
}
# tag:java-specific
ENABLE_PREVIEW_VALUE=
### @usage: ENABLE_PREVIEW()
###
### Enable java preview features.
macro ENABLE_PREVIEW() {
SET_APPEND(JVM_ARGS_VALUE --enable-preview)
SET_APPEND(JAVAC_OPTS --enable-preview --release $JDK_REAL_VERSION)
SET_APPEND(JAVAC_FLAGS_VALUE --enable-preview --release $JDK_REAL_VERSION)
SET(ENABLE_PREVIEW_VALUE yes)
}
# tag:java-specific
SAVE_JAVAC_GENERATED_SRCS=
SAVE_JAVAC_GENERATED_SRCS_DIR=
SAVE_JAVAC_GENERATED_SRCS_TAR=
when ($SAVE_JAVAC_GENERATED_SRCS) {
SAVE_JAVAC_GENERATED_SRCS_DIR=${BINDIR}/__javac_generated_srcs__
SAVE_JAVAC_GENERATED_SRCS_TAR=${BINDIR}/javac_generated.tar
JAVAC_FLAGS_VALUE+=-s $SAVE_JAVAC_GENERATED_SRCS_DIR
}
# tag:java-specific
# TODO: MAVEN_GROUP_ID_VALUE is only used by jbuild remove it after YMAKE-45 and YMAKE-46
MAVEN_GROUP_ID_VALUE=
MAVEN_EXPORT_GOUP_ID=ru.yandex
### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
###
### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
### Have no effect on regular build.
macro MAVEN_GROUP_ID(Arg, VERSION="no") {
SET(MAVEN_GROUP_ID_VALUE $Arg)
SET(MAVEN_EXPORT_GOUP_ID $Arg)
SET(PUBLISH_MAVEN_VERSION $VERSION)
}
# tag:java-specific
ANNOTATION_PROCESSOR_VALUE=
### @usage: ANNOTATION_PROCESSOR(processors...)
###
### The macro is in development.
### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
macro ANNOTATION_PROCESSOR(Args...) {
SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Args)
}
EXCLUDE_VALUE=
### EXCLUDE(prefixes)
###
### The macro is in development.
### Specifies which libraries should be excluded from the classpath.
macro EXCLUDE(Args...) {
SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args)
}
# tag:java-specific
JAVA_SRCS_VALUE=
### @usage: JAVA_SRCS(srcs)
###
### Specify java source files and resources. A macro can be contained in any of four java modules.
### Keywords:
### 1. X SRCDIR - specify the directory x is performed relatively to search the source code for these patterns. If there is no SRCDIR, the source will be searched relative to the module directory.
### 2. PACKAGE_PREFIX x - use if source paths relative to the SRCDIR does not coincide with the full class names. For example, if all sources of module are in the same package, you can create a directory package/name , and just put the source code in the SRCDIR and specify PACKAGE_PREFIX package.name.
###
### @example:
### - example/ya.make
###
### JAVA_PROGRAM()
### JAVA_SRCS(SRCDIR src/main/java **/*)
### END()
###
### - example/src/main/java/ru/yandex/example/HelloWorld.java
###
### package ru.yandex.example;
### public class HelloWorld {
### public static void main(String[] args) {
### System.out.println("Hello, World!");
### }
### }
###
### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
macro JAVA_SRCS(Args...) {
SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
}
# tag:java-specific
JAVA_ADD_DLLS_VALUE=no
macro ADD_DLLS_TO_JAR() {
SET(JAVA_ADD_DLLS_VALUE yes)
}
# tag:java-specific
MANAGED_PEERS=
MANAGED_PEERS_CLOSURE=
RUN_JAVA_PROGRAM_MANAGED=
MANAGEABLE_PEERS_ROOTS=contrib/java
HAS_MANAGEABLE_PEERS=no
PROPAGATES_MANAGEABLE_PEERS=no
# All items of this list must be PEERS, GHOST PEERS or TOOLS of the test module or module itself.
# All items of this list must has at least one of HAS_MANAGEABLE_PEERS or PROPAGATES_MANAGEABLE_PEERS flags set yes.
# This variable is used by JUnit tests but not TestNG.
TEST_CLASSPATH_VALUE=
# Calculated and replaced by ymake can be used in DART DATA
TEST_CLASSPATH_MANAGED=
# tag:java-specific
DEPENDENCY_MANAGEMENT_VALUE=
### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
###
### Lock version of the library from the contrib/java at some point, so that all unversioned PEERDIRs to this library refer to the specified version.
###
### For example, if the module has PEERDIR (contrib/java/junit/junit), and
### 1. specifies DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12),
### the PEERDIR is automatically replaced by contrib/java/junit/junit/4.12;
### 2. doesn't specify DEPENDENCY_MANAGEMENT, PEERDIR automatically replaced
### with the default from contrib/java/junit/junit/ya.make.
### These defaults are always there and are supported by maven-import, which puts
### there the maximum version available in contrib/java.
###
### The property is transitive. That is, if module A PEERDIRs module B, and B has PEERDIR(contrib/java/junit/junit), and this junit was replaced by junit-4.12, then junit-4.12 will come to A through B.
###
### If some module has both DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12) and PERDIR(contrib/java/junit/junit/4.11), the PEERDIR wins.
###
### Documentation: https://wiki.yandex-team.ru/yatool/java/
macro DEPENDENCY_MANAGEMENT(Args...) {
SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
_GHOST_PEERDIR($Args)
}
# tag:java-specific
WITH_JDK_VALUE=
### @usage: WITH_JDK()
###
### Add directory with JDK to JAVA_PROGRAM output
macro WITH_JDK() {
SET(WITH_JDK_VALUE yes)
}
# tag:kotlin-specific
WITH_KOTLIN_VALUE=
### @usage: WITH_KOTLIN()
###
### Compile kotlin source code in this java module
macro WITH_KOTLIN() {
SET(WITH_KOTLIN_VALUE yes)
}
# tag:kotlin-specific
WITH_KAPT_VALUE=
### @usage: WITH_KAPT()
###
### Use kapt for as annotation processor
macro WITH_KAPT() {
SET(WITH_KAPT_VALUE yes)
}
# tag:java-specific
WITH_GROOVY_VALUE=
### @usage: WITH_GROOVY()
###
### Compile groovy source code in this java module
macro WITH_GROOVY() {
SET(WITH_GROOVY_VALUE yes)
}
# tag:kotlin-specific
KOTLINC_FLAGS_VALUE=-Xjvm-default=all
### @usage: KOTLINC_FLAGS(-flags)
###
### Set additional Kotlin compilation flags.
macro KOTLINC_FLAGS(Args...) {
SET_APPEND(KOTLINC_OPTS_VALUE $Args)
}
# tag:kotlin-sppecific
WITH_KOTLINC_PLUGIN_ALLOPEN=
macro _WITH_KOTLINC_ALLOPEN(Options...) {
SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.allopen\::Options})
SET(WITH_KOTLINC_PLUGIN_ALLOPEN yes)
}
# tag:kotlin-specific
### @usage: WITH_KOTLINC_ALLOPEN(-flags)
###
### Enable allopen kotlin compiler plugin https://kotlinlang.org/docs/all-open-plugin.html
macro WITH_KOTLINC_ALLOPEN(HEAD, TAIL...) {
_WITH_KOTLINC_ALLOPEN($HEAD $TAIL)
}
# tag:kotlin-specific
WITH_KOTLINC_PLUGIN_LOMBOK=
### @usage: WITH_KOTLINC_LOMBOK(-flags)
###
### Enable lombok kotlin compiler plugin https://kotlinlang.org/docs/lombok.html
macro WITH_KOTLINC_LOMBOK(Options...) {
SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.lombok\::Options})
SET(WITH_KOTLINC_PLUGIN_LOMBOK yes)
}
# tag:kotlin-specific
WITH_KOTLINC_PLUGIN_NOARG=
### @usage: WITH_KOTLINC_NOARG(-flags)
###
### Enable noarg kotlin compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html
macro WITH_KOTLINC_NOARG(Options...) {
SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.noarg\::Options})
SET(WITH_KOTLINC_PLUGIN_NOARG yes)
}
# tag:kotlin-specific
WITH_KOTLINC_PLUGIN_SERIALIZATION=
### @usage: WITH_KOTLINC_SERIALIZATION()
###
### Enable serialization kotlin compiler plugin https://kotlinlang.org/docs/serialization.html
macro WITH_KOTLINC_SERIALIZATION() {
SET(WITH_KOTLINC_PLUGIN_SERIALIZATION yes)
}
# tag:kotlin-specific
### Also search for _KAPT_OPTS and change version there
KOTLIN_VERSION=1.8.20
KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.8.20/ya.dependency_management.inc
GROOVY_VERSION=3.0.5
# tag:java-specific
DIRECT_DEPS_ONLY_VALUE=
### @usage: DIRECT_DEPS_ONLY
###
### Add direct PEERDIR's only in java compile classpath
macro DIRECT_DEPS_ONLY() {
SET(DIRECT_DEPS_ONLY_VALUE yes)
}
# tag:java-specific
JAVA_EXTERNAL_DEPENDENCIES_VALUE=
### @usage: JAVA_EXTERNAL_DEPENDENCIES(file1 file2 ...)
###
### Add non-source java external build dependency (like lombok config file)
macro JAVA_EXTERNAL_DEPENDENCIES(Args...) {
SET_APPEND(JAVA_EXTERNAL_DEPENDENCIES_VALUE $Args)
}
# tag:java-specific
JAVA_CLASSPATH_CMD_TYPE_VALUE=
# tag:java-specific
### @usage:TEST_JAVA_CLASSPATH_CMD_TYPE(Type)
### Available types: MANIFEST(default), COMMAND_FILE, LIST
### Method for passing a classpath value to a java command line
### MANIFEST via empty jar file with manifest that contains Class-Path attribute
### COMMAND_FILE via @command_file
### LIST via flat args
macro TEST_JAVA_CLASSPATH_CMD_TYPE(Type) {
SET(JAVA_CLASSPATH_CMD_TYPE_VALUE $Type)
}
# tag:java-specific
IGNORE_JAVA_DEPENDENCIES_CONFIGURATION=no
JAVA_DEPENDENCIES_CONFIGURATION_VALUE=
# tag:java-specific
### @usage JAVA_DEPENDENCIES_CONFIGURATION(Vetos...)
### Validate contrib/java dependencies
### Valid arguments
### FORBID_DIRECT_PEERDIRS - fail when module have direct PEERDIR (with version) (non-transitive)
### FORBID_CONFLICT - fail when module have resolved without DEPENDENCY_MANAGEMENT version conflict (transitive)
### FORBID_CONFLICT_DM - fail when module have resolved with DEPENDENCY_MANAGEMENT version conflict (transitive)
### FORBID_CONFLICT_DM_RECENT - like FORBID_CONFLICT_DM but fail only when dependency have more recent version than specified in DEPENDENCY_MANAGEMENT
### REQUIRE_DM - all dependencies must be specified in DEPENDENCY_MANAGEMENT (transitive)
macro JAVA_DEPENDENCIES_CONFIGURATION(Args...) {
SET_APPEND(JAVA_DEPENDENCIES_CONFIGURATION_VALUE $Args)
}
# tag:java-specific
# TODO(DEVTOOLS-6901): remove this variable when there are no more references to it in jbuild
JAVA_FORBIDDEN_LIBRARIES_VALUE=
# tag:java-specific
JAR_INCLUDE_FILTER_VALUE=
JAR_EXCLUDE_FILTER_VALUE=
# tag:java-specific
### @usage:JAR_INCLUDE(Filters...)
### Filter .jar file content: keep only matched files
### * and ** patterns are supported (like JAVA_SRCS)
macro JAR_INCLUDE(Filters...) {
SET_APPEND(JAR_INCLUDE_FILTER_VALUE $Filters)
}
# tag:java-specific
### @usage:JAR_EXCLUDE(Filters...)
### Filter .jar file content: remove matched files
### * and ** patterns are supported (like JAVA_SRCS)
macro JAR_EXCLUDE(Filters...) {
SET_APPEND(JAR_EXCLUDE_FILTER_VALUE $Filters)
}
# tag:sandbox-specific
### @usage: SANDBOX_TASK([Name])
###
### Multimodule describing Sandbox task (Python code that can be executed by Sandbox system).
###
### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_TASKs as libraries.
### The final artifact is provided when SANDBOX_TASK is referred to by DEPENDS and BUNDLE macros.
### As PEERDIR target, it works like regular PY2_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_TASKs.
###
### Currently Sandbox supports only Python 2.x, so both variants will be compatible only with Python 2.x modules
### and will select multimodule variants accordingly.
###
### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
multimodule SANDBOX_TASK {
module SB_TASK_BIN: _PY2_PROGRAM {
PY_MAIN(sandbox.taskbox.binary)
PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
REGISTER_SANDBOX_IMPORT(${MODDIR})
when ($FAIL_PY2 == "yes") {
_OK=no
}
elsewhen ($OPENSOURCE != "yes") {
PEERDIR+=build/rules/py2_deprecation
}
ASSERT(_OK You are using deprecated Python2-only code (SANDBOX_TASK). Please consider rewriting to 2/3-compatible code.)
}
module PY2: PY2_LIBRARY {
PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
REGISTER_SANDBOX_IMPORT(${MODDIR})
}
}
# tag:sandbox-specific
multimodule SANDBOX_PY23_TASK {
module SB_TASK_BIN: _PY2_PROGRAM {
.RESTRICTED=RUN_ANTLR4_PYTHON
PY_MAIN(sandbox.taskbox.binary)
PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
REGISTER_SANDBOX_IMPORT(${MODDIR})
}
module PY2: PY2_LIBRARY {
.RESTRICTED=RUN_ANTLR4_PYTHON
PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
REGISTER_SANDBOX_IMPORT(${MODDIR})
OBJ_SUF=.py2
}
module PY3: PY3_LIBRARY {
.RESTRICTED=RUN_ANTLR4_PYTHON
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_PREFIX=py3
}
otherwise {
MODULE_PREFIX=libpy3
}
OBJ_SUF=.py3
RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
PEERDIR(sandbox/sdk2)
REGISTER_SANDBOX_IMPORT(${MODDIR})
}
}
# tag:sandbox-specific
### @usage: SANDBOX_PY3_TASK([Name])
###
### Multimodule describing Sandbox task (Python3 code that can be executed by Sandbox system).
###
### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_PY3_TASKs as libraries.
### The final artifact is provided when SANDBOX_PY3_TASK is referred to by DEPENDS and BUNDLE macros.
### As PEERDIR target, it works like regular PY3_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_PY3_TASKs.
###
### Currently Sandbox supports Python 3.x only in binary tasks, both variants will be compatible only with Python 3.x and py23 libraries
### and will select multimodule variants accordingly.
###
### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
multimodule SANDBOX_PY3_TASK {
module SB_TASK_BIN: PY3_PROGRAM_BIN {
.IGNORED=RUN_ANTLR4_PYTHON
PY_MAIN(sandbox.taskbox.binary)
PEERDIR(sandbox/bin sandbox/sdk2 sandbox/taskbox/worker)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
REGISTER_SANDBOX_IMPORT(${MODDIR})
}
module PY3: PY3_LIBRARY {
PEERDIR(sandbox/sdk2)
REGISTER_SANDBOX_IMPORT(${MODDIR})
}
}
# tag:python-specific tag:internal
NO_PYTHON_INCLS=no
### @usage: NO_PYTHON_INCLUDES() # internal
###
### Disable dependencies on libraries providing Python headers.
### This is only used in Python libraries themselves to avoid PEERDIR loops.
macro NO_PYTHON_INCLUDES() {
ENABLE(NO_PYTHON_INCLS)
}
# tag:python-specific
### @usage: PYTHON2_ADDINCL()
###
### This macro adds include path for Python headers (Python 2.x variant) without PEERDIR.
### This should be used in 2 cases only:
### - In PY2MODULE since it compiles into .so and uses external Python runtime;
### - In system Python libraries themselves since proper PEERDIR there may create a loop;
### In all other cases use USE_PYTHON2 macro instead.
###
### Never use this macro in PY2_PROGRAM, PY2_LIBRARY and PY23_LIBRARY: they have everything needed by default.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
macro PYTHON2_ADDINCL() {
_PYTHON_ADDINCL()
SET(MODULE_TAG PY2_NATIVE)
SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
}
# tag:python-specific tag:internal
### @usage: _ARCADIA_PYTHON_ADDINCL() # internal
### This macro sets up Python headers for modules with Arcadia python (e.g. PY2_LIBRARY) and configures module as Python 2.x.
macro _ARCADIA_PYTHON_ADDINCL() {
_PYTHON_ADDINCL()
SET(MODULE_TAG PY2)
SET(PEERDIR_TAGS PY2 PY2_NATIVE PY_PROTO PY2_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
}
# tag:python-specific tag:internal
### @usage: _PYTHON_ADDINCL() # internal
### This macro sets up Python 2.x headers for both Arcadia and non-Arcadia python.
macro _PYTHON_ADDINCL() {
SET(PYTHON2 yes)
SET(PYTHON3 no)
when ($USE_ARCADIA_PYTHON == "yes") {
ADDINCL+=GLOBAL contrib/libs/python/Include
CFLAGS+=-DARCADIA_PYTHON_UNICODE_SIZE=$ARCADIA_PYTHON_UNICODE_SIZE
}
otherwise {
when ($USE_SYSTEM_PYTHON) {
PEERDIR+=build/platform/python
}
otherwise {
CFLAGS+=$PYTHON_INCLUDE
}
}
}
# tag:python-specific
### @usage: PYTHON3_ADDINCL()
###
### This macro adds include path for Python headers (Python 3.x variant).
### This should be used in 2 cases only:
### - In PY2MODULE since it compiles into .so and uses external Python runtime;
### - In system Python libraries themselves since peerdir there may create a loop;
### In all other cases use USE_PYTHON3() macro instead.
###
### Never use this macro in PY3_PROGRAM and PY3_LIBRARY and PY23_LIBRARY: they have everything by default.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
macro PYTHON3_ADDINCL() {
_PYTHON3_ADDINCL()
SET(MODULE_TAG PY3_NATIVE)
SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY3_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
}
# tag:python-specific tag:internal
### @usage: _ARCADIA_PYTHON3_ADDINCL() # internal
###
### This macro sets up Python3 headers for modules with Arcadia python (e.g. PY3_LIBRARY) and configures module as Python 3.x.
macro _ARCADIA_PYTHON3_ADDINCL() {
_PYTHON3_ADDINCL()
SET(MODULE_TAG PY3)
SET(MODULE_LANG PY3)
SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE PY3_PROTO PY3_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
}
# tag:python-specific tag:internal
### @usage: _PYTHON_ADDINCL() # internal
###
### This macro sets up Python 3.x headers for both Arcadia and non-Arcadia python.
macro _PYTHON3_ADDINCL() {
SET(PYTHON3 yes)
SET(PYTHON2 no)
when ($USE_ARCADIA_PYTHON == "yes") {
CFLAGS+=-DUSE_PYTHON3
ADDINCL+=GLOBAL contrib/libs/python/Include
}
otherwise {
when ($USE_SYSTEM_PYTHON) {
PEERDIR+=build/platform/python
}
otherwise {
CFLAGS+=$PYTHON_INCLUDE
}
}
}
# tag:python-specific
### @usage: USE_PYTHON2()
###
### This adds Python 2.x runtime library to your LIBRARY and makes it Python2-compatible.
### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
###
### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
###
### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
macro USE_PYTHON2() {
_ARCADIA_PYTHON_ADDINCL()
SET(PEERDIR_TAGS PY2 PY2_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
PEERDIR(contrib/libs/python)
}
# tag:python-specific
### @usage: USE_PYTHON3()
###
### This adds Python3 library to your LIBRARY and makes it Python3-compatible.
### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
###
### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
###
### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
macro USE_PYTHON3() {
_ARCADIA_PYTHON3_ADDINCL()
SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
PEERDIR(contrib/libs/python)
when ($USE_ARCADIA_PYTHON == "yes") {
PEERDIR+=library/python/runtime_py3
}
}
# tag:python-specific
when ($PERL_DEFAULT_PEERDIR == "yes") {
when (($PERLXS == "yes") || ($PERLXSCPP == "yes") || ($USE_PERL == "yes")) {
PEERDIR+=build/platform/perl
}
}
# tag:perl-specific
### @usage: USE_PERL_LIB()
### Add dependency on Perl to your LIBRARY
macro USE_PERL_LIB() {
PEERDIR(build/platform/perl)
}
# tag:perl-specific
### @usage: USE_PERL_514_LIB()
### Add dependency on Perl 5.14 to your LIBRARY
macro USE_PERL_514_LIB() {
SET(PERL_SDK ubuntu-12)
SET(PERL_DEFAULT_PEERDIR no)
PEERDIR(build/platform/perl/5.14)
}
# tag:perl-specific
### @usage: ADD_PERL_MODULE(Dir ModuleName)
### Add dependency on specified Perl module to the library
macro ADD_PERL_MODULE(Dir, Module) {
PEERDIR($Dir)
SET_APPEND(modules $Module)
}
# tag:allocator
### @usage: ALLOCATOR(Alloc) # Default: LF
###
### Set memory allocator implementation for the PROGRAM()/DLL() module.
### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
###
### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU", "PROFILED_HU".
### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
### - SYSTEM - Use target system allocator
### - FAKE - Don't link with any allocator
### - HU - Huge page allocator by @gulin.
### - PROFILED_HU - patched HU. It is a bit slower but has metrics of memory consumption.
###
### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
macro ALLOCATOR(Alloc) {
SET(ALLOCATOR $Alloc)
when ($ALLOCATOR in [ "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU", "PROFILED_HU" ]) {
}
otherwise {
PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
}
}
when ($MIC_ARCH == "yes") {
CFLAGS+=-mmic
LDFLAGS+=-mmic
}
when ($USE_OPENMP == "yes") {
PEERDIR+=contrib/libs/openmp
}
when ($STRIP == "yes" && $NO_STRIP != "yes") {
STRIP_FLAG=$LD_STRIP_FLAG
DWARF_COMMAND=
GO_LINK_FLAGS_VALUE+=-s
}
when ($NO_LINKER_DCE != "yes") {
DCE_FLAG=$LD_DCE_FLAG
}
when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
ICF_FLAG=$LD_ICF_FLAG
}
OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
OBJDUMP_TOOL=$OBJDUMP_TOOL_VENDOR
STRIP_TOOL=$STRIP_TOOL_VENDOR
NEED_BINUTILS_PEERDIR=
BINUTILS_USED=
when (!$OBJCOPY_TOOL_VENDOR) {
OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
NEED_BINUTILS_PEERDIR=yes
}
when (!$OBJDUMP_TOOL_VENDOR) {
OBJDUMP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objdump
NEED_BINUTILS_PEERDIR=yes
}
when (!$STRIP_TOOL_VENDOR) {
STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
NEED_BINUTILS_PEERDIR=yes
}
SPLIT_DWARF_VALUE=no
NO_SPLIT_DWARF=no
when ($OS_DARWIN) {
SPLIT_DWARF_VALUE=yes
}
when ($STRIP_DEBUG_INFO) {
SPLIT_DWARF_VALUE=yes
NO_SPLIT_DWARF=no
}
### @usage: SPLIT_DWARF()
###
### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
macro SPLIT_DWARF() {
SET(SPLIT_DWARF_VALUE yes)
}
### @usage: NO_SPLIT_DWARF()
###
### Do NOT emit debug info for the PROGRAM/DLL as a separate file.
### On macOS this also means do NOT generate dSym files (faster linkage)
macro NO_SPLIT_DWARF() {
SET(SPLIT_DWARF_VALUE no)
}
SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
DWARF_COMMAND+= \
$OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
$STRIP_TOOL --strip-debug $TARGET && \
$OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
BINUTILS_USED=yes
}
### @usage: EXTRALIBS_STATIC(Libs...)
###
### Add the specified external static libraries to the program link
macro EXTRALIBS_STATIC(Args...) {
LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
}
### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
###
### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
__translatename_lower=${tolower:Name}
__translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
}
### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
###
### Generate transliteration dictionary code
### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
__translitname_lower=${tolower:Name}
__translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
__untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
__ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
__gentrie_dir=dict/tools/make_untranslit_trie
RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
}
# tag:python-specific tag:proto tag:deprecated
### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated
###
### Generate python bindings for protobuf files.
### Macro is obsolete and not recommended for use!
macro GENERATE_PY_PROTOS(FILES...) {
foreach (FILE : $FILES) {
_PY_PROTO_CMD($FILE)
}
}
# tag:python-specific tag:proto
macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) {
foreach (FILE : $FILES) {
_PY_PROTO_CMD_INTERNAL($FILE)
}
}
# tag:python-specific
macro _GENERATE_PY_EVS_INTERNAL(FILES...) {
foreach (FILE : $FILES) {
_PY_EVLOG_CMD_INTERNAL($FILE)
}
}
macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[], OUTPUT_INCLUDES_INP[]) {
.CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} ${output_include;from_input;hide:OUTPUT_INCLUDES_INP} $INDUCED_DEPS ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"}
.SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST}
}
### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
###
### Copy file to build root. It is possible to change both location and the name.
###
### Parameters:
### - File - Source file name.
### - Destination - Output file name.
### - AUTO - Consider copied file for further processing automatically.
### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type)
### and set of dependencies
###
### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
.CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
.SEM=$_COPY_FILE_IMPL($File $AUTO $Destination)
}
### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
###
### Copy file to build root the same way as it is done for COPY_FILE, but also
### propagates the context of the source file.
macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
.CMD=$_COPY_FILE_IMPL($FILE $AUTO $DEST OUTPUT_INCLUDES_INP $FILE OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
}
### This is to join $ALL_RES_ and $EXT
macro _ARF_HELPER(Args...) {
RESOURCE_FILES($Args)
}
### @usage ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
###
### This macro collects all files with extension `Ext` and
### Passes them to `RESOURCE_FILES` macro as relative to current directory
###
### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
###
### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
### Note: Wildcards are not allowed neither as Ext nor in Dirs
macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
_GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
_ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT})
}
macro _BUNDLE_TARGET(Target, Destination) {
.CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
}
### @usage: TIMEOUT(TIMEOUT)
###
### Sets a timeout on test execution
###
### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
macro TIMEOUT(Time) {
SET(TEST_TIMEOUT $Time)
}
SBR_UID_EXT=""
# tag:test
### @usage: VALIDATE_DATA_RESTART(ext)
###
### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
macro VALIDATE_DATA_RESTART(Ext) {
SET(SBR_UID_EXT $Ext)
}
# tag:test
TEST_FORK_MODE=none
TEST_PARTITION=SEQUENTIAL
# tag:test
### @usage: FORK_TESTS()
###
### Splits a test run on chunks by test classes.
### The number of chunks can be overridden using the macro SPLIT_FACTOR.
###
### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
###
### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
macro FORK_TESTS(MODE...) {
SET(TEST_FORK_MODE tests)
SET(TEST_PARTITION $MODE)
}
# tag:test
### @usage: FORK_SUBTESTS()
###
### Splits the test run in chunks on subtests.
### The number of chunks can be overridden using the macro SPLIT_FACTOR.
###
### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
###
### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
macro FORK_SUBTESTS(MODE...) {
SET(TEST_FORK_MODE subtests)
SET(TEST_PARTITION $MODE)
}
# tag:test
### @usage: SPLIT_FACTOR(x)
###
### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
### If none of those is specified this macro implies FORK_TESTS().
###
### Supports C++ ut and PyTest.
###
### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
macro SPLIT_FACTOR(Factor) {
SET(TEST_SPLIT_FACTOR $Factor)
}
# tag:test
FORK_TEST_FILES_MODE=
### @usage: FORK_TEST_FILES()
###
### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
### Compatible with FORK_(SUB)TESTS.
###
### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
macro FORK_TEST_FILES() {
SET(FORK_TEST_FILES_MODE on)
}
# tag:test
TEST_SIZE_NAME=SMALL
### @usage: SIZE(SMALL/MEDIUM/LARGE)
###
### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
### See documentation on test system for more details.
###
### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
macro SIZE(Type) {
SET(TEST_SIZE_NAME $Type)
}
### @usage: JOIN_SRCS(Out Src...)
###
### Join set of sources into single file named Out and send it for further processing.
### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
### You should specify file name with the extension as Out. Further processing will be done according this extension.
macro JOIN_SRCS(Out, Src...) {
.CMD=$YMAKE_PYTHON3 ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
.SEM=target_joined_source $Out ${input:Src} ${output;hide;suf=.o:Out} ${input;hide:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"}
_CONDITIONAL_SRCS($TIDY_VALUE $Src)
}
### @usage: JOIN_SRCS_GLOBAL(Out Src...)
###
### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
### You should specify file name with the extension as Out. Further processing will be done according to this extension.
macro JOIN_SRCS_GLOBAL(Out, Src...) {
.CMD=$YMAKE_PYTHON3 ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output;noauto:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
SRCS(GLOBAL $Out)
}
### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
###
### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
### This macro places all files into single file, so will work with any sources.
### You should specify file name with the extension as Out. Further processing will be done according to this extension.
macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
.CMD=$FS_TOOLS cat ${output;noauto:Out} --ya-start-command-file ${input:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
SRCS(GLOBAL $Out)
}
# tag:cpu
PIC_CFLAGS=
SSE2_CFLAGS=
SSE3_CFLAGS=
SSSE3_CFLAGS=
SSE41_CFLAGS=
SSE42_CFLAGS=
POPCNT_CFLAGS=
PCLMUL_CFLAGS=
CX16_FLAGS=
AVX_CFLAGS=
AVX2_CFLAGS=
AVX512_CFLAGS=
AMX_CFLAGS=
# tag:cpu
SSE_DEFINES=
SSE_CFLAGS=
SSE4_DEFINES=
SSE4_CFLAGS=
XOP_CFLAGS=
NO_LTO_CFLAGS=
# tag:cpu
when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
when ($CLANG || $CLANG_CL || $GCC) {
PIC_CFLAGS=-fPIC
SSE2_CFLAGS=-msse2
SSE3_CFLAGS=-msse3
SSSE3_CFLAGS=-mssse3
SSE41_CFLAGS=-msse4.1
SSE42_CFLAGS=-msse4.2
XOP_CFLAGS=-mxop
POPCNT_CFLAGS=-mpopcnt
PCLMUL_CFLAGS=-mpclmul
AVX_CFLAGS=-mavx
# On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell.
# See:
# https://en.wikipedia.org/wiki/FMA_instruction_set
# https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
#
# AMD implemented FMA3 in Piledriver architecture over AVX (that is, prior to AVX-2 which was introduced in Zen).
# BMI2 implementation was released by AMD along with AVX-2 support.
# See:
# https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
#
# Due to the above, it looks safe to enable all three extensions whenever AVX-2 is enabled.
AVX2_CFLAGS=-mavx2 -mfma -mbmi -mbmi2
# All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
# (these are Xeon Phi)
# See:
# https://en.wikichip.org/wiki/x86/avx-512
AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
# AMX stands Advanced Matrix Extension supported by modern Intel architectures
# See:
# https://en.wikipedia.org/wiki/Advanced_Matrix_Extensions
# https://en.wikichip.org/wiki/x86/amx
AMX_CFLAGS=-mamx-tile -mamx-int8 ${AVX512_CFLAGS}
when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
CX16_FLAGS=-mcx16
}
SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
}
elsewhen ($MSVC) {
SSE2_CFLAGS=/D__SSE2__=1
SSE3_CFLAGS=/D__SSE3__=1
SSSE3_CFLAGS=/D__SSSE3__=1
SSE41_CFLAGS=/D__SSE4_1__=1
SSE42_CFLAGS=/D__SSE4_2__=1
POPCNT_CFLAGS=/D__POPCNT__=1
PCLMUL_CFLAGS=/D__PCLMUL__=1
AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
}
SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
when ($ARCH_I386 && $OS_ANDROID == "yes") {
USE_SSE4=no
}
}
otherwise {
USE_SSE4=no
CPU_CHECK=no
}
# tag:cpu
when ($NOSSE == "yes") {
USE_SSE4=no
}
# tag:cpu
### @usage: NO_SSE4()
###
### Compile module without SSE4
macro NO_SSE4() {
SET(USE_SSE4 no)
}
# tag:cpu
### @usage: NO_CPU_CHECK()
###
### Compile module without startup CPU features check
macro NO_CPU_CHECK() {
SET(CPU_CHECK no)
}
### @usage: ADDINCLSELF()
###
### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
macro ADDINCLSELF(FOR="") {
when($FOR) {
ADDINCL+=FOR $FOR ${MODDIR}
}
otherwise {
ADDINCL+=${MODDIR}
}
}
COMPILE_OUT_SUFFIX=
_COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
_COMPILE_TIME_TRACE_OUTPUTS=${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?";norel":"") {
SET(_COMPILE_OUTPUTS \${output;suf=\${OBJECT_SUF}$NOREL:SRC})
SET(_COMPILE_TIME_TRACE_OUTPUTS \${output;noauto;suf=\${OBJECT_SUF}.time_trace.json$NOREL:SRC})
}
# tag:internal
### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " before $Args when GENERATE
### is specified in the list of actual arguments
macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
.SEM=$GENERATE $Args
}
# tag:internal
### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " if Args is not empty
macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
.SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
}
_EMPTY_CMD=
# tag:src-processing tag:internal
### @usage: _SRC(Ext Src Flags) # internal
###
### Basic building block of extension-based command dispatching
### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
### of other commands (except ones marked as noauto)
macro _SRC(EXT, SRC, SRCFLAGS...) {
# Generic macro definition for _SRC (just a placeholder, it does nothing)
}
# tag:src-processing
macro _SRC("swg", SRC, SRCFLAGS...) {
.CMD=${_SWIG_CMD}
.ADDINCL=${_SWIG_ADDINCLS}
.PEERDIR=${_SWIG_PEERDIR}
.SEM=conan_require_tool swig/4.0.2 && conan_import '"bin, *swig* -> ./bin"' ${input;hide:SRC} ${_SWIG_SEM_TO_MODULE_LINK}
}
RODATA_SYMBOL_PREFIX=
when ($DARWIN == "yes" || $IOS == "yes" || ($WINDOWS == "yes" && $ARCH_TYPE_32 == "yes")) {
RODATA_SYMBOL_PREFIX=_
}
RODATA_ELF_FLAGS=
when($LINUX == "yes" || $ANDROID == "yes") {
RODATA_ELF_FLAGS=--elf
}
RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2asm.py"} $RODATA_ELF_FLAGS ${RODATA_SYMBOL_PREFIX}${noext;nopath:SRC} ${input:SRC} ${tmp;suf=.asm:SRC} ${hide:OBJECT_SUF} && $_SRC_yasm_helper(${tmp;suf=.asm:SRC})
when (($ARCH_AARCH64 || $ARCH_ARM || $ARCH_PPC64LE || $ARCH_RISCV32) == "yes") {
RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2cpp.py"} ${noext;nopath:SRC} ${input:SRC} ${output;suf=.cpp:SRC}
}
# tag:src-processing
macro _SRC("rodata", SRC, SRCFLAGS...) {
.CMD=$RODATA_COMPILE ${hide;kv:"p RD"} ${hide;kv:"pc light-green"}
.SEM=target_rodata_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} ${input;hide:"build/scripts/rodata2cpp.py"}
}
# tag:src-processing
macro _SRC("S", SRC, SRCFLAGS...) {
.CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output:SRC.o} ${input:SRC} ${pre=-I:_C__INCLUDE}
.SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS) && add_language ASM
}
# tag:src-processing
macro _SRC("s", SRC, SRCFLAGS...) {
.CMD=$_SRC(S, $SRC $SRCFLAGS)
}
# tag:src-processing
macro _SRC("s79", SRC, SRCFLAGS...) {
.CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
}
# tag:src-processing
macro _SRC("mm", SRC, SRCFLAGS...) {
.CMD=$C_COMPILER $C_FLAGS_PLATFORM -x objective-c++ -fobjc-arc -fobjc-abi-version=2 -c -o ${output:SRC.o} ${input:SRC} $CXXFLAGS ${pre=-I:_C__INCLUDE} ${SRCFLAGS} ${kv;hide:"p CC"} ${kv;hide:"pc light-green"} $TOOLCHAIN_ENV
}
# tag:src-processing
macro _SRC("fml", SRC, SRCFLAGS...) {
.CMD=$FML_TOOL $CHECKFLAG -b -o ${output:SRC.inc} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("fml2", SRC, SRCFLAGS...) {
.CMD=$FML_TOOL $CHECKFLAG -b -o ${output;nopath;noext:SRC.fml.inc} -2 -O ${output;nopath;noext:SRC.fml.cpp} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("fml3", SRC, SRCFLAGS...) {
.CMD=$FML_TOOL $CHECKFLAG -b -o ${output;nopath;noext:SRC.fml.inc} -3 -O ${output;nopath;noext:SRC.fml.cpp} -L ${input;nopath;noext:SRC.list} -P ${nopath;noext:SRC} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("sfdl", SRC, SRCFLAGS...) {
.CMD=$CXX_COMPILER $C_FLAGS_PLATFORM $CXXFLAGS $SFDL_FLAG ${SRCFLAGS} ${input:SRC} && ${tool:"tools/calcstaticopt"} -i ${tmp:SRC.tmp} -a $ARCADIA_ROOT ${output;stdout;nopath;noext;defext=.inc:SRC} ${kv;hide:"p SF"} ${kv;hide:"pc yellow"} $TOOLCHAIN_ENV
}
macro _XS_SRCS(SRC, TYPEMAPS[], SRCFLAGS...) {
.CMD=$PERL_LD_LIBRARY_PATH $PERL $PERL_INCLUDE ${suf=/ExtUtils/xsubpp:PERL_PRIVLIB} -typemap ${suf=/ExtUtils/typemap:PERL_PRIVLIB} $PERLSUFFIX $XSUBPPFLAGS ${pre=-typemap :TYPEMAPS} ${input;hide:TYPEMAPS} ${SRCFLAGS} ${input:SRC} ${PERLOUTPUT} ${kv;hide:"p XS"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("xs", SRC, SRCFLAGS...) {
.CMD=$_XS_SRCS($SRC TYPEMAPS $_XSTYPEMAPS $SRCFLAGS)
}
# tag:src-processing
macro _SRC("gperf", SRC, SRCFLAGS...) {
.CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/gperf"} $GP_FLAGS ${SRCFLAGS} ${pre=-Nin_;suf=_set;nopath;noallext:SRC} ${input:SRC} ${output;stdout;nopath;noext;defext=.gperf.cpp:SRC} ${kv;hide:"p GP"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("rl", SRC, SRCFLAGS...) {
.CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/ragel"} $RAGEL_FLAGS ${SRCFLAGS} -o ${tmp:SRC.tmp} ${input:SRC} && $RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/rlgen-cd"} $RLGEN_FLAGS -o ${output;nopath;noext;defext=.rl5.cpp:SRC} ${tmp:SRC.tmp} ${kv;hide:"p R5"} ${kv;hide:"pc yellow"}
}
macro _SRC("xsyn", SRC, SRCFLAGS...) {
.CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${output;stdout;suf=.h.rl5:SRC} ${kv;hide:"p XN"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("rl5", SRC, SRCFLAGS...) {
.CMD=$_SRC(rl $SRC $SRCFLAGS)
}
# tag:src-processing
macro _SRC("asp", SRC, SRCFLAGS...) {
.CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${kv;hide:"p HT"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("rl6", SRC, SRCFLAGS...) {
.CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel6"} $RAGEL6_FLAGS ${SRCFLAGS} -L -I${ARCADIA_ROOT} -o ${output;nopath;noext;defext=.rl6.cpp:SRC} ${input:SRC} ${kv;hide:"p R6"} ${kv;hide:"pc yellow"}
.SEM=target_ragel_lexers PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $RAGEL6_FLAGS ${SRCFLAGS} && set_global_flags RAGEL_FLAGS -L -I $S/ && conan_require_tool ragel/6.10 && conan_import '"bin, ragel* -> ./bin"' ${input;hide:"build/scripts/run_tool.py"}
}
# tag:src-processing
macro _SRC("pln", SRC, SRCFLAGS...) {
.CMD=$FML_TOOL -b -o ${output;pre=pln.;nopath;noext:SRC.cpp} -f ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("xsyn", SRC, SRCFLAGS...) {
.CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${output;stdout:SRC.h.rl5} ${kv;hide:"p XN"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("ev", SRC, SRCFLAGS...) {
.CMD=$EVLOG_CMD($SRC)
.SEM=$EVLOG_CMD($SRC)
}
# tag:src-processing
macro _SRC("proto", SRC, SRCFLAGS...) {
.CMD=$PROTO_CMD($SRC)
.SEM=$PROTO_CMD($SRC)
}
# tag:src-processing
macro _SRC("gztproto", SRC, SRCFLAGS...) {
# _PROTO__INCLUDE is before ARCADIA_ROOT in includes because in gazetteer we don't use builtins now and paths' canonization (resolving) depends on order of roots.
# descriptor.proto must be resolved as google/protobuf/descriptor.proto
.CMD=${tool:"dict/gazetteer/converter"} -I$PROTOBUF_PATH ${pre="-I":_PROTO__INCLUDE} -I$ARCADIA_ROOT ${SRCFLAGS} ${input:SRC} ${output;nopath;noext;norel:SRC.proto} ${kv;hide:"p GZ"} ${kv;hide:"pc yellow"}
.PEERDIR=kernel/gazetteer/proto
}
# tag:src-processing
macro _SRC("cfgproto", SRC, SRCFLAGS...) {
.CMD=$_CPP_CFGPROTO_CMD($SRC)
}
# tag:src-processing
macro _SRC("pyx", SRC, SRCFLAGS...) {
# Copy-paste from BUILDWITH_CYTHON
.CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:SRC} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:SRC} $CYTHON_OUTPUT_INCLUDES ${SRCFLAGS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
.SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS --cplus ${SRCFLAGS} ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
.ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
}
# tag:src-processing
macro _SRC("in", SRC, SRCFLAGS...) {
.CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
.SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
}
macro MANUAL_GENERATION(Outs...) {
.SEM=IGNORED ${output;hide;noauto:Outs}
}
# tag:src-processing
macro _SRC("sc", SRC, SRCFLAGS...) {
.CMD=${tool:"tools/domschemec"} --in ${input:SRC} --out ${output;norel:SRC.h} ${output_include;hide:"util/generic/strbuf.h"} ${output_include;hide:"array"} ${output_include;hide:"util/generic/string.h"} ${output_include;hide:"util/generic/vector.h"} ${output_include;hide:"util/string/cast.h"} ${SRCFLAGS} ${kv;hide:"p SC"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("ssqls", SRC, SRCFLAGS...) {
.CMD=${tool:"metrika/core/tools/ssqls"} ${input;notransformbuilddir:SRC} -S $ARCADIA_ROOT -B $ARCADIA_BUILD_ROOT $SRCFLAGS ${output;noext;hide:SRC.cpp} ${output;noext;hide:SRC.h} ${kv;hide:"p SS"} ${kv;hide:"pc yellow"}
}
# tag:src-processing
macro _SRC("f", SRC, SRCFLAGS...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${output_include;hide:"f2c.h"} ${kv;hide:"p FT"} ${kv;hide:"pc light-green"}
.PEERDIR=contrib/libs/libf2c
.ADDINCL=contrib/libs/libf2c
}
# tag:src-processing
macro _SRC("cpp", SRC, SRCFLAGS...) {
.CMD=$_SRC_cpp($SRC $SRCFLAGS)
.SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
}
# tag:src-processing
macro _SRC("cxx", SRC, SRCFLAGS...) {
.CMD=$_SRC(cpp $SRC $SRCFLAGS)
}
# tag:src-processing
macro _SRC("cc", SRC, SRCFLAGS...) {
.CMD=$_SRC(cpp $SRC $SRCFLAGS)
.SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
}
# tag:src-processing
macro _SRC("auxcpp", SRC, SRCFLAGS...) {
.CMD=$_SRC_cpp($SRC $_FORCE_CPP_FLAGS $SRCFLAGS)
.SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($_FORCE_CPP_FLAGS $SRCFLAGS)
}
# tag:src-processing
macro _SRC("C", SRC, SRCFLAGS...) {
.CMD=$_SRC(cpp $SRC $SRCFLAGS)
}
# tag:src-processing
macro _SRC("c", SRC, SRCFLAGS...) {
.CMD=$_SRC_c($SRC $SRCFLAGS)
.SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
}
# tag:src-processing
macro _SRC("m", SRC, SRCFLAGS...) {
.CMD=$_SRC(c $SRC $SRCFLAGS)
}
# tag:src-processing
macro _SRC("masm", SRC, SRCFLAGS...) {
.CMD=$_SRC_masm($SRC $SRCFLAGS)
}
YASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${pre=-P :PREINCLUDES} ${input;hide:"build/scripts/run_tool.py"} \
&& set_global_flags YASM_FLAGS -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE \
&& add_language ASM \
&& conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
ASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${input;hide:"build/scripts/run_tool.py"} \
&& set_global_flags YASM_FLAGS -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE \
&& add_language ASM \
&& conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
# tag:src-processing
macro _SRC("yasm", SRC, SRCFLAGS...) {
.CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
.SEM=$YASM_SEM
}
# tag:src-processing
macro _SRC("asm", SRC, SRCFLAGS...) {
.CMD=$_SRC_ASM($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
.SEM=$ASM_SEM
}
# tag:src-processing
macro _SRC("lua", SRC, SRCFLAGS...) {
.CMD=${cwd:LUAJIT_PATH} ${tool:"contrib/libs/luajit/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
.PEERDIR=$LUAJIT_PATH
}
NVCC_CFLAGS=
when ($IDE_MSVS_CALL == "yes") {
# This is to avoid issues with .pdb from MSVC calling nvcc calling cl
NVCC_CFLAGS+=/Fd$(TEMP)
}
NVCC_STD_VER=14
when ($MSVC == "yes") {
NVCC_STD=/std:c++${NVCC_STD_VER}
}
otherwise {
NVCC_STD=-std=c++${NVCC_STD_VER}
}
# tag:src-processing
macro _SRC("cu", SRC, SRCFLAGS...) {
.CMD=$_SRC_CU_CMD
.SEM=target_cuda_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} && set_global_flags CMAKE_CUDA_STANDARD ${NVCC_STD_VER} && target_cuda_flags $CUDA_NVCC_FLAGS && target_cuda_cflags $USER_CXXFLAGS $SRCFLAGS $_SEM_EXTRA_CXX_FLAGS
.PEERDIR=$_SRC_CU_PEERDIR
}
# tag:src-processing
macro _SRC("fbs", SRC, SRCFLAGS...) {
.CMD=$FBS_CMD($SRC, $SRCFLAGS)
.SEM=$FBS_CMD($SRC, $SRCFLAGS)
}
# tag:src-processing
macro _SRC("fbs64", SRC, SRCFLAGS...) {
.CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
}
# tag:src-processing
macro _SRC("pysrc", SRC, SRCFLAGS...) {
.CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
}
# tag:src-processing
# This triggers configure error in attempt to add `ya.make` to SRCS macro or apply automatic processing by extension from codegen
macro _SRC("make", SRC, SRCFLAGS...) {
.CMD=
}
@import "${CONF_ROOT}/conf/bison_lex.conf"
# tag:src-processing
macro _SRC_py2src(SRC, SRCFLAGS...) {
.CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py2_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py2 --python $(PYTHON)/python --py_compile ${input:"build/scripts/py_compile.py"} ${kv;hide:"p P2"} ${kv;hide:"pc light-green"}
}
# tag:src-processing
macro _SRC_py3src(SRC, SRCFLAGS...) {
.CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py3_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py3 --pycc ${tool:"contrib/tools/python3/pycc"} ${kv;hide:"p P3"} ${kv;hide:"pc light-green"}
}
# tag:src-processing python-specific
when ($PYTHON3 == "yes") {
MACRO_ALIAS(_SRC_PYSRC _SRC_py3src)
}
otherwise {
MACRO_ALIAS(_SRC_PYSRC _SRC_py2src)
}
# tag:src-processing
macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
.CMD=$_SRC_C_NODEPS_CMD
}
# Custom flags for generated cpp-files. To support another generator:
# - insert additional file extension before .cpp into generated cpp-file name
# - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
#
# ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
# This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
#
# cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
# We use cython==0.29.26 at the time. This issue might be fixed in further versions.
#
# flags -fno-profile-instr-generate -fno-coverage-mapping needed to always disable coverage for .pyx, .rl5, .rl6
# generated sources
## tag:src-processing
when ($CLANG == "yes") {
_LANG_CFLAGS_FILTER=\
${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl5:SRC} \
${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl6:SRC} \
${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.pyx:SRC}
}
otherwise {
_LANG_CFLAGS_FILTER=\
${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
}
# tag:src-processing
# Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
macro _FILTER_EXTS(SKIP="", FLAGS...) {
.CMD=$FLAGS
}
# tag:src-processing
macro _LANG_CFLAGS(SRC) {
.CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
}
# tag:src-processing
# ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
# Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
_LANG_CFLAGS_VALUE=
when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
_LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
}
# Allows to add single compilation unit name to the node's 'kv' section.
# This is used by the coverage machinery to instrument only the necessary sources
# when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
SCU_NAME_KV=
when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no" && $USE_SCU_VALUE == "yes") {
SCU_NAME_KV=${hide;kv:"scu_name $KV_VAL"}
}
macro _ADD_SCU_NAME(KV_VAL) {
.CMD=$SCU_NAME_KV
}
# tag:src-processing
macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
.CMD=$_SRC_CPP_CMD $_ADD_SCU_NAME(${input:SRC})
}
# tag:src-processing
macro _SRC_c(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
.CMD=$_SRC_C_CMD $_ADD_SCU_NAME(${input:SRC})
}
# tag:src-processing
macro _SRC_m(SRC, SRCFLAGS...) {
.CMD=$_SRC_M_CMD
}
# tag:src-processing
macro _SRC_masm(SRC, SRCFLAGS...) {
.CMD=$_SRC_MASM_CMD
}
# tag:lua-specific
### @usage: COMPILE_LUA(Src, [NAME <import_name>])
###
### Compile LUA source file to object code using LUA 2.0
### Optionally override import name which is by default reflects Src name
macro COMPILE_LUA(Src, NAME="") {
.CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
}
# tag:lua-specific
### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
###
### Compile LUA source file to object code using LUA 2.1
macro _SRC_lua_21(SRC, SRCFLAGS...) {
.CMD=${cwd:LUAJIT_21_PATH} ${tool:"contrib/libs/luajit_21/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
.PEERDIR=$LUAJIT_21_PATH
}
# tag:lua-specific
### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
###
### Compile LUA source file to object code using LUA 2.1
### Optionally override import name which is by default reflects Src name
macro COMPILE_LUA_21(Src, NAME="") {
.CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
}
GETTEXT_KEEP_PATH=no
_MO_OUTPUT=
when ($GETTEXT_KEEP_PATH == "yes") {
_MO_OUTPUT=${output;noauto;norel;noext:SRC.mo}
}
otherwise {
_MO_OUTPUT=${output;noauto;nopath;noext;tobindir:SRC.mo}
}
# tag:src-processing
macro _SRC("po", SRC, SRCFLAGS...) {
.CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
}
# tag:ydl-specific
YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
YDL_DESC_FLAGS=
# tag:src-processing tag:ydl-specific
macro _SRC("ydl", SRC, SRCFLAGS...) {
.CMD=${tool:"statbox/ydl/compiler/tooling/ydl/bin"} c $YDL_FLAGS --cpp-output-header ${output;suf=.h:SRC} --cpp-output-source ${output;suf=.cpp:SRC} ${input:SRC} ${output_include;hide:"statbox/ydl/runtime/cpp/gen_support/standard_includes.h"} ${kv;hide:"p YDL"} ${kv;hide:"pc yellow"}
.PEERDIR+=statbox/ydl/runtime/cpp
}
# tag:ydl-specific
### @usage BUILD_YDL_DESC(Input Symbol Output)
###
### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
###
### @example:
###
### PACKAGE()
### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
### END()
###
### This will parse file ../types.ydl, generate a descriptor for a symbol Event defined in the said file, and put the descriptor to the Event.ydld.
macro BUILD_YDL_DESC(Input, Symbol, Output) {
.CMD=${tool:"statbox/ydl/compiler/tooling/ydl/bin"} ti $YDL_FLAGS $YDL_DESC_FLAGS -o ${output;noauto:Output} ${input:Input} ${Symbol} ${kv;hide:"p YDL"} ${kv;hide:"pc yellow"}
}
# tag:ydl-specific
### @usage: YDL_DESC_USE_BINARY()
###
### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
###
### @example:
###
### PACKAGE()
### YDL_DESC_USE_BINARY()
### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
### END()
###
### This will generate descriptor Event.ydld in a binary format.
macro YDL_DESC_USE_BINARY() {
YDL_DESC_FLAGS_BINARY= --binary
SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
}
### @usage SRC(File Flags...)
###
### Compile single file with extra Flags.
### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
macro SRC(FILE, FLAGS...) {
_SRC(${lastext:FILE} $FILE $FLAGS)
}
### @usage: SRCS(<[GLOBAL] File> ...)
###
### Source files of the project. Files are built according to their extension and put int module output or fed to ultimate PROGRAM/DLL depending on GLOBAL presence.
### Arcadia Paths from the root and is relative to the project's LIST are supported
###
### GLOBAL marks next file as direct input to link phase of the program/shared library project built into. This prevents symbols of the file to be excluded by linker as unused.
### The scope of the GLOBAL keyword is the following file (that is, in the case of SRCS(GLOBAL foo.cpp bar.cpp) global will be only foo.cpp)
###
### @example:
###
### LIBRARY(test_global)
### SRCS(GLOBAL foo.cpp)
### END()
###
### This will produce foo.o and feed it to any PROGRAM/DLL module transitively depending on test_global library. The library itself will be empty and won't produce .a file.
macro SRCS(FILES...) {
foreach (FILE : $FILES) {
_SRC(${lastext:FILE} $FILE)
}
}
# tag:c-specific
macro _SRC_C_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
.CMD=$_SRC_c($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
.SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL
}
macro _SRC_CPP_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
.CMD=$_SRC_cpp($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
.SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
###
### Defenition of generic macro. Report an error that the File with Ext is not
### supported by macro MacroName if no appropriate macro specialization is found.
macro _SRC_CUSTOM_C_CPP(EXT, MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
###
### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single C file (with .c extension)
macro _SRC_CUSTOM_C_CPP("c", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
_SRC_C_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
###
### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cpp extension)
macro _SRC_CUSTOM_C_CPP("cpp", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
_SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
###
### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cxx extension)
macro _SRC_CUSTOM_C_CPP("cxx", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
_SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
###
### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cc extension)
macro _SRC_CUSTOM_C_CPP("cc", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
_SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
###
### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .C extension)
macro _SRC_CUSTOM_C_CPP("C", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
_SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_SSE2(File Flags...)
###
### Compile a single C/C++ file with SSE2 and additional Flags
macro SRC_C_SSE2(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE2 $FILE .sse2 $SSE2_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_SSE3(File Flags...)
###
### Compile a single C/C++ file with SSE3 and additional Flags
macro SRC_C_SSE3(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE3 $FILE .sse3 $SSE3_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_SSSE3(File Flags...)
###
### Compile a single C/C++ file with SSSE3 and additional Flags
macro SRC_C_SSSE3(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSSE3 $FILE .ssse3 $SSSE3_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_SSE4(File Flags...)
###
### Compile a single C/C++ file with SSE4 and additional Flags
macro SRC_C_SSE4(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE4 $FILE .sse4 $SSE4_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_SSE41(File Flags...)
###
### Compile a single C/C++ file with SSE4.1 and additional Flags
macro SRC_C_SSE41(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE41 $FILE .sse41 $SSE41_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_AVX(File Flags...)
###
### Compile a single C/C++ file with AVX and additional Flags
macro SRC_C_AVX(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX $FILE .avx $AVX_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_AVX2(File Flags...)
###
### Compile a single C/C++ file with AVX2 and additional Flags
macro SRC_C_AVX2(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX2 $FILE .avx2 $AVX2_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_AVX512(File Flags...)
###
### Compile a single C/C++ file with AVX512 and additional Flags
macro SRC_C_AVX512(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX512 $FILE .avx512 $AVX512_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_AVX512(File Flags...)
###
### Compile a single C/C++ file with AVX512 and additional Flags
macro SRC_C_AMX(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AMX $FILE .amx $AMX_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_XOP(File Flags...)
###
### Compile a single C/C++ file with (an AMD-specific instruction set,
### see https://en.wikipedia.org/wiki/XOP_instruction_set) and additional Flags
macro SRC_C_XOP(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_XOP $FILE .xop $XOP_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific tag:cpu
### @uasge SRC_C_PCLMUL(File Flags...)
###
### Compile a single C/C++ file with PCLMUL and additional Flags
macro SRC_C_PCLMUL(FILE, FLAGS...) {
_SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE .pclmul $PCLMUL_CFLAGS $FLAGS )
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
###
### Defenition of generic macro. Report an error that the File with Ext is not
### supported by macro MacroName if no appropriate macro specialization is found.
macro _SRC_STRICT_C_CPP(EXT, MACRO_NAME, FILE, FLAGS...) {
MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
###
### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single C file (with .c extension)
macro _SRC_STRICT_C_CPP("c", MACRO_NAME, FILE, FLAGS...) {
_SRC(c $FILE $FLAGS)
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
###
### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cpp extension)
macro _SRC_STRICT_C_CPP("cpp", MACRO_NAME, FILE, FLAGS...) {
_SRC(cpp $FILE $FLAGS)
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
###
### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cxx extension)
macro _SRC_STRICT_C_CPP("cxx", MACRO_NAME, FILE, FLAGS...) {
_SRC(cpp $FILE $FLAGS)
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
###
### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cc extension)
macro _SRC_STRICT_C_CPP("cc", MACRO_NAME, FILE, FLAGS...) {
_SRC(cpp $FILE $FLAGS)
}
# tag:src-specific tag:cpp-specific
### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
###
### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .C extension)
macro _SRC_STRICT_C_CPP("C", MACRO_NAME, FILE, FLAGS...) {
_SRC(cpp $FILE $FLAGS)
}
# tag:src-specific tag:cpp-specific
### @uasge SRC_C_PIC(File Flags...)
###
### Compile a single C/C++ file with -fPIC and additional Flags
macro SRC_C_PIC(FILE, FLAGS...) {
_SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PIC $FILE $PIC_CFLAGS $FLAGS)
}
# tag:src-specific tag:cpp-specific
### @uasge SRC_C_NO_LTO(File Flags...)
###
### Compile a single C/C++ file with link-time-optimization disabling and additional Flags
macro SRC_C_NO_LTO(FILE, FLAGS...) {
_SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_NO_LTO $FILE $NO_LTO_CFLAGS $FLAGS)
}
# tag:python-processing tag:cython
# TODO: use it in [.pyx] cmd
### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
###
### Generates .cpp file from .pyx.
macro BUILDWITH_CYTHON_CPP(Src, Options...) {
.CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
.SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
}
# tag:python-processing tag:cython tag:internal
### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
###
### Generates .cpp file from .pyx and attach extra input Dep.
### If Dep changes the .cpp file will be re-generated.
macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
.CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
.SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
}
# tag:python-processing tag:cython tag:internal
### @usage: _BUILDWITH_CYTHON_CPP_H(Src Dep Options...) # internal
###
### BUILDWITH_CYTHON_CPP without .pyx infix and with cdef public .h file.
macro _BUILDWITH_CYTHON_CPP_H(Src, Dep, Options...) {
.CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.cpp} ${output;hide;addincl;noext;tobindir:Src.h} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
}
# tag:python-processing tag:cython
### @usage: BUILDWITH_CYTHON_C(Src Options...)
###
### Generates .c file from .pyx.
macro BUILDWITH_CYTHON_C(Src, Options...) {
.CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
.SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
}
# tag:python-processing tag:cython tag:internal
### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
###
### Generates .c file from .pyx and attach extra input Dep.
### If Dep changes the .c file will be re-generated.
macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
.CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
.SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
}
# tag:python-processing tag:cython tag:internal
### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
###
### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
.CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
}
# tag:python-processing tag:cython tag:internal
### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
###
### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
.CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} ${output;hide;addincl;noext;defext=_api.h;tobindir:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
}
### @usage: BUILDWITH_RAGEL6(Src Options...)
###
### Compile .rl file using Ragel6.
macro BUILDWITH_RAGEL6(Src, Options...) {
.CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel6"} $RAGEL6_FLAGS ${Options} -I${ARCADIA_ROOT} -o ${output;nopath;noext;defext=.rl6.cpp:Src} ${input:Src} ${kv;hide:"p R6"} ${kv;hide:"pc yellow"}
}
# tag:python-processing tag:internal
# TODO: use it in [.pyx] cmd
### @usage: _PY_REGISTER() # internal
###
### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
macro _PY_REGISTER(Func) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
SRCS(GLOBAL $Func.reg.cpp)
}
# tag:python-processing tag:internal
### @usage: _PY3_REGISTER() # internal
###
### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
macro _PY3_REGISTER(Func) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${output;noauto:Func.reg3.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
SRCS(GLOBAL $Func.reg3.cpp)
}
# tag:python-processing tag:internal
### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
###
### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
}
# tag:python-processing tag:internal
### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
###
### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
###
### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
.CMD=${env:"PYTHONHASHSEED=0"} ${tool:"contrib/tools/python3/pycc"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc3} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
}
macro _ARCHIVE_SEM_HELPER(FLAGS[], OUT, Files...) {
.SEM=add_custom_command OUTPUT ${OUT} DEPENDS $ARCH_TOOL ${join= :Files} COMMAND $ARCH_TOOL $FLAGS ${join=\: :Files}: -o ${OUT}
}
### @usage: ARCHIVE_ASM(NAME archive_name files...)
###
### Similar to the macro ARCHIVE, but:
### 1. works faster and it is better to use for large files.
### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", Files...) {
.CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;suf=$OBJ_SUF.rodata:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"}
.SEM=$_ARCHIVE_SEM_HELPER(${output;suf=$OBJ_SUF.rodata:NAME} ${input:Files} FLAGS -q $DONTCOMPRESS)
}
# tag:yweb-specific
macro PIRE_INLINE_CMD(SRC) {
.CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"}
}
# tag:yweb-specific
macro PIRE_INLINE(FILES...) {
foreach (FILE : $FILES) {
PIRE_INLINE_CMD($FILE)
}
}
### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
###
### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
###
### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", Files...) {
.CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
.SEM=$_ARCHIVE_SEM_HELPER(${output;addincl;noauto:NAME} ${input:Files} FLAGS -q -x $DONTCOMPRESS) && target_sources PRIVATE $BINDIR/$NAME
}
### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
###
### Add arbitrary data to a module be accessible by specified key.
### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
###
### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", Files...) {
.CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
}
#scripts
#special commands
BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
SVNVERSION_JAVA_MARKER=output-java-class
SVNVERSION_GO_MARKER=output-go
VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
VCS_C=$BINDIR/__vcs_version__.c
VCS_GO=$BINDIR/__vcs_version__.go
VCS_JAVA=$BINDIR/__vcs_version__.mf
VCS_INFO_DISABLE_CACHE__NO_UID__=
YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
YASM_DEBUG_INFO=
CL_DEBUG_INFO=
CL_MACRO_INFO=
when ($FORCE_VCS_INFO_UPDATE == "yes") {
VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
}
### Works for pyton too.
GENERATE_VCS_C_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} $(VCS)/vcs.json $VCS_C ${input:"build/scripts/c_templates/svn_interface.c"} $VCS_INFO_DISABLE_CACHE__NO_UID__ && $_SRC_c_nodeps($VCS_C, $VCS_C_OBJ, $(SOURCE_ROOT))
GENERATE_VCS_GO_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-go $(VCS)/vcs.json $VCS_GO $VCS_INFO_DISABLE_CACHE__NO_UID__
GENERATE_VCS_JAVA_INFO_NODEP=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $VCS_INFO_DISABLE_CACHE__NO_UID__
macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
.CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
}
VCS_INFO_FILE=
### @usage VCS_INFO_FILE([FILE out_file])
###
### Enable saving vcs info as a json-file into PACKAGE
###
### Info is saved to 'vcs_info.json' by default.
### Use FILE parameter if you want another name.
###
### Note: macro can be used only once per module
macro VCS_INFO_FILE(FILE="vcs_info.json") {
SET(VCS_INFO_FILE $FILE)
}
ADD_VCS_INFO_FILE_CMD=
when ($VCS_INFO_FILE) {
ADD_VCS_INFO_FILE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-json $(VCS)/vcs.json ${output:VCS_INFO_FILE} $VCS_INFO_DISABLE_CACHE__NO_UID__
}
### @usage: CREATE_BUILDINFO_FOR(GenHdr)
###
### Creates header file to access some information about build specified via configuration variables.
### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
macro CREATE_BUILDINFO_FOR(GenHdr) {
.CMD=$YIELD $CXX_COMPILER && $YIELD $CXXFLAGS && $XARGS $YMAKE_PYTHON3 ${input:BUILDVERSION_SCRIPT} ${output:GenHdr} ${kv;hide:"p BI"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"} $SVN_DEPENDS_CACHE__NO_UID__
.SEM=$RUN_PYTHON3($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
}
DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
DECIMAL_MD5_FIXED=
### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
###
### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
.CMD=$YMAKE_PYTHON ${input:DECIMAL_MD5_SCRIPT} --fixed-output=${DECIMAL_MD5_FIXED} --func-name=${FUNCNAME} --lower-bits 32 --source-root=$ARCADIA_ROOT ${input;context=TEXT:Opts} ${output;stdout:File} ${kv;hide:"p SV"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"}
}
# tag:internal
### @usage $CFG_VARS # internal
###
### Mark commands that embed Configuration variables into files
macro CFG_VARS() {
.GEN_FROM_FILE=yes
}
### @usage: CONFIGURE_FILE(from to)
###
### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
### The values are collected during configure stage, while replacement itself happens during build stage.
### Used implicitly for .in-files processing.
macro CONFIGURE_FILE(Src, Dst) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"}
.SEM=set_vars ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;addincl;rootrel:Dst}
}
### @usage: BASE_CODEGEN(tool_path prefix)
###
### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in.
macro BASE_CODEGEN(Tool, Prefix, Opts...) {
.CMD=${tool:Tool} ${input:Prefix.in} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc yellow"}
}
# tag:internal
### @usage: _SPLIT_CODEGEN_BASE(tool prefix OUTS[] OUTPUT_INCLUDES[]) # internal
###
### Generator of a certain number .the. cpp file + one header .h file from .in.
### This is the call of the generator. Python macro SPLIT_CODEGEN() is defined in order to properly fill command outputs from OUT_NUM argument.
macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) {
.CMD=${tool:Tool} ${input:Prefix.in} ${output;hide:OUT} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $OPTS ${output_include;hide:OUTPUT_INCLUDES} ${kv;hide:"p SC"} ${kv;hide:"pc yellow"}
}
STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \
${output_include;hide:"util/generic/strbuf.h"} \
${output_include;hide:"util/generic/vector.h"} \
${output_include;hide:"util/generic/ptr.h"} \
${output_include;hide:"util/generic/yexception.h"} \
${output_include;hide:"kernel/struct_codegen/reflection/reflection.h"} \
${output_include;hide:"kernel/struct_codegen/reflection/floats.h"}
### @usage: STRUCT_CODEGEN(Prefix)
### A special case BASE_CODEGEN, in which the kernel/struct_codegen/codegen_tool tool is used.
macro STRUCT_CODEGEN(Prefix) {
.CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES)
.PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection
}
### @usage: DUMPERF_CODEGEN(Prefix)
### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used
macro DUMPERF_CODEGEN(Prefix) {
.CMD=$BASE_CODEGEN(extsearch/images/robot/tools/dumperf/codegen, $Prefix, ${output_include;hide:"extsearch/images/kernel/erf/erf_format.h"})
}
# tag:flags
### @usage: LDFLAGS(LinkerFlags...)
###
### Add flags to the link command line of executable or shared library/dll.
### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
### Note: remember about the incompatibility of flags for gcc and cl.
macro LDFLAGS(Flags...) {
SET_APPEND(LDFLAGS_GLOBAL $Flags)
}
# tag:flags
### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
###
### Add the specified flags to the compilation command of C and C++ files.
### @params: GLOBAL - Propagates these flags to dependent projects
### Note: remember about the incompatibility flags for clang and cl (to set flags specifically for cl.exe use MSVC_FLAGS).
macro CFLAGS(Flags...) {
SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
}
# tag:flags
### @usage: MASMFLAGS(compiler flags)
### Add the specified flags to the compilation command of .masm files.
macro MASMFLAGS(Flags...) {
SET_APPEND(MASMFLAGS $Flags)
}
# tag:flags
### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
### Add the specified flags to the compilation command of .c (but not .cpp) files.
### @params: GLOBAL - Distributes these flags on dependent projects
macro CONLYFLAGS(Flags...) {
SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
}
# tag:flags
### @usage: CXXFLAGS(compiler_flags)
### Add the specified flags to the compilation command of .cpp (but not .c) files.
macro CXXFLAGS(Flags...) {
SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
}
# tag:flags
### @usage: CUDA_NVCC_FLAGS(compiler flags)
### Add the specified flags to the compile line .cu-files.
macro CUDA_NVCC_FLAGS(Flags...) {
SET_APPEND(CUDA_NVCC_FLAGS $Flags)
}
# tag:flags
### @usage: NVCC_DEVICE_LINK(file.cu...)
### Run nvcc --device-link on objects compiled from srcs with --device-c.
### This generates a stub object devlink.o that supplies missing pieces for the
### host linker to link relocatable device objects into the final executable.
macro NVCC_DEVICE_LINK(Srcs...) {
.CMD=$NVCC $NVCC_FLAGS -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"} -dlink ${input;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:Srcs} ${kv;hide:"p DL"} ${kv;hide:"pc light-blue"}
}
# tag:flags
### @usage: CYTHON_FLAGS(compiler_flags)
### Add the specified flags to the compilation command of .pyx files.
macro CYTHON_FLAGS(Flags...) {
SET_APPEND(CYTHON_OPTIONS $Flags)
}
### @usage: STRIP()
### Strip debug info from a PROGRAM, DLL or TEST.
### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
macro STRIP() {
ENABLE(STRIP)
}
### @usage: NO_OPTIMIZE()
### Build code without any optimizations (-O0 mode).
macro NO_OPTIMIZE() {
ENABLE(NO_OPTIMIZE)
}
#TODO(YMAKE-91) read proper compile flags instead of sending explicit flags to semgraph directly
_SEM_EXTRA_CXX_FLAGS=
### @usage: NO_COMPILER_WARNINGS()
### Disable all compiler warnings in the module.
### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
macro NO_COMPILER_WARNINGS() {
ENABLE(NO_COMPILER_WARNINGS)
SET(_SEM_EXTRA_CXX_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>")
}
### @usage: WERROR()
### Consider warnings as errors in the current module.
### In the bright future will be removed, since WERROR is the default.
### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
macro WERROR() {
ENABLE(WERROR)
}
### @usage: NO_WERROR()
### Override WERROR() behavior
### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
macro NO_WERROR() {
DISABLE(WERROR)
}
### @usage: NO_WSHADOW()
### Disable C++ shadowing warnings.
macro NO_WSHADOW() {
ENABLE(NO_WSHADOW)
}
# tag:internal
### @usage: NO_PLATFORM_RESOURCES() # internal
### Exclude dependency on platform resources libraries.
### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
macro NO_PLATFORM_RESOURCES() {
ENABLE(NOPLATFORM_RESOURCES)
}
# tag:internal tag:codenav
### @usage: NO_CODENAVIGATION() # internal
### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
macro NO_CODENAVIGATION() {
ENABLE(NOCODENAVIGATION)
}
### @usage: NO_UTIL()
### Build module without dependency on util.
### Note: use this with care. Util most likely will be linked into executable anyway,
### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
macro NO_UTIL() {
ENABLE(NOUTIL)
}
### @usage: NO_RUNTIME()
###
### This macro:
### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
### may not be detected at build time and may lead to unpredictable behavors at configure time.
macro NO_RUNTIME() {
SET(USE_ARCADIA_LIBM no)
NO_UTIL()
ENABLE(NORUNTIME)
}
### @usage: NO_LIBC()
###
### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
### Note: use this with care. libc most likely will be linked into executable anyway,
### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
macro NO_LIBC() {
NO_RUNTIME()
DISABLE(MUSL)
}
### @usage: NO_PLATFORM()
###
### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
### Note: use this with care. libc most likely will be linked into executable anyway,
### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
macro NO_PLATFORM() {
NO_LIBC()
ENABLE(NOPLATFORM)
}
# tag:cpp-specific
### @usage: USE_CXX()
###
### Add dependency on C++ runtime
### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
macro USE_CXX() {
DISABLE(NORUNTIME)
}
### @usage: USE_UTIL()
###
### Add dependency on util and C++ runtime
### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
macro USE_UTIL() {
USE_CXX()
DISABLE(NOUTIL)
}
### @usage: USE_NASM()
###
### Build only .asm files with nasm toolchain instead of yasm
### Add to ya.make file ADDINCL(asm ...) with all folders where .asm files include smth
macro USE_NASM() {
ENABLE(USE_NASM_ASSEMBLER)
PEERDIR(build/external_resources/nasm)
}
# tag:deprecated
### @usage: NO_JOIN_SRC() # deprecated, does-nothing
### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
macro NO_JOIN_SRC() {
ENABLE(UNUSED_MACRO)
}
# tag:sanitize
### @usage: NO_SANITIZE()
###
### Disable all sanitizers for the module.
macro NO_SANITIZE() {
DISABLE(SANITIZER_TYPE)
}
# tag:coverage tag:sanitize
### @usage: NO_SANITIZE_COVERAGE()
###
### Disable lightweight coverage (-fsanitize-coverage) for the module.
### Sanitize coverage is commonly used with fuzzing.
### It might be useful to disable it for libraries that should never
### be the main targets for fuzzing, like libfuzzer library itself.
### Sanitize coverage instrumentation is enabled by the --sanitize-coverage option.
macro NO_SANITIZE_COVERAGE() {
DISABLE(SANITIZE_COVERAGE)
}
# tag:sanitize
### @usage: NO_SANITIZE_HEADERS()
###
### Disable dependency on sanitizer headers for the module.
macro NO_SANITIZE_HEADERS() {
DISABLE(SANITIZE_HEADERS)
}
# tag:coverage
### @usage: NO_CLANG_COVERAGE()
###
### Disable heavyweight clang coverage for the module. Clang coverage instrumentation is enabled by the --clang-coverage option.
macro NO_CLANG_COVERAGE() {
DISABLE(CLANG_COVERAGE)
}
macro NO_CLANG_TIDY() {
DISABLE(TIDY_ENABLED)
}
# tag:python-specific tag:coverage
### @usage: NO_PYTHON_COVERAGE()
###
### Disable python coverage for module
macro NO_PYTHON_COVERAGE() {
DISABLE(PYTHON_COVERAGE)
}
# tag:python-specific tag:coverage tag:cython
### @usage: NO_CYTHON_COVERAGE()
###
### Disable cython and cythonized python coverage (CYTHONIZE_PY)
### Implies NO_CLANG_COVERAGE() - right now, we can't disable instrumentation for .py.cpp files, but enable for .cpp
macro NO_CYTHON_COVERAGE() {
DISABLE(CYTHON_COVERAGE)
NO_CLANG_COVERAGE()
}
# tag:lua-specific
LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
macro _LUAJIT_OBJDUMP(Src, OUT="") {
.CMD=${cwd:LUAJIT_PATH} ${tool:"contrib/libs/luajit/compiler"} -b -g ${input:Src} ${output;noauto:OUT} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
}
# tag:lua-specific
LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
.CMD=${cwd:LUAJIT_21_PATH} ${tool:"contrib/libs/luajit_21/compiler"} -b -g ${input:Src} ${output;noauto:OUT} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
}
macro _MX_BIN_TO_INFO(Src) {
.CMD=${tool:"tools/mx_bin2info"} ${input:Src} ${output;nopath;noext;noauto:Src.info} ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
}
MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \
${output_include;hide:"kernel/matrixnet/mn_sse.h"} \
${output_include;hide:"library/cpp/archive/yarchive.h"} \
${output_include;hide:"util/memory/blob.h"} \
${output_include;hide:"util/generic/hash.h"} \
${output_include;hide:"util/generic/ptr.h"} \
${output_include;hide:"util/generic/singleton.h"}
macro _MX_GEN_TABLE(Srcs...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_mx_table.py"} $Srcs ${output;stdout:"mx_tables.cpp"} $MX_GEN_TABLE_INCLS ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
PEERDIR(kernel/matrixnet)
PEERDIR(library/cpp/archive)
}
RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"}
### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
###
### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
###
### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
macro GENERATE_ENUM_SERIALIZATION(File) {
.CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} ${output_include;from_input;hide:File} ${output_include;hide:"util/generic/serialized_enum.h"} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
.SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser"}
PEERDIR(tools/enum_parser/enum_serialization_runtime)
}
### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
###
### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
### Provide access to serialization functions via generated header File_serialized.h
###
### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
.CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} --header ${output;suf=_serialized.h:File} ${output_include;from_input;hide:File} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
.SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} GEN_HEADER ${output;suf=_serialized.h:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser"}
PEERDIR(tools/enum_parser/enum_serialization_runtime)
}
### @usage: DEB_VERSION(File)
###
### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
macro DEB_VERSION(File) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"}
}
BUILD_MN_SCRIPT=build/scripts/build_mn.py
# tag:matrixnet
### @usage: BUILD_MN([CHECK] [PTR] [MULTI] mninfo mnname) # matrixnet
###
### Generate MatrixNet data and access code using single command.
### Alternative macro BUILD_MNS() works faster and better for large files.
macro BUILD_MN(MnInfo, MnName, CHECK?"fml_tool=$FML_UNUSED_TOOL CHECK":"", MULTI?, PTR?, RANKING_SUFFIX="") {
.CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnF $ARCADIA_ROOT $ARCH_TOOL ${input:MnInfo} $MnName ranking_suffix=$RANKING_SUFFIX ${output;pre=mn.:MnName.cpp} ${output;hide;pre=MN_External_;suf=.rodata:MnName} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} $CHECK $MULTI $PTR ${kv;hide:"p MN"} ${kv;hide:"pc yellow"}
}
macro _BUILD_MNS_FILE(Input, Name, Output, Suffix, Check, Fml_tool, AsmDataName) {
.CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnsFilesF $ARCADIA_ROOT $BINDIR $ARCH_TOOL fml_tool=$Fml_tool $Name ranking_suffix=$Suffix ${input:Input} ${output;hide:Output} ${output;hide;pre=MN_External_;suf=.rodata:AsmDataName} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} ${kv;hide:"p MN"} ${kv;hide:"pc yellow"}
}
MNS_OUTPUT=mnmodels
macro _BUILD_MNS_CPP(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
.CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnsCppF $NAME ranking_suffix=$RANKING_SUFFIX ${input:MNS_OUTPUT.h} ${output:MNS_OUTPUT.cpp} ${input:Files} ${output_include;hide:MNS_OUTPUT.h} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} ${kv;hide:"p MN"} ${kv;hide:"pc yellow"}
}
macro _BUILD_MNS_HEADER(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
.CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnsHeaderF $NAME ranking_suffix=$RANKING_SUFFIX ${output:MNS_OUTPUT.h} ${input:Files} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} ${output_include;hide:"kernel/matrixnet/mn_multi_categ.h"} ${kv;hide:"p MN"} ${kv;hide:"pc yellow"}
}
# TODO: support foreach_in and keywords simultaneous usage (look at BUILD_MNS_FILES)
# tag:matrixnet
### @usage: BUILD_MNS([CHECK] NAME listname mninfos...) # matrixnet
###
### Generate MatrixNet data and access code using separate commands for support code, interface and data.
### Faster version of BUILD_MN() macro for large files.
macro BUILD_MNS(Files...) {
_BUILD_MNS_HEADER($Files)
_BUILD_MNS_CPP($Files)
_BUILD_MNS_FILES($Files)
}
### @usage: COMPILE_NLG(nlg_config.json, [TRANSLATIONS_JSON translations.json], Src...)
###
### Generate and compile .nlg templates (Jinja2-based) and interface for megamind runtime in localized mode.
###
### Alice-specific macro
macro COMPILE_NLG(NLG_CONFIG_JSON, TRANSLATIONS_JSON="", Src...) {
when ($TRANSLATIONS_JSON) {
TRANSLATIONS_JSON_ARG=--translations-json
}
otherwise {
TRANSLATIONS_JSON_ARG=
}
PEERDIR(alice/nlg/library/nlg_project_runtime)
RUN_PROGRAM(alice/nlg/tools/codegen compile-cpp --import-dir ${ARCADIA_ROOT} --out-dir ${ARCADIA_BUILD_ROOT} --include-prefix ${MODDIR} --nlg-config-json ${NLG_CONFIG_JSON} ${TRANSLATIONS_JSON_ARG} ${TRANSLATIONS_JSON} ${Src} IN ${TRANSLATIONS_JSON} ${NLG_CONFIG_JSON} ${Src} OUT_NOAUTO nlg_renderer_factory.cpp nlg_renderer_factory.h register.cpp translations.cpp translations.h localizable_phrases.pb.txt ${suf=.cpp:Src} ${suf=.h:Src} ${suf=.pb.txt:Src})
SRCS(GLOBAL register.cpp nlg_renderer_factory.cpp translations.cpp ${suf=.cpp:Src})
}
### @usage: NEED_CHECK()
###
### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
### automatically merged to trunk only if there is no new broken build targets in check results.
### The use of this macro is disabled by default.
macro NEED_CHECK(Flags...) {
# TODO: FIXME
ENABLE(UNUSED_MACRO)
}
### @usage: NO_NEED_CHECK()
###
### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
macro NO_NEED_CHECK(Flags...) {
ENABLE(UNUSED_MACRO)
}
# tag:deprecated
### @usage: NEED_REVIEW() # deprecated
###
### Mark the project as needing review.
### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
macro NEED_REVIEW(Flags...) {
# TODO: FIXME
ENABLE(UNUSED_MACRO)
}
### @usage: VERSION(Args...)
###
### Specify version of a module. Currently unused by build system, only informative.
macro VERSION(Flags...) {
ENABLE(UNUSED_MACRO)
}
DATAWORK_SCHEEME_EXPORT_FLAGS=
when ($UNIX == "yes") {
SCHEEME2_CFLAGS= -E -x c++
}
when ($WIN32 == "yes") {
SCHEEME2_CFLAGS= /E /TP
}
SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
###
### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
###
### 1. ${scheeme_name}.inc - the name of the generated file.
### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
###
### @example:
###
### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
###
### all options are passed to structparser (in this example --final_only - do not export heirs with public base that contains the required field,,- m "::" only from the root namespace)
### sets in extra option
###
### @example:
###
### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
###
### for compatibility with C++ compiler and the external environment.
### See tools/structparser for more details.
macro GEN_SCHEEME2(ScheemeName, FromFile) {
.CMD=$CXX_COMPILER $C_FLAGS_PLATFORM -c ${tmp;stdout:FromFile.cph} $SCHEEME2_CFLAGS ${input:FromFile} ${pre=-I:_C__INCLUDE} $CXXFLAGS -Wno-error && ${tool:"tools/structparser"} -o ${output:ScheemeName.inc} -n N${ScheemeName}SchemeInfo $SCHEEME2_STRUCT_INFO_FLAGS $DATAWORK_SCHEEME_EXPORT_FLAGS ${tmp:FromFile.cph} ${output;stdout;noauto:ScheemeName.inc.log} ${kv;hide:"p SH"} ${kv;hide:"pc yellow"}
}
### @usage: SYMLINK(from to)
### Add symlink
macro SYMLINK(From, To) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"}
}
# tag:internal
### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
### Generate prefix " && target_sources PRIVATE " before $Args when GENERATE is specified in the list of actual arguments
macro _TARGET_SOURCES_FOR_HEADERS_IMPL(GENERATE?" && target_sources PRIVATE ":"", Args...) {
.SEM=$GENERATE ${output;ext=.h:Args} ${output;ext=.hh:Args} ${output;ext=.hpp:Args} ${output;ext=.inc:Args} ${output;ext=.i:Args}
}
# tag:internal
### @usage: _TARGET_SOURCES_FOR_HEADERS(Args...) # internal
### Generate prefix " && target_sources PRIVATE " before $Args if Args is not empty
macro _TARGET_SOURCES_FOR_HEADERS(Args...) {
.SEM=$_TARGET_SOURCES_FOR_HEADERS_IMPL(${pre=GENERATE :Args})
}
# tag:internal
### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args when GENERATE is specified in the list of actual arguments
macro _SET_ENV_FOR_CUSTOM_COMMAND_IMPL(GENERATE?" ${CMAKE_COMMAND} -E env ":"", Args...) {
.SEM=$GENERATE ${pre= :Args}
}
# tag:internal
### @usage: _SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args if Args is not empty
macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
.SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args})
}
macro _FMT_INDUCED_DEPS(For, Deps...) {
.CMD=${induced_deps=$For;hide:Deps}
}
### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...)
###
### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR`
### This tells that files of Type resulted from code generation macros (not neccessarily directly,
### but in processing chain of generated files) should have extra dependencies from list of Files...
###
### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from
### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp
### resulted from Cython-processing of generated pyx. The code ganeration will look like:
### ```
### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd)
### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h)
### RUN_PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS)
### ```
###
### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing
### as an element of array parameter. This is needed because language of ya.make doesn't support
### Dict params right now and so it is impossible to directly pass something
### like `{Type1:[Files2...], Type2:[Files2...]}`
###
macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) {
SET($VAR \$_FMT_INDUCED_DEPS($For $Deps))
}
### @usage: RUN_PROGRAM(tool_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
###
### Run a program from arcadia.
### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
###
### Parameters:
### - tool_path - Path to the directory of the tool.
### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
### - CWD dir - Absolute path of the working directory.
### - ENV key=value... - Environment variables.
### - TOOL tools... - Auxiliary tool directories.
### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
###
### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
### Note that Tool is always built for the host platform, so be careful to provide that tool can be built for all Arcadia major host platforms (Linux, MacOS and Windows).
macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
.CMD=${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
.SEM=add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${tool:Tool} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND ${tool:Tool} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
}
# tag:lua-specific
### @usage: RUN_LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
###
### Run a lua script.
### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
###
### Parameters:
### - script_path - Path to the script.3
### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
### - CWD dir - Absolute path of the working directory.
### - ENV key=value... - Environment variables.
### - TOOL tools... - Auxiliary tool directories.
### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
###
### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
macro RUN_LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
.CMD=${cwd:CWD} ${env:ENV} $LUA_TOOL ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p LU"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
}
# tag:python-specific
### @usage: PYTHON(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
###
### Run a python script with $(PYTHON)/python built from devtools/huge_python.
### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
###
### Parameters:
### - script_path - Path to the script.
### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
### - CWD dir - Absolute path of the working directory.
### - ENV key=value... - Environment variables.
### - TOOL tools... - Auxiliary tool directories.
### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
###
### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
macro PYTHON(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
.CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
.SEM=find_package Python2 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python2::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
}
# tag:python-specific
### @usage: RUN_PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
###
### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
###
### Parameters:
### - script_path - Path to the script.
### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
### - CWD dir - Absolute path of the working directory.
### - ENV key=value... - Environment variables.
### - TOOL tools... - Auxiliary tool directories.
### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
###
### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
macro RUN_PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
.CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
.SEM=find_package Python3 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python3::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
}
# tag:java-specific
macro _RUN_JAVA(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) {
PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
.CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input;pre=build/scripts/:HIDE_OUTPUT.py} $JDK_RESOURCE/bin/java $Args ${tool;hide:TOOL} ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
}
### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
###
### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
### You may specify extra dependencies that output files bring using OUTPUT_INCLUDES or INDUCED_DEPS. The change of these may e.g. lead to recompilation of .cpp files extracted from resource.
### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
###
### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
###
### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
###
### RENAME RESOURCE allows to rename the resource without specifying its file name.
###
### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
###
### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
### so you shall place it immediately after resource_id.
macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:") {
.CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
ADD_CHECK(check.resource $Id)
}
### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
###
### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX).
macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
.CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_mds.py"} --key $Key $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p MD"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
ADD_CHECK(check.mds $Key)
}
# tag:internal
### @usage: _FROM_EXTERNAL(ExtFile [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) #internal
###
### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS).
macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") {
.CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$EXT;suf=.external:OutFile} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_external.py"} --external-file ${input:File} --resource-file $(RESOURCE_ROOT)/ext/$OutFile --copy-to-dir $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/fetch_from_sandbox.py"} ${input;hide:"build/scripts/fetch_from_mds.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p XT"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
#FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors
#FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented
}
### @usage LARGE_FILES([AUTOUPDATED] Files...)
###
### Use large file ether from working copy or from remote storage via placeholder <File>.external
### If <File> is present locally (and not a symlink!) it will be copied to build directory.
### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
macro LARGE_FILES(AUTOUPDATED?, Files...) {
# This is needed to correctly switch between remote and local modes
_GLOB($LF $Files)
}
### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
###
### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
.CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_archive.py"} "--archive" ${input:Src} "--file-name" ${suf=-:Src} "--untar-to" $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p FA"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
}
when ($MSVC == "yes") {
C_AS_CXX_FLAGS=/TP /std:c++17
}
otherwise {
C_AS_CXX_FLAGS=-x c++ -std=c++17
}
# tag:cpp-specific
### @usage: COMPILE_C_AS_CXX()
###
### Compile .c files as .cpp ones within a module.
macro COMPILE_C_AS_CXX() {
SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
}
### @usage: NO_DEBUG_INFO()
###
### Compile files without debug info collection.
macro NO_DEBUG_INFO() {
SET(NO_DEBUGINFO yes)
}
### @usage: CTEMPLATE_VARNAMES(File)
###
### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
###
### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
macro CTEMPLATE_VARNAMES(File) {
.CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
}
LLVM_OPTS=
CLANG_BC_ROOT=${CLANG11_RESOURCE_GLOBAL}
macro USE_LLVM_BC12() {
SET(CLANG_BC_ROOT ${CLANG12_RESOURCE_GLOBAL})
}
CLANG_DEFAULT_ROOT=${CLANG_RESOURCE_GLOBAL}
CLANG_C_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang
CLANG_CPP_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang++
CLANG_EMIT_EXTRA_OPTS=
when ($OS_WINDOWS == "yes") {
# we can't use c++latest for clang14 now
# so we set c++20 for it
# for clang11 (actual clang for CLANG_EMIT_AST_CXX and LLVM_COMPILE_* macroses) /std:c++20 provokes "unused-command-line-argument" error
# !do not forget to change this flag when updating build/platform/clang
CLANG_EMIT_EXTRA_OPTS+=/std:c++latest
}
when ($OS_ANDROID == "yes") {
# We use clang shipped with android-ndk which has different layout
CLANG_DEFAULT_ROOT=$CLANG_ANDROID_RESOURCE_GLOBAL
when ($HOST_OS_DARWIN) {
CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
}
otherwise {
CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
}
}
### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
###
### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
### Note: Output name is used as is, no extension added.
macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_CPP_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS -emit-ast -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p ST"} ${kv;hide:"pc light-green"}
PEERDIR(build/platform/clang)
}
### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
###
### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
### Note: Output name is used as is, no extension added.
macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang++ ${pre=-I:_C__INCLUDE} $BC_CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
.SEM=llvm_compile_cxx ${input:Input} ${output;noauto:Output} ${"${CLANGPLUSPLUS}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
PEERDIR(build/platform/clang)
}
### @usage: LLVM_COMPILE_C(Input Output Opts...)
###
### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
### Note: Output name is used as is, no extension added.
macro LLVM_COMPILE_C(Input, Output, Opts...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang ${pre=-I:_C__INCLUDE} $BC_CFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
.SEM=llvm_compile_c ${input:Input} ${output;noauto:Output} ${"${CLANGC}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
PEERDIR(build/platform/clang)
}
### @usage: BPF(Input Output Opts...)
###
### Emit eBPF bytecode from .c file.
### Note: Output name is used as is, no extension added.
macro BPF(Input, Output, Opts...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_C_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BP"} ${kv;hide:"pc light-green"}
PEERDIR(build/platform/clang)
}
LD_BINARY_NAME=ld
when($OS_LINUX) {
LD_BINARY_NAME=ld.lld
}
### @usage: BPF_STATIC(Input Output Opts...)
###
### Emit eBPF bytecode from .c file.
### Note: Output name is used as is, no extension added.
macro BPF_STATIC(Input, Output, Opts...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_C_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BP"} ${kv;hide:"pc light-green"} && ${cwd:BINDIR} $LLD_ROOT_RESOURCE_GLOBAL/$LD_BINARY_NAME -r -b binary -m elf_x86_64 -o ${output;noauto;suf=.bpf.o:Input} ${noauto;nopath:Output}
PEERDIR(build/platform/clang build/platform/lld)
}
### @usage: LLVM_COMPILE_LL(Input Output Opts...)
###
### Compile LLVM bytecode to object representation.
### Note: Output name is used as is, no extension added.
macro LLVM_COMPILE_LL(Input, Output, Opts...) {
.CMD=${CLANG_BC_ROOT}/bin/llvm-as ${input:Input} -o ${output;noauto:Output} ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
PEERDIR(build/platform/clang)
}
### @usage: LLVM_LINK(Output Inputs...)
###
### Call llvm-link on set of Inputs to produce Output.
### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
macro LLVM_LINK(Output, Inputs...) {
.CMD=${CLANG_BC_ROOT}/bin/llvm-link ${input:Inputs} -o ${output;noauto:Output} ${kv;hide:"p LD"} ${kv;hide:"pc light-red"}
.SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Inputs} COMMAND ${LLVMLINK} ${input:Inputs} -o ${output;noauto:Output}
PEERDIR(build/platform/clang)
}
### @usage: LLVM_OPT(Input Output Opts...)
###
### Call llvm-opt with set of Opts on Input to produce Output.
### Note: Output name is used as is, no extension added.
macro LLVM_OPT(Input, Output, Opts...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} ${CLANG_BC_ROOT}/bin/opt ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p OP"} ${kv;hide:"pc yellow"}
.SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMOPT} ${input:Input} -o ${output;noauto:Output} $Opts
PEERDIR(build/platform/clang)
}
### @usage: LLVM_LLC(Src Opts...)
###
### Call llvm-llc with set of Opts on Src to produce object file.
###
### Note: Output name is calculated as concatenation of Src name and platform specific object file extension.
macro LLVM_LLC(Src, Opts...) {
.CMD=${tool:"contrib/libs/llvm14/tools/llc"} ${input:Src} --filetype obj -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts ${kv;hide:"p LC"} ${kv;hide:"pc yellow"}
.SEM=add_custom_command OUTPUT ${output;suf=$OBJECT_SUF;noauto:Src} DEPENDS ${input:Src} COMMAND ${LLVMLLC} --filetype obj ${input:Src} -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts
PEERDIR(build/platform/clang)
}
when ($NO_DEBUGINFO == "yes") {
DEBUG_INFO_FLAGS=
}
when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
DEBUG_INFO_FLAGS=-gline-tables-only
}
# TODO: configurable tar and touch
PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
# tag:internal
### @usage TOUCH(Outputs...) # internal
### Just introduce outputs
macro TOUCH(Outputs...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
}
TOUCH_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p UN"} ${kv;hide:"pc light-cyan"} $TARGET
FAKE_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"pc light-red"} $TARGET
COPY_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/copy_to_dir.py"} --dest-dir $BINDIR --build-root $ARCADIA_BUILD_ROOT $PACKED_PACKAGE_ARGS $SRCS_GLOBAL $PEERS_LATE_OUTS ${skip_by_ext=.pkg.fake:PEERS} ${hide;late_out:AUTO_INPUT} ${hide;late_out;to_namespace=$BINDIR/:SRCS_GLOBAL} ${hide;late_out;to_namespace=$BINDIR/:PEERS_LATE_OUTS} ${hide;late_out;skip_by_ext=.pkg.fake;to_namespace=$BINDIR/:PEERS} ${kv;hide:"package PACKAGE"}
TOUCH_PACKAGE=$FAKE_PACKAGE_CMD $VCS_INFO_DISABLE_CACHE__NO_UID__ && $COPY_PACKAGE_CMD
_P_PK=${kv;hide:"p PK"}
TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK && $ADD_VCS_INFO_FILE_CMD
# Note: we don't use touch.py in the command below to avoid introduction of undesired input
UNION_CMD=$YMAKE_PYTHON -c open(\'$TARGET\',\'w\').close() ${kv;hide:"p UN"} ${kv;hide:"package UNION"} ${kv;hide:"pc light-cyan"} $UNION_OUTS $VCS_INFO_DISABLE_CACHE__NO_UID__
UNION_CMD_MF=$UNION_CMD && $GENERATE_MF
macro _EXPAND_INS_OUTS(FILES{input}[]) {
.CMD=${input;hide:FILES} ${late_out;hide:INPUT}
}
_UNION_EXPLICIT_OUTPUTS=
### @usage: EXPLICIT_OUTPUTS(Files...)
###
### Let UNION has only explicitly specified outputs listed in this macro
### The list of files shall contain results of commands in this UNION.
### Only these files will be outputs of the UNION. This allows to eliminate
### intermediate files being result of the UNION
macro EXPLICIT_OUTPUTS(Files...) {
SET_APPEND(_UNION_EXPLICIT_OUTPUTS ${Files})
}
NO_CHECK_IMPORTS_FOR_VALUE=None
### @usage: NO_CHECK_IMPORTS([patterns])
###
### Do not run checks on imports of Python modules.
### Optional parameter mask patterns describes the names of the modules that do not need to check.
macro NO_CHECK_IMPORTS(Masks...) {
SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
}
# tag:yasm-specific
_YASM_FMT_VALUE=
_YASM_PLATFORM_FLAGS_VALUE=
_YASM_PREDEFINED_FLAGS_VALUE=
when ($OS_DARWIN || $OS_IOS) {
_YASM_FMT_VALUE=macho
_YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
}
elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
_YASM_FMT_VALUE=win
_YASM_PLATFORM_FLAGS_VALUE=-D WIN64
}
elsewhen ($OS_WINDOWS && $ARCH_I386) {
_YASM_FMT_VALUE=win
_YASM_PLATFORM_FLAGS_VALUE=-D WIN32
}
otherwise {
_YASM_FMT_VALUE=elf
_YASM_PLATFORM_FLAGS_VALUE=-D UNIX
_YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
}
when ($ASM_PREFIX) {
ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
}
otherwise {
ASM_PREFIX_VALUE=
}
# tag:yasm-specific
YASM_FLAGS=
YASM_PREINCLUDES_VALUE=
# tag:yasm-specific
macro _SRC_yasm_helper(SRC, PREINCLUDES[], SRCFLAGS...) {
.CMD=${tool:"contrib/tools/yasm"} -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE $YASM_DEBUG_INFO $YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__ -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${pre=-P :PREINCLUDES} ${input;hide:PREINCLUDES} ${SRC} ${kv;hide:"p AS"} ${kv;hide:"pc light-green"}
}
# tag:yasm-specific
macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
.CMD=$_SRC_yasm_helper(${input:SRC}, $SRCFLAGS, PREINCLUDES $PREINCLUDES)
}
# tag:nasm-specific
NASM_FLAGS=
# tag:nasm-specific
macro _SRC_nasm_helper(SRC, SRCFLAGS...) {
.CMD=${NASM_RESOURCE_GLOBAL}/bin/nasm -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} -D ${pre=_;suf=_:HARDWARE_TYPE} $NASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${SRC}
}
# tag:nasm-specific
macro _SRC_nasm(SRC, PREINCLUDES[], SRCFLAGS...) {
.CMD=$_SRC_nasm_helper(${input:SRC}, $SRCFLAGS)
}
# tag:src-processing
when ($USE_NASM_ASSEMBLER == "yes") {
MACRO_ALIAS(_SRC_ASM _SRC_nasm)
}
otherwise {
MACRO_ALIAS(_SRC_ASM _SRC_yasm)
}
### @usage: ASM_PREINCLUDE(AsmFiles...)
###
### Supply additional .asm files to all assembler calls within a module
macro ASM_PREINCLUDE(PREINCLUDES...) {
SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
}
### @usage: RUN_ANTLR(Args...)
###
### Macro to invoke ANTLR3 generator (general case)
macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
PEERDIR(build/external_resources/antlr3 build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
.CMD=$_RUN_JAVA(-jar $ANTLR3_RESOURCE_GLOBAL/antlr-3.5.2-complete-no-st3.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
.SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args
}
### @usage: RUN_ANTLR4(Args...)
###
### Macro to invoke ANTLR4 generator (general case)
macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
_RUN_JAVA(-jar ${input:"contrib/java/antlr/antlr4/antlr.jar"} $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
}
_ANTLR4_LISTENER_GRAMMAR=-listener
_ANTLR4_LISTENER_PARSER=-listener
_ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
_ANTLR4_VISITOR_GRAMMAR=-visitor
_ANTLR4_VISITOR_PARSER=-visitor
_ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
### @usage: RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
###
### Macro to invoke ANTLR4 generator for separate lexer and parser grammars (Cpp)
macro RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES[], LISTENER?"PARSER":"_ANTLR4_EMPTY", VISITOR?"PARSER":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
RUN_ANTLR4(${LEXER} ${PARSER} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${LEXER} ${PARSER} OUT ${noext;suf=.cpp:LEXER} ${noext;suf=.h:LEXER} ${noext;suf=.cpp:PARSER} ${noext;suf=.h:PARSER} ${noext;suf=Listener.h:$LISTENER} ${noext;suf=BaseListener.h:$LISTENER} ${noext;suf=Visitor.h:$VISITOR} ${noext;suf=BaseVisitor.h:$VISITOR} OUTPUT_INCLUDES ${ARCADIA_ROOT}/contrib/libs/antlr4_cpp_runtime/src/antlr4-runtime.h ${OUTPUT_INCLUDES})
PEERDIR(contrib/libs/antlr4_cpp_runtime)
}
### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
###
### Macro to invoke ANTLR4 generator for combined lexer+parser grammars (Cpp)
macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
RUN_ANTLR4(${GRAMMAR} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;suf=Lexer.cpp:GRAMMAR} ${noext;suf=Lexer.h:GRAMMAR} ${noext;suf=Parser.cpp:GRAMMAR} ${noext;suf=Parser.h:GRAMMAR} ${noext;suf=Listener.h:$LISTENER} ${noext;suf=BaseListener.h:$LISTENER} ${noext;suf=Visitor.h:$VISITOR} ${noext;suf=BaseVisitor.h:$VISITOR} OUTPUT_INCLUDES ${ARCADIA_ROOT}/contrib/libs/antlr4_cpp_runtime/src/antlr4-runtime.h ${OUTPUT_INCLUDES})
PEERDIR(contrib/libs/antlr4_cpp_runtime)
}
### @usage: RUN_ANTLR4_GO(GRAMMAR, DEPS <extra_go_deps>, LISTENER, VISITOR, Args...)
###
### Macro to invoke ANTLR4 generator (Go)
macro RUN_ANTLR4_GO(GRAMMAR, DEPS[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
RUN_ANTLR4(${GRAMMAR} -Dlanguage=Go -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;tolower;suf=_lexer.go:GRAMMAR} ${noext;tolower;suf=_parser.go:GRAMMAR} ${noext;tolower;suf=_listener.go:$LISTENER} ${noext;tolower;suf=_base_listener.go:$LISTENER} ${noext;tolower;suf=_visitor.go:$VISITOR} ${noext;tolower;suf=_base_visitor.go:$VISITOR})
PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/sync ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr/v4 $DEPS)
}
### @usage: RUN_ANTLR4_PYTHON(Grammar [LISTENER] [VISITOR] [SUBDIR] [EXTRA_OUTS Outs...] Args...)
###
### `LISTENER` - emit grammar listener
### `VISITOR` - emit grammar visitor
### `SUBDIR` - place generated files to specified subdirectory of BINDIR
### `EXTRA_OUTS` - list extra outputs produced by Antlr (e.g. .interp and .token files) if they are needed. If `SUBDIR` is specied it will affect these as well. Use file names only.
###
### Macro to invoke ANTLR4 generator (Python). The Python3 will be used for PY3_LIBRARY/PY3_PROGRAM/PY3TEST, Python2 will be used in all other cases.
macro RUN_ANTLR4_PYTHON(GRAMMAR, LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", SUBDIR=".", EXTRA_OUTS[], _ANTLR4_EMPTY="", Args...) {
RUN_ANTLR4(${GRAMMAR} -Dlanguage=$ANTLR_PYTHON -o ${BINDIR}/${SUBDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT_NOAUTO ${nopath;noext;pre=${SUBDIR}/;suf=Lexer.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Parser.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Listener.py:$LISTENER} ${nopath;noext;pre=${SUBDIR}/;suf=Visitor.py:$VISITOR} ${pre=${SUBDIR}/:EXTRA_OUTS})
PEERDIR(contrib/python/antlr4)
}
# tag:cpp-specific
macro CPP_ADDINCL(Dirs...) {
ADDINCL($Dirs)
}
# tag:internal
_WHOLE_ARCHIVE_PEERS_VALUE=
### @usage: WHOLE_ARCHIVE(dirnames...) # internal
macro WHOLE_ARCHIVE(PEERS...) {
SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
REQUIRES(${PEERS})
}
ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
macro TASKLET() {
PEERDIR(tasklet/api)
# CPP
CPP_PROTO_PLUGIN(tasklet_cpp tasklet/v1/gen/cpp .tasklet.h)
# Python
PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/v1/gen/python DEPS tasklet/v1/domain/sandbox tasklet/v1/runtime sandbox/sdk2)
}
TASKLET_REG_INCLUDES= \
${output_include;hide:"tasklet/v1/runtime/lib/cpp_wrapper.h"} \
${output_include;hide:"tasklet/v1/runtime/lib/go_wrapper.h"} \
${output_include;hide:"tasklet/v1/runtime/lib/py_wrapper.h"} \
${output_include;hide:"tasklet/v1/runtime/lib/js_wrapper.h"} \
${output_include;hide:"tasklet/v1/runtime/lib/registry.h"}
macro TASKLET_REG(Name, Lang, Impl, Includes...) {
PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
when($Lang == "js") {
# JS runtime links the Node.js from contrib as a library, which is a bit heavy,
# so we do it, only if any JS tasklets are linked into the target
PEERDIR+=tasklet/v1/runtime/js
}
.CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl ${output;noauto:Name.task.cpp} $Includes ${output_include;hide:Includes} $TASKLET_REG_INCLUDES ${kv;hide:"p TT"} ${kv;hide:"pc yellow"}
SRCS(GLOBAL $Name.task.cpp)
}
# TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
# NOT COMPLETE
macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
.CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl -w $Wrapper ${output;noauto:Name.task.cpp} $Includes ${output_include;hide:Includes} $TASKLET_REG_INCLUDES ${kv;hide:"p TT"} ${kv;hide:"pc yellow"}
SRCS(GLOBAL $Name.task.cpp)
}
# tag:cpp-specific
_CPP_PROTO_MODULE_PREFIX=
_CPP_PROTO_MODULE_SUFFIX=
when ($MSVC == "yes" || $CYGWIN == "yes") {
_CPP_PROTO_MODULE_PREFIX=
_CPP_PROTO_MODULE_SUFFIX=.lib
}
otherwise {
_CPP_PROTO_MODULE_PREFIX=lib
_CPP_PROTO_MODULE_SUFFIX=.a
}
### @usage: _EXPOSE(OutputsToExport...)
###
### Allows to mark outputs of macro command as unused in the current module but intended
### to be used in modules consuming current via PEERDIR.
###
### TODO(DEVTOOLS-9000) proper implementation needed
macro _EXPOSE(Args...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).ya_exposed:"empty_"} ${input;hide:Args}
}
### @usage: LIST_PROTO([TO list.proto] Files...) # deprecated
###
### Create list of .proto files in a list-file (should be .proto, files.proto by default)
### with original .proto-files as list's dependencies.
###
### This allows to process files listed, passing list as an argument to the processor
###
### TODO: proper implementation needed
macro LIST_PROTO(TO="files.proto", Files...) {
.CMD=$YMAKE_PYTHON3 ${input:"build/scripts/list.py"} ${Files} ${input;hide:Files} ${stdout;output;noauto:TO} ${output_include;from_input;hide:Files} && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;noext;suf=.pb.h:TO}
_EXPOSE(${TO})
}
# tag:proto
macro _PROTO_DESC_CMD(File) {
.CMD=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --descriptor_set_out=${output;suf=.desc:File} --include_source_info $_PROTOC_FLAGS ${input;rootrel:File}
}
_PROTO_DESC_MERGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $AUTO_INPUT ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
_PROTO_DESC_MERGE_PEERS_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $PEERS $SRCS_GLOBAL ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
NEED_GOOGLE_PROTO_PEERDIRS=yes
CPP_PROTO_LIBRARY_SEM=$CPP_LIBRARY_SEM
JAVA_PROTO_LIBRARY_SEM=$BUILD_PROTO_JAR_SEM $_GRADLE_EXPORT_PUBLISHING_SEM
# tag:proto
### @usage: PROTO_LIBRARY()
###
### Build some varian of protocol buffers library.
###
### The particular variant is selected based on where PEERDIR to PROTO_LIBRARY comes from.
###
### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
### When PEERDIR comes from module for particular language appropriate variant is selected.
### PROTO_LIBRARY also supports emission of GRPC code if GRPC() macro is specified.
### Notes:
### - Python versions emit C++ code in addition to Python as optimization.
### - In some PROTO_LIBRARY-es Java or Python versions are excluded via EXCLUDE_TAGS macros due to incompatibilities.
### - Use from DEPENDS or BUNDLE is not allowed
###
### Documentation: https://wiki.yandex-team.ru/yatool/proto_library/
###
### See: [GRPC()](#macro_GRPC), [OPTIMIZE_PY_PROTOS()](#macro_OPTIMIZE_PY_PROTOS), [INCLUDE_TAGS()](#macro_INCLUDE_TAGS), [EXCLUDE_TAGS()](#macro_EXCLUDE_TAGS)
multimodule PROTO_LIBRARY {
module CPP_PROTO : LIBRARY {
.ALLOWED=_EXPOSE LIST_PROTO
# TODO(svidyuk): think about marker which forces semantics inheritance
.SEM=CPP_PROTO_LIBRARY_SEM
FORCE_COVERAGE_DISABLED=yes
ENABLE(CPP_PROTO)
ENABLE(GEN_PROTO)
NO_CLANG_TIDY()
SET(PEERDIR_TAGS CPP_PROTO)
when ($BUILD_PROTO_AS_EVLOG == "yes" && $USE_VANILLA_PROTOC == "yes") {
_OK=no
}
ASSERT(_OK BUILD_PROTO_AS_EVLOG and USE_VANILLA_PROTOC are incompatible yet)
MODULE_SUFFIX=$_CPP_PROTO_MODULE_SUFFIX
MODULE_PREFIX=$_CPP_PROTO_MODULE_PREFIX
when ($_COMMON_GOOGLE_APIS != "None") {
PEERDIR += contrib/libs/googleapis-common-protos
}
}
module JAVA_PROTO: EXTERNAL_JAVA_LIBRARY {
.EXTS=.jsrc
.ALLOWED=GRPC
.SEM=JAVA_PROTO_LIBRARY_SEM
SET(PEERDIR_TAGS JAVA_PROTO)
ENABLE(JAVA_PROTO)
PEERDIR+=$JAVA_PROTOBUF_PEERS
when ($KOTLIN_PROTO == "yes") {
KOTLIN_PROTO_PEERS=contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION}
KOTLIN_PROTO_FLAGS=--kotlin_out=$ARCADIA_BUILD_ROOT/java_out
}
when ($GRADLE_EXPORT_PUBLISHING == "yes") {
_GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
}
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE
ADDINCL(FOR proto $PROTOBUF_PATH)
when ($_COMMON_GOOGLE_APIS != "None") {
PEERDIR += contrib/java/com/google/api/grpc/proto-google-common-protos/${JAVA_PROTO_COMMON_VERSION}
ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
}
}
module PY_PROTO: PY2_LIBRARY {
.ALIASES=SRCS=PY_SRCS
.ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
.PEERDIRSELF=CPP_PROTO
.SEM=IGNORED
SET(PEERDIR_TAGS PY2 PY_PROTO)
ENABLE(PY_PROTO)
OPTIMIZE_PY_PROTOS()
OBJ_SUF=.py2
# Can not use NO_LINT(), because is not allowed outside of contrib directory
SET(_NO_LINT_VALUE none_internal)
when ($_COMMON_GOOGLE_APIS != "None") {
PEERDIR += contrib/libs/googleapis-common-protos
}
_IGNORE_SELF_PEERS=
_CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
_IGNORE_PEERDIRSELF=CPP_PROTO
}
SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
}
module PY3_PROTO: PY3_LIBRARY {
.ALIASES=SRCS=PY_SRCS
.ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
.PEERDIRSELF=CPP_PROTO
.SEM=IGNORED
SET(PEERDIR_TAGS PY3 PY3_PROTO)
ENABLE(PY3_PROTO)
OPTIMIZE_PY_PROTOS()
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_PREFIX=py3
}
otherwise {
MODULE_PREFIX=libpy3
}
OBJ_SUF=.py3
# Can not use NO_LINT(), because is not allowed outside of contrib directory
SET(_NO_LINT_VALUE none_internal)
when ($_COMMON_GOOGLE_APIS != "None") {
PEERDIR += contrib/libs/googleapis-common-protos
}
_IGNORE_SELF_PEERS=
_CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
_IGNORE_PEERDIRSELF=CPP_PROTO
}
SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
}
module GO_PROTO: GO_LIBRARY {
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO
.SEM=IGNORED
SET(PEERDIR_TAGS GO GO_PROTO)
ENABLE(GO_PROTO)
when ($_COMMON_GOOGLE_APIS == "None") {
}
elsewhen ($_COMMON_GOOGLE_APIS == "") {
PEERDIR += $_GO_COMMON_GOOGLE_APIS
ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
}
otherwise {
PEERDIR += $_COMMON_GOOGLE_APIS
ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
}
}
module DESC_PROTO: _BARE_UNIT {
.CMD=_PROTO_DESC_MERGE_CMD
.SEM=IGNORED
.EXTS=.desc
.NODE_TYPE=Library
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
SET(PEERDIR_TAGS DESC_PROTO)
ENABLE(DESC_PROTO)
MODULE_SUFFIX=.self.protodesc
SET(MODULE_TYPE LIBRARY)
MACRO_ALIAS(EVLOG_CMD _PROTO_DESC_CMD)
MACRO_ALIAS(PROTO_CMD _PROTO_DESC_CMD)
when ($_COMMON_GOOGLE_APIS != "None") {
PEERDIR += contrib/libs/googleapis-common-protos
}
when ($NEED_GOOGLE_PROTO_PEERDIRS == "yes") {
when ($USE_VANILLA_PROTOC == "yes") {
PEERDIR += contrib/libs/protobuf_std/builtin_proto/protos_from_protobuf
}
otherwise {
PEERDIR += contrib/libs/protobuf/builtin_proto/protos_from_protoc
}
}
}
}
module PROTO_DESCRIPTIONS: _BARE_UNIT {
.CMD=_PROTO_DESC_MERGE_PEERS_CMD
.PEERDIR_POLICY=as_build_from
.NODE_TYPE=Library
.RESTRICTED=SRCS
.FINAL_TARGET=yes
SET(PEERDIR_TAGS DESC_PROTO)
SET(MODULE_SUFFIX .protodesc)
SET(MODULE_TYPE PROTO_DESCRIPTIONS)
}
module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
SET(MODULE_TYPE PROTO_REGISTRY)
}
# tag:fbs
_FBS_NAMESPACE_MAP_GLOBAL=
# tag:fbs
macro _FBS_NAMESPACE_IMPL(NAMESPACE, PATH, DUMMY...) {
SET_APPEND(_FBS_NAMESPACE_MAP_GLOBAL ${NAMESPACE}=${PATH})
}
# tag:fbs
macro FBS_NAMESPACE(NAMESPACE, PATH...) {
_FBS_NAMESPACE_IMPL($NAMESPACE $PATH $MODDIR)
}
# tag:fbs
### @usage: FBS_LIBRARY()
###
### Build some variant of Flatbuffers library.
###
### The particular variant is selected based on where PEERDIR to FBS_LIBRARY
### comes from.
###
### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
### When PEERDIR comes from module for particular language appropriate variant
### is selected.
###
### Notes: FBS_NAMESPACE must be specified in all dependent FBS_LIBRARY modules
### if build of Go code is requested.
multimodule FBS_LIBRARY {
module CPP_FBS: LIBRARY {
ENABLE(CPP_FBS)
SET(PEERDIR_TAGS CPP_FBS)
}
module GO_FBS: GO_LIBRARY {
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
ENABLE(GO_FBS)
SET(PEERDIR_TAGS GO GO_FBS)
}
module JAVA_FBS: EXTERNAL_JAVA_LIBRARY {
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
ENABLE(JAVA_FBS)
SET(PEERDIR_TAGS JAVA_FBS)
}
module PY2_FBS: PY2_LIBRARY {
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
.ALIASES=SRCS=PY_SRCS
ENABLE(PY2_FBS)
SET(PEERDIR_TAGS PY2 PY2_FBS)
# Can not use NO_LINT(), because is not allowed outside of contrib directory
SET(_NO_LINT_VALUE none_internal)
}
module PY3_FBS: PY3_LIBRARY {
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
.ALIASES=SRCS=PY_SRCS
ENABLE(PY3_FBS)
SET(PEERDIR_TAGS PY3 PY3_FBS)
# Can not use NO_LINT(), because is not allowed outside of contrib directory
SET(_NO_LINT_VALUE none_internal)
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_PREFIX=py3
}
otherwise {
MODULE_PREFIX=libpy3
}
OBJ_SUF=.py3
}
}
# tag:java-specific
_COMPILE_JSRC=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_jsrc.py"} --input $AUTO_INPUT --output $TARGET --prefix $BINDIR ${kv;hide:"p JC"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
# tag:java-specific
COMPILE_JSRC_MF=$_COMPILE_JSRC && $GENERATE_MF
# tag:java-specific tag:internal
### @usage: JSRC_LIBRARY() # internal
module JSRC_LIBRARY: _BARE_UNIT {
.CMD=COMPILE_JSRC_MF
.EXTS=.java
.PEERDIR_POLICY=as_include
.FINAL_TARGET=no
.ALIASES=SRCS=FILES
PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
MODULE_TYPE=LIBRARY
SET(MODULE_SUFFIX .jsrc)
SET(DONT_RESOLVE_INCLUDES yes)
SET(NEED_PLATFORM_PEERDIRS no)
SET(MODULE_LANG JAVA)
NO_RUNTIME()
}
# tag:maps-specific
@import "${CONF_ROOT}/conf/project_specific/maps/asrc.conf"
# tag:internal
### @usage: _PROXY_LIBRARY() # internal
###
### The use of this module is strictly prohibited!!!
module _PROXY_LIBRARY: LIBRARY {
.EXTS=.a .lib
.PEERDIR_POLICY=as_build_from
.PROXY=yes
.FINAL_TARGET=yes
DISABLE(NEED_ADD_FAKE_SRC)
NO_UTIL()
NO_RUNTIME()
}
# tag:maps-specific
@import "${CONF_ROOT}/conf/project_specific/maps/aar.conf"
@import "${CONF_ROOT}/conf/project_specific/maps/sproto.conf"
@import "${CONF_ROOT}/conf/project_specific/maps/mapkit.conf"
_PRIMARY_OUTPUT_VALUE=
# tag:internal
### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
###
### The use of this module is strictly prohibited!!!
macro PRIMARY_OUTPUT(OUTPUT) {
SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
}
_DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${input;hide:_PRIMARY_OUTPUT_VALUE} ${TARGET}
# tag:internal
### @usage: DLL_PROXY_LIBRARY() # internal
###
### The use of this module is strictly prohibited!!!
module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
.ALLOWED=PRIMARY_OUTPUT
.CMD=_DLL_PROXY_LIBRARY_CMD
}
_PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${kv;hide:"p ld"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
# tag:internal
### @usage: PREBUILT_PROGRAM([programname]) # internal
###
### Program module which uses a prebuilt prgram as its output.
module PREBUILT_PROGRAM: _LINK_UNIT {
.CMD=_PREBUILT_PROGRAM_CMD
.SYMLINK_POLICY=EXE
.ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
.RESTRICTED=SRCS
_BARE_LINK_MODULE()
SET(MODULE_TYPE PROGRAM)
when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
MODULE_SUFFIX=.exe
}
}
### @usage COLLECT_JINJA_TEMPLATES(varname path)
###
### This macro collects all jinja and yaml files in the directory specified by second argument and
### stores result in the variable with mane specified by first parameter.
macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
_GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
}
# tag:go-specific
### @usage: COLLECT_GO_SWAGGER_FILES(Varname, Dir)
###
### Recursively collect files for swagger config creation
macro COLLECT_GO_SWAGGER_FILES(Varname, Dir) {
_GLOB($Varname $Dir/**/*.go ${ARCADIA_ROOT}/go.mod)
}
# tag:go-specific
GO_HOST_OS=unknown
when ($HOST_OS_LINUX) {
GO_HOST_OS=linux
}
elsewhen ($HOST_OS_DARWIN) {
GO_HOST_OS=darwin
}
elsewhen($HOST_OS_WINDOWS) {
GO_HOST_OS=windows
}
# tag:go-specific
GO_HOST_ARCH=unknown
when ($HOST_ARCH_X86_64) {
GO_HOST_ARCH=amd64
}
elsewhen($HOST_ARCH_ARM64) {
GO_HOST_ARCH=arm64
}
# tag:go-specific
GO_TARG_OS=unknown
when ($OS_LINUX) {
GO_TARG_OS=linux
}
elsewhen ($OS_DARWIN) {
GO_TARG_OS=darwin
}
elsewhen ($OS_WINDOWS) {
GO_TARG_OS=windows
}
# tag:go-specific
GO_TARG_ARCH=unknwon
when ($ARCH_X86_64) {
GO_TARG_ARCH=amd64
}
elsewhen ($ARCH_I386) {
GO_TARG_ARCH=x86
}
elsewhen ($ARCH_ARM64) {
GO_TARG_ARCH=arm64
}
# tag:go-specific
GO_HOST_TARG_PARAMS=++host-os $GO_HOST_OS ++host-arch $GO_HOST_ARCH ++targ-os $GO_TARG_OS ++targ-arch $GO_TARG_ARCH
# tag:go-specific
GOSTD_VERSION=1.20
when ($GOSTD_VERSION == "1.20") {
GOSTD=contrib/go/_std_1.20/src
}
otherwise {
GOSTD=__unsupported_go_std_library_version_[$GOSTD_VERSION]__
}
# tag:go-specific
GO_DEBUG_PATH_RELATIVE=no
_GO_DEBUG_PATH__NO_UID__=
_GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=
# tag:go-specific
_GO_BUILDMODE=
_GO_IMPORT_PATH=${MODDIR}
# tag:go-specific
GO_VET=yolint
GO_VET_TOOL=
GO_VET_FLAGS=
GO_VET_EXTRA_FLAGS=
# tag:go-specific
_GO_VET_ADD_CHECK=yes
_GO_FMT_ADD_CHECK=yes
_GO_YDX_FILE=
# tag:go-specific
_GO_CGO1_WRAPPER_FLAGS=--build-prefix=/-B --source-prefix=/-S
_GO_LINK_EXE_EXT_CMD=
# tag:go-specific
GO_WITH_MUSL=
# tag:go-specific
GO_TOOLS_ROOT=${GO_TOOLS_RESOURCE_GLOBAL}
GO_TEST_MINER=${tool:"tools/go_test_miner"}
GO_TEST_IMPORT_PATH=
# tag:go-specific
GO_STD_LIB_PREFIX=${GOSTD}/
GO_STD_CMD_PREFIX=${GOSTD}/cmd/
GO_ARCADIA_PROJECT_PREFIX=a.yandex-team.ru/
GO_CONTRIB_PROJECT_PREFIX=vendor/
GO_SKIP_IMPORTS=unsafe C
GO_VET_INFO_EXT=.vet.out
GO_VET_REPORT_EXT=.vet.txt
GO_VET_OUTPUT_INFO=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_INFO_EXT}:REALPRJNAME}
GO_VET_OUTPUT_REPORT=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_REPORT_EXT}:REALPRJNAME}
# tag:go-specific tag:codenav
_GO_YNDEXER_EXT=.ydx.pb2
GO_YNDEXER_OUTPUT=${output;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${_GO_YNDEXER_EXT}:REALPRJNAME}
# tag:go-specific
GO_PROJECT_PREFIXES=++std-lib-prefix $GO_STD_LIB_PREFIX ++arc-project-prefix $GO_ARCADIA_PROJECT_PREFIX
# tag:go-specific
_GO_FAKEID=${FAKEID}.${BUILD_TYPE}.${GOSTD_VERSION}.${GO_FAKEID}
_CGO_FAKEID=${_GO_FAKEID}.${CPP_FAKEID}
# tag:go-specific
CGO2_CFLAGS_VALUE=
CGO2_LDFLAGS_VALUE=
# tag:go-specific
GO_ASM_FLAGS_VALUE=
### @usage: GO_ASM_FLAGS(flags)
### Add the specified flags to the go asm compile command line.
macro GO_ASM_FLAGS(Flags...) {
SET_APPEND(GO_ASM_FLAGS_VALUE $Flags)
}
# tag:go-specific
GO_CGO1_FLAGS_VALUE=
### @usage: GO_CGO1_FLAGS(flags)
### Add the specified flags to the go cgo compile command line.
macro GO_CGO1_FLAGS(Flags...) {
SET_APPEND(GO_CGO1_FLAGS_VALUE $Flags)
}
# tag:go-specific
GO_CGO2_FLAGS_VALUE=
### @usage: GO_CGO2_FLAGS(flags)
### Add the specified flags to the go cgo compile command line.
macro GO_CGO2_FLAGS(Flags...) {
SET_APPEND(GO_CGO2_FLAGS_VALUE $Flags)
}
# tag:go-specific
GO_COMPILE_FLAGS_VALUE=$USER_GO_COMPILE_FLAGS
### @usage: GO_COMPILE_FLAGS(flags)
### Add the specified flags to the go compile command line.
macro GO_COMPILE_FLAGS(Flags...) {
SET_APPEND(GO_COMPILE_FLAGS_VALUE $Flags)
}
# tag:go-specific
GO_LINK_FLAGS_VALUE=$USER_GO_LINK_FLAGS
### @usage: GO_LINK_FLAGS(flags)
### Add the specified flags to the go link command line.
macro GO_LINK_FLAGS(Flags...) {
SET_APPEND(GO_LINK_FLAGS_VALUE $Flags)
}
# tag:go-specific
_GO_LANG_VERSION_VALUE=
macro GOLANG_VERSION(Arg) {
SET(_GO_LANG_VERSION_VALUE $Arg)
}
# tag:go-specific
_GO_TOOL_MODE=
# tag:go-specific
_GO_TOOL_COMMON_FLAGS=\
++mode $_GO_TOOL_MODE \
$GO_PROJECT_PREFIXES \
++goversion $GOSTD_VERSION \
++lang $_GO_LANG_VERSION_VALUE \
++source-root $ARCADIA_ROOT \
++build-root $ARCADIA_BUILD_ROOT \
++output-root $BINDIR \
++toolchain-root $GO_TOOLS_ROOT \
$GO_HOST_TARG_PARAMS \
++output $TARGET \
$GO_VET_OUTPUT \
$_GO_YDX_FILE \
$_GO_DEBUG_PATH__NO_UID__ \
++srcs $AUTO_INPUT ${input:GO_FILES} \
++asm-flags $GO_ASM_FLAGS_VALUE \
++compile-flags $GO_COMPILE_FLAGS_VALUE \
++link-flags $GO_LINK_FLAGS_VALUE \
++cgo-srcs ${input:CGO_FILES} \
$_GO_EMBED_VALUE \
$_GO_BUILDMODE \
$GO_TOOLCHAIN_ENV
# tag:go-specific
macro _GO_GEN_COVER_GO(GO_FILE, GO_COVER_OUTPUT, VAR_ID) {
.CMD=${hide:_GO_FAKEID} $GO_TOOLS_ROOT/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cover -mode set -var $VAR_ID -o ${output;noext;suf=.cover.go:GO_COVER_OUTPUT} ${input:GO_FILE}
}
# tag:go-specific
macro _GO_COMPILE_SYMABIS(FLAGS[], ASM_FILES...) {
.CMD=${hide:_CGO_FAKEID} $GO_TOOLS_ROOT/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/asm $_GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__ ${pre=-I :_C__INCLUDE} -I $GO_TOOLS_ROOT/pkg/include -D GOOS_${GO_TARG_OS} -D GOARCH_${GO_TARG_ARCH} $FLAGS $GO_ASM_FLAGS_VALUE -gensymabis -o ${output:"gen.symabis"} ${input:ASM_FILES} ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
.ADDINCL=build/scripts/go_fake_include
}
# tag:go-specific
macro _GO_COMPILE_CGO1(NAME, FLAGS[], FILES...) {
.CMD=${hide:_CGO_FAKEID} ${cwd:ARCADIA_ROOT} $YMAKE_PYTHON ${input:"build/scripts/cgo1_wrapper.py"} $_GO_CGO1_WRAPPER_FLAGS --build-root ${ARCADIA_BUILD_ROOT} --source-root ${ARCADIA_ROOT} --cgo1-files ${output;noext:FILES.cgo1.go} --cgo2-files ${output;noauto;noext:FILES.cgo2.c} -- ${GO_TOOLS_ROOT}/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cgo -objdir $BINDIR -importpath $NAME $GO_CGO1_FLAGS_VALUE $FLAGS -- $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} ${CGO_CFLAGS_VALUE} ${input:FILES} ${output;hide:"_cgo_export.h"} ${output;hide:"_cgo_export.c"} ${output;hide:"_cgo_gotypes.go"} ${output;noauto;hide:"_cgo_main.c"} ${output;noauto;hide:"_cgo_flags"} $GO_TOOLCHAIN_ENV ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
}
# tag:go-specific
macro _GO_COMPILE_CGO2(NAME, C_FILES[], S_FILES[], OBJ_FILES[], FILES...) {
.CMD=${hide:_CGO_FAKEID} $C_COMPILER $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} $CGO_CFLAGS_VALUE ${input;tobindir:"_cgo_main.c"} -c -o ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_main.c"} && $C_COMPILER $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} -o ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_"} $LDFLAGS $LDFLAGS_GLOBAL $CGO2_LDFLAGS_VALUE ${input;hide:"_cgo_export.h"} ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_main.c"} ${input;suf=${OBJECT_SUF}:"_cgo_export.c"} ${input;nopath;noext;suf=.cgo2.c${OBJECT_SUF}:FILES} ${input;suf=${OBJECT_SUF}:C_FILES} ${input;suf=.o:S_FILES} ${input:OBJ_FILES} $CGO_LDFLAGS_VALUE && ${GO_TOOLS_ROOT}/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cgo -dynpackage $NAME -dynimport ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_"} -dynout ${output:"_cgo_import.go"} -dynlinker $GO_CGO2_FLAGS_VALUE $GO_TOOLCHAIN_ENV ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
_USE_LINKER()
}
GO_TOOL=$YMAKE_PYTHON3 ${input:"build/scripts/go_tool.py"} $_PROCESS_WHOLE_ARCHIVE_SCRIPT
# tag:go-specific
macro _GO_LINK_LIB_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
.CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} --ya-end-command-file ${kv;hide:"p GO"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"}
}
# tag:go-specific
macro _GO_LINK_EXE_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
.CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++vcs $VCS_GO $GO_WITH_MUSL $GO_EXTLD ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} ++non-local-peers ${rootrel;tags_in=GO|GO_PROTO|GO_FBS;tags_out=local:PEERS} ++cgo-peers ${VCS_C_OBJ_RR} ${rootrel;tags_out=GO|GO_PROTO|GO_FBS:PEERS} --ya-end-command-file ${kv;hide:"p LD"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"} $_GO_LINK_EXE_EXT_CMD
}
# tag:go-specific
macro _GO_LINK_TEST_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_TEST_FILES[], GO_XTEST_FILES[], GO_FILES...) {
.CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++vcs $VCS_GO $GO_WITH_MUSL $GO_EXTLD ++test-miner $GO_TEST_MINER ++test-import-path $GO_TEST_IMPORT_PATH ++peers ${rootrel;tags_in=local,GO|local,GO_PROGRAM|local,GO_PROTO|local,GO_FBS:PEERS} ++non-local-peers ${rootrel;tags_in=GO|GO_PROTO|GO_FBS;tags_out=local:PEERS} ++cgo-peers ${VCS_C_OBJ_RR} ${rootrel;tags_out=GO|GO_PROGRAM|GO_PROTO|GO_FBS:PEERS} ++test_srcs ${input:GO_TEST_FILES} ++xtest_srcs ${input:GO_XTEST_FILES} ++cover_info $GO_COVER_INFO_VALUE ++skip-tests $_GO_SKIP_TEST_VALUE --ya-end-command-file ${kv;hide:"p GO"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"}
}
# tag:go-specific
GO_LINK_LIB=$GENERATE_MF && $_GO_LINK_LIB_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_INPUTS $_GO_EMBED_INPUTS)
GO_LINK_EXE=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $GENERATE_VCS_GO_INFO_NODEP && $_GO_LINK_EXE_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_INPUTS $_GO_EMBED_INPUTS)
GO_LINK_TEST=$GENERATE_VCS_C_INFO_NODEP && $GENERATE_VCS_GO_INFO_NODEP && $_GO_LINK_TEST_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_INPUTS $_GO_EMBED_INPUTS GO_TEST_FILES $_GO_TEST_SRCS_VALUE GO_XTEST_FILES $_GO_XTEST_SRCS_VALUE)
GO_LINK_DLL=$GO_LINK_EXE && $COPY_CMD $BINDIR/_cgo_export.h ${output;pre=${MODULE_PREFIX};suf=.h:REALPRJNAME}
# tag:go-specific
CGO_ENABLED=yes
when ($OS_WINDOWS == "yes" || $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
CGO_ENABLED=no
}
elsewhen ($CGO_ENABLED == "yes") {
GO_LINK_FLAGS_VALUE+=-linkmode=external
}
# tag:go-specific
GO_PACKAGE_VALUE=
### @usage: GO_PACKAGE_NAME(Name)
### Override name of a Go package.
macro GO_PACKAGE_NAME(NAME) {
SET(GO_PACKAGE_VALUE $NAME)
}
# tag:go-specific tag:internal
_GO_SRCS_VALUE=
### @usage: _GO_SRCS(Files...) # internal
### This macro shouldn't be used in ya.make files, use SRCS() instead.
### This is internal macro collecting .go sources for processing within Go modules (GO_PROGRAM and GO_LIBRARY)
macro _GO_SRCS(FILES...) {
GO_FAKE_OUTPUT($FILES)
SET_APPEND(_GO_SRCS_VALUE $FILES)
}
# tag:go-specific
_GO_TEST_SRCS_VALUE=
GO_HAS_INTERNAL_TESTS=no
### @usage: GO_TEST_SRCS(Files...)
### .go sources for internal tests of a module
macro GO_TEST_SRCS(FILES...) {
GO_FAKE_OUTPUT($FILES)
_SET_FIRST_VALUE(GO_HAS_INTERNAL_TESTS ${pre=yes :FILES} ${GO_HAS_INTERNAL_TESTS})
SET_APPEND(_GO_TEST_SRCS_VALUE $FILES)
}
# tag:go-specific
_GO_XTEST_SRCS_VALUE=
GO_HAS_EXTERNAL_TESTS=no
### @usage: GO_XTEST_SRCS(Files...)
### .go sources for external tests of a module
macro GO_XTEST_SRCS(FILES...) {
GO_FAKE_OUTPUT($FILES)
SET(GO_HAS_EXTERNAL_TESTS yes)
SET_APPEND(_GO_XTEST_SRCS_VALUE $FILES)
}
# tag:go-specific
macro _GO_UNUSED_SRCS(FLAGS...) {
ENABLE(UNUSED_MACRO)
}
# tag:go-specific
_CGO_SRCS_VALUE=
### @usage: CGO_SRCS(Files...)
### .go sources to be built with CGO
macro CGO_SRCS(FILES...) {
SET_APPEND(_CGO_SRCS_VALUE $FILES)
PEERDIR(${GOSTD}/syscall)
}
# tag:go-specific
GO_LDFLAGS_GLOBAL=
### @usage: GO_LDFLAGS(Flags...)
### Link flags for GO_PROGRAM linking from .go sources
macro GO_LDFLAGS(FLAGS...) {
SET_APPEND(GO_LDFLAGS_GLOBAL $FLAGS)
}
# tag:go-specific
CGO_CFLAGS_VALUE=
### @usage: CGO_CFLAGS(Flags...)
### Compiler flags specific to CGO compilation
macro CGO_CFLAGS(FLAGS...) {
SET_APPEND(CGO_CFLAGS_VALUE $FLAGS)
CFLAGS($FLAGS)
}
# tag:go-specific
CGO_LDFLAGS_VALUE=
### @usage: CGO_LDFLAGS(Files...)
### Linker flags specific to CGO linking
macro CGO_LDFLAGS(FLAGS...) {
SET_APPEND(CGO_LDFLAGS_VALUE $FLAGS)
GO_LDFLAGS($FLAGS)
}
# tag:go-specific
_GO_SKIP_TEST_VALUE=
### @usage: GO_SKIP_TESTS(TestNames...)
###
### Define a set of tests that should not be run.
### NB! Subtests are not taken into account!
macro GO_SKIP_TESTS(TESTS...) {
SET_APPEND(_GO_SKIP_TEST_VALUE $TESTS)
RESTRICT_PATH(vendor MSG This macro is prohibited to be used outside the vendor/ directory)
}
# tag:go-specific tag:internal
_GO_EMBED_VALUE=
_GO_EMBED_INPUTS=
### @usage: _GO_EMBED_PATTERN(PATTERN) # internal
###
### Define an embed pattern.
macro _GO_EMBED_PATTERN(XTEST?"_xtest":"", PATTERN, IMPORT_PATH) {
SET(VAR_SALT1 $XTEST $PATTERN $IMPORT_PATH 1)
SET(_PATTERN_GLOB1 uniq_embed_${hash:VAR_SALT1})
_GLOB($_PATTERN_GLOB1 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/.*)
SET(VAR_SALT2 $XTEST $PATTERN $IMPORT_PATH 2)
SET(_PATTERN_GLOB2 _uniq_embed_${hash:VAR_SALT2})
_GLOB($_PATTERN_GLOB2 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN})
SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $PATTERN \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
}
# tag:go-specific
### @usage: GO_EMBED_PATTERN(PATTERN)
###
### Define an embed pattern.
macro GO_EMBED_PATTERN(PATTERN) {
_GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
}
# tag:go-specific
### @usage: GO_TEST_EMBED_PATTERN(PATTERN)
###
### Define an embed pattern for internal go tests.
macro GO_TEST_EMBED_PATTERN(PATTERN) {
_GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
}
# tag:go-specific
### @usage: GO_XTEST_EMBED_PATTERN(PATTERN)
###
### Define an embed pattern for external go tests.
macro GO_XTEST_EMBED_PATTERN(PATTERN) {
_GO_EMBED_PATTERN(XTEST $PATTERN $_GO_IMPORT_PATH)
}
# tag:go-specific tag:internal
### @usage: _GO_EMBED_DIR(PATTERN) # internal
###
### Define an embed directory DIR.
macro _GO_EMBED_DIR(XTEST?"_xtest":"", DIR, IMPORT_PATH, ALL?"all:":"", EXCLUDES...) {
SET(VAR_SALT $XTEST $DIR $IMPORT_PATH)
SET(_PATTERN_GLOB uniq_embed_${hash:VAR_SALT})
_GLOB($_PATTERN_GLOB ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/* EXCLUDE ${pre=${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/:EXCLUDES})
SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $ALL$DIR \$$_PATTERN_GLOB)
SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB)
}
# tag:go-specific
### @usage: GO_EMBED_DIR(DIR)
###
### Define an embed directory DIR.
macro GO_EMBED_DIR(ALL?"ALL":"_* .*", DIR) {
_GO_EMBED_DIR($DIR $_GO_IMPORT_PATH ${ALL})
}
# tag:go-specific
### @usage: GO_EMBED_TEST_DIR(DIR)
###
### Define an embed directory DIR for internal go tests.
macro GO_EMBED_TEST_DIR(ALL?"ALL":"_* .*", DIR) {
_GO_EMBED_DIR($DIR $_GO_IMPORT_PATH ${ALL})
}
# tag:go-specific
### @usage: GO_EMBED_XTEST_DIR(DIR)
###
### Define an embed directory DIR for external go tests.
macro GO_EMBED_XTEST_DIR(ALL?"ALL":"_* .*", DIR) {
_GO_EMBED_DIR(XTEST $DIR $_GO_IMPORT_PATH ${ALL})
}
# tag:go-specific
_GO_TOOLCHAIN_ENV_GOARCH=unknown
when ($ARCH_ARM64) {
_GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=arm64"}
}
elsewhen ($ARCH_X86_64) {
_GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=amd64"}
}
# tag:go-specific
_GO_TOOLCHAIN_ENV_GOOS=unknown
when ($OS_DARWIN) {
_GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=darwin"}
}
elsewhen ($OS_LINUX) {
_GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=linux"}
}
elsewhen ($OS_WINDOWS) {
_GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=windows"}
}
_GO_TOOLCHAIN_ENV_PATH=
# tag:go-specific
GO_TOOLCHAIN_ENV=$TOOLCHAIN_ENV $_GO_TOOLCHAIN_ENV_GOARCH $_GO_TOOLCHAIN_ENV_GOOS $_GO_TOOLCHAIN_ENV_PATH
# tag:go-specific
_GO_GRPC_WELLKNOWN=\
vendor/google.golang.org/grpc \
vendor/google.golang.org/grpc \
vendor/google.golang.org/grpc/codes \
vendor/google.golang.org/grpc/grpclog \
vendor/google.golang.org/grpc/status
# tag:go-specific
macro _GO_GRPC() {
SET(GO_PROTO_GEN_PLUGINS plugins=grpc)
SET(GO_PROTO_GRPC_OPTS \$GO_PROTO_GRPC_OPTS_V2)
SET(GO_PROTO_GRPC_OUTS \$GO_PROTO_GRPC_OUTS_V2)
PEERDIR(${GOSTD}/context ${_GO_GRPC_WELLKNOWN})
}
# tag:go-specific
### @usage: GO_GRPC_GATEWAY_SRCS()
###
### Use of grpc-gateway plugin (Supported for Go only).
macro GO_GRPC_GATEWAY_SRCS(FILE...) {
ENABLE(UNUSED_MACRO)
}
# tag:go-specific
### @usage: GO_GRPC_GATEWAY_SWAGGER_SRCS()
###
### Use of grpc-gateway plugin w/ swagger emission (Supported for Go only).
macro GO_GRPC_GATEWAY_SWAGGER_SRCS(FILE...) {
PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
}
# tag:go-specific
_GO_PROTO_GRPC_GATEWAY_OPTS=
_GO_PROTO_GRPC_GATEWAY_OUTS=
# tag:go-specific
macro _GO_GRPC_GATEWAY_SRCS_IMPL(Files...) {
foreach (File : $Files) {
[.proto]=$_GO_PROTO_CMD_IMPL($File $_GO_PROTO_GRPC_GATEWAY_OPTS $_GO_PROTO_GRPC_GATEWAY_OUTS)
}
PEERDIR(${GOSTD}/context ${GOSTD}/io ${GOSTD}/net/http)
PEERDIR(vendor/github.com/golang/protobuf/descriptor)
PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/runtime)
PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/utilities)
PEERDIR(vendor/google.golang.org/grpc/metadata)
}
# tag:go-specific
macro _SETUP_GO_GRPC_GATEWAY() {
SET(_GO_PROTO_GRPC_GATEWAY_OPTS $_PROTO_PLUGIN_ARGS_BASE(go_grpc_gw vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway allow_repeated_fields_in_body=true))
SET(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;nopath;noext;suf=.pb.gw.go:File})
}
# tag:go-specific
macro _GO_GRPC_GATEWAY_SRCS(Files...) {
_SETUP_GO_GRPC_GATEWAY()
_GO_GRPC_GATEWAY_SRCS_IMPL($Files)
}
# tag:go-specific
macro _GO_GRPC_GATEWAY_SWAGGER_SRCS(Files...) {
_SETUP_GO_GRPC_GATEWAY()
SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OPTS $_PROTO_PLUGIN_ARGS_BASE(swagger vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger logtostderr=true allow_repeated_fields_in_body=true))
SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;noauto;nopath;noext;suf=.swagger.json:File})
_GO_GRPC_GATEWAY_SRCS_IMPL($Files)
PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
}
#tag:go-specific
### @usage: GO_GRPC_GATEWAY_V2_OPENAPI_SRCS(Files...)
###
### Use of grpc-gateway plugin w/ openapi v2 emission (Supported for Go only).
macro GO_GRPC_GATEWAY_V2_OPENAPI_SRCS(NO_JSON_NAMES_FOR_FIELDS?"":"", Files...) {
PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options)
}
macro _GO_GRPC_GATEWAY_V2_OPENAPI_SRCS(NO_JSON_NAMES_FOR_FIELDS?"json_names_for_fields=false":"", Files...) {
_SETUP_GO_GRPC_GATEWAY_V2()
SET_APPEND(_GO_PROTO_GRPC_GATEWAY_V2_OPTS $_PROTO_PLUGIN_ARGS_BASE(openapiv2 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 $NO_JSON_NAMES_FOR_FIELDS logtostderr=true))
SET_APPEND(_GO_PROTO_GRPC_GATEWAY_V2_OPTS \${output;hide;norel;noauto;nopath;noext;suf=.swagger.json:File})
_GO_GRPC_GATEWAY_V2_SRCS_IMPL($Files)
PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options)
}
# tag:go-specific
### @usage: GO_GRPC_GATEWAY_V2_SRCS()
###
### Use of grpc-gateway plugin (Supported for Go only).
macro GO_GRPC_GATEWAY_V2_SRCS(FILE...) {
ENABLE(UNUSED_MACRO)
}
# tag:go-specific
_GO_PROTO_GRPC_GATEWAY_V2_OPTS=
_GO_PROTO_GRPC_GATEWAY_V2_OUTS=
# tag:go-specific
macro _GO_GRPC_GATEWAY_V2_SRCS_IMPL(Files...) {
foreach (File : $Files) {
[.proto]=$_GO_PROTO_CMD_IMPL($File $_GO_PROTO_GRPC_GATEWAY_V2_OPTS $_GO_PROTO_GRPC_GATEWAY_V2_OUTS)
}
PEERDIR(${GOSTD}/context ${GOSTD}/io ${GOSTD}/net/http)
PEERDIR(vendor/github.com/golang/protobuf/descriptor)
PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime)
PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities)
PEERDIR(vendor/google.golang.org/grpc/metadata)
PEERDIR(vendor/google.golang.org/protobuf/proto)
}
# tag:go-specific
macro _SETUP_GO_GRPC_GATEWAY_V2() {
SET(_GO_PROTO_GRPC_GATEWAY_V2_OPTS $_PROTO_PLUGIN_ARGS_BASE(go_grpc_gw vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway allow_repeated_fields_in_body=true))
SET(_GO_PROTO_GRPC_GATEWAY_V2_OUTS \${output;hide;norel;nopath;noext;suf=.pb.gw.go:File})
}
# tag:go-specific
macro _GO_GRPC_GATEWAY_V2_SRCS(Files...) {
_SETUP_GO_GRPC_GATEWAY_V2()
_GO_GRPC_GATEWAY_V2_SRCS_IMPL($Files)
}
# tag:go-specific
when ($MUSL == "yes") {
_GO_DEFAULT_ALLOCATOR=LF
}
otherwise {
_GO_DEFAULT_ALLOCATOR=FAKE
}
# tag:go-specific tag:internal
### @usage _GO_BASE_UNIT # internal
###
### The base module of all golang modules. Defines common properties, dependencies and rules for go build.
module _GO_BASE_UNIT: _BASE_UNIT {
.EXTS=.go .gosrc .o .obj .a .symabis .mf
.CMD=TOUCH_UNIT
.NODE_TYPE=Bundle
.GLOBAL=GO_LDFLAGS
.PEERDIR_POLICY=as_build_from
.ALIASES=SRCS=_GO_SRCS RESOURCE=_GO_RESOURCE GO_TEST_SRCS=_GO_UNUSED_SRCS GO_XTEST_SRCS=_GO_UNUSED_SRCS GRPC=_GO_GRPC GO_GRPC_GATEWAY_SRCS=_GO_GRPC_GATEWAY_SRCS GO_GRPC_GATEWAY_SWAGGER_SRCS=_GO_GRPC_GATEWAY_SWAGGER_SRCS CFLAGS=CGO_CFLAGS GO_TEST_EMBED_PATTERN=_GO_UNUSED_SRCS GO_XTEST_EMBED_PATTERN=_GO_UNUSED_SRCS GO_TEST_EMBED_DIR=_GO_UNUSED_SRCS GO_XTEST_EMBED_DIR=_GO_UNUSED_SRCS GO_GRPC_GATEWAY_V2_SRCS=_GO_GRPC_GATEWAY_V2_SRCS GO_GRPC_GATEWAY_V2_OPENAPI_SRCS=_GO_GRPC_GATEWAY_V2_OPENAPI_SRCS
.ALLOWED=GO_PROTO_PLUGIN USE_CXX USE_UTIL RESOURCE_FILES
.IGNORED=GO_SKIP_TESTS USE_SKIFF
.RESTRICTED=TEST_SRCS
.DEFAULT_NAME_GENERATOR=UseDirNameOrSetGoPackage
ENABLE(_GO_MODULE)
SET(MODULE_TAG GO)
PEERDIR_TAGS=GO GO_PROTO GO_FBS __EMPTY__
DEFAULT(_GO_VET_TOOL)
DEFAULT(_GO_VET_FLAGS)
DEFAULT(_GO_VET_EXTS)
DEFAULT(_GO_SONAME)
NO_RUNTIME()
SET(COVERAGE_FLAGS)
SET(EXTRA_OUTPUT)
SET(MODULE_LANG GO)
ENABLE(FORCE_CONSISTENT_DEBUG)
PEERDIR(build/external_resources/go_tools)
GO_PROTO_GRPC_OPTS_V2=--plugin=protoc-gen-go-grpc=${tool:_TOOL_PROTOC_GEN_GO_GRPC_V2} --go-grpc_out=${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
GO_PROTO_GRPC_OUTS_V2=${output;norel;nopath;noext;suf=_grpc.pb.go:File}
select ($GO_PROTO_V2) {
"yes" | "on" ? {
GO_PROTO_OUTS+=${output;hide;norel;nopath;noext;suf=.pb.go:File}
GO_PROTO_OPTS+=--plugin=protoc-gen-go=${tool:_TOOL_PROTOC_GEN_GO_V2} --go_out=${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
_GO_PROTO_CHECK_OUTPUT=--check $GO_PROTO_GRPC_OUTS_V2
GO_PROTO_OPTS+=$GO_PROTO_GRPC_OPTS
}
default ? {
GO_PROTO_OUTS+=${output;hide;norel;nopath;noext;suf=.pb.go:File}
GO_PROTO_OPTS+=--plugin=protoc-gen-go=${tool:_TOOL_PROTOC_GEN_GO} --go_out=$GO_PROTO_GEN_PLUGINS:${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
}
}
when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
PEERDIR+=$COMPILER_PLATFORM
}
when ($CLANG == "yes" || $GCC == "yes") {
CGO_CFLAGS_VALUE += -w -pthread -fpic
CGO2_CFLAGS_VALUE += -Wno-unused-variable
}
select ($GO_VET) {
"yes" | "on" ? {
_GO_VET=yes
_GO_VET_FLAGS+=-cgocall=false
}
"yndexer" ? {
_GO_VET=yes
PEERDIR+=build/external_resources/goyndexer
_GO_VET_TOOL=${GOYNDEXER_RESOURCE_GLOBAL}/goyndexer
_GO_YDX_FILE=++ydx-file ${_GO_YNDEXER_EXT}
_GO_VET_FLAGS=-indexer.arc ${ARCADIA_ROOT} -indexer.indexfile ${GO_YNDEXER_OUTPUT} -indexer.loglevel info
_GO_FMT_ADD_CHECK=no
_GO_VET_ADD_CHECK=no
GO_VET_INFO_EXT=.ydx.out
GO_VET_REPORT_EXT=.ydx.txt
_GO_VET_EXTS=++vet-info-ext .ydx.out ++vet-report-ext .ydx.txt
_GO_CGO1_WRAPPER_FLAGS=--build-prefix=__ARCADIA_BUILD_ROOT_PREFIX__ --source-prefix=__ARCADIA_SOURCE_ROOT_PREFIX__
}
"yolint" ? {
_GO_VET=yes
PEERDIR+=build/external_resources/yolint
_GO_VET_TOOL=${YOLINT_RESOURCE_GLOBAL}/yolint
_GO_VET_FLAGS=-migration.config=${input:"${ARCADIA_ROOT}/build/rules/go/migrations.yaml"} -scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
}
"yolint_next" ? {
_GO_VET=yes
PEERDIR+=build/external_resources/yolint
_GO_VET_TOOL=${YOLINT_NEXT_RESOURCE_GLOBAL}/yolint
_GO_VET_FLAGS=-scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
}
"local" ? {
_GO_VET=yes
_GO_VET_FLAGS=
}
default ? {
_GO_VET=no
_GO_VET_FLAGS=
}
}
SET(_GO_VET $_GO_VET)
when ($GO_VET_TOOL == "") {
_GO_VET_TOOL_REAL=$_GO_VET_TOOL
}
otherwise {
_GO_VET_TOOL_REAL=$GO_VET_TOOL
}
when ($GO_VET_FLAGS == "") {
_GO_VET_FLAGS_REAL=$_GO_VET_FLAGS
}
otherwise {
_GO_VET_FLAGS_REAL=$GO_VET_FLAGS
}
when ($_GO_VET == "yes" && $NO_GO_VET != "yes") {
GO_VET_OUTPUT=++vet $_GO_VET_TOOL_REAL ++vet-flags $_GO_VET_FLAGS_REAL $GO_VET_EXTRA_FLAGS $GO_VET_OUTPUT_INFO $GO_VET_OUTPUT_REPORT $_GO_VET_EXTS
}
otherwise {
GO_VET_OUTPUT=
_GO_VET_ADD_CHECK=no
}
when ($GO_DEBUG_PATH_RELATIVE == "yes") {
_GO_DEBUG_PATH__NO_UID__=++debug-root-map source=;build=;tools= ++tools-root $(TOOL_ROOT)
_GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>;$ARCADIA_BUILD_ROOT=>;$(TOOL_ROOT)=>
}
otherwise {
_GO_DEBUG_PATH__NO_UID__=++debug-root-map source=/-S;build=/-B;tools=/-T ++tools-root $(TOOL_ROOT)
_GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>/-S;$ARCADIA_BUILD_ROOT=>/-B;$(TOOL_ROOT)=>/-T
}
_GO_PROCESS_SRCS()
when ($CLANG == "yes") {
_GO_EXTLD=clang
GO_TOOLCHAIN_ENV += ${env:"CC=clang"}
}
otherwise {
_GO_EXTLD=gcc
GO_TOOLCHAIN_ENV += ${env:"CC=gcc"}
}
when ($OS_DARWIN) {
PEERDIR+=build/external_resources/go_fake_xcrun
GO_EXTLD = ++extld $_GO_EXTLD ++extldflags $_GO_SONAME $LD_SDK_VERSION -undefined dynamic_lookup $C_FLAGS_PLATFORM --sysroot=$MACOS_SDK_RESOURCE_GLOBAL --start-wa ${rootrel;ext=.a:SRCS_GLOBAL} --end-wa ${rootrel;ext=.o:SRCS_GLOBAL} --cgo-peers $LDFLAGS $LDFLAGS_GLOBAL $OBJADDE $OBJADDE_LIB $GO_LDFLAGS_GLOBAL $C_LIBRARY_PATH $C_SYSTEM_LIBRARIES_INTERCEPT $C_SYSTEM_LIBRARIES $STRIP_FLAG
CGO2_LDFLAGS_VALUE += $LD_SDK_VERSION -undefined dynamic_lookup -nodefaultlibs -lc
}
elsewhen ($OS_LINUX) {
GO_EXTLD = ++extld $_GO_EXTLD ++extldflags $_GO_SONAME $C_FLAGS_PLATFORM --sysroot=$OS_SDK_ROOT_RESOURCE_GLOBAL -Wl,--whole-archive ${rootrel;ext=.a:SRCS_GLOBAL} -Wl,--no-whole-archive ${rootrel;ext=.o:SRCS_GLOBAL} --cgo-peers $LDFLAGS $LDFLAGS_GLOBAL $OBJADDE $OBJADDE_LIB $GO_LDFLAGS_GLOBAL $C_LIBRARY_PATH $C_SYSTEM_LIBRARIES_INTERCEPT $C_SYSTEM_LIBRARIES $STRIP_FLAG
CGO2_LDFLAGS_VALUE += -Wl,--unresolved-symbols=ignore-all -nodefaultlibs -lc
}
otherwise {
GO_EXTLD = ++extld $_GO_EXTLD
}
when ($RACE == "yes") {
_GO_COMPILE_FLAGS_RACE=-race
_GO_LINK_FLAGS_RACE=-race
}
otherwise {
_GO_COMPILE_FLAGS_RACE=
_GO_LINK_FLAGS_RACE=
}
when ($PIC == "yes" || $PIE == "yes") {
_GO_COMPILE_FLAGS_SHARED=-shared
_GO_ASM_FLAGS_SHARED=-shared
}
otherwise {
_GO_COMPILE_FLAGS_SHARED=
_GO_ASM_FLAGS_SHARED=
}
GO_ASM_FLAGS_VALUE += $_GO_ASM_FLAGS_SHARED
GO_COMPILE_FLAGS_VALUE += $_GO_COMPILE_FLAGS_RACE $_GO_COMPILE_FLAGS_SHARED
GO_LINK_FLAGS_VALUE += $_GO_LINK_FLAGS_RACE
ADDINCL(${GOSTD}/runtime)
}
# tag:go-specific
### @usage: GO_LIBRARY([name])
###
### Go library module definition.
### Compile Go module as a library suitable for PEERDIR from other Go modules.
### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
module GO_LIBRARY: _GO_BASE_UNIT {
.CMD=GO_LINK_LIB
.NODE_TYPE=Bundle
.FINAL_TARGET=no
SET(_GO_TOOL_MODE lib)
SET(MODULE_TYPE LIBRARY)
SET(PEERDIR_TAGS GO GO_PROTO GO_FBS __EMPTY__ PACKAGE_UNION)
_REQUIRE_EXPLICIT_LICENSE(vendor)
MODULE_SUFFIX=.a
}
# tag:go-specific
### @usage: GO_PROGRAM([name])
###
### Go program module definition.
### Compile and link Go module to an executable program.
### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
module GO_PROGRAM: _GO_BASE_UNIT {
.CMD=GO_LINK_EXE
.NODE_TYPE=Program
.PROXY=yes
.SYMLINK_POLICY=EXE
.ALLOWED=INDUCED_DEPS
.FINAL_TARGET=yes
SET(MODULE_TAG GO_PROGRAM)
SET(_GO_TOOL_MODE exe)
SET(MODULE_TYPE PROGRAM)
SET(GO_VET_OUTPUT_INFO)
ALLOCATOR($_GO_DEFAULT_ALLOCATOR)
_USE_LINKER()
ENABLE(COMMON_LINK_SETTINGS)
when ($MUSL == "yes") {
PEERDIR += contrib/libs/musl/full
}
when ($RACE == "yes") {
PEERDIR += contrib/libs/cxxsupp/builtins
}
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_SUFFIX=.exe
}
PEERDIR(${GOSTD}/runtime library/go/core/buildinfo)
when ($RACE == "yes") {
PEERDIR += ${GOSTD}/runtime/cgo
PEERDIR += ${GOSTD}/runtime/race
}
when ($MUSL == "yes") {
GO_WITH_MUSL = ++musl
}
when ($HARDENING == "yes") {
_GO_BUILDMODE=++buildmode=pie
}
}
# tag:go-specific
module _GO_DLL_BASE_UNIT: GO_PROGRAM {
.CMD=GO_LINK_DLL
.SYMLINK_POLICY=SO
.ALLOWED=WHOLE_ARCHIVE
.ARGS_PARSER=DLL
.NODE_TYPE=Library
.PROXY=yes
SET(_GO_TOOL_MODE dll)
SET(MODULE_TYPE DLL)
GO_PACKAGE_NAME(main)
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_SUFFIX=.dll
}
elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
MODULE_PREFIX=lib
MODULE_SUFFIX=.dylib$MODULE_VERSION
}
otherwise {
MODULE_PREFIX=lib
MODULE_SUFFIX=.so$MODULE_VERSION
}
when ($OS_DARWIN) {
_GO_SONAME=-Wl,-install_name,$SONAME
}
elsewhen ($OS_LINUX) {
_GO_SONAME=-Wl,-soname,$SONAME
}
when ($MODULE_VERSION) {
when ($OS_LINUX || $OS_DARWIN) {
_GO_LINK_EXE_EXT_CMD+= && $LINK_OR_COPY_CMD $TARGET ${output;nopath;noext:SONAME}
}
}
}
# tag:go-specific
### @usage: GO_DLL(name major_ver [minor_ver] [PREFIX prefix])
###
### Go ishared object module definition.
### Compile and link Go module to a shared object.
### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
module GO_DLL: _GO_DLL_BASE_UNIT {
}
# tag:go-specific tag:test
### @usage: GO_BENCH_TIMEOUT(x)
###
### Sets timeout in seconds for 1 Benchmark in go benchmark suite
###
### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
macro GO_BENCH_TIMEOUT(bench_timeout) {
SET(GO_BENCH_TIMEOUT $bench_timeout)
}
# tag:go-specific tag:test
### @usage: GO_TEST([name])
###
### Go test module definition.
### Compile and link Go module as a test suitable for running with Arcadia testing support.
### All usual testing support macros like DATA, DEPENDS, SIZE, REQUIREMENTS etc. are supported.
### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
module GO_TEST: GO_PROGRAM {
.CMD=GO_LINK_TEST
.ALIASES=GO_TEST_SRCS=GO_TEST_SRCS GO_XTEST_SRCS=GO_XTEST_SRCS GO_TEST_EMBED_PATTERN=GO_TEST_EMBED_PATTERN GO_XTEST_EMBED_PATTERN=GO_XTEST_EMBED_PATTERN GO_TEST_EMBED_DIR=GO_TEST_EMBED_DIR GO_XTEST_EMBED_DIR=GO_XTEST_EMBED_DIR
.ALLOWED=GO_SKIP_TESTS YT_SPEC
.FINAL_TARGET=no
SET(MODULE_TAG GO_TEST)
SET(PEERDIR_TAGS GO GO_PROGRAM GO_PROTO GO_FBS __EMPTY__)
SET(_GO_TOOL_MODE test)
SET(MODULE_TYPE PROGRAM)
ENABLE(GO_TEST_MODULE)
SET(GO_COVER_INFO_VALUE)
# We have to add uncoditionaly PEERDIR to ${GOSTD}/os here thouth it is really
# needed when TestMain is defined in the source code of the test
PEERDIR(${GOSTD}/os)
PEERDIR(${GOSTD}/testing/internal/testdeps)
PEERDIR(${GOSTD}/testing)
ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.test)
ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.bench)
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
}
# tag:go-specific
macro GO_MOCKGEN_FROM(Path) {
SET(MOCKGEN_FROM ${Path})
}
# tag:go-specific
macro GO_MOCKGEN_TYPES(Types...) {
SET(MOCKGEN_TYPES ${join=\\${__COMMA__}:Types})
}
# tag:go-specific
macro GO_MOCKGEN_REFLECT() {
PEERDIR(${GOSTD}/encoding/gob)
PEERDIR(${GOSTD}/flag)
PEERDIR(${GOSTD}/fmt)
PEERDIR(${GOSTD}/os)
PEERDIR(${GOSTD}/path)
PEERDIR(${GOSTD}/reflect)
PEERDIR(vendor/github.com/golang/mock/mockgen/model)
PEERDIR(${MOCKGEN_FROM})
RUN_PROGRAM(vendor/github.com/golang/mock/mockgen -prog_only a.yandex-team.ru/${MOCKGEN_FROM} $MOCKGEN_TYPES STDOUT main.go)
}
# tag:internal
macro _TOOL(TOOL) {
.CMD=${tool:TOOL}
}
# tag:go-specific
macro GO_MOCKGEN_MOCKS() {
PEERDIR(${GOSTD}/reflect)
PEERDIR(vendor/github.com/golang/mock/gomock)
.CMD=${tool:"vendor/github.com/golang/mock/mockgen"} -package mocks -exec_only $_TOOL($MODDIR/gen) a.yandex-team.ru/${MOCKGEN_FROM} $MOCKGEN_TYPES ${output;stdout:"main.go"}
}
# Conflict between protobuf-java and protobuf-javalite ¯\_(ツ)_/¯
# both libraries are required by grpc
JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE=\
com.google.protobuf.AbstractMessageLite \
com.google.protobuf.AbstractMessageLite$Builder \
com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream \
com.google.protobuf.AbstractMessageLite$InternalOneOfEnum \
com.google.protobuf.AbstractParser \
com.google.protobuf.AbstractProtobufList \
com.google.protobuf.AllocatedBuffer \
com.google.protobuf.AllocatedBuffer$1 \
com.google.protobuf.AllocatedBuffer$2 \
com.google.protobuf.Android \
com.google.protobuf.Any \
com.google.protobuf.Any$1 \
com.google.protobuf.Any$Builder \
com.google.protobuf.AnyOrBuilder \
com.google.protobuf.AnyProto \
com.google.protobuf.Api \
com.google.protobuf.Api$1 \
com.google.protobuf.Api$Builder \
com.google.protobuf.ApiOrBuilder \
com.google.protobuf.ApiProto \
com.google.protobuf.ArrayDecoders \
com.google.protobuf.ArrayDecoders$1 \
com.google.protobuf.ArrayDecoders$Registers \
com.google.protobuf.BinaryReader \
com.google.protobuf.BinaryReader$1 \
com.google.protobuf.BinaryReader$SafeHeapReader \
com.google.protobuf.BinaryWriter \
com.google.protobuf.BinaryWriter$1 \
com.google.protobuf.BinaryWriter$SafeDirectWriter \
com.google.protobuf.BinaryWriter$SafeHeapWriter \
com.google.protobuf.BinaryWriter$UnsafeDirectWriter \
com.google.protobuf.BinaryWriter$UnsafeHeapWriter \
com.google.protobuf.BooleanArrayList \
com.google.protobuf.BoolValue \
com.google.protobuf.BoolValue$1 \
com.google.protobuf.BoolValue$Builder \
com.google.protobuf.BoolValueOrBuilder \
com.google.protobuf.BufferAllocator \
com.google.protobuf.BufferAllocator$1 \
com.google.protobuf.ByteBufferWriter \
com.google.protobuf.ByteOutput \
com.google.protobuf.ByteString \
com.google.protobuf.ByteString$1 \
com.google.protobuf.ByteString$2 \
com.google.protobuf.ByteString$AbstractByteIterator \
com.google.protobuf.ByteString$ArraysByteArrayCopier \
com.google.protobuf.ByteString$BoundedByteString \
com.google.protobuf.ByteString$ByteArrayCopier \
com.google.protobuf.ByteString$ByteIterator \
com.google.protobuf.ByteString$CodedBuilder \
com.google.protobuf.ByteString$LeafByteString \
com.google.protobuf.ByteString$LiteralByteString \
com.google.protobuf.ByteString$Output \
com.google.protobuf.ByteString$SystemByteArrayCopier \
com.google.protobuf.BytesValue \
com.google.protobuf.BytesValue$1 \
com.google.protobuf.BytesValue$Builder \
com.google.protobuf.BytesValueOrBuilder \
com.google.protobuf.CanIgnoreReturnValue \
com.google.protobuf.CheckReturnValue \
com.google.protobuf.CodedInputStream \
com.google.protobuf.CodedInputStream$1 \
com.google.protobuf.CodedInputStream$ArrayDecoder \
com.google.protobuf.CodedInputStream$IterableDirectByteBufferDecoder \
com.google.protobuf.CodedInputStream$StreamDecoder \
com.google.protobuf.CodedInputStream$StreamDecoder$RefillCallback \
com.google.protobuf.CodedInputStream$StreamDecoder$SkippedDataSink \
com.google.protobuf.CodedInputStream$UnsafeDirectNioDecoder \
com.google.protobuf.CodedInputStreamReader \
com.google.protobuf.CodedInputStreamReader$1 \
com.google.protobuf.CodedOutputStream \
com.google.protobuf.CodedOutputStream$1 \
com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder \
com.google.protobuf.CodedOutputStream$ArrayEncoder \
com.google.protobuf.CodedOutputStream$ByteOutputEncoder \
com.google.protobuf.CodedOutputStream$HeapNioEncoder \
com.google.protobuf.CodedOutputStream$OutOfSpaceException \
com.google.protobuf.CodedOutputStream$OutputStreamEncoder \
com.google.protobuf.CodedOutputStream$SafeDirectNioEncoder \
com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder \
com.google.protobuf.CodedOutputStreamWriter \
com.google.protobuf.CodedOutputStreamWriter$1 \
com.google.protobuf.DoubleArrayList \
com.google.protobuf.DoubleValue \
com.google.protobuf.DoubleValue$1 \
com.google.protobuf.DoubleValue$Builder \
com.google.protobuf.DoubleValueOrBuilder \
com.google.protobuf.Duration \
com.google.protobuf.Duration$1 \
com.google.protobuf.Duration$Builder \
com.google.protobuf.DurationOrBuilder \
com.google.protobuf.DurationProto \
com.google.protobuf.Empty \
com.google.protobuf.Empty$1 \
com.google.protobuf.Empty$Builder \
com.google.protobuf.EmptyOrBuilder \
com.google.protobuf.EmptyProto \
com.google.protobuf.Enum \
com.google.protobuf.Enum$1 \
com.google.protobuf.Enum$Builder \
com.google.protobuf.EnumOrBuilder \
com.google.protobuf.EnumValue \
com.google.protobuf.EnumValue$1 \
com.google.protobuf.EnumValue$Builder \
com.google.protobuf.EnumValueOrBuilder \
com.google.protobuf.ExperimentalApi \
com.google.protobuf.ExtensionLite \
com.google.protobuf.ExtensionRegistryFactory \
com.google.protobuf.ExtensionRegistryLite \
com.google.protobuf.ExtensionRegistryLite$ExtensionClassHolder \
com.google.protobuf.ExtensionRegistryLite$ObjectIntPair \
com.google.protobuf.ExtensionSchema \
com.google.protobuf.ExtensionSchemaLite \
com.google.protobuf.ExtensionSchemaLite$1 \
com.google.protobuf.ExtensionSchemas \
com.google.protobuf.Field \
com.google.protobuf.Field$1 \
com.google.protobuf.Field$Builder \
com.google.protobuf.Field$Cardinality \
com.google.protobuf.Field$Cardinality$1 \
com.google.protobuf.Field$Kind \
com.google.protobuf.Field$Kind$1 \
com.google.protobuf.FieldInfo \
com.google.protobuf.FieldInfo$1 \
com.google.protobuf.FieldInfo$Builder \
com.google.protobuf.FieldMask \
com.google.protobuf.FieldMask$1 \
com.google.protobuf.FieldMask$Builder \
com.google.protobuf.FieldMaskOrBuilder \
com.google.protobuf.FieldMaskProto \
com.google.protobuf.FieldOrBuilder \
com.google.protobuf.FieldSet \
com.google.protobuf.FieldSet$1 \
com.google.protobuf.FieldSet$Builder \
com.google.protobuf.FieldSet$FieldDescriptorLite \
com.google.protobuf.FieldType \
com.google.protobuf.FieldType$1 \
com.google.protobuf.FieldType$Collection \
com.google.protobuf.FloatArrayList \
com.google.protobuf.FloatValue \
com.google.protobuf.FloatValue$1 \
com.google.protobuf.FloatValue$Builder \
com.google.protobuf.FloatValueOrBuilder \
com.google.protobuf.GeneratedMessageInfoFactory \
com.google.protobuf.GeneratedMessageLite \
com.google.protobuf.GeneratedMessageLite$1 \
com.google.protobuf.GeneratedMessageLite$Builder \
com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser \
com.google.protobuf.GeneratedMessageLite$ExtendableBuilder \
com.google.protobuf.GeneratedMessageLite$ExtendableMessage \
com.google.protobuf.GeneratedMessageLite$ExtendableMessage$ExtensionWriter \
com.google.protobuf.GeneratedMessageLite$ExtendableMessageOrBuilder \
com.google.protobuf.GeneratedMessageLite$ExtensionDescriptor \
com.google.protobuf.GeneratedMessageLite$GeneratedExtension \
com.google.protobuf.GeneratedMessageLite$MethodToInvoke \
com.google.protobuf.GeneratedMessageLite$SerializedForm \
com.google.protobuf.Int32Value \
com.google.protobuf.Int32Value$1 \
com.google.protobuf.Int32Value$Builder \
com.google.protobuf.Int32ValueOrBuilder \
com.google.protobuf.Int64Value \
com.google.protobuf.Int64Value$1 \
com.google.protobuf.Int64Value$Builder \
com.google.protobuf.Int64ValueOrBuilder \
com.google.protobuf.IntArrayList \
com.google.protobuf.Internal \
com.google.protobuf.Internal$BooleanList \
com.google.protobuf.Internal$DoubleList \
com.google.protobuf.Internal$EnumLite \
com.google.protobuf.Internal$EnumLiteMap \
com.google.protobuf.Internal$EnumVerifier \
com.google.protobuf.Internal$FloatList \
com.google.protobuf.Internal$IntList \
com.google.protobuf.Internal$ListAdapter \
com.google.protobuf.Internal$ListAdapter$Converter \
com.google.protobuf.Internal$LongList \
com.google.protobuf.Internal$MapAdapter \
com.google.protobuf.Internal$MapAdapter$1 \
com.google.protobuf.Internal$MapAdapter$Converter \
com.google.protobuf.Internal$MapAdapter$EntryAdapter \
com.google.protobuf.Internal$MapAdapter$IteratorAdapter \
com.google.protobuf.Internal$MapAdapter$SetAdapter \
com.google.protobuf.Internal$ProtobufList \
com.google.protobuf.InvalidProtocolBufferException \
com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException \
com.google.protobuf.IterableByteBufferInputStream \
com.google.protobuf.JavaType \
com.google.protobuf.LazyField \
com.google.protobuf.LazyField$1 \
com.google.protobuf.LazyField$LazyEntry \
com.google.protobuf.LazyField$LazyIterator \
com.google.protobuf.LazyFieldLite \
com.google.protobuf.LazyStringArrayList \
com.google.protobuf.LazyStringArrayList$ByteArrayListView \
com.google.protobuf.LazyStringArrayList$ByteStringListView \
com.google.protobuf.LazyStringList \
com.google.protobuf.ListFieldSchema \
com.google.protobuf.ListFieldSchema$1 \
com.google.protobuf.ListFieldSchema$ListFieldSchemaFull \
com.google.protobuf.ListFieldSchema$ListFieldSchemaLite \
com.google.protobuf.ListValue \
com.google.protobuf.ListValue$1 \
com.google.protobuf.ListValue$Builder \
com.google.protobuf.ListValueOrBuilder \
com.google.protobuf.LongArrayList \
com.google.protobuf.ManifestSchemaFactory \
com.google.protobuf.ManifestSchemaFactory$1 \
com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory \
com.google.protobuf.MapEntryLite \
com.google.protobuf.MapEntryLite$1 \
com.google.protobuf.MapEntryLite$Metadata \
com.google.protobuf.MapFieldLite \
com.google.protobuf.MapFieldSchema \
com.google.protobuf.MapFieldSchemaLite \
com.google.protobuf.MapFieldSchemas \
com.google.protobuf.MessageInfo \
com.google.protobuf.MessageInfoFactory \
com.google.protobuf.MessageLite \
com.google.protobuf.MessageLite$Builder \
com.google.protobuf.MessageLiteOrBuilder \
com.google.protobuf.MessageLiteToString \
com.google.protobuf.MessageSchema \
com.google.protobuf.MessageSchema$1 \
com.google.protobuf.MessageSetSchema \
com.google.protobuf.Method \
com.google.protobuf.Method$1 \
com.google.protobuf.Method$Builder \
com.google.protobuf.MethodOrBuilder \
com.google.protobuf.Mixin \
com.google.protobuf.Mixin$1 \
com.google.protobuf.Mixin$Builder \
com.google.protobuf.MixinOrBuilder \
com.google.protobuf.MutabilityOracle \
com.google.protobuf.MutabilityOracle$1 \
com.google.protobuf.NewInstanceSchema \
com.google.protobuf.NewInstanceSchemaLite \
com.google.protobuf.NewInstanceSchemas \
com.google.protobuf.NioByteString \
com.google.protobuf.NioByteString$1 \
com.google.protobuf.NullValue \
com.google.protobuf.NullValue$1 \
com.google.protobuf.OneofInfo \
com.google.protobuf.Option \
com.google.protobuf.Option$1 \
com.google.protobuf.Option$Builder \
com.google.protobuf.OptionOrBuilder \
com.google.protobuf.Parser \
com.google.protobuf.PrimitiveNonBoxingCollection \
com.google.protobuf.Protobuf \
com.google.protobuf.ProtobufArrayList \
com.google.protobuf.ProtobufLists \
com.google.protobuf.ProtocolStringList \
com.google.protobuf.ProtoSyntax \
com.google.protobuf.RawMessageInfo \
com.google.protobuf.Reader \
com.google.protobuf.RopeByteString \
com.google.protobuf.RopeByteString$1 \
com.google.protobuf.RopeByteString$Balancer \
com.google.protobuf.RopeByteString$PieceIterator \
com.google.protobuf.RopeByteString$RopeInputStream \
com.google.protobuf.Schema \
com.google.protobuf.SchemaFactory \
com.google.protobuf.SchemaUtil \
com.google.protobuf.SmallSortedMap \
com.google.protobuf.SmallSortedMap$1 \
com.google.protobuf.SmallSortedMap$DescendingEntryIterator \
com.google.protobuf.SmallSortedMap$DescendingEntrySet \
com.google.protobuf.SmallSortedMap$EmptySet \
com.google.protobuf.SmallSortedMap$EmptySet$1 \
com.google.protobuf.SmallSortedMap$EmptySet$2 \
com.google.protobuf.SmallSortedMap$Entry \
com.google.protobuf.SmallSortedMap$EntryIterator \
com.google.protobuf.SmallSortedMap$EntrySet \
com.google.protobuf.SourceContext \
com.google.protobuf.SourceContext$1 \
com.google.protobuf.SourceContext$Builder \
com.google.protobuf.SourceContextOrBuilder \
com.google.protobuf.SourceContextProto \
com.google.protobuf.StringValue \
com.google.protobuf.StringValue$1 \
com.google.protobuf.StringValue$Builder \
com.google.protobuf.StringValueOrBuilder \
com.google.protobuf.Struct \
com.google.protobuf.Struct$1 \
com.google.protobuf.Struct$Builder \
com.google.protobuf.Struct$FieldsDefaultEntryHolder \
com.google.protobuf.StructOrBuilder \
com.google.protobuf.StructProto \
com.google.protobuf.StructuralMessageInfo \
com.google.protobuf.StructuralMessageInfo$Builder \
com.google.protobuf.Syntax \
com.google.protobuf.Syntax$1 \
com.google.protobuf.TextFormatEscaper \
com.google.protobuf.TextFormatEscaper$1 \
com.google.protobuf.TextFormatEscaper$2 \
com.google.protobuf.TextFormatEscaper$ByteSequence \
com.google.protobuf.Timestamp \
com.google.protobuf.Timestamp$1 \
com.google.protobuf.Timestamp$Builder \
com.google.protobuf.TimestampOrBuilder \
com.google.protobuf.TimestampProto \
com.google.protobuf.Type \
com.google.protobuf.Type$1 \
com.google.protobuf.Type$Builder \
com.google.protobuf.TypeOrBuilder \
com.google.protobuf.TypeProto \
com.google.protobuf.UInt32Value \
com.google.protobuf.UInt32Value$1 \
com.google.protobuf.UInt32Value$Builder \
com.google.protobuf.UInt32ValueOrBuilder \
com.google.protobuf.UInt64Value \
com.google.protobuf.UInt64Value$1 \
com.google.protobuf.UInt64Value$Builder \
com.google.protobuf.UInt64ValueOrBuilder \
com.google.protobuf.UninitializedMessageException \
com.google.protobuf.UnknownFieldSchema \
com.google.protobuf.UnknownFieldSetLite \
com.google.protobuf.UnknownFieldSetLiteSchema \
com.google.protobuf.UnmodifiableLazyStringList \
com.google.protobuf.UnmodifiableLazyStringList$1 \
com.google.protobuf.UnmodifiableLazyStringList$2 \
com.google.protobuf.UnsafeByteOperations \
com.google.protobuf.UnsafeUtil \
com.google.protobuf.UnsafeUtil$1 \
com.google.protobuf.UnsafeUtil$Android32MemoryAccessor \
com.google.protobuf.UnsafeUtil$Android64MemoryAccessor \
com.google.protobuf.UnsafeUtil$JvmMemoryAccessor \
com.google.protobuf.UnsafeUtil$MemoryAccessor \
com.google.protobuf.Utf8 \
com.google.protobuf.Utf8$DecodeUtil \
com.google.protobuf.Utf8$Processor \
com.google.protobuf.Utf8$SafeProcessor \
com.google.protobuf.Utf8$UnpairedSurrogateException \
com.google.protobuf.Utf8$UnsafeProcessor \
com.google.protobuf.Value \
com.google.protobuf.Value$1 \
com.google.protobuf.Value$Builder \
com.google.protobuf.Value$KindCase \
com.google.protobuf.ValueOrBuilder \
com.google.protobuf.WireFormat \
com.google.protobuf.WireFormat$1 \
com.google.protobuf.WireFormat$FieldType \
com.google.protobuf.WireFormat$FieldType$1 \
com.google.protobuf.WireFormat$FieldType$2 \
com.google.protobuf.WireFormat$FieldType$3 \
com.google.protobuf.WireFormat$FieldType$4 \
com.google.protobuf.WireFormat$JavaType \
com.google.protobuf.WireFormat$Utf8Validation \
com.google.protobuf.WireFormat$Utf8Validation$1 \
com.google.protobuf.WireFormat$Utf8Validation$2 \
com.google.protobuf.WireFormat$Utf8Validation$3 \
com.google.protobuf.WrappersProto \
com.google.protobuf.Writer \
com.google.protobuf.Writer$FieldOrder
# tag:java-specific
JAVA_IGNORE_CLASSPATH_CLASH_VALUE=$JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE
### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
### Ignore classpath clash test fails for classes
macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args $JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE)
}
# tag:python-specific
### @usage: PY_SRCS({| CYTHON_C} { | TOP_LEVEL | NAMESPACE ns} Files...)
###
### Build specified Python sources according to Arcadia binary Python build. Basically creates precompiled and source resources keyed with module paths.
### The resources eventually are linked into final program and can be accessed as regular Python modules.
### This custom loader linked into the program will add them to sys.meta_path.
###
### PY_SRCS also support .proto, .ev, .pyx and .swg files. The .proto and .ev are compiled to .py-code by protoc and than handled as usual .py files.
### .pyx and .swg lead to C/C++ Python extensions generation, that are automatically registered in Python as built-in modules.
###
### By default .pyx files are built as C++-extensions. Use CYTHON_C to build them as C (similar to BUILDWITH_CYTHON_C, but with the ability to specify namespace).
###
### __init__.py never required, but if present (and specified in PY_SRCS), it will be imported when you import package modules with __init__.py Oh.
###
### @example
###
### PY2_LIBRARY(mymodule)
### PY_SRCS(a.py sub/dir/b.py e.proto sub/dir/f.proto c.pyx sub/dir/d.pyx g.swg sub/dir/h.swg)
### END()
###
### PY_SRCS honors Python2 and Python3 differences and adjusts itself to Python version of a current module.
### PY_SRCS can be used in any Arcadia Python build modules like PY*_LIBRARY, PY*_PROGRAM, PY*TEST.
### PY_SRCS in LIBRARY or PROGRAM effectively converts these into PY2_LIBRARY and PY2_PROGRAM respectively.
### It is strongly advised to make this conversion explicit. Never use PY_SRCS in a LIBRARY if you plan to use it from external Python extension module.
###
### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs/#modulipylibrarypy3libraryimakrospysrcs
macro PY_SRCS() {
DEFAULT(MODULE_TAG PY2)
DEFAULT(PYTHON2 yes)
DEFAULT(PYTHON3 no)
}
# tag:python-specific
_ALL_PY_FILES=
# tag:python-specific
macro _ALL_PY_SRCS2(TOP_LEVEL?"TOP_LEVEL":"", RECURSIVE?"/**":"", ONLY_TEST_FILES?"test_*.py":"*.py", ONLY_TEST_FILES2?"*_test.py":"***", NO_TEST_FILES?"**/test_*.py **/*_test.py":"", NAMESPACE[], REST[], REST2[], EAT_TAIL[]) {
_GLOB(_ALL_PY_FILES ${suf=${RECURSIVE}/${ONLY_TEST_FILES}:REST} ${suf=${RECURSIVE}/${ONLY_TEST_FILES2}:REST2} ${suf=${RECURSIVE}/ya.make:REST} EXCLUDE ya.make ${NO_TEST_FILES})
}
# tag:python-specific
### @usage: ALL_PY_SRCS([RECURSIVE] [NO_TEST_FILES] { | TOP_LEVEL | NAMESPACE ns} [Dirs...])
###
### Puts all .py-files from given Dirs (relative to projects') into PY_SRCS of the current module.
### If Dirs is ommitted project directory is used
###
### `RECURSIVE` makes lookup recursive with resprect to Dirs
### `NO_TEST_FILES` excludes files `test_*.py` and `*_test.py` those are normally subject to `TEST_SRCS`
### `TOP_LEVEL` and `NAMESPACE` are forwarded to `PY_SRCS`
###
### Note: Only one such macro per module is allowed
### Note: Macro is designed to reject any ya.make files in Dirs except current one
###
### @see [PY_SRCS()](#macro_PY_SRCS)
macro ALL_PY_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", NO_TEST_FILES?"NO_TEST_FILES":"", Files...) {
_ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} ${NO_TEST_FILES} REST .${pre=/:Files})
PY_SRCS(_MR ${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} $_ALL_PY_FILES)
}
# tag:python-specific
### @usage: ALL_PYTEST_SRCS([RECURSIVE] [Dirs...])
###
### Puts all .py-files from given Dirs (relative to projects') into TEST_SRCS of the current module.
### If Dirs is omitted project directory is used
###
### `RECURSIVE` makes lookup recursive with respect to Dirs
### `ONLY_TEST_FILES` includes only files `test_*.py` and `*_test.py`, others are normally subject to `PY_SRCS`
###
### Note: Only one such macro per module is allowed
### Note: Macro is designed to reject any ya.make files in Dirs except current one
###
### @see [TEST_SRCS()](#macro_TEST_SRCS)
macro ALL_PYTEST_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", ONLY_TEST_FILES?"ONLY_TEST_FILES ONLY_TEST_FILES2 REST2":"EAT_TAIL", Files...) {
_ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files} ${ONLY_TEST_FILES} .${pre=/:Files})
TEST_SRCS(_MR $_ALL_PY_FILES)
}
# tag:python-specific
_PY_EXTRA_LINT_FILES_VALUE=
### @usage: PY_EXTRA_LINT_FILES(files...)
###
### Add extra Python files for linting. This macro allows adding
### Python files which has no .py extension.
macro PY_EXTRA_LINT_FILES(FILES...) {
SET_APPEND(_PY_EXTRA_LINT_FILES_VALUE $FILES)
}
# tag:python-specific
### @usage: PY23_LIBRARY([name])
###
### Build PY2_LIBRARY or PY3_LIBRARY depending on incoming PEERDIR.
### Direct build or build by RECURSE creates both variants.
### This multimodule doesn't define any final targets, so use from DEPENDS or BUNDLE is not allowed.
###
### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs
multimodule PY23_LIBRARY {
module PY2: PY2_LIBRARY {
.RESTRICTED=RUN_ANTLR4_PYTHON
OBJ_SUF=.py2
}
module PY3: PY3_LIBRARY {
.RESTRICTED=RUN_ANTLR4_PYTHON
RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_PREFIX=py3
}
otherwise {
MODULE_PREFIX=libpy3
}
OBJ_SUF=.py3
}
}
# tag:python-specific
### @usage: PY23_NATIVE_LIBRARY([name])
###
### Build LIBRARY compatible with either Python 2.x or Python 3.x depending on incoming PEERDIR.
###
### This multimodule doesn't depend on Arcadia Python binary build. It is intended only for C++ code and cannot contain PY_SRCS and USE_PYTHON2 macros.
### Use these multimodule instead of PY23_LIBRARY if the C++ extension defined in it will be used in PY2MODULE.
### While it doesn't bring Arcadia Python dependency itself, it is still compatible with Arcadia Python build and can be PEERDIR-ed from PY2_LIBRARY and alikes.
### Proper version will be selected according to Python version of the module PEERDIR comes from.
###
### This mulrtimodule doesn't define any final targets so cannot be used from DEPENDS or BUNDLE macros.
###
### For more information read https://wiki.yandex-team.ru/arcadia/python/pysrcs/#pysrcssrcsipy23nativelibrary
###
### @see [LIBRARY()](#module_LIBRARY), [PY2MODULE()](#module_PY2MODULE)
multimodule PY23_NATIVE_LIBRARY {
module PY2: LIBRARY {
.RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 PYTHON3_ADDINCL RUN_ANTLR4_PYTHON
OBJ_SUF=.py2
PYTHON2_ADDINCL()
SET(MODULE_LANG PY2)
}
module PY3: LIBRARY {
.RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 RUN_ANTLR4_PYTHON
.ALIASES=PYTHON2_ADDINCL=PYTHON3_ADDINCL
.SEM=CPP_LIBRARY_SEM
.GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
PYTHON3_ADDINCL()
SET(MODULE_LANG PY3)
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_PREFIX=py3c
}
otherwise {
MODULE_PREFIX=libpy3c
}
OBJ_SUF=.py3
}
}
IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
# tag:src-processing
STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
macro _SRC("storyboard", SRC, SRCFLAGS...) {
.CMD=$IBTOOL_PATH $STORYBOARD_FLAGS --module $REALPRJNAME --output-partial-info-plist ${output;suf=.partial_plist:SRC} --compilation-directory $BINDIR ${input:SRC} && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.compiled_storyboard_tar:SRC} $BINDIR/${nopath;suf=c:SRC} $BINDIR/${nopath;suf=c:SRC}
}
# tag:src-processing
macro _SRC("xib", SRC, SRCFLAGS...) {
.CMD=$IBTOOL_PATH $STORYBOARD_FLAGS --module $REALPRJNAME --output-partial-info-plist ${output;suf=.partial_plist:SRC} --compile ${output;tobindir;nopath;noext;suf=.nib:SRC} ${input:SRC}
}
ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
# tag:ios-specific
ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
macro _IOS_ASSETS(AssetsDir, Content...) {
.CMD=$FS_TOOLS md $BINDIR/$REALPRJNAME && $ACTOOL_PATH $ASSETS_FLAGS --export-dependency-info $BINDIR/assetcatalog_dependencies --output-partial-info-plist ${output:"assetcatalog_generated_info.partial_plist"} --product-type com.apple.product-type.application --compile $BINDIR/$REALPRJNAME $AssetsDir ${input;hide:Content} && ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;suf=_assetes.resource_tar:REALPRJNAME} $REALPRJNAME $REALPRJNAME
}
# tag:ios-specific
macro IOS_APP_COMMON_FLAGS(Flags...) {
SET_APPEND(STORYBOARD_FLAGS $Flags)
SET_APPEND(ASSETS_FLAGS $Flags)
}
# tag:ios-specific
macro IOS_APP_ASSETS_FLAGS(Flags...) {
SET_APPEND(ASSETS_FLAGS $Flags)
}
macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
.CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
}
macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
.CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
}
# tag:ios-specific
DELIM=__DELIM__
PACK_IOS_ARCHIVE=$GENERATE_MF && $YMAKE_PYTHON ${input:"build/scripts/ios_wrapper.py"} bin $IBTOOL_PATH $TARGET $REALPRJNAME $BINDIR $DELIM $AUTO_INPUT $DELIM $STORYBOARD_FLAGS
### @usage: IOS_INTERFACE()
### iOS GUI module definition
module IOS_INTERFACE: _BARE_UNIT {
.CMD=PACK_IOS_ARCHIVE
.EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
.NODE_TYPE=Library
.FINAL_TARGET=no
SET(MODULE_SUFFIX .ios.interface)
PEERDIR+=build/platform/xcode/tools
}
# tag:ios-specific
module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
SET(MODULE_SUFFIX .default.ios.interface)
}
DEFAULT_IOS_TYPE=
IOS_TYPE=
when(!$IOS_TYPE) {
when($DEFAULT_IOS_TYPE) {
IOS_TYPE=$DEFAULT_IOS_TYPE
}
otherwise {
IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
}
}
DEFAULT_IOS_RUNTIME=
IOS_RUNTIME=
when(!$IOS_RUNTIME) {
when($DEFAULT_IOS_RUNTIME) {
IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
}
otherwise {
IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
}
}
when ($ARCH_I386) {
TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
}
otherwise {
TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
}
# tag:java-specific
### @usage: JDK_VERSION(Version)
###
### Specify JDK version for module
macro JDK_VERSION(Arg) {
.SEM=required_jdk $Arg ${output;hide:"JdkVersionFakeProp.java"}
SET(JDK_REAL_VERSION $Arg)
_JDK_VERSION_MACRO_CHECK($Arg)
}
# tag:java-specific
when ($JDK_REAL_VERSION == "10") {
JDK10=yes # remove this later
}
JAVA_PROGRAM_CP_USE_COMMAND_FILE=yes
when ($JDK_REAL_VERSION == "8") {
JAVA_PROGRAM_CP_USE_COMMAND_FILE=no
}
# tag:kotlin-specific
KOTLIN_JVM_TARGET=
when ($JDK_REAL_VERSION == "8") {
KOTLIN_JVM_TARGET=1.8
}
elsewhen ($JDK_REAL_VERSION == "20") {
# remove when kotlin starts supporting jdk20 bytecode
# see also devtools/ya/jbuild/gen/actions/idea.py
KOTLIN_JVM_TARGET=19
}
otherwise {
KOTLIN_JVM_TARGET=$JDK_REAL_VERSION
}
# tag:frontend-specific
### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
###
### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
macro COLLECT_FRONTEND_FILES(Varname, Dir) {
_GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
}
# tag:java-specific
# local jdk and tools
USE_SYSTEM_JDK=
USE_SYSTEM_UBERJAR=
USE_SYSTEM_ERROR_PRONE=
# tag:swift-specific
CPP_XCODE_TOOLCHAIN_VERSION=9.2
SWIFT_XCODE_TOOLCHAIN_VERSION=9.2
XCODE_TOOLS_VERSION=10.1
macro COMPILE_SWIFT_MODULE(SRCS{input}[], BRIDGE_HEADER{input}="", Flags...) {
when ($BRIDGE_HEADER != "") {
SWIFT_BRIDGE_HEADER=-import-objc-header ${input:BRIDGE_HEADER}
}
otherwise {
SWIFT_BRIDGE_HEADER=
}
.PEERDIR+=build/platform/xcode/swift
# swift core libraries
LDFLAGS($SWIFT_LD_FLAGS)
.CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_swiftc_output_map.py"} $(SOURCE_ROOT) $(BUILD_ROOT) $BINDIR/swift_output_map.json ${input:SRCS} && $SWIFT_COMPILER -c $SWIFT_FLAGS_PLATFORM $Flags $SWIFT_BRIDGE_HEADER ${pre=-Xcc -I:_C__INCLUDE} ${input:SRCS} -emit-objc-header -emit-objc-header-path ${output;suf=-Swift.h:REALPRJNAME} -emit-module -module-name $REALPRJNAME -output-file-map $BINDIR/swift_output_map.json ${output;hide;suf=.o:SRCS}
}
TEST_TOOL_HOST_LOCAL=
TEST_TOOL_TARGET_LOCAL=
when ($MOST_USED_CUDA) {
CUDA_VERSION=11.4
CUDNN_VERSION=8.0.5
TENSORRT_VERSION=7
}
when ($TENSORFLOW_WITH_CUDA) {
CUDA_REQUIRED=yes
}
when (!$TENSORRT_VERSION) {
TENSORRT_VERSION=5
}
ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin/mvn
when ($QT_REQUIRED) {
QT_BIN=${HOST_QT_RESOURCE_GLOBAL}/bin
}
when ($OPENGL_REQUIRED) {
OPENGL_VERSION=18.0.5
}
# tag:python-specific
multimodule PY23_TEST {
module PY2 : PYTEST_BIN {
.RESTRICTED=RUN_ANTLR4_PYTHON
MODULE_PREFIX=py2_
OBJ_SUF=.py2
CANONIZE_SUB_PATH=py2test
RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
}
module PY3TEST_PROGRAM: PY3TEST_BIN {
.FINAL_TARGET=yes
.RESTRICTED=RUN_ANTLR4_PYTHON
OBJ_SUF=.py3
CANONIZE_SUB_PATH=py3test
RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
}
module PY3TEST_LIBRARY: PY3_LIBRARY {
.RESTRICTED=RUN_ANTLR4_PYTHON
PEERDIR+=library/python/pytest
_REQUIRE_EXPLICIT_LICENSE()
RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
}
}
# tag:windows-specific
WINDOWS_MANIFEST=
macro WINDOWS_MANIFEST(Manifest) {
SET(WINDOWS_MANIFEST $Manifest)
}
# https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later
macro WINDOWS_LONG_PATH_MANIFEST() {
SET(WINDOWS_MANIFEST build/long-path.manifest)
}
# tag:windows-specific
when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
}
# tag:cpp-specific
_VISIBILITY_LEVEL=
### @usage: VISIBILITY(level)
###
### This macro sets visibility level for symbols compiled for the current module. 'level'
### may take only one of the following values: DEFAULT, HIDDEN.
macro VISIBILITY(LEVEL) {
SET(_VISIBILITY_LEVEL ${LEVEL})
select ($LEVEL) {
"DEFAULT" | "HIDDEN" ? {
}
default ? {
_OK = no
}
}
ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
}
# tag:cpp-specific
_CFLAGS_VISIBILITY=
when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
when ($CLANG == "yes" || $GCC == "yes") {
_CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
}
}
CFLAGS+=$_CFLAGS_VISIBILITY
# tag:cpp-specific
macro SDBUS_CPP_ADAPTOR(File) {
.CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
.PEERDIR=contrib/libs/sdbus-cpp
}
# tag:cpp-specific
macro SDBUS_CPP_PROXY(File) {
.CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
.PEERDIR=contrib/libs/sdbus-cpp
}
# tag:python-specific
macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
.CMD=$ENUM_PARSER_TOOL ${input:File} --output ${output;noext;suf=.generated.h:File} --json-output ${output;noext:File.json} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
}
# tag:python-specific
macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
.CMD=${tool:"metrika/core/tools/python_enum_generator"} ${input;noext:File.json} -D ${MODDIR} --output ${output;noext:File.py} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
}
macro NGINX_MODULES(Modules...) {
PEERDIR(${Modules})
RUN_PROGRAM(nginx/module_gen ${Modules} CWD ${ARCADIA_ROOT} IN ${suf=/modules.json:Modules} OUTPUT_INCLUDES contrib/nginx/core/src/core/ngx_config.h contrib/nginx/core/src/core/ngx_core.h STDOUT ngx_modules.c)
}
# tag:external-build
CONTAINER_LAYER_CMD=$YMAKE_PYTHON ${input:"build/scripts/make_container_layer.py"} -s $SQUASHFS_RESOURCE_GLOBAL -o $TARGET $AUTO_INPUT ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CL"} ${kv;hide:"pc blue"}
CONTAINER_CMD=$YMAKE_PYTHON ${input:"build/scripts/make_container.py"} -s $SQUASHFS_RESOURCE_GLOBAL -o $TARGET ${rootrel:PEERS} ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CN"} ${kv;hide:"pc blue"}
# tag:external-build
module CONTAINER_LAYER: _BARE_UNIT {
.CMD=CONTAINER_LAYER_CMD
PEERDIR(build/external_resources/squashfs_tools)
MODULE_SUFFIX=.container_layer
CHECK_ALLOWED_PATH()
CHECK_DEPENDENT_DIRS(ALLOW_ONLY PEERDIRS base_layers build/external_resources/squashfs_tools build/platform/python/ymake_python3 junk)
}
# tag:external-build
module CONTAINER: _BARE_UNIT {
.NODE_TYPE=Bundle
.PEERDIR_POLICY=as_build_from
.FINAL_TARGET=yes
.CMD=CONTAINER_CMD
PEERDIR(build/external_resources/squashfs_tools)
PEERDIR(devtools/contrib/cake/entry)
}
# tag:external-build
CUSTOM_BUILD_LIBRARY_USE=
CUSTOM_BUILD_LIBRARY_CMD=$GENERATE_MF && ${tool:"devtools/experimental/solar/outbuild/runner"} ${hide:PEERS} --script=${input:CUSTOM_SCRIPT} --output $TARGET --python=${tool:"contrib/tools/python3"} --isolator=${tool:"devtools/experimental/solar/outbuild/isolator"} $CUSTOM_BUILD_LIBRARY_USE
# tag:external-build
module CUSTOM_BUILD_LIBRARY: LIBRARY {
.NODE_TYPE=Bundle
.PEERDIR_POLICY=as_build_from
.PROXY=yes
.CMD=CUSTOM_BUILD_LIBRARY_CMD
DISABLE(NEED_ADD_FAKE_SRC)
}
### @usage: ORIGINAL_SOURCE(Source)
###
### This macro specifies the source repository for contrib
### Does nothing now (just a placeholder for future functionality)
### See https://st.yandex-team.ru/DTCC-316
macro ORIGINAL_SOURCE(Source) {
ENABLE(UNUSED_MACRO)
}
# tag:licence
CREDITS_FILE_EXTRA_EXT=
CREDITS_FLAGS=
CREDITS_TEXTS_FILE=
NO_CREDITS_TEXTS_FILE=
WITH_CREDITS=
### @usage: LICENSE_TEXTS(File)
###
### This macro specifies the filename with all library licenses texts
macro LICENSE_TEXTS(Source) {
SET(CREDITS_TEXTS_FILE $Source)
}
# tag:licence
### @usage: WITHOUT_LICENSE_TEXTS()
###
### This macro indicates that the module has no license text
macro WITHOUT_LICENSE_TEXTS() {
ENABLE(NO_CREDITS_TEXTS_FILE)
}
# tag:licence
when ($WITH_CREDITS) {
CREDITS_FLAGS+=--credits-output ${output;suf=${CREDITS_FILE_EXTRA_EXT}".CREDITS.txt":REALPRJNAME}
}
GENERATE_MF=
when ($WITH_CREDITS) {
GENERATE_MF=$GENERATE_MF_CMD
}
macro _MCU_CONVERT(Bin) {
.CMD=${cwd:BINDIR} $OBJCOPY_TOOL -O ihex $Bin ${output;noext:Bin.hex} && ${cwd:BINDIR} $OBJCOPY_TOOL -O srec $Bin ${output;noext:Bin.s37} && ${cwd:BINDIR} $OBJCOPY_TOOL -O binary $Bin ${output;noext:Bin.bin}
}
MCU_LINK_EXE=$LINK_EXE && $_MCU_CONVERT($MODULE_PREFIX$REALPRJNAME)
### @usage: MCU_PROGRAM([progname])
###
### Program module for microcontrollers. Converts ELF to Intel HEX, Motorola S-record and raw binary file formats.
### If name is not specified it will be generated from the name of the containing project directory.
module MCU_PROGRAM: PROGRAM {
.CMD=MCU_LINK_EXE
}
@import "${CONF_ROOT}/conf/project_specific/esp.conf"
# tag:flags tag:internal tag:windows-specific
### @usage: _MSVC_FLAGS_WINDOWS_IMPL(target_platform compiler_flags) # internal
###
### Add CFLAGS when the firts argument is WINDOWS
macro _MSVC_FLAGS_WINDOWS_IMPL(WINDOWS[], FLAGS...) {
CFLAGS($WINDOWS)
}
# tag:flags tag:windows-specific tag:cpp-specific
### @usage: MSVC_FLAGS([GLOBAL compiler_flag]* compiler_flags)
###
### Add the specified flags to the compilation line of C/C++files.
### Flags apply only if the compiler used is MSVC (cl.exe)
macro MSVC_FLAGS(FLAGS...) {
_MSVC_FLAGS_WINDOWS_IMPL($TARGET_PLATFORM $FLAGS)
}
### @usage: COLLECT_YDB_API_SPECS_LEGACY(VarName Paths...) #deprecated
###
### This macro is ugly hack for legacy YDB go API codegen, any other uses are prohibited
macro COLLECT_YDB_API_SPECS_LEGACY(FILES_VAR, PATHS...) {
_GLOB($FILES_VAR ${suf=/*.proto:PATHS})
RESTRICT_PATH(kikimr/public/sdk/go/ydb/api MSG This is ugly hack for legacy YDB go API codegen, any other uses are probibited)
}
# tag:proto tag:apphost
### @usage: APPHOST()
###
### Emit APPHOST service code for all .proto files in a PROTO_LIBRARY.
### This works only for C++ and Java at the moment.
macro APPHOST() {
# C++
CPP_PROTO_PLUGIN(cpp_plugin apphost/tools/stub_generator/cpp_plugin .apphost.h DEPS apphost/tools/stub_generator/cpp_includes)
# Java
JAVA_PROTO_PLUGIN(java_plugin apphost/tools/stub_generator/java_plugin DEPS apphost/api/service/java/apphost)
}
# tag:internal
### Add passed ya.conf.json and all bottle's formula external files to resources
### File MUST be arcadia root relative path (without "${ARCADIA_ROOT}/" prefix).
### NOTE:
### An external formula file referenced from ya.conf.json must be passed as an arcadia root relative path and
### should be located in any subdirectory of the ya.conf.json location ("build/" if we consider a production).
### The later restriction prevents problems in selectively checkouted arcadia.
macro YA_CONF_JSON(File) {
_YA_CONF_JSON($File)
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$File)
}
# tag:internal
# Don't use directly - wrap with custom macros
macro ADD_LINTER_CHECK(CheckName, Linter, DEPENDS[], EXCLUDE[], FILES[], CONFIGS[]) {
SET(_FILES_VAR uniq_${hash:VAR_SALT})
_GLOB($_FILES_VAR $FILES EXCLUDE $EXCLUDE)
_ADD_LINTER_CHECK($CheckName $Linter ${pre=DEPENDS :DEPENDS} FILES $$_FILES_VAR CONFIGS $CONFIGS)
}
# tag:internal
# Draft. Don't use.
macro _CPP_STYLE(EXCLUDE[], Files...) {
ADD_LINTER_CHECK(cpp_style tools/cpp_style_checker/cpp_style_checker DEPENDS contrib/libs/clang12/tools/clang-format EXCLUDE $EXCLUDE FILES $Files CONFIGS devtools/ya/handlers/style/style_config)
}
# tag:proto
macro ALICE_CAPABILITY() {
CPP_PROTO_PLUGIN(alice_capability_cpp yandex_io/tools/capability_gen .cap.h DEPS yandex_io/libs/protobuf_utils)
JAVA_PROTO_PLUGIN(alice_capability_java alice/library/go/java_marker_interface_protoc_plugin DEPS alice/protos/endpoint/java_interface alice/megamind/protos/scenarios/java_interface)
}
|