ymake.core.conf 356 KB

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