ymake.core.conf 348 KB

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