ymake.core.conf 383 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872
  1. # !!! DISCLAIMER! PLEASE DON'T IGNORE !!!
  2. # The FAKEID value is huge hammer. It affects UIDs of all nodes in build graph including, but not limited to
  3. # any resource fetch (think java contrib), build on any language (C++, Python, Java, Go), any code generation.
  4. # Any build after this change will pay the price:
  5. # - Local builds and Sandbox builds will reload all resources from Sandbox and cached data from YT (if ready).
  6. # - Distributed (YT) cache warmup will take significant time to catch up and will need to recache everything.
  7. # - Autocheck will rebuild and recache everything.
  8. # Use this with extreme care and only change if it is ultimately needed. Consider more specific XXX_FAKEIDs below instead.
  9. FAKEID=3141592653
  10. SANDBOX_FAKEID=${FAKEID}.7600000
  11. CPP_FAKEID=9517719
  12. GO_FAKEID=9478151
  13. ANDROID_FAKEID=8821472
  14. CLANG_TIDY_FAKEID=8625699
  15. CURDIR=.
  16. MODDIR=.
  17. BINDIR=bin:/
  18. SRCDIR=
  19. YMAKE=ymake
  20. ECHO=echo
  21. INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i
  22. CPP_EXT=.cpp
  23. OBJ_SUF=
  24. CFLAGS=
  25. EXTRA_C_FLAGS=
  26. SFLAGS=
  27. AUTOCHECK_BALANCING_OPTIONS=
  28. SO_OTPUTS=no
  29. @import "${CONF_ROOT}/conf/settings.conf"
  30. @import "${CONF_ROOT}/conf/opensource.conf"
  31. @import "${CONF_ROOT}/conf/rules.conf"
  32. @import "${CONF_ROOT}/conf/sysincl.conf"
  33. @import "${CONF_ROOT}/conf/license.conf"
  34. @import "${CONF_ROOT}/conf/ts.conf"
  35. @import "${CONF_ROOT}/conf/docs.conf"
  36. @import "${CONF_ROOT}/conf/project_specific/other.conf"
  37. USE_GLOBAL_CMD=no
  38. when ($OS_WINDOWS != "yes") {
  39. USE_GLOBAL_CMD=yes
  40. }
  41. YMAKE_RESOURCE_BIN=${YMAKE_RESOURCE_GLOBAL}/ymake
  42. YMAKE_RESOURCE_DIR=build/external_resources/ymake
  43. when ($USE_YMAKE_RESOURCE == "yes") {
  44. PEERDIR+=${YMAKE_RESOURCE_DIR}
  45. }
  46. __COMMA__=${comma:""}
  47. ARCADIA_TEST_ROOT=../arcadia_tests_data/
  48. DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32
  49. BISON_DATA_DIR=contrib/tools/bison/bison/data
  50. CPP_BISON_SKELS=${BISON_DATA_DIR}/glr.cc ${BISON_DATA_DIR}/lalr1.cc ${BISON_DATA_DIR}/yacc.c ${BISON_DATA_DIR}/stack.hh ${BISON_DATA_DIR}/variant.hh ${BISON_DATA_DIR}/c++.m4 ${BISON_DATA_DIR}/c++-skel.m4
  51. USE_PREBUILT_TOOLS=yes
  52. when ($OPENSOURCE == "yes") {
  53. USE_PREBUILT_TOOLS=no
  54. }
  55. FAIL_PY2=no
  56. _PREBUILT_TOOLS_ROOT=build/prebuilt
  57. _TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
  58. _TOOL_RESCOMPILER=tools/rescompiler
  59. _TOOL_RESCOMPRESSOR=tools/rescompressor
  60. _TOOL_RORESCOMPILER=tools/rorescompiler
  61. when ($HOST_ARCH_X86_64 == "yes") {
  62. when ($HOST_OS_DARWIN == "yes" || $HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes") {
  63. VALID_HOST_PLATFORM_FOR_COMMON_PREBUILT_TOOLS=yes
  64. when ($USE_PREBUILT_TOOLS == "yes" && $ARCH_X86_64 == "yes") {
  65. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  66. }
  67. }
  68. }
  69. FAIL_MODULE_CMD=$YMAKE_PYTHON ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
  70. DEFAULT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  71. PROJECT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  72. when ($TIDY == "yes") {
  73. when ($TIDY_EXPORT_FIXES=="") {
  74. TIDY_EXPORT_FIXES="no"
  75. }
  76. CLANG_TIDY_ARGS=${hide:CLANG_TIDY_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/clang_tidy.py"} "--ymake-python" $YMAKE_PYTHON "--clang-tidy-bin" "$(CLANG_TIDY_BIN)/bin/clang-tidy" "--config-validation-script" ${input:"build/tests/config/clang_tidy/tidy_config_validation.py"} "--testing-src" ${input:SRC} "--source-root" $(SOURCE_ROOT) "--build-root" $(BUILD_ROOT) "--tidy-json" ${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.tidyjson:SRC} "--export-fixes" $TIDY_EXPORT_FIXES
  77. CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
  78. CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
  79. when ($TIDY_CHECKS) {
  80. CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
  81. }
  82. when ($TIDY_HEADER_FILTER) {
  83. CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
  84. }
  85. TIDY_VALUE=USE_CONDITIONAL_SRCS
  86. }
  87. otherwise {
  88. CLANG_TIDY_ARGS=
  89. TIDY_VALUE=
  90. }
  91. # tag:codenav
  92. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  93. PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
  94. YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
  95. YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.ydx.pb2:SRC}
  96. }
  97. otherwise {
  98. PY_PROGRAM_LINK_EXE=$LINK_EXE
  99. YNDEXER_ARGS=
  100. YNDEXER_OUTPUT=
  101. }
  102. COVERAGE_FLAGS=
  103. EXTRA_OUTPUT=
  104. when ($CLANG == "yes" || $GCC == "yes") {
  105. when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
  106. COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
  107. EXTRA_OUTPUT=${output;noauto;hide;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.gcno:SRC}
  108. }
  109. }
  110. when ($OS_CYGWIN == "yes") {
  111. CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
  112. USE_ASMLIB=no
  113. FSTACK=
  114. }
  115. CFLAGS+=$COVERAGE_FLAGS
  116. LDFLAGS+=$COVERAGE_FLAGS
  117. CHECKFLAG=
  118. LEX_FLAGS=
  119. NO_MAPREDUCE=
  120. when ($NO_MAPREDUCE == "yes") {
  121. C_DEFINES+=-DNO_MAPREDUCE
  122. }
  123. when ($OS_ANDROID == "yes") {
  124. PIE=yes
  125. }
  126. # TODO: extract to conf/maps/maps.conf
  127. when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
  128. USE_STL_SYSTEM=yes
  129. }
  130. when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_IOS == "yes") {
  131. BUILD_IOS_APP=yes
  132. when ($ARCH_ARM7 || $ARCH_ARM64) {
  133. BOOSTTEST_IS_FAT_OBJECT=yes
  134. }
  135. }
  136. # USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
  137. # select system standard C++ library when USE_INTERNAL_STL=no is set.
  138. #
  139. # USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
  140. #
  141. when ($USE_STL_SYSTEM == "yes") {
  142. USE_INTERNAL_STL=no
  143. }
  144. when ($USE_INTERNAL_STL == "no") {
  145. USE_STL_SYSTEM=yes
  146. }
  147. otherwise {
  148. USE_INTERNAL_STL=yes
  149. # TODO: Extract to conf/sysincl.conf
  150. # This trigger doesn't work for module level since SYSINCL is processed at
  151. # configuration stage (This means that NO_RUNTIME() macro called in ya.make
  152. # won't affect SYSINCL and the only way to make this trigger work correctly
  153. # is to define configuration variable NORUNTIME (-DNORUNTIME) on the command
  154. # line when `ya make ...` is invoked.
  155. when ($NORUNTIME != "yes") {
  156. SYSINCL+=build/sysincl/stl-to-libcxx.yml
  157. when ($MUSL == "yes") {
  158. SYSINCL+=build/sysincl/libc-musl-libcxx.yml
  159. }
  160. }
  161. }
  162. # tag:linux-specific
  163. when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") {
  164. USE_UBUNTU_COMPATIBILITY=yes
  165. }
  166. USE_ARCADIA_PYTHON=yes
  167. USE_ARCADIA_LIBM=no
  168. USE_EAT_MY_DATA=no
  169. HAVE_MKL=
  170. when ($HAVE_MKL == "") {
  171. when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
  172. HAVE_MKL=yes
  173. }
  174. otherwise {
  175. HAVE_MKL=no
  176. }
  177. }
  178. SFDL_TMP_OUT= ${output;tmp:SRC.tmp}
  179. # tag:perl-specific
  180. when ($USE_LOCAL_TOOLS == "yes") {
  181. PERL=$LOCAL_PERL
  182. PERL_VERSION=$LOCAL_PERL_VERSION
  183. PERL_PRIVLIB=$LOCAL_PERL_PRIVLIB
  184. PERL_ARCHLIB=$LOCAL_PERL_ARCHLIB
  185. when ($LOCAL_PERL_LIBS) {
  186. PERL_LIBS=$LOCAL_PERL_LIBS
  187. }
  188. }
  189. otherwise {
  190. PERL=NO-PERL-SELECTED
  191. PERL_VERSION=NO-PERL-SELECTED-VERSION
  192. PERL_PRIVLIB=NO-PERL-SELECTED-PRIVLIB
  193. PERL_ARCHLIB=NO-PERL-SELECTED-ARCHLIB
  194. }
  195. # tag:perl-specific
  196. PERL_LD_LIBRARY_PATH=
  197. PERL_INCLUDE=
  198. USE_PERL_SYSTEM=yes
  199. when ($USE_PERL_SYSTEM == "yes") {
  200. select ($PERL_SDK) {
  201. "ubuntu-12" ? {
  202. PERL_VERSION=5.14
  203. PERL_ROOT=${SYSTEM_PERL_514_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  204. PERL_LIB_ARCH=
  205. }
  206. "ubuntu-14" ? {
  207. PERL_VERSION=5.18
  208. PERL_ROOT=${SYSTEM_PERL_518_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  209. PERL_LIB_ARCH=
  210. }
  211. "ubuntu-16" ? {
  212. PERL_VERSION=5.22
  213. PERL_ROOT=${SYSTEM_PERL_522_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  214. PERL_LIB_ARCH=/x86_64-linux-gnu
  215. }
  216. "ubuntu-18" ? {
  217. PERL_VERSION=5.26
  218. PERL_ROOT=${SYSTEM_PERL_526_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  219. PERL_LIB_ARCH=/x86_64-linux-gnu
  220. }
  221. "ubuntu-20" ? {
  222. PERL_VERSION=5.30
  223. PERL_ROOT=${SYSTEM_PERL_530_RESOURCE_GLOBAL}/usr
  224. PERL_LIB_ARCH=/x86_64-linux-gnu
  225. }
  226. }
  227. PERL=${PERL_ROOT}/bin/perl
  228. PERL_ARCHLIB=${PERL_ROOT}/lib$PERL_LIB_ARCH/perl/${PERL_VERSION}
  229. PERL_PRIVLIB=${PERL_ROOT}/share/perl/${PERL_VERSION}
  230. PERL_LIBS=${PERL_ROOT}/lib${PERL_LIB_ARCH}
  231. PERL_LD_LIBRARY_PATH=${env:"LD_LIBRARY_PATH=${PERL_ROOT}/lib"}
  232. # Perl searches it's modules in INC@ paths. They can not be sysrooted or disabled (at least I haven't found a way),
  233. # so default Perl module directories should be prepended to perl command lines when using non-local perl.
  234. PERL_INCLUDE=-I${PERL_ARCHLIB} -I${PERL_PRIVLIB}
  235. }
  236. PERL_DEFAULT_PEERDIR=yes
  237. # tag:perl-specific
  238. PERLSUFFIX=-csuffix .cpp
  239. PERLOUTPUT=${stdout;output:SRC.cpp}
  240. when ($PERLC == "yes") {
  241. PERLSUFFIX=-csuffix .c
  242. PERLOUTPUT=${stdout;output:SRC.c}
  243. }
  244. XSUBPPFLAGS=
  245. # tag:tool-specific
  246. ARCH_TOOL=${tool:"tools/archiver"}
  247. # tag:tool-specific tag:proto
  248. PROTOC=${tool:"contrib/tools/protoc"}
  249. PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
  250. PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
  251. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src
  252. USE_VANILLA_PROTOC=no
  253. PROTOC_TRANSITIVE_HEADERS=yes
  254. # tag:tool-specific
  255. FML_TOOL=${tool:"tools/relev_fml_codegen"}
  256. FML_UNUSED_TOOL=${tool:"tools/relev_fml_unused"}
  257. LUA_TOOL=${tool:"tools/lua"}
  258. ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
  259. # tag:python-specific tag:cython-specific
  260. CYTHON_SCRIPT=${input:"${ARCADIA_ROOT}/contrib/tools/cython/cython.py"} $CYTHON_PREDEFINED_INCLUDES
  261. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  262. PYTHON_TYPE_FOR_CYTHON=PY2
  263. CYTHON_OUTPUT_INCLUDES=\
  264. ${output_include;hide:"contrib/libs/python/Include/compile.h"} \
  265. ${output_include;hide:"contrib/libs/python/Include/frameobject.h"} \
  266. ${output_include;hide:"contrib/libs/python/Include/longintrepr.h"} \
  267. ${output_include;hide:"contrib/libs/python/Include/pyconfig.h"} \
  268. ${output_include;hide:"contrib/libs/python/Include/Python.h"} \
  269. ${output_include;hide:"contrib/libs/python/Include/pythread.h"} \
  270. ${output_include;hide:"contrib/libs/python/Include/structmember.h"} \
  271. ${output_include;hide:"contrib/libs/python/Include/traceback.h"} \
  272. ${output_include;hide:"contrib/tools/cython/generated_c_headers.h"} \
  273. ${output_include;hide:"omp.h"}
  274. # tag:cython-specific
  275. CYTHON_CPP_OUTPUT_INCLUDES=${output_include;hide:"contrib/tools/cython/generated_cpp_headers.h"}
  276. # tag:cython-specific
  277. CYTHON_PREDEFINED_INCLUDES=\
  278. ${input;hide:"contrib/tools/cython/Cython/Utility/Buffer.c"} \
  279. ${input;hide:"contrib/tools/cython/Cython/Utility/Builtins.c"} \
  280. ${input;hide:"contrib/tools/cython/Cython/Utility/CMath.c"} \
  281. ${input;hide:"contrib/tools/cython/Cython/Utility/Capsule.c"} \
  282. ${input;hide:"contrib/tools/cython/Cython/Utility/CommonTypes.c"} \
  283. ${input;hide:"contrib/tools/cython/Cython/Utility/Complex.c"} \
  284. ${input;hide:"contrib/tools/cython/Cython/Utility/Coroutine.c"} \
  285. ${input;hide:"contrib/tools/cython/Cython/Utility/CythonFunction.c"} \
  286. ${input;hide:"contrib/tools/cython/Cython/Utility/Embed.c"} \
  287. ${input;hide:"contrib/tools/cython/Cython/Utility/Exceptions.c"} \
  288. ${input;hide:"contrib/tools/cython/Cython/Utility/ExtensionTypes.c"} \
  289. ${input;hide:"contrib/tools/cython/Cython/Utility/FunctionArguments.c"} \
  290. ${input;hide:"contrib/tools/cython/Cython/Utility/ImportExport.c"} \
  291. ${input;hide:"contrib/tools/cython/Cython/Utility/MemoryView_C.c"} \
  292. ${input;hide:"contrib/tools/cython/Cython/Utility/ModuleSetupCode.c"} \
  293. ${input;hide:"contrib/tools/cython/Cython/Utility/ObjectHandling.c"} \
  294. ${input;hide:"contrib/tools/cython/Cython/Utility/Optimize.c"} \
  295. ${input;hide:"contrib/tools/cython/Cython/Utility/Overflow.c"} \
  296. ${input;hide:"contrib/tools/cython/Cython/Utility/Printing.c"} \
  297. ${input;hide:"contrib/tools/cython/Cython/Utility/Profile.c"} \
  298. ${input;hide:"contrib/tools/cython/Cython/Utility/StringTools.c"} \
  299. ${input;hide:"contrib/tools/cython/Cython/Utility/TestUtilityLoader.c"} \
  300. ${input;hide:"contrib/tools/cython/Cython/Utility/TypeConversion.c"}
  301. # tag:cython-specific
  302. CYTHON_PREDEFINED_INDUCED=\
  303. contrib/libs/python/Include/Python.h
  304. # tag:cython-specific
  305. CYTHON_OPTIONS=
  306. when ($OS_LINUX) {
  307. CYTHON_OPTIONS += -E UNAME_SYSNAME=Linux
  308. }
  309. elsewhen ($OS_DARWIN) {
  310. CYTHON_OPTIONS += -E UNAME_SYSNAME=Darwin
  311. }
  312. elsewhen ($OS_WINDOWS) {
  313. CYTHON_OPTIONS += -E UNAME_SYSNAME=Windows
  314. }
  315. when ($USE_LOCAL_SWIG != "yes") {
  316. _SWIG_TOOL=${tool:"contrib/tools/swig"}
  317. _SWIG_LIBRARY=contrib/tools/swig/Lib
  318. _SWIG_LIBRARY_ABS=$ARCADIA_ROOT/$_SWIG_LIBRARY
  319. }
  320. otherwise {
  321. _SWIG_TOOL=$SWIG_TOOL
  322. _SWIG_LIBRARY=$SWIG_LIBRARY
  323. _SWIG_LIBRARY_ABS=$SWIG_LIBRARY
  324. }
  325. SWIG_IMPLICIT_INCLUDES = swig.swg go.swg java.swg perl5.swg python.swg
  326. FATAL_ERROR_MODULE=no
  327. FATAL_ERROR_MESSAGE=
  328. # tag:python-specific
  329. # PYTHON_DISTR={ "default" | "macos-brew" } determine python system supply
  330. # see build/platform/python/ya.make
  331. PYTHON_DISTR="default"
  332. when ($USE_SYSTEM_PYTHON) {
  333. USE_ARCADIA_PYTHON=no
  334. select ($USE_SYSTEM_PYTHON) {
  335. "2.7" ? {
  336. _SYSTEM_PYTHON27=yes
  337. PY_VERSION=2.7
  338. PY_FRAMEWORK_VERSION=2.7
  339. }
  340. "3.4" ? {
  341. _SYSTEM_PYTHON34=yes
  342. PY_VERSION=3.4m
  343. PY_FRAMEWORK_VERSION=3.4
  344. }
  345. "3.5" ? {
  346. _SYSTEM_PYTHON35=yes
  347. PY_VERSION=3.5m
  348. PY_FRAMEWORK_VERSION=3.5
  349. }
  350. "3.6" ? {
  351. _SYSTEM_PYTHON36=yes
  352. PY_VERSION=3.6m
  353. PY_FRAMEWORK_VERSION=3.6
  354. }
  355. "3.7" ? {
  356. _SYSTEM_PYTHON37=yes
  357. PY_VERSION=3.7m
  358. PY_FRAMEWORK_VERSION=3.7
  359. }
  360. "3.8" ? {
  361. _SYSTEM_PYTHON38=yes
  362. PY_VERSION=3.8
  363. PY_FRAMEWORK_VERSION=3.8
  364. }
  365. "3.9" ? {
  366. _SYSTEM_PYTHON39=yes
  367. PY_VERSION=3.9
  368. PY_FRAMEWORK_VERSION=3.9
  369. }
  370. "3.10" ? {
  371. _SYSTEM_PYTHON310=yes
  372. PY_VERSION=3.10
  373. PY_FRAMEWORK_VERSION=3.10
  374. }
  375. default ? {
  376. FATAL_ERROR_MESSAGE+=invalid USE_SYSTEM_PYTHON value
  377. }
  378. }
  379. }
  380. ### @usage: NO_LTO()
  381. ###
  382. ### Disable any lto (link-time optimizations) for the module.
  383. ### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
  384. ### linking of entire program if global settings say so.
  385. macro NO_LTO() {
  386. DISABLE(USE_LTO)
  387. DISABLE(USE_THINLTO)
  388. }
  389. when ($USE_LTO == "yes" && $OS_LINUX != "yes" && $OS_ANDROID != "yes") {
  390. FATAL_ERROR_MESSAGE+=lto is only supported for linux
  391. }
  392. # tag:python-specific
  393. YMAKE_PYTHON3_PEER=build/platform/python/ymake_python3
  394. YMAKE_PYTHON3=$YMAKE_PYTHON3_RESOURCE_GLOBAL/python3
  395. when ($HOST_OS_WINDOWS == "yes") {
  396. YMAKE_PYTHON3=$YMAKE_PYTHON3_RESOURCE_GLOBAL/python3.exe
  397. }
  398. # tag:python-specific
  399. when ($USE_ARCADIA_PYTHON == "no") {
  400. SYSINCL+=build/sysincl/python.yml
  401. }
  402. # tag:allocator
  403. DEFAULT_ALLOCATOR=LF
  404. # tag:allocator
  405. when ($OS_ANDROID == "yes" || $MSVC == "yes") {
  406. DEFAULT_ALLOCATOR=J
  407. }
  408. # tag:allocator
  409. when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
  410. DEFAULT_ALLOCATOR=SYSTEM
  411. }
  412. # tag:allocator
  413. when ($OS_DARWIN == "yes") {
  414. DEFAULT_ALLOCATOR=SYSTEM
  415. }
  416. # tag:allocator
  417. when ($SANITIZER_TYPE) {
  418. when ($SANITIZER_TYPE != "no") {
  419. DEFAULT_ALLOCATOR=SYSTEM
  420. }
  421. }
  422. # tag:internal
  423. ### @usage: CHECK_CONFIG_H(<conf_header>) # internal
  424. ###
  425. ### This internal macro adds checking code for configuration header in external (contrib) library.
  426. ### The check is needed to avoid conflicts on certain types and functions available in arcadia.
  427. ###
  428. ### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
  429. macro CHECK_CONFIG_H(Conf) {
  430. .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"}
  431. OUTPUT_INCLUDES=$Conf
  432. }
  433. REQUIRED_TRANSITIVE_PEERS=
  434. ### @usage REQUIRES(dirs...)
  435. ###
  436. ### Specify list of dirs which this module must depend on indirectly.
  437. ###
  438. ### This macro can be used if module depends on the directories specified but they can't be listed
  439. ### as direct PEERDIR dependencies (due to public include order or link order issues).
  440. macro REQUIRES(DIRS[]) {
  441. SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
  442. }
  443. CHECK_DEPENDENT_DIRS_TYPES=
  444. CHECK_DEPENDENT_DIRS_RESTRICTIONS=
  445. ### @usage CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
  446. ###
  447. ### Specify project transitive dependencies constraints.
  448. ###
  449. ### @params:
  450. ### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
  451. ### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
  452. ### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
  453. ### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
  454. ### 5. GLOB: next directory constraint is an ANT glob pattern.
  455. ### 6. EXCEPT: next constraint is an exception for the rest of other rules.
  456. ###
  457. ### Directory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
  458. ###
  459. ### Note: Can be used multiple times on the same module all specified constraints will be checked.
  460. ### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
  461. macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
  462. SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
  463. SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
  464. }
  465. # tag:proto
  466. PY_PROTOS_FOR=no
  467. BUILD_PROTO_AS_EVLOG=no
  468. # tag:proto
  469. PROTO_NAMESPACE=
  470. # tag:proto tag:python-specific
  471. GEN_PY_PROTOS=$YMAKE_PYTHON ${input:"build/scripts/gen_py_protos.py"}
  472. # tag:proto tag:cpp-specific
  473. PROTO_HEADER_EXTS=.pb.h
  474. CPP_PROTO_CMDLINE=
  475. CPP_PROTO_OPTS=
  476. CPP_PROTO_OUTS=
  477. CPP_PROTO_OUTS_SEM=
  478. CPP_PROTO_SUFFIXES=.pb.h .pb.cc
  479. CPP_PROTO_PLUGINS=
  480. # tag:proto tag:cpp-specific
  481. CPP_EV_OPTS=--plugin=protoc-gen-event2cpp=${tool:"tools/event2cpp"} --event2cpp_out=$ARCADIA_BUILD_ROOT -I=$ARCADIA_ROOT/library/cpp/eventlog
  482. CPP_EV_OUTS=
  483. # tag:proto tag:python-specific
  484. PY_PROTO_OPTS=
  485. PY_PROTO_OUTS=
  486. PY_PROTO_OUTS_INTERNAL=
  487. PY_PROTO_DEPS=
  488. PY_PROTO_SUFFIXES=_pb2.py
  489. PY_EVLOG_SUFFIXES=_ev_pb2.py
  490. # tag:proto tag:java-specific
  491. JAVA_PROTO_ARGS=
  492. # tag:proto tag:python-specific
  493. OPTIMIZE_PY_PROTOS_FLAG=no
  494. macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
  495. SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
  496. .SEM=resources ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${tool;hide:"tools/rescompiler/bin"}
  497. }
  498. # tag:built-in
  499. ### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # built-in
  500. ### Add data (resources, random files, strings) to the program)
  501. ### 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.
  502. ### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
  503. ###
  504. ### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
  505. ### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
  506. ###
  507. ### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
  508. ###
  509. ### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
  510. ###
  511. ### @example:
  512. ###
  513. ### LIBRARY()
  514. ### OWNER(user1)
  515. ###
  516. ### RESOURCE(
  517. ### path/to/file1 /key/in/program/1
  518. ### path/to/file2 /key2
  519. ### )
  520. ### END()
  521. ###
  522. macro RESOURCE(Args...) {
  523. PEERDIR(library/cpp/resource)
  524. }
  525. # tag:internal
  526. ### @usage: _ORDER_ADDINCL([BUILD ...] [SOURCE ...] Args...) # internal
  527. ###
  528. ### Order and filter ADDINCLs (Args - is intentionally omitted in ADDINCL macro)
  529. macro _ORDER_ADDINCL(BUILD[], SOURCE[], ARGS...) {
  530. ADDINCL($BUILD $SOURCE)
  531. }
  532. # tag:proto
  533. ### @usage: PROTO_ADDINCL([GLOBAL] [WITH_GEN] Path)
  534. ###
  535. ### This macro introduces proper ADDINCLs for .proto-files found in sources and
  536. ### .cpp/.h generated files, supplying them to appropriate commands and allowing
  537. ### proper dependency resolution at configure-time.
  538. ###
  539. ### Note: you normally shouldn't use this macro. ADDINCLs should be sent to user
  540. ### from dependency via PROTO_NAMESPACE macro
  541. macro PROTO_ADDINCL(GLOBAL?"GLOBAL":"", Path, WITH_GEN?"BUILD":"") {
  542. _ORDER_ADDINCL($WITH_GEN $GLOBAL FOR proto ${ARCADIA_BUILD_ROOT}/$Path SOURCE $GLOBAL FOR proto ${ARCADIA_ROOT}/$Path)
  543. ADDINCL($GLOBAL ${ARCADIA_BUILD_ROOT}/$Path)
  544. }
  545. # tag:proto
  546. ### @usage: PROTO_NAMESPACE([GLOBAL] [WITH_GEN] Namespace)
  547. ###
  548. ### Defines protobuf namespace (import/export path prefix) which should be used for imports and
  549. ### which defines output path for .proto generation.
  550. ###
  551. ### For proper importing and configure-time dependency management it sets ADDINCLs
  552. ### for both .cpp headers includes and .proto imports. If .proto expected to be used outside of the
  553. ### processing module use GLOBAL to send proper ADDINCLs to all (transitive) users. PEERDIR to
  554. ### PROTO_LIBRARY with PROTO_NAMESPACE(GLOBAL ) is enough at user side to correctly use the library.
  555. ### If generated .proto files are going to be used for building a module than use of WITH_GEN
  556. ### parameter will add appropriate dir from the build root for .proto files search.
  557. macro PROTO_NAMESPACE(GLOBAL?"GLOBAL":"", WITH_GEN?"WITH_GEN":"", Namespace) {
  558. SET(PROTO_NAMESPACE $Namespace)
  559. PROTO_ADDINCL($GLOBAL $WITH_GEN $Namespace)
  560. }
  561. # tag:proto tag:internal tag:python-specific
  562. ### @usage: OPTIMIZE_PY_PROTOS() # internal
  563. ###
  564. ### Enable Python proto optimization by embedding corresponding C++ code into binary.
  565. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  566. ### This is default mode for most PROTO_LIBRARY's and PY2_LIBRARY's, some system ones being exceptions.
  567. macro OPTIMIZE_PY_PROTOS() {
  568. SET(OPTIMIZE_PY_PROTOS_FLAG yes)
  569. }
  570. # tag:proto tag:python-specific
  571. ### @usage: NO_OPTIMIZE_PY_PROTOS()
  572. ###
  573. ### Disable Python proto optimization using embedding corresponding C++ code into binary.
  574. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  575. ### This is default mode only for some system libraries.
  576. macro NO_OPTIMIZE_PY_PROTOS() {
  577. SET(OPTIMIZE_PY_PROTOS_FLAG no)
  578. }
  579. # tag:proto tag:python-specific
  580. macro _PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  581. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$OutParm$ARCADIA_BUILD_ROOT/\$PROTO_NAMESPACE
  582. .SEM=ignored
  583. }
  584. # tag:proto tag:python-specific
  585. macro _ADD_PY_PROTO_OUT(Suf) {
  586. SET_APPEND(PY_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$Suf:File})
  587. 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}"})
  588. # XXX fix variable expansion in plugins
  589. SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
  590. }
  591. # tag:proto tag:python-specific
  592. ### @usage: PY_PROTO_PLUGIN(Name Ext Tool DEPS <Dependencies>)
  593. ###
  594. ### Define protoc plugin for python with given Name that emits extra output with provided Extension
  595. ### using Tool. Extra dependencies are passed via DEPS
  596. macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  597. SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  598. _ADD_PY_PROTO_OUT($EXT)
  599. # XXX fix variable expansion in plugins
  600. SET(PY_PROTO_DEPS $PY_PROTO_DEPS $DEPS)
  601. }
  602. # tag:proto tag:python-specific
  603. ### @usage: PY_PROTO_PLUGIN2(Name Ext1 Ext2 Tool DEPS <Dependencies>)
  604. ###
  605. ### Define protoc plugin for python with given Name that emits 2 extra outputs with provided Extensions
  606. ### using Tool. Extra dependencies are passed via DEPS
  607. macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
  608. PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
  609. _ADD_PY_PROTO_OUT($EXT2)
  610. }
  611. # tag:proto tag:java-specific
  612. macro _JAVA_PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  613. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/java_out
  614. }
  615. # tag:proto tag:java-specific
  616. ### @usage: JAVA_PROTO_PLUGIN(Name Tool DEPS <Dependencies>)
  617. ###
  618. ### Define protoc plugin for Java with given Name that emits extra outputs
  619. ### using Tool. Extra dependencies are passed via DEPS
  620. macro JAVA_PROTO_PLUGIN(NAME, TOOL, DEPS[]) {
  621. SET_APPEND(JAVA_PROTO_ARGS $_JAVA_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  622. # XXX fix variable expansion in plugins
  623. SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS $DEPS)
  624. }
  625. # tag:proto tag:cpp-specific
  626. macro _ADD_CPP_PROTO_OUT(Suf) {
  627. .SEM=append_target_property PROTOC_EXTRA_OUTS $Suf ${output;hide;suf=.o:Suf} && set_target_property PROTO_NAMESPACE $PROTO_NAMESPACE
  628. SET_APPEND(CPP_PROTO_OUTS \${output;hide;norel;nopath;noext;suf=$Suf:File})
  629. # XXX fix variable expansion in plugins
  630. SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES $Suf)
  631. }
  632. # tag:proto tag:cpp-specific
  633. HAS_CPP_PROTOBUF_PEERS=no
  634. CPP_PROTOBUF_PEERS=
  635. # tag:proto tag:cpp-specific
  636. ### @usage: CPP_PROTO_PLUGIN0(Name Tool DEPS <Dependencies>)
  637. ###
  638. ### Define protoc plugin for C++ with given Name that emits code into regular outputs
  639. ### using Tool. Extra dependencies are passed via DEPS.
  640. macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) {
  641. .SEM=target_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME}
  642. SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  643. # XXX fix variable expansion in plugins
  644. ENABLE(HAS_CPP_PROTOBUF_PEERS)
  645. SET(CPP_PROTOBUF_PEERS $CPP_PROTOBUF_PEERS $DEPS)
  646. }
  647. # tag:proto tag:cpp-specific
  648. ### @usage: CPP_PROTO_PLUGIN(Name Tool Suf DEPS <Dependencies>)
  649. ###
  650. ### Define protoc plugin for C++ with given Name that emits code into 1 extra output
  651. ### using Tool. Extra dependencies are passed via DEPS.
  652. macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[]) {
  653. CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS)
  654. _ADD_CPP_PROTO_OUT($SUF)
  655. }
  656. # tag:proto tag:cpp-specific
  657. ### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 DEPS <Dependencies>)
  658. ###
  659. ### Define protoc plugin for C++ with given Name that emits code into 2 extra outputs
  660. ### using Tool. Extra dependencies are passed via DEPS.
  661. macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[]) {
  662. CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS)
  663. _ADD_CPP_PROTO_OUT($SUF2)
  664. SET_APPEND(CPP_PROTO_OUTS_SEM \${output;hide;norel;nopath;noext;suf=$SUF2:File})
  665. }
  666. # tag:proto
  667. ### @usage: USE_SKIFF() #wip, do not use
  668. ###
  669. ### Use mapreduce/yt/skiff_proto/plugin for C++
  670. macro USE_SKIFF() {
  671. # Move extra includes to INDUCED_DEPS macro in mapreduce/yt/skiff_proto/plugin/ya.make
  672. CPP_PROTO_PLUGIN0(skiff mapreduce/yt/skiff_proto/plugin DEPS mapreduce/yt/skiff_proto/lib)
  673. }
  674. # tag:go-specific
  675. _GO_COMMON_GOOGLE_APIS = \
  676. vendor/google.golang.org/genproto/googleapis/api/annotations \
  677. vendor/google.golang.org/genproto/googleapis/api/configchange \
  678. vendor/google.golang.org/genproto/googleapis/api/distribution \
  679. vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1 \
  680. vendor/google.golang.org/genproto/googleapis/api/expr/v1beta1 \
  681. vendor/google.golang.org/genproto/googleapis/api/httpbody \
  682. vendor/google.golang.org/genproto/googleapis/api/label \
  683. vendor/google.golang.org/genproto/googleapis/api/metric \
  684. vendor/google.golang.org/genproto/googleapis/api/monitoredres \
  685. vendor/google.golang.org/genproto/googleapis/api/serviceconfig \
  686. vendor/google.golang.org/genproto/googleapis/api/servicecontrol/v1 \
  687. vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1 \
  688. vendor/google.golang.org/genproto/googleapis/iam/admin/v1 \
  689. vendor/google.golang.org/genproto/googleapis/iam/credentials/v1 \
  690. vendor/google.golang.org/genproto/googleapis/iam/v1 \
  691. vendor/google.golang.org/genproto/googleapis/iam/v1/logging \
  692. vendor/google.golang.org/genproto/googleapis/logging/type \
  693. vendor/google.golang.org/genproto/googleapis/logging/v2 \
  694. vendor/google.golang.org/genproto/googleapis/rpc/code \
  695. vendor/google.golang.org/genproto/googleapis/rpc/errdetails \
  696. vendor/google.golang.org/genproto/googleapis/rpc/status \
  697. vendor/google.golang.org/genproto/googleapis/type/calendarperiod \
  698. vendor/google.golang.org/genproto/googleapis/type/color \
  699. vendor/google.golang.org/genproto/googleapis/type/date \
  700. vendor/google.golang.org/genproto/googleapis/type/dayofweek \
  701. vendor/google.golang.org/genproto/googleapis/type/expr \
  702. vendor/google.golang.org/genproto/googleapis/type/fraction \
  703. vendor/google.golang.org/genproto/googleapis/type/latlng \
  704. vendor/google.golang.org/genproto/googleapis/type/money \
  705. vendor/google.golang.org/genproto/googleapis/type/postaladdress \
  706. vendor/google.golang.org/genproto/googleapis/type/quaternion \
  707. vendor/google.golang.org/genproto/googleapis/type/timeofday
  708. # tag:go-specific
  709. _COMMON_GOOGLE_APIS=None
  710. # tag:go-specific
  711. ### @usage: USE_COMMON_GOOGLE_APIS([apis...])
  712. ###
  713. ### Use common-google-apis library set. Pass optional apis list to be used or use them all.
  714. ### This macro is properly handled for all languages including Go, where apis come in
  715. ## pregenerated form. In other languages apis are generated from sources in Arcadia.
  716. macro USE_COMMON_GOOGLE_APIS(APIS...) {
  717. SET(_COMMON_GOOGLE_APIS ${pre=vendor/google.golang.org/genproto/googleapis/:APIS})
  718. }
  719. # tag:go-specific tag:proto
  720. GO_PROTO_GEN_TOOL=$_TOOL_PROTOC_GEN_GO
  721. GO_PROTO_GEN_PLUGINS=
  722. GO_PROTO_PACKAGE_MAP=
  723. GO_PROTO_OPTS=$_GO_PROTOC_PLUGIN_ARGS_BASE(go $GO_PROTO_GEN_TOOL MAP $GO_PROTO_PACKAGE_MAP PLUGINS $GO_PROTO_GEN_PLUGINS)
  724. GO_PROTO_OUTS=
  725. # tag:go-specific tag:proto
  726. GO_PROTOBUF_IMPORTS=\
  727. ${GOSTD}/sync \
  728. ${GOSTD}/reflect \
  729. ${GOSTD}/fmt \
  730. ${GOSTD}/math \
  731. vendor/github.com/golang/protobuf/proto \
  732. vendor/google.golang.org/protobuf/types/descriptorpb \
  733. vendor/google.golang.org/protobuf/runtime/protoimpl \
  734. vendor/google.golang.org/protobuf/runtime/protoiface \
  735. vendor/google.golang.org/protobuf/reflect/protoreflect
  736. # tag:go-specific tag:proto
  737. GO_PROTOBUF_WELLKNOWN_TYPES=\
  738. vendor/google.golang.org/protobuf/types/known/anypb \
  739. vendor/google.golang.org/protobuf/types/known/apipb \
  740. vendor/google.golang.org/protobuf/types/known/durationpb \
  741. vendor/google.golang.org/protobuf/types/known/emptypb \
  742. vendor/google.golang.org/protobuf/types/known/fieldmaskpb \
  743. vendor/google.golang.org/protobuf/types/known/sourcecontextpb \
  744. vendor/google.golang.org/protobuf/types/known/structpb \
  745. vendor/google.golang.org/protobuf/types/known/timestamppb \
  746. vendor/google.golang.org/protobuf/types/known/typepb \
  747. vendor/google.golang.org/protobuf/types/known/wrapperspb
  748. # tag:go-specific tag:proto
  749. ### @usage: GO_PROTO_PLUGIN(Name Ext Tool [DEPS dependencies...])
  750. ###
  751. ### Define protoc plugin for GO with given Name that emits extra output with provided extension
  752. ### Ext using Tool. Extra dependencies are passed via DEPS.
  753. macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  754. SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  755. SET_APPEND(GO_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$EXT:File})
  756. PEERDIR(${DEPS})
  757. }
  758. # tag:go-specific tag:proto
  759. macro _GO_PROTOC_PLUGIN_ARGS_BASE_IMPL(Name, Tool, PLUGINS...) {
  760. .CMD=--plugin=protoc-gen-${Name}=${tool:Tool} --${Name}_out=${join=|:PLUGINS}:${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
  761. }
  762. # tag:go-specific tag:proto
  763. macro _GO_PROTOC_PLUGIN_ARGS_BASE_PROXY(Name, Tool, MAP[], PLUGINS[]) {
  764. .CMD=$_GO_PROTOC_PLUGIN_ARGS_BASE_IMPL($Name $Tool $MAP ${pre=plugins=:PLUGINS})
  765. }
  766. # tag:go-specific tag:proto
  767. macro _GO_PROTOC_PLUGIN_ARGS_BASE(Name, Tool, MAP[], PLUGINS[]) {
  768. .CMD=$_GO_PROTOC_PLUGIN_ARGS_BASE_PROXY($Name $Tool MAP ${pre=M:MAP} PLUGINS ${join=|:PLUGINS})
  769. }
  770. # tag:go-specific tag:proto
  771. 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}
  772. # tag:go-specific tag:proto
  773. macro _GO_PROTO_CMD_IMPL(File, OPTS[], OUTS[]) {
  774. .CMD=$GO_PROTO_CMDLINE $OPTS $OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  775. .PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES}
  776. .ADDINCL=FOR proto contrib/libs/protobuf/src
  777. }
  778. # tag:go-specific tag:proto
  779. macro _GO_PROTO_CMD(File) {
  780. .CMD=$_GO_PROTO_CMD_IMPL($File OPTS $GO_PROTO_OPTS OUTS $GO_PROTO_OUTS)
  781. }
  782. # tag:proto
  783. ### @usage: YP_PROTO_YSON(Files... OUT_OPTS Opts...)
  784. ###
  785. ### Generate .yson.go from .proto using yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen
  786. macro YP_PROTO_YSON(OUT_OPTS[], Files...) {
  787. .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}
  788. .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
  789. .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
  790. }
  791. _SEM_CPP_PROTO_CMD=target_proto_messages PRIVATE ${input:File} $CPP_PROTO_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
  792. && set_global_flags COMMON_PROTOC_FLAGS \
  793. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
  794. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH
  795. # tag:proto
  796. macro _CPP_PROTO_CMD(File) {
  797. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  798. .SEM=$_SEM_CPP_PROTO_CMD
  799. .PEERDIR=contrib/libs/protobuf
  800. }
  801. # tag:proto
  802. macro _CPP_VANILLA_PROTO_CMD(File) {
  803. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  804. .PEERDIR=contrib/libs/protobuf_std
  805. }
  806. # tag:proto
  807. macro _CPP_EVLOG_CMD(File) {
  808. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_EV_OUTS ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  809. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  810. }
  811. # tag:proto
  812. macro _CPP_PROTO_EVLOG_CMD(File) {
  813. # process .proto as .ev
  814. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  815. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  816. }
  817. # tag:proto
  818. macro _CPP_CFGPROTO_CMD(File) {
  819. # keep extension in output just as in EV: this is hard-coded behaviour of protoc for non-.proto extensions
  820. .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"}
  821. .PEERDIR=library/cpp/proto_config/codegen library/cpp/proto_config/protos contrib/libs/protobuf
  822. }
  823. # tag:proto
  824. PY_PROTO_MYPY_ENABLED=yes
  825. 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
  826. # tag:proto tag:python-specific
  827. PY_PROTO_MYPY_SUFFIX=
  828. PY_PROTO_MYPY_PLUGIN=
  829. PY_PROTO_MYPY_PLUGIN_INTERNAL=
  830. # tag:proto tag:python-specific
  831. macro NO_MYPY() {
  832. DISABLE(PY_PROTO_MYPY_ENABLED)
  833. }
  834. # tag:proto tag:python-specific
  835. macro _PY_PROTO_CMD_BASE(File, Suf, Args...) {
  836. .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
  837. }
  838. # tag:proto tag:python-specific
  839. macro _PY_PROTO_CMD(File) {
  840. .CMD=${cwd;rootdir;input:File} $_PY_PROTO_CMD_BASE($File _pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS $PY_PROTO_MYPY_PLUGIN)
  841. }
  842. # tag:proto tag:python-specific
  843. macro _PY_PROTO_CMD_INTERNAL(File) {
  844. .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)
  845. }
  846. # tag:proto tag:java-specific
  847. JAVA_PROTO_RUNTIME=
  848. # tag:proto tag:java-specific
  849. ### @usage: USE_JAVALITE()
  850. ### Use protobuf-javalite for Java
  851. macro USE_JAVALITE() {
  852. SET(JAVA_PROTO_RUNTIME javalite)
  853. }
  854. # tag:proto tag:java-specific
  855. JAVA_PROTO_RUNTIME_VERSION = 3.19.2
  856. JAVA_PROTO_COMMON_VERSION = 1.12.0
  857. when ($JAVA_PROTO_RUNTIME == "javalite") {
  858. _JAVA_PROTO_OUT_ARG=--java_out=lite:
  859. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION}
  860. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.19.0
  861. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.19.0
  862. }
  863. otherwise {
  864. _JAVA_PROTO_OUT_ARG=--java_out=
  865. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION}
  866. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.43.2
  867. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.43.2
  868. }
  869. # tag:proto tag:java-specific
  870. macro _JAVA_PROTO_CMD(File) {
  871. .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
  872. }
  873. # tag:proto tag:perl-specific tag:deprecated
  874. ### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
  875. ###
  876. ### Generate Perl code from protobuf.
  877. ### In order to use this macro one should predict all outputs protoc will emit from input_proto file and enlist those as outputs.
  878. macro XS_PROTO(File, Dir, Outputs...) {
  879. .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}
  880. PEERDIR(${Dir})
  881. ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir})
  882. }
  883. # tag:proto tag:fbs
  884. ### @usage: PROTO2FBS(InputProto)
  885. ###
  886. ### Produce flatbuf schema out of protobuf description.
  887. macro PROTO2FBS(File) {
  888. .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"}
  889. }
  890. # tag:proto tag:python-specific
  891. when ($PY_PROTOS_FOR == "yes") {
  892. PEERDIR+=contrib/libs/protobuf/python
  893. }
  894. # tag:python-specific
  895. macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
  896. .CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
  897. .PEERDIR=library/cpp/eventlog/proto
  898. }
  899. # tag:python-specific tag:proto
  900. macro _PY_EVLOG_CMD(File) {
  901. .CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
  902. }
  903. # tag:python-specific tag:proto
  904. macro _PY_EVLOG_CMD_INTERNAL(File) {
  905. .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}"})
  906. }
  907. # tag:java-specific tag:proto
  908. macro _JAVA_EVLOG_CMD(File) {
  909. .CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  910. .PEERDIR=library/cpp/eventlog/proto
  911. }
  912. # tag:sanitize
  913. RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
  914. # tag:sanitize
  915. when ($IS_CROSS_SANITIZE) {
  916. RUN_NO_SANITIZE=
  917. }
  918. YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
  919. XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
  920. WRITER_PY=$YMAKE_PYTHON ${input:"build/scripts/writer.py"} ${input;hide:"build/scripts/process_command_files.py"}
  921. FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} ${input;hide:"build/scripts/process_command_files.py"}
  922. FIX_MSVC_OUTPUT=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ${input;hide:"build/scripts/process_command_files.py"}
  923. COPY_CMD=$FS_TOOLS copy
  924. LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
  925. REMOVE_FILE=$FS_TOOLS remove
  926. MOVE_FILE=$FS_TOOLS rename
  927. # tag:allocator tag:windows-specific
  928. MSVC_DYNAMICBASE=/DYNAMICBASE
  929. when ($ALLOCATOR == "LF") {
  930. MSVC_DYNAMICBASE=/DYNAMICBASE:NO
  931. }
  932. # tag:sanitize
  933. SANITIZER_CFLAGS=
  934. # tag:proto tag:grpc
  935. ### @usage: GRPC()
  936. ###
  937. ### Emit GRPC code for all .proto files in a PROTO_LIBRARY.
  938. ### This works for all available PROTO_LIBRARY versions (C++, Python 2.x, Pyton 3.x, Java and Go).
  939. macro GRPC() {
  940. # C++
  941. CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp .grpc.pb.cc .grpc.pb.h DEPS contrib/libs/grpc)
  942. # Python
  943. PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/libs/grpc/python contrib/libs/grpc)
  944. # Java
  945. JAVA_PROTO_PLUGIN(grpc_java contrib/tools/protoc/plugins/grpc_java DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  946. }
  947. # tag:fbs
  948. FLATC_FLAGS_VALUE=
  949. ### @usage: FLATC_FLAGS(flags...)
  950. ###
  951. ### Add flags to flatc command line
  952. macro FLATC_FLAGS(FLAGS...) {
  953. SET_APPEND(FLATC_FLAGS_VALUE $FLAGS)
  954. }
  955. # tag:fbs
  956. _PY_FBS_DEPS=contrib/python/flatbuffers
  957. # tag:fbs tag:internal
  958. ### @usage: FBS_TO_PYSRC(output_base_name fbs_files...) # internal
  959. ###
  960. ### Create a tar archive of .py files generated by flatc for Python. Output tar
  961. ### archive will have .fbs.pysrc extension. This .fbs.pysrc extension is specially
  962. ### processed when --add-flatbuf-result flag is specified on the command line
  963. ### for 'ya make ...' (tar archive is extracted to output directory).
  964. macro FBS_TO_PYSRC(OUT_NAME, IN_FBS_FILES...) {
  965. .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"}
  966. }
  967. # tag:fbs tag:go-specific
  968. # Implicit dependencies of generated code for Go
  969. _GO_FLATC_IMPORTS=\
  970. ${GOSTD}/strconv \
  971. vendor/github.com/google/flatbuffers/go
  972. # tag:fbs tag:cpp-specific
  973. macro _CPP_FLATC_CMD(SRC, SRCFLAGS...) {
  974. .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"}
  975. .SEM=target_fbs_source PRIVATE ${input:SRC} ${pre=-I :_FLATC__INCLUDE} ${output;hide;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${output;hide;noext;norel:SRC.iter.fbs.h} ${output;noauto;hide;noext;norel:SRC.bfbs} ${hide;tool:"contrib/tools/flatc/bin"} && set_global_flags FBS_CPP_FLAGS --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --yandex-maps-iter --gen-object-api --filename-suffix .fbs ${FLATC_FLAGS_VALUE}
  976. .PEERDIR=contrib/libs/flatbuffers
  977. }
  978. # tag:fbs tag:cpp-specific
  979. macro _CPP_FLATC64_CMD(SRC, SRCFLAGS...) {
  980. .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"}
  981. .PEERDIR=contrib/libs/flatbuffers64
  982. }
  983. # tag:fbs tag:go-specific tag:internal
  984. ### @usage: _GO_FLATC_CMD(fbs_file flags...) # internal
  985. ###
  986. ### Create a tar archive of .go files generated by flatc for Go. Output tar archive
  987. ### will have .fbs.gosrc extension. This .fbs.gosrc is specially processed when
  988. ### --add-protobuf-result flag is specified on the command line for 'ya make ...'
  989. ### (tar archive is extracted to output directory).
  990. macro _GO_FLATC_CMD(SRC, PACKAGE_NAME) {
  991. .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"}
  992. .PEERDIR=${_GO_FLATC_IMPORTS}
  993. }
  994. # tag:fbs tag:java-specific tag:internal
  995. ### @usage: _JAVA_FLATC_CMD(fbs_file) # internal
  996. ###
  997. ### Create a tar archive of .java files generated by flatc for Java. Output tar
  998. ### acrchive will have .fbs.jsrc extension. Files with .fbs.jsrc extension will
  999. ### be added to results when --add-flatbuf-result flag is specified on the command
  1000. ### line for 'ya make ...'
  1001. macro _JAVA_FLATC_CMD(SRC) {
  1002. .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"}
  1003. .PEERDIR=contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION}
  1004. }
  1005. # variables must be defined for all module types to make generate_mf.py work
  1006. MODULE_PREFIX=
  1007. MODULE_SUFFIX=
  1008. NEED_PLATFORM_PEERDIRS=yes
  1009. PEERDIR_TEST_TOOL=yes
  1010. # tag:python-specific
  1011. PYTHON2=no
  1012. PYTHON3=no
  1013. # tag:python-specific
  1014. when (!$ARCADIA_PYTHON_UNICODE_SIZE) {
  1015. when ($OS_WINDOWS) {
  1016. ARCADIA_PYTHON_UNICODE_SIZE=2
  1017. }
  1018. otherwise {
  1019. ARCADIA_PYTHON_UNICODE_SIZE=4
  1020. }
  1021. }
  1022. ### @usage: _BARE_UNIT # internal
  1023. ###
  1024. ### The base of all modules describing default bare minimum for all modules.
  1025. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1026. module _BARE_UNIT {
  1027. .EXTS=.*
  1028. .CMD=TOUCH_UNIT
  1029. .IGNORED=GO_PROTO_PLUGIN
  1030. .NODE_TYPE=Bundle
  1031. .PEERDIR_POLICY=as_include
  1032. .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
  1033. .FINAL_TARGET=no
  1034. PEERDIR_TAGS=__EMPTY__
  1035. when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
  1036. PEERDIR+=build/conf_fatal_error
  1037. }
  1038. DEFAULT(MODULE_VERSION)
  1039. DEFAULT(MODULE_PREFIX)
  1040. DEFAULT(MODULE_SUFFIX)
  1041. }
  1042. ### @usage: _BASE_UNIT # internal
  1043. ###
  1044. ### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
  1045. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1046. module _BASE_UNIT: _BARE_UNIT {
  1047. .GLOBAL=_FBS_NAMESPACE_MAP
  1048. PEERDIR_TAGS=CPP_PROTO CPP_FBS CPP_SSQLS CPP_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB
  1049. 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}
  1050. CPP_PROTO_OUTS+=${output;hide;norel;nopath;noext:File.pb.cc} ${output;main;hide;norel;nopath;noext:File.pb.h}
  1051. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
  1052. CPP_EV_OUTS+=${output;hide;norel:File.pb.cc} ${output;hide;norel:File.pb.h}
  1053. when ($SWIG_LANG == "perl") {
  1054. _SWIG_CMD=$_SWIG_PERL_CMD
  1055. _SWIG_ADDINCLS=$_SWIG_PERL_ADDINCLS
  1056. _SWIG_PEERDIR=$_SWIG_PERL_PEERDIR
  1057. }
  1058. elsewhen ($SWIG_LANG == "python") {
  1059. _SWIG_CMD=$_SWIG_PYTHON_CMD
  1060. _SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
  1061. _SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
  1062. }
  1063. elsewhen ($SWIG_LANG == "jni_cpp") {
  1064. _SWIG_CMD=$_SWIG_JNI_CPP_CMD
  1065. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1066. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1067. }
  1068. elsewhen ($SWIG_LANG == "java") {
  1069. _SWIG_CMD=$_SWIG_JNI_CMD
  1070. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1071. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1072. }
  1073. when ($PY_PROTOS_FOR == "yes") {
  1074. MACRO_ALIAS(EVLOG_CMD _PY_EVLOG_CMD)
  1075. MACRO_ALIAS(PROTO_CMD _PY_PROTO_CMD)
  1076. }
  1077. otherwise {
  1078. MACRO_ALIAS(EVLOG_CMD _CPP_EVLOG_CMD)
  1079. MACRO_ALIAS(FBS_CMD _CPP_FLATC_CMD)
  1080. when ($BUILD_PROTO_AS_EVLOG == "yes") {
  1081. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_EVLOG_CMD)
  1082. }
  1083. otherwise {
  1084. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_CMD)
  1085. }
  1086. when ($USE_VANILLA_PROTOC == "yes") {
  1087. PROTOC=${tool:"contrib/tools/protoc_std"}
  1088. PROTOC_STYLEGUIDE_OUT=
  1089. PROTOC_PLUGIN_STYLEGUIDE=
  1090. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std
  1091. MACRO_ALIAS(PROTO_CMD _CPP_VANILLA_PROTO_CMD)
  1092. }
  1093. when ($PROTOC_TRANSITIVE_HEADERS == "no") {
  1094. CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
  1095. }
  1096. }
  1097. SANITIZER_DEFINED=no
  1098. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1099. CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
  1100. LDFLAGS+=-fsanitize=$SANITIZER_TYPE
  1101. SANITIZER_DEFINED=yes
  1102. when ($CLANG) {
  1103. CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"}
  1104. LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"}
  1105. }
  1106. }
  1107. when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
  1108. CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1109. LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1110. }
  1111. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1112. CFLAGS+=-fprofile-instr-generate -fcoverage-mapping -DCLANG_COVERAGE
  1113. LDFLAGS+=-fprofile-instr-generate -fcoverage-mapping
  1114. }
  1115. when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
  1116. CFLAGS+=-DNLG_COVERAGE
  1117. }
  1118. when ($GCC) {
  1119. select ($SANITIZER_TYPE) {
  1120. "address" ? {
  1121. LDFLAGS+=-static-libasan
  1122. }
  1123. "undefined" ? {
  1124. LDFLAGS+=-static-libubsan
  1125. }
  1126. "thread" ? {
  1127. PIE=yes
  1128. LDFLAGS+=-static-libtsan
  1129. }
  1130. }
  1131. }
  1132. when ($HARDENING == "yes") {
  1133. when ($CLANG) {
  1134. CFLAGS+=-fstack-protector-all -D_hardening_enabled_
  1135. LDFLAGS+=-z relro -z now -z noexecstack
  1136. PIE=yes
  1137. }
  1138. }
  1139. when ($USE_LTO == "yes") {
  1140. when ($GCC) {
  1141. CFLAGS+=-flto -fno-fat-lto-objects
  1142. LDFLAGS+=-flto
  1143. NO_LTO_CFLAGS=-fno-lto
  1144. }
  1145. when ($CLANG) {
  1146. CFLAGS+=-flto
  1147. LDFLAGS+=-flto
  1148. NO_LTO_CFLAGS=-fno-lto
  1149. }
  1150. }
  1151. when ($USE_THINLTO == "yes") {
  1152. when ($GCC) {
  1153. CFLAGS+=-flto=thin
  1154. LDFLAGS+=-flto=thin
  1155. NO_LTO_CFLAGS=-fno-lto
  1156. }
  1157. when ($CLANG) {
  1158. CFLAGS+=-flto=thin
  1159. LDFLAGS+=-flto=thin
  1160. NO_LTO_CFLAGS=-fno-lto
  1161. }
  1162. }
  1163. when ($CLANG) {
  1164. when ($PGO_ADD == "yes") {
  1165. CFLAGS+=-fprofile-instr-generate
  1166. LDFLAGS+=-fprofile-instr-generate
  1167. }
  1168. when ($PGO_PATH) {
  1169. CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
  1170. LDFLAGS+=-fprofile-instr-use=$PGO_PATH
  1171. }
  1172. }
  1173. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  1174. PEERDIR+=$COMPILER_PLATFORM
  1175. }
  1176. when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
  1177. PEERDIR+=contrib/libs/linux-headers
  1178. }
  1179. # Adding PEERDIR from trigger doesn't always work. In this case it
  1180. # cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl
  1181. # Workaround this issue by setting variable with PEERDIR in trigger
  1182. # and then adding PEERDIR to it's value unconditionally.
  1183. when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1184. _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14
  1185. }
  1186. otherwise {
  1187. _UBUNTU_COMPAT_PEERDIR=
  1188. }
  1189. PEERDIR+=$_UBUNTU_COMPAT_PEERDIR
  1190. when ($NORUNTIME != "yes") {
  1191. PEERDIR+=contrib/libs/cxxsupp
  1192. when ($MAPSMOBI_BUILD_TARGET == "yes") {
  1193. PEERDIR+=build/platform/mapkit
  1194. }
  1195. }
  1196. when ($NOUTIL != "yes") {
  1197. PEERDIR+=util
  1198. }
  1199. when ($MUSL == "yes") {
  1200. CFLAGS += -D_musl_
  1201. LINK_DYN_LIB_FLAGS += --musl
  1202. LINK_SCRIPT_EXE_FLAGS += --musl
  1203. PEERDIR+=contrib/libs/musl/include
  1204. }
  1205. # g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
  1206. # The same problem exists for clang toolchain. On the other hand, the problem
  1207. # doesn't affect cl since it has united C/C++ library and doesn't need
  1208. # proxy C-headers.
  1209. # Disable all C++ headers including proxy C-headers when we use libc++.
  1210. when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
  1211. CXXFLAGS += -nostdinc++
  1212. }
  1213. otherwise {
  1214. CFLAGS += -DUSE_STL_SYSTEM
  1215. }
  1216. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  1217. PEERDIR += build/external_resources/codenavigation
  1218. }
  1219. when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
  1220. CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
  1221. }
  1222. DEFAULT(USE_SSE4 yes)
  1223. when ($NOSSE != "yes") {
  1224. CFLAGS+=$SSE_CFLAGS
  1225. C_DEFINES+=$SSE_DEFINES
  1226. when ($USE_SSE4 == "yes") {
  1227. CFLAGS+=$SSE4_CFLAGS
  1228. C_DEFINES+=$SSE4_DEFINES
  1229. }
  1230. }
  1231. elsewhen ($MSVC != "yes") {
  1232. CFLAGS += -mno-sse
  1233. }
  1234. when ($LIPO == "yes" && $NEED_PLATFORM_PEERDIRS != "no") {
  1235. when ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1236. PEERDIR += build/platform/cctools
  1237. }
  1238. }
  1239. _REGISTER_NO_CHECK_IMPORTS()
  1240. DEFAULT(PACKAGE_PREFIX_ARGS)
  1241. DEFAULT(BYACC_FLAGS -v)
  1242. DEFAULT(SWIG_LANG python)
  1243. DEFAULT(BISON_FLAGS -v)
  1244. DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
  1245. when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
  1246. PEERDIR+=build/platform/binutils
  1247. }
  1248. }
  1249. _LINKER_ID=
  1250. # GCC does not support -fuse-ld with an executable path,
  1251. # only -fuse-ld=gold or -fuse-ld=lld.
  1252. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1253. when ($_LINKER_ID in [ "gold", "lld" ]) {
  1254. PEERDIR+=build/platform/${_LINKER_ID}
  1255. }
  1256. }
  1257. macro _USE_LINKER_IMPL(LINKER_ID...) {
  1258. SET(_LINKER_ID $LINKER_ID)
  1259. }
  1260. macro _USE_LINKER() {
  1261. _USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
  1262. }
  1263. ### @usage: USE_LINKER_GOLD()
  1264. ### Use gold linker for a program. This doesn't work in libraries
  1265. macro USE_LINKER_GOLD() {
  1266. _USE_LINKER_IMPL(gold)
  1267. }
  1268. COMMON_LINK_SETTINGS=
  1269. LINK_ADDITIONAL_SECTIONS=
  1270. LINK_ADDITIONAL_SECTIONS_COMMAND=
  1271. when ($COMMON_LINK_SETTINGS == "yes") {
  1272. when ($_LINKER_ID == "lld" || $_LINKER_ID == "gold") {
  1273. LDFLAGS += -Wl,--gdb-index
  1274. }
  1275. when ($EMBED_LINKER_CREF == "yes") {
  1276. LDFLAGS+=-Wl,--cref ${tmp;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1277. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
  1278. }
  1279. elsewhen ($DUMP_LINKER_CREF == "yes") {
  1280. LDFLAGS+=-Wl,--cref ${output;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1281. }
  1282. when ($EMBED_LINKER_MAP == "yes") {
  1283. LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1284. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1285. }
  1286. elsewhen ($DUMP_LINKER_MAP == "yes") {
  1287. LDFLAGS+=-Wl,-Map=${output;rootrel;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1288. }
  1289. when ($USE_MKL == "yes") {
  1290. NOPLATFORM=yes
  1291. }
  1292. when (($USE_EAT_MY_DATA == "yes") && ($WIN32 != "yes") && ($DARWIN != "yes") && ($OS_ANDROID != "yes") && ($OS_IOS != "yes")) {
  1293. PEERDIR+=contrib/libs/libeatmydata/autocheck_wrapper
  1294. }
  1295. when ($USE_ARCADIA_LIBM == "yes") {
  1296. PEERDIR+=contrib/libs/libm
  1297. }
  1298. when ($USE_ARCADIA_LIBM == "no") {
  1299. C_SYSTEM_LIBRARIES+=-lm
  1300. }
  1301. when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
  1302. when ($ALLOCATOR in [ "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "J", "LF", "LF_YT", "LF_DBG", "B", "BM", "C", "LOCKLESS", "YT", "MIM", "HU" ]) {
  1303. PEERDIR+=library/cpp/malloc/system
  1304. }
  1305. }
  1306. otherwise {
  1307. select ($ALLOCATOR) {
  1308. "MIM" ? {
  1309. PEERDIR+=library/cpp/malloc/mimalloc
  1310. }
  1311. "HU" ? {
  1312. PEERDIR+=library/cpp/malloc/hu
  1313. }
  1314. "TCMALLOC_256K" ? {
  1315. PEERDIR+=library/cpp/malloc/tcmalloc
  1316. PEERDIR+=contrib/libs/tcmalloc
  1317. }
  1318. "TCMALLOC_SMALL_BUT_SLOW" ? {
  1319. PEERDIR+=library/cpp/malloc/tcmalloc
  1320. PEERDIR+=contrib/libs/tcmalloc/small_but_slow
  1321. }
  1322. "TCMALLOC_NUMA_256K" ? {
  1323. PEERDIR+=library/cpp/malloc/tcmalloc
  1324. PEERDIR+=contrib/libs/tcmalloc/numa_256k
  1325. }
  1326. "TCMALLOC_NUMA_LARGE_PAGES" ? {
  1327. PEERDIR+=library/cpp/malloc/tcmalloc
  1328. PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
  1329. }
  1330. "TCMALLOC" ? {
  1331. PEERDIR+=library/cpp/malloc/tcmalloc
  1332. PEERDIR+=contrib/libs/tcmalloc/default
  1333. }
  1334. "TCMALLOC_TC" ? {
  1335. PEERDIR+=library/cpp/malloc/tcmalloc
  1336. PEERDIR+=contrib/libs/tcmalloc/no_percpu_cache
  1337. }
  1338. "GOOGLE" ? {
  1339. PEERDIR+=library/cpp/malloc/galloc
  1340. }
  1341. "J" ? {
  1342. when ($WIN32 == "yes") {
  1343. PEERDIR+=library/cpp/malloc/system
  1344. }
  1345. otherwise {
  1346. PEERDIR+=library/cpp/malloc/jemalloc
  1347. }
  1348. }
  1349. "LF" ? {
  1350. PEERDIR+=library/cpp/lfalloc
  1351. }
  1352. "LF_YT" ? {
  1353. PEERDIR+=library/cpp/lfalloc/yt
  1354. }
  1355. "LF_DBG" ? {
  1356. PEERDIR+=library/cpp/lfalloc/dbg
  1357. }
  1358. "B" ? {
  1359. PEERDIR+=library/cpp/balloc
  1360. }
  1361. "BM" ? {
  1362. PEERDIR+=library/cpp/balloc_market
  1363. }
  1364. "C" ? {
  1365. PEERDIR+=library/cpp/malloc/calloc
  1366. }
  1367. "LOCKLESS" ? {
  1368. PEERDIR+=library/cpp/malloc/lockless
  1369. }
  1370. "YT" ? {
  1371. PEERDIR+=library/cpp/ytalloc/impl
  1372. }
  1373. }
  1374. }
  1375. when ($ALLOCATOR == "SYSTEM") {
  1376. PEERDIR+=library/cpp/malloc/system
  1377. }
  1378. when ($WERROR != "no") {
  1379. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  1380. C_WARNING_OPTS += $WERROR_FLAG
  1381. }
  1382. }
  1383. when ($ICC == "yes") {
  1384. PEERDIR+=contrib/libs/intel/core
  1385. }
  1386. when ($WITH_VALGRIND == "yes") {
  1387. PEERDIR+=contrib/libs/valgrind
  1388. }
  1389. }
  1390. when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
  1391. LINK_ADDITIONAL_SECTIONS_COMMAND+= \
  1392. $OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
  1393. }
  1394. _SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/:PEERS}
  1395. when ($OS_WINDOWS == "yes") {
  1396. _SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/:PEERS}
  1397. }
  1398. elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1399. _SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/:PEERS}
  1400. }
  1401. LINK_OR_COPY_SO_CMD=
  1402. when ($SO_OUTPUTS == "yes") {
  1403. LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
  1404. LDFLAGS+=$RPATH_GLOBAL
  1405. }
  1406. # tag:restricted tag:DLL
  1407. ### $usage: WITH_DYNAMIC_LIBS() # restricted
  1408. ###
  1409. ### Include dynamic libraries as extra PROGRAM/DLL outputs
  1410. macro WITH_DYNAMIC_LIBS() {
  1411. ENABLE(SO_OUTPUTS)
  1412. }
  1413. # tag:internal
  1414. ### $usage: REAL_LINK_EXE_IMPL(peers...) # internal
  1415. macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1416. .CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1417. }
  1418. # tag:internal
  1419. ### $usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1420. macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1421. .CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
  1422. }
  1423. # tag:internal
  1424. ### $usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
  1425. macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1426. .CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
  1427. }
  1428. # tag:internal
  1429. ### $usage: LINK_EXE_IMPL(peers...) # internal
  1430. macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1431. .CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1432. }
  1433. # tag:internal
  1434. ### $usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1435. macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1436. .CMD=$LINK_EXEC_DYN_LIB_CMDLINE
  1437. }
  1438. # tag:internal
  1439. ### @usage: _LINK_UNIT # internal
  1440. ###
  1441. ### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
  1442. module _LINK_UNIT: _BASE_UNIT {
  1443. .EXTS=.o .obj .supp .tidyjson .ld
  1444. .CMD=LINK_EXE
  1445. .ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  1446. .NODE_TYPE=Program
  1447. .PEERDIR_POLICY=as_build_from
  1448. .FINAL_TARGET=yes
  1449. .DEFAULT_NAME_GENERATOR=DirName
  1450. .ARGS_PARSER=Base
  1451. DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
  1452. _USE_LINKER()
  1453. #link with libunwind manually
  1454. when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
  1455. PEERDIR += contrib/libs/cxxsupp
  1456. }
  1457. when ($USE_LIBCXXRT == "yes") {
  1458. PEERDIR += contrib/libs/cxxsupp/libcxxrt
  1459. }
  1460. ENABLE(COMMON_LINK_SETTINGS)
  1461. CHECK_PROVIDES()
  1462. }
  1463. MODULE_TYPE=UNKNOWN
  1464. macro ADD_CLANG_TIDY() {
  1465. ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy)
  1466. when ($TIDY == "yes") {
  1467. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json
  1468. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json
  1469. }
  1470. }
  1471. # tag:internal
  1472. ### @usage: _BASE_PROGRAM # internal
  1473. ###
  1474. ### The base of all programs. It adds dependencies to make final artefact complete and runnable.
  1475. module _BASE_PROGRAM: _LINK_UNIT {
  1476. .SYMLINK_POLICY=EXE
  1477. .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
  1478. .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1479. SET(MODULE_TYPE PROGRAM)
  1480. when ($OS_IOS == "yes") {
  1481. EXTS+=.ios.interface
  1482. }
  1483. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  1484. MODULE_SUFFIX=.exe
  1485. }
  1486. when ($TIDY == "yes") {
  1487. MODULE_SUFFIX=.tidyjson
  1488. }
  1489. when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
  1490. PEERDIR+=contrib/libs/asmlib
  1491. }
  1492. when ($MUSL == "yes") {
  1493. when ($MUSL_LITE == "yes") {
  1494. PEERDIR += contrib/libs/musl
  1495. }
  1496. otherwise {
  1497. PEERDIR += contrib/libs/musl/full
  1498. }
  1499. }
  1500. when ($USE_DYNAMIC_CUDA == "yes") {
  1501. LINK_SCRIPT_EXE_FLAGS += --dynamic-cuda
  1502. }
  1503. DEFAULT(CPU_CHECK yes)
  1504. when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
  1505. CPU_CHECK = no
  1506. }
  1507. when ($CPU_CHECK == "yes") {
  1508. PEERDIR += library/cpp/cpuid_check
  1509. }
  1510. when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
  1511. PEERDIR += library/cpp/execprofile/autostart
  1512. }
  1513. when ($SANITIZER_DEFINED == "yes") {
  1514. PEERDIR += contrib/libs/cxxsupp/libsan
  1515. }
  1516. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1517. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1518. }
  1519. when ($IDE_MSVS == "yes") {
  1520. PEERDIR+=build/scripts/c_templates
  1521. }
  1522. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1523. LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1524. }
  1525. }
  1526. CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  1527. && vcs_info \
  1528. && target_link_options PRIVATE $LDFLAGS $OBJADDE_LIB $OBJADDE \
  1529. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1530. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS
  1531. ### @usage: PROGRAM([progname])
  1532. ###
  1533. ### Regular program module.
  1534. ### If name is not specified it will be generated from the name of the containing project directory.
  1535. module PROGRAM: _BASE_PROGRAM {
  1536. .SEM=CPP_PROGRAM_SEM
  1537. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1538. ADD_CLANG_TIDY()
  1539. SET(MODULE_LANG CPP)
  1540. }
  1541. # tag:python-specific tag:deprecated tag:internal
  1542. module _PY2_PROGRAM: _BASE_PY_PROGRAM {
  1543. SET(MODULE_LANG PY2)
  1544. # Looks like we cannot avoid copy-paste util ymake supports multiple inheritance
  1545. # We need to attach coverage.extractor to every py_program target, except pytest targets
  1546. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1547. }
  1548. # tag:python-specific tag:deprecated
  1549. ### @usage: PY2_PROGRAM([progname]) # deprecated
  1550. ###
  1551. ### Deprecated. Use PY3_PROGRAM instead.
  1552. ### Python 2.x binary program. Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  1553. ### If name is not specified it will be generated from the name of the containing project directory.
  1554. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  1555. ###
  1556. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1557. module PY2_PROGRAM: _PY2_PROGRAM {
  1558. .RESTRICTED=STYLE_PYTHON
  1559. when ($FAIL_PY2 == "yes") {
  1560. _OK=no
  1561. }
  1562. elsewhen ($OPENSOURCE != "yes") {
  1563. PEERDIR+=build/rules/py2_deprecation
  1564. }
  1565. ASSERT(_OK You are using deprecated Python2-only code (PY2_PROGRAM). Please consider rewriting to Python 3.)
  1566. }
  1567. # tag:python-specific
  1568. ### @usage: NO_EXTENDED_SOURCE_SEARCH()
  1569. ###
  1570. ### Prevent module using in extended python source search.
  1571. ### Use the macro if module contains python2-only files (or other python sources which shouldn't be imported by python3 interpreter)
  1572. ### which resides in the same directories with python 3 useful code. contrib/python/future is a example.
  1573. ### Anyway, preferred way is to move such files into separate dir and don't use this macro at all.
  1574. ###
  1575. ### Also see: https://docs.yandex-team.ru/ya-make/manual/python/vars#y_python_extended_source_search for details
  1576. macro NO_EXTENDED_SOURCE_SEARCH() {
  1577. SET(NO_EXTENDED_SOURCE_SEARCH yes)
  1578. }
  1579. # tag:python-specific
  1580. ### @usage: PY3_PROGRAM([progname])
  1581. ###
  1582. ### Python 3.x binary program. Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  1583. ### If name is not specified it will be generated from the name of the containing project directory.
  1584. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules.
  1585. ###
  1586. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1587. multimodule PY3_PROGRAM {
  1588. module PY3_BIN: PY3_PROGRAM_BIN {
  1589. .PEERDIRSELF=PY3_BIN_LIB
  1590. .IGNORED=RESOURCE RESOURCE_FILES PEERDIR TASKLET_REG
  1591. # Notify pybuild to skip almost all PY_SRCS arguments except MAIN
  1592. ENABLE(PROCESS_PY_MAIN_ONLY)
  1593. _PY_PROGRAM()
  1594. }
  1595. module PY3_BIN_LIB: PY3_LIBRARY {
  1596. .IGNORED=RESTRICT_LICENSES
  1597. # Notify pybuild to skip all python main function definitions
  1598. ENABLE(IGNORE_PY_MAIN)
  1599. _REQUIRE_EXPLICIT_LICENSE()
  1600. }
  1601. }
  1602. # tag:ycr-specific
  1603. macro _YCR_GENERATE_CONFIGS_INTL(Package, App, Configs...) {
  1604. .CMD=${tool:"maps/infra/yacare/scripts/make_configs"} $Package $App ${cwd:BINDIR} ${output;hide;pre=debian/$Package/:Configs}
  1605. }
  1606. # tag:ycr-specific
  1607. macro _YCR_GENERATE_CONFIGS(Package, App) {
  1608. .CMD=$_YCR_GENERATE_CONFIGS_INTL($Package $App ${pre=etc/yandex/maps/yacare/:App.conf} ${pre=etc/template_generator/templates/etc/logrotate.d/:App} ${pre=etc/nginx/sites-available/:App.conf} ${pre=etc/syslog-ng/conf-available/:App.conf} ${pre=etc/template_generator/config.d/:App.yaml} ${pre=/juggler/checks-available/yacare_;suf=/MANIFEST.json:App} ${pre=etc/yandex/maps/roquefort/:App.conf} ${pre=usr/lib/yandex/maps/yacare/lua/init_worker.d/rate_limiter_:App.lua} ${pre=usr/lib/yandex/maps/yacare/lua/init_worker.d/tvm_:App.lua} ${pre=usr/lib/yandex/maps/yacare/lua/init.d/tvm_:App.lua} ${pre=etc/supervisor/conf-available/:App.conf} ${pre=etc/template_generator/templates/etc/yandex/unified_agent/conf.d/04_yacare_:App.yml})
  1609. }
  1610. # tag:ycr-specific
  1611. when ($TIDY=="yes") {
  1612. YCR_LINK_EXE=$LINK_EXE
  1613. }
  1614. otherwise {
  1615. YCR_LINK_EXE=$LINK_EXE && $_YCR_GENERATE_CONFIGS($MODULE_PREFIX$REALPRJNAME $MODULE_PREFIX$REALPRJNAME)
  1616. }
  1617. # tag:ycr-specific
  1618. ### @usage: YCR_PROGRAM([progname])
  1619. ###
  1620. ### yacare-specific program module. Generates yacare configs in addition to producing the program.
  1621. ### If name is not specified it will be generated from the name of the containing project directory.
  1622. module YCR_PROGRAM: PROGRAM {
  1623. .CMD=YCR_LINK_EXE
  1624. }
  1625. # tag:ycr-specific tag:python-specific
  1626. macro _PYCR_GENERATE_CONFIGS_INTL(Package, App, Configs...) {
  1627. .CMD=${tool:"maps/infra/pycare/scripts/make_configs"} $Package $App ${cwd:BINDIR} ${output;hide;pre=configs/:Configs}
  1628. }
  1629. # tag:ycr-specific tag:python-specific
  1630. macro _PYCR_GENERATE_CONFIGS(Package, App) {
  1631. .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})
  1632. }
  1633. # tag:ycr-specific tag:python-specific
  1634. PYCR_LINK_EXE=$LINK_EXE && $_PYCR_GENERATE_CONFIGS($MODULE_PREFIX$REALPRJNAME $MODULE_PREFIX$REALPRJNAME)
  1635. # tag:ycr-specific tag:python-specific
  1636. ### @usage: PYCR_PROGRAM([progname])
  1637. ###
  1638. ### pycare-specific program module. Generates pycare configs in addition to producing the program.
  1639. ### If name is not specified it will be generated from the name of the containing project directory.
  1640. module PYCR_PROGRAM: PY3_PROGRAM_BIN {
  1641. .CMD=PYCR_LINK_EXE
  1642. }
  1643. ### @usage: EXPORTS_SCRIPT(exports_file)
  1644. ###
  1645. ### Specify exports script within PROGRAM, DLL and DLL-derived modules.
  1646. ### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
  1647. ### The other option use EXPORTS parameter of the DLL module itself.
  1648. ###
  1649. ### @see: [DLL](#module_DLL)
  1650. macro EXPORTS_SCRIPT(Arg) {
  1651. SET(EXPORTS_FILE $Arg)
  1652. }
  1653. ### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
  1654. ###
  1655. ### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
  1656. macro NO_EXPORT_DYNAMIC_SYMBOLS() {
  1657. ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
  1658. }
  1659. ### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
  1660. ###
  1661. ### Export all non-hidden symbols as dynamic when linking a PROGRAM.
  1662. macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
  1663. # Dummy: default behaviour
  1664. ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
  1665. }
  1666. ### @usage: USE_DYNAMIC_CUDA()
  1667. ###
  1668. ### Enable linking of PROGRAM with dynamic CUDA. By default CUDA uses static linking
  1669. macro USE_DYNAMIC_CUDA() {
  1670. LDFLAGS(-Wl,-rpath,$ORIGIN)
  1671. ENABLE(USE_DYNAMIC_CUDA)
  1672. }
  1673. ### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
  1674. ###
  1675. ### Specifies name of a script for custom link step. The scripts
  1676. ### should be placed in the build/scripts directory and are subject to
  1677. ### review by devtools@.
  1678. macro CUSTOM_LINK_STEP_SCRIPT(Name) {
  1679. SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
  1680. }
  1681. ### @usage: _BASE_UNITTEST # internal
  1682. ###
  1683. ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
  1684. module _BASE_UNITTEST: _BASE_PROGRAM {
  1685. .FINAL_TARGET=no
  1686. .NODE_TYPE=Program
  1687. .ALLOWED=YT_SPEC
  1688. when ($UT_SKIP_EXCEPTIONS == "yes") {
  1689. C_DEFINES+=-DUT_SKIP_EXCEPTIONS
  1690. }
  1691. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1692. }
  1693. UNITTEST_SEM=$CPP_PROGRAM_SEM && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME --print-before-suite --print-before-test --fork-tests --print-times --show-fails
  1694. # tag:test
  1695. ### @usage: UNITTEST([name])
  1696. ###
  1697. ### Unit test module based on library/cpp/testing/unittest.
  1698. ### It is recommended not to specify the name.
  1699. ###
  1700. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
  1701. module UNITTEST: _BASE_UNITTEST {
  1702. .SEM=UNITTEST_SEM
  1703. .DEFAULT_NAME_GENERATOR=FullPath
  1704. .ARGS_PARSER=Base
  1705. PEERDIR(library/cpp/testing/unittest_main)
  1706. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1707. SET(MODULE_LANG CPP)
  1708. }
  1709. # tag:yt-specific tag:test
  1710. ### @usage: YT_UNITTEST([name])
  1711. ###
  1712. ### YT Unit test module based on mapreduce/yt/library/utlib
  1713. module YT_UNITTEST: _BASE_UNITTEST {
  1714. PEERDIR(mapreduce/yt/library/utlib)
  1715. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1716. }
  1717. # tag:test
  1718. ### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
  1719. ###
  1720. ### Generic unit test module.
  1721. module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
  1722. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1723. }
  1724. # tag:cpp-specific tag:test
  1725. ### @usage: GTEST([name])
  1726. ###
  1727. ### Unit test module based on library/cpp/testing/gtest.
  1728. ### It is recommended not to specify the name.
  1729. ###
  1730. ### Documentation: https://docs.yandex-team.ru/arcadia-cpp/cpp_test
  1731. module GTEST: _BASE_UNITTEST {
  1732. .SEM=UNITTEST_SEM
  1733. .DEFAULT_NAME_GENERATOR=FullPath
  1734. .ARGS_PARSER=Base
  1735. PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
  1736. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
  1737. SET(MODULE_LANG CPP)
  1738. }
  1739. USE_AFL=no
  1740. # tag:fuzzing
  1741. ### @usage: FUZZ()
  1742. ###
  1743. ### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
  1744. ### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
  1745. ### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
  1746. ###
  1747. ### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
  1748. ###
  1749. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1750. module FUZZ: _BASE_PROGRAM {
  1751. .NODE_TYPE=Program
  1752. .FINAL_TARGET=no
  1753. .ALLOWED=FUZZ_DICTS FUZZ_OPTS
  1754. DEFAULT(LIBFUZZER_PATH contrib/libs/libfuzzer12)
  1755. when ($USE_AFL == "no") {
  1756. PEERDIR+=$LIBFUZZER_PATH
  1757. }
  1758. when ($USE_AFL == "yes") {
  1759. PEERDIR+=$LIBFUZZER_PATH/afl
  1760. }
  1761. when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
  1762. PEERDIR+=devtools/nofuzz
  1763. }
  1764. ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
  1765. }
  1766. # tag:ios-specific
  1767. PACK_IOS_CMD=
  1768. when ($OS_IOS && $BUILD_IOS_APP) {
  1769. PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
  1770. }
  1771. LINK_BOOSTTEST_CMD=
  1772. BOOST_TEST_TYPE_STRING=
  1773. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1774. LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
  1775. BOOST_TEST_TYPE_STRING=no.test
  1776. }
  1777. otherwise {
  1778. LINK_BOOSTTEST_CMD=$LINK_EXE
  1779. BOOST_TEST_TYPE_STRING=boost.test
  1780. }
  1781. # tag:deprecated
  1782. ### @usage: BOOSTTEST([name]) #deprecated
  1783. ###
  1784. ### Test module based on boost/test/unit_test.hpp.
  1785. ### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
  1786. ### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
  1787. module BOOSTTEST: _BASE_PROGRAM {
  1788. .NODE_TYPE=Program
  1789. .FINAL_TARGET=no
  1790. .CMD=LINK_BOOSTTEST_CMD
  1791. PEERDIR(library/cpp/testing/boost_test)
  1792. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1793. MODULE_SUFFIX=.a
  1794. }
  1795. elsewhen ($OS_IOS && $BUILD_IOS_APP) {
  1796. PEERDIR+=devtools/boosttest_ios_wrapper/library
  1797. MODULE_SUFFIX=.ios.tar
  1798. }
  1799. ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
  1800. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1801. }
  1802. # tag:deprecated
  1803. ### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated
  1804. ###
  1805. ### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
  1806. module BOOSTTEST_WITH_MAIN: BOOSTTEST {
  1807. PEERDIR(library/cpp/testing/boost_test_main)
  1808. }
  1809. FUZZ_DICTS_VALUE=
  1810. ### @usage: FUZZ_DICTS(path1 [path2...])
  1811. ###
  1812. ### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
  1813. ### Libfuzzer and AFL use a single syntax for dictionary descriptions.
  1814. ### Should only be used in FUZZ modules.
  1815. ###
  1816. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1817. macro FUZZ_DICTS(Data...) {
  1818. SET_APPEND(FUZZ_DICTS_VALUE $Data)
  1819. }
  1820. FUZZ_OPTS_VALUE=
  1821. ### @usage: FUZZ_OPTS(opt1 [Opt2...])
  1822. ###
  1823. ### Overrides or adds options to the corpus mining and fuzzer run.
  1824. ### Currently supported only Libfuzzer, so you should use the options for it.
  1825. ### Should only be used in FUZZ modules.
  1826. ###
  1827. ### @example:
  1828. ###
  1829. ### FUZZ_OPTS (
  1830. ### -max_len=1024
  1831. ### -rss_limit_mb=8192
  1832. ### )
  1833. ###
  1834. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1835. macro FUZZ_OPTS(Data...) {
  1836. SET_APPEND(FUZZ_OPTS_VALUE $Data)
  1837. }
  1838. # tag:yt-specific tag:test
  1839. TEST_YT_SPEC_VALUE=
  1840. ### @usage: YT_SPEC(path1 [path2...])
  1841. ###
  1842. ### Allows you to specify json-files with YT task and operation specs,
  1843. ### which will be used to run test node in the YT.
  1844. ### Test must be marked with ya:yt tag.
  1845. ### Files must be relative to the root of Arcadia.
  1846. ###
  1847. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1848. macro YT_SPEC(Data...) {
  1849. SET_APPEND(TEST_YT_SPEC_VALUE $Data)
  1850. }
  1851. # tag:test
  1852. TEST_SRCS_VALUE=
  1853. ### @usage: TEST_SRCS(Files...)
  1854. ###
  1855. ### 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.
  1856. ###
  1857. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1858. macro TEST_SRCS(Tests...) {
  1859. SET_APPEND(TEST_SRCS_VALUE $Tests)
  1860. }
  1861. macro DISABLE_DATA_VALIDATION() {
  1862. DISABLE(VALIDATE_DATA)
  1863. }
  1864. # tag:test
  1865. TEST_DATA_VALUE=
  1866. ### @usage: DATA([path...])
  1867. ###
  1868. ### Specifies the path to the data necessary test.
  1869. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
  1870. ### In the latter case resource will be brought to the working directory of the test before it is started
  1871. ###
  1872. ### Used only inside TEST modules.
  1873. ###
  1874. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1875. macro DATA(Data...) {
  1876. SET_APPEND(TEST_DATA_VALUE $Data)
  1877. ADD_CHECK(check.data $Data)
  1878. }
  1879. # tag:test
  1880. TEST_TAGS_VALUE=
  1881. ### @usage: TAG ([tag...])
  1882. ###
  1883. ### Each test can have one or more tags used to filter tests list for running.
  1884. ### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
  1885. ###
  1886. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
  1887. macro TAG(Tags...) {
  1888. SET_APPEND(TEST_TAGS_VALUE $Tags)
  1889. }
  1890. # tag:test
  1891. TEST_REQUIREMENTS_VALUE=
  1892. ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
  1893. ###
  1894. ### Allows you to specify the requirements of the test.
  1895. ###
  1896. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1897. macro REQUIREMENTS(Tags...) {
  1898. SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
  1899. }
  1900. # tag:test
  1901. TEST_ENV_VALUE=
  1902. ### @usage: ENV(key[=value])
  1903. ###
  1904. ### Sets env variable key to value (gets value from system env by default).
  1905. macro ENV(Data...) {
  1906. SET_APPEND(TEST_ENV_VALUE ${quo:Data})
  1907. }
  1908. ### @usage: CONFTEST_LOAD_POLICY_LOCAL()
  1909. ###
  1910. ### Loads conftest.py files in a way that pytest does it
  1911. macro CONFTEST_LOAD_POLICY_LOCAL() {
  1912. SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
  1913. }
  1914. # tag:test
  1915. TEST_RECIPES_VALUE=
  1916. ### @usage: USE_RECIPE(path [arg1 arg2...])
  1917. ###
  1918. ### Provides prepared environment via recipe for test.
  1919. ###
  1920. ### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
  1921. macro USE_RECIPE(Data...) {
  1922. SET_APPEND(TEST_RECIPES_VALUE $Data)
  1923. SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
  1924. }
  1925. # tag:python-specific tag:test
  1926. TEST_PYTHON_PATH_VALUE=
  1927. # tag:python-specific tag:test
  1928. ### @usage: PYTHON_PATH(Path)
  1929. ###
  1930. ### Set path to Python that will be used to runs scripts in tests
  1931. macro PYTHON_PATH(Path) {
  1932. SET(TEST_PYTHON_PATH_VALUE $Path)
  1933. }
  1934. # tag:test
  1935. SKIP_TEST_VALUE=
  1936. ### @usage: SKIP_TEST(Reason)
  1937. ###
  1938. ### Skip the suite defined by test module. Provide a reason to be output in test execution report.
  1939. macro SKIP_TEST(Reason...) {
  1940. SET(SKIP_TEST_VALUE $Reason)
  1941. }
  1942. # tag:test
  1943. LINT_LEVEL_VALUE=extended
  1944. ### @usage: NO_LINT()
  1945. ###
  1946. ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
  1947. macro NO_LINT() {
  1948. SET(LINT_LEVEL_VALUE none)
  1949. }
  1950. ### @usage: LINT(<none|base|strict>)
  1951. ###
  1952. ### Set linting levem for sources of the module
  1953. macro LINT(level) {
  1954. SET(LINT_LEVEL_VALUE $level)
  1955. }
  1956. # tag:python-specific tag:test
  1957. STYLE_PYTHON_VALUE=no
  1958. ### @usage: STYLE_PYTHON()
  1959. ###
  1960. ### Check python3 sources for style issues using black.
  1961. macro STYLE_PYTHON() {
  1962. SET(STYLE_PYTHON_VALUE yes)
  1963. }
  1964. # tag:python-specific tag:test
  1965. ### @usage: NO_DOCTESTS()
  1966. ###
  1967. ### Disable doctests in PY[|3|23_]TEST
  1968. macro NO_DOCTESTS() {
  1969. ENV(YA_PYTEST_DISABLE_DOCTEST="yes")
  1970. }
  1971. # tag:python-specific tag:test
  1972. ### @usage: _BASE_PYTEST # internal
  1973. ###
  1974. ### Base logic of Python 2.x py.test modules: common module properties and dependencies.
  1975. module _BASE_PYTEST: _BASE_PY_PROGRAM {
  1976. .NODE_TYPE=Program
  1977. .FINAL_TARGET=no
  1978. .ALLOWED=YT_SPEC NO_DOCTESTS
  1979. when ($USE_ARCADIA_PYTHON == "yes") {
  1980. PEERDIR+=library/python/pytest
  1981. }
  1982. when ($USE_ARCADIA_PYTHON == "no") {
  1983. MODULE_SUFFIX=.pkg.fake
  1984. PEERDIR+=library/python/pytest/empty
  1985. }
  1986. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1987. }
  1988. # tag:python-specific tag:deprecated tag:test
  1989. ### @usage: PYTEST_BIN() #deprecated
  1990. ###
  1991. ### Same as PY2TEST. Don't use this, use PY2TEST instead.
  1992. module PYTEST_BIN: _BASE_PYTEST {
  1993. .NODE_TYPE=Program
  1994. .DEFAULT_NAME_GENERATOR=FullPath
  1995. .ARGS_PARSER=Base
  1996. SETUP_PYTEST_BIN()
  1997. }
  1998. # tag:python-specific tag:test
  1999. ### @usage: PY2TEST([name])
  2000. ###
  2001. ### The test module for Python 2.x based on py.test
  2002. ###
  2003. ### This module is compatible only with PYTHON2-tagged modules and selects peers from multimodules accordingly.
  2004. ### This module is compatible with non-Arcadia Python builds.
  2005. ###
  2006. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#python
  2007. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2008. module PY2TEST: PYTEST_BIN {
  2009. .RESTRICTED=STYLE_PYTHON
  2010. .DEFAULT_NAME_GENERATOR=FullPath
  2011. .ARGS_PARSER=Base
  2012. when ($FAIL_PY2 == "yes") {
  2013. _OK=no
  2014. }
  2015. elsewhen ($OPENSOURCE != "yes") {
  2016. PEERDIR+=build/rules/py2_deprecation
  2017. }
  2018. SET(MODULE_LANG PY2)
  2019. ASSERT(_OK You are using deprecated Python2-only code (PY2TEST). Please consider rewriting to Python 3.)
  2020. }
  2021. # tag:python-specific tag:deprecated tag:test
  2022. ### @usage: PY3TEST_BIN() #deprecated
  2023. ###
  2024. ### Same as PY3TEST. Don't use this, use PY3TEST instead.
  2025. module PY3TEST_BIN: _BASE_PY3_PROGRAM {
  2026. .NODE_TYPE=Program
  2027. .FINAL_TARGET=no
  2028. .ALLOWED=YT_SPEC NO_DOCTESTS
  2029. .DEFAULT_NAME_GENERATOR=FullPath
  2030. .ARGS_PARSER=Base
  2031. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2032. SET(MODULE_LANG PY3)
  2033. SETUP_PYTEST_BIN()
  2034. PEERDIR+=library/python/pytest
  2035. }
  2036. # tag:python-specific tag:test
  2037. ### Disable submodules with the specified name(s).
  2038. ### Unlike EXCLUDE_TAGS this variable:
  2039. ### - affects all projects in the build;
  2040. ### - filter by module name and ignore MODULE_TAG.
  2041. EXCLUDE_SUBMODULES=PY3TEST_LIBRARY
  2042. # tag:python-specific tag:test
  2043. ### @usage: PY3TEST([name])
  2044. ###
  2045. ### The test module for Python 3.x based on py.test
  2046. ###
  2047. ### This module is compatible only with PYTHON3-tagged modules and selects peers from multimodules accordingly.
  2048. ### This module is only compatible with Arcadia Python build (to avoid tests duplication from Python2/3-tests). For non-Arcadia python use PYTEST.
  2049. ###
  2050. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  2051. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2052. multimodule PY3TEST {
  2053. module PY3TEST_PROGRAM: PY3TEST_BIN {
  2054. .FINAL_TARGET=yes
  2055. }
  2056. module PY3TEST_LIBRARY: PY3_LIBRARY {
  2057. PEERDIR+=library/python/pytest
  2058. _REQUIRE_EXPLICIT_LICENSE()
  2059. }
  2060. }
  2061. # tag:cpp-specific tag:test
  2062. module CPP_STYLE_TEST: PY3TEST_BIN {
  2063. DEPENDS(contrib/libs/clang12/tools/clang-format)
  2064. PEERDIR+=library/python/cpp_test
  2065. }
  2066. macro STYLE(Globs...) {
  2067. _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
  2068. _STYLE(${STYLE_SRCS_GLOB})
  2069. }
  2070. # tag:cpp-specific tag:deprecated tag:test
  2071. ### @usage: GTEST_UGLY([name])
  2072. ###
  2073. ### Deprecated, do not use in new projects. Use GTEST instead.
  2074. ###
  2075. ### The test module based on gtest (contrib/libs/gtest contrib/libs/gmock).
  2076. ### Use public documentation on gtest for details.
  2077. ###
  2078. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2079. module GTEST_UGLY: _BASE_PROGRAM {
  2080. .NODE_TYPE=Program
  2081. .FINAL_TARGET=no
  2082. PEERDIR(contrib/restricted/googletest/googlemock contrib/restricted/googletest/googletest)
  2083. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gtest)
  2084. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2085. }
  2086. # tag:test
  2087. ### @usage: EXECTEST()
  2088. ###
  2089. ### Module definition of generic test that executes a binary.
  2090. ### Use macro RUN to specify binary to run.
  2091. ###
  2092. ### @example:
  2093. ###
  2094. ### EXECTEST()
  2095. ### OWNER(g:yatool)
  2096. ###
  2097. ### RUN(
  2098. ### cat input.txt
  2099. ### )
  2100. ### DATA(
  2101. ### arcadia/devtools/ya/test/tests/exectest/data
  2102. ### )
  2103. ### DEPENDS(
  2104. ### devtools/dummy_arcadia/cat
  2105. ### )
  2106. ### TEST_CWD(devtools/ya/test/tests/exectest/data)
  2107. ### END()
  2108. ###
  2109. ### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
  2110. ###
  2111. ### @see: [RUN()](#macro_RUN)
  2112. module EXECTEST: _BARE_UNIT {
  2113. .NODE_TYPE=Program
  2114. .FINAL_TARGET=no
  2115. .ALLOWED=YT_SPEC
  2116. .RESTRICTED=FORK_TEST_FILES
  2117. .DEFAULT_NAME_GENERATOR=FullPath
  2118. .ARGS_PARSER=Base
  2119. SET(MODULE_SUFFIX .pkg.fake)
  2120. SETUP_EXECTEST()
  2121. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2122. }
  2123. # tag:cpp-specific tag:test
  2124. ### @usage: Y_BENCHMARK([benchmarkname])
  2125. ###
  2126. ### Benchmark test based on the library/cpp/testing/benchmark.
  2127. ###
  2128. ### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
  2129. module Y_BENCHMARK: PROGRAM {
  2130. .SEM=CPP_PROGRAM_SEM
  2131. PEERDIR(library/cpp/testing/benchmark/main)
  2132. SET(MODULE_LANG CPP)
  2133. }
  2134. # tag:cpp-specific tag:test
  2135. ### @usage: G_BENCHMARK([benchmarkname])
  2136. ###
  2137. ### Benchmark test based on the google benchmark.
  2138. ###
  2139. ### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
  2140. module G_BENCHMARK: _BASE_PROGRAM {
  2141. PEERDIR(library/cpp/testing/gbenchmark_main)
  2142. ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
  2143. SET(MODULE_LANG CPP)
  2144. }
  2145. # tag:test
  2146. TEST_ROOT=$(TESTS_DATA_ROOT)
  2147. RESULT_MAX_FILE=0
  2148. STRIP_FILES=--dont-strip-files
  2149. VERIFY_RESULTS=--verify-results
  2150. ADDITIONAL_PATH=
  2151. # set for tests variables to fill it by YA_DEV or YA
  2152. YA_ROOT=ya
  2153. when ($YA_DEV == "yes") {
  2154. YA_ROOT=ya-dev
  2155. }
  2156. # tag:test
  2157. ### @usage: UNITTEST_FOR(path/to/lib)
  2158. ###
  2159. ### Convenience extension of UNITTEST module.
  2160. ### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
  2161. ### path/to/lib is the path to the directory with the LIBRARY project.
  2162. ###
  2163. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2164. module UNITTEST_FOR: UNITTEST {
  2165. .SEM=UNITTEST_SEM
  2166. PEERDIR(ADDINCL $UNITTEST_DIR)
  2167. SRCDIR($UNITTEST_DIR)
  2168. }
  2169. ### @usage: _LIBRARY # internal
  2170. ###
  2171. ### Base module definition for all libraries.
  2172. ### Contains basic logic like module properties, default variable values etc.
  2173. ### All libraries similar to C++-libraries should be inherited from it.
  2174. module _LIBRARY: _BASE_UNIT {
  2175. .CMD=LINK_LIB
  2176. .NODE_TYPE=Library
  2177. .PEERDIR_POLICY=as_include
  2178. .EXTS=.o .obj .a .mf .supp .tidyjson .ld
  2179. .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  2180. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2181. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
  2182. .FINAL_TARGET=no
  2183. .GLOBAL_CMD=GLOBAL_LINK_LIB
  2184. .GLOBAL_EXTS=.o .obj .tidyjson
  2185. GLOBAL_SUFFIX=.global$MODULE_SUFFIX
  2186. #TODO: Remove this hack (really we do not need add fake src at all)
  2187. ENABLE(NEED_ADD_FAKE_SRC)
  2188. _REQUIRE_EXPLICIT_LICENSE(contrib/deprecated contrib/libs contrib/restricted contrib/python)
  2189. CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
  2190. when ($USE_MKL == "yes") {
  2191. NOPLATFORM=yes
  2192. }
  2193. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2194. MODULE_PREFIX=
  2195. MODULE_SUFFIX=.lib
  2196. }
  2197. otherwise {
  2198. when ($TIDY == "yes") {
  2199. MODULE_PREFIX=
  2200. MODULE_SUFFIX=.tidyjson
  2201. }
  2202. otherwise {
  2203. MODULE_PREFIX=lib
  2204. MODULE_SUFFIX=.a
  2205. }
  2206. }
  2207. when ($WERROR != "no") {
  2208. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  2209. C_WARNING_OPTS += $WERROR_FLAG
  2210. }
  2211. }
  2212. when ($WITH_VALGRIND == "yes") {
  2213. PEERDIR+=contrib/libs/valgrind
  2214. }
  2215. when ($USE_ARCADIA_LIBM == "yes") {
  2216. PEERDIR+=contrib/libs/libm
  2217. }
  2218. }
  2219. CPP_LIBRARY_SEM=add_library ${MODDIR} $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  2220. && library_fake_marker FAKE_MODULE ${FAKE_MODULE} \
  2221. && consumer_link_library PUBLIC $CMAKE_LINK_TARGET \
  2222. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2223. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2224. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS \
  2225. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  2226. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW \
  2227. && add_language C && add_language CXX
  2228. CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:CMAKE_TARGET_NAME} $CMAKE_TARGET_NAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
  2229. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2230. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2231. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS \
  2232. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  2233. CMAKE_FIND_PKG=
  2234. CMAKE_LINK_TARGET=$REALPRJNAME
  2235. CMAKE_FIND_PKG_COMP=
  2236. CONAN_REQUIRE=
  2237. ### @usage: LIBRARY()
  2238. ###
  2239. ### The regular static library module.
  2240. ###
  2241. ### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
  2242. ### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
  2243. ###
  2244. ### This is C++ library, and it selects peers from multimodules accordingly.
  2245. ###
  2246. ### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
  2247. ### In order to use library in tests PEERDIR it to link into tests.
  2248. ### If you think you need to distribute static library please contact devtools@ for assistance.
  2249. module LIBRARY: _LIBRARY {
  2250. .GLOBAL=_AARS _PROGUARD_RULES
  2251. .SEM=CPP_LIBRARY_SEM
  2252. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  2253. .DEFAULT_NAME_GENERATOR=ThreeDirNames
  2254. .ARGS_PARSER=Base
  2255. when ($CMAKE_PACKAGE_COMPONENT != "") {
  2256. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  2257. }
  2258. when ($CMAKE_PACKAGE != "") {
  2259. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  2260. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && consumer_link_library PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && ignored
  2261. }
  2262. when ($CONAN_REFERENCE != "") {
  2263. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  2264. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && consumer_link_library PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && ignored
  2265. }
  2266. when ($CONAN_PKG_OPTS != "") {
  2267. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  2268. }
  2269. when ($OPENSOURCE_EXPORT == "no") {
  2270. CPP_LIBRARY_SEM=ignored
  2271. }
  2272. when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
  2273. PEERDIR+=$CPP_PROTOBUF_PEERS
  2274. }
  2275. SET(MODULE_TYPE LIBRARY)
  2276. SET(MODULE_LANG CPP)
  2277. ADD_CLANG_TIDY()
  2278. }
  2279. # tag:internal
  2280. ### @usage: _BARE_MODULE() # internal
  2281. ###
  2282. ### Remove unwanted dependencies for "empty" library module
  2283. macro _BARE_MODULE() {
  2284. SET(NEED_PLATFORM_PEERDIRS no)
  2285. SET(PEERDIR_TEST_TOOL no)
  2286. DISABLE(WITH_VALGRIND)
  2287. NO_CODENAVIGATION()
  2288. NO_PLATFORM()
  2289. NO_RUNTIME()
  2290. NO_UTIL()
  2291. NO_CLANG_TIDY()
  2292. }
  2293. # tag:internal
  2294. ### @usage: _BARE_LINK_MODULE() # internal
  2295. ###
  2296. ### Remove unwanted dependencies for "empty" link module
  2297. macro _BARE_LINK_MODULE() {
  2298. _BARE_MODULE()
  2299. ALLOCATOR(FAKE)
  2300. }
  2301. # tag:internal
  2302. ### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
  2303. ###
  2304. ### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
  2305. ### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
  2306. macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
  2307. SRCS($USE_CONDITIONAL_SRCS)
  2308. }
  2309. # XXX: dirty hack for correct LDFLAGS passing
  2310. RESOURCES_LIBRARY_LINK=$TOUCH_UNIT ${hide:LDFLAGS_GLOBAL} ${hide:LDFLAGS}
  2311. RESOURCES_LIBRARY_SEM=ignored
  2312. ### @usage: RESOURCES_LIBRARY()
  2313. ###
  2314. ### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
  2315. ### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
  2316. ###
  2317. ### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
  2318. module RESOURCES_LIBRARY: _BARE_UNIT {
  2319. .CMD=RESOURCES_LIBRARY_LINK
  2320. .SEM=RESOURCES_LIBRARY_SEM
  2321. .ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
  2322. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS PEERDIR SPLIT_DWARF
  2323. .NODE_TYPE=Library
  2324. .PEERDIR_POLICY=as_include
  2325. .EXTS=.o .obj .a .mf .supp .tidyjson .ld
  2326. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2327. MODULE_SUFFIX=.pkg.fake
  2328. ENABLE(NEED_ADD_FAKE_SRC)
  2329. WITHOUT_LICENSE_TEXTS()
  2330. }
  2331. FAT_OBJECT_ARGS=
  2332. FAT_OBJECT_OUTS=
  2333. macro _FAT_OBJECT_ARGS_BASE(Flag, Lib) {
  2334. .CMD=$Flag=$Lib
  2335. }
  2336. macro PACK_GLOBALS_IN_LIBRARY() {
  2337. SET_APPEND(FAT_OBJECT_ARGS $_FAT_OBJECT_ARGS_BASE(--globals-lib, ${BINDIR}/${pre=$MODULE_PREFIX:REALPRJNAME.globals.a}))
  2338. SET_APPEND(FAT_OBJECT_OUTS \${output;hide;noauto;norel;nopath;noext;pre=$MODULE_PREFIX;suf=$BINDIR:REALPRJNAME.globals.a})
  2339. }
  2340. when ($OS_ANDROID != "yes") {
  2341. LINK_FAT_OBJECT_CMD=$LINK_FAT_OBJECT
  2342. }
  2343. otherwise {
  2344. LINK_FAT_OBJECT_CMD=$LINK_FAT_OBJECT_LIBRARY
  2345. }
  2346. FAT_OBJECT_SEM=add_fat_object ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  2347. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2348. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS \
  2349. && set_global_flags FAT_OBJECT_PREFIX ${MODULE_PREFIX} \
  2350. && set_global_flags FAT_OBJECT_SUFFIX ${MODULE_SUFFIX}
  2351. ### Do not turn visibility=hidden symbos into static symbos of partially linked object file
  2352. ###
  2353. ### Note: This variable do not have any effect on platforms other than MacOS and iOS.
  2354. KEEP_FAT_OBJECT_SYMBOLS=no
  2355. ### @usage: FAT_OBJECT()
  2356. ###
  2357. ### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2358. ### static libraries, local (from own SRCS) and global (from peers') object files.
  2359. ###
  2360. ### Designed for use in XCode projects for iOS.
  2361. module FAT_OBJECT: LIBRARY {
  2362. .ALLOWED=PACK_GLOBALS_IN_LIBRARY
  2363. .CMD=LINK_FAT_OBJECT_CMD
  2364. .SEM=FAT_OBJECT_SEM
  2365. .PEERDIR_POLICY=as_build_from
  2366. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2367. MODULE_SUFFIX=.global.lib
  2368. }
  2369. elsewhen ($OS_ANDROID == "yes") {
  2370. MODULE_SUFFIX=.a
  2371. }
  2372. otherwise {
  2373. MODULE_SUFFIX=.o
  2374. }
  2375. when (($OS_DARWIN == "yes" || $OS_IOS == "yes") && $KEEP_FAT_OBJECT_SYMBOLS == "yes") {
  2376. LDFLAGS_GLOBAL += -keep_private_externs
  2377. }
  2378. _USE_LINKER()
  2379. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2380. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2381. DISABLE(NEED_ADD_FAKE_SRC)
  2382. SRCS(build/scripts/_fake_src.cpp)
  2383. }
  2384. ### @usage: RECURSIVE_LIBRARY()
  2385. ###
  2386. ### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2387. ### from static libraries, local (from own SRCS) and global (from peers') object files.
  2388. ###
  2389. ### Designed for use in XCode projects for iOS.
  2390. module RECURSIVE_LIBRARY: LIBRARY {
  2391. .CMD=LINK_RECURSIVE_LIBRARY
  2392. .PEERDIR_POLICY=as_build_from
  2393. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2394. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2395. DISABLE(NEED_ADD_FAKE_SRC)
  2396. SRCS(build/scripts/_fake_src.cpp)
  2397. }
  2398. _SONAME=
  2399. _EXPORT_SCRIPT_SEM=
  2400. macro _ADD_DYNLYB_SEM(Libname) {
  2401. .SEM=add_library ${MODDIR} ${Libname} SHARED ${hide:TARGET} ${hide:AUTO_INPUT} && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && target_include_directories PRIVATE $_C__INCLUDE_OWNED && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && vcs_info $_EXPORT_SCRIPT_SEM
  2402. }
  2403. CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES
  2404. ### @usage: DLL_UNIT # internal
  2405. ###
  2406. ### Base module for all dynamically linked libraries as final artifacts.
  2407. ### Contains all general logic for such kind of modules. Supports versioning and export files.
  2408. ### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
  2409. module DLL_UNIT: _LINK_UNIT {
  2410. .CMD=LINK_DYN_LIB
  2411. .SEM=CPP_DYN_LIBRARY_SEM
  2412. .NODE_TYPE=Library
  2413. .SYMLINK_POLICY=SO
  2414. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2415. .ALLOWED=WHOLE_ARCHIVE
  2416. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2417. .ARGS_PARSER=DLL
  2418. DYNAMIC_LINK=yes
  2419. ALLOCATOR(FAKE)
  2420. SET(MODULE_TYPE DLL)
  2421. SET(MODULE_TAG DLL)
  2422. SET(MODULE_LANG CPP)
  2423. ADD_CLANG_TIDY()
  2424. when ($EXPORTS_FILE) {
  2425. _EXPORT_SCRIPT_SEM=&& use_export_script ${input:EXPORTS_FILE}
  2426. }
  2427. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2428. MODULE_SUFFIX=.dll
  2429. }
  2430. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2431. MODULE_PREFIX=lib
  2432. MODULE_SUFFIX=.dylib
  2433. }
  2434. elsewhen ($TIDY == "yes") {
  2435. MODULE_PREFIX=
  2436. MODULE_SUFFIX=.tidyjson
  2437. }
  2438. otherwise {
  2439. MODULE_PREFIX=lib
  2440. MODULE_SUFFIX=.so
  2441. }
  2442. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2443. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2444. when ($MODULE_VERSION) {
  2445. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2446. }
  2447. _SONAME=$SONAME$MODULE_VERSION
  2448. when ($LINUX == "yes") {
  2449. # '-z notext' is needed for linking mkl into shared libraries
  2450. LDFLAGS += -Wl,-z,notext
  2451. when ($_NO_FIX_ELF != "yes") {
  2452. LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
  2453. }
  2454. }
  2455. when ($DARWIN == "yes") {
  2456. LDFLAGS += -undefined dynamic_lookup
  2457. }
  2458. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  2459. PEERDIR+=library/cpp/testing/dump_clang_coverage
  2460. }
  2461. when ($IDE_MSVS == "yes") {
  2462. PEERDIR+=build/scripts/c_templates
  2463. }
  2464. }
  2465. # tag:python-specific
  2466. ### @usage: PY_ANY_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2467. ###
  2468. ### The Python external module for any versio of Arcadia or system Python.
  2469. ### 1. major_ver and minor_ver must be integers.
  2470. ### 2. The resulting .so will have the prefix "lib".
  2471. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2472. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2473. ###
  2474. ### Note: Use PYTHON2_MODULE()/PYTHON3_MODULE() in order to PEERDIR proper version of PY23_NATIVE_LIBRARY.
  2475. ### Do not PEERDIR any PY*_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2476. ###
  2477. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2478. module PY_ANY_MODULE: DLL_UNIT {
  2479. .SEM=CPP_DYN_LIBRARY_SEM
  2480. when ($MSVC != "yes" && $DARWIN != "yes") {
  2481. LDFLAGS+= -Wl,-Bsymbolic
  2482. }
  2483. when ($USE_ARCADIA_PYTHON == "no") {
  2484. when ($USE_SYSTEM_PYTHON) {
  2485. PEERDIR+=build/platform/python
  2486. }
  2487. otherwise {
  2488. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2489. LDFLAGS+=$PYTHON_LIBRARIES
  2490. }
  2491. }
  2492. }
  2493. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2494. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2495. when ($MODULE_VERSION) {
  2496. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2497. }
  2498. _SONAME=$SONAME$MODULE_VERSION
  2499. # -bundle
  2500. when ($DARWIN == "yes") {
  2501. LDFLAGS+=-flat_namespace
  2502. }
  2503. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2504. MODULE_PREFIX=
  2505. MODULE_SUFFIX=.pyd
  2506. }
  2507. otherwise {
  2508. MODULE_PREFIX=
  2509. MODULE_SUFFIX=.so
  2510. }
  2511. .RESTRICTED=USE_PYTHON2 USE_PYTHON3 PY_SRCS PY_MAIN
  2512. }
  2513. # tag:python-specific
  2514. ### @usage: PY2MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2515. ###
  2516. ### The Python external module for Python2 and any system Python
  2517. ### 1. major_ver and minor_ver must be integers.
  2518. ### 2. The resulting .so will have the prefix "lib".
  2519. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2520. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2521. ###
  2522. ### Note: this module will always PEERDIR Python2 version of PY23_NATIVE_LIBRARY.
  2523. ### Do not PEERDIR PY2_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2524. ###
  2525. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2526. module PY2MODULE: PY_ANY_MODULE {
  2527. PYTHON2_MODULE()
  2528. SET(MODULE_LANG PY2)
  2529. .RESTRICTED=PYTHON3_MODULE PYTHON3_ADDINCL
  2530. }
  2531. # tag:python-specific
  2532. ### @usage: PY3MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2533. ###
  2534. ### The Python external module for Python3 and any system Python
  2535. ### 1. major_ver and minor_ver must be integers.
  2536. ### 2. The resulting .so will have the prefix "lib".
  2537. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2538. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2539. ###
  2540. ### Note: this module will always PEERDIR Python3 version of PY23_NATIVE_LIBRARY.
  2541. ### Do not PEERDIR PY3_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2542. ###
  2543. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2544. module PY3MODULE: PY_ANY_MODULE {
  2545. PYTHON3_MODULE()
  2546. SET(MODULE_LANG PY3)
  2547. .RESTRICTED=PYTHON2_MODULE PYTHON2_ADDINCL
  2548. }
  2549. # tag:python-specific
  2550. ### @usage: PYTHON2_MODULE()
  2551. ###
  2552. ### Use in PY_ANY_MODULE to set it up for Python 2.x.
  2553. macro PYTHON2_MODULE() {
  2554. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2555. PEERDIR+=contrib/tools/python/lib
  2556. }
  2557. PYTHON2_ADDINCL()
  2558. }
  2559. # tag:python-specific
  2560. ### @usage: PYTHON3_MODULE()
  2561. ###
  2562. ### Use in PY_ANY_MODULE to set it up for Python 3.x.
  2563. macro PYTHON3_MODULE() {
  2564. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2565. PEERDIR+=contrib/tools/python3/lib
  2566. }
  2567. PYTHON3_ADDINCL()
  2568. }
  2569. # tag:r-specific
  2570. ### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2571. ###
  2572. ### The external module for R language.
  2573. ### 1. major_ver and minor_ver must be integers.
  2574. ### 2. The resulting .so will have the prefix "lib".
  2575. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2576. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2577. module R_MODULE: DLL_UNIT {
  2578. .SEM=CPP_DYN_LIBRARY_SEM
  2579. when ($DARWIN == "yes") {
  2580. LDFLAGS+=-flat_namespace -dynamiclib
  2581. }
  2582. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2583. MODULE_PREFIX=lib
  2584. MODULE_SUFFIX=.dll
  2585. }
  2586. ADDINCL(contrib/libs/r-lang)
  2587. }
  2588. ### @usage: DYNAMIC_LIBRARY_FROM(Paths)
  2589. ###
  2590. ### Use specified libraries as sources of DLL
  2591. macro DYNAMIC_LIBRARY_FROM(Path...) {
  2592. PEERDIR($Path)
  2593. WHOLE_ARCHIVE($Path)
  2594. }
  2595. ### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2596. ###
  2597. ### Dynamic library module definition.
  2598. ### 1. major_ver and minor_ver must be integers.
  2599. ### 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
  2600. ### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
  2601. ###
  2602. ### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
  2603. module DLL: DLL_UNIT {
  2604. .SEM=CPP_DYN_LIBRARY_SEM
  2605. SET(MAKE_ONLY_SHARED_LIB yes)
  2606. SET(MODULE_LANG CPP)
  2607. when ($OS_WINDOWS) {
  2608. MODULE_SUFFIX=.dll
  2609. }
  2610. # TODO: Make it possible to use this syntax
  2611. # DEFAULT(DLL_FOR_DIR no)
  2612. ### FIXME: XXX
  2613. ###when ($DLL_FOR_DIR != "no") {
  2614. ### SRCDIR($DLL_FOR_DIR)
  2615. ### ADDINCL($DLL_FOR_DIR)
  2616. ###}
  2617. }
  2618. ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
  2619. module DLL_TOOL: DLL {
  2620. .SEM=CPP_DYN_LIBRARY_SEM
  2621. # ymake resolves only program nodes as tools.
  2622. .NODE_TYPE=Program
  2623. }
  2624. ### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2625. ###
  2626. ### Executable dynamic library module definition.
  2627. ### 1. major_ver and minor_ver must be integers.
  2628. ### 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
  2629. ### 3. PREFIX allows you to change the prefix of the output file.
  2630. module SO_PROGRAM: DLL {
  2631. .CMD=LINK_EXEC_DYN_LIB
  2632. SET(MODULE_TYPE PROGRAM)
  2633. MODULE_PREFIX=
  2634. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2635. MODULE_SUFFIX=.exe
  2636. }
  2637. otherwise {
  2638. MODULE_SUFFIX=
  2639. }
  2640. }
  2641. DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
  2642. # tag:internal
  2643. ### @usage: DEV_DLL_PROXY() # internal
  2644. ###
  2645. ### The use of this module is strictly prohibited!!!
  2646. ### This is a temporary and project-specific solution.
  2647. module DEV_DLL_PROXY: _BARE_UNIT {
  2648. .NODE_TYPE=Library
  2649. .EXTS=.so .dll .dylib .mf
  2650. .CMD=DLL_PROXY_CMD_MF
  2651. DYNAMIC_LINK=yes
  2652. when ($OS_WINDOWS == "yes") {
  2653. MODULE_SUFFIX=.dll
  2654. }
  2655. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2656. MODULE_PREFIX=lib
  2657. MODULE_SUFFIX=.dylib$MODULE_VERSION
  2658. }
  2659. otherwise {
  2660. MODULE_PREFIX=lib
  2661. MODULE_SUFFIX=.so$MODULE_VERSION
  2662. }
  2663. }
  2664. # tag:internal
  2665. ### @usage: DLL_PROXY() # internal
  2666. ###
  2667. ### The use of this module is strictly prohibited!!!
  2668. ### This is a temporary and project-specific solution.
  2669. module DLL_PROXY: DEV_DLL_PROXY {
  2670. .EXTS=.so .dylib .lib .mf
  2671. .PROXY=yes
  2672. .PEERDIR_POLICY=as_build_from
  2673. SET(PEERDIR_TAGS DLL __EMPTY__)
  2674. when ($OS_WINDOWS == "yes") {
  2675. MODULE_SUFFIX=.lib
  2676. }
  2677. }
  2678. # tag:internal
  2679. ### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
  2680. ###
  2681. ### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
  2682. ### This it needed to transfer their outputs through the library to PROGRAM
  2683. ### or dependent DLL/DYNAMIC_LIBRARY.
  2684. ###
  2685. ### Note: this is temporary solution until support of `super-global` variables come
  2686. ### which will enable transfer of some properties though final targets like DLLs.
  2687. macro DYNAMIC_DEPS(Path...) {
  2688. # PEERDIR as macro completely ignored in place where this macro applies
  2689. SET_APPEND(PEERDIR $Path)
  2690. }
  2691. # tag:internal
  2692. ### @usage: DYNAMIC_LIBRARY() # internal
  2693. ###
  2694. ### The use of this module is strictly prohibited except LGPL-related opensourcing
  2695. ### This provides linkable DLL module which brings its results to programs and tests
  2696. ### for seamless testing and packaging
  2697. multimodule DYNAMIC_LIBRARY {
  2698. module DLL_BIN: DLL {
  2699. .PROXY=yes
  2700. .IGNORED=PROVIDES
  2701. SET(MODULE_TAG DLL)
  2702. }
  2703. module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
  2704. .CMD=TOUCH_UNIT_MF
  2705. .PEERDIRSELF=DLL_BIN
  2706. .IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
  2707. .ALLOWED=DYNAMIC_DEPS
  2708. SET(PEERDIR_TAGS DLL_LIB __EMPTY__)
  2709. _BARE_MODULE()
  2710. DYNAMIC_LINK=yes
  2711. MODULE_SUFFIX=.pkg.fake
  2712. PEERDIR+=build/platform/local_so
  2713. RESTRICT_PATH(contrib devtools/dummy_arcadia MSG Use of this module type outside contrib/libs is prohibited)
  2714. # disable credits generation for static library
  2715. SET(CREDITS_FLAGS)
  2716. }
  2717. }
  2718. ### @usage: GLOBAL_SRCS(filenames...)
  2719. ###
  2720. ### Make all source files listed as GLOBAL.
  2721. ### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
  2722. ### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
  2723. ### recognized for GLOBAL_SRCS in contrast to SRCS macro.
  2724. ###
  2725. ### @example:
  2726. ### Consider the file to ya.make:
  2727. ###
  2728. ### LIBRARY()
  2729. ### GLOBAL_SRCS(foo.cpp bar.cpp)
  2730. ### END()
  2731. ###
  2732. ### @see: [SRCS()](#macro_SRCS)
  2733. macro GLOBAL_SRCS(Files...) {
  2734. SRCS(${pre=GLOBAL :Files})
  2735. }
  2736. ### @usage: ALL_SRCS([GLOBAL] filenames...)
  2737. ###
  2738. ### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
  2739. ### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
  2740. ### as the first argument and is equivalent to call to SRCS macro otherwise.
  2741. ###
  2742. ### @example:
  2743. ###
  2744. ### LIBRARY()
  2745. ### SET(MAKE_IT_GLOBAL GLOBAL)
  2746. ### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
  2747. ### END()
  2748. ###
  2749. ### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
  2750. macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
  2751. SRCS(${pre=$GLOBAL :Files})
  2752. }
  2753. ### @usage: _DLL_COMPATIBLE_LIBRARY # internal
  2754. ###
  2755. ### Base module to place DLLs into multimodules back to back with libraries.
  2756. ### In order to function properly all modules in multimodule shall have the
  2757. ### same set of arguments. So this module is just library that accepts but
  2758. ### ignores all DLL arguments.
  2759. module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
  2760. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2761. .ARGS_PARSER=DLL
  2762. }
  2763. @import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
  2764. # as SRCS in packages use macro BUNDLE_SRCS!
  2765. PACKED_PACKAGE_ARGS=
  2766. PACKED_PACKAGE_EXT=
  2767. ### @usage: PACK(archive_type)
  2768. ###
  2769. ### 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`
  2770. ###
  2771. ### Is not allowed other module types than PACKAGE().
  2772. ###
  2773. ### @see: [PACKAGE()](#module_PACKAGE)
  2774. macro PACK(Ext) {
  2775. SET(PACKED_PACKAGE_EXT $Ext)
  2776. }
  2777. PACKAGE_STRICT_VALUE=
  2778. macro PACKAGE_STRICT() {
  2779. SET(PACKAGE_STRICT_VALUE yes)
  2780. }
  2781. ### @usage: PACKAGE(name)
  2782. ###
  2783. ### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
  2784. ### 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.
  2785. ### The data can be optionally packed if macro PACK() is used.
  2786. ###
  2787. ### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
  2788. ###
  2789. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2790. ###
  2791. ### @see: [PACK()](#macro_PACK)
  2792. module PACKAGE: _BASE_UNIT {
  2793. .CMD=TOUCH_PACKAGE_MF
  2794. .PEERDIR_POLICY=as_build_from
  2795. .ALL_INS_TO_OUT=yes
  2796. .FINAL_TARGET=yes
  2797. .ALLOWED=PACK
  2798. SET(MODULE_SUFFIX .pkg.fake)
  2799. SET(DONT_RESOLVE_INCLUDES yes)
  2800. NO_PLATFORM()
  2801. when ($PACKED_PACKAGE_EXT) {
  2802. PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
  2803. }
  2804. SET(NEED_PLATFORM_PEERDIRS no)
  2805. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL
  2806. }
  2807. TOUCH_GROUP=$TOUCH_PACKAGE ${kv;hide:"p CI"}
  2808. ### @usage: CI_GROUP()
  2809. ###
  2810. ### Module collects what is described directly inside it transitively by PEERDIRs.
  2811. ### No particular layout of built artifacts is implied. This module is needed primarily for CI dependency analysis and may not trigger builds at all.
  2812. ###
  2813. ### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
  2814. module CI_GROUP: _BARE_UNIT {
  2815. .CMD=TOUCH_GROUP
  2816. .PEERDIR_POLICY=as_build_from
  2817. .ALL_INS_TO_OUT=yes
  2818. .FINAL_TARGET=yes
  2819. .RESTRICTED=SRCS
  2820. MODULE_SUFFIX=.ci.pkg.fake
  2821. PEERDIR_TAGS=CPP_PROTO PY3 PY3_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE DLL
  2822. }
  2823. # tag:generic tag:internal
  2824. TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
  2825. # tag:proto
  2826. ### @usage: RESOLVE_PROTO()
  2827. ###
  2828. ### Enable include resolving within UNIONs and let system .proto being resolved
  2829. ### among .proto/.gztproto imports
  2830. ###
  2831. ### Note: it is currently impossible to enable resolving only for .proto, so resolving is enabled for all supported files
  2832. ### also we only add ADDINCL for stock protobuf. So use this macro with care: it may cause resolving problems those are
  2833. ### to be addressed by either ADDINCLs or marking them as TEXT. Please contact devtools for details.
  2834. macro RESOLVE_PROTO() {
  2835. SET(DONT_RESOLVE_INCLUDES no)
  2836. ADDINCL(FOR proto $PROTOBUF_PATH)
  2837. }
  2838. ### @usage: UNION(name)
  2839. ###
  2840. ### Collection of PEERDIR dependencies, files and artifacts.
  2841. ### UNION doesn't build its peers, just provides those to modules depending on it.
  2842. ### When specified in DEPENDS() macro the UNION is transitively closed, building all its peers and providing those by own paths (without adding this module path like PACKAGE does).
  2843. ###
  2844. ### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
  2845. ###
  2846. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2847. module UNION: _BASE_UNIT {
  2848. .ALL_INS_TO_OUT=yes
  2849. .FINAL_TARGET=no
  2850. NO_PLATFORM()
  2851. SET(MODULE_SUFFIX .pkg.fake)
  2852. SET(DONT_RESOLVE_INCLUDES yes)
  2853. .CMD=TOUCH_UNIT_MF
  2854. SET(NEED_PLATFORM_PEERDIRS no)
  2855. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN DLL
  2856. }
  2857. # tag:python-specific
  2858. module _PY_PACKAGE: UNION {
  2859. .EXTS=.py
  2860. .ALL_INS_TO_OUT=yes
  2861. .ALLOWED=GRPC USE_SKIFF
  2862. ENABLE(PY_PROTOS_FOR)
  2863. SET(PEERDIR_TAGS PY_PROTO)
  2864. SET(DONT_RESOLVE_INCLUDES no)
  2865. }
  2866. # tag:python-specific tag:deprecated tag:internal
  2867. ### @usage: PY_PACKAGE(name) # internal, deprecated
  2868. ###
  2869. ### This is module created via PY_PROTOS_FOR() macro
  2870. module PY_PACKAGE: _PY_PACKAGE {
  2871. .FINAL_TARGET=yes
  2872. }
  2873. # tag:internal
  2874. ### @usage: _SET_FIRST_VALUE(name args...) # internal
  2875. ###
  2876. ### This macro sets the value of `name` variable to the value of next argument
  2877. macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
  2878. SET($NAME $VALUE)
  2879. }
  2880. # tag:python-specific
  2881. PY_NAMESPACE_VALUE=
  2882. # tag:python-specific
  2883. ### @usage: PY_NAMESPACE(prefix)
  2884. ###
  2885. ### Sets default Python namespace for all python sources in the module.
  2886. ### Especially suitable in PROTO_LIBRARY where Python sources are generated and there is no PY_SRCS to place NAMESPACE parameter.
  2887. macro PY_NAMESPACE(Arg) {
  2888. SET(PY_NAMESPACE_VALUE $Arg)
  2889. }
  2890. # tag:internal
  2891. ### @usage: _SRCS_NO_GLOBAL(files...) # internal
  2892. ###
  2893. ### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
  2894. ### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
  2895. ### Note: this macro changes order of source files.
  2896. macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
  2897. SRCS($GLOBAL $FILES)
  2898. }
  2899. # tag:java-specific
  2900. JAVA_VCS_MF_ARG=
  2901. COMPILE_JAVA_MF=$COMPILE_JAVA
  2902. # tag:java-specific
  2903. when ($EXT_JAVA_VCS_INFO == "yes") {
  2904. JAVA_VCS_MF_ARG=--vcs-mf $VCS_JAVA
  2905. COMPILE_JAVA_MF=$GENERATE_VCS_JAVA_INFO_NODEP && $COMPILE_JAVA
  2906. }
  2907. # tag:java-specific
  2908. EXT_JAVA_VCS_INFO=no
  2909. ### @usage: EMBED_JAVA_VCS_INFO()
  2910. ###
  2911. ### Embed manifest with vcs info into `EXTERNAL_JAVA_LIBRARY`
  2912. ### By default this is disabled.
  2913. macro EMBED_JAVA_VCS_INFO() {
  2914. ENABLE(EXT_JAVA_VCS_INFO)
  2915. }
  2916. # tag:java-specific tag:internal
  2917. ### @usage: EXTERNAL_JAVA_LIBRARY() #internal
  2918. ###
  2919. ### EXTERNAL_JAVA_LIBRARY() is a module for creating a .jar file using non-Java code (generators etc.)
  2920. ### Unlike regular JAVA_LIBRARY this module doesn't produce .pom file, so it cannot be exported to Maven itself.
  2921. ### PEERDIR it from JAVA_LIBRARY or JAVA_PROGRAM for export to Maven.
  2922. module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
  2923. .EXTS=.jsrc .java .jar .mf
  2924. .NODE_TYPE=Bundle
  2925. .CMD=COMPILE_JAVA_MF
  2926. .PEERDIR_POLICY=as_build_from
  2927. .FINAL_TARGET=no
  2928. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  2929. .ALLOWED=EMBED_JAVA_VCS_INFO
  2930. .RESTRICTED=EXTERNAL_JAR
  2931. PEERDIR(build/platform/java/jdk)
  2932. PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR
  2933. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  2934. HAS_MANAGEABLE_PEERS=yes
  2935. DYNAMIC_LINK=yes
  2936. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  2937. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  2938. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  2939. when ($PACKAGE_PREFIX) {
  2940. PACKAGE_PREFIX_ARGS=--package-prefix=$PACKAGE_PREFIX
  2941. }
  2942. DISABLE(NEED_PLATFORM_PEERDIRS)
  2943. NO_PLATFORM()
  2944. SET(MODULE_SUFFIX .jar)
  2945. SET(MODULE_LANG JAVA)
  2946. }
  2947. # tag:java-specific
  2948. ALL_JAR_SOURCES=
  2949. LINT_JAVA_SOURCES=
  2950. ALL_SRCDIRS=
  2951. LINK_JAR_RESOURCES=
  2952. LINK_JAR_JSOURCES=
  2953. JAR_GEN_SRCS=
  2954. JAR_GEN_JSRCS=
  2955. macro _JAR_SRCS(SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], RESOURCES?"yes":"no", Globs...) {
  2956. _CHECK_JAVA_SRCDIR($SRCDIR)
  2957. SET_APPEND(ALL_SRCDIRS $SRCDIR)
  2958. SET(VAR_SALT $SRCDIR $Globs $EXCLUDE $PACKAGE_PREFIX $RESOURCES $FILES)
  2959. SET(JAR_SRCS_GLOB uniq_${hash:VAR_SALT})
  2960. _LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE})
  2961. SET_APPEND(LINT_JAVA_SOURCES \${input;rootrel;ext=.java:${JAR_SRCS_GLOB}})
  2962. 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})
  2963. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_RESOURCES ${quo:SRCDIR} ${BINDIR}/cls ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt)
  2964. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_JSOURCES ${quo:SRCDIR} ${BINDIR}/src ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt)
  2965. _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)
  2966. _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)
  2967. }
  2968. macro IDEA_JAR_SRCS(Args...) {
  2969. _JAR_SRCS($Args)
  2970. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  2971. }
  2972. macro _HASH_HELPER(Args...) {
  2973. .CMD=${hash:Args}
  2974. .SEM=${hash:Args}
  2975. }
  2976. macro _GENTAR_HELPER(OUT_DIR[], Args...) {
  2977. .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"}
  2978. }
  2979. # tag:java-specific
  2980. RUN_JAR_PROG_CP_PRE=@
  2981. RUN_JAR_PROG_CP_SUF=.cplst
  2982. when($JDK_VERSION == "8") {
  2983. RUN_JAR_PROG_CP_PRE=
  2984. RUN_JAR_PROG_CP_SUF=
  2985. }
  2986. # tag:java-specific
  2987. macro _DO_2_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq_", IN_DIRS_INPUTS[], IN{input}[], IN_NOPARSE{input}[], IN_DIR[], OUT_NOAUTO{output}[], OUT{output}[], TOOL{tool}[], OUT_DIR[], CLASSPATH[], ADD_SRCS_TO_CLASSPATH?"yes":"no", CWD="${ARCADIA_BUILD_ROOT}", Args...) {
  2988. _LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR})
  2989. _CHECK_RUN_JAVA_PROG_CLASSPATH($CLASSPATH)
  2990. .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
  2991. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} ${OUT_DIR} && ${cwd:CWD} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} $YMAKE_PYTHON ${input:"build/scripts/fix_java_command_file_cp.py"} --build-root ${ARCADIA_BUILD_ROOT} $JDK_RESOURCE/bin/java -Dfile.encoding=utf8 -classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} ${Args} && $_GENTAR_HELPER($CLASSPATH $IN_DIR $IN $IN_NOPARSE $TOOL $Args OUT_DIR $OUT_DIR) ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output;noauto;hide:OUT_NOAUTO} ${output;hide:OUT} ${tool;hide:TOOL} ${IN_DIRS_INPUTS}
  2992. }
  2993. # tag:java-specific
  2994. macro _DO_1_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq", Args...) {
  2995. _DO_2_RUN_JAR_PROGRAM($Args IN_DIRS_VAR $IN_DIRS_VAR IN_DIRS_INPUTS ${"$"}{input;hide:$IN_DIRS_VAR})
  2996. }
  2997. # tag:java-specific
  2998. macro RUN_JAVA_PROGRAM(Args...) {
  2999. _DO_1_RUN_JAR_PROGRAM($Args IN_DIRS_VAR uniq_${hash:Args})
  3000. }
  3001. # tag:java-specific
  3002. _JAR_ANN_PROCESSORS=
  3003. _JAR_ANN_PROC_OPT_PREFIX=
  3004. macro JAR_ANNOTATION_PROCESSOR(Classes...) {
  3005. SET_APPEND(_JAR_ANN_PROCESSORS $Classes)
  3006. SET(_JAR_ANN_PROC_OPT_PREFIX -processor)
  3007. # for ya ide idea only
  3008. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Classes)
  3009. }
  3010. # tag:java-specific
  3011. macro _JAR_ANN_PROC_OPTS(Classes...) {
  3012. .CMD=$_JAR_ANN_PROC_OPT_PREFIX ${join=,:Classes}
  3013. }
  3014. # tag:java-specific
  3015. macro _NOOP_MACRO(Args...) {
  3016. ENABLE(UNUSED_MACRO)
  3017. }
  3018. # tag:java-specific
  3019. module _JAR_BASE: _BARE_UNIT {
  3020. .NODE_TYPE=Bundle
  3021. .CMD=TOUCH_UNIT
  3022. .PEERDIR_POLICY=as_build_from
  3023. .FINAL_TARGET=no
  3024. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  3025. .ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE
  3026. .DEFAULT_NAME_GENERATOR=TwoDirNames
  3027. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__
  3028. HAS_MANAGEABLE_PEERS=yes
  3029. DYNAMIC_LINK=yes
  3030. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  3031. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  3032. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  3033. DISABLE(NEED_PLATFORM_PEERDIRS)
  3034. NO_PLATFORM()
  3035. VCS_JAVA=${suf=.__vcs_version__.mf:TARGET}
  3036. SET(MODULE_LANG JAVA)
  3037. }
  3038. # tag:java-specific
  3039. module JAVA_CONTRIB_PROXY: _JAR_BASE {
  3040. }
  3041. # tag:java-specific
  3042. macro _FETCH_CONTRIB(Id, Out, SBR="sbr:") {
  3043. .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"}
  3044. ADD_CHECK(check.resource $Id)
  3045. }
  3046. # tag:java-specific
  3047. LOCAL_JAR_PATH=
  3048. LOCAL_SOURCES_JAR_PATH=
  3049. JAR_RESOURCE_ID=
  3050. SRC_RESOURCE_ID=
  3051. FETCH_SRCS_JAR=
  3052. FETCH_TARGET_JAR=
  3053. FETCH_CONTRIB_JAR=$FETCH_TARGET_JAR $FETCH_SRCS_JAR
  3054. # tag:java-specific
  3055. macro JAR_RESOURCE(Id) {
  3056. SET(JAR_RESOURCE_ID $Id)
  3057. }
  3058. # tag:java-specific
  3059. macro SRC_RESOURCE(Id) {
  3060. SET(SRC_RESOURCE_ID $Id)
  3061. }
  3062. # tag:java-specific
  3063. macro LOCAL_JAR(File) {
  3064. SET(LOCAL_JAR_PATH $File)
  3065. }
  3066. # tag:java-specific
  3067. macro LOCAL_SOURCES_JAR(File) {
  3068. SET(LOCAL_SOURCES_JAR_PATH $File)
  3069. }
  3070. # tag:java-specific
  3071. module JAVA_CONTRIB: _JAR_BASE {
  3072. .CMD=FETCH_CONTRIB_JAR
  3073. .FINAL_TARGET=yes
  3074. when ($JAR_RESOURCE_ID) {
  3075. FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX})
  3076. }
  3077. otherwise {
  3078. when ($LOCAL_JAR_PATH) {
  3079. FETCH_TARGET_JAR= && $FS_TOOLS copy ${input:LOCAL_JAR_PATH} $TARGET
  3080. }
  3081. otherwise {
  3082. FETCH_TARGET_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:BINDIR} $JDK_RESOURCE/bin/jar cfvm $TARGET $VCS_JAVA .
  3083. PEERDIR+=build/platform/java/jdk
  3084. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3085. }
  3086. }
  3087. when ($SRC_RESOURCE_ID) {
  3088. FETCH_SRCS_JAR= && $_FETCH_CONTRIB($SRC_RESOURCE_ID ${BINDIR}/${REALPRJNAME}-sources.jar)
  3089. }
  3090. otherwise {
  3091. when ($LOCAL_SOURCES_JAR_PATH) {
  3092. FETCH_SRCS_JAR= && $FS_TOOLS copy ${input:LOCAL_SOURCES_JAR_PATH} {output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME}
  3093. }
  3094. otherwise {
  3095. 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 .
  3096. PEERDIR+=build/platform/java/jdk
  3097. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3098. }
  3099. }
  3100. SET(MODULE_SUFFIX .jar)
  3101. }
  3102. MAKE_JAVA_CLASSPATH_FILE=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} ${input;hide:"build/scripts/process_command_files.py"}
  3103. # tag:kotlin-specific
  3104. KOTLINC_OPTS_VALUE=
  3105. # tag:kotlin-specific
  3106. KT_SRSCLIST_FLAG=--kotlin ${BINDIR}/misc/all-kt-sources.txt
  3107. KT_CLASSES_DIR=${BINDIR}/kt_cls
  3108. COLLECT_KT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/kt_bfg.txt -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file
  3109. LINK_KT_CLASSPATH=${MAKE_JAVA_CLASSPATH_FILE} ${BINDIR}/kt_bfg.txt ${BINDIR}/kt_cp.txt && $FS_TOOLS md $KT_CLASSES_DIR
  3110. 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
  3111. ALL_KT_COMMANDS=
  3112. KT_CLASSPATH_ITEM=
  3113. # tag:java-specific
  3114. JAVAC_CMD=$JDK_RESOURCE/bin/javac
  3115. 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
  3116. # tag:java-specific tag:codenav
  3117. JAVA_YNDEXING=no
  3118. # tag:java-specific
  3119. when ($USE_SYSTEM_KYTHE) {
  3120. KYTHE_RESOURCE=$USE_SYSTEM_KYTHE
  3121. }
  3122. otherwise {
  3123. KYTHE_RESOURCE=$KYTHE_RESOURCE_GLOBAL
  3124. }
  3125. # tag:java-specific tag:codenav
  3126. _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
  3127. _DO_JAVA_YNDEXING=
  3128. # tag:java-specific
  3129. SOURCES_JAR=no
  3130. _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 .
  3131. _PACK_SRC_JAR=
  3132. # tag:java-specific
  3133. _PACK_JNI=
  3134. _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
  3135. # tag:java-specific
  3136. _MAKE_JSTYLE_FILE_LIST=
  3137. # tag:java-specific
  3138. _LINK_UBERJAR=
  3139. _UBERJAR_SELF=
  3140. _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} \
  3141. && $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} $BINDIR/_empty/META-INF \
  3142. && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} $BINDIR/_empty/META-INF/MANIFEST.MF \
  3143. && $UPDATE_VCS_JAVA_INFO_NODEP($TARGET) \
  3144. && ${cwd;suf=/_empty:BINDIR} ${JDK_RESOURCE}/bin/jar ufv ${TARGET} META-INF/MANIFEST.MF \
  3145. && $JDK_RESOURCE/bin/jar ufvm $TARGET $VCS_JAVA
  3146. # tag:java-specific
  3147. macro _PACK_JAR_HELPER(Out) {
  3148. .CMD=${cwd;suf=/cls:BINDIR} $JDK_RESOURCE/bin/jar cfvm $Out $VCS_JAVA .
  3149. }
  3150. # tag:java-specific
  3151. macro _JAVAC_RUN_HELPER(JAVAC_CMD_WITH_ARGS...) {
  3152. .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
  3153. }
  3154. macro _ADD_HIDDEN_INPUTS(Inputs...) {
  3155. .CMD=${input;hide:Inputs}
  3156. }
  3157. # tag:java-specific
  3158. 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
  3159. ERROR_PRONE_2_7_1_FORCED_OPTS=-Xep:InlineMeInliner:OFF -Xep:SameNameButDifferent:OFF
  3160. # tag:java-specific
  3161. JAVA_COVERAGE_SRCLIST_FLAG=--coverage ${output;pre=${MODULE_PREFIX};suf=.cpsf:REALPRJNAME} --source-root ${ARCADIA_ROOT}
  3162. JAVA_COVERAGE_SRCLIST=
  3163. PREPARE_JAVA_BUILD_DIRS=$FS_TOOLS md ${BINDIR}/cls && $FS_TOOLS md ${BINDIR}/misc
  3164. EXTRACT_GENDIRS=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --unpack --ext .gentar ${ext=.gentar:AUTO_INPUT}
  3165. COLLECT_JAVA_SRCLIST=${YMAKE_PYTHON} ${input:"build/scripts/make_java_srclists.py"} ${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/java_pack_to_file.py"} --moddir ${CURDIR} --java ${BINDIR}/all-java.srclst ${KT_SRSCLIST} ${JAVA_COVERAGE_SRCLIST} --ya-start-command-file ${ALL_JAR_SOURCES} ${ext=.java:AUTO_INPUT} ${ext=.kt:AUTO_INPUT} --ya-end-command-file
  3166. COLLECT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/bfg.txt -m --ya-start-command-file ${rootrel:MANAGED_PEERS_CLOSURE} $KT_CLASSPATH_ITEM --ya-end-command-file
  3167. LINK_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/bfg.txt ${ARCADIA_BUILD_ROOT}/bfg.jar
  3168. COMPILE_JAVA_SRCLIST=$_JAVAC_RUN_HELPER($JAVAC_CMD)
  3169. PACK_JAR=$_PACK_JAR_HELPER($TARGET)
  3170. # NOTE: No && before LINK_JAR_RESOURCES, ALL_KT_COMMANDS and JAR_GEN_SRCS needed since those vars either empty or starts with &&
  3171. LINK_JAR=$PREPARE_JAVA_BUILD_DIRS \
  3172. && $EXTRACT_GENDIRS \
  3173. && $COLLECT_JAVA_SRCLIST \
  3174. $JAR_GEN_SRCS \
  3175. $ALL_KT_COMMANDS \
  3176. && $COLLECT_CLASSPATH \
  3177. && $LINK_CLASSPATH \
  3178. && $COMPILE_JAVA_SRCLIST \
  3179. $LINK_JAR_RESOURCES \
  3180. && ${cwd;suf=/cls:BINDIR} $GENERATE_VCS_JAVA_INFO_NODEP . \
  3181. $_PACK_SRC_JAR \
  3182. $_PACK_JNI \
  3183. && $PACK_JAR \
  3184. $_DO_JAVA_YNDEXING \
  3185. ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} \
  3186. $_MAKE_JSTYLE_FILE_LIST \
  3187. $_LINK_UBERJAR \
  3188. $_ADD_HIDDEN_INPUTS($JAVA_EXTERNAL_DEPENDENCIES_VALUE)
  3189. # tag:java-specific
  3190. _EXT_SRC_JAR=
  3191. _EXT_JAR=
  3192. _COPY_EXT_SRC_JAR=
  3193. _DO_USE_EXT_JAR=$FS_TOOLS copy ${input:_EXT_JAR} $TARGET $_COPY_EXT_SRC_JAR
  3194. _DO_COPY_EXT_SRC_JAR= && $FS_TOOLS copy $_EXT_SRC_JAR ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
  3195. macro JAVA_RESOURCE(JAR, SOURCES="") {
  3196. SET(_EXT_SRC_JAR $SOURCES)
  3197. SET(_EXT_JAR $JAR)
  3198. }
  3199. # tag:java-specific tag:fbs
  3200. JAVA_FLATBUFFERS_VERSION = 2.0.0
  3201. # tag:java-specific
  3202. module _COMPILABLE_JAR_BASE : _JAR_BASE {
  3203. # flatbuffers-java
  3204. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3205. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3206. # protobuf-java
  3207. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3208. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3209. # protobuf-javalite
  3210. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3211. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3212. # protobuf-java-util
  3213. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  3214. 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})
  3215. }
  3216. # tag:java-specific tag:internal
  3217. ### @usage: JAR_LIBRARY() #internal
  3218. ###
  3219. ### Reimplementation of the JAVA_LIBRARY with ymake.core.conf and ymake based dependency management
  3220. module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
  3221. .EXTS=.jsrc .java .jar .mf .gentar .kt
  3222. .CMD=LINK_JAR
  3223. .FINAL_TARGET=yes
  3224. .ALIASES=JAVA_SRCS=IDEA_JAR_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
  3225. .RESTRICTED=EXTERNAL_JAR
  3226. MODULE_SUFFIX=.jar
  3227. PEERDIR(build/platform/java/jdk)
  3228. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3229. when ($_EXT_SRC_JAR) {
  3230. _COPY_EXT_SRC_JAR=_DO_COPY_EXT_SRC_JAR
  3231. }
  3232. when ($_EXT_JAR) {
  3233. LINK_JAR=$_DO_USE_EXT_JAR
  3234. }
  3235. # in the ideal world this statement must be under condition bellow
  3236. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
  3237. when ($WITH_KOTLIN_VALUE) {
  3238. KT_SRSCLIST=$KT_SRSCLIST_FLAG
  3239. ALL_KT_COMMANDS=&& $COLLECT_KT_CLASSPATH && $LINK_KT_CLASSPATH && $COMPILE_KT
  3240. LINK_JAR_RESOURCES+=&& $FS_TOOLS copy_all_files ${KT_CLASSES_DIR} ${BINDIR}/cls
  3241. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  3242. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  3243. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  3244. }
  3245. when($WITH_KOTLINC_PLUGIN_NOARG) {
  3246. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  3247. }
  3248. # Must be in sync with KT_CLASSES_DIR!
  3249. # There are problems in JDK13 with abs paths in classpath baked into jar file manifest. Using relative path
  3250. # here assumes that jar file with classpath for javac located in the $ARCADIA_BUILD_ROOT
  3251. KT_CLASSPATH_ITEM=$MODDIR/kt_cls
  3252. }
  3253. otherwise {
  3254. KT_SRSCLIST=
  3255. ALL_KT_COMMANDS=
  3256. KT_CLASSES=
  3257. }
  3258. when ($SOURCES_JAR == "yes") {
  3259. _PACK_SRC_JAR=$_PACK_SRC_JAR_IMPL
  3260. }
  3261. when ($JAVA_COVERAGE == "yes") {
  3262. JAVA_COVERAGE_SRCLIST=$JAVA_COVERAGE_SRCLIST_FLAG
  3263. }
  3264. when ($MAKE_UBERJAR_VALUE == "yes") {
  3265. _LINK_UBERJAR=$_DO_LINK_UBERJAR
  3266. PACK_JAR=$_PACK_JAR_HELPER(${BINDIR}/${REALPRJNAME}.lib.jar)
  3267. # TODO: This condition is incorrect in case of autoinputs _UBERJAR_SELF should be empty only for
  3268. # modules without AUTO_INPUT and without JAVA_SRCS added inputs.
  3269. when($ALL_JAR_SOURCES) {
  3270. _UBERJAR_SELF=--jar ${BINDIR}/${REALPRJNAME}.lib.jar
  3271. }
  3272. PEERDIR+=build/platform/java/uberjar
  3273. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  3274. }
  3275. when($JAVA_YNDEXING == "yes") {
  3276. PEERDIR+=build/platform/java/kythe
  3277. _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"}
  3278. }
  3279. when($ERROR_PRONE_VALUE) {
  3280. PEERDIR+=$ERROR_PRONE_PEERDIR
  3281. JAVAC_CMD=$ERROR_PRONE_JAVAC_CMD
  3282. }
  3283. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
  3284. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3285. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3286. }
  3287. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "17") {
  3288. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3289. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3290. }
  3291. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  3292. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3293. JAVAC_OPTS+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3294. }
  3295. when ($JAVA_ADD_DLLS_VALUE == "yes") {
  3296. CONSUME_NON_MANAGEABLE_PEERS=yes
  3297. _PACK_JNI=$_PACK_JNI_CMD
  3298. }
  3299. when ($LINT_LEVEL_VALUE != "none") {
  3300. _MAKE_JSTYLE_FILE_LIST= && ${WRITER_PY} --file ${output;noauto:"lint-java.srclst"} -m --ya-start-command-file $LINT_JAVA_SOURCES --ya-end-command-file
  3301. }
  3302. SET(MODULE_TYPE JAVA_LIBRARY)
  3303. ENABLE(YMAKE_JAVA_TEST)
  3304. _ADD_JAVA_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/lint-java.srclst::$(SOURCE_ROOT))
  3305. _ADD_CLASSPATH_CLASH_CHECK()
  3306. JAVA_MODULE(IDEA_ONLY)
  3307. }
  3308. # tag:java-specific
  3309. _SCRIPTGEN_FLAGS=
  3310. macro _GEN_JAVA_SCRIPT_IMPL(Out, Template, Props...) {
  3311. .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
  3312. }
  3313. # tag:java-specific
  3314. _GEN_USERSCRIPTS=
  3315. macro _ADD_GEN_JAVA_SCRIPT(Out, Template, Props...) {
  3316. SET_APPEND(_GEN_USERSCRIPTS && \$_GEN_JAVA_SCRIPT_IMPL($Out $Template $Props))
  3317. }
  3318. # tag:java-specific
  3319. _PACK_JDK=
  3320. # tag:java-specific
  3321. DO_GEN_JAVA_RUN_SH=
  3322. _SOURCE_JARS=
  3323. _SOURCE_JARS_CPLIST=
  3324. GEN_JAVA_RUN_SH=$SCRIPTGEN_RESOURCE_GLOBAL/scriptgen --java $JDK_RESOURCE/bin/java --output ${output:"run.sh"} -D GENERATE_DEFAULT_RUNNER=yes -D JAR_NAME=${REALPRJNAME}.jar -D CLASSPATH=${nopath;join;pre="::":MANAGED_PEERS_CLOSURE} -D PROJECT_DIR=${REALPRJNAME} -D JAR_BASENAME=${REALPRJNAME}
  3325. GEN_RUN_CP=${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${nopath;qe;pre=$REALPRJNAME/:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET}
  3326. 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}
  3327. MAKE_JAR_PROGRAM_CPLST=${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} --ya-start-command-file ${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS_CPLIST} --ya-end-command-file
  3328. TAR_CLASSPATH= && $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} ${output;pre=$MODULE_PREFIX;suf=.tar:REALPRJNAME} ${cwd;pre=$BINDIR/:REALPRJNAME}
  3329. DO_TAR_CLASSPATH=
  3330. 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"}
  3331. # tag:java-specific
  3332. # UBERJAR program link command
  3333. LINK_UBERJAR_PROGRAM=${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} $TARGET \
  3334. && $FS_TOOLS md ${BINDIR}/${REALPRJNAME} \
  3335. && $FS_TOOLS link_or_copy ${BINDIR}/${REALPRJNAME}.jar $TARGET \
  3336. && $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} \
  3337. $DO_TAR_CLASSPATH \
  3338. $_GEN_USERSCRIPTS \
  3339. $_PACK_JDK
  3340. # tag:java-specific
  3341. RUN_WITH_SOURCES=no
  3342. # TODO jbuild creates tar with all classpath deps by default and some projects rely on this. In ymake build this tar file creation is not needed and should be disabled by default in future
  3343. TARED_CLASSPATH=yes
  3344. _JAR_SRCS_CALLED=no
  3345. # tag:java-specific
  3346. macro _MARK_JAVA_PROG_WITH_SOURCES(Args...) {
  3347. ENABLE(_JAR_SRCS_CALLED)
  3348. }
  3349. # tag:java-specific
  3350. module _JAR_RUNNABLE: _COMPILABLE_JAR_BASE {
  3351. .FINAL_TARGET=yes
  3352. .CMD=LINK_JAR_PROGRAM
  3353. .ALIASES=JAVA_SRCS=_MARK_JAVA_PROG_WITH_SOURCES GENERATE_SCRIPT=_YMAKE_GENERATE_SCRIPT
  3354. MODULE_SUFFIX=.run.cp.jar
  3355. CONSUME_NON_MANAGEABLE_PEERS=yes
  3356. when ($RUN_WITH_SOURCES == "yes") {
  3357. _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}
  3358. _SOURCE_JARS_CPLIST=${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
  3359. }
  3360. when ($TARED_CLASSPATH == "yes") {
  3361. DO_TAR_CLASSPATH=$TAR_CLASSPATH
  3362. }
  3363. when ($DISABLE_SCRIPTGEN) {
  3364. DO_GEN_JAVA_RUN_SH=
  3365. }
  3366. otherwise {
  3367. DO_GEN_JAVA_RUN_SH=$GEN_JAVA_RUN_SH
  3368. PEERDIR+=build/platform/java/scriptgen
  3369. }
  3370. when ($WITH_JDK_VALUE) {
  3371. _PACK_JDK= && ${YMAKE_PYTHON} ${input:"build/scripts/tar_directory.py"} ${output;tared:"jdk.tar"} $WITH_JDK_RESOURCE $WITH_JDK_RESOURCE
  3372. }
  3373. when ($MAKE_UBERJAR_VALUE == "yes") {
  3374. LINK_JAR_PROGRAM=$LINK_UBERJAR_PROGRAM
  3375. DYNAMIC_LINK=no
  3376. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=yes
  3377. }
  3378. otherwise {
  3379. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=no
  3380. }
  3381. CHECK_PROVIDES()
  3382. }
  3383. # tag:java-specific
  3384. multimodule JAR_PROGRAM {
  3385. module JAR_RUNNABLE: _JAR_RUNNABLE {
  3386. .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
  3387. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3388. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
  3389. .PEERDIRSELF=JAR_COMPILATION
  3390. SET(MODULE_TYPE JAVA_PROGRAM)
  3391. }
  3392. module JAR_COMPILATION: JAR_LIBRARY {
  3393. .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
  3394. .FINAL_TARGET=no
  3395. SET(MODULE_TYPE JAVA_PROGRAM)
  3396. }
  3397. }
  3398. # tag:java-specific
  3399. LINK_JAR_TEST=${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET}
  3400. YMAKE_JAVA_TEST=
  3401. module _JAR_TEST: _COMPILABLE_JAR_BASE {
  3402. .FINAL_TARGET=yes
  3403. .CMD=LINK_JAR_TEST
  3404. .DEFAULT_NAME_GENERATOR=FullPath
  3405. CONSUME_NON_MANAGEABLE_PEERS=yes
  3406. SET(MODULE_SUFFIX .test.cp.jar)
  3407. ENABLE(YMAKE_JAVA_TEST)
  3408. JAVA_TEST()
  3409. CHECK_PROVIDES()
  3410. }
  3411. # tag:java-specific
  3412. multimodule JUNIT5_YMAKE {
  3413. module JAR_TESTABLE: _JAR_TEST {
  3414. .ALLOWED=JAVA_TEST_PEERDIR
  3415. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3416. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_TEST_PEERDIR=PEERDIR
  3417. .PEERDIRSELF=JAR_COMPILATION
  3418. SET(MODULE_TYPE JUNIT5)
  3419. }
  3420. module JAR_COMPILATION: JAR_LIBRARY {
  3421. .IGNORED=JAVA_TEST_PEERDIR
  3422. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO
  3423. .FINAL_TARGET=no
  3424. PEERDIR(devtools/junit5-runner build/platform/java/jacoco-agent)
  3425. }
  3426. }
  3427. # tag:java-specific
  3428. multimodule JTEST_YMAKE {
  3429. module JAR_TESTABLE: _JAR_TEST {
  3430. .ALLOWED=YT_SPEC
  3431. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3432. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_TEST_PEERDIR=PEERDIR
  3433. .PEERDIRSELF=JAR_COMPILATION
  3434. SET(MODULE_TYPE JTEST)
  3435. PEERDIR(devtools/junit-runner)
  3436. 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)
  3437. }
  3438. module JAR_COMPILATION: JAR_LIBRARY {
  3439. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO
  3440. .ALLOWED=YT_SPEC
  3441. .FINAL_TARGET=no
  3442. DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
  3443. PEERDIR(build/platform/java/jacoco-agent)
  3444. }
  3445. }
  3446. # tag:python-specific tag:deprecated
  3447. ### @usage: PY2_LIBRARY() # deprecated
  3448. ###
  3449. ### Deprecated. Use PY23_LIBRARY or PY3_LIBRARY instead.
  3450. ### Python 2.x binary built library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM.
  3451. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3452. ### This module is only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3453. ### This module is only compatible with Arcadia Python build.
  3454. ###
  3455. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3456. module PY2_LIBRARY: _LIBRARY {
  3457. _ARCADIA_PYTHON_ADDINCL()
  3458. when ($NO_PYTHON_INCLS != "yes") {
  3459. PEERDIR+=contrib/libs/python
  3460. }
  3461. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3462. MODULE_PREFIX=py
  3463. }
  3464. otherwise {
  3465. MODULE_PREFIX=libpy
  3466. }
  3467. .ALLOWED=FORK_TESTS
  3468. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3469. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS STYLE_PYTHON
  3470. USE_GLOBAL_CMD=yes
  3471. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3472. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3473. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3474. 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}"})
  3475. }
  3476. SET(MODULE_LANG PY2)
  3477. ADD_CLANG_TIDY()
  3478. }
  3479. # tag:python-specific
  3480. ### @usage: PY3_LIBRARY()
  3481. ###
  3482. ### Python 3.x binary library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM
  3483. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3484. ### This module is only compatible with PYTHON3-tagged modules and selects those from multimodules.
  3485. ### This module is only compatible with Arcadia Python build.
  3486. ###
  3487. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3488. module PY3_LIBRARY: _LIBRARY {
  3489. _ARCADIA_PYTHON3_ADDINCL()
  3490. when ($NO_PYTHON_INCLS != "yes") {
  3491. PEERDIR+=contrib/libs/python
  3492. }
  3493. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3494. MODULE_PREFIX=py
  3495. }
  3496. otherwise {
  3497. MODULE_PREFIX=libpy
  3498. }
  3499. .ALLOWED=FORK_TESTS
  3500. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3501. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2 OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3502. USE_GLOBAL_CMD=yes
  3503. PEERDIR($YMAKE_PYTHON3_PEER)
  3504. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3505. PYTHON_TYPE_FOR_CYTHON=PY3
  3506. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3507. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3508. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3509. 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}"})
  3510. }
  3511. SET(MODULE_LANG PY3)
  3512. ADD_CLANG_TIDY()
  3513. }
  3514. # tag:python-specific
  3515. ### @usage: _BASE_PY_PROGRAM #internal
  3516. ###
  3517. ### The base module for all Python 2.x binary programs. Adds linking logic, relevant module properties and
  3518. ### dependency on Python 2.x interpreter. Also adds import tests on all sources including PEERDIR'ed libraries.
  3519. ### Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  3520. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3521. ###
  3522. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3523. module _BASE_PY_PROGRAM: _BASE_PROGRAM {
  3524. .CMD=PY_PROGRAM_LINK_EXE
  3525. _ARCADIA_PYTHON_ADDINCL()
  3526. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3527. NO_CHECK_IMPORTS_FOR_VALUE=
  3528. }
  3529. ADD_CHECK_PY_IMPORTS()
  3530. when ($NO_PYTHON_INCLS != "yes") {
  3531. PEERDIR += contrib/libs/python
  3532. }
  3533. when ($USE_ARCADIA_PYTHON == "yes") {
  3534. PEERDIR += library/python/runtime/main
  3535. PEERDIR += contrib/deprecated/python/subprocess32
  3536. when ($PYTHON_SQLITE3 != "no") {
  3537. PEERDIR += contrib/tools/python/src/Modules/_sqlite
  3538. }
  3539. }
  3540. when ($PYTHON_COVERAGE == "yes") {
  3541. PEERDIR+=library/python/coverage
  3542. }
  3543. when ($ARCH_PPC64LE == "yes") {
  3544. _MY_ALLOCATOR=SYSTEM
  3545. }
  3546. otherwise {
  3547. _MY_ALLOCATOR=J
  3548. }
  3549. ALLOCATOR($_MY_ALLOCATOR)
  3550. STRIP()
  3551. when ($BUILD_TYPE == "DEBUG") {
  3552. NO_STRIP=yes
  3553. }
  3554. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3555. NO_STRIP=yes
  3556. }
  3557. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3558. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3559. SET(MODULE_LANG PY2)
  3560. }
  3561. # tag:python-specific tag:codenav
  3562. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3563. PY3_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"py3yndex $TARGET"}
  3564. }
  3565. otherwise {
  3566. PY3_PROGRAM_LINK_EXE=$LINK_EXE
  3567. }
  3568. # tag:python-specific
  3569. ### @usage: _BASE_PY_PROGRAM #internal
  3570. ###
  3571. ### The base module for all Python 3.x binary programs. Adds linking logic, relevant module properties and
  3572. ### dependency on Python 3.x interpreter. Also adds import tests on all sources including libraries.
  3573. ### Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  3574. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules
  3575. ###
  3576. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3577. module _BASE_PY3_PROGRAM: _BASE_PROGRAM {
  3578. .CMD=PY3_PROGRAM_LINK_EXE
  3579. _ARCADIA_PYTHON3_ADDINCL()
  3580. PEERDIR(library/python/runtime_py3/main)
  3581. when ($PYTHON_SQLITE3 != "no") {
  3582. PEERDIR += contrib/tools/python3/src/Modules/_sqlite
  3583. }
  3584. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3585. NO_CHECK_IMPORTS_FOR_VALUE=
  3586. }
  3587. ADD_CHECK_PY_IMPORTS()
  3588. when ($ARCH_PPC64LE == "yes") {
  3589. _MY_ALLOCATOR=SYSTEM
  3590. }
  3591. otherwise {
  3592. _MY_ALLOCATOR=J
  3593. }
  3594. ALLOCATOR($_MY_ALLOCATOR)
  3595. STRIP()
  3596. when ($NO_PYTHON_INCLS != "yes") {
  3597. PEERDIR+=contrib/libs/python
  3598. }
  3599. when ($BUILD_TYPE == "DEBUG") {
  3600. NO_STRIP=yes
  3601. }
  3602. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3603. NO_STRIP=yes
  3604. }
  3605. when ($PYTHON_COVERAGE == "yes") {
  3606. PEERDIR+=library/python/coverage
  3607. }
  3608. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3609. PEERDIR += contrib/python/six
  3610. }
  3611. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3612. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2
  3613. SET(MODULE_LANG PY3)
  3614. }
  3615. # tag:python-specific
  3616. ### @usage: PY3_PROGRAM_BIN([progname])
  3617. ### Use instead of PY3_PROGRAM only if ya.make with PY3_PROGRAM() included in another ya.make
  3618. ### In all other cases use PY3_PROGRAM
  3619. module PY3_PROGRAM_BIN: _BASE_PY3_PROGRAM {
  3620. # Look's like we cannot avoid copy-paste util ymake supports multiple inheritance
  3621. # We need to attach coverage.extractor to every py_program target, except pytest targets
  3622. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  3623. }
  3624. # tag:java-specific
  3625. JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
  3626. # tag:java-specific
  3627. JDK_REAL_VERSION=
  3628. JDK_VERSION=
  3629. when ($JDK_VERSION == "17") {
  3630. JDK_REAL_VERSION=17
  3631. }
  3632. elsewhen ($JDK_VERSION == "16") {
  3633. JDK_REAL_VERSION=16
  3634. }
  3635. elsewhen ($JDK_VERSION == "15") {
  3636. JDK_REAL_VERSION=15
  3637. }
  3638. elsewhen ($JDK_VERSION == "14") {
  3639. JDK_REAL_VERSION=14
  3640. }
  3641. elsewhen ($JDK_VERSION == "13") {
  3642. JDK_REAL_VERSION=13
  3643. }
  3644. elsewhen ($JDK_VERSION == "12") {
  3645. JDK_REAL_VERSION=12
  3646. }
  3647. elsewhen ($JDK_VERSION == "11") {
  3648. JDK_REAL_VERSION=11
  3649. }
  3650. elsewhen ($JDK_VERSION == "10") {
  3651. JDK_REAL_VERSION=10
  3652. }
  3653. elsewhen ($JDK_VERSION == "8") {
  3654. JDK_REAL_VERSION=8
  3655. }
  3656. elsewhen ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
  3657. JDK_REAL_VERSION=8
  3658. }
  3659. otherwise {
  3660. JDK_REAL_VERSION=17
  3661. }
  3662. # tag:java-specific
  3663. # remove extra peerdir to jdk11 after https://st.yandex-team.ru/DEVTOOLS-8851 is done
  3664. when ($USE_SYSTEM_JDK) {
  3665. JDK_RESOURCE_PEERDIR=
  3666. }
  3667. otherwise {
  3668. when ($JDK_REAL_VERSION == "17") {
  3669. # need jdk11 for spare parts in "host" platform
  3670. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk17 build/platform/java/jdk/jdk11
  3671. }
  3672. when ($JDK_REAL_VERSION == "16") {
  3673. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk16 build/platform/java/jdk/jdk17
  3674. }
  3675. when ($JDK_REAL_VERSION == "15") {
  3676. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk15 build/platform/java/jdk/jdk17
  3677. }
  3678. when ($JDK_REAL_VERSION == "14") {
  3679. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk14 build/platform/java/jdk/jdk17
  3680. }
  3681. when ($JDK_REAL_VERSION == "13") {
  3682. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk13 build/platform/java/jdk/jdk17
  3683. }
  3684. when ($JDK_REAL_VERSION == "12") {
  3685. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk12 build/platform/java/jdk/jdk17
  3686. }
  3687. when ($JDK_REAL_VERSION == "11") {
  3688. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk11 build/platform/java/jdk/jdk17
  3689. }
  3690. when ($JDK_REAL_VERSION == "10") {
  3691. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk10 build/platform/java/jdk/jdk17
  3692. }
  3693. when ($JDK_REAL_VERSION == "8") {
  3694. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk8 build/platform/java/jdk/jdk17
  3695. }
  3696. }
  3697. # tag:java-specific
  3698. when ($JDK_REAL_VERSION == "17") {
  3699. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar17
  3700. }
  3701. when ($JDK_REAL_VERSION == "16") {
  3702. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar16
  3703. }
  3704. when ($JDK_REAL_VERSION == "15") {
  3705. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar15
  3706. }
  3707. when ($JDK_REAL_VERSION == "14") {
  3708. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar14
  3709. }
  3710. when ($JDK_REAL_VERSION == "13") {
  3711. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar13
  3712. }
  3713. when ($JDK_REAL_VERSION == "12") {
  3714. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar12
  3715. }
  3716. when ($JDK_REAL_VERSION == "11") {
  3717. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar11
  3718. }
  3719. when ($JDK_REAL_VERSION == "10") {
  3720. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar10
  3721. }
  3722. when ($JDK_REAL_VERSION == "8") {
  3723. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar8
  3724. }
  3725. # tag:java-specific
  3726. JAVAC_OPTS=
  3727. when ($USE_SYSTEM_JDK) {
  3728. JDK_RESOURCE=$USE_SYSTEM_JDK
  3729. }
  3730. otherwise {
  3731. when ($JDK_REAL_VERSION == "17") {
  3732. JDK_RESOURCE=$JDK17_RESOURCE_GLOBAL
  3733. }
  3734. when ($JDK_REAL_VERSION == "16") {
  3735. JDK_RESOURCE=$JDK16_RESOURCE_GLOBAL
  3736. }
  3737. when ($JDK_REAL_VERSION == "15") {
  3738. JDK_RESOURCE=$JDK15_RESOURCE_GLOBAL
  3739. }
  3740. when ($JDK_REAL_VERSION == "14") {
  3741. JDK_RESOURCE=$JDK14_RESOURCE_GLOBAL
  3742. }
  3743. when ($JDK_REAL_VERSION == "13") {
  3744. JDK_RESOURCE=$JDK13_RESOURCE_GLOBAL
  3745. }
  3746. when ($JDK_REAL_VERSION == "12") {
  3747. JDK_RESOURCE=$JDK12_RESOURCE_GLOBAL
  3748. }
  3749. when ($JDK_REAL_VERSION == "11") {
  3750. JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  3751. }
  3752. when ($JDK_REAL_VERSION == "10") {
  3753. JDK_RESOURCE=$JDK10_RESOURCE_GLOBAL
  3754. }
  3755. when ($JDK_REAL_VERSION == "8") {
  3756. JDK_RESOURCE=$JDK8_RESOURCE_GLOBAL
  3757. }
  3758. }
  3759. # tag:java-specific
  3760. when (!$USE_SYSTEM_ERROR_PRONE) {
  3761. when ($JDK_REAL_VERSION == "8" || $JDK_REAL_VERSION == "10") {
  3762. ERROR_PRONE_VERSION=2.3.1
  3763. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.3.1
  3764. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_3_1_RESOURCE_GLOBAL
  3765. }
  3766. elsewhen ($JDK_REAL_VERSION == "11" || $JDK_REAL_VERSION == "12" || $JDK_REAL_VERSION == "13" || $JDK_REAL_VERSION == "14" || $JDK_REAL_VERSION == "15" || $JDK_REAL_VERSION == "16") {
  3767. ERROR_PRONE_VERSION=2.7.1
  3768. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.7.1
  3769. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_7_1_RESOURCE_GLOBAL
  3770. }
  3771. elsewhen ($JDK_REAL_VERSION == "17") {
  3772. ERROR_PRONE_VERSION=2.10.0
  3773. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.10.0
  3774. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_10_0_RESOURCE_GLOBAL
  3775. }
  3776. otherwise {
  3777. ERROR_PRONE_VERSION=2.7.1
  3778. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  3779. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  3780. }
  3781. }
  3782. otherwise {
  3783. ERROR_PRONE_VERSION=2.7.1
  3784. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  3785. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  3786. }
  3787. # tag:java-specific
  3788. when ($USE_SYSTEM_UBERJAR) {
  3789. UBERJAR_RESOURCE=$USE_SYSTEM_UBERJAR
  3790. }
  3791. otherwise {
  3792. when ($JDK_REAL_VERSION == "17") {
  3793. UBERJAR_RESOURCE=$UBERJAR17_RESOURCE_GLOBAL
  3794. }
  3795. when ($JDK_REAL_VERSION == "16") {
  3796. UBERJAR_RESOURCE=$UBERJAR16_RESOURCE_GLOBAL
  3797. }
  3798. when ($JDK_REAL_VERSION == "15") {
  3799. UBERJAR_RESOURCE=$UBERJAR15_RESOURCE_GLOBAL
  3800. }
  3801. when ($JDK_REAL_VERSION == "14") {
  3802. UBERJAR_RESOURCE=$UBERJAR14_RESOURCE_GLOBAL
  3803. }
  3804. when ($JDK_REAL_VERSION == "13") {
  3805. UBERJAR_RESOURCE=$UBERJAR13_RESOURCE_GLOBAL
  3806. }
  3807. when ($JDK_REAL_VERSION == "12") {
  3808. UBERJAR_RESOURCE=$UBERJAR12_RESOURCE_GLOBAL
  3809. }
  3810. when ($JDK_REAL_VERSION == "11") {
  3811. UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
  3812. }
  3813. when ($JDK_REAL_VERSION == "10") {
  3814. UBERJAR_RESOURCE=$UBERJAR10_RESOURCE_GLOBAL
  3815. }
  3816. when ($JDK_REAL_VERSION == "8") {
  3817. UBERJAR_RESOURCE=$UBERJAR8_RESOURCE_GLOBAL
  3818. }
  3819. }
  3820. # tag:java-specific
  3821. when ($JDK_REAL_VERSION == "17") {
  3822. WITH_JDK_RESOURCE=$WITH_JDK17_RESOURCE_GLOBAL
  3823. }
  3824. when ($JDK_REAL_VERSION == "16") {
  3825. WITH_JDK_RESOURCE=$WITH_JDK16_RESOURCE_GLOBAL
  3826. }
  3827. when ($JDK_REAL_VERSION == "15") {
  3828. WITH_JDK_RESOURCE=$WITH_JDK15_RESOURCE_GLOBAL
  3829. }
  3830. when ($JDK_REAL_VERSION == "14") {
  3831. WITH_JDK_RESOURCE=$WITH_JDK14_RESOURCE_GLOBAL
  3832. }
  3833. when ($JDK_REAL_VERSION == "13") {
  3834. WITH_JDK_RESOURCE=$WITH_JDK13_RESOURCE_GLOBAL
  3835. }
  3836. when ($JDK_REAL_VERSION == "12") {
  3837. WITH_JDK_RESOURCE=$WITH_JDK12_RESOURCE_GLOBAL
  3838. }
  3839. when ($JDK_REAL_VERSION == "11") {
  3840. WITH_JDK_RESOURCE=$WITH_JDK11_RESOURCE_GLOBAL
  3841. }
  3842. when ($JDK_REAL_VERSION == "10") {
  3843. WITH_JDK_RESOURCE=$WITH_JDK10_RESOURCE_GLOBAL
  3844. }
  3845. when ($JDK_REAL_VERSION == "8") {
  3846. WITH_JDK_RESOURCE=$WITH_JDK8_RESOURCE_GLOBAL
  3847. }
  3848. # tag:java-specific
  3849. EXTERNAL_JAVA_JDK_RESOURCE=
  3850. EXTERNAL_JAVA_EXTRA_PEERDIR=
  3851. when ($USE_SYSTEM_JDK) {
  3852. EXTERNAL_JAVA_EXTRA_PEERDIR=
  3853. EXTERNAL_JAVA_JDK_RESOURCE=$USE_SYSTEM_JDK
  3854. }
  3855. elsewhen ($JDK_VERSION == "") {
  3856. EXTERNAL_JAVA_JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  3857. EXTERNAL_JAVA_EXTRA_PEERDIR=build/platform/java/jdk/jdk11
  3858. }
  3859. otherwise {
  3860. EXTERNAL_JAVA_JDK_RESOURCE=$JDK_RESOURCE
  3861. }
  3862. COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_java.py"} --javac-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/jar $JAVA_VCS_MF_ARG $PACKAGE_PREFIX_ARGS --jar-output $TARGET --srcs-jar-output ${output;suf=-sources.jar:REALPRJNAME} $AUTO_INPUT DELIM $JAVAC_OPTS DELIM $MANAGED_PEERS_CLOSURE ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  3863. 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
  3864. ARGS_DELIM="MACRO_CALLS_DELIM"
  3865. SYSTEM_PROPERTIES_VALUE=
  3866. ### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
  3867. ###
  3868. ### List of Key,Value pairs that will be available to test via System.getProperty().
  3869. ### FILE means that parst should be read from file specifies as Path.
  3870. ###
  3871. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3872. macro SYSTEM_PROPERTIES(Args...) {
  3873. SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
  3874. }
  3875. # tag:java-specific
  3876. JVM_ARGS_VALUE=
  3877. ### @usage: JVM_ARGS(Args...)
  3878. ###
  3879. ### Arguments to run Java programs in tests.
  3880. ###
  3881. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3882. macro JVM_ARGS(Args...) {
  3883. SET_APPEND(JVM_ARGS_VALUE $Args)
  3884. }
  3885. # tag:java-specific
  3886. CHECK_JAVA_DEPS_VALUE=
  3887. ### @usage: CHECK_JAVA_DEPS(<yes|no>)
  3888. ###
  3889. ### Check for different classes with duplicate name in classpath.
  3890. ###
  3891. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3892. macro CHECK_JAVA_DEPS(Arg) {
  3893. SET(CHECK_JAVA_DEPS_VALUE $Arg)
  3894. }
  3895. ERROR_PRONE_VALUE=
  3896. ### @usage: USE_ERROR_PRONE()
  3897. ###
  3898. ### Use errorprone instead of javac for .java compilation.
  3899. macro USE_ERROR_PRONE() {
  3900. SET(ERROR_PRONE_VALUE yes)
  3901. }
  3902. TEST_CWD_VALUE=
  3903. ### @usage: TEST_CWD(path)
  3904. ###
  3905. ### Defines working directory for test runs. Often used in conjunction with DATA() macro.
  3906. ### Is only used inside of the TEST modules.
  3907. ###
  3908. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3909. macro TEST_CWD(Arg) {
  3910. SET(TEST_CWD_VALUE $Arg)
  3911. }
  3912. # tag:java-specific
  3913. MAKE_UBERJAR_VALUE=
  3914. ### @usage: UBERJAR()
  3915. ###
  3916. ### UBERJAR is a single all-in-one jar-archive that includes all its Java dependencies (reachable PEERDIR).
  3917. ### It also supports shading classes inside the archive by moving them to a different package (similar to the maven-shade-plugin).
  3918. ### Use UBERJAR inside JAVA_PROGRAM module.
  3919. ###
  3920. ### You can use the following macros to configure the archive:
  3921. ### 1. UBERJAR_HIDING_PREFIX prefix for classes to shade (classes remain in their packages by default)
  3922. ### 2. UBERJAR_HIDE_EXCLUDE_PATTERN exclude classes matching this patterns from shading (if enabled).
  3923. ### 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)
  3924. ### 4. UBERJAR_MANIFEST_TRANSFORMER_MAIN add ManifestResourceTransformer class to uberjar processing and specify main-class
  3925. ### 5. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE add ManifestResourceTransformer class to uberjar processing and specify some attribute
  3926. ### 6. UBERJAR_APPENDING_TRANSFORMER add AppendingTransformer class to uberjar processing
  3927. ### 7. UBERJAR_SERVICES_RESOURCE_TRANSFORMER add ServicesResourceTransformer class to uberjar processing
  3928. ###
  3929. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  3930. ###
  3931. ### @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)
  3932. macro UBERJAR() {
  3933. SET(MAKE_UBERJAR_VALUE yes)
  3934. }
  3935. # tag:java-specific
  3936. UBERJAR_PREFIX_VALUE=
  3937. UBERJAR_PREFIX_FLAG=
  3938. ### @usage: UBERJAR_HIDING_PREFIX(Arg)
  3939. ###
  3940. ### Set prefix for classes to shade. All classes in UBERJAR will be moved into package prefixed with Arg.
  3941. ### Classes remain in their packages by default.
  3942. ###
  3943. ### @see: [UBERJAR](#macro_UBERJAR)
  3944. macro UBERJAR_HIDING_PREFIX(Arg) {
  3945. SET(UBERJAR_PREFIX_VALUE $Arg)
  3946. SET(UBERJAR_PREFIX_FLAG ${pre=--shade-prefix :Arg})
  3947. }
  3948. # tag:java-specific
  3949. UBERJAR_HIDE_EXCLUDE_VALUE=
  3950. UBERJAR_HIDE_EXCLUDE_FLAGS=
  3951. ### @usage: UBERJAR_HIDE_EXCLUDE_PATTERN(Args...)
  3952. ###
  3953. ### Exclude classes matching this patterns from shading (if enabled).
  3954. ### Pattern may contain '*' and '**' globs.
  3955. ### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
  3956. ###
  3957. ### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
  3958. macro UBERJAR_HIDE_EXCLUDE_PATTERN(Args...) {
  3959. SET_APPEND(UBERJAR_HIDE_EXCLUDE_VALUE $ARGS_DELIM $Args)
  3960. SET_APPEND(UBERJAR_HIDE_EXCLUDE_FLAGS ${pre=--shade-exclude :Args})
  3961. }
  3962. # tag:java-specific
  3963. UBERJAR_PATH_EXCLUDES=
  3964. UBERJAR_PATH_EXCLUDE_VALUE=
  3965. ### @usage: UBERJAR_PATH_EXCLUDE_PREFIX(Args...)
  3966. ###
  3967. ### Exclude classes matching this patterns from UBERJAR.
  3968. ### By default all dependencies of UBERJAR program will lend in a .jar archive.
  3969. ###
  3970. ### @see: [UBERJAR](#macro_UBERJAR)
  3971. macro UBERJAR_PATH_EXCLUDE_PREFIX(Args...) {
  3972. SET_APPEND(UBERJAR_PATH_EXCLUDE_VALUE $ARGS_DELIM $Args)
  3973. SET_APPEND(UBERJAR_PATH_EXCLUDES ${pre=--uber-exclude :Args})
  3974. }
  3975. # tag:java-specific
  3976. UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE=
  3977. UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG=
  3978. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main)
  3979. ###
  3980. ### Transform manifest.mf for UBERJAR() java programs, set main-class attribute
  3981. ###
  3982. ### @see: [UBERJAR](#macro_UBERJAR)
  3983. macro UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main) {
  3984. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE $Main)
  3985. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG --manifest-main $Main)
  3986. }
  3987. # tag:java-specific
  3988. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE=
  3989. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS=
  3990. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value)
  3991. ###
  3992. ### Transform manifest.mf for UBERJAR() java programs, set attribute
  3993. ###
  3994. ### @see: [UBERJAR](#macro_UBERJAR)
  3995. macro UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value) {
  3996. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Value)
  3997. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:${Value})
  3998. }
  3999. # tag:java-specific
  4000. UBERJAR_APPENDING_TRANSFORMER_VALUE=
  4001. UBERJAR_APPENDING_TRANSFORMER_FLAGS=
  4002. ### @usage: UBERJAR_APPENDING_TRANSFORMER(Resource)
  4003. ###
  4004. ### Add AppendingTransformer for UBERJAR() java programs
  4005. ###
  4006. ### Parameters:
  4007. ### - Resource - Resource name
  4008. ###
  4009. ### @see: [UBERJAR](#macro_UBERJAR)
  4010. macro UBERJAR_APPENDING_TRANSFORMER(Resources...) {
  4011. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_VALUE $ARGS_DELIM $Resources)
  4012. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_FLAGS ${pre=--append-transformer :Resources})
  4013. }
  4014. # tag:java-specific
  4015. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE=
  4016. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG=
  4017. ### @usage: UBERJAR_SERVICES_RESOURCE_TRANSFORMER()
  4018. ###
  4019. ### Add ServicesResourceTransformer for UBERJAR() java programs
  4020. ###
  4021. ### @see: [UBERJAR](#macro_UBERJAR)
  4022. macro UBERJAR_SERVICES_RESOURCE_TRANSFORMER() {
  4023. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE yes)
  4024. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG --service-transformer)
  4025. }
  4026. # tag:idea-specific
  4027. IDEA_EXCLUDE_DIRS_VALUE=
  4028. ### @usage: IDEA_EXCLUDE_DIRS(<excluded dirs>)
  4029. ###
  4030. ### Exclude specified directories from an idea project generated by ya ide idea
  4031. ### Have no effect on regular build.
  4032. macro IDEA_EXCLUDE_DIRS(Args...) {
  4033. SET_APPEND(IDEA_EXCLUDE_DIRS_VALUE $Args)
  4034. }
  4035. # tag:idea-specific
  4036. IDEA_RESOURCE_DIRS_VALUE=
  4037. ### @usage: IDEA_RESOURCE_DIRS(<additional dirs>)
  4038. ###
  4039. ### Set specified resource directories in an idea project generated by ya ide idea
  4040. ### Have no effect on regular build.
  4041. macro IDEA_RESOURCE_DIRS(Args...) {
  4042. SET_APPEND(IDEA_RESOURCE_DIRS_VALUE $Args)
  4043. }
  4044. # tag:idea-specific
  4045. IDEA_MODULE_NAME_VALUE=
  4046. ### @usage: IDEA_MODULE_NAME(module_name)
  4047. ###
  4048. ### Set module name in an idea project generated by ya ide idea
  4049. ### Have no effect on regular build.
  4050. macro IDEA_MODULE_NAME(Name) {
  4051. SET(IDEA_MODULE_NAME_VALUE $Name)
  4052. }
  4053. # tag:java-specific
  4054. JAVAC_FLAGS_VALUE=
  4055. ### @usage: JAVAC_FLAGS(Args...)
  4056. ###
  4057. ### Set additional Java compilation flags.
  4058. macro JAVAC_FLAGS(Args...) {
  4059. SET_APPEND(JAVAC_OPTS $Args)
  4060. SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
  4061. }
  4062. # tag:java-specific
  4063. ENABLE_PREVIEW_VALUE=
  4064. ### @usage: ENABLE_PREVIEW()
  4065. ###
  4066. ### Enable java preview features.
  4067. macro ENABLE_PREVIEW() {
  4068. SET_APPEND(JVM_ARGS_VALUE --enable-preview)
  4069. SET_APPEND(JAVAC_OPTS --enable-preview --release $JDK_REAL_VERSION)
  4070. SET_APPEND(JAVAC_FLAGS_VALUE --enable-preview --release $JDK_REAL_VERSION)
  4071. SET(ENABLE_PREVIEW_VALUE yes)
  4072. }
  4073. # tag:java-specific
  4074. SAVE_JAVAC_GENERATED_SRCS=
  4075. SAVE_JAVAC_GENERATED_SRCS_DIR=
  4076. SAVE_JAVAC_GENERATED_SRCS_TAR=
  4077. when ($SAVE_JAVAC_GENERATED_SRCS) {
  4078. SAVE_JAVAC_GENERATED_SRCS_DIR=${BINDIR}/__javac_generated_srcs__
  4079. SAVE_JAVAC_GENERATED_SRCS_TAR=${BINDIR}/javac_generated.tar
  4080. JAVAC_FLAGS_VALUE+=-s $SAVE_JAVAC_GENERATED_SRCS_DIR
  4081. }
  4082. # tag:java-specific
  4083. MAVEN_GROUP_ID_VALUE=
  4084. ### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
  4085. ###
  4086. ### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
  4087. ### Have no effect on regular build.
  4088. macro MAVEN_GROUP_ID(Arg) {
  4089. SET(MAVEN_GROUP_ID_VALUE $Arg)
  4090. }
  4091. # tag:java-specific
  4092. ANNOTATION_PROCESSOR_VALUE=
  4093. ### @usage: ANNOTATION_PROCESSOR(processors...)
  4094. ###
  4095. ### The macro is in development.
  4096. ### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
  4097. macro ANNOTATION_PROCESSOR(Args...) {
  4098. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Args)
  4099. }
  4100. EXCLUDE_VALUE=
  4101. ### EXCLUDE(prefixes)
  4102. ###
  4103. ### The macro is in development.
  4104. ### Specifies which libraries should be excluded from the classpath.
  4105. macro EXCLUDE(Args...) {
  4106. SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args)
  4107. }
  4108. # tag:java-specific
  4109. JAVA_SRCS_VALUE=
  4110. ### @usage: JAVA_SRCS(srcs)
  4111. ###
  4112. ### Specify java source files and resources. A macro can be contained in any of four java modules.
  4113. ### Keywords:
  4114. ### 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.
  4115. ### 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.
  4116. ###
  4117. ### @example:
  4118. ### - example/ya.make
  4119. ###
  4120. ### JAVA_PROGRAM()
  4121. ### JAVA_SRCS(SRCDIR src/main/java **/*)
  4122. ### END()
  4123. ###
  4124. ### - example/src/main/java/ru/yandex/example/HelloWorld.java
  4125. ###
  4126. ### package ru.yandex.example;
  4127. ### public class HelloWorld {
  4128. ### public static void main(String[] args) {
  4129. ### System.out.println("Hello, World!");
  4130. ### }
  4131. ### }
  4132. ###
  4133. ### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
  4134. macro JAVA_SRCS(Args...) {
  4135. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  4136. }
  4137. # tag:java-specific
  4138. JAVA_ADD_DLLS_VALUE=no
  4139. macro ADD_DLLS_TO_JAR() {
  4140. SET(JAVA_ADD_DLLS_VALUE yes)
  4141. }
  4142. # tag:java-specific
  4143. MANAGED_PEERS=
  4144. MANAGED_PEERS_CLOSURE=
  4145. RUN_JAVA_PROGRAM_MANAGED=
  4146. MANAGEABLE_PEERS_ROOTS=contrib/java
  4147. HAS_MANAGEABLE_PEERS=no
  4148. PROPAGATES_MANAGEABLE_PEERS=no
  4149. YMAKE_CLASSPATH_CHECKS=yes
  4150. # All items of this list must be PEERS, GHOST PEERS or TOOLS of the test module or module itself.
  4151. # All items of this list must has at least one of HAS_MANAGEABLE_PEERS or PROPAGATES_MANAGEABLE_PEERS flags set yes.
  4152. # This variable is used by JUnit tests but not TestNG.
  4153. TEST_CLASSPATH_VALUE=
  4154. # Calculated and replaced by ymake can be used in DART DATA
  4155. TEST_CLASSPATH_MANAGED=
  4156. # tag:java-specific
  4157. DEPENDENCY_MANAGEMENT_VALUE=
  4158. ### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
  4159. ###
  4160. ### 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.
  4161. ###
  4162. ### For example, if the module has PEERDIR (contrib/java/junit/junit), and
  4163. ### 1. specifies DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12),
  4164. ### the PEERDIR is automatically replaced by contrib/java/junit/junit/4.12;
  4165. ### 2. doesn't specify DEPENDENCY_MANAGEMENT, PEERDIR automatically replaced
  4166. ### with the default from contrib/java/junit/junit/ya.make.
  4167. ### These defaults are always there and are supported by maven-import, which puts
  4168. ### there the maximum version available in contrib/java.
  4169. ###
  4170. ### 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.
  4171. ###
  4172. ### If some module has both DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12) and PERDIR(contrib/java/junit/junit/4.11), the PEERDIR wins.
  4173. ###
  4174. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  4175. macro DEPENDENCY_MANAGEMENT(Args...) {
  4176. SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
  4177. _GHOST_PEERDIR($Args)
  4178. }
  4179. # tag:java-specific
  4180. WITH_JDK_VALUE=
  4181. ### @usage: WITH_JDK()
  4182. ###
  4183. ### Add directory with JDK to JAVA_PROGRAM output
  4184. macro WITH_JDK() {
  4185. SET(WITH_JDK_VALUE yes)
  4186. }
  4187. # tag:kotlin-specific
  4188. WITH_KOTLIN_VALUE=
  4189. ### @usage: WITH_KOTLIN()
  4190. ###
  4191. ### Compile kotlin source code in this java module
  4192. macro WITH_KOTLIN() {
  4193. SET(WITH_KOTLIN_VALUE yes)
  4194. }
  4195. # tag:java-specific
  4196. WITH_GROOVY_VALUE=
  4197. ### @usage: WITH_GROOVY()
  4198. ###
  4199. ### Compile groovy source code in this java module
  4200. macro WITH_GROOVY() {
  4201. SET(WITH_GROOVY_VALUE yes)
  4202. }
  4203. # tag:kotlin-specific
  4204. KOTLINC_FLAGS_VALUE=-Xjvm-default=all
  4205. ### @usage: KOTLINC_FLAGS(-flags)
  4206. ###
  4207. ### Set additional Kotlin compilation flags.
  4208. macro KOTLINC_FLAGS(Args...) {
  4209. SET_APPEND(KOTLINC_OPTS_VALUE $Args)
  4210. }
  4211. # tag:kotlin-specific
  4212. WITH_KOTLINC_PLUGIN_ALLOPEN=
  4213. ### @usage: WITH_KOTLINC_ALLOPEN(-flags)
  4214. ###
  4215. ### Enable allopen kotlin compiler plugin https://kotlinlang.org/docs/all-open-plugin.html
  4216. macro WITH_KOTLINC_ALLOPEN(Options...) {
  4217. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.allopen\::Options})
  4218. SET(WITH_KOTLINC_PLUGIN_ALLOPEN yes)
  4219. }
  4220. # tag:kotlin-specific
  4221. WITH_KOTLINC_PLUGIN_NOARG=
  4222. ### @usage: WITH_KOTLINC_NOARG(-flags)
  4223. ###
  4224. ### Enable noarg kotlin compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html
  4225. macro WITH_KOTLINC_NOARG(Options...) {
  4226. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.noarg\::Options})
  4227. SET(WITH_KOTLINC_PLUGIN_NOARG yes)
  4228. }
  4229. # tag:kotlin-specific
  4230. KOTLIN_VERSION=1.6.21
  4231. KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.6.21/ya.dependency_management.inc
  4232. GROOVY_VERSION=3.0.5
  4233. # tag:java-specific
  4234. DIRECT_DEPS_ONLY_VALUE=
  4235. ### @usage: DIRECT_DEPS_ONLY
  4236. ###
  4237. ### Add direct PEERDIR's only in java compile classpath
  4238. macro DIRECT_DEPS_ONLY() {
  4239. SET(DIRECT_DEPS_ONLY_VALUE yes)
  4240. }
  4241. # tag:java-specific
  4242. JAVA_EXTERNAL_DEPENDENCIES_VALUE=
  4243. ### @usage: JAVA_EXTERNAL_DEPENDENCIES(file1 file2 ...)
  4244. ###
  4245. ### Add non-source java external build dependency (like lombok config file)
  4246. macro JAVA_EXTERNAL_DEPENDENCIES(Args...) {
  4247. SET_APPEND(JAVA_EXTERNAL_DEPENDENCIES_VALUE $Args)
  4248. }
  4249. # tag:java-specific
  4250. ### @usage _JAVA_PLACEHOLDER #internal
  4251. ### The base module for all Java modules. Defines common properties and dependencies.
  4252. module _JAVA_PLACEHOLDER: _BASE_UNIT {
  4253. .CMD=TOUCH_JAVA_UNIT
  4254. .FINAL_TARGET=yes
  4255. .ALLOWED=DEPENDENCY_MANAGEMENT EXCLUDE
  4256. .ALIASES=RUN_JAVA_PROGRAM=_RUN_JBUILD_PROGRAM
  4257. HAS_MANAGEABLE_PEERS=yes
  4258. DYNAMIC_LINK=yes
  4259. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL JAR_COMPILATION
  4260. PEERDIR(build/platform/java/jdk)
  4261. PEERDIR+=$JDK_RESOURCE_PEERDIR
  4262. when($MAKE_UBERJAR_VALUE) {
  4263. PEERDIR+=build/platform/java/uberjar
  4264. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  4265. }
  4266. when($ERROR_PRONE_VALUE) {
  4267. # Jbuild assumes hardcoded resource name https://a.yandex-team.ru/arc_vcs/devtools/ya/jbuild/gen/consts/__init__.py?rev=1739368ed5aaa585b8300b84e5dea708a2bedd3a#L130
  4268. # adding default peerdir as a hack to make `ya ide idea` and `ya maven-export` work for now
  4269. PEERDIR+=build/platform/java/error_prone
  4270. PEERDIR+=$ERROR_PRONE_PEERDIR
  4271. }
  4272. # in the ideal world this statement must be under condition bellow
  4273. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
  4274. when($WITH_KOTLIN_VALUE) {
  4275. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  4276. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  4277. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  4278. }
  4279. when($WITH_KOTLINC_PLUGIN_NOARG) {
  4280. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  4281. }
  4282. }
  4283. when($WITH_GROOVY_VALUE) {
  4284. PEERDIR+=build/platform/java/groovy contrib/java/org/codehaus/groovy/groovy/${GROOVY_VERSION}
  4285. }
  4286. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
  4287. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  4288. }
  4289. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  4290. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  4291. }
  4292. JAVA_DEPENDENCIES_CONFIGURATION(FORBID_DEFAULT_VERSIONS)
  4293. DISABLE(NEED_PLATFORM_PEERDIRS)
  4294. NO_PLATFORM()
  4295. JAVA_MODULE()
  4296. # flatbuffers-java
  4297. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  4298. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  4299. # protobuf-java
  4300. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  4301. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  4302. # protobuf-javalite
  4303. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  4304. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  4305. # protobuf-java-util
  4306. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  4307. 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})
  4308. SET(MODULE_LANG JAVA)
  4309. }
  4310. # tag:java-specific
  4311. JAVA_CLASSPATH_CMD_TYPE_VALUE=
  4312. # tag:java-specific
  4313. ### @usage:TEST_JAVA_CLASSPATH_CMD_TYPE(Type)
  4314. ### Available types: MANIFEST(default), COMMAND_FILE, LIST
  4315. ### Method for passing a classpath value to a java command line
  4316. ### MANIFEST via empty jar file with manifest that contains Class-Path attribute
  4317. ### COMMAND_FILE via @command_file
  4318. ### LIST via flat args
  4319. macro TEST_JAVA_CLASSPATH_CMD_TYPE(Type) {
  4320. SET(JAVA_CLASSPATH_CMD_TYPE_VALUE $Type)
  4321. }
  4322. # tag:java-specific
  4323. IGNORE_JAVA_DEPENDENCIES_CONFIGURATION=no
  4324. JAVA_DEPENDENCIES_CONFIGURATION_VALUE=
  4325. # tag:java-specific
  4326. ### @usage JAVA_DEPENDENCIES_CONFIGURATION(Vetos...)
  4327. ### Validate contrib/java dependencies
  4328. ### Valid arguments
  4329. ### FORBID_DIRECT_PEERDIRS - fail when module have direct PEERDIR (with version) (non-transitive)
  4330. ### FORBID_DEFAULT_VERSIONS - fail when module have PEERDIR to library with default (last) version (transitive)
  4331. ### FORBID_CONFLICT - fail when module have resolved without DEPENDENCY_MANAGEMENT version conflict (transitive)
  4332. ### FORBID_CONFLICT_DM - fail when module have resolved with DEPENDENCY_MANAGEMENT version conflict (transitive)
  4333. ### FORBID_CONFLICT_DM_RECENT - like FORBID_CONFLICT_DM but fail only when dependency have more recent version than specified in DEPENDENCY_MANAGEMENT
  4334. ### REQUIRE_DM - all dependencies must be specified in DEPENDENCY_MANAGEMENT (transitive)
  4335. macro JAVA_DEPENDENCIES_CONFIGURATION(Args...) {
  4336. SET_APPEND(JAVA_DEPENDENCIES_CONFIGURATION_VALUE $Args)
  4337. }
  4338. # tag:java-specific
  4339. # TODO(DEVTOOLS-6901): remove this variable when there are no more references to it in jbuild
  4340. JAVA_FORBIDDEN_LIBRARIES_VALUE=
  4341. # tag:java-specific
  4342. JAR_INCLUDE_FILTER_VALUE=
  4343. JAR_EXCLUDE_FILTER_VALUE=
  4344. # tag:java-specific
  4345. ### @usage:JAR_INCLUDE(Filters...)
  4346. ### Filter .jar file content: keep only matched files
  4347. ### * and ** patterns are supported (like JAVA_SRCS)
  4348. macro JAR_INCLUDE(Filters...) {
  4349. SET_APPEND(JAR_INCLUDE_FILTER_VALUE $Filters)
  4350. }
  4351. # tag:java-specific
  4352. ### @usage:JAR_EXCLUDE(Filters...)
  4353. ### Filter .jar file content: remove matched files
  4354. ### * and ** patterns are supported (like JAVA_SRCS)
  4355. macro JAR_EXCLUDE(Filters...) {
  4356. SET_APPEND(JAR_EXCLUDE_FILTER_VALUE $Filters)
  4357. }
  4358. # tag:sandbox-specific
  4359. ### @usage: SANDBOX_TASK([Name])
  4360. ###
  4361. ### Multimodule describing Sandbox task (Python code that can be executed by Sandbox system).
  4362. ###
  4363. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_TASKs as libraries.
  4364. ### The final artifact is provided when SANDBOX_TASK is referred to by DEPENDS and BUNDLE macros.
  4365. ### As PEERDIR target, it works like regular PY2_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_TASKs.
  4366. ###
  4367. ### Currently Sandbox supports only Python 2.x, so both variants will be compatible only with Python 2.x modules
  4368. ### and will select multimodule variants accordingly.
  4369. ###
  4370. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4371. multimodule SANDBOX_TASK {
  4372. module SB_TASK_BIN: _PY2_PROGRAM {
  4373. PY_MAIN(sandbox.taskbox.binary)
  4374. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4375. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4376. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4377. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4378. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4379. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4380. when ($FAIL_PY2 == "yes") {
  4381. _OK=no
  4382. }
  4383. elsewhen ($OPENSOURCE != "yes") {
  4384. PEERDIR+=build/rules/py2_deprecation
  4385. }
  4386. ASSERT(_OK You are using deprecated Python2-only code (SANDBOX_TASK). Please consider rewriting to 2/3-compatible code.)
  4387. }
  4388. module PY2: PY2_LIBRARY {
  4389. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4390. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4391. }
  4392. }
  4393. # tag:sandbox-specific
  4394. multimodule SANDBOX_PY23_TASK {
  4395. module SB_TASK_BIN: _PY2_PROGRAM {
  4396. PY_MAIN(sandbox.taskbox.binary)
  4397. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4398. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4399. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4400. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4401. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4402. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4403. }
  4404. module PY2: PY2_LIBRARY {
  4405. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4406. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4407. OBJ_SUF=.py2
  4408. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  4409. PYTHON_TYPE_FOR_CYTHON=PY2
  4410. }
  4411. module PY3: PY3_LIBRARY {
  4412. when ($MSVC == "yes" || $CYGWIN == "yes") {
  4413. MODULE_PREFIX=py3
  4414. }
  4415. otherwise {
  4416. MODULE_PREFIX=libpy3
  4417. }
  4418. OBJ_SUF=.py3
  4419. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  4420. PYTHON_TYPE_FOR_CYTHON=PY2
  4421. PEERDIR(sandbox/sdk2)
  4422. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4423. }
  4424. }
  4425. # tag:sandbox-specific
  4426. ### @usage: SANDBOX_PY3_TASK([Name])
  4427. ###
  4428. ### Multimodule describing Sandbox task (Python3 code that can be executed by Sandbox system).
  4429. ###
  4430. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_PY3_TASKs as libraries.
  4431. ### The final artifact is provided when SANDBOX_PY3_TASK is referred to by DEPENDS and BUNDLE macros.
  4432. ### As PEERDIR target, it works like regular PY3_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_PY3_TASKs.
  4433. ###
  4434. ### Currently Sandbox supports Python 3.x only in binary tasks, both variants will be compatible only with Python 3.x and py23 libraries
  4435. ### and will select multimodule variants accordingly.
  4436. ###
  4437. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4438. multimodule SANDBOX_PY3_TASK {
  4439. module SB_TASK_BIN: PY3_PROGRAM_BIN {
  4440. PY_MAIN(sandbox.taskbox.binary)
  4441. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/taskbox/worker)
  4442. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4443. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4444. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4445. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4446. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4447. }
  4448. module PY3: PY3_LIBRARY {
  4449. PEERDIR(sandbox/sdk2)
  4450. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4451. }
  4452. }
  4453. # tag:python-specific tag:internal
  4454. NO_PYTHON_INCLS=no
  4455. ### @usage: NO_PYTHON_INCLUDES() # internal
  4456. ###
  4457. ### Disable dependencies on libraries providing Python headers.
  4458. ### This is only used in Python libraries themselves to avoid PEERDIR loops.
  4459. macro NO_PYTHON_INCLUDES() {
  4460. ENABLE(NO_PYTHON_INCLS)
  4461. }
  4462. # tag:python-specific
  4463. ### @usage: PYTHON2_ADDINCL()
  4464. ###
  4465. ### This macro adds include path for Python headers (Python 2.x variant) without PEERDIR.
  4466. ### This should be used in 2 cases only:
  4467. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4468. ### - In system Python libraries themselves since proper PEERDIR there may create a loop;
  4469. ### In all other cases use USE_PYTHON2 macro instead.
  4470. ###
  4471. ### Never use this macro in PY2_PROGRAM, PY2_LIBRARY and PY23_LIBRARY: they have everything needed by default.
  4472. ###
  4473. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4474. macro PYTHON2_ADDINCL() {
  4475. _PYTHON_ADDINCL()
  4476. SET(MODULE_TAG PY2_NATIVE)
  4477. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4478. }
  4479. # tag:python-specific tag:internal
  4480. ### @usage: _ARCADIA_PYTHON_ADDINCL() # internal
  4481. ### This macro sets up Python headers for modules with Arcadia python (e.g. PY2_LIBRARY) and configures module as Python 2.x.
  4482. macro _ARCADIA_PYTHON_ADDINCL() {
  4483. _PYTHON_ADDINCL()
  4484. SET(MODULE_TAG PY2)
  4485. SET(PEERDIR_TAGS PY2 PY2_NATIVE PY_PROTO PY2_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4486. }
  4487. # tag:python-specific tag:internal
  4488. ### @usage: _PYTHON_ADDINCL() # internal
  4489. ### This macro sets up Python 2.x headers for both Arcadia and non-Arcadia python.
  4490. macro _PYTHON_ADDINCL() {
  4491. SET(PYTHON2 yes)
  4492. SET(PYTHON3 no)
  4493. when ($USE_ARCADIA_PYTHON == "yes") {
  4494. ADDINCL+=GLOBAL contrib/libs/python/Include
  4495. CFLAGS+=-DARCADIA_PYTHON_UNICODE_SIZE=$ARCADIA_PYTHON_UNICODE_SIZE
  4496. }
  4497. otherwise {
  4498. when ($USE_SYSTEM_PYTHON) {
  4499. PEERDIR+=build/platform/python
  4500. }
  4501. otherwise {
  4502. CFLAGS+=$PYTHON_INCLUDE
  4503. }
  4504. }
  4505. }
  4506. # tag:python-specific
  4507. ### @usage: PYTHON3_ADDINCL()
  4508. ###
  4509. ### This macro adds include path for Python headers (Python 3.x variant).
  4510. ### This should be used in 2 cases only:
  4511. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4512. ### - In system Python libraries themselves since peerdir there may create a loop;
  4513. ### In all other cases use USE_PYTHON3() macro instead.
  4514. ###
  4515. ### Never use this macro in PY3_PROGRAM and PY3_LIBRARY and PY23_LIBRARY: they have everything by default.
  4516. ###
  4517. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4518. macro PYTHON3_ADDINCL() {
  4519. _PYTHON3_ADDINCL()
  4520. SET(MODULE_TAG PY3_NATIVE)
  4521. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY3_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4522. }
  4523. # tag:python-specific tag:internal
  4524. ### @usage: _ARCADIA_PYTHON3_ADDINCL() # internal
  4525. ###
  4526. ### This macro sets up Python3 headers for modules with Arcadia python (e.g. PY3_LIBRARY) and configures module as Python 3.x.
  4527. macro _ARCADIA_PYTHON3_ADDINCL() {
  4528. _PYTHON3_ADDINCL()
  4529. SET(MODULE_TAG PY3)
  4530. SET(MODULE_LANG PY3)
  4531. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE PY3_PROTO PY3_FBS PY3_SSQLS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4532. }
  4533. # tag:python-specific tag:internal
  4534. ### @usage: _PYTHON_ADDINCL() # internal
  4535. ###
  4536. ### This macro sets up Python 3.x headers for both Arcadia and non-Arcadia python.
  4537. macro _PYTHON3_ADDINCL() {
  4538. SET(PYTHON3 yes)
  4539. SET(PYTHON2 no)
  4540. when ($USE_ARCADIA_PYTHON == "yes") {
  4541. CFLAGS+=-DUSE_PYTHON3
  4542. ADDINCL+=GLOBAL contrib/libs/python/Include
  4543. }
  4544. otherwise {
  4545. when ($USE_SYSTEM_PYTHON) {
  4546. PEERDIR+=build/platform/python
  4547. }
  4548. otherwise {
  4549. CFLAGS+=$PYTHON_INCLUDE
  4550. }
  4551. }
  4552. }
  4553. # tag:python-specific
  4554. ### @usage: USE_PYTHON2()
  4555. ###
  4556. ### This adds Python 2.x runtime library to your LIBRARY and makes it Python2-compatible.
  4557. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4558. ###
  4559. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4560. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4561. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4562. ###
  4563. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4564. macro USE_PYTHON2() {
  4565. _ARCADIA_PYTHON_ADDINCL()
  4566. SET(PEERDIR_TAGS PY2 PY2_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4567. PEERDIR(contrib/libs/python)
  4568. }
  4569. # tag:python-specific
  4570. ### @usage: USE_PYTHON3()
  4571. ###
  4572. ### This adds Python3 library to your LIBRARY and makes it Python3-compatible.
  4573. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4574. ###
  4575. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4576. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4577. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4578. ###
  4579. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4580. macro USE_PYTHON3() {
  4581. _ARCADIA_PYTHON3_ADDINCL()
  4582. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4583. PEERDIR(contrib/libs/python)
  4584. when ($USE_ARCADIA_PYTHON == "yes") {
  4585. PEERDIR+=library/python/runtime_py3
  4586. }
  4587. }
  4588. # tag:python-specific
  4589. when ($PERL_DEFAULT_PEERDIR == "yes") {
  4590. when (($PERLXS == "yes") || ($PERLXSCPP == "yes") || ($USE_PERL == "yes")) {
  4591. PEERDIR+=build/platform/perl
  4592. }
  4593. }
  4594. # tag:perl-specific
  4595. ### @usage: USE_PERL_LIB()
  4596. ### Add dependency on Perl to your LIBRARY
  4597. macro USE_PERL_LIB() {
  4598. PEERDIR(build/platform/perl)
  4599. }
  4600. # tag:perl-specific
  4601. ### @usage: USE_PERL_514_LIB()
  4602. ### Add dependency on Perl 5.14 to your LIBRARY
  4603. macro USE_PERL_514_LIB() {
  4604. SET(PERL_SDK ubuntu-12)
  4605. SET(PERL_DEFAULT_PEERDIR no)
  4606. PEERDIR(build/platform/perl/5.14)
  4607. }
  4608. # tag:perl-specific
  4609. ### @usage: ADD_PERL_MODULE(Dir ModuleName)
  4610. ### Add dependency on specified Perl module to the library
  4611. macro ADD_PERL_MODULE(Dir, Module) {
  4612. PEERDIR($Dir)
  4613. SET_APPEND(modules $Module)
  4614. }
  4615. # tag:allocator
  4616. ### @usage: ALLOCATOR(Alloc) # Default: LF
  4617. ###
  4618. ### Set memory allocator implementation for the PROGRAM()/DLL() module.
  4619. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
  4620. ###
  4621. ### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU".
  4622. ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
  4623. ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
  4624. ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
  4625. ### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
  4626. ### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
  4627. ### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
  4628. ### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
  4629. ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
  4630. ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
  4631. ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
  4632. ### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
  4633. ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
  4634. ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
  4635. ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
  4636. ### - SYSTEM - Use target system allocator
  4637. ### - FAKE - Don't link with any allocator
  4638. ###
  4639. ### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
  4640. macro ALLOCATOR(Alloc) {
  4641. SET(ALLOCATOR $Alloc)
  4642. when ($ALLOCATOR in [ "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU" ]) {
  4643. }
  4644. otherwise {
  4645. PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
  4646. }
  4647. }
  4648. when ($MIC_ARCH == "yes") {
  4649. CFLAGS+=-mmic
  4650. LDFLAGS+=-mmic
  4651. }
  4652. when ($USE_OPENMP == "yes") {
  4653. PEERDIR+=contrib/libs/openmp
  4654. }
  4655. when ($STRIP == "yes" && $NO_STRIP != "yes") {
  4656. STRIP_FLAG=$LD_STRIP_FLAG
  4657. DWARF_COMMAND=
  4658. GO_LINK_FLAGS_VALUE+=-s
  4659. }
  4660. when ($NO_LINKER_DCE != "yes") {
  4661. DCE_FLAG=$LD_DCE_FLAG
  4662. }
  4663. when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
  4664. ICF_FLAG=$LD_ICF_FLAG
  4665. }
  4666. OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
  4667. STRIP_TOOL=$STRIP_TOOL_VENDOR
  4668. NEED_BINUTILS_PEERDIR=
  4669. BINUTILS_USED=
  4670. when (!$OBJCOPY_TOOL_VENDOR) {
  4671. OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
  4672. NEED_BINUTILS_PEERDIR=yes
  4673. }
  4674. when (!$STRIP_TOOL_VENDOR) {
  4675. STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
  4676. NEED_BINUTILS_PEERDIR=yes
  4677. }
  4678. SPLIT_DWARF_VALUE=no
  4679. NO_SPLIT_DWARF=no
  4680. when ($STRIP_DEBUG_INFO) {
  4681. SPLIT_DWARF_VALUE=yes
  4682. NO_SPLIT_DWARF=no
  4683. }
  4684. ### @usage: SPLIT_DWARF()
  4685. ###
  4686. ### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
  4687. ### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
  4688. macro SPLIT_DWARF() {
  4689. SET(SPLIT_DWARF_VALUE yes)
  4690. }
  4691. SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
  4692. when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
  4693. DWARF_COMMAND+= \
  4694. $OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
  4695. $STRIP_TOOL --strip-debug $TARGET && \
  4696. $OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
  4697. BINUTILS_USED=yes
  4698. }
  4699. ### @usage: EXTRALIBS_STATIC(Libs...)
  4700. ###
  4701. ### Add the specified external static libraries to the program link
  4702. macro EXTRALIBS_STATIC(Args...) {
  4703. LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
  4704. }
  4705. ### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
  4706. ###
  4707. ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
  4708. macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
  4709. __translatename_lower=${tolower:Name}
  4710. __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
  4711. RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
  4712. }
  4713. ### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
  4714. ###
  4715. ### Generate transliteration dictionary code
  4716. ### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
  4717. macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
  4718. __translitname_lower=${tolower:Name}
  4719. __translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
  4720. __untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
  4721. __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
  4722. __gentrie_dir=dict/tools/make_untranslit_trie
  4723. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
  4724. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
  4725. RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
  4726. }
  4727. # tag:python-specific tag:proto tag:deprecated
  4728. ### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated
  4729. ###
  4730. ### Generate python bindings for protobuf files.
  4731. ### Macro is obsolete and not recommended for use!
  4732. macro GENERATE_PY_PROTOS(FILES...) {
  4733. foreach (FILE : $FILES) {
  4734. _PY_PROTO_CMD($FILE)
  4735. }
  4736. }
  4737. # tag:python-specific tag:proto
  4738. macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) {
  4739. foreach (FILE : $FILES) {
  4740. _PY_PROTO_CMD_INTERNAL($FILE)
  4741. }
  4742. }
  4743. # tag:python-specific
  4744. macro _GENERATE_PY_EVS_INTERNAL(FILES...) {
  4745. foreach (FILE : $FILES) {
  4746. _PY_EVLOG_CMD_INTERNAL($FILE)
  4747. }
  4748. }
  4749. macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4750. .CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"}
  4751. .SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST}
  4752. }
  4753. ### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
  4754. ###
  4755. ### Copy file to build root. It is possible to change both location and the name.
  4756. ###
  4757. ### Parameters:
  4758. ### - File - Source file name.
  4759. ### - Destination - Output file name.
  4760. ### - AUTO - Consider copied file for further processing automatically.
  4761. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
  4762. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  4763. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type)
  4764. ### and set of dependencies
  4765. ###
  4766. ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
  4767. ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
  4768. macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4769. .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  4770. .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination)
  4771. }
  4772. ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
  4773. ###
  4774. ### Copy file to build root the same way as it is done for COPY_FILE, but also
  4775. ### propagates the context of the source file.
  4776. macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO":"", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4777. .CMD=$COPY_FILE($FILE $DEST $AUTO OUTPUT_INCLUDES $FILE $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  4778. }
  4779. ### This is to join $ALL_RES_ and $EXT
  4780. macro _ARF_HELPER(Args...) {
  4781. RESOURCE_FILES($Args)
  4782. }
  4783. ### @usage ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
  4784. ###
  4785. ### This macro collects all files with extension `Ext` and
  4786. ### Passes them to `RESOURCE_FILES` macro as relative to current directory
  4787. ###
  4788. ### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
  4789. ###
  4790. ### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
  4791. ### Note: Wildcards are not allowed neither as Ext nor in Dirs
  4792. macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
  4793. _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
  4794. _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT})
  4795. }
  4796. macro _BUNDLE_TARGET(Target, Destination) {
  4797. .CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
  4798. }
  4799. ### @usage: TIMEOUT(TIMEOUT)
  4800. ###
  4801. ### Sets a timeout on test execution
  4802. ###
  4803. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4804. macro TIMEOUT(Time) {
  4805. SET(TEST_TIMEOUT $Time)
  4806. }
  4807. SBR_UID_EXT=""
  4808. # tag:test
  4809. ### @usage: VALIDATE_DATA_RESTART(ext)
  4810. ###
  4811. ### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
  4812. ### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
  4813. macro VALIDATE_DATA_RESTART(Ext) {
  4814. SET(SBR_UID_EXT $Ext)
  4815. }
  4816. # tag:test
  4817. TEST_FORK_MODE=none
  4818. TEST_PARTITION=SEQUENTIAL
  4819. # tag:test
  4820. ### @usage: FORK_TESTS()
  4821. ###
  4822. ### Splits a test run on chunks by test classes.
  4823. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  4824. ###
  4825. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  4826. ###
  4827. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4828. macro FORK_TESTS(MODE...) {
  4829. SET(TEST_FORK_MODE tests)
  4830. SET(TEST_PARTITION $MODE)
  4831. }
  4832. # tag:test
  4833. ### @usage: FORK_SUBTESTS()
  4834. ###
  4835. ### Splits the test run in chunks on subtests.
  4836. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  4837. ###
  4838. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  4839. ###
  4840. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4841. macro FORK_SUBTESTS(MODE...) {
  4842. SET(TEST_FORK_MODE subtests)
  4843. SET(TEST_PARTITION $MODE)
  4844. }
  4845. # tag:test
  4846. ### @usage: SPLIT_FACTOR(x)
  4847. ###
  4848. ### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
  4849. ### If none of those is specified this macro implies FORK_TESTS().
  4850. ###
  4851. ### Supports C++ ut and PyTest.
  4852. ###
  4853. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4854. macro SPLIT_FACTOR(Factor) {
  4855. SET(TEST_SPLIT_FACTOR $Factor)
  4856. }
  4857. # tag:test
  4858. FORK_TEST_FILES_MODE=
  4859. ### @usage: FORK_TEST_FILES()
  4860. ###
  4861. ### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
  4862. ### Compatible with FORK_(SUB)TESTS.
  4863. ###
  4864. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4865. macro FORK_TEST_FILES() {
  4866. SET(FORK_TEST_FILES_MODE on)
  4867. }
  4868. # tag:test
  4869. TEST_SIZE_NAME=SMALL
  4870. ### @usage: SIZE(SMALL/MEDIUM/LARGE)
  4871. ###
  4872. ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
  4873. ### See documentation on test system for more details.
  4874. ###
  4875. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4876. macro SIZE(Type) {
  4877. SET(TEST_SIZE_NAME $Type)
  4878. }
  4879. ### @usage: JOIN_SRCS(Out Src...)
  4880. ###
  4881. ### Join set of sources into single file named Out and send it for further processing.
  4882. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  4883. ### You should specify file name with the extension as Out. Further processing will be done according this extension.
  4884. macro JOIN_SRCS(Out, Src...) {
  4885. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  4886. .SEM=target_joined_source $Out ${input:Src} ${output;hide;suf=.o:Out}
  4887. _CONDITIONAL_SRCS($TIDY_VALUE $Src)
  4888. }
  4889. ### @usage: JOIN_SRCS_GLOBAL(Out Src...)
  4890. ###
  4891. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  4892. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  4893. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  4894. macro JOIN_SRCS_GLOBAL(Out, Src...) {
  4895. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output;noauto:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  4896. SRCS(GLOBAL $Out)
  4897. }
  4898. ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
  4899. ###
  4900. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  4901. ### This macro places all files into single file, so will work with any sources.
  4902. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  4903. macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
  4904. .CMD=$FS_TOOLS cat ${output;noauto:Out} --ya-start-command-file ${input:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  4905. SRCS(GLOBAL $Out)
  4906. }
  4907. # tag:cpu
  4908. PIC_CFLAGS=
  4909. SSE2_CFLAGS=
  4910. SSE3_CFLAGS=
  4911. SSSE3_CFLAGS=
  4912. SSE41_CFLAGS=
  4913. SSE42_CFLAGS=
  4914. POPCNT_CFLAGS=
  4915. PCLMUL_CFLAGS=
  4916. CX16_FLAGS=
  4917. AVX_CFLAGS=
  4918. AVX2_CFLAGS=
  4919. AVX512_CFLAGS=
  4920. # tag:cpu
  4921. SSE_DEFINES=
  4922. SSE_CFLAGS=
  4923. SSE4_DEFINES=
  4924. SSE4_CFLAGS=
  4925. XOP_CFLAGS=
  4926. NO_LTO_CFLAGS=
  4927. # tag:cpu
  4928. when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
  4929. when ($CLANG || $CLANG_CL || $GCC) {
  4930. PIC_CFLAGS=-fPIC
  4931. SSE2_CFLAGS=-msse2
  4932. SSE3_CFLAGS=-msse3
  4933. SSSE3_CFLAGS=-mssse3
  4934. SSE41_CFLAGS=-msse4.1
  4935. SSE42_CFLAGS=-msse4.2
  4936. XOP_CFLAGS=-mxop
  4937. POPCNT_CFLAGS=-mpopcnt
  4938. PCLMUL_CFLAGS=-mpclmul
  4939. AVX_CFLAGS=-mavx
  4940. # On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell.
  4941. # See:
  4942. # https://en.wikipedia.org/wiki/FMA_instruction_set
  4943. # https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
  4944. #
  4945. # AMD implemented FMA3 in Piledriver architecture over AVX (that is, prior to AVX-2 which was introduced in Zen).
  4946. # BMI2 implementation was released by AMD along with AVX-2 support.
  4947. # See:
  4948. # https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
  4949. #
  4950. # Due to the above, it looks safe to enable all three extensions whenever AVX-2 is enabled.
  4951. AVX2_CFLAGS=-mavx2 -mfma -mbmi -mbmi2
  4952. # All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
  4953. # (these are Xeon Phi)
  4954. # See:
  4955. # https://en.wikichip.org/wiki/x86/avx-512
  4956. AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
  4957. when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
  4958. CX16_FLAGS=-mcx16
  4959. }
  4960. SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
  4961. SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
  4962. }
  4963. elsewhen ($MSVC) {
  4964. SSE2_CFLAGS=/D__SSE2__=1
  4965. SSE3_CFLAGS=/D__SSE3__=1
  4966. SSSE3_CFLAGS=/D__SSSE3__=1
  4967. SSE41_CFLAGS=/D__SSE4_1__=1
  4968. SSE42_CFLAGS=/D__SSE4_2__=1
  4969. POPCNT_CFLAGS=/D__POPCNT__=1
  4970. PCLMUL_CFLAGS=/D__PCLMUL__=1
  4971. AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
  4972. AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
  4973. AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
  4974. SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
  4975. SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
  4976. }
  4977. SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
  4978. SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
  4979. when ($ARCH_I386 && $OS_ANDROID == "yes") {
  4980. USE_SSE4=no
  4981. }
  4982. }
  4983. otherwise {
  4984. USE_SSE4=no
  4985. CPU_CHECK=no
  4986. }
  4987. # tag:cpu
  4988. when ($NOSSE == "yes") {
  4989. USE_SSE4=no
  4990. }
  4991. # tag:cpu
  4992. ### @usage: NO_SSE4()
  4993. ###
  4994. ### Compile module without SSE4
  4995. macro NO_SSE4() {
  4996. SET(USE_SSE4 no)
  4997. }
  4998. # tag:cpu
  4999. ### @usage: NO_CPU_CHECK()
  5000. ###
  5001. ### Compile module without startup CPU features check
  5002. macro NO_CPU_CHECK() {
  5003. SET(CPU_CHECK no)
  5004. }
  5005. ### @usage: ADDINCLSELF()
  5006. ###
  5007. ### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
  5008. macro ADDINCLSELF(FOR="") {
  5009. when($FOR) {
  5010. ADDINCL+=FOR $FOR ${MODDIR}
  5011. }
  5012. otherwise {
  5013. ADDINCL+=${MODDIR}
  5014. }
  5015. }
  5016. COMPILE_OUT_SUFFIX=
  5017. _COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
  5018. _COMPILE_TIME_TRACE_OUTPUTS=${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
  5019. macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?";norel":"") {
  5020. SET(_COMPILE_OUTPUTS \${output;suf=\${OBJECT_SUF}$NOREL:SRC})
  5021. SET(_COMPILE_TIME_TRACE_OUTPUTS \${output;noauto;suf=\${OBJECT_SUF}.time_trace.json$NOREL:SRC})
  5022. }
  5023. # tag:internal
  5024. ### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
  5025. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " before $Args when GENERATE
  5026. ### is specified in the list of actual arguments
  5027. macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
  5028. .SEM=$GENERATE $Args
  5029. }
  5030. # tag:internal
  5031. ### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
  5032. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " if Args is not empty
  5033. macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
  5034. .SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
  5035. }
  5036. _EMPTY_CMD=
  5037. # tag:src-processing tag:internal
  5038. ### @usage: _SRC(Ext Src Flags) # internal
  5039. ###
  5040. ### Basic building block of extension-based command dispatching
  5041. ### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
  5042. ### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
  5043. ### of other commands (except ones marked as noauto)
  5044. macro _SRC(EXT, SRC, SRCFLAGS...) {
  5045. # Generic macro definition for _SRC (just a placeholder, it does nothing)
  5046. }
  5047. _SWIG_CMD=$_SWIG_PYTHON_CMD
  5048. _SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
  5049. _SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
  5050. _SWIG_SEM_TO_MODULE_LINK=${output;hide;suf=.o:SRC}
  5051. _SWIG_PYTHON_CMD=${_SWIG_TOOL} -module ${REALPRJNAME} -cpperraswarn -c++ -python -interface ${MODULE_PREFIX}${REALPRJNAME} -o ${output;noext;main;suf=_wrap.swg.cpp:SRC} ${output;noauto;add_to_outs;hide;tobindir;suf=.py:REALPRJNAME} -outdir ${BINDIR} ${pre=-I:_SWIG__INCLUDE} ${input:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5052. _SWIG_PYTHON_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/python FOR swig ${_SWIG_LIBRARY}
  5053. _SWIG_PYTHON_PEERDIR=
  5054. _SWIG_PERL_CMD=${_SWIG_TOOL} -c++ -cpperraswarn -module ${REALPRJNAME} -shadow -perl -o ${output;noext;main;suf=_wrap.swg.cpp:SRC} ${output;noauto;add_to_outs;hide;tobindir;suf=.pm:REALPRJNAME} -outdir ${ARCADIA_BUILD_ROOT}/${MODDIR} ${pre=-I:_SWIG__INCLUDE} ${input:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5055. _SWIG_PERL_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/perl5 FOR swig ${_SWIG_LIBRARY}
  5056. _SWIG_PERL_PEERDIR=build/platform/perl
  5057. _SWIG_JNI_CPP_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --out-header ${output;main;noext;suf=_wrap.swg.h:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${output;noext;suf=_wrap.swg.cpp:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5058. _SWIG_JNI_JAVA_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} --jsrc ${output;main;suf=.jsrc:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${BINDIR}/unused.cpp ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5059. _SWIG_JNI_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --out-header ${output;main;noext;suf=_wrap.swg.h:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} --jsrc ${output;suf=.jsrc:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${output;noext;suf=_wrap.swg.cpp:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5060. _SWIG_JNI_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/java FOR swig $_SWIG_LIBRARY
  5061. _SWIG_JNI_PEERDIR=$YMAKE_PYTHON3_PEER contrib/libs/jdk
  5062. when ($USE_LOCAL_SWIG == "yes") {
  5063. _SWIG_JNI_ADDINCLS=
  5064. }
  5065. when ($USE_SYSTEM_JDK == "yes" || $OS_ANDROID == "yes") {
  5066. _SWIG_JNI_PEERDIR=$YMAKE_PYTHON3_PEER
  5067. }
  5068. # tag:src-processing
  5069. macro _SRC("swg", SRC, SRCFLAGS...) {
  5070. .CMD=${_SWIG_CMD}
  5071. .ADDINCL=${_SWIG_ADDINCLS}
  5072. .PEERDIR=${_SWIG_PEERDIR}
  5073. .SEM=conan_require swig/4.0.2 && conan_import '"bin, *swig* -> ./bin"' ${input;hide:SRC} ${_SWIG_SEM_TO_MODULE_LINK}
  5074. }
  5075. RODATA_SYMBOL_PREFIX=
  5076. when ($DARWIN == "yes" || $IOS == "yes" || ($WINDOWS == "yes" && $ARCH_TYPE_32 == "yes")) {
  5077. RODATA_SYMBOL_PREFIX=_
  5078. }
  5079. RODATA_ELF_FLAGS=
  5080. when($LINUX == "yes" || $ANDROID == "yes") {
  5081. RODATA_ELF_FLAGS=--elf
  5082. }
  5083. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2asm.py"} $RODATA_ELF_FLAGS ${RODATA_SYMBOL_PREFIX}${noext;nopath:SRC} ${input:SRC} ${tmp;suf=.asm:SRC} ${hide:OBJECT_SUF} && $_SRC_yasm_helper(${tmp;suf=.asm:SRC})
  5084. when (($ARCH_AARCH64 || $ARCH_ARM || $ARCH_PPC64LE) == "yes") {
  5085. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2cpp.py"} ${noext;nopath:SRC} ${input:SRC} ${output;suf=.cpp:SRC}
  5086. }
  5087. # tag:src-processing
  5088. macro _SRC("rodata", SRC, SRCFLAGS...) {
  5089. .CMD=$RODATA_COMPILE ${hide;kv:"p RD"} ${hide;kv:"pc light-green"}
  5090. .PEERDIR=$YMAKE_PYTHON3_PEER
  5091. .SEM=target_rodata_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC}
  5092. }
  5093. # tag:src-processing
  5094. macro _SRC("S", SRC, SRCFLAGS...) {
  5095. .CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output:SRC.o} ${input:SRC} ${pre=-I:_C__INCLUDE}
  5096. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5097. }
  5098. # tag:src-processing
  5099. macro _SRC("s", SRC, SRCFLAGS...) {
  5100. .CMD=$_SRC(S, $SRC $SRCFLAGS)
  5101. }
  5102. # tag:src-processing
  5103. macro _SRC("s79", SRC, SRCFLAGS...) {
  5104. .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
  5105. }
  5106. # tag:src-processing
  5107. macro _SRC("mm", SRC, SRCFLAGS...) {
  5108. .CMD=$C_COMPILER $C_FLAGS_PLATFORM -x objective-c++ -fobjc-arc -fobjc-abi-version=2 -c -o ${output:SRC.o} ${input:SRC} $CXXFLAGS ${pre=-I:_C__INCLUDE} ${SRCFLAGS} ${kv;hide:"p CC"} ${kv;hide:"pc light-green"} $TOOLCHAIN_ENV
  5109. }
  5110. # tag:src-processing
  5111. macro _SRC("fml", SRC, SRCFLAGS...) {
  5112. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output:SRC.inc} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5113. }
  5114. # tag:src-processing
  5115. macro _SRC("fml2", SRC, SRCFLAGS...) {
  5116. .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"}
  5117. }
  5118. # tag:src-processing
  5119. macro _SRC("fml3", SRC, SRCFLAGS...) {
  5120. .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"}
  5121. }
  5122. # tag:src-processing
  5123. macro _SRC("sfdl", SRC, SRCFLAGS...) {
  5124. .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
  5125. }
  5126. # tag:src-processing
  5127. macro _SRC("xs", SRC, SRCFLAGS...) {
  5128. .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"}
  5129. }
  5130. # tag:src-processing
  5131. macro _SRC("y", SRC, SRCFLAGS...) {
  5132. # .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"}
  5133. .CMD=${tool:"contrib/tools/bison/bison"} $BISON_FLAGS --m4=${tool:"contrib/tools/bison/m4"} --defines=${nopath;noext;output;main;addincl;norel:SRC.h} -o ${nopath;noext;output:SRC.cpp} ${input:SRC} ${SRCFLAGS} && $YMAKE_PYTHON ${input:"build/scripts/preprocess.py"} $_ADD_HIDDEN_INPUTS($CPP_BISON_SKELS) ${nopath;noext;tmp:SRC.h} ${kv;hide:"p YC"} ${kv;hide:"pc light-green"}
  5134. .SEM=target_bison_parser PRIVATE ${input:SRC} ${output;nopath;noext;hide;suf=${OBJ_SUF}.o:SRC} ${nopath;noext;output;hide:SRC.h} ${nopath;noext;output;addincl;hide:SRC.h} && set_global_flags BISON_FLAGS $BISON_FLAGS && conan_require bison/3.5.3 && conan_import '"bin, bison* -> ./bin/bison/bin"' && conan_import '"res, * -> ./bin/bison/res"'
  5135. }
  5136. # tag:src-processing
  5137. macro _SRC("ypp", SRC, SRCFLAGS...) {
  5138. .CMD=$_SRC(y $SRC $SRCFLAGS)
  5139. }
  5140. # tag:src-processing
  5141. macro _SRC("gperf", SRC, SRCFLAGS...) {
  5142. .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"}
  5143. }
  5144. # tag:src-processing
  5145. macro _SRC("rl", SRC, SRCFLAGS...) {
  5146. .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"}
  5147. }
  5148. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5149. .CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${output;stdout;suf=.h.rl5:SRC} ${kv;hide:"p XN"} ${kv;hide:"pc yellow"}
  5150. }
  5151. # tag:src-processing
  5152. macro _SRC("rl5", SRC, SRCFLAGS...) {
  5153. .CMD=$_SRC(rl $SRC $SRCFLAGS)
  5154. }
  5155. # tag:src-processing
  5156. macro _SRC("asp", SRC, SRCFLAGS...) {
  5157. .CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${kv;hide:"p HT"} ${kv;hide:"pc yellow"}
  5158. }
  5159. # tag:src-processing
  5160. macro _SRC("rl6", SRC, SRCFLAGS...) {
  5161. .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"}
  5162. .SEM=target_ragel_lexers PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $RAGEL6_FLAGS ${SRCFLAGS} && set_global_flags RAGEL_FLAGS -L -I $S/ && conan_require ragel/6.10 && conan_import '"bin, ragel* -> ./bin"'
  5163. }
  5164. # tag:src-processing
  5165. macro _SRC("l", SRC, SRCFLAGS...) {
  5166. .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"}
  5167. .ADDINCL=contrib/tools/flex-old
  5168. .SEM=target_flex_lexers ${tool;hide:"contrib/tools/flex-old"} ${output;hide;suf=${OBJ_SUF}.o:SRC} ${input:SRC} && set_global_flags LEX_FLAGS $LEX_FLAGS
  5169. }
  5170. # tag:src-processing
  5171. macro _SRC("lex", SRC, SRCFLAGS...) {
  5172. .CMD=$_SRC(l $SRC $SRCFLAGS)
  5173. }
  5174. # tag:src-processing
  5175. macro _SRC("lpp", SRC, SRCFLAGS...) {
  5176. .CMD=$_SRC(l $SRC $SRCFLAGS)
  5177. }
  5178. # tag:src-processing
  5179. macro _SRC("pln", SRC, SRCFLAGS...) {
  5180. .CMD=$FML_TOOL -b -o ${output;pre=pln.;nopath;noext:SRC.cpp} -f ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5181. }
  5182. # tag:src-processing
  5183. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5184. .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"}
  5185. }
  5186. # tag:src-processing
  5187. macro _SRC("ev", SRC, SRCFLAGS...) {
  5188. .CMD=$EVLOG_CMD($SRC)
  5189. }
  5190. # tag:src-processing
  5191. macro _SRC("proto", SRC, SRCFLAGS...) {
  5192. .CMD=$PROTO_CMD($SRC)
  5193. .SEM=$PROTO_CMD($SRC)
  5194. }
  5195. # tag:src-processing
  5196. macro _SRC("gztproto", SRC, SRCFLAGS...) {
  5197. # _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.
  5198. # descriptor.proto must be resolved as google/protobuf/descriptor.proto
  5199. .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"}
  5200. .PEERDIR=kernel/gazetteer/proto
  5201. }
  5202. # tag:src-processing
  5203. macro _SRC("cfgproto", SRC, SRCFLAGS...) {
  5204. .CMD=$_CPP_CFGPROTO_CMD($SRC)
  5205. }
  5206. # tag:src-processing
  5207. macro _SRC("pyx", SRC, SRCFLAGS...) {
  5208. # Copy-paste from BUILDWITH_CYTHON
  5209. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:SRC} -o ${output;tobindir:SRC.cpp} $CYTHON_OUTPUT_INCLUDES ${SRCFLAGS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5210. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS --cplus ${SRCFLAGS} ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5211. .ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
  5212. }
  5213. # tag:src-processing
  5214. macro _SRC("in", SRC, SRCFLAGS...) {
  5215. .CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5216. .SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5217. }
  5218. macro MANUAL_GENERATION(Outs...) {
  5219. .SEM=ignored ${output;hide;noauto:Outs}
  5220. }
  5221. # tag:src-processing
  5222. macro _SRC("sc", SRC, SRCFLAGS...) {
  5223. .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"}
  5224. }
  5225. # tag:src-processing
  5226. macro _SRC("ssqls", SRC, SRCFLAGS...) {
  5227. .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"}
  5228. }
  5229. # tag:src-processing
  5230. macro _SRC("f", SRC, SRCFLAGS...) {
  5231. .CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${kv;hide:"p FT"} ${kv;hide:"pc light-green"}
  5232. .PEERDIR=contrib/libs/libf2c
  5233. .ADDINCL=contrib/libs/libf2c
  5234. }
  5235. # tag:src-processing
  5236. macro _SRC("cpp", SRC, SRCFLAGS...) {
  5237. .CMD=$_SRC_cpp($SRC $SRCFLAGS)
  5238. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5239. }
  5240. # tag:src-processing
  5241. macro _SRC("cxx", SRC, SRCFLAGS...) {
  5242. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5243. }
  5244. # tag:src-processing
  5245. macro _SRC("cc", SRC, SRCFLAGS...) {
  5246. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5247. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5248. }
  5249. # tag:src-processing
  5250. macro _SRC("C", SRC, SRCFLAGS...) {
  5251. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5252. }
  5253. # tag:src-processing
  5254. macro _SRC("c", SRC, SRCFLAGS...) {
  5255. .CMD=$_SRC_c($SRC $SRCFLAGS)
  5256. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
  5257. }
  5258. # tag:src-processing
  5259. macro _SRC("m", SRC, SRCFLAGS...) {
  5260. .CMD=$_SRC(c $SRC $SRCFLAGS)
  5261. }
  5262. # tag:src-processing
  5263. macro _SRC("masm", SRC, SRCFLAGS...) {
  5264. .CMD=$_SRC_masm($SRC $SRCFLAGS)
  5265. }
  5266. YASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${pre=-P :PREINCLUDES} \
  5267. && 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 \
  5268. && add_language ASM \
  5269. && conan_require yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5270. ASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS \
  5271. && 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 \
  5272. && add_language ASM \
  5273. && conan_require yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5274. # tag:src-processing
  5275. macro _SRC("yasm", SRC, SRCFLAGS...) {
  5276. .CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  5277. .SEM=$YASM_SEM
  5278. }
  5279. # tag:src-processing
  5280. macro _SRC("asm", SRC, SRCFLAGS...) {
  5281. .CMD=$_SRC(yasm $SRC $SRCFLAGS)
  5282. .SEM=$ASM_SEM
  5283. }
  5284. # tag:src-processing
  5285. macro _SRC("lua", SRC, SRCFLAGS...) {
  5286. .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"}
  5287. .PEERDIR=$LUAJIT_PATH
  5288. }
  5289. NVCC_STD_VER=14
  5290. when ($MSVC == "yes") {
  5291. NVCC_STD=/std:c++${NVCC_STD_VER}
  5292. }
  5293. otherwise {
  5294. NVCC_STD=-std=c++${NVCC_STD_VER}
  5295. }
  5296. # tag:src-processing
  5297. macro _SRC("cu", SRC, SRCFLAGS...) {
  5298. .CMD=$_SRC_CU_CMD
  5299. .SEM=target_cuda_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} && add_language CUDA && set_global_flags CMAKE_CUDA_STANDARD ${NVCC_STD_VER} && target_cuda_flags $CUDA_NVCC_FLAGS && target_cuda_cflags $USER_CXXFLAGS $SRCFLAGS
  5300. .PEERDIR=$_SRC_CU_PEERDIR
  5301. }
  5302. # tag:src-processing
  5303. macro _SRC("fbs", SRC, SRCFLAGS...) {
  5304. .CMD=$FBS_CMD($SRC, $SRCFLAGS)
  5305. .SEM=$FBS_CMD($SRC, $SRCFLAGS)
  5306. }
  5307. # tag:src-processing
  5308. macro _SRC("fbs64", SRC, SRCFLAGS...) {
  5309. .CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
  5310. }
  5311. # tag:src-processing
  5312. macro _SRC("pysrc", SRC, SRCFLAGS...) {
  5313. .CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
  5314. }
  5315. # tag:src-processing
  5316. macro _SRC_py2src(SRC, SRCFLAGS...) {
  5317. .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"}
  5318. }
  5319. # tag:src-processing
  5320. macro _SRC_py3src(SRC, SRCFLAGS...) {
  5321. .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"}
  5322. }
  5323. # tag:src-processing python-specific
  5324. when ($PYTHON3 == "yes") {
  5325. MACRO_ALIAS(_SRC_PYSRC _SRC_py3src)
  5326. }
  5327. otherwise {
  5328. MACRO_ALIAS(_SRC_PYSRC _SRC_py2src)
  5329. }
  5330. # tag:src-processing
  5331. macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
  5332. .CMD=$_SRC_C_NODEPS_CMD
  5333. }
  5334. # Custom flags for generated cpp-files. To support another generator:
  5335. # - insert additional file extension before .cpp into generated cpp-file name
  5336. # - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
  5337. #
  5338. # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
  5339. # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
  5340. #
  5341. # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
  5342. # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
  5343. ## tag:src-processing
  5344. _LANG_CFLAGS_FILTER=\
  5345. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
  5346. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
  5347. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
  5348. # tag:src-processing
  5349. # Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
  5350. macro _FILTER_EXTS(SKIP="", FLAGS...) {
  5351. .CMD=$FLAGS
  5352. }
  5353. # tag:src-processing
  5354. macro _LANG_CFLAGS(SRC) {
  5355. .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
  5356. }
  5357. # tag:src-processing
  5358. # ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
  5359. # Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
  5360. _LANG_CFLAGS_VALUE=
  5361. when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
  5362. _LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
  5363. }
  5364. # Allows to add single compilation unit name to the node's 'kv' section.
  5365. # This is used by the coverage machinery to instrument only the necessary sources
  5366. # when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
  5367. SCU_NAME_KV=
  5368. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  5369. SCU_NAME_KV=${hide;kv:"scu_name $KV_VAL"}
  5370. }
  5371. macro _ADD_SCU_NAME(KV_VAL) {
  5372. .CMD=$SCU_NAME_KV
  5373. }
  5374. # tag:src-processing
  5375. macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5376. .CMD=$_SRC_CPP_CMD $_ADD_SCU_NAME(${input:SRC})
  5377. }
  5378. # tag:src-processing
  5379. macro _SRC_c(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5380. .CMD=$_SRC_C_CMD $_ADD_SCU_NAME(${input:SRC})
  5381. }
  5382. # tag:src-processing
  5383. macro _SRC_m(SRC, SRCFLAGS...) {
  5384. .CMD=$_SRC_M_CMD
  5385. }
  5386. # tag:src-processing
  5387. macro _SRC_masm(SRC, SRCFLAGS...) {
  5388. .CMD=$_SRC_MASM_CMD
  5389. }
  5390. # tag:lua-specific
  5391. ### @usage: COMPILE_LUA(Src, [NAME <import_name>])
  5392. ###
  5393. ### Compile LUA source file to object code using LUA 2.0
  5394. ### Optionally override import name which is by default reflects Src name
  5395. macro COMPILE_LUA(Src, NAME="") {
  5396. .CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
  5397. }
  5398. # tag:lua-specific
  5399. ### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
  5400. ###
  5401. ### Compile LUA source file to object code using LUA 2.1
  5402. macro _SRC_lua_21(SRC, SRCFLAGS...) {
  5403. .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"}
  5404. .PEERDIR=$LUAJIT_21_PATH
  5405. }
  5406. # tag:lua-specific
  5407. ### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
  5408. ###
  5409. ### Compile LUA source file to object code using LUA 2.1
  5410. ### Optionally override import name which is by default reflects Src name
  5411. macro COMPILE_LUA_21(Src, NAME="") {
  5412. .CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
  5413. }
  5414. GETTEXT_KEEP_PATH=no
  5415. _MO_OUTPUT=
  5416. when ($GETTEXT_KEEP_PATH == "yes") {
  5417. _MO_OUTPUT=${output;noauto;norel;noext:SRC.mo}
  5418. }
  5419. otherwise {
  5420. _MO_OUTPUT=${output;noauto;nopath;noext;tobindir:SRC.mo}
  5421. }
  5422. # tag:src-processing
  5423. macro _SRC("po", SRC, SRCFLAGS...) {
  5424. .CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
  5425. }
  5426. # tag:ydl-specific
  5427. YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
  5428. YDL_DESC_FLAGS=
  5429. # tag:src-processing tag:ydl-specific
  5430. macro _SRC("ydl", SRC, SRCFLAGS...) {
  5431. .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"}
  5432. .PEERDIR+=statbox/ydl/runtime/cpp
  5433. }
  5434. # tag:ydl-specific
  5435. ### @usage BUILD_YDL_DESC(Input Symbol Output)
  5436. ###
  5437. ### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
  5438. ###
  5439. ### @example:
  5440. ###
  5441. ### PACKAGE()
  5442. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5443. ### END()
  5444. ###
  5445. ### 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.
  5446. macro BUILD_YDL_DESC(Input, Symbol, Output) {
  5447. .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"}
  5448. }
  5449. # tag:ydl-specific
  5450. ### @usage: YDL_DESC_USE_BINARY()
  5451. ###
  5452. ### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
  5453. ###
  5454. ### @example:
  5455. ###
  5456. ### PACKAGE()
  5457. ### YDL_DESC_USE_BINARY()
  5458. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5459. ### END()
  5460. ###
  5461. ### This will generate descriptor Event.ydld in a binary format.
  5462. macro YDL_DESC_USE_BINARY() {
  5463. YDL_DESC_FLAGS_BINARY= --binary
  5464. SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
  5465. }
  5466. ### @usage SRC(File Flags...)
  5467. ###
  5468. ### Compile single file with extra Flags.
  5469. ### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
  5470. macro SRC(FILE, FLAGS...) {
  5471. _SRC(${lastext:FILE} $FILE $FLAGS)
  5472. }
  5473. ### @usage: SRCS(<[GLOBAL] File> ...)
  5474. ###
  5475. ### 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.
  5476. ### Arcadia Paths from the root and is relative to the project's LIST are supported
  5477. ###
  5478. ### 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.
  5479. ### 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)
  5480. ###
  5481. ### @example:
  5482. ###
  5483. ### LIBRARY(test_global)
  5484. ### SRCS(GLOBAL foo.cpp)
  5485. ### END()
  5486. ###
  5487. ### 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.
  5488. macro SRCS(FILES...) {
  5489. foreach (FILE : $FILES) {
  5490. _SRC(${lastext:FILE} $FILE)
  5491. }
  5492. }
  5493. # tag:src-specific tag:cpp-specific
  5494. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5495. ###
  5496. ### Defenition of generic macro. Report an error that the File with Ext is not
  5497. ### supported by macro MacroName if no appropriate macro specialization is found.
  5498. macro _SRC_STRICT_C_CPP(EXT, MACRO_NAME, FILE, FLAGS...) {
  5499. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  5500. }
  5501. # tag:src-specific tag:cpp-specific
  5502. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5503. ###
  5504. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single C file (with .c extension)
  5505. macro _SRC_STRICT_C_CPP("c", MACRO_NAME, FILE, FLAGS...) {
  5506. _SRC(c $FILE $FLAGS)
  5507. }
  5508. # tag:src-specific tag:cpp-specific
  5509. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5510. ###
  5511. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cpp extension)
  5512. macro _SRC_STRICT_C_CPP("cpp", MACRO_NAME, FILE, FLAGS...) {
  5513. _SRC(cpp $FILE $FLAGS)
  5514. }
  5515. # tag:src-specific tag:cpp-specific
  5516. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5517. ###
  5518. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cxx extension)
  5519. macro _SRC_STRICT_C_CPP("cxx", MACRO_NAME, FILE, FLAGS...) {
  5520. _SRC(cpp $FILE $FLAGS)
  5521. }
  5522. # tag:src-specific tag:cpp-specific
  5523. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5524. ###
  5525. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cc extension)
  5526. macro _SRC_STRICT_C_CPP("cc", MACRO_NAME, FILE, FLAGS...) {
  5527. _SRC(cpp $FILE $FLAGS)
  5528. }
  5529. # tag:src-specific tag:cpp-specific
  5530. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5531. ###
  5532. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .C extension)
  5533. macro _SRC_STRICT_C_CPP("C", MACRO_NAME, FILE, FLAGS...) {
  5534. _SRC(cpp $FILE $FLAGS)
  5535. }
  5536. # tag:src-specific tag:cpp-specific tag:cpu
  5537. ### @uasge SRC_C_SSE2(File Flags...)
  5538. ###
  5539. ### Compile a single C/C++ file with SSE2 and additional Flags
  5540. macro SRC_C_SSE2(FILE, FLAGS...) {
  5541. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE2 $FILE $SSE2_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse2)
  5542. }
  5543. # tag:src-specific tag:cpp-specific tag:cpu
  5544. ### @uasge SRC_C_SSE3(File Flags...)
  5545. ###
  5546. ### Compile a single C/C++ file with SSE3 and additional Flags
  5547. macro SRC_C_SSE3(FILE, FLAGS...) {
  5548. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE3 $FILE $SSE3_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse3)
  5549. }
  5550. # tag:src-specific tag:cpp-specific tag:cpu
  5551. ### @uasge SRC_C_SSSE3(File Flags...)
  5552. ###
  5553. ### Compile a single C/C++ file with SSSE3 and additional Flags
  5554. macro SRC_C_SSSE3(FILE, FLAGS...) {
  5555. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSSE3 $FILE $SSSE3_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .ssse3)
  5556. }
  5557. # tag:src-specific tag:cpp-specific tag:cpu
  5558. ### @uasge SRC_C_SSE4(File Flags...)
  5559. ###
  5560. ### Compile a single C/C++ file with SSE4 and additional Flags
  5561. macro SRC_C_SSE4(FILE, FLAGS...) {
  5562. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE4 $FILE $SSE4_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse4)
  5563. }
  5564. # tag:src-specific tag:cpp-specific tag:cpu
  5565. ### @uasge SRC_C_SSE41(File Flags...)
  5566. ###
  5567. ### Compile a single C/C++ file with SSE4.1 and additional Flags
  5568. macro SRC_C_SSE41(FILE, FLAGS...) {
  5569. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_SSE41 $FILE $SSE41_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse41)
  5570. }
  5571. # tag:src-specific tag:cpp-specific tag:cpu
  5572. ### @uasge SRC_C_AVX(File Flags...)
  5573. ###
  5574. ### Compile a single C/C++ file with AVX and additional Flags
  5575. macro SRC_C_AVX(FILE, FLAGS...) {
  5576. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_AVX $FILE $AVX_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx)
  5577. }
  5578. # tag:src-specific tag:cpp-specific tag:cpu
  5579. ### @uasge SRC_C_AVX2(File Flags...)
  5580. ###
  5581. ### Compile a single C/C++ file with AVX2 and additional Flags
  5582. macro SRC_C_AVX2(FILE, FLAGS...) {
  5583. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_AVX2 $FILE $AVX2_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx2)
  5584. }
  5585. # tag:src-specific tag:cpp-specific tag:cpu
  5586. ### @uasge SRC_C_AVX512(File Flags...)
  5587. ###
  5588. ### Compile a single C/C++ file with AVX512 and additional Flags
  5589. macro SRC_C_AVX512(FILE, FLAGS...) {
  5590. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_AVX512 $FILE $AVX512_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx512)
  5591. }
  5592. # tag:src-specific tag:cpp-specific tag:cpu
  5593. ### @uasge SRC_C_XOP(File Flags...)
  5594. ###
  5595. ### Compile a single C/C++ file with (an AMD-specific instruction set,
  5596. ### see https://en.wikipedia.org/wiki/XOP_instruction_set) and additional Flags
  5597. macro SRC_C_XOP(FILE, FLAGS...) {
  5598. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_XOP $FILE $XOP_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .xop)
  5599. }
  5600. # tag:src-specific tag:cpp-specific tag:cpu
  5601. ### @uasge SRC_C_PCLMUL(File Flags...)
  5602. ###
  5603. ### Compile a single C/C++ file with PCLMUL and additional Flags
  5604. macro SRC_C_PCLMUL(FILE, FLAGS...) {
  5605. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE $PCLMUL_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .pclmul)
  5606. }
  5607. # tag:src-specific tag:cpp-specific
  5608. ### @uasge SRC_C_PIC(File Flags...)
  5609. ###
  5610. ### Compile a single C/C++ file with -fPIC and additional Flags
  5611. macro SRC_C_PIC(FILE, FLAGS...) {
  5612. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PIC $FILE $PIC_CFLAGS $FLAGS)
  5613. }
  5614. # tag:src-specific tag:cpp-specific
  5615. ### @uasge SRC_C_NO_LTO(File Flags...)
  5616. ###
  5617. ### Compile a single C/C++ file with link-time-optimization disabling and additional Flags
  5618. macro SRC_C_NO_LTO(FILE, FLAGS...) {
  5619. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_NO_LTO $FILE $NO_LTO_CFLAGS $FLAGS)
  5620. }
  5621. # tag:python-processing tag:cython
  5622. # TODO: use it in [.pyx] cmd
  5623. ### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
  5624. ###
  5625. ### Generates .cpp file from .pyx.
  5626. macro BUILDWITH_CYTHON_CPP(Src, Options...) {
  5627. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir:Src.cpp} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5628. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5629. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5630. }
  5631. # tag:python-processing tag:cython tag:internal
  5632. ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
  5633. ###
  5634. ### Generates .cpp file from .pyx and attach extra input Dep.
  5635. ### If Dep changes the .cpp file will be re-generated.
  5636. macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
  5637. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir:Src.cpp} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5638. .SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5639. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5640. }
  5641. # tag:python-processing tag:cython
  5642. ### @usage: BUILDWITH_CYTHON_C(Src Options...)
  5643. ###
  5644. ### Generates .c file from .pyx.
  5645. macro BUILDWITH_CYTHON_C(Src, Options...) {
  5646. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir:Src.c} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5647. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5648. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5649. }
  5650. # tag:python-processing tag:cython tag:internal
  5651. ### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
  5652. ###
  5653. ### Generates .c file from .pyx and attach extra input Dep.
  5654. ### If Dep changes the .c file will be re-generated.
  5655. macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
  5656. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir:Src.c} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5657. .SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5658. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5659. }
  5660. # tag:python-processing tag:cython tag:internal
  5661. ### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
  5662. ###
  5663. ### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
  5664. macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
  5665. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5666. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5667. }
  5668. # tag:python-processing tag:cython tag:internal
  5669. ### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
  5670. ###
  5671. ### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
  5672. macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
  5673. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} ${output;hide;addincl;noext;defext=_api.h;tobindir:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5674. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5675. }
  5676. # tag:python-processing tag:internal
  5677. ### @usage: _SWIG_PYTHON_CPP(Src, DstSubPrefix) # internal
  5678. ###
  5679. ### Run swig on Src to produce DstSubPrefix.py and DstSubPrefix_swg.cpp that
  5680. ### provides DstSubPrefix_swg python module.
  5681. macro _SWIG_PYTHON_CPP(Src, DstSubPrefix) {
  5682. .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"}
  5683. ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY)
  5684. }
  5685. # tag:python-processing tag:internal
  5686. ### @usage: _SWIG_PYTHON_C(Src, DstSubPrefix) # internal
  5687. ###
  5688. ### Like _SWIG_PYTHON_CPP but generate DstSubPrefix_swg.c.
  5689. macro _SWIG_PYTHON_C(Src, DstSubPrefix) {
  5690. .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"}
  5691. ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY)
  5692. }
  5693. ### @usage: BUILDWITH_RAGEL6(Src Options...)
  5694. ###
  5695. ### Compile .rl file using Ragel6.
  5696. macro BUILDWITH_RAGEL6(Src, Options...) {
  5697. .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"}
  5698. }
  5699. # tag:python-processing tag:internal
  5700. # TODO: use it in [.pyx] cmd
  5701. ### @usage: _PY_REGISTER() # internal
  5702. ###
  5703. ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
  5704. ###
  5705. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5706. macro _PY_REGISTER(Func) {
  5707. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5708. SRCS(GLOBAL $Func.reg.cpp)
  5709. }
  5710. # tag:python-processing tag:internal
  5711. ### @usage: _PY3_REGISTER() # internal
  5712. ###
  5713. ### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
  5714. ###
  5715. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5716. macro _PY3_REGISTER(Func) {
  5717. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${output;noauto:Func.reg3.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5718. SRCS(GLOBAL $Func.reg3.cpp)
  5719. }
  5720. # tag:python-processing tag:internal
  5721. ### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
  5722. ###
  5723. ### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
  5724. ###
  5725. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5726. macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
  5727. .CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5728. }
  5729. # tag:python-processing tag:internal
  5730. ### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
  5731. ###
  5732. ### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
  5733. ###
  5734. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5735. macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
  5736. .CMD=${env:"PYTHONHASHSEED=0"} ${tool:"contrib/tools/python3/pycc"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc3} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5737. }
  5738. macro _ARCHIVE_SEM_HELPER(OUT, DONTCOMPRESS, Files...) {
  5739. .SEM=add_custom_command OUTPUT ${OUT} DEPENDS ${Files} COMMAND $ARCH_TOOL -q $DONTCOMPRESS ${join=\: :Files}: -o ${OUT}
  5740. }
  5741. ### @usage: ARCHIVE_ASM(NAME archive_name files...)
  5742. ###
  5743. ### Similar to the macro ARCHIVE, but:
  5744. ### 1. works faster and it is better to use for large files.
  5745. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
  5746. macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  5747. .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;chksum;suf=$OBJ_SUF.rodata:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"}
  5748. .SEM=$_ARCHIVE_SEM_HELPER(${output;suf=$OBJ_SUF.rodata:NAME}, $DONTCOMPRESS, ${input:Files})
  5749. }
  5750. # tag:yweb-specific
  5751. macro PIRE_INLINE_CMD(SRC) {
  5752. .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"}
  5753. }
  5754. # tag:yweb-specific
  5755. macro PIRE_INLINE(FILES...) {
  5756. foreach (FILE : $FILES) {
  5757. PIRE_INLINE_CMD($FILE)
  5758. }
  5759. }
  5760. ### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
  5761. ###
  5762. ### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  5763. ###
  5764. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  5765. macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  5766. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;chksum;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  5767. .SEM=$_ARCHIVE_SEM_HELPER(${output;addincl;noauto:NAME}, $DONTCOMPRESS, ${input:Files})
  5768. }
  5769. ### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
  5770. ###
  5771. ### Add arbitrary data to a module be accessible by specified key.
  5772. ### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  5773. ###
  5774. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  5775. macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", Files...) {
  5776. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;chksum;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  5777. }
  5778. #scripts
  5779. #special commands
  5780. BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
  5781. SVNVERSION_JAVA_MARKER=output-java-class
  5782. SVNVERSION_GO_MARKER=output-go
  5783. VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
  5784. VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
  5785. VCS_C=$BINDIR/__vcs_version__.c
  5786. VCS_GO=$BINDIR/__vcs_version__.go
  5787. VCS_JAVA=$BINDIR/__vcs_version__.mf
  5788. VCS_INFO_DISABLE_CACHE__NO_UID__=
  5789. YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  5790. CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  5791. CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
  5792. YASM_DEBUG_INFO=
  5793. CL_DEBUG_INFO=
  5794. CL_MACRO_INFO=
  5795. when ($FORCE_VCS_INFO_UPDATE == "yes") {
  5796. VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
  5797. }
  5798. ### Works for pyton too.
  5799. 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))
  5800. 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__
  5801. 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__
  5802. macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
  5803. .CMD=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
  5804. }
  5805. ### @usage: CREATE_BUILDINFO_FOR(GenHdr)
  5806. ###
  5807. ### Creates header file to access some information about build specified via configuration variables.
  5808. ### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
  5809. macro CREATE_BUILDINFO_FOR(GenHdr) {
  5810. .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__
  5811. .SEM=$PYTHON($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
  5812. }
  5813. DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
  5814. DECIMAL_MD5_FIXED=
  5815. ### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
  5816. ###
  5817. ### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
  5818. ### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
  5819. macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
  5820. .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"}
  5821. }
  5822. # tag:internal
  5823. ### @usage $CFG_VARS # internal
  5824. ###
  5825. ### Mark commands that embed Configuration variables into files
  5826. macro CFG_VARS() {
  5827. .GEN_FROM_FILE=yes
  5828. }
  5829. ### @usage: CONFIGURE_FILE(from to)
  5830. ###
  5831. ### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
  5832. ### The values are collected during configure stage, while replacement itself happens during build stage.
  5833. ### Used implicitly for .in-files processing.
  5834. macro CONFIGURE_FILE(Src, Dst) {
  5835. .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"}
  5836. .SEM=set_vars ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;rootrel:Dst}
  5837. }
  5838. ### @usage: BASE_CODEGEN(tool_path prefix)
  5839. ###
  5840. ### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in.
  5841. macro BASE_CODEGEN(Tool, Prefix, Opts...) {
  5842. .CMD=${tool:Tool} ${input:Prefix.in} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc yellow"}
  5843. }
  5844. # tag:internal
  5845. ### @usage: _SPLIT_CODEGEN_BASE(tool prefix OUTS[] OUTPUT_INCLUDES[]) # internal
  5846. ###
  5847. ### Generator of a certain number .the. cpp file + one header .h file from .in.
  5848. ### This is the call of the generator. Python macro SPLIT_CODEGEN() is defined in order to properly fill command outputs from OUT_NUM argument.
  5849. macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) {
  5850. .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"}
  5851. }
  5852. STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \
  5853. ${output_include;hide:"util/generic/strbuf.h"} \
  5854. ${output_include;hide:"util/generic/vector.h"} \
  5855. ${output_include;hide:"util/generic/ptr.h"} \
  5856. ${output_include;hide:"util/generic/yexception.h"} \
  5857. ${output_include;hide:"kernel/struct_codegen/reflection/reflection.h"} \
  5858. ${output_include;hide:"kernel/struct_codegen/reflection/floats.h"}
  5859. ### @usage: STRUCT_CODEGEN(Prefix)
  5860. ### A special case BASE_CODEGEN, in which the kernel/struct_codegen/codegen_tool tool is used.
  5861. macro STRUCT_CODEGEN(Prefix) {
  5862. .CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES)
  5863. .PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection
  5864. }
  5865. ### @usage: DUMPERF_CODEGEN(Prefix)
  5866. ### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used
  5867. macro DUMPERF_CODEGEN(Prefix) {
  5868. .CMD=$BASE_CODEGEN(extsearch/images/robot/tools/dumperf/codegen, $Prefix, ${output_include;hide:"extsearch/images/kernel/erf/erf_format.h"})
  5869. }
  5870. # tag:flags
  5871. ### @usage: LDFLAGS(LinkerFlags...)
  5872. ###
  5873. ### Add flags to the link command line of executable or shared library/dll.
  5874. ### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
  5875. ### Note: remember about the incompatibility of flags for gcc and cl.
  5876. macro LDFLAGS(Flags...) {
  5877. SET_APPEND(LDFLAGS_GLOBAL $Flags)
  5878. }
  5879. # tag:flags
  5880. ### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
  5881. ###
  5882. ### Add the specified flags to the compilation command of C and C++ files.
  5883. ### @params: GLOBAL - Propagates these flags to dependent projects
  5884. ### Note: remember about the incompatibility flags for clang and cl (to set flags specifically for cl.exe use MSVC_FLAGS).
  5885. macro CFLAGS(Flags...) {
  5886. SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
  5887. }
  5888. # tag:flags
  5889. ### @usage: MASMFLAGS(compiler flags)
  5890. ### Add the specified flags to the compilation command of .masm files.
  5891. macro MASMFLAGS(Flags...) {
  5892. SET_APPEND(MASMFLAGS $Flags)
  5893. }
  5894. # tag:flags
  5895. ### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
  5896. ### Add the specified flags to the compilation command of .c (but not .cpp) files.
  5897. ### @params: GLOBAL - Distributes these flags on dependent projects
  5898. macro CONLYFLAGS(Flags...) {
  5899. SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
  5900. }
  5901. # tag:flags
  5902. ### @usage: CXXFLAGS(compiler_flags)
  5903. ### Add the specified flags to the compilation command of .cpp (but not .c) files.
  5904. macro CXXFLAGS(Flags...) {
  5905. SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
  5906. }
  5907. # tag:flags
  5908. ### @usage: CUDA_NVCC_FLAGS(compiler flags)
  5909. ### Add the specified flags to the compile line .cu-files.
  5910. macro CUDA_NVCC_FLAGS(Flags...) {
  5911. SET_APPEND(CUDA_NVCC_FLAGS $Flags)
  5912. }
  5913. # tag:flags
  5914. ### @usage: NVCC_DEVICE_LINK(file.cu...)
  5915. ### Run nvcc --device-link on objects compiled from srcs with --device-c.
  5916. ### This generates a stub object devlink.o that supplies missing pieces for the
  5917. ### host linker to link relocatable device objects into the final executable.
  5918. macro NVCC_DEVICE_LINK(Srcs...) {
  5919. .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"}
  5920. }
  5921. ### @usage: STRIP()
  5922. ### Strip debug info from a PROGRAM, DLL or TEST.
  5923. ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
  5924. macro STRIP() {
  5925. ENABLE(STRIP)
  5926. }
  5927. ### @usage: NO_OPTIMIZE()
  5928. ### Build code without any optimizations (-O0 mode).
  5929. macro NO_OPTIMIZE() {
  5930. ENABLE(NO_OPTIMIZE)
  5931. }
  5932. ### @usage: NO_COMPILER_WARNINGS()
  5933. ### Disable all compiler warnings in the module.
  5934. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5935. macro NO_COMPILER_WARNINGS() {
  5936. ENABLE(NO_COMPILER_WARNINGS)
  5937. }
  5938. ### @usage: WERROR()
  5939. ### Consider warnings as errors in the current module.
  5940. ### In the bright future will be removed, since WERROR is the default.
  5941. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5942. macro WERROR() {
  5943. ENABLE(WERROR)
  5944. }
  5945. ### @usage: NO_WERROR()
  5946. ### Override WERROR() behavior
  5947. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5948. macro NO_WERROR() {
  5949. DISABLE(WERROR)
  5950. }
  5951. ### @usage: NO_WSHADOW()
  5952. ### Disable C++ shadowing warnings.
  5953. macro NO_WSHADOW() {
  5954. ENABLE(NO_WSHADOW)
  5955. }
  5956. # tag:internal
  5957. ### @usage: NO_PLATFORM_RESOURCES() # internal
  5958. ### Exclude dependency on platform resources libraries.
  5959. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  5960. macro NO_PLATFORM_RESOURCES() {
  5961. ENABLE(NOPLATFORM_RESOURCES)
  5962. }
  5963. # tag:internal tag:codenav
  5964. ### @usage: NO_CODENAVIGATION() # internal
  5965. ### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
  5966. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  5967. macro NO_CODENAVIGATION() {
  5968. ENABLE(NOCODENAVIGATION)
  5969. }
  5970. ### @usage: NO_UTIL()
  5971. ### Build module without dependency on util.
  5972. ### Note: use this with care. Util most likely will be linked into executable anyway,
  5973. ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
  5974. macro NO_UTIL() {
  5975. ENABLE(NOUTIL)
  5976. }
  5977. ### @usage: NO_RUNTIME()
  5978. ###
  5979. ### This macro:
  5980. ### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
  5981. ### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
  5982. ### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
  5983. ### may not be detected at build time and may lead to unpredictable behavors at configure time.
  5984. macro NO_RUNTIME() {
  5985. SET(USE_ARCADIA_LIBM no)
  5986. NO_UTIL()
  5987. ENABLE(NORUNTIME)
  5988. }
  5989. ### @usage: NO_LIBC()
  5990. ###
  5991. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
  5992. ### Note: use this with care. libc most likely will be linked into executable anyway,
  5993. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  5994. macro NO_LIBC() {
  5995. NO_RUNTIME()
  5996. DISABLE(MUSL)
  5997. }
  5998. ### @usage: NO_PLATFORM()
  5999. ###
  6000. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
  6001. ### Note: use this with care. libc most likely will be linked into executable anyway,
  6002. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  6003. macro NO_PLATFORM() {
  6004. NO_LIBC()
  6005. ENABLE(NOPLATFORM)
  6006. }
  6007. # tag:cpp-specific
  6008. ### @usage: USE_CXX()
  6009. ###
  6010. ### Add dependency on C++ runtime
  6011. ### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
  6012. macro USE_CXX() {
  6013. DISABLE(NORUNTIME)
  6014. }
  6015. ### @usage: USE_UTIL()
  6016. ###
  6017. ### Add dependency on util and C++ runtime
  6018. ### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
  6019. macro USE_UTIL() {
  6020. USE_CXX()
  6021. DISABLE(NOUTIL)
  6022. }
  6023. # tag:deprecated
  6024. ### @usage: NO_JOIN_SRC() # deprecated, does-nothing
  6025. ### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
  6026. macro NO_JOIN_SRC() {
  6027. ENABLE(UNUSED_MACRO)
  6028. }
  6029. # tag:sanitize
  6030. ### @usage: NO_SANITIZE()
  6031. ###
  6032. ### Disable all sanitizers for the module.
  6033. macro NO_SANITIZE() {
  6034. DISABLE(SANITIZER_TYPE)
  6035. }
  6036. # tag:coverage tag:sanitize
  6037. ### @usage: NO_SANITIZE_COVERAGE()
  6038. ###
  6039. ### Disable lightweight coverage (-fsanitize-coverage) for the module.
  6040. macro NO_SANITIZE_COVERAGE() {
  6041. DISABLE(SANITIZE_COVERAGE)
  6042. }
  6043. # tag:coverage
  6044. ### @usage: NO_CLANG_COVERAGE()
  6045. ###
  6046. ### Disable heavyweight clang coverage for the module
  6047. macro NO_CLANG_COVERAGE() {
  6048. DISABLE(CLANG_COVERAGE)
  6049. }
  6050. macro NO_CLANG_TIDY() {
  6051. DISABLE(TIDY)
  6052. }
  6053. # tag:python-specific tag:coverage
  6054. ### @usage: NO_PYTHON_COVERAGE()
  6055. ###
  6056. ### Disable python coverage for module
  6057. macro NO_PYTHON_COVERAGE() {
  6058. DISABLE(PYTHON_COVERAGE)
  6059. }
  6060. # tag:python-specific tag:coverage tag:cython
  6061. ### @usage: NO_CYTHON_COVERAGE()
  6062. ###
  6063. ### Disable cython and cythonized python coverage (CYTHONIZE_PY)
  6064. ### Implies NO_CLANG_COVERAGE() - right now, we can't disable instrumentation for .py.cpp files, but enable for .cpp
  6065. macro NO_CYTHON_COVERAGE() {
  6066. DISABLE(CYTHON_COVERAGE)
  6067. NO_CLANG_COVERAGE()
  6068. }
  6069. # tag:lua-specific
  6070. LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
  6071. macro _LUAJIT_OBJDUMP(Src, OUT="") {
  6072. .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"}
  6073. }
  6074. # tag:lua-specific
  6075. LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
  6076. macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
  6077. .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"}
  6078. }
  6079. macro _MX_BIN_TO_INFO(Src) {
  6080. .CMD=${tool:"tools/mx_bin2info"} ${input:Src} ${output;nopath;noext;noauto:Src.info} ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
  6081. }
  6082. MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \
  6083. ${output_include;hide:"kernel/matrixnet/mn_sse.h"} \
  6084. ${output_include;hide:"library/cpp/archive/yarchive.h"} \
  6085. ${output_include;hide:"util/memory/blob.h"} \
  6086. ${output_include;hide:"util/generic/hash.h"} \
  6087. ${output_include;hide:"util/generic/ptr.h"} \
  6088. ${output_include;hide:"util/generic/singleton.h"}
  6089. macro _MX_GEN_TABLE(Srcs...) {
  6090. .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"}
  6091. PEERDIR(kernel/matrixnet)
  6092. PEERDIR(library/cpp/archive)
  6093. }
  6094. RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"}
  6095. ### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
  6096. ###
  6097. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
  6098. ###
  6099. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6100. macro GENERATE_ENUM_SERIALIZATION(File) {
  6101. .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"}
  6102. .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"}
  6103. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6104. }
  6105. ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
  6106. ###
  6107. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
  6108. ### Provide access to serialization functions via generated header File_serialized.h
  6109. ###
  6110. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6111. macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
  6112. .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"}
  6113. .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"}
  6114. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6115. }
  6116. ### @usage: DEB_VERSION(File)
  6117. ###
  6118. ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
  6119. macro DEB_VERSION(File) {
  6120. .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"}
  6121. }
  6122. BUILD_MN_SCRIPT=build/scripts/build_mn.py
  6123. # tag:matrixnet
  6124. ### @usage: BUILD_MN([CHECK] [PTR] [MULTI] mninfo mnname) # matrixnet
  6125. ###
  6126. ### Generate MatrixNet data and access code using single command.
  6127. ### Alternative macro BUILD_MNS() works faster and better for large files.
  6128. macro BUILD_MN(MnInfo, MnName, CHECK?"fml_tool=$FML_UNUSED_TOOL CHECK":"", MULTI?, PTR?, RANKING_SUFFIX="") {
  6129. .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"}
  6130. }
  6131. macro _BUILD_MNS_FILE(Input, Name, Output, Suffix, Check, Fml_tool, AsmDataName) {
  6132. .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"}
  6133. }
  6134. MNS_OUTPUT=mnmodels
  6135. macro _BUILD_MNS_CPP(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6136. .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"}
  6137. }
  6138. macro _BUILD_MNS_HEADER(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6139. .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"}
  6140. }
  6141. # TODO: support foreach_in and keywords simultaneous usage (look at BUILD_MNS_FILES)
  6142. # tag:matrixnet
  6143. ### @usage: BUILD_MNS([CHECK] NAME listname mninfos...) # matrixnet
  6144. ###
  6145. ### Generate MatrixNet data and access code using separate commands for support code, interface and data.
  6146. ### Faster version of BUILD_MN() macro for large files.
  6147. macro BUILD_MNS(Files...) {
  6148. _BUILD_MNS_HEADER($Files)
  6149. _BUILD_MNS_CPP($Files)
  6150. _BUILD_MNS_FILES($Files)
  6151. }
  6152. ### @usage: COMPILE_NLG(Src...)
  6153. ###
  6154. ### Generate and compile .nlg templates (Jinja2-based) and interface for megamind runtime.
  6155. ###
  6156. ### Alice-specific macro
  6157. macro COMPILE_NLG(Src...) {
  6158. PEERDIR(alice/nlg/library/runtime)
  6159. RUN_PROGRAM(alice/nlg/tools/codegen compile-cpp --import-dir ${ARCADIA_ROOT} --out-dir ${ARCADIA_BUILD_ROOT} --include-prefix ${MODDIR} ${Src} IN ${Src} OUT_NOAUTO register.cpp register.h ${suf=.cpp:Src} ${suf=.h:Src} ${suf=.pb.txt:Src})
  6160. SRCS(GLOBAL register.cpp ${suf=.cpp:Src})
  6161. }
  6162. ### @usage: NEED_CHECK()
  6163. ###
  6164. ### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
  6165. ### automatically merged to trunk only if there is no new broken build targets in check results.
  6166. ### The use of this macro is disabled by default.
  6167. macro NEED_CHECK(Flags...) {
  6168. # TODO: FIXME
  6169. ENABLE(UNUSED_MACRO)
  6170. }
  6171. ### @usage: NO_NEED_CHECK()
  6172. ###
  6173. ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
  6174. macro NO_NEED_CHECK(Flags...) {
  6175. ENABLE(UNUSED_MACRO)
  6176. }
  6177. # tag:deprecated
  6178. ### @usage: NEED_REVIEW() # deprecated
  6179. ###
  6180. ### Mark the project as needing review.
  6181. ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
  6182. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
  6183. macro NEED_REVIEW(Flags...) {
  6184. # TODO: FIXME
  6185. ENABLE(UNUSED_MACRO)
  6186. }
  6187. ### @usage: VERSION(Args...)
  6188. ###
  6189. ### Specify version of a module. Currently unused by build system, only informative.
  6190. macro VERSION(Flags...) {
  6191. ENABLE(UNUSED_MACRO)
  6192. }
  6193. DATAWORK_SCHEEME_EXPORT_FLAGS=
  6194. when ($UNIX == "yes") {
  6195. SCHEEME2_CFLAGS= -E -x c++
  6196. }
  6197. when ($WIN32 == "yes") {
  6198. SCHEEME2_CFLAGS= /E /TP
  6199. }
  6200. SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
  6201. ### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
  6202. ###
  6203. ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
  6204. ###
  6205. ### 1. ${scheeme_name}.inc - the name of the generated file.
  6206. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
  6207. ###
  6208. ### @example:
  6209. ###
  6210. ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
  6211. ###
  6212. ### 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)
  6213. ### sets in extra option
  6214. ###
  6215. ### @example:
  6216. ###
  6217. ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
  6218. ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
  6219. ### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
  6220. ###
  6221. ### for compatibility with C++ compiler and the external environment.
  6222. ### See tools/structparser for more details.
  6223. macro GEN_SCHEEME2(ScheemeName, FromFile) {
  6224. .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"}
  6225. }
  6226. ### @usage: SYMLINK(from to)
  6227. ### Add symlink
  6228. macro SYMLINK(From, To) {
  6229. .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"}
  6230. }
  6231. # tag:internal
  6232. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6233. ### Generate prefix " && target_sources PRIVATE " before $Args when GENERATE is specified in the list of actual arguments
  6234. macro _TARGET_SOURCES_FOR_HEADERS_IMPL(GENERATE?" && target_sources PRIVATE ":"", Args...) {
  6235. .SEM=$GENERATE ${output;ext=.h:Args} ${output;ext=.hh:Args} ${output;ext=.hpp:Args} ${output;ext=.inc:Args} ${output;ext=.i:Args}
  6236. }
  6237. # tag:internal
  6238. ### @usage: _TARGET_SOURCES_FOR_HEADERS(Args...) # internal
  6239. ### Generate prefix " && target_sources PRIVATE " before $Args if Args is not empty
  6240. macro _TARGET_SOURCES_FOR_HEADERS(Args...) {
  6241. .SEM=$_TARGET_SOURCES_FOR_HEADERS_IMPL(${pre=GENERATE :Args})
  6242. }
  6243. # tag:internal
  6244. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6245. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args when GENERATE is specified in the list of actual arguments
  6246. macro _SET_ENV_FOR_CUSTOM_COMMAND_IMPL(GENERATE?" ${CMAKE_COMMAND} -E env ":"", Args...) {
  6247. .SEM=$GENERATE ${pre= :Args}
  6248. }
  6249. # tag:internal
  6250. ### @usage: _SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
  6251. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args if Args is not empty
  6252. macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
  6253. .SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args})
  6254. }
  6255. macro _FMT_INDUCED_DEPS(For, Deps...) {
  6256. .CMD=${induced_deps=$For:Deps}
  6257. }
  6258. ### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...)
  6259. ###
  6260. ### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR`
  6261. ### This tells that files of Type resulted from code generation macros (not neccessarily directly,
  6262. ### but in processing chain of generated files) should have extra dependencies from list of Files...
  6263. ###
  6264. ### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from
  6265. ### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp
  6266. ### resulted from Cython-processing of generated pyx. The code ganeration will look like:
  6267. ### ```
  6268. ### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd)
  6269. ### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h)
  6270. ### RUN_PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS)
  6271. ### ```
  6272. ###
  6273. ### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing
  6274. ### as an element of array parameter. This is needed because language of ya.make doesn't support
  6275. ### Dict params right now and so it is impossible to directly pass something
  6276. ### like `{Type1:[Files2...], Type2:[Files2...]}`
  6277. ###
  6278. macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) {
  6279. SET($VAR \$_FMT_INDUCED_DEPS($For $Deps))
  6280. }
  6281. ### @usage: RUN_PROGRAM(tool_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6282. ###
  6283. ### Run a program from arcadia.
  6284. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6285. ###
  6286. ### Parameters:
  6287. ### - tool_path - Path to the directory of the tool.
  6288. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6289. ### - CWD dir - Absolute path of the working directory.
  6290. ### - ENV key=value... - Environment variables.
  6291. ### - TOOL tools... - Auxiliary tool directories.
  6292. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6293. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6294. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6295. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6296. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6297. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6298. ###
  6299. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6300. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6301. ### 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).
  6302. macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6303. .CMD=${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6304. .SEM=add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${tool:Tool} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND ${tool:Tool} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  6305. }
  6306. # tag:lua-specific
  6307. ### @usage: RUN_LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6308. ###
  6309. ### Run a lua script.
  6310. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6311. ###
  6312. ### Parameters:
  6313. ### - script_path - Path to the script.3
  6314. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6315. ### - CWD dir - Absolute path of the working directory.
  6316. ### - ENV key=value... - Environment variables.
  6317. ### - TOOL tools... - Auxiliary tool directories.
  6318. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6319. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6320. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6321. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6322. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6323. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6324. ###
  6325. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6326. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6327. macro RUN_LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6328. .CMD=${cwd:CWD} ${env:ENV} $LUA_TOOL ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p LU"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6329. }
  6330. # tag:python-specific
  6331. ### @usage: PYTHON(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6332. ###
  6333. ### Run a python script with $(PYTHON)/python built from devtools/huge_python.
  6334. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6335. ###
  6336. ### Parameters:
  6337. ### - script_path - Path to the script.
  6338. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6339. ### - CWD dir - Absolute path of the working directory.
  6340. ### - ENV key=value... - Environment variables.
  6341. ### - TOOL tools... - Auxiliary tool directories.
  6342. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6343. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6344. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6345. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6346. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6347. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6348. ###
  6349. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6350. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6351. macro PYTHON(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6352. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6353. .SEM=find_package Python2 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python2::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  6354. }
  6355. # tag:python-specific
  6356. ### @usage: RUN_PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6357. ###
  6358. ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
  6359. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6360. ###
  6361. ### Parameters:
  6362. ### - script_path - Path to the script.
  6363. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6364. ### - CWD dir - Absolute path of the working directory.
  6365. ### - ENV key=value... - Environment variables.
  6366. ### - TOOL tools... - Auxiliary tool directories.
  6367. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6368. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6369. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6370. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6371. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6372. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6373. ###
  6374. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6375. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6376. macro RUN_PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6377. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6378. .PEERDIR=$YMAKE_PYTHON3_PEER
  6379. .SEM=find_package Python3 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python3::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  6380. }
  6381. # tag:java-specific
  6382. macro _RUN_JAVA(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) {
  6383. PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6384. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input;pre=build/scripts/:HIDE_OUTPUT.py} $JDK_RESOURCE/bin/java $Args ${tool;hide:TOOL} ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  6385. }
  6386. ### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6387. ###
  6388. ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
  6389. ### You may specify extra dependencies that output files bring using OUTPUT_INCLUDES or INDUCED_DEPS. The change of these may e.g. lead to recompilation of .cpp files extracted from resource.
  6390. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
  6391. ###
  6392. ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
  6393. ###
  6394. ### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
  6395. ### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
  6396. ### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
  6397. ### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
  6398. ###
  6399. ### RENAME RESOURCE allows to rename the resource without specifying its file name.
  6400. ###
  6401. ### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6402. ### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6403. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6404. ###
  6405. ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
  6406. ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
  6407. ### so you shall place it immediately after resource_id.
  6408. macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:") {
  6409. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6410. ADD_CHECK(check.resource $Id)
  6411. }
  6412. ### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6413. ###
  6414. ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6415. macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6416. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_mds.py"} --key $Key $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p MD"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6417. ADD_CHECK(check.mds $Key)
  6418. }
  6419. # tag:internal
  6420. ### @usage: _FROM_EXTERNAL(ExtFile [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) #internal
  6421. ###
  6422. ### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS).
  6423. macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") {
  6424. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$EXT;suf=.external:OutFile} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_external.py"} --external-file ${input:File} --resource-file $(RESOURCE_ROOT)/ext/$OutFile --copy-to-dir $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/fetch_from_sandbox.py"} ${input;hide:"build/scripts/fetch_from_mds.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p XT"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6425. #FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors
  6426. #FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented
  6427. }
  6428. ### @usage LARGE_FILES([AUTOUPDATED] Files...)
  6429. ###
  6430. ### Use large file ether from working copy or from remote storage via placeholder <File>.external
  6431. ### If <File> is present locally (and not a symlink!) it will be copied to build directory.
  6432. ### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
  6433. macro LARGE_FILES(AUTOUPDATED?, Files...) {
  6434. # This is needed to correctly switch between remote and local modes
  6435. _GLOB($LF $Files)
  6436. }
  6437. ### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6438. ###
  6439. ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6440. macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6441. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_archive.py"} "--archive" ${input:Src} "--file-name" ${suf=-:Src} "--untar-to" $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p FA"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6442. }
  6443. when ($MSVC == "yes") {
  6444. C_AS_CXX_FLAGS=/TP /std:c++17
  6445. }
  6446. otherwise {
  6447. C_AS_CXX_FLAGS=-x c++ -std=c++17
  6448. }
  6449. # tag:cpp-specific
  6450. ### @usage: COMPILE_C_AS_CXX()
  6451. ###
  6452. ### Compile .c files as .cpp ones within a module.
  6453. macro COMPILE_C_AS_CXX() {
  6454. SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
  6455. }
  6456. ### @usage: NO_DEBUG_INFO()
  6457. ###
  6458. ### Compile files without debug info collection.
  6459. macro NO_DEBUG_INFO() {
  6460. SET(NO_DEBUGINFO yes)
  6461. }
  6462. ### @usage: CTEMPLATE_VARNAMES(File)
  6463. ###
  6464. ### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
  6465. ###
  6466. ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
  6467. macro CTEMPLATE_VARNAMES(File) {
  6468. .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
  6469. }
  6470. LLVM_OPTS=
  6471. CLANG_ROOT=$CLANG_RESOURCE_GLOBAL
  6472. CLANG_BINARIES_ROOT=$CLANG_ROOT/bin
  6473. CLANG_CPP_COMPILER_BIN=$CLANG_BINARIES_ROOT/clang++
  6474. CLANG_C_COMPILER_BIN=$CLANG_BINARIES_ROOT/clang
  6475. when ($OS_ANDROID == "yes") {
  6476. CLANG_ROOT=$CLANG_ANDROID_RESOURCE_GLOBAL
  6477. when ($HOST_OS_DARWIN) {
  6478. CLANG_BINARIES_ROOT=$CLANG_ROOT/toolchains/llvm/prebuilt/darwin-x86_64/bin
  6479. }
  6480. otherwise {
  6481. CLANG_BINARIES_ROOT=$CLANG_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin
  6482. }
  6483. }
  6484. ### @usage: GENERATED_SRCS(srcs... PARSE_META_FROM cpp_srcs... [OUTPUT_INCLUDES output_includes...] [OPTIONS])
  6485. ###
  6486. ### Generate sources using Jinja 2 template engine.
  6487. ###
  6488. ### srcs... - list of text files which will be generated during build time by templates. Each template must be
  6489. ### placed to the place in source tree where corresponding source file should be generated. Name of
  6490. ### template must be "<name_of_src_file>.markettemplate". For example if you want to generate file "example.cpp"
  6491. ### then template should be named "example.cpp.markettemplate".
  6492. ### PARSE_META_FROM cpp_srcs... - list of C++ source files (.cpp, .h) which will be parsed using clang library
  6493. ### and metainformation extracted from the files will be made available for templates. Example of
  6494. ### template code fragment using metainformation: {{ meta.objects["@N@std@S@string"].name }}
  6495. ### OUTPUT_INCLUDES output_includes... - in cases when build system parser fails to determine all headers
  6496. ### which generated files include, you can specify additional headers here. In a normal situation this should
  6497. ### not be needed and this feature could be removed in the future.
  6498. ### OPTIONS - additional options for code_generator utility
  6499. ###
  6500. ### Examples of templates can be found in directory market/tools/code_generator/templates.
  6501. ### Metainformation does not contain entries for every object declared in C++ files specified in PARSE_META_FROM
  6502. ### parameter. To include some object into consideration you need to mark it by attribute. Attributes can
  6503. ### automatically add more attributes to dependent objects. This behavior depends on attribute definition.
  6504. ###
  6505. ### More information will be available (eventually:) here: https://wiki.yandex-team.ru/Users/denisk/codegenerator/
  6506. macro GENERATED_SRCS(PARSE_META_FROM{input}[], OUTPUT_INCLUDES[], OPTIONS[], TEMPLATES...) {
  6507. .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
  6508. PEERDIR(build/platform/clang)
  6509. }
  6510. ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
  6511. ###
  6512. ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
  6513. ### Note: Output name is used as is, no extension added.
  6514. macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
  6515. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_CPP_COMPILER_BIN ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS -emit-ast -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p ST"} ${kv;hide:"pc light-green"}
  6516. PEERDIR(build/platform/clang)
  6517. }
  6518. ### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
  6519. ###
  6520. ### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6521. ### Note: Output name is used as is, no extension added.
  6522. macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
  6523. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_CPP_COMPILER_BIN ${pre=-I:_C__INCLUDE} $BC_CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6524. .SEM=llvm_compile_cxx ${input:Input} ${output;noauto:Output} ${CLANGPLUSPLUS} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  6525. PEERDIR(build/platform/clang)
  6526. }
  6527. ### @usage: LLVM_COMPILE_C(Input Output Opts...)
  6528. ###
  6529. ### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6530. ### Note: Output name is used as is, no extension added.
  6531. macro LLVM_COMPILE_C(Input, Output, Opts...) {
  6532. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_C_COMPILER_BIN ${pre=-I:_C__INCLUDE} $BC_CFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6533. PEERDIR(build/platform/clang)
  6534. }
  6535. ### @usage: BPF(Input Output Opts...)
  6536. ###
  6537. ### Emit eBPF bytecode from .c file.
  6538. ### Note: Output name is used as is, no extension added.
  6539. macro BPF(Input, Output, Opts...) {
  6540. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_C_COMPILER_BIN ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BP"} ${kv;hide:"pc light-green"}
  6541. PEERDIR(build/platform/clang)
  6542. }
  6543. ### @usage: BPF_STATIC(Input Output Opts...)
  6544. ###
  6545. ### Emit eBPF bytecode from .c file.
  6546. ### Note: Output name is used as is, no extension added.
  6547. macro BPF_STATIC(Input, Output, Opts...) {
  6548. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_C_COMPILER_BIN ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BP"} ${kv;hide:"pc light-green"} && ${cwd:BINDIR} $LLD_ROOT_RESOURCE_GLOBAL/ld -r -b binary -m elf_x86_64 -o ${output;noauto;suf=.bpf.o:Input} ${noauto;nopath:Output}
  6549. PEERDIR(build/platform/clang build/platform/lld)
  6550. }
  6551. ### @usage: LLVM_COMPILE_LL(Input Output Opts...)
  6552. ###
  6553. ### Compile LLVM bytecode to object representation.
  6554. ### Note: Output name is used as is, no extension added.
  6555. macro LLVM_COMPILE_LL(Input, Output, Opts...) {
  6556. .CMD=$CLANG_BINARIES_ROOT/llvm-as ${input:Input} -o ${output;noauto:Output} ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6557. PEERDIR(build/platform/clang)
  6558. }
  6559. ### @usage: LLVM_LINK(Output Inputs...)
  6560. ###
  6561. ### Call llvm-link on set of Inputs to produce Output.
  6562. ### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
  6563. macro LLVM_LINK(Output, Inputs...) {
  6564. .CMD=$CLANG_BINARIES_ROOT/llvm-link ${input:Inputs} -o ${output;noauto:Output} ${kv;hide:"p LD"} ${kv;hide:"pc light-red"}
  6565. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Inputs} COMMAND ${LLVMLINK} ${input:Inputs} -o ${output;noauto:Output}
  6566. PEERDIR(build/platform/clang)
  6567. }
  6568. ### @usage: LLVM_OPT(Input Output Opts...)
  6569. ###
  6570. ### Call llvm-opt with set of Opts on Input to produce Output.
  6571. ### Note: Output name is used as is, no extension added.
  6572. macro LLVM_OPT(Input, Output, Opts...) {
  6573. .CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} $CLANG_BINARIES_ROOT/opt ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p OP"} ${kv;hide:"pc yellow"}
  6574. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMOPT} ${input:Input} -o ${output;noauto:Output} $Opts
  6575. PEERDIR(build/platform/clang)
  6576. }
  6577. when ($NO_DEBUGINFO == "yes") {
  6578. DEBUG_INFO_FLAGS=
  6579. }
  6580. when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
  6581. DEBUG_INFO_FLAGS=-gline-tables-only
  6582. }
  6583. # TODO: configurable tar and touch
  6584. PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  6585. # tag:internal
  6586. ### @usage TOUCH(Outputs...) # internal
  6587. ### Just introduce outputs
  6588. macro TOUCH(Outputs...) {
  6589. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
  6590. }
  6591. TOUCH_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p UN"} ${kv;hide:"pc light-cyan"} $TARGET
  6592. 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
  6593. _P_PK=${kv;hide:"p PK"}
  6594. TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK
  6595. TOUCH_JAVA_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"java $CURDIR"} $TARGET
  6596. NO_CHECK_IMPORTS_FOR_VALUE=None
  6597. ### @usage: NO_CHECK_IMPORTS([patterns])
  6598. ###
  6599. ### Do not run checks on imports of Python modules.
  6600. ### Optional parameter mask patterns describes the names of the modules that do not need to check.
  6601. macro NO_CHECK_IMPORTS(Masks...) {
  6602. SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
  6603. }
  6604. # tag:yasm-specific
  6605. _YASM_FMT_VALUE=
  6606. _YASM_PLATFORM_FLAGS_VALUE=
  6607. _YASM_PREDEFINED_FLAGS_VALUE=
  6608. when ($OS_DARWIN || $OS_IOS) {
  6609. _YASM_FMT_VALUE=macho
  6610. _YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
  6611. }
  6612. elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
  6613. _YASM_FMT_VALUE=win
  6614. _YASM_PLATFORM_FLAGS_VALUE=-D WIN64
  6615. }
  6616. elsewhen ($OS_WINDOWS && $ARCH_I386) {
  6617. _YASM_FMT_VALUE=win
  6618. _YASM_PLATFORM_FLAGS_VALUE=-D WIN32
  6619. }
  6620. otherwise {
  6621. _YASM_FMT_VALUE=elf
  6622. _YASM_PLATFORM_FLAGS_VALUE=-D UNIX
  6623. _YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
  6624. }
  6625. when ($ASM_PREFIX) {
  6626. ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
  6627. }
  6628. otherwise {
  6629. ASM_PREFIX_VALUE=
  6630. }
  6631. # tag:yasm-specific
  6632. YASM_FLAGS=
  6633. YASM_PREINCLUDES_VALUE=
  6634. # tag:yasm-specific
  6635. macro _SRC_yasm_helper(SRC, PREINCLUDES[], SRCFLAGS...) {
  6636. .CMD=${tool:"contrib/tools/yasm"} -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE $YASM_DEBUG_INFO $YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__ -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${pre=-P :PREINCLUDES} ${input;hide:PREINCLUDES} ${SRC} ${kv;hide:"p AS"} ${kv;hide:"pc light-green"}
  6637. }
  6638. # tag:yasm-specific
  6639. macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  6640. .CMD=$_SRC_yasm_helper(${input:SRC}, $SRCFLAGS, PREINCLUDES $PREINCLUDES)
  6641. }
  6642. ### @usage: ASM_PREINCLUDE(AsmFiles...)
  6643. ###
  6644. ### Supply additional .asm files to all assembler calls within a module
  6645. macro ASM_PREINCLUDE(PREINCLUDES...) {
  6646. SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
  6647. }
  6648. # tag:python-specific
  6649. ### @usage: RUN_PYTHON(Args...)
  6650. ###
  6651. ### Version of RUN() macro to invoke Python scripts
  6652. ### @see: [RUN()](#macro_RUN)
  6653. macro RUN_PYTHON(Args...) {
  6654. SETUP_RUN_PYTHON()
  6655. RUN(${PYTHON_BIN} $Args)
  6656. }
  6657. ### @usage: RUN_ANTLR(Args...)
  6658. ###
  6659. ### Macro to invoke ANTLR3 generator (general case)
  6660. macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  6661. PEERDIR(build/external_resources/antlr3 build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6662. .CMD=$_RUN_JAVA(-jar $ANTLR3_RESOURCE_GLOBAL/antlr-3.5.2-complete-no-st3.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
  6663. .SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args
  6664. }
  6665. ### @usage: RUN_ANTLR4(Args...)
  6666. ###
  6667. ### Macro to invoke ANTLR4 generator (general case)
  6668. macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  6669. PEERDIR(build/external_resources/antlr4)
  6670. _RUN_JAVA(-jar $ANTLR4_RESOURCE_GLOBAL/antlr-4.9-complete.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
  6671. }
  6672. _ANTLR4_LISTENER_GRAMMAR=-listener
  6673. _ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
  6674. _ANTLR4_VISITOR_GRAMMAR=-visitor
  6675. _ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
  6676. ### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  6677. ###
  6678. ### Macro to invoke ANTLR4 generator (Cpp)
  6679. macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6680. 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})
  6681. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  6682. }
  6683. ### @usage: RUN_ANTLR4_GO(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  6684. ###
  6685. ### Macro to invoke ANTLR4 generator (Go)
  6686. macro RUN_ANTLR4_GO(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6687. 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})
  6688. PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr)
  6689. }
  6690. # tag:cpp-specific
  6691. macro CPP_ADDINCL(Dirs...) {
  6692. ADDINCL($Dirs)
  6693. }
  6694. # tag:internal
  6695. _WHOLE_ARCHIVE_PEERS_VALUE=
  6696. ### @usage: WHOLE_ARCHIVE(dirnames...) # internal
  6697. macro WHOLE_ARCHIVE(PEERS...) {
  6698. SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
  6699. REQUIRES(${PEERS})
  6700. }
  6701. ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
  6702. macro TASKLET() {
  6703. PEERDIR(tasklet/api)
  6704. # CPP
  6705. CPP_PROTO_PLUGIN(tasklet_cpp tasklet/gen/cpp .tasklet.h)
  6706. # Python
  6707. PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/gen/python DEPS tasklet/domain/sandbox tasklet/runtime sandbox/sdk2)
  6708. #Java
  6709. JAVA_PROTO_PLUGIN(tasket_java tasklet/gen/java DEPS tasklet/runtime/java/lib $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  6710. }
  6711. TASKLET_REG_INCLUDES= \
  6712. ${output_include;hide:"tasklet/runtime/lib/cpp_wrapper.h"} \
  6713. ${output_include;hide:"tasklet/runtime/lib/go_wrapper.h"} \
  6714. ${output_include;hide:"tasklet/runtime/lib/py_wrapper.h"} \
  6715. ${output_include;hide:"tasklet/runtime/lib/js_wrapper.h"} \
  6716. ${output_include;hide:"tasklet/runtime/lib/registry.h"}
  6717. macro TASKLET_REG(Name, Lang, Impl, Includes...) {
  6718. PEERDIR(tasklet/domain sandbox/bin sandbox/taskbox/worker)
  6719. when($Lang == "js") {
  6720. # JS runtime links the Node.js from contrib as a library, which is a bit heavy,
  6721. # so we do it, only if any JS tasklets are linked into the target
  6722. PEERDIR+=tasklet/runtime/js
  6723. }
  6724. .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"}
  6725. SRCS(GLOBAL $Name.task.cpp)
  6726. }
  6727. # TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
  6728. # NOT COMPLETE
  6729. macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
  6730. PEERDIR(tasklet/domain sandbox/bin sandbox/taskbox/worker)
  6731. .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"}
  6732. SRCS(GLOBAL $Name.task.cpp)
  6733. }
  6734. # tag:cpp-specific
  6735. _CPP_PROTO_MODULE_PREFIX=
  6736. _CPP_PROTO_MODULE_SUFFIX=
  6737. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6738. _CPP_PROTO_MODULE_PREFIX=
  6739. _CPP_PROTO_MODULE_SUFFIX=.lib
  6740. }
  6741. otherwise {
  6742. _CPP_PROTO_MODULE_PREFIX=lib
  6743. _CPP_PROTO_MODULE_SUFFIX=.a
  6744. }
  6745. ### @usage: EXPOSE(OutputsToExport...)
  6746. ###
  6747. ### Allows to mark outputs of macro command as unused in the current module but intended
  6748. ### to be used in modules consuming current via PEERDIR.
  6749. ###
  6750. ### TODO(DEVTOOLS-9000) proper implementation needed
  6751. macro EXPOSE(Args...) {
  6752. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).cpp:"empty_"} ${input;hide:Args}
  6753. }
  6754. # tag:proto
  6755. macro _PROTO_DESC_CMD(File) {
  6756. .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}
  6757. }
  6758. _PROTO_DESC_MERGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $AUTO_INPUT ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
  6759. _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"}
  6760. NEED_GOOGLE_PROTO_PEERDIRS=yes
  6761. PROTO_LIBRARY_SEM=$CPP_LIBRARY_SEM
  6762. # tag:proto
  6763. ### @usage: PROTO_LIBRARY()
  6764. ###
  6765. ### Build some varian of protocol buffers library.
  6766. ###
  6767. ### The particular variant is selected based on where PEERDIR to PROTO_LIBRARY comes from.
  6768. ###
  6769. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  6770. ### When PEERDIR comes from module for particular language appropriate variant is selected.
  6771. ### PROTO_LIBRARY also supports emission of GRPC code if GRPC() macro is specified.
  6772. ### Notes:
  6773. ### - Python versions emit C++ code in addition to Python as optimization.
  6774. ### - In some PROTO_LIBRARY-es Java or Python versions are excluded via EXCLUDE_TAGS macros due to incompatibilities.
  6775. ### - Use from DEPENDS or BUNDLE is not allowed
  6776. ###
  6777. ### Documentation: https://wiki.yandex-team.ru/yatool/proto_library/
  6778. ###
  6779. ### See: [GRPC()](#macro_GRPC), [OPTIMIZE_PY_PROTOS()](#macro_OPTIMIZE_PY_PROTOS), [INCLUDE_TAGS()](#macro_INCLUDE_TAGS), [EXCLUDE_TAGS()](#macro_EXCLUDE_TAGS)
  6780. multimodule PROTO_LIBRARY {
  6781. module CPP_PROTO : LIBRARY {
  6782. .ALLOWED=EXPOSE
  6783. # TODO(svidyuk): think about marker which forces semantics inheritance
  6784. .SEM=PROTO_LIBRARY_SEM
  6785. ENABLE(CPP_PROTO)
  6786. ENABLE(GEN_PROTO)
  6787. NO_CLANG_TIDY()
  6788. SET(PEERDIR_TAGS CPP_PROTO)
  6789. when ($BUILD_PROTO_AS_EVLOG == "yes" && $USE_VANILLA_PROTOC == "yes") {
  6790. _OK=no
  6791. }
  6792. ASSERT(_OK BUILD_PROTO_AS_EVLOG and USE_VANILLA_PROTOC are incompatible yet)
  6793. MODULE_SUFFIX=$_CPP_PROTO_MODULE_SUFFIX
  6794. MODULE_PREFIX=$_CPP_PROTO_MODULE_PREFIX
  6795. when ($_COMMON_GOOGLE_APIS != "None") {
  6796. PEERDIR += contrib/libs/googleapis-common-protos
  6797. }
  6798. }
  6799. module JAVA_PROTO: EXTERNAL_JAVA_LIBRARY {
  6800. .EXTS=.jsrc
  6801. .ALLOWED=GRPC
  6802. .SEM=ignored
  6803. SET(PEERDIR_TAGS JAVA_PROTO)
  6804. ENABLE(JAVA_PROTO)
  6805. PEERDIR+=$JAVA_PROTOBUF_PEERS contrib/java/javax/annotation/javax.annotation-api/1.3.1
  6806. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE
  6807. ADDINCL(FOR proto $PROTOBUF_PATH)
  6808. when ($_COMMON_GOOGLE_APIS != "None") {
  6809. PEERDIR += contrib/java/com/google/api/grpc/proto-google-common-protos/${JAVA_PROTO_COMMON_VERSION}
  6810. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6811. }
  6812. }
  6813. module PY_PROTO: PY2_LIBRARY {
  6814. .ALIASES=SRCS=PY_SRCS
  6815. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  6816. .PEERDIRSELF=CPP_PROTO
  6817. .SEM=ignored
  6818. SET(PEERDIR_TAGS PY2 PY_PROTO)
  6819. ENABLE(PY_PROTO)
  6820. OPTIMIZE_PY_PROTOS()
  6821. OBJ_SUF=.py2
  6822. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6823. SET(LINT_LEVEL_VALUE none_internal)
  6824. when ($_COMMON_GOOGLE_APIS != "None") {
  6825. PEERDIR += contrib/libs/googleapis-common-protos
  6826. }
  6827. _IGNORE_SELF_PEERS=
  6828. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  6829. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  6830. _IGNORE_PEERDIRSELF=CPP_PROTO
  6831. }
  6832. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  6833. }
  6834. module PY3_PROTO: PY3_LIBRARY {
  6835. .ALIASES=SRCS=PY_SRCS
  6836. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  6837. .PEERDIRSELF=CPP_PROTO
  6838. .SEM=ignored
  6839. SET(PEERDIR_TAGS PY3 PY3_PROTO)
  6840. ENABLE(PY3_PROTO)
  6841. OPTIMIZE_PY_PROTOS()
  6842. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6843. MODULE_PREFIX=py3
  6844. }
  6845. otherwise {
  6846. MODULE_PREFIX=libpy3
  6847. }
  6848. OBJ_SUF=.py3
  6849. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6850. SET(LINT_LEVEL_VALUE none_internal)
  6851. when ($_COMMON_GOOGLE_APIS != "None") {
  6852. PEERDIR += contrib/libs/googleapis-common-protos
  6853. }
  6854. _IGNORE_SELF_PEERS=
  6855. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  6856. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  6857. _IGNORE_PEERDIRSELF=CPP_PROTO
  6858. }
  6859. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  6860. }
  6861. module GO_PROTO: GO_LIBRARY {
  6862. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO
  6863. .SEM=ignored
  6864. SET(PEERDIR_TAGS GO GO_PROTO)
  6865. ENABLE(GO_PROTO)
  6866. when ($_COMMON_GOOGLE_APIS == "None") {
  6867. }
  6868. elsewhen ($_COMMON_GOOGLE_APIS == "") {
  6869. PEERDIR += $_GO_COMMON_GOOGLE_APIS
  6870. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6871. }
  6872. otherwise {
  6873. PEERDIR += $_COMMON_GOOGLE_APIS
  6874. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6875. }
  6876. }
  6877. module EXT_PROTO: _BARE_UNIT {
  6878. .ALIASES=SRCS=_RAW_PROTO_SRCS
  6879. .CMD=TOUCH_UNIT_MF
  6880. .SEM=ignored
  6881. .EXTS=.*
  6882. .PROXY=yes
  6883. .PEERDIR_POLICY=as_build_from
  6884. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
  6885. SET(PEERDIR_TAGS EXT_PROTO)
  6886. ENABLE(EXT_PROTO)
  6887. SET(MODULE_SUFFIX .raw.fake.pkg)
  6888. SET(MODULE_TYPE LIBRARY)
  6889. when ($_COMMON_GOOGLE_APIS != "None") {
  6890. PEERDIR += contrib/libs/googleapis-common-protos
  6891. }
  6892. SET(CREDITS_FILE_EXTRA_EXT .ext_proto)
  6893. }
  6894. module DESC_PROTO: _BARE_UNIT {
  6895. .CMD=_PROTO_DESC_MERGE_CMD
  6896. .SEM=ignored
  6897. .EXTS=.desc
  6898. .NODE_TYPE=Library
  6899. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
  6900. SET(PEERDIR_TAGS DESC_PROTO)
  6901. ENABLE(DESC_PROTO)
  6902. MODULE_SUFFIX=.self.protodesc
  6903. SET(MODULE_TYPE LIBRARY)
  6904. MACRO_ALIAS(EVLOG_CMD _PROTO_DESC_CMD)
  6905. MACRO_ALIAS(PROTO_CMD _PROTO_DESC_CMD)
  6906. when ($_COMMON_GOOGLE_APIS != "None") {
  6907. PEERDIR += contrib/libs/googleapis-common-protos
  6908. }
  6909. when ($NEED_GOOGLE_PROTO_PEERDIRS == "yes") {
  6910. when ($USE_VANILLA_PROTOC == "yes") {
  6911. PEERDIR += contrib/libs/protobuf_std/builtin_proto/protos_from_protobuf
  6912. }
  6913. otherwise {
  6914. PEERDIR += contrib/libs/protobuf/builtin_proto/protos_from_protoc
  6915. }
  6916. }
  6917. }
  6918. module PB_PY_PROTO: _PY_PACKAGE {
  6919. .INCLUDE_TAG=no
  6920. .PROXY=yes
  6921. .SEM=ignored
  6922. SET(MODULE_SUFFIX .pb_py.fake.pkg)
  6923. ENABLE(PB_PY_PROTO)
  6924. # WARN:
  6925. # _COMMON_GOOGLE_APIS aren't handled intentionally.
  6926. # PB_PY_PROTO is a legacy module type, stop using it.
  6927. }
  6928. }
  6929. # tag:proto
  6930. _EXT_PROTO_DIR=_RAW_
  6931. # tag:proto
  6932. ### This var defines the root of the tree for copied proto files from EXT_PROTO
  6933. ### submodule of PROTO_LIBRARY module
  6934. EXT_PROTO_ROOT=${ARCADIA_BUILD_ROOT}/${_EXT_PROTO_DIR}
  6935. # tag:proto
  6936. ### @usage: USE_EXT_PROTO(peerdir_tag...)
  6937. ###
  6938. ### Configure module to use proto files from existing PROTO_LIBRARY module.
  6939. ### Additional PEERDIR tags required to build a module can be passed through
  6940. ### EXTRA_TAGS vararg parameter.
  6941. macro USE_EXT_PROTO(EXTRA_TAGS...) {
  6942. SET(PEERDIR_TAGS EXT_PROTO ${EXTRA_TAGS})
  6943. SRCDIR(${EXT_PROTO_ROOT})
  6944. }
  6945. # tag:proto tag:internal
  6946. ### @usage: _RAW_PROTO_SRCS(files...) # internal
  6947. ###
  6948. ### _RAW_PROTO_SRCS is a proxy macro to FILES macro which filters out
  6949. ### GLOBAL keyword from the list of files (NOTE! The order of files listed
  6950. ### originally in call to _RAW_PROTO_SRCS() macro is changed in call to
  6951. ### FILES() macro). Currently this macro copies only files with the following
  6952. ### extensions: .proto, .gztproto, .ev
  6953. macro _RAW_PROTO_SRCS(FILES...) {
  6954. _COPY_FILES_TO_BUILD_PREFIX(${ext=.proto:FILES} PREFIX ${_EXT_PROTO_DIR})
  6955. _COPY_FILES_TO_BUILD_PREFIX(${ext=.gztproto:FILES} PREFIX ${_EXT_PROTO_DIR})
  6956. _COPY_FILES_TO_BUILD_PREFIX(${ext=.ev:FILES} PREFIX ${_EXT_PROTO_DIR})
  6957. }
  6958. module PROTO_DESCRIPTIONS: _BARE_UNIT {
  6959. .CMD=_PROTO_DESC_MERGE_PEERS_CMD
  6960. .PEERDIR_POLICY=as_build_from
  6961. .NODE_TYPE=Library
  6962. .RESTRICTED=SRCS
  6963. .FINAL_TARGET=yes
  6964. SET(PEERDIR_TAGS DESC_PROTO)
  6965. SET(MODULE_SUFFIX .protodesc)
  6966. SET(MODULE_TYPE PROTO_DESCRIPTIONS)
  6967. }
  6968. module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
  6969. SET(MODULE_TYPE PROTO_REGISTRY)
  6970. }
  6971. # tag:fbs
  6972. _FBS_NAMESPACE_MAP_GLOBAL=
  6973. # tag:fbs
  6974. macro _FBS_NAMESPACE_IMPL(NAMESPACE, PATH, DUMMY...) {
  6975. SET_APPEND(_FBS_NAMESPACE_MAP_GLOBAL ${NAMESPACE}=${PATH})
  6976. }
  6977. # tag:fbs
  6978. macro FBS_NAMESPACE(NAMESPACE, PATH...) {
  6979. _FBS_NAMESPACE_IMPL($NAMESPACE $PATH $MODDIR)
  6980. }
  6981. # tag:fbs
  6982. ### @usage: FBS_LIBRARY()
  6983. ###
  6984. ### Build some variant of Flatbuffers library.
  6985. ###
  6986. ### The particular variant is selected based on where PEERDIR to FBS_LIBRARY
  6987. ### comes from.
  6988. ###
  6989. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  6990. ### When PEERDIR comes from module for particular language appropriate variant
  6991. ### is selected.
  6992. ###
  6993. ### Notes: FBS_NAMESPACE must be specified in all dependent FBS_LIBRARY modules
  6994. ### if build of Go code is requested.
  6995. multimodule FBS_LIBRARY {
  6996. module CPP_FBS: LIBRARY {
  6997. ENABLE(CPP_FBS)
  6998. SET(PEERDIR_TAGS CPP_FBS)
  6999. }
  7000. module GO_FBS: GO_LIBRARY {
  7001. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7002. ENABLE(GO_FBS)
  7003. SET(PEERDIR_TAGS GO GO_FBS)
  7004. }
  7005. module JAVA_FBS: EXTERNAL_JAVA_LIBRARY {
  7006. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7007. ENABLE(JAVA_FBS)
  7008. SET(PEERDIR_TAGS JAVA_FBS)
  7009. }
  7010. module PY2_FBS: PY2_LIBRARY {
  7011. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7012. .ALIASES=SRCS=PY_SRCS
  7013. ENABLE(PY2_FBS)
  7014. SET(PEERDIR_TAGS PY2 PY2_FBS)
  7015. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7016. SET(LINT_LEVEL_VALUE none_internal)
  7017. }
  7018. module PY3_FBS: PY3_LIBRARY {
  7019. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7020. .ALIASES=SRCS=PY_SRCS
  7021. ENABLE(PY3_FBS)
  7022. SET(PEERDIR_TAGS PY3 PY3_FBS)
  7023. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7024. SET(LINT_LEVEL_VALUE none_internal)
  7025. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7026. MODULE_PREFIX=py3
  7027. }
  7028. otherwise {
  7029. MODULE_PREFIX=libpy3
  7030. }
  7031. OBJ_SUF=.py3
  7032. }
  7033. }
  7034. # tag:java-specific
  7035. _COMPILE_JSRC=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_jsrc.py"} --input $AUTO_INPUT --output $TARGET --prefix $BINDIR ${kv;hide:"p JC"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7036. # tag:java-specific
  7037. COMPILE_JSRC_MF=$_COMPILE_JSRC && $GENERATE_MF
  7038. # tag:java-specific tag:internal
  7039. ### @usage: JSRC_LIBRARY() # internal
  7040. module JSRC_LIBRARY: _BARE_UNIT {
  7041. .CMD=COMPILE_JSRC_MF
  7042. .EXTS=.java
  7043. .ALL_INS_TO_OUT=no
  7044. .PEERDIR_POLICY=as_include
  7045. .FINAL_TARGET=no
  7046. .ALIASES=SRCS=FILES
  7047. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  7048. MODULE_TYPE=Library
  7049. SET(MODULE_SUFFIX .jsrc)
  7050. SET(DONT_RESOLVE_INCLUDES yes)
  7051. SET(NEED_PLATFORM_PEERDIRS no)
  7052. SET(MODULE_LANG JAVA)
  7053. NO_RUNTIME()
  7054. }
  7055. # tag:maps-specific
  7056. @import "${CONF_ROOT}/conf/project_specific/maps/asrc.conf"
  7057. # tag:internal
  7058. ### @usage: _PROXY_LIBRARY() # internal
  7059. ###
  7060. ### The use of this module is strictly prohibited!!!
  7061. module _PROXY_LIBRARY: LIBRARY {
  7062. .EXTS=.a .lib
  7063. .PEERDIR_POLICY=as_build_from
  7064. .PROXY=yes
  7065. .FINAL_TARGET=yes
  7066. DISABLE(NEED_ADD_FAKE_SRC)
  7067. NO_UTIL()
  7068. NO_RUNTIME()
  7069. }
  7070. # tag:maps-specific
  7071. @import "${CONF_ROOT}/conf/project_specific/maps/aar.conf"
  7072. @import "${CONF_ROOT}/conf/project_specific/maps/sproto.conf"
  7073. @import "${CONF_ROOT}/conf/project_specific/maps/mapkit.conf"
  7074. _PRIMARY_OUTPUT_VALUE=
  7075. # tag:internal
  7076. ### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
  7077. ###
  7078. ### The use of this module is strictly prohibited!!!
  7079. macro PRIMARY_OUTPUT(OUTPUT) {
  7080. SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
  7081. }
  7082. _DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${input;hide:_PRIMARY_OUTPUT_VALUE} ${TARGET}
  7083. # tag:internal
  7084. ### @usage: DLL_PROXY_LIBRARY() # internal
  7085. ###
  7086. ### The use of this module is strictly prohibited!!!
  7087. module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
  7088. .ALLOWED=PRIMARY_OUTPUT
  7089. .CMD=_DLL_PROXY_LIBRARY_CMD
  7090. }
  7091. _PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${kv;hide:"p ld"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7092. # tag:internal
  7093. ### @usage: PREBUILT_PROGRAM([programname]) # internal
  7094. ###
  7095. ### Program module which uses a prebuilt prgram as its output.
  7096. module PREBUILT_PROGRAM: _LINK_UNIT {
  7097. .CMD=_PREBUILT_PROGRAM_CMD
  7098. .SYMLINK_POLICY=EXE
  7099. .ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
  7100. .RESTRICTED=SRCS
  7101. _BARE_LINK_MODULE()
  7102. SET(MODULE_TYPE PROGRAM)
  7103. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  7104. MODULE_SUFFIX=.exe
  7105. }
  7106. }
  7107. ### @usage COLLECT_JINJA_TEMPLATES(varname path)
  7108. ###
  7109. ### This macro collects all jinja and yaml files in the directory specified by second argument and
  7110. ### stores result in the variable with mane specified by first parameter.
  7111. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
  7112. _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
  7113. }
  7114. # tag:go-specific
  7115. GO_HOST_OS=unknown
  7116. when ($HOST_OS_LINUX) {
  7117. GO_HOST_OS=linux
  7118. }
  7119. elsewhen ($HOST_OS_DARWIN) {
  7120. GO_HOST_OS=darwin
  7121. }
  7122. elsewhen($HOST_OS_WINDOWS) {
  7123. GO_HOST_OS=windows
  7124. }
  7125. # tag:go-specific
  7126. GO_HOST_ARCH=unknown
  7127. when ($HOST_ARCH_X86_64) {
  7128. GO_HOST_ARCH=amd64
  7129. }
  7130. elsewhen($HOST_ARCH_ARM64) {
  7131. GO_HOST_ARCH=arm64
  7132. }
  7133. # tag:go-specific
  7134. GO_TARG_OS=unknown
  7135. when ($OS_LINUX) {
  7136. GO_TARG_OS=linux
  7137. }
  7138. elsewhen ($OS_DARWIN) {
  7139. GO_TARG_OS=darwin
  7140. }
  7141. elsewhen ($OS_WINDOWS) {
  7142. GO_TARG_OS=windows
  7143. }
  7144. # tag:go-specific
  7145. GO_TARG_ARCH=unknwon
  7146. when ($ARCH_X86_64) {
  7147. GO_TARG_ARCH=amd64
  7148. }
  7149. elsewhen ($ARCH_I386) {
  7150. GO_TARG_ARCH=x86
  7151. }
  7152. elsewhen ($ARCH_ARM64) {
  7153. GO_TARG_ARCH=arm64
  7154. }
  7155. # tag:go-specific
  7156. GO_HOST_TARG_PARAMS=++host-os $GO_HOST_OS ++host-arch $GO_HOST_ARCH ++targ-os $GO_TARG_OS ++targ-arch $GO_TARG_ARCH
  7157. # tag:go-specific
  7158. GOSTD_VERSION=1.18.2
  7159. when ($GOSTD_VERSION == "1.18.2") {
  7160. GOSTD=contrib/go/_std_1.18/src
  7161. }
  7162. otherwise {
  7163. GOSTD=__unsupported_go_std_library_version_[$GOSTD_VERSION]__
  7164. }
  7165. # tag:go-specific
  7166. GO_DEBUG_PATH_RELATIVE=no
  7167. _GO_DEBUG_PATH__NO_UID__=
  7168. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=
  7169. # tag:go-specific
  7170. _GO_IMPORT_PATH=${MODDIR}
  7171. # tag:go-specific
  7172. GO_VET=yolint
  7173. GO_VET_TOOL=
  7174. GO_VET_FLAGS=
  7175. GO_VET_EXTRA_FLAGS=
  7176. # tag:go-specific
  7177. _GO_VET_ADD_CHECK=yes
  7178. _GO_FMT_ADD_CHECK=yes
  7179. _GO_YDX_FILE=
  7180. # tag:go-specific
  7181. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=/-B --source-prefix=/-S
  7182. _GO_LINK_EXE_EXT_CMD=
  7183. # tag:go-specific
  7184. GO_WITH_MUSL=
  7185. # tag:go-specific
  7186. GO_TOOLS_ROOT=${GO_TOOLS_RESOURCE_GLOBAL}
  7187. GO_TEST_MINER=${tool:"tools/go_test_miner"}
  7188. GO_TEST_IMPORT_PATH=
  7189. # tag:go-specific
  7190. GO_STD_LIB_PREFIX=${GOSTD}/
  7191. GO_STD_CMD_PREFIX=${GOSTD}/cmd/
  7192. GO_ARCADIA_PROJECT_PREFIX=a.yandex-team.ru/
  7193. GO_CONTRIB_PROJECT_PREFIX=vendor/
  7194. GO_SKIP_IMPORTS=unsafe C
  7195. GO_VET_INFO_EXT=.vet.out
  7196. GO_VET_REPORT_EXT=.vet.txt
  7197. GO_VET_OUTPUT_INFO=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_INFO_EXT}:REALPRJNAME}
  7198. GO_VET_OUTPUT_REPORT=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_REPORT_EXT}:REALPRJNAME}
  7199. # tag:go-specific tag:codenav
  7200. _GO_YNDEXER_EXT=.ydx.pb2
  7201. GO_YNDEXER_OUTPUT=${output;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${_GO_YNDEXER_EXT}:REALPRJNAME}
  7202. # tag:go-specific
  7203. GO_PROJECT_PREFIXES=++std-lib-prefix $GO_STD_LIB_PREFIX ++arc-project-prefix $GO_ARCADIA_PROJECT_PREFIX
  7204. # tag:go-specific
  7205. _GO_FAKEID=${FAKEID}.${BUILD_TYPE}.${GO_FAKEID}
  7206. # tag:go-specific
  7207. CGO2_CFLAGS_VALUE=
  7208. CGO2_LDFLAGS_VALUE=
  7209. # tag:go-specific
  7210. GO_ASM_FLAGS_VALUE=
  7211. ### @usage: GO_ASM_FLAGS(flags)
  7212. ### Add the specified flags to the go asm compile command line.
  7213. macro GO_ASM_FLAGS(Flags...) {
  7214. SET_APPEND(GO_ASM_FLAGS_VALUE $Flags)
  7215. }
  7216. # tag:go-specific
  7217. GO_CGO1_FLAGS_VALUE=
  7218. ### @usage: GO_CGO1_FLAGS(flags)
  7219. ### Add the specified flags to the go cgo compile command line.
  7220. macro GO_CGO1_FLAGS(Flags...) {
  7221. SET_APPEND(GO_CGO1_FLAGS_VALUE $Flags)
  7222. }
  7223. # tag:go-specific
  7224. GO_CGO2_FLAGS_VALUE=
  7225. ### @usage: GO_CGO2_FLAGS(flags)
  7226. ### Add the specified flags to the go cgo compile command line.
  7227. macro GO_CGO2_FLAGS(Flags...) {
  7228. SET_APPEND(GO_CGO2_FLAGS_VALUE $Flags)
  7229. }
  7230. # tag:go-specific
  7231. GO_COMPILE_FLAGS_VALUE=$USER_GO_COMPILE_FLAGS
  7232. ### @usage: GO_COMPILE_FLAGS(flags)
  7233. ### Add the specified flags to the go compile command line.
  7234. macro GO_COMPILE_FLAGS(Flags...) {
  7235. SET_APPEND(GO_COMPILE_FLAGS_VALUE $Flags)
  7236. }
  7237. # tag:go-specific
  7238. GO_LINK_FLAGS_VALUE=$USER_GO_LINK_FLAGS
  7239. ### @usage: GO_LINK_FLAGS(flags)
  7240. ### Add the specified flags to the go link command line.
  7241. macro GO_LINK_FLAGS(Flags...) {
  7242. SET_APPEND(GO_LINK_FLAGS_VALUE $Flags)
  7243. }
  7244. # tag:go-specific
  7245. _GO_TOOL_MODE=
  7246. # tag:go-specific
  7247. _GO_TOOL_COMMON_FLAGS=\
  7248. ++mode $_GO_TOOL_MODE \
  7249. $GO_PROJECT_PREFIXES \
  7250. ++goversion $GOSTD_VERSION \
  7251. ++source-root $ARCADIA_ROOT \
  7252. ++build-root $ARCADIA_BUILD_ROOT \
  7253. ++output-root $BINDIR \
  7254. ++toolchain-root $GO_TOOLS_ROOT \
  7255. $GO_HOST_TARG_PARAMS \
  7256. ++output $TARGET \
  7257. $GO_VET_OUTPUT \
  7258. $_GO_YDX_FILE \
  7259. $_GO_DEBUG_PATH__NO_UID__ \
  7260. ++srcs $AUTO_INPUT ${input:GO_FILES} \
  7261. ++asm-flags $GO_ASM_FLAGS_VALUE \
  7262. ++compile-flags $GO_COMPILE_FLAGS_VALUE \
  7263. ++link-flags $GO_LINK_FLAGS_VALUE \
  7264. ++cgo-srcs ${input:CGO_FILES} \
  7265. $_GO_EMBED_VALUE \
  7266. $GO_TOOLCHAIN_ENV
  7267. # tag:go-specific
  7268. macro _GO_GEN_COVER_GO(GO_FILE, VAR_ID) {
  7269. .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}
  7270. }
  7271. # tag:go-specific
  7272. macro _GO_COMPILE_SYMABIS(FLAGS[], ASM_FILES...) {
  7273. .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"}
  7274. .ADDINCL=build/scripts/go_fake_include
  7275. }
  7276. # tag:go-specific
  7277. macro _GO_COMPILE_CGO1(NAME, FLAGS[], FILES...) {
  7278. .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"}
  7279. }
  7280. # tag:go-specific
  7281. macro _GO_COMPILE_CGO2(NAME, C_FILES[], S_FILES[], OBJ_FILES[], FILES...) {
  7282. .CMD=${hide:_GO_FAKEID} $C_COMPILER $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} $CGO_CFLAGS_VALUE ${input;tobindir:"_cgo_main.c"} -c -o ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_main.c"} && $C_COMPILER $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} -o ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_"} $LDFLAGS $LDFLAGS_GLOBAL $CGO2_LDFLAGS_VALUE ${input;hide:"_cgo_export.h"} ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_main.c"} ${input;suf=${OBJECT_SUF}:"_cgo_export.c"} ${input;nopath;noext;suf=.cgo2.c${OBJECT_SUF}:FILES} ${input;suf=${OBJECT_SUF}:C_FILES} ${input;suf=.o:S_FILES} ${input:OBJ_FILES} $CGO_LDFLAGS_VALUE && ${GO_TOOLS_ROOT}/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cgo -dynpackage $NAME -dynimport ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_"} -dynout ${output:"_cgo_import.go"} -dynlinker $GO_CGO2_FLAGS_VALUE $GO_TOOLCHAIN_ENV ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7283. _USE_LINKER()
  7284. }
  7285. GO_TOOL=$YMAKE_PYTHON ${input:"build/scripts/go_tool.py"} ${input;hide:"build/scripts/process_command_files.py"}
  7286. # tag:go-specific
  7287. macro _GO_LINK_LIB_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
  7288. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} --ya-end-command-file ${kv;hide:"p GO"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"}
  7289. }
  7290. # tag:go-specific
  7291. macro _GO_LINK_EXE_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
  7292. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++vcs $VCS_GO $GO_WITH_MUSL $GO_EXTLD ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} ++non-local-peers ${rootrel;tags_in=GO|GO_PROTO|GO_FBS;tags_out=local:PEERS} ++cgo-peers ${VCS_C_OBJ_RR} ${rootrel;tags_out=GO|GO_PROTO|GO_FBS:PEERS} --ya-end-command-file ${kv;hide:"p LD"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"} $_GO_LINK_EXE_EXT_CMD
  7293. }
  7294. # tag:go-specific
  7295. macro _GO_LINK_TEST_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_TEST_FILES[], GO_XTEST_FILES[], GO_FILES...) {
  7296. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++vcs $VCS_GO $GO_WITH_MUSL $GO_EXTLD ++test-miner $GO_TEST_MINER ++test-import-path $GO_TEST_IMPORT_PATH ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} ++non-local-peers ${rootrel;tags_in=GO|GO_PROTO|GO_FBS;tags_out=local:PEERS} ++cgo-peers ${VCS_C_OBJ_RR} ${rootrel;tags_out=GO|GO_PROTO|GO_FBS:PEERS} ++test_srcs ${input:GO_TEST_FILES} ++xtest_srcs ${input:GO_XTEST_FILES} ++cover_info $GO_COVER_INFO_VALUE ++skip-tests $_GO_SKIP_TEST_VALUE --ya-end-command-file ${kv;hide:"p GO"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"}
  7297. }
  7298. # tag:go-specific
  7299. GO_LINK_LIB=$GENERATE_MF && $_GO_LINK_LIB_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_INPUTS $_GO_EMBED_INPUTS)
  7300. 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)
  7301. 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)
  7302. GO_LINK_DLL=$GO_LINK_EXE && $COPY_CMD $BINDIR/_cgo_export.h ${output;pre=${MODULE_PREFIX};suf=.h:REALPRJNAME}
  7303. # tag:go-specific
  7304. CGO_ENABLED=yes
  7305. when ($OS_WINDOWS == "yes" || $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  7306. CGO_ENABLED=no
  7307. }
  7308. # tag:go-specific
  7309. GO_PACKAGE_VALUE=
  7310. ### @usage: GO_PACKAGE_NAME(Name)
  7311. ### Override name of a Go package.
  7312. macro GO_PACKAGE_NAME(NAME) {
  7313. SET(GO_PACKAGE_VALUE $NAME)
  7314. }
  7315. # tag:go-specific tag:internal
  7316. _GO_SRCS_VALUE=
  7317. ### @usage: _GO_SRCS(Files...) # internal
  7318. ### This macro shouldn't be used in ya.make files, use SRCS() instead.
  7319. ### This is internal macro collecting .go sources for processing within Go modules (GO_PROGRAM and GO_LIBRARY)
  7320. macro _GO_SRCS(FILES...) {
  7321. GO_FAKE_OUTPUT($FILES)
  7322. SET_APPEND(_GO_SRCS_VALUE $FILES)
  7323. }
  7324. # tag:go-specific
  7325. _GO_TEST_SRCS_VALUE=
  7326. GO_HAS_INTERNAL_TESTS=no
  7327. ### @usage: GO_TEST_SRCS(Files...)
  7328. ### .go sources for internal tests of a module
  7329. macro GO_TEST_SRCS(FILES...) {
  7330. GO_FAKE_OUTPUT($FILES)
  7331. _SET_FIRST_VALUE(GO_HAS_INTERNAL_TESTS ${pre=yes :FILES} ${GO_HAS_INTERNAL_TESTS})
  7332. SET_APPEND(_GO_TEST_SRCS_VALUE $FILES)
  7333. }
  7334. # tag:go-specific
  7335. _GO_XTEST_SRCS_VALUE=
  7336. GO_HAS_EXTERNAL_TESTS=no
  7337. ### @usage: GO_XTEST_SRCS(Files...)
  7338. ### .go sources for external tests of a module
  7339. macro GO_XTEST_SRCS(FILES...) {
  7340. GO_FAKE_OUTPUT($FILES)
  7341. SET(GO_HAS_EXTERNAL_TESTS yes)
  7342. SET_APPEND(_GO_XTEST_SRCS_VALUE $FILES)
  7343. }
  7344. # tag:go-specific
  7345. macro _GO_UNUSED_SRCS(FLAGS...) {
  7346. ENABLE(UNUSED_MACRO)
  7347. }
  7348. # tag:go-specific
  7349. _CGO_SRCS_VALUE=
  7350. ### @usage: CGO_SRCS(Files...)
  7351. ### .go sources to be built with CGO
  7352. macro CGO_SRCS(FILES...) {
  7353. SET_APPEND(_CGO_SRCS_VALUE $FILES)
  7354. PEERDIR(${GOSTD}/syscall)
  7355. }
  7356. # tag:go-specific
  7357. GO_LDFLAGS_GLOBAL=
  7358. ### @usage: GO_LDFLAGS(Flags...)
  7359. ### Link flags for GO_PROGRAM linking from .go sources
  7360. macro GO_LDFLAGS(FLAGS...) {
  7361. SET_APPEND(GO_LDFLAGS_GLOBAL $FLAGS)
  7362. }
  7363. # tag:go-specific
  7364. CGO_CFLAGS_VALUE=
  7365. ### @usage: CGO_CFLAGS(Flags...)
  7366. ### Compiler flags specific to CGO compilation
  7367. macro CGO_CFLAGS(FLAGS...) {
  7368. SET_APPEND(CGO_CFLAGS_VALUE $FLAGS)
  7369. CFLAGS($FLAGS)
  7370. }
  7371. # tag:go-specific
  7372. CGO_LDFLAGS_VALUE=
  7373. ### @usage: CGO_LDFLAGS(Files...)
  7374. ### Linker flags specific to CGO linking
  7375. macro CGO_LDFLAGS(FLAGS...) {
  7376. SET_APPEND(CGO_LDFLAGS_VALUE $FLAGS)
  7377. GO_LDFLAGS($FLAGS)
  7378. }
  7379. # tag:go-specific
  7380. _GO_SKIP_TEST_VALUE=
  7381. ### @usage: GO_SKIP_TESTS(TestNames...)
  7382. ###
  7383. ### Define a set of tests that should not be run.
  7384. ### NB! Subtests are not taken into account!
  7385. macro GO_SKIP_TESTS(TESTS...) {
  7386. SET_APPEND(_GO_SKIP_TEST_VALUE $TESTS)
  7387. RESTRICT_PATH(vendor MSG This macro is prohibited to be used outside the vendor/ directory)
  7388. }
  7389. # tag:go-specific tag:internal
  7390. _GO_EMBED_VALUE=
  7391. _GO_EMBED_INPUTS=
  7392. ### @usage: _GO_EMBED_PATTERN(PATTERN) # internal
  7393. ###
  7394. ### Define an embed pattern.
  7395. macro _GO_EMBED_PATTERN(XTEST?"_xtest":"", PATTERN, IMPORT_PATH) {
  7396. SET(VAR_SALT1 $XTEST $PATTERN $IMPORT_PATH 1)
  7397. SET(_PATTERN_GLOB1 uniq_embed_${hash:VAR_SALT1})
  7398. _GLOB($_PATTERN_GLOB1 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/.*)
  7399. SET(VAR_SALT2 $XTEST $PATTERN $IMPORT_PATH 2)
  7400. SET(_PATTERN_GLOB2 _uniq_embed_${hash:VAR_SALT2})
  7401. _GLOB($_PATTERN_GLOB2 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN})
  7402. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $PATTERN \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7403. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7404. }
  7405. # tag:go-specific
  7406. ### @usage: GO_EMBED_PATTERN(PATTERN)
  7407. ###
  7408. ### Define an embed pattern.
  7409. macro GO_EMBED_PATTERN(PATTERN) {
  7410. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7411. }
  7412. # tag:go-specific
  7413. ### @usage: GO_TEST_EMBED_PATTERN(PATTERN)
  7414. ###
  7415. ### Define an embed pattern for internal go tests.
  7416. macro GO_TEST_EMBED_PATTERN(PATTERN) {
  7417. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7418. }
  7419. # tag:go-specific
  7420. ### @usage: GO_XTEST_EMBED_PATTERN(PATTERN)
  7421. ###
  7422. ### Define an embed pattern for external go tests.
  7423. macro GO_XTEST_EMBED_PATTERN(PATTERN) {
  7424. _GO_EMBED_PATTERN(XTEST $PATTERN $_GO_IMPORT_PATH)
  7425. }
  7426. # tag:go-specific tag:internal
  7427. ### @usage: _GO_EMBED_DIR(PATTERN) # internal
  7428. ###
  7429. ### Define an embed directory DIR.
  7430. macro _GO_EMBED_DIR(XTEST?"_xtest":"", DIR, IMPORT_PATH) {
  7431. SET(VAR_SALT $XTEST $DIR $IMPORT_PATH)
  7432. SET(_PATTERN_GLOB uniq_embed_${hash:VAR_SALT})
  7433. _GLOB($_PATTERN_GLOB ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/.*)
  7434. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $DIR \$$_PATTERN_GLOB)
  7435. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB)
  7436. }
  7437. # tag:go-specific
  7438. ### @usage: GO_EMBED_DIR(DIR)
  7439. ###
  7440. ### Define an embed directory DIR.
  7441. macro GO_EMBED_DIR(DIR) {
  7442. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH)
  7443. }
  7444. # tag:go-specific
  7445. ### @usage: GO_TEST_EMBED_DIR(DIR)
  7446. ###
  7447. ### Define an embed directory DIR for internal go tests.
  7448. macro GO_EMBED_TEST_DIR(DIR) {
  7449. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH)
  7450. }
  7451. # tag:go-specific
  7452. ### @usage: GO_XTEST_EMBED_DIR(DIR)
  7453. ###
  7454. ### Define an embed directory DIR for external go tests.
  7455. macro GO_EMBED_XTEST_DIR(DIR) {
  7456. _GO_EMBED_DIR(XTEST $DIR $_GO_IMPORT_PATH)
  7457. }
  7458. # tag:go-specific
  7459. _GO_TOOLCHAIN_ENV_GOARCH=unknown
  7460. when ($ARCH_ARM64) {
  7461. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=arm64"}
  7462. }
  7463. elsewhen ($ARCH_X86_64) {
  7464. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=amd64"}
  7465. }
  7466. # tag:go-specific
  7467. _GO_TOOLCHAIN_ENV_GOOS=unknown
  7468. when ($OS_DARWIN) {
  7469. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=darwin"}
  7470. }
  7471. elsewhen ($OS_LINUX) {
  7472. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=linux"}
  7473. }
  7474. elsewhen ($OS_WINDOWS) {
  7475. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=windows"}
  7476. }
  7477. _GO_TOOLCHAIN_ENV_PATH=
  7478. # tag:go-specific
  7479. GO_TOOLCHAIN_ENV=$TOOLCHAIN_ENV $_GO_TOOLCHAIN_ENV_GOARCH $_GO_TOOLCHAIN_ENV_GOOS $_GO_TOOLCHAIN_ENV_PATH
  7480. # tag:go-specific
  7481. _GO_GRPC_WELLKNOWN=\
  7482. vendor/google.golang.org/grpc \
  7483. vendor/google.golang.org/grpc \
  7484. vendor/google.golang.org/grpc/codes \
  7485. vendor/google.golang.org/grpc/grpclog \
  7486. vendor/google.golang.org/grpc/status
  7487. # tag:go-specific
  7488. macro _GO_GRPC() {
  7489. SET(GO_PROTO_GEN_PLUGINS grpc)
  7490. PEERDIR(${GOSTD}/context ${_GO_GRPC_WELLKNOWN})
  7491. }
  7492. # tag:go-specific
  7493. ### @usage: GO_GRPC_GATEWAY_SRCS()
  7494. ###
  7495. ### Use of grpc-gateway plugin (Supported for Go only).
  7496. macro GO_GRPC_GATEWAY_SRCS(FILE...) {
  7497. ENABLE(UNUSED_MACRO)
  7498. }
  7499. # tag:go-specific
  7500. ### @usage: GO_GRPC_GATEWAY_SWAGGER_SRCS()
  7501. ###
  7502. ### Use of grpc-gateway plugin w/ swagger emission (Supported for Go only).
  7503. macro GO_GRPC_GATEWAY_SWAGGER_SRCS(FILE...) {
  7504. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  7505. }
  7506. # tag:go-specific
  7507. _GO_PROTO_GRPC_GATEWAY_OPTS=
  7508. _GO_PROTO_GRPC_GATEWAY_OUTS=
  7509. # tag:go-specific
  7510. macro _GO_GRPC_GATEWAY_SRCS_IMPL(Files...) {
  7511. foreach (File : $Files) {
  7512. [.proto]=$_GO_PROTO_CMD_IMPL($File OPTS $_GO_PROTO_GRPC_GATEWAY_OPTS OUTS $_GO_PROTO_GRPC_GATEWAY_OUTS)
  7513. }
  7514. PEERDIR(${GOSTD}/context ${GOSTD}/io ${GOSTD}/net/http)
  7515. PEERDIR(vendor/github.com/golang/protobuf/descriptor)
  7516. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/runtime)
  7517. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/utilities)
  7518. PEERDIR(vendor/google.golang.org/grpc/metadata)
  7519. }
  7520. # tag:go-specific
  7521. macro _SETUP_GO_GRPC_GATEWAY() {
  7522. 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:))
  7523. SET(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;nopath;noext;suf=.pb.gw.go:File})
  7524. }
  7525. # tag:go-specific
  7526. macro _GO_GRPC_GATEWAY_SRCS(Files...) {
  7527. _SETUP_GO_GRPC_GATEWAY()
  7528. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  7529. }
  7530. # tag:go-specific
  7531. macro _GO_GRPC_GATEWAY_SWAGGER_SRCS(Files...) {
  7532. _SETUP_GO_GRPC_GATEWAY()
  7533. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OPTS $_PROTO_PLUGIN_ARGS_BASE(swagger vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger logtostderr=true:))
  7534. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;noauto;nopath;noext;suf=.swagger.json:File})
  7535. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  7536. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  7537. }
  7538. # tag:go-specific
  7539. when ($MUSL == "yes") {
  7540. _GO_DEFAULT_ALLOCATOR=$DEFAULT_ALLOCATOR
  7541. }
  7542. otherwise {
  7543. _GO_DEFAULT_ALLOCATOR=FAKE
  7544. }
  7545. # tag:go-specific tag:internal
  7546. ### @usage _GO_BASE_UNIT # internal
  7547. ###
  7548. ### The base module of all golang modules. Defines common properties, dependencies and rules for go build.
  7549. module _GO_BASE_UNIT: _BASE_UNIT {
  7550. .EXTS=.go .gosrc .o .obj .a .symabis .mf
  7551. .CMD=TOUCH_UNIT
  7552. .NODE_TYPE=Bundle
  7553. .GLOBAL=GO_LDFLAGS
  7554. .PEERDIR_POLICY=as_build_from
  7555. .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
  7556. .ALLOWED=GO_PROTO_PLUGIN USE_CXX USE_UTIL RESOURCE_FILES
  7557. .IGNORED=GO_SKIP_TESTS USE_SKIFF
  7558. .DEFAULT_NAME_GENERATOR=UseDirNameOrSetGoPackage
  7559. ENABLE(_GO_MODULE)
  7560. SET(MODULE_TAG GO)
  7561. PEERDIR_TAGS=GO GO_PROTO GO_FBS __EMPTY__
  7562. DEFAULT(_GO_VET_TOOL)
  7563. DEFAULT(_GO_VET_FLAGS)
  7564. DEFAULT(_GO_VET_EXTS)
  7565. DEFAULT(_GO_SONAME)
  7566. NO_RUNTIME()
  7567. SET(COVERAGE_FLAGS)
  7568. SET(EXTRA_OUTPUT)
  7569. SET(MODULE_LANG GO)
  7570. PEERDIR(build/external_resources/go_tools)
  7571. GO_PROTO_OUTS+=${output;hide;norel;nopath;noext;suf=.pb.go:File}
  7572. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  7573. PEERDIR+=$COMPILER_PLATFORM
  7574. }
  7575. when ($CLANG == "yes" || $GCC == "yes") {
  7576. CGO_CFLAGS_VALUE += -w -pthread -fpic
  7577. CGO2_CFLAGS_VALUE += -Wno-unused-variable
  7578. }
  7579. select ($GO_VET) {
  7580. "yes" | "on" ? {
  7581. _GO_VET=yes
  7582. _GO_VET_FLAGS+=-cgocall=false
  7583. }
  7584. "yndexer" ? {
  7585. _GO_VET=yes
  7586. PEERDIR+=build/external_resources/goyndexer
  7587. _GO_VET_TOOL=${GOYNDEXER_RESOURCE_GLOBAL}/goyndexer
  7588. _GO_YDX_FILE=++ydx-file ${_GO_YNDEXER_EXT}
  7589. _GO_VET_FLAGS=-indexer.arc ${ARCADIA_ROOT} -indexer.indexfile ${GO_YNDEXER_OUTPUT} -indexer.loglevel info
  7590. _GO_FMT_ADD_CHECK=no
  7591. _GO_VET_ADD_CHECK=no
  7592. GO_VET_INFO_EXT=.ydx.out
  7593. GO_VET_REPORT_EXT=.ydx.txt
  7594. _GO_VET_EXTS=++vet-info-ext .ydx.out ++vet-report-ext .ydx.txt
  7595. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=__ARCADIA_BUILD_ROOT_PREFIX__ --source-prefix=__ARCADIA_SOURCE_ROOT_PREFIX__
  7596. }
  7597. "yolint" ? {
  7598. _GO_VET=yes
  7599. PEERDIR+=build/external_resources/yolint
  7600. _GO_VET_TOOL=${YOLINT_RESOURCE_GLOBAL}/yolint
  7601. _GO_VET_FLAGS=-migration.config=${input:"${ARCADIA_ROOT}/build/rules/go/migrations.yaml"} -scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
  7602. }
  7603. "yolint_next" ? {
  7604. _GO_VET=yes
  7605. PEERDIR+=build/external_resources/yolint
  7606. _GO_VET_TOOL=${YOLINT_NEXT_RESOURCE_GLOBAL}/yolint
  7607. _GO_VET_FLAGS=-scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
  7608. }
  7609. "local" ? {
  7610. _GO_VET=yes
  7611. _GO_VET_FLAGS=
  7612. }
  7613. default ? {
  7614. _GO_VET=no
  7615. _GO_VET_FLAGS=
  7616. }
  7617. }
  7618. SET(_GO_VET $_GO_VET)
  7619. when ($GO_VET_TOOL == "") {
  7620. _GO_VET_TOOL_REAL=$_GO_VET_TOOL
  7621. }
  7622. otherwise {
  7623. _GO_VET_TOOL_REAL=$GO_VET_TOOL
  7624. }
  7625. when ($GO_VET_FLAGS == "") {
  7626. _GO_VET_FLAGS_REAL=$_GO_VET_FLAGS
  7627. }
  7628. otherwise {
  7629. _GO_VET_FLAGS_REAL=$GO_VET_FLAGS
  7630. }
  7631. when ($_GO_VET == "yes" && $NO_GO_VET != "yes") {
  7632. 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
  7633. }
  7634. otherwise {
  7635. GO_VET_OUTPUT=
  7636. _GO_VET_ADD_CHECK=no
  7637. }
  7638. when ($GO_DEBUG_PATH_RELATIVE == "yes") {
  7639. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=;build=;tools= ++tools-root $(TOOL_ROOT)
  7640. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>;$ARCADIA_BUILD_ROOT=>;$(TOOL_ROOT)=>
  7641. }
  7642. otherwise {
  7643. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=/-S;build=/-B;tools=/-T ++tools-root $(TOOL_ROOT)
  7644. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>/-S;$ARCADIA_BUILD_ROOT=>/-B;$(TOOL_ROOT)=>/-T
  7645. }
  7646. _GO_PROCESS_SRCS()
  7647. when ($CLANG == "yes") {
  7648. _GO_EXTLD=clang
  7649. GO_TOOLCHAIN_ENV += ${env:"CC=clang"}
  7650. }
  7651. otherwise {
  7652. _GO_EXTLD=gcc
  7653. GO_TOOLCHAIN_ENV += ${env:"CC=gcc"}
  7654. }
  7655. when ($OS_DARWIN) {
  7656. PEERDIR+=build/external_resources/go_fake_xcrun
  7657. 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
  7658. CGO2_LDFLAGS_VALUE += $LD_SDK_VERSION -undefined dynamic_lookup -nodefaultlibs -lc
  7659. }
  7660. elsewhen ($OS_LINUX) {
  7661. 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
  7662. CGO2_LDFLAGS_VALUE += -Wl,--unresolved-symbols=ignore-all -nodefaultlibs -lc
  7663. }
  7664. otherwise {
  7665. GO_EXTLD = ++extld $_GO_EXTLD
  7666. }
  7667. when ($RACE == "yes") {
  7668. _GO_COMPILE_FLAGS_RACE=-race
  7669. _GO_LINK_FLAGS_RACE=-race
  7670. }
  7671. otherwise {
  7672. _GO_COMPILE_FLAGS_RACE=
  7673. _GO_LINK_FLAGS_RACE=
  7674. }
  7675. when ($PIC == "yes") {
  7676. _GO_COMPILE_FLAGS_SHARED=-shared
  7677. _GO_ASM_FLAGS_SHARED=-shared
  7678. }
  7679. otherwise {
  7680. _GO_COMPILE_FLAGS_SHARED=
  7681. _GO_ASM_FLAGS_SHARED=
  7682. }
  7683. GO_ASM_FLAGS_VALUE += $_GO_ASM_FLAGS_SHARED
  7684. GO_COMPILE_FLAGS_VALUE += $_GO_COMPILE_FLAGS_RACE $_GO_COMPILE_FLAGS_SHARED
  7685. GO_LINK_FLAGS_VALUE += $_GO_LINK_FLAGS_RACE
  7686. ADDINCL(${GOSTD}/runtime)
  7687. }
  7688. # tag:go-specific
  7689. ### @usage: GO_LIBRARY([name])
  7690. ###
  7691. ### Go library module definition.
  7692. ### Compile Go module as a library suitable for PEERDIR from other Go modules.
  7693. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7694. module GO_LIBRARY: _GO_BASE_UNIT {
  7695. .CMD=GO_LINK_LIB
  7696. .NODE_TYPE=Bundle
  7697. .FINAL_TARGET=no
  7698. SET(_GO_TOOL_MODE lib)
  7699. SET(MODULE_TYPE LIBRARY)
  7700. _REQUIRE_EXPLICIT_LICENSE(vendor)
  7701. MODULE_SUFFIX=.a
  7702. }
  7703. # tag:go-specific
  7704. ### @usage: GO_PROGRAM([name])
  7705. ###
  7706. ### Go program module definition.
  7707. ### Compile and link Go module to an executable program.
  7708. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7709. module GO_PROGRAM: _GO_BASE_UNIT {
  7710. .CMD=GO_LINK_EXE
  7711. .NODE_TYPE=Program
  7712. .PROXY=yes
  7713. .SYMLINK_POLICY=EXE
  7714. .ALLOWED=INDUCED_DEPS
  7715. .FINAL_TARGET=yes
  7716. SET(_GO_TOOL_MODE exe)
  7717. SET(MODULE_TYPE PROGRAM)
  7718. SET(GO_VET_OUTPUT_INFO)
  7719. ALLOCATOR($_GO_DEFAULT_ALLOCATOR)
  7720. _USE_LINKER()
  7721. ENABLE(COMMON_LINK_SETTINGS)
  7722. when ($MUSL == "yes") {
  7723. PEERDIR += contrib/libs/musl/full
  7724. }
  7725. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7726. MODULE_SUFFIX=.exe
  7727. }
  7728. PEERDIR(${GOSTD}/runtime library/go/core/buildinfo)
  7729. when ($RACE == "yes") {
  7730. PEERDIR += ${GOSTD}/runtime/cgo
  7731. PEERDIR += ${GOSTD}/runtime/race
  7732. }
  7733. when ($MUSL == "yes") {
  7734. GO_WITH_MUSL = ++musl
  7735. }
  7736. }
  7737. # tag:go-specific
  7738. module _GO_DLL_BASE_UNIT: GO_PROGRAM {
  7739. .CMD=GO_LINK_DLL
  7740. .SYMLINK_POLICY=SO
  7741. .ALLOWED=WHOLE_ARCHIVE
  7742. .ARGS_PARSER=DLL
  7743. .NODE_TYPE=Library
  7744. .PROXY=yes
  7745. SET(_GO_TOOL_MODE dll)
  7746. SET(MODULE_TYPE DLL)
  7747. GO_PACKAGE_NAME(main)
  7748. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7749. MODULE_SUFFIX=.dll
  7750. }
  7751. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  7752. MODULE_PREFIX=lib
  7753. MODULE_SUFFIX=.dylib$MODULE_VERSION
  7754. }
  7755. otherwise {
  7756. MODULE_PREFIX=lib
  7757. MODULE_SUFFIX=.so$MODULE_VERSION
  7758. }
  7759. when ($OS_DARWIN) {
  7760. _GO_SONAME=-Wl,-install_name,$SONAME
  7761. }
  7762. elsewhen ($OS_LINUX) {
  7763. _GO_SONAME=-Wl,-soname,$SONAME
  7764. }
  7765. when ($MODULE_VERSION) {
  7766. when ($OS_LINUX || $OS_DARWIN) {
  7767. _GO_LINK_EXE_EXT_CMD+= && $LINK_OR_COPY_CMD $TARGET ${output;nopath;noext:SONAME}
  7768. }
  7769. }
  7770. }
  7771. # tag:go-specific
  7772. ### @usage: GO_DLL(name major_ver [minor_ver] [PREFIX prefix])
  7773. ###
  7774. ### Go ishared object module definition.
  7775. ### Compile and link Go module to a shared object.
  7776. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7777. module GO_DLL: _GO_DLL_BASE_UNIT {
  7778. }
  7779. # tag:go-specific tag:test
  7780. ### @usage: GO_BENCH_TIMEOUT(x)
  7781. ###
  7782. ### Sets timeout in seconds for 1 Benchmark in go benchmark suite
  7783. ###
  7784. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  7785. macro GO_BENCH_TIMEOUT(bench_timeout) {
  7786. SET(GO_BENCH_TIMEOUT $bench_timeout)
  7787. }
  7788. # tag:go-specific tag:test
  7789. ### @usage: GO_TEST([name])
  7790. ###
  7791. ### Go test module definition.
  7792. ### Compile and link Go module as a test suitable for running with Arcadia testing support.
  7793. ### All usual testing support macros like DATA, DEPENDS, SIZE, REQUIREMENTS etc. are supported.
  7794. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7795. module GO_TEST: GO_PROGRAM {
  7796. .CMD=GO_LINK_TEST
  7797. .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
  7798. .ALLOWED=GO_SKIP_TESTS YT_SPEC
  7799. .FINAL_TARGET=no
  7800. SET(_GO_TOOL_MODE test)
  7801. SET(MODULE_TYPE PROGRAM)
  7802. ENABLE(GO_TEST_MODULE)
  7803. SET(GO_COVER_INFO_VALUE)
  7804. # We have to add uncoditionaly PEERDIR to ${GOSTD}/os here thouth it is really
  7805. # needed when TestMain is defined in the source code of the test
  7806. PEERDIR(${GOSTD}/os)
  7807. PEERDIR(${GOSTD}/testing/internal/testdeps)
  7808. PEERDIR(${GOSTD}/testing)
  7809. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.test)
  7810. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.bench)
  7811. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  7812. }
  7813. # tag:go-specific
  7814. macro GO_MOCKGEN_FROM(Path) {
  7815. SET(MOCKGEN_FROM ${Path})
  7816. }
  7817. # tag:go-specific
  7818. macro GO_MOCKGEN_TYPES(First, Rest...) {
  7819. SET(MOCKGEN_FIRST $First)
  7820. SET(MOCKGEN_REST $Rest)
  7821. }
  7822. # tag:go-specific
  7823. macro GO_MOCKGEN_REFLECT() {
  7824. PEERDIR(${GOSTD}/encoding/gob)
  7825. PEERDIR(${GOSTD}/flag)
  7826. PEERDIR(${GOSTD}/fmt)
  7827. PEERDIR(${GOSTD}/os)
  7828. PEERDIR(${GOSTD}/path)
  7829. PEERDIR(${GOSTD}/reflect)
  7830. PEERDIR(vendor/github.com/golang/mock/mockgen/model)
  7831. PEERDIR(${MOCKGEN_FROM})
  7832. 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)
  7833. }
  7834. # tag:go-specific
  7835. macro GO_MOCKGEN_MOCKS() {
  7836. PEERDIR(${GOSTD}/reflect)
  7837. PEERDIR(vendor/github.com/golang/mock/gomock)
  7838. 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)
  7839. }
  7840. # Conflict between protobuf-java and protobuf-javalite ¯\_(ツ)_/¯
  7841. # both libraries are required by grpc
  7842. JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE=\
  7843. com.google.protobuf.AbstractMessageLite \
  7844. com.google.protobuf.AbstractMessageLite$Builder \
  7845. com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream \
  7846. com.google.protobuf.AbstractMessageLite$InternalOneOfEnum \
  7847. com.google.protobuf.AbstractParser \
  7848. com.google.protobuf.AbstractProtobufList \
  7849. com.google.protobuf.AllocatedBuffer \
  7850. com.google.protobuf.AllocatedBuffer$1 \
  7851. com.google.protobuf.AllocatedBuffer$2 \
  7852. com.google.protobuf.Android \
  7853. com.google.protobuf.Any \
  7854. com.google.protobuf.Any$1 \
  7855. com.google.protobuf.Any$Builder \
  7856. com.google.protobuf.AnyOrBuilder \
  7857. com.google.protobuf.AnyProto \
  7858. com.google.protobuf.Api \
  7859. com.google.protobuf.Api$1 \
  7860. com.google.protobuf.Api$Builder \
  7861. com.google.protobuf.ApiOrBuilder \
  7862. com.google.protobuf.ApiProto \
  7863. com.google.protobuf.ArrayDecoders \
  7864. com.google.protobuf.ArrayDecoders$1 \
  7865. com.google.protobuf.ArrayDecoders$Registers \
  7866. com.google.protobuf.BinaryReader \
  7867. com.google.protobuf.BinaryReader$1 \
  7868. com.google.protobuf.BinaryReader$SafeHeapReader \
  7869. com.google.protobuf.BinaryWriter \
  7870. com.google.protobuf.BinaryWriter$1 \
  7871. com.google.protobuf.BinaryWriter$SafeDirectWriter \
  7872. com.google.protobuf.BinaryWriter$SafeHeapWriter \
  7873. com.google.protobuf.BinaryWriter$UnsafeDirectWriter \
  7874. com.google.protobuf.BinaryWriter$UnsafeHeapWriter \
  7875. com.google.protobuf.BooleanArrayList \
  7876. com.google.protobuf.BoolValue \
  7877. com.google.protobuf.BoolValue$1 \
  7878. com.google.protobuf.BoolValue$Builder \
  7879. com.google.protobuf.BoolValueOrBuilder \
  7880. com.google.protobuf.BufferAllocator \
  7881. com.google.protobuf.BufferAllocator$1 \
  7882. com.google.protobuf.ByteBufferWriter \
  7883. com.google.protobuf.ByteOutput \
  7884. com.google.protobuf.ByteString \
  7885. com.google.protobuf.ByteString$1 \
  7886. com.google.protobuf.ByteString$2 \
  7887. com.google.protobuf.ByteString$AbstractByteIterator \
  7888. com.google.protobuf.ByteString$ArraysByteArrayCopier \
  7889. com.google.protobuf.ByteString$BoundedByteString \
  7890. com.google.protobuf.ByteString$ByteArrayCopier \
  7891. com.google.protobuf.ByteString$ByteIterator \
  7892. com.google.protobuf.ByteString$CodedBuilder \
  7893. com.google.protobuf.ByteString$LeafByteString \
  7894. com.google.protobuf.ByteString$LiteralByteString \
  7895. com.google.protobuf.ByteString$Output \
  7896. com.google.protobuf.ByteString$SystemByteArrayCopier \
  7897. com.google.protobuf.BytesValue \
  7898. com.google.protobuf.BytesValue$1 \
  7899. com.google.protobuf.BytesValue$Builder \
  7900. com.google.protobuf.BytesValueOrBuilder \
  7901. com.google.protobuf.CanIgnoreReturnValue \
  7902. com.google.protobuf.CheckReturnValue \
  7903. com.google.protobuf.CodedInputStream \
  7904. com.google.protobuf.CodedInputStream$1 \
  7905. com.google.protobuf.CodedInputStream$ArrayDecoder \
  7906. com.google.protobuf.CodedInputStream$IterableDirectByteBufferDecoder \
  7907. com.google.protobuf.CodedInputStream$StreamDecoder \
  7908. com.google.protobuf.CodedInputStream$StreamDecoder$RefillCallback \
  7909. com.google.protobuf.CodedInputStream$StreamDecoder$SkippedDataSink \
  7910. com.google.protobuf.CodedInputStream$UnsafeDirectNioDecoder \
  7911. com.google.protobuf.CodedInputStreamReader \
  7912. com.google.protobuf.CodedInputStreamReader$1 \
  7913. com.google.protobuf.CodedOutputStream \
  7914. com.google.protobuf.CodedOutputStream$1 \
  7915. com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder \
  7916. com.google.protobuf.CodedOutputStream$ArrayEncoder \
  7917. com.google.protobuf.CodedOutputStream$ByteOutputEncoder \
  7918. com.google.protobuf.CodedOutputStream$HeapNioEncoder \
  7919. com.google.protobuf.CodedOutputStream$OutOfSpaceException \
  7920. com.google.protobuf.CodedOutputStream$OutputStreamEncoder \
  7921. com.google.protobuf.CodedOutputStream$SafeDirectNioEncoder \
  7922. com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder \
  7923. com.google.protobuf.CodedOutputStreamWriter \
  7924. com.google.protobuf.CodedOutputStreamWriter$1 \
  7925. com.google.protobuf.DoubleArrayList \
  7926. com.google.protobuf.DoubleValue \
  7927. com.google.protobuf.DoubleValue$1 \
  7928. com.google.protobuf.DoubleValue$Builder \
  7929. com.google.protobuf.DoubleValueOrBuilder \
  7930. com.google.protobuf.Duration \
  7931. com.google.protobuf.Duration$1 \
  7932. com.google.protobuf.Duration$Builder \
  7933. com.google.protobuf.DurationOrBuilder \
  7934. com.google.protobuf.DurationProto \
  7935. com.google.protobuf.Empty \
  7936. com.google.protobuf.Empty$1 \
  7937. com.google.protobuf.Empty$Builder \
  7938. com.google.protobuf.EmptyOrBuilder \
  7939. com.google.protobuf.EmptyProto \
  7940. com.google.protobuf.Enum \
  7941. com.google.protobuf.Enum$1 \
  7942. com.google.protobuf.Enum$Builder \
  7943. com.google.protobuf.EnumOrBuilder \
  7944. com.google.protobuf.EnumValue \
  7945. com.google.protobuf.EnumValue$1 \
  7946. com.google.protobuf.EnumValue$Builder \
  7947. com.google.protobuf.EnumValueOrBuilder \
  7948. com.google.protobuf.ExperimentalApi \
  7949. com.google.protobuf.ExtensionLite \
  7950. com.google.protobuf.ExtensionRegistryFactory \
  7951. com.google.protobuf.ExtensionRegistryLite \
  7952. com.google.protobuf.ExtensionRegistryLite$ExtensionClassHolder \
  7953. com.google.protobuf.ExtensionRegistryLite$ObjectIntPair \
  7954. com.google.protobuf.ExtensionSchema \
  7955. com.google.protobuf.ExtensionSchemaLite \
  7956. com.google.protobuf.ExtensionSchemaLite$1 \
  7957. com.google.protobuf.ExtensionSchemas \
  7958. com.google.protobuf.Field \
  7959. com.google.protobuf.Field$1 \
  7960. com.google.protobuf.Field$Builder \
  7961. com.google.protobuf.Field$Cardinality \
  7962. com.google.protobuf.Field$Cardinality$1 \
  7963. com.google.protobuf.Field$Kind \
  7964. com.google.protobuf.Field$Kind$1 \
  7965. com.google.protobuf.FieldInfo \
  7966. com.google.protobuf.FieldInfo$1 \
  7967. com.google.protobuf.FieldInfo$Builder \
  7968. com.google.protobuf.FieldMask \
  7969. com.google.protobuf.FieldMask$1 \
  7970. com.google.protobuf.FieldMask$Builder \
  7971. com.google.protobuf.FieldMaskOrBuilder \
  7972. com.google.protobuf.FieldMaskProto \
  7973. com.google.protobuf.FieldOrBuilder \
  7974. com.google.protobuf.FieldSet \
  7975. com.google.protobuf.FieldSet$1 \
  7976. com.google.protobuf.FieldSet$Builder \
  7977. com.google.protobuf.FieldSet$FieldDescriptorLite \
  7978. com.google.protobuf.FieldType \
  7979. com.google.protobuf.FieldType$1 \
  7980. com.google.protobuf.FieldType$Collection \
  7981. com.google.protobuf.FloatArrayList \
  7982. com.google.protobuf.FloatValue \
  7983. com.google.protobuf.FloatValue$1 \
  7984. com.google.protobuf.FloatValue$Builder \
  7985. com.google.protobuf.FloatValueOrBuilder \
  7986. com.google.protobuf.GeneratedMessageInfoFactory \
  7987. com.google.protobuf.GeneratedMessageLite \
  7988. com.google.protobuf.GeneratedMessageLite$1 \
  7989. com.google.protobuf.GeneratedMessageLite$Builder \
  7990. com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser \
  7991. com.google.protobuf.GeneratedMessageLite$ExtendableBuilder \
  7992. com.google.protobuf.GeneratedMessageLite$ExtendableMessage \
  7993. com.google.protobuf.GeneratedMessageLite$ExtendableMessage$ExtensionWriter \
  7994. com.google.protobuf.GeneratedMessageLite$ExtendableMessageOrBuilder \
  7995. com.google.protobuf.GeneratedMessageLite$ExtensionDescriptor \
  7996. com.google.protobuf.GeneratedMessageLite$GeneratedExtension \
  7997. com.google.protobuf.GeneratedMessageLite$MethodToInvoke \
  7998. com.google.protobuf.GeneratedMessageLite$SerializedForm \
  7999. com.google.protobuf.Int32Value \
  8000. com.google.protobuf.Int32Value$1 \
  8001. com.google.protobuf.Int32Value$Builder \
  8002. com.google.protobuf.Int32ValueOrBuilder \
  8003. com.google.protobuf.Int64Value \
  8004. com.google.protobuf.Int64Value$1 \
  8005. com.google.protobuf.Int64Value$Builder \
  8006. com.google.protobuf.Int64ValueOrBuilder \
  8007. com.google.protobuf.IntArrayList \
  8008. com.google.protobuf.Internal \
  8009. com.google.protobuf.Internal$BooleanList \
  8010. com.google.protobuf.Internal$DoubleList \
  8011. com.google.protobuf.Internal$EnumLite \
  8012. com.google.protobuf.Internal$EnumLiteMap \
  8013. com.google.protobuf.Internal$EnumVerifier \
  8014. com.google.protobuf.Internal$FloatList \
  8015. com.google.protobuf.Internal$IntList \
  8016. com.google.protobuf.Internal$ListAdapter \
  8017. com.google.protobuf.Internal$ListAdapter$Converter \
  8018. com.google.protobuf.Internal$LongList \
  8019. com.google.protobuf.Internal$MapAdapter \
  8020. com.google.protobuf.Internal$MapAdapter$1 \
  8021. com.google.protobuf.Internal$MapAdapter$Converter \
  8022. com.google.protobuf.Internal$MapAdapter$EntryAdapter \
  8023. com.google.protobuf.Internal$MapAdapter$IteratorAdapter \
  8024. com.google.protobuf.Internal$MapAdapter$SetAdapter \
  8025. com.google.protobuf.Internal$ProtobufList \
  8026. com.google.protobuf.InvalidProtocolBufferException \
  8027. com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException \
  8028. com.google.protobuf.IterableByteBufferInputStream \
  8029. com.google.protobuf.JavaType \
  8030. com.google.protobuf.LazyField \
  8031. com.google.protobuf.LazyField$1 \
  8032. com.google.protobuf.LazyField$LazyEntry \
  8033. com.google.protobuf.LazyField$LazyIterator \
  8034. com.google.protobuf.LazyFieldLite \
  8035. com.google.protobuf.LazyStringArrayList \
  8036. com.google.protobuf.LazyStringArrayList$ByteArrayListView \
  8037. com.google.protobuf.LazyStringArrayList$ByteStringListView \
  8038. com.google.protobuf.LazyStringList \
  8039. com.google.protobuf.ListFieldSchema \
  8040. com.google.protobuf.ListFieldSchema$1 \
  8041. com.google.protobuf.ListFieldSchema$ListFieldSchemaFull \
  8042. com.google.protobuf.ListFieldSchema$ListFieldSchemaLite \
  8043. com.google.protobuf.ListValue \
  8044. com.google.protobuf.ListValue$1 \
  8045. com.google.protobuf.ListValue$Builder \
  8046. com.google.protobuf.ListValueOrBuilder \
  8047. com.google.protobuf.LongArrayList \
  8048. com.google.protobuf.ManifestSchemaFactory \
  8049. com.google.protobuf.ManifestSchemaFactory$1 \
  8050. com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory \
  8051. com.google.protobuf.MapEntryLite \
  8052. com.google.protobuf.MapEntryLite$1 \
  8053. com.google.protobuf.MapEntryLite$Metadata \
  8054. com.google.protobuf.MapFieldLite \
  8055. com.google.protobuf.MapFieldSchema \
  8056. com.google.protobuf.MapFieldSchemaLite \
  8057. com.google.protobuf.MapFieldSchemas \
  8058. com.google.protobuf.MessageInfo \
  8059. com.google.protobuf.MessageInfoFactory \
  8060. com.google.protobuf.MessageLite \
  8061. com.google.protobuf.MessageLite$Builder \
  8062. com.google.protobuf.MessageLiteOrBuilder \
  8063. com.google.protobuf.MessageLiteToString \
  8064. com.google.protobuf.MessageSchema \
  8065. com.google.protobuf.MessageSchema$1 \
  8066. com.google.protobuf.MessageSetSchema \
  8067. com.google.protobuf.Method \
  8068. com.google.protobuf.Method$1 \
  8069. com.google.protobuf.Method$Builder \
  8070. com.google.protobuf.MethodOrBuilder \
  8071. com.google.protobuf.Mixin \
  8072. com.google.protobuf.Mixin$1 \
  8073. com.google.protobuf.Mixin$Builder \
  8074. com.google.protobuf.MixinOrBuilder \
  8075. com.google.protobuf.MutabilityOracle \
  8076. com.google.protobuf.MutabilityOracle$1 \
  8077. com.google.protobuf.NewInstanceSchema \
  8078. com.google.protobuf.NewInstanceSchemaLite \
  8079. com.google.protobuf.NewInstanceSchemas \
  8080. com.google.protobuf.NioByteString \
  8081. com.google.protobuf.NioByteString$1 \
  8082. com.google.protobuf.NullValue \
  8083. com.google.protobuf.NullValue$1 \
  8084. com.google.protobuf.OneofInfo \
  8085. com.google.protobuf.Option \
  8086. com.google.protobuf.Option$1 \
  8087. com.google.protobuf.Option$Builder \
  8088. com.google.protobuf.OptionOrBuilder \
  8089. com.google.protobuf.Parser \
  8090. com.google.protobuf.PrimitiveNonBoxingCollection \
  8091. com.google.protobuf.Protobuf \
  8092. com.google.protobuf.ProtobufArrayList \
  8093. com.google.protobuf.ProtobufLists \
  8094. com.google.protobuf.ProtocolStringList \
  8095. com.google.protobuf.ProtoSyntax \
  8096. com.google.protobuf.RawMessageInfo \
  8097. com.google.protobuf.Reader \
  8098. com.google.protobuf.RopeByteString \
  8099. com.google.protobuf.RopeByteString$1 \
  8100. com.google.protobuf.RopeByteString$Balancer \
  8101. com.google.protobuf.RopeByteString$PieceIterator \
  8102. com.google.protobuf.RopeByteString$RopeInputStream \
  8103. com.google.protobuf.Schema \
  8104. com.google.protobuf.SchemaFactory \
  8105. com.google.protobuf.SchemaUtil \
  8106. com.google.protobuf.SmallSortedMap \
  8107. com.google.protobuf.SmallSortedMap$1 \
  8108. com.google.protobuf.SmallSortedMap$DescendingEntryIterator \
  8109. com.google.protobuf.SmallSortedMap$DescendingEntrySet \
  8110. com.google.protobuf.SmallSortedMap$EmptySet \
  8111. com.google.protobuf.SmallSortedMap$EmptySet$1 \
  8112. com.google.protobuf.SmallSortedMap$EmptySet$2 \
  8113. com.google.protobuf.SmallSortedMap$Entry \
  8114. com.google.protobuf.SmallSortedMap$EntryIterator \
  8115. com.google.protobuf.SmallSortedMap$EntrySet \
  8116. com.google.protobuf.SourceContext \
  8117. com.google.protobuf.SourceContext$1 \
  8118. com.google.protobuf.SourceContext$Builder \
  8119. com.google.protobuf.SourceContextOrBuilder \
  8120. com.google.protobuf.SourceContextProto \
  8121. com.google.protobuf.StringValue \
  8122. com.google.protobuf.StringValue$1 \
  8123. com.google.protobuf.StringValue$Builder \
  8124. com.google.protobuf.StringValueOrBuilder \
  8125. com.google.protobuf.Struct \
  8126. com.google.protobuf.Struct$1 \
  8127. com.google.protobuf.Struct$Builder \
  8128. com.google.protobuf.Struct$FieldsDefaultEntryHolder \
  8129. com.google.protobuf.StructOrBuilder \
  8130. com.google.protobuf.StructProto \
  8131. com.google.protobuf.StructuralMessageInfo \
  8132. com.google.protobuf.StructuralMessageInfo$Builder \
  8133. com.google.protobuf.Syntax \
  8134. com.google.protobuf.Syntax$1 \
  8135. com.google.protobuf.TextFormatEscaper \
  8136. com.google.protobuf.TextFormatEscaper$1 \
  8137. com.google.protobuf.TextFormatEscaper$2 \
  8138. com.google.protobuf.TextFormatEscaper$ByteSequence \
  8139. com.google.protobuf.Timestamp \
  8140. com.google.protobuf.Timestamp$1 \
  8141. com.google.protobuf.Timestamp$Builder \
  8142. com.google.protobuf.TimestampOrBuilder \
  8143. com.google.protobuf.TimestampProto \
  8144. com.google.protobuf.Type \
  8145. com.google.protobuf.Type$1 \
  8146. com.google.protobuf.Type$Builder \
  8147. com.google.protobuf.TypeOrBuilder \
  8148. com.google.protobuf.TypeProto \
  8149. com.google.protobuf.UInt32Value \
  8150. com.google.protobuf.UInt32Value$1 \
  8151. com.google.protobuf.UInt32Value$Builder \
  8152. com.google.protobuf.UInt32ValueOrBuilder \
  8153. com.google.protobuf.UInt64Value \
  8154. com.google.protobuf.UInt64Value$1 \
  8155. com.google.protobuf.UInt64Value$Builder \
  8156. com.google.protobuf.UInt64ValueOrBuilder \
  8157. com.google.protobuf.UninitializedMessageException \
  8158. com.google.protobuf.UnknownFieldSchema \
  8159. com.google.protobuf.UnknownFieldSetLite \
  8160. com.google.protobuf.UnknownFieldSetLiteSchema \
  8161. com.google.protobuf.UnmodifiableLazyStringList \
  8162. com.google.protobuf.UnmodifiableLazyStringList$1 \
  8163. com.google.protobuf.UnmodifiableLazyStringList$2 \
  8164. com.google.protobuf.UnsafeByteOperations \
  8165. com.google.protobuf.UnsafeUtil \
  8166. com.google.protobuf.UnsafeUtil$1 \
  8167. com.google.protobuf.UnsafeUtil$Android32MemoryAccessor \
  8168. com.google.protobuf.UnsafeUtil$Android64MemoryAccessor \
  8169. com.google.protobuf.UnsafeUtil$JvmMemoryAccessor \
  8170. com.google.protobuf.UnsafeUtil$MemoryAccessor \
  8171. com.google.protobuf.Utf8 \
  8172. com.google.protobuf.Utf8$DecodeUtil \
  8173. com.google.protobuf.Utf8$Processor \
  8174. com.google.protobuf.Utf8$SafeProcessor \
  8175. com.google.protobuf.Utf8$UnpairedSurrogateException \
  8176. com.google.protobuf.Utf8$UnsafeProcessor \
  8177. com.google.protobuf.Value \
  8178. com.google.protobuf.Value$1 \
  8179. com.google.protobuf.Value$Builder \
  8180. com.google.protobuf.Value$KindCase \
  8181. com.google.protobuf.ValueOrBuilder \
  8182. com.google.protobuf.WireFormat \
  8183. com.google.protobuf.WireFormat$1 \
  8184. com.google.protobuf.WireFormat$FieldType \
  8185. com.google.protobuf.WireFormat$FieldType$1 \
  8186. com.google.protobuf.WireFormat$FieldType$2 \
  8187. com.google.protobuf.WireFormat$FieldType$3 \
  8188. com.google.protobuf.WireFormat$FieldType$4 \
  8189. com.google.protobuf.WireFormat$JavaType \
  8190. com.google.protobuf.WireFormat$Utf8Validation \
  8191. com.google.protobuf.WireFormat$Utf8Validation$1 \
  8192. com.google.protobuf.WireFormat$Utf8Validation$2 \
  8193. com.google.protobuf.WireFormat$Utf8Validation$3 \
  8194. com.google.protobuf.WrappersProto \
  8195. com.google.protobuf.Writer \
  8196. com.google.protobuf.Writer$FieldOrder
  8197. # tag:java-specific
  8198. JAVA_IGNORE_CLASSPATH_CLASH_VALUE=$JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE
  8199. ### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
  8200. ### Ignore classpath clash test fails for classes
  8201. macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
  8202. SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args $JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE)
  8203. }
  8204. # tag:python-specific
  8205. ### @usage: PY_SRCS({| CYTHON_C} { | TOP_LEVEL | NAMESPACE ns} Files...)
  8206. ###
  8207. ### Build specified Python sources according to Arcadia binary Python build. Basically creates precompiled and source resources keyed with module paths.
  8208. ### The resources eventually are linked into final program and can be accessed as regular Python modules.
  8209. ### This custom loader linked into the program will add them to sys.meta_path.
  8210. ###
  8211. ### 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.
  8212. ### .pyx and .swg lead to C/C++ Python extensions generation, that are automatically registered in Python as built-in modules.
  8213. ###
  8214. ### 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).
  8215. ###
  8216. ### __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.
  8217. ###
  8218. ### @example
  8219. ###
  8220. ### PY2_LIBRARY(mymodule)
  8221. ### 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)
  8222. ### END()
  8223. ###
  8224. ### PY_SRCS honors Python2 and Python3 differences and adjusts itself to Python version of a current module.
  8225. ### PY_SRCS can be used in any Arcadia Python build modules like PY*_LIBRARY, PY*_PROGRAM, PY*TEST.
  8226. ### PY_SRCS in LIBRARY or PROGRAM effectively converts these into PY2_LIBRARY and PY2_PROGRAM respectively.
  8227. ### 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.
  8228. ###
  8229. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs/#modulipylibrarypy3libraryimakrospysrcs
  8230. macro PY_SRCS() {
  8231. DEFAULT(MODULE_TAG PY2)
  8232. DEFAULT(PYTHON2 yes)
  8233. DEFAULT(PYTHON3 no)
  8234. }
  8235. # tag:python-specific
  8236. _ALL_PY_FILES=
  8237. # tag:python-specific
  8238. macro _ALL_PY_SRCS2(TOP_LEVEL?"TOP_LEVEL":"", RECURSIVE?"/**":"", NAMESPACE[], REST[]) {
  8239. _GLOB(_ALL_PY_FILES ${suf=${RECURSIVE}/*.py:REST} ${suf=${RECURSIVE}/ya.make:REST} EXCLUDE ya.make)
  8240. }
  8241. # tag:python-specific
  8242. ### @usage: ALL_PY_SRCS([RECURSIVE] { | TOP_LEVEL | NAMESPACE ns} [Dirs...])
  8243. ###
  8244. ### Puts all .py-files from given Dirs (relative to projects') into PY_SRCS of the current module.
  8245. ### If Dirs is ommitted project directory is used
  8246. ###
  8247. ### `RECURSIVE` makes lookup recursive with resprect to Dirs
  8248. ### `TOP_LEVEL` and `NAMESPACE` are forwarded to `PY_SRCS`
  8249. ###
  8250. ### Note: Only one such macro per module is allowed
  8251. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  8252. ###
  8253. ### @see [PY_SRCS()](#macro_PY_SRCS)
  8254. macro ALL_PY_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", Files...) {
  8255. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files})
  8256. PY_SRCS(_MR ${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} $_ALL_PY_FILES)
  8257. }
  8258. # tag:python-specific
  8259. ### @usage: ALL_PYTEST_SRCS([RECURSIVE] [Dirs...])
  8260. ###
  8261. ### Puts all .py-files from given Dirs (relative to projects') into TEST_SRCS of the current module.
  8262. ### If Dirs is omitted project directory is used
  8263. ###
  8264. ### `RECURSIVE` makes lookup recursive with respect to Dirs
  8265. ###
  8266. ### Note: Only one such macro per module is allowed
  8267. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  8268. ###
  8269. ### @see [TEST_SRCS()](#macro_TEST_SRCS)
  8270. macro ALL_PYTEST_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", Files...) {
  8271. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files})
  8272. TEST_SRCS(_MR $_ALL_PY_FILES)
  8273. }
  8274. # tag:python-specific
  8275. _PY_EXTRA_LINT_FILES_VALUE=
  8276. ### @usage: PY_EXTRA_LINT_FILES(files...)
  8277. ###
  8278. ### Add extra Python files for linting. This macro allows adding
  8279. ### Python files which has no .py extension.
  8280. macro PY_EXTRA_LINT_FILES(FILES...) {
  8281. SET_APPEND(_PY_EXTRA_LINT_FILES_VALUE $FILES)
  8282. }
  8283. # tag:python-specific
  8284. ### @usage: PY23_LIBRARY([name])
  8285. ###
  8286. ### Build PY2_LIBRARY or PY3_LIBRARY depending on incoming PEERDIR.
  8287. ### Direct build or build by RECURSE creates both variants.
  8288. ### This multimodule doesn't define any final targets, so use from DEPENDS or BUNDLE is not allowed.
  8289. ###
  8290. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs
  8291. multimodule PY23_LIBRARY {
  8292. module PY2: PY2_LIBRARY {
  8293. OBJ_SUF=.py2
  8294. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8295. PYTHON_TYPE_FOR_CYTHON=PY2
  8296. }
  8297. module PY3: PY3_LIBRARY {
  8298. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8299. PYTHON_TYPE_FOR_CYTHON=PY2
  8300. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8301. MODULE_PREFIX=py3
  8302. }
  8303. otherwise {
  8304. MODULE_PREFIX=libpy3
  8305. }
  8306. OBJ_SUF=.py3
  8307. }
  8308. }
  8309. # tag:python-specific
  8310. ### @usage: PY23_NATIVE_LIBRARY([name])
  8311. ###
  8312. ### Build LIBRARY compatible with either Python 2.x or Python 3.x depending on incoming PEERDIR.
  8313. ###
  8314. ### 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.
  8315. ### Use these multimodule instead of PY23_LIBRARY if the C++ extension defined in it will be used in PY2MODULE.
  8316. ### 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.
  8317. ### Proper version will be selected according to Python version of the module PEERDIR comes from.
  8318. ###
  8319. ### This mulrtimodule doesn't define any final targets so cannot be used from DEPENDS or BUNDLE macros.
  8320. ###
  8321. ### For more information read https://wiki.yandex-team.ru/arcadia/python/pysrcs/#pysrcssrcsipy23nativelibrary
  8322. ###
  8323. ### @see [LIBRARY()](#module_LIBRARY), [PY2MODULE()](#module_PY2MODULE)
  8324. multimodule PY23_NATIVE_LIBRARY {
  8325. module PY2: LIBRARY {
  8326. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 PYTHON3_ADDINCL
  8327. OBJ_SUF=.py2
  8328. PYTHON2_ADDINCL()
  8329. SET(MODULE_LANG PY2)
  8330. }
  8331. module PY3: LIBRARY {
  8332. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3
  8333. .ALIASES=PYTHON2_ADDINCL=PYTHON3_ADDINCL
  8334. PYTHON3_ADDINCL()
  8335. SET(MODULE_LANG PY3)
  8336. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8337. MODULE_PREFIX=py3c
  8338. }
  8339. otherwise {
  8340. MODULE_PREFIX=libpy3c
  8341. }
  8342. OBJ_SUF=.py3
  8343. }
  8344. }
  8345. IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  8346. # tag:src-processing
  8347. STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
  8348. macro _SRC("storyboard", SRC, SRCFLAGS...) {
  8349. .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}
  8350. }
  8351. # tag:src-processing
  8352. macro _SRC("xib", SRC, SRCFLAGS...) {
  8353. .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}
  8354. }
  8355. ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  8356. # tag:ios-specific
  8357. ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
  8358. macro _IOS_ASSETS(AssetsDir, Content...) {
  8359. .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
  8360. }
  8361. # tag:ios-specific
  8362. macro IOS_APP_COMMON_FLAGS(Flags...) {
  8363. SET_APPEND(STORYBOARD_FLAGS $Flags)
  8364. SET_APPEND(ASSETS_FLAGS $Flags)
  8365. }
  8366. # tag:ios-specific
  8367. macro IOS_APP_ASSETS_FLAGS(Flags...) {
  8368. SET_APPEND(ASSETS_FLAGS $Flags)
  8369. }
  8370. macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
  8371. .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
  8372. }
  8373. macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
  8374. .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
  8375. }
  8376. # tag:ios-specific
  8377. DELIM=__DELIM__
  8378. 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
  8379. ### @usage: IOS_INTERFACE()
  8380. ### iOS GUI module definition
  8381. module IOS_INTERFACE: _BARE_UNIT {
  8382. .CMD=PACK_IOS_ARCHIVE
  8383. .EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
  8384. .NODE_TYPE=Library
  8385. .FINAL_TARGET=no
  8386. SET(MODULE_SUFFIX .ios.interface)
  8387. PEERDIR+=build/platform/xcode/tools
  8388. }
  8389. # tag:ios-specific
  8390. module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
  8391. SET(MODULE_SUFFIX .default.ios.interface)
  8392. }
  8393. DEFAULT_IOS_TYPE=
  8394. IOS_TYPE=
  8395. when(!$IOS_TYPE) {
  8396. when($DEFAULT_IOS_TYPE) {
  8397. IOS_TYPE=$DEFAULT_IOS_TYPE
  8398. }
  8399. otherwise {
  8400. IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
  8401. }
  8402. }
  8403. DEFAULT_IOS_RUNTIME=
  8404. IOS_RUNTIME=
  8405. when(!$IOS_RUNTIME) {
  8406. when($DEFAULT_IOS_RUNTIME) {
  8407. IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
  8408. }
  8409. otherwise {
  8410. IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
  8411. }
  8412. }
  8413. when ($ARCH_I386) {
  8414. TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
  8415. TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
  8416. }
  8417. otherwise {
  8418. TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
  8419. TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
  8420. }
  8421. # tag:java-specific
  8422. ### @usage: MODULE_JDK(Version)
  8423. ###
  8424. ### Specify JDK version for module
  8425. macro JDK_VERSION(Arg) {
  8426. SET(JDK_REAL_VERSION $Arg)
  8427. _JDK_VERSION_MACRO_CHECK($Arg)
  8428. }
  8429. # tag:java-specific
  8430. when ($JDK_REAL_VERSION == "10") {
  8431. JDK10=yes # remove this later
  8432. }
  8433. JAVA_PROGRAM_CP_USE_COMMAND_FILE=yes
  8434. when ($JDK_REAL_VERSION == "8") {
  8435. JAVA_PROGRAM_CP_USE_COMMAND_FILE=no
  8436. }
  8437. # tag:kotlin-specific
  8438. KOTLIN_JVM_TARGET=
  8439. when ($JDK_REAL_VERSION == "8") {
  8440. KOTLIN_JVM_TARGET=1.8
  8441. }
  8442. elsewhen ($JDK_REAL_VERSION == "18") {
  8443. # remove when kotlin starts supporting jdk18 bytecode
  8444. # see also devtools/ya/jbuild/gen/actions/idea.py
  8445. KOTLIN_JVM_TARGET=17
  8446. }
  8447. otherwise {
  8448. KOTLIN_JVM_TARGET=$JDK_REAL_VERSION
  8449. }
  8450. # tag:frontend-specific
  8451. ### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
  8452. ###
  8453. ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
  8454. macro COLLECT_FRONTEND_FILES(Varname, Dir) {
  8455. _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
  8456. }
  8457. # tag:java-specific
  8458. # local jdk and tools
  8459. USE_SYSTEM_JDK=
  8460. USE_SYSTEM_UBERJAR=
  8461. USE_SYSTEM_ERROR_PRONE=
  8462. # tag:swift-specific
  8463. CPP_XCODE_TOOLCHAIN_VERSION=9.2
  8464. SWIFT_XCODE_TOOLCHAIN_VERSION=9.2
  8465. XCODE_TOOLS_VERSION=10.1
  8466. macro COMPILE_SWIFT_MODULE(SRCS{input}[], BRIDGE_HEADER{input}="", Flags...) {
  8467. when ($BRIDGE_HEADER != "") {
  8468. SWIFT_BRIDGE_HEADER=-import-objc-header ${input:BRIDGE_HEADER}
  8469. }
  8470. otherwise {
  8471. SWIFT_BRIDGE_HEADER=
  8472. }
  8473. .PEERDIR+=build/platform/xcode/swift
  8474. # swift core libraries
  8475. LDFLAGS($SWIFT_LD_FLAGS)
  8476. .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}
  8477. }
  8478. TEST_TOOL_HOST_LOCAL=
  8479. TEST_TOOL_TARGET_LOCAL=
  8480. when ($TENSORFLOW_WITH_CUDA) {
  8481. CUDA_REQUIRED=yes
  8482. }
  8483. when (!$TENSORRT_VERSION) {
  8484. TENSORRT_VERSION=5
  8485. }
  8486. ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
  8487. MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin
  8488. when ($QT_REQUIRED) {
  8489. QT_BIN=${HOST_QT_RESOURCE_GLOBAL}/bin
  8490. }
  8491. when ($OPENGL_REQUIRED) {
  8492. OPENGL_VERSION=18.0.5
  8493. }
  8494. # tag:python-specific
  8495. multimodule PY23_TEST {
  8496. module PY2 : PYTEST_BIN {
  8497. MODULE_PREFIX=py2_
  8498. OBJ_SUF=.py2
  8499. CANONIZE_SUB_PATH=py2test
  8500. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8501. PYTHON_TYPE_FOR_CYTHON=PY2
  8502. }
  8503. module PY3TEST_PROGRAM: PY3TEST_BIN {
  8504. .FINAL_TARGET=yes
  8505. OBJ_SUF=.py3
  8506. CANONIZE_SUB_PATH=py3test
  8507. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8508. PYTHON_TYPE_FOR_CYTHON=PY2
  8509. }
  8510. module PY3TEST_LIBRARY: PY3_LIBRARY {
  8511. PEERDIR+=library/python/pytest
  8512. _REQUIRE_EXPLICIT_LICENSE()
  8513. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8514. PYTHON_TYPE_FOR_CYTHON=PY2
  8515. }
  8516. }
  8517. # tag:windows-specific
  8518. WINDOWS_MANIFEST=
  8519. macro WINDOWS_MANIFEST(Manifest) {
  8520. SET(WINDOWS_MANIFEST $Manifest)
  8521. }
  8522. # tag:windows-specific
  8523. when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
  8524. LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
  8525. }
  8526. # tag:cpp-specific
  8527. _VISIBILITY_LEVEL=
  8528. ### @usage: VISIBILITY(level)
  8529. ###
  8530. ### This macro sets visibility level for symbols compiled for the current module. 'level'
  8531. ### may take only one of the following values: DEFAULT, HIDDEN.
  8532. macro VISIBILITY(LEVEL) {
  8533. SET(_VISIBILITY_LEVEL ${LEVEL})
  8534. select ($LEVEL) {
  8535. "DEFAULT" | "HIDDEN" ? {
  8536. }
  8537. default ? {
  8538. _OK = no
  8539. }
  8540. }
  8541. ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
  8542. }
  8543. # tag:cpp-specific
  8544. _CFLAGS_VISIBILITY=
  8545. when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
  8546. when ($CLANG == "yes" || $GCC == "yes") {
  8547. _CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
  8548. }
  8549. }
  8550. CFLAGS+=$_CFLAGS_VISIBILITY
  8551. # tag:cpp-specific
  8552. macro SDBUS_CPP_ADAPTOR(File) {
  8553. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
  8554. .PEERDIR=contrib/libs/sdbus-cpp
  8555. }
  8556. # tag:cpp-specific
  8557. macro SDBUS_CPP_PROXY(File) {
  8558. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
  8559. .PEERDIR=contrib/libs/sdbus-cpp
  8560. }
  8561. # tag:python-specific
  8562. macro _PY_SSQLS_SRC(EXT, SRC, SRCFLAGS...) {
  8563. #generic macro
  8564. }
  8565. # tag:python-specific
  8566. macro _PY_SSQLS_SRC("ssqls", SRC, SRCFLAGS...) {
  8567. .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}
  8568. }
  8569. # tag:python-specific
  8570. macro _PY_SSQLS_SRCS(Srcs...) {
  8571. foreach(Src: $Srcs) {
  8572. _PY_SSQLS_SRC(${lastext:Src} $Src)
  8573. }
  8574. }
  8575. # tag:python-specific
  8576. macro PY_SSQLS_SRCS(Srcs...) {
  8577. _PY_SSQLS_SRCS(KEEP_DIR_STRUCT $Srcs)
  8578. PY_SRCS(${noext;pre=autogenerated/$MODDIR/:Srcs.py})
  8579. }
  8580. # tag:python-specific
  8581. macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
  8582. .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"}
  8583. }
  8584. # tag:python-specific
  8585. macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
  8586. .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"}
  8587. }
  8588. # tag:metrika
  8589. multimodule SSQLS_LIBRARY {
  8590. module CPP_SSQLS : LIBRARY {
  8591. .ALIASES=ENUMS_SERIALIZATION=CPP_ENUMS_SERIALIZATION
  8592. SET(PEERDIR_TAGS CPP_SSQLS)
  8593. PEERDIR(metrika/core/libs/appmetrica/types metrika/core/libs/types)
  8594. ADDINCL(GLOBAL ${ARCADIA_BUILD_ROOT}/metrika/core/common_tables/include)
  8595. }
  8596. module PY3_SSQLS : PY3_LIBRARY {
  8597. .ALIASES=SRCS=PY_SSQLS_SRCS ENUMS_SERIALIZATION=PY_ENUMS_SERIALIZATION
  8598. SET(PEERDIR_TAGS PY3 PY3_SSQLS)
  8599. }
  8600. }
  8601. macro NGINX_MODULES(Modules...) {
  8602. PEERDIR(${Modules})
  8603. 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)
  8604. }
  8605. # Experimental: container as output. https://st.yandex-team.ru/DTCC-179
  8606. # tag:external-build
  8607. 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"}
  8608. 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"}
  8609. # tag:external-build
  8610. module CONTAINER_LAYER: _BARE_UNIT {
  8611. .CMD=CONTAINER_LAYER_CMD
  8612. MODULE_SUFFIX=.container_layer
  8613. }
  8614. # tag:external-build
  8615. module CONTAINER: _BARE_UNIT {
  8616. .NODE_TYPE=Bundle
  8617. .PEERDIR_POLICY=as_build_from
  8618. .FINAL_TARGET=yes
  8619. .CMD=CONTAINER_CMD
  8620. }
  8621. # tag:external-build
  8622. CUSTOM_BUILD_LIBRARY_USE=
  8623. 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
  8624. # tag:external-build
  8625. module CUSTOM_BUILD_LIBRARY: LIBRARY {
  8626. .NODE_TYPE=Bundle
  8627. .PEERDIR_POLICY=as_build_from
  8628. .PROXY=yes
  8629. .CMD=CUSTOM_BUILD_LIBRARY_CMD
  8630. DISABLE(NEED_ADD_FAKE_SRC)
  8631. }
  8632. ### @usage: ORIGINAL_SOURCE(Source)
  8633. ###
  8634. ### This macro specifies the source repository for contrib
  8635. ### Does nothing now (just a placeholder for future functionality)
  8636. ### See https://st.yandex-team.ru/DTCC-316
  8637. macro ORIGINAL_SOURCE(Source) {
  8638. ENABLE(UNUSED_MACRO)
  8639. }
  8640. # tag:licence
  8641. CREDITS_FILE_EXTRA_EXT=
  8642. CREDITS_FLAGS=
  8643. CREDITS_TEXTS_FILE=
  8644. NO_CREDITS_TEXTS_FILE=
  8645. WITH_CREDITS=
  8646. ### @usage: LICENSE_TEXTS(File)
  8647. ###
  8648. ### This macro specifies the filename with all library licenses texts
  8649. macro LICENSE_TEXTS(Source) {
  8650. SET(CREDITS_TEXTS_FILE $Source)
  8651. }
  8652. # tag:licence
  8653. ### @usage: WITHOUT_LICENSE_TEXTS()
  8654. ###
  8655. ### This macro indicates that the module has no license text
  8656. macro WITHOUT_LICENSE_TEXTS() {
  8657. ENABLE(NO_CREDITS_TEXTS_FILE)
  8658. }
  8659. # tag:licence
  8660. when ($WITH_CREDITS) {
  8661. CREDITS_FLAGS+=--credits-output ${output;suf=${CREDITS_FILE_EXTRA_EXT}".CREDITS.txt":REALPRJNAME}
  8662. }
  8663. GENERATE_MF=
  8664. when ($WITH_CREDITS) {
  8665. GENERATE_MF=$GENERATE_MF_CMD
  8666. }
  8667. macro _MCU_CONVERT(Bin) {
  8668. .CMD=${cwd:BINDIR} $OBJCOPY_TOOL -O ihex $Bin ${output;noext:Bin.hex} && ${cwd:BINDIR} $OBJCOPY_TOOL -O srec $Bin ${output;noext:Bin.s37} && ${cwd:BINDIR} $OBJCOPY_TOOL -O binary $Bin ${output;noext:Bin.bin}
  8669. }
  8670. MCU_LINK_EXE=$LINK_EXE && $_MCU_CONVERT($MODULE_PREFIX$REALPRJNAME)
  8671. ### @usage: MCU_PROGRAM([progname])
  8672. ###
  8673. ### Program module for microcontrollers. Converts ELF to Intel HEX, Motorola S-record and raw binary file formats.
  8674. ### If name is not specified it will be generated from the name of the containing project directory.
  8675. module MCU_PROGRAM: PROGRAM {
  8676. .CMD=MCU_LINK_EXE
  8677. }
  8678. # tag:deprecated
  8679. ### @usage: METAQUERYFILES(filenames...) #deprecated
  8680. ###
  8681. ### This macro does nothing and will be removed
  8682. macro METAQUERYFILES(Files...) {
  8683. ENABLE(UNUSED_MACRO)
  8684. }
  8685. # tag:flags tag:internal tag:windows-specific
  8686. ### @usage: _MSVC_FLAGS_WINDOWS_IMPL(target_platform compiler_flags) # internal
  8687. ###
  8688. ### Add CFLAGS when the firts argument is WINDOWS
  8689. macro _MSVC_FLAGS_WINDOWS_IMPL(WINDOWS[], FLAGS...) {
  8690. CFLAGS($WINDOWS)
  8691. }
  8692. # tag:flags tag:windows-specific tag:cpp-specific
  8693. ### @usage: MSVC_FLAGS([GLOBAL compiler_flag]* compiler_flags)
  8694. ###
  8695. ### Add the specified flags to the compilation line of C/C++files.
  8696. ### Flags apply only if the compiler used is MSVC (cl.exe)
  8697. macro MSVC_FLAGS(FLAGS...) {
  8698. _MSVC_FLAGS_WINDOWS_IMPL($TARGET_PLATFORM $FLAGS)
  8699. }
  8700. ### @usage: COLLECT_YDB_API_SPECS_LEGACY(VarName Paths...) #deprecated
  8701. ###
  8702. ### This macro is ugly hack for legacy YDB go API codegen, any other uses are prohibited
  8703. macro COLLECT_YDB_API_SPECS_LEGACY(FILES_VAR, PATHS...) {
  8704. _GLOB($FILES_VAR ${suf=/*.proto:PATHS})
  8705. RESTRICT_PATH(kikimr/public/sdk/go/ydb/api MSG This is ugly hack for legacy YDB go API codegen, any other uses are probibited)
  8706. }
  8707. # tag:proto tag:apphost
  8708. ### @usage: APPHOST()
  8709. ###
  8710. ### Emit APPHOST service code for all .proto files in a PROTO_LIBRARY.
  8711. ### This works only for C++ and Java at the moment.
  8712. macro APPHOST() {
  8713. # C++
  8714. CPP_PROTO_PLUGIN(cpp_plugin apphost/tools/stub_generator/cpp_plugin .apphost.h)
  8715. # Java
  8716. JAVA_PROTO_PLUGIN(java_plugin apphost/tools/stub_generator/java_plugin DEPS apphost/api/service/java/apphost)
  8717. }