ymake.core.conf 382 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867
  1. # !!! DISCLAIMER! PLEASE DON'T IGNORE !!!
  2. # The FAKEID value is huge hammer. It affects UIDs of all nodes in build graph including, but not limited to
  3. # any resource fetch (think java contrib), build on any language (C++, Python, Java, Go), any code generation.
  4. # Any build after this change will pay the price:
  5. # - Local builds and Sandbox builds will reload all resources from Sandbox and cached data from YT (if ready).
  6. # - Distributed (YT) cache warmup will take significant time to catch up and will need to recache everything.
  7. # - Autocheck will rebuild and recache everything.
  8. # Use this with extreme care and only change if it is ultimately needed. Consider more specific XXX_FAKEIDs below instead.
  9. FAKEID=3141592653
  10. SANDBOX_FAKEID=${FAKEID}.7600000
  11. CPP_FAKEID=9403851
  12. GO_FAKEID=9336945
  13. ANDROID_FAKEID=8821472
  14. CLANG_TIDY_FAKEID=8625699
  15. CURDIR=.
  16. MODDIR=.
  17. BINDIR=bin:/
  18. SRCDIR=
  19. YMAKE=ymake
  20. ECHO=echo
  21. INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i
  22. CPP_EXT=.cpp
  23. OBJ_SUF=
  24. CFLAGS=
  25. EXTRA_C_FLAGS=
  26. SFLAGS=
  27. AUTOCHECK_BALANCING_OPTIONS=
  28. SO_OTPUTS=no
  29. @import "${CONF_ROOT}/conf/settings.conf"
  30. @import "${CONF_ROOT}/conf/opensource.conf"
  31. @import "${CONF_ROOT}/conf/rules.conf"
  32. @import "${CONF_ROOT}/conf/sysincl.conf"
  33. @import "${CONF_ROOT}/conf/license.conf"
  34. @import "${CONF_ROOT}/conf/ts.conf"
  35. @import "${CONF_ROOT}/conf/docs.conf"
  36. @import "${CONF_ROOT}/conf/project_specific/other.conf"
  37. USE_GLOBAL_CMD=no
  38. when ($OS_WINDOWS != "yes") {
  39. USE_GLOBAL_CMD=yes
  40. }
  41. YMAKE_RESOURCE_BIN=${YMAKE_RESOURCE_GLOBAL}/ymake
  42. YMAKE_RESOURCE_DIR=build/external_resources/ymake
  43. when ($USE_YMAKE_RESOURCE == "yes") {
  44. PEERDIR+=${YMAKE_RESOURCE_DIR}
  45. }
  46. __COMMA__=${comma:""}
  47. ARCADIA_TEST_ROOT=../arcadia_tests_data/
  48. DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32
  49. BISON_DATA_DIR=contrib/tools/bison/bison/data
  50. CPP_BISON_SKELS=${BISON_DATA_DIR}/glr.cc ${BISON_DATA_DIR}/lalr1.cc ${BISON_DATA_DIR}/yacc.c ${BISON_DATA_DIR}/stack.hh ${BISON_DATA_DIR}/variant.hh ${BISON_DATA_DIR}/c++.m4 ${BISON_DATA_DIR}/c++-skel.m4
  51. USE_PREBUILT_TOOLS=yes
  52. when ($OPENSOURCE == "yes") {
  53. USE_PREBUILT_TOOLS=no
  54. }
  55. FAIL_PY2=no
  56. _PREBUILT_TOOLS_ROOT=build/prebuilt
  57. _TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
  58. _TOOL_RESCOMPILER=tools/rescompiler
  59. _TOOL_RESCOMPRESSOR=tools/rescompressor
  60. _TOOL_RORESCOMPILER=tools/rorescompiler
  61. when ($HOST_ARCH_X86_64 == "yes") {
  62. when ($HOST_OS_DARWIN == "yes" || $HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes") {
  63. VALID_HOST_PLATFORM_FOR_COMMON_PREBUILT_TOOLS=yes
  64. when ($USE_PREBUILT_TOOLS == "yes" && $ARCH_X86_64 == "yes") {
  65. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  66. }
  67. }
  68. }
  69. FAIL_MODULE_CMD=$YMAKE_PYTHON ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
  70. when ($TIDY == "yes") {
  71. when ($TIDY_EXPORT_FIXES=="") {
  72. TIDY_EXPORT_FIXES="no"
  73. }
  74. 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=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.tidyjson:SRC} "--export-fixes" $TIDY_EXPORT_FIXES
  75. CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
  76. CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
  77. when ($TIDY_CHECKS) {
  78. CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
  79. }
  80. when ($TIDY_HEADER_FILTER) {
  81. CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
  82. }
  83. TIDY_VALUE=USE_CONDITIONAL_SRCS
  84. }
  85. otherwise {
  86. CLANG_TIDY_ARGS=
  87. TIDY_VALUE=
  88. }
  89. # tag:codenav
  90. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  91. PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
  92. YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
  93. YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.ydx.pb2:SRC}
  94. }
  95. otherwise {
  96. PY_PROGRAM_LINK_EXE=$LINK_EXE
  97. YNDEXER_ARGS=
  98. YNDEXER_OUTPUT=
  99. }
  100. COVERAGE_FLAGS=
  101. EXTRA_OUTPUT=
  102. when ($CLANG == "yes" || $GCC == "yes") {
  103. when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
  104. COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
  105. EXTRA_OUTPUT=${output;noauto;hide;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.gcno:SRC}
  106. }
  107. }
  108. when ($OS_CYGWIN == "yes") {
  109. CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
  110. USE_ASMLIB=no
  111. FSTACK=
  112. }
  113. CFLAGS+=$COVERAGE_FLAGS
  114. LDFLAGS+=$COVERAGE_FLAGS
  115. CHECKFLAG=
  116. LEX_FLAGS=
  117. NO_MAPREDUCE=
  118. when ($NO_MAPREDUCE == "yes") {
  119. C_DEFINES+=-DNO_MAPREDUCE
  120. }
  121. when ($OS_ANDROID == "yes") {
  122. PIE=yes
  123. }
  124. # TODO: extract to conf/maps/maps.conf
  125. when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
  126. USE_STL_SYSTEM=yes
  127. }
  128. when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_IOS == "yes") {
  129. BUILD_IOS_APP=yes
  130. when ($ARCH_ARM7 || $ARCH_ARM64) {
  131. BOOSTTEST_IS_FAT_OBJECT=yes
  132. }
  133. }
  134. # USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
  135. # select system standard C++ library when USE_INTERNAL_STL=no is set.
  136. #
  137. # USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
  138. #
  139. when ($USE_STL_SYSTEM == "yes") {
  140. USE_INTERNAL_STL=no
  141. }
  142. when ($USE_INTERNAL_STL == "no") {
  143. USE_STL_SYSTEM=yes
  144. }
  145. otherwise {
  146. USE_INTERNAL_STL=yes
  147. # TODO: Extract to conf/sysincl.conf
  148. # This trigger doesn't work for module level since SYSINCL is processed at
  149. # configuration stage (This means that NO_RUNTIME() macro called in ya.make
  150. # won't affect SYSINCL and the only way to make this trigger work correctly
  151. # is to define configuration variable NORUNTIME (-DNORUNTIME) on the command
  152. # line when `ya make ...` is invoked.
  153. when ($NORUNTIME != "yes") {
  154. SYSINCL+=build/sysincl/stl-to-libcxx.yml
  155. when ($MUSL == "yes") {
  156. SYSINCL+=build/sysincl/libc-musl-libcxx.yml
  157. }
  158. }
  159. }
  160. # tag:linux-specific
  161. when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") {
  162. USE_UBUNTU_COMPATIBILITY=yes
  163. }
  164. USE_ARCADIA_PYTHON=yes
  165. USE_ARCADIA_LIBM=no
  166. USE_EAT_MY_DATA=no
  167. HAVE_MKL=
  168. when ($HAVE_MKL == "") {
  169. when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
  170. HAVE_MKL=yes
  171. }
  172. otherwise {
  173. HAVE_MKL=no
  174. }
  175. }
  176. SFDL_TMP_OUT= ${output;tmp:SRC.tmp}
  177. # tag:perl-specific
  178. when ($USE_LOCAL_TOOLS == "yes") {
  179. PERL=$LOCAL_PERL
  180. PERL_VERSION=$LOCAL_PERL_VERSION
  181. PERL_PRIVLIB=$LOCAL_PERL_PRIVLIB
  182. PERL_ARCHLIB=$LOCAL_PERL_ARCHLIB
  183. when ($LOCAL_PERL_LIBS) {
  184. PERL_LIBS=$LOCAL_PERL_LIBS
  185. }
  186. }
  187. otherwise {
  188. PERL=NO-PERL-SELECTED
  189. PERL_VERSION=NO-PERL-SELECTED-VERSION
  190. PERL_PRIVLIB=NO-PERL-SELECTED-PRIVLIB
  191. PERL_ARCHLIB=NO-PERL-SELECTED-ARCHLIB
  192. }
  193. # tag:perl-specific
  194. PERL_LD_LIBRARY_PATH=
  195. PERL_INCLUDE=
  196. USE_PERL_SYSTEM=yes
  197. when ($USE_PERL_SYSTEM == "yes") {
  198. select ($PERL_SDK) {
  199. "ubuntu-12" ? {
  200. PERL_VERSION=5.14
  201. PERL_ROOT=${SYSTEM_PERL_514_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  202. PERL_LIB_ARCH=
  203. }
  204. "ubuntu-14" ? {
  205. PERL_VERSION=5.18
  206. PERL_ROOT=${SYSTEM_PERL_518_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  207. PERL_LIB_ARCH=
  208. }
  209. "ubuntu-16" ? {
  210. PERL_VERSION=5.22
  211. PERL_ROOT=${SYSTEM_PERL_522_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  212. PERL_LIB_ARCH=/x86_64-linux-gnu
  213. }
  214. "ubuntu-18" ? {
  215. PERL_VERSION=5.26
  216. PERL_ROOT=${SYSTEM_PERL_526_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  217. PERL_LIB_ARCH=/x86_64-linux-gnu
  218. }
  219. "ubuntu-20" ? {
  220. PERL_VERSION=5.30
  221. PERL_ROOT=${SYSTEM_PERL_530_RESOURCE_GLOBAL}/usr
  222. PERL_LIB_ARCH=/x86_64-linux-gnu
  223. }
  224. }
  225. PERL=${PERL_ROOT}/bin/perl
  226. PERL_ARCHLIB=${PERL_ROOT}/lib$PERL_LIB_ARCH/perl/${PERL_VERSION}
  227. PERL_PRIVLIB=${PERL_ROOT}/share/perl/${PERL_VERSION}
  228. PERL_LIBS=${PERL_ROOT}/lib${PERL_LIB_ARCH}
  229. PERL_LD_LIBRARY_PATH=${env:"LD_LIBRARY_PATH=${PERL_ROOT}/lib"}
  230. # Perl searches it's modules in INC@ paths. They can not be sysrooted or disabled (at least I haven't found a way),
  231. # so default Perl module directories should be prepended to perl command lines when using non-local perl.
  232. PERL_INCLUDE=-I${PERL_ARCHLIB} -I${PERL_PRIVLIB}
  233. }
  234. PERL_DEFAULT_PEERDIR=yes
  235. # tag:perl-specific
  236. PERLSUFFIX=-csuffix .cpp
  237. PERLOUTPUT=${stdout;output:SRC.cpp}
  238. when ($PERLC == "yes") {
  239. PERLSUFFIX=-csuffix .c
  240. PERLOUTPUT=${stdout;output:SRC.c}
  241. }
  242. XSUBPPFLAGS=
  243. # tag:tool-specific
  244. ARCH_TOOL=${tool:"tools/archiver"}
  245. # tag:tool-specific tag:proto
  246. PROTOC=${tool:"contrib/tools/protoc"}
  247. PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
  248. PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
  249. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src
  250. USE_VANILLA_PROTOC=no
  251. PROTOC_TRANSITIVE_HEADERS=yes
  252. # tag:tool-specific
  253. FML_TOOL=${tool:"tools/relev_fml_codegen"}
  254. FML_UNUSED_TOOL=${tool:"tools/relev_fml_unused"}
  255. LUA_TOOL=${tool:"tools/lua"}
  256. ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
  257. # tag:python-specific tag:cython-specific
  258. CYTHON_SCRIPT=${input:"${ARCADIA_ROOT}/contrib/tools/cython/cython.py"} $CYTHON_PREDEFINED_INCLUDES
  259. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  260. PYTHON_TYPE_FOR_CYTHON=PY2
  261. CYTHON_OUTPUT_INCLUDES=\
  262. ${output_include;hide:"contrib/libs/python/Include/compile.h"} \
  263. ${output_include;hide:"contrib/libs/python/Include/frameobject.h"} \
  264. ${output_include;hide:"contrib/libs/python/Include/longintrepr.h"} \
  265. ${output_include;hide:"contrib/libs/python/Include/pyconfig.h"} \
  266. ${output_include;hide:"contrib/libs/python/Include/Python.h"} \
  267. ${output_include;hide:"contrib/libs/python/Include/pythread.h"} \
  268. ${output_include;hide:"contrib/libs/python/Include/structmember.h"} \
  269. ${output_include;hide:"contrib/libs/python/Include/traceback.h"} \
  270. ${output_include;hide:"contrib/tools/cython/generated_c_headers.h"} \
  271. ${output_include;hide:"omp.h"}
  272. # tag:cython-specific
  273. CYTHON_CPP_OUTPUT_INCLUDES=${output_include;hide:"contrib/tools/cython/generated_cpp_headers.h"}
  274. # tag:cython-specific
  275. CYTHON_PREDEFINED_INCLUDES=\
  276. ${input;hide:"contrib/tools/cython/Cython/Utility/Buffer.c"} \
  277. ${input;hide:"contrib/tools/cython/Cython/Utility/Builtins.c"} \
  278. ${input;hide:"contrib/tools/cython/Cython/Utility/CMath.c"} \
  279. ${input;hide:"contrib/tools/cython/Cython/Utility/Capsule.c"} \
  280. ${input;hide:"contrib/tools/cython/Cython/Utility/CommonTypes.c"} \
  281. ${input;hide:"contrib/tools/cython/Cython/Utility/Complex.c"} \
  282. ${input;hide:"contrib/tools/cython/Cython/Utility/Coroutine.c"} \
  283. ${input;hide:"contrib/tools/cython/Cython/Utility/CythonFunction.c"} \
  284. ${input;hide:"contrib/tools/cython/Cython/Utility/Embed.c"} \
  285. ${input;hide:"contrib/tools/cython/Cython/Utility/Exceptions.c"} \
  286. ${input;hide:"contrib/tools/cython/Cython/Utility/ExtensionTypes.c"} \
  287. ${input;hide:"contrib/tools/cython/Cython/Utility/FunctionArguments.c"} \
  288. ${input;hide:"contrib/tools/cython/Cython/Utility/ImportExport.c"} \
  289. ${input;hide:"contrib/tools/cython/Cython/Utility/MemoryView_C.c"} \
  290. ${input;hide:"contrib/tools/cython/Cython/Utility/ModuleSetupCode.c"} \
  291. ${input;hide:"contrib/tools/cython/Cython/Utility/ObjectHandling.c"} \
  292. ${input;hide:"contrib/tools/cython/Cython/Utility/Optimize.c"} \
  293. ${input;hide:"contrib/tools/cython/Cython/Utility/Overflow.c"} \
  294. ${input;hide:"contrib/tools/cython/Cython/Utility/Printing.c"} \
  295. ${input;hide:"contrib/tools/cython/Cython/Utility/Profile.c"} \
  296. ${input;hide:"contrib/tools/cython/Cython/Utility/StringTools.c"} \
  297. ${input;hide:"contrib/tools/cython/Cython/Utility/TestUtilityLoader.c"} \
  298. ${input;hide:"contrib/tools/cython/Cython/Utility/TypeConversion.c"}
  299. # tag:cython-specific
  300. CYTHON_PREDEFINED_INDUCED=\
  301. contrib/libs/python/Include/Python.h
  302. # tag:cython-specific
  303. CYTHON_OPTIONS=
  304. when ($OS_LINUX) {
  305. CYTHON_OPTIONS += -E UNAME_SYSNAME=Linux
  306. }
  307. elsewhen ($OS_DARWIN) {
  308. CYTHON_OPTIONS += -E UNAME_SYSNAME=Darwin
  309. }
  310. elsewhen ($OS_WINDOWS) {
  311. CYTHON_OPTIONS += -E UNAME_SYSNAME=Windows
  312. }
  313. when ($USE_LOCAL_SWIG != "yes") {
  314. _SWIG_TOOL=${tool:"contrib/tools/swig"}
  315. _SWIG_LIBRARY=contrib/tools/swig/Lib
  316. _SWIG_LIBRARY_ABS=$ARCADIA_ROOT/$_SWIG_LIBRARY
  317. }
  318. otherwise {
  319. _SWIG_TOOL=$SWIG_TOOL
  320. _SWIG_LIBRARY=$SWIG_LIBRARY
  321. _SWIG_LIBRARY_ABS=$SWIG_LIBRARY
  322. }
  323. SWIG_IMPLICIT_INCLUDES = swig.swg go.swg java.swg perl5.swg python.swg
  324. FATAL_ERROR_MODULE=no
  325. FATAL_ERROR_MESSAGE=
  326. # tag:python-specific
  327. # PYTHON_DISTR={ "default" | "macos-brew" } determine python system supply
  328. # see build/platform/python/ya.make
  329. PYTHON_DISTR="default"
  330. when ($USE_SYSTEM_PYTHON) {
  331. USE_ARCADIA_PYTHON=no
  332. select ($USE_SYSTEM_PYTHON) {
  333. "2.7" ? {
  334. _SYSTEM_PYTHON27=yes
  335. PY_VERSION=2.7
  336. PY_FRAMEWORK_VERSION=2.7
  337. }
  338. "3.4" ? {
  339. _SYSTEM_PYTHON34=yes
  340. PY_VERSION=3.4m
  341. PY_FRAMEWORK_VERSION=3.4
  342. }
  343. "3.5" ? {
  344. _SYSTEM_PYTHON35=yes
  345. PY_VERSION=3.5m
  346. PY_FRAMEWORK_VERSION=3.5
  347. }
  348. "3.6" ? {
  349. _SYSTEM_PYTHON36=yes
  350. PY_VERSION=3.6m
  351. PY_FRAMEWORK_VERSION=3.6
  352. }
  353. "3.7" ? {
  354. _SYSTEM_PYTHON37=yes
  355. PY_VERSION=3.7m
  356. PY_FRAMEWORK_VERSION=3.7
  357. }
  358. "3.8" ? {
  359. _SYSTEM_PYTHON38=yes
  360. PY_VERSION=3.8
  361. PY_FRAMEWORK_VERSION=3.8
  362. }
  363. "3.9" ? {
  364. _SYSTEM_PYTHON39=yes
  365. PY_VERSION=3.9
  366. PY_FRAMEWORK_VERSION=3.9
  367. }
  368. "3.10" ? {
  369. _SYSTEM_PYTHON310=yes
  370. PY_VERSION=3.10
  371. PY_FRAMEWORK_VERSION=3.10
  372. }
  373. default ? {
  374. FATAL_ERROR_MESSAGE+=invalid USE_SYSTEM_PYTHON value
  375. }
  376. }
  377. }
  378. ### @usage: NO_LTO()
  379. ###
  380. ### Disable any lto (link-time optimizations) for the module.
  381. ### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
  382. ### linking of entire program if global settings say so.
  383. macro NO_LTO() {
  384. DISABLE(USE_LTO)
  385. DISABLE(USE_THINLTO)
  386. }
  387. when ($USE_LTO == "yes" && $OS_LINUX != "yes" && $OS_ANDROID != "yes") {
  388. FATAL_ERROR_MESSAGE+=lto is only supported for linux
  389. }
  390. # tag:python-specific
  391. YMAKE_PYTHON3_PEER=build/platform/python/ymake_python3
  392. YMAKE_PYTHON3=$YMAKE_PYTHON3_RESOURCE_GLOBAL/python3
  393. when ($HOST_OS_WINDOWS == "yes") {
  394. YMAKE_PYTHON3=$YMAKE_PYTHON3_RESOURCE_GLOBAL/python3.exe
  395. }
  396. # tag:python-specific
  397. when ($USE_ARCADIA_PYTHON == "no") {
  398. SYSINCL+=build/sysincl/python.yml
  399. }
  400. # tag:allocator
  401. DEFAULT_ALLOCATOR=LF
  402. # tag:allocator
  403. when ($OS_ANDROID == "yes" || $MSVC == "yes") {
  404. DEFAULT_ALLOCATOR=J
  405. }
  406. # tag:allocator
  407. when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
  408. DEFAULT_ALLOCATOR=SYSTEM
  409. }
  410. # tag:allocator
  411. when ($OS_DARWIN == "yes") {
  412. DEFAULT_ALLOCATOR=SYSTEM
  413. }
  414. # tag:allocator
  415. when ($SANITIZER_TYPE) {
  416. when ($SANITIZER_TYPE != "no") {
  417. DEFAULT_ALLOCATOR=SYSTEM
  418. }
  419. }
  420. # tag:internal
  421. ### @usage: CHECK_CONFIG_H(<conf_header>) # internal
  422. ###
  423. ### This internal macro adds checking code for configuration header in external (contrib) library.
  424. ### The check is needed to avoid conflicts on certain types and functions available in arcadia.
  425. ###
  426. ### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
  427. macro CHECK_CONFIG_H(Conf) {
  428. .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"}
  429. OUTPUT_INCLUDES=$Conf
  430. }
  431. REQUIRED_TRANSITIVE_PEERS=
  432. ### @usage REQUIRES(dirs...)
  433. ###
  434. ### Specify list of dirs which this module must depend on indirectly.
  435. ###
  436. ### This macro can be used if module depends on the directories specified but they can't be listed
  437. ### as direct PEERDIR dependencies (due to public include order or link order issues).
  438. macro REQUIRES(DIRS[]) {
  439. SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
  440. }
  441. CHECK_DEPENDENT_DIRS_TYPES=
  442. CHECK_DEPENDENT_DIRS_RESTRICTIONS=
  443. ### @usage CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
  444. ###
  445. ### Specify project transitive dependencies constraints.
  446. ###
  447. ### @params:
  448. ### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
  449. ### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
  450. ### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
  451. ### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
  452. ### 5. GLOB: next directory constraint is an ANT glob pattern.
  453. ### 6. EXCEPT: next constraint is an exception for the rest of other rules.
  454. ###
  455. ### Directory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
  456. ###
  457. ### Note: Can be used multiple times on the same module all specified constraints will be checked.
  458. ### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
  459. macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
  460. SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
  461. SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
  462. }
  463. # tag:proto
  464. PY_PROTOS_FOR=no
  465. BUILD_PROTO_AS_EVLOG=no
  466. # tag:proto
  467. PROTO_NAMESPACE=
  468. # tag:proto tag:python-specific
  469. GEN_PY_PROTOS=$YMAKE_PYTHON ${input:"build/scripts/gen_py_protos.py"}
  470. # tag:proto tag:cpp-specific
  471. PROTO_HEADER_EXTS=.pb.h
  472. CPP_PROTO_CMDLINE=
  473. CPP_PROTO_OPTS=
  474. CPP_PROTO_OUTS=
  475. CPP_PROTO_OUTS_SEM=
  476. CPP_PROTO_SUFFIXES=.pb.h .pb.cc
  477. CPP_PROTO_PLUGINS=
  478. # tag:proto tag:cpp-specific
  479. CPP_EV_OPTS=--plugin=protoc-gen-event2cpp=${tool:"tools/event2cpp"} --event2cpp_out=$ARCADIA_BUILD_ROOT -I=$ARCADIA_ROOT/library/cpp/eventlog
  480. CPP_EV_OUTS=
  481. # tag:proto tag:python-specific
  482. PY_PROTO_OPTS=
  483. PY_PROTO_OUTS=
  484. PY_PROTO_OUTS_INTERNAL=
  485. PY_PROTO_DEPS=
  486. PY_PROTO_SUFFIXES=_pb2.py
  487. PY_EVLOG_SUFFIXES=_ev_pb2.py
  488. # tag:proto tag:java-specific
  489. JAVA_PROTO_ARGS=
  490. # tag:proto tag:python-specific
  491. OPTIMIZE_PY_PROTOS_FLAG=no
  492. macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
  493. SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
  494. .SEM=resources ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${tool;hide:"tools/rescompiler/bin"}
  495. }
  496. # tag:built-in
  497. ### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # built-in
  498. ### Add data (resources, random files, strings) to the program)
  499. ### 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.
  500. ### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
  501. ###
  502. ### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
  503. ### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
  504. ###
  505. ### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
  506. ###
  507. ### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
  508. ###
  509. ### @example:
  510. ###
  511. ### LIBRARY()
  512. ### OWNER(user1)
  513. ###
  514. ### RESOURCE(
  515. ### path/to/file1 /key/in/program/1
  516. ### path/to/file2 /key2
  517. ### )
  518. ### END()
  519. ###
  520. macro RESOURCE(Args...) {
  521. PEERDIR(library/cpp/resource)
  522. }
  523. # tag:internal
  524. ### @usage: _ORDER_ADDINCL([BUILD ...] [SOURCE ...] Args...) # internal
  525. ###
  526. ### Order and filter ADDINCLs (Args - is intentionally omitted in ADDINCL macro)
  527. macro _ORDER_ADDINCL(BUILD[], SOURCE[], ARGS...) {
  528. ADDINCL($BUILD $SOURCE)
  529. }
  530. # tag:proto
  531. ### @usage: PROTO_ADDINCL([GLOBAL] [WITH_GEN] Path)
  532. ###
  533. ### This macro introduces proper ADDINCLs for .proto-files found in sources and
  534. ### .cpp/.h generated files, supplying them to appropriate commands and allowing
  535. ### proper dependency resolution at configure-time.
  536. ###
  537. ### Note: you normally shouldn't use this macro. ADDINCLs should be sent to user
  538. ### from dependency via PROTO_NAMESPACE macro
  539. macro PROTO_ADDINCL(GLOBAL?"GLOBAL":"", Path, WITH_GEN?"BUILD":"") {
  540. _ORDER_ADDINCL($WITH_GEN $GLOBAL FOR proto ${ARCADIA_BUILD_ROOT}/$Path SOURCE $GLOBAL FOR proto ${ARCADIA_ROOT}/$Path)
  541. ADDINCL($GLOBAL ${ARCADIA_BUILD_ROOT}/$Path)
  542. }
  543. # tag:proto
  544. ### @usage: PROTO_NAMESPACE([GLOBAL] [WITH_GEN] Namespace)
  545. ###
  546. ### Defines protobuf namespace (import/export path prefix) which should be used for imports and
  547. ### which defines output path for .proto generation.
  548. ###
  549. ### For proper importing and configure-time dependency management it sets ADDINCLs
  550. ### for both .cpp headers includes and .proto imports. If .proto expected to be used outside of the
  551. ### processing module use GLOBAL to send proper ADDINCLs to all (transitive) users. PEERDIR to
  552. ### PROTO_LIBRARY with PROTO_NAMESPACE(GLOBAL ) is enough at user side to correctly use the library.
  553. ### If generated .proto files are going to be used for building a module than use of WITH_GEN
  554. ### parameter will add appropriate dir from the build root for .proto files search.
  555. macro PROTO_NAMESPACE(GLOBAL?"GLOBAL":"", WITH_GEN?"WITH_GEN":"", Namespace) {
  556. SET(PROTO_NAMESPACE $Namespace)
  557. PROTO_ADDINCL($GLOBAL $WITH_GEN $Namespace)
  558. }
  559. # tag:proto tag:internal tag:python-specific
  560. ### @usage: OPTIMIZE_PY_PROTOS() # internal
  561. ###
  562. ### Enable Python proto optimization by embedding corresponding C++ code into binary.
  563. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  564. ### This is default mode for most PROTO_LIBRARY's and PY2_LIBRARY's, some system ones being exceptions.
  565. macro OPTIMIZE_PY_PROTOS() {
  566. SET(OPTIMIZE_PY_PROTOS_FLAG yes)
  567. }
  568. # tag:proto tag:python-specific
  569. ### @usage: NO_OPTIMIZE_PY_PROTOS()
  570. ###
  571. ### Disable Python proto optimization using embedding corresponding C++ code into binary.
  572. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  573. ### This is default mode only for some system libraries.
  574. macro NO_OPTIMIZE_PY_PROTOS() {
  575. SET(OPTIMIZE_PY_PROTOS_FLAG no)
  576. }
  577. # tag:proto tag:python-specific
  578. macro _PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  579. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$OutParm$ARCADIA_BUILD_ROOT/\$PROTO_NAMESPACE
  580. .SEM=ignored
  581. }
  582. # tag:proto tag:python-specific
  583. macro _ADD_PY_PROTO_OUT(Suf) {
  584. SET_APPEND(PY_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$Suf:File})
  585. 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}"})
  586. # XXX fix variable expansion in plugins
  587. SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
  588. }
  589. # tag:proto tag:python-specific
  590. ### @usage: PY_PROTO_PLUGIN(Name Ext Tool DEPS <Dependencies>)
  591. ###
  592. ### Define protoc plugin for python with given Name that emits extra output with provided Extension
  593. ### using Tool. Extra dependencies are passed via DEPS
  594. macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  595. SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  596. _ADD_PY_PROTO_OUT($EXT)
  597. # XXX fix variable expansion in plugins
  598. SET(PY_PROTO_DEPS $PY_PROTO_DEPS $DEPS)
  599. }
  600. # tag:proto tag:python-specific
  601. ### @usage: PY_PROTO_PLUGIN2(Name Ext1 Ext2 Tool DEPS <Dependencies>)
  602. ###
  603. ### Define protoc plugin for python with given Name that emits 2 extra outputs with provided Extensions
  604. ### using Tool. Extra dependencies are passed via DEPS
  605. macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
  606. PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
  607. _ADD_PY_PROTO_OUT($EXT2)
  608. }
  609. # tag:proto tag:java-specific
  610. macro _JAVA_PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  611. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/java_out
  612. }
  613. # tag:proto tag:java-specific
  614. ### @usage: JAVA_PROTO_PLUGIN(Name Tool DEPS <Dependencies>)
  615. ###
  616. ### Define protoc plugin for Java with given Name that emits extra outputs
  617. ### using Tool. Extra dependencies are passed via DEPS
  618. macro JAVA_PROTO_PLUGIN(NAME, TOOL, DEPS[]) {
  619. SET_APPEND(JAVA_PROTO_ARGS $_JAVA_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  620. # XXX fix variable expansion in plugins
  621. SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS $DEPS)
  622. }
  623. # tag:proto tag:cpp-specific
  624. macro _ADD_CPP_PROTO_OUT(Suf) {
  625. .SEM=append_target_property PROTOC_EXTRA_OUTS $Suf ${output;hide;suf=.o:Suf} && set_target_property PROTO_NAMESPACE $PROTO_NAMESPACE
  626. SET_APPEND(CPP_PROTO_OUTS \${output;hide;norel;nopath;noext;suf=$Suf:File})
  627. # XXX fix variable expansion in plugins
  628. SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES $Suf)
  629. }
  630. # tag:proto tag:cpp-specific
  631. HAS_CPP_PROTOBUF_PEERS=no
  632. CPP_PROTOBUF_PEERS=
  633. # tag:proto tag:cpp-specific
  634. ### @usage: CPP_PROTO_PLUGIN0(Name Tool DEPS <Dependencies>)
  635. ###
  636. ### Define protoc plugin for C++ with given Name that emits code into regular outputs
  637. ### using Tool. Extra dependencies are passed via DEPS.
  638. macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) {
  639. .SEM=target_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME}
  640. SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  641. # XXX fix variable expansion in plugins
  642. ENABLE(HAS_CPP_PROTOBUF_PEERS)
  643. SET(CPP_PROTOBUF_PEERS $CPP_PROTOBUF_PEERS $DEPS)
  644. }
  645. # tag:proto tag:cpp-specific
  646. ### @usage: CPP_PROTO_PLUGIN(Name Tool Suf DEPS <Dependencies>)
  647. ###
  648. ### Define protoc plugin for C++ with given Name that emits code into 1 extra output
  649. ### using Tool. Extra dependencies are passed via DEPS.
  650. macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[]) {
  651. CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS)
  652. _ADD_CPP_PROTO_OUT($SUF)
  653. }
  654. # tag:proto tag:cpp-specific
  655. ### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 DEPS <Dependencies>)
  656. ###
  657. ### Define protoc plugin for C++ with given Name that emits code into 2 extra outputs
  658. ### using Tool. Extra dependencies are passed via DEPS.
  659. macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[]) {
  660. CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS)
  661. _ADD_CPP_PROTO_OUT($SUF2)
  662. SET_APPEND(CPP_PROTO_OUTS_SEM \${output;hide;norel;nopath;noext;suf=$SUF2:File})
  663. }
  664. # tag:proto
  665. ### @usage: USE_SKIFF() #wip, do not use
  666. ###
  667. ### Use mapreduce/yt/skiff_proto/plugin for C++
  668. macro USE_SKIFF() {
  669. # Move extra includes to INDUCED_DEPS macro in mapreduce/yt/skiff_proto/plugin/ya.make
  670. CPP_PROTO_PLUGIN0(skiff mapreduce/yt/skiff_proto/plugin DEPS mapreduce/yt/skiff_proto/lib)
  671. }
  672. # tag:go-specific
  673. _GO_COMMON_GOOGLE_APIS = \
  674. vendor/google.golang.org/genproto/googleapis/api/annotations \
  675. vendor/google.golang.org/genproto/googleapis/api/configchange \
  676. vendor/google.golang.org/genproto/googleapis/api/distribution \
  677. vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1 \
  678. vendor/google.golang.org/genproto/googleapis/api/expr/v1beta1 \
  679. vendor/google.golang.org/genproto/googleapis/api/httpbody \
  680. vendor/google.golang.org/genproto/googleapis/api/label \
  681. vendor/google.golang.org/genproto/googleapis/api/metric \
  682. vendor/google.golang.org/genproto/googleapis/api/monitoredres \
  683. vendor/google.golang.org/genproto/googleapis/api/serviceconfig \
  684. vendor/google.golang.org/genproto/googleapis/api/servicecontrol/v1 \
  685. vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1 \
  686. vendor/google.golang.org/genproto/googleapis/iam/admin/v1 \
  687. vendor/google.golang.org/genproto/googleapis/iam/credentials/v1 \
  688. vendor/google.golang.org/genproto/googleapis/iam/v1 \
  689. vendor/google.golang.org/genproto/googleapis/iam/v1/logging \
  690. vendor/google.golang.org/genproto/googleapis/logging/type \
  691. vendor/google.golang.org/genproto/googleapis/logging/v2 \
  692. vendor/google.golang.org/genproto/googleapis/rpc/code \
  693. vendor/google.golang.org/genproto/googleapis/rpc/errdetails \
  694. vendor/google.golang.org/genproto/googleapis/rpc/status \
  695. vendor/google.golang.org/genproto/googleapis/type/calendarperiod \
  696. vendor/google.golang.org/genproto/googleapis/type/color \
  697. vendor/google.golang.org/genproto/googleapis/type/date \
  698. vendor/google.golang.org/genproto/googleapis/type/dayofweek \
  699. vendor/google.golang.org/genproto/googleapis/type/expr \
  700. vendor/google.golang.org/genproto/googleapis/type/fraction \
  701. vendor/google.golang.org/genproto/googleapis/type/latlng \
  702. vendor/google.golang.org/genproto/googleapis/type/money \
  703. vendor/google.golang.org/genproto/googleapis/type/postaladdress \
  704. vendor/google.golang.org/genproto/googleapis/type/quaternion \
  705. vendor/google.golang.org/genproto/googleapis/type/timeofday
  706. # tag:go-specific
  707. _COMMON_GOOGLE_APIS=None
  708. # tag:go-specific
  709. ### @usage: USE_COMMON_GOOGLE_APIS([apis...])
  710. ###
  711. ### Use common-google-apis library set. Pass optional apis list to be used or use them all.
  712. ### This macro is properly handled for all languages including Go, where apis come in
  713. ## pregenerated form. In other languages apis are generated from sources in Arcadia.
  714. macro USE_COMMON_GOOGLE_APIS(APIS...) {
  715. SET(_COMMON_GOOGLE_APIS ${pre=vendor/google.golang.org/genproto/googleapis/:APIS})
  716. }
  717. # tag:go-specific tag:proto
  718. GO_PROTO_GEN_TOOL=$_TOOL_PROTOC_GEN_GO
  719. GO_PROTO_GEN_PLUGINS=
  720. GO_PROTO_PACKAGE_MAP=
  721. GO_PROTO_OPTS=$_GO_PROTOC_PLUGIN_ARGS_BASE(go $GO_PROTO_GEN_TOOL MAP $GO_PROTO_PACKAGE_MAP PLUGINS $GO_PROTO_GEN_PLUGINS)
  722. GO_PROTO_OUTS=
  723. # tag:go-specific tag:proto
  724. GO_PROTOBUF_IMPORTS=\
  725. ${GOSTD}/sync \
  726. ${GOSTD}/reflect \
  727. ${GOSTD}/fmt \
  728. ${GOSTD}/math \
  729. vendor/github.com/golang/protobuf/proto \
  730. vendor/google.golang.org/protobuf/types/descriptorpb \
  731. vendor/google.golang.org/protobuf/runtime/protoimpl \
  732. vendor/google.golang.org/protobuf/runtime/protoiface \
  733. vendor/google.golang.org/protobuf/reflect/protoreflect
  734. # tag:go-specific tag:proto
  735. GO_PROTOBUF_WELLKNOWN_TYPES=\
  736. vendor/google.golang.org/protobuf/types/known/anypb \
  737. vendor/google.golang.org/protobuf/types/known/apipb \
  738. vendor/google.golang.org/protobuf/types/known/durationpb \
  739. vendor/google.golang.org/protobuf/types/known/emptypb \
  740. vendor/google.golang.org/protobuf/types/known/fieldmaskpb \
  741. vendor/google.golang.org/protobuf/types/known/sourcecontextpb \
  742. vendor/google.golang.org/protobuf/types/known/structpb \
  743. vendor/google.golang.org/protobuf/types/known/timestamppb \
  744. vendor/google.golang.org/protobuf/types/known/typepb \
  745. vendor/google.golang.org/protobuf/types/known/wrapperspb
  746. # tag:go-specific tag:proto
  747. ### @usage: GO_PROTO_PLUGIN(Name Ext Tool [DEPS dependencies...])
  748. ###
  749. ### Define protoc plugin for GO with given Name that emits extra output with provided extension
  750. ### Ext using Tool. Extra dependencies are passed via DEPS.
  751. macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  752. SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  753. SET_APPEND(GO_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$EXT:File})
  754. PEERDIR(${DEPS})
  755. }
  756. # tag:go-specific tag:proto
  757. macro _GO_PROTOC_PLUGIN_ARGS_BASE_IMPL(Name, Tool, PLUGINS...) {
  758. .CMD=--plugin=protoc-gen-${Name}=${tool:Tool} --${Name}_out=${join=|:PLUGINS}:${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
  759. }
  760. # tag:go-specific tag:proto
  761. macro _GO_PROTOC_PLUGIN_ARGS_BASE_PROXY(Name, Tool, MAP[], PLUGINS[]) {
  762. .CMD=$_GO_PROTOC_PLUGIN_ARGS_BASE_IMPL($Name $Tool $MAP ${pre=plugins=:PLUGINS})
  763. }
  764. # tag:go-specific tag:proto
  765. macro _GO_PROTOC_PLUGIN_ARGS_BASE(Name, Tool, MAP[], PLUGINS[]) {
  766. .CMD=$_GO_PROTOC_PLUGIN_ARGS_BASE_PROXY($Name $Tool MAP ${pre=M:MAP} PLUGINS ${join=|:PLUGINS})
  767. }
  768. # tag:go-specific tag:proto
  769. GO_PROTO_CMDLINE=${cwd;rootdir;input:File} $YMAKE_PYTHON ${input:"build/scripts/go_proto_wrapper.py"} $GO_ARCADIA_PROJECT_PREFIX $GO_CONTRIB_PROJECT_PREFIX ./$PROTO_NAMESPACE $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH ${input;rootrel:File}
  770. # tag:go-specific tag:proto
  771. macro _GO_PROTO_CMD_IMPL(File, OPTS[], OUTS[]) {
  772. .CMD=$GO_PROTO_CMDLINE $OPTS $OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  773. .PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES}
  774. .ADDINCL=FOR proto contrib/libs/protobuf/src
  775. }
  776. # tag:go-specific tag:proto
  777. macro _GO_PROTO_CMD(File) {
  778. .CMD=$_GO_PROTO_CMD_IMPL($File OPTS $GO_PROTO_OPTS OUTS $GO_PROTO_OUTS)
  779. }
  780. # tag:proto
  781. ### @usage: YP_PROTO_YSON(Files... OUT_OPTS Opts...)
  782. ###
  783. ### Generate .yson.go from .proto using yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen
  784. macro YP_PROTO_YSON(OUT_OPTS[], Files...) {
  785. .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}" ${input:Files} ${output;hide;noauto;nopath;noext;suf=.yson.go:Files}
  786. .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
  787. .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
  788. }
  789. _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"} \
  790. && set_global_flags COMMON_PROTOC_FLAGS \
  791. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
  792. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH
  793. # tag:proto
  794. macro _CPP_PROTO_CMD(File) {
  795. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  796. .SEM=$_SEM_CPP_PROTO_CMD
  797. .PEERDIR=contrib/libs/protobuf
  798. }
  799. # tag:proto
  800. macro _CPP_VANILLA_PROTO_CMD(File) {
  801. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  802. .PEERDIR=contrib/libs/protobuf_std
  803. }
  804. # tag:proto
  805. macro _CPP_EVLOG_CMD(File) {
  806. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_EV_OUTS ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  807. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  808. }
  809. # tag:proto
  810. macro _CPP_PROTO_EVLOG_CMD(File) {
  811. # process .proto as .ev
  812. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  813. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  814. }
  815. # tag:proto
  816. macro _CPP_CFGPROTO_CMD(File) {
  817. # keep extension in output just as in EV: this is hard-coded behaviour of protoc for non-.proto extensions
  818. .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"}
  819. .PEERDIR=library/cpp/proto_config/codegen library/cpp/proto_config/protos contrib/libs/protobuf
  820. }
  821. # tag:proto
  822. PY_PROTO_MYPY_ENABLED=yes
  823. 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
  824. # tag:proto tag:python-specific
  825. PY_PROTO_MYPY_SUFFIX=
  826. PY_PROTO_MYPY_PLUGIN=
  827. PY_PROTO_MYPY_PLUGIN_INTERNAL=
  828. # tag:proto tag:python-specific
  829. macro NO_MYPY() {
  830. DISABLE(PY_PROTO_MYPY_ENABLED)
  831. }
  832. # tag:proto tag:python-specific
  833. macro _PY_PROTO_CMD_BASE(File, Suf, Args...) {
  834. .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 ${input;rootrel:File} ${output;hide;noauto;norel;nopath;noext;suf=$Suf:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $Args
  835. }
  836. # tag:proto tag:python-specific
  837. macro _PY_PROTO_CMD(File) {
  838. .CMD=${cwd;rootdir;input:File} $_PY_PROTO_CMD_BASE($File _pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS $PY_PROTO_MYPY_PLUGIN)
  839. }
  840. # tag:proto tag:python-specific
  841. macro _PY_PROTO_CMD_INTERNAL(File) {
  842. .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)
  843. }
  844. # tag:proto tag:java-specific
  845. JAVA_PROTO_RUNTIME=
  846. # tag:proto tag:java-specific
  847. ### @usage: USE_JAVALITE()
  848. ### Use protobuf-javalite for Java
  849. macro USE_JAVALITE() {
  850. SET(JAVA_PROTO_RUNTIME javalite)
  851. }
  852. # tag:proto tag:java-specific
  853. JAVA_PROTO_RUNTIME_VERSION = 3.18.2
  854. JAVA_PROTO_COMMON_VERSION = 1.12.0
  855. when ($JAVA_PROTO_RUNTIME == "javalite") {
  856. _JAVA_PROTO_OUT_ARG=--java_out=lite:
  857. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION}
  858. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.19.0
  859. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.19.0
  860. }
  861. otherwise {
  862. _JAVA_PROTO_OUT_ARG=--java_out=
  863. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION}
  864. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.26.0
  865. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.26.0
  866. }
  867. # tag:proto tag:java-specific
  868. macro _JAVA_PROTO_CMD(File) {
  869. .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_PROTO_OUT_ARG$ARCADIA_BUILD_ROOT/java_out ${input;rootrel:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $JAVA_PROTO_ARGS
  870. }
  871. # tag:proto tag:perl-specific tag:deprecated
  872. ### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
  873. ###
  874. ### Generate Perl code from protobuf.
  875. ### In order to use this macro one should predict all outputs protoc will emit from input_proto file and enlist those as outputs.
  876. macro XS_PROTO(File, Dir, Outputs...) {
  877. .CMD=$PROTOC -I=${ARCADIA_ROOT}/${Dir} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} -I=${PROTOBUF_PATH} --perlxs_out=${BINDIR} ${input:File} ${hide;output:Outputs} ${output_include;hide;nopath;noext;suf=.pb.h:File}
  878. PEERDIR(${Dir})
  879. ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir})
  880. }
  881. # tag:proto tag:fbs
  882. ### @usage: PROTO2FBS(InputProto)
  883. ###
  884. ### Produce flatbuf schema out of protobuf description.
  885. macro PROTO2FBS(File) {
  886. .CMD=${cwd:BINDIR} ${tool:"contrib/tools/flatc"} -I . -I ${ARCADIA_ROOT} --proto ${input:File} ${output;hide;nopath;noext:File.fbs} ${kv;hide:"p FBS"} ${kv;hide:"pc yellow"}
  887. }
  888. # tag:proto tag:python-specific
  889. when ($PY_PROTOS_FOR == "yes") {
  890. PEERDIR+=contrib/libs/protobuf/python
  891. }
  892. # tag:python-specific
  893. macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
  894. .CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
  895. .PEERDIR=library/cpp/eventlog/proto
  896. }
  897. # tag:python-specific tag:proto
  898. macro _PY_EVLOG_CMD(File) {
  899. .CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
  900. }
  901. # tag:python-specific tag:proto
  902. macro _PY_EVLOG_CMD_INTERNAL(File) {
  903. .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}"})
  904. }
  905. # tag:java-specific tag:proto
  906. macro _JAVA_EVLOG_CMD(File) {
  907. .CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  908. .PEERDIR=library/cpp/eventlog/proto
  909. }
  910. # tag:sanitize
  911. RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
  912. # tag:sanitize
  913. when ($IS_CROSS_SANITIZE) {
  914. RUN_NO_SANITIZE=
  915. }
  916. YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
  917. XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
  918. RESPFILE_CMD=$YMAKE_PYTHON ${input:"build/scripts/writer.py"}
  919. FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"}
  920. COPY_CMD=$FS_TOOLS copy
  921. LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
  922. REMOVE_FILE=$FS_TOOLS remove
  923. MOVE_FILE=$FS_TOOLS rename
  924. # tag:allocator tag:windows-specific
  925. MSVC_DYNAMICBASE=/DYNAMICBASE
  926. when ($ALLOCATOR == "LF") {
  927. MSVC_DYNAMICBASE=/DYNAMICBASE:NO
  928. }
  929. # tag:sanitize
  930. SANITIZER_CFLAGS=
  931. # tag:proto tag:grpc
  932. ### @usage: GRPC()
  933. ###
  934. ### Emit GRPC code for all .proto files in a PROTO_LIBRARY.
  935. ### This works for all available PROTO_LIBRARY versions (C++, Python 2.x, Pyton 3.x, Java and Go).
  936. macro GRPC() {
  937. # C++
  938. CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp .grpc.pb.cc .grpc.pb.h DEPS contrib/libs/grpc)
  939. # Python
  940. PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/libs/grpc/python contrib/libs/grpc)
  941. # Java
  942. JAVA_PROTO_PLUGIN(grpc_java contrib/tools/protoc/plugins/grpc_java DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  943. }
  944. # tag:fbs
  945. FLATC_FLAGS_VALUE=
  946. ### @usage: FLATC_FLAGS(flags...)
  947. ###
  948. ### Add flags to flatc command line
  949. macro FLATC_FLAGS(FLAGS...) {
  950. SET_APPEND(FLATC_FLAGS_VALUE $FLAGS)
  951. }
  952. # tag:fbs
  953. _PY_FBS_DEPS=contrib/python/flatbuffers
  954. # tag:fbs tag:internal
  955. ### @usage: FBS_TO_PYSRC(output_base_name fbs_files...) # internal
  956. ###
  957. ### Create a tar archive of .py files generated by flatc for Python. Output tar
  958. ### archive will have .fbs.pysrc extension. This .fbs.pysrc extension is specially
  959. ### processed when --add-flatbuf-result flag is specified on the command line
  960. ### for 'ya make ...' (tar archive is extracted to output directory).
  961. macro FBS_TO_PYSRC(OUT_NAME, IN_FBS_FILES...) {
  962. .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_PYTHON ${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"}
  963. }
  964. # tag:fbs tag:go-specific
  965. # Implicit dependencies of generated code for Go
  966. _GO_FLATC_IMPORTS=\
  967. ${GOSTD}/strconv \
  968. vendor/github.com/google/flatbuffers/go
  969. # tag:fbs tag:cpp-specific
  970. macro _CPP_FLATC_CMD(SRC, SRCFLAGS...) {
  971. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${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"}
  972. .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}
  973. .PEERDIR=contrib/libs/flatbuffers
  974. }
  975. # tag:fbs tag:cpp-specific
  976. macro _CPP_FLATC64_CMD(SRC, SRCFLAGS...) {
  977. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${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"}
  978. .PEERDIR=contrib/libs/flatbuffers64
  979. }
  980. # tag:fbs tag:go-specific tag:internal
  981. ### @usage: _GO_FLATC_CMD(fbs_file flags...) # internal
  982. ###
  983. ### Create a tar archive of .go files generated by flatc for Go. Output tar archive
  984. ### will have .fbs.gosrc extension. This .fbs.gosrc is specially processed when
  985. ### --add-protobuf-result flag is specified on the command line for 'ya make ...'
  986. ### (tar archive is extracted to output directory).
  987. macro _GO_FLATC_CMD(SRC, PACKAGE_NAME) {
  988. .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_PYTHON ${input:"build/scripts/postprocess_go_fbs.py"} --input-dir ${BINDIR} --map $_FBS_NAMESPACE_MAP_GLOBAL && $YMAKE_PYTHON ${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"}
  989. .PEERDIR=${_GO_FLATC_IMPORTS}
  990. }
  991. # tag:fbs tag:java-specific tag:internal
  992. ### @usage: _JAVA_FLATC_CMD(fbs_file) # internal
  993. ###
  994. ### Create a tar archive of .java files generated by flatc for Java. Output tar
  995. ### acrchive will have .fbs.jsrc extension. Files with .fbs.jsrc extension will
  996. ### be added to results when --add-flatbuf-result flag is specified on the command
  997. ### line for 'ya make ...'
  998. macro _JAVA_FLATC_CMD(SRC) {
  999. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --java --gen-mutable ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR} ${input:SRC} && $YMAKE_PYTHON ${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"}
  1000. .PEERDIR=contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION}
  1001. }
  1002. # variables must be defined for all module types to make generate_mf.py work
  1003. MODULE_PREFIX=
  1004. MODULE_SUFFIX=
  1005. NEED_PLATFORM_PEERDIRS=yes
  1006. PEERDIR_TEST_TOOL=yes
  1007. # tag:python-specific
  1008. PYTHON2=no
  1009. PYTHON3=no
  1010. # tag:python-specific
  1011. when (!$ARCADIA_PYTHON_UNICODE_SIZE) {
  1012. when ($OS_WINDOWS) {
  1013. ARCADIA_PYTHON_UNICODE_SIZE=2
  1014. }
  1015. otherwise {
  1016. ARCADIA_PYTHON_UNICODE_SIZE=4
  1017. }
  1018. }
  1019. ### @usage: _BARE_UNIT # internal
  1020. ###
  1021. ### The base of all modules describing default bare minimum for all modules.
  1022. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1023. module _BARE_UNIT {
  1024. .EXTS=.*
  1025. .CMD=TOUCH_UNIT
  1026. .IGNORED=GO_PROTO_PLUGIN
  1027. .NODE_TYPE=Bundle
  1028. .PEERDIR_POLICY=as_include
  1029. .RESTRICTED=GRPC USE_SKIFF INDUCED_DEPS FUZZ_DICTS FUZZ_OPTS PACK 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
  1030. .FINAL_TARGET=no
  1031. PEERDIR_TAGS=__EMPTY__
  1032. when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
  1033. PEERDIR+=build/conf_fatal_error
  1034. }
  1035. DEFAULT(MODULE_VERSION)
  1036. DEFAULT(MODULE_PREFIX)
  1037. DEFAULT(MODULE_SUFFIX)
  1038. }
  1039. ### @usage: _BASE_UNIT # internal
  1040. ###
  1041. ### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
  1042. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1043. module _BASE_UNIT: _BARE_UNIT {
  1044. .GLOBAL=_FBS_NAMESPACE_MAP
  1045. PEERDIR_TAGS=CPP_PROTO CPP_FBS CPP_SSQLS CPP_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB
  1046. 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_STYLEGUIDE_OUT $PROTOC_PLUGIN_STYLEGUIDE ${input;rootrel:File}
  1047. CPP_PROTO_OUTS+=${output;hide;norel;nopath;noext:File.pb.cc} ${output;main;hide;norel;nopath;noext:File.pb.h}
  1048. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
  1049. CPP_EV_OUTS+=${output;hide;norel:File.pb.cc} ${output;hide;norel:File.pb.h}
  1050. when ($SWIG_LANG == "perl") {
  1051. _SWIG_CMD=$_SWIG_PERL_CMD
  1052. _SWIG_ADDINCLS=$_SWIG_PERL_ADDINCLS
  1053. _SWIG_PEERDIR=$_SWIG_PERL_PEERDIR
  1054. }
  1055. elsewhen ($SWIG_LANG == "python") {
  1056. _SWIG_CMD=$_SWIG_PYTHON_CMD
  1057. _SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
  1058. _SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
  1059. }
  1060. elsewhen ($SWIG_LANG == "jni_cpp") {
  1061. _SWIG_CMD=$_SWIG_JNI_CPP_CMD
  1062. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1063. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1064. }
  1065. elsewhen ($SWIG_LANG == "java") {
  1066. _SWIG_CMD=$_SWIG_JNI_CMD
  1067. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1068. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1069. }
  1070. when ($PY_PROTOS_FOR == "yes") {
  1071. MACRO_ALIAS(EVLOG_CMD _PY_EVLOG_CMD)
  1072. MACRO_ALIAS(PROTO_CMD _PY_PROTO_CMD)
  1073. }
  1074. otherwise {
  1075. MACRO_ALIAS(EVLOG_CMD _CPP_EVLOG_CMD)
  1076. MACRO_ALIAS(FBS_CMD _CPP_FLATC_CMD)
  1077. when ($BUILD_PROTO_AS_EVLOG == "yes") {
  1078. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_EVLOG_CMD)
  1079. }
  1080. otherwise {
  1081. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_CMD)
  1082. }
  1083. when ($USE_VANILLA_PROTOC == "yes") {
  1084. PROTOC=${tool:"contrib/tools/protoc_std"}
  1085. PROTOC_STYLEGUIDE_OUT=
  1086. PROTOC_PLUGIN_STYLEGUIDE=
  1087. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std
  1088. MACRO_ALIAS(PROTO_CMD _CPP_VANILLA_PROTO_CMD)
  1089. }
  1090. when ($PROTOC_TRANSITIVE_HEADERS == "no") {
  1091. CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
  1092. }
  1093. }
  1094. SANITIZER_DEFINED=no
  1095. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1096. CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
  1097. LDFLAGS+=-fsanitize=$SANITIZER_TYPE
  1098. SANITIZER_DEFINED=yes
  1099. when ($CLANG) {
  1100. CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"}
  1101. LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"}
  1102. }
  1103. }
  1104. when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
  1105. CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1106. LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1107. }
  1108. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1109. CFLAGS+=-fprofile-instr-generate -fcoverage-mapping -DCLANG_COVERAGE
  1110. LDFLAGS+=-fprofile-instr-generate -fcoverage-mapping
  1111. }
  1112. when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
  1113. CFLAGS+=-DNLG_COVERAGE
  1114. }
  1115. when ($GCC) {
  1116. select ($SANITIZER_TYPE) {
  1117. "address" ? {
  1118. LDFLAGS+=-static-libasan
  1119. }
  1120. "undefined" ? {
  1121. LDFLAGS+=-static-libubsan
  1122. }
  1123. "thread" ? {
  1124. PIE=yes
  1125. LDFLAGS+=-static-libtsan
  1126. }
  1127. }
  1128. }
  1129. when ($HARDENING == "yes") {
  1130. when ($CLANG) {
  1131. CFLAGS+=-fstack-protector-all -D_hardening_enabled_
  1132. LDFLAGS+=-z relro -z now -z noexecstack
  1133. PIE=yes
  1134. }
  1135. }
  1136. when ($USE_LTO == "yes") {
  1137. when ($GCC) {
  1138. CFLAGS+=-flto -fno-fat-lto-objects
  1139. LDFLAGS+=-flto
  1140. NO_LTO_CFLAGS=-fno-lto
  1141. }
  1142. when ($CLANG) {
  1143. CFLAGS+=-flto
  1144. LDFLAGS+=-flto
  1145. NO_LTO_CFLAGS=-fno-lto
  1146. }
  1147. }
  1148. when ($USE_THINLTO == "yes") {
  1149. when ($GCC) {
  1150. CFLAGS+=-flto=thin
  1151. LDFLAGS+=-flto=thin
  1152. NO_LTO_CFLAGS=-fno-lto
  1153. }
  1154. when ($CLANG) {
  1155. CFLAGS+=-flto=thin
  1156. LDFLAGS+=-flto=thin
  1157. NO_LTO_CFLAGS=-fno-lto
  1158. }
  1159. }
  1160. when ($CLANG) {
  1161. when ($PGO_ADD == "yes") {
  1162. CFLAGS+=-fprofile-instr-generate
  1163. LDFLAGS+=-fprofile-instr-generate
  1164. }
  1165. when ($PGO_PATH) {
  1166. CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
  1167. LDFLAGS+=-fprofile-instr-use=$PGO_PATH
  1168. }
  1169. }
  1170. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  1171. PEERDIR+=$COMPILER_PLATFORM
  1172. }
  1173. when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
  1174. PEERDIR+=contrib/libs/linux-headers
  1175. }
  1176. # Adding PEERDIR from trigger doesn't always work. In this case it
  1177. # cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl
  1178. # Workaround this issue by setting variable with PEERDIR in trigger
  1179. # and then adding PEERDIR to it's value unconditionally.
  1180. when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1181. _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14
  1182. }
  1183. otherwise {
  1184. _UBUNTU_COMPAT_PEERDIR=
  1185. }
  1186. PEERDIR+=$_UBUNTU_COMPAT_PEERDIR
  1187. when ($NORUNTIME != "yes") {
  1188. PEERDIR+=contrib/libs/cxxsupp
  1189. when ($MAPSMOBI_BUILD_TARGET == "yes") {
  1190. PEERDIR+=build/platform/mapkit
  1191. }
  1192. }
  1193. when ($NOUTIL != "yes") {
  1194. PEERDIR+=util
  1195. }
  1196. when ($MUSL == "yes") {
  1197. CFLAGS += -D_musl_
  1198. LINK_DYN_LIB_FLAGS += --musl
  1199. LINK_SCRIPT_EXE_FLAGS += --musl
  1200. PEERDIR+=contrib/libs/musl/include
  1201. }
  1202. # g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
  1203. # The same problem exists for clang toolchain. On the other hand, the problem
  1204. # doesn't affect cl since it has united C/C++ library and doesn't need
  1205. # proxy C-headers.
  1206. # Disable all C++ headers including proxy C-headers when we use libc++.
  1207. when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
  1208. CXXFLAGS += -nostdinc++
  1209. }
  1210. otherwise {
  1211. CFLAGS += -DUSE_STL_SYSTEM
  1212. }
  1213. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  1214. PEERDIR += build/external_resources/codenavigation
  1215. }
  1216. when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
  1217. CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
  1218. }
  1219. DEFAULT(USE_SSE4 yes)
  1220. when ($NOSSE != "yes") {
  1221. CFLAGS+=$SSE_CFLAGS
  1222. C_DEFINES+=$SSE_DEFINES
  1223. when ($USE_SSE4 == "yes") {
  1224. CFLAGS+=$SSE4_CFLAGS
  1225. C_DEFINES+=$SSE4_DEFINES
  1226. }
  1227. }
  1228. elsewhen ($MSVC != "yes") {
  1229. CFLAGS += -mno-sse
  1230. }
  1231. when ($LIPO == "yes" && $NEED_PLATFORM_PEERDIRS != "no") {
  1232. when ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1233. PEERDIR += build/platform/cctools
  1234. }
  1235. }
  1236. _REGISTER_NO_CHECK_IMPORTS()
  1237. DEFAULT(PACKAGE_PREFIX_ARGS)
  1238. DEFAULT(BYACC_FLAGS -v)
  1239. DEFAULT(SWIG_LANG python)
  1240. DEFAULT(BISON_FLAGS -v)
  1241. DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
  1242. when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
  1243. PEERDIR+=build/platform/binutils
  1244. }
  1245. }
  1246. _LINKER_ID=
  1247. # GCC does not support -fuse-ld with an executable path,
  1248. # only -fuse-ld=gold or -fuse-ld=lld.
  1249. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1250. when ($_LINKER_ID in [ "gold", "lld" ]) {
  1251. PEERDIR+=build/platform/${_LINKER_ID}
  1252. }
  1253. }
  1254. macro _USE_LINKER_IMPL(LINKER_ID...) {
  1255. SET(_LINKER_ID $LINKER_ID)
  1256. }
  1257. macro _USE_LINKER() {
  1258. _USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
  1259. }
  1260. ### @usage: USE_LINKER_GOLD()
  1261. ### Use gold linker for a program. This doesn't work in libraries
  1262. macro USE_LINKER_GOLD() {
  1263. _USE_LINKER_IMPL(gold)
  1264. }
  1265. COMMON_LINK_SETTINGS=
  1266. LINK_ADDITIONAL_SECTIONS=
  1267. LINK_ADDITIONAL_SECTIONS_COMMAND=
  1268. when ($COMMON_LINK_SETTINGS == "yes") {
  1269. when ($_LINKER_ID == "lld" || $_LINKER_ID == "gold") {
  1270. LDFLAGS += -Wl,--gdb-index
  1271. }
  1272. when ($EMBED_LINKER_CREF == "yes") {
  1273. LDFLAGS+=-Wl,--cref ${tmp;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1274. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
  1275. }
  1276. elsewhen ($DUMP_LINKER_CREF == "yes") {
  1277. LDFLAGS+=-Wl,--cref ${output;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1278. }
  1279. when ($EMBED_LINKER_MAP == "yes") {
  1280. LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1281. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1282. }
  1283. elsewhen ($DUMP_LINKER_MAP == "yes") {
  1284. LDFLAGS+=-Wl,-Map=${output;rootrel;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1285. }
  1286. when ($USE_MKL == "yes") {
  1287. NOPLATFORM=yes
  1288. }
  1289. when (($USE_EAT_MY_DATA == "yes") && ($WIN32 != "yes") && ($DARWIN != "yes") && ($OS_ANDROID != "yes") && ($OS_IOS != "yes")) {
  1290. PEERDIR+=contrib/libs/libeatmydata/autocheck_wrapper
  1291. }
  1292. when ($USE_ARCADIA_LIBM == "yes") {
  1293. PEERDIR+=contrib/libs/libm
  1294. }
  1295. when ($USE_ARCADIA_LIBM == "no") {
  1296. C_SYSTEM_LIBRARIES+=-lm
  1297. }
  1298. when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
  1299. 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" ]) {
  1300. PEERDIR+=library/cpp/malloc/system
  1301. }
  1302. }
  1303. otherwise {
  1304. select ($ALLOCATOR) {
  1305. "MIM" ? {
  1306. PEERDIR+=library/cpp/malloc/mimalloc
  1307. }
  1308. "HU" ? {
  1309. PEERDIR+=library/cpp/malloc/hu
  1310. }
  1311. "TCMALLOC_256K" ? {
  1312. PEERDIR+=library/cpp/malloc/tcmalloc
  1313. PEERDIR+=contrib/libs/tcmalloc
  1314. }
  1315. "TCMALLOC_SMALL_BUT_SLOW" ? {
  1316. PEERDIR+=library/cpp/malloc/tcmalloc
  1317. PEERDIR+=contrib/libs/tcmalloc/small_but_slow
  1318. }
  1319. "TCMALLOC_NUMA_256K" ? {
  1320. PEERDIR+=library/cpp/malloc/tcmalloc
  1321. PEERDIR+=contrib/libs/tcmalloc/numa_256k
  1322. }
  1323. "TCMALLOC_NUMA_LARGE_PAGES" ? {
  1324. PEERDIR+=library/cpp/malloc/tcmalloc
  1325. PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
  1326. }
  1327. "TCMALLOC" ? {
  1328. PEERDIR+=library/cpp/malloc/tcmalloc
  1329. PEERDIR+=contrib/libs/tcmalloc/default
  1330. }
  1331. "TCMALLOC_TC" ? {
  1332. PEERDIR+=library/cpp/malloc/tcmalloc
  1333. PEERDIR+=contrib/libs/tcmalloc/no_percpu_cache
  1334. }
  1335. "GOOGLE" ? {
  1336. PEERDIR+=library/cpp/malloc/galloc
  1337. }
  1338. "J" ? {
  1339. when ($WIN32 == "yes") {
  1340. PEERDIR+=library/cpp/malloc/system
  1341. }
  1342. otherwise {
  1343. PEERDIR+=library/cpp/malloc/jemalloc
  1344. }
  1345. }
  1346. "LF" ? {
  1347. PEERDIR+=library/cpp/lfalloc
  1348. }
  1349. "LF_YT" ? {
  1350. PEERDIR+=library/cpp/lfalloc/yt
  1351. }
  1352. "LF_DBG" ? {
  1353. PEERDIR+=library/cpp/lfalloc/dbg
  1354. }
  1355. "B" ? {
  1356. PEERDIR+=library/cpp/balloc
  1357. }
  1358. "BM" ? {
  1359. PEERDIR+=library/cpp/balloc_market
  1360. }
  1361. "C" ? {
  1362. PEERDIR+=library/cpp/malloc/calloc
  1363. }
  1364. "LOCKLESS" ? {
  1365. PEERDIR+=library/cpp/malloc/lockless
  1366. }
  1367. "YT" ? {
  1368. PEERDIR+=library/cpp/ytalloc/impl
  1369. }
  1370. }
  1371. }
  1372. when ($ALLOCATOR == "SYSTEM") {
  1373. PEERDIR+=library/cpp/malloc/system
  1374. }
  1375. when ($WERROR != "no") {
  1376. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  1377. C_WARNING_OPTS += $WERROR_FLAG
  1378. }
  1379. }
  1380. when ($ICC == "yes") {
  1381. PEERDIR+=contrib/libs/intel/core
  1382. }
  1383. when ($WITH_VALGRIND == "yes") {
  1384. PEERDIR+=contrib/libs/valgrind
  1385. }
  1386. }
  1387. when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
  1388. LINK_ADDITIONAL_SECTIONS_COMMAND+= \
  1389. $OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
  1390. }
  1391. _SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/:PEERS}
  1392. when ($OS_WINDOWS == "yes") {
  1393. _SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/:PEERS}
  1394. }
  1395. elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1396. _SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/:PEERS}
  1397. }
  1398. LINK_OR_COPY_SO_CMD=
  1399. when ($SO_OUTPUTS == "yes") {
  1400. LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
  1401. LDFLAGS+=$RPATH_GLOBAL
  1402. }
  1403. # tag:restricted tag:DLL
  1404. ### $usage: WITH_DYNAMIC_LIBS() # restricted
  1405. ###
  1406. ### Include dynamic libraries as extra PROGRAM/DLL outputs
  1407. macro WITH_DYNAMIC_LIBS() {
  1408. ENABLE(SO_OUTPUTS)
  1409. }
  1410. # tag:internal
  1411. ### $usage: REAL_LINK_EXE_IMPL(peers...) # internal
  1412. macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1413. .CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1414. }
  1415. # tag:internal
  1416. ### $usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1417. macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1418. .CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
  1419. }
  1420. # tag:internal
  1421. ### $usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
  1422. macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1423. .CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
  1424. }
  1425. # tag:internal
  1426. ### $usage: LINK_EXE_IMPL(peers...) # internal
  1427. macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1428. .CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1429. }
  1430. # tag:internal
  1431. ### $usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1432. macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1433. .CMD=$LINK_EXEC_DYN_LIB_CMDLINE
  1434. }
  1435. # tag:internal
  1436. ### @usage: _LINK_UNIT # internal
  1437. ###
  1438. ### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
  1439. module _LINK_UNIT: _BASE_UNIT {
  1440. .EXTS=.o .obj .supp .tidyjson .ld
  1441. .CMD=LINK_EXE
  1442. .ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  1443. .NODE_TYPE=Program
  1444. .PEERDIR_POLICY=as_build_from
  1445. .FINAL_TARGET=yes
  1446. .DEFAULT_NAME_GENERATOR=DirName
  1447. .ARGS_PARSER=Base
  1448. DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
  1449. _USE_LINKER()
  1450. #link with libunwind manually
  1451. when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
  1452. PEERDIR += contrib/libs/cxxsupp
  1453. }
  1454. when ($USE_LIBCXXRT == "yes") {
  1455. PEERDIR += contrib/libs/cxxsupp/libcxxrt
  1456. }
  1457. ENABLE(COMMON_LINK_SETTINGS)
  1458. CHECK_PROVIDES()
  1459. }
  1460. MODULE_TYPE=UNKNOWN
  1461. macro ADD_CLANG_TIDY() {
  1462. ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy)
  1463. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json)
  1464. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json)
  1465. }
  1466. # tag:internal
  1467. ### @usage: _BASE_PROGRAM # internal
  1468. ###
  1469. ### The base of all programs. It adds dependencies to make final artefact complete and runnable.
  1470. module _BASE_PROGRAM: _LINK_UNIT {
  1471. .SYMLINK_POLICY=EXE
  1472. .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
  1473. .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1474. SET(MODULE_TYPE PROGRAM)
  1475. when ($OS_IOS == "yes") {
  1476. EXTS+=.ios.interface
  1477. }
  1478. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  1479. MODULE_SUFFIX=.exe
  1480. }
  1481. when ($TIDY == "yes") {
  1482. MODULE_SUFFIX=.tidyjson
  1483. }
  1484. when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
  1485. PEERDIR+=contrib/libs/asmlib
  1486. }
  1487. when ($MUSL == "yes") {
  1488. when ($MUSL_LITE == "yes") {
  1489. PEERDIR += contrib/libs/musl
  1490. }
  1491. otherwise {
  1492. PEERDIR += contrib/libs/musl/full
  1493. }
  1494. }
  1495. when ($USE_DYNAMIC_CUDA == "yes") {
  1496. LINK_SCRIPT_EXE_FLAGS += --dynamic-cuda
  1497. }
  1498. DEFAULT(CPU_CHECK yes)
  1499. when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
  1500. CPU_CHECK = no
  1501. }
  1502. when ($CPU_CHECK == "yes") {
  1503. PEERDIR += library/cpp/cpuid_check
  1504. }
  1505. when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
  1506. PEERDIR += library/cpp/execprofile/autostart
  1507. }
  1508. when ($SANITIZER_DEFINED == "yes") {
  1509. PEERDIR += contrib/libs/cxxsupp/libsan
  1510. }
  1511. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1512. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1513. }
  1514. when ($IDE_MSVS == "yes") {
  1515. PEERDIR+=build/scripts/c_templates
  1516. }
  1517. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1518. LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1519. }
  1520. }
  1521. CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  1522. && vcs_info \
  1523. && target_link_options PRIVATE $LDFLAGS $OBJADDE_LIB $OBJADDE \
  1524. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1525. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS
  1526. ### @usage: PROGRAM([progname])
  1527. ###
  1528. ### Regular program module.
  1529. ### If name is not specified it will be generated from the name of the containing project directory.
  1530. module PROGRAM: _BASE_PROGRAM {
  1531. .SEM=CPP_PROGRAM_SEM
  1532. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1533. ADD_CLANG_TIDY()
  1534. SET(MODULE_LANG CPP)
  1535. }
  1536. # tag:python-specific tag:deprecated tag:internal
  1537. module _PY2_PROGRAM: _BASE_PY_PROGRAM {
  1538. SET(MODULE_LANG PY2)
  1539. # Looks like we cannot avoid copy-paste util ymake supports multiple inheritance
  1540. # We need to attach coverage.extractor to every py_program target, except pytest targets
  1541. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1542. }
  1543. # tag:python-specific tag:deprecated
  1544. ### @usage: PY2_PROGRAM([progname]) # deprecated
  1545. ###
  1546. ### Deprecated. Use PY3_PROGRAM instead.
  1547. ### Python 2.x binary program. Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  1548. ### If name is not specified it will be generated from the name of the containing project directory.
  1549. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  1550. ###
  1551. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1552. module PY2_PROGRAM: _PY2_PROGRAM {
  1553. .RESTRICTED=STYLE_PYTHON
  1554. when ($FAIL_PY2 == "yes") {
  1555. _OK=no
  1556. }
  1557. otherwise {
  1558. PEERDIR+=build/rules/py2_deprecation
  1559. }
  1560. ASSERT(_OK You are using deprecated Python2-only code (PY2_PROGRAM). Please consider rewriting to Python 3.)
  1561. }
  1562. # tag:python-specific
  1563. ### @usage: NO_EXTENDED_SOURCE_SEARCH()
  1564. ###
  1565. ### Prevent module using in extended python source search.
  1566. ### Use the macro if module contains python2-only files (or other python sources which shouldn't be imported by python3 interpreter)
  1567. ### which resides in the same directories with python 3 useful code. contrib/python/future is a example.
  1568. ### Anyway, preferred way is to move such files into separate dir and don't use this macro at all.
  1569. ###
  1570. ### Also see: https://docs.yandex-team.ru/ya-make/manual/python/vars#y_python_extended_source_search for details
  1571. macro NO_EXTENDED_SOURCE_SEARCH() {
  1572. SET(NO_EXTENDED_SOURCE_SEARCH yes)
  1573. }
  1574. # tag:python-specific
  1575. ### @usage: PY3_PROGRAM([progname])
  1576. ###
  1577. ### Python 3.x binary program. Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  1578. ### If name is not specified it will be generated from the name of the containing project directory.
  1579. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules.
  1580. ###
  1581. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1582. multimodule PY3_PROGRAM {
  1583. module PY3_BIN: PY3_PROGRAM_BIN {
  1584. .PEERDIRSELF=PY3_BIN_LIB
  1585. .IGNORED=RESOURCE RESOURCE_FILES PEERDIR TASKLET_REG
  1586. # Notify pybuild to skip almost all PY_SRCS arguments except MAIN
  1587. ENABLE(PROCESS_PY_MAIN_ONLY)
  1588. _PY_PROGRAM()
  1589. }
  1590. module PY3_BIN_LIB: PY3_LIBRARY {
  1591. .IGNORED=RESTRICT_LICENSES
  1592. # Notify pybuild to skip all python main function definitions
  1593. ENABLE(IGNORE_PY_MAIN)
  1594. _REQUIRE_EXPLICIT_LICENSE()
  1595. }
  1596. }
  1597. # tag:ycr-specific
  1598. macro _YCR_GENERATE_CONFIGS_INTL(Package, App, Configs...) {
  1599. .CMD=${tool:"maps/infra/yacare/scripts/make_configs"} $Package $App ${cwd:BINDIR} ${output;hide;pre=debian/$Package/:Configs}
  1600. }
  1601. # tag:ycr-specific
  1602. macro _YCR_GENERATE_CONFIGS(Package, App) {
  1603. .CMD=$_YCR_GENERATE_CONFIGS_INTL($Package $App ${pre=etc/yandex/maps/yacare/:App.conf} ${pre=etc/template_generator/templates/etc/logrotate.d/:App} ${pre=etc/nginx/sites-available/:App.conf} ${pre=etc/syslog-ng/conf-available/:App.conf} ${pre=etc/template_generator/config.d/:App.yaml} ${pre=/juggler/checks-available/yacare_;suf=/MANIFEST.json:App} ${pre=etc/yandex/maps/roquefort/:App.conf} ${pre=usr/lib/yandex/maps/yacare/lua/init_worker.d/rate_limiter_:App.lua} ${pre=usr/lib/yandex/maps/yacare/lua/init_worker.d/tvm_:App.lua} ${pre=usr/lib/yandex/maps/yacare/lua/init.d/tvm_:App.lua} ${pre=etc/supervisor/conf-available/:App.conf} ${pre=etc/template_generator/templates/etc/yandex/unified_agent/conf.d/04_yacare_:App.yml})
  1604. }
  1605. # tag:ycr-specific
  1606. when ($TIDY=="yes") {
  1607. YCR_LINK_EXE=$LINK_EXE
  1608. }
  1609. otherwise {
  1610. YCR_LINK_EXE=$LINK_EXE && $_YCR_GENERATE_CONFIGS($MODULE_PREFIX$REALPRJNAME $MODULE_PREFIX$REALPRJNAME)
  1611. }
  1612. # tag:ycr-specific
  1613. ### @usage: YCR_PROGRAM([progname])
  1614. ###
  1615. ### yacare-specific program module. Generates yacare configs in addition to producing the program.
  1616. ### If name is not specified it will be generated from the name of the containing project directory.
  1617. module YCR_PROGRAM: PROGRAM {
  1618. .CMD=YCR_LINK_EXE
  1619. }
  1620. # tag:ycr-specific tag:python-specific
  1621. macro _PYCR_GENERATE_CONFIGS_INTL(Package, App, Configs...) {
  1622. .CMD=${tool:"maps/infra/pycare/scripts/make_configs"} $Package $App ${cwd:BINDIR} ${output;hide;pre=configs/:Configs}
  1623. }
  1624. # tag:ycr-specific tag:python-specific
  1625. macro _PYCR_GENERATE_CONFIGS(Package, App) {
  1626. .CMD=$_PYCR_GENERATE_CONFIGS_INTL($Package $App ${pre=etc/nginx/sites-available/:App.conf} ${pre=etc/template_generator/templates/etc/logrotate.d/:App} ${pre=etc/syslog-ng/conf-available/:App.conf} ${pre=etc/yandex/maps/roquefort/:App.conf} ${pre=etc/template_generator/config.d/:App.yaml} ${pre=etc/supervisor/conf-available/:App.conf} ${pre=etc/template_generator/templates/etc/yandex/unified_agent/conf.d/04_pycare_:App.yml})
  1627. }
  1628. # tag:ycr-specific tag:python-specific
  1629. PYCR_LINK_EXE=$LINK_EXE && $_PYCR_GENERATE_CONFIGS($MODULE_PREFIX$REALPRJNAME $MODULE_PREFIX$REALPRJNAME)
  1630. # tag:ycr-specific tag:python-specific
  1631. ### @usage: PYCR_PROGRAM([progname])
  1632. ###
  1633. ### pycare-specific program module. Generates pycare configs in addition to producing the program.
  1634. ### If name is not specified it will be generated from the name of the containing project directory.
  1635. module PYCR_PROGRAM: PY3_PROGRAM_BIN {
  1636. .CMD=PYCR_LINK_EXE
  1637. }
  1638. ### @usage: EXPORTS_SCRIPT(exports_file)
  1639. ###
  1640. ### Specify exports script within PROGRAM, DLL and DLL-derived modules.
  1641. ### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
  1642. ### The other option use EXPORTS parameter of the DLL module itself.
  1643. ###
  1644. ### @see: [DLL](#module_DLL)
  1645. macro EXPORTS_SCRIPT(Arg) {
  1646. SET(EXPORTS_FILE $Arg)
  1647. }
  1648. ### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
  1649. ###
  1650. ### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
  1651. macro NO_EXPORT_DYNAMIC_SYMBOLS() {
  1652. ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
  1653. }
  1654. ### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
  1655. ###
  1656. ### Export all non-hidden symbols as dynamic when linking a PROGRAM.
  1657. macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
  1658. # Dummy: default behaviour
  1659. ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
  1660. }
  1661. ### @usage: USE_DYNAMIC_CUDA()
  1662. ###
  1663. ### Enable linking of PROGRAM with dynamic CUDA. By default CUDA uses static linking
  1664. macro USE_DYNAMIC_CUDA() {
  1665. LDFLAGS(-Wl,-rpath,$ORIGIN)
  1666. ENABLE(USE_DYNAMIC_CUDA)
  1667. }
  1668. ### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
  1669. ###
  1670. ### Specifies name of a script for custom link step. The scripts
  1671. ### should be placed in the build/scripts directory and are subject to
  1672. ### review by devtools@.
  1673. macro CUSTOM_LINK_STEP_SCRIPT(Name) {
  1674. SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
  1675. }
  1676. ### @usage: _BASE_UNITTEST # internal
  1677. ###
  1678. ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
  1679. module _BASE_UNITTEST: _BASE_PROGRAM {
  1680. .FINAL_TARGET=no
  1681. .NODE_TYPE=Program
  1682. .ALLOWED=YT_SPEC
  1683. when ($UT_SKIP_EXCEPTIONS == "yes") {
  1684. C_DEFINES+=-DUT_SKIP_EXCEPTIONS
  1685. }
  1686. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1687. }
  1688. UNITTEST_SEM=$CPP_PROGRAM_SEM && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME --print-before-suite --print-before-test --fork-tests --print-times --show-fails
  1689. # tag:test
  1690. ### @usage: UNITTEST([name])
  1691. ###
  1692. ### Unit test module based on library/cpp/testing/unittest.
  1693. ### It is recommended not to specify the name.
  1694. ###
  1695. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
  1696. module UNITTEST: _BASE_UNITTEST {
  1697. .SEM=UNITTEST_SEM
  1698. .DEFAULT_NAME_GENERATOR=FullPath
  1699. .ARGS_PARSER=Base
  1700. PEERDIR(library/cpp/testing/unittest_main)
  1701. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1702. SET(MODULE_LANG CPP)
  1703. }
  1704. # tag:yt-specific tag:test
  1705. ### @usage: YT_UNITTEST([name])
  1706. ###
  1707. ### YT Unit test module based on mapreduce/yt/library/utlib
  1708. module YT_UNITTEST: _BASE_UNITTEST {
  1709. PEERDIR(mapreduce/yt/library/utlib)
  1710. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1711. }
  1712. # tag:test
  1713. ### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
  1714. ###
  1715. ### Generic unit test module.
  1716. module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
  1717. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1718. }
  1719. # tag:cpp-specific tag:test
  1720. ### @usage: GTEST([name])
  1721. ###
  1722. ### Unit test module based on library/cpp/testing/gtest.
  1723. ### It is recommended not to specify the name.
  1724. ###
  1725. ### Documentation: https://docs.yandex-team.ru/arcadia-cpp/cpp_test
  1726. module GTEST: _BASE_UNITTEST {
  1727. .SEM=UNITTEST_SEM
  1728. .DEFAULT_NAME_GENERATOR=FullPath
  1729. .ARGS_PARSER=Base
  1730. PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
  1731. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
  1732. SET(MODULE_LANG CPP)
  1733. }
  1734. USE_AFL=no
  1735. # tag:fuzzing
  1736. ### @usage: FUZZ()
  1737. ###
  1738. ### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
  1739. ### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
  1740. ### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
  1741. ###
  1742. ### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
  1743. ###
  1744. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1745. module FUZZ: _BASE_PROGRAM {
  1746. .NODE_TYPE=Program
  1747. .FINAL_TARGET=no
  1748. .ALLOWED=FUZZ_DICTS FUZZ_OPTS
  1749. DEFAULT(LIBFUZZER_PATH contrib/libs/libfuzzer12)
  1750. when ($USE_AFL == "no") {
  1751. PEERDIR+=$LIBFUZZER_PATH
  1752. }
  1753. when ($USE_AFL == "yes") {
  1754. PEERDIR+=$LIBFUZZER_PATH/afl
  1755. }
  1756. when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
  1757. PEERDIR+=devtools/nofuzz
  1758. }
  1759. ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
  1760. }
  1761. # tag:ios-specific
  1762. PACK_IOS_CMD=
  1763. when ($OS_IOS && $BUILD_IOS_APP) {
  1764. PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
  1765. }
  1766. LINK_BOOSTTEST_CMD=
  1767. BOOST_TEST_TYPE_STRING=
  1768. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1769. LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
  1770. BOOST_TEST_TYPE_STRING=no.test
  1771. }
  1772. otherwise {
  1773. LINK_BOOSTTEST_CMD=$LINK_EXE
  1774. BOOST_TEST_TYPE_STRING=boost.test
  1775. }
  1776. # tag:deprecated
  1777. ### @usage: BOOSTTEST([name]) #deprecated
  1778. ###
  1779. ### Test module based on boost/test/unit_test.hpp.
  1780. ### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
  1781. ### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
  1782. module BOOSTTEST: _BASE_PROGRAM {
  1783. .NODE_TYPE=Program
  1784. .FINAL_TARGET=no
  1785. .CMD=LINK_BOOSTTEST_CMD
  1786. PEERDIR(library/cpp/testing/boost_test)
  1787. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1788. MODULE_SUFFIX=.a
  1789. }
  1790. elsewhen ($OS_IOS && $BUILD_IOS_APP) {
  1791. PEERDIR+=devtools/boosttest_ios_wrapper/library
  1792. MODULE_SUFFIX=.ios.tar
  1793. }
  1794. ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
  1795. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1796. }
  1797. # tag:deprecated
  1798. ### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated
  1799. ###
  1800. ### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
  1801. module BOOSTTEST_WITH_MAIN: BOOSTTEST {
  1802. PEERDIR(library/cpp/testing/boost_test_main)
  1803. }
  1804. FUZZ_DICTS_VALUE=
  1805. ### @usage: FUZZ_DICTS(path1 [path2...])
  1806. ###
  1807. ### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
  1808. ### Libfuzzer and AFL use a single syntax for dictionary descriptions.
  1809. ### Should only be used in FUZZ modules.
  1810. ###
  1811. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1812. macro FUZZ_DICTS(Data...) {
  1813. SET_APPEND(FUZZ_DICTS_VALUE $Data)
  1814. }
  1815. FUZZ_OPTS_VALUE=
  1816. ### @usage: FUZZ_OPTS(opt1 [Opt2...])
  1817. ###
  1818. ### Overrides or adds options to the corpus mining and fuzzer run.
  1819. ### Currently supported only Libfuzzer, so you should use the options for it.
  1820. ### Should only be used in FUZZ modules.
  1821. ###
  1822. ### @example:
  1823. ###
  1824. ### FUZZ_OPTS (
  1825. ### -max_len=1024
  1826. ### -rss_limit_mb=8192
  1827. ### )
  1828. ###
  1829. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1830. macro FUZZ_OPTS(Data...) {
  1831. SET_APPEND(FUZZ_OPTS_VALUE $Data)
  1832. }
  1833. # tag:yt-specific tag:test
  1834. TEST_YT_SPEC_VALUE=
  1835. ### @usage: YT_SPEC(path1 [path2...])
  1836. ###
  1837. ### Allows you to specify json-files with YT task and operation specs,
  1838. ### which will be used to run test node in the YT.
  1839. ### Test must be marked with ya:yt tag.
  1840. ### Files must be relative to the root of Arcadia.
  1841. ###
  1842. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1843. macro YT_SPEC(Data...) {
  1844. SET_APPEND(TEST_YT_SPEC_VALUE $Data)
  1845. }
  1846. # tag:test
  1847. TEST_SRCS_VALUE=
  1848. ### @usage: TEST_SRCS(Files...)
  1849. ###
  1850. ### 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.
  1851. ###
  1852. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1853. macro TEST_SRCS(Tests...) {
  1854. SET_APPEND(TEST_SRCS_VALUE $Tests)
  1855. }
  1856. macro DISABLE_DATA_VALIDATION() {
  1857. DISABLE(VALIDATE_DATA)
  1858. }
  1859. # tag:test
  1860. TEST_DATA_VALUE=
  1861. ### @usage: DATA([path...])
  1862. ###
  1863. ### Specifies the path to the data necessary test.
  1864. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
  1865. ### In the latter case resource will be brought to the working directory of the test before it is started
  1866. ###
  1867. ### Used only inside TEST modules.
  1868. ###
  1869. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1870. macro DATA(Data...) {
  1871. SET_APPEND(TEST_DATA_VALUE $Data)
  1872. ADD_CHECK(check.data $Data)
  1873. }
  1874. # tag:test
  1875. TEST_TAGS_VALUE=
  1876. ### @usage: TAG ([tag...])
  1877. ###
  1878. ### Each test can have one or more tags used to filter tests list for running.
  1879. ### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
  1880. ###
  1881. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
  1882. macro TAG(Tags...) {
  1883. SET_APPEND(TEST_TAGS_VALUE $Tags)
  1884. }
  1885. # tag:test
  1886. TEST_REQUIREMENTS_VALUE=
  1887. ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
  1888. ###
  1889. ### Allows you to specify the requirements of the test.
  1890. ###
  1891. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1892. macro REQUIREMENTS(Tags...) {
  1893. SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
  1894. }
  1895. # tag:test
  1896. TEST_ENV_VALUE=
  1897. ### @usage: ENV(key[=value])
  1898. ###
  1899. ### Sets env variable key to value (gets value from system env by default).
  1900. macro ENV(Data...) {
  1901. SET_APPEND(TEST_ENV_VALUE ${quo:Data})
  1902. }
  1903. ### @usage: CONFTEST_LOAD_POLICY_LOCAL()
  1904. ###
  1905. ### Loads conftest.py files in a way that pytest does it
  1906. macro CONFTEST_LOAD_POLICY_LOCAL() {
  1907. SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
  1908. }
  1909. # tag:test
  1910. TEST_RECIPES_VALUE=
  1911. ### @usage: USE_RECIPE(path [arg1 arg2...])
  1912. ###
  1913. ### Provides prepared environment via recipe for test.
  1914. ###
  1915. ### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
  1916. macro USE_RECIPE(Data...) {
  1917. SET_APPEND(TEST_RECIPES_VALUE $Data)
  1918. SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
  1919. }
  1920. # tag:python-specific tag:test
  1921. TEST_PYTHON_PATH_VALUE=
  1922. # tag:python-specific tag:test
  1923. ### @usage: PYTHON_PATH(Path)
  1924. ###
  1925. ### Set path to Python that will be used to runs scripts in tests
  1926. macro PYTHON_PATH(Path) {
  1927. SET(TEST_PYTHON_PATH_VALUE $Path)
  1928. }
  1929. # tag:test
  1930. SKIP_TEST_VALUE=
  1931. ### @usage: SKIP_TEST(Reason)
  1932. ###
  1933. ### Skip the suite defined by test module. Provide a reason to be output in test execution report.
  1934. macro SKIP_TEST(Reason...) {
  1935. SET(SKIP_TEST_VALUE $Reason)
  1936. }
  1937. # tag:test
  1938. LINT_LEVEL_VALUE=extended
  1939. ### @usage: NO_LINT()
  1940. ###
  1941. ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
  1942. macro NO_LINT() {
  1943. SET(LINT_LEVEL_VALUE none)
  1944. }
  1945. ### @usage: LINT(<none|base|strict>)
  1946. ###
  1947. ### Set linting levem for sources of the module
  1948. macro LINT(level) {
  1949. SET(LINT_LEVEL_VALUE $level)
  1950. }
  1951. # tag:python-specific tag:test
  1952. STYLE_PYTHON_VALUE=no
  1953. ### @usage: STYLE_PYTHON()
  1954. ###
  1955. ### Check python3 sources for style issues using black.
  1956. macro STYLE_PYTHON() {
  1957. SET(STYLE_PYTHON_VALUE yes)
  1958. }
  1959. # tag:python-specific tag:test
  1960. ### @usage: NO_DOCTESTS()
  1961. ###
  1962. ### Disable doctests in PY[|3|23_]TEST
  1963. macro NO_DOCTESTS() {
  1964. ENV(YA_PYTEST_DISABLE_DOCTEST="yes")
  1965. }
  1966. # tag:python-specific tag:test
  1967. ### @usage: _BASE_PYTEST # internal
  1968. ###
  1969. ### Base logic of Python 2.x py.test modules: common module properties and dependencies.
  1970. module _BASE_PYTEST: _BASE_PY_PROGRAM {
  1971. .NODE_TYPE=Program
  1972. .FINAL_TARGET=no
  1973. .ALLOWED=YT_SPEC NO_DOCTESTS
  1974. when ($USE_ARCADIA_PYTHON == "yes") {
  1975. PEERDIR+=library/python/pytest
  1976. }
  1977. when ($USE_ARCADIA_PYTHON == "no") {
  1978. MODULE_SUFFIX=.pkg.fake
  1979. PEERDIR+=library/python/pytest/empty
  1980. }
  1981. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1982. }
  1983. # tag:python-specific tag:deprecated tag:test
  1984. ### @usage: PYTEST_BIN() #deprecated
  1985. ###
  1986. ### Same as PY2TEST. Don't use this, use PY2TEST instead.
  1987. module PYTEST_BIN: _BASE_PYTEST {
  1988. .NODE_TYPE=Program
  1989. .DEFAULT_NAME_GENERATOR=FullPath
  1990. .ARGS_PARSER=Base
  1991. SETUP_PYTEST_BIN()
  1992. }
  1993. # tag:python-specific tag:test
  1994. ### @usage: PY2TEST([name])
  1995. ###
  1996. ### The test module for Python 2.x based on py.test
  1997. ###
  1998. ### This module is compatible only with PYTHON2-tagged modules and selects peers from multimodules accordingly.
  1999. ### This module is compatible with non-Arcadia Python builds.
  2000. ###
  2001. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#python
  2002. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2003. module PY2TEST: PYTEST_BIN {
  2004. .RESTRICTED=STYLE_PYTHON
  2005. .DEFAULT_NAME_GENERATOR=FullPath
  2006. .ARGS_PARSER=Base
  2007. when ($FAIL_PY2 == "yes") {
  2008. _OK=no
  2009. }
  2010. otherwise {
  2011. PEERDIR+=build/rules/py2_deprecation
  2012. }
  2013. SET(MODULE_LANG PY2)
  2014. ASSERT(_OK You are using deprecated Python2-only code (PY2TEST). Please consider rewriting to Python 3.)
  2015. }
  2016. # tag:python-specific tag:deprecated tag:test
  2017. ### @usage: PY3TEST_BIN() #deprecated
  2018. ###
  2019. ### Same as PY3TEST. Don't use this, use PY3TEST instead.
  2020. module PY3TEST_BIN: _BASE_PY3_PROGRAM {
  2021. .NODE_TYPE=Program
  2022. .FINAL_TARGET=no
  2023. .ALLOWED=YT_SPEC NO_DOCTESTS
  2024. .DEFAULT_NAME_GENERATOR=FullPath
  2025. .ARGS_PARSER=Base
  2026. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2027. SET(MODULE_LANG PY3)
  2028. SETUP_PYTEST_BIN()
  2029. PEERDIR+=library/python/pytest
  2030. }
  2031. # tag:python-specific tag:test
  2032. ### Disable submodules with the specified name(s).
  2033. ### Unlike EXCLUDE_TAGS this variable:
  2034. ### - affects all projects in the build;
  2035. ### - filter by module name and ignore MODULE_TAG.
  2036. EXCLUDE_SUBMODULES=PY3TEST_LIBRARY
  2037. # tag:python-specific tag:test
  2038. ### @usage: PY3TEST([name])
  2039. ###
  2040. ### The test module for Python 3.x based on py.test
  2041. ###
  2042. ### This module is compatible only with PYTHON3-tagged modules and selects peers from multimodules accordingly.
  2043. ### This module is only compatible with Arcadia Python build (to avoid tests duplication from Python2/3-tests). For non-Arcadia python use PYTEST.
  2044. ###
  2045. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  2046. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2047. multimodule PY3TEST {
  2048. module PY3TEST_PROGRAM: PY3TEST_BIN {
  2049. .FINAL_TARGET=yes
  2050. }
  2051. module PY3TEST_LIBRARY: PY3_LIBRARY {
  2052. PEERDIR+=library/python/pytest
  2053. _REQUIRE_EXPLICIT_LICENSE()
  2054. }
  2055. }
  2056. # tag:cpp-specific tag:test
  2057. module CPP_STYLE_TEST: PY3TEST_BIN {
  2058. DEPENDS(contrib/libs/clang12/tools/clang-format)
  2059. PEERDIR+=library/python/cpp_test
  2060. }
  2061. macro STYLE(Globs...) {
  2062. _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
  2063. _STYLE(${STYLE_SRCS_GLOB})
  2064. }
  2065. # tag:cpp-specific tag:deprecated tag:test
  2066. ### @usage: GTEST_UGLY([name])
  2067. ###
  2068. ### Deprecated, do not use in new projects. Use GTEST instead.
  2069. ###
  2070. ### The test module based on gtest (contrib/libs/gtest contrib/libs/gmock).
  2071. ### Use public documentation on gtest for details.
  2072. ###
  2073. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2074. module GTEST_UGLY: _BASE_PROGRAM {
  2075. .NODE_TYPE=Program
  2076. .FINAL_TARGET=no
  2077. PEERDIR(contrib/restricted/googletest/googlemock contrib/restricted/googletest/googletest)
  2078. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gtest)
  2079. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2080. }
  2081. # tag:test
  2082. ### @usage: EXECTEST()
  2083. ###
  2084. ### Module definition of generic test that executes a binary.
  2085. ### Use macro RUN to specify binary to run.
  2086. ###
  2087. ### @example:
  2088. ###
  2089. ### EXECTEST()
  2090. ### OWNER(g:yatool)
  2091. ###
  2092. ### RUN(
  2093. ### cat input.txt
  2094. ### )
  2095. ### DATA(
  2096. ### arcadia/devtools/ya/test/tests/exectest/data
  2097. ### )
  2098. ### DEPENDS(
  2099. ### devtools/dummy_arcadia/cat
  2100. ### )
  2101. ### TEST_CWD(devtools/ya/test/tests/exectest/data)
  2102. ### END()
  2103. ###
  2104. ### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
  2105. ###
  2106. ### @see: [RUN()](#macro_RUN)
  2107. module EXECTEST: _BARE_UNIT {
  2108. .NODE_TYPE=Program
  2109. .FINAL_TARGET=no
  2110. .ALLOWED=YT_SPEC
  2111. .RESTRICTED=FORK_TEST_FILES
  2112. .DEFAULT_NAME_GENERATOR=FullPath
  2113. .ARGS_PARSER=Base
  2114. SET(MODULE_SUFFIX .pkg.fake)
  2115. SETUP_EXECTEST()
  2116. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2117. }
  2118. # tag:cpp-specific tag:test
  2119. ### @usage: Y_BENCHMARK([benchmarkname])
  2120. ###
  2121. ### Benchmark test based on the library/cpp/testing/benchmark.
  2122. ###
  2123. ### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
  2124. module Y_BENCHMARK: PROGRAM {
  2125. .SEM=CPP_PROGRAM_SEM
  2126. PEERDIR(library/cpp/testing/benchmark/main)
  2127. SET(MODULE_LANG CPP)
  2128. }
  2129. # tag:cpp-specific tag:test
  2130. ### @usage: G_BENCHMARK([benchmarkname])
  2131. ###
  2132. ### Benchmark test based on the google benchmark.
  2133. ###
  2134. ### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
  2135. module G_BENCHMARK: _BASE_PROGRAM {
  2136. PEERDIR(library/cpp/testing/gbenchmark_main)
  2137. ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
  2138. SET(MODULE_LANG CPP)
  2139. }
  2140. # tag:test
  2141. TEST_ROOT=$(TESTS_DATA_ROOT)
  2142. RESULT_MAX_FILE=0
  2143. STRIP_FILES=--dont-strip-files
  2144. VERIFY_RESULTS=--verify-results
  2145. ADDITIONAL_PATH=
  2146. # set for tests variables to fill it by YA_DEV or YA
  2147. YA_ROOT=ya
  2148. when ($YA_DEV == "yes") {
  2149. YA_ROOT=ya-dev
  2150. }
  2151. # tag:test
  2152. ### @usage: UNITTEST_FOR(path/to/lib)
  2153. ###
  2154. ### Convenience extension of UNITTEST module.
  2155. ### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
  2156. ### path/to/lib is the path to the directory with the LIBRARY project.
  2157. ###
  2158. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2159. module UNITTEST_FOR: UNITTEST {
  2160. .SEM=UNITTEST_SEM
  2161. PEERDIR(ADDINCL $UNITTEST_DIR)
  2162. SRCDIR($UNITTEST_DIR)
  2163. }
  2164. ### @usage: _LIBRARY # internal
  2165. ###
  2166. ### Base module definition for all libraries.
  2167. ### Contains basic logic like module properties, default variable values etc.
  2168. ### All libraries similar to C++-libraries should be inherited from it.
  2169. module _LIBRARY: _BASE_UNIT {
  2170. .CMD=LINK_LIB
  2171. .NODE_TYPE=Library
  2172. .PEERDIR_POLICY=as_include
  2173. .EXTS=.o .obj .a .mf .supp .tidyjson .ld
  2174. .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  2175. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2176. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
  2177. .FINAL_TARGET=no
  2178. .GLOBAL_CMD=GLOBAL_LINK_LIB
  2179. .GLOBAL_EXTS=.o .obj .tidyjson
  2180. GLOBAL_SUFFIX=.global$MODULE_SUFFIX
  2181. #TODO: Remove this hack (really we do not need add fake src at all)
  2182. ENABLE(NEED_ADD_FAKE_SRC)
  2183. _REQUIRE_EXPLICIT_LICENSE(contrib/deprecated contrib/libs contrib/restricted contrib/python)
  2184. CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
  2185. when ($USE_MKL == "yes") {
  2186. NOPLATFORM=yes
  2187. }
  2188. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2189. MODULE_PREFIX=
  2190. MODULE_SUFFIX=.lib
  2191. }
  2192. otherwise {
  2193. when ($TIDY == "yes") {
  2194. MODULE_PREFIX=
  2195. MODULE_SUFFIX=.tidyjson
  2196. }
  2197. otherwise {
  2198. MODULE_PREFIX=lib
  2199. MODULE_SUFFIX=.a
  2200. }
  2201. }
  2202. when ($WERROR != "no") {
  2203. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  2204. C_WARNING_OPTS += $WERROR_FLAG
  2205. }
  2206. }
  2207. when ($WITH_VALGRIND == "yes") {
  2208. PEERDIR+=contrib/libs/valgrind
  2209. }
  2210. when ($USE_ARCADIA_LIBM == "yes") {
  2211. PEERDIR+=contrib/libs/libm
  2212. }
  2213. }
  2214. CPP_LIBRARY_SEM=add_library ${MODDIR} $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  2215. && library_fake_marker FAKE_MODULE ${FAKE_MODULE} \
  2216. && consumer_link_library PUBLIC $CMAKE_LINK_TARGET \
  2217. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2218. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2219. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS \
  2220. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  2221. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW \
  2222. && add_language C && add_language CXX
  2223. CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:CMAKE_TARGET_NAME} $CMAKE_TARGET_NAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
  2224. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2225. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2226. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS \
  2227. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  2228. CMAKE_FIND_PKG=
  2229. CMAKE_LINK_TARGET=$REALPRJNAME
  2230. CMAKE_FIND_PKG_COMP=
  2231. CONAN_REQUIRE=
  2232. ### @usage: LIBRARY()
  2233. ###
  2234. ### The regular static library module.
  2235. ###
  2236. ### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
  2237. ### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
  2238. ###
  2239. ### This is C++ library, and it selects peers from multimodules accordingly.
  2240. ###
  2241. ### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
  2242. ### In order to use library in tests PEERDIR it to link into tests.
  2243. ### If you think you need to distribute static library please contact devtools@ for assistance.
  2244. module LIBRARY: _LIBRARY {
  2245. .GLOBAL=_AARS _PROGUARD_RULES
  2246. .SEM=CPP_LIBRARY_SEM
  2247. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  2248. .DEFAULT_NAME_GENERATOR=ThreeDirNames
  2249. .ARGS_PARSER=Base
  2250. when ($CMAKE_PACKAGE_COMPONENT != "") {
  2251. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  2252. }
  2253. when ($CMAKE_PACKAGE != "") {
  2254. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  2255. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && consumer_link_library PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && ignored
  2256. }
  2257. when ($CONAN_REFERENCE != "") {
  2258. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  2259. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && consumer_link_library PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && ignored
  2260. }
  2261. when ($CONAN_PKG_OPTS != "") {
  2262. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  2263. }
  2264. when ($OPENSOURCE_EXPORT == "no") {
  2265. CPP_LIBRARY_SEM=ignored
  2266. }
  2267. when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
  2268. PEERDIR+=$CPP_PROTOBUF_PEERS
  2269. }
  2270. SET(MODULE_TYPE LIBRARY)
  2271. SET(MODULE_LANG CPP)
  2272. ADD_CLANG_TIDY()
  2273. }
  2274. # tag:internal
  2275. ### @usage: _BARE_MODULE() # internal
  2276. ###
  2277. ### Remove unwanted dependencies for "empty" library module
  2278. macro _BARE_MODULE() {
  2279. SET(NEED_PLATFORM_PEERDIRS no)
  2280. SET(PEERDIR_TEST_TOOL no)
  2281. DISABLE(WITH_VALGRIND)
  2282. NO_CODENAVIGATION()
  2283. NO_PLATFORM()
  2284. NO_RUNTIME()
  2285. NO_UTIL()
  2286. NO_CLANG_TIDY()
  2287. }
  2288. # tag:internal
  2289. ### @usage: _BARE_LINK_MODULE() # internal
  2290. ###
  2291. ### Remove unwanted dependencies for "empty" link module
  2292. macro _BARE_LINK_MODULE() {
  2293. _BARE_MODULE()
  2294. ALLOCATOR(FAKE)
  2295. }
  2296. # tag:internal
  2297. ### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
  2298. ###
  2299. ### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
  2300. ### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
  2301. macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
  2302. SRCS($USE_CONDITIONAL_SRCS)
  2303. }
  2304. # XXX: dirty hack for correct LDFLAGS passing
  2305. RESOURCES_LIBRARY_LINK=$TOUCH_UNIT ${hide:LDFLAGS_GLOBAL} ${hide:LDFLAGS}
  2306. RESOURCES_LIBRARY_SEM=ignored
  2307. ### @usage: RESOURCES_LIBRARY()
  2308. ###
  2309. ### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
  2310. ### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
  2311. ###
  2312. ### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
  2313. module RESOURCES_LIBRARY: _BARE_UNIT {
  2314. .CMD=RESOURCES_LIBRARY_LINK
  2315. .SEM=RESOURCES_LIBRARY_SEM
  2316. .ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
  2317. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS PEERDIR SPLIT_DWARF
  2318. .NODE_TYPE=Library
  2319. .PEERDIR_POLICY=as_include
  2320. .EXTS=.o .obj .a .mf .supp .tidyjson .ld
  2321. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2322. MODULE_SUFFIX=.pkg.fake
  2323. ENABLE(NEED_ADD_FAKE_SRC)
  2324. WITHOUT_LICENSE_TEXTS()
  2325. }
  2326. FAT_OBJECT_ARGS=
  2327. FAT_OBJECT_OUTS=
  2328. macro _FAT_OBJECT_ARGS_BASE(Flag, Lib) {
  2329. .CMD=$Flag=$Lib
  2330. }
  2331. macro PACK_GLOBALS_IN_LIBRARY() {
  2332. SET_APPEND(FAT_OBJECT_ARGS $_FAT_OBJECT_ARGS_BASE(--globals-lib, ${BINDIR}/${pre=$MODULE_PREFIX:REALPRJNAME.globals.a}))
  2333. SET_APPEND(FAT_OBJECT_OUTS \${output;hide;noauto;norel;nopath;noext;pre=$MODULE_PREFIX;suf=$BINDIR:REALPRJNAME.globals.a})
  2334. }
  2335. when ($OS_ANDROID != "yes") {
  2336. LINK_FAT_OBJECT_CMD=$LINK_FAT_OBJECT
  2337. }
  2338. otherwise {
  2339. LINK_FAT_OBJECT_CMD=$LINK_FAT_OBJECT_LIBRARY
  2340. }
  2341. FAT_OBJECT_SEM=add_fat_object ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  2342. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2343. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS \
  2344. && set_global_flags FAT_OBJECT_PREFIX ${MODULE_PREFIX} \
  2345. && set_global_flags FAT_OBJECT_SUFFIX ${MODULE_SUFFIX}
  2346. ### Do not turn visibility=hidden symbos into static symbos of partially linked object file
  2347. ###
  2348. ### Note: This variable do not have any effect on platforms other than MacOS and iOS.
  2349. KEEP_FAT_OBJECT_SYMBOLS=no
  2350. ### @usage: FAT_OBJECT()
  2351. ###
  2352. ### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2353. ### static libraries, local (from own SRCS) and global (from peers') object files.
  2354. ###
  2355. ### Designed for use in XCode projects for iOS.
  2356. module FAT_OBJECT: LIBRARY {
  2357. .ALLOWED=PACK_GLOBALS_IN_LIBRARY
  2358. .CMD=LINK_FAT_OBJECT_CMD
  2359. .SEM=FAT_OBJECT_SEM
  2360. .PEERDIR_POLICY=as_build_from
  2361. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2362. MODULE_SUFFIX=.global.lib
  2363. }
  2364. elsewhen ($OS_ANDROID == "yes") {
  2365. MODULE_SUFFIX=.a
  2366. }
  2367. otherwise {
  2368. MODULE_SUFFIX=.o
  2369. }
  2370. when (($OS_DARWIN == "yes" || $OS_IOS == "yes") && $KEEP_FAT_OBJECT_SYMBOLS == "yes") {
  2371. LDFLAGS_GLOBAL += -keep_private_externs
  2372. }
  2373. _USE_LINKER()
  2374. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2375. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2376. DISABLE(NEED_ADD_FAKE_SRC)
  2377. SRCS(build/scripts/_fake_src.cpp)
  2378. }
  2379. ### @usage: RECURSIVE_LIBRARY()
  2380. ###
  2381. ### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2382. ### from static libraries, local (from own SRCS) and global (from peers') object files.
  2383. ###
  2384. ### Designed for use in XCode projects for iOS.
  2385. module RECURSIVE_LIBRARY: LIBRARY {
  2386. .CMD=LINK_RECURSIVE_LIBRARY
  2387. .PEERDIR_POLICY=as_build_from
  2388. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2389. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2390. DISABLE(NEED_ADD_FAKE_SRC)
  2391. SRCS(build/scripts/_fake_src.cpp)
  2392. }
  2393. _SONAME=
  2394. _EXPORT_SCRIPT_SEM=
  2395. macro _ADD_DYNLYB_SEM(Libname) {
  2396. .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 && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && vcs_info $_EXPORT_SCRIPT_SEM
  2397. }
  2398. CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES
  2399. ### @usage: DLL_UNIT # internal
  2400. ###
  2401. ### Base module for all dynamically linked libraries as final artifacts.
  2402. ### Contains all general logic for such kind of modules. Supports versioning and export files.
  2403. ### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
  2404. module DLL_UNIT: _LINK_UNIT {
  2405. .CMD=LINK_DYN_LIB
  2406. .SEM=CPP_DYN_LIBRARY_SEM
  2407. .NODE_TYPE=Library
  2408. .SYMLINK_POLICY=SO
  2409. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2410. .ALLOWED=WHOLE_ARCHIVE
  2411. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2412. .ARGS_PARSER=DLL
  2413. DYNAMIC_LINK=yes
  2414. ALLOCATOR(FAKE)
  2415. SET(MODULE_TYPE DLL)
  2416. SET(MODULE_TAG DLL)
  2417. SET(MODULE_LANG CPP)
  2418. ADD_CLANG_TIDY()
  2419. when ($EXPORTS_FILE) {
  2420. _EXPORT_SCRIPT_SEM=&& use_export_script ${input:EXPORTS_FILE}
  2421. }
  2422. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2423. MODULE_SUFFIX=.dll
  2424. }
  2425. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2426. MODULE_PREFIX=lib
  2427. MODULE_SUFFIX=.dylib
  2428. }
  2429. elsewhen ($TIDY == "yes") {
  2430. MODULE_PREFIX=
  2431. MODULE_SUFFIX=.tidyjson
  2432. }
  2433. otherwise {
  2434. MODULE_PREFIX=lib
  2435. MODULE_SUFFIX=.so
  2436. }
  2437. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2438. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2439. when ($MODULE_VERSION) {
  2440. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2441. }
  2442. _SONAME=$SONAME$MODULE_VERSION
  2443. when ($LINUX == "yes") {
  2444. # '-z notext' is needed for linking mkl into shared libraries
  2445. LDFLAGS += -Wl,-z,notext
  2446. when ($_NO_FIX_ELF != "yes") {
  2447. LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
  2448. }
  2449. }
  2450. when ($DARWIN == "yes") {
  2451. LDFLAGS += -undefined dynamic_lookup
  2452. }
  2453. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  2454. PEERDIR+=library/cpp/testing/dump_clang_coverage
  2455. }
  2456. when ($IDE_MSVS == "yes") {
  2457. PEERDIR+=build/scripts/c_templates
  2458. }
  2459. }
  2460. # tag:python-specific
  2461. ### @usage: PY_ANY_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2462. ###
  2463. ### The Python external module for any versio of Arcadia or system Python.
  2464. ### 1. major_ver and minor_ver must be integers.
  2465. ### 2. The resulting .so will have the prefix "lib".
  2466. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2467. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2468. ###
  2469. ### Note: Use PYTHON2_MODULE()/PYTHON3_MODULE() in order to PEERDIR proper version of PY23_NATIVE_LIBRARY.
  2470. ### Do not PEERDIR any PY*_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2471. ###
  2472. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2473. module PY_ANY_MODULE: DLL_UNIT {
  2474. .SEM=CPP_DYN_LIBRARY_SEM
  2475. when ($MSVC != "yes" && $DARWIN != "yes") {
  2476. LDFLAGS+= -Wl,-Bsymbolic
  2477. }
  2478. when ($USE_ARCADIA_PYTHON == "no") {
  2479. when ($USE_SYSTEM_PYTHON) {
  2480. PEERDIR+=build/platform/python
  2481. }
  2482. otherwise {
  2483. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2484. LDFLAGS+=$PYTHON_LIBRARIES
  2485. }
  2486. }
  2487. }
  2488. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2489. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2490. when ($MODULE_VERSION) {
  2491. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2492. }
  2493. _SONAME=$SONAME$MODULE_VERSION
  2494. # -bundle
  2495. when ($DARWIN == "yes") {
  2496. LDFLAGS+=-flat_namespace
  2497. }
  2498. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2499. MODULE_PREFIX=
  2500. MODULE_SUFFIX=.pyd
  2501. }
  2502. otherwise {
  2503. MODULE_PREFIX=
  2504. MODULE_SUFFIX=.so
  2505. }
  2506. .RESTRICTED=USE_PYTHON2 USE_PYTHON3 PY_SRCS PY_MAIN
  2507. }
  2508. # tag:python-specific
  2509. ### @usage: PY2MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2510. ###
  2511. ### The Python external module for Python2 and any system Python
  2512. ### 1. major_ver and minor_ver must be integers.
  2513. ### 2. The resulting .so will have the prefix "lib".
  2514. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2515. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2516. ###
  2517. ### Note: this module will always PEERDIR Python2 version of PY23_NATIVE_LIBRARY.
  2518. ### Do not PEERDIR PY2_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2519. ###
  2520. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2521. module PY2MODULE: PY_ANY_MODULE {
  2522. PYTHON2_MODULE()
  2523. SET(MODULE_LANG PY2)
  2524. .RESTRICTED=PYTHON3_MODULE PYTHON3_ADDINCL
  2525. }
  2526. # tag:python-specific
  2527. ### @usage: PY3MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2528. ###
  2529. ### The Python external module for Python3 and any system Python
  2530. ### 1. major_ver and minor_ver must be integers.
  2531. ### 2. The resulting .so will have the prefix "lib".
  2532. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2533. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2534. ###
  2535. ### Note: this module will always PEERDIR Python3 version of PY23_NATIVE_LIBRARY.
  2536. ### Do not PEERDIR PY3_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2537. ###
  2538. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2539. module PY3MODULE: PY_ANY_MODULE {
  2540. PYTHON3_MODULE()
  2541. SET(MODULE_LANG PY3)
  2542. .RESTRICTED=PYTHON2_MODULE PYTHON2_ADDINCL
  2543. }
  2544. # tag:python-specific
  2545. ### @usage: PYTHON2_MODULE()
  2546. ###
  2547. ### Use in PY_ANY_MODULE to set it up for Python 2.x.
  2548. macro PYTHON2_MODULE() {
  2549. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2550. PEERDIR+=contrib/tools/python/lib
  2551. }
  2552. PYTHON2_ADDINCL()
  2553. }
  2554. # tag:python-specific
  2555. ### @usage: PYTHON3_MODULE()
  2556. ###
  2557. ### Use in PY_ANY_MODULE to set it up for Python 3.x.
  2558. macro PYTHON3_MODULE() {
  2559. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2560. PEERDIR+=contrib/tools/python3/lib
  2561. }
  2562. PYTHON3_ADDINCL()
  2563. }
  2564. # tag:r-specific
  2565. ### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2566. ###
  2567. ### The external module for R language.
  2568. ### 1. major_ver and minor_ver must be integers.
  2569. ### 2. The resulting .so will have the prefix "lib".
  2570. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2571. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2572. module R_MODULE: DLL_UNIT {
  2573. .SEM=CPP_DYN_LIBRARY_SEM
  2574. when ($DARWIN == "yes") {
  2575. LDFLAGS+=-flat_namespace -dynamiclib
  2576. }
  2577. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2578. MODULE_PREFIX=lib
  2579. MODULE_SUFFIX=.dll
  2580. }
  2581. ADDINCL(contrib/libs/r-lang)
  2582. }
  2583. ### @usage: DYNAMIC_LIBRARY_FROM(Paths)
  2584. ###
  2585. ### Use specified libraries as sources of DLL
  2586. macro DYNAMIC_LIBRARY_FROM(Path...) {
  2587. PEERDIR($Path)
  2588. WHOLE_ARCHIVE($Path)
  2589. }
  2590. ### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2591. ###
  2592. ### Dynamic library module definition.
  2593. ### 1. major_ver and minor_ver must be integers.
  2594. ### 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
  2595. ### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
  2596. ###
  2597. ### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
  2598. module DLL: DLL_UNIT {
  2599. .SEM=CPP_DYN_LIBRARY_SEM
  2600. SET(MAKE_ONLY_SHARED_LIB yes)
  2601. SET(MODULE_LANG CPP)
  2602. when ($OS_WINDOWS) {
  2603. MODULE_SUFFIX=.dll
  2604. }
  2605. # TODO: Make it possible to use this syntax
  2606. # DEFAULT(DLL_FOR_DIR no)
  2607. ### FIXME: XXX
  2608. ###when ($DLL_FOR_DIR != "no") {
  2609. ### SRCDIR($DLL_FOR_DIR)
  2610. ### ADDINCL($DLL_FOR_DIR)
  2611. ###}
  2612. }
  2613. ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
  2614. module DLL_TOOL: DLL {
  2615. .SEM=CPP_DYN_LIBRARY_SEM
  2616. # ymake resolves only program nodes as tools.
  2617. .NODE_TYPE=Program
  2618. }
  2619. ### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2620. ###
  2621. ### Executable dynamic library module definition.
  2622. ### 1. major_ver and minor_ver must be integers.
  2623. ### 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
  2624. ### 3. PREFIX allows you to change the prefix of the output file.
  2625. module SO_PROGRAM: DLL {
  2626. .CMD=LINK_EXEC_DYN_LIB
  2627. SET(MODULE_TYPE PROGRAM)
  2628. MODULE_PREFIX=
  2629. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2630. MODULE_SUFFIX=.exe
  2631. }
  2632. otherwise {
  2633. MODULE_SUFFIX=
  2634. }
  2635. }
  2636. DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
  2637. # tag:internal
  2638. ### @usage: DEV_DLL_PROXY() # internal
  2639. ###
  2640. ### The use of this module is strictly prohibited!!!
  2641. ### This is a temporary and project-specific solution.
  2642. module DEV_DLL_PROXY: _BARE_UNIT {
  2643. .NODE_TYPE=Library
  2644. .EXTS=.so .dll .dylib .mf
  2645. .CMD=DLL_PROXY_CMD_MF
  2646. DYNAMIC_LINK=yes
  2647. when ($OS_WINDOWS == "yes") {
  2648. MODULE_SUFFIX=.dll
  2649. }
  2650. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2651. MODULE_PREFIX=lib
  2652. MODULE_SUFFIX=.dylib$MODULE_VERSION
  2653. }
  2654. otherwise {
  2655. MODULE_PREFIX=lib
  2656. MODULE_SUFFIX=.so$MODULE_VERSION
  2657. }
  2658. }
  2659. # tag:internal
  2660. ### @usage: DLL_PROXY() # internal
  2661. ###
  2662. ### The use of this module is strictly prohibited!!!
  2663. ### This is a temporary and project-specific solution.
  2664. module DLL_PROXY: DEV_DLL_PROXY {
  2665. .EXTS=.so .dylib .lib .mf
  2666. .PROXY=yes
  2667. .PEERDIR_POLICY=as_build_from
  2668. SET(PEERDIR_TAGS DLL __EMPTY__)
  2669. when ($OS_WINDOWS == "yes") {
  2670. MODULE_SUFFIX=.lib
  2671. }
  2672. }
  2673. # tag:internal
  2674. ### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
  2675. ###
  2676. ### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
  2677. ### This it needed to transfer their outputs through the library to PROGRAM
  2678. ### or dependent DLL/DYNAMIC_LIBRARY.
  2679. ###
  2680. ### Note: this is temporary solution until support of `super-global` variables come
  2681. ### which will enable transfer of some properties though final targets like DLLs.
  2682. macro DYNAMIC_DEPS(Path...) {
  2683. # PEERDIR as macro completely ignored in place where this macro applies
  2684. SET_APPEND(PEERDIR $Path)
  2685. }
  2686. # tag:internal
  2687. ### @usage: DYNAMIC_LIBRARY() # internal
  2688. ###
  2689. ### The use of this module is strictly prohibited except LGPL-related opensourcing
  2690. ### This provides linkable DLL module which brings its results to programs and tests
  2691. ### for seamless testing and packaging
  2692. multimodule DYNAMIC_LIBRARY {
  2693. module DLL_BIN: DLL {
  2694. .PROXY=yes
  2695. .IGNORED=PROVIDES
  2696. SET(MODULE_TAG DLL)
  2697. }
  2698. module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
  2699. .CMD=TOUCH_UNIT_MF
  2700. .PEERDIRSELF=DLL_BIN
  2701. .IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
  2702. .ALLOWED=DYNAMIC_DEPS
  2703. SET(PEERDIR_TAGS DLL_LIB __EMPTY__)
  2704. _BARE_MODULE()
  2705. DYNAMIC_LINK=yes
  2706. MODULE_SUFFIX=.pkg.fake
  2707. PEERDIR+=build/platform/local_so
  2708. RESTRICT_PATH(contrib devtools/dummy_arcadia MSG Use of this module type outside contrib/libs is prohibited)
  2709. # disable credits generation for static library
  2710. SET(CREDITS_FLAGS)
  2711. }
  2712. }
  2713. ### @usage: GLOBAL_SRCS(filenames...)
  2714. ###
  2715. ### Make all source files listed as GLOBAL.
  2716. ### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
  2717. ### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
  2718. ### recognized for GLOBAL_SRCS in contrast to SRCS macro.
  2719. ###
  2720. ### @example:
  2721. ### Consider the file to ya.make:
  2722. ###
  2723. ### LIBRARY()
  2724. ### GLOBAL_SRCS(foo.cpp bar.cpp)
  2725. ### END()
  2726. ###
  2727. ### @see: [SRCS()](#macro_SRCS)
  2728. macro GLOBAL_SRCS(Files...) {
  2729. SRCS(${pre=GLOBAL :Files})
  2730. }
  2731. ### @usage: ALL_SRCS([GLOBAL] filenames...)
  2732. ###
  2733. ### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
  2734. ### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
  2735. ### as the first argument and is equivalent to call to SRCS macro otherwise.
  2736. ###
  2737. ### @example:
  2738. ###
  2739. ### LIBRARY()
  2740. ### SET(MAKE_IT_GLOBAL GLOBAL)
  2741. ### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
  2742. ### END()
  2743. ###
  2744. ### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
  2745. macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
  2746. SRCS(${pre=$GLOBAL :Files})
  2747. }
  2748. ### @usage: _DLL_COMPATIBLE_LIBRARY # internal
  2749. ###
  2750. ### Base module to place DLLs into multimodules back to back with libraries.
  2751. ### In order to function properly all modules in multimodule shall have the
  2752. ### same set of arguments. So this module is just library that accepts but
  2753. ### ignores all DLL arguments.
  2754. module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
  2755. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2756. .ARGS_PARSER=DLL
  2757. }
  2758. @import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
  2759. # as SRCS in packages use macro BUNDLE_SRCS!
  2760. PACKED_PACKAGE_ARGS=
  2761. PACKED_PACKAGE_EXT=
  2762. ### @usage: PACK(archive_type)
  2763. ###
  2764. ### 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`
  2765. ###
  2766. ### Is not allowed other module types than PACKAGE().
  2767. ###
  2768. ### @see: [PACKAGE()](#module_PACKAGE)
  2769. macro PACK(Ext) {
  2770. SET(PACKED_PACKAGE_EXT $Ext)
  2771. }
  2772. PACKAGE_STRICT_VALUE=
  2773. macro PACKAGE_STRICT() {
  2774. SET(PACKAGE_STRICT_VALUE yes)
  2775. }
  2776. ### @usage: PACKAGE(name)
  2777. ###
  2778. ### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
  2779. ### 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.
  2780. ### The data can be optionally packed if macro PACK() is used.
  2781. ###
  2782. ### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
  2783. ###
  2784. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2785. ###
  2786. ### @see: [PACK()](#macro_PACK)
  2787. module PACKAGE: _BASE_UNIT {
  2788. .CMD=TOUCH_PACKAGE_MF
  2789. .PEERDIR_POLICY=as_build_from
  2790. .ALL_INS_TO_OUT=yes
  2791. .FINAL_TARGET=yes
  2792. .ALLOWED=PACK
  2793. SET(MODULE_SUFFIX .pkg.fake)
  2794. SET(DONT_RESOLVE_INCLUDES yes)
  2795. NO_PLATFORM()
  2796. when ($PACKED_PACKAGE_EXT) {
  2797. PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
  2798. }
  2799. SET(NEED_PLATFORM_PEERDIRS no)
  2800. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL
  2801. }
  2802. TOUCH_GROUP=$TOUCH_PACKAGE ${kv;hide:"p CI"}
  2803. ### @usage: CI_GROUP()
  2804. ###
  2805. ### Module collects what is described directly inside it transitively by PEERDIRs.
  2806. ### No particular layout of built artifacts is implied. This module is needed primarily for CI dependency analysis and may not trigger builds at all.
  2807. ###
  2808. ### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
  2809. module CI_GROUP: _BARE_UNIT {
  2810. .CMD=TOUCH_GROUP
  2811. .PEERDIR_POLICY=as_build_from
  2812. .ALL_INS_TO_OUT=yes
  2813. .FINAL_TARGET=yes
  2814. .RESTRICTED=SRCS
  2815. MODULE_SUFFIX=.ci.pkg.fake
  2816. PEERDIR_TAGS=CPP_PROTO PY3 PY3_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE DLL
  2817. }
  2818. # tag:generic tag:internal
  2819. TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
  2820. # tag:proto
  2821. ### @usage: RESOLVE_PROTO()
  2822. ###
  2823. ### Enable include resolving within UNIONs and let system .proto being resolved
  2824. ### among .proto/.gztproto imports
  2825. ###
  2826. ### Note: it is currently impossible to enable resolving only for .proto, so resolving is enabled for all supported files
  2827. ### also we only add ADDINCL for stock protobuf. So use this macro with care: it may cause resolving problems those are
  2828. ### to be addressed by either ADDINCLs or marking them as TEXT. Please contact devtools for details.
  2829. macro RESOLVE_PROTO() {
  2830. SET(DONT_RESOLVE_INCLUDES no)
  2831. ADDINCL(FOR proto $PROTOBUF_PATH)
  2832. }
  2833. ### @usage: UNION(name)
  2834. ###
  2835. ### Collection of PEERDIR dependencies, files and artifacts.
  2836. ### UNION doesn't build its peers, just provides those to modules depending on it.
  2837. ### 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).
  2838. ###
  2839. ### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
  2840. ###
  2841. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2842. module UNION: _BASE_UNIT {
  2843. .ALL_INS_TO_OUT=yes
  2844. .FINAL_TARGET=no
  2845. NO_PLATFORM()
  2846. SET(MODULE_SUFFIX .pkg.fake)
  2847. SET(DONT_RESOLVE_INCLUDES yes)
  2848. .CMD=TOUCH_UNIT_MF
  2849. SET(NEED_PLATFORM_PEERDIRS no)
  2850. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNABLE PY3_BIN DLL
  2851. }
  2852. # tag:python-specific
  2853. module _PY_PACKAGE: UNION {
  2854. .EXTS=.py
  2855. .ALL_INS_TO_OUT=yes
  2856. .ALLOWED=GRPC USE_SKIFF
  2857. ENABLE(PY_PROTOS_FOR)
  2858. SET(PEERDIR_TAGS PY_PROTO)
  2859. SET(DONT_RESOLVE_INCLUDES no)
  2860. }
  2861. # tag:python-specific tag:deprecated tag:internal
  2862. ### @usage: PY_PACKAGE(name) # internal, deprecated
  2863. ###
  2864. ### This is module created via PY_PROTOS_FOR() macro
  2865. module PY_PACKAGE: _PY_PACKAGE {
  2866. .FINAL_TARGET=yes
  2867. }
  2868. # tag:internal
  2869. ### @usage: _SET_FIRST_VALUE(name args...) # internal
  2870. ###
  2871. ### This macro sets the value of `name` variable to the value of next argument
  2872. macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
  2873. SET($NAME $VALUE)
  2874. }
  2875. # tag:python-specific
  2876. PY_NAMESPACE_VALUE=
  2877. # tag:python-specific
  2878. ### @usage: PY_NAMESPACE(prefix)
  2879. ###
  2880. ### Sets default Python namespace for all python sources in the module.
  2881. ### Especially suitable in PROTO_LIBRARY where Python sources are generated and there is no PY_SRCS to place NAMESPACE parameter.
  2882. macro PY_NAMESPACE(Arg) {
  2883. SET(PY_NAMESPACE_VALUE $Arg)
  2884. }
  2885. # tag:internal
  2886. ### @usage: _SRCS_NO_GLOBAL(files...) # internal
  2887. ###
  2888. ### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
  2889. ### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
  2890. ### Note: this macro changes order of source files.
  2891. macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
  2892. SRCS($GLOBAL $FILES)
  2893. }
  2894. # tag:java-specific
  2895. JAVA_VCS_MF_ARG=
  2896. COMPILE_JAVA_MF=$COMPILE_JAVA
  2897. # tag:java-specific
  2898. when ($EXT_JAVA_VCS_INFO == "yes") {
  2899. JAVA_VCS_MF_ARG=--vcs-mf $VCS_JAVA
  2900. COMPILE_JAVA_MF=$GENERATE_VCS_JAVA_INFO_NODEP && $COMPILE_JAVA
  2901. }
  2902. # tag:java-specific
  2903. EXT_JAVA_VCS_INFO=no
  2904. ### @usage: EMBED_JAVA_VCS_INFO()
  2905. ###
  2906. ### Embed manifest with vcs info into `EXTERNAL_JAVA_LIBRARY`
  2907. ### By default this is disabled.
  2908. macro EMBED_JAVA_VCS_INFO() {
  2909. ENABLE(EXT_JAVA_VCS_INFO)
  2910. }
  2911. # tag:java-specific tag:internal
  2912. ### @usage: EXTERNAL_JAVA_LIBRARY() #internal
  2913. ###
  2914. ### EXTERNAL_JAVA_LIBRARY() is a module for creating a .jar file using non-Java code (generators etc.)
  2915. ### Unlike regular JAVA_LIBRARY this module doesn't produce .pom file, so it cannot be exported to Maven itself.
  2916. ### PEERDIR it from JAVA_LIBRARY or JAVA_PROGRAM for export to Maven.
  2917. module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
  2918. .EXTS=.jsrc .java .jar .mf
  2919. .NODE_TYPE=Bundle
  2920. .CMD=COMPILE_JAVA_MF
  2921. .PEERDIR_POLICY=as_build_from
  2922. .FINAL_TARGET=no
  2923. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  2924. .ALLOWED=EMBED_JAVA_VCS_INFO
  2925. .RESTRICTED=EXTERNAL_JAR
  2926. PEERDIR(build/platform/java/jdk)
  2927. PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR
  2928. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  2929. HAS_MANAGEABLE_PEERS=yes
  2930. DYNAMIC_LINK=yes
  2931. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  2932. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  2933. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  2934. when ($PACKAGE_PREFIX) {
  2935. PACKAGE_PREFIX_ARGS=--package-prefix=$PACKAGE_PREFIX
  2936. }
  2937. DISABLE(NEED_PLATFORM_PEERDIRS)
  2938. NO_PLATFORM()
  2939. SET(MODULE_SUFFIX .jar)
  2940. SET(MODULE_LANG JAVA)
  2941. }
  2942. # tag:java-specific
  2943. ALL_JAR_SOURCES=
  2944. LINT_JAVA_SOURCES=
  2945. ALL_SRCDIRS=
  2946. LINK_JAR_RESOURCES=
  2947. LINK_JAR_JSOURCES=
  2948. JAR_GEN_SRCS=
  2949. JAR_GEN_JSRCS=
  2950. macro _JAR_SRCS(SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], RESOURCES?"yes":"no", Globs...) {
  2951. _CHECK_JAVA_SRCDIR($SRCDIR)
  2952. SET_APPEND(ALL_SRCDIRS $SRCDIR)
  2953. SET(VAR_SALT $SRCDIR $Globs $EXCLUDE $PACKAGE_PREFIX $RESOURCES $FILES)
  2954. SET(JAR_SRCS_GLOB uniq_${hash:VAR_SALT})
  2955. _LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE})
  2956. SET_APPEND(LINT_JAVA_SOURCES \${input;rootrel;ext=.java:${JAR_SRCS_GLOB}})
  2957. 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})
  2958. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_RESOURCES ${quo:SRCDIR} ${BINDIR}/cls ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt)
  2959. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_JSOURCES ${quo:SRCDIR} ${BINDIR}/src ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt)
  2960. _FILL_JAR_GEN_SRCS(JAR_GEN_SRCS JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst ${BINDIR}/misc/all-kt-sources.txt ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt $Globs EXCLUDE $EXCLUDE)
  2961. _FILL_JAR_GEN_SRCS(JAR_GEN_JSRCS SRC_JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst ${BINDIR}/misc/all-kt-sources.txt ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt $Globs EXCLUDE $EXCLUDE)
  2962. }
  2963. macro IDEA_JAR_SRCS(Args...) {
  2964. _JAR_SRCS($Args)
  2965. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  2966. }
  2967. macro _HASH_HELPER(Args...) {
  2968. .CMD=${hash:Args}
  2969. }
  2970. macro _GENTAR_HELPER(OUT_DIR[], Args...) {
  2971. .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"}
  2972. }
  2973. # tag:java-specific
  2974. RUN_JAR_PROG_CP_PRE=@
  2975. RUN_JAR_PROG_CP_SUF=.cplst
  2976. when($JDK_VERSION == "8") {
  2977. RUN_JAR_PROG_CP_PRE=
  2978. RUN_JAR_PROG_CP_SUF=
  2979. }
  2980. # tag:java-specific
  2981. 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}", Args...) {
  2982. _LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR})
  2983. _CHECK_RUN_JAVA_PROG_CLASSPATH($CLASSPATH)
  2984. .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
  2985. .CMD=${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"} $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}
  2986. }
  2987. # tag:java-specific
  2988. macro _DO_1_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq", Args...) {
  2989. _DO_2_RUN_JAR_PROGRAM($Args IN_DIRS_VAR $IN_DIRS_VAR IN_DIRS_INPUTS ${"$"}{input;hide:$IN_DIRS_VAR})
  2990. }
  2991. # tag:java-specific
  2992. macro RUN_JAVA_PROGRAM(Args...) {
  2993. _DO_1_RUN_JAR_PROGRAM($Args IN_DIRS_VAR uniq_${hash:Args})
  2994. }
  2995. # tag:java-specific
  2996. _JAR_ANN_PROCESSORS=
  2997. _JAR_ANN_PROC_OPT_PREFIX=
  2998. macro JAR_ANNOTATION_PROCESSOR(Classes...) {
  2999. SET_APPEND(_JAR_ANN_PROCESSORS $Classes)
  3000. SET(_JAR_ANN_PROC_OPT_PREFIX -processor)
  3001. # for ya ide idea only
  3002. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Classes)
  3003. }
  3004. # tag:java-specific
  3005. macro _JAR_ANN_PROC_OPTS(Classes...) {
  3006. .CMD=$_JAR_ANN_PROC_OPT_PREFIX ${join=,:Classes}
  3007. }
  3008. # tag:java-specific
  3009. macro _NOOP_MACRO(Args...) {
  3010. ENABLE(UNUSED_MACRO)
  3011. }
  3012. # tag:java-specific
  3013. module _JAR_BASE: _BARE_UNIT {
  3014. .NODE_TYPE=Bundle
  3015. .CMD=TOUCH_UNIT
  3016. .PEERDIR_POLICY=as_build_from
  3017. .FINAL_TARGET=no
  3018. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  3019. .ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE
  3020. .DEFAULT_NAME_GENERATOR=TwoDirNames
  3021. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__
  3022. HAS_MANAGEABLE_PEERS=yes
  3023. DYNAMIC_LINK=yes
  3024. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  3025. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  3026. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  3027. DISABLE(NEED_PLATFORM_PEERDIRS)
  3028. NO_PLATFORM()
  3029. VCS_JAVA=${suf=.__vcs_version__.mf:TARGET}
  3030. SET(MODULE_LANG JAVA)
  3031. }
  3032. # tag:java-specific
  3033. module JAVA_CONTRIB_PROXY: _JAR_BASE {
  3034. }
  3035. # tag:java-specific
  3036. macro _FETCH_CONTRIB(Id, Out, SBR="sbr:") {
  3037. .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"}
  3038. ADD_CHECK(check.resource $Id)
  3039. }
  3040. # tag:java-specific
  3041. LOCAL_JAR_PATH=
  3042. LOCAL_SOURCES_JAR_PATH=
  3043. JAR_RESOURCE_ID=
  3044. SRC_RESOURCE_ID=
  3045. FETCH_SRCS_JAR=
  3046. FETCH_TARGET_JAR=
  3047. FETCH_CONTRIB_JAR=$FETCH_TARGET_JAR $FETCH_SRCS_JAR
  3048. # tag:java-specific
  3049. macro JAR_RESOURCE(Id) {
  3050. SET(JAR_RESOURCE_ID $Id)
  3051. }
  3052. # tag:java-specific
  3053. macro SRC_RESOURCE(Id) {
  3054. SET(SRC_RESOURCE_ID $Id)
  3055. }
  3056. # tag:java-specific
  3057. macro LOCAL_JAR(File) {
  3058. SET(LOCAL_JAR_PATH $File)
  3059. }
  3060. # tag:java-specific
  3061. macro LOCAL_SOURCES_JAR(File) {
  3062. SET(LOCAL_SOURCES_JAR_PATH $File)
  3063. }
  3064. # tag:java-specific
  3065. module JAVA_CONTRIB: _JAR_BASE {
  3066. .CMD=FETCH_CONTRIB_JAR
  3067. .FINAL_TARGET=yes
  3068. when ($JAR_RESOURCE_ID) {
  3069. FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX})
  3070. }
  3071. otherwise {
  3072. when ($LOCAL_JAR_PATH) {
  3073. FETCH_TARGET_JAR= && $FS_TOOLS copy ${input:LOCAL_JAR_PATH} $TARGET
  3074. }
  3075. otherwise {
  3076. FETCH_TARGET_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:BINDIR} $JDK_RESOURCE/bin/jar cfvm $TARGET $VCS_JAVA .
  3077. PEERDIR+=build/platform/java/jdk
  3078. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3079. }
  3080. }
  3081. when ($SRC_RESOURCE_ID) {
  3082. FETCH_SRCS_JAR= && $_FETCH_CONTRIB($SRC_RESOURCE_ID ${BINDIR}/${REALPRJNAME}-sources.jar)
  3083. }
  3084. otherwise {
  3085. when ($LOCAL_SOURCES_JAR_PATH) {
  3086. FETCH_SRCS_JAR= && $FS_TOOLS copy ${input:LOCAL_SOURCES_JAR_PATH} {output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME}
  3087. }
  3088. otherwise {
  3089. 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 .
  3090. PEERDIR+=build/platform/java/jdk
  3091. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3092. }
  3093. }
  3094. SET(MODULE_SUFFIX .jar)
  3095. }
  3096. # tag:kotlin-specific
  3097. KOTLINC_OPTS_VALUE=
  3098. # tag:kotlin-specific
  3099. KT_SRSCLIST_FLAG=--kotlin ${BINDIR}/misc/all-kt-sources.txt
  3100. KT_CLASSES_DIR=${BINDIR}/kt_cls
  3101. COLLECT_KT_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/writer.py"} --file ${BINDIR}/kt_bfg.txt -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file
  3102. LINK_KT_CLASSPATH=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} ${BINDIR}/kt_bfg.txt ${BINDIR}/kt_cp.txt && $FS_TOOLS md $KT_CLASSES_DIR
  3103. COMPILE_KT=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/with_pathsep_resolve.py"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} --kotlin --sources-list ${BINDIR}/misc/all-kt-sources.txt $JDK_RESOURCE/bin/java -jar $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} @${BINDIR}/misc/all-kt-sources.txt -classpath @${BINDIR}/kt_cp.txt $KOTLINC_FLAGS_VALUE -d $KT_CLASSES_DIR $KOTLINC_OPTS_VALUE
  3104. ALL_KT_COMMANDS=
  3105. KT_CLASSPATH_ITEM=
  3106. # tag:java-specific
  3107. JAVAC_CMD=$JDK_RESOURCE/bin/javac
  3108. 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
  3109. # tag:java-specific tag:codenav
  3110. JAVA_YNDEXING=no
  3111. # tag:java-specific
  3112. when ($USE_SYSTEM_KYTHE) {
  3113. KYTHE_RESOURCE=$USE_SYSTEM_KYTHE
  3114. }
  3115. otherwise {
  3116. KYTHE_RESOURCE=$KYTHE_RESOURCE_GLOBAL
  3117. }
  3118. # tag:java-specific tag:codenav
  3119. _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
  3120. _DO_JAVA_YNDEXING=
  3121. # tag:java-specific
  3122. SOURCES_JAR=no
  3123. _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 .
  3124. _PACK_SRC_JAR=
  3125. # tag:java-specific
  3126. _PACK_JNI=
  3127. _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
  3128. # tag:java-specific
  3129. _MAKE_JSTYLE_FILE_LIST=
  3130. # tag:java-specific
  3131. _LINK_UBERJAR=
  3132. _UBERJAR_SELF=
  3133. _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} \
  3134. && $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} $BINDIR/_empty/META-INF \
  3135. && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} $BINDIR/_empty/META-INF/MANIFEST.MF \
  3136. && $UPDATE_VCS_JAVA_INFO_NODEP($TARGET) \
  3137. && ${cwd;suf=/_empty:BINDIR} ${JDK_RESOURCE}/bin/jar ufv ${TARGET} META-INF/MANIFEST.MF \
  3138. && $JDK_RESOURCE/bin/jar ufvm $TARGET $VCS_JAVA
  3139. # tag:java-specific
  3140. macro _PACK_JAR_HELPER(Out) {
  3141. .CMD=${cwd;suf=/cls:BINDIR} $JDK_RESOURCE/bin/jar cfvm $Out $VCS_JAVA .
  3142. }
  3143. # tag:java-specific
  3144. macro _JAVAC_RUN_HELPER(JAVAC_CMD_WITH_ARGS...) {
  3145. .CMD=${cwd:ARCADIA_BUILD_ROOT} $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
  3146. }
  3147. macro _ADD_HIDDEN_INPUTS(Inputs...) {
  3148. .CMD=${input;hide:Inputs}
  3149. }
  3150. # tag:java-specific
  3151. 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
  3152. ERROR_PRONE_2_7_1_FORCED_OPTS=-Xep:InlineMeInliner:OFF -Xep:SameNameButDifferent:OFF
  3153. # tag:java-specific
  3154. JAVA_COVERAGE_SRCLIST_FLAG=--coverage ${output;pre=${MODULE_PREFIX};suf=.cpsf:REALPRJNAME} --source-root ${ARCADIA_ROOT}
  3155. JAVA_COVERAGE_SRCLIST=
  3156. PREPARE_JAVA_BUILD_DIRS=$FS_TOOLS md ${BINDIR}/cls && $FS_TOOLS md ${BINDIR}/misc
  3157. EXTRACT_GENDIRS=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --unpack --ext .gentar ${ext=.gentar:AUTO_INPUT}
  3158. COLLECT_JAVA_SRCLIST=${YMAKE_PYTHON} ${input:"build/scripts/make_java_srclists.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
  3159. COLLECT_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/writer.py"} --file ${BINDIR}/bfg.txt -m --ya-start-command-file ${rootrel:MANAGED_PEERS_CLOSURE} $KT_CLASSPATH_ITEM --ya-end-command-file
  3160. LINK_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/bfg.txt ${ARCADIA_BUILD_ROOT}/bfg.jar
  3161. COMPILE_JAVA_SRCLIST=$_JAVAC_RUN_HELPER($JAVAC_CMD)
  3162. PACK_JAR=$_PACK_JAR_HELPER($TARGET)
  3163. # NOTE: No && before LINK_JAR_RESOURCES, ALL_KT_COMMANDS and JAR_GEN_SRCS needed since those vars either empty or starts with &&
  3164. LINK_JAR=$PREPARE_JAVA_BUILD_DIRS \
  3165. && $EXTRACT_GENDIRS \
  3166. && $COLLECT_JAVA_SRCLIST \
  3167. $JAR_GEN_SRCS \
  3168. $ALL_KT_COMMANDS \
  3169. && $COLLECT_CLASSPATH \
  3170. && $LINK_CLASSPATH \
  3171. && $COMPILE_JAVA_SRCLIST \
  3172. $LINK_JAR_RESOURCES \
  3173. && ${cwd;suf=/cls:BINDIR} $GENERATE_VCS_JAVA_INFO_NODEP . \
  3174. $_PACK_SRC_JAR \
  3175. $_PACK_JNI \
  3176. && $PACK_JAR \
  3177. $_DO_JAVA_YNDEXING \
  3178. ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} \
  3179. $_MAKE_JSTYLE_FILE_LIST \
  3180. $_LINK_UBERJAR \
  3181. $_ADD_HIDDEN_INPUTS($JAVA_EXTERNAL_DEPENDENCIES_VALUE)
  3182. # tag:java-specific
  3183. _EXT_SRC_JAR=
  3184. _EXT_JAR=
  3185. _COPY_EXT_SRC_JAR=
  3186. _DO_USE_EXT_JAR=$FS_TOOLS copy ${input:_EXT_JAR} $TARGET $_COPY_EXT_SRC_JAR
  3187. _DO_COPY_EXT_SRC_JAR= && $FS_TOOLS copy $_EXT_SRC_JAR ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
  3188. macro JAVA_RESOURCE(JAR, SOURCES="") {
  3189. SET(_EXT_SRC_JAR $SOURCES)
  3190. SET(_EXT_JAR $JAR)
  3191. }
  3192. # tag:java-specific tag:fbs
  3193. JAVA_FLATBUFFERS_VERSION = 2.0.0
  3194. # tag:java-specific
  3195. module _COMPILABLE_JAR_BASE : _JAR_BASE {
  3196. # flatbuffers-java
  3197. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3198. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3199. # protobuf-java
  3200. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3201. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3202. # protobuf-javalite
  3203. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3204. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3205. # protobuf-java-util
  3206. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  3207. 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})
  3208. }
  3209. # tag:java-specific tag:internal
  3210. ### @usage: JAR_LIBRARY() #internal
  3211. ###
  3212. ### Reimplementation of the JAVA_LIBRARY with ymake.core.conf and ymake based dependency management
  3213. module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
  3214. .EXTS=.jsrc .java .jar .mf .gentar .kt
  3215. .CMD=LINK_JAR
  3216. .FINAL_TARGET=yes
  3217. .ALIASES=JAVA_SRCS=IDEA_JAR_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
  3218. .RESTRICTED=EXTERNAL_JAR
  3219. MODULE_SUFFIX=.jar
  3220. PEERDIR(build/platform/java/jdk)
  3221. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3222. when ($_EXT_SRC_JAR) {
  3223. _COPY_EXT_SRC_JAR=_DO_COPY_EXT_SRC_JAR
  3224. }
  3225. when ($_EXT_JAR) {
  3226. LINK_JAR=$_DO_USE_EXT_JAR
  3227. }
  3228. # in the ideal world this statement must be under condition bellow
  3229. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
  3230. when ($WITH_KOTLIN_VALUE) {
  3231. KT_SRSCLIST=$KT_SRSCLIST_FLAG
  3232. ALL_KT_COMMANDS=&& $COLLECT_KT_CLASSPATH && $LINK_KT_CLASSPATH && $COMPILE_KT
  3233. LINK_JAR_RESOURCES+=&& $FS_TOOLS copy_all_files ${KT_CLASSES_DIR} ${BINDIR}/cls
  3234. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  3235. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  3236. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  3237. }
  3238. when($WITH_KOTLINC_PLUGIN_NOARG) {
  3239. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  3240. }
  3241. # Must be in sync with KT_CLASSES_DIR!
  3242. # There are problems in JDK13 with abs paths in classpath baked into jar file manifest. Using relative path
  3243. # here assumes that jar file with classpath for javac located in the $ARCADIA_BUILD_ROOT
  3244. KT_CLASSPATH_ITEM=$MODDIR/kt_cls
  3245. }
  3246. otherwise {
  3247. KT_SRSCLIST=
  3248. ALL_KT_COMMANDS=
  3249. KT_CLASSES=
  3250. }
  3251. when ($SOURCES_JAR == "yes") {
  3252. _PACK_SRC_JAR=$_PACK_SRC_JAR_IMPL
  3253. }
  3254. when ($JAVA_COVERAGE == "yes") {
  3255. JAVA_COVERAGE_SRCLIST=$JAVA_COVERAGE_SRCLIST_FLAG
  3256. }
  3257. when ($MAKE_UBERJAR_VALUE == "yes") {
  3258. _LINK_UBERJAR=$_DO_LINK_UBERJAR
  3259. PACK_JAR=$_PACK_JAR_HELPER(${BINDIR}/${REALPRJNAME}.lib.jar)
  3260. # TODO: This condition is incorrect in case of autoinputs _UBERJAR_SELF should be empty only for
  3261. # modules without AUTO_INPUT and without JAVA_SRCS added inputs.
  3262. when($ALL_JAR_SOURCES) {
  3263. _UBERJAR_SELF=--jar ${BINDIR}/${REALPRJNAME}.lib.jar
  3264. }
  3265. PEERDIR+=build/platform/java/uberjar
  3266. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  3267. }
  3268. when($JAVA_YNDEXING == "yes") {
  3269. PEERDIR+=build/platform/java/kythe
  3270. _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"}
  3271. }
  3272. when($ERROR_PRONE_VALUE) {
  3273. PEERDIR+=$ERROR_PRONE_PEERDIR
  3274. JAVAC_CMD=$ERROR_PRONE_JAVAC_CMD
  3275. }
  3276. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
  3277. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3278. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3279. }
  3280. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "17") {
  3281. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3282. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3283. }
  3284. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  3285. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3286. JAVAC_OPTS+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3287. }
  3288. when ($JAVA_ADD_DLLS_VALUE == "yes") {
  3289. CONSUME_NON_MANAGEABLE_PEERS=yes
  3290. _PACK_JNI=$_PACK_JNI_CMD
  3291. }
  3292. when ($LINT_LEVEL_VALUE != "none") {
  3293. _MAKE_JSTYLE_FILE_LIST= && $YMAKE_PYTHON ${input:"build/scripts/writer.py"} --file ${output;noauto:"lint-java.srclst"} -m --ya-start-command-file $LINT_JAVA_SOURCES --ya-end-command-file
  3294. }
  3295. SET(MODULE_TYPE JAVA_LIBRARY)
  3296. ENABLE(YMAKE_JAVA_TEST)
  3297. _ADD_JAVA_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/lint-java.srclst::$(SOURCE_ROOT))
  3298. _ADD_CLASSPATH_CLASH_CHECK()
  3299. JAVA_MODULE(IDEA_ONLY)
  3300. }
  3301. # tag:java-specific
  3302. _SCRIPTGEN_FLAGS=
  3303. macro _GEN_JAVA_SCRIPT_IMPL(Out, Template, Props...) {
  3304. .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
  3305. }
  3306. # tag:java-specific
  3307. _GEN_USERSCRIPTS=
  3308. macro _ADD_GEN_JAVA_SCRIPT(Out, Template, Props...) {
  3309. SET_APPEND(_GEN_USERSCRIPTS && \$_GEN_JAVA_SCRIPT_IMPL($Out $Template $Props))
  3310. }
  3311. # tag:java-specific
  3312. _PACK_JDK=
  3313. # tag:java-specific
  3314. DO_GEN_JAVA_RUN_SH=
  3315. _SOURCE_JARS=
  3316. _SOURCE_JARS_CPLIST=
  3317. 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}
  3318. GEN_RUN_CP=${YMAKE_PYTHON} ${input:"build/scripts/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}
  3319. 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}
  3320. MAKE_JAR_PROGRAM_CPLST=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} --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
  3321. TAR_CLASSPATH= && $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} ${output;pre=$MODULE_PREFIX;suf=.tar:REALPRJNAME} ${cwd;pre=$BINDIR/:REALPRJNAME}
  3322. DO_TAR_CLASSPATH=
  3323. LINK_JAR_PROGRAM=$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"}
  3324. # tag:java-specific
  3325. # UBERJAR program link command
  3326. LINK_UBERJAR_PROGRAM=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} $TARGET \
  3327. && $FS_TOOLS md ${BINDIR}/${REALPRJNAME} \
  3328. && $FS_TOOLS link_or_copy ${BINDIR}/${REALPRJNAME}.jar $TARGET \
  3329. && $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;late_out;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} \
  3330. $DO_TAR_CLASSPATH \
  3331. $_GEN_USERSCRIPTS \
  3332. $_PACK_JDK
  3333. # tag:java-specific
  3334. RUN_WITH_SOURCES=no
  3335. # 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
  3336. TARED_CLASSPATH=yes
  3337. _JAR_SRCS_CALLED=no
  3338. # tag:java-specific
  3339. macro _MARK_JAVA_PROG_WITH_SOURCES(Args...) {
  3340. ENABLE(_JAR_SRCS_CALLED)
  3341. }
  3342. # tag:java-specific
  3343. module _JAR_RUNABLE: _COMPILABLE_JAR_BASE {
  3344. .FINAL_TARGET=yes
  3345. .CMD=LINK_JAR_PROGRAM
  3346. .ALIASES=JAVA_SRCS=_MARK_JAVA_PROG_WITH_SOURCES GENERATE_SCRIPT=_YMAKE_GENERATE_SCRIPT
  3347. MODULE_SUFFIX=.run.cp.jar
  3348. CONSUME_NON_MANAGEABLE_PEERS=yes
  3349. when ($RUN_WITH_SOURCES == "yes") {
  3350. _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}
  3351. _SOURCE_JARS_CPLIST=${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
  3352. }
  3353. when ($TARED_CLASSPATH == "yes") {
  3354. DO_TAR_CLASSPATH=$TAR_CLASSPATH
  3355. }
  3356. when ($DISABLE_SCRIPTGEN) {
  3357. DO_GEN_JAVA_RUN_SH=
  3358. }
  3359. otherwise {
  3360. DO_GEN_JAVA_RUN_SH=$GEN_JAVA_RUN_SH
  3361. PEERDIR+=build/platform/java/scriptgen
  3362. }
  3363. when ($WITH_JDK_VALUE) {
  3364. _PACK_JDK= && ${YMAKE_PYTHON} ${input:"build/scripts/tar_directory.py"} ${output;tared:"jdk.tar"} $WITH_JDK_RESOURCE $WITH_JDK_RESOURCE
  3365. }
  3366. when ($MAKE_UBERJAR_VALUE == "yes") {
  3367. LINK_JAR_PROGRAM=$LINK_UBERJAR_PROGRAM
  3368. DYNAMIC_LINK=no
  3369. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=yes
  3370. }
  3371. otherwise {
  3372. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=no
  3373. }
  3374. CHECK_PROVIDES()
  3375. }
  3376. # tag:java-specific
  3377. multimodule JAR_PROGRAM {
  3378. module JAR_RUNABLE: _JAR_RUNABLE {
  3379. .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
  3380. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3381. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
  3382. .PEERDIRSELF=JAR_COMPILATION
  3383. SET(MODULE_TYPE JAVA_PROGRAM)
  3384. }
  3385. module JAR_COMPILATION: JAR_LIBRARY {
  3386. .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
  3387. .FINAL_TARGET=no
  3388. SET(MODULE_TYPE JAVA_PROGRAM)
  3389. }
  3390. }
  3391. # tag:java-specific
  3392. LINK_JAR_TEST=${YMAKE_PYTHON} ${input:"build/scripts/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}
  3393. YMAKE_JAVA_TEST=
  3394. module _JAR_TEST: _COMPILABLE_JAR_BASE {
  3395. .FINAL_TARGET=yes
  3396. .CMD=LINK_JAR_TEST
  3397. .DEFAULT_NAME_GENERATOR=FullPath
  3398. CONSUME_NON_MANAGEABLE_PEERS=yes
  3399. SET(MODULE_SUFFIX .test.cp.jar)
  3400. ENABLE(YMAKE_JAVA_TEST)
  3401. JAVA_TEST()
  3402. CHECK_PROVIDES()
  3403. }
  3404. # tag:java-specific
  3405. multimodule JUNIT5_YMAKE {
  3406. module JAR_TESTABLE: _JAR_TEST {
  3407. .ALLOWED=JAVA_TEST_PEERDIR
  3408. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3409. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_TEST_PEERDIR=PEERDIR
  3410. .PEERDIRSELF=JAR_COMPILATION
  3411. SET(MODULE_TYPE JUNIT5)
  3412. }
  3413. module JAR_COMPILATION: JAR_LIBRARY {
  3414. .IGNORED=JAVA_TEST_PEERDIR
  3415. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO
  3416. .FINAL_TARGET=no
  3417. PEERDIR(devtools/junit5-runner build/platform/java/jacoco-agent)
  3418. }
  3419. }
  3420. # tag:java-specific
  3421. multimodule JTEST_YMAKE {
  3422. module JAR_TESTABLE: _JAR_TEST {
  3423. .ALLOWED=YT_SPEC
  3424. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3425. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_TEST_PEERDIR=PEERDIR
  3426. .PEERDIRSELF=JAR_COMPILATION
  3427. SET(MODULE_TYPE JTEST)
  3428. PEERDIR(devtools/junit-runner)
  3429. DEPENDENCY_MANAGEMENT(contrib/java/org/hamcrest/hamcrest-core/1.3 contrib/java/com/google/code/gson/gson/2.8.6 contrib/java/com/beust/jcommander/1.72 contrib/java/junit/junit/4.12)
  3430. }
  3431. module JAR_COMPILATION: JAR_LIBRARY {
  3432. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO
  3433. .ALLOWED=YT_SPEC
  3434. .FINAL_TARGET=no
  3435. DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
  3436. PEERDIR(build/platform/java/jacoco-agent)
  3437. }
  3438. }
  3439. # tag:python-specific tag:deprecated
  3440. ### @usage: PY2_LIBRARY() # deprecated
  3441. ###
  3442. ### Deprecated. Use PY23_LIBRARY or PY3_LIBRARY instead.
  3443. ### Python 2.x binary built library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM.
  3444. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3445. ### This module is only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3446. ### This module is only compatible with Arcadia Python build.
  3447. ###
  3448. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3449. module PY2_LIBRARY: _LIBRARY {
  3450. _ARCADIA_PYTHON_ADDINCL()
  3451. when ($NO_PYTHON_INCLS != "yes") {
  3452. PEERDIR+=contrib/libs/python
  3453. }
  3454. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3455. MODULE_PREFIX=py
  3456. }
  3457. otherwise {
  3458. MODULE_PREFIX=libpy
  3459. }
  3460. .ALLOWED=FORK_TESTS
  3461. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3462. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS STYLE_PYTHON
  3463. USE_GLOBAL_CMD=yes
  3464. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3465. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3466. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3467. 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}"})
  3468. }
  3469. SET(MODULE_LANG PY2)
  3470. ADD_CLANG_TIDY()
  3471. }
  3472. # tag:python-specific
  3473. ### @usage: PY3_LIBRARY()
  3474. ###
  3475. ### Python 3.x binary library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM
  3476. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3477. ### This module is only compatible with PYTHON3-tagged modules and selects those from multimodules.
  3478. ### This module is only compatible with Arcadia Python build.
  3479. ###
  3480. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3481. module PY3_LIBRARY: _LIBRARY {
  3482. _ARCADIA_PYTHON3_ADDINCL()
  3483. when ($NO_PYTHON_INCLS != "yes") {
  3484. PEERDIR+=contrib/libs/python
  3485. }
  3486. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3487. MODULE_PREFIX=py
  3488. }
  3489. otherwise {
  3490. MODULE_PREFIX=libpy
  3491. }
  3492. .ALLOWED=FORK_TESTS
  3493. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3494. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2 OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3495. USE_GLOBAL_CMD=yes
  3496. PEERDIR($YMAKE_PYTHON3_PEER)
  3497. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3498. PYTHON_TYPE_FOR_CYTHON=PY3
  3499. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3500. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3501. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3502. 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}"})
  3503. }
  3504. SET(MODULE_LANG PY3)
  3505. ADD_CLANG_TIDY()
  3506. }
  3507. # tag:python-specific
  3508. ### @usage: _BASE_PY_PROGRAM #internal
  3509. ###
  3510. ### The base module for all Python 2.x binary programs. Adds linking logic, relevant module properties and
  3511. ### dependency on Python 2.x interpreter. Also adds import tests on all sources including PEERDIR'ed libraries.
  3512. ### Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  3513. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3514. ###
  3515. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3516. module _BASE_PY_PROGRAM: _BASE_PROGRAM {
  3517. .CMD=PY_PROGRAM_LINK_EXE
  3518. _ARCADIA_PYTHON_ADDINCL()
  3519. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3520. NO_CHECK_IMPORTS_FOR_VALUE=
  3521. }
  3522. ADD_CHECK_PY_IMPORTS()
  3523. when ($NO_PYTHON_INCLS != "yes") {
  3524. PEERDIR += contrib/libs/python
  3525. }
  3526. when ($USE_ARCADIA_PYTHON == "yes") {
  3527. PEERDIR += library/python/runtime/main
  3528. PEERDIR += contrib/python/subprocess32
  3529. when ($PYTHON_SQLITE3 != "no") {
  3530. PEERDIR += contrib/tools/python/src/Modules/_sqlite
  3531. }
  3532. }
  3533. when ($PYTHON_COVERAGE == "yes") {
  3534. PEERDIR+=library/python/coverage
  3535. }
  3536. when ($ARCH_PPC64LE == "yes") {
  3537. _MY_ALLOCATOR=SYSTEM
  3538. }
  3539. otherwise {
  3540. _MY_ALLOCATOR=J
  3541. }
  3542. ALLOCATOR($_MY_ALLOCATOR)
  3543. STRIP()
  3544. when ($BUILD_TYPE == "DEBUG") {
  3545. NO_STRIP=yes
  3546. }
  3547. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3548. NO_STRIP=yes
  3549. }
  3550. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3551. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3552. SET(MODULE_LANG PY2)
  3553. }
  3554. # tag:python-specific tag:codenav
  3555. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3556. PY3_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"py3yndex $TARGET"}
  3557. }
  3558. otherwise {
  3559. PY3_PROGRAM_LINK_EXE=$LINK_EXE
  3560. }
  3561. # tag:python-specific
  3562. ### @usage: _BASE_PY_PROGRAM #internal
  3563. ###
  3564. ### The base module for all Python 3.x binary programs. Adds linking logic, relevant module properties and
  3565. ### dependency on Python 3.x interpreter. Also adds import tests on all sources including libraries.
  3566. ### Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  3567. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules
  3568. ###
  3569. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3570. module _BASE_PY3_PROGRAM: _BASE_PROGRAM {
  3571. .CMD=PY3_PROGRAM_LINK_EXE
  3572. _ARCADIA_PYTHON3_ADDINCL()
  3573. PEERDIR(library/python/runtime_py3/main)
  3574. when ($PYTHON_SQLITE3 != "no") {
  3575. PEERDIR += contrib/tools/python3/src/Modules/_sqlite
  3576. }
  3577. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3578. NO_CHECK_IMPORTS_FOR_VALUE=
  3579. }
  3580. ADD_CHECK_PY_IMPORTS()
  3581. when ($ARCH_PPC64LE == "yes") {
  3582. _MY_ALLOCATOR=SYSTEM
  3583. }
  3584. otherwise {
  3585. _MY_ALLOCATOR=J
  3586. }
  3587. ALLOCATOR($_MY_ALLOCATOR)
  3588. STRIP()
  3589. when ($NO_PYTHON_INCLS != "yes") {
  3590. PEERDIR+=contrib/libs/python
  3591. }
  3592. when ($BUILD_TYPE == "DEBUG") {
  3593. NO_STRIP=yes
  3594. }
  3595. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3596. NO_STRIP=yes
  3597. }
  3598. when ($PYTHON_COVERAGE == "yes") {
  3599. PEERDIR+=library/python/coverage
  3600. }
  3601. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3602. PEERDIR += contrib/python/six
  3603. }
  3604. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3605. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2
  3606. SET(MODULE_LANG PY3)
  3607. }
  3608. # tag:python-specific
  3609. ### @usage: PY3_PROGRAM_BIN([progname])
  3610. ### Use instead of PY3_PROGRAM only if ya.make with PY3_PROGRAM() included in another ya.make
  3611. ### In all other cases use PY3_PROGRAM
  3612. module PY3_PROGRAM_BIN: _BASE_PY3_PROGRAM {
  3613. # Look's like we cannot avoid copy-paste util ymake supports multiple inheritance
  3614. # We need to attach coverage.extractor to every py_program target, except pytest targets
  3615. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  3616. }
  3617. # tag:java-specific
  3618. JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
  3619. # tag:java-specific
  3620. JDK_REAL_VERSION=
  3621. JDK_VERSION=
  3622. when ($JDK_VERSION == "17") {
  3623. JDK_REAL_VERSION=17
  3624. }
  3625. elsewhen ($JDK_VERSION == "16") {
  3626. JDK_REAL_VERSION=16
  3627. }
  3628. elsewhen ($JDK_VERSION == "15") {
  3629. JDK_REAL_VERSION=15
  3630. }
  3631. elsewhen ($JDK_VERSION == "14") {
  3632. JDK_REAL_VERSION=14
  3633. }
  3634. elsewhen ($JDK_VERSION == "13") {
  3635. JDK_REAL_VERSION=13
  3636. }
  3637. elsewhen ($JDK_VERSION == "12") {
  3638. JDK_REAL_VERSION=12
  3639. }
  3640. elsewhen ($JDK_VERSION == "11") {
  3641. JDK_REAL_VERSION=11
  3642. }
  3643. elsewhen ($JDK_VERSION == "10") {
  3644. JDK_REAL_VERSION=10
  3645. }
  3646. elsewhen ($JDK_VERSION == "8") {
  3647. JDK_REAL_VERSION=8
  3648. }
  3649. elsewhen ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
  3650. JDK_REAL_VERSION=8
  3651. }
  3652. otherwise {
  3653. JDK_REAL_VERSION=17
  3654. }
  3655. # tag:java-specific
  3656. # remove extra peerdir to jdk11 after https://st.yandex-team.ru/DEVTOOLS-8851 is done
  3657. when ($USE_SYSTEM_JDK) {
  3658. JDK_RESOURCE_PEERDIR=
  3659. }
  3660. otherwise {
  3661. when ($JDK_REAL_VERSION == "17") {
  3662. # need jdk11 for spare parts in "host" platform
  3663. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk17 build/platform/java/jdk/jdk11
  3664. }
  3665. when ($JDK_REAL_VERSION == "16") {
  3666. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk16 build/platform/java/jdk/jdk17
  3667. }
  3668. when ($JDK_REAL_VERSION == "15") {
  3669. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk15 build/platform/java/jdk/jdk17
  3670. }
  3671. when ($JDK_REAL_VERSION == "14") {
  3672. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk14 build/platform/java/jdk/jdk17
  3673. }
  3674. when ($JDK_REAL_VERSION == "13") {
  3675. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk13 build/platform/java/jdk/jdk17
  3676. }
  3677. when ($JDK_REAL_VERSION == "12") {
  3678. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk12 build/platform/java/jdk/jdk17
  3679. }
  3680. when ($JDK_REAL_VERSION == "11") {
  3681. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk11 build/platform/java/jdk/jdk17
  3682. }
  3683. when ($JDK_REAL_VERSION == "10") {
  3684. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk10 build/platform/java/jdk/jdk17
  3685. }
  3686. when ($JDK_REAL_VERSION == "8") {
  3687. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk8 build/platform/java/jdk/jdk17
  3688. }
  3689. }
  3690. # tag:java-specific
  3691. when ($JDK_REAL_VERSION == "17") {
  3692. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar17
  3693. }
  3694. when ($JDK_REAL_VERSION == "16") {
  3695. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar16
  3696. }
  3697. when ($JDK_REAL_VERSION == "15") {
  3698. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar15
  3699. }
  3700. when ($JDK_REAL_VERSION == "14") {
  3701. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar14
  3702. }
  3703. when ($JDK_REAL_VERSION == "13") {
  3704. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar13
  3705. }
  3706. when ($JDK_REAL_VERSION == "12") {
  3707. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar12
  3708. }
  3709. when ($JDK_REAL_VERSION == "11") {
  3710. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar11
  3711. }
  3712. when ($JDK_REAL_VERSION == "10") {
  3713. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar10
  3714. }
  3715. when ($JDK_REAL_VERSION == "8") {
  3716. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar8
  3717. }
  3718. # tag:java-specific
  3719. JAVAC_OPTS=
  3720. when ($USE_SYSTEM_JDK) {
  3721. JDK_RESOURCE=$USE_SYSTEM_JDK
  3722. }
  3723. otherwise {
  3724. when ($JDK_REAL_VERSION == "17") {
  3725. JDK_RESOURCE=$JDK17_RESOURCE_GLOBAL
  3726. }
  3727. when ($JDK_REAL_VERSION == "16") {
  3728. JDK_RESOURCE=$JDK16_RESOURCE_GLOBAL
  3729. }
  3730. when ($JDK_REAL_VERSION == "15") {
  3731. JDK_RESOURCE=$JDK15_RESOURCE_GLOBAL
  3732. }
  3733. when ($JDK_REAL_VERSION == "14") {
  3734. JDK_RESOURCE=$JDK14_RESOURCE_GLOBAL
  3735. }
  3736. when ($JDK_REAL_VERSION == "13") {
  3737. JDK_RESOURCE=$JDK13_RESOURCE_GLOBAL
  3738. }
  3739. when ($JDK_REAL_VERSION == "12") {
  3740. JDK_RESOURCE=$JDK12_RESOURCE_GLOBAL
  3741. }
  3742. when ($JDK_REAL_VERSION == "11") {
  3743. JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  3744. }
  3745. when ($JDK_REAL_VERSION == "10") {
  3746. JDK_RESOURCE=$JDK10_RESOURCE_GLOBAL
  3747. }
  3748. when ($JDK_REAL_VERSION == "8") {
  3749. JDK_RESOURCE=$JDK8_RESOURCE_GLOBAL
  3750. }
  3751. }
  3752. # tag:java-specific
  3753. when (!$USE_SYSTEM_ERROR_PRONE) {
  3754. when ($JDK_REAL_VERSION == "8" || $JDK_REAL_VERSION == "10") {
  3755. ERROR_PRONE_VERSION=2.3.1
  3756. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.3.1
  3757. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_3_1_RESOURCE_GLOBAL
  3758. }
  3759. elsewhen ($JDK_REAL_VERSION == "11" || $JDK_REAL_VERSION == "12" || $JDK_REAL_VERSION == "13" || $JDK_REAL_VERSION == "14" || $JDK_REAL_VERSION == "15" || $JDK_REAL_VERSION == "16") {
  3760. ERROR_PRONE_VERSION=2.7.1
  3761. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.7.1
  3762. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_7_1_RESOURCE_GLOBAL
  3763. }
  3764. elsewhen ($JDK_REAL_VERSION == "17") {
  3765. ERROR_PRONE_VERSION=2.10.0
  3766. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.10.0
  3767. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_10_0_RESOURCE_GLOBAL
  3768. }
  3769. otherwise {
  3770. ERROR_PRONE_VERSION=2.7.1
  3771. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  3772. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  3773. }
  3774. }
  3775. otherwise {
  3776. ERROR_PRONE_VERSION=2.7.1
  3777. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  3778. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  3779. }
  3780. # tag:java-specific
  3781. when ($USE_SYSTEM_UBERJAR) {
  3782. UBERJAR_RESOURCE=$USE_SYSTEM_UBERJAR
  3783. }
  3784. otherwise {
  3785. when ($JDK_REAL_VERSION == "17") {
  3786. UBERJAR_RESOURCE=$UBERJAR17_RESOURCE_GLOBAL
  3787. }
  3788. when ($JDK_REAL_VERSION == "16") {
  3789. UBERJAR_RESOURCE=$UBERJAR16_RESOURCE_GLOBAL
  3790. }
  3791. when ($JDK_REAL_VERSION == "15") {
  3792. UBERJAR_RESOURCE=$UBERJAR15_RESOURCE_GLOBAL
  3793. }
  3794. when ($JDK_REAL_VERSION == "14") {
  3795. UBERJAR_RESOURCE=$UBERJAR14_RESOURCE_GLOBAL
  3796. }
  3797. when ($JDK_REAL_VERSION == "13") {
  3798. UBERJAR_RESOURCE=$UBERJAR13_RESOURCE_GLOBAL
  3799. }
  3800. when ($JDK_REAL_VERSION == "12") {
  3801. UBERJAR_RESOURCE=$UBERJAR12_RESOURCE_GLOBAL
  3802. }
  3803. when ($JDK_REAL_VERSION == "11") {
  3804. UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
  3805. }
  3806. when ($JDK_REAL_VERSION == "10") {
  3807. UBERJAR_RESOURCE=$UBERJAR10_RESOURCE_GLOBAL
  3808. }
  3809. when ($JDK_REAL_VERSION == "8") {
  3810. UBERJAR_RESOURCE=$UBERJAR8_RESOURCE_GLOBAL
  3811. }
  3812. }
  3813. # tag:java-specific
  3814. when ($JDK_REAL_VERSION == "17") {
  3815. WITH_JDK_RESOURCE=$WITH_JDK17_RESOURCE_GLOBAL
  3816. }
  3817. when ($JDK_REAL_VERSION == "16") {
  3818. WITH_JDK_RESOURCE=$WITH_JDK16_RESOURCE_GLOBAL
  3819. }
  3820. when ($JDK_REAL_VERSION == "15") {
  3821. WITH_JDK_RESOURCE=$WITH_JDK15_RESOURCE_GLOBAL
  3822. }
  3823. when ($JDK_REAL_VERSION == "14") {
  3824. WITH_JDK_RESOURCE=$WITH_JDK14_RESOURCE_GLOBAL
  3825. }
  3826. when ($JDK_REAL_VERSION == "13") {
  3827. WITH_JDK_RESOURCE=$WITH_JDK13_RESOURCE_GLOBAL
  3828. }
  3829. when ($JDK_REAL_VERSION == "12") {
  3830. WITH_JDK_RESOURCE=$WITH_JDK12_RESOURCE_GLOBAL
  3831. }
  3832. when ($JDK_REAL_VERSION == "11") {
  3833. WITH_JDK_RESOURCE=$WITH_JDK11_RESOURCE_GLOBAL
  3834. }
  3835. when ($JDK_REAL_VERSION == "10") {
  3836. WITH_JDK_RESOURCE=$WITH_JDK10_RESOURCE_GLOBAL
  3837. }
  3838. when ($JDK_REAL_VERSION == "8") {
  3839. WITH_JDK_RESOURCE=$WITH_JDK8_RESOURCE_GLOBAL
  3840. }
  3841. # tag:java-specific
  3842. EXTERNAL_JAVA_JDK_RESOURCE=
  3843. EXTERNAL_JAVA_EXTRA_PEERDIR=
  3844. when ($USE_SYSTEM_JDK) {
  3845. EXTERNAL_JAVA_EXTRA_PEERDIR=
  3846. EXTERNAL_JAVA_JDK_RESOURCE=$USE_SYSTEM_JDK
  3847. }
  3848. elsewhen ($JDK_VERSION == "") {
  3849. EXTERNAL_JAVA_JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  3850. EXTERNAL_JAVA_EXTRA_PEERDIR=build/platform/java/jdk/jdk11
  3851. }
  3852. otherwise {
  3853. EXTERNAL_JAVA_JDK_RESOURCE=$JDK_RESOURCE
  3854. }
  3855. COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_java.py"} --javac-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/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 ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  3856. REAL_SWIG_DLL_JAR_CMD=$GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/build_dll_and_java.py"} $JAVA_SWIG_DELIM $REAL_LINK_DYN_LIB $JAVA_SWIG_DELIM $COMPILE_JAVA $JAVA_SWIG_DELIM $AUTO_INPUT $JAVA_SWIG_DELIM $TARGET $JAVA_SWIG_DELIM ${output;suf=.jar:REALPRJNAME} $JAVA_SWIG_DELIM ${output;suf=-sources.jar:REALPRJNAME} $JAVA_SWIG_DELIM $ARCADIA_BUILD_ROOT $ARCADIA_ROOT
  3857. ARGS_DELIM="MACRO_CALLS_DELIM"
  3858. SYSTEM_PROPERTIES_VALUE=
  3859. ### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
  3860. ###
  3861. ### List of Key,Value pairs that will be available to test via System.getProperty().
  3862. ### FILE means that parst should be read from file specifies as Path.
  3863. ###
  3864. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3865. macro SYSTEM_PROPERTIES(Args...) {
  3866. SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
  3867. }
  3868. # tag:java-specific
  3869. JVM_ARGS_VALUE=
  3870. ### @usage: JVM_ARGS(Args...)
  3871. ###
  3872. ### Arguments to run Java programs in tests.
  3873. ###
  3874. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3875. macro JVM_ARGS(Args...) {
  3876. SET_APPEND(JVM_ARGS_VALUE $Args)
  3877. }
  3878. # tag:java-specific
  3879. CHECK_JAVA_DEPS_VALUE=
  3880. ### @usage: CHECK_JAVA_DEPS(<yes|no>)
  3881. ###
  3882. ### Check for different classes with duplicate name in classpath.
  3883. ###
  3884. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3885. macro CHECK_JAVA_DEPS(Arg) {
  3886. SET(CHECK_JAVA_DEPS_VALUE $Arg)
  3887. }
  3888. ERROR_PRONE_VALUE=
  3889. ### @usage: USE_ERROR_PRONE()
  3890. ###
  3891. ### Use errorprone instead of javac for .java compilation.
  3892. macro USE_ERROR_PRONE() {
  3893. SET(ERROR_PRONE_VALUE yes)
  3894. }
  3895. TEST_CWD_VALUE=
  3896. ### @usage: TEST_CWD(path)
  3897. ###
  3898. ### Defines working directory for test runs. Often used in conjunction with DATA() macro.
  3899. ### Is only used inside of the TEST modules.
  3900. ###
  3901. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3902. macro TEST_CWD(Arg) {
  3903. SET(TEST_CWD_VALUE $Arg)
  3904. }
  3905. # tag:java-specific
  3906. MAKE_UBERJAR_VALUE=
  3907. ### @usage: UBERJAR()
  3908. ###
  3909. ### UBERJAR is a single all-in-one jar-archive that includes all its Java dependencies (reachable PEERDIR).
  3910. ### It also supports shading classes inside the archive by moving them to a different package (similar to the maven-shade-plugin).
  3911. ### Use UBERJAR inside JAVA_PROGRAM module.
  3912. ###
  3913. ### You can use the following macros to configure the archive:
  3914. ### 1. UBERJAR_HIDING_PREFIX prefix for classes to shade (classes remain in their packages by default)
  3915. ### 2. UBERJAR_HIDE_EXCLUDE_PATTERN exclude classes matching this patterns from shading (if enabled).
  3916. ### 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)
  3917. ### 4. UBERJAR_MANIFEST_TRANSFORMER_MAIN add ManifestResourceTransformer class to uberjar processing and specify main-class
  3918. ### 5. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE add ManifestResourceTransformer class to uberjar processing and specify some attribute
  3919. ### 6. UBERJAR_APPENDING_TRANSFORMER add AppendingTransformer class to uberjar processing
  3920. ### 7. UBERJAR_SERVICES_RESOURCE_TRANSFORMER add ServicesResourceTransformer class to uberjar processing
  3921. ###
  3922. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  3923. ###
  3924. ### @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)
  3925. macro UBERJAR() {
  3926. SET(MAKE_UBERJAR_VALUE yes)
  3927. }
  3928. # tag:java-specific
  3929. UBERJAR_PREFIX_VALUE=
  3930. UBERJAR_PREFIX_FLAG=
  3931. ### @usage: UBERJAR_HIDING_PREFIX(Arg)
  3932. ###
  3933. ### Set prefix for classes to shade. All classes in UBERJAR will be moved into package prefixed with Arg.
  3934. ### Classes remain in their packages by default.
  3935. ###
  3936. ### @see: [UBERJAR](#macro_UBERJAR)
  3937. macro UBERJAR_HIDING_PREFIX(Arg) {
  3938. SET(UBERJAR_PREFIX_VALUE $Arg)
  3939. SET(UBERJAR_PREFIX_FLAG ${pre=--shade-prefix :Arg})
  3940. }
  3941. # tag:java-specific
  3942. UBERJAR_HIDE_EXCLUDE_VALUE=
  3943. UBERJAR_HIDE_EXCLUDE_FLAGS=
  3944. ### @usage: UBERJAR_HIDE_EXCLUDE_PATTERN(Args...)
  3945. ###
  3946. ### Exclude classes matching this patterns from shading (if enabled).
  3947. ### Pattern may contain '*' and '**' globs.
  3948. ### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
  3949. ###
  3950. ### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
  3951. macro UBERJAR_HIDE_EXCLUDE_PATTERN(Args...) {
  3952. SET_APPEND(UBERJAR_HIDE_EXCLUDE_VALUE $ARGS_DELIM $Args)
  3953. SET_APPEND(UBERJAR_HIDE_EXCLUDE_FLAGS ${pre=--shade-exclude :Args})
  3954. }
  3955. # tag:java-specific
  3956. UBERJAR_PATH_EXCLUDES=
  3957. UBERJAR_PATH_EXCLUDE_VALUE=
  3958. ### @usage: UBERJAR_PATH_EXCLUDE_PREFIX(Args...)
  3959. ###
  3960. ### Exclude classes matching this patterns from UBERJAR.
  3961. ### By default all dependencies of UBERJAR program will lend in a .jar archive.
  3962. ###
  3963. ### @see: [UBERJAR](#macro_UBERJAR)
  3964. macro UBERJAR_PATH_EXCLUDE_PREFIX(Args...) {
  3965. SET_APPEND(UBERJAR_PATH_EXCLUDE_VALUE $ARGS_DELIM $Args)
  3966. SET_APPEND(UBERJAR_PATH_EXCLUDES ${pre=--uber-exclude :Args})
  3967. }
  3968. # tag:java-specific
  3969. UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE=
  3970. UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG=
  3971. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main)
  3972. ###
  3973. ### Transform manifest.mf for UBERJAR() java programs, set main-class attribute
  3974. ###
  3975. ### @see: [UBERJAR](#macro_UBERJAR)
  3976. macro UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main) {
  3977. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE $Main)
  3978. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG --manifest-main $Main)
  3979. }
  3980. # tag:java-specific
  3981. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE=
  3982. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS=
  3983. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value)
  3984. ###
  3985. ### Transform manifest.mf for UBERJAR() java programs, set attribute
  3986. ###
  3987. ### @see: [UBERJAR](#macro_UBERJAR)
  3988. macro UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value) {
  3989. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Value)
  3990. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:${Value})
  3991. }
  3992. # tag:java-specific
  3993. UBERJAR_APPENDING_TRANSFORMER_VALUE=
  3994. UBERJAR_APPENDING_TRANSFORMER_FLAGS=
  3995. ### @usage: UBERJAR_APPENDING_TRANSFORMER(Resource)
  3996. ###
  3997. ### Add AppendingTransformer for UBERJAR() java programs
  3998. ###
  3999. ### Parameters:
  4000. ### - Resource - Resource name
  4001. ###
  4002. ### @see: [UBERJAR](#macro_UBERJAR)
  4003. macro UBERJAR_APPENDING_TRANSFORMER(Resources...) {
  4004. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_VALUE $ARGS_DELIM $Resources)
  4005. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_FLAGS ${pre=--append-transformer :Resources})
  4006. }
  4007. # tag:java-specific
  4008. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE=
  4009. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG=
  4010. ### @usage: UBERJAR_SERVICES_RESOURCE_TRANSFORMER()
  4011. ###
  4012. ### Add ServicesResourceTransformer for UBERJAR() java programs
  4013. ###
  4014. ### @see: [UBERJAR](#macro_UBERJAR)
  4015. macro UBERJAR_SERVICES_RESOURCE_TRANSFORMER() {
  4016. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE yes)
  4017. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG --service-transformer)
  4018. }
  4019. # tag:idea-specific
  4020. IDEA_EXCLUDE_DIRS_VALUE=
  4021. ### @usage: IDEA_EXCLUDE_DIRS(<excluded dirs>)
  4022. ###
  4023. ### Exclude specified directories from an idea project generated by ya ide idea
  4024. ### Have no effect on regular build.
  4025. macro IDEA_EXCLUDE_DIRS(Args...) {
  4026. SET_APPEND(IDEA_EXCLUDE_DIRS_VALUE $Args)
  4027. }
  4028. # tag:idea-specific
  4029. IDEA_RESOURCE_DIRS_VALUE=
  4030. ### @usage: IDEA_RESOURCE_DIRS(<additional dirs>)
  4031. ###
  4032. ### Set specified resource directories in an idea project generated by ya ide idea
  4033. ### Have no effect on regular build.
  4034. macro IDEA_RESOURCE_DIRS(Args...) {
  4035. SET_APPEND(IDEA_RESOURCE_DIRS_VALUE $Args)
  4036. }
  4037. # tag:idea-specific
  4038. IDEA_MODULE_NAME_VALUE=
  4039. ### @usage: IDEA_MODULE_NAME(module_name)
  4040. ###
  4041. ### Set module name in an idea project generated by ya ide idea
  4042. ### Have no effect on regular build.
  4043. macro IDEA_MODULE_NAME(Name) {
  4044. SET(IDEA_MODULE_NAME_VALUE $Name)
  4045. }
  4046. # tag:java-specific
  4047. JAVAC_FLAGS_VALUE=
  4048. ### @usage: JAVAC_FLAGS(Args...)
  4049. ###
  4050. ### Set additional Java compilation flags.
  4051. macro JAVAC_FLAGS(Args...) {
  4052. SET_APPEND(JAVAC_OPTS $Args)
  4053. SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
  4054. }
  4055. # tag:java-specific
  4056. ENABLE_PREVIEW_VALUE=
  4057. ### @usage: ENABLE_PREVIEW()
  4058. ###
  4059. ### Enable java preview features.
  4060. macro ENABLE_PREVIEW() {
  4061. SET_APPEND(JVM_ARGS_VALUE --enable-preview)
  4062. SET_APPEND(JAVAC_OPTS --enable-preview --release $JDK_REAL_VERSION)
  4063. SET_APPEND(JAVAC_FLAGS_VALUE --enable-preview --release $JDK_REAL_VERSION)
  4064. SET(ENABLE_PREVIEW_VALUE yes)
  4065. }
  4066. # tag:java-specific
  4067. SAVE_JAVAC_GENERATED_SRCS=
  4068. SAVE_JAVAC_GENERATED_SRCS_DIR=
  4069. SAVE_JAVAC_GENERATED_SRCS_TAR=
  4070. when ($SAVE_JAVAC_GENERATED_SRCS) {
  4071. SAVE_JAVAC_GENERATED_SRCS_DIR=${BINDIR}/__javac_generated_srcs__
  4072. SAVE_JAVAC_GENERATED_SRCS_TAR=${BINDIR}/javac_generated.tar
  4073. JAVAC_FLAGS_VALUE+=-s $SAVE_JAVAC_GENERATED_SRCS_DIR
  4074. }
  4075. # tag:java-specific
  4076. MAVEN_GROUP_ID_VALUE=
  4077. ### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
  4078. ###
  4079. ### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
  4080. ### Have no effect on regular build.
  4081. macro MAVEN_GROUP_ID(Arg) {
  4082. SET(MAVEN_GROUP_ID_VALUE $Arg)
  4083. }
  4084. # tag:java-specific
  4085. ANNOTATION_PROCESSOR_VALUE=
  4086. ### @usage: ANNOTATION_PROCESSOR(processors...)
  4087. ###
  4088. ### The macro is in development.
  4089. ### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
  4090. macro ANNOTATION_PROCESSOR(Args...) {
  4091. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Args)
  4092. }
  4093. EXCLUDE_VALUE=
  4094. ### EXCLUDE(prefixes)
  4095. ###
  4096. ### The macro is in development.
  4097. ### Specifies which libraries should be excluded from the classpath.
  4098. macro EXCLUDE(Args...) {
  4099. SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args)
  4100. }
  4101. # tag:java-specific
  4102. JAVA_SRCS_VALUE=
  4103. ### @usage: JAVA_SRCS(srcs)
  4104. ###
  4105. ### Specify java source files and resources. A macro can be contained in any of four java modules.
  4106. ### Keywords:
  4107. ### 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.
  4108. ### 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.
  4109. ###
  4110. ### @example:
  4111. ### - example/ya.make
  4112. ###
  4113. ### JAVA_PROGRAM()
  4114. ### JAVA_SRCS(SRCDIR src/main/java **/*)
  4115. ### END()
  4116. ###
  4117. ### - example/src/main/java/ru/yandex/example/HelloWorld.java
  4118. ###
  4119. ### package ru.yandex.example;
  4120. ### public class HelloWorld {
  4121. ### public static void main(String[] args) {
  4122. ### System.out.println("Hello, World!");
  4123. ### }
  4124. ### }
  4125. ###
  4126. ### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
  4127. macro JAVA_SRCS(Args...) {
  4128. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  4129. }
  4130. # tag:java-specific
  4131. JAVA_ADD_DLLS_VALUE=no
  4132. macro ADD_DLLS_TO_JAR() {
  4133. SET(JAVA_ADD_DLLS_VALUE yes)
  4134. }
  4135. # tag:java-specific
  4136. MANAGED_PEERS=
  4137. MANAGED_PEERS_CLOSURE=
  4138. RUN_JAVA_PROGRAM_MANAGED=
  4139. MANAGEABLE_PEERS_ROOTS=contrib/java
  4140. HAS_MANAGEABLE_PEERS=no
  4141. PROPAGATES_MANAGEABLE_PEERS=no
  4142. YMAKE_CLASSPATH_CHECKS=yes
  4143. # All items of this list must be PEERS, GHOST PEERS or TOOLS of the test module or module itself.
  4144. # All items of this list must has at least one of HAS_MANAGEABLE_PEERS or PROPAGATES_MANAGEABLE_PEERS flags set yes.
  4145. # This variable is used by JUnit tests but not TestNG.
  4146. TEST_CLASSPATH_VALUE=
  4147. # Calculated and replaced by ymake can be used in DART DATA
  4148. TEST_CLASSPATH_MANAGED=
  4149. # tag:java-specific
  4150. DEPENDENCY_MANAGEMENT_VALUE=
  4151. ### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
  4152. ###
  4153. ### 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.
  4154. ###
  4155. ### For example, if the module has PEERDIR (contrib/java/junit/junit), and
  4156. ### 1. specifies DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12),
  4157. ### the PEERDIR is automatically replaced by contrib/java/junit/junit/4.12;
  4158. ### 2. doesn't specify DEPENDENCY_MANAGEMENT, PEERDIR automatically replaced
  4159. ### with the default from contrib/java/junit/junit/ya.make.
  4160. ### These defaults are always there and are supported by maven-import, which puts
  4161. ### there the maximum version available in contrib/java.
  4162. ###
  4163. ### 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.
  4164. ###
  4165. ### If some module has both DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12) and PERDIR(contrib/java/junit/junit/4.11), the PEERDIR wins.
  4166. ###
  4167. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  4168. macro DEPENDENCY_MANAGEMENT(Args...) {
  4169. SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
  4170. _GHOST_PEERDIR($Args)
  4171. }
  4172. # tag:java-specific
  4173. WITH_JDK_VALUE=
  4174. ### @usage: WITH_JDK()
  4175. ###
  4176. ### Add directory with JDK to JAVA_PROGRAM output
  4177. macro WITH_JDK() {
  4178. SET(WITH_JDK_VALUE yes)
  4179. }
  4180. # tag:kotlin-specific
  4181. WITH_KOTLIN_VALUE=
  4182. ### @usage: WITH_KOTLIN()
  4183. ###
  4184. ### Compile kotlin source code in this java module
  4185. macro WITH_KOTLIN() {
  4186. SET(WITH_KOTLIN_VALUE yes)
  4187. }
  4188. # tag:java-specific
  4189. WITH_GROOVY_VALUE=
  4190. ### @usage: WITH_GROOVY()
  4191. ###
  4192. ### Compile groovy source code in this java module
  4193. macro WITH_GROOVY() {
  4194. SET(WITH_GROOVY_VALUE yes)
  4195. }
  4196. # tag:kotlin-specific
  4197. KOTLINC_FLAGS_VALUE=-Xjvm-default=all
  4198. ### @usage: KOTLINC_FLAGS(-flags)
  4199. ###
  4200. ### Set additional Kotlin compilation flags.
  4201. macro KOTLINC_FLAGS(Args...) {
  4202. SET_APPEND(KOTLINC_OPTS_VALUE $Args)
  4203. }
  4204. # tag:kotlin-specific
  4205. WITH_KOTLINC_PLUGIN_ALLOPEN=
  4206. ### @usage: WITH_KOTLINC_ALLOPEN(-flags)
  4207. ###
  4208. ### Enable allopen kotlin compiler plugin https://kotlinlang.org/docs/all-open-plugin.html
  4209. macro WITH_KOTLINC_ALLOPEN(Options...) {
  4210. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.allopen\::Options})
  4211. SET(WITH_KOTLINC_PLUGIN_ALLOPEN yes)
  4212. }
  4213. # tag:kotlin-specific
  4214. WITH_KOTLINC_PLUGIN_NOARG=
  4215. ### @usage: WITH_KOTLINC_NOARG(-flags)
  4216. ###
  4217. ### Enable noarg kotlin compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html
  4218. macro WITH_KOTLINC_NOARG(Options...) {
  4219. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.noarg\::Options})
  4220. SET(WITH_KOTLINC_PLUGIN_NOARG yes)
  4221. }
  4222. # tag:kotlin-specific
  4223. KOTLIN_VERSION=1.6.10
  4224. KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.6.10/ya.dependency_management.inc
  4225. GROOVY_VERSION=3.0.5
  4226. # tag:java-specific
  4227. DIRECT_DEPS_ONLY_VALUE=
  4228. ### @usage: DIRECT_DEPS_ONLY
  4229. ###
  4230. ### Add direct PEERDIR's only in java compile classpath
  4231. macro DIRECT_DEPS_ONLY() {
  4232. SET(DIRECT_DEPS_ONLY_VALUE yes)
  4233. }
  4234. # tag:java-specific
  4235. JAVA_EXTERNAL_DEPENDENCIES_VALUE=
  4236. ### @usage: JAVA_EXTERNAL_DEPENDENCIES(file1 file2 ...)
  4237. ###
  4238. ### Add non-source java external build dependency (like lombok config file)
  4239. macro JAVA_EXTERNAL_DEPENDENCIES(Args...) {
  4240. SET_APPEND(JAVA_EXTERNAL_DEPENDENCIES_VALUE $Args)
  4241. }
  4242. # tag:java-specific
  4243. ### @usage _JAVA_PLACEHOLDER #internal
  4244. ### The base module for all Java modules. Defines common properties and dependencies.
  4245. module _JAVA_PLACEHOLDER: _BASE_UNIT {
  4246. .CMD=TOUCH_JAVA_UNIT
  4247. .FINAL_TARGET=yes
  4248. .ALLOWED=DEPENDENCY_MANAGEMENT EXCLUDE
  4249. .ALIASES=RUN_JAVA_PROGRAM=_RUN_JBUILD_PROGRAM
  4250. HAS_MANAGEABLE_PEERS=yes
  4251. DYNAMIC_LINK=yes
  4252. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL JAR_COMPILATION
  4253. PEERDIR(build/platform/java/jdk)
  4254. PEERDIR+=$JDK_RESOURCE_PEERDIR
  4255. when($MAKE_UBERJAR_VALUE) {
  4256. PEERDIR+=build/platform/java/uberjar
  4257. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  4258. }
  4259. when($ERROR_PRONE_VALUE) {
  4260. # Jbuild assumes hardcoded resource name https://a.yandex-team.ru/arc_vcs/devtools/ya/jbuild/gen/consts/__init__.py?rev=1739368ed5aaa585b8300b84e5dea708a2bedd3a#L130
  4261. # adding default peerdir as a hack to make `ya ide idea` and `ya maven-export` work for now
  4262. PEERDIR+=build/platform/java/error_prone
  4263. PEERDIR+=$ERROR_PRONE_PEERDIR
  4264. }
  4265. # in the ideal world this statement must be under condition bellow
  4266. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
  4267. when($WITH_KOTLIN_VALUE) {
  4268. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  4269. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  4270. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  4271. }
  4272. when($WITH_KOTLINC_PLUGIN_NOARG) {
  4273. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  4274. }
  4275. }
  4276. when($WITH_GROOVY_VALUE) {
  4277. PEERDIR+=build/platform/java/groovy contrib/java/org/codehaus/groovy/groovy/${GROOVY_VERSION}
  4278. }
  4279. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
  4280. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  4281. }
  4282. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  4283. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  4284. }
  4285. JAVA_DEPENDENCIES_CONFIGURATION(FORBID_DEFAULT_VERSIONS)
  4286. DISABLE(NEED_PLATFORM_PEERDIRS)
  4287. NO_PLATFORM()
  4288. JAVA_MODULE()
  4289. # flatbuffers-java
  4290. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  4291. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  4292. # protobuf-java
  4293. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  4294. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  4295. # protobuf-javalite
  4296. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  4297. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  4298. # protobuf-java-util
  4299. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  4300. 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})
  4301. SET(MODULE_LANG JAVA)
  4302. }
  4303. # tag:java-specific
  4304. JAVA_CLASSPATH_CMD_TYPE_VALUE=
  4305. # tag:java-specific
  4306. ### @usage:TEST_JAVA_CLASSPATH_CMD_TYPE(Type)
  4307. ### Available types: MANIFEST(default), COMMAND_FILE, LIST
  4308. ### Method for passing a classpath value to a java command line
  4309. ### MANIFEST via empty jar file with manifest that contains Class-Path attribute
  4310. ### COMMAND_FILE via @command_file
  4311. ### LIST via flat args
  4312. macro TEST_JAVA_CLASSPATH_CMD_TYPE(Type) {
  4313. SET(JAVA_CLASSPATH_CMD_TYPE_VALUE $Type)
  4314. }
  4315. # tag:java-specific
  4316. IGNORE_JAVA_DEPENDENCIES_CONFIGURATION=no
  4317. JAVA_DEPENDENCIES_CONFIGURATION_VALUE=
  4318. # tag:java-specific
  4319. ### @usage JAVA_DEPENDENCIES_CONFIGURATION(Vetos...)
  4320. ### Validate contrib/java dependencies
  4321. ### Valid arguments
  4322. ### FORBID_DIRECT_PEERDIRS - fail when module have direct PEERDIR (with version) (non-transitive)
  4323. ### FORBID_DEFAULT_VERSIONS - fail when module have PEERDIR to library with default (last) version (transitive)
  4324. ### FORBID_CONFLICT - fail when module have resolved without DEPENDENCY_MANAGEMENT version conflict (transitive)
  4325. ### FORBID_CONFLICT_DM - fail when module have resolved with DEPENDENCY_MANAGEMENT version conflict (transitive)
  4326. ### FORBID_CONFLICT_DM_RECENT - like FORBID_CONFLICT_DM but fail only when dependency have more recent version than specified in DEPENDENCY_MANAGEMENT
  4327. ### REQUIRE_DM - all dependencies must be specified in DEPENDENCY_MANAGEMENT (transitive)
  4328. macro JAVA_DEPENDENCIES_CONFIGURATION(Args...) {
  4329. SET_APPEND(JAVA_DEPENDENCIES_CONFIGURATION_VALUE $Args)
  4330. }
  4331. # tag:java-specific
  4332. # TODO(DEVTOOLS-6901): remove this variable when there are no more references to it in jbuild
  4333. JAVA_FORBIDDEN_LIBRARIES_VALUE=
  4334. # tag:java-specific
  4335. JAR_INCLUDE_FILTER_VALUE=
  4336. JAR_EXCLUDE_FILTER_VALUE=
  4337. # tag:java-specific
  4338. ### @usage:JAR_INCLUDE(Filters...)
  4339. ### Filter .jar file content: keep only matched files
  4340. ### * and ** patterns are supported (like JAVA_SRCS)
  4341. macro JAR_INCLUDE(Filters...) {
  4342. SET_APPEND(JAR_INCLUDE_FILTER_VALUE $Filters)
  4343. }
  4344. # tag:java-specific
  4345. ### @usage:JAR_EXCLUDE(Filters...)
  4346. ### Filter .jar file content: remove matched files
  4347. ### * and ** patterns are supported (like JAVA_SRCS)
  4348. macro JAR_EXCLUDE(Filters...) {
  4349. SET_APPEND(JAR_EXCLUDE_FILTER_VALUE $Filters)
  4350. }
  4351. # tag:sandbox-specific
  4352. ### @usage: SANDBOX_TASK([Name])
  4353. ###
  4354. ### Multimodule describing Sandbox task (Python code that can be executed by Sandbox system).
  4355. ###
  4356. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_TASKs as libraries.
  4357. ### The final artifact is provided when SANDBOX_TASK is referred to by DEPENDS and BUNDLE macros.
  4358. ### As PEERDIR target, it works like regular PY2_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_TASKs.
  4359. ###
  4360. ### Currently Sandbox supports only Python 2.x, so both variants will be compatible only with Python 2.x modules
  4361. ### and will select multimodule variants accordingly.
  4362. ###
  4363. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4364. multimodule SANDBOX_TASK {
  4365. module SB_TASK_BIN: _PY2_PROGRAM {
  4366. PY_MAIN(sandbox.taskbox.binary)
  4367. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4368. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4369. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4370. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4371. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4372. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4373. when ($FAIL_PY2 == "yes") {
  4374. _OK=no
  4375. }
  4376. otherwise {
  4377. PEERDIR+=build/rules/py2_deprecation
  4378. }
  4379. ASSERT(_OK You are using deprecated Python2-only code (SANDBOX_TASK). Please consider rewriting to 2/3-compatible code.)
  4380. }
  4381. module PY2: PY2_LIBRARY {
  4382. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4383. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4384. }
  4385. }
  4386. # tag:sandbox-specific
  4387. multimodule SANDBOX_PY23_TASK {
  4388. module SB_TASK_BIN: _PY2_PROGRAM {
  4389. PY_MAIN(sandbox.taskbox.binary)
  4390. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4391. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4392. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4393. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4394. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4395. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4396. }
  4397. module PY2: PY2_LIBRARY {
  4398. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4399. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4400. OBJ_SUF=.py2
  4401. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  4402. PYTHON_TYPE_FOR_CYTHON=PY2
  4403. }
  4404. module PY3: PY3_LIBRARY {
  4405. when ($MSVC == "yes" || $CYGWIN == "yes") {
  4406. MODULE_PREFIX=py3
  4407. }
  4408. otherwise {
  4409. MODULE_PREFIX=libpy3
  4410. }
  4411. OBJ_SUF=.py3
  4412. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  4413. PYTHON_TYPE_FOR_CYTHON=PY2
  4414. PEERDIR(sandbox/sdk2)
  4415. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4416. }
  4417. }
  4418. # tag:sandbox-specific
  4419. ### @usage: SANDBOX_PY3_TASK([Name])
  4420. ###
  4421. ### Multimodule describing Sandbox task (Python3 code that can be executed by Sandbox system).
  4422. ###
  4423. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_PY3_TASKs as libraries.
  4424. ### The final artifact is provided when SANDBOX_PY3_TASK is referred to by DEPENDS and BUNDLE macros.
  4425. ### As PEERDIR target, it works like regular PY3_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_PY3_TASKs.
  4426. ###
  4427. ### Currently Sandbox supports Python 3.x only in binary tasks, both variants will be compatible only with Python 3.x and py23 libraries
  4428. ### and will select multimodule variants accordingly.
  4429. ###
  4430. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4431. multimodule SANDBOX_PY3_TASK {
  4432. module SB_TASK_BIN: PY3_PROGRAM_BIN {
  4433. PY_MAIN(sandbox.taskbox.binary)
  4434. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/taskbox/worker)
  4435. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4436. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4437. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4438. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4439. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4440. }
  4441. module PY3: PY3_LIBRARY {
  4442. PEERDIR(sandbox/sdk2)
  4443. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4444. }
  4445. }
  4446. # tag:python-specific tag:internal
  4447. NO_PYTHON_INCLS=no
  4448. ### @usage: NO_PYTHON_INCLUDES() # internal
  4449. ###
  4450. ### Disable dependencies on libraries providing Python headers.
  4451. ### This is only used in Python libraries themselves to avoid PEERDIR loops.
  4452. macro NO_PYTHON_INCLUDES() {
  4453. ENABLE(NO_PYTHON_INCLS)
  4454. }
  4455. # tag:python-specific
  4456. ### @usage: PYTHON2_ADDINCL()
  4457. ###
  4458. ### This macro adds include path for Python headers (Python 2.x variant) without PEERDIR.
  4459. ### This should be used in 2 cases only:
  4460. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4461. ### - In system Python libraries themselves since proper PEERDIR there may create a loop;
  4462. ### In all other cases use USE_PYTHON2 macro instead.
  4463. ###
  4464. ### Never use this macro in PY2_PROGRAM, PY2_LIBRARY and PY23_LIBRARY: they have everything needed by default.
  4465. ###
  4466. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4467. macro PYTHON2_ADDINCL() {
  4468. _PYTHON_ADDINCL()
  4469. SET(MODULE_TAG PY2_NATIVE)
  4470. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4471. }
  4472. # tag:python-specific tag:internal
  4473. ### @usage: _ARCADIA_PYTHON_ADDINCL() # internal
  4474. ### This macro sets up Python headers for modules with Arcadia python (e.g. PY2_LIBRARY) and configures module as Python 2.x.
  4475. macro _ARCADIA_PYTHON_ADDINCL() {
  4476. _PYTHON_ADDINCL()
  4477. SET(MODULE_TAG PY2)
  4478. SET(PEERDIR_TAGS PY2 PY2_NATIVE PY_PROTO PY2_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4479. }
  4480. # tag:python-specific tag:internal
  4481. ### @usage: _PYTHON_ADDINCL() # internal
  4482. ### This macro sets up Python 2.x headers for both Arcadia and non-Arcadia python.
  4483. macro _PYTHON_ADDINCL() {
  4484. SET(PYTHON2 yes)
  4485. SET(PYTHON3 no)
  4486. when ($USE_ARCADIA_PYTHON == "yes") {
  4487. ADDINCL+=GLOBAL contrib/libs/python/Include
  4488. CFLAGS+=-DARCADIA_PYTHON_UNICODE_SIZE=$ARCADIA_PYTHON_UNICODE_SIZE
  4489. }
  4490. otherwise {
  4491. when ($USE_SYSTEM_PYTHON) {
  4492. PEERDIR+=build/platform/python
  4493. }
  4494. otherwise {
  4495. CFLAGS+=$PYTHON_INCLUDE
  4496. }
  4497. }
  4498. }
  4499. # tag:python-specific
  4500. ### @usage: PYTHON3_ADDINCL()
  4501. ###
  4502. ### This macro adds include path for Python headers (Python 3.x variant).
  4503. ### This should be used in 2 cases only:
  4504. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4505. ### - In system Python libraries themselves since peerdir there may create a loop;
  4506. ### In all other cases use USE_PYTHON3() macro instead.
  4507. ###
  4508. ### Never use this macro in PY3_PROGRAM and PY3_LIBRARY and PY23_LIBRARY: they have everything by default.
  4509. ###
  4510. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4511. macro PYTHON3_ADDINCL() {
  4512. _PYTHON3_ADDINCL()
  4513. SET(MODULE_TAG PY3_NATIVE)
  4514. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY3_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4515. }
  4516. # tag:python-specific tag:internal
  4517. ### @usage: _ARCADIA_PYTHON3_ADDINCL() # internal
  4518. ###
  4519. ### This macro sets up Python3 headers for modules with Arcadia python (e.g. PY3_LIBRARY) and configures module as Python 3.x.
  4520. macro _ARCADIA_PYTHON3_ADDINCL() {
  4521. _PYTHON3_ADDINCL()
  4522. SET(MODULE_TAG PY3)
  4523. SET(MODULE_LANG PY3)
  4524. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE PY3_PROTO PY3_FBS PY3_SSQLS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4525. }
  4526. # tag:python-specific tag:internal
  4527. ### @usage: _PYTHON_ADDINCL() # internal
  4528. ###
  4529. ### This macro sets up Python 3.x headers for both Arcadia and non-Arcadia python.
  4530. macro _PYTHON3_ADDINCL() {
  4531. SET(PYTHON3 yes)
  4532. SET(PYTHON2 no)
  4533. when ($USE_ARCADIA_PYTHON == "yes") {
  4534. CFLAGS+=-DUSE_PYTHON3
  4535. ADDINCL+=GLOBAL contrib/libs/python/Include
  4536. }
  4537. otherwise {
  4538. when ($USE_SYSTEM_PYTHON) {
  4539. PEERDIR+=build/platform/python
  4540. }
  4541. otherwise {
  4542. CFLAGS+=$PYTHON_INCLUDE
  4543. }
  4544. }
  4545. }
  4546. # tag:python-specific
  4547. ### @usage: USE_PYTHON2()
  4548. ###
  4549. ### This adds Python 2.x runtime library to your LIBRARY and makes it Python2-compatible.
  4550. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4551. ###
  4552. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4553. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4554. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4555. ###
  4556. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4557. macro USE_PYTHON2() {
  4558. _ARCADIA_PYTHON_ADDINCL()
  4559. SET(PEERDIR_TAGS PY2 PY2_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4560. PEERDIR(contrib/libs/python)
  4561. }
  4562. # tag:python-specific
  4563. ### @usage: USE_PYTHON3()
  4564. ###
  4565. ### This adds Python3 library to your LIBRARY and makes it Python3-compatible.
  4566. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4567. ###
  4568. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4569. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4570. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4571. ###
  4572. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4573. macro USE_PYTHON3() {
  4574. _ARCADIA_PYTHON3_ADDINCL()
  4575. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4576. PEERDIR(contrib/libs/python)
  4577. when ($USE_ARCADIA_PYTHON == "yes") {
  4578. PEERDIR+=library/python/runtime_py3
  4579. }
  4580. }
  4581. # tag:python-specific
  4582. when ($PERL_DEFAULT_PEERDIR == "yes") {
  4583. when (($PERLXS == "yes") || ($PERLXSCPP == "yes") || ($USE_PERL == "yes")) {
  4584. PEERDIR+=build/platform/perl
  4585. }
  4586. }
  4587. # tag:perl-specific
  4588. ### @usage: USE_PERL_LIB()
  4589. ### Add dependency on Perl to your LIBRARY
  4590. macro USE_PERL_LIB() {
  4591. PEERDIR(build/platform/perl)
  4592. }
  4593. # tag:perl-specific
  4594. ### @usage: USE_PERL_514_LIB()
  4595. ### Add dependency on Perl 5.14 to your LIBRARY
  4596. macro USE_PERL_514_LIB() {
  4597. SET(PERL_SDK ubuntu-12)
  4598. SET(PERL_DEFAULT_PEERDIR no)
  4599. PEERDIR(build/platform/perl/5.14)
  4600. }
  4601. # tag:perl-specific
  4602. ### @usage: ADD_PERL_MODULE(Dir ModuleName)
  4603. ### Add dependency on specified Perl module to the library
  4604. macro ADD_PERL_MODULE(Dir, Module) {
  4605. PEERDIR($Dir)
  4606. SET_APPEND(modules $Module)
  4607. }
  4608. # tag:allocator
  4609. ### @usage: ALLOCATOR(Alloc) # Default: LF
  4610. ###
  4611. ### Set memory allocator implementation for the PROGRAM()/DLL() module.
  4612. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
  4613. ###
  4614. ### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU".
  4615. ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
  4616. ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
  4617. ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
  4618. ### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
  4619. ### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
  4620. ### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
  4621. ### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
  4622. ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
  4623. ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
  4624. ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
  4625. ### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
  4626. ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
  4627. ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
  4628. ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
  4629. ### - SYSTEM - Use target system allocator
  4630. ### - FAKE - Don't link with any allocator
  4631. ###
  4632. ### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
  4633. macro ALLOCATOR(Alloc) {
  4634. SET(ALLOCATOR $Alloc)
  4635. 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" ]) {
  4636. }
  4637. otherwise {
  4638. PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
  4639. }
  4640. }
  4641. when ($MIC_ARCH == "yes") {
  4642. CFLAGS+=-mmic
  4643. LDFLAGS+=-mmic
  4644. }
  4645. when ($USE_OPENMP == "yes") {
  4646. PEERDIR+=contrib/libs/openmp
  4647. }
  4648. when ($STRIP == "yes" && $NO_STRIP != "yes") {
  4649. STRIP_FLAG=$LD_STRIP_FLAG
  4650. DWARF_COMMAND=
  4651. GO_LINK_FLAGS_VALUE+=-s
  4652. }
  4653. when ($NO_LINKER_DCE != "yes") {
  4654. DCE_FLAG=$LD_DCE_FLAG
  4655. }
  4656. when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
  4657. ICF_FLAG=$LD_ICF_FLAG
  4658. }
  4659. OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
  4660. STRIP_TOOL=$STRIP_TOOL_VENDOR
  4661. NEED_BINUTILS_PEERDIR=
  4662. BINUTILS_USED=
  4663. when (!$OBJCOPY_TOOL_VENDOR) {
  4664. OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
  4665. NEED_BINUTILS_PEERDIR=yes
  4666. }
  4667. when (!$STRIP_TOOL_VENDOR) {
  4668. STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
  4669. NEED_BINUTILS_PEERDIR=yes
  4670. }
  4671. SPLIT_DWARF_VALUE=no
  4672. NO_SPLIT_DWARF=no
  4673. when ($STRIP_DEBUG_INFO) {
  4674. SPLIT_DWARF_VALUE=yes
  4675. NO_SPLIT_DWARF=no
  4676. }
  4677. ### @usage: SPLIT_DWARF()
  4678. ###
  4679. ### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
  4680. ### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
  4681. macro SPLIT_DWARF() {
  4682. SET(SPLIT_DWARF_VALUE yes)
  4683. }
  4684. SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
  4685. when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
  4686. DWARF_COMMAND+= \
  4687. $OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
  4688. $STRIP_TOOL --strip-debug $TARGET && \
  4689. $OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
  4690. BINUTILS_USED=yes
  4691. }
  4692. ### @usage: EXTRALIBS_STATIC(Libs...)
  4693. ###
  4694. ### Add the specified external static libraries to the program link
  4695. macro EXTRALIBS_STATIC(Args...) {
  4696. LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
  4697. }
  4698. ### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
  4699. ###
  4700. ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
  4701. macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
  4702. __translatename_lower=${tolower:Name}
  4703. __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
  4704. RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
  4705. }
  4706. ### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
  4707. ###
  4708. ### Generate transliteration dictionary code
  4709. ### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
  4710. macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
  4711. __translitname_lower=${tolower:Name}
  4712. __translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
  4713. __untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
  4714. __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
  4715. __gentrie_dir=dict/tools/make_untranslit_trie
  4716. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
  4717. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
  4718. RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
  4719. }
  4720. # tag:python-specific tag:proto tag:deprecated
  4721. ### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated
  4722. ###
  4723. ### Generate python bindings for protobuf files.
  4724. ### Macro is obsolete and not recommended for use!
  4725. macro GENERATE_PY_PROTOS(FILES...) {
  4726. foreach (FILE : $FILES) {
  4727. _PY_PROTO_CMD($FILE)
  4728. }
  4729. }
  4730. # tag:python-specific tag:proto
  4731. macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) {
  4732. foreach (FILE : $FILES) {
  4733. _PY_PROTO_CMD_INTERNAL($FILE)
  4734. }
  4735. }
  4736. # tag:python-specific
  4737. macro _GENERATE_PY_EVS_INTERNAL(FILES...) {
  4738. foreach (FILE : $FILES) {
  4739. _PY_EVLOG_CMD_INTERNAL($FILE)
  4740. }
  4741. }
  4742. macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4743. .CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"}
  4744. .SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST}
  4745. }
  4746. ### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
  4747. ###
  4748. ### Copy file to build root. It is possible to change both location and the name.
  4749. ###
  4750. ### Parameters:
  4751. ### - File - Source file name.
  4752. ### - Destination - Output file name.
  4753. ### - AUTO - Consider copied file for further processing automatically.
  4754. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
  4755. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  4756. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type)
  4757. ### and set of dependencies
  4758. ###
  4759. ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
  4760. ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
  4761. macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4762. .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  4763. .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination)
  4764. }
  4765. ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
  4766. ###
  4767. ### Copy file to build root the same way as it is done for COPY_FILE, but also
  4768. ### propagates the context of the source file.
  4769. macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO":"", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4770. .CMD=$COPY_FILE($FILE $DEST $AUTO OUTPUT_INCLUDES $FILE $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  4771. }
  4772. ### This is to join $ALL_RES_ and $EXT
  4773. macro _ARF_HELPER(Args...) {
  4774. RESOURCE_FILES($Args)
  4775. }
  4776. ### @usage ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
  4777. ###
  4778. ### This macro collects all files with extension `Ext` and
  4779. ### Passes them to `RESOURCE_FILES` macro as relative to current directory
  4780. ###
  4781. ### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
  4782. ###
  4783. ### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
  4784. ### Note: Wildcards are not allowed neither as Ext nor in Dirs
  4785. macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
  4786. _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
  4787. _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}${pre=/:STRIP} ${pre=$ALL_RES_:EXT})
  4788. }
  4789. macro _BUNDLE_TARGET(Target, Destination) {
  4790. .CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
  4791. }
  4792. ### @usage: TIMEOUT(TIMEOUT)
  4793. ###
  4794. ### Sets a timeout on test execution
  4795. ###
  4796. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4797. macro TIMEOUT(Time) {
  4798. SET(TEST_TIMEOUT $Time)
  4799. }
  4800. SBR_UID_EXT=""
  4801. # tag:test
  4802. ### @usage: VALIDATE_DATA_RESTART(ext)
  4803. ###
  4804. ### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
  4805. ### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
  4806. macro VALIDATE_DATA_RESTART(Ext) {
  4807. SET(SBR_UID_EXT $Ext)
  4808. }
  4809. # tag:test
  4810. TEST_FORK_MODE=none
  4811. TEST_PARTITION=SEQUENTIAL
  4812. # tag:test
  4813. ### @usage: FORK_TESTS()
  4814. ###
  4815. ### Splits a test run on chunks by test classes.
  4816. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  4817. ###
  4818. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  4819. ###
  4820. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4821. macro FORK_TESTS(MODE...) {
  4822. SET(TEST_FORK_MODE tests)
  4823. SET(TEST_PARTITION $MODE)
  4824. }
  4825. # tag:test
  4826. ### @usage: FORK_SUBTESTS()
  4827. ###
  4828. ### Splits the test run in chunks on subtests.
  4829. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  4830. ###
  4831. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  4832. ###
  4833. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4834. macro FORK_SUBTESTS(MODE...) {
  4835. SET(TEST_FORK_MODE subtests)
  4836. SET(TEST_PARTITION $MODE)
  4837. }
  4838. # tag:test
  4839. ### @usage: SPLIT_FACTOR(x)
  4840. ###
  4841. ### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
  4842. ### If none of those is specified this macro implies FORK_TESTS().
  4843. ###
  4844. ### Supports C++ ut and PyTest.
  4845. ###
  4846. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4847. macro SPLIT_FACTOR(Factor) {
  4848. SET(TEST_SPLIT_FACTOR $Factor)
  4849. }
  4850. # tag:test
  4851. FORK_TEST_FILES_MODE=
  4852. ### @usage: FORK_TEST_FILES()
  4853. ###
  4854. ### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
  4855. ### Compatible with FORK_(SUB)TESTS.
  4856. ###
  4857. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4858. macro FORK_TEST_FILES() {
  4859. SET(FORK_TEST_FILES_MODE on)
  4860. }
  4861. # tag:test
  4862. TEST_SIZE_NAME=SMALL
  4863. ### @usage: SIZE(SMALL/MEDIUM/LARGE)
  4864. ###
  4865. ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
  4866. ### See documentation on test system for more details.
  4867. ###
  4868. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4869. macro SIZE(Type) {
  4870. SET(TEST_SIZE_NAME $Type)
  4871. }
  4872. ### @usage: JOIN_SRCS(Out Src...)
  4873. ###
  4874. ### Join set of sources into single file named Out and send it for further processing.
  4875. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  4876. ### You should specify file name with the extension as Out. Further processing will be done according this extension.
  4877. macro JOIN_SRCS(Out, Src...) {
  4878. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_join_srcs.py"} ${output:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  4879. .SEM=target_joined_source $Out ${input:Src} ${output;hide;suf=.o:Out}
  4880. _CONDITIONAL_SRCS($TIDY_VALUE $Src)
  4881. }
  4882. ### @usage: JOIN_SRCS_GLOBAL(Out Src...)
  4883. ###
  4884. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  4885. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  4886. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  4887. macro JOIN_SRCS_GLOBAL(Out, Src...) {
  4888. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_join_srcs.py"} ${output;noauto:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  4889. SRCS(GLOBAL $Out)
  4890. }
  4891. ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
  4892. ###
  4893. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  4894. ### This macro places all files into single file, so will work with any sources.
  4895. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  4896. macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
  4897. .CMD=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} cat ${output;noauto:Out} --ya-start-command-file ${input:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  4898. SRCS(GLOBAL $Out)
  4899. }
  4900. # tag:cpu
  4901. PIC_CFLAGS=
  4902. SSE2_CFLAGS=
  4903. SSE3_CFLAGS=
  4904. SSSE3_CFLAGS=
  4905. SSE41_CFLAGS=
  4906. SSE42_CFLAGS=
  4907. POPCNT_CFLAGS=
  4908. PCLMUL_CFLAGS=
  4909. CX16_FLAGS=
  4910. AVX_CFLAGS=
  4911. AVX2_CFLAGS=
  4912. AVX512_CFLAGS=
  4913. # tag:cpu
  4914. SSE_DEFINES=
  4915. SSE_CFLAGS=
  4916. SSE4_DEFINES=
  4917. SSE4_CFLAGS=
  4918. XOP_CFLAGS=
  4919. NO_LTO_CFLAGS=
  4920. # tag:cpu
  4921. when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
  4922. when ($CLANG || $CLANG_CL || $GCC) {
  4923. PIC_CFLAGS=-fPIC
  4924. SSE2_CFLAGS=-msse2
  4925. SSE3_CFLAGS=-msse3
  4926. SSSE3_CFLAGS=-mssse3
  4927. SSE41_CFLAGS=-msse4.1
  4928. SSE42_CFLAGS=-msse4.2
  4929. XOP_CFLAGS=-mxop
  4930. POPCNT_CFLAGS=-mpopcnt
  4931. PCLMUL_CFLAGS=-mpclmul
  4932. AVX_CFLAGS=-mavx
  4933. # On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell.
  4934. # See:
  4935. # https://en.wikipedia.org/wiki/FMA_instruction_set
  4936. # https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
  4937. #
  4938. # AMD implemented FMA3 in Piledriver architecture over AVX (that is, prior to AVX-2 which was introduced in Zen).
  4939. # BMI2 implementation was released by AMD along with AVX-2 support.
  4940. # See:
  4941. # https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
  4942. #
  4943. # Due to the above, it looks safe to enable all three extensions whenever AVX-2 is enabled.
  4944. AVX2_CFLAGS=-mavx2 -mfma -mbmi -mbmi2
  4945. # All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
  4946. # (these are Xeon Phi)
  4947. # See:
  4948. # https://en.wikichip.org/wiki/x86/avx-512
  4949. AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
  4950. when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
  4951. CX16_FLAGS=-mcx16
  4952. }
  4953. SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
  4954. SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
  4955. }
  4956. elsewhen ($MSVC) {
  4957. SSE2_CFLAGS=/D__SSE2__=1
  4958. SSE3_CFLAGS=/D__SSE3__=1
  4959. SSSE3_CFLAGS=/D__SSSE3__=1
  4960. SSE41_CFLAGS=/D__SSE4_1__=1
  4961. SSE42_CFLAGS=/D__SSE4_2__=1
  4962. POPCNT_CFLAGS=/D__POPCNT__=1
  4963. PCLMUL_CFLAGS=/D__PCLMUL__=1
  4964. AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
  4965. AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
  4966. AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
  4967. SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
  4968. SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
  4969. }
  4970. SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
  4971. SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
  4972. when ($ARCH_I386 && $OS_ANDROID == "yes") {
  4973. USE_SSE4=no
  4974. }
  4975. }
  4976. otherwise {
  4977. USE_SSE4=no
  4978. CPU_CHECK=no
  4979. }
  4980. # tag:cpu
  4981. when ($NOSSE == "yes") {
  4982. USE_SSE4=no
  4983. }
  4984. # tag:cpu
  4985. ### @usage: NO_SSE4()
  4986. ###
  4987. ### Compile module without SSE4
  4988. macro NO_SSE4() {
  4989. SET(USE_SSE4 no)
  4990. }
  4991. # tag:cpu
  4992. ### @usage: NO_CPU_CHECK()
  4993. ###
  4994. ### Compile module without startup CPU features check
  4995. macro NO_CPU_CHECK() {
  4996. SET(CPU_CHECK no)
  4997. }
  4998. ### @usage: ADDINCLSELF()
  4999. ###
  5000. ### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
  5001. macro ADDINCLSELF(FOR="") {
  5002. when($FOR) {
  5003. ADDINCL+=FOR $FOR ${MODDIR}
  5004. }
  5005. otherwise {
  5006. ADDINCL+=${MODDIR}
  5007. }
  5008. }
  5009. COMPILE_OUT_SUFFIX=
  5010. _COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
  5011. _COMPILE_TIME_TRACE_OUTPUTS=${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
  5012. macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?";norel":"") {
  5013. SET(_COMPILE_OUTPUTS \${output;suf=\${OBJECT_SUF}$NOREL:SRC})
  5014. SET(_COMPILE_TIME_TRACE_OUTPUTS \${output;noauto;suf=\${OBJECT_SUF}.time_trace.json$NOREL:SRC})
  5015. }
  5016. # tag:internal
  5017. ### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
  5018. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " before $Args when GENERATE
  5019. ### is specified in the list of actual arguments
  5020. macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
  5021. .SEM=$GENERATE $Args
  5022. }
  5023. # tag:internal
  5024. ### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
  5025. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " if Args is not empty
  5026. macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
  5027. .SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
  5028. }
  5029. _EMPTY_CMD=
  5030. # tag:src-processing tag:internal
  5031. ### @usage: _SRC(Ext Src Flags) # internal
  5032. ###
  5033. ### Basic building block of extension-based command dispatching
  5034. ### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
  5035. ### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
  5036. ### of other commands (except ones marked as noauto)
  5037. macro _SRC(EXT, SRC, SRCFLAGS...) {
  5038. # Generic macro definition for _SRC (just a placeholder, it does nothing)
  5039. }
  5040. _SWIG_CMD=$_SWIG_PYTHON_CMD
  5041. _SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
  5042. _SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
  5043. _SWIG_PYTHON_CMD=${_SWIG_TOOL} -module ${REALPRJNAME} -cpperraswarn -c++ -python -interface ${MODULE_PREFIX}${REALPRJNAME} -o ${output;noext;main;suf=_wrap.swg.cpp:SRC} ${output;noauto;add_to_outs;hide;tobindir;suf=.py:REALPRJNAME} -outdir ${BINDIR} ${pre=-I:_SWIG__INCLUDE} ${input:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5044. _SWIG_PYTHON_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/python FOR swig ${_SWIG_LIBRARY}
  5045. _SWIG_PYTHON_PEERDIR=
  5046. _SWIG_PERL_CMD=${_SWIG_TOOL} -c++ -cpperraswarn -module ${REALPRJNAME} -shadow -perl -o ${output;noext;main;suf=_wrap.swg.cpp:SRC} ${output;noauto;add_to_outs;hide;tobindir;suf=.pm:REALPRJNAME} -outdir ${ARCADIA_BUILD_ROOT}/${MODDIR} ${pre=-I:_SWIG__INCLUDE} ${input:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5047. _SWIG_PERL_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/perl5 FOR swig ${_SWIG_LIBRARY}
  5048. _SWIG_PERL_PEERDIR=build/platform/perl
  5049. _SWIG_JNI_CPP_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --out-header ${output;main;noext;suf=_wrap.swg.h:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${output;noext;suf=_wrap.swg.cpp:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5050. _SWIG_JNI_JAVA_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} --jsrc ${output;main;suf=.jsrc:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${BINDIR}/unused.cpp ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5051. _SWIG_JNI_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --out-header ${output;main;noext;suf=_wrap.swg.h:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} --jsrc ${output;suf=.jsrc:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${output;noext;suf=_wrap.swg.cpp:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5052. _SWIG_JNI_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/java FOR swig $_SWIG_LIBRARY
  5053. _SWIG_JNI_PEERDIR=$YMAKE_PYTHON3_PEER contrib/libs/jdk
  5054. when ($USE_LOCAL_SWIG == "yes") {
  5055. _SWIG_JNI_ADDINCLS=
  5056. }
  5057. when ($USE_SYSTEM_JDK == "yes" || $OS_ANDROID == "yes") {
  5058. _SWIG_JNI_PEERDIR=$YMAKE_PYTHON3_PEER
  5059. }
  5060. # tag:src-processing
  5061. macro _SRC("swg", SRC, SRCFLAGS...) {
  5062. .CMD=${_SWIG_CMD}
  5063. .ADDINCL=${_SWIG_ADDINCLS}
  5064. .PEERDIR=${_SWIG_PEERDIR}
  5065. }
  5066. RODATA_SYMBOL_PREFIX=
  5067. when ($DARWIN == "yes" || $IOS == "yes" || ($WINDOWS == "yes" && $ARCH_TYPE_32 == "yes")) {
  5068. RODATA_SYMBOL_PREFIX=_
  5069. }
  5070. RODATA_ELF_FLAGS=
  5071. when($LINUX == "yes" || $ANDROID == "yes") {
  5072. RODATA_ELF_FLAGS=--elf
  5073. }
  5074. 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})
  5075. when (($ARCH_AARCH64 || $ARCH_ARM || $ARCH_PPC64LE) == "yes") {
  5076. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2cpp.py"} ${noext;nopath:SRC} ${input:SRC} ${output;suf=.cpp:SRC}
  5077. }
  5078. # tag:src-processing
  5079. macro _SRC("rodata", SRC, SRCFLAGS...) {
  5080. .CMD=$RODATA_COMPILE ${hide;kv:"p RD"} ${hide;kv:"pc light-green"}
  5081. .PEERDIR=$YMAKE_PYTHON3_PEER
  5082. .SEM=target_rodata_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC}
  5083. }
  5084. # tag:src-processing
  5085. macro _SRC("S", SRC, SRCFLAGS...) {
  5086. .CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output:SRC.o} ${input:SRC} ${pre=-I:_C__INCLUDE}
  5087. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5088. }
  5089. # tag:src-processing
  5090. macro _SRC("s", SRC, SRCFLAGS...) {
  5091. .CMD=$_SRC(S, $SRC $SRCFLAGS)
  5092. }
  5093. # tag:src-processing
  5094. macro _SRC("s79", SRC, SRCFLAGS...) {
  5095. .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
  5096. }
  5097. # tag:src-processing
  5098. macro _SRC("mm", SRC, SRCFLAGS...) {
  5099. .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
  5100. }
  5101. # tag:src-processing
  5102. macro _SRC("fml", SRC, SRCFLAGS...) {
  5103. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output:SRC.inc} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5104. }
  5105. # tag:src-processing
  5106. macro _SRC("fml2", SRC, SRCFLAGS...) {
  5107. .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"}
  5108. }
  5109. # tag:src-processing
  5110. macro _SRC("fml3", SRC, SRCFLAGS...) {
  5111. .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"}
  5112. }
  5113. # tag:src-processing
  5114. macro _SRC("sfdl", SRC, SRCFLAGS...) {
  5115. .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
  5116. }
  5117. # tag:src-processing
  5118. macro _SRC("xs", SRC, SRCFLAGS...) {
  5119. .CMD=$PERL_LD_LIBRARY_PATH $PERL $PERL_INCLUDE ${suf=/ExtUtils/xsubpp:PERL_PRIVLIB} -typemap ${suf=/ExtUtils/typemap:PERL_PRIVLIB} $PERLSUFFIX $XSUBPPFLAGS ${SRCFLAGS} ${input:SRC} $PERLOUTPUT ${kv;hide:"p XS"} ${kv;hide:"pc yellow"}
  5120. }
  5121. # tag:src-processing
  5122. macro _SRC("y", SRC, SRCFLAGS...) {
  5123. # .CMD=${tool:"contrib/tools/byacc"} $BYACC_FLAGS ${nopath;noext;output:SRC.cpp} ${input:SRC} ${nopath;noext;hide;output;addincl:SRC.h} ${kv;hide:"p YC"} ${kv;hide:"pc light-green"}
  5124. .CMD=${tool:"contrib/tools/bison/bison"} $BISON_FLAGS --m4=${tool:"contrib/tools/bison/m4"} --defines=${nopath;noext;output;main;addincl;norel:SRC.h} -o ${nopath;noext;output:SRC.cpp} ${input:SRC} ${SRCFLAGS} && $YMAKE_PYTHON ${input:"build/scripts/preprocess.py"} $_ADD_HIDDEN_INPUTS($CPP_BISON_SKELS) ${nopath;noext;tmp:SRC.h} ${kv;hide:"p YC"} ${kv;hide:"pc light-green"}
  5125. .SEM=target_bison_parser PRIVATE ${input:SRC} ${output;nopath;noext;hide;suf=${OBJ_SUF}.o:SRC} ${nopath;noext;output;hide:SRC.h} ${nopath;noext;output;addincl;hide:SRC.h} && set_global_flags BISON_FLAGS $BISON_FLAGS && conan_require bison/3.5.3 && conan_import '"bin, bison* -> ./bin/bison/bin"' && conan_import '"res, * -> ./bin/bison/res"'
  5126. }
  5127. # tag:src-processing
  5128. macro _SRC("ypp", SRC, SRCFLAGS...) {
  5129. .CMD=$_SRC(y $SRC $SRCFLAGS)
  5130. }
  5131. # tag:src-processing
  5132. macro _SRC("gperf", SRC, SRCFLAGS...) {
  5133. .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"}
  5134. }
  5135. # tag:src-processing
  5136. macro _SRC("rl", SRC, SRCFLAGS...) {
  5137. .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"}
  5138. }
  5139. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5140. .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"}
  5141. }
  5142. # tag:src-processing
  5143. macro _SRC("rl5", SRC, SRCFLAGS...) {
  5144. .CMD=$_SRC(rl $SRC $SRCFLAGS)
  5145. }
  5146. # tag:src-processing
  5147. macro _SRC("asp", SRC, SRCFLAGS...) {
  5148. .CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${kv;hide:"p HT"} ${kv;hide:"pc yellow"}
  5149. }
  5150. # tag:src-processing
  5151. macro _SRC("rl6", SRC, SRCFLAGS...) {
  5152. .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"}
  5153. .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 ragel/6.10 && conan_import '"bin, ragel* -> ./bin"'
  5154. }
  5155. # tag:src-processing
  5156. macro _SRC("l", SRC, SRCFLAGS...) {
  5157. .CMD=${tool:"contrib/tools/flex-old"} $LEX_FLAGS ${SRCFLAGS} -o${output:SRC.cpp} ${output_include;hide:"util/system/compiler.h"} ${input:SRC} ${kv;hide:"p LX"} ${kv;hide:"pc yellow"}
  5158. .ADDINCL=contrib/tools/flex-old
  5159. .SEM=target_flex_lexers ${tool;hide:"contrib/tools/flex-old"} ${output;hide;suf=${OBJ_SUF}.o:SRC} ${input:SRC} && set_global_flags LEX_FLAGS $LEX_FLAGS
  5160. }
  5161. # tag:src-processing
  5162. macro _SRC("lex", SRC, SRCFLAGS...) {
  5163. .CMD=$_SRC(l $SRC $SRCFLAGS)
  5164. }
  5165. # tag:src-processing
  5166. macro _SRC("lpp", SRC, SRCFLAGS...) {
  5167. .CMD=$_SRC(l $SRC $SRCFLAGS)
  5168. }
  5169. # tag:src-processing
  5170. macro _SRC("pln", SRC, SRCFLAGS...) {
  5171. .CMD=$FML_TOOL -b -o ${output;pre=pln.;nopath;noext:SRC.cpp} -f ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5172. }
  5173. # tag:src-processing
  5174. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5175. .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"}
  5176. }
  5177. # tag:src-processing
  5178. macro _SRC("ev", SRC, SRCFLAGS...) {
  5179. .CMD=$EVLOG_CMD($SRC)
  5180. }
  5181. # tag:src-processing
  5182. macro _SRC("proto", SRC, SRCFLAGS...) {
  5183. .CMD=$PROTO_CMD($SRC)
  5184. .SEM=$PROTO_CMD($SRC)
  5185. }
  5186. # tag:src-processing
  5187. macro _SRC("gztproto", SRC, SRCFLAGS...) {
  5188. # _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.
  5189. # descriptor.proto must be resolved as google/protobuf/descriptor.proto
  5190. .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"}
  5191. .PEERDIR=kernel/gazetteer/proto
  5192. }
  5193. # tag:src-processing
  5194. macro _SRC("cfgproto", SRC, SRCFLAGS...) {
  5195. .CMD=$_CPP_CFGPROTO_CMD($SRC)
  5196. }
  5197. # tag:src-processing
  5198. macro _SRC("pyx", SRC, SRCFLAGS...) {
  5199. # Copy-paste from BUILDWITH_CYTHON
  5200. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:SRC} -o ${output;tobindir:SRC.cpp} $CYTHON_OUTPUT_INCLUDES ${SRCFLAGS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5201. .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
  5202. .ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
  5203. }
  5204. # tag:src-processing
  5205. macro _SRC("in", SRC, SRCFLAGS...) {
  5206. .CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5207. .SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5208. }
  5209. macro MANUAL_GENERATION(Outs...) {
  5210. .SEM=ignored ${output;hide;noauto:Outs}
  5211. }
  5212. # tag:src-processing
  5213. macro _SRC("sc", SRC, SRCFLAGS...) {
  5214. .CMD=${tool:"tools/domschemec"} --in ${input:SRC} --out ${output;norel:SRC.h} ${output_include;hide:"util/generic/strbuf.h"} ${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"}
  5215. }
  5216. # tag:src-processing
  5217. macro _SRC("ssqls", SRC, SRCFLAGS...) {
  5218. .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"}
  5219. }
  5220. # tag:src-processing
  5221. macro _SRC("f", SRC, SRCFLAGS...) {
  5222. .CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${kv;hide:"p FT"} ${kv;hide:"pc light-green"}
  5223. .PEERDIR=contrib/libs/libf2c
  5224. .ADDINCL=contrib/libs/libf2c
  5225. }
  5226. # tag:src-processing
  5227. macro _SRC("cpp", SRC, SRCFLAGS...) {
  5228. .CMD=$_SRC_cpp($SRC $SRCFLAGS)
  5229. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5230. }
  5231. # tag:src-processing
  5232. macro _SRC("cxx", SRC, SRCFLAGS...) {
  5233. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5234. }
  5235. # tag:src-processing
  5236. macro _SRC("cc", SRC, SRCFLAGS...) {
  5237. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5238. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5239. }
  5240. # tag:src-processing
  5241. macro _SRC("C", SRC, SRCFLAGS...) {
  5242. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5243. }
  5244. # tag:src-processing
  5245. macro _SRC("c", SRC, SRCFLAGS...) {
  5246. .CMD=$_SRC_c($SRC $SRCFLAGS)
  5247. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
  5248. }
  5249. # tag:src-processing
  5250. macro _SRC("m", SRC, SRCFLAGS...) {
  5251. .CMD=$_SRC(c $SRC $SRCFLAGS)
  5252. }
  5253. # tag:src-processing
  5254. macro _SRC("masm", SRC, SRCFLAGS...) {
  5255. .CMD=$_SRC_masm($SRC $SRCFLAGS)
  5256. }
  5257. 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} \
  5258. && 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 \
  5259. && add_language ASM \
  5260. && conan_require yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5261. ASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS \
  5262. && 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 \
  5263. && add_language ASM \
  5264. && conan_require yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5265. # tag:src-processing
  5266. macro _SRC("yasm", SRC, SRCFLAGS...) {
  5267. .CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  5268. .SEM=$YASM_SEM
  5269. }
  5270. # tag:src-processing
  5271. macro _SRC("asm", SRC, SRCFLAGS...) {
  5272. .CMD=$_SRC(yasm $SRC $SRCFLAGS)
  5273. .SEM=$ASM_SEM
  5274. }
  5275. # tag:src-processing
  5276. macro _SRC("lua", SRC, SRCFLAGS...) {
  5277. .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"}
  5278. .PEERDIR=$LUAJIT_PATH
  5279. }
  5280. NVCC_STD_VER=14
  5281. when ($MSVC == "yes") {
  5282. NVCC_STD=/std:c++${NVCC_STD_VER}
  5283. }
  5284. otherwise {
  5285. NVCC_STD=-std=c++${NVCC_STD_VER}
  5286. }
  5287. # tag:src-processing
  5288. macro _SRC("cu", SRC, SRCFLAGS...) {
  5289. .CMD=$_SRC_CU_CMD
  5290. .SEM=target_cuda_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} && add_language CUDA && set_global_flags CMAKE_CUDA_STANDARD ${NVCC_STD_VER} && target_cuda_flags $CUDA_NVCC_FLAGS && target_cuda_cflags $USER_CXXFLAGS $SRCFLAGS
  5291. .PEERDIR=$_SRC_CU_PEERDIR
  5292. }
  5293. # tag:src-processing
  5294. macro _SRC("fbs", SRC, SRCFLAGS...) {
  5295. .CMD=$FBS_CMD($SRC, $SRCFLAGS)
  5296. .SEM=$FBS_CMD($SRC, $SRCFLAGS)
  5297. }
  5298. # tag:src-processing
  5299. macro _SRC("fbs64", SRC, SRCFLAGS...) {
  5300. .CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
  5301. }
  5302. # tag:src-processing
  5303. macro _SRC("pysrc", SRC, SRCFLAGS...) {
  5304. .CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
  5305. }
  5306. # tag:src-processing
  5307. macro _SRC_py2src(SRC, SRCFLAGS...) {
  5308. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${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"}
  5309. }
  5310. # tag:src-processing
  5311. macro _SRC_py3src(SRC, SRCFLAGS...) {
  5312. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${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"}
  5313. }
  5314. # tag:src-processing python-specific
  5315. when ($PYTHON3 == "yes") {
  5316. MACRO_ALIAS(_SRC_PYSRC _SRC_py3src)
  5317. }
  5318. otherwise {
  5319. MACRO_ALIAS(_SRC_PYSRC _SRC_py2src)
  5320. }
  5321. # tag:src-processing
  5322. macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
  5323. .CMD=$_SRC_C_NODEPS_CMD
  5324. }
  5325. # Custom flags for generated cpp-files. To support another generator:
  5326. # - insert additional file extension before .cpp into generated cpp-file name
  5327. # - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
  5328. #
  5329. # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
  5330. # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
  5331. #
  5332. # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
  5333. # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
  5334. ## tag:src-processing
  5335. _LANG_CFLAGS_FILTER=\
  5336. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
  5337. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
  5338. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
  5339. # tag:src-processing
  5340. # Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
  5341. macro _FILTER_EXTS(SKIP="", FLAGS...) {
  5342. .CMD=$FLAGS
  5343. }
  5344. # tag:src-processing
  5345. macro _LANG_CFLAGS(SRC) {
  5346. .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
  5347. }
  5348. # tag:src-processing
  5349. # ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
  5350. # Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
  5351. _LANG_CFLAGS_VALUE=
  5352. when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
  5353. _LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
  5354. }
  5355. # Allows to add single compilation unit name to the node's 'kv' section.
  5356. # This is used by the coverage machinery to instrument only the necessary sources
  5357. # when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
  5358. SCU_NAME_KV=
  5359. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  5360. SCU_NAME_KV=${hide;kv:"scu_name $KV_VAL"}
  5361. }
  5362. macro _ADD_SCU_NAME(KV_VAL) {
  5363. .CMD=$SCU_NAME_KV
  5364. }
  5365. # tag:src-processing
  5366. macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5367. .CMD=$_SRC_CPP_CMD $_ADD_SCU_NAME(${input:SRC})
  5368. }
  5369. # tag:src-processing
  5370. macro _SRC_c(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5371. .CMD=$_SRC_C_CMD $_ADD_SCU_NAME(${input:SRC})
  5372. }
  5373. # tag:src-processing
  5374. macro _SRC_m(SRC, SRCFLAGS...) {
  5375. .CMD=$_SRC_M_CMD
  5376. }
  5377. # tag:src-processing
  5378. macro _SRC_masm(SRC, SRCFLAGS...) {
  5379. .CMD=$_SRC_MASM_CMD
  5380. }
  5381. # tag:lua-specific
  5382. ### @usage: COMPILE_LUA(Src, [NAME <import_name>])
  5383. ###
  5384. ### Compile LUA source file to object code using LUA 2.0
  5385. ### Optionally override import name which is by default reflects Src name
  5386. macro COMPILE_LUA(Src, NAME="") {
  5387. .CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
  5388. }
  5389. # tag:lua-specific
  5390. ### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
  5391. ###
  5392. ### Compile LUA source file to object code using LUA 2.1
  5393. macro _SRC_lua_21(SRC, SRCFLAGS...) {
  5394. .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"}
  5395. .PEERDIR=$LUAJIT_21_PATH
  5396. }
  5397. # tag:lua-specific
  5398. ### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
  5399. ###
  5400. ### Compile LUA source file to object code using LUA 2.1
  5401. ### Optionally override import name which is by default reflects Src name
  5402. macro COMPILE_LUA_21(Src, NAME="") {
  5403. .CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
  5404. }
  5405. GETTEXT_KEEP_PATH=no
  5406. _MO_OUTPUT=
  5407. when ($GETTEXT_KEEP_PATH == "yes") {
  5408. _MO_OUTPUT=${output;noauto;norel;noext:SRC.mo}
  5409. }
  5410. otherwise {
  5411. _MO_OUTPUT=${output;noauto;nopath;noext;tobindir:SRC.mo}
  5412. }
  5413. # tag:src-processing
  5414. macro _SRC("po", SRC, SRCFLAGS...) {
  5415. .CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
  5416. }
  5417. # tag:ydl-specific
  5418. YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
  5419. YDL_DESC_FLAGS=
  5420. # tag:src-processing tag:ydl-specific
  5421. macro _SRC("ydl", SRC, SRCFLAGS...) {
  5422. .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"}
  5423. .PEERDIR+=statbox/ydl/runtime/cpp
  5424. }
  5425. # tag:ydl-specific
  5426. ### @usage BUILD_YDL_DESC(Input Symbol Output)
  5427. ###
  5428. ### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
  5429. ###
  5430. ### @example:
  5431. ###
  5432. ### PACKAGE()
  5433. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5434. ### END()
  5435. ###
  5436. ### 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.
  5437. macro BUILD_YDL_DESC(Input, Symbol, Output) {
  5438. .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"}
  5439. }
  5440. # tag:ydl-specific
  5441. ### @usage: YDL_DESC_USE_BINARY()
  5442. ###
  5443. ### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
  5444. ###
  5445. ### @example:
  5446. ###
  5447. ### PACKAGE()
  5448. ### YDL_DESC_USE_BINARY()
  5449. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5450. ### END()
  5451. ###
  5452. ### This will generate descriptor Event.ydld in a binary format.
  5453. macro YDL_DESC_USE_BINARY() {
  5454. YDL_DESC_FLAGS_BINARY= --binary
  5455. SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
  5456. }
  5457. ### @usage SRC(File Flags...)
  5458. ###
  5459. ### Compile single file with extra Flags.
  5460. ### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
  5461. macro SRC(FILE, FLAGS...) {
  5462. _SRC(${lastext:FILE} $FILE $FLAGS)
  5463. }
  5464. ### @usage: SRCS(<[GLOBAL] File> ...)
  5465. ###
  5466. ### 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.
  5467. ### Arcadia Paths from the root and is relative to the project's LIST are supported
  5468. ###
  5469. ### 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.
  5470. ### 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)
  5471. ###
  5472. ### @example:
  5473. ###
  5474. ### LIBRARY(test_global)
  5475. ### SRCS(GLOBAL foo.cpp)
  5476. ### END()
  5477. ###
  5478. ### 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.
  5479. macro SRCS(FILES...) {
  5480. foreach (FILE : $FILES) {
  5481. _SRC(${lastext:FILE} $FILE)
  5482. }
  5483. }
  5484. # tag:src-specific tag:cpp-specific
  5485. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5486. ###
  5487. ### Defenition of generic macro. Report an error that the File with Ext is not
  5488. ### supported by macro MacroName if no appropriate macro specialization is found.
  5489. macro _SRC_STRICT_C_CPP(EXT, MACRO_NAME, FILE, FLAGS...) {
  5490. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  5491. }
  5492. # tag:src-specific tag:cpp-specific
  5493. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5494. ###
  5495. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single C file (with .c extension)
  5496. macro _SRC_STRICT_C_CPP("c", MACRO_NAME, FILE, FLAGS...) {
  5497. _SRC(c $FILE $FLAGS)
  5498. }
  5499. # tag:src-specific tag:cpp-specific
  5500. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5501. ###
  5502. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cpp extension)
  5503. macro _SRC_STRICT_C_CPP("cpp", MACRO_NAME, FILE, FLAGS...) {
  5504. _SRC(cpp $FILE $FLAGS)
  5505. }
  5506. # tag:src-specific tag:cpp-specific
  5507. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5508. ###
  5509. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cxx extension)
  5510. macro _SRC_STRICT_C_CPP("cxx", MACRO_NAME, FILE, FLAGS...) {
  5511. _SRC(cpp $FILE $FLAGS)
  5512. }
  5513. # tag:src-specific tag:cpp-specific
  5514. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5515. ###
  5516. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cc extension)
  5517. macro _SRC_STRICT_C_CPP("cc", MACRO_NAME, FILE, FLAGS...) {
  5518. _SRC(cpp $FILE $FLAGS)
  5519. }
  5520. # tag:src-specific tag:cpp-specific
  5521. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5522. ###
  5523. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .C extension)
  5524. macro _SRC_STRICT_C_CPP("C", MACRO_NAME, FILE, FLAGS...) {
  5525. _SRC(cpp $FILE $FLAGS)
  5526. }
  5527. # tag:src-specific tag:cpp-specific tag:cpu
  5528. ### @uasge SRC_C_SSE2(File Flags...)
  5529. ###
  5530. ### Compile a single C/C++ file with SSE2 and additional Flags
  5531. macro SRC_C_SSE2(FILE, FLAGS...) {
  5532. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE2 $FILE $SSE2_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse2)
  5533. }
  5534. # tag:src-specific tag:cpp-specific tag:cpu
  5535. ### @uasge SRC_C_SSE3(File Flags...)
  5536. ###
  5537. ### Compile a single C/C++ file with SSE3 and additional Flags
  5538. macro SRC_C_SSE3(FILE, FLAGS...) {
  5539. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE3 $FILE $SSE3_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse3)
  5540. }
  5541. # tag:src-specific tag:cpp-specific tag:cpu
  5542. ### @uasge SRC_C_SSSE3(File Flags...)
  5543. ###
  5544. ### Compile a single C/C++ file with SSSE3 and additional Flags
  5545. macro SRC_C_SSSE3(FILE, FLAGS...) {
  5546. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSSE3 $FILE $SSSE3_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .ssse3)
  5547. }
  5548. # tag:src-specific tag:cpp-specific tag:cpu
  5549. ### @uasge SRC_C_SSE4(File Flags...)
  5550. ###
  5551. ### Compile a single C/C++ file with SSE4 and additional Flags
  5552. macro SRC_C_SSE4(FILE, FLAGS...) {
  5553. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE4 $FILE $SSE4_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse4)
  5554. }
  5555. # tag:src-specific tag:cpp-specific tag:cpu
  5556. ### @uasge SRC_C_SSE41(File Flags...)
  5557. ###
  5558. ### Compile a single C/C++ file with SSE4.1 and additional Flags
  5559. macro SRC_C_SSE41(FILE, FLAGS...) {
  5560. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE41 $FILE $SSE41_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse41)
  5561. }
  5562. # tag:src-specific tag:cpp-specific tag:cpu
  5563. ### @uasge SRC_C_AVX(File Flags...)
  5564. ###
  5565. ### Compile a single C/C++ file with AVX and additional Flags
  5566. macro SRC_C_AVX(FILE, FLAGS...) {
  5567. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_AVX $FILE $AVX_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx)
  5568. }
  5569. # tag:src-specific tag:cpp-specific tag:cpu
  5570. ### @uasge SRC_C_AVX2(File Flags...)
  5571. ###
  5572. ### Compile a single C/C++ file with AVX2 and additional Flags
  5573. macro SRC_C_AVX2(FILE, FLAGS...) {
  5574. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_AVX2 $FILE $AVX2_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx2)
  5575. }
  5576. # tag:src-specific tag:cpp-specific tag:cpu
  5577. ### @uasge SRC_C_AVX512(File Flags...)
  5578. ###
  5579. ### Compile a single C/C++ file with AVX512 and additional Flags
  5580. macro SRC_C_AVX512(FILE, FLAGS...) {
  5581. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_AVX512 $FILE $AVX512_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx512)
  5582. }
  5583. # tag:src-specific tag:cpp-specific tag:cpu
  5584. ### @uasge SRC_C_XOP(File Flags...)
  5585. ###
  5586. ### Compile a single C/C++ file with (an AMD-specific instruction set,
  5587. ### see https://en.wikipedia.org/wiki/XOP_instruction_set) and additional Flags
  5588. macro SRC_C_XOP(FILE, FLAGS...) {
  5589. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_XOP $FILE $XOP_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .xop)
  5590. }
  5591. # tag:src-specific tag:cpp-specific tag:cpu
  5592. ### @uasge SRC_C_PCLMUL(File Flags...)
  5593. ###
  5594. ### Compile a single C/C++ file with PCLMUL and additional Flags
  5595. macro SRC_C_PCLMUL(FILE, FLAGS...) {
  5596. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE $PCLMUL_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .pclmul)
  5597. }
  5598. # tag:src-specific tag:cpp-specific
  5599. ### @uasge SRC_C_PIC(File Flags...)
  5600. ###
  5601. ### Compile a single C/C++ file with -fPIC and additional Flags
  5602. macro SRC_C_PIC(FILE, FLAGS...) {
  5603. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PIC $FILE $PIC_CFLAGS $FLAGS)
  5604. }
  5605. # tag:src-specific tag:cpp-specific
  5606. ### @uasge SRC_C_NO_LTO(File Flags...)
  5607. ###
  5608. ### Compile a single C/C++ file with link-time-optimization disabling and additional Flags
  5609. macro SRC_C_NO_LTO(FILE, FLAGS...) {
  5610. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_NO_LTO $FILE $NO_LTO_CFLAGS $FLAGS)
  5611. }
  5612. # tag:python-processing tag:cython
  5613. # TODO: use it in [.pyx] cmd
  5614. ### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
  5615. ###
  5616. ### Generates .cpp file from .pyx.
  5617. macro BUILDWITH_CYTHON_CPP(Src, Options...) {
  5618. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir:Src.cpp} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5619. .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
  5620. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5621. }
  5622. # tag:python-processing tag:cython tag:internal
  5623. ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
  5624. ###
  5625. ### Generates .cpp file from .pyx and attach extra input Dep.
  5626. ### If Dep changes the .cpp file will be re-generated.
  5627. macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
  5628. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir:Src.cpp} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5629. .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
  5630. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5631. }
  5632. # tag:python-processing tag:cython
  5633. ### @usage: BUILDWITH_CYTHON_C(Src Options...)
  5634. ###
  5635. ### Generates .c file from .pyx.
  5636. macro BUILDWITH_CYTHON_C(Src, Options...) {
  5637. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir:Src.c} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5638. .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
  5639. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5640. }
  5641. # tag:python-processing tag:cython tag:internal
  5642. ### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
  5643. ###
  5644. ### Generates .c file from .pyx and attach extra input Dep.
  5645. ### If Dep changes the .c file will be re-generated.
  5646. macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
  5647. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir:Src.c} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5648. .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
  5649. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5650. }
  5651. # tag:python-processing tag:cython tag:internal
  5652. ### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
  5653. ###
  5654. ### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
  5655. macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
  5656. .CMD=$RUN_CYTHON_SCRIPT $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"}
  5657. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5658. }
  5659. # tag:python-processing tag:cython tag:internal
  5660. ### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
  5661. ###
  5662. ### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
  5663. macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
  5664. .CMD=$RUN_CYTHON_SCRIPT $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"}
  5665. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5666. }
  5667. # tag:python-processing tag:internal
  5668. ### @usage: _SWIG_PYTHON_CPP(Src, DstSubPrefix) # internal
  5669. ###
  5670. ### Run swig on Src to produce DstSubPrefix.py and DstSubPrefix_swg.cpp that
  5671. ### provides DstSubPrefix_swg python module.
  5672. macro _SWIG_PYTHON_CPP(Src, DstSubPrefix) {
  5673. .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -c++ -python -module ${nopath:DstSubPrefix} -interface ${nopath;suf=_swg:DstSubPrefix} -o ${output;suf=.swg.cpp:DstSubPrefix} ${input:Src} ${output;noauto;hide;suf=.py:DstSubPrefix} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5674. ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY)
  5675. }
  5676. # tag:python-processing tag:internal
  5677. ### @usage: _SWIG_PYTHON_C(Src, DstSubPrefix) # internal
  5678. ###
  5679. ### Like _SWIG_PYTHON_CPP but generate DstSubPrefix_swg.c.
  5680. macro _SWIG_PYTHON_C(Src, DstSubPrefix) {
  5681. .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -python -module ${nopath:DstSubPrefix} -interface ${nopath;suf=_swg:DstSubPrefix} -o ${output;suf=.swg.c:DstSubPrefix} ${input:Src} ${output;noauto;hide;suf=.py:DstSubPrefix} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5682. ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY)
  5683. }
  5684. ### @usage: BUILDWITH_RAGEL6(Src Options...)
  5685. ###
  5686. ### Compile .rl file using Ragel6.
  5687. macro BUILDWITH_RAGEL6(Src, Options...) {
  5688. .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"}
  5689. }
  5690. # tag:python-processing tag:internal
  5691. # TODO: use it in [.pyx] cmd
  5692. ### @usage: _PY_REGISTER() # internal
  5693. ###
  5694. ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
  5695. ###
  5696. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5697. macro _PY_REGISTER(Func) {
  5698. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5699. SRCS(GLOBAL $Func.reg.cpp)
  5700. }
  5701. # tag:python-processing tag:internal
  5702. ### @usage: _PY3_REGISTER() # internal
  5703. ###
  5704. ### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
  5705. ###
  5706. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5707. macro _PY3_REGISTER(Func) {
  5708. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${output;noauto:Func.reg3.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5709. SRCS(GLOBAL $Func.reg3.cpp)
  5710. }
  5711. # tag:python-processing tag:internal
  5712. ### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
  5713. ###
  5714. ### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
  5715. ###
  5716. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5717. macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
  5718. .CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5719. }
  5720. # tag:python-processing tag:internal
  5721. ### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
  5722. ###
  5723. ### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
  5724. ###
  5725. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5726. macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
  5727. .CMD=${env:"PYTHONHASHSEED=0"} ${tool:"contrib/tools/python3/pycc"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc3} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5728. }
  5729. macro _ARCHIVE_SEM_HELPER(OUT, DONTCOMPRESS, Files...) {
  5730. .SEM=add_custom_command OUTPUT ${OUT} DEPENDS ${Files} COMMAND $ARCH_TOOL -q $DONTCOMPRESS ${join=\: :Files}: -o ${OUT}
  5731. }
  5732. ### @usage: ARCHIVE_ASM(NAME archive_name files...)
  5733. ###
  5734. ### Similar to the macro ARCHIVE, but:
  5735. ### 1. works faster and it is better to use for large files.
  5736. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
  5737. macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  5738. .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;chksum;suf=$OBJ_SUF.rodata:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"}
  5739. .SEM=$_ARCHIVE_SEM_HELPER(${output;suf=$OBJ_SUF.rodata:NAME}, $DONTCOMPRESS, ${input:Files})
  5740. }
  5741. # tag:yweb-specific
  5742. macro PIRE_INLINE_CMD(SRC) {
  5743. .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"}
  5744. }
  5745. # tag:yweb-specific
  5746. macro PIRE_INLINE(FILES...) {
  5747. foreach (FILE : $FILES) {
  5748. PIRE_INLINE_CMD($FILE)
  5749. }
  5750. }
  5751. ### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
  5752. ###
  5753. ### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  5754. ###
  5755. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  5756. macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  5757. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;chksum;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  5758. .SEM=$_ARCHIVE_SEM_HELPER(${output;addincl;noauto:NAME}, $DONTCOMPRESS, ${input:Files})
  5759. }
  5760. ### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
  5761. ###
  5762. ### Add arbitrary data to a module be accessible by specified key.
  5763. ### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  5764. ###
  5765. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  5766. macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", Files...) {
  5767. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;chksum;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  5768. }
  5769. #scripts
  5770. #special commands
  5771. BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
  5772. SVNVERSION_JAVA_MARKER=output-java-class
  5773. SVNVERSION_GO_MARKER=output-go
  5774. VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
  5775. VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
  5776. VCS_C=$BINDIR/__vcs_version__.c
  5777. VCS_GO=$BINDIR/__vcs_version__.go
  5778. VCS_JAVA=$BINDIR/__vcs_version__.mf
  5779. VCS_INFO_DISABLE_CACHE__NO_UID__=
  5780. YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  5781. CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  5782. CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
  5783. YASM_DEBUG_INFO=
  5784. CL_DEBUG_INFO=
  5785. CL_MACRO_INFO=
  5786. when ($FORCE_VCS_INFO_UPDATE == "yes") {
  5787. VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
  5788. }
  5789. ### Works for pyton too.
  5790. GENERATE_VCS_C_INFO_NODEP=$YMAKE_PYTHON ${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))
  5791. GENERATE_VCS_GO_INFO_NODEP=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} output-go $(VCS)/vcs.json $VCS_GO $VCS_INFO_DISABLE_CACHE__NO_UID__
  5792. 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__
  5793. macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
  5794. .CMD=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
  5795. }
  5796. ### @usage: CREATE_BUILDINFO_FOR(GenHdr)
  5797. ###
  5798. ### Creates header file to access some information about build specified via configuration variables.
  5799. ### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
  5800. macro CREATE_BUILDINFO_FOR(GenHdr) {
  5801. .CMD=$YIELD $CXX_COMPILER && $YIELD $CXXFLAGS && $XARGS $YMAKE_PYTHON ${input:BUILDVERSION_SCRIPT} ${output:GenHdr} ${kv;hide:"p BI"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"} $SVN_DEPENDS_CACHE__NO_UID__
  5802. .SEM=$PYTHON($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
  5803. }
  5804. DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
  5805. DECIMAL_MD5_FIXED=
  5806. ### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
  5807. ###
  5808. ### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
  5809. ### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
  5810. macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
  5811. .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;chksum:File} ${kv;hide:"p SV"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"}
  5812. }
  5813. # tag:internal
  5814. ### @usage $CFG_VARS # internal
  5815. ###
  5816. ### Mark commands that embed Configuration variables into files
  5817. macro CFG_VARS() {
  5818. .GEN_FROM_FILE=yes
  5819. }
  5820. ### @usage: CONFIGURE_FILE(from to)
  5821. ###
  5822. ### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
  5823. ### The values are collected during configure stage, while replacement itself happens during build stage.
  5824. ### Used implicitly for .in-files processing.
  5825. macro CONFIGURE_FILE(Src, Dst) {
  5826. .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"}
  5827. .SEM=set_vars ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;rootrel:Dst}
  5828. }
  5829. ### @usage: BASE_CODEGEN(tool_path prefix)
  5830. ###
  5831. ### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in.
  5832. macro BASE_CODEGEN(Tool, Prefix, Opts...) {
  5833. .CMD=${tool:Tool} ${input:Prefix.in} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc yellow"}
  5834. }
  5835. # tag:internal
  5836. ### @usage: _SPLIT_CODEGEN_BASE(tool prefix OUTS[] OUTPUT_INCLUDES[]) # internal
  5837. ###
  5838. ### Generator of a certain number .the. cpp file + one header .h file from .in.
  5839. ### This is the call of the generator. Python macro SPLIT_CODEGEN() is defined in order to properly fill command outputs from OUT_NUM argument.
  5840. macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) {
  5841. .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"}
  5842. }
  5843. STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \
  5844. ${output_include;hide:"util/generic/strbuf.h"} \
  5845. ${output_include;hide:"util/generic/vector.h"} \
  5846. ${output_include;hide:"util/generic/ptr.h"} \
  5847. ${output_include;hide:"util/generic/yexception.h"} \
  5848. ${output_include;hide:"kernel/struct_codegen/reflection/reflection.h"} \
  5849. ${output_include;hide:"kernel/struct_codegen/reflection/floats.h"}
  5850. ### @usage: STRUCT_CODEGEN(Prefix)
  5851. ### A special case BASE_CODEGEN, in which the kernel/struct_codegen/codegen_tool tool is used.
  5852. macro STRUCT_CODEGEN(Prefix) {
  5853. .CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES)
  5854. .PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection
  5855. }
  5856. ### @usage: DUMPERF_CODEGEN(Prefix)
  5857. ### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used
  5858. macro DUMPERF_CODEGEN(Prefix) {
  5859. .CMD=$BASE_CODEGEN(extsearch/images/robot/tools/dumperf/codegen, $Prefix, ${output_include;hide:"extsearch/images/kernel/erf/erf_format.h"})
  5860. }
  5861. # tag:flags
  5862. ### @usage: LDFLAGS(LinkerFlags...)
  5863. ###
  5864. ### Add flags to the link command line of executable or shared library/dll.
  5865. ### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
  5866. ### Note: remember about the incompatibility of flags for gcc and cl.
  5867. macro LDFLAGS(Flags...) {
  5868. SET_APPEND(LDFLAGS_GLOBAL $Flags)
  5869. }
  5870. # tag:flags
  5871. ### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
  5872. ###
  5873. ### Add the specified flags to the compilation command of C and C++ files.
  5874. ### @params: GLOBAL - Propagates these flags to dependent projects
  5875. ### Note: remember about the incompatibility flags for clang and cl (to set flags specifically for cl.exe use MSVC_FLAGS).
  5876. macro CFLAGS(Flags...) {
  5877. SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
  5878. }
  5879. # tag:flags
  5880. ### @usage: MASMFLAGS(compiler flags)
  5881. ### Add the specified flags to the compilation command of .masm files.
  5882. macro MASMFLAGS(Flags...) {
  5883. SET_APPEND(MASMFLAGS $Flags)
  5884. }
  5885. # tag:flags
  5886. ### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
  5887. ### Add the specified flags to the compilation command of .c (but not .cpp) files.
  5888. ### @params: GLOBAL - Distributes these flags on dependent projects
  5889. macro CONLYFLAGS(Flags...) {
  5890. SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
  5891. }
  5892. # tag:flags
  5893. ### @usage: CXXFLAGS(compiler_flags)
  5894. ### Add the specified flags to the compilation command of .cpp (but not .c) files.
  5895. macro CXXFLAGS(Flags...) {
  5896. SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
  5897. }
  5898. # tag:flags
  5899. ### @usage: CUDA_NVCC_FLAGS(compiler flags)
  5900. ### Add the specified flags to the compile line .cu-files.
  5901. macro CUDA_NVCC_FLAGS(Flags...) {
  5902. SET_APPEND(CUDA_NVCC_FLAGS $Flags)
  5903. }
  5904. # tag:flags
  5905. ### @usage: NVCC_DEVICE_LINK(file.cu...)
  5906. ### Run nvcc --device-link on objects compiled from srcs with --device-c.
  5907. ### This generates a stub object devlink.o that supplies missing pieces for the
  5908. ### host linker to link relocatable device objects into the final executable.
  5909. macro NVCC_DEVICE_LINK(Srcs...) {
  5910. .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"}
  5911. }
  5912. ### @usage: STRIP()
  5913. ### Strip debug info from a PROGRAM, DLL or TEST.
  5914. ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
  5915. macro STRIP() {
  5916. ENABLE(STRIP)
  5917. }
  5918. ### @usage: NO_OPTIMIZE()
  5919. ### Build code without any optimizations (-O0 mode).
  5920. macro NO_OPTIMIZE() {
  5921. ENABLE(NO_OPTIMIZE)
  5922. }
  5923. ### @usage: NO_COMPILER_WARNINGS()
  5924. ### Disable all compiler warnings in the module.
  5925. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5926. macro NO_COMPILER_WARNINGS() {
  5927. ENABLE(NO_COMPILER_WARNINGS)
  5928. }
  5929. ### @usage: WERROR()
  5930. ### Consider warnings as errors in the current module.
  5931. ### In the bright future will be removed, since WERROR is the default.
  5932. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5933. macro WERROR() {
  5934. ENABLE(WERROR)
  5935. }
  5936. ### @usage: NO_WERROR()
  5937. ### Override WERROR() behavior
  5938. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5939. macro NO_WERROR() {
  5940. DISABLE(WERROR)
  5941. }
  5942. ### @usage: NO_WSHADOW()
  5943. ### Disable C++ shadowing warnings.
  5944. macro NO_WSHADOW() {
  5945. ENABLE(NO_WSHADOW)
  5946. }
  5947. # tag:internal
  5948. ### @usage: NO_PLATFORM_RESOURCES() # internal
  5949. ### Exclude dependency on platform resources libraries.
  5950. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  5951. macro NO_PLATFORM_RESOURCES() {
  5952. ENABLE(NOPLATFORM_RESOURCES)
  5953. }
  5954. # tag:internal tag:codenav
  5955. ### @usage: NO_CODENAVIGATION() # internal
  5956. ### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
  5957. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  5958. macro NO_CODENAVIGATION() {
  5959. ENABLE(NOCODENAVIGATION)
  5960. }
  5961. ### @usage: NO_UTIL()
  5962. ### Build module without dependency on util.
  5963. ### Note: use this with care. Util most likely will be linked into executable anyway,
  5964. ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
  5965. macro NO_UTIL() {
  5966. ENABLE(NOUTIL)
  5967. }
  5968. ### @usage: NO_RUNTIME()
  5969. ###
  5970. ### This macro:
  5971. ### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
  5972. ### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
  5973. ### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
  5974. ### may not be detected at build time and may lead to unpredictable behavors at configure time.
  5975. macro NO_RUNTIME() {
  5976. SET(USE_ARCADIA_LIBM no)
  5977. NO_UTIL()
  5978. ENABLE(NORUNTIME)
  5979. }
  5980. ### @usage: NO_LIBC()
  5981. ###
  5982. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
  5983. ### Note: use this with care. libc most likely will be linked into executable anyway,
  5984. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  5985. macro NO_LIBC() {
  5986. NO_RUNTIME()
  5987. DISABLE(MUSL)
  5988. }
  5989. ### @usage: NO_PLATFORM()
  5990. ###
  5991. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
  5992. ### Note: use this with care. libc most likely will be linked into executable anyway,
  5993. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  5994. macro NO_PLATFORM() {
  5995. NO_LIBC()
  5996. ENABLE(NOPLATFORM)
  5997. }
  5998. # tag:cpp-specific
  5999. ### @usage: USE_CXX()
  6000. ###
  6001. ### Add dependency on C++ runtime
  6002. ### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
  6003. macro USE_CXX() {
  6004. DISABLE(NORUNTIME)
  6005. }
  6006. ### @usage: USE_UTIL()
  6007. ###
  6008. ### Add dependency on util and C++ runtime
  6009. ### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
  6010. macro USE_UTIL() {
  6011. USE_CXX()
  6012. DISABLE(NOUTIL)
  6013. }
  6014. # tag:deprecated
  6015. ### @usage: NO_JOIN_SRC() # deprecated, does-nothing
  6016. ### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
  6017. macro NO_JOIN_SRC() {
  6018. ENABLE(UNUSED_MACRO)
  6019. }
  6020. # tag:deprecated
  6021. ### @usage: JOINSRC() # deprecated, does-nothing
  6022. ### This macro currently does nothing. Use JOIN_SRCS and similar macros to make one file of set of sources.
  6023. macro JOINSRC() {
  6024. ENABLE(UNUSED_MACRO)
  6025. }
  6026. # tag:sanitize
  6027. ### @usage: NO_SANITIZE()
  6028. ###
  6029. ### Disable all sanitizers for the module.
  6030. macro NO_SANITIZE() {
  6031. DISABLE(SANITIZER_TYPE)
  6032. }
  6033. # tag:coverage tag:sanitize
  6034. ### @usage: NO_SANITIZE_COVERAGE()
  6035. ###
  6036. ### Disable lightweight coverage (-fsanitize-coverage) for the module.
  6037. macro NO_SANITIZE_COVERAGE() {
  6038. DISABLE(SANITIZE_COVERAGE)
  6039. }
  6040. # tag:coverage
  6041. ### @usage: NO_CLANG_COVERAGE()
  6042. ###
  6043. ### Disable heavyweight clang coverage for the module
  6044. macro NO_CLANG_COVERAGE() {
  6045. DISABLE(CLANG_COVERAGE)
  6046. }
  6047. macro NO_CLANG_TIDY() {
  6048. DISABLE(TIDY)
  6049. }
  6050. # tag:python-specific tag:coverage
  6051. ### @usage: NO_PYTHON_COVERAGE()
  6052. ###
  6053. ### Disable python coverage for module
  6054. macro NO_PYTHON_COVERAGE() {
  6055. DISABLE(PYTHON_COVERAGE)
  6056. }
  6057. # tag:python-specific tag:coverage tag:cython
  6058. ### @usage: NO_CYTHON_COVERAGE()
  6059. ###
  6060. ### Disable cython and cythonized python coverage (CYTHONIZE_PY)
  6061. ### Implies NO_CLANG_COVERAGE() - right now, we can't disable instrumentation for .py.cpp files, but enable for .cpp
  6062. macro NO_CYTHON_COVERAGE() {
  6063. DISABLE(CYTHON_COVERAGE)
  6064. NO_CLANG_COVERAGE()
  6065. }
  6066. # tag:lua-specific
  6067. LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
  6068. macro _LUAJIT_OBJDUMP(Src, OUT="") {
  6069. .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"}
  6070. }
  6071. # tag:lua-specific
  6072. LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
  6073. macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
  6074. .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"}
  6075. }
  6076. macro _MX_BIN_TO_INFO(Src) {
  6077. .CMD=${tool:"tools/mx_bin2info"} ${input:Src} ${output;nopath;noext;noauto:Src.info} ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
  6078. }
  6079. MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \
  6080. ${output_include;hide:"kernel/matrixnet/mn_sse.h"} \
  6081. ${output_include;hide:"library/cpp/archive/yarchive.h"} \
  6082. ${output_include;hide:"util/memory/blob.h"} \
  6083. ${output_include;hide:"util/generic/hash.h"} \
  6084. ${output_include;hide:"util/generic/ptr.h"} \
  6085. ${output_include;hide:"util/generic/singleton.h"}
  6086. macro _MX_GEN_TABLE(Srcs...) {
  6087. .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"}
  6088. PEERDIR(kernel/matrixnet)
  6089. PEERDIR(library/cpp/archive)
  6090. }
  6091. RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"}
  6092. ### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
  6093. ###
  6094. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
  6095. ###
  6096. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6097. macro GENERATE_ENUM_SERIALIZATION(File) {
  6098. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;chksum;suf=_serialized.cpp:File} ${output_include;hide:File} ${output_include;hide:"util/generic/serialized_enum.h"} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  6099. .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser/bin"}
  6100. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6101. }
  6102. ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
  6103. ###
  6104. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
  6105. ### Provide access to serialization functions via generated header File_serialized.h
  6106. ###
  6107. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6108. macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
  6109. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;chksum;suf=_serialized.cpp:File} --header ${output;chksum;suf=_serialized.h:File} ${output_include;hide:File} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  6110. .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/bin"}
  6111. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6112. }
  6113. ### @usage: DEB_VERSION(File)
  6114. ###
  6115. ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
  6116. macro DEB_VERSION(File) {
  6117. .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"}
  6118. }
  6119. BUILD_MN_SCRIPT=build/scripts/build_mn.py
  6120. # tag:matrixnet
  6121. ### @usage: BUILD_MN([CHECK] [PTR] [MULTI] mninfo mnname) # matrixnet
  6122. ###
  6123. ### Generate MatrixNet data and access code using single command.
  6124. ### Alternative macro BUILD_MNS() works faster and better for large files.
  6125. macro BUILD_MN(MnInfo, MnName, CHECK?"fml_tool=$FML_UNUSED_TOOL CHECK":"", MULTI?, PTR?, RANKING_SUFFIX="") {
  6126. .CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnF $ARCADIA_ROOT $ARCH_TOOL ${input:MnInfo} $MnName ranking_suffix=$RANKING_SUFFIX ${output;chksum;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"}
  6127. }
  6128. macro _BUILD_MNS_FILE(Input, Name, Output, Suffix, Check, Fml_tool, AsmDataName) {
  6129. .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"}
  6130. }
  6131. MNS_OUTPUT=mnmodels
  6132. macro _BUILD_MNS_CPP(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6133. .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"}
  6134. }
  6135. macro _BUILD_MNS_HEADER(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6136. .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"}
  6137. }
  6138. # TODO: support foreach_in and keywords simultaneous usage (look at BUILD_MNS_FILES)
  6139. # tag:matrixnet
  6140. ### @usage: BUILD_MNS([CHECK] NAME listname mninfos...) # matrixnet
  6141. ###
  6142. ### Generate MatrixNet data and access code using separate commands for support code, interface and data.
  6143. ### Faster version of BUILD_MN() macro for large files.
  6144. macro BUILD_MNS(Files...) {
  6145. _BUILD_MNS_HEADER($Files)
  6146. _BUILD_MNS_CPP($Files)
  6147. _BUILD_MNS_FILES($Files)
  6148. }
  6149. ### @usage: COMPILE_NLG(Src...)
  6150. ###
  6151. ### Generate and compile .nlg templates (Jinja2-based) and interface for megamind runtime.
  6152. ###
  6153. ### Alice-specific macro
  6154. macro COMPILE_NLG(Src...) {
  6155. PEERDIR(alice/nlg/library/runtime)
  6156. RUN_PROGRAM(alice/nlg/tools/codegen compile-cpp --import-dir ${ARCADIA_ROOT} --out-dir ${ARCADIA_BUILD_ROOT} --include-prefix ${MODDIR} ${Src} IN ${Src} OUT_NOAUTO register.cpp register.h ${suf=.cpp:Src} ${suf=.h:Src} ${suf=.pb.txt:Src})
  6157. SRCS(GLOBAL register.cpp ${suf=.cpp:Src})
  6158. }
  6159. ### @usage: NEED_CHECK()
  6160. ###
  6161. ### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
  6162. ### automatically merged to trunk only if there is no new broken build targets in check results.
  6163. ### The use of this macro is disabled by default.
  6164. macro NEED_CHECK(Flags...) {
  6165. # TODO: FIXME
  6166. ENABLE(UNUSED_MACRO)
  6167. }
  6168. ### @usage: NO_NEED_CHECK()
  6169. ###
  6170. ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
  6171. macro NO_NEED_CHECK(Flags...) {
  6172. ENABLE(UNUSED_MACRO)
  6173. }
  6174. # tag:deprecated
  6175. ### @usage: NEED_REVIEW() # deprecated
  6176. ###
  6177. ### Mark the project as needing review.
  6178. ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
  6179. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
  6180. macro NEED_REVIEW(Flags...) {
  6181. # TODO: FIXME
  6182. ENABLE(UNUSED_MACRO)
  6183. }
  6184. ### @usage: VERSION(Args...)
  6185. ###
  6186. ### Specify version of a module. Currently unused by build system, only informative.
  6187. macro VERSION(Flags...) {
  6188. ENABLE(UNUSED_MACRO)
  6189. }
  6190. DATAWORK_SCHEEME_EXPORT_FLAGS=
  6191. when ($UNIX == "yes") {
  6192. SCHEEME2_CFLAGS= -E -x c++
  6193. }
  6194. when ($WIN32 == "yes") {
  6195. SCHEEME2_CFLAGS= /E /TP
  6196. }
  6197. SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
  6198. ### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
  6199. ###
  6200. ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
  6201. ###
  6202. ### 1. ${scheeme_name}.inc - the name of the generated file.
  6203. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
  6204. ###
  6205. ### @example:
  6206. ###
  6207. ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
  6208. ###
  6209. ### 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)
  6210. ### sets in extra option
  6211. ###
  6212. ### @example:
  6213. ###
  6214. ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
  6215. ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
  6216. ### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
  6217. ###
  6218. ### for compatibility with C++ compiler and the external environment.
  6219. ### See tools/structparser for more details.
  6220. macro GEN_SCHEEME2(ScheemeName, FromFile) {
  6221. .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"}
  6222. }
  6223. ### @usage: SYMLINK(from to)
  6224. ### Add symlink
  6225. macro SYMLINK(From, To) {
  6226. .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"}
  6227. }
  6228. # tag:internal
  6229. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6230. ### Generate prefix " && target_sources PRIVATE " before $Args when GENERATE is specified in the list of actual arguments
  6231. macro _TARGET_SOURCES_FOR_HEADERS_IMPL(GENERATE?" && target_sources PRIVATE ":"", Args...) {
  6232. .SEM=$GENERATE ${output;ext=.h:Args} ${output;ext=.hh:Args} ${output;ext=.hpp:Args} ${output;ext=.inc:Args} ${output;ext=.i:Args}
  6233. }
  6234. # tag:internal
  6235. ### @usage: _TARGET_SOURCES_FOR_HEADERS(Args...) # internal
  6236. ### Generate prefix " && target_sources PRIVATE " before $Args if Args is not empty
  6237. macro _TARGET_SOURCES_FOR_HEADERS(Args...) {
  6238. .SEM=$_TARGET_SOURCES_FOR_HEADERS_IMPL(${pre=GENERATE :Args})
  6239. }
  6240. # tag:internal
  6241. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6242. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args when GENERATE is specified in the list of actual arguments
  6243. macro _SET_ENV_FOR_CUSTOM_COMMAND_IMPL(GENERATE?" ${CMAKE_COMMAND} -E env ":"", Args...) {
  6244. .SEM=$GENERATE ${pre= :Args}
  6245. }
  6246. # tag:internal
  6247. ### @usage: _SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
  6248. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args if Args is not empty
  6249. macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
  6250. .SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args})
  6251. }
  6252. macro _FMT_INDUCED_DEPS(For, Deps...) {
  6253. .CMD=${induced_deps=$For:Deps}
  6254. }
  6255. ### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...)
  6256. ###
  6257. ### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR`
  6258. ### This tells that files of Type resulted from code generation macros (not neccessarily directly,
  6259. ### but in processing chain of generated files) should have extra dependencies from list of Files...
  6260. ###
  6261. ### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from
  6262. ### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp
  6263. ### resulted from Cython-processing of generated pyx. The code ganeration will look like:
  6264. ### ```
  6265. ### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd)
  6266. ### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h)
  6267. ### RUN_PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS)
  6268. ### ```
  6269. ###
  6270. ### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing
  6271. ### as an element of array parameter. This is needed because language of ya.make doesn't support
  6272. ### Dict params right now and so it is impossible to directly pass something
  6273. ### like `{Type1:[Files2...], Type2:[Files2...]}`
  6274. ###
  6275. macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) {
  6276. SET($VAR \$_FMT_INDUCED_DEPS($For $Deps))
  6277. }
  6278. ### @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...])
  6279. ###
  6280. ### Run a program from arcadia.
  6281. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6282. ###
  6283. ### Parameters:
  6284. ### - tool_path - Path to the directory of the tool.
  6285. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6286. ### - CWD dir - Absolute path of the working directory.
  6287. ### - ENV key=value... - Environment variables.
  6288. ### - TOOL tools... - Auxiliary tool directories.
  6289. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6290. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6291. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6292. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6293. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6294. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6295. ###
  6296. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6297. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6298. ### 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).
  6299. 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...) {
  6300. .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"}
  6301. .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)
  6302. }
  6303. # tag:lua-specific
  6304. ### @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...])
  6305. ###
  6306. ### Run a lua script.
  6307. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6308. ###
  6309. ### Parameters:
  6310. ### - script_path - Path to the script.3
  6311. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6312. ### - CWD dir - Absolute path of the working directory.
  6313. ### - ENV key=value... - Environment variables.
  6314. ### - TOOL tools... - Auxiliary tool directories.
  6315. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6316. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6317. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6318. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6319. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6320. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6321. ###
  6322. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6323. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6324. 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...) {
  6325. .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"}
  6326. }
  6327. # tag:python-specific
  6328. ### @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...])
  6329. ###
  6330. ### Run a python script with $(PYTHON)/python built from devtools/huge_python.
  6331. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6332. ###
  6333. ### Parameters:
  6334. ### - script_path - Path to the script.
  6335. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6336. ### - CWD dir - Absolute path of the working directory.
  6337. ### - ENV key=value... - Environment variables.
  6338. ### - TOOL tools... - Auxiliary tool directories.
  6339. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6340. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6341. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6342. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6343. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6344. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6345. ###
  6346. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6347. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6348. 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...) {
  6349. .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"}
  6350. .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)
  6351. }
  6352. # tag:python-specific
  6353. ### @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...])
  6354. ###
  6355. ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
  6356. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6357. ###
  6358. ### Parameters:
  6359. ### - script_path - Path to the script.
  6360. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6361. ### - CWD dir - Absolute path of the working directory.
  6362. ### - ENV key=value... - Environment variables.
  6363. ### - TOOL tools... - Auxiliary tool directories.
  6364. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6365. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6366. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6367. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6368. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6369. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6370. ###
  6371. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6372. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6373. 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...) {
  6374. .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"}
  6375. .PEERDIR=$YMAKE_PYTHON3_PEER
  6376. .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)
  6377. }
  6378. # tag:java-specific
  6379. 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...) {
  6380. PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6381. .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"}
  6382. }
  6383. ### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6384. ###
  6385. ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
  6386. ### 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.
  6387. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
  6388. ###
  6389. ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
  6390. ###
  6391. ### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
  6392. ### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
  6393. ### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
  6394. ### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
  6395. ###
  6396. ### RENAME RESOURCE allows to rename the resource without specifying its file name.
  6397. ###
  6398. ### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6399. ### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6400. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6401. ###
  6402. ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
  6403. ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
  6404. ### so you shall place it immediately after resource_id.
  6405. 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:") {
  6406. .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"}
  6407. ADD_CHECK(check.resource $Id)
  6408. }
  6409. ### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6410. ###
  6411. ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6412. macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6413. .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"}
  6414. ADD_CHECK(check.mds $Key)
  6415. }
  6416. # tag:internal
  6417. ### @usage: _FROM_EXTERNAL(ExtFile [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) #internal
  6418. ###
  6419. ### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS).
  6420. macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") {
  6421. .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"}
  6422. #FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors
  6423. #FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented
  6424. }
  6425. ### @usage LARGE_FILES([AUTOUPDATED] Files...)
  6426. ###
  6427. ### Use large file ether from working copy or from remote storage via placeholder <File>.external
  6428. ### If <File> is present locally (and not a symlink!) it will be copied to build directory.
  6429. ### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
  6430. macro LARGE_FILES(AUTOUPDATED?, Files...) {
  6431. # This is needed to correctly switch between remote and local modes
  6432. _GLOB($LF $Files)
  6433. }
  6434. ### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6435. ###
  6436. ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6437. macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6438. .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"}
  6439. }
  6440. when ($MSVC == "yes") {
  6441. C_AS_CXX_FLAGS=/TP /std:c++17
  6442. }
  6443. otherwise {
  6444. C_AS_CXX_FLAGS=-x c++ -std=c++17
  6445. }
  6446. # tag:cpp-specific
  6447. ### @usage: COMPILE_C_AS_CXX()
  6448. ###
  6449. ### Compile .c files as .cpp ones within a module.
  6450. macro COMPILE_C_AS_CXX() {
  6451. SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
  6452. }
  6453. ### @usage: NO_DEBUG_INFO()
  6454. ###
  6455. ### Compile files without debug info collection.
  6456. macro NO_DEBUG_INFO() {
  6457. SET(NO_DEBUGINFO yes)
  6458. }
  6459. ### @usage: CTEMPLATE_VARNAMES(File)
  6460. ###
  6461. ### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
  6462. ###
  6463. ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
  6464. macro CTEMPLATE_VARNAMES(File) {
  6465. .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
  6466. }
  6467. LLVM_OPTS=
  6468. CLANG_ROOT=$CLANG_RESOURCE_GLOBAL
  6469. CLANG_BINARIES_ROOT=$CLANG_ROOT/bin
  6470. CLANG_CPP_COMPILER_BIN=$CLANG_BINARIES_ROOT/clang++
  6471. CLANG_C_COMPILER_BIN=$CLANG_BINARIES_ROOT/clang
  6472. when ($OS_ANDROID == "yes") {
  6473. CLANG_ROOT=$CLANG_ANDROID_RESOURCE_GLOBAL
  6474. when ($HOST_OS_DARWIN) {
  6475. CLANG_BINARIES_ROOT=$CLANG_ROOT/toolchains/llvm/prebuilt/darwin-x86_64/bin
  6476. }
  6477. otherwise {
  6478. CLANG_BINARIES_ROOT=$CLANG_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin
  6479. }
  6480. }
  6481. ### @usage: GENERATED_SRCS(srcs... PARSE_META_FROM cpp_srcs... [OUTPUT_INCLUDES output_includes...] [OPTIONS])
  6482. ###
  6483. ### Generate sources using Jinja 2 template engine.
  6484. ###
  6485. ### srcs... - list of text files which will be generated during build time by templates. Each template must be
  6486. ### placed to the place in source tree where corresponding source file should be generated. Name of
  6487. ### template must be "<name_of_src_file>.markettemplate". For example if you want to generate file "example.cpp"
  6488. ### then template should be named "example.cpp.markettemplate".
  6489. ### PARSE_META_FROM cpp_srcs... - list of C++ source files (.cpp, .h) which will be parsed using clang library
  6490. ### and metainformation extracted from the files will be made available for templates. Example of
  6491. ### template code fragment using metainformation: {{ meta.objects["@N@std@S@string"].name }}
  6492. ### OUTPUT_INCLUDES output_includes... - in cases when build system parser fails to determine all headers
  6493. ### which generated files include, you can specify additional headers here. In a normal situation this should
  6494. ### not be needed and this feature could be removed in the future.
  6495. ### OPTIONS - additional options for code_generator utility
  6496. ###
  6497. ### Examples of templates can be found in directory market/tools/code_generator/templates.
  6498. ### Metainformation does not contain entries for every object declared in C++ files specified in PARSE_META_FROM
  6499. ### parameter. To include some object into consideration you need to mark it by attribute. Attributes can
  6500. ### automatically add more attributes to dependent objects. This behavior depends on attribute definition.
  6501. ###
  6502. ### More information will be available (eventually:) here: https://wiki.yandex-team.ru/Users/denisk/codegenerator/
  6503. macro GENERATED_SRCS(PARSE_META_FROM{input}[], OUTPUT_INCLUDES[], OPTIONS[], TEMPLATES...) {
  6504. .CMD=${tool:"market/tools/code_generator"} --cpp-file ${input:PARSE_META_FROM} --templates-dir / ${ARCADIA_ROOT} --templates ${input:TEMPLATES.markettemplate} --generated-files ${output:TEMPLATES} ${output_include;hide:OUTPUT_INCLUDES} ${output_include;hide:PARSE_META_FROM} --arcadia-root ${ARCADIA_ROOT} --arcadia-build-root ${ARCADIA_BUILD_ROOT} --clang-root $CLANG_ROOT ${OPTIONS} -- $C_FLAGS_PLATFORM $CXXFLAGS ${pre=-I:_C__INCLUDE} -std=c++17 -Wno-unknown-warning-option -Wno-unused-parameter -Wno-undefined-inline -Wno-undefined-internal -Wno-unused-function $LLVM_OPTS -fno-lto
  6505. PEERDIR(build/platform/clang)
  6506. }
  6507. ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
  6508. ###
  6509. ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
  6510. ### Note: Output name is used as is, no extension added.
  6511. macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
  6512. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_CPP_COMPILER_BIN ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS -emit-ast -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p ST"} ${kv;hide:"pc light-green"}
  6513. PEERDIR(build/platform/clang)
  6514. }
  6515. ### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
  6516. ###
  6517. ### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6518. ### Note: Output name is used as is, no extension added.
  6519. macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
  6520. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_CPP_COMPILER_BIN ${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 ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6521. .SEM=llvm_compile_cxx ${input:Input} ${output;noauto:Output} ${CLANGPLUSPLUS} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  6522. PEERDIR(build/platform/clang)
  6523. }
  6524. ### @usage: LLVM_COMPILE_C(Input Output Opts...)
  6525. ###
  6526. ### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6527. ### Note: Output name is used as is, no extension added.
  6528. macro LLVM_COMPILE_C(Input, Output, Opts...) {
  6529. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_C_COMPILER_BIN ${pre=-I:_C__INCLUDE} $BC_CFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6530. PEERDIR(build/platform/clang)
  6531. }
  6532. ### @usage: BPF(Input Output Opts...)
  6533. ###
  6534. ### Emit eBPF bytecode from .c file.
  6535. ### Note: Output name is used as is, no extension added.
  6536. macro BPF(Input, Output, Opts...) {
  6537. .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"}
  6538. PEERDIR(build/platform/clang)
  6539. }
  6540. ### @usage: BPF_STATIC(Input Output Opts...)
  6541. ###
  6542. ### Emit eBPF bytecode from .c file.
  6543. ### Note: Output name is used as is, no extension added.
  6544. macro BPF_STATIC(Input, Output, Opts...) {
  6545. .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 -r -b binary -m elf_x86_64 -o ${output;noauto;suf=.bpf.o:Input} ${noauto;nopath:Output}
  6546. PEERDIR(build/platform/clang build/platform/lld)
  6547. }
  6548. ### @usage: LLVM_COMPILE_LL(Input Output Opts...)
  6549. ###
  6550. ### Compile LLVM bytecode to object representation.
  6551. ### Note: Output name is used as is, no extension added.
  6552. macro LLVM_COMPILE_LL(Input, Output, Opts...) {
  6553. .CMD=$CLANG_BINARIES_ROOT/llvm-as ${input:Input} -o ${output;noauto:Output} ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6554. PEERDIR(build/platform/clang)
  6555. }
  6556. ### @usage: LLVM_LINK(Output Inputs...)
  6557. ###
  6558. ### Call llvm-link on set of Inputs to produce Output.
  6559. ### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
  6560. macro LLVM_LINK(Output, Inputs...) {
  6561. .CMD=$CLANG_BINARIES_ROOT/llvm-link ${input:Inputs} -o ${output;noauto:Output} ${kv;hide:"p LD"} ${kv;hide:"pc light-red"}
  6562. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Inputs} COMMAND ${LLVMLINK} ${input:Inputs} -o ${output;noauto:Output}
  6563. PEERDIR(build/platform/clang)
  6564. }
  6565. ### @usage: LLVM_OPT(Input Output Opts...)
  6566. ###
  6567. ### Call llvm-opt with set of Opts on Input to produce Output.
  6568. ### Note: Output name is used as is, no extension added.
  6569. macro LLVM_OPT(Input, Output, Opts...) {
  6570. .CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} $CLANG_BINARIES_ROOT/opt ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p OP"} ${kv;hide:"pc yellow"}
  6571. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMOPT} ${input:Input} -o ${output;noauto:Output} $Opts
  6572. PEERDIR(build/platform/clang)
  6573. }
  6574. when ($NO_DEBUGINFO == "yes") {
  6575. DEBUG_INFO_FLAGS=
  6576. }
  6577. when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
  6578. DEBUG_INFO_FLAGS=-gline-tables-only
  6579. }
  6580. # TODO: configurable tar and touch
  6581. PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  6582. # tag:internal
  6583. ### @usage TOUCH(Outputs...) # internal
  6584. ### Just introduce outputs
  6585. macro TOUCH(Outputs...) {
  6586. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
  6587. }
  6588. TOUCH_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p UN"} ${kv;hide:"pc light-cyan"} $TARGET
  6589. TOUCH_PACKAGE=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"pc light-red"} $TARGET && $YMAKE_PYTHON ${input:"build/scripts/copy_to_dir.py"} --dest-dir $BINDIR --build-root $ARCADIA_BUILD_ROOT $PACKED_PACKAGE_ARGS $SRCS_GLOBAL $PEERS
  6590. _P_PK=${kv;hide:"p PK"}
  6591. TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK
  6592. TOUCH_JAVA_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"java $CURDIR"} $TARGET
  6593. NO_CHECK_IMPORTS_FOR_VALUE=None
  6594. ### @usage: NO_CHECK_IMPORTS([patterns])
  6595. ###
  6596. ### Do not run checks on imports of Python modules.
  6597. ### Optional parameter mask patterns describes the names of the modules that do not need to check.
  6598. macro NO_CHECK_IMPORTS(Masks...) {
  6599. SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
  6600. }
  6601. # tag:yasm-specific
  6602. _YASM_FMT_VALUE=
  6603. _YASM_PLATFORM_FLAGS_VALUE=
  6604. _YASM_PREDEFINED_FLAGS_VALUE=
  6605. when ($OS_DARWIN || $OS_IOS) {
  6606. _YASM_FMT_VALUE=macho
  6607. _YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
  6608. }
  6609. elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
  6610. _YASM_FMT_VALUE=win
  6611. _YASM_PLATFORM_FLAGS_VALUE=-D WIN64
  6612. }
  6613. elsewhen ($OS_WINDOWS && $ARCH_I386) {
  6614. _YASM_FMT_VALUE=win
  6615. _YASM_PLATFORM_FLAGS_VALUE=-D WIN32
  6616. }
  6617. otherwise {
  6618. _YASM_FMT_VALUE=elf
  6619. _YASM_PLATFORM_FLAGS_VALUE=-D UNIX
  6620. _YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
  6621. }
  6622. when ($ASM_PREFIX) {
  6623. ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
  6624. }
  6625. otherwise {
  6626. ASM_PREFIX_VALUE=
  6627. }
  6628. # tag:yasm-specific
  6629. YASM_FLAGS=
  6630. YASM_PREINCLUDES_VALUE=
  6631. # tag:yasm-specific
  6632. macro _SRC_yasm_helper(SRC, PREINCLUDES[], SRCFLAGS...) {
  6633. .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"}
  6634. }
  6635. # tag:yasm-specific
  6636. macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  6637. .CMD=$_SRC_yasm_helper(${input:SRC}, $SRCFLAGS, PREINCLUDES $PREINCLUDES)
  6638. }
  6639. ### @usage: ASM_PREINCLUDE(AsmFiles...)
  6640. ###
  6641. ### Supply additional .asm files to all assembler calls within a module
  6642. macro ASM_PREINCLUDE(PREINCLUDES...) {
  6643. SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
  6644. }
  6645. # tag:python-specific
  6646. ### @usage: RUN_PYTHON(Args...)
  6647. ###
  6648. ### Version of RUN() macro to invoke Python scripts
  6649. ### @see: [RUN()](#macro_RUN)
  6650. macro RUN_PYTHON(Args...) {
  6651. SETUP_RUN_PYTHON()
  6652. RUN(${PYTHON_BIN} $Args)
  6653. }
  6654. ### @usage: RUN_ANTLR(Args...)
  6655. ###
  6656. ### Macro to invoke ANTLR3 generator (general case)
  6657. macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  6658. PEERDIR(build/external_resources/antlr3 build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6659. .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})
  6660. .SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args
  6661. }
  6662. ### @usage: RUN_ANTLR4(Args...)
  6663. ###
  6664. ### Macro to invoke ANTLR4 generator (general case)
  6665. macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  6666. PEERDIR(build/external_resources/antlr4)
  6667. _RUN_JAVA(-jar $ANTLR4_RESOURCE_GLOBAL/antlr-4.9-complete.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})
  6668. }
  6669. _ANTLR4_LISTENER_GRAMMAR=-listener
  6670. _ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
  6671. _ANTLR4_VISITOR_GRAMMAR=-visitor
  6672. _ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
  6673. ### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  6674. ###
  6675. ### Macro to invoke ANTLR4 generator (Cpp)
  6676. macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6677. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Cpp -o ${BINDIR} ${Args} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} 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})
  6678. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  6679. }
  6680. ### @usage: RUN_ANTLR4_GO(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  6681. ###
  6682. ### Macro to invoke ANTLR4 generator (Go)
  6683. macro RUN_ANTLR4_GO(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6684. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Go -o ${BINDIR} ${Args} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} 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} OUTPUT_INCLUDES ${OUTPUT_INCLUDES})
  6685. PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr)
  6686. }
  6687. # tag:cpp-specific
  6688. macro CPP_ADDINCL(Dirs...) {
  6689. ADDINCL($Dirs)
  6690. }
  6691. # tag:internal
  6692. _WHOLE_ARCHIVE_PEERS_VALUE=
  6693. ### @usage: WHOLE_ARCHIVE(dirnames...) # internal
  6694. macro WHOLE_ARCHIVE(PEERS...) {
  6695. SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
  6696. REQUIRES(${PEERS})
  6697. }
  6698. ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
  6699. macro TASKLET() {
  6700. PEERDIR(tasklet/api)
  6701. # CPP
  6702. CPP_PROTO_PLUGIN(tasklet_cpp tasklet/gen/cpp .tasklet.h)
  6703. # Python
  6704. PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/gen/python DEPS tasklet/domain/sandbox tasklet/runtime sandbox/sdk2)
  6705. #Java
  6706. JAVA_PROTO_PLUGIN(tasket_java tasklet/gen/java DEPS tasklet/runtime/java/lib $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  6707. }
  6708. TASKLET_REG_INCLUDES= \
  6709. ${output_include;hide:"tasklet/runtime/lib/cpp_wrapper.h"} \
  6710. ${output_include;hide:"tasklet/runtime/lib/go_wrapper.h"} \
  6711. ${output_include;hide:"tasklet/runtime/lib/py_wrapper.h"} \
  6712. ${output_include;hide:"tasklet/runtime/lib/js_wrapper.h"} \
  6713. ${output_include;hide:"tasklet/runtime/lib/registry.h"}
  6714. macro TASKLET_REG(Name, Lang, Impl, Includes...) {
  6715. PEERDIR(tasklet/domain sandbox/bin sandbox/taskbox/worker)
  6716. when($Lang == "js") {
  6717. # JS runtime links the Node.js from contrib as a library, which is a bit heavy,
  6718. # so we do it, only if any JS tasklets are linked into the target
  6719. PEERDIR+=tasklet/runtime/js
  6720. }
  6721. .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"}
  6722. SRCS(GLOBAL $Name.task.cpp)
  6723. }
  6724. # TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
  6725. # NOT COMPLETE
  6726. macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
  6727. PEERDIR(tasklet/domain sandbox/bin sandbox/taskbox/worker)
  6728. .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"}
  6729. SRCS(GLOBAL $Name.task.cpp)
  6730. }
  6731. # tag:cpp-specific
  6732. _CPP_PROTO_MODULE_PREFIX=
  6733. _CPP_PROTO_MODULE_SUFFIX=
  6734. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6735. _CPP_PROTO_MODULE_PREFIX=
  6736. _CPP_PROTO_MODULE_SUFFIX=.lib
  6737. }
  6738. otherwise {
  6739. _CPP_PROTO_MODULE_PREFIX=lib
  6740. _CPP_PROTO_MODULE_SUFFIX=.a
  6741. }
  6742. ### @usage: EXPOSE(OutputsToExport...)
  6743. ###
  6744. ### Allows to mark outputs of macro command as unused in the current module but intended
  6745. ### to be used in modules consuming current via PEERDIR.
  6746. ###
  6747. ### TODO(DEVTOOLS-9000) proper implementation needed
  6748. macro EXPOSE(Args...) {
  6749. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).cpp:"empty_"} ${input;hide:Args}
  6750. }
  6751. # tag:proto
  6752. macro _PROTO_DESC_CMD(File) {
  6753. .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 ${input;rootrel:File}
  6754. }
  6755. _PROTO_DESC_MERGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $AUTO_INPUT ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
  6756. _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"}
  6757. NEED_GOOGLE_PROTO_PEERDIRS=yes
  6758. PROTO_LIBRARY_SEM=$CPP_LIBRARY_SEM
  6759. # tag:proto
  6760. ### @usage: PROTO_LIBRARY()
  6761. ###
  6762. ### Build some varian of protocol buffers library.
  6763. ###
  6764. ### The particular variant is selected based on where PEERDIR to PROTO_LIBRARY comes from.
  6765. ###
  6766. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  6767. ### When PEERDIR comes from module for particular language appropriate variant is selected.
  6768. ### PROTO_LIBRARY also supports emission of GRPC code if GRPC() macro is specified.
  6769. ### Notes:
  6770. ### - Python versions emit C++ code in addition to Python as optimization.
  6771. ### - In some PROTO_LIBRARY-es Java or Python versions are excluded via EXCLUDE_TAGS macros due to incompatibilities.
  6772. ### - Use from DEPENDS or BUNDLE is not allowed
  6773. ###
  6774. ### Documentation: https://wiki.yandex-team.ru/yatool/proto_library/
  6775. ###
  6776. ### See: [GRPC()](#macro_GRPC), [OPTIMIZE_PY_PROTOS()](#macro_OPTIMIZE_PY_PROTOS), [INCLUDE_TAGS()](#macro_INCLUDE_TAGS), [EXCLUDE_TAGS()](#macro_EXCLUDE_TAGS)
  6777. multimodule PROTO_LIBRARY {
  6778. module CPP_PROTO : LIBRARY {
  6779. .ALLOWED=EXPOSE
  6780. # TODO(svidyuk): think about marker which forces semantics inheritance
  6781. .SEM=PROTO_LIBRARY_SEM
  6782. ENABLE(CPP_PROTO)
  6783. ENABLE(GEN_PROTO)
  6784. NO_CLANG_TIDY()
  6785. SET(PEERDIR_TAGS CPP_PROTO)
  6786. when ($BUILD_PROTO_AS_EVLOG == "yes" && $USE_VANILLA_PROTOC == "yes") {
  6787. _OK=no
  6788. }
  6789. ASSERT(_OK BUILD_PROTO_AS_EVLOG and USE_VANILLA_PROTOC are incompatible yet)
  6790. MODULE_SUFFIX=$_CPP_PROTO_MODULE_SUFFIX
  6791. MODULE_PREFIX=$_CPP_PROTO_MODULE_PREFIX
  6792. when ($_COMMON_GOOGLE_APIS != "None") {
  6793. PEERDIR += contrib/libs/googleapis-common-protos
  6794. }
  6795. }
  6796. module JAVA_PROTO: EXTERNAL_JAVA_LIBRARY {
  6797. .EXTS=.jsrc
  6798. .ALLOWED=GRPC
  6799. .SEM=ignored
  6800. SET(PEERDIR_TAGS JAVA_PROTO)
  6801. ENABLE(JAVA_PROTO)
  6802. PEERDIR+=$JAVA_PROTOBUF_PEERS contrib/java/javax/annotation/javax.annotation-api/1.3.1
  6803. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE
  6804. ADDINCL(FOR proto $PROTOBUF_PATH)
  6805. when ($_COMMON_GOOGLE_APIS != "None") {
  6806. PEERDIR += contrib/java/com/google/api/grpc/proto-google-common-protos/${JAVA_PROTO_COMMON_VERSION}
  6807. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6808. }
  6809. }
  6810. module PY_PROTO: PY2_LIBRARY {
  6811. .ALIASES=SRCS=PY_SRCS
  6812. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  6813. .PEERDIRSELF=CPP_PROTO
  6814. .SEM=ignored
  6815. SET(PEERDIR_TAGS PY2 PY_PROTO)
  6816. ENABLE(PY_PROTO)
  6817. OPTIMIZE_PY_PROTOS()
  6818. OBJ_SUF=.py2
  6819. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6820. SET(LINT_LEVEL_VALUE none_internal)
  6821. when ($_COMMON_GOOGLE_APIS != "None") {
  6822. PEERDIR += contrib/libs/googleapis-common-protos
  6823. }
  6824. _IGNORE_SELF_PEERS=
  6825. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  6826. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  6827. _IGNORE_PEERDIRSELF=CPP_PROTO
  6828. }
  6829. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  6830. }
  6831. module PY3_PROTO: PY3_LIBRARY {
  6832. .ALIASES=SRCS=PY_SRCS
  6833. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  6834. .PEERDIRSELF=CPP_PROTO
  6835. .SEM=ignored
  6836. SET(PEERDIR_TAGS PY3 PY3_PROTO)
  6837. ENABLE(PY3_PROTO)
  6838. OPTIMIZE_PY_PROTOS()
  6839. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6840. MODULE_PREFIX=py3
  6841. }
  6842. otherwise {
  6843. MODULE_PREFIX=libpy3
  6844. }
  6845. OBJ_SUF=.py3
  6846. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6847. SET(LINT_LEVEL_VALUE none_internal)
  6848. when ($_COMMON_GOOGLE_APIS != "None") {
  6849. PEERDIR += contrib/libs/googleapis-common-protos
  6850. }
  6851. _IGNORE_SELF_PEERS=
  6852. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  6853. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  6854. _IGNORE_PEERDIRSELF=CPP_PROTO
  6855. }
  6856. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  6857. }
  6858. module GO_PROTO: GO_LIBRARY {
  6859. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO
  6860. .SEM=ignored
  6861. SET(PEERDIR_TAGS GO GO_PROTO)
  6862. ENABLE(GO_PROTO)
  6863. when ($_COMMON_GOOGLE_APIS == "None") {
  6864. }
  6865. elsewhen ($_COMMON_GOOGLE_APIS == "") {
  6866. PEERDIR += $_GO_COMMON_GOOGLE_APIS
  6867. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6868. }
  6869. otherwise {
  6870. PEERDIR += $_COMMON_GOOGLE_APIS
  6871. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6872. }
  6873. }
  6874. module EXT_PROTO: _BARE_UNIT {
  6875. .ALIASES=SRCS=_RAW_PROTO_SRCS
  6876. .CMD=TOUCH_UNIT_MF
  6877. .SEM=ignored
  6878. .EXTS=.*
  6879. .PROXY=yes
  6880. .PEERDIR_POLICY=as_build_from
  6881. SET(PEERDIR_TAGS EXT_PROTO)
  6882. ENABLE(EXT_PROTO)
  6883. SET(MODULE_SUFFIX .raw.fake.pkg)
  6884. SET(MODULE_TYPE LIBRARY)
  6885. when ($_COMMON_GOOGLE_APIS != "None") {
  6886. PEERDIR += contrib/libs/googleapis-common-protos
  6887. }
  6888. SET(CREDITS_FILE_EXTRA_EXT .ext_proto)
  6889. }
  6890. module DESC_PROTO: _BARE_UNIT {
  6891. .CMD=_PROTO_DESC_MERGE_CMD
  6892. .SEM=ignored
  6893. .EXTS=.desc
  6894. .NODE_TYPE=Library
  6895. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
  6896. SET(PEERDIR_TAGS DESC_PROTO)
  6897. ENABLE(DESC_PROTO)
  6898. MODULE_SUFFIX=.self.protodesc
  6899. SET(MODULE_TYPE LIBRARY)
  6900. MACRO_ALIAS(EVLOG_CMD _PROTO_DESC_CMD)
  6901. MACRO_ALIAS(PROTO_CMD _PROTO_DESC_CMD)
  6902. when ($_COMMON_GOOGLE_APIS != "None") {
  6903. PEERDIR += contrib/libs/googleapis-common-protos
  6904. }
  6905. when ($NEED_GOOGLE_PROTO_PEERDIRS == "yes") {
  6906. when ($USE_VANILLA_PROTOC == "yes") {
  6907. PEERDIR += contrib/libs/protobuf_std/builtin_proto/protos_from_protobuf
  6908. }
  6909. otherwise {
  6910. PEERDIR += contrib/libs/protobuf/builtin_proto/protos_from_protoc
  6911. }
  6912. }
  6913. }
  6914. module PB_PY_PROTO: _PY_PACKAGE {
  6915. .INCLUDE_TAG=no
  6916. .PROXY=yes
  6917. .SEM=ignored
  6918. SET(MODULE_SUFFIX .pb_py.fake.pkg)
  6919. ENABLE(PB_PY_PROTO)
  6920. # WARN:
  6921. # _COMMON_GOOGLE_APIS aren't handled intentionally.
  6922. # PB_PY_PROTO is a legacy module type, stop using it.
  6923. }
  6924. }
  6925. # tag:proto
  6926. _EXT_PROTO_DIR=_RAW_
  6927. # tag:proto
  6928. ### This var defines the root of the tree for copied proto files from EXT_PROTO
  6929. ### submodule of PROTO_LIBRARY module
  6930. EXT_PROTO_ROOT=${ARCADIA_BUILD_ROOT}/${_EXT_PROTO_DIR}
  6931. # tag:proto
  6932. ### @usage: USE_EXT_PROTO(peerdir_tag...)
  6933. ###
  6934. ### Configure module to use proto files from existing PROTO_LIBRARY module.
  6935. ### Additional PEERDIR tags required to build a module can be passed through
  6936. ### EXTRA_TAGS vararg parameter.
  6937. macro USE_EXT_PROTO(EXTRA_TAGS...) {
  6938. SET(PEERDIR_TAGS EXT_PROTO ${EXTRA_TAGS})
  6939. SRCDIR(${EXT_PROTO_ROOT})
  6940. }
  6941. # tag:proto tag:internal
  6942. ### @usage: _RAW_PROTO_SRCS(files...) # internal
  6943. ###
  6944. ### _RAW_PROTO_SRCS is a proxy macro to FILES macro which filters out
  6945. ### GLOBAL keyword from the list of files (NOTE! The order of files listed
  6946. ### originally in call to _RAW_PROTO_SRCS() macro is changed in call to
  6947. ### FILES() macro). Currently this macro copies only files with the following
  6948. ### extensions: .proto, .gztproto, .ev
  6949. macro _RAW_PROTO_SRCS(FILES...) {
  6950. _COPY_FILES_TO_BUILD_PREFIX(${ext=.proto:FILES} PREFIX ${_EXT_PROTO_DIR})
  6951. _COPY_FILES_TO_BUILD_PREFIX(${ext=.gztproto:FILES} PREFIX ${_EXT_PROTO_DIR})
  6952. _COPY_FILES_TO_BUILD_PREFIX(${ext=.ev:FILES} PREFIX ${_EXT_PROTO_DIR})
  6953. }
  6954. module PROTO_DESCRIPTIONS: _BARE_UNIT {
  6955. .CMD=_PROTO_DESC_MERGE_PEERS_CMD
  6956. .PEERDIR_POLICY=as_build_from
  6957. .NODE_TYPE=Library
  6958. .RESTRICTED=SRCS
  6959. .FINAL_TARGET=yes
  6960. SET(PEERDIR_TAGS DESC_PROTO)
  6961. SET(MODULE_SUFFIX .protodesc)
  6962. SET(MODULE_TYPE PROTO_DESCRIPTIONS)
  6963. }
  6964. module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
  6965. SET(MODULE_TYPE PROTO_REGISTRY)
  6966. }
  6967. # tag:fbs
  6968. _FBS_NAMESPACE_MAP_GLOBAL=
  6969. # tag:fbs
  6970. macro _FBS_NAMESPACE_IMPL(NAMESPACE, PATH, DUMMY...) {
  6971. SET_APPEND(_FBS_NAMESPACE_MAP_GLOBAL ${NAMESPACE}=${PATH})
  6972. }
  6973. # tag:fbs
  6974. macro FBS_NAMESPACE(NAMESPACE, PATH...) {
  6975. _FBS_NAMESPACE_IMPL($NAMESPACE $PATH $MODDIR)
  6976. }
  6977. # tag:fbs
  6978. ### @usage: FBS_LIBRARY()
  6979. ###
  6980. ### Build some variant of Flatbuffers library.
  6981. ###
  6982. ### The particular variant is selected based on where PEERDIR to FBS_LIBRARY
  6983. ### comes from.
  6984. ###
  6985. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  6986. ### When PEERDIR comes from module for particular language appropriate variant
  6987. ### is selected.
  6988. ###
  6989. ### Notes: FBS_NAMESPACE must be specified in all dependent FBS_LIBRARY modules
  6990. ### if build of Go code is requested.
  6991. multimodule FBS_LIBRARY {
  6992. module CPP_FBS: LIBRARY {
  6993. ENABLE(CPP_FBS)
  6994. SET(PEERDIR_TAGS CPP_FBS)
  6995. }
  6996. module GO_FBS: GO_LIBRARY {
  6997. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  6998. ENABLE(GO_FBS)
  6999. SET(PEERDIR_TAGS GO GO_FBS)
  7000. }
  7001. module JAVA_FBS: EXTERNAL_JAVA_LIBRARY {
  7002. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7003. ENABLE(JAVA_FBS)
  7004. SET(PEERDIR_TAGS JAVA_FBS)
  7005. }
  7006. module PY2_FBS: PY2_LIBRARY {
  7007. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7008. .ALIASES=SRCS=PY_SRCS
  7009. ENABLE(PY2_FBS)
  7010. SET(PEERDIR_TAGS PY2 PY2_FBS)
  7011. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7012. SET(LINT_LEVEL_VALUE none_internal)
  7013. }
  7014. module PY3_FBS: PY3_LIBRARY {
  7015. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7016. .ALIASES=SRCS=PY_SRCS
  7017. ENABLE(PY3_FBS)
  7018. SET(PEERDIR_TAGS PY3 PY3_FBS)
  7019. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7020. SET(LINT_LEVEL_VALUE none_internal)
  7021. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7022. MODULE_PREFIX=py3
  7023. }
  7024. otherwise {
  7025. MODULE_PREFIX=libpy3
  7026. }
  7027. OBJ_SUF=.py3
  7028. }
  7029. }
  7030. # tag:java-specific
  7031. _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"}
  7032. # tag:java-specific
  7033. COMPILE_JSRC_MF=$_COMPILE_JSRC && $GENERATE_MF
  7034. # tag:java-specific tag:internal
  7035. ### @usage: JSRC_LIBRARY() # internal
  7036. module JSRC_LIBRARY: _BARE_UNIT {
  7037. .CMD=COMPILE_JSRC_MF
  7038. .EXTS=.java
  7039. .ALL_INS_TO_OUT=no
  7040. .PEERDIR_POLICY=as_include
  7041. .FINAL_TARGET=no
  7042. .ALIASES=SRCS=FILES
  7043. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  7044. MODULE_TYPE=Library
  7045. SET(MODULE_SUFFIX .jsrc)
  7046. SET(DONT_RESOLVE_INCLUDES yes)
  7047. SET(NEED_PLATFORM_PEERDIRS no)
  7048. SET(MODULE_LANG JAVA)
  7049. NO_RUNTIME()
  7050. }
  7051. # tag:maps-specific
  7052. @import "${CONF_ROOT}/conf/project_specific/maps/asrc.conf"
  7053. # tag:internal
  7054. ### @usage: _PROXY_LIBRARY() # internal
  7055. ###
  7056. ### The use of this module is strictly prohibited!!!
  7057. module _PROXY_LIBRARY: LIBRARY {
  7058. .EXTS=.a .lib
  7059. .PEERDIR_POLICY=as_build_from
  7060. .PROXY=yes
  7061. .FINAL_TARGET=yes
  7062. DISABLE(NEED_ADD_FAKE_SRC)
  7063. NO_UTIL()
  7064. NO_RUNTIME()
  7065. }
  7066. # tag:maps-specific
  7067. @import "${CONF_ROOT}/conf/project_specific/maps/aar.conf"
  7068. @import "${CONF_ROOT}/conf/project_specific/maps/sproto.conf"
  7069. @import "${CONF_ROOT}/conf/project_specific/maps/mapkit.conf"
  7070. _PRIMARY_OUTPUT_VALUE=
  7071. # tag:internal
  7072. ### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
  7073. ###
  7074. ### The use of this module is strictly prohibited!!!
  7075. macro PRIMARY_OUTPUT(OUTPUT) {
  7076. SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
  7077. }
  7078. _DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${input;hide:_PRIMARY_OUTPUT_VALUE} ${TARGET}
  7079. # tag:internal
  7080. ### @usage: DLL_PROXY_LIBRARY() # internal
  7081. ###
  7082. ### The use of this module is strictly prohibited!!!
  7083. module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
  7084. .ALLOWED=PRIMARY_OUTPUT
  7085. .CMD=_DLL_PROXY_LIBRARY_CMD
  7086. }
  7087. _PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${kv;hide:"p ld"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7088. # tag:internal
  7089. ### @usage: PREBUILT_PROGRAM([programname]) # internal
  7090. ###
  7091. ### Program module which uses a prebuilt prgram as its output.
  7092. module PREBUILT_PROGRAM: _LINK_UNIT {
  7093. .CMD=_PREBUILT_PROGRAM_CMD
  7094. .SYMLINK_POLICY=EXE
  7095. .ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
  7096. .RESTRICTED=SRCS
  7097. _BARE_LINK_MODULE()
  7098. SET(MODULE_TYPE PROGRAM)
  7099. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  7100. MODULE_SUFFIX=.exe
  7101. }
  7102. }
  7103. ### @usage COLLECT_JINJA_TEMPLATES(varname path)
  7104. ###
  7105. ### This macro collects all jinja and yaml files in the directory specified by second argument and
  7106. ### stores result in the variable with mane specified by first parameter.
  7107. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
  7108. _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
  7109. }
  7110. # tag:go-specific
  7111. GO_HOST_OS=unknown
  7112. when ($HOST_OS_LINUX) {
  7113. GO_HOST_OS=linux
  7114. }
  7115. elsewhen ($HOST_OS_DARWIN) {
  7116. GO_HOST_OS=darwin
  7117. }
  7118. elsewhen($HOST_OS_WINDOWS) {
  7119. GO_HOST_OS=windows
  7120. }
  7121. # tag:go-specific
  7122. GO_HOST_ARCH=unknown
  7123. when ($HOST_ARCH_X86_64) {
  7124. GO_HOST_ARCH=amd64
  7125. }
  7126. elsewhen($HOST_ARCH_ARM64) {
  7127. GO_HOST_ARCH=arm64
  7128. }
  7129. # tag:go-specific
  7130. GO_TARG_OS=unknown
  7131. when ($OS_LINUX) {
  7132. GO_TARG_OS=linux
  7133. }
  7134. elsewhen ($OS_DARWIN) {
  7135. GO_TARG_OS=darwin
  7136. }
  7137. elsewhen ($OS_WINDOWS) {
  7138. GO_TARG_OS=windows
  7139. }
  7140. # tag:go-specific
  7141. GO_TARG_ARCH=unknwon
  7142. when ($ARCH_X86_64) {
  7143. GO_TARG_ARCH=amd64
  7144. }
  7145. elsewhen ($ARCH_I386) {
  7146. GO_TARG_ARCH=x86
  7147. }
  7148. elsewhen ($ARCH_ARM64) {
  7149. GO_TARG_ARCH=arm64
  7150. }
  7151. # tag:go-specific
  7152. GO_HOST_TARG_PARAMS=++host-os $GO_HOST_OS ++host-arch $GO_HOST_ARCH ++targ-os $GO_TARG_OS ++targ-arch $GO_TARG_ARCH
  7153. # tag:go-specific
  7154. GOSTD_VERSION=1.17.8
  7155. when ($GOSTD_VERSION == "1.17.8") {
  7156. GOSTD=contrib/go/_std/src
  7157. }
  7158. elsewhen ($GOSTD_VERSION == "1.18.2") {
  7159. GOSTD=contrib/go/_std_1.18/src
  7160. }
  7161. otherwise {
  7162. GOSTD=__unsupported_go_std_library_version_[$GOSTD_VERSION]__
  7163. }
  7164. # tag:go-specific
  7165. GO_DEBUG_PATH_RELATIVE=no
  7166. _GO_DEBUG_PATH__NO_UID__=
  7167. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=
  7168. # tag:go-specific
  7169. _GO_IMPORT_PATH=${MODDIR}
  7170. # tag:go-specific
  7171. GO_VET=yolint
  7172. GO_VET_TOOL=
  7173. GO_VET_FLAGS=
  7174. GO_VET_EXTRA_FLAGS=
  7175. # tag:go-specific
  7176. _GO_VET_ADD_CHECK=yes
  7177. _GO_FMT_ADD_CHECK=yes
  7178. _GO_YDX_FILE=
  7179. # tag:go-specific
  7180. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=/-B --source-prefix=/-S
  7181. _GO_LINK_EXE_EXT_CMD=
  7182. # tag:go-specific
  7183. GO_WITH_MUSL=
  7184. # tag:go-specific
  7185. GO_TOOLS_ROOT=${GO_TOOLS_RESOURCE_GLOBAL}
  7186. GO_TEST_MINER=${tool:"tools/go_test_miner"}
  7187. GO_TEST_IMPORT_PATH=
  7188. # tag:go-specific
  7189. GO_STD_LIB_PREFIX=${GOSTD}/
  7190. GO_STD_CMD_PREFIX=${GOSTD}/cmd/
  7191. GO_ARCADIA_PROJECT_PREFIX=a.yandex-team.ru/
  7192. GO_CONTRIB_PROJECT_PREFIX=vendor/
  7193. GO_SKIP_IMPORTS=unsafe C
  7194. GO_VET_INFO_EXT=.vet.out
  7195. GO_VET_REPORT_EXT=.vet.txt
  7196. GO_VET_OUTPUT_INFO=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_INFO_EXT}:REALPRJNAME}
  7197. GO_VET_OUTPUT_REPORT=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_REPORT_EXT}:REALPRJNAME}
  7198. # tag:go-specific tag:codenav
  7199. _GO_YNDEXER_EXT=.ydx.pb2
  7200. GO_YNDEXER_OUTPUT=${output;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${_GO_YNDEXER_EXT}:REALPRJNAME}
  7201. # tag:go-specific
  7202. GO_PROJECT_PREFIXES=++std-lib-prefix $GO_STD_LIB_PREFIX ++arc-project-prefix $GO_ARCADIA_PROJECT_PREFIX
  7203. # tag:go-specific
  7204. _GO_FAKEID=${FAKEID}.${BUILD_TYPE}.${GO_FAKEID}
  7205. # tag:go-specific
  7206. CGO2_CFLAGS_VALUE=
  7207. CGO2_LDFLAGS_VALUE=
  7208. # tag:go-specific
  7209. GO_ASM_FLAGS_VALUE=
  7210. ### @usage: GO_ASM_FLAGS(flags)
  7211. ### Add the specified flags to the go asm compile command line.
  7212. macro GO_ASM_FLAGS(Flags...) {
  7213. SET_APPEND(GO_ASM_FLAGS_VALUE $Flags)
  7214. }
  7215. # tag:go-specific
  7216. GO_CGO1_FLAGS_VALUE=
  7217. ### @usage: GO_CGO1_FLAGS(flags)
  7218. ### Add the specified flags to the go cgo compile command line.
  7219. macro GO_CGO1_FLAGS(Flags...) {
  7220. SET_APPEND(GO_CGO1_FLAGS_VALUE $Flags)
  7221. }
  7222. # tag:go-specific
  7223. GO_CGO2_FLAGS_VALUE=
  7224. ### @usage: GO_CGO2_FLAGS(flags)
  7225. ### Add the specified flags to the go cgo compile command line.
  7226. macro GO_CGO2_FLAGS(Flags...) {
  7227. SET_APPEND(GO_CGO2_FLAGS_VALUE $Flags)
  7228. }
  7229. # tag:go-specific
  7230. GO_COMPILE_FLAGS_VALUE=$USER_GO_COMPILE_FLAGS
  7231. ### @usage: GO_COMPILE_FLAGS(flags)
  7232. ### Add the specified flags to the go compile command line.
  7233. macro GO_COMPILE_FLAGS(Flags...) {
  7234. SET_APPEND(GO_COMPILE_FLAGS_VALUE $Flags)
  7235. }
  7236. # tag:go-specific
  7237. GO_LINK_FLAGS_VALUE=$USER_GO_LINK_FLAGS
  7238. ### @usage: GO_LINK_FLAGS(flags)
  7239. ### Add the specified flags to the go link command line.
  7240. macro GO_LINK_FLAGS(Flags...) {
  7241. SET_APPEND(GO_LINK_FLAGS_VALUE $Flags)
  7242. }
  7243. # tag:go-specific
  7244. _GO_TOOL_MODE=
  7245. # tag:go-specific
  7246. _GO_TOOL_COMMON_FLAGS=\
  7247. ++mode $_GO_TOOL_MODE \
  7248. $GO_PROJECT_PREFIXES \
  7249. ++goversion $GOSTD_VERSION \
  7250. ++source-root $ARCADIA_ROOT \
  7251. ++build-root $ARCADIA_BUILD_ROOT \
  7252. ++output-root $BINDIR \
  7253. ++toolchain-root $GO_TOOLS_ROOT \
  7254. $GO_HOST_TARG_PARAMS \
  7255. ++output $TARGET \
  7256. $GO_VET_OUTPUT \
  7257. $_GO_YDX_FILE \
  7258. $_GO_DEBUG_PATH__NO_UID__ \
  7259. ++srcs $AUTO_INPUT ${input:GO_FILES} \
  7260. ++asm-flags $GO_ASM_FLAGS_VALUE \
  7261. ++compile-flags $GO_COMPILE_FLAGS_VALUE \
  7262. ++link-flags $GO_LINK_FLAGS_VALUE \
  7263. ++cgo-srcs ${input:CGO_FILES} \
  7264. $_GO_EMBED_VALUE \
  7265. $GO_TOOLCHAIN_ENV
  7266. # tag:go-specific
  7267. macro _GO_GEN_COVER_GO(GO_FILE, VAR_ID) {
  7268. .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_FILE} ${input:GO_FILE}
  7269. }
  7270. # tag:go-specific
  7271. macro _GO_COMPILE_SYMABIS(FLAGS[], ASM_FILES...) {
  7272. .CMD=${hide:_GO_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"}
  7273. .ADDINCL=build/scripts/go_fake_include
  7274. }
  7275. # tag:go-specific
  7276. macro _GO_COMPILE_CGO1(NAME, FLAGS[], FILES...) {
  7277. .CMD=${hide:_GO_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"}
  7278. }
  7279. # tag:go-specific
  7280. macro _GO_COMPILE_CGO2(NAME, C_FILES[], S_FILES[], OBJ_FILES[], FILES...) {
  7281. .CMD=${hide:_GO_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"}
  7282. _USE_LINKER()
  7283. }
  7284. # tag:go-specific
  7285. macro _GO_LINK_LIB_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
  7286. .CMD=${hide:_GO_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/go_tool.py"} ${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"}
  7287. }
  7288. # tag:go-specific
  7289. macro _GO_LINK_EXE_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
  7290. .CMD=${hide:_GO_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/go_tool.py"} ${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
  7291. }
  7292. # tag:go-specific
  7293. macro _GO_LINK_TEST_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_TEST_FILES[], GO_XTEST_FILES[], GO_FILES...) {
  7294. .CMD=${hide:_GO_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/go_tool.py"} ${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_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} ++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"}
  7295. }
  7296. # tag:go-specific
  7297. GO_LINK_LIB=$GENERATE_MF && $_GO_LINK_LIB_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_INPUTS $_GO_EMBED_INPUTS)
  7298. 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)
  7299. 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)
  7300. GO_LINK_DLL=$GO_LINK_EXE && $COPY_CMD $BINDIR/_cgo_export.h ${output;pre=${MODULE_PREFIX};suf=.h:REALPRJNAME}
  7301. # tag:go-specific
  7302. CGO_ENABLED=yes
  7303. when ($OS_WINDOWS == "yes" || $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  7304. CGO_ENABLED=no
  7305. }
  7306. # tag:go-specific
  7307. GO_PACKAGE_VALUE=
  7308. ### @usage: GO_PACKAGE_NAME(Name)
  7309. ### Override name of a Go package.
  7310. macro GO_PACKAGE_NAME(NAME) {
  7311. SET(GO_PACKAGE_VALUE $NAME)
  7312. }
  7313. # tag:go-specific tag:internal
  7314. _GO_SRCS_VALUE=
  7315. ### @usage: _GO_SRCS(Files...) # internal
  7316. ### This macro shouldn't be used in ya.make files, use SRCS() instead.
  7317. ### This is internal macro collecting .go sources for processing within Go modules (GO_PROGRAM and GO_LIBRARY)
  7318. macro _GO_SRCS(FILES...) {
  7319. GO_FAKE_OUTPUT($FILES)
  7320. SET_APPEND(_GO_SRCS_VALUE $FILES)
  7321. }
  7322. # tag:go-specific
  7323. _GO_TEST_SRCS_VALUE=
  7324. GO_HAS_INTERNAL_TESTS=no
  7325. ### @usage: GO_TEST_SRCS(Files...)
  7326. ### .go sources for internal tests of a module
  7327. macro GO_TEST_SRCS(FILES...) {
  7328. GO_FAKE_OUTPUT($FILES)
  7329. _SET_FIRST_VALUE(GO_HAS_INTERNAL_TESTS ${pre=yes :FILES} ${GO_HAS_INTERNAL_TESTS})
  7330. SET_APPEND(_GO_TEST_SRCS_VALUE $FILES)
  7331. }
  7332. # tag:go-specific
  7333. _GO_XTEST_SRCS_VALUE=
  7334. GO_HAS_EXTERNAL_TESTS=no
  7335. ### @usage: GO_XTEST_SRCS(Files...)
  7336. ### .go sources for external tests of a module
  7337. macro GO_XTEST_SRCS(FILES...) {
  7338. GO_FAKE_OUTPUT($FILES)
  7339. SET(GO_HAS_EXTERNAL_TESTS yes)
  7340. SET_APPEND(_GO_XTEST_SRCS_VALUE $FILES)
  7341. }
  7342. # tag:go-specific
  7343. macro _GO_UNUSED_SRCS(FLAGS...) {
  7344. ENABLE(UNUSED_MACRO)
  7345. }
  7346. # tag:go-specific
  7347. _CGO_SRCS_VALUE=
  7348. ### @usage: CGO_SRCS(Files...)
  7349. ### .go sources to be built with CGO
  7350. macro CGO_SRCS(FILES...) {
  7351. SET_APPEND(_CGO_SRCS_VALUE $FILES)
  7352. PEERDIR(${GOSTD}/syscall)
  7353. }
  7354. # tag:go-specific
  7355. GO_LDFLAGS_GLOBAL=
  7356. ### @usage: GO_LDFLAGS(Flags...)
  7357. ### Link flags for GO_PROGRAM linking from .go sources
  7358. macro GO_LDFLAGS(FLAGS...) {
  7359. SET_APPEND(GO_LDFLAGS_GLOBAL $FLAGS)
  7360. }
  7361. # tag:go-specific
  7362. CGO_CFLAGS_VALUE=
  7363. ### @usage: CGO_CFLAGS(Flags...)
  7364. ### Compiler flags specific to CGO compilation
  7365. macro CGO_CFLAGS(FLAGS...) {
  7366. SET_APPEND(CGO_CFLAGS_VALUE $FLAGS)
  7367. CFLAGS($FLAGS)
  7368. }
  7369. # tag:go-specific
  7370. CGO_LDFLAGS_VALUE=
  7371. ### @usage: CGO_LDFLAGS(Files...)
  7372. ### Linker flags specific to CGO linking
  7373. macro CGO_LDFLAGS(FLAGS...) {
  7374. SET_APPEND(CGO_LDFLAGS_VALUE $FLAGS)
  7375. GO_LDFLAGS($FLAGS)
  7376. }
  7377. # tag:go-specific
  7378. _GO_SKIP_TEST_VALUE=
  7379. ### @usage: GO_SKIP_TESTS(TestNames...)
  7380. ###
  7381. ### Define a set of tests that should not be run.
  7382. ### NB! Subtests are not taken into account!
  7383. macro GO_SKIP_TESTS(TESTS...) {
  7384. SET_APPEND(_GO_SKIP_TEST_VALUE $TESTS)
  7385. RESTRICT_PATH(vendor MSG This macro is prohibited to be used outside the vendor/ directory)
  7386. }
  7387. # tag:go-specific tag:internal
  7388. _GO_EMBED_VALUE=
  7389. _GO_EMBED_INPUTS=
  7390. ### @usage: _GO_EMBED_PATTERN(PATTERN) # internal
  7391. ###
  7392. ### Define an embed pattern.
  7393. macro _GO_EMBED_PATTERN(XTEST?"_xtest":"", PATTERN, IMPORT_PATH) {
  7394. SET(VAR_SALT1 $XTEST $PATTERN $IMPORT_PATH 1)
  7395. SET(_PATTERN_GLOB1 uniq_embed_${hash:VAR_SALT1})
  7396. _GLOB($_PATTERN_GLOB1 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/.*)
  7397. SET(VAR_SALT2 $XTEST $PATTERN $IMPORT_PATH 2)
  7398. SET(_PATTERN_GLOB2 _uniq_embed_${hash:VAR_SALT2})
  7399. _GLOB($_PATTERN_GLOB2 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN})
  7400. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $PATTERN \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7401. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7402. }
  7403. # tag:go-specific
  7404. ### @usage: GO_EMBED_PATTERN(PATTERN)
  7405. ###
  7406. ### Define an embed pattern.
  7407. macro GO_EMBED_PATTERN(PATTERN) {
  7408. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7409. }
  7410. # tag:go-specific
  7411. ### @usage: GO_TEST_EMBED_PATTERN(PATTERN)
  7412. ###
  7413. ### Define an embed pattern for internal go tests.
  7414. macro GO_TEST_EMBED_PATTERN(PATTERN) {
  7415. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7416. }
  7417. # tag:go-specific
  7418. ### @usage: GO_XTEST_EMBED_PATTERN(PATTERN)
  7419. ###
  7420. ### Define an embed pattern for external go tests.
  7421. macro GO_XTEST_EMBED_PATTERN(PATTERN) {
  7422. _GO_EMBED_PATTERN(XTEST $PATTERN $_GO_IMPORT_PATH)
  7423. }
  7424. # tag:go-specific tag:internal
  7425. ### @usage: _GO_EMBED_DIR(PATTERN) # internal
  7426. ###
  7427. ### Define an embed directory DIR.
  7428. macro _GO_EMBED_DIR(XTEST?"_xtest":"", DIR, IMPORT_PATH) {
  7429. SET(VAR_SALT $XTEST $DIR $IMPORT_PATH)
  7430. SET(_PATTERN_GLOB uniq_embed_${hash:VAR_SALT})
  7431. _GLOB($_PATTERN_GLOB ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/.*)
  7432. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $DIR \$$_PATTERN_GLOB)
  7433. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB)
  7434. }
  7435. # tag:go-specific
  7436. ### @usage: GO_EMBED_DIR(DIR)
  7437. ###
  7438. ### Define an embed directory DIR.
  7439. macro GO_EMBED_DIR(DIR) {
  7440. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH)
  7441. }
  7442. # tag:go-specific
  7443. ### @usage: GO_TEST_EMBED_DIR(DIR)
  7444. ###
  7445. ### Define an embed directory DIR for internal go tests.
  7446. macro GO_EMBED_TEST_DIR(DIR) {
  7447. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH)
  7448. }
  7449. # tag:go-specific
  7450. ### @usage: GO_XTEST_EMBED_DIR(DIR)
  7451. ###
  7452. ### Define an embed directory DIR for external go tests.
  7453. macro GO_EMBED_XTEST_DIR(DIR) {
  7454. _GO_EMBED_DIR(XTEST $DIR $_GO_IMPORT_PATH)
  7455. }
  7456. # tag:go-specific
  7457. _GO_TOOLCHAIN_ENV_GOARCH=unknown
  7458. when ($ARCH_ARM64) {
  7459. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=arm64"}
  7460. }
  7461. elsewhen ($ARCH_X86_64) {
  7462. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=amd64"}
  7463. }
  7464. # tag:go-specific
  7465. _GO_TOOLCHAIN_ENV_GOOS=unknown
  7466. when ($OS_DARWIN) {
  7467. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=darwin"}
  7468. }
  7469. elsewhen ($OS_LINUX) {
  7470. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=linux"}
  7471. }
  7472. elsewhen ($OS_WINDOWS) {
  7473. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=windows"}
  7474. }
  7475. _GO_TOOLCHAIN_ENV_PATH=
  7476. # tag:go-specific
  7477. GO_TOOLCHAIN_ENV=$TOOLCHAIN_ENV $_GO_TOOLCHAIN_ENV_GOARCH $_GO_TOOLCHAIN_ENV_GOOS $_GO_TOOLCHAIN_ENV_PATH
  7478. # tag:go-specific
  7479. _GO_GRPC_WELLKNOWN=\
  7480. vendor/google.golang.org/grpc \
  7481. vendor/google.golang.org/grpc \
  7482. vendor/google.golang.org/grpc/codes \
  7483. vendor/google.golang.org/grpc/grpclog \
  7484. vendor/google.golang.org/grpc/status
  7485. # tag:go-specific
  7486. macro _GO_GRPC() {
  7487. SET(GO_PROTO_GEN_PLUGINS grpc)
  7488. PEERDIR(${GOSTD}/context ${_GO_GRPC_WELLKNOWN})
  7489. }
  7490. # tag:go-specific
  7491. ### @usage: GO_GRPC_GATEWAY_SRCS()
  7492. ###
  7493. ### Use of grpc-gateway plugin (Supported for Go only).
  7494. macro GO_GRPC_GATEWAY_SRCS(FILE...) {
  7495. ENABLE(UNUSED_MACRO)
  7496. }
  7497. # tag:go-specific
  7498. ### @usage: GO_GRPC_GATEWAY_SWAGGER_SRCS()
  7499. ###
  7500. ### Use of grpc-gateway plugin w/ swagger emission (Supported for Go only).
  7501. macro GO_GRPC_GATEWAY_SWAGGER_SRCS(FILE...) {
  7502. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  7503. }
  7504. # tag:go-specific
  7505. _GO_PROTO_GRPC_GATEWAY_OPTS=
  7506. _GO_PROTO_GRPC_GATEWAY_OUTS=
  7507. # tag:go-specific
  7508. macro _GO_GRPC_GATEWAY_SRCS_IMPL(Files...) {
  7509. foreach (File : $Files) {
  7510. [.proto]=$_GO_PROTO_CMD_IMPL($File OPTS $_GO_PROTO_GRPC_GATEWAY_OPTS OUTS $_GO_PROTO_GRPC_GATEWAY_OUTS)
  7511. }
  7512. PEERDIR(${GOSTD}/context ${GOSTD}/io ${GOSTD}/net/http)
  7513. PEERDIR(vendor/github.com/golang/protobuf/descriptor)
  7514. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/runtime)
  7515. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/utilities)
  7516. PEERDIR(vendor/google.golang.org/grpc/metadata)
  7517. }
  7518. # tag:go-specific
  7519. macro _SETUP_GO_GRPC_GATEWAY() {
  7520. 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:))
  7521. SET(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;nopath;noext;suf=.pb.gw.go:File})
  7522. }
  7523. # tag:go-specific
  7524. macro _GO_GRPC_GATEWAY_SRCS(Files...) {
  7525. _SETUP_GO_GRPC_GATEWAY()
  7526. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  7527. }
  7528. # tag:go-specific
  7529. macro _GO_GRPC_GATEWAY_SWAGGER_SRCS(Files...) {
  7530. _SETUP_GO_GRPC_GATEWAY()
  7531. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OPTS $_PROTO_PLUGIN_ARGS_BASE(swagger vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger logtostderr=true:))
  7532. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;noauto;nopath;noext;suf=.swagger.json:File})
  7533. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  7534. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  7535. }
  7536. # tag:go-specific
  7537. when ($MUSL == "yes") {
  7538. _GO_DEFAULT_ALLOCATOR=$DEFAULT_ALLOCATOR
  7539. }
  7540. otherwise {
  7541. _GO_DEFAULT_ALLOCATOR=FAKE
  7542. }
  7543. # tag:go-specific tag:internal
  7544. ### @usage _GO_BASE_UNIT # internal
  7545. ###
  7546. ### The base module of all golang modules. Defines common properties, dependencies and rules for go build.
  7547. module _GO_BASE_UNIT: _BASE_UNIT {
  7548. .EXTS=.go .gosrc .o .obj .a .symabis .mf
  7549. .CMD=TOUCH_UNIT
  7550. .NODE_TYPE=Bundle
  7551. .GLOBAL=GO_LDFLAGS
  7552. .PEERDIR_POLICY=as_build_from
  7553. .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
  7554. .ALLOWED=GO_PROTO_PLUGIN USE_CXX USE_UTIL RESOURCE_FILES
  7555. .IGNORED=GO_SKIP_TESTS USE_SKIFF
  7556. .DEFAULT_NAME_GENERATOR=UseDirNameOrSetGoPackage
  7557. ENABLE(_GO_MODULE)
  7558. SET(MODULE_TAG GO)
  7559. PEERDIR_TAGS=GO GO_PROTO GO_FBS __EMPTY__
  7560. DEFAULT(_GO_VET_TOOL)
  7561. DEFAULT(_GO_VET_FLAGS)
  7562. DEFAULT(_GO_VET_EXTS)
  7563. DEFAULT(_GO_SONAME)
  7564. NO_RUNTIME()
  7565. SET(COVERAGE_FLAGS)
  7566. SET(EXTRA_OUTPUT)
  7567. SET(MODULE_LANG GO)
  7568. PEERDIR(build/external_resources/go_tools)
  7569. GO_PROTO_OUTS+=${output;hide;norel;nopath;noext;suf=.pb.go:File}
  7570. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  7571. PEERDIR+=$COMPILER_PLATFORM
  7572. }
  7573. when ($CLANG == "yes" || $GCC == "yes") {
  7574. CGO_CFLAGS_VALUE += -w -pthread -fpic
  7575. CGO2_CFLAGS_VALUE += -Wno-unused-variable
  7576. }
  7577. select ($GO_VET) {
  7578. "yes" | "on" ? {
  7579. _GO_VET=yes
  7580. _GO_VET_FLAGS+=-cgocall=false
  7581. }
  7582. "yndexer" ? {
  7583. _GO_VET=yes
  7584. PEERDIR+=build/external_resources/goyndexer
  7585. _GO_VET_TOOL=${GOYNDEXER_RESOURCE_GLOBAL}/goyndexer
  7586. _GO_YDX_FILE=++ydx-file ${_GO_YNDEXER_EXT}
  7587. _GO_VET_FLAGS=-indexer.arc ${ARCADIA_ROOT} -indexer.indexfile ${GO_YNDEXER_OUTPUT} -indexer.loglevel info
  7588. _GO_FMT_ADD_CHECK=no
  7589. _GO_VET_ADD_CHECK=no
  7590. GO_VET_INFO_EXT=.ydx.out
  7591. GO_VET_REPORT_EXT=.ydx.txt
  7592. _GO_VET_EXTS=++vet-info-ext .ydx.out ++vet-report-ext .ydx.txt
  7593. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=__ARCADIA_BUILD_ROOT_PREFIX__ --source-prefix=__ARCADIA_SOURCE_ROOT_PREFIX__
  7594. }
  7595. "yolint" ? {
  7596. _GO_VET=yes
  7597. PEERDIR+=build/external_resources/yolint
  7598. _GO_VET_TOOL=${YOLINT_RESOURCE_GLOBAL}/yolint
  7599. _GO_VET_FLAGS=-migration.config=${input:"${ARCADIA_ROOT}/build/rules/go/migrations.yaml"} -scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
  7600. }
  7601. "yolint_next" ? {
  7602. _GO_VET=yes
  7603. PEERDIR+=build/external_resources/yolint
  7604. _GO_VET_TOOL=${YOLINT_NEXT_RESOURCE_GLOBAL}/yolint
  7605. _GO_VET_FLAGS=-scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
  7606. }
  7607. "local" ? {
  7608. _GO_VET=yes
  7609. _GO_VET_FLAGS=
  7610. }
  7611. default ? {
  7612. _GO_VET=no
  7613. _GO_VET_FLAGS=
  7614. }
  7615. }
  7616. SET(_GO_VET $_GO_VET)
  7617. when ($GO_VET_TOOL == "") {
  7618. _GO_VET_TOOL_REAL=$_GO_VET_TOOL
  7619. }
  7620. otherwise {
  7621. _GO_VET_TOOL_REAL=$GO_VET_TOOL
  7622. }
  7623. when ($GO_VET_FLAGS == "") {
  7624. _GO_VET_FLAGS_REAL=$_GO_VET_FLAGS
  7625. }
  7626. otherwise {
  7627. _GO_VET_FLAGS_REAL=$GO_VET_FLAGS
  7628. }
  7629. when ($_GO_VET == "yes" && $NO_GO_VET != "yes") {
  7630. 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
  7631. }
  7632. otherwise {
  7633. GO_VET_OUTPUT=
  7634. _GO_VET_ADD_CHECK=no
  7635. }
  7636. when ($GO_DEBUG_PATH_RELATIVE == "yes") {
  7637. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=;build=;tools= ++tools-root $(TOOL_ROOT)
  7638. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>;$ARCADIA_BUILD_ROOT=>;$(TOOL_ROOT)=>
  7639. }
  7640. otherwise {
  7641. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=/-S;build=/-B;tools=/-T ++tools-root $(TOOL_ROOT)
  7642. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>/-S;$ARCADIA_BUILD_ROOT=>/-B;$(TOOL_ROOT)=>/-T
  7643. }
  7644. _GO_PROCESS_SRCS()
  7645. when ($CLANG == "yes") {
  7646. _GO_EXTLD=clang
  7647. GO_TOOLCHAIN_ENV += ${env:"CC=clang"}
  7648. }
  7649. otherwise {
  7650. _GO_EXTLD=gcc
  7651. GO_TOOLCHAIN_ENV += ${env:"CC=gcc"}
  7652. }
  7653. when ($OS_DARWIN) {
  7654. PEERDIR+=build/external_resources/go_fake_xcrun
  7655. 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
  7656. CGO2_LDFLAGS_VALUE += $LD_SDK_VERSION -undefined dynamic_lookup -nodefaultlibs -lc
  7657. }
  7658. elsewhen ($OS_LINUX) {
  7659. 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
  7660. CGO2_LDFLAGS_VALUE += -Wl,--unresolved-symbols=ignore-all -nodefaultlibs -lc
  7661. }
  7662. otherwise {
  7663. GO_EXTLD = ++extld $_GO_EXTLD
  7664. }
  7665. when ($RACE == "yes") {
  7666. _GO_COMPILE_FLAGS_RACE=-race
  7667. _GO_LINK_FLAGS_RACE=-race
  7668. }
  7669. otherwise {
  7670. _GO_COMPILE_FLAGS_RACE=
  7671. _GO_LINK_FLAGS_RACE=
  7672. }
  7673. when ($PIC == "yes") {
  7674. _GO_COMPILE_FLAGS_SHARED=-shared
  7675. _GO_ASM_FLAGS_SHARED=-shared
  7676. }
  7677. otherwise {
  7678. _GO_COMPILE_FLAGS_SHARED=
  7679. _GO_ASM_FLAGS_SHARED=
  7680. }
  7681. GO_ASM_FLAGS_VALUE += $_GO_ASM_FLAGS_SHARED
  7682. GO_COMPILE_FLAGS_VALUE += $_GO_COMPILE_FLAGS_RACE $_GO_COMPILE_FLAGS_SHARED
  7683. GO_LINK_FLAGS_VALUE += $_GO_LINK_FLAGS_RACE
  7684. ADDINCL(${GOSTD}/runtime)
  7685. }
  7686. # tag:go-specific
  7687. ### @usage: GO_LIBRARY([name])
  7688. ###
  7689. ### Go library module definition.
  7690. ### Compile Go module as a library suitable for PEERDIR from other Go modules.
  7691. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7692. module GO_LIBRARY: _GO_BASE_UNIT {
  7693. .CMD=GO_LINK_LIB
  7694. .NODE_TYPE=Bundle
  7695. .FINAL_TARGET=no
  7696. SET(_GO_TOOL_MODE lib)
  7697. SET(MODULE_TYPE LIBRARY)
  7698. _REQUIRE_EXPLICIT_LICENSE(vendor)
  7699. MODULE_SUFFIX=.a
  7700. }
  7701. # tag:go-specific
  7702. ### @usage: GO_PROGRAM([name])
  7703. ###
  7704. ### Go program module definition.
  7705. ### Compile and link Go module to an executable program.
  7706. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7707. module GO_PROGRAM: _GO_BASE_UNIT {
  7708. .CMD=GO_LINK_EXE
  7709. .NODE_TYPE=Bundle
  7710. .SYMLINK_POLICY=EXE
  7711. .ALLOWED=INDUCED_DEPS
  7712. .FINAL_TARGET=yes
  7713. SET(_GO_TOOL_MODE exe)
  7714. SET(MODULE_TYPE PROGRAM)
  7715. SET(GO_VET_OUTPUT_INFO)
  7716. ALLOCATOR($_GO_DEFAULT_ALLOCATOR)
  7717. _USE_LINKER()
  7718. ENABLE(COMMON_LINK_SETTINGS)
  7719. when ($MUSL == "yes") {
  7720. PEERDIR += contrib/libs/musl/full
  7721. }
  7722. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7723. MODULE_SUFFIX=.exe
  7724. }
  7725. PEERDIR(${GOSTD}/runtime library/go/core/buildinfo)
  7726. when ($RACE == "yes") {
  7727. PEERDIR += ${GOSTD}/runtime/cgo
  7728. PEERDIR += ${GOSTD}/runtime/race
  7729. }
  7730. when ($MUSL == "yes") {
  7731. GO_WITH_MUSL = ++musl
  7732. }
  7733. }
  7734. # tag:go-specific
  7735. module _GO_DLL_BASE_UNIT: GO_PROGRAM {
  7736. .CMD=GO_LINK_DLL
  7737. .SYMLINK_POLICY=SO
  7738. .ALLOWED=WHOLE_ARCHIVE
  7739. .ARGS_PARSER=DLL
  7740. SET(_GO_TOOL_MODE dll)
  7741. SET(MODULE_TYPE DLL)
  7742. GO_PACKAGE_NAME(main)
  7743. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7744. MODULE_SUFFIX=.dll
  7745. }
  7746. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  7747. MODULE_PREFIX=lib
  7748. MODULE_SUFFIX=.dylib$MODULE_VERSION
  7749. }
  7750. otherwise {
  7751. MODULE_PREFIX=lib
  7752. MODULE_SUFFIX=.so$MODULE_VERSION
  7753. }
  7754. when ($OS_DARWIN) {
  7755. _GO_SONAME=-Wl,-install_name,$SONAME
  7756. }
  7757. elsewhen ($OS_LINUX) {
  7758. _GO_SONAME=-Wl,-soname,$SONAME
  7759. }
  7760. when ($MODULE_VERSION) {
  7761. when ($OS_LINUX || $OS_DARWIN) {
  7762. _GO_LINK_EXE_EXT_CMD+= && $LINK_OR_COPY_CMD $TARGET ${output;nopath;noext:SONAME}
  7763. }
  7764. }
  7765. }
  7766. # tag:go-specific
  7767. ### @usage: GO_DLL(name major_ver [minor_ver] [PREFIX prefix])
  7768. ###
  7769. ### Go ishared object module definition.
  7770. ### Compile and link Go module to a shared object.
  7771. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7772. module GO_DLL: _GO_DLL_BASE_UNIT {
  7773. }
  7774. # tag:go-specific tag:test
  7775. ### @usage: GO_BENCH_TIMEOUT(x)
  7776. ###
  7777. ### Sets timeout in seconds for 1 Benchmark in go benchmark suite
  7778. ###
  7779. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  7780. macro GO_BENCH_TIMEOUT(bench_timeout) {
  7781. SET(GO_BENCH_TIMEOUT $bench_timeout)
  7782. }
  7783. # tag:go-specific tag:test
  7784. ### @usage: GO_TEST([name])
  7785. ###
  7786. ### Go test module definition.
  7787. ### Compile and link Go module as a test suitable for running with Arcadia testing support.
  7788. ### All usual testing support macros like DATA, DEPENDS, SIZE, REQUIREMENTS etc. are supported.
  7789. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7790. module GO_TEST: GO_PROGRAM {
  7791. .CMD=GO_LINK_TEST
  7792. .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
  7793. .ALLOWED=GO_SKIP_TESTS YT_SPEC
  7794. .FINAL_TARGET=no
  7795. SET(_GO_TOOL_MODE test)
  7796. SET(MODULE_TYPE PROGRAM)
  7797. ENABLE(GO_TEST_MODULE)
  7798. SET(GO_COVER_INFO_VALUE)
  7799. # We have to add uncoditionaly PEERDIR to ${GOSTD}/os here thouth it is really
  7800. # needed when TestMain is defined in the source code of the test
  7801. PEERDIR(${GOSTD}/os)
  7802. PEERDIR(${GOSTD}/testing/internal/testdeps)
  7803. PEERDIR(${GOSTD}/testing)
  7804. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.test)
  7805. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.bench)
  7806. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  7807. }
  7808. # tag:go-specific
  7809. macro GO_MOCKGEN_FROM(Path) {
  7810. SET(MOCKGEN_FROM ${Path})
  7811. }
  7812. # tag:go-specific
  7813. macro GO_MOCKGEN_TYPES(First, Rest...) {
  7814. SET(MOCKGEN_FIRST $First)
  7815. SET(MOCKGEN_REST $Rest)
  7816. }
  7817. # tag:go-specific
  7818. macro GO_MOCKGEN_REFLECT() {
  7819. PEERDIR(${GOSTD}/encoding/gob)
  7820. PEERDIR(${GOSTD}/flag)
  7821. PEERDIR(${GOSTD}/fmt)
  7822. PEERDIR(${GOSTD}/os)
  7823. PEERDIR(${GOSTD}/path)
  7824. PEERDIR(${GOSTD}/reflect)
  7825. PEERDIR(vendor/github.com/golang/mock/mockgen/model)
  7826. PEERDIR(${MOCKGEN_FROM})
  7827. RUN_PROGRAM(vendor/github.com/golang/mock/mockgen -prog_only a.yandex-team.ru/${MOCKGEN_FROM} $MOCKGEN_FIRST${pre=$__COMMA__:MOCKGEN_REST} STDOUT main.go)
  7828. }
  7829. # tag:go-specific
  7830. macro GO_MOCKGEN_MOCKS() {
  7831. PEERDIR(${GOSTD}/reflect)
  7832. PEERDIR(vendor/github.com/golang/mock/gomock)
  7833. RUN_PROGRAM(vendor/github.com/golang/mock/mockgen -package mocks -exec_only ${BINDIR}/gen/gen a.yandex-team.ru/${MOCKGEN_FROM} $MOCKGEN_FIRST${pre=$__COMMA__:MOCKGEN_REST} TOOL ${MODDIR}/gen STDOUT mocks.go)
  7834. }
  7835. # Conflict between protobuf-java and protobuf-javalite ¯\_(ツ)_/¯
  7836. # both libraries are required by grpc
  7837. JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE=\
  7838. com.google.protobuf.AbstractMessageLite \
  7839. com.google.protobuf.AbstractMessageLite$Builder \
  7840. com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream \
  7841. com.google.protobuf.AbstractMessageLite$InternalOneOfEnum \
  7842. com.google.protobuf.AbstractParser \
  7843. com.google.protobuf.AbstractProtobufList \
  7844. com.google.protobuf.AllocatedBuffer \
  7845. com.google.protobuf.AllocatedBuffer$1 \
  7846. com.google.protobuf.AllocatedBuffer$2 \
  7847. com.google.protobuf.Android \
  7848. com.google.protobuf.Any \
  7849. com.google.protobuf.Any$1 \
  7850. com.google.protobuf.Any$Builder \
  7851. com.google.protobuf.AnyOrBuilder \
  7852. com.google.protobuf.AnyProto \
  7853. com.google.protobuf.Api \
  7854. com.google.protobuf.Api$1 \
  7855. com.google.protobuf.Api$Builder \
  7856. com.google.protobuf.ApiOrBuilder \
  7857. com.google.protobuf.ApiProto \
  7858. com.google.protobuf.ArrayDecoders \
  7859. com.google.protobuf.ArrayDecoders$1 \
  7860. com.google.protobuf.ArrayDecoders$Registers \
  7861. com.google.protobuf.BinaryReader \
  7862. com.google.protobuf.BinaryReader$1 \
  7863. com.google.protobuf.BinaryReader$SafeHeapReader \
  7864. com.google.protobuf.BinaryWriter \
  7865. com.google.protobuf.BinaryWriter$1 \
  7866. com.google.protobuf.BinaryWriter$SafeDirectWriter \
  7867. com.google.protobuf.BinaryWriter$SafeHeapWriter \
  7868. com.google.protobuf.BinaryWriter$UnsafeDirectWriter \
  7869. com.google.protobuf.BinaryWriter$UnsafeHeapWriter \
  7870. com.google.protobuf.BooleanArrayList \
  7871. com.google.protobuf.BoolValue \
  7872. com.google.protobuf.BoolValue$1 \
  7873. com.google.protobuf.BoolValue$Builder \
  7874. com.google.protobuf.BoolValueOrBuilder \
  7875. com.google.protobuf.BufferAllocator \
  7876. com.google.protobuf.BufferAllocator$1 \
  7877. com.google.protobuf.ByteBufferWriter \
  7878. com.google.protobuf.ByteOutput \
  7879. com.google.protobuf.ByteString \
  7880. com.google.protobuf.ByteString$1 \
  7881. com.google.protobuf.ByteString$2 \
  7882. com.google.protobuf.ByteString$AbstractByteIterator \
  7883. com.google.protobuf.ByteString$ArraysByteArrayCopier \
  7884. com.google.protobuf.ByteString$BoundedByteString \
  7885. com.google.protobuf.ByteString$ByteArrayCopier \
  7886. com.google.protobuf.ByteString$ByteIterator \
  7887. com.google.protobuf.ByteString$CodedBuilder \
  7888. com.google.protobuf.ByteString$LeafByteString \
  7889. com.google.protobuf.ByteString$LiteralByteString \
  7890. com.google.protobuf.ByteString$Output \
  7891. com.google.protobuf.ByteString$SystemByteArrayCopier \
  7892. com.google.protobuf.BytesValue \
  7893. com.google.protobuf.BytesValue$1 \
  7894. com.google.protobuf.BytesValue$Builder \
  7895. com.google.protobuf.BytesValueOrBuilder \
  7896. com.google.protobuf.CanIgnoreReturnValue \
  7897. com.google.protobuf.CheckReturnValue \
  7898. com.google.protobuf.CodedInputStream \
  7899. com.google.protobuf.CodedInputStream$1 \
  7900. com.google.protobuf.CodedInputStream$ArrayDecoder \
  7901. com.google.protobuf.CodedInputStream$IterableDirectByteBufferDecoder \
  7902. com.google.protobuf.CodedInputStream$StreamDecoder \
  7903. com.google.protobuf.CodedInputStream$StreamDecoder$RefillCallback \
  7904. com.google.protobuf.CodedInputStream$StreamDecoder$SkippedDataSink \
  7905. com.google.protobuf.CodedInputStream$UnsafeDirectNioDecoder \
  7906. com.google.protobuf.CodedInputStreamReader \
  7907. com.google.protobuf.CodedInputStreamReader$1 \
  7908. com.google.protobuf.CodedOutputStream \
  7909. com.google.protobuf.CodedOutputStream$1 \
  7910. com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder \
  7911. com.google.protobuf.CodedOutputStream$ArrayEncoder \
  7912. com.google.protobuf.CodedOutputStream$ByteOutputEncoder \
  7913. com.google.protobuf.CodedOutputStream$HeapNioEncoder \
  7914. com.google.protobuf.CodedOutputStream$OutOfSpaceException \
  7915. com.google.protobuf.CodedOutputStream$OutputStreamEncoder \
  7916. com.google.protobuf.CodedOutputStream$SafeDirectNioEncoder \
  7917. com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder \
  7918. com.google.protobuf.CodedOutputStreamWriter \
  7919. com.google.protobuf.CodedOutputStreamWriter$1 \
  7920. com.google.protobuf.DoubleArrayList \
  7921. com.google.protobuf.DoubleValue \
  7922. com.google.protobuf.DoubleValue$1 \
  7923. com.google.protobuf.DoubleValue$Builder \
  7924. com.google.protobuf.DoubleValueOrBuilder \
  7925. com.google.protobuf.Duration \
  7926. com.google.protobuf.Duration$1 \
  7927. com.google.protobuf.Duration$Builder \
  7928. com.google.protobuf.DurationOrBuilder \
  7929. com.google.protobuf.DurationProto \
  7930. com.google.protobuf.Empty \
  7931. com.google.protobuf.Empty$1 \
  7932. com.google.protobuf.Empty$Builder \
  7933. com.google.protobuf.EmptyOrBuilder \
  7934. com.google.protobuf.EmptyProto \
  7935. com.google.protobuf.Enum \
  7936. com.google.protobuf.Enum$1 \
  7937. com.google.protobuf.Enum$Builder \
  7938. com.google.protobuf.EnumOrBuilder \
  7939. com.google.protobuf.EnumValue \
  7940. com.google.protobuf.EnumValue$1 \
  7941. com.google.protobuf.EnumValue$Builder \
  7942. com.google.protobuf.EnumValueOrBuilder \
  7943. com.google.protobuf.ExperimentalApi \
  7944. com.google.protobuf.ExtensionLite \
  7945. com.google.protobuf.ExtensionRegistryFactory \
  7946. com.google.protobuf.ExtensionRegistryLite \
  7947. com.google.protobuf.ExtensionRegistryLite$ExtensionClassHolder \
  7948. com.google.protobuf.ExtensionRegistryLite$ObjectIntPair \
  7949. com.google.protobuf.ExtensionSchema \
  7950. com.google.protobuf.ExtensionSchemaLite \
  7951. com.google.protobuf.ExtensionSchemaLite$1 \
  7952. com.google.protobuf.ExtensionSchemas \
  7953. com.google.protobuf.Field \
  7954. com.google.protobuf.Field$1 \
  7955. com.google.protobuf.Field$Builder \
  7956. com.google.protobuf.Field$Cardinality \
  7957. com.google.protobuf.Field$Cardinality$1 \
  7958. com.google.protobuf.Field$Kind \
  7959. com.google.protobuf.Field$Kind$1 \
  7960. com.google.protobuf.FieldInfo \
  7961. com.google.protobuf.FieldInfo$1 \
  7962. com.google.protobuf.FieldInfo$Builder \
  7963. com.google.protobuf.FieldMask \
  7964. com.google.protobuf.FieldMask$1 \
  7965. com.google.protobuf.FieldMask$Builder \
  7966. com.google.protobuf.FieldMaskOrBuilder \
  7967. com.google.protobuf.FieldMaskProto \
  7968. com.google.protobuf.FieldOrBuilder \
  7969. com.google.protobuf.FieldSet \
  7970. com.google.protobuf.FieldSet$1 \
  7971. com.google.protobuf.FieldSet$Builder \
  7972. com.google.protobuf.FieldSet$FieldDescriptorLite \
  7973. com.google.protobuf.FieldType \
  7974. com.google.protobuf.FieldType$1 \
  7975. com.google.protobuf.FieldType$Collection \
  7976. com.google.protobuf.FloatArrayList \
  7977. com.google.protobuf.FloatValue \
  7978. com.google.protobuf.FloatValue$1 \
  7979. com.google.protobuf.FloatValue$Builder \
  7980. com.google.protobuf.FloatValueOrBuilder \
  7981. com.google.protobuf.GeneratedMessageInfoFactory \
  7982. com.google.protobuf.GeneratedMessageLite \
  7983. com.google.protobuf.GeneratedMessageLite$1 \
  7984. com.google.protobuf.GeneratedMessageLite$Builder \
  7985. com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser \
  7986. com.google.protobuf.GeneratedMessageLite$ExtendableBuilder \
  7987. com.google.protobuf.GeneratedMessageLite$ExtendableMessage \
  7988. com.google.protobuf.GeneratedMessageLite$ExtendableMessage$ExtensionWriter \
  7989. com.google.protobuf.GeneratedMessageLite$ExtendableMessageOrBuilder \
  7990. com.google.protobuf.GeneratedMessageLite$ExtensionDescriptor \
  7991. com.google.protobuf.GeneratedMessageLite$GeneratedExtension \
  7992. com.google.protobuf.GeneratedMessageLite$MethodToInvoke \
  7993. com.google.protobuf.GeneratedMessageLite$SerializedForm \
  7994. com.google.protobuf.Int32Value \
  7995. com.google.protobuf.Int32Value$1 \
  7996. com.google.protobuf.Int32Value$Builder \
  7997. com.google.protobuf.Int32ValueOrBuilder \
  7998. com.google.protobuf.Int64Value \
  7999. com.google.protobuf.Int64Value$1 \
  8000. com.google.protobuf.Int64Value$Builder \
  8001. com.google.protobuf.Int64ValueOrBuilder \
  8002. com.google.protobuf.IntArrayList \
  8003. com.google.protobuf.Internal \
  8004. com.google.protobuf.Internal$BooleanList \
  8005. com.google.protobuf.Internal$DoubleList \
  8006. com.google.protobuf.Internal$EnumLite \
  8007. com.google.protobuf.Internal$EnumLiteMap \
  8008. com.google.protobuf.Internal$EnumVerifier \
  8009. com.google.protobuf.Internal$FloatList \
  8010. com.google.protobuf.Internal$IntList \
  8011. com.google.protobuf.Internal$ListAdapter \
  8012. com.google.protobuf.Internal$ListAdapter$Converter \
  8013. com.google.protobuf.Internal$LongList \
  8014. com.google.protobuf.Internal$MapAdapter \
  8015. com.google.protobuf.Internal$MapAdapter$1 \
  8016. com.google.protobuf.Internal$MapAdapter$Converter \
  8017. com.google.protobuf.Internal$MapAdapter$EntryAdapter \
  8018. com.google.protobuf.Internal$MapAdapter$IteratorAdapter \
  8019. com.google.protobuf.Internal$MapAdapter$SetAdapter \
  8020. com.google.protobuf.Internal$ProtobufList \
  8021. com.google.protobuf.InvalidProtocolBufferException \
  8022. com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException \
  8023. com.google.protobuf.IterableByteBufferInputStream \
  8024. com.google.protobuf.JavaType \
  8025. com.google.protobuf.LazyField \
  8026. com.google.protobuf.LazyField$1 \
  8027. com.google.protobuf.LazyField$LazyEntry \
  8028. com.google.protobuf.LazyField$LazyIterator \
  8029. com.google.protobuf.LazyFieldLite \
  8030. com.google.protobuf.LazyStringArrayList \
  8031. com.google.protobuf.LazyStringArrayList$ByteArrayListView \
  8032. com.google.protobuf.LazyStringArrayList$ByteStringListView \
  8033. com.google.protobuf.LazyStringList \
  8034. com.google.protobuf.ListFieldSchema \
  8035. com.google.protobuf.ListFieldSchema$1 \
  8036. com.google.protobuf.ListFieldSchema$ListFieldSchemaFull \
  8037. com.google.protobuf.ListFieldSchema$ListFieldSchemaLite \
  8038. com.google.protobuf.ListValue \
  8039. com.google.protobuf.ListValue$1 \
  8040. com.google.protobuf.ListValue$Builder \
  8041. com.google.protobuf.ListValueOrBuilder \
  8042. com.google.protobuf.LongArrayList \
  8043. com.google.protobuf.ManifestSchemaFactory \
  8044. com.google.protobuf.ManifestSchemaFactory$1 \
  8045. com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory \
  8046. com.google.protobuf.MapEntryLite \
  8047. com.google.protobuf.MapEntryLite$1 \
  8048. com.google.protobuf.MapEntryLite$Metadata \
  8049. com.google.protobuf.MapFieldLite \
  8050. com.google.protobuf.MapFieldSchema \
  8051. com.google.protobuf.MapFieldSchemaLite \
  8052. com.google.protobuf.MapFieldSchemas \
  8053. com.google.protobuf.MessageInfo \
  8054. com.google.protobuf.MessageInfoFactory \
  8055. com.google.protobuf.MessageLite \
  8056. com.google.protobuf.MessageLite$Builder \
  8057. com.google.protobuf.MessageLiteOrBuilder \
  8058. com.google.protobuf.MessageLiteToString \
  8059. com.google.protobuf.MessageSchema \
  8060. com.google.protobuf.MessageSchema$1 \
  8061. com.google.protobuf.MessageSetSchema \
  8062. com.google.protobuf.Method \
  8063. com.google.protobuf.Method$1 \
  8064. com.google.protobuf.Method$Builder \
  8065. com.google.protobuf.MethodOrBuilder \
  8066. com.google.protobuf.Mixin \
  8067. com.google.protobuf.Mixin$1 \
  8068. com.google.protobuf.Mixin$Builder \
  8069. com.google.protobuf.MixinOrBuilder \
  8070. com.google.protobuf.MutabilityOracle \
  8071. com.google.protobuf.MutabilityOracle$1 \
  8072. com.google.protobuf.NewInstanceSchema \
  8073. com.google.protobuf.NewInstanceSchemaLite \
  8074. com.google.protobuf.NewInstanceSchemas \
  8075. com.google.protobuf.NioByteString \
  8076. com.google.protobuf.NioByteString$1 \
  8077. com.google.protobuf.NullValue \
  8078. com.google.protobuf.NullValue$1 \
  8079. com.google.protobuf.OneofInfo \
  8080. com.google.protobuf.Option \
  8081. com.google.protobuf.Option$1 \
  8082. com.google.protobuf.Option$Builder \
  8083. com.google.protobuf.OptionOrBuilder \
  8084. com.google.protobuf.Parser \
  8085. com.google.protobuf.PrimitiveNonBoxingCollection \
  8086. com.google.protobuf.Protobuf \
  8087. com.google.protobuf.ProtobufArrayList \
  8088. com.google.protobuf.ProtobufLists \
  8089. com.google.protobuf.ProtocolStringList \
  8090. com.google.protobuf.ProtoSyntax \
  8091. com.google.protobuf.RawMessageInfo \
  8092. com.google.protobuf.Reader \
  8093. com.google.protobuf.RopeByteString \
  8094. com.google.protobuf.RopeByteString$1 \
  8095. com.google.protobuf.RopeByteString$Balancer \
  8096. com.google.protobuf.RopeByteString$PieceIterator \
  8097. com.google.protobuf.RopeByteString$RopeInputStream \
  8098. com.google.protobuf.Schema \
  8099. com.google.protobuf.SchemaFactory \
  8100. com.google.protobuf.SchemaUtil \
  8101. com.google.protobuf.SmallSortedMap \
  8102. com.google.protobuf.SmallSortedMap$1 \
  8103. com.google.protobuf.SmallSortedMap$DescendingEntryIterator \
  8104. com.google.protobuf.SmallSortedMap$DescendingEntrySet \
  8105. com.google.protobuf.SmallSortedMap$EmptySet \
  8106. com.google.protobuf.SmallSortedMap$EmptySet$1 \
  8107. com.google.protobuf.SmallSortedMap$EmptySet$2 \
  8108. com.google.protobuf.SmallSortedMap$Entry \
  8109. com.google.protobuf.SmallSortedMap$EntryIterator \
  8110. com.google.protobuf.SmallSortedMap$EntrySet \
  8111. com.google.protobuf.SourceContext \
  8112. com.google.protobuf.SourceContext$1 \
  8113. com.google.protobuf.SourceContext$Builder \
  8114. com.google.protobuf.SourceContextOrBuilder \
  8115. com.google.protobuf.SourceContextProto \
  8116. com.google.protobuf.StringValue \
  8117. com.google.protobuf.StringValue$1 \
  8118. com.google.protobuf.StringValue$Builder \
  8119. com.google.protobuf.StringValueOrBuilder \
  8120. com.google.protobuf.Struct \
  8121. com.google.protobuf.Struct$1 \
  8122. com.google.protobuf.Struct$Builder \
  8123. com.google.protobuf.Struct$FieldsDefaultEntryHolder \
  8124. com.google.protobuf.StructOrBuilder \
  8125. com.google.protobuf.StructProto \
  8126. com.google.protobuf.StructuralMessageInfo \
  8127. com.google.protobuf.StructuralMessageInfo$Builder \
  8128. com.google.protobuf.Syntax \
  8129. com.google.protobuf.Syntax$1 \
  8130. com.google.protobuf.TextFormatEscaper \
  8131. com.google.protobuf.TextFormatEscaper$1 \
  8132. com.google.protobuf.TextFormatEscaper$2 \
  8133. com.google.protobuf.TextFormatEscaper$ByteSequence \
  8134. com.google.protobuf.Timestamp \
  8135. com.google.protobuf.Timestamp$1 \
  8136. com.google.protobuf.Timestamp$Builder \
  8137. com.google.protobuf.TimestampOrBuilder \
  8138. com.google.protobuf.TimestampProto \
  8139. com.google.protobuf.Type \
  8140. com.google.protobuf.Type$1 \
  8141. com.google.protobuf.Type$Builder \
  8142. com.google.protobuf.TypeOrBuilder \
  8143. com.google.protobuf.TypeProto \
  8144. com.google.protobuf.UInt32Value \
  8145. com.google.protobuf.UInt32Value$1 \
  8146. com.google.protobuf.UInt32Value$Builder \
  8147. com.google.protobuf.UInt32ValueOrBuilder \
  8148. com.google.protobuf.UInt64Value \
  8149. com.google.protobuf.UInt64Value$1 \
  8150. com.google.protobuf.UInt64Value$Builder \
  8151. com.google.protobuf.UInt64ValueOrBuilder \
  8152. com.google.protobuf.UninitializedMessageException \
  8153. com.google.protobuf.UnknownFieldSchema \
  8154. com.google.protobuf.UnknownFieldSetLite \
  8155. com.google.protobuf.UnknownFieldSetLiteSchema \
  8156. com.google.protobuf.UnmodifiableLazyStringList \
  8157. com.google.protobuf.UnmodifiableLazyStringList$1 \
  8158. com.google.protobuf.UnmodifiableLazyStringList$2 \
  8159. com.google.protobuf.UnsafeByteOperations \
  8160. com.google.protobuf.UnsafeUtil \
  8161. com.google.protobuf.UnsafeUtil$1 \
  8162. com.google.protobuf.UnsafeUtil$Android32MemoryAccessor \
  8163. com.google.protobuf.UnsafeUtil$Android64MemoryAccessor \
  8164. com.google.protobuf.UnsafeUtil$JvmMemoryAccessor \
  8165. com.google.protobuf.UnsafeUtil$MemoryAccessor \
  8166. com.google.protobuf.Utf8 \
  8167. com.google.protobuf.Utf8$DecodeUtil \
  8168. com.google.protobuf.Utf8$Processor \
  8169. com.google.protobuf.Utf8$SafeProcessor \
  8170. com.google.protobuf.Utf8$UnpairedSurrogateException \
  8171. com.google.protobuf.Utf8$UnsafeProcessor \
  8172. com.google.protobuf.Value \
  8173. com.google.protobuf.Value$1 \
  8174. com.google.protobuf.Value$Builder \
  8175. com.google.protobuf.Value$KindCase \
  8176. com.google.protobuf.ValueOrBuilder \
  8177. com.google.protobuf.WireFormat \
  8178. com.google.protobuf.WireFormat$1 \
  8179. com.google.protobuf.WireFormat$FieldType \
  8180. com.google.protobuf.WireFormat$FieldType$1 \
  8181. com.google.protobuf.WireFormat$FieldType$2 \
  8182. com.google.protobuf.WireFormat$FieldType$3 \
  8183. com.google.protobuf.WireFormat$FieldType$4 \
  8184. com.google.protobuf.WireFormat$JavaType \
  8185. com.google.protobuf.WireFormat$Utf8Validation \
  8186. com.google.protobuf.WireFormat$Utf8Validation$1 \
  8187. com.google.protobuf.WireFormat$Utf8Validation$2 \
  8188. com.google.protobuf.WireFormat$Utf8Validation$3 \
  8189. com.google.protobuf.WrappersProto \
  8190. com.google.protobuf.Writer \
  8191. com.google.protobuf.Writer$FieldOrder
  8192. # tag:java-specific
  8193. JAVA_IGNORE_CLASSPATH_CLASH_VALUE=$JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE
  8194. ### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
  8195. ### Ignore classpath clash test fails for classes
  8196. macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
  8197. SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args $JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE)
  8198. }
  8199. # tag:python-specific
  8200. ### @usage: PY_SRCS({| CYTHON_C} { | TOP_LEVEL | NAMESPACE ns} Files...)
  8201. ###
  8202. ### Build specified Python sources according to Arcadia binary Python build. Basically creates precompiled and source resources keyed with module paths.
  8203. ### The resources eventually are linked into final program and can be accessed as regular Python modules.
  8204. ### This custom loader linked into the program will add them to sys.meta_path.
  8205. ###
  8206. ### 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.
  8207. ### .pyx and .swg lead to C/C++ Python extensions generation, that are automatically registered in Python as built-in modules.
  8208. ###
  8209. ### 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).
  8210. ###
  8211. ### __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.
  8212. ###
  8213. ### @example
  8214. ###
  8215. ### PY2_LIBRARY(mymodule)
  8216. ### 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)
  8217. ### END()
  8218. ###
  8219. ### PY_SRCS honors Python2 and Python3 differences and adjusts itself to Python version of a current module.
  8220. ### PY_SRCS can be used in any Arcadia Python build modules like PY*_LIBRARY, PY*_PROGRAM, PY*TEST.
  8221. ### PY_SRCS in LIBRARY or PROGRAM effectively converts these into PY2_LIBRARY and PY2_PROGRAM respectively.
  8222. ### 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.
  8223. ###
  8224. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs/#modulipylibrarypy3libraryimakrospysrcs
  8225. macro PY_SRCS() {
  8226. DEFAULT(MODULE_TAG PY2)
  8227. DEFAULT(PYTHON2 yes)
  8228. DEFAULT(PYTHON3 no)
  8229. }
  8230. # tag:python-specific
  8231. _ALL_PY_FILES=
  8232. # tag:python-specific
  8233. macro _ALL_PY_SRCS2(TOP_LEVEL?"TOP_LEVEL":"", RECURSIVE?"/**":"", NAMESPACE[], REST[]) {
  8234. _GLOB(_ALL_PY_FILES ${suf=${RECURSIVE}/*.py:REST} ${suf=${RECURSIVE}/ya.make:REST} EXCLUDE ya.make)
  8235. }
  8236. # tag:python-specific
  8237. ### @usage: ALL_PY_SRCS([RECURSIVE] { | TOP_LEVEL | NAMESPACE ns} [Dirs...])
  8238. ###
  8239. ### Puts all .py-files from given Dirs (relative to projects') into PY_SRCS of the current module.
  8240. ### If Dirs is ommitted project directory is used
  8241. ###
  8242. ### `RECURSIVE` makes lookup recursive with resprect to Dirs
  8243. ### `TOP_LEVEL` and `NAMESPACE` are forwarded to `PY_SRCS`
  8244. ###
  8245. ### Note: Only one such macro per module is allowed
  8246. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  8247. ###
  8248. ### @see [PY_SRCS()](#macro_PY_SRCS)
  8249. macro ALL_PY_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", Files...) {
  8250. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files})
  8251. PY_SRCS(_MR ${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} $_ALL_PY_FILES)
  8252. }
  8253. # tag:python-specific
  8254. ### @usage: ALL_PYTEST_SRCS([RECURSIVE] [Dirs...])
  8255. ###
  8256. ### Puts all .py-files from given Dirs (relative to projects') into TEST_SRCS of the current module.
  8257. ### If Dirs is omitted project directory is used
  8258. ###
  8259. ### `RECURSIVE` makes lookup recursive with respect to Dirs
  8260. ###
  8261. ### Note: Only one such macro per module is allowed
  8262. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  8263. ###
  8264. ### @see [TEST_SRCS()](#macro_TEST_SRCS)
  8265. macro ALL_PYTEST_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", Files...) {
  8266. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files})
  8267. TEST_SRCS(_MR $_ALL_PY_FILES)
  8268. }
  8269. # tag:python-specific
  8270. _PY_EXTRA_LINT_FILES_VALUE=
  8271. ### @usage: PY_EXTRA_LINT_FILES(files...)
  8272. ###
  8273. ### Add extra Python files for linting. This macro allows adding
  8274. ### Python files which has no .py extension.
  8275. macro PY_EXTRA_LINT_FILES(FILES...) {
  8276. SET_APPEND(_PY_EXTRA_LINT_FILES_VALUE $FILES)
  8277. }
  8278. # tag:python-specific
  8279. ### @usage: PY23_LIBRARY([name])
  8280. ###
  8281. ### Build PY2_LIBRARY or PY3_LIBRARY depending on incoming PEERDIR.
  8282. ### Direct build or build by RECURSE creates both variants.
  8283. ### This multimodule doesn't define any final targets, so use from DEPENDS or BUNDLE is not allowed.
  8284. ###
  8285. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs
  8286. multimodule PY23_LIBRARY {
  8287. module PY2: PY2_LIBRARY {
  8288. OBJ_SUF=.py2
  8289. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8290. PYTHON_TYPE_FOR_CYTHON=PY2
  8291. }
  8292. module PY3: PY3_LIBRARY {
  8293. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8294. PYTHON_TYPE_FOR_CYTHON=PY2
  8295. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8296. MODULE_PREFIX=py3
  8297. }
  8298. otherwise {
  8299. MODULE_PREFIX=libpy3
  8300. }
  8301. OBJ_SUF=.py3
  8302. }
  8303. }
  8304. # tag:python-specific
  8305. ### @usage: PY23_NATIVE_LIBRARY([name])
  8306. ###
  8307. ### Build LIBRARY compatible with either Python 2.x or Python 3.x depending on incoming PEERDIR.
  8308. ###
  8309. ### 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.
  8310. ### Use these multimodule instead of PY23_LIBRARY if the C++ extension defined in it will be used in PY2MODULE.
  8311. ### 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.
  8312. ### Proper version will be selected according to Python version of the module PEERDIR comes from.
  8313. ###
  8314. ### This mulrtimodule doesn't define any final targets so cannot be used from DEPENDS or BUNDLE macros.
  8315. ###
  8316. ### For more information read https://wiki.yandex-team.ru/arcadia/python/pysrcs/#pysrcssrcsipy23nativelibrary
  8317. ###
  8318. ### @see [LIBRARY()](#module_LIBRARY), [PY2MODULE()](#module_PY2MODULE)
  8319. multimodule PY23_NATIVE_LIBRARY {
  8320. module PY2: LIBRARY {
  8321. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 PYTHON3_ADDINCL
  8322. OBJ_SUF=.py2
  8323. PYTHON2_ADDINCL()
  8324. SET(MODULE_LANG PY2)
  8325. }
  8326. module PY3: LIBRARY {
  8327. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3
  8328. .ALIASES=PYTHON2_ADDINCL=PYTHON3_ADDINCL
  8329. PYTHON3_ADDINCL()
  8330. SET(MODULE_LANG PY3)
  8331. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8332. MODULE_PREFIX=py3c
  8333. }
  8334. otherwise {
  8335. MODULE_PREFIX=libpy3c
  8336. }
  8337. OBJ_SUF=.py3
  8338. }
  8339. }
  8340. IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  8341. # tag:src-processing
  8342. STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
  8343. macro _SRC("storyboard", SRC, SRCFLAGS...) {
  8344. .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}
  8345. }
  8346. # tag:src-processing
  8347. macro _SRC("xib", SRC, SRCFLAGS...) {
  8348. .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}
  8349. }
  8350. ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  8351. # tag:ios-specific
  8352. ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
  8353. macro _IOS_ASSETS(AssetsDir, Content...) {
  8354. .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
  8355. }
  8356. # tag:ios-specific
  8357. macro IOS_APP_COMMON_FLAGS(Flags...) {
  8358. SET_APPEND(STORYBOARD_FLAGS $Flags)
  8359. SET_APPEND(ASSETS_FLAGS $Flags)
  8360. }
  8361. # tag:ios-specific
  8362. macro IOS_APP_ASSETS_FLAGS(Flags...) {
  8363. SET_APPEND(ASSETS_FLAGS $Flags)
  8364. }
  8365. macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
  8366. .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
  8367. }
  8368. macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
  8369. .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
  8370. }
  8371. # tag:ios-specific
  8372. DELIM=__DELIM__
  8373. 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
  8374. ### @usage: IOS_INTERFACE()
  8375. ### iOS GUI module definition
  8376. module IOS_INTERFACE: _BARE_UNIT {
  8377. .CMD=PACK_IOS_ARCHIVE
  8378. .EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
  8379. .NODE_TYPE=Library
  8380. .FINAL_TARGET=no
  8381. SET(MODULE_SUFFIX .ios.interface)
  8382. PEERDIR+=build/platform/xcode/tools
  8383. }
  8384. # tag:ios-specific
  8385. module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
  8386. SET(MODULE_SUFFIX .default.ios.interface)
  8387. }
  8388. DEFAULT_IOS_TYPE=
  8389. IOS_TYPE=
  8390. when(!$IOS_TYPE) {
  8391. when($DEFAULT_IOS_TYPE) {
  8392. IOS_TYPE=$DEFAULT_IOS_TYPE
  8393. }
  8394. otherwise {
  8395. IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
  8396. }
  8397. }
  8398. DEFAULT_IOS_RUNTIME=
  8399. IOS_RUNTIME=
  8400. when(!$IOS_RUNTIME) {
  8401. when($DEFAULT_IOS_RUNTIME) {
  8402. IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
  8403. }
  8404. otherwise {
  8405. IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
  8406. }
  8407. }
  8408. when ($ARCH_I386) {
  8409. TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
  8410. TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
  8411. }
  8412. otherwise {
  8413. TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
  8414. TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
  8415. }
  8416. # tag:java-specific
  8417. ### @usage: MODULE_JDK(Version)
  8418. ###
  8419. ### Specify JDK version for module
  8420. macro JDK_VERSION(Arg) {
  8421. SET(JDK_REAL_VERSION $Arg)
  8422. _JDK_VERSION_MACRO_CHECK($Arg)
  8423. }
  8424. # tag:java-specific
  8425. when ($JDK_REAL_VERSION == "10") {
  8426. JDK10=yes # remove this later
  8427. }
  8428. JAVA_PROGRAM_CP_USE_COMMAND_FILE=yes
  8429. when ($JDK_REAL_VERSION == "8") {
  8430. JAVA_PROGRAM_CP_USE_COMMAND_FILE=no
  8431. }
  8432. # tag:kotlin-specific
  8433. KOTLIN_JVM_TARGET=
  8434. when ($JDK_REAL_VERSION == "8") {
  8435. KOTLIN_JVM_TARGET=1.8
  8436. }
  8437. elsewhen ($JDK_REAL_VERSION == "18") {
  8438. # remove when kotlin starts supporting jdk18 bytecode
  8439. # see also devtools/ya/jbuild/gen/actions/idea.py
  8440. KOTLIN_JVM_TARGET=17
  8441. }
  8442. otherwise {
  8443. KOTLIN_JVM_TARGET=$JDK_REAL_VERSION
  8444. }
  8445. # tag:frontend-specific
  8446. ### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
  8447. ###
  8448. ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
  8449. macro COLLECT_FRONTEND_FILES(Varname, Dir) {
  8450. _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
  8451. }
  8452. # tag:java-specific
  8453. # local jdk and tools
  8454. USE_SYSTEM_JDK=
  8455. USE_SYSTEM_UBERJAR=
  8456. USE_SYSTEM_ERROR_PRONE=
  8457. # tag:swift-specific
  8458. CPP_XCODE_TOOLCHAIN_VERSION=9.2
  8459. SWIFT_XCODE_TOOLCHAIN_VERSION=9.2
  8460. XCODE_TOOLS_VERSION=10.1
  8461. macro COMPILE_SWIFT_MODULE(SRCS{input}[], BRIDGE_HEADER{input}="", Flags...) {
  8462. when ($BRIDGE_HEADER != "") {
  8463. SWIFT_BRIDGE_HEADER=-import-objc-header ${input:BRIDGE_HEADER}
  8464. }
  8465. otherwise {
  8466. SWIFT_BRIDGE_HEADER=
  8467. }
  8468. .PEERDIR+=build/platform/xcode/swift
  8469. # swift core libraries
  8470. LDFLAGS($SWIFT_LD_FLAGS)
  8471. .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}
  8472. }
  8473. TEST_TOOL_HOST_LOCAL=
  8474. TEST_TOOL_TARGET_LOCAL=
  8475. when ($TENSORFLOW_WITH_CUDA) {
  8476. CUDA_REQUIRED=yes
  8477. }
  8478. when (!$TENSORRT_VERSION) {
  8479. TENSORRT_VERSION=5
  8480. }
  8481. ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
  8482. MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin
  8483. when ($QT_REQUIRED) {
  8484. QT_BIN=${HOST_QT_RESOURCE_GLOBAL}/bin
  8485. }
  8486. when ($OPENGL_REQUIRED) {
  8487. OPENGL_VERSION=18.0.5
  8488. }
  8489. # tag:python-specific
  8490. multimodule PY23_TEST {
  8491. module PY2 : PYTEST_BIN {
  8492. MODULE_PREFIX=py2_
  8493. OBJ_SUF=.py2
  8494. CANONIZE_SUB_PATH=py2test
  8495. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8496. PYTHON_TYPE_FOR_CYTHON=PY2
  8497. }
  8498. module PY3TEST_PROGRAM: PY3TEST_BIN {
  8499. .FINAL_TARGET=yes
  8500. OBJ_SUF=.py3
  8501. CANONIZE_SUB_PATH=py3test
  8502. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8503. PYTHON_TYPE_FOR_CYTHON=PY2
  8504. }
  8505. module PY3TEST_LIBRARY: PY3_LIBRARY {
  8506. PEERDIR+=library/python/pytest
  8507. _REQUIRE_EXPLICIT_LICENSE()
  8508. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8509. PYTHON_TYPE_FOR_CYTHON=PY2
  8510. }
  8511. }
  8512. # tag:windows-specific
  8513. WINDOWS_MANIFEST=
  8514. macro WINDOWS_MANIFEST(Manifest) {
  8515. SET(WINDOWS_MANIFEST $Manifest)
  8516. }
  8517. # tag:windows-specific
  8518. when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
  8519. LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
  8520. }
  8521. # tag:cpp-specific
  8522. _VISIBILITY_LEVEL=
  8523. ### @usage: VISIBILITY(level)
  8524. ###
  8525. ### This macro sets visibility level for symbols compiled for the current module. 'level'
  8526. ### may take only one of the following values: DEFAULT, HIDDEN.
  8527. macro VISIBILITY(LEVEL) {
  8528. SET(_VISIBILITY_LEVEL ${LEVEL})
  8529. select ($LEVEL) {
  8530. "DEFAULT" | "HIDDEN" ? {
  8531. }
  8532. default ? {
  8533. _OK = no
  8534. }
  8535. }
  8536. ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
  8537. }
  8538. # tag:cpp-specific
  8539. _CFLAGS_VISIBILITY=
  8540. when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
  8541. when ($CLANG == "yes" || $GCC == "yes") {
  8542. _CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
  8543. }
  8544. }
  8545. CFLAGS+=$_CFLAGS_VISIBILITY
  8546. # tag:cpp-specific
  8547. macro SDBUS_CPP_ADAPTOR(File) {
  8548. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
  8549. .PEERDIR=contrib/libs/sdbus-cpp
  8550. }
  8551. # tag:cpp-specific
  8552. macro SDBUS_CPP_PROXY(File) {
  8553. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
  8554. .PEERDIR=contrib/libs/sdbus-cpp
  8555. }
  8556. # tag:python-specific
  8557. macro _PY_SSQLS_SRC(EXT, SRC, SRCFLAGS...) {
  8558. #generic macro
  8559. }
  8560. # tag:python-specific
  8561. macro _PY_SSQLS_SRC("ssqls", SRC, SRCFLAGS...) {
  8562. .CMD=${tool:"metrika/core/tools/ssqls"} ${input;notransformbuilddir:SRC} -S $ARCADIA_ROOT -B $ARCADIA_BUILD_ROOT -L "python" -D $MODDIR $SRCFLAGS ${output;tobindir;noext;hide;pre=autogenerated/$MODDIR/:SRC.py}
  8563. }
  8564. # tag:python-specific
  8565. macro _PY_SSQLS_SRCS(Srcs...) {
  8566. foreach(Src: $Srcs) {
  8567. _PY_SSQLS_SRC(${lastext:Src} $Src)
  8568. }
  8569. }
  8570. # tag:python-specific
  8571. macro PY_SSQLS_SRCS(Srcs...) {
  8572. _PY_SSQLS_SRCS(KEEP_DIR_STRUCT $Srcs)
  8573. PY_SRCS(${noext;pre=autogenerated/$MODDIR/:Srcs.py})
  8574. }
  8575. # tag:python-specific
  8576. macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
  8577. .CMD=$ENUM_PARSER_TOOL ${input:File} --output ${output;chksum;noext;suf=.generated.h:File} --json-output ${output;noext:File.json} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  8578. }
  8579. # tag:python-specific
  8580. macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
  8581. .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"}
  8582. }
  8583. # tag:metrika
  8584. multimodule SSQLS_LIBRARY {
  8585. module CPP_SSQLS : LIBRARY {
  8586. .ALIASES=ENUMS_SERIALIZATION=CPP_ENUMS_SERIALIZATION
  8587. SET(PEERDIR_TAGS CPP_SSQLS)
  8588. PEERDIR(metrika/core/libs/appmetrica/types metrika/core/libs/types)
  8589. ADDINCL(GLOBAL ${ARCADIA_BUILD_ROOT}/metrika/core/common_tables/include)
  8590. }
  8591. module PY3_SSQLS : PY3_LIBRARY {
  8592. .ALIASES=SRCS=PY_SSQLS_SRCS ENUMS_SERIALIZATION=PY_ENUMS_SERIALIZATION
  8593. SET(PEERDIR_TAGS PY3 PY3_SSQLS)
  8594. }
  8595. }
  8596. macro NGINX_MODULES(Modules...) {
  8597. PEERDIR(${Modules})
  8598. 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)
  8599. }
  8600. # Experimental: container as output. https://st.yandex-team.ru/DTCC-179
  8601. # tag:external-build
  8602. CONTAINER_LAYER_CMD=$YMAKE_PYTHON ${input:"devtools/experimental/solar/selfcontainer/scripts/make_container_layer.py"} -o $TARGET $AUTO_INPUT ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CL"} ${kv;hide:"pc blue"}
  8603. CONTAINER_CMD=$YMAKE_PYTHON ${input:"devtools/experimental/solar/selfcontainer/scripts/make_container.py"} -o $TARGET ${rootrel:PEERS} ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CN"} ${kv;hide:"pc blue"}
  8604. # tag:external-build
  8605. module CONTAINER_LAYER: _BARE_UNIT {
  8606. .CMD=CONTAINER_LAYER_CMD
  8607. MODULE_SUFFIX=.container_layer
  8608. }
  8609. # tag:external-build
  8610. module CONTAINER: _BARE_UNIT {
  8611. .NODE_TYPE=Bundle
  8612. .PEERDIR_POLICY=as_build_from
  8613. .FINAL_TARGET=yes
  8614. .CMD=CONTAINER_CMD
  8615. }
  8616. # tag:external-build
  8617. CUSTOM_BUILD_LIBRARY_USE=
  8618. 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
  8619. # tag:external-build
  8620. module CUSTOM_BUILD_LIBRARY: LIBRARY {
  8621. .NODE_TYPE=Bundle
  8622. .PEERDIR_POLICY=as_build_from
  8623. .PROXY=yes
  8624. .CMD=CUSTOM_BUILD_LIBRARY_CMD
  8625. DISABLE(NEED_ADD_FAKE_SRC)
  8626. }
  8627. ### @usage: ORIGINAL_SOURCE(Source)
  8628. ###
  8629. ### This macro specifies the source repository for contrib
  8630. ### Does nothing now (just a placeholder for future functionality)
  8631. ### See https://st.yandex-team.ru/DTCC-316
  8632. macro ORIGINAL_SOURCE(Source) {
  8633. ENABLE(UNUSED_MACRO)
  8634. }
  8635. # tag:licence
  8636. CREDITS_FILE_EXTRA_EXT=
  8637. CREDITS_FLAGS=
  8638. CREDITS_TEXTS_FILE=
  8639. NO_CREDITS_TEXTS_FILE=
  8640. WITH_CREDITS=
  8641. ### @usage: LICENSE_TEXTS(File)
  8642. ###
  8643. ### This macro specifies the filename with all library licenses texts
  8644. macro LICENSE_TEXTS(Source) {
  8645. SET(CREDITS_TEXTS_FILE $Source)
  8646. }
  8647. # tag:licence
  8648. ### @usage: WITHOUT_LICENSE_TEXTS()
  8649. ###
  8650. ### This macro indicates that the module has no license text
  8651. macro WITHOUT_LICENSE_TEXTS() {
  8652. ENABLE(NO_CREDITS_TEXTS_FILE)
  8653. }
  8654. # tag:licence
  8655. when ($WITH_CREDITS) {
  8656. CREDITS_FLAGS+=--credits-output ${output;suf=${CREDITS_FILE_EXTRA_EXT}".CREDITS.txt":REALPRJNAME}
  8657. }
  8658. GENERATE_MF=
  8659. when ($WITH_CREDITS) {
  8660. GENERATE_MF=$GENERATE_MF_CMD
  8661. }
  8662. macro _MCU_CONVERT(Bin) {
  8663. .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}
  8664. }
  8665. MCU_LINK_EXE=$LINK_EXE && $_MCU_CONVERT($MODULE_PREFIX$REALPRJNAME)
  8666. ### @usage: MCU_PROGRAM([progname])
  8667. ###
  8668. ### Program module for microcontrollers. Converts ELF to Intel HEX, Motorola S-record and raw binary file formats.
  8669. ### If name is not specified it will be generated from the name of the containing project directory.
  8670. module MCU_PROGRAM: PROGRAM {
  8671. .CMD=MCU_LINK_EXE
  8672. }
  8673. # tag:deprecated
  8674. ### @usage: METAQUERYFILES(filenames...) #deprecated
  8675. ###
  8676. ### This macro does nothing and will be removed
  8677. macro METAQUERYFILES(Files...) {
  8678. ENABLE(UNUSED_MACRO)
  8679. }
  8680. # tag:flags tag:internal tag:windows-specific
  8681. ### @usage: _MSVC_FLAGS_WINDOWS_IMPL(target_platform compiler_flags) # internal
  8682. ###
  8683. ### Add CFLAGS when the firts argument is WINDOWS
  8684. macro _MSVC_FLAGS_WINDOWS_IMPL(WINDOWS[], FLAGS...) {
  8685. CFLAGS($WINDOWS)
  8686. }
  8687. # tag:flags tag:windows-specific tag:cpp-specific
  8688. ### @usage: MSVC_FLAGS([GLOBAL compiler_flag]* compiler_flags)
  8689. ###
  8690. ### Add the specified flags to the compilation line of C/C++files.
  8691. ### Flags apply only if the compiler used is MSVC (cl.exe)
  8692. macro MSVC_FLAGS(FLAGS...) {
  8693. _MSVC_FLAGS_WINDOWS_IMPL($TARGET_PLATFORM $FLAGS)
  8694. }
  8695. ### @usage: COLLECT_YDB_API_SPECS_LEGACY(VarName Paths...) #deprecated
  8696. ###
  8697. ### This macro is ugly hack for legacy YDB go API codegen, any other uses are prohibited
  8698. macro COLLECT_YDB_API_SPECS_LEGACY(FILES_VAR, PATHS...) {
  8699. _GLOB($FILES_VAR ${suf=/*.proto:PATHS})
  8700. RESTRICT_PATH(kikimr/public/sdk/go/ydb/api MSG This is ugly hack for legacy YDB go API codegen, any other uses are probibited)
  8701. }
  8702. # tag:proto tag:apphost
  8703. ### @usage: APPHOST()
  8704. ###
  8705. ### Emit APPHOST service code for all .proto files in a PROTO_LIBRARY.
  8706. ### This works only for C++ and Java at the moment.
  8707. macro APPHOST() {
  8708. # C++
  8709. CPP_PROTO_PLUGIN(cpp_plugin apphost/tools/stub_generator/cpp_plugin .apphost.h)
  8710. # Java
  8711. JAVA_PROTO_PLUGIN(java_plugin apphost/tools/stub_generator/java_plugin DEPS apphost/api/service/java/apphost)
  8712. }