ymake.core.conf 383 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906
  1. # !!! DISCLAIMER! PLEASE DON'T IGNORE !!!
  2. # The FAKEID value is huge hammer. It affects UIDs of all nodes in build graph including, but not limited to
  3. # any resource fetch (think java contrib), build on any language (C++, Python, Java, Go), any code generation.
  4. # Any build after this change will pay the price:
  5. # - Local builds and Sandbox builds will reload all resources from Sandbox and cached data from YT (if ready).
  6. # - Distributed (YT) cache warmup will take significant time to catch up and will need to recache everything.
  7. # - Autocheck will rebuild and recache everything.
  8. # Use this with extreme care and only change if it is ultimately needed. Consider more specific XXX_FAKEIDs below instead.
  9. FAKEID=3141592653
  10. SANDBOX_FAKEID=${FAKEID}.7600000
  11. CPP_FAKEID=9563524
  12. GO_FAKEID=9478151
  13. ANDROID_FAKEID=8821472
  14. CLANG_TIDY_FAKEID=8625699
  15. CURDIR=.
  16. MODDIR=.
  17. BINDIR=bin:/
  18. SRCDIR=
  19. YMAKE=ymake
  20. ECHO=echo
  21. INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i
  22. CPP_EXT=.cpp
  23. OBJ_SUF=
  24. CFLAGS=
  25. EXTRA_C_FLAGS=
  26. SFLAGS=
  27. AUTOCHECK_BALANCING_OPTIONS=
  28. SO_OTPUTS=no
  29. @import "${CONF_ROOT}/conf/settings.conf"
  30. @import "${CONF_ROOT}/conf/opensource.conf"
  31. @import "${CONF_ROOT}/conf/rules.conf"
  32. @import "${CONF_ROOT}/conf/sysincl.conf"
  33. @import "${CONF_ROOT}/conf/license.conf"
  34. @import "${CONF_ROOT}/conf/ts.conf"
  35. @import "${CONF_ROOT}/conf/docs.conf"
  36. @import "${CONF_ROOT}/conf/project_specific/other.conf"
  37. USE_GLOBAL_CMD=no
  38. when ($OS_WINDOWS != "yes") {
  39. USE_GLOBAL_CMD=yes
  40. }
  41. YMAKE_RESOURCE_BIN=${YMAKE_RESOURCE_GLOBAL}/ymake
  42. YMAKE_RESOURCE_DIR=build/external_resources/ymake
  43. when ($USE_YMAKE_RESOURCE == "yes") {
  44. PEERDIR+=${YMAKE_RESOURCE_DIR}
  45. }
  46. __COMMA__=${comma:""}
  47. ARCADIA_TEST_ROOT=../arcadia_tests_data/
  48. DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32
  49. BISON_DATA_DIR=contrib/tools/bison/bison/data
  50. CPP_BISON_SKELS=${BISON_DATA_DIR}/glr.cc ${BISON_DATA_DIR}/lalr1.cc ${BISON_DATA_DIR}/yacc.c ${BISON_DATA_DIR}/stack.hh ${BISON_DATA_DIR}/variant.hh ${BISON_DATA_DIR}/c++.m4 ${BISON_DATA_DIR}/c++-skel.m4
  51. USE_PREBUILT_TOOLS=yes
  52. when ($OPENSOURCE == "yes") {
  53. USE_PREBUILT_TOOLS=no
  54. }
  55. FAIL_PY2=no
  56. _PREBUILT_TOOLS_ROOT=build/prebuilt
  57. _TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
  58. _TOOL_RESCOMPILER=tools/rescompiler
  59. _TOOL_RESCOMPRESSOR=tools/rescompressor
  60. _TOOL_RORESCOMPILER=tools/rorescompiler
  61. when ($HOST_ARCH_X86_64 == "yes") {
  62. when ($HOST_OS_DARWIN == "yes" || $HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes") {
  63. VALID_HOST_PLATFORM_FOR_COMMON_PREBUILT_TOOLS=yes
  64. when ($USE_PREBUILT_TOOLS == "yes" && $ARCH_X86_64 == "yes") {
  65. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  66. }
  67. }
  68. }
  69. FAIL_MODULE_CMD=$YMAKE_PYTHON ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
  70. DEFAULT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  71. PROJECT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  72. when ($TIDY == "yes") {
  73. when ($TIDY_EXPORT_FIXES=="") {
  74. TIDY_EXPORT_FIXES="no"
  75. }
  76. 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
  77. CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
  78. CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
  79. when ($TIDY_CHECKS) {
  80. CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
  81. }
  82. when ($TIDY_HEADER_FILTER) {
  83. CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
  84. }
  85. TIDY_VALUE=USE_CONDITIONAL_SRCS
  86. }
  87. otherwise {
  88. CLANG_TIDY_ARGS=
  89. TIDY_VALUE=
  90. }
  91. # tag:codenav
  92. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  93. PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
  94. YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
  95. YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.ydx.pb2:SRC}
  96. }
  97. otherwise {
  98. PY_PROGRAM_LINK_EXE=$LINK_EXE
  99. YNDEXER_ARGS=
  100. YNDEXER_OUTPUT=
  101. }
  102. COVERAGE_FLAGS=
  103. EXTRA_OUTPUT=
  104. when ($CLANG == "yes" || $GCC == "yes") {
  105. when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
  106. COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
  107. EXTRA_OUTPUT=${output;noauto;hide;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.gcno:SRC}
  108. }
  109. }
  110. when ($OS_CYGWIN == "yes") {
  111. CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
  112. USE_ASMLIB=no
  113. FSTACK=
  114. }
  115. CFLAGS+=$COVERAGE_FLAGS
  116. LDFLAGS+=$COVERAGE_FLAGS
  117. CHECKFLAG=
  118. LEX_FLAGS=
  119. NO_MAPREDUCE=
  120. when ($NO_MAPREDUCE == "yes") {
  121. C_DEFINES+=-DNO_MAPREDUCE
  122. }
  123. when ($OS_ANDROID == "yes") {
  124. PIE=yes
  125. }
  126. # TODO: extract to conf/maps/maps.conf
  127. when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
  128. USE_STL_SYSTEM=yes
  129. }
  130. when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_IOS == "yes") {
  131. BUILD_IOS_APP=yes
  132. when ($ARCH_ARM7 || $ARCH_ARM64) {
  133. BOOSTTEST_IS_FAT_OBJECT=yes
  134. }
  135. }
  136. # USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
  137. # select system standard C++ library when USE_INTERNAL_STL=no is set.
  138. #
  139. # USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
  140. #
  141. when ($USE_STL_SYSTEM == "yes") {
  142. USE_INTERNAL_STL=no
  143. }
  144. when ($USE_INTERNAL_STL == "no") {
  145. USE_STL_SYSTEM=yes
  146. }
  147. otherwise {
  148. USE_INTERNAL_STL=yes
  149. # TODO: Extract to conf/sysincl.conf
  150. # This trigger doesn't work for module level since SYSINCL is processed at
  151. # configuration stage (This means that NO_RUNTIME() macro called in ya.make
  152. # won't affect SYSINCL and the only way to make this trigger work correctly
  153. # is to define configuration variable NORUNTIME (-DNORUNTIME) on the command
  154. # line when `ya make ...` is invoked.
  155. when ($NORUNTIME != "yes") {
  156. SYSINCL+=build/sysincl/stl-to-libcxx.yml
  157. when ($MUSL == "yes") {
  158. SYSINCL+=build/sysincl/libc-musl-libcxx.yml
  159. }
  160. }
  161. }
  162. # tag:linux-specific
  163. when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") {
  164. USE_UBUNTU_COMPATIBILITY=yes
  165. }
  166. USE_ARCADIA_PYTHON=yes
  167. USE_ARCADIA_LIBM=no
  168. USE_EAT_MY_DATA=no
  169. HAVE_MKL=
  170. when ($HAVE_MKL == "") {
  171. when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
  172. HAVE_MKL=yes
  173. }
  174. otherwise {
  175. HAVE_MKL=no
  176. }
  177. }
  178. SFDL_TMP_OUT= ${output;tmp:SRC.tmp}
  179. # tag:perl-specific
  180. when ($USE_LOCAL_TOOLS == "yes") {
  181. PERL=$LOCAL_PERL
  182. PERL_VERSION=$LOCAL_PERL_VERSION
  183. PERL_PRIVLIB=$LOCAL_PERL_PRIVLIB
  184. PERL_ARCHLIB=$LOCAL_PERL_ARCHLIB
  185. when ($LOCAL_PERL_LIBS) {
  186. PERL_LIBS=$LOCAL_PERL_LIBS
  187. }
  188. }
  189. otherwise {
  190. PERL=NO-PERL-SELECTED
  191. PERL_VERSION=NO-PERL-SELECTED-VERSION
  192. PERL_PRIVLIB=NO-PERL-SELECTED-PRIVLIB
  193. PERL_ARCHLIB=NO-PERL-SELECTED-ARCHLIB
  194. }
  195. # tag:perl-specific
  196. PERL_LD_LIBRARY_PATH=
  197. PERL_INCLUDE=
  198. USE_PERL_SYSTEM=yes
  199. when ($USE_PERL_SYSTEM == "yes") {
  200. select ($PERL_SDK) {
  201. "ubuntu-12" ? {
  202. PERL_VERSION=5.14
  203. PERL_ROOT=${SYSTEM_PERL_514_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  204. PERL_LIB_ARCH=
  205. }
  206. "ubuntu-14" ? {
  207. PERL_VERSION=5.18
  208. PERL_ROOT=${SYSTEM_PERL_518_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  209. PERL_LIB_ARCH=
  210. }
  211. "ubuntu-16" ? {
  212. PERL_VERSION=5.22
  213. PERL_ROOT=${SYSTEM_PERL_522_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  214. PERL_LIB_ARCH=/x86_64-linux-gnu
  215. }
  216. "ubuntu-18" ? {
  217. PERL_VERSION=5.26
  218. PERL_ROOT=${SYSTEM_PERL_526_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  219. PERL_LIB_ARCH=/x86_64-linux-gnu
  220. }
  221. "ubuntu-20" ? {
  222. PERL_VERSION=5.30
  223. PERL_ROOT=${SYSTEM_PERL_530_RESOURCE_GLOBAL}/usr
  224. PERL_LIB_ARCH=/x86_64-linux-gnu
  225. }
  226. }
  227. PERL=${PERL_ROOT}/bin/perl
  228. PERL_ARCHLIB=${PERL_ROOT}/lib$PERL_LIB_ARCH/perl/${PERL_VERSION}
  229. PERL_PRIVLIB=${PERL_ROOT}/share/perl/${PERL_VERSION}
  230. PERL_LIBS=${PERL_ROOT}/lib${PERL_LIB_ARCH}
  231. PERL_LD_LIBRARY_PATH=${env:"LD_LIBRARY_PATH=${PERL_ROOT}/lib"}
  232. # Perl searches it's modules in INC@ paths. They can not be sysrooted or disabled (at least I haven't found a way),
  233. # so default Perl module directories should be prepended to perl command lines when using non-local perl.
  234. PERL_INCLUDE=-I${PERL_ARCHLIB} -I${PERL_PRIVLIB}
  235. }
  236. PERL_DEFAULT_PEERDIR=yes
  237. # tag:perl-specific
  238. PERLSUFFIX=-csuffix .cpp
  239. PERLOUTPUT=${stdout;output:SRC.cpp}
  240. when ($PERLC == "yes") {
  241. PERLSUFFIX=-csuffix .c
  242. PERLOUTPUT=${stdout;output:SRC.c}
  243. }
  244. XSUBPPFLAGS=
  245. # tag:tool-specific
  246. ARCH_TOOL=${tool:"tools/archiver"}
  247. # tag:tool-specific tag:proto
  248. PROTOC=${tool:"contrib/tools/protoc"}
  249. PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
  250. PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
  251. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src
  252. USE_VANILLA_PROTOC=no
  253. PROTOC_TRANSITIVE_HEADERS=yes
  254. # tag:tool-specific
  255. FML_TOOL=${tool:"tools/relev_fml_codegen"}
  256. FML_UNUSED_TOOL=${tool:"tools/relev_fml_unused"}
  257. LUA_TOOL=${tool:"tools/lua"}
  258. ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
  259. # tag:python-specific tag:cython-specific
  260. CYTHON_SCRIPT=${input:"${ARCADIA_ROOT}/contrib/tools/cython/cython.py"} $CYTHON_PREDEFINED_INCLUDES
  261. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  262. PYTHON_TYPE_FOR_CYTHON=PY2
  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_PREDEFINED_INCLUDES=\
  278. ${input;hide:"contrib/tools/cython/Cython/Utility/Buffer.c"} \
  279. ${input;hide:"contrib/tools/cython/Cython/Utility/Builtins.c"} \
  280. ${input;hide:"contrib/tools/cython/Cython/Utility/CMath.c"} \
  281. ${input;hide:"contrib/tools/cython/Cython/Utility/Capsule.c"} \
  282. ${input;hide:"contrib/tools/cython/Cython/Utility/CommonTypes.c"} \
  283. ${input;hide:"contrib/tools/cython/Cython/Utility/Complex.c"} \
  284. ${input;hide:"contrib/tools/cython/Cython/Utility/Coroutine.c"} \
  285. ${input;hide:"contrib/tools/cython/Cython/Utility/CythonFunction.c"} \
  286. ${input;hide:"contrib/tools/cython/Cython/Utility/Embed.c"} \
  287. ${input;hide:"contrib/tools/cython/Cython/Utility/Exceptions.c"} \
  288. ${input;hide:"contrib/tools/cython/Cython/Utility/ExtensionTypes.c"} \
  289. ${input;hide:"contrib/tools/cython/Cython/Utility/FunctionArguments.c"} \
  290. ${input;hide:"contrib/tools/cython/Cython/Utility/ImportExport.c"} \
  291. ${input;hide:"contrib/tools/cython/Cython/Utility/MemoryView_C.c"} \
  292. ${input;hide:"contrib/tools/cython/Cython/Utility/ModuleSetupCode.c"} \
  293. ${input;hide:"contrib/tools/cython/Cython/Utility/ObjectHandling.c"} \
  294. ${input;hide:"contrib/tools/cython/Cython/Utility/Optimize.c"} \
  295. ${input;hide:"contrib/tools/cython/Cython/Utility/Overflow.c"} \
  296. ${input;hide:"contrib/tools/cython/Cython/Utility/Printing.c"} \
  297. ${input;hide:"contrib/tools/cython/Cython/Utility/Profile.c"} \
  298. ${input;hide:"contrib/tools/cython/Cython/Utility/StringTools.c"} \
  299. ${input;hide:"contrib/tools/cython/Cython/Utility/TestUtilityLoader.c"} \
  300. ${input;hide:"contrib/tools/cython/Cython/Utility/TypeConversion.c"}
  301. # tag:cython-specific
  302. CYTHON_PREDEFINED_INDUCED=\
  303. contrib/libs/python/Include/Python.h
  304. # tag:cython-specific
  305. CYTHON_OPTIONS=
  306. when ($OS_LINUX) {
  307. CYTHON_OPTIONS += -E UNAME_SYSNAME=Linux
  308. }
  309. elsewhen ($OS_DARWIN) {
  310. CYTHON_OPTIONS += -E UNAME_SYSNAME=Darwin
  311. }
  312. elsewhen ($OS_WINDOWS) {
  313. CYTHON_OPTIONS += -E UNAME_SYSNAME=Windows
  314. }
  315. when ($USE_LOCAL_SWIG != "yes") {
  316. _SWIG_TOOL=${tool:"contrib/tools/swig"}
  317. _SWIG_LIBRARY=contrib/tools/swig/Lib
  318. _SWIG_LIBRARY_ABS=$ARCADIA_ROOT/$_SWIG_LIBRARY
  319. }
  320. otherwise {
  321. _SWIG_TOOL=$SWIG_TOOL
  322. _SWIG_LIBRARY=$SWIG_LIBRARY
  323. _SWIG_LIBRARY_ABS=$SWIG_LIBRARY
  324. }
  325. SWIG_IMPLICIT_INCLUDES = swig.swg go.swg java.swg perl5.swg python.swg
  326. FATAL_ERROR_MODULE=no
  327. FATAL_ERROR_MESSAGE=
  328. # tag:python-specific
  329. # PYTHON_DISTR={ "default" | "macos-brew" } determine python system supply
  330. # see build/platform/python/ya.make
  331. PYTHON_DISTR="default"
  332. when ($USE_SYSTEM_PYTHON) {
  333. USE_ARCADIA_PYTHON=no
  334. select ($USE_SYSTEM_PYTHON) {
  335. "2.7" ? {
  336. _SYSTEM_PYTHON27=yes
  337. PY_VERSION=2.7
  338. PY_FRAMEWORK_VERSION=2.7
  339. }
  340. "3.4" ? {
  341. _SYSTEM_PYTHON34=yes
  342. PY_VERSION=3.4m
  343. PY_FRAMEWORK_VERSION=3.4
  344. }
  345. "3.5" ? {
  346. _SYSTEM_PYTHON35=yes
  347. PY_VERSION=3.5m
  348. PY_FRAMEWORK_VERSION=3.5
  349. }
  350. "3.6" ? {
  351. _SYSTEM_PYTHON36=yes
  352. PY_VERSION=3.6m
  353. PY_FRAMEWORK_VERSION=3.6
  354. }
  355. "3.7" ? {
  356. _SYSTEM_PYTHON37=yes
  357. PY_VERSION=3.7m
  358. PY_FRAMEWORK_VERSION=3.7
  359. }
  360. "3.8" ? {
  361. _SYSTEM_PYTHON38=yes
  362. PY_VERSION=3.8
  363. PY_FRAMEWORK_VERSION=3.8
  364. }
  365. "3.9" ? {
  366. _SYSTEM_PYTHON39=yes
  367. PY_VERSION=3.9
  368. PY_FRAMEWORK_VERSION=3.9
  369. }
  370. "3.10" ? {
  371. _SYSTEM_PYTHON310=yes
  372. PY_VERSION=3.10
  373. PY_FRAMEWORK_VERSION=3.10
  374. }
  375. default ? {
  376. FATAL_ERROR_MESSAGE+=invalid USE_SYSTEM_PYTHON value
  377. }
  378. }
  379. }
  380. ### @usage: NO_LTO()
  381. ###
  382. ### Disable any lto (link-time optimizations) for the module.
  383. ### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
  384. ### linking of entire program if global settings say so.
  385. macro NO_LTO() {
  386. DISABLE(USE_LTO)
  387. DISABLE(USE_THINLTO)
  388. }
  389. when ($USE_LTO == "yes" && $OS_LINUX != "yes" && $OS_ANDROID != "yes") {
  390. FATAL_ERROR_MESSAGE+=lto is only supported for linux
  391. }
  392. # tag:python-specific
  393. YMAKE_PYTHON3_PEER=build/platform/python/ymake_python3
  394. YMAKE_PYTHON3=$YMAKE_PYTHON3_RESOURCE_GLOBAL/python3
  395. when ($HOST_OS_WINDOWS == "yes") {
  396. YMAKE_PYTHON3=$YMAKE_PYTHON3_RESOURCE_GLOBAL/python3.exe
  397. }
  398. # tag:python-specific
  399. when ($USE_ARCADIA_PYTHON == "no") {
  400. SYSINCL+=build/sysincl/python.yml
  401. }
  402. # tag:allocator
  403. DEFAULT_ALLOCATOR=LF
  404. # tag:allocator
  405. when ($OS_ANDROID == "yes" || $MSVC == "yes") {
  406. DEFAULT_ALLOCATOR=J
  407. }
  408. # tag:allocator
  409. when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
  410. DEFAULT_ALLOCATOR=SYSTEM
  411. }
  412. # tag:allocator
  413. when ($OS_DARWIN == "yes") {
  414. DEFAULT_ALLOCATOR=SYSTEM
  415. }
  416. # tag:allocator
  417. when ($OS_LINUX == "yes") {
  418. when ($GCC) {
  419. # tcmalloc broken build
  420. }
  421. elsewhen ($SANDBOXING) {
  422. # broken
  423. }
  424. elsewhen ($ARCH_X86_64) {
  425. DEFAULT_ALLOCATOR=TCMALLOC_TC
  426. }
  427. }
  428. # tag:allocator
  429. when ($SANITIZER_TYPE) {
  430. when ($SANITIZER_TYPE != "no") {
  431. DEFAULT_ALLOCATOR=SYSTEM
  432. }
  433. }
  434. # tag:internal
  435. ### @usage: CHECK_CONFIG_H(<conf_header>) # internal
  436. ###
  437. ### This internal macro adds checking code for configuration header in external (contrib) library.
  438. ### The check is needed to avoid conflicts on certain types and functions available in arcadia.
  439. ###
  440. ### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
  441. macro CHECK_CONFIG_H(Conf) {
  442. .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"}
  443. OUTPUT_INCLUDES=$Conf
  444. }
  445. REQUIRED_TRANSITIVE_PEERS=
  446. ### @usage REQUIRES(dirs...)
  447. ###
  448. ### Specify list of dirs which this module must depend on indirectly.
  449. ###
  450. ### This macro can be used if module depends on the directories specified but they can't be listed
  451. ### as direct PEERDIR dependencies (due to public include order or link order issues).
  452. macro REQUIRES(DIRS[]) {
  453. SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
  454. }
  455. CHECK_DEPENDENT_DIRS_TYPES=
  456. CHECK_DEPENDENT_DIRS_RESTRICTIONS=
  457. ### @usage CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
  458. ###
  459. ### Specify project transitive dependencies constraints.
  460. ###
  461. ### @params:
  462. ### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
  463. ### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
  464. ### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
  465. ### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
  466. ### 5. GLOB: next directory constraint is an ANT glob pattern.
  467. ### 6. EXCEPT: next constraint is an exception for the rest of other rules.
  468. ###
  469. ### Directory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
  470. ###
  471. ### Note: Can be used multiple times on the same module all specified constraints will be checked.
  472. ### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
  473. macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
  474. SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
  475. SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
  476. }
  477. # tag:proto
  478. PY_PROTOS_FOR=no
  479. BUILD_PROTO_AS_EVLOG=no
  480. # tag:proto
  481. PROTO_NAMESPACE=
  482. # tag:proto tag:python-specific
  483. GEN_PY_PROTOS=$YMAKE_PYTHON ${input:"build/scripts/gen_py_protos.py"}
  484. # tag:proto tag:cpp-specific
  485. PROTO_HEADER_EXTS=.pb.h
  486. CPP_PROTO_CMDLINE=
  487. CPP_PROTO_OPTS=
  488. CPP_PROTO_OUTS=
  489. CPP_PROTO_OUTS_SEM=
  490. CPP_PROTO_SUFFIXES=.pb.h .pb.cc
  491. CPP_PROTO_PLUGINS=
  492. # tag:proto tag:cpp-specific
  493. CPP_EV_OPTS=--plugin=protoc-gen-event2cpp=${tool:"tools/event2cpp"} --event2cpp_out=$ARCADIA_BUILD_ROOT -I=$ARCADIA_ROOT/library/cpp/eventlog
  494. CPP_EV_OUTS=
  495. # tag:proto tag:python-specific
  496. PY_PROTO_OPTS=
  497. PY_PROTO_OUTS=
  498. PY_PROTO_OUTS_INTERNAL=
  499. PY_PROTO_DEPS=
  500. PY_PROTO_SUFFIXES=_pb2.py
  501. PY_EVLOG_SUFFIXES=_ev_pb2.py
  502. # tag:proto tag:java-specific
  503. JAVA_PROTO_ARGS=
  504. # tag:proto tag:python-specific
  505. OPTIMIZE_PY_PROTOS_FLAG=no
  506. macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
  507. SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
  508. .SEM=resources ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${tool;hide:"tools/rescompiler/bin"}
  509. }
  510. # tag:built-in
  511. ### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # built-in
  512. ### Add data (resources, random files, strings) to the program)
  513. ### 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.
  514. ### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
  515. ###
  516. ### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
  517. ### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
  518. ###
  519. ### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
  520. ###
  521. ### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
  522. ###
  523. ### @example:
  524. ###
  525. ### LIBRARY()
  526. ### OWNER(user1)
  527. ###
  528. ### RESOURCE(
  529. ### path/to/file1 /key/in/program/1
  530. ### path/to/file2 /key2
  531. ### )
  532. ### END()
  533. ###
  534. macro RESOURCE(Args...) {
  535. PEERDIR(library/cpp/resource)
  536. }
  537. # tag:internal
  538. ### @usage: _ORDER_ADDINCL([BUILD ...] [SOURCE ...] Args...) # internal
  539. ###
  540. ### Order and filter ADDINCLs (Args - is intentionally omitted in ADDINCL macro)
  541. macro _ORDER_ADDINCL(BUILD[], SOURCE[], ARGS...) {
  542. ADDINCL($BUILD $SOURCE)
  543. }
  544. # tag:proto
  545. ### @usage: PROTO_ADDINCL([GLOBAL] [WITH_GEN] Path)
  546. ###
  547. ### This macro introduces proper ADDINCLs for .proto-files found in sources and
  548. ### .cpp/.h generated files, supplying them to appropriate commands and allowing
  549. ### proper dependency resolution at configure-time.
  550. ###
  551. ### Note: you normally shouldn't use this macro. ADDINCLs should be sent to user
  552. ### from dependency via PROTO_NAMESPACE macro
  553. macro PROTO_ADDINCL(GLOBAL?"GLOBAL":"", Path, WITH_GEN?"BUILD":"") {
  554. _ORDER_ADDINCL($WITH_GEN $GLOBAL FOR proto ${ARCADIA_BUILD_ROOT}/$Path SOURCE $GLOBAL FOR proto ${ARCADIA_ROOT}/$Path)
  555. ADDINCL($GLOBAL ${ARCADIA_BUILD_ROOT}/$Path)
  556. }
  557. # tag:proto
  558. ### @usage: PROTO_NAMESPACE([GLOBAL] [WITH_GEN] Namespace)
  559. ###
  560. ### Defines protobuf namespace (import/export path prefix) which should be used for imports and
  561. ### which defines output path for .proto generation.
  562. ###
  563. ### For proper importing and configure-time dependency management it sets ADDINCLs
  564. ### for both .cpp headers includes and .proto imports. If .proto expected to be used outside of the
  565. ### processing module use GLOBAL to send proper ADDINCLs to all (transitive) users. PEERDIR to
  566. ### PROTO_LIBRARY with PROTO_NAMESPACE(GLOBAL ) is enough at user side to correctly use the library.
  567. ### If generated .proto files are going to be used for building a module than use of WITH_GEN
  568. ### parameter will add appropriate dir from the build root for .proto files search.
  569. macro PROTO_NAMESPACE(GLOBAL?"GLOBAL":"", WITH_GEN?"WITH_GEN":"", Namespace) {
  570. SET(PROTO_NAMESPACE $Namespace)
  571. PROTO_ADDINCL($GLOBAL $WITH_GEN $Namespace)
  572. }
  573. # tag:proto tag:internal tag:python-specific
  574. ### @usage: OPTIMIZE_PY_PROTOS() # internal
  575. ###
  576. ### Enable Python proto optimization by embedding corresponding C++ code into binary.
  577. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  578. ### This is default mode for most PROTO_LIBRARY's and PY2_LIBRARY's, some system ones being exceptions.
  579. macro OPTIMIZE_PY_PROTOS() {
  580. SET(OPTIMIZE_PY_PROTOS_FLAG yes)
  581. }
  582. # tag:proto tag:python-specific
  583. ### @usage: NO_OPTIMIZE_PY_PROTOS()
  584. ###
  585. ### Disable Python proto optimization using embedding corresponding C++ code into binary.
  586. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  587. ### This is default mode only for some system libraries.
  588. macro NO_OPTIMIZE_PY_PROTOS() {
  589. SET(OPTIMIZE_PY_PROTOS_FLAG no)
  590. }
  591. # tag:proto tag:python-specific
  592. macro _PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  593. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$OutParm$ARCADIA_BUILD_ROOT/\$PROTO_NAMESPACE
  594. .SEM=IGNORED
  595. }
  596. # tag:proto tag:python-specific
  597. macro _ADD_PY_PROTO_OUT(Suf) {
  598. SET_APPEND(PY_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$Suf:File})
  599. 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}"})
  600. # XXX fix variable expansion in plugins
  601. SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
  602. }
  603. # tag:proto tag:python-specific
  604. ### @usage: PY_PROTO_PLUGIN(Name Ext Tool DEPS <Dependencies>)
  605. ###
  606. ### Define protoc plugin for python with given Name that emits extra output with provided Extension
  607. ### using Tool. Extra dependencies are passed via DEPS
  608. macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  609. SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  610. _ADD_PY_PROTO_OUT($EXT)
  611. # XXX fix variable expansion in plugins
  612. SET(PY_PROTO_DEPS $PY_PROTO_DEPS $DEPS)
  613. }
  614. # tag:proto tag:python-specific
  615. ### @usage: PY_PROTO_PLUGIN2(Name Ext1 Ext2 Tool DEPS <Dependencies>)
  616. ###
  617. ### Define protoc plugin for python with given Name that emits 2 extra outputs with provided Extensions
  618. ### using Tool. Extra dependencies are passed via DEPS
  619. macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
  620. PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
  621. _ADD_PY_PROTO_OUT($EXT2)
  622. }
  623. # tag:proto tag:java-specific
  624. macro _JAVA_PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  625. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/java_out
  626. }
  627. # tag:proto tag:java-specific
  628. ### @usage: JAVA_PROTO_PLUGIN(Name Tool DEPS <Dependencies>)
  629. ###
  630. ### Define protoc plugin for Java with given Name that emits extra outputs
  631. ### using Tool. Extra dependencies are passed via DEPS
  632. macro JAVA_PROTO_PLUGIN(NAME, TOOL, DEPS[]) {
  633. SET_APPEND(JAVA_PROTO_ARGS $_JAVA_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  634. # XXX fix variable expansion in plugins
  635. SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS $DEPS)
  636. }
  637. # tag:proto tag:cpp-specific
  638. macro _ADD_CPP_PROTO_OUT(Suf) {
  639. .SEM=append_target_property PROTOC_EXTRA_OUTS $Suf ${output;hide;suf=.o:Suf} && set_target_property PROTO_NAMESPACE $PROTO_NAMESPACE
  640. SET_APPEND(CPP_PROTO_OUTS \${output;hide;norel;nopath;noext;suf=$Suf:File})
  641. # XXX fix variable expansion in plugins
  642. SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES $Suf)
  643. }
  644. # tag:proto tag:cpp-specific
  645. HAS_CPP_PROTOBUF_PEERS=no
  646. CPP_PROTOBUF_PEERS=
  647. # tag:proto tag:cpp-specific
  648. ### @usage: CPP_PROTO_PLUGIN0(Name Tool DEPS <Dependencies>)
  649. ###
  650. ### Define protoc plugin for C++ with given Name that emits code into regular outputs
  651. ### using Tool. Extra dependencies are passed via DEPS.
  652. macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) {
  653. .SEM=target_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME}
  654. SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  655. # XXX fix variable expansion in plugins
  656. ENABLE(HAS_CPP_PROTOBUF_PEERS)
  657. SET(CPP_PROTOBUF_PEERS $CPP_PROTOBUF_PEERS $DEPS)
  658. }
  659. # tag:proto tag:cpp-specific
  660. ### @usage: CPP_PROTO_PLUGIN(Name Tool Suf DEPS <Dependencies>)
  661. ###
  662. ### Define protoc plugin for C++ with given Name that emits code into 1 extra output
  663. ### using Tool. Extra dependencies are passed via DEPS.
  664. macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[]) {
  665. CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS)
  666. _ADD_CPP_PROTO_OUT($SUF)
  667. }
  668. # tag:proto tag:cpp-specific
  669. ### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 DEPS <Dependencies>)
  670. ###
  671. ### Define protoc plugin for C++ with given Name that emits code into 2 extra outputs
  672. ### using Tool. Extra dependencies are passed via DEPS.
  673. macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[]) {
  674. CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS)
  675. _ADD_CPP_PROTO_OUT($SUF2)
  676. SET_APPEND(CPP_PROTO_OUTS_SEM \${output;hide;norel;nopath;noext;suf=$SUF2:File})
  677. }
  678. # tag:proto
  679. ### @usage: USE_SKIFF() #wip, do not use
  680. ###
  681. ### Use mapreduce/yt/skiff_proto/plugin for C++
  682. macro USE_SKIFF() {
  683. # Move extra includes to INDUCED_DEPS macro in mapreduce/yt/skiff_proto/plugin/ya.make
  684. CPP_PROTO_PLUGIN0(skiff mapreduce/yt/skiff_proto/plugin DEPS mapreduce/yt/skiff_proto/lib)
  685. }
  686. # tag:go-specific
  687. _GO_COMMON_GOOGLE_APIS = \
  688. vendor/google.golang.org/genproto/googleapis/api/annotations \
  689. vendor/google.golang.org/genproto/googleapis/api/configchange \
  690. vendor/google.golang.org/genproto/googleapis/api/distribution \
  691. vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1 \
  692. vendor/google.golang.org/genproto/googleapis/api/expr/v1beta1 \
  693. vendor/google.golang.org/genproto/googleapis/api/httpbody \
  694. vendor/google.golang.org/genproto/googleapis/api/label \
  695. vendor/google.golang.org/genproto/googleapis/api/metric \
  696. vendor/google.golang.org/genproto/googleapis/api/monitoredres \
  697. vendor/google.golang.org/genproto/googleapis/api/serviceconfig \
  698. vendor/google.golang.org/genproto/googleapis/api/servicecontrol/v1 \
  699. vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1 \
  700. vendor/google.golang.org/genproto/googleapis/iam/admin/v1 \
  701. vendor/google.golang.org/genproto/googleapis/iam/credentials/v1 \
  702. vendor/google.golang.org/genproto/googleapis/iam/v1 \
  703. vendor/google.golang.org/genproto/googleapis/iam/v1/logging \
  704. vendor/google.golang.org/genproto/googleapis/logging/type \
  705. vendor/google.golang.org/genproto/googleapis/logging/v2 \
  706. vendor/google.golang.org/genproto/googleapis/rpc/code \
  707. vendor/google.golang.org/genproto/googleapis/rpc/errdetails \
  708. vendor/google.golang.org/genproto/googleapis/rpc/status \
  709. vendor/google.golang.org/genproto/googleapis/type/calendarperiod \
  710. vendor/google.golang.org/genproto/googleapis/type/color \
  711. vendor/google.golang.org/genproto/googleapis/type/date \
  712. vendor/google.golang.org/genproto/googleapis/type/dayofweek \
  713. vendor/google.golang.org/genproto/googleapis/type/expr \
  714. vendor/google.golang.org/genproto/googleapis/type/fraction \
  715. vendor/google.golang.org/genproto/googleapis/type/latlng \
  716. vendor/google.golang.org/genproto/googleapis/type/money \
  717. vendor/google.golang.org/genproto/googleapis/type/postaladdress \
  718. vendor/google.golang.org/genproto/googleapis/type/quaternion \
  719. vendor/google.golang.org/genproto/googleapis/type/timeofday
  720. # tag:go-specific
  721. _COMMON_GOOGLE_APIS=None
  722. # tag:go-specific
  723. ### @usage: USE_COMMON_GOOGLE_APIS([apis...])
  724. ###
  725. ### Use common-google-apis library set. Pass optional apis list to be used or use them all.
  726. ### This macro is properly handled for all languages including Go, where apis come in
  727. ## pregenerated form. In other languages apis are generated from sources in Arcadia.
  728. macro USE_COMMON_GOOGLE_APIS(APIS...) {
  729. SET(_COMMON_GOOGLE_APIS ${pre=vendor/google.golang.org/genproto/googleapis/:APIS})
  730. }
  731. # tag:go-specific tag:proto
  732. GO_PROTO_GEN_PLUGINS=
  733. GO_PROTO_OPTS=
  734. GO_PROTO_OUTS=
  735. # tag:go-specific tag:proto
  736. GO_PROTOBUF_IMPORTS=\
  737. ${GOSTD}/sync \
  738. ${GOSTD}/reflect \
  739. ${GOSTD}/fmt \
  740. ${GOSTD}/math \
  741. vendor/github.com/golang/protobuf/proto \
  742. vendor/google.golang.org/protobuf/types/descriptorpb \
  743. vendor/google.golang.org/protobuf/runtime/protoimpl \
  744. vendor/google.golang.org/protobuf/runtime/protoiface \
  745. vendor/google.golang.org/protobuf/reflect/protoreflect
  746. # tag:go-specific tag:proto
  747. GO_PROTOBUF_WELLKNOWN_TYPES=\
  748. vendor/google.golang.org/protobuf/types/known/anypb \
  749. vendor/google.golang.org/protobuf/types/known/apipb \
  750. vendor/google.golang.org/protobuf/types/known/durationpb \
  751. vendor/google.golang.org/protobuf/types/known/emptypb \
  752. vendor/google.golang.org/protobuf/types/known/fieldmaskpb \
  753. vendor/google.golang.org/protobuf/types/known/sourcecontextpb \
  754. vendor/google.golang.org/protobuf/types/known/structpb \
  755. vendor/google.golang.org/protobuf/types/known/timestamppb \
  756. vendor/google.golang.org/protobuf/types/known/typepb \
  757. vendor/google.golang.org/protobuf/types/known/wrapperspb
  758. # tag:go-specific tag:proto
  759. ### @usage: GO_PROTO_PLUGIN(Name Ext Tool [DEPS dependencies...])
  760. ###
  761. ### Define protoc plugin for GO with given Name that emits extra output with provided extension
  762. ### Ext using Tool. Extra dependencies are passed via DEPS.
  763. macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  764. SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  765. SET_APPEND(GO_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$EXT:File})
  766. PEERDIR(${DEPS})
  767. }
  768. # tag:go-specific tag:proto
  769. GO_PROTO_CMDLINE=${cwd;rootdir;input:File} $YMAKE_PYTHON ${input:"build/scripts/go_proto_wrapper.py"} $GO_ARCADIA_PROJECT_PREFIX $GO_CONTRIB_PROJECT_PREFIX ./$PROTO_NAMESPACE $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH ${input;rootrel:File}
  770. # tag:go-specific tag:proto
  771. macro _GO_PROTO_CMD_IMPL(File, OPTS...) {
  772. .CMD=$GO_PROTO_CMDLINE $OPTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  773. .PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES}
  774. .ADDINCL=FOR proto contrib/libs/protobuf/src
  775. }
  776. # tag:go-specific tag:proto
  777. macro _GO_PROTO_CMD(File) {
  778. .CMD=$_GO_PROTO_CMD_IMPL($File $GO_PROTO_OPTS $GO_PROTO_OUTS)
  779. }
  780. # tag:proto
  781. ### @usage: YP_PROTO_YSON(Files... OUT_OPTS Opts...)
  782. ###
  783. ### Generate .yson.go from .proto using yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen
  784. macro YP_PROTO_YSON(OUT_OPTS[], Files...) {
  785. .CMD=${cwd:BINDIR} $PROTOC --plugin=protoc-gen-custom=${tool:"yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen"} -I=${ARCADIA_ROOT}/${PROTO_NAMESPACE} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} --custom_out="$OUT_OPTS paths=base_name:." --custom_opt="goroot=${GO_TOOLS_ROOT}" ${input:Files} ${output;hide;noauto;nopath;noext;suf=.yson.go:Files}
  786. .ADDINCL=FOR proto ${ARCADIA_ROOT}/${MODDIR} FOR proto ${ARCADIA_ROOT}/${GO_TEST_IMPORT_PATH} FOR proto yt ${ARCADIA_BUILD_ROOT}/yt FOR proto contrib/libs/protobuf/src
  787. .PEERDIR=$GOSTD/strings $GOSTD/fmt $GOSTD/errors $GOSTD/encoding/json library/go/core/xerrors yt/go/yson yt/go/yterrors yp/go/yson/ytypes contrib/libs/protobuf
  788. }
  789. _SEM_CPP_PROTO_CMD=target_proto_messages PRIVATE ${input:File} $CPP_PROTO_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
  790. && set_global_flags COMMON_PROTOC_FLAGS \
  791. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
  792. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH
  793. # tag:proto
  794. macro _CPP_PROTO_CMD(File) {
  795. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  796. .SEM=$_SEM_CPP_PROTO_CMD
  797. .PEERDIR=contrib/libs/protobuf
  798. }
  799. # tag:proto
  800. macro _CPP_VANILLA_PROTO_CMD(File) {
  801. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  802. .PEERDIR=contrib/libs/protobuf_std
  803. }
  804. # tag:proto
  805. macro _CPP_EVLOG_CMD(File) {
  806. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_EV_OUTS ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  807. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  808. }
  809. # tag:proto
  810. macro _CPP_PROTO_EVLOG_CMD(File) {
  811. # process .proto as .ev
  812. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  813. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  814. }
  815. # tag:proto
  816. macro _CPP_CFGPROTO_CMD(File) {
  817. # keep extension in output just as in EV: this is hard-coded behaviour of protoc for non-.proto extensions
  818. .CMD=$CPP_PROTO_CMDLINE --plugin=protoc-gen-config=${tool:"library/cpp/proto_config/plugin"} --config_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $CPP_EV_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  819. .PEERDIR=library/cpp/proto_config/codegen library/cpp/proto_config/protos contrib/libs/protobuf
  820. }
  821. # tag:proto
  822. PY_PROTO_MYPY_ENABLED=yes
  823. PY_PROTO_MYPY_PLUGIN_BASE=--plugin=protoc-gen-mypy=${tool:"contrib/python/mypy-protobuf/bin/protoc-gen-mypy"} --mypy_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
  824. # tag:proto tag:python-specific
  825. PY_PROTO_MYPY_SUFFIX=
  826. PY_PROTO_MYPY_PLUGIN=
  827. PY_PROTO_MYPY_PLUGIN_INTERNAL=
  828. # tag:proto tag:python-specific
  829. macro NO_MYPY() {
  830. DISABLE(PY_PROTO_MYPY_ENABLED)
  831. }
  832. # tag:proto tag:python-specific
  833. macro _PY_PROTO_CMD_BASE(File, Suf, Args...) {
  834. .CMD=$PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --python_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE ${input;rootrel:File} ${output;hide;noauto;norel;nopath;noext;suf=$Suf:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $Args
  835. }
  836. # tag:proto tag:python-specific
  837. macro _PY_PROTO_CMD(File) {
  838. .CMD=${cwd;rootdir;input:File} $_PY_PROTO_CMD_BASE($File _pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS $PY_PROTO_MYPY_PLUGIN)
  839. }
  840. # tag:proto tag:python-specific
  841. macro _PY_PROTO_CMD_INTERNAL(File) {
  842. .CMD=${cwd;rootdir;input:File} $GEN_PY_PROTOS --suffixes $PY_PROTO_SUFFIXES $PY_PROTO_MYPY_SUFFIX -- $_PY_PROTO_CMD_BASE($File __int___pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS_INTERNAL ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___pb2.py:File} ${nopath;noext;suf=_pb2.py:File}"} $PY_PROTO_MYPY_PLUGIN_INTERNAL)
  843. }
  844. # tag:proto tag:java-specific
  845. JAVA_PROTO_RUNTIME=
  846. # tag:proto tag:java-specific
  847. ### @usage: USE_JAVALITE()
  848. ### Use protobuf-javalite for Java
  849. macro USE_JAVALITE() {
  850. SET(JAVA_PROTO_RUNTIME javalite)
  851. }
  852. # tag:proto tag:java-specific
  853. JAVA_PROTO_RUNTIME_VERSION = 3.19.2
  854. JAVA_PROTO_COMMON_VERSION = 1.12.0
  855. when ($JAVA_PROTO_RUNTIME == "javalite") {
  856. _JAVA_PROTO_OUT_ARG=--java_out=lite:
  857. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION}
  858. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.19.0
  859. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.19.0
  860. }
  861. otherwise {
  862. _JAVA_PROTO_OUT_ARG=--java_out=
  863. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION}
  864. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.43.2
  865. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.43.2
  866. }
  867. # tag:proto tag:java-specific
  868. macro _JAVA_PROTO_CMD(File) {
  869. .CMD=${cwd;rootdir;input:File} $YMAKE_PYTHON ${input:"build/scripts/tared_protoc.py"} --tar-output ${output;norel;nopath;noext;suf=.jsrc:File} --protoc-out-dir $ARCADIA_BUILD_ROOT/java_out $PROTOC -I=./$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_ROOT $_JAVA_PROTO_OUT_ARG$ARCADIA_BUILD_ROOT/java_out ${input;rootrel:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $JAVA_PROTO_ARGS
  870. }
  871. # tag:proto tag:perl-specific tag:deprecated
  872. ### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
  873. ###
  874. ### Generate Perl code from protobuf.
  875. ### In order to use this macro one should predict all outputs protoc will emit from input_proto file and enlist those as outputs.
  876. macro XS_PROTO(File, Dir, Outputs...) {
  877. .CMD=$PROTOC -I=${ARCADIA_ROOT}/${Dir} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} -I=${PROTOBUF_PATH} --perlxs_out=${BINDIR} ${input:File} ${hide;output:Outputs} ${output_include;hide;nopath;noext;suf=.pb.h:File}
  878. PEERDIR(${Dir})
  879. ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir})
  880. }
  881. # tag:proto tag:fbs
  882. ### @usage: PROTO2FBS(InputProto)
  883. ###
  884. ### Produce flatbuf schema out of protobuf description.
  885. macro PROTO2FBS(File) {
  886. .CMD=${cwd:BINDIR} ${tool:"contrib/tools/flatc"} -I . -I ${ARCADIA_ROOT} --proto ${input:File} ${output;hide;nopath;noext:File.fbs} ${kv;hide:"p FBS"} ${kv;hide:"pc yellow"}
  887. }
  888. # tag:proto tag:python-specific
  889. when ($PY_PROTOS_FOR == "yes") {
  890. PEERDIR+=contrib/libs/protobuf/python
  891. }
  892. # tag:python-specific
  893. macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
  894. .CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
  895. .PEERDIR=library/cpp/eventlog/proto
  896. }
  897. # tag:python-specific tag:proto
  898. macro _PY_EVLOG_CMD(File) {
  899. .CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
  900. }
  901. # tag:python-specific tag:proto
  902. macro _PY_EVLOG_CMD_INTERNAL(File) {
  903. .CMD=${cwd;rootdir;input:File} $GEN_PY_PROTOS --suffixes $PY_EVLOG_SUFFIXES -- $_PY_EVLOG_CMD_BASE($File __int___ev_pb2.py ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___ev_pb2.py:File} ${nopath;noext;suf=_ev_pb2.py:File}"})
  904. }
  905. # tag:java-specific tag:proto
  906. macro _JAVA_EVLOG_CMD(File) {
  907. .CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  908. .PEERDIR=library/cpp/eventlog/proto
  909. }
  910. # tag:sanitize
  911. RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
  912. # tag:sanitize
  913. when ($IS_CROSS_SANITIZE) {
  914. RUN_NO_SANITIZE=
  915. }
  916. YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
  917. XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
  918. WRITER_PY=$YMAKE_PYTHON ${input:"build/scripts/writer.py"} ${input;hide:"build/scripts/process_command_files.py"}
  919. FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} ${input;hide:"build/scripts/process_command_files.py"}
  920. FIX_MSVC_OUTPUT=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ${input;hide:"build/scripts/process_command_files.py"}
  921. COPY_CMD=$FS_TOOLS copy
  922. LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
  923. REMOVE_FILE=$FS_TOOLS remove
  924. MOVE_FILE=$FS_TOOLS rename
  925. # tag:allocator tag:windows-specific
  926. MSVC_DYNAMICBASE=/DYNAMICBASE
  927. when ($ALLOCATOR == "LF") {
  928. MSVC_DYNAMICBASE=/DYNAMICBASE:NO
  929. }
  930. # tag:sanitize
  931. SANITIZER_CFLAGS=
  932. # tag:proto tag:grpc
  933. ### @usage: GRPC()
  934. ###
  935. ### Emit GRPC code for all .proto files in a PROTO_LIBRARY.
  936. ### This works for all available PROTO_LIBRARY versions (C++, Python 2.x, Pyton 3.x, Java and Go).
  937. macro GRPC() {
  938. # C++
  939. CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp .grpc.pb.cc .grpc.pb.h DEPS contrib/libs/grpc)
  940. # Python
  941. PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/libs/grpc/python contrib/libs/grpc)
  942. # Java
  943. JAVA_PROTO_PLUGIN(grpc_java contrib/tools/protoc/plugins/grpc_java DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  944. }
  945. # tag:fbs
  946. FLATC_FLAGS_VALUE=
  947. ### @usage: FLATC_FLAGS(flags...)
  948. ###
  949. ### Add flags to flatc command line
  950. macro FLATC_FLAGS(FLAGS...) {
  951. SET_APPEND(FLATC_FLAGS_VALUE $FLAGS)
  952. }
  953. # tag:fbs
  954. _PY_FBS_DEPS=contrib/python/flatbuffers
  955. # tag:fbs tag:internal
  956. ### @usage: FBS_TO_PYSRC(output_base_name fbs_files...) # internal
  957. ###
  958. ### Create a tar archive of .py files generated by flatc for Python. Output tar
  959. ### archive will have .fbs.pysrc extension. This .fbs.pysrc extension is specially
  960. ### processed when --add-flatbuf-result flag is specified on the command line
  961. ### for 'ya make ...' (tar archive is extracted to output directory).
  962. macro FBS_TO_PYSRC(OUT_NAME, IN_FBS_FILES...) {
  963. .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"}
  964. }
  965. # tag:fbs tag:go-specific
  966. # Implicit dependencies of generated code for Go
  967. _GO_FLATC_IMPORTS=\
  968. ${GOSTD}/strconv \
  969. vendor/github.com/google/flatbuffers/go
  970. # tag:fbs tag:cpp-specific
  971. macro _CPP_FLATC_CMD(SRC, SRCFLAGS...) {
  972. .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"}
  973. .SEM=target_fbs_source PRIVATE ${input:SRC} ${pre=-I :_FLATC__INCLUDE} ${output;hide;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${output;hide;noext;norel:SRC.iter.fbs.h} ${output;noauto;hide;noext;norel:SRC.bfbs} ${hide;tool:"contrib/tools/flatc/bin"} && set_global_flags FBS_CPP_FLAGS --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --yandex-maps-iter --gen-object-api --filename-suffix .fbs ${FLATC_FLAGS_VALUE}
  974. .PEERDIR=contrib/libs/flatbuffers
  975. }
  976. # tag:fbs tag:cpp-specific
  977. macro _CPP_FLATC64_CMD(SRC, SRCFLAGS...) {
  978. .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"}
  979. .PEERDIR=contrib/libs/flatbuffers64
  980. }
  981. # tag:fbs tag:go-specific tag:internal
  982. ### @usage: _GO_FLATC_CMD(fbs_file flags...) # internal
  983. ###
  984. ### Create a tar archive of .go files generated by flatc for Go. Output tar archive
  985. ### will have .fbs.gosrc extension. This .fbs.gosrc is specially processed when
  986. ### --add-protobuf-result flag is specified on the command line for 'ya make ...'
  987. ### (tar archive is extracted to output directory).
  988. macro _GO_FLATC_CMD(SRC, PACKAGE_NAME) {
  989. .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"}
  990. .PEERDIR=${_GO_FLATC_IMPORTS}
  991. }
  992. # tag:fbs tag:java-specific tag:internal
  993. ### @usage: _JAVA_FLATC_CMD(fbs_file) # internal
  994. ###
  995. ### Create a tar archive of .java files generated by flatc for Java. Output tar
  996. ### acrchive will have .fbs.jsrc extension. Files with .fbs.jsrc extension will
  997. ### be added to results when --add-flatbuf-result flag is specified on the command
  998. ### line for 'ya make ...'
  999. macro _JAVA_FLATC_CMD(SRC) {
  1000. .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"}
  1001. .PEERDIR=contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION}
  1002. }
  1003. # variables must be defined for all module types to make generate_mf.py work
  1004. MODULE_PREFIX=
  1005. MODULE_SUFFIX=
  1006. NEED_PLATFORM_PEERDIRS=yes
  1007. PEERDIR_TEST_TOOL=yes
  1008. # tag:python-specific
  1009. PYTHON2=no
  1010. PYTHON3=no
  1011. # tag:python-specific
  1012. when (!$ARCADIA_PYTHON_UNICODE_SIZE) {
  1013. when ($OS_WINDOWS) {
  1014. ARCADIA_PYTHON_UNICODE_SIZE=2
  1015. }
  1016. otherwise {
  1017. ARCADIA_PYTHON_UNICODE_SIZE=4
  1018. }
  1019. }
  1020. ### @usage: _BARE_UNIT # internal
  1021. ###
  1022. ### The base of all modules describing default bare minimum for all modules.
  1023. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1024. module _BARE_UNIT {
  1025. .EXTS=.*
  1026. .CMD=TOUCH_UNIT
  1027. .IGNORED=GO_PROTO_PLUGIN
  1028. .NODE_TYPE=Bundle
  1029. .PEERDIR_POLICY=as_include
  1030. .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
  1031. .FINAL_TARGET=no
  1032. PEERDIR_TAGS=__EMPTY__
  1033. when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
  1034. PEERDIR+=build/conf_fatal_error
  1035. }
  1036. DEFAULT(MODULE_VERSION)
  1037. DEFAULT(MODULE_PREFIX)
  1038. DEFAULT(MODULE_SUFFIX)
  1039. }
  1040. ### @usage: _BASE_UNIT # internal
  1041. ###
  1042. ### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
  1043. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1044. module _BASE_UNIT: _BARE_UNIT {
  1045. .GLOBAL=_FBS_NAMESPACE_MAP
  1046. PEERDIR_TAGS=CPP_PROTO CPP_FBS CPP_SSQLS CPP_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB
  1047. 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}
  1048. CPP_PROTO_OUTS+=${output;hide;norel;nopath;noext:File.pb.cc} ${output;main;hide;norel;nopath;noext:File.pb.h}
  1049. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
  1050. CPP_EV_OUTS+=${output;hide;norel:File.pb.cc} ${output;hide;norel:File.pb.h}
  1051. when ($SWIG_LANG == "perl") {
  1052. _SWIG_CMD=$_SWIG_PERL_CMD
  1053. _SWIG_ADDINCLS=$_SWIG_PERL_ADDINCLS
  1054. _SWIG_PEERDIR=$_SWIG_PERL_PEERDIR
  1055. }
  1056. elsewhen ($SWIG_LANG == "python") {
  1057. _SWIG_CMD=$_SWIG_PYTHON_CMD
  1058. _SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
  1059. _SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
  1060. }
  1061. elsewhen ($SWIG_LANG == "jni_cpp") {
  1062. _SWIG_CMD=$_SWIG_JNI_CPP_CMD
  1063. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1064. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1065. }
  1066. elsewhen ($SWIG_LANG == "java") {
  1067. _SWIG_CMD=$_SWIG_JNI_CMD
  1068. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1069. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1070. }
  1071. when ($PY_PROTOS_FOR == "yes") {
  1072. MACRO_ALIAS(EVLOG_CMD _PY_EVLOG_CMD)
  1073. MACRO_ALIAS(PROTO_CMD _PY_PROTO_CMD)
  1074. }
  1075. otherwise {
  1076. MACRO_ALIAS(EVLOG_CMD _CPP_EVLOG_CMD)
  1077. MACRO_ALIAS(FBS_CMD _CPP_FLATC_CMD)
  1078. when ($BUILD_PROTO_AS_EVLOG == "yes") {
  1079. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_EVLOG_CMD)
  1080. }
  1081. otherwise {
  1082. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_CMD)
  1083. }
  1084. when ($USE_VANILLA_PROTOC == "yes") {
  1085. PROTOC=${tool:"contrib/tools/protoc_std"}
  1086. PROTOC_STYLEGUIDE_OUT=
  1087. PROTOC_PLUGIN_STYLEGUIDE=
  1088. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std
  1089. MACRO_ALIAS(PROTO_CMD _CPP_VANILLA_PROTO_CMD)
  1090. }
  1091. when ($PROTOC_TRANSITIVE_HEADERS == "no") {
  1092. CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
  1093. }
  1094. }
  1095. SANITIZER_DEFINED=no
  1096. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1097. CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
  1098. LDFLAGS+=-fsanitize=$SANITIZER_TYPE
  1099. SANITIZER_DEFINED=yes
  1100. when ($CLANG) {
  1101. CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"}
  1102. LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"}
  1103. }
  1104. }
  1105. when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
  1106. CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1107. LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1108. }
  1109. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1110. CFLAGS+=-fprofile-instr-generate -fcoverage-mapping -DCLANG_COVERAGE
  1111. LDFLAGS+=-fprofile-instr-generate -fcoverage-mapping
  1112. }
  1113. when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
  1114. CFLAGS+=-DNLG_COVERAGE
  1115. }
  1116. when ($GCC) {
  1117. select ($SANITIZER_TYPE) {
  1118. "address" ? {
  1119. LDFLAGS+=-static-libasan
  1120. }
  1121. "undefined" ? {
  1122. LDFLAGS+=-static-libubsan
  1123. }
  1124. "thread" ? {
  1125. PIE=yes
  1126. LDFLAGS+=-static-libtsan
  1127. }
  1128. }
  1129. }
  1130. when ($HARDENING == "yes") {
  1131. when ($CLANG) {
  1132. CFLAGS+=-fstack-protector-all -D_hardening_enabled_
  1133. LDFLAGS+=-z relro -z now -z noexecstack
  1134. PIE=yes
  1135. }
  1136. }
  1137. when ($USE_LTO == "yes") {
  1138. when ($GCC) {
  1139. CFLAGS+=-flto -fno-fat-lto-objects
  1140. LDFLAGS+=-flto
  1141. NO_LTO_CFLAGS=-fno-lto
  1142. }
  1143. when ($CLANG) {
  1144. CFLAGS+=-flto
  1145. LDFLAGS+=-flto
  1146. NO_LTO_CFLAGS=-fno-lto
  1147. }
  1148. }
  1149. when ($USE_THINLTO == "yes") {
  1150. when ($GCC) {
  1151. CFLAGS+=-flto=thin
  1152. LDFLAGS+=-flto=thin
  1153. NO_LTO_CFLAGS=-fno-lto
  1154. }
  1155. when ($CLANG) {
  1156. CFLAGS+=-flto=thin
  1157. LDFLAGS+=-flto=thin
  1158. NO_LTO_CFLAGS=-fno-lto
  1159. }
  1160. }
  1161. when ($CLANG) {
  1162. when ($PGO_ADD == "yes") {
  1163. CFLAGS+=-fprofile-instr-generate
  1164. LDFLAGS+=-fprofile-instr-generate
  1165. }
  1166. when ($PGO_PATH) {
  1167. CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
  1168. LDFLAGS+=-fprofile-instr-use=$PGO_PATH
  1169. }
  1170. }
  1171. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  1172. PEERDIR+=$COMPILER_PLATFORM
  1173. }
  1174. when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
  1175. PEERDIR+=contrib/libs/linux-headers
  1176. }
  1177. # Adding PEERDIR from trigger doesn't always work. In this case it
  1178. # cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl
  1179. # Workaround this issue by setting variable with PEERDIR in trigger
  1180. # and then adding PEERDIR to it's value unconditionally.
  1181. when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1182. _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14
  1183. }
  1184. otherwise {
  1185. _UBUNTU_COMPAT_PEERDIR=
  1186. }
  1187. PEERDIR+=$_UBUNTU_COMPAT_PEERDIR
  1188. when ($NORUNTIME != "yes") {
  1189. PEERDIR+=contrib/libs/cxxsupp
  1190. when ($MAPSMOBI_BUILD_TARGET == "yes") {
  1191. PEERDIR+=build/platform/mapkit
  1192. }
  1193. }
  1194. when ($NOUTIL != "yes") {
  1195. PEERDIR+=util
  1196. }
  1197. when ($MUSL == "yes") {
  1198. CFLAGS += -D_musl_
  1199. LINK_DYN_LIB_FLAGS += --musl
  1200. LINK_SCRIPT_EXE_FLAGS += --musl
  1201. PEERDIR+=contrib/libs/musl/include
  1202. }
  1203. # g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
  1204. # The same problem exists for clang toolchain. On the other hand, the problem
  1205. # doesn't affect cl since it has united C/C++ library and doesn't need
  1206. # proxy C-headers.
  1207. # Disable all C++ headers including proxy C-headers when we use libc++.
  1208. when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
  1209. CXXFLAGS += -nostdinc++
  1210. }
  1211. otherwise {
  1212. CFLAGS += -DUSE_STL_SYSTEM
  1213. }
  1214. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  1215. PEERDIR += build/external_resources/codenavigation
  1216. }
  1217. when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
  1218. CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
  1219. }
  1220. DEFAULT(USE_SSE4 yes)
  1221. when ($NOSSE != "yes") {
  1222. CFLAGS+=$SSE_CFLAGS
  1223. C_DEFINES+=$SSE_DEFINES
  1224. when ($USE_SSE4 == "yes") {
  1225. CFLAGS+=$SSE4_CFLAGS
  1226. C_DEFINES+=$SSE4_DEFINES
  1227. }
  1228. }
  1229. elsewhen ($MSVC != "yes") {
  1230. CFLAGS += -mno-sse
  1231. }
  1232. when ($LIPO == "yes" && $NEED_PLATFORM_PEERDIRS != "no") {
  1233. when ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1234. PEERDIR += build/platform/cctools
  1235. }
  1236. }
  1237. _REGISTER_NO_CHECK_IMPORTS()
  1238. DEFAULT(PACKAGE_PREFIX_ARGS)
  1239. DEFAULT(BYACC_FLAGS -v)
  1240. DEFAULT(SWIG_LANG python)
  1241. DEFAULT(BISON_FLAGS -v)
  1242. DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
  1243. when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
  1244. PEERDIR+=build/platform/binutils
  1245. }
  1246. }
  1247. _LINKER_ID=
  1248. # GCC does not support -fuse-ld with an executable path,
  1249. # only -fuse-ld=gold or -fuse-ld=lld.
  1250. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1251. when ($_LINKER_ID in [ "gold", "lld" ]) {
  1252. PEERDIR+=build/platform/${_LINKER_ID}
  1253. }
  1254. }
  1255. macro _USE_LINKER_IMPL(LINKER_ID...) {
  1256. SET(_LINKER_ID $LINKER_ID)
  1257. }
  1258. macro _USE_LINKER() {
  1259. _USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
  1260. }
  1261. ### @usage: USE_LINKER_GOLD()
  1262. ### Use gold linker for a program. This doesn't work in libraries
  1263. macro USE_LINKER_GOLD() {
  1264. _USE_LINKER_IMPL(gold)
  1265. }
  1266. COMMON_LINK_SETTINGS=
  1267. LINK_ADDITIONAL_SECTIONS=
  1268. LINK_ADDITIONAL_SECTIONS_COMMAND=
  1269. when ($COMMON_LINK_SETTINGS == "yes") {
  1270. when ($_LINKER_ID == "lld" || $_LINKER_ID == "gold") {
  1271. LDFLAGS += -Wl,--gdb-index
  1272. }
  1273. when ($EMBED_LINKER_CREF == "yes") {
  1274. LDFLAGS+=-Wl,--cref ${tmp;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1275. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
  1276. }
  1277. elsewhen ($DUMP_LINKER_CREF == "yes") {
  1278. LDFLAGS+=-Wl,--cref ${output;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1279. }
  1280. when ($EMBED_LINKER_MAP == "yes") {
  1281. LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1282. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1283. }
  1284. elsewhen ($DUMP_LINKER_MAP == "yes") {
  1285. LDFLAGS+=-Wl,-Map=${output;rootrel;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1286. }
  1287. when ($USE_MKL == "yes") {
  1288. NOPLATFORM=yes
  1289. }
  1290. when (($USE_EAT_MY_DATA == "yes") && ($WIN32 != "yes") && ($DARWIN != "yes") && ($OS_ANDROID != "yes") && ($OS_IOS != "yes")) {
  1291. PEERDIR+=contrib/libs/libeatmydata/autocheck_wrapper
  1292. }
  1293. when ($USE_ARCADIA_LIBM == "yes") {
  1294. PEERDIR+=contrib/libs/libm
  1295. }
  1296. when ($USE_ARCADIA_LIBM == "no") {
  1297. C_SYSTEM_LIBRARIES+=-lm
  1298. }
  1299. when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
  1300. when ($ALLOCATOR in [ "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "J", "LF", "LF_YT", "LF_DBG", "B", "BM", "C", "LOCKLESS", "YT", "MIM", "HU" ]) {
  1301. PEERDIR+=library/cpp/malloc/system
  1302. }
  1303. }
  1304. otherwise {
  1305. select ($ALLOCATOR) {
  1306. "MIM" ? {
  1307. PEERDIR+=library/cpp/malloc/mimalloc
  1308. }
  1309. "HU" ? {
  1310. PEERDIR+=library/cpp/malloc/hu
  1311. }
  1312. "TCMALLOC_256K" ? {
  1313. PEERDIR+=library/cpp/malloc/tcmalloc
  1314. PEERDIR+=contrib/libs/tcmalloc
  1315. }
  1316. "TCMALLOC_SMALL_BUT_SLOW" ? {
  1317. PEERDIR+=library/cpp/malloc/tcmalloc
  1318. PEERDIR+=contrib/libs/tcmalloc/small_but_slow
  1319. }
  1320. "TCMALLOC_NUMA_256K" ? {
  1321. PEERDIR+=library/cpp/malloc/tcmalloc
  1322. PEERDIR+=contrib/libs/tcmalloc/numa_256k
  1323. }
  1324. "TCMALLOC_NUMA_LARGE_PAGES" ? {
  1325. PEERDIR+=library/cpp/malloc/tcmalloc
  1326. PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
  1327. }
  1328. "TCMALLOC" ? {
  1329. PEERDIR+=library/cpp/malloc/tcmalloc
  1330. PEERDIR+=contrib/libs/tcmalloc/default
  1331. }
  1332. "TCMALLOC_TC" ? {
  1333. PEERDIR+=library/cpp/malloc/tcmalloc
  1334. PEERDIR+=contrib/libs/tcmalloc/no_percpu_cache
  1335. }
  1336. "GOOGLE" ? {
  1337. PEERDIR+=library/cpp/malloc/galloc
  1338. }
  1339. "J" ? {
  1340. when ($WIN32 == "yes") {
  1341. PEERDIR+=library/cpp/malloc/system
  1342. }
  1343. otherwise {
  1344. PEERDIR+=library/cpp/malloc/jemalloc
  1345. }
  1346. }
  1347. "LF" ? {
  1348. PEERDIR+=library/cpp/lfalloc
  1349. }
  1350. "LF_YT" ? {
  1351. PEERDIR+=library/cpp/lfalloc/yt
  1352. }
  1353. "LF_DBG" ? {
  1354. PEERDIR+=library/cpp/lfalloc/dbg
  1355. }
  1356. "B" ? {
  1357. PEERDIR+=library/cpp/balloc
  1358. }
  1359. "BM" ? {
  1360. PEERDIR+=library/cpp/balloc_market
  1361. }
  1362. "C" ? {
  1363. PEERDIR+=library/cpp/malloc/calloc
  1364. }
  1365. "LOCKLESS" ? {
  1366. PEERDIR+=library/cpp/malloc/lockless
  1367. }
  1368. "YT" ? {
  1369. PEERDIR+=library/cpp/ytalloc/impl
  1370. }
  1371. }
  1372. }
  1373. when ($ALLOCATOR == "SYSTEM") {
  1374. PEERDIR+=library/cpp/malloc/system
  1375. }
  1376. when ($WERROR != "no") {
  1377. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  1378. C_WARNING_OPTS += $WERROR_FLAG
  1379. }
  1380. }
  1381. when ($ICC == "yes") {
  1382. PEERDIR+=contrib/libs/intel/core
  1383. }
  1384. when ($WITH_VALGRIND == "yes") {
  1385. PEERDIR+=contrib/libs/valgrind
  1386. }
  1387. }
  1388. when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
  1389. LINK_ADDITIONAL_SECTIONS_COMMAND+= \
  1390. $OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
  1391. }
  1392. _SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/:PEERS}
  1393. when ($OS_WINDOWS == "yes") {
  1394. _SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/:PEERS}
  1395. }
  1396. elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1397. _SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/:PEERS}
  1398. }
  1399. LINK_OR_COPY_SO_CMD=
  1400. when ($SO_OUTPUTS == "yes") {
  1401. LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
  1402. LDFLAGS+=$RPATH_GLOBAL
  1403. }
  1404. # tag:restricted tag:DLL
  1405. ### $usage: WITH_DYNAMIC_LIBS() # restricted
  1406. ###
  1407. ### Include dynamic libraries as extra PROGRAM/DLL outputs
  1408. macro WITH_DYNAMIC_LIBS() {
  1409. ENABLE(SO_OUTPUTS)
  1410. }
  1411. # tag:internal
  1412. ### $usage: REAL_LINK_EXE_IMPL(peers...) # internal
  1413. macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1414. .CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1415. }
  1416. # tag:internal
  1417. ### $usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1418. macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1419. .CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
  1420. }
  1421. # tag:internal
  1422. ### $usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
  1423. macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1424. .CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
  1425. }
  1426. # tag:internal
  1427. ### $usage: LINK_EXE_IMPL(peers...) # internal
  1428. macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1429. .CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1430. }
  1431. # tag:internal
  1432. ### $usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1433. macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1434. .CMD=$LINK_EXEC_DYN_LIB_CMDLINE
  1435. }
  1436. # tag:internal
  1437. ### @usage: _LINK_UNIT # internal
  1438. ###
  1439. ### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
  1440. module _LINK_UNIT: _BASE_UNIT {
  1441. .EXTS=.o .obj .supp .tidyjson .ld
  1442. .CMD=LINK_EXE
  1443. .ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  1444. .NODE_TYPE=Program
  1445. .PEERDIR_POLICY=as_build_from
  1446. .FINAL_TARGET=yes
  1447. .DEFAULT_NAME_GENERATOR=DirName
  1448. .ARGS_PARSER=Base
  1449. DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
  1450. _USE_LINKER()
  1451. #link with libunwind manually
  1452. when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
  1453. PEERDIR += contrib/libs/cxxsupp
  1454. }
  1455. when ($USE_LIBCXXRT == "yes") {
  1456. PEERDIR += contrib/libs/cxxsupp/libcxxrt
  1457. }
  1458. when ($USE_DYNAMIC_CUDA == "yes") {
  1459. LINK_DYN_LIB_FLAGS += --dynamic-cuda
  1460. LINK_SCRIPT_EXE_FLAGS += --dynamic-cuda
  1461. }
  1462. ENABLE(COMMON_LINK_SETTINGS)
  1463. CHECK_PROVIDES()
  1464. }
  1465. MODULE_TYPE=UNKNOWN
  1466. macro ADD_CLANG_TIDY() {
  1467. ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy)
  1468. when ($TIDY == "yes") {
  1469. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json
  1470. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json
  1471. }
  1472. }
  1473. # tag:internal
  1474. ### @usage: _BASE_PROGRAM # internal
  1475. ###
  1476. ### The base of all programs. It adds dependencies to make final artefact complete and runnable.
  1477. module _BASE_PROGRAM: _LINK_UNIT {
  1478. .SYMLINK_POLICY=EXE
  1479. .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
  1480. .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1481. SET(MODULE_TYPE PROGRAM)
  1482. when ($OS_IOS == "yes") {
  1483. EXTS+=.ios.interface
  1484. }
  1485. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  1486. MODULE_SUFFIX=.exe
  1487. }
  1488. when ($TIDY == "yes") {
  1489. MODULE_SUFFIX=.tidyjson
  1490. }
  1491. when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
  1492. PEERDIR+=contrib/libs/asmlib
  1493. }
  1494. when ($MUSL == "yes") {
  1495. when ($MUSL_LITE == "yes") {
  1496. PEERDIR += contrib/libs/musl
  1497. }
  1498. otherwise {
  1499. PEERDIR += contrib/libs/musl/full
  1500. }
  1501. }
  1502. DEFAULT(CPU_CHECK yes)
  1503. when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
  1504. CPU_CHECK = no
  1505. }
  1506. when ($CPU_CHECK == "yes") {
  1507. PEERDIR += library/cpp/cpuid_check
  1508. }
  1509. when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
  1510. PEERDIR += library/cpp/execprofile/autostart
  1511. }
  1512. when ($SANITIZER_DEFINED == "yes") {
  1513. PEERDIR += contrib/libs/cxxsupp/libsan
  1514. }
  1515. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1516. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1517. }
  1518. when ($IDE_MSVS == "yes") {
  1519. PEERDIR+=build/scripts/c_templates
  1520. }
  1521. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1522. LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1523. }
  1524. }
  1525. CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  1526. && vcs_info \
  1527. && target_link_options PRIVATE $LDFLAGS $OBJADDE_LIB $OBJADDE \
  1528. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1529. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS
  1530. ### @usage: PROGRAM([progname])
  1531. ###
  1532. ### Regular program module.
  1533. ### If name is not specified it will be generated from the name of the containing project directory.
  1534. module PROGRAM: _BASE_PROGRAM {
  1535. .SEM=CPP_PROGRAM_SEM
  1536. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1537. ADD_CLANG_TIDY()
  1538. SET(MODULE_LANG CPP)
  1539. }
  1540. # tag:python-specific tag:deprecated tag:internal
  1541. module _PY2_PROGRAM: _BASE_PY_PROGRAM {
  1542. SET(MODULE_LANG PY2)
  1543. # Looks like we cannot avoid copy-paste util ymake supports multiple inheritance
  1544. # We need to attach coverage.extractor to every py_program target, except pytest targets
  1545. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1546. }
  1547. # tag:python-specific tag:deprecated
  1548. ### @usage: PY2_PROGRAM([progname]) # deprecated
  1549. ###
  1550. ### Deprecated. Use PY3_PROGRAM instead.
  1551. ### Python 2.x binary program. Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  1552. ### If name is not specified it will be generated from the name of the containing project directory.
  1553. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  1554. ###
  1555. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1556. module PY2_PROGRAM: _PY2_PROGRAM {
  1557. .RESTRICTED=STYLE_PYTHON
  1558. when ($FAIL_PY2 == "yes") {
  1559. _OK=no
  1560. }
  1561. elsewhen ($OPENSOURCE != "yes") {
  1562. PEERDIR+=build/rules/py2_deprecation
  1563. }
  1564. ASSERT(_OK You are using deprecated Python2-only code (PY2_PROGRAM). Please consider rewriting to Python 3.)
  1565. }
  1566. # tag:python-specific
  1567. ### @usage: NO_EXTENDED_SOURCE_SEARCH()
  1568. ###
  1569. ### Prevent module using in extended python source search.
  1570. ### Use the macro if module contains python2-only files (or other python sources which shouldn't be imported by python3 interpreter)
  1571. ### which resides in the same directories with python 3 useful code. contrib/python/future is a example.
  1572. ### Anyway, preferred way is to move such files into separate dir and don't use this macro at all.
  1573. ###
  1574. ### Also see: https://docs.yandex-team.ru/ya-make/manual/python/vars#y_python_extended_source_search for details
  1575. macro NO_EXTENDED_SOURCE_SEARCH() {
  1576. SET(NO_EXTENDED_SOURCE_SEARCH yes)
  1577. }
  1578. # tag:python-specific
  1579. ### @usage: PY3_PROGRAM([progname])
  1580. ###
  1581. ### Python 3.x binary program. Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  1582. ### If name is not specified it will be generated from the name of the containing project directory.
  1583. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules.
  1584. ###
  1585. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1586. multimodule PY3_PROGRAM {
  1587. module PY3_BIN: PY3_PROGRAM_BIN {
  1588. .PEERDIRSELF=PY3_BIN_LIB
  1589. .IGNORED=RESOURCE RESOURCE_FILES PEERDIR TASKLET_REG
  1590. # Notify pybuild to skip almost all PY_SRCS arguments except MAIN
  1591. ENABLE(PROCESS_PY_MAIN_ONLY)
  1592. _PY_PROGRAM()
  1593. }
  1594. module PY3_BIN_LIB: PY3_LIBRARY {
  1595. .IGNORED=RESTRICT_LICENSES
  1596. # Notify pybuild to skip all python main function definitions
  1597. ENABLE(IGNORE_PY_MAIN)
  1598. _REQUIRE_EXPLICIT_LICENSE()
  1599. }
  1600. }
  1601. # tag:ycr-specific
  1602. macro _YCR_GENERATE_CONFIGS_INTL(Package, App, Configs...) {
  1603. .CMD=${tool:"maps/infra/yacare/scripts/make_configs"} $Package $App ${cwd:BINDIR} ${output;hide;pre=debian/$Package/:Configs}
  1604. }
  1605. # tag:ycr-specific
  1606. macro _YCR_GENERATE_CONFIGS(Package, App) {
  1607. .CMD=$_YCR_GENERATE_CONFIGS_INTL($Package $App ${pre=etc/yandex/maps/yacare/:App.conf} ${pre=etc/template_generator/templates/etc/logrotate.d/:App} ${pre=etc/nginx/sites-available/:App.conf} ${pre=etc/syslog-ng/conf-available/:App.conf} ${pre=etc/template_generator/config.d/:App.yaml} ${pre=/juggler/checks-available/yacare_;suf=/MANIFEST.json:App} ${pre=etc/yandex/maps/roquefort/:App.conf} ${pre=usr/lib/yandex/maps/yacare/lua/init_worker.d/rate_limiter_:App.lua} ${pre=usr/lib/yandex/maps/yacare/lua/init_worker.d/tvm_:App.lua} ${pre=usr/lib/yandex/maps/yacare/lua/init.d/tvm_:App.lua} ${pre=etc/supervisor/conf-available/:App.conf} ${pre=etc/template_generator/templates/etc/yandex/unified_agent/conf.d/04_yacare_:App.yml})
  1608. }
  1609. # tag:ycr-specific
  1610. when ($TIDY=="yes") {
  1611. YCR_LINK_EXE=$LINK_EXE
  1612. }
  1613. otherwise {
  1614. YCR_LINK_EXE=$LINK_EXE && $_YCR_GENERATE_CONFIGS($MODULE_PREFIX$REALPRJNAME $MODULE_PREFIX$REALPRJNAME)
  1615. }
  1616. # tag:ycr-specific
  1617. ### @usage: YCR_PROGRAM([progname])
  1618. ###
  1619. ### yacare-specific program module. Generates yacare configs in addition to producing the program.
  1620. ### If name is not specified it will be generated from the name of the containing project directory.
  1621. module YCR_PROGRAM: PROGRAM {
  1622. .CMD=YCR_LINK_EXE
  1623. }
  1624. # tag:ycr-specific tag:python-specific
  1625. macro _PYCR_GENERATE_CONFIGS_INTL(Package, App, Configs...) {
  1626. .CMD=${tool:"maps/infra/pycare/scripts/make_configs"} $Package $App ${cwd:BINDIR} ${output;hide;pre=configs/:Configs}
  1627. }
  1628. # tag:ycr-specific tag:python-specific
  1629. macro _PYCR_GENERATE_CONFIGS(Package, App) {
  1630. .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})
  1631. }
  1632. # tag:ycr-specific tag:python-specific
  1633. PYCR_LINK_EXE=$LINK_EXE && $_PYCR_GENERATE_CONFIGS($MODULE_PREFIX$REALPRJNAME $MODULE_PREFIX$REALPRJNAME)
  1634. # tag:ycr-specific tag:python-specific
  1635. ### @usage: PYCR_PROGRAM([progname])
  1636. ###
  1637. ### pycare-specific program module. Generates pycare configs in addition to producing the program.
  1638. ### If name is not specified it will be generated from the name of the containing project directory.
  1639. module PYCR_PROGRAM: PY3_PROGRAM_BIN {
  1640. .CMD=PYCR_LINK_EXE
  1641. }
  1642. ### @usage: EXPORTS_SCRIPT(exports_file)
  1643. ###
  1644. ### Specify exports script within PROGRAM, DLL and DLL-derived modules.
  1645. ### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
  1646. ### The other option use EXPORTS parameter of the DLL module itself.
  1647. ###
  1648. ### @see: [DLL](#module_DLL)
  1649. macro EXPORTS_SCRIPT(Arg) {
  1650. SET(EXPORTS_FILE $Arg)
  1651. }
  1652. ### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
  1653. ###
  1654. ### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
  1655. macro NO_EXPORT_DYNAMIC_SYMBOLS() {
  1656. ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
  1657. }
  1658. ### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
  1659. ###
  1660. ### Export all non-hidden symbols as dynamic when linking a PROGRAM.
  1661. macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
  1662. # Dummy: default behaviour
  1663. ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
  1664. }
  1665. ### @usage: USE_DYNAMIC_CUDA()
  1666. ###
  1667. ### Enable linking of PROGRAM with dynamic CUDA. By default CUDA uses static linking
  1668. macro USE_DYNAMIC_CUDA() {
  1669. LDFLAGS(-Wl,-rpath,$ORIGIN)
  1670. ENABLE(USE_DYNAMIC_CUDA)
  1671. }
  1672. ### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
  1673. ###
  1674. ### Specifies name of a script for custom link step. The scripts
  1675. ### should be placed in the build/scripts directory and are subject to
  1676. ### review by devtools@.
  1677. macro CUSTOM_LINK_STEP_SCRIPT(Name) {
  1678. SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
  1679. }
  1680. ### @usage: _BASE_UNITTEST # internal
  1681. ###
  1682. ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
  1683. module _BASE_UNITTEST: _BASE_PROGRAM {
  1684. .FINAL_TARGET=no
  1685. .NODE_TYPE=Program
  1686. .ALLOWED=YT_SPEC
  1687. when ($UT_SKIP_EXCEPTIONS == "yes") {
  1688. C_DEFINES+=-DUT_SKIP_EXCEPTIONS
  1689. }
  1690. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1691. }
  1692. UNITTEST_SEM=$CPP_PROGRAM_SEM && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME --print-before-suite --print-before-test --fork-tests --print-times --show-fails
  1693. # tag:test
  1694. ### @usage: UNITTEST([name])
  1695. ###
  1696. ### Unit test module based on library/cpp/testing/unittest.
  1697. ### It is recommended not to specify the name.
  1698. ###
  1699. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
  1700. module UNITTEST: _BASE_UNITTEST {
  1701. .SEM=UNITTEST_SEM
  1702. .DEFAULT_NAME_GENERATOR=FullPath
  1703. .ARGS_PARSER=Base
  1704. PEERDIR(library/cpp/testing/unittest_main)
  1705. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1706. SET(MODULE_LANG CPP)
  1707. }
  1708. # tag:yt-specific tag:test
  1709. ### @usage: YT_UNITTEST([name])
  1710. ###
  1711. ### YT Unit test module based on mapreduce/yt/library/utlib
  1712. module YT_UNITTEST: _BASE_UNITTEST {
  1713. PEERDIR(mapreduce/yt/library/utlib)
  1714. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1715. }
  1716. # tag:test
  1717. ### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
  1718. ###
  1719. ### Generic unit test module.
  1720. module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
  1721. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1722. }
  1723. # tag:cpp-specific tag:test
  1724. ### @usage: GTEST([name])
  1725. ###
  1726. ### Unit test module based on library/cpp/testing/gtest.
  1727. ### It is recommended not to specify the name.
  1728. ###
  1729. ### Documentation: https://docs.yandex-team.ru/arcadia-cpp/cpp_test
  1730. module GTEST: _BASE_UNITTEST {
  1731. .SEM=UNITTEST_SEM
  1732. .DEFAULT_NAME_GENERATOR=FullPath
  1733. .ARGS_PARSER=Base
  1734. PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
  1735. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
  1736. SET(MODULE_LANG CPP)
  1737. }
  1738. USE_AFL=no
  1739. # tag:fuzzing
  1740. ### @usage: FUZZ()
  1741. ###
  1742. ### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
  1743. ### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
  1744. ### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
  1745. ###
  1746. ### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
  1747. ###
  1748. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1749. module FUZZ: _BASE_PROGRAM {
  1750. .NODE_TYPE=Program
  1751. .FINAL_TARGET=no
  1752. .ALLOWED=FUZZ_DICTS FUZZ_OPTS
  1753. DEFAULT(LIBFUZZER_PATH contrib/libs/libfuzzer12)
  1754. when ($USE_AFL == "no") {
  1755. PEERDIR+=$LIBFUZZER_PATH
  1756. }
  1757. when ($USE_AFL == "yes") {
  1758. PEERDIR+=$LIBFUZZER_PATH/afl
  1759. }
  1760. when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
  1761. PEERDIR+=devtools/nofuzz
  1762. }
  1763. ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
  1764. }
  1765. # tag:ios-specific
  1766. PACK_IOS_CMD=
  1767. when ($OS_IOS && $BUILD_IOS_APP) {
  1768. PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
  1769. }
  1770. LINK_BOOSTTEST_CMD=
  1771. BOOST_TEST_TYPE_STRING=
  1772. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1773. LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
  1774. BOOST_TEST_TYPE_STRING=no.test
  1775. }
  1776. otherwise {
  1777. LINK_BOOSTTEST_CMD=$LINK_EXE
  1778. BOOST_TEST_TYPE_STRING=boost.test
  1779. }
  1780. # tag:deprecated
  1781. ### @usage: BOOSTTEST([name]) #deprecated
  1782. ###
  1783. ### Test module based on boost/test/unit_test.hpp.
  1784. ### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
  1785. ### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
  1786. module BOOSTTEST: _BASE_PROGRAM {
  1787. .NODE_TYPE=Program
  1788. .FINAL_TARGET=no
  1789. .CMD=LINK_BOOSTTEST_CMD
  1790. PEERDIR(library/cpp/testing/boost_test)
  1791. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1792. MODULE_SUFFIX=.a
  1793. }
  1794. elsewhen ($OS_IOS && $BUILD_IOS_APP) {
  1795. PEERDIR+=devtools/boosttest_ios_wrapper/library
  1796. MODULE_SUFFIX=.ios.tar
  1797. }
  1798. ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
  1799. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1800. }
  1801. # tag:deprecated
  1802. ### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated
  1803. ###
  1804. ### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
  1805. module BOOSTTEST_WITH_MAIN: BOOSTTEST {
  1806. PEERDIR(library/cpp/testing/boost_test_main)
  1807. }
  1808. FUZZ_DICTS_VALUE=
  1809. ### @usage: FUZZ_DICTS(path1 [path2...])
  1810. ###
  1811. ### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
  1812. ### Libfuzzer and AFL use a single syntax for dictionary descriptions.
  1813. ### Should only be used in FUZZ modules.
  1814. ###
  1815. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1816. macro FUZZ_DICTS(Data...) {
  1817. SET_APPEND(FUZZ_DICTS_VALUE $Data)
  1818. }
  1819. FUZZ_OPTS_VALUE=
  1820. ### @usage: FUZZ_OPTS(opt1 [Opt2...])
  1821. ###
  1822. ### Overrides or adds options to the corpus mining and fuzzer run.
  1823. ### Currently supported only Libfuzzer, so you should use the options for it.
  1824. ### Should only be used in FUZZ modules.
  1825. ###
  1826. ### @example:
  1827. ###
  1828. ### FUZZ_OPTS (
  1829. ### -max_len=1024
  1830. ### -rss_limit_mb=8192
  1831. ### )
  1832. ###
  1833. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1834. macro FUZZ_OPTS(Data...) {
  1835. SET_APPEND(FUZZ_OPTS_VALUE $Data)
  1836. }
  1837. # tag:yt-specific tag:test
  1838. TEST_YT_SPEC_VALUE=
  1839. ### @usage: YT_SPEC(path1 [path2...])
  1840. ###
  1841. ### Allows you to specify json-files with YT task and operation specs,
  1842. ### which will be used to run test node in the YT.
  1843. ### Test must be marked with ya:yt tag.
  1844. ### Files must be relative to the root of Arcadia.
  1845. ###
  1846. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1847. macro YT_SPEC(Data...) {
  1848. SET_APPEND(TEST_YT_SPEC_VALUE $Data)
  1849. }
  1850. # tag:test
  1851. TEST_SRCS_VALUE=
  1852. ### @usage: TEST_SRCS(Files...)
  1853. ###
  1854. ### 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.
  1855. ###
  1856. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1857. macro TEST_SRCS(Tests...) {
  1858. SET_APPEND(TEST_SRCS_VALUE $Tests)
  1859. }
  1860. macro DISABLE_DATA_VALIDATION() {
  1861. DISABLE(VALIDATE_DATA)
  1862. }
  1863. # tag:test
  1864. TEST_DATA_VALUE=
  1865. ### @usage: DATA([path...])
  1866. ###
  1867. ### Specifies the path to the data necessary test.
  1868. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
  1869. ### In the latter case resource will be brought to the working directory of the test before it is started
  1870. ###
  1871. ### Used only inside TEST modules.
  1872. ###
  1873. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1874. macro DATA(Data...) {
  1875. SET_APPEND(TEST_DATA_VALUE $Data)
  1876. ADD_CHECK(check.data $Data)
  1877. }
  1878. # tag:test
  1879. TEST_TAGS_VALUE=
  1880. ### @usage: TAG ([tag...])
  1881. ###
  1882. ### Each test can have one or more tags used to filter tests list for running.
  1883. ### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
  1884. ###
  1885. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
  1886. macro TAG(Tags...) {
  1887. SET_APPEND(TEST_TAGS_VALUE $Tags)
  1888. }
  1889. # tag:test
  1890. TEST_REQUIREMENTS_VALUE=
  1891. ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
  1892. ###
  1893. ### Allows you to specify the requirements of the test.
  1894. ###
  1895. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1896. macro REQUIREMENTS(Tags...) {
  1897. SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
  1898. }
  1899. # tag:test
  1900. TEST_ENV_VALUE=
  1901. ### @usage: ENV(key[=value])
  1902. ###
  1903. ### Sets env variable key to value (gets value from system env by default).
  1904. macro ENV(Data...) {
  1905. SET_APPEND(TEST_ENV_VALUE ${quo:Data})
  1906. }
  1907. ### @usage: CONFTEST_LOAD_POLICY_LOCAL()
  1908. ###
  1909. ### Loads conftest.py files in a way that pytest does it
  1910. macro CONFTEST_LOAD_POLICY_LOCAL() {
  1911. SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
  1912. }
  1913. # tag:test
  1914. TEST_RECIPES_VALUE=
  1915. ### @usage: USE_RECIPE(path [arg1 arg2...])
  1916. ###
  1917. ### Provides prepared environment via recipe for test.
  1918. ###
  1919. ### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
  1920. macro USE_RECIPE(Data...) {
  1921. SET_APPEND(TEST_RECIPES_VALUE $Data)
  1922. SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
  1923. }
  1924. # tag:python-specific tag:test
  1925. TEST_PYTHON_PATH_VALUE=
  1926. # tag:python-specific tag:test
  1927. ### @usage: PYTHON_PATH(Path)
  1928. ###
  1929. ### Set path to Python that will be used to runs scripts in tests
  1930. macro PYTHON_PATH(Path) {
  1931. SET(TEST_PYTHON_PATH_VALUE $Path)
  1932. }
  1933. # tag:test
  1934. SKIP_TEST_VALUE=
  1935. ### @usage: SKIP_TEST(Reason)
  1936. ###
  1937. ### Skip the suite defined by test module. Provide a reason to be output in test execution report.
  1938. macro SKIP_TEST(Reason...) {
  1939. SET(SKIP_TEST_VALUE $Reason)
  1940. }
  1941. # tag:test
  1942. LINT_LEVEL_VALUE=extended
  1943. ### @usage: NO_LINT()
  1944. ###
  1945. ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
  1946. macro NO_LINT() {
  1947. SET(LINT_LEVEL_VALUE none)
  1948. }
  1949. ### @usage: LINT(<none|base|strict>)
  1950. ###
  1951. ### Set linting levem for sources of the module
  1952. macro LINT(level) {
  1953. SET(LINT_LEVEL_VALUE $level)
  1954. }
  1955. # tag:python-specific tag:test
  1956. STYLE_PYTHON_VALUE=no
  1957. ### @usage: STYLE_PYTHON()
  1958. ###
  1959. ### Check python3 sources for style issues using black.
  1960. macro STYLE_PYTHON() {
  1961. SET(STYLE_PYTHON_VALUE yes)
  1962. }
  1963. # tag:python-specific tag:test
  1964. ### @usage: NO_DOCTESTS()
  1965. ###
  1966. ### Disable doctests in PY[|3|23_]TEST
  1967. macro NO_DOCTESTS() {
  1968. ENV(YA_PYTEST_DISABLE_DOCTEST="yes")
  1969. }
  1970. # tag:python-specific tag:test
  1971. ### @usage: _BASE_PYTEST # internal
  1972. ###
  1973. ### Base logic of Python 2.x py.test modules: common module properties and dependencies.
  1974. module _BASE_PYTEST: _BASE_PY_PROGRAM {
  1975. .NODE_TYPE=Program
  1976. .FINAL_TARGET=no
  1977. .ALLOWED=YT_SPEC NO_DOCTESTS
  1978. when ($USE_ARCADIA_PYTHON == "yes") {
  1979. PEERDIR+=library/python/pytest
  1980. }
  1981. when ($USE_ARCADIA_PYTHON == "no") {
  1982. MODULE_SUFFIX=.pkg.fake
  1983. PEERDIR+=library/python/pytest/empty
  1984. }
  1985. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1986. }
  1987. # tag:python-specific tag:deprecated tag:test
  1988. ### @usage: PYTEST_BIN() #deprecated
  1989. ###
  1990. ### Same as PY2TEST. Don't use this, use PY2TEST instead.
  1991. module PYTEST_BIN: _BASE_PYTEST {
  1992. .NODE_TYPE=Program
  1993. .DEFAULT_NAME_GENERATOR=FullPath
  1994. .ARGS_PARSER=Base
  1995. SETUP_PYTEST_BIN()
  1996. }
  1997. # tag:python-specific tag:test
  1998. ### @usage: PY2TEST([name])
  1999. ###
  2000. ### The test module for Python 2.x based on py.test
  2001. ###
  2002. ### This module is compatible only with PYTHON2-tagged modules and selects peers from multimodules accordingly.
  2003. ### This module is compatible with non-Arcadia Python builds.
  2004. ###
  2005. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#python
  2006. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2007. module PY2TEST: PYTEST_BIN {
  2008. .RESTRICTED=STYLE_PYTHON
  2009. .DEFAULT_NAME_GENERATOR=FullPath
  2010. .ARGS_PARSER=Base
  2011. when ($FAIL_PY2 == "yes") {
  2012. _OK=no
  2013. }
  2014. elsewhen ($OPENSOURCE != "yes") {
  2015. PEERDIR+=build/rules/py2_deprecation
  2016. }
  2017. SET(MODULE_LANG PY2)
  2018. ASSERT(_OK You are using deprecated Python2-only code (PY2TEST). Please consider rewriting to Python 3.)
  2019. }
  2020. # tag:python-specific tag:deprecated tag:test
  2021. ### @usage: PY3TEST_BIN() #deprecated
  2022. ###
  2023. ### Same as PY3TEST. Don't use this, use PY3TEST instead.
  2024. module PY3TEST_BIN: _BASE_PY3_PROGRAM {
  2025. .NODE_TYPE=Program
  2026. .FINAL_TARGET=no
  2027. .ALLOWED=YT_SPEC NO_DOCTESTS
  2028. .DEFAULT_NAME_GENERATOR=FullPath
  2029. .ARGS_PARSER=Base
  2030. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2031. SET(MODULE_LANG PY3)
  2032. SETUP_PYTEST_BIN()
  2033. PEERDIR+=library/python/pytest
  2034. }
  2035. # tag:python-specific tag:test
  2036. ### Disable submodules with the specified name(s).
  2037. ### Unlike EXCLUDE_TAGS this variable:
  2038. ### - affects all projects in the build;
  2039. ### - filter by module name and ignore MODULE_TAG.
  2040. EXCLUDE_SUBMODULES=PY3TEST_LIBRARY
  2041. # tag:python-specific tag:test
  2042. ### @usage: PY3TEST([name])
  2043. ###
  2044. ### The test module for Python 3.x based on py.test
  2045. ###
  2046. ### This module is compatible only with PYTHON3-tagged modules and selects peers from multimodules accordingly.
  2047. ### This module is only compatible with Arcadia Python build (to avoid tests duplication from Python2/3-tests). For non-Arcadia python use PYTEST.
  2048. ###
  2049. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  2050. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2051. multimodule PY3TEST {
  2052. module PY3TEST_PROGRAM: PY3TEST_BIN {
  2053. .FINAL_TARGET=yes
  2054. }
  2055. module PY3TEST_LIBRARY: PY3_LIBRARY {
  2056. PEERDIR+=library/python/pytest
  2057. _REQUIRE_EXPLICIT_LICENSE()
  2058. }
  2059. }
  2060. # tag:cpp-specific tag:test
  2061. module CPP_STYLE_TEST: PY3TEST_BIN {
  2062. DEPENDS(contrib/libs/clang12/tools/clang-format)
  2063. PEERDIR+=library/python/cpp_test
  2064. }
  2065. macro STYLE(Globs...) {
  2066. _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
  2067. _STYLE(${STYLE_SRCS_GLOB})
  2068. }
  2069. # tag:cpp-specific tag:deprecated tag:test
  2070. ### @usage: GTEST_UGLY([name])
  2071. ###
  2072. ### Deprecated, do not use in new projects. Use GTEST instead.
  2073. ###
  2074. ### The test module based on gtest (contrib/libs/gtest contrib/libs/gmock).
  2075. ### Use public documentation on gtest for details.
  2076. ###
  2077. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2078. module GTEST_UGLY: _BASE_PROGRAM {
  2079. .NODE_TYPE=Program
  2080. .FINAL_TARGET=no
  2081. PEERDIR(contrib/restricted/googletest/googlemock contrib/restricted/googletest/googletest)
  2082. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gtest)
  2083. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2084. }
  2085. # tag:test
  2086. ### @usage: EXECTEST()
  2087. ###
  2088. ### Module definition of generic test that executes a binary.
  2089. ### Use macro RUN to specify binary to run.
  2090. ###
  2091. ### @example:
  2092. ###
  2093. ### EXECTEST()
  2094. ### OWNER(g:yatool)
  2095. ###
  2096. ### RUN(
  2097. ### cat input.txt
  2098. ### )
  2099. ### DATA(
  2100. ### arcadia/devtools/ya/test/tests/exectest/data
  2101. ### )
  2102. ### DEPENDS(
  2103. ### devtools/dummy_arcadia/cat
  2104. ### )
  2105. ### TEST_CWD(devtools/ya/test/tests/exectest/data)
  2106. ### END()
  2107. ###
  2108. ### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
  2109. ###
  2110. ### @see: [RUN()](#macro_RUN)
  2111. module EXECTEST: _BARE_UNIT {
  2112. .NODE_TYPE=Program
  2113. .FINAL_TARGET=no
  2114. .ALLOWED=YT_SPEC
  2115. .RESTRICTED=FORK_TEST_FILES
  2116. .DEFAULT_NAME_GENERATOR=FullPath
  2117. .ARGS_PARSER=Base
  2118. SET(MODULE_SUFFIX .pkg.fake)
  2119. SETUP_EXECTEST()
  2120. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2121. }
  2122. # tag:cpp-specific tag:test
  2123. ### @usage: Y_BENCHMARK([benchmarkname])
  2124. ###
  2125. ### Benchmark test based on the library/cpp/testing/benchmark.
  2126. ###
  2127. ### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
  2128. module Y_BENCHMARK: PROGRAM {
  2129. .SEM=CPP_PROGRAM_SEM
  2130. PEERDIR(library/cpp/testing/benchmark/main)
  2131. SET(MODULE_LANG CPP)
  2132. }
  2133. # tag:cpp-specific tag:test
  2134. ### @usage: G_BENCHMARK([benchmarkname])
  2135. ###
  2136. ### Benchmark test based on the google benchmark.
  2137. ###
  2138. ### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
  2139. module G_BENCHMARK: _BASE_PROGRAM {
  2140. PEERDIR(library/cpp/testing/gbenchmark_main)
  2141. ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
  2142. SET(MODULE_LANG CPP)
  2143. }
  2144. # tag:test
  2145. TEST_ROOT=$(TESTS_DATA_ROOT)
  2146. RESULT_MAX_FILE=0
  2147. STRIP_FILES=--dont-strip-files
  2148. VERIFY_RESULTS=--verify-results
  2149. ADDITIONAL_PATH=
  2150. # set for tests variables to fill it by YA_DEV or YA
  2151. YA_ROOT=ya
  2152. when ($YA_DEV == "yes") {
  2153. YA_ROOT=ya-dev
  2154. }
  2155. # tag:test
  2156. ### @usage: UNITTEST_FOR(path/to/lib)
  2157. ###
  2158. ### Convenience extension of UNITTEST module.
  2159. ### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
  2160. ### path/to/lib is the path to the directory with the LIBRARY project.
  2161. ###
  2162. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2163. module UNITTEST_FOR: UNITTEST {
  2164. .SEM=UNITTEST_SEM
  2165. PEERDIR(ADDINCL $UNITTEST_DIR)
  2166. SRCDIR($UNITTEST_DIR)
  2167. }
  2168. ### @usage: _LIBRARY # internal
  2169. ###
  2170. ### Base module definition for all libraries.
  2171. ### Contains basic logic like module properties, default variable values etc.
  2172. ### All libraries similar to C++-libraries should be inherited from it.
  2173. module _LIBRARY: _BASE_UNIT {
  2174. .CMD=LINK_LIB
  2175. .NODE_TYPE=Library
  2176. .PEERDIR_POLICY=as_include
  2177. .EXTS=.o .obj .a .mf .supp .tidyjson .ld
  2178. .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  2179. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2180. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
  2181. .FINAL_TARGET=no
  2182. .GLOBAL_CMD=GLOBAL_LINK_LIB
  2183. .GLOBAL_EXTS=.o .obj .tidyjson
  2184. GLOBAL_SUFFIX=.global$MODULE_SUFFIX
  2185. #TODO: Remove this hack (really we do not need add fake src at all)
  2186. ENABLE(NEED_ADD_FAKE_SRC)
  2187. _REQUIRE_EXPLICIT_LICENSE(contrib/deprecated contrib/libs contrib/restricted contrib/python)
  2188. CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
  2189. when ($USE_MKL == "yes") {
  2190. NOPLATFORM=yes
  2191. }
  2192. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2193. MODULE_PREFIX=
  2194. MODULE_SUFFIX=.lib
  2195. }
  2196. otherwise {
  2197. when ($TIDY == "yes") {
  2198. MODULE_PREFIX=
  2199. MODULE_SUFFIX=.tidyjson
  2200. }
  2201. otherwise {
  2202. MODULE_PREFIX=lib
  2203. MODULE_SUFFIX=.a
  2204. }
  2205. }
  2206. when ($WERROR != "no") {
  2207. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  2208. C_WARNING_OPTS += $WERROR_FLAG
  2209. }
  2210. }
  2211. when ($WITH_VALGRIND == "yes") {
  2212. PEERDIR+=contrib/libs/valgrind
  2213. }
  2214. when ($USE_ARCADIA_LIBM == "yes") {
  2215. PEERDIR+=contrib/libs/libm
  2216. }
  2217. }
  2218. CPP_LIBRARY_SEM=add_library ${MODDIR} $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  2219. && library_fake_marker FAKE_MODULE ${FAKE_MODULE} \
  2220. && consumer_link_library PUBLIC $CMAKE_LINK_TARGET \
  2221. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2222. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2223. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2224. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  2225. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW \
  2226. && add_language C && add_language CXX
  2227. CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:CMAKE_TARGET_NAME} $CMAKE_TARGET_NAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
  2228. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2229. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2230. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2231. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  2232. CMAKE_FIND_PKG=
  2233. CMAKE_LINK_TARGET=$REALPRJNAME
  2234. CMAKE_FIND_PKG_COMP=
  2235. CONAN_REQUIRE=
  2236. ### @usage: LIBRARY()
  2237. ###
  2238. ### The regular static library module.
  2239. ###
  2240. ### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
  2241. ### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
  2242. ###
  2243. ### This is C++ library, and it selects peers from multimodules accordingly.
  2244. ###
  2245. ### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
  2246. ### In order to use library in tests PEERDIR it to link into tests.
  2247. ### If you think you need to distribute static library please contact devtools@ for assistance.
  2248. module LIBRARY: _LIBRARY {
  2249. .GLOBAL=_AARS _PROGUARD_RULES
  2250. .SEM=CPP_LIBRARY_SEM
  2251. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  2252. .DEFAULT_NAME_GENERATOR=ThreeDirNames
  2253. .ARGS_PARSER=Base
  2254. when ($CMAKE_PACKAGE_COMPONENT != "") {
  2255. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  2256. }
  2257. when ($CMAKE_PACKAGE != "") {
  2258. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  2259. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && consumer_link_library PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2260. }
  2261. when ($CONAN_REFERENCE != "") {
  2262. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  2263. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && consumer_link_library PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2264. }
  2265. when ($CONAN_PKG_OPTS != "") {
  2266. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  2267. }
  2268. when ($OPENSOURCE_EXPORT == "no") {
  2269. CPP_LIBRARY_SEM=IGNORED
  2270. }
  2271. when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
  2272. PEERDIR+=$CPP_PROTOBUF_PEERS
  2273. }
  2274. SET(MODULE_TYPE LIBRARY)
  2275. SET(MODULE_LANG CPP)
  2276. ADD_CLANG_TIDY()
  2277. }
  2278. # tag:internal
  2279. ### @usage: _BARE_MODULE() # internal
  2280. ###
  2281. ### Remove unwanted dependencies for "empty" library module
  2282. macro _BARE_MODULE() {
  2283. SET(NEED_PLATFORM_PEERDIRS no)
  2284. SET(PEERDIR_TEST_TOOL no)
  2285. DISABLE(WITH_VALGRIND)
  2286. NO_CODENAVIGATION()
  2287. NO_PLATFORM()
  2288. NO_RUNTIME()
  2289. NO_UTIL()
  2290. NO_CLANG_TIDY()
  2291. }
  2292. # tag:internal
  2293. ### @usage: _BARE_LINK_MODULE() # internal
  2294. ###
  2295. ### Remove unwanted dependencies for "empty" link module
  2296. macro _BARE_LINK_MODULE() {
  2297. _BARE_MODULE()
  2298. ALLOCATOR(FAKE)
  2299. }
  2300. # tag:internal
  2301. ### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
  2302. ###
  2303. ### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
  2304. ### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
  2305. macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
  2306. SRCS($USE_CONDITIONAL_SRCS)
  2307. }
  2308. # XXX: dirty hack for correct LDFLAGS passing
  2309. RESOURCES_LIBRARY_LINK=$TOUCH_UNIT ${hide:LDFLAGS_GLOBAL} ${hide:LDFLAGS}
  2310. RESOURCES_LIBRARY_SEM=IGNORED
  2311. ### @usage: RESOURCES_LIBRARY()
  2312. ###
  2313. ### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
  2314. ### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
  2315. ###
  2316. ### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
  2317. module RESOURCES_LIBRARY: _BARE_UNIT {
  2318. .CMD=RESOURCES_LIBRARY_LINK
  2319. .SEM=RESOURCES_LIBRARY_SEM
  2320. .ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
  2321. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS PEERDIR SPLIT_DWARF
  2322. .NODE_TYPE=Library
  2323. .PEERDIR_POLICY=as_include
  2324. .EXTS=.o .obj .a .mf .supp .tidyjson .ld
  2325. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2326. MODULE_SUFFIX=.pkg.fake
  2327. ENABLE(NEED_ADD_FAKE_SRC)
  2328. WITHOUT_LICENSE_TEXTS()
  2329. }
  2330. FAT_OBJECT_ARGS=
  2331. FAT_OBJECT_OUTS=
  2332. macro _FAT_OBJECT_ARGS_BASE(Flag, Lib) {
  2333. .CMD=$Flag=$Lib
  2334. }
  2335. macro PACK_GLOBALS_IN_LIBRARY() {
  2336. SET_APPEND(FAT_OBJECT_ARGS $_FAT_OBJECT_ARGS_BASE(--globals-lib, ${BINDIR}/${pre=$MODULE_PREFIX:REALPRJNAME.globals.a}))
  2337. SET_APPEND(FAT_OBJECT_OUTS \${output;hide;noauto;norel;nopath;noext;pre=$MODULE_PREFIX;suf=$BINDIR:REALPRJNAME.globals.a})
  2338. }
  2339. when ($OS_ANDROID != "yes") {
  2340. LINK_FAT_OBJECT_CMD=$LINK_FAT_OBJECT
  2341. }
  2342. otherwise {
  2343. LINK_FAT_OBJECT_CMD=$LINK_FAT_OBJECT_LIBRARY
  2344. }
  2345. FAT_OBJECT_SEM=add_fat_object ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  2346. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2347. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2348. && set_global_flags FAT_OBJECT_PREFIX ${MODULE_PREFIX} \
  2349. && set_global_flags FAT_OBJECT_SUFFIX ${MODULE_SUFFIX}
  2350. ### Do not turn visibility=hidden symbos into static symbos of partially linked object file
  2351. ###
  2352. ### Note: This variable do not have any effect on platforms other than MacOS and iOS.
  2353. KEEP_FAT_OBJECT_SYMBOLS=no
  2354. ### @usage: FAT_OBJECT()
  2355. ###
  2356. ### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2357. ### static libraries, local (from own SRCS) and global (from peers') object files.
  2358. ###
  2359. ### Designed for use in XCode projects for iOS.
  2360. module FAT_OBJECT: LIBRARY {
  2361. .ALLOWED=PACK_GLOBALS_IN_LIBRARY
  2362. .CMD=LINK_FAT_OBJECT_CMD
  2363. .SEM=FAT_OBJECT_SEM
  2364. .PEERDIR_POLICY=as_build_from
  2365. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2366. MODULE_SUFFIX=.global.lib
  2367. }
  2368. elsewhen ($OS_ANDROID == "yes") {
  2369. MODULE_SUFFIX=.a
  2370. }
  2371. otherwise {
  2372. MODULE_SUFFIX=.o
  2373. }
  2374. when (($OS_DARWIN == "yes" || $OS_IOS == "yes") && $KEEP_FAT_OBJECT_SYMBOLS == "yes") {
  2375. LDFLAGS_GLOBAL += -keep_private_externs
  2376. }
  2377. _USE_LINKER()
  2378. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2379. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2380. DISABLE(NEED_ADD_FAKE_SRC)
  2381. SRCS(build/scripts/_fake_src.cpp)
  2382. }
  2383. ### @usage: RECURSIVE_LIBRARY()
  2384. ###
  2385. ### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2386. ### from static libraries, local (from own SRCS) and global (from peers') object files.
  2387. ###
  2388. ### Designed for use in XCode projects for iOS.
  2389. module RECURSIVE_LIBRARY: LIBRARY {
  2390. .CMD=LINK_RECURSIVE_LIBRARY
  2391. .PEERDIR_POLICY=as_build_from
  2392. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2393. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2394. DISABLE(NEED_ADD_FAKE_SRC)
  2395. SRCS(build/scripts/_fake_src.cpp)
  2396. }
  2397. _SONAME=
  2398. _EXPORT_SCRIPT_SEM=
  2399. macro _ADD_DYNLYB_SEM(Libname) {
  2400. .SEM=add_library ${MODDIR} ${Libname} SHARED ${hide:TARGET} ${hide:AUTO_INPUT} && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && target_include_directories PRIVATE $_C__INCLUDE_OWNED && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && vcs_info $_EXPORT_SCRIPT_SEM
  2401. }
  2402. CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES
  2403. ### @usage: DLL_UNIT # internal
  2404. ###
  2405. ### Base module for all dynamically linked libraries as final artifacts.
  2406. ### Contains all general logic for such kind of modules. Supports versioning and export files.
  2407. ### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
  2408. module DLL_UNIT: _LINK_UNIT {
  2409. .CMD=LINK_DYN_LIB
  2410. .SEM=CPP_DYN_LIBRARY_SEM
  2411. .NODE_TYPE=Library
  2412. .SYMLINK_POLICY=SO
  2413. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2414. .ALLOWED=WHOLE_ARCHIVE
  2415. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2416. .ARGS_PARSER=DLL
  2417. DYNAMIC_LINK=yes
  2418. ALLOCATOR(FAKE)
  2419. SET(MODULE_TYPE DLL)
  2420. SET(MODULE_TAG DLL)
  2421. SET(MODULE_LANG CPP)
  2422. ADD_CLANG_TIDY()
  2423. when ($EXPORTS_FILE) {
  2424. _EXPORT_SCRIPT_SEM=&& use_export_script ${input:EXPORTS_FILE}
  2425. }
  2426. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2427. MODULE_SUFFIX=.dll
  2428. }
  2429. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2430. MODULE_PREFIX=lib
  2431. MODULE_SUFFIX=.dylib
  2432. }
  2433. elsewhen ($TIDY == "yes") {
  2434. MODULE_PREFIX=
  2435. MODULE_SUFFIX=.tidyjson
  2436. }
  2437. otherwise {
  2438. MODULE_PREFIX=lib
  2439. MODULE_SUFFIX=.so
  2440. }
  2441. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2442. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2443. when ($MODULE_VERSION) {
  2444. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2445. }
  2446. _SONAME=$SONAME$MODULE_VERSION
  2447. when ($LINUX == "yes") {
  2448. # '-z notext' is needed for linking mkl into shared libraries
  2449. LDFLAGS += -Wl,-z,notext
  2450. when ($_NO_FIX_ELF != "yes") {
  2451. LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
  2452. }
  2453. }
  2454. when ($DARWIN == "yes") {
  2455. LDFLAGS += -undefined dynamic_lookup
  2456. }
  2457. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  2458. PEERDIR+=library/cpp/testing/dump_clang_coverage
  2459. }
  2460. when ($IDE_MSVS == "yes") {
  2461. PEERDIR+=build/scripts/c_templates
  2462. }
  2463. }
  2464. # tag:python-specific
  2465. ### @usage: PY_ANY_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2466. ###
  2467. ### The Python external module for any versio of Arcadia or system Python.
  2468. ### 1. major_ver and minor_ver must be integers.
  2469. ### 2. The resulting .so will have the prefix "lib".
  2470. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2471. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2472. ###
  2473. ### Note: Use PYTHON2_MODULE()/PYTHON3_MODULE() in order to PEERDIR proper version of PY23_NATIVE_LIBRARY.
  2474. ### Do not PEERDIR any PY*_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2475. ###
  2476. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2477. module PY_ANY_MODULE: DLL_UNIT {
  2478. .SEM=CPP_DYN_LIBRARY_SEM
  2479. when ($MSVC != "yes" && $DARWIN != "yes") {
  2480. LDFLAGS+= -Wl,-Bsymbolic
  2481. }
  2482. when ($USE_ARCADIA_PYTHON == "no") {
  2483. when ($USE_SYSTEM_PYTHON) {
  2484. PEERDIR+=build/platform/python
  2485. }
  2486. otherwise {
  2487. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2488. LDFLAGS+=$PYTHON_LIBRARIES
  2489. }
  2490. }
  2491. }
  2492. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2493. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2494. when ($MODULE_VERSION) {
  2495. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2496. }
  2497. _SONAME=$SONAME$MODULE_VERSION
  2498. # -bundle
  2499. when ($DARWIN == "yes") {
  2500. LDFLAGS+=-flat_namespace
  2501. }
  2502. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2503. MODULE_PREFIX=
  2504. MODULE_SUFFIX=.pyd
  2505. }
  2506. otherwise {
  2507. MODULE_PREFIX=
  2508. MODULE_SUFFIX=.so
  2509. }
  2510. .RESTRICTED=USE_PYTHON2 USE_PYTHON3 PY_SRCS PY_MAIN
  2511. }
  2512. # tag:python-specific
  2513. ### @usage: PY2MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2514. ###
  2515. ### The Python external module for Python2 and any system Python
  2516. ### 1. major_ver and minor_ver must be integers.
  2517. ### 2. The resulting .so will have the prefix "lib".
  2518. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2519. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2520. ###
  2521. ### Note: this module will always PEERDIR Python2 version of PY23_NATIVE_LIBRARY.
  2522. ### Do not PEERDIR PY2_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2523. ###
  2524. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2525. module PY2MODULE: PY_ANY_MODULE {
  2526. PYTHON2_MODULE()
  2527. SET(MODULE_LANG PY2)
  2528. .RESTRICTED=PYTHON3_MODULE PYTHON3_ADDINCL
  2529. }
  2530. # tag:python-specific
  2531. ### @usage: PY3MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2532. ###
  2533. ### The Python external module for Python3 and any system Python
  2534. ### 1. major_ver and minor_ver must be integers.
  2535. ### 2. The resulting .so will have the prefix "lib".
  2536. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2537. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2538. ###
  2539. ### Note: this module will always PEERDIR Python3 version of PY23_NATIVE_LIBRARY.
  2540. ### Do not PEERDIR PY3_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2541. ###
  2542. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2543. module PY3MODULE: PY_ANY_MODULE {
  2544. PYTHON3_MODULE()
  2545. SET(MODULE_LANG PY3)
  2546. .RESTRICTED=PYTHON2_MODULE PYTHON2_ADDINCL
  2547. }
  2548. # tag:python-specific
  2549. ### @usage: PYTHON2_MODULE()
  2550. ###
  2551. ### Use in PY_ANY_MODULE to set it up for Python 2.x.
  2552. macro PYTHON2_MODULE() {
  2553. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2554. PEERDIR+=contrib/tools/python/lib
  2555. }
  2556. PYTHON2_ADDINCL()
  2557. }
  2558. # tag:python-specific
  2559. ### @usage: PYTHON3_MODULE()
  2560. ###
  2561. ### Use in PY_ANY_MODULE to set it up for Python 3.x.
  2562. macro PYTHON3_MODULE() {
  2563. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2564. PEERDIR+=contrib/tools/python3/lib
  2565. }
  2566. PYTHON3_ADDINCL()
  2567. }
  2568. # tag:r-specific
  2569. ### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2570. ###
  2571. ### The external module for R language.
  2572. ### 1. major_ver and minor_ver must be integers.
  2573. ### 2. The resulting .so will have the prefix "lib".
  2574. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2575. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2576. module R_MODULE: DLL_UNIT {
  2577. .SEM=CPP_DYN_LIBRARY_SEM
  2578. when ($DARWIN == "yes") {
  2579. LDFLAGS+=-flat_namespace -dynamiclib
  2580. }
  2581. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2582. MODULE_PREFIX=lib
  2583. MODULE_SUFFIX=.dll
  2584. }
  2585. ADDINCL(contrib/libs/r-lang)
  2586. }
  2587. ### @usage: DYNAMIC_LIBRARY_FROM(Paths)
  2588. ###
  2589. ### Use specified libraries as sources of DLL
  2590. macro DYNAMIC_LIBRARY_FROM(Path...) {
  2591. PEERDIR($Path)
  2592. WHOLE_ARCHIVE($Path)
  2593. }
  2594. ### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2595. ###
  2596. ### Dynamic library module definition.
  2597. ### 1. major_ver and minor_ver must be integers.
  2598. ### 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
  2599. ### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
  2600. ###
  2601. ### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
  2602. module DLL: DLL_UNIT {
  2603. .SEM=CPP_DYN_LIBRARY_SEM
  2604. SET(MAKE_ONLY_SHARED_LIB yes)
  2605. SET(MODULE_LANG CPP)
  2606. when ($OS_WINDOWS) {
  2607. MODULE_SUFFIX=.dll
  2608. }
  2609. # TODO: Make it possible to use this syntax
  2610. # DEFAULT(DLL_FOR_DIR no)
  2611. ### FIXME: XXX
  2612. ###when ($DLL_FOR_DIR != "no") {
  2613. ### SRCDIR($DLL_FOR_DIR)
  2614. ### ADDINCL($DLL_FOR_DIR)
  2615. ###}
  2616. }
  2617. ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
  2618. module DLL_TOOL: DLL {
  2619. .SEM=CPP_DYN_LIBRARY_SEM
  2620. # ymake resolves only program nodes as tools.
  2621. .NODE_TYPE=Program
  2622. }
  2623. ### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2624. ###
  2625. ### Executable dynamic library module definition.
  2626. ### 1. major_ver and minor_ver must be integers.
  2627. ### 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
  2628. ### 3. PREFIX allows you to change the prefix of the output file.
  2629. module SO_PROGRAM: DLL {
  2630. .CMD=LINK_EXEC_DYN_LIB
  2631. SET(MODULE_TYPE PROGRAM)
  2632. MODULE_PREFIX=
  2633. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2634. MODULE_SUFFIX=.exe
  2635. }
  2636. otherwise {
  2637. MODULE_SUFFIX=
  2638. }
  2639. }
  2640. DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
  2641. # tag:internal
  2642. ### @usage: DEV_DLL_PROXY() # internal
  2643. ###
  2644. ### The use of this module is strictly prohibited!!!
  2645. ### This is a temporary and project-specific solution.
  2646. module DEV_DLL_PROXY: _BARE_UNIT {
  2647. .NODE_TYPE=Library
  2648. .EXTS=.so .dll .dylib .mf
  2649. .CMD=DLL_PROXY_CMD_MF
  2650. DYNAMIC_LINK=yes
  2651. when ($OS_WINDOWS == "yes") {
  2652. MODULE_SUFFIX=.dll
  2653. }
  2654. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2655. MODULE_PREFIX=lib
  2656. MODULE_SUFFIX=.dylib$MODULE_VERSION
  2657. }
  2658. otherwise {
  2659. MODULE_PREFIX=lib
  2660. MODULE_SUFFIX=.so$MODULE_VERSION
  2661. }
  2662. }
  2663. # tag:internal
  2664. ### @usage: DLL_PROXY() # internal
  2665. ###
  2666. ### The use of this module is strictly prohibited!!!
  2667. ### This is a temporary and project-specific solution.
  2668. module DLL_PROXY: DEV_DLL_PROXY {
  2669. .EXTS=.so .dylib .lib .mf
  2670. .PROXY=yes
  2671. .PEERDIR_POLICY=as_build_from
  2672. SET(PEERDIR_TAGS DLL __EMPTY__)
  2673. when ($OS_WINDOWS == "yes") {
  2674. MODULE_SUFFIX=.lib
  2675. }
  2676. }
  2677. # tag:internal
  2678. ### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
  2679. ###
  2680. ### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
  2681. ### This it needed to transfer their outputs through the library to PROGRAM
  2682. ### or dependent DLL/DYNAMIC_LIBRARY.
  2683. ###
  2684. ### Note: this is temporary solution until support of `super-global` variables come
  2685. ### which will enable transfer of some properties though final targets like DLLs.
  2686. macro DYNAMIC_DEPS(Path...) {
  2687. # PEERDIR as macro completely ignored in place where this macro applies
  2688. SET_APPEND(PEERDIR $Path)
  2689. }
  2690. # tag:internal
  2691. ### @usage: DYNAMIC_LIBRARY() # internal
  2692. ###
  2693. ### The use of this module is strictly prohibited except LGPL-related opensourcing
  2694. ### This provides linkable DLL module which brings its results to programs and tests
  2695. ### for seamless testing and packaging
  2696. multimodule DYNAMIC_LIBRARY {
  2697. module DLL_BIN: DLL {
  2698. .PROXY=yes
  2699. .IGNORED=PROVIDES
  2700. SET(MODULE_TAG DLL)
  2701. }
  2702. module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
  2703. .CMD=TOUCH_UNIT_MF
  2704. .PEERDIRSELF=DLL_BIN
  2705. .IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
  2706. .ALLOWED=DYNAMIC_DEPS
  2707. SET(PEERDIR_TAGS DLL_LIB __EMPTY__)
  2708. _BARE_MODULE()
  2709. DYNAMIC_LINK=yes
  2710. MODULE_SUFFIX=.pkg.fake
  2711. PEERDIR+=build/platform/local_so
  2712. RESTRICT_PATH(contrib devtools/dummy_arcadia MSG Use of this module type outside contrib/libs is prohibited)
  2713. # disable credits generation for static library
  2714. SET(CREDITS_FLAGS)
  2715. }
  2716. }
  2717. ### @usage: GLOBAL_SRCS(filenames...)
  2718. ###
  2719. ### Make all source files listed as GLOBAL.
  2720. ### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
  2721. ### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
  2722. ### recognized for GLOBAL_SRCS in contrast to SRCS macro.
  2723. ###
  2724. ### @example:
  2725. ### Consider the file to ya.make:
  2726. ###
  2727. ### LIBRARY()
  2728. ### GLOBAL_SRCS(foo.cpp bar.cpp)
  2729. ### END()
  2730. ###
  2731. ### @see: [SRCS()](#macro_SRCS)
  2732. macro GLOBAL_SRCS(Files...) {
  2733. SRCS(${pre=GLOBAL :Files})
  2734. }
  2735. ### @usage: ALL_SRCS([GLOBAL] filenames...)
  2736. ###
  2737. ### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
  2738. ### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
  2739. ### as the first argument and is equivalent to call to SRCS macro otherwise.
  2740. ###
  2741. ### @example:
  2742. ###
  2743. ### LIBRARY()
  2744. ### SET(MAKE_IT_GLOBAL GLOBAL)
  2745. ### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
  2746. ### END()
  2747. ###
  2748. ### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
  2749. macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
  2750. SRCS(${pre=$GLOBAL :Files})
  2751. }
  2752. ### @usage: _DLL_COMPATIBLE_LIBRARY # internal
  2753. ###
  2754. ### Base module to place DLLs into multimodules back to back with libraries.
  2755. ### In order to function properly all modules in multimodule shall have the
  2756. ### same set of arguments. So this module is just library that accepts but
  2757. ### ignores all DLL arguments.
  2758. module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
  2759. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2760. .ARGS_PARSER=DLL
  2761. }
  2762. @import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
  2763. # as SRCS in packages use macro BUNDLE_SRCS!
  2764. PACKED_PACKAGE_ARGS=
  2765. PACKED_PACKAGE_EXT=
  2766. ### @usage: PACK(archive_type)
  2767. ###
  2768. ### 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`
  2769. ###
  2770. ### Is not allowed other module types than PACKAGE().
  2771. ###
  2772. ### @see: [PACKAGE()](#module_PACKAGE)
  2773. macro PACK(Ext) {
  2774. SET(PACKED_PACKAGE_EXT $Ext)
  2775. }
  2776. PACKAGE_STRICT_VALUE=
  2777. macro PACKAGE_STRICT() {
  2778. SET(PACKAGE_STRICT_VALUE yes)
  2779. }
  2780. ### @usage: PACKAGE(name)
  2781. ###
  2782. ### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
  2783. ### 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.
  2784. ### The data can be optionally packed if macro PACK() is used.
  2785. ###
  2786. ### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
  2787. ###
  2788. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2789. ###
  2790. ### @see: [PACK()](#macro_PACK)
  2791. module PACKAGE: _BASE_UNIT {
  2792. .CMD=TOUCH_PACKAGE_MF
  2793. .PEERDIR_POLICY=as_build_from
  2794. .ALL_INS_TO_OUT=yes
  2795. .FINAL_TARGET=yes
  2796. .ALLOWED=PACK
  2797. SET(MODULE_SUFFIX .pkg.fake)
  2798. SET(DONT_RESOLVE_INCLUDES yes)
  2799. NO_PLATFORM()
  2800. when ($PACKED_PACKAGE_EXT) {
  2801. PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
  2802. }
  2803. SET(NEED_PLATFORM_PEERDIRS no)
  2804. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL
  2805. }
  2806. TOUCH_GROUP=$TOUCH_PACKAGE ${kv;hide:"p CI"}
  2807. ### @usage: CI_GROUP()
  2808. ###
  2809. ### Module collects what is described directly inside it transitively by PEERDIRs.
  2810. ### No particular layout of built artifacts is implied. This module is needed primarily for CI dependency analysis and may not trigger builds at all.
  2811. ###
  2812. ### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
  2813. module CI_GROUP: _BARE_UNIT {
  2814. .CMD=TOUCH_GROUP
  2815. .PEERDIR_POLICY=as_build_from
  2816. .ALL_INS_TO_OUT=yes
  2817. .FINAL_TARGET=yes
  2818. .RESTRICTED=SRCS
  2819. MODULE_SUFFIX=.ci.pkg.fake
  2820. PEERDIR_TAGS=CPP_PROTO PY3 PY3_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE DLL
  2821. }
  2822. # tag:generic tag:internal
  2823. TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
  2824. # tag:proto
  2825. ### @usage: RESOLVE_PROTO()
  2826. ###
  2827. ### Enable include resolving within UNIONs and let system .proto being resolved
  2828. ### among .proto/.gztproto imports
  2829. ###
  2830. ### Note: it is currently impossible to enable resolving only for .proto, so resolving is enabled for all supported files
  2831. ### also we only add ADDINCL for stock protobuf. So use this macro with care: it may cause resolving problems those are
  2832. ### to be addressed by either ADDINCLs or marking them as TEXT. Please contact devtools for details.
  2833. macro RESOLVE_PROTO() {
  2834. SET(DONT_RESOLVE_INCLUDES no)
  2835. ADDINCL(FOR proto $PROTOBUF_PATH)
  2836. }
  2837. ### @usage: UNION(name)
  2838. ###
  2839. ### Collection of PEERDIR dependencies, files and artifacts.
  2840. ### UNION doesn't build its peers, just provides those to modules depending on it.
  2841. ### When specified in DEPENDS() macro the UNION is transitively closed, building all its peers and providing those by own paths (without adding this module path like PACKAGE does).
  2842. ###
  2843. ### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
  2844. ###
  2845. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2846. module UNION: _BASE_UNIT {
  2847. .ALL_INS_TO_OUT=yes
  2848. .FINAL_TARGET=no
  2849. NO_PLATFORM()
  2850. SET(MODULE_SUFFIX .pkg.fake)
  2851. SET(DONT_RESOLVE_INCLUDES yes)
  2852. .CMD=TOUCH_UNIT_MF
  2853. SET(NEED_PLATFORM_PEERDIRS no)
  2854. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN DLL
  2855. }
  2856. # tag:python-specific
  2857. module _PY_PACKAGE: UNION {
  2858. .EXTS=.py
  2859. .ALL_INS_TO_OUT=yes
  2860. .ALLOWED=GRPC USE_SKIFF
  2861. ENABLE(PY_PROTOS_FOR)
  2862. SET(PEERDIR_TAGS PY_PROTO)
  2863. SET(DONT_RESOLVE_INCLUDES no)
  2864. }
  2865. # tag:python-specific tag:deprecated tag:internal
  2866. ### @usage: PY_PACKAGE(name) # internal, deprecated
  2867. ###
  2868. ### This is module created via PY_PROTOS_FOR() macro
  2869. module PY_PACKAGE: _PY_PACKAGE {
  2870. .FINAL_TARGET=yes
  2871. }
  2872. # tag:internal
  2873. ### @usage: _SET_FIRST_VALUE(name args...) # internal
  2874. ###
  2875. ### This macro sets the value of `name` variable to the value of next argument
  2876. macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
  2877. SET($NAME $VALUE)
  2878. }
  2879. # tag:python-specific
  2880. PY_NAMESPACE_VALUE=
  2881. # tag:python-specific
  2882. ### @usage: PY_NAMESPACE(prefix)
  2883. ###
  2884. ### Sets default Python namespace for all python sources in the module.
  2885. ### Especially suitable in PROTO_LIBRARY where Python sources are generated and there is no PY_SRCS to place NAMESPACE parameter.
  2886. macro PY_NAMESPACE(Arg) {
  2887. SET(PY_NAMESPACE_VALUE $Arg)
  2888. }
  2889. # tag:internal
  2890. ### @usage: _SRCS_NO_GLOBAL(files...) # internal
  2891. ###
  2892. ### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
  2893. ### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
  2894. ### Note: this macro changes order of source files.
  2895. macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
  2896. SRCS($GLOBAL $FILES)
  2897. }
  2898. # tag:java-specific
  2899. JAVA_VCS_MF_ARG=
  2900. COMPILE_JAVA_MF=$COMPILE_JAVA
  2901. # tag:java-specific
  2902. when ($EXT_JAVA_VCS_INFO == "yes") {
  2903. JAVA_VCS_MF_ARG=--vcs-mf $VCS_JAVA
  2904. COMPILE_JAVA_MF=$GENERATE_VCS_JAVA_INFO_NODEP && $COMPILE_JAVA
  2905. }
  2906. # tag:java-specific
  2907. EXT_JAVA_VCS_INFO=no
  2908. ### @usage: EMBED_JAVA_VCS_INFO()
  2909. ###
  2910. ### Embed manifest with vcs info into `EXTERNAL_JAVA_LIBRARY`
  2911. ### By default this is disabled.
  2912. macro EMBED_JAVA_VCS_INFO() {
  2913. ENABLE(EXT_JAVA_VCS_INFO)
  2914. }
  2915. # tag:java-specific tag:internal
  2916. ### @usage: EXTERNAL_JAVA_LIBRARY() #internal
  2917. ###
  2918. ### EXTERNAL_JAVA_LIBRARY() is a module for creating a .jar file using non-Java code (generators etc.)
  2919. ### Unlike regular JAVA_LIBRARY this module doesn't produce .pom file, so it cannot be exported to Maven itself.
  2920. ### PEERDIR it from JAVA_LIBRARY or JAVA_PROGRAM for export to Maven.
  2921. module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
  2922. .EXTS=.jsrc .java .jar .mf
  2923. .NODE_TYPE=Bundle
  2924. .CMD=COMPILE_JAVA_MF
  2925. .PEERDIR_POLICY=as_build_from
  2926. .FINAL_TARGET=no
  2927. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  2928. .ALLOWED=EMBED_JAVA_VCS_INFO
  2929. .RESTRICTED=EXTERNAL_JAR
  2930. PEERDIR(build/platform/java/jdk)
  2931. PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR
  2932. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  2933. HAS_MANAGEABLE_PEERS=yes
  2934. DYNAMIC_LINK=yes
  2935. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  2936. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  2937. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  2938. when ($PACKAGE_PREFIX) {
  2939. PACKAGE_PREFIX_ARGS=--package-prefix=$PACKAGE_PREFIX
  2940. }
  2941. DISABLE(NEED_PLATFORM_PEERDIRS)
  2942. NO_PLATFORM()
  2943. SET(MODULE_SUFFIX .jar)
  2944. SET(MODULE_LANG JAVA)
  2945. }
  2946. # tag:java-specific
  2947. ALL_JAR_SOURCES=
  2948. LINT_JAVA_SOURCES=
  2949. ALL_SRCDIRS=
  2950. LINK_JAR_RESOURCES=
  2951. LINK_JAR_JSOURCES=
  2952. JAR_GEN_SRCS=
  2953. JAR_GEN_JSRCS=
  2954. macro _JAR_SRCS(SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], RESOURCES?"yes":"no", Globs...) {
  2955. _CHECK_JAVA_SRCDIR($SRCDIR)
  2956. SET_APPEND(ALL_SRCDIRS $SRCDIR)
  2957. SET(VAR_SALT $SRCDIR $Globs $EXCLUDE $PACKAGE_PREFIX $RESOURCES $FILES)
  2958. SET(JAR_SRCS_GLOB uniq_${hash:VAR_SALT})
  2959. _LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE})
  2960. SET_APPEND(LINT_JAVA_SOURCES \${input;rootrel;ext=.java:${JAR_SRCS_GLOB}})
  2961. 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})
  2962. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_RESOURCES ${quo:SRCDIR} ${BINDIR}/cls ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt)
  2963. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_JSOURCES ${quo:SRCDIR} ${BINDIR}/src ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt)
  2964. _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)
  2965. _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)
  2966. }
  2967. macro IDEA_JAR_SRCS(Args...) {
  2968. _JAR_SRCS($Args)
  2969. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  2970. }
  2971. macro _HASH_HELPER(Args...) {
  2972. .CMD=${hash:Args}
  2973. .SEM=${hash:Args}
  2974. }
  2975. macro _GENTAR_HELPER(OUT_DIR[], Args...) {
  2976. .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"}
  2977. }
  2978. # tag:java-specific
  2979. RUN_JAR_PROG_CP_PRE=@
  2980. RUN_JAR_PROG_CP_SUF=.cplst
  2981. when($JDK_VERSION == "8") {
  2982. RUN_JAR_PROG_CP_PRE=
  2983. RUN_JAR_PROG_CP_SUF=
  2984. }
  2985. # tag:java-specific
  2986. macro _DO_2_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq_", IN_DIRS_INPUTS[], IN{input}[], IN_NOPARSE{input}[], IN_DIR[], OUT_NOAUTO{output}[], OUT{output}[], TOOL{tool}[], OUT_DIR[], CLASSPATH[], ADD_SRCS_TO_CLASSPATH?"yes":"no", CWD="${ARCADIA_BUILD_ROOT}", Args...) {
  2987. _LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR})
  2988. _CHECK_RUN_JAVA_PROG_CLASSPATH($CLASSPATH)
  2989. .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
  2990. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} ${OUT_DIR} && ${cwd:CWD} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} $YMAKE_PYTHON ${input:"build/scripts/fix_java_command_file_cp.py"} --build-root ${ARCADIA_BUILD_ROOT} $JDK_RESOURCE/bin/java -Dfile.encoding=utf8 -classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} ${Args} && $_GENTAR_HELPER($CLASSPATH $IN_DIR $IN $IN_NOPARSE $TOOL $Args OUT_DIR $OUT_DIR) ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output;noauto;hide:OUT_NOAUTO} ${output;hide:OUT} ${tool;hide:TOOL} ${IN_DIRS_INPUTS}
  2991. }
  2992. # tag:java-specific
  2993. macro _DO_1_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq", Args...) {
  2994. _DO_2_RUN_JAR_PROGRAM($Args IN_DIRS_VAR $IN_DIRS_VAR IN_DIRS_INPUTS ${"$"}{input;hide:$IN_DIRS_VAR})
  2995. }
  2996. # tag:java-specific
  2997. macro RUN_JAVA_PROGRAM(Args...) {
  2998. _DO_1_RUN_JAR_PROGRAM($Args IN_DIRS_VAR uniq_${hash:Args})
  2999. }
  3000. # tag:java-specific
  3001. _JAR_ANN_PROCESSORS=
  3002. _JAR_ANN_PROC_OPT_PREFIX=
  3003. macro JAR_ANNOTATION_PROCESSOR(Classes...) {
  3004. SET_APPEND(_JAR_ANN_PROCESSORS $Classes)
  3005. SET(_JAR_ANN_PROC_OPT_PREFIX -processor)
  3006. # for ya ide idea only
  3007. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Classes)
  3008. }
  3009. # tag:java-specific
  3010. macro _JAR_ANN_PROC_OPTS(Classes...) {
  3011. .CMD=$_JAR_ANN_PROC_OPT_PREFIX ${join=,:Classes}
  3012. }
  3013. # tag:java-specific
  3014. macro _NOOP_MACRO(Args...) {
  3015. ENABLE(UNUSED_MACRO)
  3016. }
  3017. # tag:java-specific
  3018. module _JAR_BASE: _BARE_UNIT {
  3019. .NODE_TYPE=Bundle
  3020. .CMD=TOUCH_UNIT
  3021. .PEERDIR_POLICY=as_build_from
  3022. .FINAL_TARGET=no
  3023. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  3024. .ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE
  3025. .DEFAULT_NAME_GENERATOR=TwoDirNames
  3026. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__
  3027. HAS_MANAGEABLE_PEERS=yes
  3028. DYNAMIC_LINK=yes
  3029. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  3030. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  3031. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  3032. DISABLE(NEED_PLATFORM_PEERDIRS)
  3033. NO_PLATFORM()
  3034. VCS_JAVA=${suf=.__vcs_version__.mf:TARGET}
  3035. SET(MODULE_LANG JAVA)
  3036. }
  3037. # tag:java-specific
  3038. module JAVA_CONTRIB_PROXY: _JAR_BASE {
  3039. }
  3040. # tag:java-specific
  3041. macro _FETCH_CONTRIB(Id, Out, SBR="sbr:") {
  3042. .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"}
  3043. ADD_CHECK(check.resource $Id)
  3044. }
  3045. # tag:java-specific
  3046. LOCAL_JAR_PATH=
  3047. LOCAL_SOURCES_JAR_PATH=
  3048. JAR_RESOURCE_ID=
  3049. SRC_RESOURCE_ID=
  3050. FETCH_SRCS_JAR=
  3051. FETCH_TARGET_JAR=
  3052. FETCH_CONTRIB_JAR=$FETCH_TARGET_JAR $FETCH_SRCS_JAR
  3053. # tag:java-specific
  3054. macro JAR_RESOURCE(Id) {
  3055. SET(JAR_RESOURCE_ID $Id)
  3056. }
  3057. # tag:java-specific
  3058. macro SRC_RESOURCE(Id) {
  3059. SET(SRC_RESOURCE_ID $Id)
  3060. }
  3061. # tag:java-specific
  3062. macro LOCAL_JAR(File) {
  3063. SET(LOCAL_JAR_PATH $File)
  3064. }
  3065. # tag:java-specific
  3066. macro LOCAL_SOURCES_JAR(File) {
  3067. SET(LOCAL_SOURCES_JAR_PATH $File)
  3068. }
  3069. # tag:java-specific
  3070. module JAVA_CONTRIB: _JAR_BASE {
  3071. .CMD=FETCH_CONTRIB_JAR
  3072. .FINAL_TARGET=yes
  3073. when ($JAR_RESOURCE_ID) {
  3074. FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX})
  3075. }
  3076. otherwise {
  3077. when ($LOCAL_JAR_PATH) {
  3078. FETCH_TARGET_JAR= && $FS_TOOLS copy ${input:LOCAL_JAR_PATH} $TARGET
  3079. }
  3080. otherwise {
  3081. FETCH_TARGET_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:BINDIR} $JDK_RESOURCE/bin/jar cfvm $TARGET $VCS_JAVA .
  3082. PEERDIR+=build/platform/java/jdk
  3083. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3084. }
  3085. }
  3086. when ($SRC_RESOURCE_ID) {
  3087. FETCH_SRCS_JAR= && $_FETCH_CONTRIB($SRC_RESOURCE_ID ${BINDIR}/${REALPRJNAME}-sources.jar)
  3088. }
  3089. otherwise {
  3090. when ($LOCAL_SOURCES_JAR_PATH) {
  3091. FETCH_SRCS_JAR= && $FS_TOOLS copy ${input:LOCAL_SOURCES_JAR_PATH} {output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME}
  3092. }
  3093. otherwise {
  3094. 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 .
  3095. PEERDIR+=build/platform/java/jdk
  3096. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3097. }
  3098. }
  3099. SET(MODULE_SUFFIX .jar)
  3100. }
  3101. MAKE_JAVA_CLASSPATH_FILE=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} ${input;hide:"build/scripts/process_command_files.py"}
  3102. # tag:kotlin-specific
  3103. KOTLINC_OPTS_VALUE=
  3104. # tag:kotlin-specific
  3105. KT_SRSCLIST_FLAG=--kotlin ${BINDIR}/misc/all-kt-sources.txt
  3106. KT_CLASSES_DIR=${BINDIR}/kt_cls
  3107. COLLECT_KT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/kt_bfg.txt -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file
  3108. LINK_KT_CLASSPATH=${MAKE_JAVA_CLASSPATH_FILE} ${BINDIR}/kt_bfg.txt ${BINDIR}/kt_cp.txt && $FS_TOOLS md $KT_CLASSES_DIR
  3109. 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
  3110. ALL_KT_COMMANDS=
  3111. KT_CLASSPATH_ITEM=
  3112. # tag:java-specific
  3113. JAVAC_CMD=$JDK_RESOURCE/bin/javac
  3114. 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
  3115. # tag:java-specific tag:codenav
  3116. JAVA_YNDEXING=no
  3117. # tag:java-specific
  3118. when ($USE_SYSTEM_KYTHE) {
  3119. KYTHE_RESOURCE=$USE_SYSTEM_KYTHE
  3120. }
  3121. otherwise {
  3122. KYTHE_RESOURCE=$KYTHE_RESOURCE_GLOBAL
  3123. }
  3124. # tag:java-specific tag:codenav
  3125. _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
  3126. _DO_JAVA_YNDEXING=
  3127. # tag:java-specific
  3128. SOURCES_JAR=no
  3129. _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 .
  3130. _PACK_SRC_JAR=
  3131. # tag:java-specific
  3132. _PACK_JNI=
  3133. _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
  3134. # tag:java-specific
  3135. _MAKE_JSTYLE_FILE_LIST=
  3136. # tag:java-specific
  3137. _LINK_UBERJAR=
  3138. _UBERJAR_SELF=
  3139. _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} \
  3140. && $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} $BINDIR/_empty/META-INF \
  3141. && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} $BINDIR/_empty/META-INF/MANIFEST.MF \
  3142. && $UPDATE_VCS_JAVA_INFO_NODEP($TARGET) \
  3143. && ${cwd;suf=/_empty:BINDIR} ${JDK_RESOURCE}/bin/jar ufv ${TARGET} META-INF/MANIFEST.MF \
  3144. && $JDK_RESOURCE/bin/jar ufvm $TARGET $VCS_JAVA
  3145. # tag:java-specific
  3146. macro _PACK_JAR_HELPER(Out) {
  3147. .CMD=${cwd;suf=/cls:BINDIR} $JDK_RESOURCE/bin/jar cfvm $Out $VCS_JAVA .
  3148. }
  3149. # tag:java-specific
  3150. macro _JAVAC_RUN_HELPER(JAVAC_CMD_WITH_ARGS...) {
  3151. .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
  3152. }
  3153. macro _ADD_HIDDEN_INPUTS(Inputs...) {
  3154. .CMD=${input;hide:Inputs}
  3155. }
  3156. # tag:java-specific
  3157. 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
  3158. ERROR_PRONE_2_7_1_FORCED_OPTS=-Xep:InlineMeInliner:OFF -Xep:SameNameButDifferent:OFF
  3159. # tag:java-specific
  3160. JAVA_COVERAGE_SRCLIST_FLAG=--coverage ${output;pre=${MODULE_PREFIX};suf=.cpsf:REALPRJNAME} --source-root ${ARCADIA_ROOT}
  3161. JAVA_COVERAGE_SRCLIST=
  3162. PREPARE_JAVA_BUILD_DIRS=$FS_TOOLS md ${BINDIR}/cls && $FS_TOOLS md ${BINDIR}/misc
  3163. EXTRACT_GENDIRS=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --unpack --ext .gentar ${ext=.gentar:AUTO_INPUT}
  3164. COLLECT_JAVA_SRCLIST=${YMAKE_PYTHON} ${input:"build/scripts/make_java_srclists.py"} ${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/java_pack_to_file.py"} --moddir ${CURDIR} --java ${BINDIR}/all-java.srclst ${KT_SRSCLIST} ${JAVA_COVERAGE_SRCLIST} --ya-start-command-file ${ALL_JAR_SOURCES} ${ext=.java:AUTO_INPUT} ${ext=.kt:AUTO_INPUT} --ya-end-command-file
  3165. COLLECT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/bfg.txt -m --ya-start-command-file ${rootrel:MANAGED_PEERS_CLOSURE} $KT_CLASSPATH_ITEM --ya-end-command-file
  3166. LINK_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/bfg.txt ${ARCADIA_BUILD_ROOT}/bfg.jar
  3167. COMPILE_JAVA_SRCLIST=$_JAVAC_RUN_HELPER($JAVAC_CMD)
  3168. PACK_JAR=$_PACK_JAR_HELPER($TARGET)
  3169. # NOTE: No && before LINK_JAR_RESOURCES, ALL_KT_COMMANDS and JAR_GEN_SRCS needed since those vars either empty or starts with &&
  3170. LINK_JAR=$PREPARE_JAVA_BUILD_DIRS \
  3171. && $EXTRACT_GENDIRS \
  3172. && $COLLECT_JAVA_SRCLIST \
  3173. $JAR_GEN_SRCS \
  3174. $ALL_KT_COMMANDS \
  3175. && $COLLECT_CLASSPATH \
  3176. && $LINK_CLASSPATH \
  3177. && $COMPILE_JAVA_SRCLIST \
  3178. $LINK_JAR_RESOURCES \
  3179. && ${cwd;suf=/cls:BINDIR} $GENERATE_VCS_JAVA_INFO_NODEP . \
  3180. $_PACK_SRC_JAR \
  3181. $_PACK_JNI \
  3182. && $PACK_JAR \
  3183. $_DO_JAVA_YNDEXING \
  3184. ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} \
  3185. $_MAKE_JSTYLE_FILE_LIST \
  3186. $_LINK_UBERJAR \
  3187. $_ADD_HIDDEN_INPUTS($JAVA_EXTERNAL_DEPENDENCIES_VALUE)
  3188. # tag:java-specific
  3189. _EXT_SRC_JAR=
  3190. _EXT_JAR=
  3191. _COPY_EXT_SRC_JAR=
  3192. _DO_USE_EXT_JAR=$FS_TOOLS copy ${input:_EXT_JAR} $TARGET $_COPY_EXT_SRC_JAR
  3193. _DO_COPY_EXT_SRC_JAR= && $FS_TOOLS copy $_EXT_SRC_JAR ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
  3194. macro JAVA_RESOURCE(JAR, SOURCES="") {
  3195. SET(_EXT_SRC_JAR $SOURCES)
  3196. SET(_EXT_JAR $JAR)
  3197. }
  3198. # tag:java-specific tag:fbs
  3199. JAVA_FLATBUFFERS_VERSION = 2.0.0
  3200. # tag:java-specific
  3201. module _COMPILABLE_JAR_BASE : _JAR_BASE {
  3202. # flatbuffers-java
  3203. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3204. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3205. # protobuf-java
  3206. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3207. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3208. # protobuf-javalite
  3209. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3210. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3211. # protobuf-java-util
  3212. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  3213. 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})
  3214. }
  3215. # tag:java-specific tag:internal
  3216. ### @usage: JAR_LIBRARY() #internal
  3217. ###
  3218. ### Reimplementation of the JAVA_LIBRARY with ymake.core.conf and ymake based dependency management
  3219. module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
  3220. .EXTS=.jsrc .java .jar .mf .gentar .kt
  3221. .CMD=LINK_JAR
  3222. .FINAL_TARGET=yes
  3223. .ALIASES=JAVA_SRCS=IDEA_JAR_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
  3224. .RESTRICTED=EXTERNAL_JAR
  3225. MODULE_SUFFIX=.jar
  3226. PEERDIR(build/platform/java/jdk)
  3227. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3228. when ($_EXT_SRC_JAR) {
  3229. _COPY_EXT_SRC_JAR=_DO_COPY_EXT_SRC_JAR
  3230. }
  3231. when ($_EXT_JAR) {
  3232. LINK_JAR=$_DO_USE_EXT_JAR
  3233. }
  3234. # in the ideal world this statement must be under condition bellow
  3235. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
  3236. when ($WITH_KOTLIN_VALUE) {
  3237. KT_SRSCLIST=$KT_SRSCLIST_FLAG
  3238. ALL_KT_COMMANDS=&& $COLLECT_KT_CLASSPATH && $LINK_KT_CLASSPATH && $COMPILE_KT
  3239. LINK_JAR_RESOURCES+=&& $FS_TOOLS copy_all_files ${KT_CLASSES_DIR} ${BINDIR}/cls
  3240. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  3241. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  3242. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  3243. }
  3244. when($WITH_KOTLINC_PLUGIN_NOARG) {
  3245. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  3246. }
  3247. # Must be in sync with KT_CLASSES_DIR!
  3248. # There are problems in JDK13 with abs paths in classpath baked into jar file manifest. Using relative path
  3249. # here assumes that jar file with classpath for javac located in the $ARCADIA_BUILD_ROOT
  3250. KT_CLASSPATH_ITEM=$MODDIR/kt_cls
  3251. }
  3252. otherwise {
  3253. KT_SRSCLIST=
  3254. ALL_KT_COMMANDS=
  3255. KT_CLASSES=
  3256. }
  3257. when ($SOURCES_JAR == "yes") {
  3258. _PACK_SRC_JAR=$_PACK_SRC_JAR_IMPL
  3259. }
  3260. when ($JAVA_COVERAGE == "yes") {
  3261. JAVA_COVERAGE_SRCLIST=$JAVA_COVERAGE_SRCLIST_FLAG
  3262. }
  3263. when ($MAKE_UBERJAR_VALUE == "yes") {
  3264. _LINK_UBERJAR=$_DO_LINK_UBERJAR
  3265. PACK_JAR=$_PACK_JAR_HELPER(${BINDIR}/${REALPRJNAME}.lib.jar)
  3266. # TODO: This condition is incorrect in case of autoinputs _UBERJAR_SELF should be empty only for
  3267. # modules without AUTO_INPUT and without JAVA_SRCS added inputs.
  3268. when($ALL_JAR_SOURCES) {
  3269. _UBERJAR_SELF=--jar ${BINDIR}/${REALPRJNAME}.lib.jar
  3270. }
  3271. PEERDIR+=build/platform/java/uberjar
  3272. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  3273. }
  3274. when($JAVA_YNDEXING == "yes") {
  3275. PEERDIR+=build/platform/java/kythe
  3276. _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"}
  3277. }
  3278. when($ERROR_PRONE_VALUE) {
  3279. PEERDIR+=$ERROR_PRONE_PEERDIR
  3280. JAVAC_CMD=$ERROR_PRONE_JAVAC_CMD
  3281. }
  3282. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
  3283. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3284. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3285. }
  3286. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "17") {
  3287. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3288. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3289. }
  3290. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "18") {
  3291. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3292. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3293. }
  3294. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  3295. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3296. JAVAC_OPTS+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3297. }
  3298. when ($JAVA_ADD_DLLS_VALUE == "yes") {
  3299. CONSUME_NON_MANAGEABLE_PEERS=yes
  3300. _PACK_JNI=$_PACK_JNI_CMD
  3301. }
  3302. when ($LINT_LEVEL_VALUE != "none") {
  3303. _MAKE_JSTYLE_FILE_LIST= && ${WRITER_PY} --file ${output;noauto:"lint-java.srclst"} -m --ya-start-command-file $LINT_JAVA_SOURCES --ya-end-command-file
  3304. }
  3305. SET(MODULE_TYPE JAVA_LIBRARY)
  3306. ENABLE(YMAKE_JAVA_TEST)
  3307. _ADD_JAVA_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/lint-java.srclst::$(SOURCE_ROOT))
  3308. _ADD_CLASSPATH_CLASH_CHECK()
  3309. JAVA_MODULE(IDEA_ONLY)
  3310. }
  3311. # tag:java-specific
  3312. _SCRIPTGEN_FLAGS=
  3313. macro _GEN_JAVA_SCRIPT_IMPL(Out, Template, Props...) {
  3314. .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
  3315. }
  3316. # tag:java-specific
  3317. _GEN_USERSCRIPTS=
  3318. macro _ADD_GEN_JAVA_SCRIPT(Out, Template, Props...) {
  3319. SET_APPEND(_GEN_USERSCRIPTS && \$_GEN_JAVA_SCRIPT_IMPL($Out $Template $Props))
  3320. }
  3321. # tag:java-specific
  3322. _PACK_JDK=
  3323. # tag:java-specific
  3324. DO_GEN_JAVA_RUN_SH=
  3325. _SOURCE_JARS=
  3326. _SOURCE_JARS_CPLIST=
  3327. GEN_JAVA_RUN_SH=$SCRIPTGEN_RESOURCE_GLOBAL/scriptgen --java $JDK_RESOURCE/bin/java --output ${output:"run.sh"} -D GENERATE_DEFAULT_RUNNER=yes -D JAR_NAME=${REALPRJNAME}.jar -D CLASSPATH=${nopath;join;pre="::":MANAGED_PEERS_CLOSURE} -D PROJECT_DIR=${REALPRJNAME} -D JAR_BASENAME=${REALPRJNAME}
  3328. GEN_RUN_CP=${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${nopath;qe;pre=$REALPRJNAME/:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET}
  3329. 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}
  3330. MAKE_JAR_PROGRAM_CPLST=${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} --ya-start-command-file ${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS_CPLIST} --ya-end-command-file
  3331. TAR_CLASSPATH= && $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} ${output;pre=$MODULE_PREFIX;suf=.tar:REALPRJNAME} ${cwd;pre=$BINDIR/:REALPRJNAME}
  3332. DO_TAR_CLASSPATH=
  3333. 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"}
  3334. # tag:java-specific
  3335. # UBERJAR program link command
  3336. LINK_UBERJAR_PROGRAM=${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} $TARGET \
  3337. && $FS_TOOLS md ${BINDIR}/${REALPRJNAME} \
  3338. && $FS_TOOLS link_or_copy ${BINDIR}/${REALPRJNAME}.jar $TARGET \
  3339. && $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} \
  3340. $DO_TAR_CLASSPATH \
  3341. $_GEN_USERSCRIPTS \
  3342. $_PACK_JDK
  3343. # tag:java-specific
  3344. RUN_WITH_SOURCES=no
  3345. # TODO jbuild creates tar with all classpath deps by default and some projects rely on this. In ymake build this tar file creation is not needed and should be disabled by default in future
  3346. TARED_CLASSPATH=yes
  3347. _JAR_SRCS_CALLED=no
  3348. # tag:java-specific
  3349. macro _MARK_JAVA_PROG_WITH_SOURCES(Args...) {
  3350. ENABLE(_JAR_SRCS_CALLED)
  3351. }
  3352. # tag:java-specific
  3353. module _JAR_RUNNABLE: _COMPILABLE_JAR_BASE {
  3354. .FINAL_TARGET=yes
  3355. .CMD=LINK_JAR_PROGRAM
  3356. .ALIASES=JAVA_SRCS=_MARK_JAVA_PROG_WITH_SOURCES GENERATE_SCRIPT=_YMAKE_GENERATE_SCRIPT
  3357. MODULE_SUFFIX=.run.cp.jar
  3358. CONSUME_NON_MANAGEABLE_PEERS=yes
  3359. when ($RUN_WITH_SOURCES == "yes") {
  3360. _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}
  3361. _SOURCE_JARS_CPLIST=${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
  3362. }
  3363. when ($TARED_CLASSPATH == "yes") {
  3364. DO_TAR_CLASSPATH=$TAR_CLASSPATH
  3365. }
  3366. when ($DISABLE_SCRIPTGEN) {
  3367. DO_GEN_JAVA_RUN_SH=
  3368. }
  3369. otherwise {
  3370. DO_GEN_JAVA_RUN_SH=$GEN_JAVA_RUN_SH
  3371. PEERDIR+=build/platform/java/scriptgen
  3372. }
  3373. when ($WITH_JDK_VALUE) {
  3374. _PACK_JDK= && ${YMAKE_PYTHON} ${input:"build/scripts/tar_directory.py"} ${output;tared:"jdk.tar"} $WITH_JDK_RESOURCE $WITH_JDK_RESOURCE
  3375. }
  3376. when ($MAKE_UBERJAR_VALUE == "yes") {
  3377. LINK_JAR_PROGRAM=$LINK_UBERJAR_PROGRAM
  3378. DYNAMIC_LINK=no
  3379. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=yes
  3380. }
  3381. otherwise {
  3382. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=no
  3383. }
  3384. CHECK_PROVIDES()
  3385. }
  3386. # tag:java-specific
  3387. multimodule JAR_PROGRAM {
  3388. module JAR_RUNNABLE: _JAR_RUNNABLE {
  3389. .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
  3390. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3391. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
  3392. .PEERDIRSELF=JAR_COMPILATION
  3393. SET(MODULE_TYPE JAVA_PROGRAM)
  3394. }
  3395. module JAR_COMPILATION: JAR_LIBRARY {
  3396. .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
  3397. .FINAL_TARGET=no
  3398. SET(MODULE_TYPE JAVA_PROGRAM)
  3399. }
  3400. }
  3401. # tag:java-specific
  3402. LINK_JAR_TEST=${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}
  3403. YMAKE_JAVA_TEST=
  3404. module _JAR_TEST: _COMPILABLE_JAR_BASE {
  3405. .FINAL_TARGET=yes
  3406. .CMD=LINK_JAR_TEST
  3407. .DEFAULT_NAME_GENERATOR=FullPath
  3408. CONSUME_NON_MANAGEABLE_PEERS=yes
  3409. SET(MODULE_SUFFIX .test.cp.jar)
  3410. ENABLE(YMAKE_JAVA_TEST)
  3411. JAVA_TEST()
  3412. CHECK_PROVIDES()
  3413. }
  3414. # tag:java-specific
  3415. multimodule JUNIT5_YMAKE {
  3416. module JAR_TESTABLE: _JAR_TEST {
  3417. .ALLOWED=JAVA_TEST_PEERDIR
  3418. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3419. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_TEST_PEERDIR=PEERDIR
  3420. .PEERDIRSELF=JAR_COMPILATION
  3421. SET(MODULE_TYPE JUNIT5)
  3422. }
  3423. module JAR_COMPILATION: JAR_LIBRARY {
  3424. .IGNORED=JAVA_TEST_PEERDIR
  3425. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO
  3426. .FINAL_TARGET=no
  3427. PEERDIR(devtools/junit5-runner build/platform/java/jacoco-agent)
  3428. }
  3429. }
  3430. # tag:java-specific
  3431. multimodule JTEST_YMAKE {
  3432. module JAR_TESTABLE: _JAR_TEST {
  3433. .ALLOWED=YT_SPEC
  3434. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3435. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_TEST_PEERDIR=PEERDIR
  3436. .PEERDIRSELF=JAR_COMPILATION
  3437. SET(MODULE_TYPE JTEST)
  3438. PEERDIR(devtools/junit-runner)
  3439. 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)
  3440. }
  3441. module JAR_COMPILATION: JAR_LIBRARY {
  3442. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO
  3443. .ALLOWED=YT_SPEC
  3444. .FINAL_TARGET=no
  3445. DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
  3446. PEERDIR(build/platform/java/jacoco-agent)
  3447. }
  3448. }
  3449. # tag:python-specific tag:deprecated
  3450. ### @usage: PY2_LIBRARY() # deprecated
  3451. ###
  3452. ### Deprecated. Use PY23_LIBRARY or PY3_LIBRARY instead.
  3453. ### Python 2.x binary built library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM.
  3454. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3455. ### This module is only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3456. ### This module is only compatible with Arcadia Python build.
  3457. ###
  3458. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3459. module PY2_LIBRARY: _LIBRARY {
  3460. _ARCADIA_PYTHON_ADDINCL()
  3461. when ($NO_PYTHON_INCLS != "yes") {
  3462. PEERDIR+=contrib/libs/python
  3463. }
  3464. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3465. MODULE_PREFIX=py
  3466. }
  3467. otherwise {
  3468. MODULE_PREFIX=libpy
  3469. }
  3470. .ALLOWED=FORK_TESTS
  3471. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3472. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS STYLE_PYTHON
  3473. USE_GLOBAL_CMD=yes
  3474. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3475. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3476. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3477. 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}"})
  3478. }
  3479. SET(MODULE_LANG PY2)
  3480. ADD_CLANG_TIDY()
  3481. }
  3482. # tag:python-specific
  3483. ### @usage: PY3_LIBRARY()
  3484. ###
  3485. ### Python 3.x binary library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM
  3486. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3487. ### This module is only compatible with PYTHON3-tagged modules and selects those from multimodules.
  3488. ### This module is only compatible with Arcadia Python build.
  3489. ###
  3490. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3491. module PY3_LIBRARY: _LIBRARY {
  3492. _ARCADIA_PYTHON3_ADDINCL()
  3493. when ($NO_PYTHON_INCLS != "yes") {
  3494. PEERDIR+=contrib/libs/python
  3495. }
  3496. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3497. MODULE_PREFIX=py
  3498. }
  3499. otherwise {
  3500. MODULE_PREFIX=libpy
  3501. }
  3502. .ALLOWED=FORK_TESTS
  3503. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3504. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2 OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3505. USE_GLOBAL_CMD=yes
  3506. PEERDIR($YMAKE_PYTHON3_PEER)
  3507. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3508. PYTHON_TYPE_FOR_CYTHON=PY3
  3509. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3510. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3511. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3512. 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}"})
  3513. }
  3514. SET(MODULE_LANG PY3)
  3515. ADD_CLANG_TIDY()
  3516. }
  3517. # tag:python-specific
  3518. ### @usage: _BASE_PY_PROGRAM #internal
  3519. ###
  3520. ### The base module for all Python 2.x binary programs. Adds linking logic, relevant module properties and
  3521. ### dependency on Python 2.x interpreter. Also adds import tests on all sources including PEERDIR'ed libraries.
  3522. ### Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  3523. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3524. ###
  3525. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3526. module _BASE_PY_PROGRAM: _BASE_PROGRAM {
  3527. .CMD=PY_PROGRAM_LINK_EXE
  3528. _ARCADIA_PYTHON_ADDINCL()
  3529. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3530. NO_CHECK_IMPORTS_FOR_VALUE=
  3531. }
  3532. ADD_CHECK_PY_IMPORTS()
  3533. when ($NO_PYTHON_INCLS != "yes") {
  3534. PEERDIR += contrib/libs/python
  3535. }
  3536. when ($USE_ARCADIA_PYTHON == "yes") {
  3537. PEERDIR += library/python/runtime/main
  3538. PEERDIR += contrib/deprecated/python/subprocess32
  3539. when ($PYTHON_SQLITE3 != "no") {
  3540. PEERDIR += contrib/tools/python/src/Modules/_sqlite
  3541. }
  3542. }
  3543. when ($PYTHON_COVERAGE == "yes") {
  3544. PEERDIR+=library/python/coverage
  3545. }
  3546. when ($ARCH_PPC64LE == "yes") {
  3547. _MY_ALLOCATOR=SYSTEM
  3548. }
  3549. otherwise {
  3550. _MY_ALLOCATOR=J
  3551. }
  3552. ALLOCATOR($_MY_ALLOCATOR)
  3553. STRIP()
  3554. when ($BUILD_TYPE == "DEBUG") {
  3555. NO_STRIP=yes
  3556. }
  3557. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3558. NO_STRIP=yes
  3559. }
  3560. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3561. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3562. SET(MODULE_LANG PY2)
  3563. }
  3564. # tag:python-specific tag:codenav
  3565. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3566. PY3_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"py3yndex $TARGET"}
  3567. }
  3568. otherwise {
  3569. PY3_PROGRAM_LINK_EXE=$LINK_EXE
  3570. }
  3571. # tag:python-specific
  3572. ### @usage: _BASE_PY_PROGRAM #internal
  3573. ###
  3574. ### The base module for all Python 3.x binary programs. Adds linking logic, relevant module properties and
  3575. ### dependency on Python 3.x interpreter. Also adds import tests on all sources including libraries.
  3576. ### Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  3577. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules
  3578. ###
  3579. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3580. module _BASE_PY3_PROGRAM: _BASE_PROGRAM {
  3581. .CMD=PY3_PROGRAM_LINK_EXE
  3582. _ARCADIA_PYTHON3_ADDINCL()
  3583. PEERDIR(library/python/runtime_py3/main)
  3584. when ($PYTHON_SQLITE3 != "no") {
  3585. PEERDIR += contrib/tools/python3/src/Modules/_sqlite
  3586. }
  3587. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3588. NO_CHECK_IMPORTS_FOR_VALUE=
  3589. }
  3590. ADD_CHECK_PY_IMPORTS()
  3591. when ($ARCH_PPC64LE == "yes") {
  3592. _MY_ALLOCATOR=SYSTEM
  3593. }
  3594. otherwise {
  3595. _MY_ALLOCATOR=J
  3596. }
  3597. ALLOCATOR($_MY_ALLOCATOR)
  3598. STRIP()
  3599. when ($NO_PYTHON_INCLS != "yes") {
  3600. PEERDIR+=contrib/libs/python
  3601. }
  3602. when ($BUILD_TYPE == "DEBUG") {
  3603. NO_STRIP=yes
  3604. }
  3605. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3606. NO_STRIP=yes
  3607. }
  3608. when ($PYTHON_COVERAGE == "yes") {
  3609. PEERDIR+=library/python/coverage
  3610. }
  3611. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3612. PEERDIR += contrib/python/six
  3613. }
  3614. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3615. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2
  3616. SET(MODULE_LANG PY3)
  3617. }
  3618. # tag:python-specific
  3619. ### @usage: PY3_PROGRAM_BIN([progname])
  3620. ### Use instead of PY3_PROGRAM only if ya.make with PY3_PROGRAM() included in another ya.make
  3621. ### In all other cases use PY3_PROGRAM
  3622. module PY3_PROGRAM_BIN: _BASE_PY3_PROGRAM {
  3623. # Look's like we cannot avoid copy-paste util ymake supports multiple inheritance
  3624. # We need to attach coverage.extractor to every py_program target, except pytest targets
  3625. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  3626. }
  3627. # tag:java-specific
  3628. JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
  3629. # tag:java-specific
  3630. JDK_REAL_VERSION=
  3631. JDK_VERSION=
  3632. when ($JDK_VERSION == "18") {
  3633. JDK_REAL_VERSION=18
  3634. }
  3635. elsewhen ($JDK_VERSION == "17") {
  3636. JDK_REAL_VERSION=17
  3637. }
  3638. elsewhen ($JDK_VERSION == "16") {
  3639. JDK_REAL_VERSION=16
  3640. }
  3641. elsewhen ($JDK_VERSION == "15") {
  3642. JDK_REAL_VERSION=15
  3643. }
  3644. elsewhen ($JDK_VERSION == "14") {
  3645. JDK_REAL_VERSION=14
  3646. }
  3647. elsewhen ($JDK_VERSION == "13") {
  3648. JDK_REAL_VERSION=13
  3649. }
  3650. elsewhen ($JDK_VERSION == "12") {
  3651. JDK_REAL_VERSION=12
  3652. }
  3653. elsewhen ($JDK_VERSION == "11") {
  3654. JDK_REAL_VERSION=11
  3655. }
  3656. elsewhen ($JDK_VERSION == "10") {
  3657. JDK_REAL_VERSION=10
  3658. }
  3659. elsewhen ($JDK_VERSION == "8") {
  3660. JDK_REAL_VERSION=8
  3661. }
  3662. elsewhen ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
  3663. JDK_REAL_VERSION=8
  3664. }
  3665. otherwise {
  3666. JDK_REAL_VERSION=17
  3667. }
  3668. # tag:java-specific
  3669. # remove extra peerdir to jdk11 after https://st.yandex-team.ru/DEVTOOLS-8851 is done
  3670. when ($USE_SYSTEM_JDK) {
  3671. JDK_RESOURCE_PEERDIR=
  3672. }
  3673. otherwise {
  3674. when ($JDK_REAL_VERSION == "18") {
  3675. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk18 build/platform/java/jdk/jdk17
  3676. }
  3677. when ($JDK_REAL_VERSION == "17") {
  3678. # need jdk11 for spare parts in "host" platform
  3679. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk17 build/platform/java/jdk/jdk11
  3680. }
  3681. when ($JDK_REAL_VERSION == "16") {
  3682. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk16 build/platform/java/jdk/jdk17
  3683. }
  3684. when ($JDK_REAL_VERSION == "15") {
  3685. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk15 build/platform/java/jdk/jdk17
  3686. }
  3687. when ($JDK_REAL_VERSION == "14") {
  3688. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk14 build/platform/java/jdk/jdk17
  3689. }
  3690. when ($JDK_REAL_VERSION == "13") {
  3691. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk13 build/platform/java/jdk/jdk17
  3692. }
  3693. when ($JDK_REAL_VERSION == "12") {
  3694. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk12 build/platform/java/jdk/jdk17
  3695. }
  3696. when ($JDK_REAL_VERSION == "11") {
  3697. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk11 build/platform/java/jdk/jdk17
  3698. }
  3699. when ($JDK_REAL_VERSION == "10") {
  3700. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk10 build/platform/java/jdk/jdk17
  3701. }
  3702. when ($JDK_REAL_VERSION == "8") {
  3703. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk8 build/platform/java/jdk/jdk17
  3704. }
  3705. }
  3706. # tag:java-specific
  3707. when ($JDK_REAL_VERSION == "18") {
  3708. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
  3709. }
  3710. when ($JDK_REAL_VERSION == "17") {
  3711. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar17
  3712. }
  3713. when ($JDK_REAL_VERSION == "16") {
  3714. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar16
  3715. }
  3716. when ($JDK_REAL_VERSION == "15") {
  3717. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar15
  3718. }
  3719. when ($JDK_REAL_VERSION == "14") {
  3720. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar14
  3721. }
  3722. when ($JDK_REAL_VERSION == "13") {
  3723. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar13
  3724. }
  3725. when ($JDK_REAL_VERSION == "12") {
  3726. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar12
  3727. }
  3728. when ($JDK_REAL_VERSION == "11") {
  3729. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar11
  3730. }
  3731. when ($JDK_REAL_VERSION == "10") {
  3732. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar10
  3733. }
  3734. when ($JDK_REAL_VERSION == "8") {
  3735. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar8
  3736. }
  3737. # tag:java-specific
  3738. JAVAC_OPTS=
  3739. when ($USE_SYSTEM_JDK) {
  3740. JDK_RESOURCE=$USE_SYSTEM_JDK
  3741. }
  3742. otherwise {
  3743. when ($JDK_REAL_VERSION == "18") {
  3744. JDK_RESOURCE=$JDK18_RESOURCE_GLOBAL
  3745. }
  3746. when ($JDK_REAL_VERSION == "17") {
  3747. JDK_RESOURCE=$JDK17_RESOURCE_GLOBAL
  3748. }
  3749. when ($JDK_REAL_VERSION == "16") {
  3750. JDK_RESOURCE=$JDK16_RESOURCE_GLOBAL
  3751. }
  3752. when ($JDK_REAL_VERSION == "15") {
  3753. JDK_RESOURCE=$JDK15_RESOURCE_GLOBAL
  3754. }
  3755. when ($JDK_REAL_VERSION == "14") {
  3756. JDK_RESOURCE=$JDK14_RESOURCE_GLOBAL
  3757. }
  3758. when ($JDK_REAL_VERSION == "13") {
  3759. JDK_RESOURCE=$JDK13_RESOURCE_GLOBAL
  3760. }
  3761. when ($JDK_REAL_VERSION == "12") {
  3762. JDK_RESOURCE=$JDK12_RESOURCE_GLOBAL
  3763. }
  3764. when ($JDK_REAL_VERSION == "11") {
  3765. JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  3766. }
  3767. when ($JDK_REAL_VERSION == "10") {
  3768. JDK_RESOURCE=$JDK10_RESOURCE_GLOBAL
  3769. }
  3770. when ($JDK_REAL_VERSION == "8") {
  3771. JDK_RESOURCE=$JDK8_RESOURCE_GLOBAL
  3772. }
  3773. }
  3774. # tag:java-specific
  3775. when (!$USE_SYSTEM_ERROR_PRONE) {
  3776. when ($JDK_REAL_VERSION == "8" || $JDK_REAL_VERSION == "10") {
  3777. ERROR_PRONE_VERSION=2.3.1
  3778. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.3.1
  3779. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_3_1_RESOURCE_GLOBAL
  3780. }
  3781. 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") {
  3782. ERROR_PRONE_VERSION=2.7.1
  3783. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.7.1
  3784. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_7_1_RESOURCE_GLOBAL
  3785. }
  3786. elsewhen ($JDK_REAL_VERSION == "17" || $JDK_REAL_VERSION == "18") {
  3787. ERROR_PRONE_VERSION=2.10.0
  3788. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.10.0
  3789. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_10_0_RESOURCE_GLOBAL
  3790. }
  3791. otherwise {
  3792. ERROR_PRONE_VERSION=2.7.1
  3793. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  3794. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  3795. }
  3796. }
  3797. otherwise {
  3798. ERROR_PRONE_VERSION=2.7.1
  3799. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  3800. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  3801. }
  3802. # tag:java-specific
  3803. when ($USE_SYSTEM_UBERJAR) {
  3804. UBERJAR_RESOURCE=$USE_SYSTEM_UBERJAR
  3805. }
  3806. otherwise {
  3807. when ($JDK_REAL_VERSION == "18") {
  3808. UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
  3809. }
  3810. when ($JDK_REAL_VERSION == "17") {
  3811. UBERJAR_RESOURCE=$UBERJAR17_RESOURCE_GLOBAL
  3812. }
  3813. when ($JDK_REAL_VERSION == "16") {
  3814. UBERJAR_RESOURCE=$UBERJAR16_RESOURCE_GLOBAL
  3815. }
  3816. when ($JDK_REAL_VERSION == "15") {
  3817. UBERJAR_RESOURCE=$UBERJAR15_RESOURCE_GLOBAL
  3818. }
  3819. when ($JDK_REAL_VERSION == "14") {
  3820. UBERJAR_RESOURCE=$UBERJAR14_RESOURCE_GLOBAL
  3821. }
  3822. when ($JDK_REAL_VERSION == "13") {
  3823. UBERJAR_RESOURCE=$UBERJAR13_RESOURCE_GLOBAL
  3824. }
  3825. when ($JDK_REAL_VERSION == "12") {
  3826. UBERJAR_RESOURCE=$UBERJAR12_RESOURCE_GLOBAL
  3827. }
  3828. when ($JDK_REAL_VERSION == "11") {
  3829. UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
  3830. }
  3831. when ($JDK_REAL_VERSION == "10") {
  3832. UBERJAR_RESOURCE=$UBERJAR10_RESOURCE_GLOBAL
  3833. }
  3834. when ($JDK_REAL_VERSION == "8") {
  3835. UBERJAR_RESOURCE=$UBERJAR8_RESOURCE_GLOBAL
  3836. }
  3837. }
  3838. # tag:java-specific
  3839. when ($JDK_REAL_VERSION == "18") {
  3840. WITH_JDK_RESOURCE=$WITH_JDK18_RESOURCE_GLOBAL
  3841. }
  3842. when ($JDK_REAL_VERSION == "17") {
  3843. WITH_JDK_RESOURCE=$WITH_JDK17_RESOURCE_GLOBAL
  3844. }
  3845. when ($JDK_REAL_VERSION == "16") {
  3846. WITH_JDK_RESOURCE=$WITH_JDK16_RESOURCE_GLOBAL
  3847. }
  3848. when ($JDK_REAL_VERSION == "15") {
  3849. WITH_JDK_RESOURCE=$WITH_JDK15_RESOURCE_GLOBAL
  3850. }
  3851. when ($JDK_REAL_VERSION == "14") {
  3852. WITH_JDK_RESOURCE=$WITH_JDK14_RESOURCE_GLOBAL
  3853. }
  3854. when ($JDK_REAL_VERSION == "13") {
  3855. WITH_JDK_RESOURCE=$WITH_JDK13_RESOURCE_GLOBAL
  3856. }
  3857. when ($JDK_REAL_VERSION == "12") {
  3858. WITH_JDK_RESOURCE=$WITH_JDK12_RESOURCE_GLOBAL
  3859. }
  3860. when ($JDK_REAL_VERSION == "11") {
  3861. WITH_JDK_RESOURCE=$WITH_JDK11_RESOURCE_GLOBAL
  3862. }
  3863. when ($JDK_REAL_VERSION == "10") {
  3864. WITH_JDK_RESOURCE=$WITH_JDK10_RESOURCE_GLOBAL
  3865. }
  3866. when ($JDK_REAL_VERSION == "8") {
  3867. WITH_JDK_RESOURCE=$WITH_JDK8_RESOURCE_GLOBAL
  3868. }
  3869. # tag:java-specific
  3870. EXTERNAL_JAVA_JDK_RESOURCE=
  3871. EXTERNAL_JAVA_EXTRA_PEERDIR=
  3872. when ($USE_SYSTEM_JDK) {
  3873. EXTERNAL_JAVA_EXTRA_PEERDIR=
  3874. EXTERNAL_JAVA_JDK_RESOURCE=$USE_SYSTEM_JDK
  3875. }
  3876. elsewhen ($JDK_VERSION == "") {
  3877. EXTERNAL_JAVA_JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  3878. EXTERNAL_JAVA_EXTRA_PEERDIR=build/platform/java/jdk/jdk11
  3879. }
  3880. otherwise {
  3881. EXTERNAL_JAVA_JDK_RESOURCE=$JDK_RESOURCE
  3882. }
  3883. COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_java.py"} --javac-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/jar $JAVA_VCS_MF_ARG $PACKAGE_PREFIX_ARGS --jar-output $TARGET --srcs-jar-output ${output;suf=-sources.jar:REALPRJNAME} $AUTO_INPUT DELIM $JAVAC_OPTS DELIM $MANAGED_PEERS_CLOSURE ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  3884. 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
  3885. ARGS_DELIM="MACRO_CALLS_DELIM"
  3886. SYSTEM_PROPERTIES_VALUE=
  3887. ### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
  3888. ###
  3889. ### List of Key,Value pairs that will be available to test via System.getProperty().
  3890. ### FILE means that parst should be read from file specifies as Path.
  3891. ###
  3892. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3893. macro SYSTEM_PROPERTIES(Args...) {
  3894. SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
  3895. }
  3896. # tag:java-specific
  3897. JVM_ARGS_VALUE=
  3898. ### @usage: JVM_ARGS(Args...)
  3899. ###
  3900. ### Arguments to run Java programs in tests.
  3901. ###
  3902. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3903. macro JVM_ARGS(Args...) {
  3904. SET_APPEND(JVM_ARGS_VALUE $Args)
  3905. }
  3906. # tag:java-specific
  3907. CHECK_JAVA_DEPS_VALUE=
  3908. ### @usage: CHECK_JAVA_DEPS(<yes|no>)
  3909. ###
  3910. ### Check for different classes with duplicate name in classpath.
  3911. ###
  3912. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3913. macro CHECK_JAVA_DEPS(Arg) {
  3914. SET(CHECK_JAVA_DEPS_VALUE $Arg)
  3915. }
  3916. ERROR_PRONE_VALUE=
  3917. ### @usage: USE_ERROR_PRONE()
  3918. ###
  3919. ### Use errorprone instead of javac for .java compilation.
  3920. macro USE_ERROR_PRONE() {
  3921. SET(ERROR_PRONE_VALUE yes)
  3922. }
  3923. TEST_CWD_VALUE=
  3924. ### @usage: TEST_CWD(path)
  3925. ###
  3926. ### Defines working directory for test runs. Often used in conjunction with DATA() macro.
  3927. ### Is only used inside of the TEST modules.
  3928. ###
  3929. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3930. macro TEST_CWD(Arg) {
  3931. SET(TEST_CWD_VALUE $Arg)
  3932. }
  3933. # tag:java-specific
  3934. MAKE_UBERJAR_VALUE=
  3935. ### @usage: UBERJAR()
  3936. ###
  3937. ### UBERJAR is a single all-in-one jar-archive that includes all its Java dependencies (reachable PEERDIR).
  3938. ### It also supports shading classes inside the archive by moving them to a different package (similar to the maven-shade-plugin).
  3939. ### Use UBERJAR inside JAVA_PROGRAM module.
  3940. ###
  3941. ### You can use the following macros to configure the archive:
  3942. ### 1. UBERJAR_HIDING_PREFIX prefix for classes to shade (classes remain in their packages by default)
  3943. ### 2. UBERJAR_HIDE_EXCLUDE_PATTERN exclude classes matching this patterns from shading (if enabled).
  3944. ### 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)
  3945. ### 4. UBERJAR_MANIFEST_TRANSFORMER_MAIN add ManifestResourceTransformer class to uberjar processing and specify main-class
  3946. ### 5. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE add ManifestResourceTransformer class to uberjar processing and specify some attribute
  3947. ### 6. UBERJAR_APPENDING_TRANSFORMER add AppendingTransformer class to uberjar processing
  3948. ### 7. UBERJAR_SERVICES_RESOURCE_TRANSFORMER add ServicesResourceTransformer class to uberjar processing
  3949. ###
  3950. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  3951. ###
  3952. ### @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)
  3953. macro UBERJAR() {
  3954. SET(MAKE_UBERJAR_VALUE yes)
  3955. }
  3956. # tag:java-specific
  3957. UBERJAR_PREFIX_VALUE=
  3958. UBERJAR_PREFIX_FLAG=
  3959. ### @usage: UBERJAR_HIDING_PREFIX(Arg)
  3960. ###
  3961. ### Set prefix for classes to shade. All classes in UBERJAR will be moved into package prefixed with Arg.
  3962. ### Classes remain in their packages by default.
  3963. ###
  3964. ### @see: [UBERJAR](#macro_UBERJAR)
  3965. macro UBERJAR_HIDING_PREFIX(Arg) {
  3966. SET(UBERJAR_PREFIX_VALUE $Arg)
  3967. SET(UBERJAR_PREFIX_FLAG ${pre=--shade-prefix :Arg})
  3968. }
  3969. # tag:java-specific
  3970. UBERJAR_HIDE_EXCLUDE_VALUE=
  3971. UBERJAR_HIDE_EXCLUDE_FLAGS=
  3972. ### @usage: UBERJAR_HIDE_EXCLUDE_PATTERN(Args...)
  3973. ###
  3974. ### Exclude classes matching this patterns from shading (if enabled).
  3975. ### Pattern may contain '*' and '**' globs.
  3976. ### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
  3977. ###
  3978. ### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
  3979. macro UBERJAR_HIDE_EXCLUDE_PATTERN(Args...) {
  3980. SET_APPEND(UBERJAR_HIDE_EXCLUDE_VALUE $ARGS_DELIM $Args)
  3981. SET_APPEND(UBERJAR_HIDE_EXCLUDE_FLAGS ${pre=--shade-exclude :Args})
  3982. }
  3983. # tag:java-specific
  3984. UBERJAR_PATH_EXCLUDES=
  3985. UBERJAR_PATH_EXCLUDE_VALUE=
  3986. ### @usage: UBERJAR_PATH_EXCLUDE_PREFIX(Args...)
  3987. ###
  3988. ### Exclude classes matching this patterns from UBERJAR.
  3989. ### By default all dependencies of UBERJAR program will lend in a .jar archive.
  3990. ###
  3991. ### @see: [UBERJAR](#macro_UBERJAR)
  3992. macro UBERJAR_PATH_EXCLUDE_PREFIX(Args...) {
  3993. SET_APPEND(UBERJAR_PATH_EXCLUDE_VALUE $ARGS_DELIM $Args)
  3994. SET_APPEND(UBERJAR_PATH_EXCLUDES ${pre=--uber-exclude :Args})
  3995. }
  3996. # tag:java-specific
  3997. UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE=
  3998. UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG=
  3999. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main)
  4000. ###
  4001. ### Transform manifest.mf for UBERJAR() java programs, set main-class attribute
  4002. ###
  4003. ### @see: [UBERJAR](#macro_UBERJAR)
  4004. macro UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main) {
  4005. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE $Main)
  4006. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG --manifest-main $Main)
  4007. }
  4008. # tag:java-specific
  4009. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE=
  4010. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS=
  4011. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value)
  4012. ###
  4013. ### Transform manifest.mf for UBERJAR() java programs, set attribute
  4014. ###
  4015. ### @see: [UBERJAR](#macro_UBERJAR)
  4016. macro UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value) {
  4017. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Value)
  4018. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:${Value})
  4019. }
  4020. # tag:java-specific
  4021. UBERJAR_APPENDING_TRANSFORMER_VALUE=
  4022. UBERJAR_APPENDING_TRANSFORMER_FLAGS=
  4023. ### @usage: UBERJAR_APPENDING_TRANSFORMER(Resource)
  4024. ###
  4025. ### Add AppendingTransformer for UBERJAR() java programs
  4026. ###
  4027. ### Parameters:
  4028. ### - Resource - Resource name
  4029. ###
  4030. ### @see: [UBERJAR](#macro_UBERJAR)
  4031. macro UBERJAR_APPENDING_TRANSFORMER(Resources...) {
  4032. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_VALUE $ARGS_DELIM $Resources)
  4033. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_FLAGS ${pre=--append-transformer :Resources})
  4034. }
  4035. # tag:java-specific
  4036. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE=
  4037. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG=
  4038. ### @usage: UBERJAR_SERVICES_RESOURCE_TRANSFORMER()
  4039. ###
  4040. ### Add ServicesResourceTransformer for UBERJAR() java programs
  4041. ###
  4042. ### @see: [UBERJAR](#macro_UBERJAR)
  4043. macro UBERJAR_SERVICES_RESOURCE_TRANSFORMER() {
  4044. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE yes)
  4045. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG --service-transformer)
  4046. }
  4047. # tag:idea-specific
  4048. IDEA_EXCLUDE_DIRS_VALUE=
  4049. ### @usage: IDEA_EXCLUDE_DIRS(<excluded dirs>)
  4050. ###
  4051. ### Exclude specified directories from an idea project generated by ya ide idea
  4052. ### Have no effect on regular build.
  4053. macro IDEA_EXCLUDE_DIRS(Args...) {
  4054. SET_APPEND(IDEA_EXCLUDE_DIRS_VALUE $Args)
  4055. }
  4056. # tag:idea-specific
  4057. IDEA_RESOURCE_DIRS_VALUE=
  4058. ### @usage: IDEA_RESOURCE_DIRS(<additional dirs>)
  4059. ###
  4060. ### Set specified resource directories in an idea project generated by ya ide idea
  4061. ### Have no effect on regular build.
  4062. macro IDEA_RESOURCE_DIRS(Args...) {
  4063. SET_APPEND(IDEA_RESOURCE_DIRS_VALUE $Args)
  4064. }
  4065. # tag:idea-specific
  4066. IDEA_MODULE_NAME_VALUE=
  4067. ### @usage: IDEA_MODULE_NAME(module_name)
  4068. ###
  4069. ### Set module name in an idea project generated by ya ide idea
  4070. ### Have no effect on regular build.
  4071. macro IDEA_MODULE_NAME(Name) {
  4072. SET(IDEA_MODULE_NAME_VALUE $Name)
  4073. }
  4074. # tag:java-specific
  4075. JAVAC_FLAGS_VALUE=
  4076. ### @usage: JAVAC_FLAGS(Args...)
  4077. ###
  4078. ### Set additional Java compilation flags.
  4079. macro JAVAC_FLAGS(Args...) {
  4080. SET_APPEND(JAVAC_OPTS $Args)
  4081. SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
  4082. }
  4083. # tag:java-specific
  4084. ENABLE_PREVIEW_VALUE=
  4085. ### @usage: ENABLE_PREVIEW()
  4086. ###
  4087. ### Enable java preview features.
  4088. macro ENABLE_PREVIEW() {
  4089. SET_APPEND(JVM_ARGS_VALUE --enable-preview)
  4090. SET_APPEND(JAVAC_OPTS --enable-preview --release $JDK_REAL_VERSION)
  4091. SET_APPEND(JAVAC_FLAGS_VALUE --enable-preview --release $JDK_REAL_VERSION)
  4092. SET(ENABLE_PREVIEW_VALUE yes)
  4093. }
  4094. # tag:java-specific
  4095. SAVE_JAVAC_GENERATED_SRCS=
  4096. SAVE_JAVAC_GENERATED_SRCS_DIR=
  4097. SAVE_JAVAC_GENERATED_SRCS_TAR=
  4098. when ($SAVE_JAVAC_GENERATED_SRCS) {
  4099. SAVE_JAVAC_GENERATED_SRCS_DIR=${BINDIR}/__javac_generated_srcs__
  4100. SAVE_JAVAC_GENERATED_SRCS_TAR=${BINDIR}/javac_generated.tar
  4101. JAVAC_FLAGS_VALUE+=-s $SAVE_JAVAC_GENERATED_SRCS_DIR
  4102. }
  4103. # tag:java-specific
  4104. MAVEN_GROUP_ID_VALUE=
  4105. ### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
  4106. ###
  4107. ### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
  4108. ### Have no effect on regular build.
  4109. macro MAVEN_GROUP_ID(Arg) {
  4110. SET(MAVEN_GROUP_ID_VALUE $Arg)
  4111. }
  4112. # tag:java-specific
  4113. ANNOTATION_PROCESSOR_VALUE=
  4114. ### @usage: ANNOTATION_PROCESSOR(processors...)
  4115. ###
  4116. ### The macro is in development.
  4117. ### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
  4118. macro ANNOTATION_PROCESSOR(Args...) {
  4119. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Args)
  4120. }
  4121. EXCLUDE_VALUE=
  4122. ### EXCLUDE(prefixes)
  4123. ###
  4124. ### The macro is in development.
  4125. ### Specifies which libraries should be excluded from the classpath.
  4126. macro EXCLUDE(Args...) {
  4127. SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args)
  4128. }
  4129. # tag:java-specific
  4130. JAVA_SRCS_VALUE=
  4131. ### @usage: JAVA_SRCS(srcs)
  4132. ###
  4133. ### Specify java source files and resources. A macro can be contained in any of four java modules.
  4134. ### Keywords:
  4135. ### 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.
  4136. ### 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.
  4137. ###
  4138. ### @example:
  4139. ### - example/ya.make
  4140. ###
  4141. ### JAVA_PROGRAM()
  4142. ### JAVA_SRCS(SRCDIR src/main/java **/*)
  4143. ### END()
  4144. ###
  4145. ### - example/src/main/java/ru/yandex/example/HelloWorld.java
  4146. ###
  4147. ### package ru.yandex.example;
  4148. ### public class HelloWorld {
  4149. ### public static void main(String[] args) {
  4150. ### System.out.println("Hello, World!");
  4151. ### }
  4152. ### }
  4153. ###
  4154. ### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
  4155. macro JAVA_SRCS(Args...) {
  4156. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  4157. }
  4158. # tag:java-specific
  4159. JAVA_ADD_DLLS_VALUE=no
  4160. macro ADD_DLLS_TO_JAR() {
  4161. SET(JAVA_ADD_DLLS_VALUE yes)
  4162. }
  4163. # tag:java-specific
  4164. MANAGED_PEERS=
  4165. MANAGED_PEERS_CLOSURE=
  4166. RUN_JAVA_PROGRAM_MANAGED=
  4167. MANAGEABLE_PEERS_ROOTS=contrib/java
  4168. HAS_MANAGEABLE_PEERS=no
  4169. PROPAGATES_MANAGEABLE_PEERS=no
  4170. YMAKE_CLASSPATH_CHECKS=yes
  4171. # All items of this list must be PEERS, GHOST PEERS or TOOLS of the test module or module itself.
  4172. # All items of this list must has at least one of HAS_MANAGEABLE_PEERS or PROPAGATES_MANAGEABLE_PEERS flags set yes.
  4173. # This variable is used by JUnit tests but not TestNG.
  4174. TEST_CLASSPATH_VALUE=
  4175. # Calculated and replaced by ymake can be used in DART DATA
  4176. TEST_CLASSPATH_MANAGED=
  4177. # tag:java-specific
  4178. DEPENDENCY_MANAGEMENT_VALUE=
  4179. ### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
  4180. ###
  4181. ### 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.
  4182. ###
  4183. ### For example, if the module has PEERDIR (contrib/java/junit/junit), and
  4184. ### 1. specifies DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12),
  4185. ### the PEERDIR is automatically replaced by contrib/java/junit/junit/4.12;
  4186. ### 2. doesn't specify DEPENDENCY_MANAGEMENT, PEERDIR automatically replaced
  4187. ### with the default from contrib/java/junit/junit/ya.make.
  4188. ### These defaults are always there and are supported by maven-import, which puts
  4189. ### there the maximum version available in contrib/java.
  4190. ###
  4191. ### 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.
  4192. ###
  4193. ### If some module has both DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12) and PERDIR(contrib/java/junit/junit/4.11), the PEERDIR wins.
  4194. ###
  4195. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  4196. macro DEPENDENCY_MANAGEMENT(Args...) {
  4197. SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
  4198. _GHOST_PEERDIR($Args)
  4199. }
  4200. # tag:java-specific
  4201. WITH_JDK_VALUE=
  4202. ### @usage: WITH_JDK()
  4203. ###
  4204. ### Add directory with JDK to JAVA_PROGRAM output
  4205. macro WITH_JDK() {
  4206. SET(WITH_JDK_VALUE yes)
  4207. }
  4208. # tag:kotlin-specific
  4209. WITH_KOTLIN_VALUE=
  4210. ### @usage: WITH_KOTLIN()
  4211. ###
  4212. ### Compile kotlin source code in this java module
  4213. macro WITH_KOTLIN() {
  4214. SET(WITH_KOTLIN_VALUE yes)
  4215. }
  4216. # tag:java-specific
  4217. WITH_GROOVY_VALUE=
  4218. ### @usage: WITH_GROOVY()
  4219. ###
  4220. ### Compile groovy source code in this java module
  4221. macro WITH_GROOVY() {
  4222. SET(WITH_GROOVY_VALUE yes)
  4223. }
  4224. # tag:kotlin-specific
  4225. KOTLINC_FLAGS_VALUE=-Xjvm-default=all
  4226. ### @usage: KOTLINC_FLAGS(-flags)
  4227. ###
  4228. ### Set additional Kotlin compilation flags.
  4229. macro KOTLINC_FLAGS(Args...) {
  4230. SET_APPEND(KOTLINC_OPTS_VALUE $Args)
  4231. }
  4232. # tag:kotlin-specific
  4233. WITH_KOTLINC_PLUGIN_ALLOPEN=
  4234. ### @usage: WITH_KOTLINC_ALLOPEN(-flags)
  4235. ###
  4236. ### Enable allopen kotlin compiler plugin https://kotlinlang.org/docs/all-open-plugin.html
  4237. macro WITH_KOTLINC_ALLOPEN(Options...) {
  4238. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.allopen\::Options})
  4239. SET(WITH_KOTLINC_PLUGIN_ALLOPEN yes)
  4240. }
  4241. # tag:kotlin-specific
  4242. WITH_KOTLINC_PLUGIN_NOARG=
  4243. ### @usage: WITH_KOTLINC_NOARG(-flags)
  4244. ###
  4245. ### Enable noarg kotlin compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html
  4246. macro WITH_KOTLINC_NOARG(Options...) {
  4247. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.noarg\::Options})
  4248. SET(WITH_KOTLINC_PLUGIN_NOARG yes)
  4249. }
  4250. # tag:kotlin-specific
  4251. KOTLIN_VERSION=1.6.21
  4252. KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.6.21/ya.dependency_management.inc
  4253. GROOVY_VERSION=3.0.5
  4254. # tag:java-specific
  4255. DIRECT_DEPS_ONLY_VALUE=
  4256. ### @usage: DIRECT_DEPS_ONLY
  4257. ###
  4258. ### Add direct PEERDIR's only in java compile classpath
  4259. macro DIRECT_DEPS_ONLY() {
  4260. SET(DIRECT_DEPS_ONLY_VALUE yes)
  4261. }
  4262. # tag:java-specific
  4263. JAVA_EXTERNAL_DEPENDENCIES_VALUE=
  4264. ### @usage: JAVA_EXTERNAL_DEPENDENCIES(file1 file2 ...)
  4265. ###
  4266. ### Add non-source java external build dependency (like lombok config file)
  4267. macro JAVA_EXTERNAL_DEPENDENCIES(Args...) {
  4268. SET_APPEND(JAVA_EXTERNAL_DEPENDENCIES_VALUE $Args)
  4269. }
  4270. # tag:java-specific
  4271. ### @usage _JAVA_PLACEHOLDER #internal
  4272. ### The base module for all Java modules. Defines common properties and dependencies.
  4273. module _JAVA_PLACEHOLDER: _BASE_UNIT {
  4274. .CMD=TOUCH_JAVA_UNIT
  4275. .FINAL_TARGET=yes
  4276. .ALLOWED=DEPENDENCY_MANAGEMENT EXCLUDE
  4277. .ALIASES=RUN_JAVA_PROGRAM=_RUN_JBUILD_PROGRAM
  4278. HAS_MANAGEABLE_PEERS=yes
  4279. DYNAMIC_LINK=yes
  4280. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL JAR_COMPILATION
  4281. PEERDIR(build/platform/java/jdk)
  4282. PEERDIR+=$JDK_RESOURCE_PEERDIR
  4283. when($MAKE_UBERJAR_VALUE) {
  4284. PEERDIR+=build/platform/java/uberjar
  4285. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  4286. }
  4287. when($ERROR_PRONE_VALUE) {
  4288. # Jbuild assumes hardcoded resource name https://a.yandex-team.ru/arc_vcs/devtools/ya/jbuild/gen/consts/__init__.py?rev=1739368ed5aaa585b8300b84e5dea708a2bedd3a#L130
  4289. # adding default peerdir as a hack to make `ya ide idea` and `ya maven-export` work for now
  4290. PEERDIR+=build/platform/java/error_prone
  4291. PEERDIR+=$ERROR_PRONE_PEERDIR
  4292. }
  4293. # in the ideal world this statement must be under condition bellow
  4294. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
  4295. when($WITH_KOTLIN_VALUE) {
  4296. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  4297. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  4298. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  4299. }
  4300. when($WITH_KOTLINC_PLUGIN_NOARG) {
  4301. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  4302. }
  4303. }
  4304. when($WITH_GROOVY_VALUE) {
  4305. PEERDIR+=build/platform/java/groovy contrib/java/org/codehaus/groovy/groovy/${GROOVY_VERSION}
  4306. }
  4307. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
  4308. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  4309. }
  4310. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  4311. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  4312. }
  4313. JAVA_DEPENDENCIES_CONFIGURATION(FORBID_DEFAULT_VERSIONS)
  4314. DISABLE(NEED_PLATFORM_PEERDIRS)
  4315. NO_PLATFORM()
  4316. JAVA_MODULE()
  4317. # flatbuffers-java
  4318. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  4319. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  4320. # protobuf-java
  4321. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  4322. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  4323. # protobuf-javalite
  4324. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  4325. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  4326. # protobuf-java-util
  4327. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  4328. 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})
  4329. SET(MODULE_LANG JAVA)
  4330. }
  4331. # tag:java-specific
  4332. JAVA_CLASSPATH_CMD_TYPE_VALUE=
  4333. # tag:java-specific
  4334. ### @usage:TEST_JAVA_CLASSPATH_CMD_TYPE(Type)
  4335. ### Available types: MANIFEST(default), COMMAND_FILE, LIST
  4336. ### Method for passing a classpath value to a java command line
  4337. ### MANIFEST via empty jar file with manifest that contains Class-Path attribute
  4338. ### COMMAND_FILE via @command_file
  4339. ### LIST via flat args
  4340. macro TEST_JAVA_CLASSPATH_CMD_TYPE(Type) {
  4341. SET(JAVA_CLASSPATH_CMD_TYPE_VALUE $Type)
  4342. }
  4343. # tag:java-specific
  4344. IGNORE_JAVA_DEPENDENCIES_CONFIGURATION=no
  4345. JAVA_DEPENDENCIES_CONFIGURATION_VALUE=
  4346. # tag:java-specific
  4347. ### @usage JAVA_DEPENDENCIES_CONFIGURATION(Vetos...)
  4348. ### Validate contrib/java dependencies
  4349. ### Valid arguments
  4350. ### FORBID_DIRECT_PEERDIRS - fail when module have direct PEERDIR (with version) (non-transitive)
  4351. ### FORBID_DEFAULT_VERSIONS - fail when module have PEERDIR to library with default (last) version (transitive)
  4352. ### FORBID_CONFLICT - fail when module have resolved without DEPENDENCY_MANAGEMENT version conflict (transitive)
  4353. ### FORBID_CONFLICT_DM - fail when module have resolved with DEPENDENCY_MANAGEMENT version conflict (transitive)
  4354. ### FORBID_CONFLICT_DM_RECENT - like FORBID_CONFLICT_DM but fail only when dependency have more recent version than specified in DEPENDENCY_MANAGEMENT
  4355. ### REQUIRE_DM - all dependencies must be specified in DEPENDENCY_MANAGEMENT (transitive)
  4356. macro JAVA_DEPENDENCIES_CONFIGURATION(Args...) {
  4357. SET_APPEND(JAVA_DEPENDENCIES_CONFIGURATION_VALUE $Args)
  4358. }
  4359. # tag:java-specific
  4360. # TODO(DEVTOOLS-6901): remove this variable when there are no more references to it in jbuild
  4361. JAVA_FORBIDDEN_LIBRARIES_VALUE=
  4362. # tag:java-specific
  4363. JAR_INCLUDE_FILTER_VALUE=
  4364. JAR_EXCLUDE_FILTER_VALUE=
  4365. # tag:java-specific
  4366. ### @usage:JAR_INCLUDE(Filters...)
  4367. ### Filter .jar file content: keep only matched files
  4368. ### * and ** patterns are supported (like JAVA_SRCS)
  4369. macro JAR_INCLUDE(Filters...) {
  4370. SET_APPEND(JAR_INCLUDE_FILTER_VALUE $Filters)
  4371. }
  4372. # tag:java-specific
  4373. ### @usage:JAR_EXCLUDE(Filters...)
  4374. ### Filter .jar file content: remove matched files
  4375. ### * and ** patterns are supported (like JAVA_SRCS)
  4376. macro JAR_EXCLUDE(Filters...) {
  4377. SET_APPEND(JAR_EXCLUDE_FILTER_VALUE $Filters)
  4378. }
  4379. # tag:sandbox-specific
  4380. ### @usage: SANDBOX_TASK([Name])
  4381. ###
  4382. ### Multimodule describing Sandbox task (Python code that can be executed by Sandbox system).
  4383. ###
  4384. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_TASKs as libraries.
  4385. ### The final artifact is provided when SANDBOX_TASK is referred to by DEPENDS and BUNDLE macros.
  4386. ### As PEERDIR target, it works like regular PY2_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_TASKs.
  4387. ###
  4388. ### Currently Sandbox supports only Python 2.x, so both variants will be compatible only with Python 2.x modules
  4389. ### and will select multimodule variants accordingly.
  4390. ###
  4391. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4392. multimodule SANDBOX_TASK {
  4393. module SB_TASK_BIN: _PY2_PROGRAM {
  4394. PY_MAIN(sandbox.taskbox.binary)
  4395. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4396. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4397. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4398. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4399. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4400. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4401. when ($FAIL_PY2 == "yes") {
  4402. _OK=no
  4403. }
  4404. elsewhen ($OPENSOURCE != "yes") {
  4405. PEERDIR+=build/rules/py2_deprecation
  4406. }
  4407. ASSERT(_OK You are using deprecated Python2-only code (SANDBOX_TASK). Please consider rewriting to 2/3-compatible code.)
  4408. }
  4409. module PY2: PY2_LIBRARY {
  4410. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4411. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4412. }
  4413. }
  4414. # tag:sandbox-specific
  4415. multimodule SANDBOX_PY23_TASK {
  4416. module SB_TASK_BIN: _PY2_PROGRAM {
  4417. PY_MAIN(sandbox.taskbox.binary)
  4418. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4419. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4420. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4421. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4422. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4423. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4424. }
  4425. module PY2: PY2_LIBRARY {
  4426. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4427. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4428. OBJ_SUF=.py2
  4429. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  4430. PYTHON_TYPE_FOR_CYTHON=PY2
  4431. }
  4432. module PY3: PY3_LIBRARY {
  4433. when ($MSVC == "yes" || $CYGWIN == "yes") {
  4434. MODULE_PREFIX=py3
  4435. }
  4436. otherwise {
  4437. MODULE_PREFIX=libpy3
  4438. }
  4439. OBJ_SUF=.py3
  4440. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  4441. PYTHON_TYPE_FOR_CYTHON=PY2
  4442. PEERDIR(sandbox/sdk2)
  4443. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4444. }
  4445. }
  4446. # tag:sandbox-specific
  4447. ### @usage: SANDBOX_PY3_TASK([Name])
  4448. ###
  4449. ### Multimodule describing Sandbox task (Python3 code that can be executed by Sandbox system).
  4450. ###
  4451. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_PY3_TASKs as libraries.
  4452. ### The final artifact is provided when SANDBOX_PY3_TASK is referred to by DEPENDS and BUNDLE macros.
  4453. ### As PEERDIR target, it works like regular PY3_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_PY3_TASKs.
  4454. ###
  4455. ### Currently Sandbox supports Python 3.x only in binary tasks, both variants will be compatible only with Python 3.x and py23 libraries
  4456. ### and will select multimodule variants accordingly.
  4457. ###
  4458. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4459. multimodule SANDBOX_PY3_TASK {
  4460. module SB_TASK_BIN: PY3_PROGRAM_BIN {
  4461. PY_MAIN(sandbox.taskbox.binary)
  4462. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/taskbox/worker)
  4463. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4464. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4465. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4466. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4467. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4468. }
  4469. module PY3: PY3_LIBRARY {
  4470. PEERDIR(sandbox/sdk2)
  4471. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4472. }
  4473. }
  4474. # tag:python-specific tag:internal
  4475. NO_PYTHON_INCLS=no
  4476. ### @usage: NO_PYTHON_INCLUDES() # internal
  4477. ###
  4478. ### Disable dependencies on libraries providing Python headers.
  4479. ### This is only used in Python libraries themselves to avoid PEERDIR loops.
  4480. macro NO_PYTHON_INCLUDES() {
  4481. ENABLE(NO_PYTHON_INCLS)
  4482. }
  4483. # tag:python-specific
  4484. ### @usage: PYTHON2_ADDINCL()
  4485. ###
  4486. ### This macro adds include path for Python headers (Python 2.x variant) without PEERDIR.
  4487. ### This should be used in 2 cases only:
  4488. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4489. ### - In system Python libraries themselves since proper PEERDIR there may create a loop;
  4490. ### In all other cases use USE_PYTHON2 macro instead.
  4491. ###
  4492. ### Never use this macro in PY2_PROGRAM, PY2_LIBRARY and PY23_LIBRARY: they have everything needed by default.
  4493. ###
  4494. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4495. macro PYTHON2_ADDINCL() {
  4496. _PYTHON_ADDINCL()
  4497. SET(MODULE_TAG PY2_NATIVE)
  4498. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4499. }
  4500. # tag:python-specific tag:internal
  4501. ### @usage: _ARCADIA_PYTHON_ADDINCL() # internal
  4502. ### This macro sets up Python headers for modules with Arcadia python (e.g. PY2_LIBRARY) and configures module as Python 2.x.
  4503. macro _ARCADIA_PYTHON_ADDINCL() {
  4504. _PYTHON_ADDINCL()
  4505. SET(MODULE_TAG PY2)
  4506. SET(PEERDIR_TAGS PY2 PY2_NATIVE PY_PROTO PY2_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4507. }
  4508. # tag:python-specific tag:internal
  4509. ### @usage: _PYTHON_ADDINCL() # internal
  4510. ### This macro sets up Python 2.x headers for both Arcadia and non-Arcadia python.
  4511. macro _PYTHON_ADDINCL() {
  4512. SET(PYTHON2 yes)
  4513. SET(PYTHON3 no)
  4514. when ($USE_ARCADIA_PYTHON == "yes") {
  4515. ADDINCL+=GLOBAL contrib/libs/python/Include
  4516. CFLAGS+=-DARCADIA_PYTHON_UNICODE_SIZE=$ARCADIA_PYTHON_UNICODE_SIZE
  4517. }
  4518. otherwise {
  4519. when ($USE_SYSTEM_PYTHON) {
  4520. PEERDIR+=build/platform/python
  4521. }
  4522. otherwise {
  4523. CFLAGS+=$PYTHON_INCLUDE
  4524. }
  4525. }
  4526. }
  4527. # tag:python-specific
  4528. ### @usage: PYTHON3_ADDINCL()
  4529. ###
  4530. ### This macro adds include path for Python headers (Python 3.x variant).
  4531. ### This should be used in 2 cases only:
  4532. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4533. ### - In system Python libraries themselves since peerdir there may create a loop;
  4534. ### In all other cases use USE_PYTHON3() macro instead.
  4535. ###
  4536. ### Never use this macro in PY3_PROGRAM and PY3_LIBRARY and PY23_LIBRARY: they have everything by default.
  4537. ###
  4538. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4539. macro PYTHON3_ADDINCL() {
  4540. _PYTHON3_ADDINCL()
  4541. SET(MODULE_TAG PY3_NATIVE)
  4542. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY3_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4543. }
  4544. # tag:python-specific tag:internal
  4545. ### @usage: _ARCADIA_PYTHON3_ADDINCL() # internal
  4546. ###
  4547. ### This macro sets up Python3 headers for modules with Arcadia python (e.g. PY3_LIBRARY) and configures module as Python 3.x.
  4548. macro _ARCADIA_PYTHON3_ADDINCL() {
  4549. _PYTHON3_ADDINCL()
  4550. SET(MODULE_TAG PY3)
  4551. SET(MODULE_LANG PY3)
  4552. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE PY3_PROTO PY3_FBS PY3_SSQLS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4553. }
  4554. # tag:python-specific tag:internal
  4555. ### @usage: _PYTHON_ADDINCL() # internal
  4556. ###
  4557. ### This macro sets up Python 3.x headers for both Arcadia and non-Arcadia python.
  4558. macro _PYTHON3_ADDINCL() {
  4559. SET(PYTHON3 yes)
  4560. SET(PYTHON2 no)
  4561. when ($USE_ARCADIA_PYTHON == "yes") {
  4562. CFLAGS+=-DUSE_PYTHON3
  4563. ADDINCL+=GLOBAL contrib/libs/python/Include
  4564. }
  4565. otherwise {
  4566. when ($USE_SYSTEM_PYTHON) {
  4567. PEERDIR+=build/platform/python
  4568. }
  4569. otherwise {
  4570. CFLAGS+=$PYTHON_INCLUDE
  4571. }
  4572. }
  4573. }
  4574. # tag:python-specific
  4575. ### @usage: USE_PYTHON2()
  4576. ###
  4577. ### This adds Python 2.x runtime library to your LIBRARY and makes it Python2-compatible.
  4578. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4579. ###
  4580. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4581. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4582. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4583. ###
  4584. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4585. macro USE_PYTHON2() {
  4586. _ARCADIA_PYTHON_ADDINCL()
  4587. SET(PEERDIR_TAGS PY2 PY2_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4588. PEERDIR(contrib/libs/python)
  4589. }
  4590. # tag:python-specific
  4591. ### @usage: USE_PYTHON3()
  4592. ###
  4593. ### This adds Python3 library to your LIBRARY and makes it Python3-compatible.
  4594. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4595. ###
  4596. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4597. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4598. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4599. ###
  4600. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4601. macro USE_PYTHON3() {
  4602. _ARCADIA_PYTHON3_ADDINCL()
  4603. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4604. PEERDIR(contrib/libs/python)
  4605. when ($USE_ARCADIA_PYTHON == "yes") {
  4606. PEERDIR+=library/python/runtime_py3
  4607. }
  4608. }
  4609. # tag:python-specific
  4610. when ($PERL_DEFAULT_PEERDIR == "yes") {
  4611. when (($PERLXS == "yes") || ($PERLXSCPP == "yes") || ($USE_PERL == "yes")) {
  4612. PEERDIR+=build/platform/perl
  4613. }
  4614. }
  4615. # tag:perl-specific
  4616. ### @usage: USE_PERL_LIB()
  4617. ### Add dependency on Perl to your LIBRARY
  4618. macro USE_PERL_LIB() {
  4619. PEERDIR(build/platform/perl)
  4620. }
  4621. # tag:perl-specific
  4622. ### @usage: USE_PERL_514_LIB()
  4623. ### Add dependency on Perl 5.14 to your LIBRARY
  4624. macro USE_PERL_514_LIB() {
  4625. SET(PERL_SDK ubuntu-12)
  4626. SET(PERL_DEFAULT_PEERDIR no)
  4627. PEERDIR(build/platform/perl/5.14)
  4628. }
  4629. # tag:perl-specific
  4630. ### @usage: ADD_PERL_MODULE(Dir ModuleName)
  4631. ### Add dependency on specified Perl module to the library
  4632. macro ADD_PERL_MODULE(Dir, Module) {
  4633. PEERDIR($Dir)
  4634. SET_APPEND(modules $Module)
  4635. }
  4636. # tag:allocator
  4637. ### @usage: ALLOCATOR(Alloc) # Default: LF
  4638. ###
  4639. ### Set memory allocator implementation for the PROGRAM()/DLL() module.
  4640. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
  4641. ###
  4642. ### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU".
  4643. ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
  4644. ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
  4645. ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
  4646. ### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
  4647. ### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
  4648. ### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
  4649. ### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
  4650. ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
  4651. ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
  4652. ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
  4653. ### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
  4654. ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
  4655. ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
  4656. ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
  4657. ### - SYSTEM - Use target system allocator
  4658. ### - FAKE - Don't link with any allocator
  4659. ###
  4660. ### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
  4661. macro ALLOCATOR(Alloc) {
  4662. SET(ALLOCATOR $Alloc)
  4663. when ($ALLOCATOR in [ "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU" ]) {
  4664. }
  4665. otherwise {
  4666. PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
  4667. }
  4668. }
  4669. when ($MIC_ARCH == "yes") {
  4670. CFLAGS+=-mmic
  4671. LDFLAGS+=-mmic
  4672. }
  4673. when ($USE_OPENMP == "yes") {
  4674. PEERDIR+=contrib/libs/openmp
  4675. }
  4676. when ($STRIP == "yes" && $NO_STRIP != "yes") {
  4677. STRIP_FLAG=$LD_STRIP_FLAG
  4678. DWARF_COMMAND=
  4679. GO_LINK_FLAGS_VALUE+=-s
  4680. }
  4681. when ($NO_LINKER_DCE != "yes") {
  4682. DCE_FLAG=$LD_DCE_FLAG
  4683. }
  4684. when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
  4685. ICF_FLAG=$LD_ICF_FLAG
  4686. }
  4687. OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
  4688. STRIP_TOOL=$STRIP_TOOL_VENDOR
  4689. NEED_BINUTILS_PEERDIR=
  4690. BINUTILS_USED=
  4691. when (!$OBJCOPY_TOOL_VENDOR) {
  4692. OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
  4693. NEED_BINUTILS_PEERDIR=yes
  4694. }
  4695. when (!$STRIP_TOOL_VENDOR) {
  4696. STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
  4697. NEED_BINUTILS_PEERDIR=yes
  4698. }
  4699. SPLIT_DWARF_VALUE=no
  4700. NO_SPLIT_DWARF=no
  4701. when ($STRIP_DEBUG_INFO) {
  4702. SPLIT_DWARF_VALUE=yes
  4703. NO_SPLIT_DWARF=no
  4704. }
  4705. ### @usage: SPLIT_DWARF()
  4706. ###
  4707. ### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
  4708. ### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
  4709. macro SPLIT_DWARF() {
  4710. SET(SPLIT_DWARF_VALUE yes)
  4711. }
  4712. SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
  4713. when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
  4714. DWARF_COMMAND+= \
  4715. $OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
  4716. $STRIP_TOOL --strip-debug $TARGET && \
  4717. $OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
  4718. BINUTILS_USED=yes
  4719. }
  4720. ### @usage: EXTRALIBS_STATIC(Libs...)
  4721. ###
  4722. ### Add the specified external static libraries to the program link
  4723. macro EXTRALIBS_STATIC(Args...) {
  4724. LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
  4725. }
  4726. ### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
  4727. ###
  4728. ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
  4729. macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
  4730. __translatename_lower=${tolower:Name}
  4731. __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
  4732. RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
  4733. }
  4734. ### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
  4735. ###
  4736. ### Generate transliteration dictionary code
  4737. ### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
  4738. macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
  4739. __translitname_lower=${tolower:Name}
  4740. __translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
  4741. __untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
  4742. __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
  4743. __gentrie_dir=dict/tools/make_untranslit_trie
  4744. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
  4745. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
  4746. RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
  4747. }
  4748. # tag:python-specific tag:proto tag:deprecated
  4749. ### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated
  4750. ###
  4751. ### Generate python bindings for protobuf files.
  4752. ### Macro is obsolete and not recommended for use!
  4753. macro GENERATE_PY_PROTOS(FILES...) {
  4754. foreach (FILE : $FILES) {
  4755. _PY_PROTO_CMD($FILE)
  4756. }
  4757. }
  4758. # tag:python-specific tag:proto
  4759. macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) {
  4760. foreach (FILE : $FILES) {
  4761. _PY_PROTO_CMD_INTERNAL($FILE)
  4762. }
  4763. }
  4764. # tag:python-specific
  4765. macro _GENERATE_PY_EVS_INTERNAL(FILES...) {
  4766. foreach (FILE : $FILES) {
  4767. _PY_EVLOG_CMD_INTERNAL($FILE)
  4768. }
  4769. }
  4770. macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4771. .CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"}
  4772. .SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST}
  4773. }
  4774. ### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
  4775. ###
  4776. ### Copy file to build root. It is possible to change both location and the name.
  4777. ###
  4778. ### Parameters:
  4779. ### - File - Source file name.
  4780. ### - Destination - Output file name.
  4781. ### - AUTO - Consider copied file for further processing automatically.
  4782. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
  4783. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  4784. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type)
  4785. ### and set of dependencies
  4786. ###
  4787. ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
  4788. ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
  4789. macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4790. .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  4791. .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination)
  4792. }
  4793. ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
  4794. ###
  4795. ### Copy file to build root the same way as it is done for COPY_FILE, but also
  4796. ### propagates the context of the source file.
  4797. macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO":"", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4798. .CMD=$COPY_FILE($FILE $DEST $AUTO OUTPUT_INCLUDES $FILE $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  4799. }
  4800. ### This is to join $ALL_RES_ and $EXT
  4801. macro _ARF_HELPER(Args...) {
  4802. RESOURCE_FILES($Args)
  4803. }
  4804. ### @usage ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
  4805. ###
  4806. ### This macro collects all files with extension `Ext` and
  4807. ### Passes them to `RESOURCE_FILES` macro as relative to current directory
  4808. ###
  4809. ### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
  4810. ###
  4811. ### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
  4812. ### Note: Wildcards are not allowed neither as Ext nor in Dirs
  4813. macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
  4814. _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
  4815. _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT})
  4816. }
  4817. macro _BUNDLE_TARGET(Target, Destination) {
  4818. .CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
  4819. }
  4820. ### @usage: TIMEOUT(TIMEOUT)
  4821. ###
  4822. ### Sets a timeout on test execution
  4823. ###
  4824. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4825. macro TIMEOUT(Time) {
  4826. SET(TEST_TIMEOUT $Time)
  4827. }
  4828. SBR_UID_EXT=""
  4829. # tag:test
  4830. ### @usage: VALIDATE_DATA_RESTART(ext)
  4831. ###
  4832. ### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
  4833. ### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
  4834. macro VALIDATE_DATA_RESTART(Ext) {
  4835. SET(SBR_UID_EXT $Ext)
  4836. }
  4837. # tag:test
  4838. TEST_FORK_MODE=none
  4839. TEST_PARTITION=SEQUENTIAL
  4840. # tag:test
  4841. ### @usage: FORK_TESTS()
  4842. ###
  4843. ### Splits a test run on chunks by test classes.
  4844. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  4845. ###
  4846. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  4847. ###
  4848. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4849. macro FORK_TESTS(MODE...) {
  4850. SET(TEST_FORK_MODE tests)
  4851. SET(TEST_PARTITION $MODE)
  4852. }
  4853. # tag:test
  4854. ### @usage: FORK_SUBTESTS()
  4855. ###
  4856. ### Splits the test run in chunks on subtests.
  4857. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  4858. ###
  4859. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  4860. ###
  4861. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4862. macro FORK_SUBTESTS(MODE...) {
  4863. SET(TEST_FORK_MODE subtests)
  4864. SET(TEST_PARTITION $MODE)
  4865. }
  4866. # tag:test
  4867. ### @usage: SPLIT_FACTOR(x)
  4868. ###
  4869. ### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
  4870. ### If none of those is specified this macro implies FORK_TESTS().
  4871. ###
  4872. ### Supports C++ ut and PyTest.
  4873. ###
  4874. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4875. macro SPLIT_FACTOR(Factor) {
  4876. SET(TEST_SPLIT_FACTOR $Factor)
  4877. }
  4878. # tag:test
  4879. FORK_TEST_FILES_MODE=
  4880. ### @usage: FORK_TEST_FILES()
  4881. ###
  4882. ### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
  4883. ### Compatible with FORK_(SUB)TESTS.
  4884. ###
  4885. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4886. macro FORK_TEST_FILES() {
  4887. SET(FORK_TEST_FILES_MODE on)
  4888. }
  4889. # tag:test
  4890. TEST_SIZE_NAME=SMALL
  4891. ### @usage: SIZE(SMALL/MEDIUM/LARGE)
  4892. ###
  4893. ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
  4894. ### See documentation on test system for more details.
  4895. ###
  4896. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4897. macro SIZE(Type) {
  4898. SET(TEST_SIZE_NAME $Type)
  4899. }
  4900. ### @usage: JOIN_SRCS(Out Src...)
  4901. ###
  4902. ### Join set of sources into single file named Out and send it for further processing.
  4903. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  4904. ### You should specify file name with the extension as Out. Further processing will be done according this extension.
  4905. macro JOIN_SRCS(Out, Src...) {
  4906. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  4907. .SEM=target_joined_source $Out ${input:Src} ${output;hide;suf=.o:Out}
  4908. _CONDITIONAL_SRCS($TIDY_VALUE $Src)
  4909. }
  4910. ### @usage: JOIN_SRCS_GLOBAL(Out Src...)
  4911. ###
  4912. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  4913. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  4914. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  4915. macro JOIN_SRCS_GLOBAL(Out, Src...) {
  4916. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output;noauto:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  4917. SRCS(GLOBAL $Out)
  4918. }
  4919. ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
  4920. ###
  4921. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  4922. ### This macro places all files into single file, so will work with any sources.
  4923. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  4924. macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
  4925. .CMD=$FS_TOOLS 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"}
  4926. SRCS(GLOBAL $Out)
  4927. }
  4928. # tag:cpu
  4929. PIC_CFLAGS=
  4930. SSE2_CFLAGS=
  4931. SSE3_CFLAGS=
  4932. SSSE3_CFLAGS=
  4933. SSE41_CFLAGS=
  4934. SSE42_CFLAGS=
  4935. POPCNT_CFLAGS=
  4936. PCLMUL_CFLAGS=
  4937. CX16_FLAGS=
  4938. AVX_CFLAGS=
  4939. AVX2_CFLAGS=
  4940. AVX512_CFLAGS=
  4941. # tag:cpu
  4942. SSE_DEFINES=
  4943. SSE_CFLAGS=
  4944. SSE4_DEFINES=
  4945. SSE4_CFLAGS=
  4946. XOP_CFLAGS=
  4947. NO_LTO_CFLAGS=
  4948. # tag:cpu
  4949. when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
  4950. when ($CLANG || $CLANG_CL || $GCC) {
  4951. PIC_CFLAGS=-fPIC
  4952. SSE2_CFLAGS=-msse2
  4953. SSE3_CFLAGS=-msse3
  4954. SSSE3_CFLAGS=-mssse3
  4955. SSE41_CFLAGS=-msse4.1
  4956. SSE42_CFLAGS=-msse4.2
  4957. XOP_CFLAGS=-mxop
  4958. POPCNT_CFLAGS=-mpopcnt
  4959. PCLMUL_CFLAGS=-mpclmul
  4960. AVX_CFLAGS=-mavx
  4961. # On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell.
  4962. # See:
  4963. # https://en.wikipedia.org/wiki/FMA_instruction_set
  4964. # https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
  4965. #
  4966. # AMD implemented FMA3 in Piledriver architecture over AVX (that is, prior to AVX-2 which was introduced in Zen).
  4967. # BMI2 implementation was released by AMD along with AVX-2 support.
  4968. # See:
  4969. # https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
  4970. #
  4971. # Due to the above, it looks safe to enable all three extensions whenever AVX-2 is enabled.
  4972. AVX2_CFLAGS=-mavx2 -mfma -mbmi -mbmi2
  4973. # All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
  4974. # (these are Xeon Phi)
  4975. # See:
  4976. # https://en.wikichip.org/wiki/x86/avx-512
  4977. AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
  4978. when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
  4979. CX16_FLAGS=-mcx16
  4980. }
  4981. SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
  4982. SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
  4983. }
  4984. elsewhen ($MSVC) {
  4985. SSE2_CFLAGS=/D__SSE2__=1
  4986. SSE3_CFLAGS=/D__SSE3__=1
  4987. SSSE3_CFLAGS=/D__SSSE3__=1
  4988. SSE41_CFLAGS=/D__SSE4_1__=1
  4989. SSE42_CFLAGS=/D__SSE4_2__=1
  4990. POPCNT_CFLAGS=/D__POPCNT__=1
  4991. PCLMUL_CFLAGS=/D__PCLMUL__=1
  4992. AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
  4993. AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
  4994. AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
  4995. SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
  4996. SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
  4997. }
  4998. SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
  4999. SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
  5000. when ($ARCH_I386 && $OS_ANDROID == "yes") {
  5001. USE_SSE4=no
  5002. }
  5003. }
  5004. otherwise {
  5005. USE_SSE4=no
  5006. CPU_CHECK=no
  5007. }
  5008. # tag:cpu
  5009. when ($NOSSE == "yes") {
  5010. USE_SSE4=no
  5011. }
  5012. # tag:cpu
  5013. ### @usage: NO_SSE4()
  5014. ###
  5015. ### Compile module without SSE4
  5016. macro NO_SSE4() {
  5017. SET(USE_SSE4 no)
  5018. }
  5019. # tag:cpu
  5020. ### @usage: NO_CPU_CHECK()
  5021. ###
  5022. ### Compile module without startup CPU features check
  5023. macro NO_CPU_CHECK() {
  5024. SET(CPU_CHECK no)
  5025. }
  5026. ### @usage: ADDINCLSELF()
  5027. ###
  5028. ### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
  5029. macro ADDINCLSELF(FOR="") {
  5030. when($FOR) {
  5031. ADDINCL+=FOR $FOR ${MODDIR}
  5032. }
  5033. otherwise {
  5034. ADDINCL+=${MODDIR}
  5035. }
  5036. }
  5037. COMPILE_OUT_SUFFIX=
  5038. _COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
  5039. _COMPILE_TIME_TRACE_OUTPUTS=${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
  5040. macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?";norel":"") {
  5041. SET(_COMPILE_OUTPUTS \${output;suf=\${OBJECT_SUF}$NOREL:SRC})
  5042. SET(_COMPILE_TIME_TRACE_OUTPUTS \${output;noauto;suf=\${OBJECT_SUF}.time_trace.json$NOREL:SRC})
  5043. }
  5044. # tag:internal
  5045. ### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
  5046. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " before $Args when GENERATE
  5047. ### is specified in the list of actual arguments
  5048. macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
  5049. .SEM=$GENERATE $Args
  5050. }
  5051. # tag:internal
  5052. ### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
  5053. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " if Args is not empty
  5054. macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
  5055. .SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
  5056. }
  5057. _EMPTY_CMD=
  5058. # tag:src-processing tag:internal
  5059. ### @usage: _SRC(Ext Src Flags) # internal
  5060. ###
  5061. ### Basic building block of extension-based command dispatching
  5062. ### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
  5063. ### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
  5064. ### of other commands (except ones marked as noauto)
  5065. macro _SRC(EXT, SRC, SRCFLAGS...) {
  5066. # Generic macro definition for _SRC (just a placeholder, it does nothing)
  5067. }
  5068. _SWIG_CMD=$_SWIG_PYTHON_CMD
  5069. _SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
  5070. _SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
  5071. _SWIG_SEM_TO_MODULE_LINK=${output;hide;suf=.o:SRC}
  5072. _SWIG_PYTHON_CMD=${_SWIG_TOOL} -module ${REALPRJNAME} -cpperraswarn -c++ -python -interface ${MODULE_PREFIX}${REALPRJNAME} -o ${output;noext;main;suf=_wrap.swg.cpp:SRC} ${output;noauto;add_to_outs;hide;tobindir;suf=.py:REALPRJNAME} -outdir ${BINDIR} ${pre=-I:_SWIG__INCLUDE} ${input:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5073. _SWIG_PYTHON_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/python FOR swig ${_SWIG_LIBRARY}
  5074. _SWIG_PYTHON_PEERDIR=
  5075. _SWIG_PERL_CMD=${_SWIG_TOOL} -c++ -cpperraswarn -module ${REALPRJNAME} -shadow -perl -o ${output;noext;main;suf=_wrap.swg.cpp:SRC} ${output;noauto;add_to_outs;hide;tobindir;suf=.pm:REALPRJNAME} -outdir ${ARCADIA_BUILD_ROOT}/${MODDIR} ${pre=-I:_SWIG__INCLUDE} ${input:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5076. _SWIG_PERL_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/perl5 FOR swig ${_SWIG_LIBRARY}
  5077. _SWIG_PERL_PEERDIR=build/platform/perl
  5078. _SWIG_JNI_CPP_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --out-header ${output;main;noext;suf=_wrap.swg.h:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${output;noext;suf=_wrap.swg.cpp:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5079. _SWIG_JNI_JAVA_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} --jsrc ${output;main;suf=.jsrc:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${BINDIR}/unused.cpp ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5080. _SWIG_JNI_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --out-header ${output;main;noext;suf=_wrap.swg.h:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} --jsrc ${output;suf=.jsrc:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${output;noext;suf=_wrap.swg.cpp:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5081. _SWIG_JNI_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/java FOR swig $_SWIG_LIBRARY
  5082. _SWIG_JNI_PEERDIR=$YMAKE_PYTHON3_PEER contrib/libs/jdk
  5083. when ($USE_LOCAL_SWIG == "yes") {
  5084. _SWIG_JNI_ADDINCLS=
  5085. }
  5086. when ($USE_SYSTEM_JDK == "yes" || $OS_ANDROID == "yes") {
  5087. _SWIG_JNI_PEERDIR=$YMAKE_PYTHON3_PEER
  5088. }
  5089. # tag:src-processing
  5090. macro _SRC("swg", SRC, SRCFLAGS...) {
  5091. .CMD=${_SWIG_CMD}
  5092. .ADDINCL=${_SWIG_ADDINCLS}
  5093. .PEERDIR=${_SWIG_PEERDIR}
  5094. .SEM=conan_require swig/4.0.2 && conan_import '"bin, *swig* -> ./bin"' ${input;hide:SRC} ${_SWIG_SEM_TO_MODULE_LINK}
  5095. }
  5096. RODATA_SYMBOL_PREFIX=
  5097. when ($DARWIN == "yes" || $IOS == "yes" || ($WINDOWS == "yes" && $ARCH_TYPE_32 == "yes")) {
  5098. RODATA_SYMBOL_PREFIX=_
  5099. }
  5100. RODATA_ELF_FLAGS=
  5101. when($LINUX == "yes" || $ANDROID == "yes") {
  5102. RODATA_ELF_FLAGS=--elf
  5103. }
  5104. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2asm.py"} $RODATA_ELF_FLAGS ${RODATA_SYMBOL_PREFIX}${noext;nopath:SRC} ${input:SRC} ${tmp;suf=.asm:SRC} ${hide:OBJECT_SUF} && $_SRC_yasm_helper(${tmp;suf=.asm:SRC})
  5105. when (($ARCH_AARCH64 || $ARCH_ARM || $ARCH_PPC64LE) == "yes") {
  5106. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2cpp.py"} ${noext;nopath:SRC} ${input:SRC} ${output;suf=.cpp:SRC}
  5107. }
  5108. # tag:src-processing
  5109. macro _SRC("rodata", SRC, SRCFLAGS...) {
  5110. .CMD=$RODATA_COMPILE ${hide;kv:"p RD"} ${hide;kv:"pc light-green"}
  5111. .PEERDIR=$YMAKE_PYTHON3_PEER
  5112. .SEM=target_rodata_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC}
  5113. }
  5114. # tag:src-processing
  5115. macro _SRC("S", SRC, SRCFLAGS...) {
  5116. .CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output:SRC.o} ${input:SRC} ${pre=-I:_C__INCLUDE}
  5117. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5118. }
  5119. # tag:src-processing
  5120. macro _SRC("s", SRC, SRCFLAGS...) {
  5121. .CMD=$_SRC(S, $SRC $SRCFLAGS)
  5122. }
  5123. # tag:src-processing
  5124. macro _SRC("s79", SRC, SRCFLAGS...) {
  5125. .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
  5126. }
  5127. # tag:src-processing
  5128. macro _SRC("mm", SRC, SRCFLAGS...) {
  5129. .CMD=$C_COMPILER $C_FLAGS_PLATFORM -x objective-c++ -fobjc-arc -fobjc-abi-version=2 -c -o ${output:SRC.o} ${input:SRC} $CXXFLAGS ${pre=-I:_C__INCLUDE} ${SRCFLAGS} ${kv;hide:"p CC"} ${kv;hide:"pc light-green"} $TOOLCHAIN_ENV
  5130. }
  5131. # tag:src-processing
  5132. macro _SRC("fml", SRC, SRCFLAGS...) {
  5133. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output:SRC.inc} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5134. }
  5135. # tag:src-processing
  5136. macro _SRC("fml2", SRC, SRCFLAGS...) {
  5137. .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"}
  5138. }
  5139. # tag:src-processing
  5140. macro _SRC("fml3", SRC, SRCFLAGS...) {
  5141. .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"}
  5142. }
  5143. # tag:src-processing
  5144. macro _SRC("sfdl", SRC, SRCFLAGS...) {
  5145. .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
  5146. }
  5147. # tag:src-processing
  5148. macro _SRC("xs", SRC, SRCFLAGS...) {
  5149. .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"}
  5150. }
  5151. # tag:src-processing
  5152. macro _SRC("y", SRC, SRCFLAGS...) {
  5153. # .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"}
  5154. .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"}
  5155. .SEM=target_bison_parser PRIVATE ${input:SRC} ${output;nopath;noext;hide;suf=${OBJ_SUF}.o:SRC} ${nopath;noext;output;hide:SRC.h} ${nopath;noext;output;addincl;hide:SRC.h} && set_global_flags BISON_FLAGS $BISON_FLAGS && conan_require bison/3.5.3 && conan_import '"bin, bison* -> ./bin/bison/bin"' && conan_import '"res, * -> ./bin/bison/res"'
  5156. }
  5157. # tag:src-processing
  5158. macro _SRC("ypp", SRC, SRCFLAGS...) {
  5159. .CMD=$_SRC(y $SRC $SRCFLAGS)
  5160. }
  5161. # tag:src-processing
  5162. macro _SRC("gperf", SRC, SRCFLAGS...) {
  5163. .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"}
  5164. }
  5165. # tag:src-processing
  5166. macro _SRC("rl", SRC, SRCFLAGS...) {
  5167. .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"}
  5168. }
  5169. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5170. .CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${output;stdout;suf=.h.rl5:SRC} ${kv;hide:"p XN"} ${kv;hide:"pc yellow"}
  5171. }
  5172. # tag:src-processing
  5173. macro _SRC("rl5", SRC, SRCFLAGS...) {
  5174. .CMD=$_SRC(rl $SRC $SRCFLAGS)
  5175. }
  5176. # tag:src-processing
  5177. macro _SRC("asp", SRC, SRCFLAGS...) {
  5178. .CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${kv;hide:"p HT"} ${kv;hide:"pc yellow"}
  5179. }
  5180. # tag:src-processing
  5181. macro _SRC("rl6", SRC, SRCFLAGS...) {
  5182. .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"}
  5183. .SEM=target_ragel_lexers PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $RAGEL6_FLAGS ${SRCFLAGS} && set_global_flags RAGEL_FLAGS -L -I $S/ && conan_require ragel/6.10 && conan_import '"bin, ragel* -> ./bin"'
  5184. }
  5185. # tag:src-processing
  5186. macro _SRC("l", SRC, SRCFLAGS...) {
  5187. .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"}
  5188. .ADDINCL=contrib/tools/flex-old
  5189. .SEM=target_flex_lexers ${tool;hide:"contrib/tools/flex-old"} ${output;hide;suf=${OBJ_SUF}.o:SRC} ${input:SRC} && set_global_flags LEX_FLAGS $LEX_FLAGS
  5190. }
  5191. # tag:src-processing
  5192. macro _SRC("lex", SRC, SRCFLAGS...) {
  5193. .CMD=$_SRC(l $SRC $SRCFLAGS)
  5194. }
  5195. # tag:src-processing
  5196. macro _SRC("lpp", SRC, SRCFLAGS...) {
  5197. .CMD=$_SRC(l $SRC $SRCFLAGS)
  5198. }
  5199. # tag:src-processing
  5200. macro _SRC("pln", SRC, SRCFLAGS...) {
  5201. .CMD=$FML_TOOL -b -o ${output;pre=pln.;nopath;noext:SRC.cpp} -f ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5202. }
  5203. # tag:src-processing
  5204. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5205. .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"}
  5206. }
  5207. # tag:src-processing
  5208. macro _SRC("ev", SRC, SRCFLAGS...) {
  5209. .CMD=$EVLOG_CMD($SRC)
  5210. }
  5211. # tag:src-processing
  5212. macro _SRC("proto", SRC, SRCFLAGS...) {
  5213. .CMD=$PROTO_CMD($SRC)
  5214. .SEM=$PROTO_CMD($SRC)
  5215. }
  5216. # tag:src-processing
  5217. macro _SRC("gztproto", SRC, SRCFLAGS...) {
  5218. # _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.
  5219. # descriptor.proto must be resolved as google/protobuf/descriptor.proto
  5220. .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"}
  5221. .PEERDIR=kernel/gazetteer/proto
  5222. }
  5223. # tag:src-processing
  5224. macro _SRC("cfgproto", SRC, SRCFLAGS...) {
  5225. .CMD=$_CPP_CFGPROTO_CMD($SRC)
  5226. }
  5227. # tag:src-processing
  5228. macro _SRC("pyx", SRC, SRCFLAGS...) {
  5229. # Copy-paste from BUILDWITH_CYTHON
  5230. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:SRC} -o ${output;tobindir:SRC.cpp} $CYTHON_OUTPUT_INCLUDES ${SRCFLAGS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5231. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS --cplus ${SRCFLAGS} ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5232. .ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
  5233. }
  5234. # tag:src-processing
  5235. macro _SRC("in", SRC, SRCFLAGS...) {
  5236. .CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5237. .SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5238. }
  5239. macro MANUAL_GENERATION(Outs...) {
  5240. .SEM=IGNORED ${output;hide;noauto:Outs}
  5241. }
  5242. # tag:src-processing
  5243. macro _SRC("sc", SRC, SRCFLAGS...) {
  5244. .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"}
  5245. }
  5246. # tag:src-processing
  5247. macro _SRC("ssqls", SRC, SRCFLAGS...) {
  5248. .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"}
  5249. }
  5250. # tag:src-processing
  5251. macro _SRC("f", SRC, SRCFLAGS...) {
  5252. .CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${kv;hide:"p FT"} ${kv;hide:"pc light-green"}
  5253. .PEERDIR=contrib/libs/libf2c
  5254. .ADDINCL=contrib/libs/libf2c
  5255. }
  5256. # tag:src-processing
  5257. macro _SRC("cpp", SRC, SRCFLAGS...) {
  5258. .CMD=$_SRC_cpp($SRC $SRCFLAGS)
  5259. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5260. }
  5261. # tag:src-processing
  5262. macro _SRC("cxx", SRC, SRCFLAGS...) {
  5263. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5264. }
  5265. # tag:src-processing
  5266. macro _SRC("cc", SRC, SRCFLAGS...) {
  5267. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5268. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5269. }
  5270. # tag:src-processing
  5271. macro _SRC("C", SRC, SRCFLAGS...) {
  5272. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5273. }
  5274. # tag:src-processing
  5275. macro _SRC("c", SRC, SRCFLAGS...) {
  5276. .CMD=$_SRC_c($SRC $SRCFLAGS)
  5277. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
  5278. }
  5279. # tag:src-processing
  5280. macro _SRC("m", SRC, SRCFLAGS...) {
  5281. .CMD=$_SRC(c $SRC $SRCFLAGS)
  5282. }
  5283. # tag:src-processing
  5284. macro _SRC("masm", SRC, SRCFLAGS...) {
  5285. .CMD=$_SRC_masm($SRC $SRCFLAGS)
  5286. }
  5287. YASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${pre=-P :PREINCLUDES} \
  5288. && 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 \
  5289. && add_language ASM \
  5290. && conan_require yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5291. ASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS \
  5292. && 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 \
  5293. && add_language ASM \
  5294. && conan_require yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5295. # tag:src-processing
  5296. macro _SRC("yasm", SRC, SRCFLAGS...) {
  5297. .CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  5298. .SEM=$YASM_SEM
  5299. }
  5300. # tag:src-processing
  5301. macro _SRC("asm", SRC, SRCFLAGS...) {
  5302. .CMD=$_SRC(yasm $SRC $SRCFLAGS)
  5303. .SEM=$ASM_SEM
  5304. }
  5305. # tag:src-processing
  5306. macro _SRC("lua", SRC, SRCFLAGS...) {
  5307. .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"}
  5308. .PEERDIR=$LUAJIT_PATH
  5309. }
  5310. NVCC_STD_VER=14
  5311. when ($MSVC == "yes") {
  5312. NVCC_STD=/std:c++${NVCC_STD_VER}
  5313. }
  5314. otherwise {
  5315. NVCC_STD=-std=c++${NVCC_STD_VER}
  5316. }
  5317. # tag:src-processing
  5318. macro _SRC("cu", SRC, SRCFLAGS...) {
  5319. .CMD=$_SRC_CU_CMD
  5320. .SEM=target_cuda_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} && add_language CUDA && set_global_flags CMAKE_CUDA_STANDARD ${NVCC_STD_VER} && target_cuda_flags $CUDA_NVCC_FLAGS && target_cuda_cflags $USER_CXXFLAGS $SRCFLAGS $_SEM_EXTRA_CXX_FLAGS
  5321. .PEERDIR=$_SRC_CU_PEERDIR
  5322. }
  5323. # tag:src-processing
  5324. macro _SRC("fbs", SRC, SRCFLAGS...) {
  5325. .CMD=$FBS_CMD($SRC, $SRCFLAGS)
  5326. .SEM=$FBS_CMD($SRC, $SRCFLAGS)
  5327. }
  5328. # tag:src-processing
  5329. macro _SRC("fbs64", SRC, SRCFLAGS...) {
  5330. .CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
  5331. }
  5332. # tag:src-processing
  5333. macro _SRC("pysrc", SRC, SRCFLAGS...) {
  5334. .CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
  5335. }
  5336. # tag:src-processing
  5337. macro _SRC_py2src(SRC, SRCFLAGS...) {
  5338. .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"}
  5339. }
  5340. # tag:src-processing
  5341. macro _SRC_py3src(SRC, SRCFLAGS...) {
  5342. .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"}
  5343. }
  5344. # tag:src-processing python-specific
  5345. when ($PYTHON3 == "yes") {
  5346. MACRO_ALIAS(_SRC_PYSRC _SRC_py3src)
  5347. }
  5348. otherwise {
  5349. MACRO_ALIAS(_SRC_PYSRC _SRC_py2src)
  5350. }
  5351. # tag:src-processing
  5352. macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
  5353. .CMD=$_SRC_C_NODEPS_CMD
  5354. }
  5355. # Custom flags for generated cpp-files. To support another generator:
  5356. # - insert additional file extension before .cpp into generated cpp-file name
  5357. # - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
  5358. #
  5359. # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
  5360. # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
  5361. #
  5362. # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
  5363. # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
  5364. ## tag:src-processing
  5365. _LANG_CFLAGS_FILTER=\
  5366. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
  5367. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
  5368. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
  5369. # tag:src-processing
  5370. # Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
  5371. macro _FILTER_EXTS(SKIP="", FLAGS...) {
  5372. .CMD=$FLAGS
  5373. }
  5374. # tag:src-processing
  5375. macro _LANG_CFLAGS(SRC) {
  5376. .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
  5377. }
  5378. # tag:src-processing
  5379. # ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
  5380. # Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
  5381. _LANG_CFLAGS_VALUE=
  5382. when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
  5383. _LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
  5384. }
  5385. # Allows to add single compilation unit name to the node's 'kv' section.
  5386. # This is used by the coverage machinery to instrument only the necessary sources
  5387. # when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
  5388. SCU_NAME_KV=
  5389. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  5390. SCU_NAME_KV=${hide;kv:"scu_name $KV_VAL"}
  5391. }
  5392. macro _ADD_SCU_NAME(KV_VAL) {
  5393. .CMD=$SCU_NAME_KV
  5394. }
  5395. # tag:src-processing
  5396. macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5397. .CMD=$_SRC_CPP_CMD $_ADD_SCU_NAME(${input:SRC})
  5398. }
  5399. # tag:src-processing
  5400. macro _SRC_c(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5401. .CMD=$_SRC_C_CMD $_ADD_SCU_NAME(${input:SRC})
  5402. }
  5403. # tag:src-processing
  5404. macro _SRC_m(SRC, SRCFLAGS...) {
  5405. .CMD=$_SRC_M_CMD
  5406. }
  5407. # tag:src-processing
  5408. macro _SRC_masm(SRC, SRCFLAGS...) {
  5409. .CMD=$_SRC_MASM_CMD
  5410. }
  5411. # tag:lua-specific
  5412. ### @usage: COMPILE_LUA(Src, [NAME <import_name>])
  5413. ###
  5414. ### Compile LUA source file to object code using LUA 2.0
  5415. ### Optionally override import name which is by default reflects Src name
  5416. macro COMPILE_LUA(Src, NAME="") {
  5417. .CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
  5418. }
  5419. # tag:lua-specific
  5420. ### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
  5421. ###
  5422. ### Compile LUA source file to object code using LUA 2.1
  5423. macro _SRC_lua_21(SRC, SRCFLAGS...) {
  5424. .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"}
  5425. .PEERDIR=$LUAJIT_21_PATH
  5426. }
  5427. # tag:lua-specific
  5428. ### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
  5429. ###
  5430. ### Compile LUA source file to object code using LUA 2.1
  5431. ### Optionally override import name which is by default reflects Src name
  5432. macro COMPILE_LUA_21(Src, NAME="") {
  5433. .CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
  5434. }
  5435. GETTEXT_KEEP_PATH=no
  5436. _MO_OUTPUT=
  5437. when ($GETTEXT_KEEP_PATH == "yes") {
  5438. _MO_OUTPUT=${output;noauto;norel;noext:SRC.mo}
  5439. }
  5440. otherwise {
  5441. _MO_OUTPUT=${output;noauto;nopath;noext;tobindir:SRC.mo}
  5442. }
  5443. # tag:src-processing
  5444. macro _SRC("po", SRC, SRCFLAGS...) {
  5445. .CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
  5446. }
  5447. # tag:ydl-specific
  5448. YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
  5449. YDL_DESC_FLAGS=
  5450. # tag:src-processing tag:ydl-specific
  5451. macro _SRC("ydl", SRC, SRCFLAGS...) {
  5452. .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"}
  5453. .PEERDIR+=statbox/ydl/runtime/cpp
  5454. }
  5455. # tag:ydl-specific
  5456. ### @usage BUILD_YDL_DESC(Input Symbol Output)
  5457. ###
  5458. ### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
  5459. ###
  5460. ### @example:
  5461. ###
  5462. ### PACKAGE()
  5463. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5464. ### END()
  5465. ###
  5466. ### 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.
  5467. macro BUILD_YDL_DESC(Input, Symbol, Output) {
  5468. .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"}
  5469. }
  5470. # tag:ydl-specific
  5471. ### @usage: YDL_DESC_USE_BINARY()
  5472. ###
  5473. ### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
  5474. ###
  5475. ### @example:
  5476. ###
  5477. ### PACKAGE()
  5478. ### YDL_DESC_USE_BINARY()
  5479. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5480. ### END()
  5481. ###
  5482. ### This will generate descriptor Event.ydld in a binary format.
  5483. macro YDL_DESC_USE_BINARY() {
  5484. YDL_DESC_FLAGS_BINARY= --binary
  5485. SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
  5486. }
  5487. ### @usage SRC(File Flags...)
  5488. ###
  5489. ### Compile single file with extra Flags.
  5490. ### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
  5491. macro SRC(FILE, FLAGS...) {
  5492. _SRC(${lastext:FILE} $FILE $FLAGS)
  5493. }
  5494. ### @usage: SRCS(<[GLOBAL] File> ...)
  5495. ###
  5496. ### 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.
  5497. ### Arcadia Paths from the root and is relative to the project's LIST are supported
  5498. ###
  5499. ### 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.
  5500. ### 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)
  5501. ###
  5502. ### @example:
  5503. ###
  5504. ### LIBRARY(test_global)
  5505. ### SRCS(GLOBAL foo.cpp)
  5506. ### END()
  5507. ###
  5508. ### 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.
  5509. macro SRCS(FILES...) {
  5510. foreach (FILE : $FILES) {
  5511. _SRC(${lastext:FILE} $FILE)
  5512. }
  5513. }
  5514. # tag:src-specific tag:cpp-specific
  5515. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5516. ###
  5517. ### Defenition of generic macro. Report an error that the File with Ext is not
  5518. ### supported by macro MacroName if no appropriate macro specialization is found.
  5519. macro _SRC_STRICT_C_CPP(EXT, MACRO_NAME, FILE, FLAGS...) {
  5520. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  5521. }
  5522. # tag:src-specific tag:cpp-specific
  5523. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5524. ###
  5525. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single C file (with .c extension)
  5526. macro _SRC_STRICT_C_CPP("c", MACRO_NAME, FILE, FLAGS...) {
  5527. _SRC(c $FILE $FLAGS)
  5528. }
  5529. # tag:src-specific tag:cpp-specific
  5530. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5531. ###
  5532. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cpp extension)
  5533. macro _SRC_STRICT_C_CPP("cpp", MACRO_NAME, FILE, FLAGS...) {
  5534. _SRC(cpp $FILE $FLAGS)
  5535. }
  5536. # tag:src-specific tag:cpp-specific
  5537. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5538. ###
  5539. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cxx extension)
  5540. macro _SRC_STRICT_C_CPP("cxx", MACRO_NAME, FILE, FLAGS...) {
  5541. _SRC(cpp $FILE $FLAGS)
  5542. }
  5543. # tag:src-specific tag:cpp-specific
  5544. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5545. ###
  5546. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cc extension)
  5547. macro _SRC_STRICT_C_CPP("cc", MACRO_NAME, FILE, FLAGS...) {
  5548. _SRC(cpp $FILE $FLAGS)
  5549. }
  5550. # tag:src-specific tag:cpp-specific
  5551. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5552. ###
  5553. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .C extension)
  5554. macro _SRC_STRICT_C_CPP("C", MACRO_NAME, FILE, FLAGS...) {
  5555. _SRC(cpp $FILE $FLAGS)
  5556. }
  5557. # tag:src-specific tag:cpp-specific tag:cpu
  5558. ### @uasge SRC_C_SSE2(File Flags...)
  5559. ###
  5560. ### Compile a single C/C++ file with SSE2 and additional Flags
  5561. macro SRC_C_SSE2(FILE, FLAGS...) {
  5562. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE2 $FILE $SSE2_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse2)
  5563. }
  5564. # tag:src-specific tag:cpp-specific tag:cpu
  5565. ### @uasge SRC_C_SSE3(File Flags...)
  5566. ###
  5567. ### Compile a single C/C++ file with SSE3 and additional Flags
  5568. macro SRC_C_SSE3(FILE, FLAGS...) {
  5569. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE3 $FILE $SSE3_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse3)
  5570. }
  5571. # tag:src-specific tag:cpp-specific tag:cpu
  5572. ### @uasge SRC_C_SSSE3(File Flags...)
  5573. ###
  5574. ### Compile a single C/C++ file with SSSE3 and additional Flags
  5575. macro SRC_C_SSSE3(FILE, FLAGS...) {
  5576. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSSE3 $FILE $SSSE3_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .ssse3)
  5577. }
  5578. # tag:src-specific tag:cpp-specific tag:cpu
  5579. ### @uasge SRC_C_SSE4(File Flags...)
  5580. ###
  5581. ### Compile a single C/C++ file with SSE4 and additional Flags
  5582. macro SRC_C_SSE4(FILE, FLAGS...) {
  5583. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE4 $FILE $SSE4_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse4)
  5584. }
  5585. # tag:src-specific tag:cpp-specific tag:cpu
  5586. ### @uasge SRC_C_SSE41(File Flags...)
  5587. ###
  5588. ### Compile a single C/C++ file with SSE4.1 and additional Flags
  5589. macro SRC_C_SSE41(FILE, FLAGS...) {
  5590. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE41 $FILE $SSE41_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse41)
  5591. }
  5592. # tag:src-specific tag:cpp-specific tag:cpu
  5593. ### @uasge SRC_C_AVX(File Flags...)
  5594. ###
  5595. ### Compile a single C/C++ file with AVX and additional Flags
  5596. macro SRC_C_AVX(FILE, FLAGS...) {
  5597. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_AVX $FILE $AVX_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx)
  5598. }
  5599. # tag:src-specific tag:cpp-specific tag:cpu
  5600. ### @uasge SRC_C_AVX2(File Flags...)
  5601. ###
  5602. ### Compile a single C/C++ file with AVX2 and additional Flags
  5603. macro SRC_C_AVX2(FILE, FLAGS...) {
  5604. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_AVX2 $FILE $AVX2_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx2)
  5605. }
  5606. # tag:src-specific tag:cpp-specific tag:cpu
  5607. ### @uasge SRC_C_AVX512(File Flags...)
  5608. ###
  5609. ### Compile a single C/C++ file with AVX512 and additional Flags
  5610. macro SRC_C_AVX512(FILE, FLAGS...) {
  5611. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_AVX512 $FILE $AVX512_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx512)
  5612. }
  5613. # tag:src-specific tag:cpp-specific tag:cpu
  5614. ### @uasge SRC_C_XOP(File Flags...)
  5615. ###
  5616. ### Compile a single C/C++ file with (an AMD-specific instruction set,
  5617. ### see https://en.wikipedia.org/wiki/XOP_instruction_set) and additional Flags
  5618. macro SRC_C_XOP(FILE, FLAGS...) {
  5619. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_XOP $FILE $XOP_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .xop)
  5620. }
  5621. # tag:src-specific tag:cpp-specific tag:cpu
  5622. ### @uasge SRC_C_PCLMUL(File Flags...)
  5623. ###
  5624. ### Compile a single C/C++ file with PCLMUL and additional Flags
  5625. macro SRC_C_PCLMUL(FILE, FLAGS...) {
  5626. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE $PCLMUL_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .pclmul)
  5627. }
  5628. # tag:src-specific tag:cpp-specific
  5629. ### @uasge SRC_C_PIC(File Flags...)
  5630. ###
  5631. ### Compile a single C/C++ file with -fPIC and additional Flags
  5632. macro SRC_C_PIC(FILE, FLAGS...) {
  5633. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PIC $FILE $PIC_CFLAGS $FLAGS)
  5634. }
  5635. # tag:src-specific tag:cpp-specific
  5636. ### @uasge SRC_C_NO_LTO(File Flags...)
  5637. ###
  5638. ### Compile a single C/C++ file with link-time-optimization disabling and additional Flags
  5639. macro SRC_C_NO_LTO(FILE, FLAGS...) {
  5640. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_NO_LTO $FILE $NO_LTO_CFLAGS $FLAGS)
  5641. }
  5642. # tag:python-processing tag:cython
  5643. # TODO: use it in [.pyx] cmd
  5644. ### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
  5645. ###
  5646. ### Generates .cpp file from .pyx.
  5647. macro BUILDWITH_CYTHON_CPP(Src, Options...) {
  5648. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir:Src.cpp} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5649. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5650. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5651. }
  5652. # tag:python-processing tag:cython tag:internal
  5653. ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
  5654. ###
  5655. ### Generates .cpp file from .pyx and attach extra input Dep.
  5656. ### If Dep changes the .cpp file will be re-generated.
  5657. macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
  5658. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir:Src.cpp} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5659. .SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5660. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5661. }
  5662. # tag:python-processing tag:cython
  5663. ### @usage: BUILDWITH_CYTHON_C(Src Options...)
  5664. ###
  5665. ### Generates .c file from .pyx.
  5666. macro BUILDWITH_CYTHON_C(Src, Options...) {
  5667. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir:Src.c} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5668. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5669. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5670. }
  5671. # tag:python-processing tag:cython tag:internal
  5672. ### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
  5673. ###
  5674. ### Generates .c file from .pyx and attach extra input Dep.
  5675. ### If Dep changes the .c file will be re-generated.
  5676. macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
  5677. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir:Src.c} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5678. .SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5679. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5680. }
  5681. # tag:python-processing tag:cython tag:internal
  5682. ### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
  5683. ###
  5684. ### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
  5685. macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
  5686. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5687. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5688. }
  5689. # tag:python-processing tag:cython tag:internal
  5690. ### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
  5691. ###
  5692. ### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
  5693. macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
  5694. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} ${output;hide;addincl;noext;defext=_api.h;tobindir:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5695. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5696. }
  5697. # tag:python-processing tag:internal
  5698. ### @usage: _SWIG_PYTHON_CPP(Src, DstSubPrefix) # internal
  5699. ###
  5700. ### Run swig on Src to produce DstSubPrefix.py and DstSubPrefix_swg.cpp that
  5701. ### provides DstSubPrefix_swg python module.
  5702. macro _SWIG_PYTHON_CPP(Src, DstSubPrefix) {
  5703. .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"}
  5704. ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY)
  5705. }
  5706. # tag:python-processing tag:internal
  5707. ### @usage: _SWIG_PYTHON_C(Src, DstSubPrefix) # internal
  5708. ###
  5709. ### Like _SWIG_PYTHON_CPP but generate DstSubPrefix_swg.c.
  5710. macro _SWIG_PYTHON_C(Src, DstSubPrefix) {
  5711. .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"}
  5712. ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY)
  5713. }
  5714. ### @usage: BUILDWITH_RAGEL6(Src Options...)
  5715. ###
  5716. ### Compile .rl file using Ragel6.
  5717. macro BUILDWITH_RAGEL6(Src, Options...) {
  5718. .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"}
  5719. }
  5720. # tag:python-processing tag:internal
  5721. # TODO: use it in [.pyx] cmd
  5722. ### @usage: _PY_REGISTER() # internal
  5723. ###
  5724. ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
  5725. ###
  5726. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5727. macro _PY_REGISTER(Func) {
  5728. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5729. SRCS(GLOBAL $Func.reg.cpp)
  5730. }
  5731. # tag:python-processing tag:internal
  5732. ### @usage: _PY3_REGISTER() # internal
  5733. ###
  5734. ### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
  5735. ###
  5736. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5737. macro _PY3_REGISTER(Func) {
  5738. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${output;noauto:Func.reg3.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5739. SRCS(GLOBAL $Func.reg3.cpp)
  5740. }
  5741. # tag:python-processing tag:internal
  5742. ### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
  5743. ###
  5744. ### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
  5745. ###
  5746. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5747. macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
  5748. .CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5749. }
  5750. # tag:python-processing tag:internal
  5751. ### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
  5752. ###
  5753. ### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
  5754. ###
  5755. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5756. macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
  5757. .CMD=${env:"PYTHONHASHSEED=0"} ${tool:"contrib/tools/python3/pycc"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc3} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5758. }
  5759. macro _ARCHIVE_SEM_HELPER(OUT, DONTCOMPRESS, Files...) {
  5760. .SEM=add_custom_command OUTPUT ${OUT} DEPENDS ${Files} COMMAND $ARCH_TOOL -q $DONTCOMPRESS ${join=\: :Files}: -o ${OUT}
  5761. }
  5762. ### @usage: ARCHIVE_ASM(NAME archive_name files...)
  5763. ###
  5764. ### Similar to the macro ARCHIVE, but:
  5765. ### 1. works faster and it is better to use for large files.
  5766. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
  5767. macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  5768. .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;chksum;suf=$OBJ_SUF.rodata:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"}
  5769. .SEM=$_ARCHIVE_SEM_HELPER(${output;suf=$OBJ_SUF.rodata:NAME}, $DONTCOMPRESS, ${input:Files})
  5770. }
  5771. # tag:yweb-specific
  5772. macro PIRE_INLINE_CMD(SRC) {
  5773. .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"}
  5774. }
  5775. # tag:yweb-specific
  5776. macro PIRE_INLINE(FILES...) {
  5777. foreach (FILE : $FILES) {
  5778. PIRE_INLINE_CMD($FILE)
  5779. }
  5780. }
  5781. ### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
  5782. ###
  5783. ### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  5784. ###
  5785. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  5786. macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  5787. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;chksum;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  5788. .SEM=$_ARCHIVE_SEM_HELPER(${output;addincl;noauto:NAME}, $DONTCOMPRESS, ${input:Files})
  5789. }
  5790. ### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
  5791. ###
  5792. ### Add arbitrary data to a module be accessible by specified key.
  5793. ### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  5794. ###
  5795. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  5796. macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", Files...) {
  5797. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;chksum;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  5798. }
  5799. #scripts
  5800. #special commands
  5801. BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
  5802. SVNVERSION_JAVA_MARKER=output-java-class
  5803. SVNVERSION_GO_MARKER=output-go
  5804. VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
  5805. VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
  5806. VCS_C=$BINDIR/__vcs_version__.c
  5807. VCS_GO=$BINDIR/__vcs_version__.go
  5808. VCS_JAVA=$BINDIR/__vcs_version__.mf
  5809. VCS_INFO_DISABLE_CACHE__NO_UID__=
  5810. YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  5811. CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  5812. CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
  5813. YASM_DEBUG_INFO=
  5814. CL_DEBUG_INFO=
  5815. CL_MACRO_INFO=
  5816. when ($FORCE_VCS_INFO_UPDATE == "yes") {
  5817. VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
  5818. }
  5819. ### Works for pyton too.
  5820. 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))
  5821. 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__
  5822. 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__
  5823. macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
  5824. .CMD=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
  5825. }
  5826. ### @usage: CREATE_BUILDINFO_FOR(GenHdr)
  5827. ###
  5828. ### Creates header file to access some information about build specified via configuration variables.
  5829. ### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
  5830. macro CREATE_BUILDINFO_FOR(GenHdr) {
  5831. .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__
  5832. .SEM=$PYTHON($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
  5833. }
  5834. DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
  5835. DECIMAL_MD5_FIXED=
  5836. ### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
  5837. ###
  5838. ### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
  5839. ### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
  5840. macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
  5841. .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"}
  5842. }
  5843. # tag:internal
  5844. ### @usage $CFG_VARS # internal
  5845. ###
  5846. ### Mark commands that embed Configuration variables into files
  5847. macro CFG_VARS() {
  5848. .GEN_FROM_FILE=yes
  5849. }
  5850. ### @usage: CONFIGURE_FILE(from to)
  5851. ###
  5852. ### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
  5853. ### The values are collected during configure stage, while replacement itself happens during build stage.
  5854. ### Used implicitly for .in-files processing.
  5855. macro CONFIGURE_FILE(Src, Dst) {
  5856. .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"}
  5857. .SEM=set_vars ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;addincl;rootrel:Dst}
  5858. }
  5859. ### @usage: BASE_CODEGEN(tool_path prefix)
  5860. ###
  5861. ### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in.
  5862. macro BASE_CODEGEN(Tool, Prefix, Opts...) {
  5863. .CMD=${tool:Tool} ${input:Prefix.in} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc yellow"}
  5864. }
  5865. # tag:internal
  5866. ### @usage: _SPLIT_CODEGEN_BASE(tool prefix OUTS[] OUTPUT_INCLUDES[]) # internal
  5867. ###
  5868. ### Generator of a certain number .the. cpp file + one header .h file from .in.
  5869. ### This is the call of the generator. Python macro SPLIT_CODEGEN() is defined in order to properly fill command outputs from OUT_NUM argument.
  5870. macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) {
  5871. .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"}
  5872. }
  5873. STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \
  5874. ${output_include;hide:"util/generic/strbuf.h"} \
  5875. ${output_include;hide:"util/generic/vector.h"} \
  5876. ${output_include;hide:"util/generic/ptr.h"} \
  5877. ${output_include;hide:"util/generic/yexception.h"} \
  5878. ${output_include;hide:"kernel/struct_codegen/reflection/reflection.h"} \
  5879. ${output_include;hide:"kernel/struct_codegen/reflection/floats.h"}
  5880. ### @usage: STRUCT_CODEGEN(Prefix)
  5881. ### A special case BASE_CODEGEN, in which the kernel/struct_codegen/codegen_tool tool is used.
  5882. macro STRUCT_CODEGEN(Prefix) {
  5883. .CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES)
  5884. .PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection
  5885. }
  5886. ### @usage: DUMPERF_CODEGEN(Prefix)
  5887. ### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used
  5888. macro DUMPERF_CODEGEN(Prefix) {
  5889. .CMD=$BASE_CODEGEN(extsearch/images/robot/tools/dumperf/codegen, $Prefix, ${output_include;hide:"extsearch/images/kernel/erf/erf_format.h"})
  5890. }
  5891. # tag:flags
  5892. ### @usage: LDFLAGS(LinkerFlags...)
  5893. ###
  5894. ### Add flags to the link command line of executable or shared library/dll.
  5895. ### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
  5896. ### Note: remember about the incompatibility of flags for gcc and cl.
  5897. macro LDFLAGS(Flags...) {
  5898. SET_APPEND(LDFLAGS_GLOBAL $Flags)
  5899. }
  5900. # tag:flags
  5901. ### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
  5902. ###
  5903. ### Add the specified flags to the compilation command of C and C++ files.
  5904. ### @params: GLOBAL - Propagates these flags to dependent projects
  5905. ### Note: remember about the incompatibility flags for clang and cl (to set flags specifically for cl.exe use MSVC_FLAGS).
  5906. macro CFLAGS(Flags...) {
  5907. SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
  5908. }
  5909. # tag:flags
  5910. ### @usage: MASMFLAGS(compiler flags)
  5911. ### Add the specified flags to the compilation command of .masm files.
  5912. macro MASMFLAGS(Flags...) {
  5913. SET_APPEND(MASMFLAGS $Flags)
  5914. }
  5915. # tag:flags
  5916. ### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
  5917. ### Add the specified flags to the compilation command of .c (but not .cpp) files.
  5918. ### @params: GLOBAL - Distributes these flags on dependent projects
  5919. macro CONLYFLAGS(Flags...) {
  5920. SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
  5921. }
  5922. # tag:flags
  5923. ### @usage: CXXFLAGS(compiler_flags)
  5924. ### Add the specified flags to the compilation command of .cpp (but not .c) files.
  5925. macro CXXFLAGS(Flags...) {
  5926. SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
  5927. }
  5928. # tag:flags
  5929. ### @usage: CUDA_NVCC_FLAGS(compiler flags)
  5930. ### Add the specified flags to the compile line .cu-files.
  5931. macro CUDA_NVCC_FLAGS(Flags...) {
  5932. SET_APPEND(CUDA_NVCC_FLAGS $Flags)
  5933. }
  5934. # tag:flags
  5935. ### @usage: NVCC_DEVICE_LINK(file.cu...)
  5936. ### Run nvcc --device-link on objects compiled from srcs with --device-c.
  5937. ### This generates a stub object devlink.o that supplies missing pieces for the
  5938. ### host linker to link relocatable device objects into the final executable.
  5939. macro NVCC_DEVICE_LINK(Srcs...) {
  5940. .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"}
  5941. }
  5942. ### @usage: STRIP()
  5943. ### Strip debug info from a PROGRAM, DLL or TEST.
  5944. ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
  5945. macro STRIP() {
  5946. ENABLE(STRIP)
  5947. }
  5948. ### @usage: NO_OPTIMIZE()
  5949. ### Build code without any optimizations (-O0 mode).
  5950. macro NO_OPTIMIZE() {
  5951. ENABLE(NO_OPTIMIZE)
  5952. }
  5953. #TODO(YMAKE-91) read proper compile flags instead of sending explicit flags to semgraph directly
  5954. _SEM_EXTRA_CXX_FLAGS=
  5955. ### @usage: NO_COMPILER_WARNINGS()
  5956. ### Disable all compiler warnings in the module.
  5957. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5958. macro NO_COMPILER_WARNINGS() {
  5959. ENABLE(NO_COMPILER_WARNINGS)
  5960. SET(_SEM_EXTRA_CXX_FLAGS -Wno-everything)
  5961. }
  5962. ### @usage: WERROR()
  5963. ### Consider warnings as errors in the current module.
  5964. ### In the bright future will be removed, since WERROR is the default.
  5965. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5966. macro WERROR() {
  5967. ENABLE(WERROR)
  5968. }
  5969. ### @usage: NO_WERROR()
  5970. ### Override WERROR() behavior
  5971. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5972. macro NO_WERROR() {
  5973. DISABLE(WERROR)
  5974. }
  5975. ### @usage: NO_WSHADOW()
  5976. ### Disable C++ shadowing warnings.
  5977. macro NO_WSHADOW() {
  5978. ENABLE(NO_WSHADOW)
  5979. }
  5980. # tag:internal
  5981. ### @usage: NO_PLATFORM_RESOURCES() # internal
  5982. ### Exclude dependency on platform resources libraries.
  5983. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  5984. macro NO_PLATFORM_RESOURCES() {
  5985. ENABLE(NOPLATFORM_RESOURCES)
  5986. }
  5987. # tag:internal tag:codenav
  5988. ### @usage: NO_CODENAVIGATION() # internal
  5989. ### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
  5990. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  5991. macro NO_CODENAVIGATION() {
  5992. ENABLE(NOCODENAVIGATION)
  5993. }
  5994. ### @usage: NO_UTIL()
  5995. ### Build module without dependency on util.
  5996. ### Note: use this with care. Util most likely will be linked into executable anyway,
  5997. ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
  5998. macro NO_UTIL() {
  5999. ENABLE(NOUTIL)
  6000. }
  6001. ### @usage: NO_RUNTIME()
  6002. ###
  6003. ### This macro:
  6004. ### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
  6005. ### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
  6006. ### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
  6007. ### may not be detected at build time and may lead to unpredictable behavors at configure time.
  6008. macro NO_RUNTIME() {
  6009. SET(USE_ARCADIA_LIBM no)
  6010. NO_UTIL()
  6011. ENABLE(NORUNTIME)
  6012. }
  6013. ### @usage: NO_LIBC()
  6014. ###
  6015. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
  6016. ### Note: use this with care. libc most likely will be linked into executable anyway,
  6017. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  6018. macro NO_LIBC() {
  6019. NO_RUNTIME()
  6020. DISABLE(MUSL)
  6021. }
  6022. ### @usage: NO_PLATFORM()
  6023. ###
  6024. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
  6025. ### Note: use this with care. libc most likely will be linked into executable anyway,
  6026. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  6027. macro NO_PLATFORM() {
  6028. NO_LIBC()
  6029. ENABLE(NOPLATFORM)
  6030. }
  6031. # tag:cpp-specific
  6032. ### @usage: USE_CXX()
  6033. ###
  6034. ### Add dependency on C++ runtime
  6035. ### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
  6036. macro USE_CXX() {
  6037. DISABLE(NORUNTIME)
  6038. }
  6039. ### @usage: USE_UTIL()
  6040. ###
  6041. ### Add dependency on util and C++ runtime
  6042. ### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
  6043. macro USE_UTIL() {
  6044. USE_CXX()
  6045. DISABLE(NOUTIL)
  6046. }
  6047. # tag:deprecated
  6048. ### @usage: NO_JOIN_SRC() # deprecated, does-nothing
  6049. ### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
  6050. macro NO_JOIN_SRC() {
  6051. ENABLE(UNUSED_MACRO)
  6052. }
  6053. # tag:sanitize
  6054. ### @usage: NO_SANITIZE()
  6055. ###
  6056. ### Disable all sanitizers for the module.
  6057. macro NO_SANITIZE() {
  6058. DISABLE(SANITIZER_TYPE)
  6059. }
  6060. # tag:coverage tag:sanitize
  6061. ### @usage: NO_SANITIZE_COVERAGE()
  6062. ###
  6063. ### Disable lightweight coverage (-fsanitize-coverage) for the module.
  6064. macro NO_SANITIZE_COVERAGE() {
  6065. DISABLE(SANITIZE_COVERAGE)
  6066. }
  6067. # tag:coverage
  6068. ### @usage: NO_CLANG_COVERAGE()
  6069. ###
  6070. ### Disable heavyweight clang coverage for the module
  6071. macro NO_CLANG_COVERAGE() {
  6072. DISABLE(CLANG_COVERAGE)
  6073. }
  6074. macro NO_CLANG_TIDY() {
  6075. DISABLE(TIDY)
  6076. }
  6077. # tag:python-specific tag:coverage
  6078. ### @usage: NO_PYTHON_COVERAGE()
  6079. ###
  6080. ### Disable python coverage for module
  6081. macro NO_PYTHON_COVERAGE() {
  6082. DISABLE(PYTHON_COVERAGE)
  6083. }
  6084. # tag:python-specific tag:coverage tag:cython
  6085. ### @usage: NO_CYTHON_COVERAGE()
  6086. ###
  6087. ### Disable cython and cythonized python coverage (CYTHONIZE_PY)
  6088. ### Implies NO_CLANG_COVERAGE() - right now, we can't disable instrumentation for .py.cpp files, but enable for .cpp
  6089. macro NO_CYTHON_COVERAGE() {
  6090. DISABLE(CYTHON_COVERAGE)
  6091. NO_CLANG_COVERAGE()
  6092. }
  6093. # tag:lua-specific
  6094. LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
  6095. macro _LUAJIT_OBJDUMP(Src, OUT="") {
  6096. .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"}
  6097. }
  6098. # tag:lua-specific
  6099. LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
  6100. macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
  6101. .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"}
  6102. }
  6103. macro _MX_BIN_TO_INFO(Src) {
  6104. .CMD=${tool:"tools/mx_bin2info"} ${input:Src} ${output;nopath;noext;noauto:Src.info} ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
  6105. }
  6106. MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \
  6107. ${output_include;hide:"kernel/matrixnet/mn_sse.h"} \
  6108. ${output_include;hide:"library/cpp/archive/yarchive.h"} \
  6109. ${output_include;hide:"util/memory/blob.h"} \
  6110. ${output_include;hide:"util/generic/hash.h"} \
  6111. ${output_include;hide:"util/generic/ptr.h"} \
  6112. ${output_include;hide:"util/generic/singleton.h"}
  6113. macro _MX_GEN_TABLE(Srcs...) {
  6114. .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"}
  6115. PEERDIR(kernel/matrixnet)
  6116. PEERDIR(library/cpp/archive)
  6117. }
  6118. RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"}
  6119. ### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
  6120. ###
  6121. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
  6122. ###
  6123. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6124. macro GENERATE_ENUM_SERIALIZATION(File) {
  6125. .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"}
  6126. .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"}
  6127. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6128. }
  6129. ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
  6130. ###
  6131. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
  6132. ### Provide access to serialization functions via generated header File_serialized.h
  6133. ###
  6134. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6135. macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
  6136. .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"}
  6137. .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"}
  6138. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6139. }
  6140. ### @usage: DEB_VERSION(File)
  6141. ###
  6142. ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
  6143. macro DEB_VERSION(File) {
  6144. .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"}
  6145. }
  6146. BUILD_MN_SCRIPT=build/scripts/build_mn.py
  6147. # tag:matrixnet
  6148. ### @usage: BUILD_MN([CHECK] [PTR] [MULTI] mninfo mnname) # matrixnet
  6149. ###
  6150. ### Generate MatrixNet data and access code using single command.
  6151. ### Alternative macro BUILD_MNS() works faster and better for large files.
  6152. macro BUILD_MN(MnInfo, MnName, CHECK?"fml_tool=$FML_UNUSED_TOOL CHECK":"", MULTI?, PTR?, RANKING_SUFFIX="") {
  6153. .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"}
  6154. }
  6155. macro _BUILD_MNS_FILE(Input, Name, Output, Suffix, Check, Fml_tool, AsmDataName) {
  6156. .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"}
  6157. }
  6158. MNS_OUTPUT=mnmodels
  6159. macro _BUILD_MNS_CPP(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6160. .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"}
  6161. }
  6162. macro _BUILD_MNS_HEADER(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6163. .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"}
  6164. }
  6165. # TODO: support foreach_in and keywords simultaneous usage (look at BUILD_MNS_FILES)
  6166. # tag:matrixnet
  6167. ### @usage: BUILD_MNS([CHECK] NAME listname mninfos...) # matrixnet
  6168. ###
  6169. ### Generate MatrixNet data and access code using separate commands for support code, interface and data.
  6170. ### Faster version of BUILD_MN() macro for large files.
  6171. macro BUILD_MNS(Files...) {
  6172. _BUILD_MNS_HEADER($Files)
  6173. _BUILD_MNS_CPP($Files)
  6174. _BUILD_MNS_FILES($Files)
  6175. }
  6176. ### @usage: COMPILE_NLG(Src...)
  6177. ###
  6178. ### Generate and compile .nlg templates (Jinja2-based) and interface for megamind runtime.
  6179. ###
  6180. ### Alice-specific macro
  6181. macro COMPILE_NLG(Src...) {
  6182. PEERDIR(alice/nlg/library/runtime)
  6183. RUN_PROGRAM(alice/nlg/tools/codegen compile-cpp --import-dir ${ARCADIA_ROOT} --out-dir ${ARCADIA_BUILD_ROOT} --include-prefix ${MODDIR} ${Src} IN ${Src} OUT_NOAUTO register.cpp register.h ${suf=.cpp:Src} ${suf=.h:Src} ${suf=.pb.txt:Src})
  6184. SRCS(GLOBAL register.cpp ${suf=.cpp:Src})
  6185. }
  6186. ### @usage: NEED_CHECK()
  6187. ###
  6188. ### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
  6189. ### automatically merged to trunk only if there is no new broken build targets in check results.
  6190. ### The use of this macro is disabled by default.
  6191. macro NEED_CHECK(Flags...) {
  6192. # TODO: FIXME
  6193. ENABLE(UNUSED_MACRO)
  6194. }
  6195. ### @usage: NO_NEED_CHECK()
  6196. ###
  6197. ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
  6198. macro NO_NEED_CHECK(Flags...) {
  6199. ENABLE(UNUSED_MACRO)
  6200. }
  6201. # tag:deprecated
  6202. ### @usage: NEED_REVIEW() # deprecated
  6203. ###
  6204. ### Mark the project as needing review.
  6205. ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
  6206. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
  6207. macro NEED_REVIEW(Flags...) {
  6208. # TODO: FIXME
  6209. ENABLE(UNUSED_MACRO)
  6210. }
  6211. ### @usage: VERSION(Args...)
  6212. ###
  6213. ### Specify version of a module. Currently unused by build system, only informative.
  6214. macro VERSION(Flags...) {
  6215. ENABLE(UNUSED_MACRO)
  6216. }
  6217. DATAWORK_SCHEEME_EXPORT_FLAGS=
  6218. when ($UNIX == "yes") {
  6219. SCHEEME2_CFLAGS= -E -x c++
  6220. }
  6221. when ($WIN32 == "yes") {
  6222. SCHEEME2_CFLAGS= /E /TP
  6223. }
  6224. SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
  6225. ### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
  6226. ###
  6227. ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
  6228. ###
  6229. ### 1. ${scheeme_name}.inc - the name of the generated file.
  6230. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
  6231. ###
  6232. ### @example:
  6233. ###
  6234. ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
  6235. ###
  6236. ### 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)
  6237. ### sets in extra option
  6238. ###
  6239. ### @example:
  6240. ###
  6241. ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
  6242. ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
  6243. ### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
  6244. ###
  6245. ### for compatibility with C++ compiler and the external environment.
  6246. ### See tools/structparser for more details.
  6247. macro GEN_SCHEEME2(ScheemeName, FromFile) {
  6248. .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"}
  6249. }
  6250. ### @usage: SYMLINK(from to)
  6251. ### Add symlink
  6252. macro SYMLINK(From, To) {
  6253. .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"}
  6254. }
  6255. # tag:internal
  6256. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6257. ### Generate prefix " && target_sources PRIVATE " before $Args when GENERATE is specified in the list of actual arguments
  6258. macro _TARGET_SOURCES_FOR_HEADERS_IMPL(GENERATE?" && target_sources PRIVATE ":"", Args...) {
  6259. .SEM=$GENERATE ${output;ext=.h:Args} ${output;ext=.hh:Args} ${output;ext=.hpp:Args} ${output;ext=.inc:Args} ${output;ext=.i:Args}
  6260. }
  6261. # tag:internal
  6262. ### @usage: _TARGET_SOURCES_FOR_HEADERS(Args...) # internal
  6263. ### Generate prefix " && target_sources PRIVATE " before $Args if Args is not empty
  6264. macro _TARGET_SOURCES_FOR_HEADERS(Args...) {
  6265. .SEM=$_TARGET_SOURCES_FOR_HEADERS_IMPL(${pre=GENERATE :Args})
  6266. }
  6267. # tag:internal
  6268. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6269. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args when GENERATE is specified in the list of actual arguments
  6270. macro _SET_ENV_FOR_CUSTOM_COMMAND_IMPL(GENERATE?" ${CMAKE_COMMAND} -E env ":"", Args...) {
  6271. .SEM=$GENERATE ${pre= :Args}
  6272. }
  6273. # tag:internal
  6274. ### @usage: _SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
  6275. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args if Args is not empty
  6276. macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
  6277. .SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args})
  6278. }
  6279. macro _FMT_INDUCED_DEPS(For, Deps...) {
  6280. .CMD=${induced_deps=$For:Deps}
  6281. }
  6282. ### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...)
  6283. ###
  6284. ### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR`
  6285. ### This tells that files of Type resulted from code generation macros (not neccessarily directly,
  6286. ### but in processing chain of generated files) should have extra dependencies from list of Files...
  6287. ###
  6288. ### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from
  6289. ### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp
  6290. ### resulted from Cython-processing of generated pyx. The code ganeration will look like:
  6291. ### ```
  6292. ### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd)
  6293. ### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h)
  6294. ### RUN_PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS)
  6295. ### ```
  6296. ###
  6297. ### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing
  6298. ### as an element of array parameter. This is needed because language of ya.make doesn't support
  6299. ### Dict params right now and so it is impossible to directly pass something
  6300. ### like `{Type1:[Files2...], Type2:[Files2...]}`
  6301. ###
  6302. macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) {
  6303. SET($VAR \$_FMT_INDUCED_DEPS($For $Deps))
  6304. }
  6305. ### @usage: RUN_PROGRAM(tool_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6306. ###
  6307. ### Run a program from arcadia.
  6308. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6309. ###
  6310. ### Parameters:
  6311. ### - tool_path - Path to the directory of the tool.
  6312. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6313. ### - CWD dir - Absolute path of the working directory.
  6314. ### - ENV key=value... - Environment variables.
  6315. ### - TOOL tools... - Auxiliary tool directories.
  6316. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6317. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6318. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6319. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6320. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6321. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6322. ###
  6323. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6324. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6325. ### 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).
  6326. macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6327. .CMD=${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6328. .SEM=add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${tool:Tool} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND ${tool:Tool} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  6329. }
  6330. # tag:lua-specific
  6331. ### @usage: RUN_LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6332. ###
  6333. ### Run a lua script.
  6334. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6335. ###
  6336. ### Parameters:
  6337. ### - script_path - Path to the script.3
  6338. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6339. ### - CWD dir - Absolute path of the working directory.
  6340. ### - ENV key=value... - Environment variables.
  6341. ### - TOOL tools... - Auxiliary tool directories.
  6342. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6343. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6344. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6345. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6346. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6347. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6348. ###
  6349. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6350. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6351. macro RUN_LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6352. .CMD=${cwd:CWD} ${env:ENV} $LUA_TOOL ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p LU"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6353. }
  6354. # tag:python-specific
  6355. ### @usage: PYTHON(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6356. ###
  6357. ### Run a python script with $(PYTHON)/python built from devtools/huge_python.
  6358. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6359. ###
  6360. ### Parameters:
  6361. ### - script_path - Path to the script.
  6362. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6363. ### - CWD dir - Absolute path of the working directory.
  6364. ### - ENV key=value... - Environment variables.
  6365. ### - TOOL tools... - Auxiliary tool directories.
  6366. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6367. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6368. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6369. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6370. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6371. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6372. ###
  6373. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6374. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6375. macro PYTHON(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6376. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6377. .SEM=find_package Python2 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python2::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  6378. }
  6379. # tag:python-specific
  6380. ### @usage: RUN_PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6381. ###
  6382. ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
  6383. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6384. ###
  6385. ### Parameters:
  6386. ### - script_path - Path to the script.
  6387. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6388. ### - CWD dir - Absolute path of the working directory.
  6389. ### - ENV key=value... - Environment variables.
  6390. ### - TOOL tools... - Auxiliary tool directories.
  6391. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6392. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6393. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6394. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6395. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6396. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6397. ###
  6398. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6399. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6400. macro RUN_PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6401. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6402. .PEERDIR=$YMAKE_PYTHON3_PEER
  6403. .SEM=find_package Python3 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python3::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  6404. }
  6405. # tag:java-specific
  6406. macro _RUN_JAVA(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) {
  6407. PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6408. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input;pre=build/scripts/:HIDE_OUTPUT.py} $JDK_RESOURCE/bin/java $Args ${tool;hide:TOOL} ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  6409. }
  6410. ### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6411. ###
  6412. ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
  6413. ### You may specify extra dependencies that output files bring using OUTPUT_INCLUDES or INDUCED_DEPS. The change of these may e.g. lead to recompilation of .cpp files extracted from resource.
  6414. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
  6415. ###
  6416. ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
  6417. ###
  6418. ### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
  6419. ### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
  6420. ### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
  6421. ### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
  6422. ###
  6423. ### RENAME RESOURCE allows to rename the resource without specifying its file name.
  6424. ###
  6425. ### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6426. ### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6427. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6428. ###
  6429. ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
  6430. ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
  6431. ### so you shall place it immediately after resource_id.
  6432. macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:") {
  6433. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6434. ADD_CHECK(check.resource $Id)
  6435. }
  6436. ### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6437. ###
  6438. ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6439. macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6440. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_mds.py"} --key $Key $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p MD"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6441. ADD_CHECK(check.mds $Key)
  6442. }
  6443. # tag:internal
  6444. ### @usage: _FROM_EXTERNAL(ExtFile [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) #internal
  6445. ###
  6446. ### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS).
  6447. macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") {
  6448. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$EXT;suf=.external:OutFile} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_external.py"} --external-file ${input:File} --resource-file $(RESOURCE_ROOT)/ext/$OutFile --copy-to-dir $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/fetch_from_sandbox.py"} ${input;hide:"build/scripts/fetch_from_mds.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p XT"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6449. #FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors
  6450. #FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented
  6451. }
  6452. ### @usage LARGE_FILES([AUTOUPDATED] Files...)
  6453. ###
  6454. ### Use large file ether from working copy or from remote storage via placeholder <File>.external
  6455. ### If <File> is present locally (and not a symlink!) it will be copied to build directory.
  6456. ### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
  6457. macro LARGE_FILES(AUTOUPDATED?, Files...) {
  6458. # This is needed to correctly switch between remote and local modes
  6459. _GLOB($LF $Files)
  6460. }
  6461. ### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6462. ###
  6463. ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6464. macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6465. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_archive.py"} "--archive" ${input:Src} "--file-name" ${suf=-:Src} "--untar-to" $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p FA"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6466. }
  6467. when ($MSVC == "yes") {
  6468. C_AS_CXX_FLAGS=/TP /std:c++17
  6469. }
  6470. otherwise {
  6471. C_AS_CXX_FLAGS=-x c++ -std=c++17
  6472. }
  6473. # tag:cpp-specific
  6474. ### @usage: COMPILE_C_AS_CXX()
  6475. ###
  6476. ### Compile .c files as .cpp ones within a module.
  6477. macro COMPILE_C_AS_CXX() {
  6478. SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
  6479. }
  6480. ### @usage: NO_DEBUG_INFO()
  6481. ###
  6482. ### Compile files without debug info collection.
  6483. macro NO_DEBUG_INFO() {
  6484. SET(NO_DEBUGINFO yes)
  6485. }
  6486. ### @usage: CTEMPLATE_VARNAMES(File)
  6487. ###
  6488. ### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
  6489. ###
  6490. ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
  6491. macro CTEMPLATE_VARNAMES(File) {
  6492. .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
  6493. }
  6494. LLVM_OPTS=
  6495. CLANG_ROOT=$CLANG_RESOURCE_GLOBAL
  6496. CLANG_BINARIES_ROOT=$CLANG_ROOT/bin
  6497. CLANG_CPP_COMPILER_BIN=$CLANG_BINARIES_ROOT/clang++
  6498. CLANG_C_COMPILER_BIN=$CLANG_BINARIES_ROOT/clang
  6499. when ($OS_ANDROID == "yes") {
  6500. CLANG_ROOT=$CLANG_ANDROID_RESOURCE_GLOBAL
  6501. when ($HOST_OS_DARWIN) {
  6502. CLANG_BINARIES_ROOT=$CLANG_ROOT/toolchains/llvm/prebuilt/darwin-x86_64/bin
  6503. }
  6504. otherwise {
  6505. CLANG_BINARIES_ROOT=$CLANG_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin
  6506. }
  6507. }
  6508. ### @usage: GENERATED_SRCS(srcs... PARSE_META_FROM cpp_srcs... [OUTPUT_INCLUDES output_includes...] [OPTIONS])
  6509. ###
  6510. ### Generate sources using Jinja 2 template engine.
  6511. ###
  6512. ### srcs... - list of text files which will be generated during build time by templates. Each template must be
  6513. ### placed to the place in source tree where corresponding source file should be generated. Name of
  6514. ### template must be "<name_of_src_file>.markettemplate". For example if you want to generate file "example.cpp"
  6515. ### then template should be named "example.cpp.markettemplate".
  6516. ### PARSE_META_FROM cpp_srcs... - list of C++ source files (.cpp, .h) which will be parsed using clang library
  6517. ### and metainformation extracted from the files will be made available for templates. Example of
  6518. ### template code fragment using metainformation: {{ meta.objects["@N@std@S@string"].name }}
  6519. ### OUTPUT_INCLUDES output_includes... - in cases when build system parser fails to determine all headers
  6520. ### which generated files include, you can specify additional headers here. In a normal situation this should
  6521. ### not be needed and this feature could be removed in the future.
  6522. ### OPTIONS - additional options for code_generator utility
  6523. ###
  6524. ### Examples of templates can be found in directory market/tools/code_generator/templates.
  6525. ### Metainformation does not contain entries for every object declared in C++ files specified in PARSE_META_FROM
  6526. ### parameter. To include some object into consideration you need to mark it by attribute. Attributes can
  6527. ### automatically add more attributes to dependent objects. This behavior depends on attribute definition.
  6528. ###
  6529. ### More information will be available (eventually:) here: https://wiki.yandex-team.ru/Users/denisk/codegenerator/
  6530. macro GENERATED_SRCS(PARSE_META_FROM{input}[], OUTPUT_INCLUDES[], OPTIONS[], TEMPLATES...) {
  6531. .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
  6532. PEERDIR(build/platform/clang)
  6533. }
  6534. ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
  6535. ###
  6536. ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
  6537. ### Note: Output name is used as is, no extension added.
  6538. macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
  6539. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_CPP_COMPILER_BIN ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS -emit-ast -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p ST"} ${kv;hide:"pc light-green"}
  6540. PEERDIR(build/platform/clang)
  6541. }
  6542. ### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
  6543. ###
  6544. ### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6545. ### Note: Output name is used as is, no extension added.
  6546. macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
  6547. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_CPP_COMPILER_BIN ${pre=-I:_C__INCLUDE} $BC_CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6548. .SEM=llvm_compile_cxx ${input:Input} ${output;noauto:Output} ${CLANGPLUSPLUS} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  6549. PEERDIR(build/platform/clang)
  6550. }
  6551. ### @usage: LLVM_COMPILE_C(Input Output Opts...)
  6552. ###
  6553. ### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6554. ### Note: Output name is used as is, no extension added.
  6555. macro LLVM_COMPILE_C(Input, Output, Opts...) {
  6556. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_C_COMPILER_BIN ${pre=-I:_C__INCLUDE} $BC_CFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6557. PEERDIR(build/platform/clang)
  6558. }
  6559. ### @usage: BPF(Input Output Opts...)
  6560. ###
  6561. ### Emit eBPF bytecode from .c file.
  6562. ### Note: Output name is used as is, no extension added.
  6563. macro BPF(Input, Output, Opts...) {
  6564. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_C_COMPILER_BIN ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BP"} ${kv;hide:"pc light-green"}
  6565. PEERDIR(build/platform/clang)
  6566. }
  6567. ### @usage: BPF_STATIC(Input Output Opts...)
  6568. ###
  6569. ### Emit eBPF bytecode from .c file.
  6570. ### Note: Output name is used as is, no extension added.
  6571. macro BPF_STATIC(Input, Output, Opts...) {
  6572. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_C_COMPILER_BIN ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BP"} ${kv;hide:"pc light-green"} && ${cwd:BINDIR} $LLD_ROOT_RESOURCE_GLOBAL/ld -r -b binary -m elf_x86_64 -o ${output;noauto;suf=.bpf.o:Input} ${noauto;nopath:Output}
  6573. PEERDIR(build/platform/clang build/platform/lld)
  6574. }
  6575. ### @usage: LLVM_COMPILE_LL(Input Output Opts...)
  6576. ###
  6577. ### Compile LLVM bytecode to object representation.
  6578. ### Note: Output name is used as is, no extension added.
  6579. macro LLVM_COMPILE_LL(Input, Output, Opts...) {
  6580. .CMD=$CLANG_BINARIES_ROOT/llvm-as ${input:Input} -o ${output;noauto:Output} ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6581. PEERDIR(build/platform/clang)
  6582. }
  6583. ### @usage: LLVM_LINK(Output Inputs...)
  6584. ###
  6585. ### Call llvm-link on set of Inputs to produce Output.
  6586. ### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
  6587. macro LLVM_LINK(Output, Inputs...) {
  6588. .CMD=$CLANG_BINARIES_ROOT/llvm-link ${input:Inputs} -o ${output;noauto:Output} ${kv;hide:"p LD"} ${kv;hide:"pc light-red"}
  6589. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Inputs} COMMAND ${LLVMLINK} ${input:Inputs} -o ${output;noauto:Output}
  6590. PEERDIR(build/platform/clang)
  6591. }
  6592. ### @usage: LLVM_OPT(Input Output Opts...)
  6593. ###
  6594. ### Call llvm-opt with set of Opts on Input to produce Output.
  6595. ### Note: Output name is used as is, no extension added.
  6596. macro LLVM_OPT(Input, Output, Opts...) {
  6597. .CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} $CLANG_BINARIES_ROOT/opt ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p OP"} ${kv;hide:"pc yellow"}
  6598. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMOPT} ${input:Input} -o ${output;noauto:Output} $Opts
  6599. PEERDIR(build/platform/clang)
  6600. }
  6601. when ($NO_DEBUGINFO == "yes") {
  6602. DEBUG_INFO_FLAGS=
  6603. }
  6604. when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
  6605. DEBUG_INFO_FLAGS=-gline-tables-only
  6606. }
  6607. # TODO: configurable tar and touch
  6608. PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  6609. # tag:internal
  6610. ### @usage TOUCH(Outputs...) # internal
  6611. ### Just introduce outputs
  6612. macro TOUCH(Outputs...) {
  6613. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
  6614. }
  6615. TOUCH_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p UN"} ${kv;hide:"pc light-cyan"} $TARGET
  6616. 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
  6617. _P_PK=${kv;hide:"p PK"}
  6618. TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK
  6619. TOUCH_JAVA_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"java $CURDIR"} $TARGET
  6620. NO_CHECK_IMPORTS_FOR_VALUE=None
  6621. ### @usage: NO_CHECK_IMPORTS([patterns])
  6622. ###
  6623. ### Do not run checks on imports of Python modules.
  6624. ### Optional parameter mask patterns describes the names of the modules that do not need to check.
  6625. macro NO_CHECK_IMPORTS(Masks...) {
  6626. SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
  6627. }
  6628. # tag:yasm-specific
  6629. _YASM_FMT_VALUE=
  6630. _YASM_PLATFORM_FLAGS_VALUE=
  6631. _YASM_PREDEFINED_FLAGS_VALUE=
  6632. when ($OS_DARWIN || $OS_IOS) {
  6633. _YASM_FMT_VALUE=macho
  6634. _YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
  6635. }
  6636. elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
  6637. _YASM_FMT_VALUE=win
  6638. _YASM_PLATFORM_FLAGS_VALUE=-D WIN64
  6639. }
  6640. elsewhen ($OS_WINDOWS && $ARCH_I386) {
  6641. _YASM_FMT_VALUE=win
  6642. _YASM_PLATFORM_FLAGS_VALUE=-D WIN32
  6643. }
  6644. otherwise {
  6645. _YASM_FMT_VALUE=elf
  6646. _YASM_PLATFORM_FLAGS_VALUE=-D UNIX
  6647. _YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
  6648. }
  6649. when ($ASM_PREFIX) {
  6650. ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
  6651. }
  6652. otherwise {
  6653. ASM_PREFIX_VALUE=
  6654. }
  6655. # tag:yasm-specific
  6656. YASM_FLAGS=
  6657. YASM_PREINCLUDES_VALUE=
  6658. # tag:yasm-specific
  6659. macro _SRC_yasm_helper(SRC, PREINCLUDES[], SRCFLAGS...) {
  6660. .CMD=${tool:"contrib/tools/yasm"} -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE $YASM_DEBUG_INFO $YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__ -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${pre=-P :PREINCLUDES} ${input;hide:PREINCLUDES} ${SRC} ${kv;hide:"p AS"} ${kv;hide:"pc light-green"}
  6661. }
  6662. # tag:yasm-specific
  6663. macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  6664. .CMD=$_SRC_yasm_helper(${input:SRC}, $SRCFLAGS, PREINCLUDES $PREINCLUDES)
  6665. }
  6666. ### @usage: ASM_PREINCLUDE(AsmFiles...)
  6667. ###
  6668. ### Supply additional .asm files to all assembler calls within a module
  6669. macro ASM_PREINCLUDE(PREINCLUDES...) {
  6670. SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
  6671. }
  6672. # tag:python-specific
  6673. ### @usage: RUN_PYTHON(Args...)
  6674. ###
  6675. ### Version of RUN() macro to invoke Python scripts
  6676. ### @see: [RUN()](#macro_RUN)
  6677. macro RUN_PYTHON(Args...) {
  6678. SETUP_RUN_PYTHON()
  6679. RUN(${PYTHON_BIN} $Args)
  6680. }
  6681. ### @usage: RUN_ANTLR(Args...)
  6682. ###
  6683. ### Macro to invoke ANTLR3 generator (general case)
  6684. macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  6685. PEERDIR(build/external_resources/antlr3 build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6686. .CMD=$_RUN_JAVA(-jar $ANTLR3_RESOURCE_GLOBAL/antlr-3.5.2-complete-no-st3.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
  6687. .SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args
  6688. }
  6689. ### @usage: RUN_ANTLR4(Args...)
  6690. ###
  6691. ### Macro to invoke ANTLR4 generator (general case)
  6692. macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  6693. PEERDIR(build/external_resources/antlr4)
  6694. _RUN_JAVA(-jar $ANTLR4_RESOURCE_GLOBAL/antlr-4.9-complete.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
  6695. }
  6696. _ANTLR4_LISTENER_GRAMMAR=-listener
  6697. _ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
  6698. _ANTLR4_VISITOR_GRAMMAR=-visitor
  6699. _ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
  6700. ### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  6701. ###
  6702. ### Macro to invoke ANTLR4 generator (Cpp)
  6703. macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6704. 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})
  6705. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  6706. }
  6707. ### @usage: RUN_ANTLR4_GO(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  6708. ###
  6709. ### Macro to invoke ANTLR4 generator (Go)
  6710. macro RUN_ANTLR4_GO(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6711. 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})
  6712. PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr)
  6713. }
  6714. # tag:cpp-specific
  6715. macro CPP_ADDINCL(Dirs...) {
  6716. ADDINCL($Dirs)
  6717. }
  6718. # tag:internal
  6719. _WHOLE_ARCHIVE_PEERS_VALUE=
  6720. ### @usage: WHOLE_ARCHIVE(dirnames...) # internal
  6721. macro WHOLE_ARCHIVE(PEERS...) {
  6722. SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
  6723. REQUIRES(${PEERS})
  6724. }
  6725. ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
  6726. macro TASKLET() {
  6727. PEERDIR(tasklet/api)
  6728. # CPP
  6729. CPP_PROTO_PLUGIN(tasklet_cpp tasklet/gen/cpp .tasklet.h)
  6730. # Python
  6731. PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/gen/python DEPS tasklet/domain/sandbox tasklet/runtime sandbox/sdk2)
  6732. }
  6733. TASKLET_REG_INCLUDES= \
  6734. ${output_include;hide:"tasklet/runtime/lib/cpp_wrapper.h"} \
  6735. ${output_include;hide:"tasklet/runtime/lib/go_wrapper.h"} \
  6736. ${output_include;hide:"tasklet/runtime/lib/py_wrapper.h"} \
  6737. ${output_include;hide:"tasklet/runtime/lib/js_wrapper.h"} \
  6738. ${output_include;hide:"tasklet/runtime/lib/registry.h"}
  6739. macro TASKLET_REG(Name, Lang, Impl, Includes...) {
  6740. PEERDIR(tasklet/domain sandbox/bin sandbox/taskbox/worker)
  6741. when($Lang == "js") {
  6742. # JS runtime links the Node.js from contrib as a library, which is a bit heavy,
  6743. # so we do it, only if any JS tasklets are linked into the target
  6744. PEERDIR+=tasklet/runtime/js
  6745. }
  6746. .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"}
  6747. SRCS(GLOBAL $Name.task.cpp)
  6748. }
  6749. # TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
  6750. # NOT COMPLETE
  6751. macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
  6752. PEERDIR(tasklet/domain sandbox/bin sandbox/taskbox/worker)
  6753. .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"}
  6754. SRCS(GLOBAL $Name.task.cpp)
  6755. }
  6756. # tag:cpp-specific
  6757. _CPP_PROTO_MODULE_PREFIX=
  6758. _CPP_PROTO_MODULE_SUFFIX=
  6759. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6760. _CPP_PROTO_MODULE_PREFIX=
  6761. _CPP_PROTO_MODULE_SUFFIX=.lib
  6762. }
  6763. otherwise {
  6764. _CPP_PROTO_MODULE_PREFIX=lib
  6765. _CPP_PROTO_MODULE_SUFFIX=.a
  6766. }
  6767. ### @usage: EXPOSE(OutputsToExport...)
  6768. ###
  6769. ### Allows to mark outputs of macro command as unused in the current module but intended
  6770. ### to be used in modules consuming current via PEERDIR.
  6771. ###
  6772. ### TODO(DEVTOOLS-9000) proper implementation needed
  6773. macro EXPOSE(Args...) {
  6774. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).cpp:"empty_"} ${input;hide:Args}
  6775. }
  6776. # tag:proto
  6777. macro _PROTO_DESC_CMD(File) {
  6778. .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}
  6779. }
  6780. _PROTO_DESC_MERGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $AUTO_INPUT ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
  6781. _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"}
  6782. NEED_GOOGLE_PROTO_PEERDIRS=yes
  6783. PROTO_LIBRARY_SEM=$CPP_LIBRARY_SEM
  6784. # tag:proto
  6785. ### @usage: PROTO_LIBRARY()
  6786. ###
  6787. ### Build some varian of protocol buffers library.
  6788. ###
  6789. ### The particular variant is selected based on where PEERDIR to PROTO_LIBRARY comes from.
  6790. ###
  6791. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  6792. ### When PEERDIR comes from module for particular language appropriate variant is selected.
  6793. ### PROTO_LIBRARY also supports emission of GRPC code if GRPC() macro is specified.
  6794. ### Notes:
  6795. ### - Python versions emit C++ code in addition to Python as optimization.
  6796. ### - In some PROTO_LIBRARY-es Java or Python versions are excluded via EXCLUDE_TAGS macros due to incompatibilities.
  6797. ### - Use from DEPENDS or BUNDLE is not allowed
  6798. ###
  6799. ### Documentation: https://wiki.yandex-team.ru/yatool/proto_library/
  6800. ###
  6801. ### See: [GRPC()](#macro_GRPC), [OPTIMIZE_PY_PROTOS()](#macro_OPTIMIZE_PY_PROTOS), [INCLUDE_TAGS()](#macro_INCLUDE_TAGS), [EXCLUDE_TAGS()](#macro_EXCLUDE_TAGS)
  6802. multimodule PROTO_LIBRARY {
  6803. module CPP_PROTO : LIBRARY {
  6804. .ALLOWED=EXPOSE
  6805. # TODO(svidyuk): think about marker which forces semantics inheritance
  6806. .SEM=PROTO_LIBRARY_SEM
  6807. ENABLE(CPP_PROTO)
  6808. ENABLE(GEN_PROTO)
  6809. NO_CLANG_TIDY()
  6810. SET(PEERDIR_TAGS CPP_PROTO)
  6811. when ($BUILD_PROTO_AS_EVLOG == "yes" && $USE_VANILLA_PROTOC == "yes") {
  6812. _OK=no
  6813. }
  6814. ASSERT(_OK BUILD_PROTO_AS_EVLOG and USE_VANILLA_PROTOC are incompatible yet)
  6815. MODULE_SUFFIX=$_CPP_PROTO_MODULE_SUFFIX
  6816. MODULE_PREFIX=$_CPP_PROTO_MODULE_PREFIX
  6817. when ($_COMMON_GOOGLE_APIS != "None") {
  6818. PEERDIR += contrib/libs/googleapis-common-protos
  6819. }
  6820. }
  6821. module JAVA_PROTO: EXTERNAL_JAVA_LIBRARY {
  6822. .EXTS=.jsrc
  6823. .ALLOWED=GRPC
  6824. .SEM=IGNORED
  6825. SET(PEERDIR_TAGS JAVA_PROTO)
  6826. ENABLE(JAVA_PROTO)
  6827. PEERDIR+=$JAVA_PROTOBUF_PEERS contrib/java/javax/annotation/javax.annotation-api/1.3.1
  6828. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE
  6829. ADDINCL(FOR proto $PROTOBUF_PATH)
  6830. when ($_COMMON_GOOGLE_APIS != "None") {
  6831. PEERDIR += contrib/java/com/google/api/grpc/proto-google-common-protos/${JAVA_PROTO_COMMON_VERSION}
  6832. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6833. }
  6834. }
  6835. module PY_PROTO: PY2_LIBRARY {
  6836. .ALIASES=SRCS=PY_SRCS
  6837. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  6838. .PEERDIRSELF=CPP_PROTO
  6839. .SEM=IGNORED
  6840. SET(PEERDIR_TAGS PY2 PY_PROTO)
  6841. ENABLE(PY_PROTO)
  6842. OPTIMIZE_PY_PROTOS()
  6843. OBJ_SUF=.py2
  6844. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6845. SET(LINT_LEVEL_VALUE none_internal)
  6846. when ($_COMMON_GOOGLE_APIS != "None") {
  6847. PEERDIR += contrib/libs/googleapis-common-protos
  6848. }
  6849. _IGNORE_SELF_PEERS=
  6850. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  6851. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  6852. _IGNORE_PEERDIRSELF=CPP_PROTO
  6853. }
  6854. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  6855. }
  6856. module PY3_PROTO: PY3_LIBRARY {
  6857. .ALIASES=SRCS=PY_SRCS
  6858. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  6859. .PEERDIRSELF=CPP_PROTO
  6860. .SEM=IGNORED
  6861. SET(PEERDIR_TAGS PY3 PY3_PROTO)
  6862. ENABLE(PY3_PROTO)
  6863. OPTIMIZE_PY_PROTOS()
  6864. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6865. MODULE_PREFIX=py3
  6866. }
  6867. otherwise {
  6868. MODULE_PREFIX=libpy3
  6869. }
  6870. OBJ_SUF=.py3
  6871. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6872. SET(LINT_LEVEL_VALUE none_internal)
  6873. when ($_COMMON_GOOGLE_APIS != "None") {
  6874. PEERDIR += contrib/libs/googleapis-common-protos
  6875. }
  6876. _IGNORE_SELF_PEERS=
  6877. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  6878. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  6879. _IGNORE_PEERDIRSELF=CPP_PROTO
  6880. }
  6881. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  6882. }
  6883. module GO_PROTO: GO_LIBRARY {
  6884. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO
  6885. .SEM=IGNORED
  6886. SET(PEERDIR_TAGS GO GO_PROTO)
  6887. ENABLE(GO_PROTO)
  6888. when ($_COMMON_GOOGLE_APIS == "None") {
  6889. }
  6890. elsewhen ($_COMMON_GOOGLE_APIS == "") {
  6891. PEERDIR += $_GO_COMMON_GOOGLE_APIS
  6892. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6893. }
  6894. otherwise {
  6895. PEERDIR += $_COMMON_GOOGLE_APIS
  6896. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6897. }
  6898. }
  6899. module EXT_PROTO: _BARE_UNIT {
  6900. .ALIASES=SRCS=_RAW_PROTO_SRCS
  6901. .CMD=TOUCH_UNIT_MF
  6902. .SEM=IGNORED
  6903. .EXTS=.*
  6904. .PROXY=yes
  6905. .PEERDIR_POLICY=as_build_from
  6906. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
  6907. SET(PEERDIR_TAGS EXT_PROTO)
  6908. ENABLE(EXT_PROTO)
  6909. SET(MODULE_SUFFIX .raw.fake.pkg)
  6910. SET(MODULE_TYPE LIBRARY)
  6911. when ($_COMMON_GOOGLE_APIS != "None") {
  6912. PEERDIR += contrib/libs/googleapis-common-protos
  6913. }
  6914. SET(CREDITS_FILE_EXTRA_EXT .ext_proto)
  6915. }
  6916. module DESC_PROTO: _BARE_UNIT {
  6917. .CMD=_PROTO_DESC_MERGE_CMD
  6918. .SEM=IGNORED
  6919. .EXTS=.desc
  6920. .NODE_TYPE=Library
  6921. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
  6922. SET(PEERDIR_TAGS DESC_PROTO)
  6923. ENABLE(DESC_PROTO)
  6924. MODULE_SUFFIX=.self.protodesc
  6925. SET(MODULE_TYPE LIBRARY)
  6926. MACRO_ALIAS(EVLOG_CMD _PROTO_DESC_CMD)
  6927. MACRO_ALIAS(PROTO_CMD _PROTO_DESC_CMD)
  6928. when ($_COMMON_GOOGLE_APIS != "None") {
  6929. PEERDIR += contrib/libs/googleapis-common-protos
  6930. }
  6931. when ($NEED_GOOGLE_PROTO_PEERDIRS == "yes") {
  6932. when ($USE_VANILLA_PROTOC == "yes") {
  6933. PEERDIR += contrib/libs/protobuf_std/builtin_proto/protos_from_protobuf
  6934. }
  6935. otherwise {
  6936. PEERDIR += contrib/libs/protobuf/builtin_proto/protos_from_protoc
  6937. }
  6938. }
  6939. }
  6940. module PB_PY_PROTO: _PY_PACKAGE {
  6941. .INCLUDE_TAG=no
  6942. .PROXY=yes
  6943. .SEM=IGNORED
  6944. SET(MODULE_SUFFIX .pb_py.fake.pkg)
  6945. ENABLE(PB_PY_PROTO)
  6946. # WARN:
  6947. # _COMMON_GOOGLE_APIS aren't handled intentionally.
  6948. # PB_PY_PROTO is a legacy module type, stop using it.
  6949. }
  6950. }
  6951. # tag:proto
  6952. _EXT_PROTO_DIR=_RAW_
  6953. # tag:proto
  6954. ### This var defines the root of the tree for copied proto files from EXT_PROTO
  6955. ### submodule of PROTO_LIBRARY module
  6956. EXT_PROTO_ROOT=${ARCADIA_BUILD_ROOT}/${_EXT_PROTO_DIR}
  6957. # tag:proto
  6958. ### @usage: USE_EXT_PROTO(peerdir_tag...)
  6959. ###
  6960. ### Configure module to use proto files from existing PROTO_LIBRARY module.
  6961. ### Additional PEERDIR tags required to build a module can be passed through
  6962. ### EXTRA_TAGS vararg parameter.
  6963. macro USE_EXT_PROTO(EXTRA_TAGS...) {
  6964. SET(PEERDIR_TAGS EXT_PROTO ${EXTRA_TAGS})
  6965. SRCDIR(${EXT_PROTO_ROOT})
  6966. }
  6967. # tag:proto tag:internal
  6968. ### @usage: _RAW_PROTO_SRCS(files...) # internal
  6969. ###
  6970. ### _RAW_PROTO_SRCS is a proxy macro to FILES macro which filters out
  6971. ### GLOBAL keyword from the list of files (NOTE! The order of files listed
  6972. ### originally in call to _RAW_PROTO_SRCS() macro is changed in call to
  6973. ### FILES() macro). Currently this macro copies only files with the following
  6974. ### extensions: .proto, .gztproto, .ev
  6975. macro _RAW_PROTO_SRCS(FILES...) {
  6976. _COPY_FILES_TO_BUILD_PREFIX(${ext=.proto:FILES} PREFIX ${_EXT_PROTO_DIR})
  6977. _COPY_FILES_TO_BUILD_PREFIX(${ext=.gztproto:FILES} PREFIX ${_EXT_PROTO_DIR})
  6978. _COPY_FILES_TO_BUILD_PREFIX(${ext=.ev:FILES} PREFIX ${_EXT_PROTO_DIR})
  6979. }
  6980. module PROTO_DESCRIPTIONS: _BARE_UNIT {
  6981. .CMD=_PROTO_DESC_MERGE_PEERS_CMD
  6982. .PEERDIR_POLICY=as_build_from
  6983. .NODE_TYPE=Library
  6984. .RESTRICTED=SRCS
  6985. .FINAL_TARGET=yes
  6986. SET(PEERDIR_TAGS DESC_PROTO)
  6987. SET(MODULE_SUFFIX .protodesc)
  6988. SET(MODULE_TYPE PROTO_DESCRIPTIONS)
  6989. }
  6990. module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
  6991. SET(MODULE_TYPE PROTO_REGISTRY)
  6992. }
  6993. # tag:fbs
  6994. _FBS_NAMESPACE_MAP_GLOBAL=
  6995. # tag:fbs
  6996. macro _FBS_NAMESPACE_IMPL(NAMESPACE, PATH, DUMMY...) {
  6997. SET_APPEND(_FBS_NAMESPACE_MAP_GLOBAL ${NAMESPACE}=${PATH})
  6998. }
  6999. # tag:fbs
  7000. macro FBS_NAMESPACE(NAMESPACE, PATH...) {
  7001. _FBS_NAMESPACE_IMPL($NAMESPACE $PATH $MODDIR)
  7002. }
  7003. # tag:fbs
  7004. ### @usage: FBS_LIBRARY()
  7005. ###
  7006. ### Build some variant of Flatbuffers library.
  7007. ###
  7008. ### The particular variant is selected based on where PEERDIR to FBS_LIBRARY
  7009. ### comes from.
  7010. ###
  7011. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  7012. ### When PEERDIR comes from module for particular language appropriate variant
  7013. ### is selected.
  7014. ###
  7015. ### Notes: FBS_NAMESPACE must be specified in all dependent FBS_LIBRARY modules
  7016. ### if build of Go code is requested.
  7017. multimodule FBS_LIBRARY {
  7018. module CPP_FBS: LIBRARY {
  7019. ENABLE(CPP_FBS)
  7020. SET(PEERDIR_TAGS CPP_FBS)
  7021. }
  7022. module GO_FBS: GO_LIBRARY {
  7023. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7024. ENABLE(GO_FBS)
  7025. SET(PEERDIR_TAGS GO GO_FBS)
  7026. }
  7027. module JAVA_FBS: EXTERNAL_JAVA_LIBRARY {
  7028. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7029. ENABLE(JAVA_FBS)
  7030. SET(PEERDIR_TAGS JAVA_FBS)
  7031. }
  7032. module PY2_FBS: PY2_LIBRARY {
  7033. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7034. .ALIASES=SRCS=PY_SRCS
  7035. ENABLE(PY2_FBS)
  7036. SET(PEERDIR_TAGS PY2 PY2_FBS)
  7037. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7038. SET(LINT_LEVEL_VALUE none_internal)
  7039. }
  7040. module PY3_FBS: PY3_LIBRARY {
  7041. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7042. .ALIASES=SRCS=PY_SRCS
  7043. ENABLE(PY3_FBS)
  7044. SET(PEERDIR_TAGS PY3 PY3_FBS)
  7045. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7046. SET(LINT_LEVEL_VALUE none_internal)
  7047. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7048. MODULE_PREFIX=py3
  7049. }
  7050. otherwise {
  7051. MODULE_PREFIX=libpy3
  7052. }
  7053. OBJ_SUF=.py3
  7054. }
  7055. }
  7056. # tag:java-specific
  7057. _COMPILE_JSRC=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_jsrc.py"} --input $AUTO_INPUT --output $TARGET --prefix $BINDIR ${kv;hide:"p JC"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7058. # tag:java-specific
  7059. COMPILE_JSRC_MF=$_COMPILE_JSRC && $GENERATE_MF
  7060. # tag:java-specific tag:internal
  7061. ### @usage: JSRC_LIBRARY() # internal
  7062. module JSRC_LIBRARY: _BARE_UNIT {
  7063. .CMD=COMPILE_JSRC_MF
  7064. .EXTS=.java
  7065. .ALL_INS_TO_OUT=no
  7066. .PEERDIR_POLICY=as_include
  7067. .FINAL_TARGET=no
  7068. .ALIASES=SRCS=FILES
  7069. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  7070. MODULE_TYPE=Library
  7071. SET(MODULE_SUFFIX .jsrc)
  7072. SET(DONT_RESOLVE_INCLUDES yes)
  7073. SET(NEED_PLATFORM_PEERDIRS no)
  7074. SET(MODULE_LANG JAVA)
  7075. NO_RUNTIME()
  7076. }
  7077. # tag:maps-specific
  7078. @import "${CONF_ROOT}/conf/project_specific/maps/asrc.conf"
  7079. # tag:internal
  7080. ### @usage: _PROXY_LIBRARY() # internal
  7081. ###
  7082. ### The use of this module is strictly prohibited!!!
  7083. module _PROXY_LIBRARY: LIBRARY {
  7084. .EXTS=.a .lib
  7085. .PEERDIR_POLICY=as_build_from
  7086. .PROXY=yes
  7087. .FINAL_TARGET=yes
  7088. DISABLE(NEED_ADD_FAKE_SRC)
  7089. NO_UTIL()
  7090. NO_RUNTIME()
  7091. }
  7092. # tag:maps-specific
  7093. @import "${CONF_ROOT}/conf/project_specific/maps/aar.conf"
  7094. @import "${CONF_ROOT}/conf/project_specific/maps/sproto.conf"
  7095. @import "${CONF_ROOT}/conf/project_specific/maps/mapkit.conf"
  7096. _PRIMARY_OUTPUT_VALUE=
  7097. # tag:internal
  7098. ### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
  7099. ###
  7100. ### The use of this module is strictly prohibited!!!
  7101. macro PRIMARY_OUTPUT(OUTPUT) {
  7102. SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
  7103. }
  7104. _DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${input;hide:_PRIMARY_OUTPUT_VALUE} ${TARGET}
  7105. # tag:internal
  7106. ### @usage: DLL_PROXY_LIBRARY() # internal
  7107. ###
  7108. ### The use of this module is strictly prohibited!!!
  7109. module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
  7110. .ALLOWED=PRIMARY_OUTPUT
  7111. .CMD=_DLL_PROXY_LIBRARY_CMD
  7112. }
  7113. _PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${kv;hide:"p ld"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7114. # tag:internal
  7115. ### @usage: PREBUILT_PROGRAM([programname]) # internal
  7116. ###
  7117. ### Program module which uses a prebuilt prgram as its output.
  7118. module PREBUILT_PROGRAM: _LINK_UNIT {
  7119. .CMD=_PREBUILT_PROGRAM_CMD
  7120. .SYMLINK_POLICY=EXE
  7121. .ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
  7122. .RESTRICTED=SRCS
  7123. _BARE_LINK_MODULE()
  7124. SET(MODULE_TYPE PROGRAM)
  7125. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  7126. MODULE_SUFFIX=.exe
  7127. }
  7128. }
  7129. ### @usage COLLECT_JINJA_TEMPLATES(varname path)
  7130. ###
  7131. ### This macro collects all jinja and yaml files in the directory specified by second argument and
  7132. ### stores result in the variable with mane specified by first parameter.
  7133. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
  7134. _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
  7135. }
  7136. # tag:go-specific
  7137. GO_HOST_OS=unknown
  7138. when ($HOST_OS_LINUX) {
  7139. GO_HOST_OS=linux
  7140. }
  7141. elsewhen ($HOST_OS_DARWIN) {
  7142. GO_HOST_OS=darwin
  7143. }
  7144. elsewhen($HOST_OS_WINDOWS) {
  7145. GO_HOST_OS=windows
  7146. }
  7147. # tag:go-specific
  7148. GO_HOST_ARCH=unknown
  7149. when ($HOST_ARCH_X86_64) {
  7150. GO_HOST_ARCH=amd64
  7151. }
  7152. elsewhen($HOST_ARCH_ARM64) {
  7153. GO_HOST_ARCH=arm64
  7154. }
  7155. # tag:go-specific
  7156. GO_TARG_OS=unknown
  7157. when ($OS_LINUX) {
  7158. GO_TARG_OS=linux
  7159. }
  7160. elsewhen ($OS_DARWIN) {
  7161. GO_TARG_OS=darwin
  7162. }
  7163. elsewhen ($OS_WINDOWS) {
  7164. GO_TARG_OS=windows
  7165. }
  7166. # tag:go-specific
  7167. GO_TARG_ARCH=unknwon
  7168. when ($ARCH_X86_64) {
  7169. GO_TARG_ARCH=amd64
  7170. }
  7171. elsewhen ($ARCH_I386) {
  7172. GO_TARG_ARCH=x86
  7173. }
  7174. elsewhen ($ARCH_ARM64) {
  7175. GO_TARG_ARCH=arm64
  7176. }
  7177. # tag:go-specific
  7178. GO_HOST_TARG_PARAMS=++host-os $GO_HOST_OS ++host-arch $GO_HOST_ARCH ++targ-os $GO_TARG_OS ++targ-arch $GO_TARG_ARCH
  7179. # tag:go-specific
  7180. GOSTD_VERSION=1.18.3
  7181. when ($GOSTD_VERSION == "1.18.3") {
  7182. GOSTD=contrib/go/_std_1.18/src
  7183. }
  7184. otherwise {
  7185. GOSTD=__unsupported_go_std_library_version_[$GOSTD_VERSION]__
  7186. }
  7187. # tag:go-specific
  7188. GO_DEBUG_PATH_RELATIVE=no
  7189. _GO_DEBUG_PATH__NO_UID__=
  7190. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=
  7191. # tag:go-specific
  7192. _GO_IMPORT_PATH=${MODDIR}
  7193. # tag:go-specific
  7194. GO_VET=yolint
  7195. GO_VET_TOOL=
  7196. GO_VET_FLAGS=
  7197. GO_VET_EXTRA_FLAGS=
  7198. # tag:go-specific
  7199. _GO_VET_ADD_CHECK=yes
  7200. _GO_FMT_ADD_CHECK=yes
  7201. _GO_YDX_FILE=
  7202. # tag:go-specific
  7203. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=/-B --source-prefix=/-S
  7204. _GO_LINK_EXE_EXT_CMD=
  7205. # tag:go-specific
  7206. GO_WITH_MUSL=
  7207. # tag:go-specific
  7208. GO_TOOLS_ROOT=${GO_TOOLS_RESOURCE_GLOBAL}
  7209. GO_TEST_MINER=${tool:"tools/go_test_miner"}
  7210. GO_TEST_IMPORT_PATH=
  7211. # tag:go-specific
  7212. GO_STD_LIB_PREFIX=${GOSTD}/
  7213. GO_STD_CMD_PREFIX=${GOSTD}/cmd/
  7214. GO_ARCADIA_PROJECT_PREFIX=a.yandex-team.ru/
  7215. GO_CONTRIB_PROJECT_PREFIX=vendor/
  7216. GO_SKIP_IMPORTS=unsafe C
  7217. GO_VET_INFO_EXT=.vet.out
  7218. GO_VET_REPORT_EXT=.vet.txt
  7219. GO_VET_OUTPUT_INFO=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_INFO_EXT}:REALPRJNAME}
  7220. GO_VET_OUTPUT_REPORT=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_REPORT_EXT}:REALPRJNAME}
  7221. # tag:go-specific tag:codenav
  7222. _GO_YNDEXER_EXT=.ydx.pb2
  7223. GO_YNDEXER_OUTPUT=${output;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${_GO_YNDEXER_EXT}:REALPRJNAME}
  7224. # tag:go-specific
  7225. GO_PROJECT_PREFIXES=++std-lib-prefix $GO_STD_LIB_PREFIX ++arc-project-prefix $GO_ARCADIA_PROJECT_PREFIX
  7226. # tag:go-specific
  7227. _GO_FAKEID=${FAKEID}.${BUILD_TYPE}.${GO_FAKEID}
  7228. # tag:go-specific
  7229. CGO2_CFLAGS_VALUE=
  7230. CGO2_LDFLAGS_VALUE=
  7231. # tag:go-specific
  7232. GO_ASM_FLAGS_VALUE=
  7233. ### @usage: GO_ASM_FLAGS(flags)
  7234. ### Add the specified flags to the go asm compile command line.
  7235. macro GO_ASM_FLAGS(Flags...) {
  7236. SET_APPEND(GO_ASM_FLAGS_VALUE $Flags)
  7237. }
  7238. # tag:go-specific
  7239. GO_CGO1_FLAGS_VALUE=
  7240. ### @usage: GO_CGO1_FLAGS(flags)
  7241. ### Add the specified flags to the go cgo compile command line.
  7242. macro GO_CGO1_FLAGS(Flags...) {
  7243. SET_APPEND(GO_CGO1_FLAGS_VALUE $Flags)
  7244. }
  7245. # tag:go-specific
  7246. GO_CGO2_FLAGS_VALUE=
  7247. ### @usage: GO_CGO2_FLAGS(flags)
  7248. ### Add the specified flags to the go cgo compile command line.
  7249. macro GO_CGO2_FLAGS(Flags...) {
  7250. SET_APPEND(GO_CGO2_FLAGS_VALUE $Flags)
  7251. }
  7252. # tag:go-specific
  7253. GO_COMPILE_FLAGS_VALUE=$USER_GO_COMPILE_FLAGS
  7254. ### @usage: GO_COMPILE_FLAGS(flags)
  7255. ### Add the specified flags to the go compile command line.
  7256. macro GO_COMPILE_FLAGS(Flags...) {
  7257. SET_APPEND(GO_COMPILE_FLAGS_VALUE $Flags)
  7258. }
  7259. # tag:go-specific
  7260. GO_LINK_FLAGS_VALUE=$USER_GO_LINK_FLAGS
  7261. ### @usage: GO_LINK_FLAGS(flags)
  7262. ### Add the specified flags to the go link command line.
  7263. macro GO_LINK_FLAGS(Flags...) {
  7264. SET_APPEND(GO_LINK_FLAGS_VALUE $Flags)
  7265. }
  7266. # tag:go-specific
  7267. _GO_LANG_VERSION_VALUE=
  7268. macro GOLANG_VERSION(Arg) {
  7269. SET(_GO_LANG_VERSION_VALUE $Arg)
  7270. }
  7271. # tag:go-specific
  7272. _GO_TOOL_MODE=
  7273. # tag:go-specific
  7274. _GO_TOOL_COMMON_FLAGS=\
  7275. ++mode $_GO_TOOL_MODE \
  7276. $GO_PROJECT_PREFIXES \
  7277. ++goversion $GOSTD_VERSION \
  7278. ++source-root $ARCADIA_ROOT \
  7279. ++build-root $ARCADIA_BUILD_ROOT \
  7280. ++output-root $BINDIR \
  7281. ++toolchain-root $GO_TOOLS_ROOT \
  7282. $GO_HOST_TARG_PARAMS \
  7283. ++output $TARGET \
  7284. $GO_VET_OUTPUT \
  7285. $_GO_YDX_FILE \
  7286. $_GO_DEBUG_PATH__NO_UID__ \
  7287. ++srcs $AUTO_INPUT ${input:GO_FILES} \
  7288. ++asm-flags $GO_ASM_FLAGS_VALUE \
  7289. ++compile-flags $GO_COMPILE_FLAGS_VALUE \
  7290. ++link-flags $GO_LINK_FLAGS_VALUE \
  7291. ++cgo-srcs ${input:CGO_FILES} \
  7292. $_GO_EMBED_VALUE \
  7293. $GO_TOOLCHAIN_ENV
  7294. # tag:go-specific
  7295. macro _GO_GEN_COVER_GO(GO_FILE, VAR_ID) {
  7296. .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}
  7297. }
  7298. # tag:go-specific
  7299. macro _GO_COMPILE_SYMABIS(FLAGS[], ASM_FILES...) {
  7300. .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"}
  7301. .ADDINCL=build/scripts/go_fake_include
  7302. }
  7303. # tag:go-specific
  7304. macro _GO_COMPILE_CGO1(NAME, FLAGS[], FILES...) {
  7305. .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"}
  7306. }
  7307. # tag:go-specific
  7308. macro _GO_COMPILE_CGO2(NAME, C_FILES[], S_FILES[], OBJ_FILES[], FILES...) {
  7309. .CMD=${hide:_GO_FAKEID} $C_COMPILER $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} $CGO_CFLAGS_VALUE ${input;tobindir:"_cgo_main.c"} -c -o ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_main.c"} && $C_COMPILER $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} -o ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_"} $LDFLAGS $LDFLAGS_GLOBAL $CGO2_LDFLAGS_VALUE ${input;hide:"_cgo_export.h"} ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_main.c"} ${input;suf=${OBJECT_SUF}:"_cgo_export.c"} ${input;nopath;noext;suf=.cgo2.c${OBJECT_SUF}:FILES} ${input;suf=${OBJECT_SUF}:C_FILES} ${input;suf=.o:S_FILES} ${input:OBJ_FILES} $CGO_LDFLAGS_VALUE && ${GO_TOOLS_ROOT}/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cgo -dynpackage $NAME -dynimport ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_"} -dynout ${output:"_cgo_import.go"} -dynlinker $GO_CGO2_FLAGS_VALUE $GO_TOOLCHAIN_ENV ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7310. _USE_LINKER()
  7311. }
  7312. GO_TOOL=$YMAKE_PYTHON ${input:"build/scripts/go_tool.py"} ${input;hide:"build/scripts/process_command_files.py"}
  7313. # tag:go-specific
  7314. macro _GO_LINK_LIB_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
  7315. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++lang $_GO_LANG_VERSION_VALUE ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} --ya-end-command-file ${kv;hide:"p GO"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"}
  7316. }
  7317. # tag:go-specific
  7318. macro _GO_LINK_EXE_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
  7319. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++vcs $VCS_GO $GO_WITH_MUSL $GO_EXTLD ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} ++non-local-peers ${rootrel;tags_in=GO|GO_PROTO|GO_FBS;tags_out=local:PEERS} ++cgo-peers ${VCS_C_OBJ_RR} ${rootrel;tags_out=GO|GO_PROTO|GO_FBS:PEERS} --ya-end-command-file ${kv;hide:"p LD"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"} $_GO_LINK_EXE_EXT_CMD
  7320. }
  7321. # tag:go-specific
  7322. macro _GO_LINK_TEST_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_TEST_FILES[], GO_XTEST_FILES[], GO_FILES...) {
  7323. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++vcs $VCS_GO $GO_WITH_MUSL $GO_EXTLD ++test-miner $GO_TEST_MINER ++test-import-path $GO_TEST_IMPORT_PATH ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} ++non-local-peers ${rootrel;tags_in=GO|GO_PROTO|GO_FBS;tags_out=local:PEERS} ++cgo-peers ${VCS_C_OBJ_RR} ${rootrel;tags_out=GO|GO_PROTO|GO_FBS:PEERS} ++test_srcs ${input:GO_TEST_FILES} ++xtest_srcs ${input:GO_XTEST_FILES} ++cover_info $GO_COVER_INFO_VALUE ++skip-tests $_GO_SKIP_TEST_VALUE --ya-end-command-file ${kv;hide:"p GO"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"}
  7324. }
  7325. # tag:go-specific
  7326. GO_LINK_LIB=$GENERATE_MF && $_GO_LINK_LIB_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_INPUTS $_GO_EMBED_INPUTS)
  7327. 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)
  7328. 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)
  7329. GO_LINK_DLL=$GO_LINK_EXE && $COPY_CMD $BINDIR/_cgo_export.h ${output;pre=${MODULE_PREFIX};suf=.h:REALPRJNAME}
  7330. # tag:go-specific
  7331. CGO_ENABLED=yes
  7332. when ($OS_WINDOWS == "yes" || $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  7333. CGO_ENABLED=no
  7334. }
  7335. # tag:go-specific
  7336. GO_PACKAGE_VALUE=
  7337. ### @usage: GO_PACKAGE_NAME(Name)
  7338. ### Override name of a Go package.
  7339. macro GO_PACKAGE_NAME(NAME) {
  7340. SET(GO_PACKAGE_VALUE $NAME)
  7341. }
  7342. # tag:go-specific tag:internal
  7343. _GO_SRCS_VALUE=
  7344. ### @usage: _GO_SRCS(Files...) # internal
  7345. ### This macro shouldn't be used in ya.make files, use SRCS() instead.
  7346. ### This is internal macro collecting .go sources for processing within Go modules (GO_PROGRAM and GO_LIBRARY)
  7347. macro _GO_SRCS(FILES...) {
  7348. GO_FAKE_OUTPUT($FILES)
  7349. SET_APPEND(_GO_SRCS_VALUE $FILES)
  7350. }
  7351. # tag:go-specific
  7352. _GO_TEST_SRCS_VALUE=
  7353. GO_HAS_INTERNAL_TESTS=no
  7354. ### @usage: GO_TEST_SRCS(Files...)
  7355. ### .go sources for internal tests of a module
  7356. macro GO_TEST_SRCS(FILES...) {
  7357. GO_FAKE_OUTPUT($FILES)
  7358. _SET_FIRST_VALUE(GO_HAS_INTERNAL_TESTS ${pre=yes :FILES} ${GO_HAS_INTERNAL_TESTS})
  7359. SET_APPEND(_GO_TEST_SRCS_VALUE $FILES)
  7360. }
  7361. # tag:go-specific
  7362. _GO_XTEST_SRCS_VALUE=
  7363. GO_HAS_EXTERNAL_TESTS=no
  7364. ### @usage: GO_XTEST_SRCS(Files...)
  7365. ### .go sources for external tests of a module
  7366. macro GO_XTEST_SRCS(FILES...) {
  7367. GO_FAKE_OUTPUT($FILES)
  7368. SET(GO_HAS_EXTERNAL_TESTS yes)
  7369. SET_APPEND(_GO_XTEST_SRCS_VALUE $FILES)
  7370. }
  7371. # tag:go-specific
  7372. macro _GO_UNUSED_SRCS(FLAGS...) {
  7373. ENABLE(UNUSED_MACRO)
  7374. }
  7375. # tag:go-specific
  7376. _CGO_SRCS_VALUE=
  7377. ### @usage: CGO_SRCS(Files...)
  7378. ### .go sources to be built with CGO
  7379. macro CGO_SRCS(FILES...) {
  7380. SET_APPEND(_CGO_SRCS_VALUE $FILES)
  7381. PEERDIR(${GOSTD}/syscall)
  7382. }
  7383. # tag:go-specific
  7384. GO_LDFLAGS_GLOBAL=
  7385. ### @usage: GO_LDFLAGS(Flags...)
  7386. ### Link flags for GO_PROGRAM linking from .go sources
  7387. macro GO_LDFLAGS(FLAGS...) {
  7388. SET_APPEND(GO_LDFLAGS_GLOBAL $FLAGS)
  7389. }
  7390. # tag:go-specific
  7391. CGO_CFLAGS_VALUE=
  7392. ### @usage: CGO_CFLAGS(Flags...)
  7393. ### Compiler flags specific to CGO compilation
  7394. macro CGO_CFLAGS(FLAGS...) {
  7395. SET_APPEND(CGO_CFLAGS_VALUE $FLAGS)
  7396. CFLAGS($FLAGS)
  7397. }
  7398. # tag:go-specific
  7399. CGO_LDFLAGS_VALUE=
  7400. ### @usage: CGO_LDFLAGS(Files...)
  7401. ### Linker flags specific to CGO linking
  7402. macro CGO_LDFLAGS(FLAGS...) {
  7403. SET_APPEND(CGO_LDFLAGS_VALUE $FLAGS)
  7404. GO_LDFLAGS($FLAGS)
  7405. }
  7406. # tag:go-specific
  7407. _GO_SKIP_TEST_VALUE=
  7408. ### @usage: GO_SKIP_TESTS(TestNames...)
  7409. ###
  7410. ### Define a set of tests that should not be run.
  7411. ### NB! Subtests are not taken into account!
  7412. macro GO_SKIP_TESTS(TESTS...) {
  7413. SET_APPEND(_GO_SKIP_TEST_VALUE $TESTS)
  7414. RESTRICT_PATH(vendor MSG This macro is prohibited to be used outside the vendor/ directory)
  7415. }
  7416. # tag:go-specific tag:internal
  7417. _GO_EMBED_VALUE=
  7418. _GO_EMBED_INPUTS=
  7419. ### @usage: _GO_EMBED_PATTERN(PATTERN) # internal
  7420. ###
  7421. ### Define an embed pattern.
  7422. macro _GO_EMBED_PATTERN(XTEST?"_xtest":"", PATTERN, IMPORT_PATH) {
  7423. SET(VAR_SALT1 $XTEST $PATTERN $IMPORT_PATH 1)
  7424. SET(_PATTERN_GLOB1 uniq_embed_${hash:VAR_SALT1})
  7425. _GLOB($_PATTERN_GLOB1 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/.*)
  7426. SET(VAR_SALT2 $XTEST $PATTERN $IMPORT_PATH 2)
  7427. SET(_PATTERN_GLOB2 _uniq_embed_${hash:VAR_SALT2})
  7428. _GLOB($_PATTERN_GLOB2 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN})
  7429. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $PATTERN \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7430. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7431. }
  7432. # tag:go-specific
  7433. ### @usage: GO_EMBED_PATTERN(PATTERN)
  7434. ###
  7435. ### Define an embed pattern.
  7436. macro GO_EMBED_PATTERN(PATTERN) {
  7437. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7438. }
  7439. # tag:go-specific
  7440. ### @usage: GO_TEST_EMBED_PATTERN(PATTERN)
  7441. ###
  7442. ### Define an embed pattern for internal go tests.
  7443. macro GO_TEST_EMBED_PATTERN(PATTERN) {
  7444. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7445. }
  7446. # tag:go-specific
  7447. ### @usage: GO_XTEST_EMBED_PATTERN(PATTERN)
  7448. ###
  7449. ### Define an embed pattern for external go tests.
  7450. macro GO_XTEST_EMBED_PATTERN(PATTERN) {
  7451. _GO_EMBED_PATTERN(XTEST $PATTERN $_GO_IMPORT_PATH)
  7452. }
  7453. # tag:go-specific tag:internal
  7454. ### @usage: _GO_EMBED_DIR(PATTERN) # internal
  7455. ###
  7456. ### Define an embed directory DIR.
  7457. macro _GO_EMBED_DIR(XTEST?"_xtest":"", DIR, IMPORT_PATH) {
  7458. SET(VAR_SALT $XTEST $DIR $IMPORT_PATH)
  7459. SET(_PATTERN_GLOB uniq_embed_${hash:VAR_SALT})
  7460. _GLOB($_PATTERN_GLOB ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/.*)
  7461. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $DIR \$$_PATTERN_GLOB)
  7462. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB)
  7463. }
  7464. # tag:go-specific
  7465. ### @usage: GO_EMBED_DIR(DIR)
  7466. ###
  7467. ### Define an embed directory DIR.
  7468. macro GO_EMBED_DIR(DIR) {
  7469. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH)
  7470. }
  7471. # tag:go-specific
  7472. ### @usage: GO_TEST_EMBED_DIR(DIR)
  7473. ###
  7474. ### Define an embed directory DIR for internal go tests.
  7475. macro GO_EMBED_TEST_DIR(DIR) {
  7476. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH)
  7477. }
  7478. # tag:go-specific
  7479. ### @usage: GO_XTEST_EMBED_DIR(DIR)
  7480. ###
  7481. ### Define an embed directory DIR for external go tests.
  7482. macro GO_EMBED_XTEST_DIR(DIR) {
  7483. _GO_EMBED_DIR(XTEST $DIR $_GO_IMPORT_PATH)
  7484. }
  7485. # tag:go-specific
  7486. _GO_TOOLCHAIN_ENV_GOARCH=unknown
  7487. when ($ARCH_ARM64) {
  7488. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=arm64"}
  7489. }
  7490. elsewhen ($ARCH_X86_64) {
  7491. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=amd64"}
  7492. }
  7493. # tag:go-specific
  7494. _GO_TOOLCHAIN_ENV_GOOS=unknown
  7495. when ($OS_DARWIN) {
  7496. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=darwin"}
  7497. }
  7498. elsewhen ($OS_LINUX) {
  7499. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=linux"}
  7500. }
  7501. elsewhen ($OS_WINDOWS) {
  7502. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=windows"}
  7503. }
  7504. _GO_TOOLCHAIN_ENV_PATH=
  7505. # tag:go-specific
  7506. GO_TOOLCHAIN_ENV=$TOOLCHAIN_ENV $_GO_TOOLCHAIN_ENV_GOARCH $_GO_TOOLCHAIN_ENV_GOOS $_GO_TOOLCHAIN_ENV_PATH
  7507. # tag:go-specific
  7508. _GO_GRPC_WELLKNOWN=\
  7509. vendor/google.golang.org/grpc \
  7510. vendor/google.golang.org/grpc \
  7511. vendor/google.golang.org/grpc/codes \
  7512. vendor/google.golang.org/grpc/grpclog \
  7513. vendor/google.golang.org/grpc/status
  7514. # tag:go-specific
  7515. macro _GO_GRPC() {
  7516. SET(GO_PROTO_GEN_PLUGINS plugins=grpc)
  7517. PEERDIR(${GOSTD}/context ${_GO_GRPC_WELLKNOWN})
  7518. }
  7519. # tag:go-specific
  7520. ### @usage: GO_GRPC_GATEWAY_SRCS()
  7521. ###
  7522. ### Use of grpc-gateway plugin (Supported for Go only).
  7523. macro GO_GRPC_GATEWAY_SRCS(FILE...) {
  7524. ENABLE(UNUSED_MACRO)
  7525. }
  7526. # tag:go-specific
  7527. ### @usage: GO_GRPC_GATEWAY_SWAGGER_SRCS()
  7528. ###
  7529. ### Use of grpc-gateway plugin w/ swagger emission (Supported for Go only).
  7530. macro GO_GRPC_GATEWAY_SWAGGER_SRCS(FILE...) {
  7531. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  7532. }
  7533. # tag:go-specific
  7534. _GO_PROTO_GRPC_GATEWAY_OPTS=
  7535. _GO_PROTO_GRPC_GATEWAY_OUTS=
  7536. # tag:go-specific
  7537. macro _GO_GRPC_GATEWAY_SRCS_IMPL(Files...) {
  7538. foreach (File : $Files) {
  7539. [.proto]=$_GO_PROTO_CMD_IMPL($File $_GO_PROTO_GRPC_GATEWAY_OPTS $_GO_PROTO_GRPC_GATEWAY_OUTS)
  7540. }
  7541. PEERDIR(${GOSTD}/context ${GOSTD}/io ${GOSTD}/net/http)
  7542. PEERDIR(vendor/github.com/golang/protobuf/descriptor)
  7543. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/runtime)
  7544. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/utilities)
  7545. PEERDIR(vendor/google.golang.org/grpc/metadata)
  7546. }
  7547. # tag:go-specific
  7548. macro _SETUP_GO_GRPC_GATEWAY() {
  7549. 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:))
  7550. SET(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;nopath;noext;suf=.pb.gw.go:File})
  7551. }
  7552. # tag:go-specific
  7553. macro _GO_GRPC_GATEWAY_SRCS(Files...) {
  7554. _SETUP_GO_GRPC_GATEWAY()
  7555. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  7556. }
  7557. # tag:go-specific
  7558. macro _GO_GRPC_GATEWAY_SWAGGER_SRCS(Files...) {
  7559. _SETUP_GO_GRPC_GATEWAY()
  7560. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OPTS $_PROTO_PLUGIN_ARGS_BASE(swagger vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger logtostderr=true:))
  7561. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;noauto;nopath;noext;suf=.swagger.json:File})
  7562. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  7563. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  7564. }
  7565. # tag:go-specific
  7566. when ($MUSL == "yes") {
  7567. _GO_DEFAULT_ALLOCATOR=LF
  7568. }
  7569. otherwise {
  7570. _GO_DEFAULT_ALLOCATOR=FAKE
  7571. }
  7572. # tag:go-specific tag:internal
  7573. ### @usage _GO_BASE_UNIT # internal
  7574. ###
  7575. ### The base module of all golang modules. Defines common properties, dependencies and rules for go build.
  7576. module _GO_BASE_UNIT: _BASE_UNIT {
  7577. .EXTS=.go .gosrc .o .obj .a .symabis .mf
  7578. .CMD=TOUCH_UNIT
  7579. .NODE_TYPE=Bundle
  7580. .GLOBAL=GO_LDFLAGS
  7581. .PEERDIR_POLICY=as_build_from
  7582. .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
  7583. .ALLOWED=GO_PROTO_PLUGIN USE_CXX USE_UTIL RESOURCE_FILES
  7584. .IGNORED=GO_SKIP_TESTS USE_SKIFF
  7585. .DEFAULT_NAME_GENERATOR=UseDirNameOrSetGoPackage
  7586. ENABLE(_GO_MODULE)
  7587. SET(MODULE_TAG GO)
  7588. PEERDIR_TAGS=GO GO_PROTO GO_FBS __EMPTY__
  7589. DEFAULT(_GO_VET_TOOL)
  7590. DEFAULT(_GO_VET_FLAGS)
  7591. DEFAULT(_GO_VET_EXTS)
  7592. DEFAULT(_GO_SONAME)
  7593. NO_RUNTIME()
  7594. SET(COVERAGE_FLAGS)
  7595. SET(EXTRA_OUTPUT)
  7596. SET(MODULE_LANG GO)
  7597. PEERDIR(build/external_resources/go_tools)
  7598. GO_PROTO_OUTS+=${output;hide;norel;nopath;noext;suf=.pb.go:File}
  7599. GO_PROTO_OPTS+=--plugin=protoc-gen-go=${tool:_TOOL_PROTOC_GEN_GO} --go_out=$GO_PROTO_GEN_PLUGINS:${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
  7600. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  7601. PEERDIR+=$COMPILER_PLATFORM
  7602. }
  7603. when ($CLANG == "yes" || $GCC == "yes") {
  7604. CGO_CFLAGS_VALUE += -w -pthread -fpic
  7605. CGO2_CFLAGS_VALUE += -Wno-unused-variable
  7606. }
  7607. select ($GO_VET) {
  7608. "yes" | "on" ? {
  7609. _GO_VET=yes
  7610. _GO_VET_FLAGS+=-cgocall=false
  7611. }
  7612. "yndexer" ? {
  7613. _GO_VET=yes
  7614. PEERDIR+=build/external_resources/goyndexer
  7615. _GO_VET_TOOL=${GOYNDEXER_RESOURCE_GLOBAL}/goyndexer
  7616. _GO_YDX_FILE=++ydx-file ${_GO_YNDEXER_EXT}
  7617. _GO_VET_FLAGS=-indexer.arc ${ARCADIA_ROOT} -indexer.indexfile ${GO_YNDEXER_OUTPUT} -indexer.loglevel info
  7618. _GO_FMT_ADD_CHECK=no
  7619. _GO_VET_ADD_CHECK=no
  7620. GO_VET_INFO_EXT=.ydx.out
  7621. GO_VET_REPORT_EXT=.ydx.txt
  7622. _GO_VET_EXTS=++vet-info-ext .ydx.out ++vet-report-ext .ydx.txt
  7623. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=__ARCADIA_BUILD_ROOT_PREFIX__ --source-prefix=__ARCADIA_SOURCE_ROOT_PREFIX__
  7624. }
  7625. "yolint" ? {
  7626. _GO_VET=yes
  7627. PEERDIR+=build/external_resources/yolint
  7628. _GO_VET_TOOL=${YOLINT_RESOURCE_GLOBAL}/yolint
  7629. _GO_VET_FLAGS=-migration.config=${input:"${ARCADIA_ROOT}/build/rules/go/migrations.yaml"} -scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
  7630. }
  7631. "yolint_next" ? {
  7632. _GO_VET=yes
  7633. PEERDIR+=build/external_resources/yolint
  7634. _GO_VET_TOOL=${YOLINT_NEXT_RESOURCE_GLOBAL}/yolint
  7635. _GO_VET_FLAGS=-scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
  7636. }
  7637. "local" ? {
  7638. _GO_VET=yes
  7639. _GO_VET_FLAGS=
  7640. }
  7641. default ? {
  7642. _GO_VET=no
  7643. _GO_VET_FLAGS=
  7644. }
  7645. }
  7646. SET(_GO_VET $_GO_VET)
  7647. when ($GO_VET_TOOL == "") {
  7648. _GO_VET_TOOL_REAL=$_GO_VET_TOOL
  7649. }
  7650. otherwise {
  7651. _GO_VET_TOOL_REAL=$GO_VET_TOOL
  7652. }
  7653. when ($GO_VET_FLAGS == "") {
  7654. _GO_VET_FLAGS_REAL=$_GO_VET_FLAGS
  7655. }
  7656. otherwise {
  7657. _GO_VET_FLAGS_REAL=$GO_VET_FLAGS
  7658. }
  7659. when ($_GO_VET == "yes" && $NO_GO_VET != "yes") {
  7660. 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
  7661. }
  7662. otherwise {
  7663. GO_VET_OUTPUT=
  7664. _GO_VET_ADD_CHECK=no
  7665. }
  7666. when ($GO_DEBUG_PATH_RELATIVE == "yes") {
  7667. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=;build=;tools= ++tools-root $(TOOL_ROOT)
  7668. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>;$ARCADIA_BUILD_ROOT=>;$(TOOL_ROOT)=>
  7669. }
  7670. otherwise {
  7671. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=/-S;build=/-B;tools=/-T ++tools-root $(TOOL_ROOT)
  7672. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>/-S;$ARCADIA_BUILD_ROOT=>/-B;$(TOOL_ROOT)=>/-T
  7673. }
  7674. _GO_PROCESS_SRCS()
  7675. when ($CLANG == "yes") {
  7676. _GO_EXTLD=clang
  7677. GO_TOOLCHAIN_ENV += ${env:"CC=clang"}
  7678. }
  7679. otherwise {
  7680. _GO_EXTLD=gcc
  7681. GO_TOOLCHAIN_ENV += ${env:"CC=gcc"}
  7682. }
  7683. when ($OS_DARWIN) {
  7684. PEERDIR+=build/external_resources/go_fake_xcrun
  7685. 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
  7686. CGO2_LDFLAGS_VALUE += $LD_SDK_VERSION -undefined dynamic_lookup -nodefaultlibs -lc
  7687. }
  7688. elsewhen ($OS_LINUX) {
  7689. 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
  7690. CGO2_LDFLAGS_VALUE += -Wl,--unresolved-symbols=ignore-all -nodefaultlibs -lc
  7691. }
  7692. otherwise {
  7693. GO_EXTLD = ++extld $_GO_EXTLD
  7694. }
  7695. when ($RACE == "yes") {
  7696. _GO_COMPILE_FLAGS_RACE=-race
  7697. _GO_LINK_FLAGS_RACE=-race
  7698. }
  7699. otherwise {
  7700. _GO_COMPILE_FLAGS_RACE=
  7701. _GO_LINK_FLAGS_RACE=
  7702. }
  7703. when ($PIC == "yes") {
  7704. _GO_COMPILE_FLAGS_SHARED=-shared
  7705. _GO_ASM_FLAGS_SHARED=-shared
  7706. }
  7707. otherwise {
  7708. _GO_COMPILE_FLAGS_SHARED=
  7709. _GO_ASM_FLAGS_SHARED=
  7710. }
  7711. GO_ASM_FLAGS_VALUE += $_GO_ASM_FLAGS_SHARED
  7712. GO_COMPILE_FLAGS_VALUE += $_GO_COMPILE_FLAGS_RACE $_GO_COMPILE_FLAGS_SHARED
  7713. GO_LINK_FLAGS_VALUE += $_GO_LINK_FLAGS_RACE
  7714. ADDINCL(${GOSTD}/runtime)
  7715. }
  7716. # tag:go-specific
  7717. ### @usage: GO_LIBRARY([name])
  7718. ###
  7719. ### Go library module definition.
  7720. ### Compile Go module as a library suitable for PEERDIR from other Go modules.
  7721. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7722. module GO_LIBRARY: _GO_BASE_UNIT {
  7723. .CMD=GO_LINK_LIB
  7724. .NODE_TYPE=Bundle
  7725. .FINAL_TARGET=no
  7726. SET(_GO_TOOL_MODE lib)
  7727. SET(MODULE_TYPE LIBRARY)
  7728. _REQUIRE_EXPLICIT_LICENSE(vendor)
  7729. MODULE_SUFFIX=.a
  7730. }
  7731. # tag:go-specific
  7732. ### @usage: GO_PROGRAM([name])
  7733. ###
  7734. ### Go program module definition.
  7735. ### Compile and link Go module to an executable program.
  7736. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7737. module GO_PROGRAM: _GO_BASE_UNIT {
  7738. .CMD=GO_LINK_EXE
  7739. .NODE_TYPE=Program
  7740. .PROXY=yes
  7741. .SYMLINK_POLICY=EXE
  7742. .ALLOWED=INDUCED_DEPS
  7743. .FINAL_TARGET=yes
  7744. SET(_GO_TOOL_MODE exe)
  7745. SET(MODULE_TYPE PROGRAM)
  7746. SET(GO_VET_OUTPUT_INFO)
  7747. ALLOCATOR($_GO_DEFAULT_ALLOCATOR)
  7748. _USE_LINKER()
  7749. ENABLE(COMMON_LINK_SETTINGS)
  7750. when ($MUSL == "yes") {
  7751. PEERDIR += contrib/libs/musl/full
  7752. }
  7753. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7754. MODULE_SUFFIX=.exe
  7755. }
  7756. PEERDIR(${GOSTD}/runtime library/go/core/buildinfo)
  7757. when ($RACE == "yes") {
  7758. PEERDIR += ${GOSTD}/runtime/cgo
  7759. PEERDIR += ${GOSTD}/runtime/race
  7760. }
  7761. when ($MUSL == "yes") {
  7762. GO_WITH_MUSL = ++musl
  7763. }
  7764. }
  7765. # tag:go-specific
  7766. module _GO_DLL_BASE_UNIT: GO_PROGRAM {
  7767. .CMD=GO_LINK_DLL
  7768. .SYMLINK_POLICY=SO
  7769. .ALLOWED=WHOLE_ARCHIVE
  7770. .ARGS_PARSER=DLL
  7771. .NODE_TYPE=Library
  7772. .PROXY=yes
  7773. SET(_GO_TOOL_MODE dll)
  7774. SET(MODULE_TYPE DLL)
  7775. GO_PACKAGE_NAME(main)
  7776. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7777. MODULE_SUFFIX=.dll
  7778. }
  7779. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  7780. MODULE_PREFIX=lib
  7781. MODULE_SUFFIX=.dylib$MODULE_VERSION
  7782. }
  7783. otherwise {
  7784. MODULE_PREFIX=lib
  7785. MODULE_SUFFIX=.so$MODULE_VERSION
  7786. }
  7787. when ($OS_DARWIN) {
  7788. _GO_SONAME=-Wl,-install_name,$SONAME
  7789. }
  7790. elsewhen ($OS_LINUX) {
  7791. _GO_SONAME=-Wl,-soname,$SONAME
  7792. }
  7793. when ($MODULE_VERSION) {
  7794. when ($OS_LINUX || $OS_DARWIN) {
  7795. _GO_LINK_EXE_EXT_CMD+= && $LINK_OR_COPY_CMD $TARGET ${output;nopath;noext:SONAME}
  7796. }
  7797. }
  7798. }
  7799. # tag:go-specific
  7800. ### @usage: GO_DLL(name major_ver [minor_ver] [PREFIX prefix])
  7801. ###
  7802. ### Go ishared object module definition.
  7803. ### Compile and link Go module to a shared object.
  7804. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7805. module GO_DLL: _GO_DLL_BASE_UNIT {
  7806. }
  7807. # tag:go-specific tag:test
  7808. ### @usage: GO_BENCH_TIMEOUT(x)
  7809. ###
  7810. ### Sets timeout in seconds for 1 Benchmark in go benchmark suite
  7811. ###
  7812. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  7813. macro GO_BENCH_TIMEOUT(bench_timeout) {
  7814. SET(GO_BENCH_TIMEOUT $bench_timeout)
  7815. }
  7816. # tag:go-specific tag:test
  7817. ### @usage: GO_TEST([name])
  7818. ###
  7819. ### Go test module definition.
  7820. ### Compile and link Go module as a test suitable for running with Arcadia testing support.
  7821. ### All usual testing support macros like DATA, DEPENDS, SIZE, REQUIREMENTS etc. are supported.
  7822. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7823. module GO_TEST: GO_PROGRAM {
  7824. .CMD=GO_LINK_TEST
  7825. .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
  7826. .ALLOWED=GO_SKIP_TESTS YT_SPEC
  7827. .FINAL_TARGET=no
  7828. SET(_GO_TOOL_MODE test)
  7829. SET(MODULE_TYPE PROGRAM)
  7830. ENABLE(GO_TEST_MODULE)
  7831. SET(GO_COVER_INFO_VALUE)
  7832. # We have to add uncoditionaly PEERDIR to ${GOSTD}/os here thouth it is really
  7833. # needed when TestMain is defined in the source code of the test
  7834. PEERDIR(${GOSTD}/os)
  7835. PEERDIR(${GOSTD}/testing/internal/testdeps)
  7836. PEERDIR(${GOSTD}/testing)
  7837. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.test)
  7838. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.bench)
  7839. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  7840. }
  7841. # tag:go-specific
  7842. macro GO_MOCKGEN_FROM(Path) {
  7843. SET(MOCKGEN_FROM ${Path})
  7844. }
  7845. # tag:go-specific
  7846. macro GO_MOCKGEN_TYPES(First, Rest...) {
  7847. SET(MOCKGEN_FIRST $First)
  7848. SET(MOCKGEN_REST $Rest)
  7849. }
  7850. # tag:go-specific
  7851. macro GO_MOCKGEN_REFLECT() {
  7852. PEERDIR(${GOSTD}/encoding/gob)
  7853. PEERDIR(${GOSTD}/flag)
  7854. PEERDIR(${GOSTD}/fmt)
  7855. PEERDIR(${GOSTD}/os)
  7856. PEERDIR(${GOSTD}/path)
  7857. PEERDIR(${GOSTD}/reflect)
  7858. PEERDIR(vendor/github.com/golang/mock/mockgen/model)
  7859. PEERDIR(${MOCKGEN_FROM})
  7860. 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)
  7861. }
  7862. # tag:go-specific
  7863. macro GO_MOCKGEN_MOCKS() {
  7864. PEERDIR(${GOSTD}/reflect)
  7865. PEERDIR(vendor/github.com/golang/mock/gomock)
  7866. 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)
  7867. }
  7868. # Conflict between protobuf-java and protobuf-javalite ¯\_(ツ)_/¯
  7869. # both libraries are required by grpc
  7870. JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE=\
  7871. com.google.protobuf.AbstractMessageLite \
  7872. com.google.protobuf.AbstractMessageLite$Builder \
  7873. com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream \
  7874. com.google.protobuf.AbstractMessageLite$InternalOneOfEnum \
  7875. com.google.protobuf.AbstractParser \
  7876. com.google.protobuf.AbstractProtobufList \
  7877. com.google.protobuf.AllocatedBuffer \
  7878. com.google.protobuf.AllocatedBuffer$1 \
  7879. com.google.protobuf.AllocatedBuffer$2 \
  7880. com.google.protobuf.Android \
  7881. com.google.protobuf.Any \
  7882. com.google.protobuf.Any$1 \
  7883. com.google.protobuf.Any$Builder \
  7884. com.google.protobuf.AnyOrBuilder \
  7885. com.google.protobuf.AnyProto \
  7886. com.google.protobuf.Api \
  7887. com.google.protobuf.Api$1 \
  7888. com.google.protobuf.Api$Builder \
  7889. com.google.protobuf.ApiOrBuilder \
  7890. com.google.protobuf.ApiProto \
  7891. com.google.protobuf.ArrayDecoders \
  7892. com.google.protobuf.ArrayDecoders$1 \
  7893. com.google.protobuf.ArrayDecoders$Registers \
  7894. com.google.protobuf.BinaryReader \
  7895. com.google.protobuf.BinaryReader$1 \
  7896. com.google.protobuf.BinaryReader$SafeHeapReader \
  7897. com.google.protobuf.BinaryWriter \
  7898. com.google.protobuf.BinaryWriter$1 \
  7899. com.google.protobuf.BinaryWriter$SafeDirectWriter \
  7900. com.google.protobuf.BinaryWriter$SafeHeapWriter \
  7901. com.google.protobuf.BinaryWriter$UnsafeDirectWriter \
  7902. com.google.protobuf.BinaryWriter$UnsafeHeapWriter \
  7903. com.google.protobuf.BooleanArrayList \
  7904. com.google.protobuf.BoolValue \
  7905. com.google.protobuf.BoolValue$1 \
  7906. com.google.protobuf.BoolValue$Builder \
  7907. com.google.protobuf.BoolValueOrBuilder \
  7908. com.google.protobuf.BufferAllocator \
  7909. com.google.protobuf.BufferAllocator$1 \
  7910. com.google.protobuf.ByteBufferWriter \
  7911. com.google.protobuf.ByteOutput \
  7912. com.google.protobuf.ByteString \
  7913. com.google.protobuf.ByteString$1 \
  7914. com.google.protobuf.ByteString$2 \
  7915. com.google.protobuf.ByteString$AbstractByteIterator \
  7916. com.google.protobuf.ByteString$ArraysByteArrayCopier \
  7917. com.google.protobuf.ByteString$BoundedByteString \
  7918. com.google.protobuf.ByteString$ByteArrayCopier \
  7919. com.google.protobuf.ByteString$ByteIterator \
  7920. com.google.protobuf.ByteString$CodedBuilder \
  7921. com.google.protobuf.ByteString$LeafByteString \
  7922. com.google.protobuf.ByteString$LiteralByteString \
  7923. com.google.protobuf.ByteString$Output \
  7924. com.google.protobuf.ByteString$SystemByteArrayCopier \
  7925. com.google.protobuf.BytesValue \
  7926. com.google.protobuf.BytesValue$1 \
  7927. com.google.protobuf.BytesValue$Builder \
  7928. com.google.protobuf.BytesValueOrBuilder \
  7929. com.google.protobuf.CanIgnoreReturnValue \
  7930. com.google.protobuf.CheckReturnValue \
  7931. com.google.protobuf.CodedInputStream \
  7932. com.google.protobuf.CodedInputStream$1 \
  7933. com.google.protobuf.CodedInputStream$ArrayDecoder \
  7934. com.google.protobuf.CodedInputStream$IterableDirectByteBufferDecoder \
  7935. com.google.protobuf.CodedInputStream$StreamDecoder \
  7936. com.google.protobuf.CodedInputStream$StreamDecoder$RefillCallback \
  7937. com.google.protobuf.CodedInputStream$StreamDecoder$SkippedDataSink \
  7938. com.google.protobuf.CodedInputStream$UnsafeDirectNioDecoder \
  7939. com.google.protobuf.CodedInputStreamReader \
  7940. com.google.protobuf.CodedInputStreamReader$1 \
  7941. com.google.protobuf.CodedOutputStream \
  7942. com.google.protobuf.CodedOutputStream$1 \
  7943. com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder \
  7944. com.google.protobuf.CodedOutputStream$ArrayEncoder \
  7945. com.google.protobuf.CodedOutputStream$ByteOutputEncoder \
  7946. com.google.protobuf.CodedOutputStream$HeapNioEncoder \
  7947. com.google.protobuf.CodedOutputStream$OutOfSpaceException \
  7948. com.google.protobuf.CodedOutputStream$OutputStreamEncoder \
  7949. com.google.protobuf.CodedOutputStream$SafeDirectNioEncoder \
  7950. com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder \
  7951. com.google.protobuf.CodedOutputStreamWriter \
  7952. com.google.protobuf.CodedOutputStreamWriter$1 \
  7953. com.google.protobuf.DoubleArrayList \
  7954. com.google.protobuf.DoubleValue \
  7955. com.google.protobuf.DoubleValue$1 \
  7956. com.google.protobuf.DoubleValue$Builder \
  7957. com.google.protobuf.DoubleValueOrBuilder \
  7958. com.google.protobuf.Duration \
  7959. com.google.protobuf.Duration$1 \
  7960. com.google.protobuf.Duration$Builder \
  7961. com.google.protobuf.DurationOrBuilder \
  7962. com.google.protobuf.DurationProto \
  7963. com.google.protobuf.Empty \
  7964. com.google.protobuf.Empty$1 \
  7965. com.google.protobuf.Empty$Builder \
  7966. com.google.protobuf.EmptyOrBuilder \
  7967. com.google.protobuf.EmptyProto \
  7968. com.google.protobuf.Enum \
  7969. com.google.protobuf.Enum$1 \
  7970. com.google.protobuf.Enum$Builder \
  7971. com.google.protobuf.EnumOrBuilder \
  7972. com.google.protobuf.EnumValue \
  7973. com.google.protobuf.EnumValue$1 \
  7974. com.google.protobuf.EnumValue$Builder \
  7975. com.google.protobuf.EnumValueOrBuilder \
  7976. com.google.protobuf.ExperimentalApi \
  7977. com.google.protobuf.ExtensionLite \
  7978. com.google.protobuf.ExtensionRegistryFactory \
  7979. com.google.protobuf.ExtensionRegistryLite \
  7980. com.google.protobuf.ExtensionRegistryLite$ExtensionClassHolder \
  7981. com.google.protobuf.ExtensionRegistryLite$ObjectIntPair \
  7982. com.google.protobuf.ExtensionSchema \
  7983. com.google.protobuf.ExtensionSchemaLite \
  7984. com.google.protobuf.ExtensionSchemaLite$1 \
  7985. com.google.protobuf.ExtensionSchemas \
  7986. com.google.protobuf.Field \
  7987. com.google.protobuf.Field$1 \
  7988. com.google.protobuf.Field$Builder \
  7989. com.google.protobuf.Field$Cardinality \
  7990. com.google.protobuf.Field$Cardinality$1 \
  7991. com.google.protobuf.Field$Kind \
  7992. com.google.protobuf.Field$Kind$1 \
  7993. com.google.protobuf.FieldInfo \
  7994. com.google.protobuf.FieldInfo$1 \
  7995. com.google.protobuf.FieldInfo$Builder \
  7996. com.google.protobuf.FieldMask \
  7997. com.google.protobuf.FieldMask$1 \
  7998. com.google.protobuf.FieldMask$Builder \
  7999. com.google.protobuf.FieldMaskOrBuilder \
  8000. com.google.protobuf.FieldMaskProto \
  8001. com.google.protobuf.FieldOrBuilder \
  8002. com.google.protobuf.FieldSet \
  8003. com.google.protobuf.FieldSet$1 \
  8004. com.google.protobuf.FieldSet$Builder \
  8005. com.google.protobuf.FieldSet$FieldDescriptorLite \
  8006. com.google.protobuf.FieldType \
  8007. com.google.protobuf.FieldType$1 \
  8008. com.google.protobuf.FieldType$Collection \
  8009. com.google.protobuf.FloatArrayList \
  8010. com.google.protobuf.FloatValue \
  8011. com.google.protobuf.FloatValue$1 \
  8012. com.google.protobuf.FloatValue$Builder \
  8013. com.google.protobuf.FloatValueOrBuilder \
  8014. com.google.protobuf.GeneratedMessageInfoFactory \
  8015. com.google.protobuf.GeneratedMessageLite \
  8016. com.google.protobuf.GeneratedMessageLite$1 \
  8017. com.google.protobuf.GeneratedMessageLite$Builder \
  8018. com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser \
  8019. com.google.protobuf.GeneratedMessageLite$ExtendableBuilder \
  8020. com.google.protobuf.GeneratedMessageLite$ExtendableMessage \
  8021. com.google.protobuf.GeneratedMessageLite$ExtendableMessage$ExtensionWriter \
  8022. com.google.protobuf.GeneratedMessageLite$ExtendableMessageOrBuilder \
  8023. com.google.protobuf.GeneratedMessageLite$ExtensionDescriptor \
  8024. com.google.protobuf.GeneratedMessageLite$GeneratedExtension \
  8025. com.google.protobuf.GeneratedMessageLite$MethodToInvoke \
  8026. com.google.protobuf.GeneratedMessageLite$SerializedForm \
  8027. com.google.protobuf.Int32Value \
  8028. com.google.protobuf.Int32Value$1 \
  8029. com.google.protobuf.Int32Value$Builder \
  8030. com.google.protobuf.Int32ValueOrBuilder \
  8031. com.google.protobuf.Int64Value \
  8032. com.google.protobuf.Int64Value$1 \
  8033. com.google.protobuf.Int64Value$Builder \
  8034. com.google.protobuf.Int64ValueOrBuilder \
  8035. com.google.protobuf.IntArrayList \
  8036. com.google.protobuf.Internal \
  8037. com.google.protobuf.Internal$BooleanList \
  8038. com.google.protobuf.Internal$DoubleList \
  8039. com.google.protobuf.Internal$EnumLite \
  8040. com.google.protobuf.Internal$EnumLiteMap \
  8041. com.google.protobuf.Internal$EnumVerifier \
  8042. com.google.protobuf.Internal$FloatList \
  8043. com.google.protobuf.Internal$IntList \
  8044. com.google.protobuf.Internal$ListAdapter \
  8045. com.google.protobuf.Internal$ListAdapter$Converter \
  8046. com.google.protobuf.Internal$LongList \
  8047. com.google.protobuf.Internal$MapAdapter \
  8048. com.google.protobuf.Internal$MapAdapter$1 \
  8049. com.google.protobuf.Internal$MapAdapter$Converter \
  8050. com.google.protobuf.Internal$MapAdapter$EntryAdapter \
  8051. com.google.protobuf.Internal$MapAdapter$IteratorAdapter \
  8052. com.google.protobuf.Internal$MapAdapter$SetAdapter \
  8053. com.google.protobuf.Internal$ProtobufList \
  8054. com.google.protobuf.InvalidProtocolBufferException \
  8055. com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException \
  8056. com.google.protobuf.IterableByteBufferInputStream \
  8057. com.google.protobuf.JavaType \
  8058. com.google.protobuf.LazyField \
  8059. com.google.protobuf.LazyField$1 \
  8060. com.google.protobuf.LazyField$LazyEntry \
  8061. com.google.protobuf.LazyField$LazyIterator \
  8062. com.google.protobuf.LazyFieldLite \
  8063. com.google.protobuf.LazyStringArrayList \
  8064. com.google.protobuf.LazyStringArrayList$ByteArrayListView \
  8065. com.google.protobuf.LazyStringArrayList$ByteStringListView \
  8066. com.google.protobuf.LazyStringList \
  8067. com.google.protobuf.ListFieldSchema \
  8068. com.google.protobuf.ListFieldSchema$1 \
  8069. com.google.protobuf.ListFieldSchema$ListFieldSchemaFull \
  8070. com.google.protobuf.ListFieldSchema$ListFieldSchemaLite \
  8071. com.google.protobuf.ListValue \
  8072. com.google.protobuf.ListValue$1 \
  8073. com.google.protobuf.ListValue$Builder \
  8074. com.google.protobuf.ListValueOrBuilder \
  8075. com.google.protobuf.LongArrayList \
  8076. com.google.protobuf.ManifestSchemaFactory \
  8077. com.google.protobuf.ManifestSchemaFactory$1 \
  8078. com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory \
  8079. com.google.protobuf.MapEntryLite \
  8080. com.google.protobuf.MapEntryLite$1 \
  8081. com.google.protobuf.MapEntryLite$Metadata \
  8082. com.google.protobuf.MapFieldLite \
  8083. com.google.protobuf.MapFieldSchema \
  8084. com.google.protobuf.MapFieldSchemaLite \
  8085. com.google.protobuf.MapFieldSchemas \
  8086. com.google.protobuf.MessageInfo \
  8087. com.google.protobuf.MessageInfoFactory \
  8088. com.google.protobuf.MessageLite \
  8089. com.google.protobuf.MessageLite$Builder \
  8090. com.google.protobuf.MessageLiteOrBuilder \
  8091. com.google.protobuf.MessageLiteToString \
  8092. com.google.protobuf.MessageSchema \
  8093. com.google.protobuf.MessageSchema$1 \
  8094. com.google.protobuf.MessageSetSchema \
  8095. com.google.protobuf.Method \
  8096. com.google.protobuf.Method$1 \
  8097. com.google.protobuf.Method$Builder \
  8098. com.google.protobuf.MethodOrBuilder \
  8099. com.google.protobuf.Mixin \
  8100. com.google.protobuf.Mixin$1 \
  8101. com.google.protobuf.Mixin$Builder \
  8102. com.google.protobuf.MixinOrBuilder \
  8103. com.google.protobuf.MutabilityOracle \
  8104. com.google.protobuf.MutabilityOracle$1 \
  8105. com.google.protobuf.NewInstanceSchema \
  8106. com.google.protobuf.NewInstanceSchemaLite \
  8107. com.google.protobuf.NewInstanceSchemas \
  8108. com.google.protobuf.NioByteString \
  8109. com.google.protobuf.NioByteString$1 \
  8110. com.google.protobuf.NullValue \
  8111. com.google.protobuf.NullValue$1 \
  8112. com.google.protobuf.OneofInfo \
  8113. com.google.protobuf.Option \
  8114. com.google.protobuf.Option$1 \
  8115. com.google.protobuf.Option$Builder \
  8116. com.google.protobuf.OptionOrBuilder \
  8117. com.google.protobuf.Parser \
  8118. com.google.protobuf.PrimitiveNonBoxingCollection \
  8119. com.google.protobuf.Protobuf \
  8120. com.google.protobuf.ProtobufArrayList \
  8121. com.google.protobuf.ProtobufLists \
  8122. com.google.protobuf.ProtocolStringList \
  8123. com.google.protobuf.ProtoSyntax \
  8124. com.google.protobuf.RawMessageInfo \
  8125. com.google.protobuf.Reader \
  8126. com.google.protobuf.RopeByteString \
  8127. com.google.protobuf.RopeByteString$1 \
  8128. com.google.protobuf.RopeByteString$Balancer \
  8129. com.google.protobuf.RopeByteString$PieceIterator \
  8130. com.google.protobuf.RopeByteString$RopeInputStream \
  8131. com.google.protobuf.Schema \
  8132. com.google.protobuf.SchemaFactory \
  8133. com.google.protobuf.SchemaUtil \
  8134. com.google.protobuf.SmallSortedMap \
  8135. com.google.protobuf.SmallSortedMap$1 \
  8136. com.google.protobuf.SmallSortedMap$DescendingEntryIterator \
  8137. com.google.protobuf.SmallSortedMap$DescendingEntrySet \
  8138. com.google.protobuf.SmallSortedMap$EmptySet \
  8139. com.google.protobuf.SmallSortedMap$EmptySet$1 \
  8140. com.google.protobuf.SmallSortedMap$EmptySet$2 \
  8141. com.google.protobuf.SmallSortedMap$Entry \
  8142. com.google.protobuf.SmallSortedMap$EntryIterator \
  8143. com.google.protobuf.SmallSortedMap$EntrySet \
  8144. com.google.protobuf.SourceContext \
  8145. com.google.protobuf.SourceContext$1 \
  8146. com.google.protobuf.SourceContext$Builder \
  8147. com.google.protobuf.SourceContextOrBuilder \
  8148. com.google.protobuf.SourceContextProto \
  8149. com.google.protobuf.StringValue \
  8150. com.google.protobuf.StringValue$1 \
  8151. com.google.protobuf.StringValue$Builder \
  8152. com.google.protobuf.StringValueOrBuilder \
  8153. com.google.protobuf.Struct \
  8154. com.google.protobuf.Struct$1 \
  8155. com.google.protobuf.Struct$Builder \
  8156. com.google.protobuf.Struct$FieldsDefaultEntryHolder \
  8157. com.google.protobuf.StructOrBuilder \
  8158. com.google.protobuf.StructProto \
  8159. com.google.protobuf.StructuralMessageInfo \
  8160. com.google.protobuf.StructuralMessageInfo$Builder \
  8161. com.google.protobuf.Syntax \
  8162. com.google.protobuf.Syntax$1 \
  8163. com.google.protobuf.TextFormatEscaper \
  8164. com.google.protobuf.TextFormatEscaper$1 \
  8165. com.google.protobuf.TextFormatEscaper$2 \
  8166. com.google.protobuf.TextFormatEscaper$ByteSequence \
  8167. com.google.protobuf.Timestamp \
  8168. com.google.protobuf.Timestamp$1 \
  8169. com.google.protobuf.Timestamp$Builder \
  8170. com.google.protobuf.TimestampOrBuilder \
  8171. com.google.protobuf.TimestampProto \
  8172. com.google.protobuf.Type \
  8173. com.google.protobuf.Type$1 \
  8174. com.google.protobuf.Type$Builder \
  8175. com.google.protobuf.TypeOrBuilder \
  8176. com.google.protobuf.TypeProto \
  8177. com.google.protobuf.UInt32Value \
  8178. com.google.protobuf.UInt32Value$1 \
  8179. com.google.protobuf.UInt32Value$Builder \
  8180. com.google.protobuf.UInt32ValueOrBuilder \
  8181. com.google.protobuf.UInt64Value \
  8182. com.google.protobuf.UInt64Value$1 \
  8183. com.google.protobuf.UInt64Value$Builder \
  8184. com.google.protobuf.UInt64ValueOrBuilder \
  8185. com.google.protobuf.UninitializedMessageException \
  8186. com.google.protobuf.UnknownFieldSchema \
  8187. com.google.protobuf.UnknownFieldSetLite \
  8188. com.google.protobuf.UnknownFieldSetLiteSchema \
  8189. com.google.protobuf.UnmodifiableLazyStringList \
  8190. com.google.protobuf.UnmodifiableLazyStringList$1 \
  8191. com.google.protobuf.UnmodifiableLazyStringList$2 \
  8192. com.google.protobuf.UnsafeByteOperations \
  8193. com.google.protobuf.UnsafeUtil \
  8194. com.google.protobuf.UnsafeUtil$1 \
  8195. com.google.protobuf.UnsafeUtil$Android32MemoryAccessor \
  8196. com.google.protobuf.UnsafeUtil$Android64MemoryAccessor \
  8197. com.google.protobuf.UnsafeUtil$JvmMemoryAccessor \
  8198. com.google.protobuf.UnsafeUtil$MemoryAccessor \
  8199. com.google.protobuf.Utf8 \
  8200. com.google.protobuf.Utf8$DecodeUtil \
  8201. com.google.protobuf.Utf8$Processor \
  8202. com.google.protobuf.Utf8$SafeProcessor \
  8203. com.google.protobuf.Utf8$UnpairedSurrogateException \
  8204. com.google.protobuf.Utf8$UnsafeProcessor \
  8205. com.google.protobuf.Value \
  8206. com.google.protobuf.Value$1 \
  8207. com.google.protobuf.Value$Builder \
  8208. com.google.protobuf.Value$KindCase \
  8209. com.google.protobuf.ValueOrBuilder \
  8210. com.google.protobuf.WireFormat \
  8211. com.google.protobuf.WireFormat$1 \
  8212. com.google.protobuf.WireFormat$FieldType \
  8213. com.google.protobuf.WireFormat$FieldType$1 \
  8214. com.google.protobuf.WireFormat$FieldType$2 \
  8215. com.google.protobuf.WireFormat$FieldType$3 \
  8216. com.google.protobuf.WireFormat$FieldType$4 \
  8217. com.google.protobuf.WireFormat$JavaType \
  8218. com.google.protobuf.WireFormat$Utf8Validation \
  8219. com.google.protobuf.WireFormat$Utf8Validation$1 \
  8220. com.google.protobuf.WireFormat$Utf8Validation$2 \
  8221. com.google.protobuf.WireFormat$Utf8Validation$3 \
  8222. com.google.protobuf.WrappersProto \
  8223. com.google.protobuf.Writer \
  8224. com.google.protobuf.Writer$FieldOrder
  8225. # tag:java-specific
  8226. JAVA_IGNORE_CLASSPATH_CLASH_VALUE=$JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE
  8227. ### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
  8228. ### Ignore classpath clash test fails for classes
  8229. macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
  8230. SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args $JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE)
  8231. }
  8232. # tag:python-specific
  8233. ### @usage: PY_SRCS({| CYTHON_C} { | TOP_LEVEL | NAMESPACE ns} Files...)
  8234. ###
  8235. ### Build specified Python sources according to Arcadia binary Python build. Basically creates precompiled and source resources keyed with module paths.
  8236. ### The resources eventually are linked into final program and can be accessed as regular Python modules.
  8237. ### This custom loader linked into the program will add them to sys.meta_path.
  8238. ###
  8239. ### 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.
  8240. ### .pyx and .swg lead to C/C++ Python extensions generation, that are automatically registered in Python as built-in modules.
  8241. ###
  8242. ### 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).
  8243. ###
  8244. ### __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.
  8245. ###
  8246. ### @example
  8247. ###
  8248. ### PY2_LIBRARY(mymodule)
  8249. ### 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)
  8250. ### END()
  8251. ###
  8252. ### PY_SRCS honors Python2 and Python3 differences and adjusts itself to Python version of a current module.
  8253. ### PY_SRCS can be used in any Arcadia Python build modules like PY*_LIBRARY, PY*_PROGRAM, PY*TEST.
  8254. ### PY_SRCS in LIBRARY or PROGRAM effectively converts these into PY2_LIBRARY and PY2_PROGRAM respectively.
  8255. ### 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.
  8256. ###
  8257. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs/#modulipylibrarypy3libraryimakrospysrcs
  8258. macro PY_SRCS() {
  8259. DEFAULT(MODULE_TAG PY2)
  8260. DEFAULT(PYTHON2 yes)
  8261. DEFAULT(PYTHON3 no)
  8262. }
  8263. # tag:python-specific
  8264. _ALL_PY_FILES=
  8265. # tag:python-specific
  8266. macro _ALL_PY_SRCS2(TOP_LEVEL?"TOP_LEVEL":"", RECURSIVE?"/**":"", NAMESPACE[], REST[]) {
  8267. _GLOB(_ALL_PY_FILES ${suf=${RECURSIVE}/*.py:REST} ${suf=${RECURSIVE}/ya.make:REST} EXCLUDE ya.make)
  8268. }
  8269. # tag:python-specific
  8270. ### @usage: ALL_PY_SRCS([RECURSIVE] { | TOP_LEVEL | NAMESPACE ns} [Dirs...])
  8271. ###
  8272. ### Puts all .py-files from given Dirs (relative to projects') into PY_SRCS of the current module.
  8273. ### If Dirs is ommitted project directory is used
  8274. ###
  8275. ### `RECURSIVE` makes lookup recursive with resprect to Dirs
  8276. ### `TOP_LEVEL` and `NAMESPACE` are forwarded to `PY_SRCS`
  8277. ###
  8278. ### Note: Only one such macro per module is allowed
  8279. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  8280. ###
  8281. ### @see [PY_SRCS()](#macro_PY_SRCS)
  8282. macro ALL_PY_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", Files...) {
  8283. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files})
  8284. PY_SRCS(_MR ${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} $_ALL_PY_FILES)
  8285. }
  8286. # tag:python-specific
  8287. ### @usage: ALL_PYTEST_SRCS([RECURSIVE] [Dirs...])
  8288. ###
  8289. ### Puts all .py-files from given Dirs (relative to projects') into TEST_SRCS of the current module.
  8290. ### If Dirs is omitted project directory is used
  8291. ###
  8292. ### `RECURSIVE` makes lookup recursive with respect to Dirs
  8293. ###
  8294. ### Note: Only one such macro per module is allowed
  8295. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  8296. ###
  8297. ### @see [TEST_SRCS()](#macro_TEST_SRCS)
  8298. macro ALL_PYTEST_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", Files...) {
  8299. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files})
  8300. TEST_SRCS(_MR $_ALL_PY_FILES)
  8301. }
  8302. # tag:python-specific
  8303. _PY_EXTRA_LINT_FILES_VALUE=
  8304. ### @usage: PY_EXTRA_LINT_FILES(files...)
  8305. ###
  8306. ### Add extra Python files for linting. This macro allows adding
  8307. ### Python files which has no .py extension.
  8308. macro PY_EXTRA_LINT_FILES(FILES...) {
  8309. SET_APPEND(_PY_EXTRA_LINT_FILES_VALUE $FILES)
  8310. }
  8311. # tag:python-specific
  8312. ### @usage: PY23_LIBRARY([name])
  8313. ###
  8314. ### Build PY2_LIBRARY or PY3_LIBRARY depending on incoming PEERDIR.
  8315. ### Direct build or build by RECURSE creates both variants.
  8316. ### This multimodule doesn't define any final targets, so use from DEPENDS or BUNDLE is not allowed.
  8317. ###
  8318. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs
  8319. multimodule PY23_LIBRARY {
  8320. module PY2: PY2_LIBRARY {
  8321. OBJ_SUF=.py2
  8322. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8323. PYTHON_TYPE_FOR_CYTHON=PY2
  8324. }
  8325. module PY3: PY3_LIBRARY {
  8326. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8327. PYTHON_TYPE_FOR_CYTHON=PY2
  8328. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8329. MODULE_PREFIX=py3
  8330. }
  8331. otherwise {
  8332. MODULE_PREFIX=libpy3
  8333. }
  8334. OBJ_SUF=.py3
  8335. }
  8336. }
  8337. # tag:python-specific
  8338. ### @usage: PY23_NATIVE_LIBRARY([name])
  8339. ###
  8340. ### Build LIBRARY compatible with either Python 2.x or Python 3.x depending on incoming PEERDIR.
  8341. ###
  8342. ### 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.
  8343. ### Use these multimodule instead of PY23_LIBRARY if the C++ extension defined in it will be used in PY2MODULE.
  8344. ### 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.
  8345. ### Proper version will be selected according to Python version of the module PEERDIR comes from.
  8346. ###
  8347. ### This mulrtimodule doesn't define any final targets so cannot be used from DEPENDS or BUNDLE macros.
  8348. ###
  8349. ### For more information read https://wiki.yandex-team.ru/arcadia/python/pysrcs/#pysrcssrcsipy23nativelibrary
  8350. ###
  8351. ### @see [LIBRARY()](#module_LIBRARY), [PY2MODULE()](#module_PY2MODULE)
  8352. multimodule PY23_NATIVE_LIBRARY {
  8353. module PY2: LIBRARY {
  8354. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 PYTHON3_ADDINCL
  8355. OBJ_SUF=.py2
  8356. PYTHON2_ADDINCL()
  8357. SET(MODULE_LANG PY2)
  8358. }
  8359. module PY3: LIBRARY {
  8360. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3
  8361. .ALIASES=PYTHON2_ADDINCL=PYTHON3_ADDINCL
  8362. PYTHON3_ADDINCL()
  8363. SET(MODULE_LANG PY3)
  8364. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8365. MODULE_PREFIX=py3c
  8366. }
  8367. otherwise {
  8368. MODULE_PREFIX=libpy3c
  8369. }
  8370. OBJ_SUF=.py3
  8371. }
  8372. }
  8373. IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  8374. # tag:src-processing
  8375. STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
  8376. macro _SRC("storyboard", SRC, SRCFLAGS...) {
  8377. .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}
  8378. }
  8379. # tag:src-processing
  8380. macro _SRC("xib", SRC, SRCFLAGS...) {
  8381. .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}
  8382. }
  8383. ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  8384. # tag:ios-specific
  8385. ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
  8386. macro _IOS_ASSETS(AssetsDir, Content...) {
  8387. .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
  8388. }
  8389. # tag:ios-specific
  8390. macro IOS_APP_COMMON_FLAGS(Flags...) {
  8391. SET_APPEND(STORYBOARD_FLAGS $Flags)
  8392. SET_APPEND(ASSETS_FLAGS $Flags)
  8393. }
  8394. # tag:ios-specific
  8395. macro IOS_APP_ASSETS_FLAGS(Flags...) {
  8396. SET_APPEND(ASSETS_FLAGS $Flags)
  8397. }
  8398. macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
  8399. .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
  8400. }
  8401. macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
  8402. .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
  8403. }
  8404. # tag:ios-specific
  8405. DELIM=__DELIM__
  8406. 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
  8407. ### @usage: IOS_INTERFACE()
  8408. ### iOS GUI module definition
  8409. module IOS_INTERFACE: _BARE_UNIT {
  8410. .CMD=PACK_IOS_ARCHIVE
  8411. .EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
  8412. .NODE_TYPE=Library
  8413. .FINAL_TARGET=no
  8414. SET(MODULE_SUFFIX .ios.interface)
  8415. PEERDIR+=build/platform/xcode/tools
  8416. }
  8417. # tag:ios-specific
  8418. module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
  8419. SET(MODULE_SUFFIX .default.ios.interface)
  8420. }
  8421. DEFAULT_IOS_TYPE=
  8422. IOS_TYPE=
  8423. when(!$IOS_TYPE) {
  8424. when($DEFAULT_IOS_TYPE) {
  8425. IOS_TYPE=$DEFAULT_IOS_TYPE
  8426. }
  8427. otherwise {
  8428. IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
  8429. }
  8430. }
  8431. DEFAULT_IOS_RUNTIME=
  8432. IOS_RUNTIME=
  8433. when(!$IOS_RUNTIME) {
  8434. when($DEFAULT_IOS_RUNTIME) {
  8435. IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
  8436. }
  8437. otherwise {
  8438. IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
  8439. }
  8440. }
  8441. when ($ARCH_I386) {
  8442. TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
  8443. TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
  8444. }
  8445. otherwise {
  8446. TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
  8447. TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
  8448. }
  8449. # tag:java-specific
  8450. ### @usage: MODULE_JDK(Version)
  8451. ###
  8452. ### Specify JDK version for module
  8453. macro JDK_VERSION(Arg) {
  8454. SET(JDK_REAL_VERSION $Arg)
  8455. _JDK_VERSION_MACRO_CHECK($Arg)
  8456. }
  8457. # tag:java-specific
  8458. when ($JDK_REAL_VERSION == "10") {
  8459. JDK10=yes # remove this later
  8460. }
  8461. JAVA_PROGRAM_CP_USE_COMMAND_FILE=yes
  8462. when ($JDK_REAL_VERSION == "8") {
  8463. JAVA_PROGRAM_CP_USE_COMMAND_FILE=no
  8464. }
  8465. # tag:kotlin-specific
  8466. KOTLIN_JVM_TARGET=
  8467. when ($JDK_REAL_VERSION == "8") {
  8468. KOTLIN_JVM_TARGET=1.8
  8469. }
  8470. elsewhen ($JDK_REAL_VERSION == "18") {
  8471. # remove when kotlin starts supporting jdk18 bytecode
  8472. # see also devtools/ya/jbuild/gen/actions/idea.py
  8473. KOTLIN_JVM_TARGET=17
  8474. }
  8475. otherwise {
  8476. KOTLIN_JVM_TARGET=$JDK_REAL_VERSION
  8477. }
  8478. # tag:frontend-specific
  8479. ### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
  8480. ###
  8481. ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
  8482. macro COLLECT_FRONTEND_FILES(Varname, Dir) {
  8483. _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
  8484. }
  8485. # tag:java-specific
  8486. # local jdk and tools
  8487. USE_SYSTEM_JDK=
  8488. USE_SYSTEM_UBERJAR=
  8489. USE_SYSTEM_ERROR_PRONE=
  8490. # tag:swift-specific
  8491. CPP_XCODE_TOOLCHAIN_VERSION=9.2
  8492. SWIFT_XCODE_TOOLCHAIN_VERSION=9.2
  8493. XCODE_TOOLS_VERSION=10.1
  8494. macro COMPILE_SWIFT_MODULE(SRCS{input}[], BRIDGE_HEADER{input}="", Flags...) {
  8495. when ($BRIDGE_HEADER != "") {
  8496. SWIFT_BRIDGE_HEADER=-import-objc-header ${input:BRIDGE_HEADER}
  8497. }
  8498. otherwise {
  8499. SWIFT_BRIDGE_HEADER=
  8500. }
  8501. .PEERDIR+=build/platform/xcode/swift
  8502. # swift core libraries
  8503. LDFLAGS($SWIFT_LD_FLAGS)
  8504. .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}
  8505. }
  8506. TEST_TOOL_HOST_LOCAL=
  8507. TEST_TOOL_TARGET_LOCAL=
  8508. when ($MOST_USED_CUDA) {
  8509. CUDA_VERSION=11.4
  8510. CUDNN_VERSION=8.0.5
  8511. TENSORRT_VERSION=7
  8512. }
  8513. when ($TENSORFLOW_WITH_CUDA) {
  8514. CUDA_REQUIRED=yes
  8515. }
  8516. when (!$TENSORRT_VERSION) {
  8517. TENSORRT_VERSION=5
  8518. }
  8519. ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
  8520. MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin
  8521. when ($QT_REQUIRED) {
  8522. QT_BIN=${HOST_QT_RESOURCE_GLOBAL}/bin
  8523. }
  8524. when ($OPENGL_REQUIRED) {
  8525. OPENGL_VERSION=18.0.5
  8526. }
  8527. # tag:python-specific
  8528. multimodule PY23_TEST {
  8529. module PY2 : PYTEST_BIN {
  8530. MODULE_PREFIX=py2_
  8531. OBJ_SUF=.py2
  8532. CANONIZE_SUB_PATH=py2test
  8533. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8534. PYTHON_TYPE_FOR_CYTHON=PY2
  8535. }
  8536. module PY3TEST_PROGRAM: PY3TEST_BIN {
  8537. .FINAL_TARGET=yes
  8538. OBJ_SUF=.py3
  8539. CANONIZE_SUB_PATH=py3test
  8540. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8541. PYTHON_TYPE_FOR_CYTHON=PY2
  8542. }
  8543. module PY3TEST_LIBRARY: PY3_LIBRARY {
  8544. PEERDIR+=library/python/pytest
  8545. _REQUIRE_EXPLICIT_LICENSE()
  8546. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8547. PYTHON_TYPE_FOR_CYTHON=PY2
  8548. }
  8549. }
  8550. # tag:windows-specific
  8551. WINDOWS_MANIFEST=
  8552. macro WINDOWS_MANIFEST(Manifest) {
  8553. SET(WINDOWS_MANIFEST $Manifest)
  8554. }
  8555. # tag:windows-specific
  8556. when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
  8557. LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
  8558. }
  8559. # tag:cpp-specific
  8560. _VISIBILITY_LEVEL=
  8561. ### @usage: VISIBILITY(level)
  8562. ###
  8563. ### This macro sets visibility level for symbols compiled for the current module. 'level'
  8564. ### may take only one of the following values: DEFAULT, HIDDEN.
  8565. macro VISIBILITY(LEVEL) {
  8566. SET(_VISIBILITY_LEVEL ${LEVEL})
  8567. select ($LEVEL) {
  8568. "DEFAULT" | "HIDDEN" ? {
  8569. }
  8570. default ? {
  8571. _OK = no
  8572. }
  8573. }
  8574. ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
  8575. }
  8576. # tag:cpp-specific
  8577. _CFLAGS_VISIBILITY=
  8578. when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
  8579. when ($CLANG == "yes" || $GCC == "yes") {
  8580. _CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
  8581. }
  8582. }
  8583. CFLAGS+=$_CFLAGS_VISIBILITY
  8584. # tag:cpp-specific
  8585. macro SDBUS_CPP_ADAPTOR(File) {
  8586. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
  8587. .PEERDIR=contrib/libs/sdbus-cpp
  8588. }
  8589. # tag:cpp-specific
  8590. macro SDBUS_CPP_PROXY(File) {
  8591. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
  8592. .PEERDIR=contrib/libs/sdbus-cpp
  8593. }
  8594. # tag:python-specific
  8595. macro _PY_SSQLS_SRC(EXT, SRC, SRCFLAGS...) {
  8596. #generic macro
  8597. }
  8598. # tag:python-specific
  8599. macro _PY_SSQLS_SRC("ssqls", SRC, SRCFLAGS...) {
  8600. .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}
  8601. }
  8602. # tag:python-specific
  8603. macro _PY_SSQLS_SRCS(Srcs...) {
  8604. foreach(Src: $Srcs) {
  8605. _PY_SSQLS_SRC(${lastext:Src} $Src)
  8606. }
  8607. }
  8608. # tag:python-specific
  8609. macro PY_SSQLS_SRCS(Srcs...) {
  8610. _PY_SSQLS_SRCS(KEEP_DIR_STRUCT $Srcs)
  8611. PY_SRCS(${noext;pre=autogenerated/$MODDIR/:Srcs.py})
  8612. }
  8613. # tag:python-specific
  8614. macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
  8615. .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"}
  8616. }
  8617. # tag:python-specific
  8618. macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
  8619. .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"}
  8620. }
  8621. # tag:metrika
  8622. multimodule SSQLS_LIBRARY {
  8623. module CPP_SSQLS : LIBRARY {
  8624. .ALIASES=ENUMS_SERIALIZATION=CPP_ENUMS_SERIALIZATION
  8625. SET(PEERDIR_TAGS CPP_SSQLS)
  8626. PEERDIR(metrika/core/libs/appmetrica/types metrika/core/libs/types)
  8627. ADDINCL(GLOBAL ${ARCADIA_BUILD_ROOT}/metrika/core/common_tables/include)
  8628. }
  8629. module PY3_SSQLS : PY3_LIBRARY {
  8630. .ALIASES=SRCS=PY_SSQLS_SRCS ENUMS_SERIALIZATION=PY_ENUMS_SERIALIZATION
  8631. SET(PEERDIR_TAGS PY3 PY3_SSQLS)
  8632. }
  8633. }
  8634. macro NGINX_MODULES(Modules...) {
  8635. PEERDIR(${Modules})
  8636. 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)
  8637. }
  8638. # Experimental: container as output. https://st.yandex-team.ru/DTCC-179
  8639. # tag:external-build
  8640. 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"}
  8641. 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"}
  8642. # tag:external-build
  8643. module CONTAINER_LAYER: _BARE_UNIT {
  8644. .CMD=CONTAINER_LAYER_CMD
  8645. MODULE_SUFFIX=.container_layer
  8646. }
  8647. # tag:external-build
  8648. module CONTAINER: _BARE_UNIT {
  8649. .NODE_TYPE=Bundle
  8650. .PEERDIR_POLICY=as_build_from
  8651. .FINAL_TARGET=yes
  8652. .CMD=CONTAINER_CMD
  8653. }
  8654. # tag:external-build
  8655. CUSTOM_BUILD_LIBRARY_USE=
  8656. 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
  8657. # tag:external-build
  8658. module CUSTOM_BUILD_LIBRARY: LIBRARY {
  8659. .NODE_TYPE=Bundle
  8660. .PEERDIR_POLICY=as_build_from
  8661. .PROXY=yes
  8662. .CMD=CUSTOM_BUILD_LIBRARY_CMD
  8663. DISABLE(NEED_ADD_FAKE_SRC)
  8664. }
  8665. ### @usage: ORIGINAL_SOURCE(Source)
  8666. ###
  8667. ### This macro specifies the source repository for contrib
  8668. ### Does nothing now (just a placeholder for future functionality)
  8669. ### See https://st.yandex-team.ru/DTCC-316
  8670. macro ORIGINAL_SOURCE(Source) {
  8671. ENABLE(UNUSED_MACRO)
  8672. }
  8673. # tag:licence
  8674. CREDITS_FILE_EXTRA_EXT=
  8675. CREDITS_FLAGS=
  8676. CREDITS_TEXTS_FILE=
  8677. NO_CREDITS_TEXTS_FILE=
  8678. WITH_CREDITS=
  8679. ### @usage: LICENSE_TEXTS(File)
  8680. ###
  8681. ### This macro specifies the filename with all library licenses texts
  8682. macro LICENSE_TEXTS(Source) {
  8683. SET(CREDITS_TEXTS_FILE $Source)
  8684. }
  8685. # tag:licence
  8686. ### @usage: WITHOUT_LICENSE_TEXTS()
  8687. ###
  8688. ### This macro indicates that the module has no license text
  8689. macro WITHOUT_LICENSE_TEXTS() {
  8690. ENABLE(NO_CREDITS_TEXTS_FILE)
  8691. }
  8692. # tag:licence
  8693. when ($WITH_CREDITS) {
  8694. CREDITS_FLAGS+=--credits-output ${output;suf=${CREDITS_FILE_EXTRA_EXT}".CREDITS.txt":REALPRJNAME}
  8695. }
  8696. GENERATE_MF=
  8697. when ($WITH_CREDITS) {
  8698. GENERATE_MF=$GENERATE_MF_CMD
  8699. }
  8700. macro _MCU_CONVERT(Bin) {
  8701. .CMD=${cwd:BINDIR} $OBJCOPY_TOOL -O ihex $Bin ${output;noext:Bin.hex} && ${cwd:BINDIR} $OBJCOPY_TOOL -O srec $Bin ${output;noext:Bin.s37} && ${cwd:BINDIR} $OBJCOPY_TOOL -O binary $Bin ${output;noext:Bin.bin}
  8702. }
  8703. MCU_LINK_EXE=$LINK_EXE && $_MCU_CONVERT($MODULE_PREFIX$REALPRJNAME)
  8704. ### @usage: MCU_PROGRAM([progname])
  8705. ###
  8706. ### Program module for microcontrollers. Converts ELF to Intel HEX, Motorola S-record and raw binary file formats.
  8707. ### If name is not specified it will be generated from the name of the containing project directory.
  8708. module MCU_PROGRAM: PROGRAM {
  8709. .CMD=MCU_LINK_EXE
  8710. }
  8711. # tag:deprecated
  8712. ### @usage: METAQUERYFILES(filenames...) #deprecated
  8713. ###
  8714. ### This macro does nothing and will be removed
  8715. macro METAQUERYFILES(Files...) {
  8716. ENABLE(UNUSED_MACRO)
  8717. }
  8718. # tag:flags tag:internal tag:windows-specific
  8719. ### @usage: _MSVC_FLAGS_WINDOWS_IMPL(target_platform compiler_flags) # internal
  8720. ###
  8721. ### Add CFLAGS when the firts argument is WINDOWS
  8722. macro _MSVC_FLAGS_WINDOWS_IMPL(WINDOWS[], FLAGS...) {
  8723. CFLAGS($WINDOWS)
  8724. }
  8725. # tag:flags tag:windows-specific tag:cpp-specific
  8726. ### @usage: MSVC_FLAGS([GLOBAL compiler_flag]* compiler_flags)
  8727. ###
  8728. ### Add the specified flags to the compilation line of C/C++files.
  8729. ### Flags apply only if the compiler used is MSVC (cl.exe)
  8730. macro MSVC_FLAGS(FLAGS...) {
  8731. _MSVC_FLAGS_WINDOWS_IMPL($TARGET_PLATFORM $FLAGS)
  8732. }
  8733. ### @usage: COLLECT_YDB_API_SPECS_LEGACY(VarName Paths...) #deprecated
  8734. ###
  8735. ### This macro is ugly hack for legacy YDB go API codegen, any other uses are prohibited
  8736. macro COLLECT_YDB_API_SPECS_LEGACY(FILES_VAR, PATHS...) {
  8737. _GLOB($FILES_VAR ${suf=/*.proto:PATHS})
  8738. RESTRICT_PATH(kikimr/public/sdk/go/ydb/api MSG This is ugly hack for legacy YDB go API codegen, any other uses are probibited)
  8739. }
  8740. # tag:proto tag:apphost
  8741. ### @usage: APPHOST()
  8742. ###
  8743. ### Emit APPHOST service code for all .proto files in a PROTO_LIBRARY.
  8744. ### This works only for C++ and Java at the moment.
  8745. macro APPHOST() {
  8746. # C++
  8747. CPP_PROTO_PLUGIN(cpp_plugin apphost/tools/stub_generator/cpp_plugin .apphost.h)
  8748. # Java
  8749. JAVA_PROTO_PLUGIN(java_plugin apphost/tools/stub_generator/java_plugin DEPS apphost/api/service/java/apphost)
  8750. }