ymake.core.conf 406 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462
  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=314159265358
  10. SANDBOX_FAKEID=${FAKEID}.7600000
  11. CPP_FAKEID=2023-06-06
  12. GO_FAKEID=11100371
  13. ANDROID_FAKEID=2023-05-17
  14. CLANG_TIDY_FAKEID=2023-06-06
  15. CYTHON_FAKE_ID=10784829
  16. JAVA_FAKEID=10849009
  17. # Change of this value will invalidate some parts of configure cache
  18. # but will not affect builds anyhow (except tests referring build/ directory)
  19. JSON_CACHE_FAKE_ID=11215402
  20. CURDIR=.
  21. MODDIR=.
  22. BINDIR=bin:/
  23. SRCDIR=
  24. YMAKE=ymake
  25. ECHO=echo
  26. INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i .ipp .ixx .ya_exposed
  27. CPP_EXT=.cpp
  28. OBJ_SUF=
  29. CFLAGS=
  30. EXTRA_C_FLAGS=
  31. SFLAGS=
  32. FORCE_COVERAGE_ENABLED=
  33. FORCE_COVERAGE_DISABLED=
  34. AUTOCHECK_BALANCING_OPTIONS=
  35. SO_OUTPUTS=no
  36. @import "${CONF_ROOT}/conf/settings.conf"
  37. @import "${CONF_ROOT}/conf/opensource.conf"
  38. @import "${CONF_ROOT}/conf/rules.conf"
  39. @import "${CONF_ROOT}/conf/sysincl.conf"
  40. @import "${CONF_ROOT}/conf/license.conf"
  41. @import "${CONF_ROOT}/conf/ts/ts.conf"
  42. @import "${CONF_ROOT}/conf/docs.conf"
  43. @import "${CONF_ROOT}/conf/swig.conf"
  44. @import "${CONF_ROOT}/conf/java.conf"
  45. @import "${CONF_ROOT}/conf/project_specific/other.conf"
  46. @import "${CONF_ROOT}/conf/project_specific/uservices.conf"
  47. @import "${CONF_ROOT}/conf/project_specific/yt.conf"
  48. USE_GLOBAL_CMD=no
  49. when ($OS_WINDOWS != "yes") {
  50. USE_GLOBAL_CMD=yes
  51. }
  52. when ($USE_PYTHON) {
  53. C_DEFINES+= -DUSE_PYTHON
  54. }
  55. __COMMA__=${comma:""}
  56. ARCADIA_TEST_ROOT=../arcadia_tests_data/
  57. DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32
  58. FAIL_PY2=no
  59. _PREBUILT_TOOLS_ROOT=build/prebuilt
  60. _TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
  61. _TOOL_PROTOC_GEN_GO_V2=vendor/google.golang.org/protobuf/cmd/protoc-gen-go
  62. _TOOL_PROTOC_GEN_GO_GRPC_V2=vendor/google.golang.org/grpc/cmd/protoc-gen-go-grpc
  63. _TOOL_RESCOMPILER=tools/rescompiler
  64. _TOOL_RESCOMPRESSOR=tools/rescompressor
  65. _TOOL_RORESCOMPILER=tools/rorescompiler
  66. when ($DISABLE_SEPARATE_AUX_CPP != "yes") {
  67. SEPARATE_AUX_CPP=yes
  68. }
  69. when ($HOST_ARCH_X86_64 == "yes") {
  70. when ($HOST_OS_DARWIN == "yes" || $HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes") {
  71. VALID_HOST_PLATFORM_FOR_COMMON_PREBUILT_TOOLS=yes
  72. when ($USE_PREBUILT_TOOLS == "yes" && $ARCH_X86_64 == "yes") {
  73. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  74. }
  75. }
  76. }
  77. FAIL_MODULE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
  78. DEFAULT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  79. PROJECT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  80. TIDY=
  81. TIDY_ENABLED=
  82. when($TIDY == "yes") {
  83. TIDY_ENABLED=yes
  84. }
  85. when ($TIDY_ENABLED == "yes") {
  86. when ($TIDY_EXPORT_FIXES=="") {
  87. TIDY_EXPORT_FIXES="no"
  88. }
  89. 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=${COMPILE_OUT_SUFFIX}${OBJ_CROSS_SUF}.tidyjson:SRC} "--export-fixes" $TIDY_EXPORT_FIXES
  90. CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
  91. CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
  92. when ($TIDY_CHECKS) {
  93. CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
  94. }
  95. when ($TIDY_HEADER_FILTER) {
  96. CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
  97. }
  98. TIDY_VALUE=USE_CONDITIONAL_SRCS
  99. }
  100. otherwise {
  101. CLANG_TIDY_ARGS=
  102. TIDY_VALUE=
  103. }
  104. # tag:codenav
  105. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  106. PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
  107. YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
  108. YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.ydx.pb2:SRC}
  109. }
  110. otherwise {
  111. PY_PROGRAM_LINK_EXE=$LINK_EXE
  112. YNDEXER_ARGS=
  113. YNDEXER_OUTPUT=
  114. }
  115. when ($RETRY == "yes") {
  116. RETRY_ARGS=$YMAKE_PYTHON ${input:"build/scripts/wrapcc.py"}
  117. }
  118. otherwise {
  119. RETRY_ARGS=
  120. }
  121. COVERAGE_FLAGS=
  122. EXTRA_OUTPUT=
  123. when ($CLANG == "yes" || $GCC == "yes") {
  124. when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
  125. COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
  126. EXTRA_OUTPUT=${output;noauto;hide;suf=${COMPILE_OUT_SUFFIX}${_CROSS_SUFFIX}.gcno:SRC}
  127. }
  128. }
  129. when ($OS_CYGWIN == "yes") {
  130. CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
  131. USE_ASMLIB=no
  132. FSTACK=
  133. }
  134. CFLAGS+=$COVERAGE_FLAGS
  135. LDFLAGS+=$COVERAGE_FLAGS
  136. CHECKFLAG=
  137. NO_MAPREDUCE=
  138. when ($NO_MAPREDUCE == "yes") {
  139. C_DEFINES+=-DNO_MAPREDUCE
  140. }
  141. when ($OS_ANDROID == "yes") {
  142. PIE=yes
  143. }
  144. when ($CLANG && $OS_DARWIN && $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  145. SO_OUTPUTS=yes
  146. }
  147. when ($OS_NONE == "yes" || $MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
  148. USE_STL_SYSTEM=yes
  149. }
  150. # USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
  151. # select system standard C++ library when USE_INTERNAL_STL=no is set.
  152. #
  153. # USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
  154. #
  155. when ($USE_STL_SYSTEM == "yes") {
  156. USE_INTERNAL_STL=no
  157. }
  158. when ($USE_INTERNAL_STL == "no") {
  159. USE_STL_SYSTEM=yes
  160. }
  161. otherwise {
  162. USE_INTERNAL_STL=yes
  163. # TODO: Extract to conf/sysincl.conf
  164. # This trigger doesn't work for module level since SYSINCL is processed at
  165. # configuration stage (This means that NO_RUNTIME() macro called in ya.make
  166. # won't affect SYSINCL and the only way to make this trigger work correctly
  167. # is to define configuration variable NORUNTIME (-DNORUNTIME) on the command
  168. # line when `ya make ...` is invoked.
  169. when ($NORUNTIME != "yes") {
  170. SYSINCL+=build/sysincl/stl-to-libcxx.yml
  171. when ($MUSL == "yes") {
  172. SYSINCL+=build/sysincl/libc-musl-libcxx.yml
  173. }
  174. }
  175. }
  176. # tag:linux-specific
  177. when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") {
  178. USE_UBUNTU_COMPATIBILITY=yes
  179. }
  180. USE_ARCADIA_PYTHON=yes
  181. USE_ARCADIA_LIBM=no
  182. USE_EAT_MY_DATA=no
  183. HAVE_MKL=
  184. when ($HAVE_MKL == "") {
  185. when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
  186. HAVE_MKL=yes
  187. }
  188. otherwise {
  189. HAVE_MKL=no
  190. }
  191. }
  192. SFDL_TMP_OUT= ${output;tmp:SRC.tmp}
  193. # tag:perl-specific
  194. when ($USE_LOCAL_TOOLS == "yes") {
  195. PERL=$LOCAL_PERL
  196. PERL_VERSION=$LOCAL_PERL_VERSION
  197. PERL_PRIVLIB=$LOCAL_PERL_PRIVLIB
  198. PERL_ARCHLIB=$LOCAL_PERL_ARCHLIB
  199. when ($LOCAL_PERL_LIBS) {
  200. PERL_LIBS=$LOCAL_PERL_LIBS
  201. }
  202. }
  203. otherwise {
  204. PERL=NO-PERL-SELECTED
  205. PERL_VERSION=NO-PERL-SELECTED-VERSION
  206. PERL_PRIVLIB=NO-PERL-SELECTED-PRIVLIB
  207. PERL_ARCHLIB=NO-PERL-SELECTED-ARCHLIB
  208. }
  209. # tag:perl-specific
  210. PERL_LD_LIBRARY_PATH=
  211. PERL_INCLUDE=
  212. USE_PERL_SYSTEM=yes
  213. when ($USE_PERL_SYSTEM == "yes") {
  214. select ($PERL_SDK) {
  215. "ubuntu-12" ? {
  216. PERL_VERSION=5.14
  217. PERL_ROOT=${SYSTEM_PERL_514_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  218. PERL_LIB_ARCH=
  219. }
  220. "ubuntu-14" ? {
  221. PERL_VERSION=5.18
  222. PERL_ROOT=${SYSTEM_PERL_518_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  223. PERL_LIB_ARCH=
  224. }
  225. "ubuntu-16" ? {
  226. PERL_VERSION=5.22
  227. PERL_ROOT=${SYSTEM_PERL_522_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  228. PERL_LIB_ARCH=/x86_64-linux-gnu
  229. }
  230. "ubuntu-18" ? {
  231. PERL_VERSION=5.26
  232. PERL_ROOT=${SYSTEM_PERL_526_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  233. PERL_LIB_ARCH=/x86_64-linux-gnu
  234. }
  235. "ubuntu-20" ? {
  236. PERL_VERSION=5.30
  237. PERL_ROOT=${SYSTEM_PERL_530_RESOURCE_GLOBAL}/usr
  238. PERL_LIB_ARCH=/x86_64-linux-gnu
  239. }
  240. }
  241. PERL=${PERL_ROOT}/bin/perl
  242. PERL_ARCHLIB=${PERL_ROOT}/lib$PERL_LIB_ARCH/perl/${PERL_VERSION}
  243. PERL_PRIVLIB=${PERL_ROOT}/share/perl/${PERL_VERSION}
  244. PERL_LIBS=${PERL_ROOT}/lib${PERL_LIB_ARCH}
  245. PERL_LD_LIBRARY_PATH=${env:"LD_LIBRARY_PATH=${PERL_ROOT}/lib"}
  246. # Perl searches it's modules in INC@ paths. They can not be sysrooted or disabled (at least I haven't found a way),
  247. # so default Perl module directories should be prepended to perl command lines when using non-local perl.
  248. PERL_INCLUDE=-I${PERL_ARCHLIB} -I${PERL_PRIVLIB}
  249. }
  250. PERL_DEFAULT_PEERDIR=yes
  251. # tag:perl-specific
  252. PERLSUFFIX=-csuffix .cpp
  253. PERLOUTPUT=${stdout;output:SRC.cpp}
  254. when ($PERLC == "yes") {
  255. PERLSUFFIX=-csuffix .c
  256. PERLOUTPUT=${stdout;output:SRC.c}
  257. }
  258. XSUBPPFLAGS=
  259. _XSTYPEMAPS=
  260. macro XSTYPEMAPS(Names...) {
  261. SET_APPEND(_XSTYPEMAPS $Names)
  262. }
  263. # tag:tool-specific
  264. ARCH_TOOL=${tool:"tools/archiver"}
  265. # tag:tool-specific tag:proto
  266. PROTOC=${tool:"contrib/tools/protoc"}
  267. PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
  268. PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
  269. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src
  270. USE_VANILLA_PROTOC=no
  271. PROTOC_TRANSITIVE_HEADERS=yes
  272. _PROTOC_FLAGS=
  273. # tag:tool-specific
  274. FML_TOOL=${tool:"tools/relev_fml_codegen"}
  275. FML_UNUSED_TOOL=${tool:"tools/relev_fml_unused"}
  276. LUA_TOOL=${tool:"tools/lua"}
  277. ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
  278. # tag:python-specific tag:cython-specific
  279. CYTHON_SCRIPT=${input:"${ARCADIA_ROOT}/contrib/tools/cython/cython.py"} ${hide:CYTHON_FAKE_ID} $CYTHON_PREDEFINED_INCLUDES
  280. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  281. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  282. PYTHON_TYPE_FOR_CYTHON=PY2
  283. CYTHON_OUTPUT_INCLUDES=\
  284. ${output_include;hide:"contrib/libs/python/Include/compile.h"} \
  285. ${output_include;hide:"contrib/libs/python/Include/frameobject.h"} \
  286. ${output_include;hide:"contrib/libs/python/Include/longintrepr.h"} \
  287. ${output_include;hide:"contrib/libs/python/Include/pyconfig.h"} \
  288. ${output_include;hide:"contrib/libs/python/Include/Python.h"} \
  289. ${output_include;hide:"contrib/libs/python/Include/pythread.h"} \
  290. ${output_include;hide:"contrib/libs/python/Include/structmember.h"} \
  291. ${output_include;hide:"contrib/libs/python/Include/traceback.h"} \
  292. ${output_include;hide:"contrib/tools/cython/generated_c_headers.h"} \
  293. ${output_include;hide:"omp.h"}
  294. # tag:cython-specific
  295. CYTHON_CPP_OUTPUT_INCLUDES=${output_include;hide:"contrib/tools/cython/generated_cpp_headers.h"}
  296. # tag:cython-specific
  297. CYTHON_PREDEFINED_INCLUDES=\
  298. ${input;hide:"contrib/tools/cython/Cython/Utility/Buffer.c"} \
  299. ${input;hide:"contrib/tools/cython/Cython/Utility/Builtins.c"} \
  300. ${input;hide:"contrib/tools/cython/Cython/Utility/CMath.c"} \
  301. ${input;hide:"contrib/tools/cython/Cython/Utility/Capsule.c"} \
  302. ${input;hide:"contrib/tools/cython/Cython/Utility/CommonTypes.c"} \
  303. ${input;hide:"contrib/tools/cython/Cython/Utility/Complex.c"} \
  304. ${input;hide:"contrib/tools/cython/Cython/Utility/Coroutine.c"} \
  305. ${input;hide:"contrib/tools/cython/Cython/Utility/CythonFunction.c"} \
  306. ${input;hide:"contrib/tools/cython/Cython/Utility/Embed.c"} \
  307. ${input;hide:"contrib/tools/cython/Cython/Utility/Exceptions.c"} \
  308. ${input;hide:"contrib/tools/cython/Cython/Utility/ExtensionTypes.c"} \
  309. ${input;hide:"contrib/tools/cython/Cython/Utility/FunctionArguments.c"} \
  310. ${input;hide:"contrib/tools/cython/Cython/Utility/ImportExport.c"} \
  311. ${input;hide:"contrib/tools/cython/Cython/Utility/MemoryView_C.c"} \
  312. ${input;hide:"contrib/tools/cython/Cython/Utility/ModuleSetupCode.c"} \
  313. ${input;hide:"contrib/tools/cython/Cython/Utility/ObjectHandling.c"} \
  314. ${input;hide:"contrib/tools/cython/Cython/Utility/Optimize.c"} \
  315. ${input;hide:"contrib/tools/cython/Cython/Utility/Overflow.c"} \
  316. ${input;hide:"contrib/tools/cython/Cython/Utility/Printing.c"} \
  317. ${input;hide:"contrib/tools/cython/Cython/Utility/Profile.c"} \
  318. ${input;hide:"contrib/tools/cython/Cython/Utility/StringTools.c"} \
  319. ${input;hide:"contrib/tools/cython/Cython/Utility/TestUtilityLoader.c"} \
  320. ${input;hide:"contrib/tools/cython/Cython/Utility/TypeConversion.c"}
  321. # tag:cython-specific
  322. CYTHON_PREDEFINED_INDUCED=\
  323. contrib/libs/python/Include/Python.h
  324. # tag:cython-specific
  325. CYTHON_OPTIONS=
  326. when ($OS_LINUX) {
  327. CYTHON_OPTIONS += -E UNAME_SYSNAME=Linux
  328. }
  329. elsewhen ($OS_DARWIN) {
  330. CYTHON_OPTIONS += -E UNAME_SYSNAME=Darwin
  331. }
  332. elsewhen ($OS_WINDOWS) {
  333. CYTHON_OPTIONS += -E UNAME_SYSNAME=Windows
  334. }
  335. FATAL_ERROR_MODULE=no
  336. FATAL_ERROR_MESSAGE=
  337. # tag:python-specific
  338. # PYTHON_DISTR={ "default" | "macos-brew" } determine python system supply
  339. # see build/platform/python/ya.make
  340. PYTHON_DISTR="default"
  341. when ($USE_SYSTEM_PYTHON) {
  342. USE_ARCADIA_PYTHON=no
  343. select ($USE_SYSTEM_PYTHON) {
  344. "2.7" ? {
  345. _SYSTEM_PYTHON27=yes
  346. PY_VERSION=2.7
  347. PY_FRAMEWORK_VERSION=2.7
  348. }
  349. "3.4" ? {
  350. _SYSTEM_PYTHON34=yes
  351. PY_VERSION=3.4m
  352. PY_FRAMEWORK_VERSION=3.4
  353. }
  354. "3.5" ? {
  355. _SYSTEM_PYTHON35=yes
  356. PY_VERSION=3.5m
  357. PY_FRAMEWORK_VERSION=3.5
  358. }
  359. "3.6" ? {
  360. _SYSTEM_PYTHON36=yes
  361. PY_VERSION=3.6m
  362. PY_FRAMEWORK_VERSION=3.6
  363. }
  364. "3.7" ? {
  365. _SYSTEM_PYTHON37=yes
  366. PY_VERSION=3.7m
  367. PY_FRAMEWORK_VERSION=3.7
  368. }
  369. "3.8" ? {
  370. _SYSTEM_PYTHON38=yes
  371. PY_VERSION=3.8
  372. PY_FRAMEWORK_VERSION=3.8
  373. }
  374. "3.9" ? {
  375. _SYSTEM_PYTHON39=yes
  376. PY_VERSION=3.9
  377. PY_FRAMEWORK_VERSION=3.9
  378. }
  379. "3.10" ? {
  380. _SYSTEM_PYTHON310=yes
  381. PY_VERSION=3.10
  382. PY_FRAMEWORK_VERSION=3.10
  383. }
  384. "3.11" ? {
  385. _SYSTEM_PYTHON311=yes
  386. PY_VERSION=3.11
  387. PY_FRAMEWORK_VERSION=3.11
  388. }
  389. default ? {
  390. FATAL_ERROR_MESSAGE+=invalid USE_SYSTEM_PYTHON value
  391. }
  392. }
  393. }
  394. ANTLR_PYTHON=Python2
  395. ### @usage: NO_LTO()
  396. ###
  397. ### Disable any lto (link-time optimizations) for the module.
  398. ### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
  399. ### linking of entire program if global settings say so.
  400. macro NO_LTO() {
  401. DISABLE(USE_LTO)
  402. DISABLE(USE_THINLTO)
  403. }
  404. when ($BUILD_PYTHON3_BIN) {
  405. YMAKE_PYTHON3=${BUILD_PYTHON3_BIN}
  406. YMAKE_PYTHON3_PEERDIR=
  407. }
  408. otherwise {
  409. YMAKE_PYTHON3=${YMAKE_PYTHON3_RESOURCE_GLOBAL}/python3
  410. }
  411. # tag:python-specific
  412. when ($USE_ARCADIA_PYTHON == "no") {
  413. SYSINCL+=build/sysincl/python.yml
  414. }
  415. # tag:allocator
  416. DEFAULT_ALLOCATOR=LF
  417. # tag:allocator
  418. when ($OS_ANDROID == "yes" || $MSVC == "yes" || $ARCH_TYPE_32 == "yes" || $ARCH_AARCH64 == "yes") {
  419. DEFAULT_ALLOCATOR=J
  420. }
  421. # tag:allocator
  422. when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
  423. DEFAULT_ALLOCATOR=SYSTEM
  424. }
  425. # tag:allocator
  426. when ($OS_DARWIN == "yes") {
  427. DEFAULT_ALLOCATOR=SYSTEM
  428. }
  429. # tag:allocator
  430. when ($OS_LINUX == "yes") {
  431. when ($GCC) {
  432. # tcmalloc broken build
  433. }
  434. elsewhen ($SANDBOXING) {
  435. # broken
  436. }
  437. elsewhen ($ARCH_X86_64) {
  438. DEFAULT_ALLOCATOR=TCMALLOC_TC
  439. }
  440. }
  441. # tag:allocator
  442. when ($SANITIZER_TYPE) {
  443. when ($SANITIZER_TYPE != "no") {
  444. DEFAULT_ALLOCATOR=SYSTEM
  445. }
  446. }
  447. # tag:allocator
  448. when ($ARCH_XTENSA == "yes") {
  449. DEFAULT_ALLOCATOR=FAKE
  450. }
  451. # tag:internal
  452. ### @usage: CHECK_CONFIG_H(<conf_header>) # internal
  453. ###
  454. ### This internal macro adds checking code for configuration header in external (contrib) library.
  455. ### The check is needed to avoid conflicts on certain types and functions available in arcadia.
  456. ###
  457. ### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
  458. macro CHECK_CONFIG_H(Conf) {
  459. .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"}
  460. OUTPUT_INCLUDES=$Conf
  461. }
  462. REQUIRED_TRANSITIVE_PEERS=
  463. ### @usage REQUIRES(dirs...)
  464. ###
  465. ### Specify list of dirs which this module must depend on indirectly.
  466. ###
  467. ### This macro can be used if module depends on the directories specified but they can't be listed
  468. ### as direct PEERDIR dependencies (due to public include order or link order issues).
  469. macro REQUIRES(DIRS[]) {
  470. SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
  471. }
  472. CHECK_DEPENDENT_DIRS_TYPES=
  473. CHECK_DEPENDENT_DIRS_RESTRICTIONS=
  474. ### @usage CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
  475. ###
  476. ### Specify project transitive dependencies constraints.
  477. ###
  478. ### @params:
  479. ### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
  480. ### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
  481. ### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
  482. ### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
  483. ### 5. GLOB: next directory constraint is an ANT glob pattern.
  484. ### 6. EXCEPT: next constraint is an exception for the rest of other rules.
  485. ###
  486. ### Directory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
  487. ###
  488. ### Note: Can be used multiple times on the same module all specified constraints will be checked.
  489. ### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
  490. macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
  491. SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
  492. SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
  493. }
  494. # tag:proto
  495. PY_PROTOS_FOR=no
  496. BUILD_PROTO_AS_EVLOG=no
  497. # tag:proto
  498. PROTO_NAMESPACE=
  499. # tag:proto tag:python-specific
  500. GEN_PY_PROTOS=$YMAKE_PYTHON ${input:"build/scripts/gen_py_protos.py"}
  501. # tag:proto tag:cpp-specific
  502. PROTO_HEADER_EXTS=.pb.h
  503. CPP_PROTO_CMDLINE=
  504. CPP_PROTO_OPTS=
  505. CPP_PROTO_OUTS=
  506. CPP_PROTO_OUTS_SEM=
  507. CPP_PROTO_SUFFIXES=.pb.h .pb.cc
  508. CPP_PROTO_PLUGINS=
  509. # tag:proto tag:cpp-specific
  510. CPP_EV_OPTS=--plugin=protoc-gen-event2cpp=${tool:"tools/event2cpp"} --event2cpp_out=$ARCADIA_BUILD_ROOT -I=$ARCADIA_ROOT/library/cpp/eventlog
  511. CPP_EV_OUTS=
  512. CPP_EV_OUTS_SEM=
  513. # tag:proto tag:python-specific
  514. PY_PROTO_OPTS=
  515. PY_PROTO_OUTS=
  516. PY_PROTO_OUTS_INTERNAL=
  517. PY_PROTO_DEPS=
  518. PY_PROTO_SUFFIXES=_pb2.py
  519. PY_EVLOG_SUFFIXES=_ev_pb2.py
  520. # tag:proto tag:java-specific
  521. JAVA_PROTO_ARGS=
  522. # tag:proto tag:python-specific
  523. OPTIMIZE_PY_PROTOS_FLAG=no
  524. macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
  525. SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
  526. .SEM=resources ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${tool;hide:"tools/rescompiler/bin"}
  527. }
  528. # tag:built-in
  529. ### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # built-in
  530. ### Add data (resources, random files, strings) to the program)
  531. ### 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.
  532. ### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
  533. ###
  534. ### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
  535. ### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
  536. ###
  537. ### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
  538. ###
  539. ### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
  540. ###
  541. ### @example:
  542. ###
  543. ### LIBRARY()
  544. ### OWNER(user1)
  545. ###
  546. ### RESOURCE(
  547. ### path/to/file1 /key/in/program/1
  548. ### path/to/file2 /key2
  549. ### )
  550. ### END()
  551. ###
  552. macro RESOURCE(Args...) {
  553. PEERDIR(library/cpp/resource)
  554. }
  555. # tag:internal
  556. ### @usage: _ORDER_ADDINCL([BUILD ...] [SOURCE ...] Args...) # internal
  557. ###
  558. ### Order and filter ADDINCLs (Args - is intentionally omitted in ADDINCL macro)
  559. macro _ORDER_ADDINCL(BUILD[], SOURCE[], ARGS...) {
  560. ADDINCL($BUILD $SOURCE)
  561. }
  562. # tag:proto
  563. ### @usage: PROTO_ADDINCL([GLOBAL] [WITH_GEN] Path)
  564. ###
  565. ### This macro introduces proper ADDINCLs for .proto-files found in sources and
  566. ### .cpp/.h generated files, supplying them to appropriate commands and allowing
  567. ### proper dependency resolution at configure-time.
  568. ###
  569. ### Note: you normally shouldn't use this macro. ADDINCLs should be sent to user
  570. ### from dependency via PROTO_NAMESPACE macro
  571. macro PROTO_ADDINCL(GLOBAL?"GLOBAL":"", Path, WITH_GEN?"BUILD":"") {
  572. _ORDER_ADDINCL($WITH_GEN $GLOBAL FOR proto ${ARCADIA_BUILD_ROOT}/$Path SOURCE $GLOBAL FOR proto ${ARCADIA_ROOT}/$Path)
  573. ADDINCL($GLOBAL ${ARCADIA_BUILD_ROOT}/$Path)
  574. }
  575. # tag:proto
  576. ### @usage: PROTO_NAMESPACE([WITH_GEN] Namespace)
  577. ###
  578. ### Defines protobuf namespace (import/export path prefix) which should be used for imports and
  579. ### which defines output path for .proto generation.
  580. ###
  581. ### For proper importing and configure-time dependency management it sets ADDINCLs
  582. ### for both .cpp headers includes and .proto imports. If .proto expected to be used outside of the
  583. ### processing module use GLOBAL to send proper ADDINCLs to all (transitive) users. PEERDIR to
  584. ### PROTO_LIBRARY with PROTO_NAMESPACE() is enough at user side to correctly use the library.
  585. ### If generated .proto files are going to be used for building a module than use of WITH_GEN
  586. ### parameter will add appropriate dir from the build root for .proto files search.
  587. macro PROTO_NAMESPACE(GLOBAL?"GLOBAL":"", WITH_GEN?"WITH_GEN":"", Namespace) {
  588. SET(PROTO_NAMESPACE $Namespace)
  589. PROTO_ADDINCL(GLOBAL $WITH_GEN $Namespace)
  590. }
  591. # tag:proto
  592. ### @usage PROTOC_FATAL_WARNINGS()
  593. ###
  594. ### Treat protoc warnings as fatal errors that break the build, for example, unused imports
  595. ### Adds `--fatal_warnings` argument to protoc
  596. macro PROTOC_FATAL_WARNINGS() {
  597. SET_APPEND(_PROTOC_FLAGS --fatal_warnings)
  598. }
  599. # tag:proto tag:internal tag:python-specific
  600. ### @usage: OPTIMIZE_PY_PROTOS() # internal
  601. ###
  602. ### Enable Python proto optimization by embedding corresponding C++ code into binary.
  603. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  604. ### This is default mode for most PROTO_LIBRARY's and PY2_LIBRARY's, some system ones being exceptions.
  605. macro OPTIMIZE_PY_PROTOS() {
  606. SET(OPTIMIZE_PY_PROTOS_FLAG yes)
  607. }
  608. # tag:proto tag:python-specific
  609. ### @usage: NO_OPTIMIZE_PY_PROTOS()
  610. ###
  611. ### Disable Python proto optimization using embedding corresponding C++ code into binary.
  612. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  613. ### This is default mode only for some system libraries.
  614. macro NO_OPTIMIZE_PY_PROTOS() {
  615. SET(OPTIMIZE_PY_PROTOS_FLAG no)
  616. }
  617. # tag:proto tag:python-specific
  618. macro _PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  619. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/\$PROTO_NAMESPACE ${pre=--${Name}_opt=:OutParm}
  620. .SEM=IGNORED
  621. }
  622. # tag:proto tag:python-specific
  623. macro _ADD_PY_PROTO_OUT(Suf) {
  624. SET_APPEND(PY_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$Suf:File})
  625. 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}"})
  626. # XXX fix variable expansion in plugins
  627. SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
  628. }
  629. # tag:proto tag:python-specific
  630. ### @usage: PY_PROTO_PLUGIN(Name Ext Tool DEPS <Dependencies>)
  631. ###
  632. ### Define protoc plugin for python with given Name that emits extra output with provided Extension
  633. ### using Tool. Extra dependencies are passed via DEPS
  634. macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  635. SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  636. _ADD_PY_PROTO_OUT($EXT)
  637. # XXX fix variable expansion in plugins
  638. SET(PY_PROTO_DEPS $PY_PROTO_DEPS $DEPS)
  639. }
  640. # tag:proto tag:python-specific
  641. ### @usage: PY_PROTO_PLUGIN2(Name Ext1 Ext2 Tool DEPS <Dependencies>)
  642. ###
  643. ### Define protoc plugin for python with given Name that emits 2 extra outputs with provided Extensions
  644. ### using Tool. Extra dependencies are passed via DEPS
  645. macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
  646. PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
  647. _ADD_PY_PROTO_OUT($EXT2)
  648. }
  649. # tag:proto tag:java-specific
  650. macro _JAVA_PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  651. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/java_out
  652. }
  653. # tag:proto tag:java-specific
  654. ### @usage: JAVA_PROTO_PLUGIN(Name Tool DEPS <Dependencies>)
  655. ###
  656. ### Define protoc plugin for Java with given Name that emits extra outputs
  657. ### using Tool. Extra dependencies are passed via DEPS
  658. macro JAVA_PROTO_PLUGIN(NAME, TOOL, DEPS[]) {
  659. SET_APPEND(JAVA_PROTO_ARGS $_JAVA_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  660. # XXX fix variable expansion in plugins
  661. SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS $DEPS)
  662. }
  663. macro _ADD_SEM_PROP_IF_NON_EMPTY(Prop, Args...) {
  664. .SEM=${pre=&& set_target_property $Prop :Args}
  665. }
  666. # tag:proto tag:cpp-specific
  667. macro _ADD_CPP_PROTO_OUT(Suf) {
  668. .SEM=append_target_property PROTOC_EXTRA_OUTS $Suf ${output;hide;suf=.o:Suf} $_ADD_SEM_PROP_IF_NON_EMPTY(PROTO_NAMESPACE $PROTO_NAMESPACE)
  669. SET_APPEND(CPP_PROTO_OUTS \${output;hide;norel;nopath;noext;suf=$Suf:File})
  670. # XXX fix variable expansion in plugins
  671. SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES $Suf)
  672. }
  673. # tag:proto tag:cpp-specific
  674. HAS_CPP_PROTOBUF_PEERS=no
  675. CPP_PROTOBUF_PEERS=
  676. # tag:proto tag:cpp-specific
  677. ### @usage: CPP_PROTO_PLUGIN0(Name Tool DEPS <Dependencies>)
  678. ###
  679. ### Define protoc plugin for C++ with given Name that emits code into regular outputs
  680. ### using Tool. Extra dependencies are passed via DEPS.
  681. macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) {
  682. .SEM=target_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME}
  683. SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  684. # XXX fix variable expansion in plugins
  685. ENABLE(HAS_CPP_PROTOBUF_PEERS)
  686. SET(CPP_PROTOBUF_PEERS $CPP_PROTOBUF_PEERS $DEPS)
  687. }
  688. # tag:proto tag:cpp-specific
  689. ### @usage: CPP_PROTO_PLUGIN(Name Tool Suf DEPS <Dependencies>)
  690. ###
  691. ### Define protoc plugin for C++ with given Name that emits code into 1 extra output
  692. ### using Tool. Extra dependencies are passed via DEPS.
  693. macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[]) {
  694. CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS)
  695. _ADD_CPP_PROTO_OUT($SUF)
  696. }
  697. # tag:proto tag:cpp-specific
  698. ### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 DEPS <Dependencies>)
  699. ###
  700. ### Define protoc plugin for C++ with given Name that emits code into 2 extra outputs
  701. ### using Tool. Extra dependencies are passed via DEPS.
  702. macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[]) {
  703. CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS)
  704. _ADD_CPP_PROTO_OUT($SUF2)
  705. SET_APPEND(CPP_PROTO_OUTS_SEM \${output;hide;norel;nopath;noext;suf=$SUF2:File})
  706. }
  707. # tag:proto
  708. ### @usage: USE_SKIFF() #wip, do not use
  709. ###
  710. ### Use mapreduce/yt/skiff_proto/plugin for C++
  711. macro USE_SKIFF() {
  712. # Move extra includes to INDUCED_DEPS macro in mapreduce/yt/skiff_proto/plugin/ya.make
  713. CPP_PROTO_PLUGIN0(skiff mapreduce/yt/skiff_proto/plugin DEPS mapreduce/yt/skiff_proto/lib)
  714. }
  715. # tag:go-specific
  716. _GO_COMMON_GOOGLE_APIS = \
  717. vendor/google.golang.org/genproto/googleapis/api/annotations \
  718. vendor/google.golang.org/genproto/googleapis/api/configchange \
  719. vendor/google.golang.org/genproto/googleapis/api/distribution \
  720. vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1 \
  721. vendor/google.golang.org/genproto/googleapis/api/expr/v1beta1 \
  722. vendor/google.golang.org/genproto/googleapis/api/httpbody \
  723. vendor/google.golang.org/genproto/googleapis/api/label \
  724. vendor/google.golang.org/genproto/googleapis/api/metric \
  725. vendor/google.golang.org/genproto/googleapis/api/monitoredres \
  726. vendor/google.golang.org/genproto/googleapis/api/serviceconfig \
  727. vendor/google.golang.org/genproto/googleapis/api/servicecontrol/v1 \
  728. vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1 \
  729. vendor/google.golang.org/genproto/googleapis/iam/admin/v1 \
  730. vendor/google.golang.org/genproto/googleapis/iam/credentials/v1 \
  731. vendor/google.golang.org/genproto/googleapis/iam/v1 \
  732. vendor/google.golang.org/genproto/googleapis/iam/v1/logging \
  733. vendor/google.golang.org/genproto/googleapis/logging/type \
  734. vendor/google.golang.org/genproto/googleapis/logging/v2 \
  735. vendor/google.golang.org/genproto/googleapis/rpc/code \
  736. vendor/google.golang.org/genproto/googleapis/rpc/errdetails \
  737. vendor/google.golang.org/genproto/googleapis/rpc/status \
  738. vendor/google.golang.org/genproto/googleapis/type/calendarperiod \
  739. vendor/google.golang.org/genproto/googleapis/type/color \
  740. vendor/google.golang.org/genproto/googleapis/type/date \
  741. vendor/google.golang.org/genproto/googleapis/type/dayofweek \
  742. vendor/google.golang.org/genproto/googleapis/type/expr \
  743. vendor/google.golang.org/genproto/googleapis/type/fraction \
  744. vendor/google.golang.org/genproto/googleapis/type/latlng \
  745. vendor/google.golang.org/genproto/googleapis/type/money \
  746. vendor/google.golang.org/genproto/googleapis/type/postaladdress \
  747. vendor/google.golang.org/genproto/googleapis/type/quaternion \
  748. vendor/google.golang.org/genproto/googleapis/type/timeofday
  749. # tag:go-specific
  750. _COMMON_GOOGLE_APIS=None
  751. # tag:go-specific
  752. ### @usage: USE_COMMON_GOOGLE_APIS([apis...])
  753. ###
  754. ### Use common-google-apis library set. Pass optional apis list to be used or use them all.
  755. ### This macro is properly handled for all languages including Go, where apis come in
  756. ## pregenerated form. In other languages apis are generated from sources in Arcadia.
  757. macro USE_COMMON_GOOGLE_APIS(APIS...) {
  758. SET(_COMMON_GOOGLE_APIS ${pre=vendor/google.golang.org/genproto/googleapis/:APIS})
  759. }
  760. # tag:go-specific tag:proto
  761. GO_PROTO_GEN_PLUGINS=
  762. GO_PROTO_OPTS=
  763. GO_PROTO_OUTS=
  764. GO_PROTO_GRPC_OPTS=
  765. GO_PROTO_GRPC_OUTS=
  766. GO_PROTO_V2=no
  767. _GO_PROTO_CHECK_OUTPUT=
  768. # tag:go-specific tag:proto
  769. GO_PROTOBUF_IMPORTS=\
  770. ${GOSTD}/sync \
  771. ${GOSTD}/reflect \
  772. ${GOSTD}/fmt \
  773. ${GOSTD}/math \
  774. vendor/github.com/golang/protobuf/proto \
  775. vendor/google.golang.org/protobuf/types/descriptorpb \
  776. vendor/google.golang.org/protobuf/runtime/protoimpl \
  777. vendor/google.golang.org/protobuf/runtime/protoiface \
  778. vendor/google.golang.org/protobuf/reflect/protoreflect
  779. # tag:go-specific tag:proto
  780. GO_PROTOBUF_WELLKNOWN_TYPES=\
  781. vendor/google.golang.org/protobuf/types/known/anypb \
  782. vendor/google.golang.org/protobuf/types/known/apipb \
  783. vendor/google.golang.org/protobuf/types/known/durationpb \
  784. vendor/google.golang.org/protobuf/types/known/emptypb \
  785. vendor/google.golang.org/protobuf/types/known/fieldmaskpb \
  786. vendor/google.golang.org/protobuf/types/known/sourcecontextpb \
  787. vendor/google.golang.org/protobuf/types/known/structpb \
  788. vendor/google.golang.org/protobuf/types/known/timestamppb \
  789. vendor/google.golang.org/protobuf/types/known/typepb \
  790. vendor/google.golang.org/protobuf/types/known/wrapperspb
  791. # tag:go-specific tag:proto
  792. ### @usage: GO_PROTO_PLUGIN(Name Ext Tool [DEPS dependencies...])
  793. ###
  794. ### Define protoc plugin for GO with given Name that emits extra output with provided extension
  795. ### Ext using Tool. Extra dependencies are passed via DEPS.
  796. macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  797. SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  798. SET_APPEND(GO_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$EXT:File})
  799. PEERDIR(${DEPS})
  800. }
  801. # tag:go-specific tag:proto
  802. GO_PROTO_CMDLINE=${cwd;rootdir;input:File} $YMAKE_PYTHON3 ${input:"build/scripts/go_proto_wrapper.py"} --arcadia-prefix $GO_ARCADIA_PROJECT_PREFIX --contrib-prefix $GO_CONTRIB_PROJECT_PREFIX --namespace ./$PROTO_NAMESPACE $_GO_PROTO_CHECK_OUTPUT --proto ${input;rootrel:File} -- $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH $_PROTOC_FLAGS
  803. # tag:go-specific tag:proto
  804. macro _GO_PROTO_CMD_IMPL(File, OPTS...) {
  805. .CMD=$GO_PROTO_CMDLINE $OPTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  806. .PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES}
  807. .ADDINCL=FOR proto contrib/libs/protobuf/src
  808. }
  809. # tag:go-specific tag:proto
  810. macro _GO_PROTO_CMD(File) {
  811. .CMD=$_GO_PROTO_CMD_IMPL($File $GO_PROTO_OPTS $GO_PROTO_OUTS)
  812. }
  813. # tag:proto
  814. ### @usage: YP_PROTO_YSON(Files... OUT_OPTS Opts...)
  815. ###
  816. ### Generate .yson.go from .proto using yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen
  817. macro YP_PROTO_YSON(OUT_OPTS[], Files...) {
  818. .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}" $_PROTOC_FLAGS ${input:Files} ${output;hide;noauto;nopath;noext;suf=.yson.go:Files}
  819. .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
  820. .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
  821. }
  822. _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"} \
  823. && set_global_flags COMMON_PROTOC_FLAGS \
  824. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
  825. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH
  826. # tag:proto
  827. macro _CPP_PROTO_CMD(File) {
  828. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  829. .SEM=$_SEM_CPP_PROTO_CMD
  830. .PEERDIR=contrib/libs/protobuf
  831. }
  832. # tag:proto
  833. macro _CPP_VANILLA_PROTO_CMD(File) {
  834. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  835. .PEERDIR=contrib/libs/protobuf_std
  836. }
  837. _SEM_CPP_EV_CMD=target_ev_messages PRIVATE ${input:File} $CPP_EV_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"tools/event2cpp/bin"} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
  838. && set_global_flags COMMON_PROTOC_FLAGS \
  839. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT --event2cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE \
  840. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH $ARCADIA_ROOT/library/cpp/eventlog
  841. # tag:proto
  842. macro _CPP_EVLOG_CMD(File) {
  843. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_EV_OUTS ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  844. .SEM=$_SEM_CPP_EV_CMD
  845. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  846. }
  847. # tag:proto
  848. macro _CPP_PROTO_EVLOG_CMD(File) {
  849. # process .proto as .ev
  850. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  851. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  852. }
  853. # tag:proto
  854. macro _CPP_CFGPROTO_CMD(File) {
  855. # keep extension in output just as in EV: this is hard-coded behaviour of protoc for non-.proto extensions
  856. .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"}
  857. .PEERDIR=library/cpp/proto_config/codegen library/cpp/proto_config/protos contrib/libs/protobuf
  858. }
  859. # tag:proto
  860. PY_PROTO_MYPY_ENABLED=yes
  861. 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
  862. # tag:proto tag:python-specific
  863. PY_PROTO_MYPY_SUFFIX=
  864. PY_PROTO_MYPY_PLUGIN=
  865. PY_PROTO_MYPY_PLUGIN_INTERNAL=
  866. # tag:proto tag:python-specific
  867. macro NO_MYPY() {
  868. DISABLE(PY_PROTO_MYPY_ENABLED)
  869. }
  870. # tag:proto tag:python-specific
  871. macro _PY_PROTO_CMD_BASE(File, Suf, Args...) {
  872. .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 $_PROTOC_FLAGS ${input;rootrel:File} ${output;hide;noauto;norel;nopath;noext;suf=$Suf:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $Args
  873. }
  874. # tag:proto tag:python-specific
  875. macro _PY_PROTO_CMD(File) {
  876. .CMD=${cwd;rootdir;input:File} $_PY_PROTO_CMD_BASE($File _pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS $PY_PROTO_MYPY_PLUGIN)
  877. }
  878. # tag:proto tag:python-specific
  879. macro _PY_PROTO_CMD_INTERNAL(File) {
  880. .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)
  881. }
  882. # tag:proto tag:java-specific
  883. JAVA_PROTO_RUNTIME=
  884. # tag:proto tag:java-specific
  885. ### @usage: USE_JAVALITE()
  886. ### Use protobuf-javalite for Java
  887. macro USE_JAVALITE() {
  888. SET(JAVA_PROTO_RUNTIME javalite)
  889. }
  890. # tag:proto tag:java-specific
  891. JAVA_PROTO_RUNTIME_VERSION = 3.21.12
  892. JAVA_PROTO_COMMON_VERSION = 1.12.0
  893. KOTLIN_PROTO=no
  894. KOTLIN_PROTO_PEERS=
  895. when ($JAVA_PROTO_RUNTIME == "javalite") {
  896. _JAVA_PROTO_LITE_ARG=lite:
  897. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
  898. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.43.2
  899. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.43.2
  900. }
  901. otherwise {
  902. _JAVA_PROTO_LITE_ARG=
  903. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
  904. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.43.2
  905. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.43.2
  906. }
  907. KOTLIN_PROTO_FLAGS=
  908. # tag:proto tag:java-specific
  909. macro _JAVA_PROTO_CMD(File) {
  910. .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_out=${_JAVA_PROTO_LITE_ARG}$ARCADIA_BUILD_ROOT/java_out ${KOTLIN_PROTO_FLAGS} $_PROTOC_FLAGS ${input;rootrel:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $JAVA_PROTO_ARGS
  911. .SEM=proto_files ${input;rootrel:File} ${hide;output:File.jsrc}
  912. }
  913. # tag:proto tag:perl-specific tag:deprecated
  914. ### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
  915. ###
  916. ### Generate Perl code from protobuf.
  917. ### In order to use this macro one should predict all outputs protoc will emit from input_proto file and enlist those as outputs.
  918. macro XS_PROTO(File, Dir, Outputs...) {
  919. .CMD=$PROTOC -I=${ARCADIA_ROOT}/${Dir} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} -I=${PROTOBUF_PATH} --perlxs_out=${BINDIR} $_PROTOC_FLAGS ${input:File} ${hide;output:Outputs} ${induced_deps=h+cpp;hide;nopath;noext;suf=.pb.h:File}
  920. PEERDIR(${Dir})
  921. ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir})
  922. }
  923. # tag:proto tag:fbs
  924. ### @usage: PROTO2FBS(InputProto)
  925. ###
  926. ### Produce flatbuf schema out of protobuf description.
  927. macro PROTO2FBS(File) {
  928. .CMD=${cwd:BINDIR} ${tool:"contrib/tools/flatc"} -I . -I ${ARCADIA_ROOT} --proto ${input:File} ${output;hide;norel;noext:File.fbs} ${kv;hide:"p FBS"} ${kv;hide:"pc yellow"} && $MOVE_FILE ${BINDIR}/${nopath;noext:File.fbs} ${output;norel;noext:File.fbs}
  929. }
  930. # tag:proto tag:python-specific
  931. when ($PY_PROTOS_FOR == "yes") {
  932. PEERDIR+=contrib/libs/protobuf/python
  933. }
  934. # tag:python-specific
  935. macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
  936. .CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
  937. .PEERDIR=library/cpp/eventlog/proto
  938. }
  939. # tag:python-specific tag:proto
  940. macro _PY_EVLOG_CMD(File) {
  941. .CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
  942. }
  943. # tag:python-specific tag:proto
  944. macro _PY_EVLOG_CMD_INTERNAL(File) {
  945. .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}"})
  946. }
  947. # tag:java-specific tag:proto
  948. macro _JAVA_EVLOG_CMD(File) {
  949. .CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  950. .PEERDIR=library/cpp/eventlog/proto
  951. }
  952. # tag:sanitize
  953. RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
  954. # tag:sanitize
  955. when ($IS_CROSS_SANITIZE) {
  956. RUN_NO_SANITIZE=
  957. }
  958. YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
  959. XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
  960. WRITER_PY=$YMAKE_PYTHON ${input:"build/scripts/writer.py"} ${input;hide:"build/scripts/process_command_files.py"}
  961. FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} ${input;hide:"build/scripts/process_command_files.py"}
  962. FIX_MSVC_OUTPUT=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ${input;hide:"build/scripts/process_command_files.py"}
  963. _PROCESS_WHOLE_ARCHIVE_SCRIPT=${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/process_whole_archive_option.py"}
  964. COPY_CMD=$FS_TOOLS copy
  965. LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
  966. REMOVE_FILE=$FS_TOOLS remove
  967. MOVE_FILE=$FS_TOOLS rename
  968. # tag:allocator tag:windows-specific
  969. MSVC_DYNAMICBASE=/DYNAMICBASE
  970. when ($ALLOCATOR == "LF") {
  971. MSVC_DYNAMICBASE=/DYNAMICBASE:NO
  972. }
  973. # tag:sanitize
  974. SANITIZER_CFLAGS=
  975. # tag:proto tag:grpc
  976. _GRPC_ENABLED=no
  977. # tag:proto tag:grpc
  978. ### @usage: GRPC()
  979. ###
  980. ### Emit GRPC code for all .proto files in a PROTO_LIBRARY.
  981. ### This works for all available PROTO_LIBRARY versions (C++, Python 2.x, Python 3.x, Java and Go).
  982. macro GRPC() {
  983. ENABLE(_GRPC_ENABLED)
  984. # C++
  985. CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp .grpc.pb.cc .grpc.pb.h DEPS contrib/libs/grpc)
  986. # Python
  987. PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/python/grpcio)
  988. # Java
  989. JAVA_PROTO_PLUGIN(grpc_java contrib/tools/protoc/plugins/grpc_java DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  990. SET_APPEND(JAVA_PROTOBUF_PEERS contrib/java/javax/annotation/javax.annotation-api/1.3.1)
  991. }
  992. macro GO_PROTO_USE_V2() {
  993. ENABLE(GO_PROTO_V2)
  994. }
  995. # tag:fbs
  996. FLATC_FLAGS_VALUE=
  997. ### @usage: FLATC_FLAGS(flags...)
  998. ###
  999. ### Add flags to flatc command line
  1000. macro FLATC_FLAGS(FLAGS...) {
  1001. SET_APPEND(FLATC_FLAGS_VALUE $FLAGS)
  1002. }
  1003. # tag:fbs
  1004. _PY_FBS_DEPS=contrib/python/flatbuffers
  1005. # tag:fbs tag:internal
  1006. ### @usage: FBS_TO_PYSRC(output_base_name fbs_files...) # internal
  1007. ###
  1008. ### Create a tar archive of .py files generated by flatc for Python. Output tar
  1009. ### archive will have .fbs.pysrc extension. This .fbs.pysrc extension is specially
  1010. ### processed when --add-flatbuf-result flag is specified on the command line
  1011. ### for 'ya make ...' (tar archive is extracted to output directory).
  1012. macro FBS_TO_PYSRC(OUT_NAME, IN_FBS_FILES...) {
  1013. .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_PYTHON3 ${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"}
  1014. }
  1015. # tag:fbs tag:go-specific
  1016. # Implicit dependencies of generated code for Go
  1017. _GO_FLATC_IMPORTS=\
  1018. ${GOSTD}/strconv \
  1019. vendor/github.com/google/flatbuffers/go
  1020. # tag:fbs tag:cpp-specific
  1021. macro _CPP_FLATC_CMD(SRC, SRCFLAGS...) {
  1022. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${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"}
  1023. .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} ${input;hide:"build/scripts/cpp_flatc_wrapper.py"}
  1024. .PEERDIR=contrib/libs/flatbuffers
  1025. }
  1026. # tag:fbs tag:cpp-specific
  1027. macro _CPP_FLATC64_CMD(SRC, SRCFLAGS...) {
  1028. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${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"}
  1029. .PEERDIR=contrib/libs/flatbuffers64
  1030. }
  1031. # tag:fbs tag:go-specific tag:internal
  1032. ### @usage: _GO_FLATC_CMD(fbs_file flags...) # internal
  1033. ###
  1034. ### Create a tar archive of .go files generated by flatc for Go. Output tar archive
  1035. ### will have .fbs.gosrc extension. This .fbs.gosrc is specially processed when
  1036. ### --add-protobuf-result flag is specified on the command line for 'ya make ...'
  1037. ### (tar archive is extracted to output directory).
  1038. macro _GO_FLATC_CMD(SRC, PACKAGE_NAME) {
  1039. .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_PYTHON3 ${input:"build/scripts/postprocess_go_fbs.py"} --input-dir ${BINDIR} --map $_FBS_NAMESPACE_MAP_GLOBAL && $YMAKE_PYTHON3 ${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"}
  1040. .PEERDIR=${_GO_FLATC_IMPORTS}
  1041. }
  1042. # tag:fbs tag:java-specific tag:internal
  1043. ### @usage: _JAVA_FLATC_CMD(fbs_file) # internal
  1044. ###
  1045. ### Create a tar archive of .java files generated by flatc for Java. Output tar
  1046. ### acrchive will have .fbs.jsrc extension. Files with .fbs.jsrc extension will
  1047. ### be added to results when --add-flatbuf-result flag is specified on the command
  1048. ### line for 'ya make ...'
  1049. macro _JAVA_FLATC_CMD(SRC) {
  1050. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --java --gen-mutable ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR} ${input:SRC} && $YMAKE_PYTHON3 ${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"}
  1051. .PEERDIR=contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION}
  1052. }
  1053. # variables must be defined for all module types to make generate_mf.py work
  1054. MODULE_PREFIX=
  1055. MODULE_SUFFIX=
  1056. NEED_PLATFORM_PEERDIRS=yes
  1057. PEERDIR_TEST_TOOL=yes
  1058. # tag:python-specific
  1059. PYTHON2=no
  1060. PYTHON3=no
  1061. # tag:python-specific
  1062. when (!$ARCADIA_PYTHON_UNICODE_SIZE) {
  1063. when ($OS_WINDOWS) {
  1064. ARCADIA_PYTHON_UNICODE_SIZE=2
  1065. }
  1066. otherwise {
  1067. ARCADIA_PYTHON_UNICODE_SIZE=4
  1068. }
  1069. }
  1070. YMAKE_PYTHON3_PEERDIR=build/platform/python/ymake_python3
  1071. macro NO_YMAKE_PYTHON3() {
  1072. SET(YMAKE_PYTHON3_PEERDIR)
  1073. }
  1074. ### @usage: _BARE_UNIT # internal
  1075. ###
  1076. ### The base of all modules describing default bare minimum for all modules.
  1077. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1078. module _BARE_UNIT {
  1079. .EXTS=.*
  1080. .CMD=TOUCH_UNIT
  1081. .IGNORED=GO_PROTO_PLUGIN
  1082. .NODE_TYPE=Bundle
  1083. .PEERDIR_POLICY=as_include
  1084. .RESTRICTED=GRPC USE_SKIFF INDUCED_DEPS FUZZ_DICTS FUZZ_OPTS PACK EXPLICIT_OUTPUTS 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 LIST_PROTO
  1085. .FINAL_TARGET=no
  1086. PEERDIR_TAGS=__EMPTY__
  1087. PEERDIR+=$YMAKE_PYTHON3_PEERDIR
  1088. when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
  1089. PEERDIR+=build/conf_fatal_error
  1090. }
  1091. DEFAULT(MODULE_VERSION)
  1092. DEFAULT(MODULE_PREFIX)
  1093. DEFAULT(MODULE_SUFFIX)
  1094. }
  1095. ### @usage: GEN_LIBRARY()
  1096. ###
  1097. ### Definition of a module that brings generated artefacts. This module can PEERDIRed
  1098. ### from any module. The resulted module is empty and cleaned up during construction
  1099. ### of the build graph.
  1100. ###
  1101. ### NOTE! SRCS macro is not supported for this library.
  1102. module GEN_LIBRARY: _BARE_UNIT {
  1103. .PROXY=yes
  1104. .RESTRICTED=SRCS SRC
  1105. .SEM=IGNORED
  1106. # ENABLE(_FAKE_MODULE)
  1107. SET(MODULE_SUFFIX .pkg.fake)
  1108. }
  1109. ### @usage: _BASE_UNIT # internal
  1110. ###
  1111. ### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
  1112. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1113. module _BASE_UNIT: _BARE_UNIT {
  1114. .GLOBAL=_FBS_NAMESPACE_MAP
  1115. PEERDIR_TAGS=CPP_PROTO CPP_FBS H_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB
  1116. 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_FLAGS $PROTOC_STYLEGUIDE_OUT $PROTOC_PLUGIN_STYLEGUIDE ${input;rootrel:File}
  1117. CPP_PROTO_OUTS+=${output;hide;norel;nopath;noext:File.pb.cc} ${output;main;hide;norel;nopath;noext:File.pb.h}
  1118. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
  1119. CPP_EV_OUTS+=${output;hide;norel:File.pb.cc} ${output;hide;norel:File.pb.h}
  1120. CPP_EV_OUTS_SEM+=${output;hide;norel:File.pb.h}
  1121. when ($SWIG_LANG == "perl") {
  1122. _SWIG_CMD=$_SWIG_PERL_CMD
  1123. _SWIG_ADDINCLS=$_SWIG_PERL_ADDINCLS
  1124. _SWIG_PEERDIR=$_SWIG_PERL_PEERDIR
  1125. }
  1126. elsewhen ($SWIG_LANG == "python") {
  1127. _SWIG_CMD=$_SWIG_PYTHON_CMD
  1128. _SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
  1129. _SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
  1130. }
  1131. elsewhen ($SWIG_LANG == "jni_cpp") {
  1132. _SWIG_CMD=$_SWIG_JNI_CPP_CMD
  1133. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1134. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1135. }
  1136. elsewhen ($SWIG_LANG == "java") {
  1137. _SWIG_CMD=$_SWIG_JNI_CMD
  1138. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1139. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1140. }
  1141. when ($PY_PROTOS_FOR == "yes") {
  1142. MACRO_ALIAS(EVLOG_CMD _PY_EVLOG_CMD)
  1143. MACRO_ALIAS(PROTO_CMD _PY_PROTO_CMD)
  1144. }
  1145. otherwise {
  1146. MACRO_ALIAS(EVLOG_CMD _CPP_EVLOG_CMD)
  1147. MACRO_ALIAS(FBS_CMD _CPP_FLATC_CMD)
  1148. when ($BUILD_PROTO_AS_EVLOG == "yes") {
  1149. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_EVLOG_CMD)
  1150. }
  1151. otherwise {
  1152. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_CMD)
  1153. }
  1154. when ($USE_VANILLA_PROTOC == "yes") {
  1155. PROTOC=${tool:"contrib/tools/protoc_std"}
  1156. PROTOC_STYLEGUIDE_OUT=
  1157. PROTOC_PLUGIN_STYLEGUIDE=
  1158. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std
  1159. MACRO_ALIAS(PROTO_CMD _CPP_VANILLA_PROTO_CMD)
  1160. }
  1161. when ($PROTOC_TRANSITIVE_HEADERS == "no") {
  1162. CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
  1163. }
  1164. }
  1165. SANITIZER_DEFINED=no
  1166. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1167. CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
  1168. LDFLAGS+=-fsanitize=$SANITIZER_TYPE
  1169. SANITIZER_DEFINED=yes
  1170. when ($CLANG) {
  1171. CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  1172. LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  1173. }
  1174. }
  1175. when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
  1176. CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1177. LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1178. }
  1179. POPULATE_CPP_COVERAGE_FLAGS()
  1180. when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
  1181. CFLAGS+=-DNLG_COVERAGE
  1182. }
  1183. when ($GCC) {
  1184. select ($SANITIZER_TYPE) {
  1185. "address" ? {
  1186. LDFLAGS+=-static-libasan
  1187. }
  1188. "undefined" ? {
  1189. LDFLAGS+=-static-libubsan
  1190. }
  1191. "thread" ? {
  1192. PIE=yes
  1193. LDFLAGS+=-static-libtsan
  1194. }
  1195. }
  1196. }
  1197. when ($HARDENING == "yes") {
  1198. when ($CLANG) {
  1199. CFLAGS+=-fstack-protector-all -D_hardening_enabled_
  1200. LDFLAGS+=-z relro -z now -z noexecstack
  1201. PIE=yes
  1202. }
  1203. }
  1204. when ($USE_LTO == "yes") {
  1205. when ($GCC) {
  1206. CFLAGS+=-flto -fno-fat-lto-objects
  1207. LDFLAGS+=-flto
  1208. NO_LTO_CFLAGS=-fno-lto
  1209. }
  1210. when ($CLANG) {
  1211. CFLAGS+=-flto
  1212. LDFLAGS+=-flto
  1213. NO_LTO_CFLAGS=-fno-lto
  1214. }
  1215. }
  1216. when ($USE_THINLTO == "yes") {
  1217. when ($GCC) {
  1218. CFLAGS+=-flto=thin
  1219. LDFLAGS+=-flto=thin
  1220. NO_LTO_CFLAGS=-fno-lto
  1221. }
  1222. when ($CLANG) {
  1223. CFLAGS+=-flto=thin
  1224. LDFLAGS+=-flto=thin
  1225. NO_LTO_CFLAGS=-fno-lto
  1226. }
  1227. }
  1228. when ($CLANG) {
  1229. when ($PGO_ADD == "yes") {
  1230. CFLAGS+=-fprofile-instr-generate
  1231. LDFLAGS+=-fprofile-instr-generate
  1232. }
  1233. when ($PGO_PATH) {
  1234. CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
  1235. LDFLAGS+=-fprofile-instr-use=$PGO_PATH
  1236. }
  1237. }
  1238. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  1239. PEERDIR+=$COMPILER_PLATFORM
  1240. }
  1241. when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
  1242. PEERDIR+=contrib/libs/linux-headers
  1243. }
  1244. # Adding PEERDIR from trigger doesn't always work. In this case it
  1245. # cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl
  1246. # Workaround this issue by setting variable with PEERDIR in trigger
  1247. # and then adding PEERDIR to it's value unconditionally.
  1248. when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1249. _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14
  1250. }
  1251. otherwise {
  1252. _UBUNTU_COMPAT_PEERDIR=
  1253. }
  1254. PEERDIR+=$_UBUNTU_COMPAT_PEERDIR
  1255. when ($NORUNTIME != "yes") {
  1256. PEERDIR+=contrib/libs/cxxsupp
  1257. when ($MAPSMOBI_BUILD_TARGET == "yes") {
  1258. PEERDIR+=build/platform/mapkit
  1259. }
  1260. }
  1261. when ($NOUTIL != "yes") {
  1262. PEERDIR+=util
  1263. }
  1264. when ($MUSL == "yes") {
  1265. CFLAGS += -D_musl_
  1266. LINK_DYN_LIB_FLAGS += --musl
  1267. LINK_SCRIPT_EXE_FLAGS += --musl
  1268. PEERDIR+=contrib/libs/musl/include
  1269. }
  1270. # g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
  1271. # The same problem exists for clang toolchain. On the other hand, the problem
  1272. # doesn't affect cl since it has united C/C++ library and doesn't need
  1273. # proxy C-headers.
  1274. # Disable all C++ headers including proxy C-headers when we use libc++.
  1275. when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
  1276. CXXFLAGS += -nostdinc++
  1277. }
  1278. otherwise {
  1279. CFLAGS += -DUSE_STL_SYSTEM
  1280. }
  1281. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  1282. PEERDIR += build/external_resources/codenavigation
  1283. }
  1284. when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
  1285. CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
  1286. }
  1287. DEFAULT(USE_SSE4 yes)
  1288. when ($NOSSE != "yes") {
  1289. CFLAGS+=$SSE_CFLAGS
  1290. C_DEFINES+=$SSE_DEFINES
  1291. when ($USE_SSE4 == "yes") {
  1292. CFLAGS+=$SSE4_CFLAGS
  1293. C_DEFINES+=$SSE4_DEFINES
  1294. }
  1295. }
  1296. elsewhen ($MSVC != "yes") {
  1297. CFLAGS += -mno-sse
  1298. }
  1299. POPULATE_CPP_COVERAGE_FLAGS()
  1300. _REGISTER_NO_CHECK_IMPORTS()
  1301. DEFAULT(PACKAGE_PREFIX_ARGS)
  1302. DEFAULT(SWIG_LANG python)
  1303. DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
  1304. when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
  1305. PEERDIR+=build/platform/binutils
  1306. }
  1307. }
  1308. _LINKER_ID=
  1309. # GCC does not support -fuse-ld with an executable path,
  1310. # only -fuse-ld=gold or -fuse-ld=lld.
  1311. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1312. when ($_LINKER_ID in [ "gold", "lld" ]) {
  1313. PEERDIR+=build/platform/${_LINKER_ID}
  1314. }
  1315. }
  1316. macro _USE_LINKER_IMPL(LINKER_ID...) {
  1317. SET(_LINKER_ID $LINKER_ID)
  1318. }
  1319. macro _USE_LINKER() {
  1320. _USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
  1321. }
  1322. ### @usage: USE_LINKER_GOLD()
  1323. ### Use gold linker for a program. This doesn't work in libraries
  1324. macro USE_LINKER_GOLD() {
  1325. _USE_LINKER_IMPL(gold)
  1326. }
  1327. COMMON_LINK_SETTINGS=
  1328. LINK_ADDITIONAL_SECTIONS=
  1329. LINK_ADDITIONAL_SECTIONS_COMMAND=
  1330. when ($COMMON_LINK_SETTINGS == "yes") {
  1331. when ($_LINKER_ID == "lld" && ($OS_LINUX == "yes" || $OS_ANDROID == "yes")) {
  1332. LDFLAGS += -Wl,--gdb-index
  1333. }
  1334. when ($EMBED_LINKER_CREF == "yes") {
  1335. LDFLAGS+=-Wl,--cref ${tmp;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1336. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
  1337. }
  1338. elsewhen ($DUMP_LINKER_CREF == "yes") {
  1339. LDFLAGS+=-Wl,--cref ${output;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1340. }
  1341. when ($EMBED_LINKER_MAP == "yes") {
  1342. LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1343. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1344. }
  1345. elsewhen ($DUMP_LINKER_MAP == "yes") {
  1346. LDFLAGS+=-Wl,-Map=${output;rootrel;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1347. }
  1348. when ($USE_MKL == "yes") {
  1349. NOPLATFORM=yes
  1350. }
  1351. when (($USE_EAT_MY_DATA == "yes") && ($WIN32 != "yes") && ($DARWIN != "yes") && ($OS_ANDROID != "yes") && ($OS_IOS != "yes")) {
  1352. PEERDIR+=contrib/libs/libeatmydata/autocheck_wrapper
  1353. }
  1354. when ($USE_ARCADIA_LIBM == "yes") {
  1355. PEERDIR+=contrib/libs/libm
  1356. }
  1357. when ($USE_ARCADIA_LIBM == "no") {
  1358. C_SYSTEM_LIBRARIES+=-lm
  1359. }
  1360. when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
  1361. 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", "PROFILED_HU" ]) {
  1362. PEERDIR+=library/cpp/malloc/system
  1363. }
  1364. }
  1365. otherwise {
  1366. select ($ALLOCATOR) {
  1367. "MIM" ? {
  1368. PEERDIR+=library/cpp/malloc/mimalloc
  1369. }
  1370. "HU" ? {
  1371. PEERDIR+=library/cpp/malloc/hu
  1372. }
  1373. "PROFILED_HU" ? {
  1374. PEERDIR+=library/cpp/malloc/profiled_hu
  1375. }
  1376. "TCMALLOC_256K" ? {
  1377. PEERDIR+=library/cpp/malloc/tcmalloc
  1378. PEERDIR+=contrib/libs/tcmalloc
  1379. }
  1380. "TCMALLOC_SMALL_BUT_SLOW" ? {
  1381. PEERDIR+=library/cpp/malloc/tcmalloc
  1382. PEERDIR+=contrib/libs/tcmalloc/small_but_slow
  1383. }
  1384. "TCMALLOC_NUMA_256K" ? {
  1385. PEERDIR+=library/cpp/malloc/tcmalloc
  1386. PEERDIR+=contrib/libs/tcmalloc/numa_256k
  1387. }
  1388. "TCMALLOC_NUMA_LARGE_PAGES" ? {
  1389. PEERDIR+=library/cpp/malloc/tcmalloc
  1390. PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
  1391. }
  1392. "TCMALLOC" ? {
  1393. PEERDIR+=library/cpp/malloc/tcmalloc
  1394. PEERDIR+=contrib/libs/tcmalloc/default
  1395. }
  1396. "TCMALLOC_TC" ? {
  1397. PEERDIR+=library/cpp/malloc/tcmalloc
  1398. PEERDIR+=contrib/libs/tcmalloc/no_percpu_cache
  1399. }
  1400. "GOOGLE" ? {
  1401. PEERDIR+=library/cpp/malloc/galloc
  1402. }
  1403. "J" ? {
  1404. when ($WIN32 == "yes") {
  1405. PEERDIR+=library/cpp/malloc/system
  1406. }
  1407. otherwise {
  1408. PEERDIR+=library/cpp/malloc/jemalloc
  1409. }
  1410. }
  1411. "LF" ? {
  1412. PEERDIR+=library/cpp/lfalloc
  1413. }
  1414. "LF_YT" ? {
  1415. PEERDIR+=library/cpp/lfalloc/yt
  1416. }
  1417. "LF_DBG" ? {
  1418. PEERDIR+=library/cpp/lfalloc/dbg
  1419. }
  1420. "B" ? {
  1421. PEERDIR+=library/cpp/balloc
  1422. }
  1423. "BM" ? {
  1424. PEERDIR+=library/cpp/balloc_market
  1425. }
  1426. "C" ? {
  1427. PEERDIR+=library/cpp/malloc/calloc
  1428. }
  1429. "LOCKLESS" ? {
  1430. PEERDIR+=library/cpp/malloc/lockless
  1431. }
  1432. "YT" ? {
  1433. PEERDIR+=library/cpp/ytalloc/impl
  1434. }
  1435. }
  1436. }
  1437. when ($ALLOCATOR == "SYSTEM") {
  1438. PEERDIR+=library/cpp/malloc/system
  1439. }
  1440. when ($WERROR != "no") {
  1441. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  1442. C_WARNING_OPTS += $WERROR_FLAG
  1443. }
  1444. }
  1445. when ($ICC == "yes") {
  1446. PEERDIR+=contrib/libs/intel/core
  1447. }
  1448. when ($WITH_VALGRIND == "yes") {
  1449. PEERDIR+=contrib/libs/valgrind
  1450. # https://st.yandex-team.ru/DTCC-122
  1451. CFLAGS+=-fdebug-default-version=4
  1452. }
  1453. }
  1454. when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
  1455. LINK_ADDITIONAL_SECTIONS_COMMAND+= \
  1456. $OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
  1457. }
  1458. _SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/:PEERS}
  1459. when ($OS_WINDOWS == "yes") {
  1460. _SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/:PEERS}
  1461. }
  1462. elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1463. _SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/:PEERS}
  1464. }
  1465. LINK_OR_COPY_SO_CMD=
  1466. RPATH_GLOBAL=
  1467. when ($SO_OUTPUTS == "yes") {
  1468. LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
  1469. LDFLAGS+=$RPATH_GLOBAL
  1470. }
  1471. # tag:restricted tag:DLL
  1472. ### $usage: WITH_DYNAMIC_LIBS() # restricted
  1473. ###
  1474. ### Include dynamic libraries as extra PROGRAM/DLL outputs
  1475. macro WITH_DYNAMIC_LIBS() {
  1476. ENABLE(SO_OUTPUTS)
  1477. }
  1478. # tag:internal
  1479. ### $usage: REAL_LINK_EXE_IMPL(peers...) # internal
  1480. macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1481. .CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1482. }
  1483. # tag:internal
  1484. ### $usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1485. macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1486. .CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
  1487. }
  1488. # tag:internal
  1489. ### $usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
  1490. macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1491. .CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
  1492. }
  1493. # tag:internal
  1494. ### $usage: LINK_EXE_IMPL(peers...) # internal
  1495. macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1496. .CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1497. }
  1498. # tag:internal
  1499. ### $usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1500. macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1501. .CMD=$LINK_EXEC_DYN_LIB_CMDLINE
  1502. }
  1503. # tag:internal
  1504. ### @usage: _LINK_UNIT # internal
  1505. ###
  1506. ### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
  1507. module _LINK_UNIT: _BASE_UNIT {
  1508. .EXTS=.o .obj .supp .tidyjson .ld
  1509. .CMD=LINK_EXE
  1510. .ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  1511. .NODE_TYPE=Program
  1512. .PEERDIR_POLICY=as_build_from
  1513. .FINAL_TARGET=yes
  1514. .DEFAULT_NAME_GENERATOR=DirName
  1515. .ARGS_PARSER=Base
  1516. DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
  1517. _USE_LINKER()
  1518. #link with libunwind manually
  1519. when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
  1520. PEERDIR += contrib/libs/cxxsupp
  1521. }
  1522. when ($USE_LIBCXXRT == "yes") {
  1523. PEERDIR += contrib/libs/cxxsupp/libcxxrt
  1524. }
  1525. when ($USE_DYNAMIC_CUDA == "yes") {
  1526. LINK_DYN_LIB_FLAGS += --dynamic-cuda
  1527. LINK_SCRIPT_EXE_FLAGS += --dynamic-cuda
  1528. }
  1529. ENABLE(COMMON_LINK_SETTINGS)
  1530. CHECK_PROVIDES()
  1531. }
  1532. MODULE_TYPE=UNKNOWN
  1533. macro ADD_CLANG_TIDY() {
  1534. ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy)
  1535. when ($TIDY_ENABLED == "yes") {
  1536. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json
  1537. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json
  1538. }
  1539. }
  1540. # tag:internal
  1541. ### @usage: _BASE_PROGRAM # internal
  1542. ###
  1543. ### The base of all programs. It adds dependencies to make final artefact complete and runnable.
  1544. module _BASE_PROGRAM: _LINK_UNIT {
  1545. .SYMLINK_POLICY=EXE
  1546. .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
  1547. .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1548. SET(MODULE_TYPE PROGRAM)
  1549. SET(MODULE_LANG CPP)
  1550. FORCE_COVERAGE_ENABLED=yes
  1551. when ($OS_IOS == "yes") {
  1552. EXTS+=.ios.interface
  1553. }
  1554. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  1555. MODULE_SUFFIX=.exe
  1556. }
  1557. when ($TIDY_ENABLED == "yes") {
  1558. MODULE_SUFFIX=.tidyjson
  1559. }
  1560. when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
  1561. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes" && $MUSL != "yes" && $SANITIZER_DEFINED != "yes" && $USE_THINLTO != "yes") {
  1562. PEERDIR+=contrib/libs/glibcasm
  1563. }
  1564. otherwise {
  1565. PEERDIR+=contrib/libs/asmlib
  1566. }
  1567. }
  1568. when ($MUSL == "yes") {
  1569. when ($MUSL_LITE == "yes") {
  1570. PEERDIR += contrib/libs/musl
  1571. }
  1572. otherwise {
  1573. PEERDIR += contrib/libs/musl/full
  1574. }
  1575. }
  1576. DEFAULT(CPU_CHECK yes)
  1577. when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
  1578. CPU_CHECK = no
  1579. }
  1580. when ($CPU_CHECK == "yes") {
  1581. PEERDIR += library/cpp/cpuid_check
  1582. }
  1583. when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
  1584. PEERDIR += library/cpp/execprofile/autostart
  1585. }
  1586. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1587. PEERDIR += contrib/libs/cxxsupp/libsan
  1588. when ($CLANG) {
  1589. select ($TARGET_PLATFORM) {
  1590. "LINUX" ? {
  1591. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/static
  1592. }
  1593. "DARWIN" ? {
  1594. # Memory sanitizer is not supported for darwin platform.
  1595. # https://clang.llvm.org/docs/MemorySanitizer.html#supported-platforms
  1596. when ($SANITIZER_TYPE != "memory") {
  1597. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/dynamic
  1598. }
  1599. }
  1600. default ? {
  1601. FATAL_ERROR_MESSAGE+=Unsupported platform for sanitizer
  1602. }
  1603. }
  1604. }
  1605. }
  1606. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1607. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1608. }
  1609. when ($IDE_MSVS == "yes") {
  1610. PEERDIR+=build/scripts/c_templates
  1611. }
  1612. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1613. LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1614. }
  1615. }
  1616. VCS_INFO_SEM=vcs_info ${input;hide:"build/scripts/vcs_info.py"} ${input;hide:"build/scripts/c_templates/svn_interface.c"} ${input;hide:"build/scripts/c_templates/svnversion.h"}
  1617. CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  1618. && ${VCS_INFO_SEM} \
  1619. && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE \
  1620. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1621. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1622. && target_compile_options PRIVATE $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  1623. ### @usage: PROGRAM([progname])
  1624. ###
  1625. ### Regular program module.
  1626. ### If name is not specified it will be generated from the name of the containing project directory.
  1627. module PROGRAM: _BASE_PROGRAM {
  1628. .SEM=CPP_PROGRAM_SEM
  1629. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1630. ADD_CLANG_TIDY()
  1631. }
  1632. # tag:python-specific tag:deprecated tag:internal
  1633. module _PY2_PROGRAM: _BASE_PY_PROGRAM {
  1634. SET(MODULE_LANG PY2)
  1635. # Looks like we cannot avoid copy-paste util ymake supports multiple inheritance
  1636. # We need to attach coverage.extractor to every py_program target, except pytest targets
  1637. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1638. }
  1639. # tag:python-specific tag:deprecated
  1640. ### @usage: PY2_PROGRAM([progname]) # deprecated
  1641. ###
  1642. ### Deprecated. Use PY3_PROGRAM instead.
  1643. ### Python 2.x binary program. Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  1644. ### If name is not specified it will be generated from the name of the containing project directory.
  1645. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  1646. ###
  1647. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1648. module PY2_PROGRAM: _PY2_PROGRAM {
  1649. .RESTRICTED=STYLE_PYTHON
  1650. when ($FAIL_PY2 == "yes") {
  1651. _OK=no
  1652. }
  1653. elsewhen ($OPENSOURCE != "yes") {
  1654. PEERDIR+=build/rules/py2_deprecation
  1655. }
  1656. ASSERT(_OK You are using deprecated Python2-only code (PY2_PROGRAM). Please consider rewriting to Python 3.)
  1657. }
  1658. # tag:python-specific
  1659. ### @usage: NO_EXTENDED_SOURCE_SEARCH()
  1660. ###
  1661. ### Prevent module using in extended python source search.
  1662. ### Use the macro if module contains python2-only files (or other python sources which shouldn't be imported by python3 interpreter)
  1663. ### which resides in the same directories with python 3 useful code. contrib/python/future is a example.
  1664. ### Anyway, preferred way is to move such files into separate dir and don't use this macro at all.
  1665. ###
  1666. ### Also see: https://docs.yandex-team.ru/ya-make/manual/python/vars#y_python_extended_source_search for details
  1667. macro NO_EXTENDED_SOURCE_SEARCH() {
  1668. SET(NO_EXTENDED_SOURCE_SEARCH yes)
  1669. }
  1670. # tag:python-specific
  1671. ### @usage: PY3_PROGRAM([progname])
  1672. ###
  1673. ### Python 3.x binary program. Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  1674. ### If name is not specified it will be generated from the name of the containing project directory.
  1675. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules.
  1676. ###
  1677. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1678. multimodule PY3_PROGRAM {
  1679. module PY3_BIN: PY3_PROGRAM_BIN {
  1680. .PEERDIRSELF=PY3_BIN_LIB
  1681. .IGNORED=RESOURCE RESOURCE_FILES PEERDIR TASKLET_REG RUN_ANTLR4_PYTHON BUILDWITH_CYTHON_CPP _BUILDWITH_CYTHON_CPP_DEP _BUILDWITH_CYTHON_CPP_H BUILDWITH_CYTHON_C _BUILDWITH_CYTHON_C_DEP _BUILDWITH_CYTHON_C_H _BUILDWITH_CYTHON_C_API_H
  1682. # Notify pybuild to skip almost all PY_SRCS arguments except MAIN
  1683. ENABLE(PROCESS_PY_MAIN_ONLY)
  1684. _PY_PROGRAM()
  1685. NO_CLANG_TIDY()
  1686. }
  1687. module PY3_BIN_LIB: PY3_LIBRARY {
  1688. .IGNORED=RESTRICT_LICENSES
  1689. # Notify pybuild to skip all python main function definitions
  1690. ENABLE(IGNORE_PY_MAIN)
  1691. _REQUIRE_EXPLICIT_LICENSE()
  1692. NO_CLANG_TIDY()
  1693. }
  1694. }
  1695. ### @usage: EXPORTS_SCRIPT(exports_file)
  1696. ###
  1697. ### Specify exports script within PROGRAM, DLL and DLL-derived modules.
  1698. ### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
  1699. ### The other option use EXPORTS parameter of the DLL module itself.
  1700. ###
  1701. ### @see: [DLL](#module_DLL)
  1702. macro EXPORTS_SCRIPT(Arg) {
  1703. SET(EXPORTS_FILE $Arg)
  1704. }
  1705. ### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
  1706. ###
  1707. ### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
  1708. macro NO_EXPORT_DYNAMIC_SYMBOLS() {
  1709. ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
  1710. }
  1711. ### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
  1712. ###
  1713. ### Export all non-hidden symbols as dynamic when linking a PROGRAM.
  1714. macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
  1715. # Dummy: default behaviour
  1716. ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
  1717. }
  1718. ### @usage: USE_DYNAMIC_CUDA()
  1719. ###
  1720. ### Enable linking of PROGRAM with dynamic CUDA. By default CUDA uses static linking
  1721. macro USE_DYNAMIC_CUDA() {
  1722. LDFLAGS(-Wl,-rpath,$ORIGIN)
  1723. ENABLE(USE_DYNAMIC_CUDA)
  1724. }
  1725. ### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
  1726. ###
  1727. ### Specifies name of a script for custom link step. The scripts
  1728. ### should be placed in the build/scripts directory and are subject to
  1729. ### review by devtools@.
  1730. macro CUSTOM_LINK_STEP_SCRIPT(Name) {
  1731. SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
  1732. }
  1733. ### @usage: _BASE_UNITTEST # internal
  1734. ###
  1735. ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
  1736. module _BASE_UNITTEST: _BASE_PROGRAM {
  1737. .FINAL_TARGET=no
  1738. .NODE_TYPE=Program
  1739. .ALLOWED=YT_SPEC
  1740. when ($UT_SKIP_EXCEPTIONS == "yes") {
  1741. C_DEFINES+=-DUT_SKIP_EXCEPTIONS
  1742. }
  1743. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1744. }
  1745. _TEST_SPLIT_FACTOR_SEM=1
  1746. _TEST_TIMEOUT_SEM=
  1747. _TEST_PARTITION_SEM=
  1748. UNITTEST_SEM=$CPP_PROGRAM_SEM \
  1749. && set_property TARGET $REALPRJNAME PROPERTY SPLIT_FACTOR $_TEST_SPLIT_FACTOR_SEM \
  1750. $_TEST_PARTITION_SEM \
  1751. && add_yunittest NAME $REALPRJNAME TEST_TARGET $REALPRJNAME TEST_ARG --print-before-suite --print-before-test --fork-tests --print-times --show-fails \
  1752. && set_yunittest_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1753. && add_ytest_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1754. $_TEST_TIMEOUT_SEM
  1755. # tag:test
  1756. ### @usage: UNITTEST([name])
  1757. ###
  1758. ### Unit test module based on library/cpp/testing/unittest.
  1759. ### It is recommended not to specify the name.
  1760. ###
  1761. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
  1762. module UNITTEST: _BASE_UNITTEST {
  1763. .SEM=UNITTEST_SEM
  1764. .DEFAULT_NAME_GENERATOR=FullPath
  1765. .ARGS_PARSER=Base
  1766. PEERDIR(library/cpp/testing/unittest_main)
  1767. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1768. when ($TEST_FORK_MODE != "none") {
  1769. when ($TEST_SPLIT_FACTOR) {
  1770. _TEST_SPLIT_FACTOR_SEM=$TEST_SPLIT_FACTOR
  1771. }
  1772. otherwise {
  1773. _TEST_SPLIT_FACTOR_SEM=10
  1774. }
  1775. when ($TEST_PARTITION == "MODULO") {
  1776. _TEST_PARTITION_SEM=&& set_property TARGET $REALPRJNAME PROPERTY SPLIT_TYPE $TEST_PARTITION \
  1777. }
  1778. }
  1779. when ($TEST_TIMEOUT) {
  1780. _TEST_TIMEOUT_SEM=&& set_yunittest_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1781. }
  1782. }
  1783. # tag:yt-specific tag:test
  1784. ### @usage: YT_UNITTEST([name])
  1785. ###
  1786. ### YT Unit test module based on library/cpp/testing/unittest with NYT::Initialize hook
  1787. module YT_UNITTEST: _BASE_UNITTEST {
  1788. PEERDIR(library/cpp/testing/unittest_main mapreduce/yt/tests/yt_initialize_hook)
  1789. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1790. }
  1791. # tag:test
  1792. ### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
  1793. ###
  1794. ### Generic unit test module.
  1795. module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
  1796. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1797. }
  1798. GTEST_SEM=$CPP_PROGRAM_SEM \
  1799. && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
  1800. && set_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1801. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1802. $_TEST_TIMEOUT_SEM
  1803. # tag:cpp-specific tag:test
  1804. ### @usage: GTEST([name])
  1805. ###
  1806. ### Unit test module based on library/cpp/testing/gtest.
  1807. ### It is recommended not to specify the name.
  1808. ###
  1809. ### Documentation: https://docs.yandex-team.ru/arcadia-cpp/cpp_test
  1810. module GTEST: _BASE_UNITTEST {
  1811. .SEM=GTEST_SEM
  1812. .DEFAULT_NAME_GENERATOR=FullPath
  1813. .ARGS_PARSER=Base
  1814. PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
  1815. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
  1816. when ($TEST_TIMEOUT) {
  1817. _TEST_TIMEOUT_SEM=&& set_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1818. }
  1819. }
  1820. USE_AFL=no
  1821. # tag:fuzzing
  1822. ### @usage: FUZZ()
  1823. ###
  1824. ### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
  1825. ### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
  1826. ### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
  1827. ###
  1828. ### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
  1829. ###
  1830. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1831. module FUZZ: _BASE_PROGRAM {
  1832. .NODE_TYPE=Program
  1833. .FINAL_TARGET=no
  1834. .ALLOWED=FUZZ_DICTS FUZZ_OPTS
  1835. SET(LIBFUZZER_PATH contrib/libs/libfuzzer)
  1836. when ($USE_AFL == "no") {
  1837. PEERDIR+=$LIBFUZZER_PATH
  1838. }
  1839. when ($USE_AFL == "yes") {
  1840. PEERDIR+=$LIBFUZZER_PATH/afl
  1841. }
  1842. when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
  1843. PEERDIR+=devtools/nofuzz
  1844. }
  1845. ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
  1846. }
  1847. # tag:ios-specific
  1848. PACK_IOS_CMD=
  1849. when ($OS_IOS && $BUILD_IOS_APP) {
  1850. PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
  1851. }
  1852. LINK_BOOSTTEST_CMD=
  1853. BOOST_TEST_TYPE_STRING=
  1854. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1855. LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
  1856. BOOST_TEST_TYPE_STRING=no.test
  1857. }
  1858. otherwise {
  1859. LINK_BOOSTTEST_CMD=$LINK_EXE
  1860. BOOST_TEST_TYPE_STRING=boost.test
  1861. }
  1862. # tag:deprecated
  1863. ### @usage: BOOSTTEST([name]) #deprecated
  1864. ###
  1865. ### Test module based on boost/test/unit_test.hpp.
  1866. ### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
  1867. ### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
  1868. module BOOSTTEST: _BASE_PROGRAM {
  1869. .NODE_TYPE=Program
  1870. .FINAL_TARGET=no
  1871. .CMD=LINK_BOOSTTEST_CMD
  1872. PEERDIR(library/cpp/testing/boost_test)
  1873. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1874. MODULE_SUFFIX=.a
  1875. }
  1876. elsewhen ($OS_IOS && $BUILD_IOS_APP) {
  1877. PEERDIR+=devtools/boosttest_ios_wrapper/library
  1878. MODULE_SUFFIX=.ios.tar
  1879. }
  1880. ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
  1881. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1882. }
  1883. # tag:deprecated
  1884. ### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated
  1885. ###
  1886. ### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
  1887. module BOOSTTEST_WITH_MAIN: BOOSTTEST {
  1888. PEERDIR(library/cpp/testing/boost_test_main)
  1889. }
  1890. FUZZ_DICTS_VALUE=
  1891. ### @usage: FUZZ_DICTS(path1 [path2...])
  1892. ###
  1893. ### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
  1894. ### Libfuzzer and AFL use a single syntax for dictionary descriptions.
  1895. ### Should only be used in FUZZ modules.
  1896. ###
  1897. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1898. macro FUZZ_DICTS(Data...) {
  1899. SET_APPEND(FUZZ_DICTS_VALUE $Data)
  1900. }
  1901. FUZZ_OPTS_VALUE=
  1902. ### @usage: FUZZ_OPTS(opt1 [Opt2...])
  1903. ###
  1904. ### Overrides or adds options to the corpus mining and fuzzer run.
  1905. ### Currently supported only Libfuzzer, so you should use the options for it.
  1906. ### Should only be used in FUZZ modules.
  1907. ###
  1908. ### @example:
  1909. ###
  1910. ### FUZZ_OPTS (
  1911. ### -max_len=1024
  1912. ### -rss_limit_mb=8192
  1913. ### )
  1914. ###
  1915. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1916. macro FUZZ_OPTS(Data...) {
  1917. SET_APPEND(FUZZ_OPTS_VALUE $Data)
  1918. }
  1919. # tag:yt-specific tag:test
  1920. TEST_YT_SPEC_VALUE=
  1921. ### @usage: YT_SPEC(path1 [path2...])
  1922. ###
  1923. ### Allows you to specify json-files with YT task and operation specs,
  1924. ### which will be used to run test node in the YT.
  1925. ### Test must be marked with ya:yt tag.
  1926. ### Files must be relative to the root of Arcadia.
  1927. ###
  1928. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1929. macro YT_SPEC(Data...) {
  1930. SET_APPEND(TEST_YT_SPEC_VALUE $Data)
  1931. }
  1932. # tag:test
  1933. TEST_SRCS_VALUE=
  1934. ### @usage: TEST_SRCS(Files...)
  1935. ###
  1936. ### 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.
  1937. ###
  1938. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1939. macro TEST_SRCS(Tests...) {
  1940. SET_APPEND(TEST_SRCS_VALUE $Tests)
  1941. }
  1942. macro DISABLE_DATA_VALIDATION() {
  1943. DISABLE(VALIDATE_DATA)
  1944. }
  1945. # tag:test
  1946. TEST_DATA_VALUE=
  1947. ### @usage: DATA([path...])
  1948. ###
  1949. ### Specifies the path to the data necessary test.
  1950. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
  1951. ### In the latter case resource will be brought to the working directory of the test before it is started
  1952. ###
  1953. ### Used only inside TEST modules.
  1954. ###
  1955. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1956. macro DATA(Data...) {
  1957. SET_APPEND(TEST_DATA_VALUE $Data)
  1958. ADD_CHECK(check.data $Data)
  1959. }
  1960. # tag:test
  1961. ### @usage: DATA_FILES([path...])
  1962. ###
  1963. ### Specifies the path to the arcadia source data necessary test.
  1964. ### Used only inside TEST modules.
  1965. ###
  1966. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1967. macro DATA_FILES(Paths...) {
  1968. SET_APPEND(TEST_DATA_VALUE ${pre=arcadia/:Paths})
  1969. _DATA_FILES($Paths)
  1970. }
  1971. # tag:test
  1972. ### @usage: EXPLICIT_DATA()
  1973. ###
  1974. ### Disables implicit macro DATA(<module_path>).
  1975. ADD_SRCDIR_TO_TEST_DATA=yes
  1976. macro EXPLICIT_DATA() {
  1977. SET(ADD_SRCDIR_TO_TEST_DATA no)
  1978. }
  1979. # tag:test
  1980. TEST_TAGS_VALUE=
  1981. ### @usage: TAG ([tag...])
  1982. ###
  1983. ### Each test can have one or more tags used to filter tests list for running.
  1984. ### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
  1985. ###
  1986. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
  1987. macro TAG(Tags...) {
  1988. SET_APPEND(TEST_TAGS_VALUE $Tags)
  1989. }
  1990. # tag:test
  1991. TEST_REQUIREMENTS_VALUE=
  1992. ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
  1993. ###
  1994. ### Allows you to specify the requirements of the test.
  1995. ###
  1996. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1997. macro REQUIREMENTS(Tags...) {
  1998. SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
  1999. }
  2000. # tag:test
  2001. TEST_ENV_VALUE=
  2002. ### @usage: ENV(key[=value])
  2003. ###
  2004. ### Sets env variable key to value (gets value from system env by default).
  2005. macro ENV(Data...) {
  2006. SET_APPEND(TEST_ENV_VALUE ${quo:Data})
  2007. }
  2008. ### @usage: CONFTEST_LOAD_POLICY_LOCAL()
  2009. ###
  2010. ### Loads conftest.py files in a way that pytest does it
  2011. macro CONFTEST_LOAD_POLICY_LOCAL() {
  2012. SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
  2013. }
  2014. # tag:test
  2015. TEST_RECIPES_VALUE=
  2016. ### @usage: USE_RECIPE(path [arg1 arg2...])
  2017. ###
  2018. ### Provides prepared environment via recipe for test.
  2019. ###
  2020. ### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
  2021. macro USE_RECIPE(Data...) {
  2022. SET_APPEND(TEST_RECIPES_VALUE $Data)
  2023. SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
  2024. }
  2025. # tag:python-specific tag:test
  2026. TEST_PYTHON_PATH_VALUE=
  2027. # tag:python-specific tag:test
  2028. ### @usage: PYTHON_PATH(Path)
  2029. ###
  2030. ### Set path to Python that will be used to runs scripts in tests
  2031. macro PYTHON_PATH(Path) {
  2032. SET(TEST_PYTHON_PATH_VALUE $Path)
  2033. }
  2034. # tag:test
  2035. SKIP_TEST_VALUE=
  2036. ### @usage: SKIP_TEST(Reason)
  2037. ###
  2038. ### Skip the suite defined by test module. Provide a reason to be output in test execution report.
  2039. macro SKIP_TEST(Reason...) {
  2040. SET(SKIP_TEST_VALUE $Reason)
  2041. }
  2042. # tag:test
  2043. LINT_LEVEL_VALUE=extended
  2044. _NO_LINT_VALUE=
  2045. ### @usage: NO_LINT([ktlint])
  2046. ###
  2047. ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
  2048. ### Ktlint can be disabled using NO_LINT(ktlint) explicitly.
  2049. macro NO_LINT(ktlint?"ktlint":"none") {
  2050. SET(_NO_LINT_VALUE ${ktlint})
  2051. }
  2052. ### @usage: LINT(<none|base|strict>)
  2053. ###
  2054. ### Set linting level for sources of the module
  2055. macro LINT(level) {
  2056. SET(LINT_LEVEL_VALUE $level)
  2057. }
  2058. # tag:python-specific tag:test
  2059. STYLE_PYTHON_VALUE=no
  2060. STYLE_PYTHON_PYPROJECT_VALUE=
  2061. ### @usage: STYLE_PYTHON([pyproject])
  2062. ###
  2063. ### Check python3 sources for style issues using black.
  2064. macro STYLE_PYTHON(pyproject...) {
  2065. SET(STYLE_PYTHON_VALUE yes)
  2066. SET(STYLE_PYTHON_PYPROJECT_VALUE ${pyproject})
  2067. }
  2068. # tag:python-specific tag:test
  2069. ### @usage: NO_DOCTESTS()
  2070. ###
  2071. ### Disable doctests in PY[|3|23_]TEST
  2072. macro NO_DOCTESTS() {
  2073. ENV(YA_PYTEST_DISABLE_DOCTEST="yes")
  2074. }
  2075. # tag:python-specific tag:test
  2076. ### @usage: _BASE_PYTEST # internal
  2077. ###
  2078. ### Base logic of Python 2.x py.test modules: common module properties and dependencies.
  2079. module _BASE_PYTEST: _BASE_PY_PROGRAM {
  2080. .NODE_TYPE=Program
  2081. .FINAL_TARGET=no
  2082. .ALLOWED=YT_SPEC NO_DOCTESTS
  2083. when ($USE_ARCADIA_PYTHON == "yes") {
  2084. PEERDIR+=library/python/pytest
  2085. }
  2086. when ($USE_ARCADIA_PYTHON == "no") {
  2087. MODULE_SUFFIX=.pkg.fake
  2088. PEERDIR+=library/python/pytest/empty
  2089. }
  2090. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2091. }
  2092. # tag:python-specific tag:deprecated tag:test
  2093. ### @usage: PYTEST_BIN() #deprecated
  2094. ###
  2095. ### Same as PY2TEST. Don't use this, use PY2TEST instead.
  2096. module PYTEST_BIN: _BASE_PYTEST {
  2097. .NODE_TYPE=Program
  2098. .DEFAULT_NAME_GENERATOR=FullPath
  2099. .ARGS_PARSER=Base
  2100. SETUP_PYTEST_BIN()
  2101. }
  2102. # tag:python-specific tag:test
  2103. ### @usage: PY2TEST([name])
  2104. ###
  2105. ### The test module for Python 2.x based on py.test
  2106. ###
  2107. ### This module is compatible only with PYTHON2-tagged modules and selects peers from multimodules accordingly.
  2108. ### This module is compatible with non-Arcadia Python builds.
  2109. ###
  2110. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#python
  2111. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2112. module PY2TEST: PYTEST_BIN {
  2113. .RESTRICTED=STYLE_PYTHON
  2114. .DEFAULT_NAME_GENERATOR=FullPath
  2115. .ARGS_PARSER=Base
  2116. when ($FAIL_PY2 == "yes") {
  2117. _OK=no
  2118. }
  2119. elsewhen ($OPENSOURCE != "yes") {
  2120. PEERDIR+=build/rules/py2_deprecation
  2121. }
  2122. SET(MODULE_LANG PY2)
  2123. ASSERT(_OK You are using deprecated Python2-only code (PY2TEST). Please consider rewriting to Python 3.)
  2124. }
  2125. # tag:python-specific tag:deprecated tag:test
  2126. ### @usage: PY3TEST_BIN() #deprecated
  2127. ###
  2128. ### Same as PY3TEST. Don't use this, use PY3TEST instead.
  2129. module PY3TEST_BIN: _BASE_PY3_PROGRAM {
  2130. .NODE_TYPE=Program
  2131. .FINAL_TARGET=no
  2132. .ALLOWED=YT_SPEC NO_DOCTESTS
  2133. .DEFAULT_NAME_GENERATOR=FullPath
  2134. .ARGS_PARSER=Base
  2135. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2136. SET(MODULE_LANG PY3)
  2137. SETUP_PYTEST_BIN()
  2138. PEERDIR+=library/python/pytest
  2139. }
  2140. # tag:python-specific tag:test
  2141. ### Disable submodules with the specified name(s).
  2142. ### Unlike EXCLUDE_TAGS this variable:
  2143. ### - affects all projects in the build;
  2144. ### - filter by module name and ignore MODULE_TAG.
  2145. EXCLUDE_SUBMODULES=PY3TEST_LIBRARY
  2146. # tag:python-specific tag:test
  2147. ### @usage: PY3TEST([name])
  2148. ###
  2149. ### The test module for Python 3.x based on py.test
  2150. ###
  2151. ### This module is compatible only with PYTHON3-tagged modules and selects peers from multimodules accordingly.
  2152. ### This module is only compatible with Arcadia Python build (to avoid tests duplication from Python2/3-tests). For non-Arcadia python use PYTEST.
  2153. ###
  2154. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  2155. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2156. multimodule PY3TEST {
  2157. module PY3TEST_PROGRAM: PY3TEST_BIN {
  2158. .IGNORED=RUN_ANTLR4_PYTHON
  2159. .FINAL_TARGET=yes
  2160. }
  2161. module PY3TEST_LIBRARY: PY3_LIBRARY {
  2162. PEERDIR+=library/python/pytest
  2163. _REQUIRE_EXPLICIT_LICENSE()
  2164. }
  2165. }
  2166. # tag:cpp-specific tag:test
  2167. module CPP_STYLE_TEST_14: PY3TEST_BIN {
  2168. DEPENDS(contrib/libs/clang14/tools/clang-format)
  2169. PEERDIR+=library/python/cpp_test
  2170. }
  2171. macro STYLE(Globs...) {
  2172. _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
  2173. _STYLE(${STYLE_SRCS_GLOB})
  2174. }
  2175. # tag:cpp-specific tag:deprecated tag:test
  2176. ### @usage: GTEST_UGLY([name])
  2177. ###
  2178. ### Deprecated, do not use in new projects. Use GTEST instead.
  2179. ###
  2180. ### The test module based on gtest (contrib/libs/gtest contrib/libs/gmock).
  2181. ### Use public documentation on gtest for details.
  2182. ###
  2183. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2184. module GTEST_UGLY: _BASE_PROGRAM {
  2185. .NODE_TYPE=Program
  2186. .FINAL_TARGET=no
  2187. PEERDIR(contrib/restricted/googletest/googlemock contrib/restricted/googletest/googletest)
  2188. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gtest)
  2189. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2190. }
  2191. # tag:test
  2192. ### @usage: EXECTEST()
  2193. ###
  2194. ### Module definition of generic test that executes a binary.
  2195. ### Use macro RUN to specify binary to run.
  2196. ###
  2197. ### @example:
  2198. ###
  2199. ### EXECTEST()
  2200. ### OWNER(g:yatool)
  2201. ###
  2202. ### RUN(
  2203. ### cat input.txt
  2204. ### )
  2205. ### DATA(
  2206. ### arcadia/devtools/ya/test/tests/exectest/data
  2207. ### )
  2208. ### DEPENDS(
  2209. ### devtools/dummy_arcadia/cat
  2210. ### )
  2211. ### TEST_CWD(devtools/ya/test/tests/exectest/data)
  2212. ### END()
  2213. ###
  2214. ### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
  2215. ###
  2216. ### @see: [RUN()](#macro_RUN)
  2217. module EXECTEST: _BARE_UNIT {
  2218. .NODE_TYPE=Program
  2219. .FINAL_TARGET=no
  2220. .ALLOWED=YT_SPEC
  2221. .RESTRICTED=FORK_TEST_FILES
  2222. .DEFAULT_NAME_GENERATOR=FullPath
  2223. .ARGS_PARSER=Base
  2224. SET(MODULE_SUFFIX .pkg.fake)
  2225. SETUP_EXECTEST()
  2226. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2227. }
  2228. # tag:cpp-specific tag:test
  2229. ### @usage: Y_BENCHMARK([benchmarkname])
  2230. ###
  2231. ### Benchmark test based on the library/cpp/testing/benchmark.
  2232. ###
  2233. ### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
  2234. module Y_BENCHMARK: PROGRAM {
  2235. .SEM=CPP_PROGRAM_SEM
  2236. PEERDIR(library/cpp/testing/benchmark/main)
  2237. }
  2238. GBENCH_SEM=$CPP_PROGRAM_SEM \
  2239. && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
  2240. && set_property TEST $REALPRJNAME PROPERTY LABELS SMALL $FILTER_ONLY_TEST_TAGS \
  2241. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  2242. $_TEST_TIMEOUT_SEM
  2243. # tag:cpp-specific tag:test
  2244. ### @usage: G_BENCHMARK([benchmarkname])
  2245. ###
  2246. ### Benchmark test based on the google benchmark.
  2247. ###
  2248. ### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
  2249. module G_BENCHMARK: _BASE_PROGRAM {
  2250. .SEM=GBENCH_SEM
  2251. PEERDIR(library/cpp/testing/gbenchmark)
  2252. ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
  2253. }
  2254. # tag:test
  2255. TEST_ROOT=$(TESTS_DATA_ROOT)
  2256. RESULT_MAX_FILE=0
  2257. STRIP_FILES=--dont-strip-files
  2258. VERIFY_RESULTS=--verify-results
  2259. ADDITIONAL_PATH=
  2260. # set for tests variables to fill it by YA_DEV or YA
  2261. YA_ROOT=ya
  2262. when ($YA_DEV == "yes") {
  2263. YA_ROOT=ya-dev
  2264. }
  2265. # tag:test
  2266. ### @usage: UNITTEST_FOR(path/to/lib)
  2267. ###
  2268. ### Convenience extension of UNITTEST module.
  2269. ### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
  2270. ### path/to/lib is the path to the directory with the LIBRARY project.
  2271. ###
  2272. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2273. module UNITTEST_FOR: UNITTEST {
  2274. .SEM=UNITTEST_SEM
  2275. PEERDIR(ADDINCL $UNITTEST_DIR)
  2276. SRCDIR($UNITTEST_DIR)
  2277. }
  2278. ### @usage: _LIBRARY # internal
  2279. ###
  2280. ### Base module definition for all libraries.
  2281. ### Contains basic logic like module properties, default variable values etc.
  2282. ### All libraries similar to C++-libraries should be inherited from it.
  2283. module _LIBRARY: _BASE_UNIT {
  2284. .CMD=LINK_LIB
  2285. .NODE_TYPE=Library
  2286. .PEERDIR_POLICY=as_include
  2287. .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
  2288. .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  2289. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2290. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
  2291. .FINAL_TARGET=no
  2292. .GLOBAL_CMD=GLOBAL_LINK_LIB
  2293. .GLOBAL_EXTS=.o .obj .tidyjson
  2294. GLOBAL_SUFFIX=.global$MODULE_SUFFIX
  2295. #TODO: Remove this hack (really we do not need add fake src at all)
  2296. ENABLE(NEED_ADD_FAKE_SRC)
  2297. _REQUIRE_EXPLICIT_LICENSE(contrib/deprecated contrib/libs contrib/restricted contrib/python)
  2298. CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
  2299. when ($USE_MKL == "yes") {
  2300. NOPLATFORM=yes
  2301. }
  2302. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2303. MODULE_PREFIX=
  2304. MODULE_SUFFIX=.lib
  2305. }
  2306. otherwise {
  2307. when ($TIDY_ENABLED == "yes") {
  2308. MODULE_PREFIX=
  2309. MODULE_SUFFIX=.tidyjson
  2310. }
  2311. otherwise {
  2312. MODULE_PREFIX=lib
  2313. MODULE_SUFFIX=.a
  2314. }
  2315. }
  2316. when ($WERROR != "no") {
  2317. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  2318. C_WARNING_OPTS += $WERROR_FLAG
  2319. }
  2320. }
  2321. when ($WITH_VALGRIND == "yes") {
  2322. PEERDIR+=contrib/libs/valgrind
  2323. # https://st.yandex-team.ru/DTCC-1227
  2324. CFLAGS+=-fdebug-default-version=4
  2325. }
  2326. when ($USE_ARCADIA_LIBM == "yes") {
  2327. PEERDIR+=contrib/libs/libm
  2328. }
  2329. }
  2330. CPP_LIBRARY_INDUCED_SEM_PROPERTY=consumer_link_library
  2331. CPP_LIBRARY_SEM=add_library ${MODDIR} $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  2332. && library_fake_marker FAKE_MODULE ${FAKE_MODULE} \
  2333. && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET \
  2334. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2335. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2336. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2337. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  2338. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW \
  2339. && add_language C && add_language CXX
  2340. CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:CMAKE_TARGET_NAME} $CMAKE_TARGET_NAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
  2341. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2342. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2343. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2344. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  2345. CMAKE_FIND_PKG=
  2346. CMAKE_LINK_TARGET=$REALPRJNAME
  2347. CMAKE_FIND_PKG_COMP=
  2348. CONAN_REQUIRE=
  2349. CONAN_OPTS_SEM=
  2350. ### @usage: LIBRARY()
  2351. ###
  2352. ### The regular static library module.
  2353. ###
  2354. ### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
  2355. ### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
  2356. ###
  2357. ### This is C++ library, and it selects peers from multimodules accordingly.
  2358. ###
  2359. ### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
  2360. ### In order to use library in tests PEERDIR it to link into tests.
  2361. ### If you think you need to distribute static library please contact devtools@ for assistance.
  2362. module LIBRARY: _LIBRARY {
  2363. .GLOBAL=_AARS _PROGUARD_RULES
  2364. .SEM=CPP_LIBRARY_SEM
  2365. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  2366. .DEFAULT_NAME_GENERATOR=ThreeDirNames
  2367. .ARGS_PARSER=Base
  2368. when ($CMAKE_PACKAGE_COMPONENT != "") {
  2369. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  2370. }
  2371. when ($CMAKE_PACKAGE != "") {
  2372. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  2373. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2374. }
  2375. when ($CONAN_REFERENCE != "") {
  2376. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  2377. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2378. }
  2379. when ($CONAN_PKG_OPTS != "") {
  2380. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  2381. }
  2382. when ($OPENSOURCE_EXPORT == "no") {
  2383. CPP_LIBRARY_SEM=IGNORED
  2384. }
  2385. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no" && $SANITIZE_HEADERS && $SANITIZE_HEADERS != "no") {
  2386. PEERDIR += library/cpp/sanitizer/include
  2387. }
  2388. when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
  2389. PEERDIR+=$CPP_PROTOBUF_PEERS
  2390. }
  2391. SET(MODULE_TYPE LIBRARY)
  2392. SET(MODULE_LANG CPP)
  2393. ADD_CLANG_TIDY()
  2394. }
  2395. # tag:internal
  2396. ### @usage: _BARE_MODULE() # internal
  2397. ###
  2398. ### Remove unwanted dependencies for "empty" library module
  2399. macro _BARE_MODULE() {
  2400. SET(NEED_PLATFORM_PEERDIRS no)
  2401. SET(PEERDIR_TEST_TOOL no)
  2402. DISABLE(WITH_VALGRIND)
  2403. NO_CODENAVIGATION()
  2404. NO_PLATFORM()
  2405. NO_RUNTIME()
  2406. NO_UTIL()
  2407. NO_CLANG_TIDY()
  2408. }
  2409. # tag:internal
  2410. ### @usage: _BARE_LINK_MODULE() # internal
  2411. ###
  2412. ### Remove unwanted dependencies for "empty" link module
  2413. macro _BARE_LINK_MODULE() {
  2414. _BARE_MODULE()
  2415. DISABLE(COMMON_LINK_SETTINGS)
  2416. ALLOCATOR(FAKE)
  2417. }
  2418. # tag:internal
  2419. ### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
  2420. ###
  2421. ### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
  2422. ### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
  2423. macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
  2424. SRCS($USE_CONDITIONAL_SRCS)
  2425. }
  2426. # XXX: dirty hack for correct LDFLAGS passing
  2427. RESOURCES_LIBRARY_LINK=$TOUCH_UNIT
  2428. RESOURCES_LIBRARY_SEM=IGNORED
  2429. ### @usage: RESOURCES_LIBRARY()
  2430. ###
  2431. ### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
  2432. ### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
  2433. ###
  2434. ### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
  2435. module RESOURCES_LIBRARY: _BARE_UNIT {
  2436. .CMD=RESOURCES_LIBRARY_LINK
  2437. .SEM=RESOURCES_LIBRARY_SEM
  2438. .ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
  2439. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS PEERDIR SPLIT_DWARF
  2440. .NODE_TYPE=Library
  2441. .PEERDIR_POLICY=as_include
  2442. .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
  2443. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2444. when ($CMAKE_PACKAGE_COMPONENT != "") {
  2445. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  2446. }
  2447. when ($CMAKE_PACKAGE != "") {
  2448. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  2449. RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2450. }
  2451. when ($CONAN_REFERENCE != "") {
  2452. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  2453. RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2454. }
  2455. when ($CONAN_PKG_OPTS != "") {
  2456. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  2457. }
  2458. MODULE_SUFFIX=.pkg.fake
  2459. ENABLE(NEED_ADD_FAKE_SRC)
  2460. WITHOUT_LICENSE_TEXTS()
  2461. }
  2462. FAT_OBJECT_SEM=add_fat_object ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  2463. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2464. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2465. && set_global_flags FAT_OBJECT_PREFIX ${MODULE_PREFIX} \
  2466. && set_global_flags FAT_OBJECT_SUFFIX ${MODULE_SUFFIX}
  2467. ### Do not turn visibility=hidden symbos into static symbos of partially linked object file
  2468. ###
  2469. ### Note: This variable do not have any effect on platforms other than MacOS and iOS.
  2470. KEEP_FAT_OBJECT_SYMBOLS=no
  2471. ### @usage: FAT_OBJECT()
  2472. ###
  2473. ### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2474. ### static libraries, local (from own SRCS) and global (from peers') object files.
  2475. ###
  2476. ### Designed for use in XCode projects for iOS.
  2477. module FAT_OBJECT: LIBRARY {
  2478. .ALLOWED=PACK_GLOBALS_IN_LIBRARY
  2479. .CMD=LINK_FAT_OBJECT
  2480. .SEM=FAT_OBJECT_SEM
  2481. .PEERDIR_POLICY=as_build_from
  2482. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2483. MODULE_SUFFIX=.lib
  2484. }
  2485. otherwise {
  2486. MODULE_SUFFIX=.a
  2487. }
  2488. when (($OS_DARWIN == "yes" || $OS_IOS == "yes") && $KEEP_FAT_OBJECT_SYMBOLS == "yes") {
  2489. LDFLAGS_GLOBAL += -keep_private_externs
  2490. }
  2491. # FIXME: This is weird legacy
  2492. when ($OS_ANDROID == "yes") {
  2493. MODULE_PREFIX=lib
  2494. }
  2495. otherwise {
  2496. MODULE_PREFIX=
  2497. }
  2498. _USE_LINKER()
  2499. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2500. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2501. DISABLE(NEED_ADD_FAKE_SRC)
  2502. SRCS(build/scripts/_fake_src.cpp)
  2503. }
  2504. RECURSIVE_LIBRARY_SEM=add_recursive_library ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  2505. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2506. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2507. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2508. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  2509. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW
  2510. ### @usage: RECURSIVE_LIBRARY()
  2511. ###
  2512. ### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2513. ### from static libraries, local (from own SRCS) and global (from peers') object files.
  2514. ###
  2515. ### Designed for use in XCode projects for iOS.
  2516. module RECURSIVE_LIBRARY: LIBRARY {
  2517. .CMD=LINK_RECURSIVE_LIBRARY
  2518. .SEM=RECURSIVE_LIBRARY_SEM
  2519. .PEERDIR_POLICY=as_build_from
  2520. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2521. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2522. DISABLE(NEED_ADD_FAKE_SRC)
  2523. SRCS(build/scripts/_fake_src.cpp)
  2524. }
  2525. _SONAME=
  2526. _EXPORT_SCRIPT_SEM=
  2527. _CLEAN_TEXTREL=
  2528. macro _ADD_DYNLYB_SEM(Libname) {
  2529. .SEM=add_library ${MODDIR} ${Libname} SHARED ${hide:TARGET} ${hide:AUTO_INPUT} && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && target_include_directories PRIVATE $_C__INCLUDE_OWNED && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE && ${VCS_INFO_SEM} $_EXPORT_SCRIPT_SEM
  2530. }
  2531. CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES
  2532. macro CLEAN_TEXTREL() {
  2533. SET(_CLEAN_TEXTREL yes)
  2534. }
  2535. ### @usage: DLL_UNIT # internal
  2536. ###
  2537. ### Base module for all dynamically linked libraries as final artifacts.
  2538. ### Contains all general logic for such kind of modules. Supports versioning and export files.
  2539. ### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
  2540. module DLL_UNIT: _LINK_UNIT {
  2541. .CMD=LINK_DYN_LIB
  2542. .SEM=CPP_DYN_LIBRARY_SEM
  2543. .NODE_TYPE=Library
  2544. .SYMLINK_POLICY=SO
  2545. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2546. .ALLOWED=WHOLE_ARCHIVE
  2547. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2548. .ARGS_PARSER=DLL
  2549. DYNAMIC_LINK=yes
  2550. ALLOCATOR(FAKE)
  2551. SET(MODULE_TYPE DLL)
  2552. SET(MODULE_TAG DLL)
  2553. SET(MODULE_LANG CPP)
  2554. ADD_CLANG_TIDY()
  2555. when ($EXPORTS_FILE) {
  2556. _EXPORT_SCRIPT_SEM=&& use_export_script ${input:EXPORTS_FILE}
  2557. }
  2558. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2559. MODULE_SUFFIX=.dll
  2560. }
  2561. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2562. MODULE_PREFIX=lib
  2563. MODULE_SUFFIX=.dylib
  2564. }
  2565. elsewhen ($TIDY_ENABLED == "yes") {
  2566. MODULE_PREFIX=
  2567. MODULE_SUFFIX=.tidyjson
  2568. }
  2569. otherwise {
  2570. MODULE_PREFIX=lib
  2571. MODULE_SUFFIX=.so
  2572. }
  2573. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2574. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2575. when ($MODULE_VERSION) {
  2576. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2577. }
  2578. _SONAME=$SONAME$MODULE_VERSION
  2579. when ($LINUX == "yes") {
  2580. # '-z notext' is needed for linking mkl into shared libraries
  2581. when ($_CLEAN_TEXTREL != "yes") {
  2582. LDFLAGS += -Wl,-z,notext
  2583. }
  2584. }
  2585. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes") {
  2586. when ($_NO_FIX_ELF != "yes") {
  2587. LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
  2588. }
  2589. }
  2590. when ($DARWIN == "yes") {
  2591. LDFLAGS += -undefined dynamic_lookup
  2592. }
  2593. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  2594. PEERDIR+=library/cpp/testing/dump_clang_coverage
  2595. }
  2596. when ($IDE_MSVS == "yes") {
  2597. PEERDIR+=build/scripts/c_templates
  2598. }
  2599. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  2600. LINK_DYN_LIB_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  2601. }
  2602. }
  2603. # tag:python-specific
  2604. ### @usage: PY_ANY_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2605. ###
  2606. ### The Python external module for any versio of Arcadia or system Python.
  2607. ### 1. major_ver and minor_ver must be integers.
  2608. ### 2. The resulting .so will have the prefix "lib".
  2609. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2610. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2611. ###
  2612. ### Note: Use PYTHON2_MODULE()/PYTHON3_MODULE() in order to PEERDIR proper version of PY23_NATIVE_LIBRARY.
  2613. ### Do not PEERDIR any PY*_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2614. ###
  2615. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2616. module PY_ANY_MODULE: DLL_UNIT {
  2617. .SEM=CPP_DYN_LIBRARY_SEM
  2618. when ($MSVC != "yes" && $DARWIN != "yes") {
  2619. LDFLAGS+= -Wl,-Bsymbolic
  2620. }
  2621. when ($USE_ARCADIA_PYTHON == "no") {
  2622. when ($USE_SYSTEM_PYTHON) {
  2623. PEERDIR+=build/platform/python
  2624. }
  2625. otherwise {
  2626. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2627. LDFLAGS+=$PYTHON_LIBRARIES
  2628. }
  2629. }
  2630. }
  2631. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2632. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2633. when ($MODULE_VERSION) {
  2634. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2635. }
  2636. _SONAME=$SONAME$MODULE_VERSION
  2637. # -bundle
  2638. when ($DARWIN == "yes") {
  2639. LDFLAGS+=-flat_namespace
  2640. }
  2641. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2642. MODULE_PREFIX=
  2643. MODULE_SUFFIX=.pyd
  2644. }
  2645. otherwise {
  2646. MODULE_PREFIX=
  2647. MODULE_SUFFIX=.so
  2648. }
  2649. .RESTRICTED=USE_PYTHON2 USE_PYTHON3 PY_SRCS PY_MAIN
  2650. }
  2651. # tag:python-specific
  2652. ### @usage: PY2MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2653. ###
  2654. ### The Python external module for Python2 and any system Python
  2655. ### 1. major_ver and minor_ver must be integers.
  2656. ### 2. The resulting .so will have the prefix "lib".
  2657. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2658. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2659. ###
  2660. ### Note: this module will always PEERDIR Python2 version of PY23_NATIVE_LIBRARY.
  2661. ### Do not PEERDIR PY2_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2662. ###
  2663. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2664. module PY2MODULE: PY_ANY_MODULE {
  2665. PYTHON2_MODULE()
  2666. SET(MODULE_LANG PY2)
  2667. .RESTRICTED=PYTHON3_MODULE PYTHON3_ADDINCL
  2668. }
  2669. # tag:python-specific
  2670. ### @usage: PY3MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2671. ###
  2672. ### The Python external module for Python3 and any system Python
  2673. ### 1. major_ver and minor_ver must be integers.
  2674. ### 2. The resulting .so will have the prefix "lib".
  2675. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2676. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2677. ###
  2678. ### Note: this module will always PEERDIR Python3 version of PY23_NATIVE_LIBRARY.
  2679. ### Do not PEERDIR PY3_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2680. ###
  2681. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2682. module PY3MODULE: PY_ANY_MODULE {
  2683. PYTHON3_MODULE()
  2684. SET(MODULE_LANG PY3)
  2685. .RESTRICTED=PYTHON2_MODULE PYTHON2_ADDINCL
  2686. }
  2687. # tag:python-specific
  2688. ### @usage: PYTHON2_MODULE()
  2689. ###
  2690. ### Use in PY_ANY_MODULE to set it up for Python 2.x.
  2691. macro PYTHON2_MODULE() {
  2692. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2693. PEERDIR+=contrib/tools/python/lib
  2694. }
  2695. SET(ANTLR_PYTHON Python2)
  2696. PYTHON2_ADDINCL()
  2697. }
  2698. # tag:python-specific
  2699. ### @usage: PYTHON3_MODULE()
  2700. ###
  2701. ### Use in PY_ANY_MODULE to set it up for Python 3.x.
  2702. macro PYTHON3_MODULE() {
  2703. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2704. PEERDIR+=contrib/tools/python3/lib
  2705. }
  2706. SET(ANTLR_PYTHON Python3)
  2707. PYTHON3_ADDINCL()
  2708. }
  2709. # tag:r-specific
  2710. ### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2711. ###
  2712. ### The external module for R language.
  2713. ### 1. major_ver and minor_ver must be integers.
  2714. ### 2. The resulting .so will have the prefix "lib".
  2715. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2716. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2717. module R_MODULE: DLL_UNIT {
  2718. .SEM=CPP_DYN_LIBRARY_SEM
  2719. when ($DARWIN == "yes") {
  2720. LDFLAGS+=-flat_namespace -dynamiclib
  2721. }
  2722. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2723. MODULE_PREFIX=lib
  2724. MODULE_SUFFIX=.dll
  2725. }
  2726. ADDINCL(contrib/libs/r-lang)
  2727. }
  2728. ### @usage: DYNAMIC_LIBRARY_FROM(Paths)
  2729. ###
  2730. ### Use specified libraries as sources of DLL
  2731. macro DYNAMIC_LIBRARY_FROM(Path...) {
  2732. PEERDIR($Path)
  2733. WHOLE_ARCHIVE($Path)
  2734. }
  2735. ### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2736. ###
  2737. ### Dynamic library module definition.
  2738. ### 1. major_ver and minor_ver must be integers.
  2739. ### 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
  2740. ### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
  2741. ###
  2742. ### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
  2743. module DLL: DLL_UNIT {
  2744. .SEM=CPP_DYN_LIBRARY_SEM
  2745. SET(MAKE_ONLY_SHARED_LIB yes)
  2746. when ($OS_WINDOWS) {
  2747. MODULE_SUFFIX=.dll
  2748. }
  2749. # TODO: Make it possible to use this syntax
  2750. # DEFAULT(DLL_FOR_DIR no)
  2751. ### FIXME: XXX
  2752. ###when ($DLL_FOR_DIR != "no") {
  2753. ### SRCDIR($DLL_FOR_DIR)
  2754. ### ADDINCL($DLL_FOR_DIR)
  2755. ###}
  2756. }
  2757. ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
  2758. module DLL_TOOL: DLL {
  2759. .SEM=CPP_DYN_LIBRARY_SEM
  2760. # ymake resolves only program nodes as tools.
  2761. .NODE_TYPE=Program
  2762. }
  2763. ### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2764. ###
  2765. ### Executable dynamic library module definition.
  2766. ### 1. major_ver and minor_ver must be integers.
  2767. ### 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
  2768. ### 3. PREFIX allows you to change the prefix of the output file.
  2769. module SO_PROGRAM: DLL {
  2770. .CMD=LINK_EXEC_DYN_LIB
  2771. SET(MODULE_TYPE PROGRAM)
  2772. MODULE_PREFIX=
  2773. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2774. MODULE_SUFFIX=.exe
  2775. }
  2776. otherwise {
  2777. MODULE_SUFFIX=
  2778. }
  2779. }
  2780. DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
  2781. # tag:internal
  2782. ### @usage: DEV_DLL_PROXY() # internal
  2783. ###
  2784. ### The use of this module is strictly prohibited!!!
  2785. ### This is a temporary and project-specific solution.
  2786. module DEV_DLL_PROXY: _BARE_UNIT {
  2787. .NODE_TYPE=Library
  2788. .EXTS=.so .dll .dylib .mf
  2789. .CMD=DLL_PROXY_CMD_MF
  2790. DYNAMIC_LINK=yes
  2791. when ($OS_WINDOWS == "yes") {
  2792. MODULE_SUFFIX=.dll
  2793. }
  2794. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2795. MODULE_PREFIX=lib
  2796. MODULE_SUFFIX=.dylib$MODULE_VERSION
  2797. }
  2798. otherwise {
  2799. MODULE_PREFIX=lib
  2800. MODULE_SUFFIX=.so$MODULE_VERSION
  2801. }
  2802. }
  2803. # tag:internal
  2804. ### @usage: DLL_PROXY() # internal
  2805. ###
  2806. ### The use of this module is strictly prohibited!!!
  2807. ### This is a temporary and project-specific solution.
  2808. module DLL_PROXY: DEV_DLL_PROXY {
  2809. .EXTS=.so .dylib .lib .mf
  2810. .PROXY=yes
  2811. .PEERDIR_POLICY=as_build_from
  2812. SET(PEERDIR_TAGS DLL __EMPTY__)
  2813. when ($OS_WINDOWS == "yes") {
  2814. MODULE_SUFFIX=.lib
  2815. }
  2816. }
  2817. # tag:internal
  2818. ### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
  2819. ###
  2820. ### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
  2821. ### This it needed to transfer their outputs through the library to PROGRAM
  2822. ### or dependent DLL/DYNAMIC_LIBRARY.
  2823. ###
  2824. ### Note: this is temporary solution until support of `super-global` variables come
  2825. ### which will enable transfer of some properties though final targets like DLLs.
  2826. macro DYNAMIC_DEPS(Path...) {
  2827. # PEERDIR as macro completely ignored in place where this macro applies
  2828. SET_APPEND(PEERDIR $Path)
  2829. }
  2830. # tag:internal
  2831. ### @usage: DYNAMIC_LIBRARY() # internal
  2832. ###
  2833. ### The use of this module is strictly prohibited except LGPL-related opensourcing
  2834. ### This provides linkable DLL module which brings its results to programs and tests
  2835. ### for seamless testing and packaging
  2836. multimodule DYNAMIC_LIBRARY {
  2837. module DLL_BIN: DLL {
  2838. .PROXY=yes
  2839. .IGNORED=PROVIDES
  2840. SET(MODULE_TAG DLL)
  2841. }
  2842. module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
  2843. .CMD=TOUCH_UNIT_MF
  2844. .PEERDIRSELF=DLL_BIN
  2845. .IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
  2846. .ALLOWED=DYNAMIC_DEPS
  2847. SET(PEERDIR_TAGS DLL_LIB __EMPTY__)
  2848. _BARE_MODULE()
  2849. DYNAMIC_LINK=yes
  2850. MODULE_SUFFIX=.pkg.fake
  2851. PEERDIR+=build/platform/local_so
  2852. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no" && $SANITIZE_HEADERS && $SANITIZE_HEADERS != "no") {
  2853. PEERDIR += library/cpp/sanitizer/include
  2854. }
  2855. # disable credits generation for static library
  2856. SET(CREDITS_FLAGS)
  2857. }
  2858. }
  2859. ### @usage: GLOBAL_SRCS(filenames...)
  2860. ###
  2861. ### Make all source files listed as GLOBAL.
  2862. ### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
  2863. ### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
  2864. ### recognized for GLOBAL_SRCS in contrast to SRCS macro.
  2865. ###
  2866. ### @example:
  2867. ### Consider the file to ya.make:
  2868. ###
  2869. ### LIBRARY()
  2870. ### GLOBAL_SRCS(foo.cpp bar.cpp)
  2871. ### END()
  2872. ###
  2873. ### @see: [SRCS()](#macro_SRCS)
  2874. macro GLOBAL_SRCS(Files...) {
  2875. SRCS(${pre=GLOBAL :Files})
  2876. }
  2877. ### @usage: ALL_SRCS([GLOBAL] filenames...)
  2878. ###
  2879. ### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
  2880. ### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
  2881. ### as the first argument and is equivalent to call to SRCS macro otherwise.
  2882. ###
  2883. ### @example:
  2884. ###
  2885. ### LIBRARY()
  2886. ### SET(MAKE_IT_GLOBAL GLOBAL)
  2887. ### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
  2888. ### END()
  2889. ###
  2890. ### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
  2891. macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
  2892. SRCS(${pre=$GLOBAL :Files})
  2893. }
  2894. ### @usage: _DLL_COMPATIBLE_LIBRARY # internal
  2895. ###
  2896. ### Base module to place DLLs into multimodules back to back with libraries.
  2897. ### In order to function properly all modules in multimodule shall have the
  2898. ### same set of arguments. So this module is just library that accepts but
  2899. ### ignores all DLL arguments.
  2900. module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
  2901. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2902. .ARGS_PARSER=DLL
  2903. }
  2904. @import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
  2905. # as SRCS in packages use macro BUNDLE_SRCS!
  2906. PACKED_PACKAGE_ARGS=
  2907. PACKED_PACKAGE_EXT=
  2908. ### @usage: PACK(archive_type)
  2909. ###
  2910. ### 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`
  2911. ###
  2912. ### Is not allowed other module types than PACKAGE().
  2913. ###
  2914. ### @see: [PACKAGE()](#module_PACKAGE)
  2915. macro PACK(Ext) {
  2916. SET(PACKED_PACKAGE_EXT $Ext)
  2917. }
  2918. PACKAGE_STRICT_VALUE=
  2919. macro PACKAGE_STRICT() {
  2920. SET(PACKAGE_STRICT_VALUE yes)
  2921. }
  2922. ### @usage: PACKAGE(name)
  2923. ###
  2924. ### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
  2925. ### 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.
  2926. ### The data can be optionally packed if macro PACK() is used.
  2927. ###
  2928. ### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
  2929. ###
  2930. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2931. ###
  2932. ### @see: [PACK()](#macro_PACK)
  2933. multimodule PACKAGE {
  2934. module PACKAGE_FINAL: _BASE_UNIT {
  2935. .CMD=TOUCH_PACKAGE_MF
  2936. .ALIASES=SRCS=FILES
  2937. .ALLOWED=PACK
  2938. .PEERDIRSELF=PACKAGE_UNION
  2939. .USE_PEERS_LATE_OUTS=yes
  2940. .PEERDIR_POLICY=as_build_from
  2941. .FINAL_TARGET=yes
  2942. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2 PY3 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM PACKAGE_UNION)
  2943. SET(MODULE_SUFFIX .final.pkg.fake)
  2944. SET(DONT_RESOLVE_INCLUDES yes)
  2945. NO_PLATFORM()
  2946. when ($PACKED_PACKAGE_EXT) {
  2947. PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
  2948. }
  2949. SET(NEED_PLATFORM_PEERDIRS no)
  2950. }
  2951. module PACKAGE_UNION: UNION {
  2952. .CMD=UNION_CMD
  2953. .FINAL_TARGET=no
  2954. .ALLOWED=PACK
  2955. .IGNORED=VCS_INFO_FILE
  2956. SET(MODULE_SUFFIX .pkg.fake)
  2957. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2 PY3 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM PACKAGE_UNION)
  2958. DISABLE(START_TARGET)
  2959. }
  2960. }
  2961. TOUCH_GROUP=$TOUCH_PACKAGE ${kv;hide:"p CI"}
  2962. ### @usage: CI_GROUP()
  2963. ###
  2964. ### Module collects what is described directly inside it transitively by PEERDIRs.
  2965. ### No particular layout of built artifacts is implied. This module is needed primarily for CI dependency analysis and may not trigger builds at all.
  2966. ###
  2967. ### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
  2968. module CI_GROUP: _BARE_UNIT {
  2969. .CMD=TOUCH_GROUP
  2970. .PEERDIR_POLICY=as_build_from
  2971. .FINAL_TARGET=yes
  2972. .RESTRICTED=SRCS
  2973. .USE_PEERS_LATE_OUTS=yes
  2974. MODULE_SUFFIX=.ci.pkg.fake
  2975. PEERDIR_TAGS=CPP_PROTO PY3 PY3_NATIVE PY3_BIN PY3TEST_PROGRAM YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE DLL
  2976. }
  2977. # tag:generic tag:internal
  2978. TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
  2979. # tag:proto
  2980. ### @usage: RESOLVE_PROTO()
  2981. ###
  2982. ### Enable include resolving within UNIONs and let system .proto being resolved
  2983. ### among .proto/.gztproto imports
  2984. ###
  2985. ### Note: it is currently impossible to enable resolving only for .proto, so resolving is enabled for all supported files
  2986. ### also we only add ADDINCL for stock protobuf. So use this macro with care: it may cause resolving problems those are
  2987. ### to be addressed by either ADDINCLs or marking them as TEXT. Please contact devtools for details.
  2988. macro RESOLVE_PROTO() {
  2989. SET(DONT_RESOLVE_INCLUDES no)
  2990. ADDINCL(FOR proto $PROTOBUF_PATH)
  2991. }
  2992. ### @usage: UNION(name)
  2993. ###
  2994. ### Collection of PEERDIR dependencies, files and artifacts.
  2995. ### UNION doesn't build its peers, just provides those to modules depending on it.
  2996. ### 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).
  2997. ###
  2998. ### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
  2999. ###
  3000. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  3001. module UNION: _BASE_UNIT {
  3002. .CMD=UNION_CMD_MF
  3003. .FINAL_TARGET=no
  3004. .ALIASES=SRCS=FILES
  3005. .ALLOWED=EXPLICIT_OUTPUTS
  3006. .IGNORED=VCS_INFO_FILE
  3007. NO_PLATFORM()
  3008. SET(MODULE_SUFFIX .pkg.fake)
  3009. SET(DONT_RESOLVE_INCLUDES yes)
  3010. SET(NEED_PLATFORM_PEERDIRS no)
  3011. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN DLL PACKAGE_UNION
  3012. UNION_OUTS=${hide;late_out:AUTO_INPUT}
  3013. when ($_UNION_EXPLICIT_OUTPUTS) {
  3014. UNION_OUTS=$_EXPAND_INS_OUTS($_UNION_EXPLICIT_OUTPUTS)
  3015. }
  3016. }
  3017. # tag:python-specific
  3018. module _PY_PACKAGE: UNION {
  3019. .EXTS=.py
  3020. .ALLOWED=GRPC USE_SKIFF
  3021. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3022. ENABLE(PY_PROTOS_FOR)
  3023. SET(PEERDIR_TAGS PY_PROTO)
  3024. SET(DONT_RESOLVE_INCLUDES no)
  3025. }
  3026. # tag:python-specific tag:deprecated tag:internal
  3027. ### @usage: PY_PACKAGE(name) # internal, deprecated
  3028. ###
  3029. ### This is module created via PY_PROTOS_FOR() macro
  3030. module PY_PACKAGE: _PY_PACKAGE {
  3031. .ALIASES=SRCS=SRCS
  3032. .FINAL_TARGET=yes
  3033. }
  3034. # tag:internal
  3035. ### @usage: _SET_FIRST_VALUE(name args...) # internal
  3036. ###
  3037. ### This macro sets the value of `name` variable to the value of next argument
  3038. macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
  3039. SET($NAME $VALUE)
  3040. }
  3041. # tag:python-specific
  3042. PY_NAMESPACE_VALUE=
  3043. # tag:python-specific
  3044. ### @usage: PY_NAMESPACE(prefix)
  3045. ###
  3046. ### Sets default Python namespace for all python sources in the module.
  3047. ### Especially suitable in PROTO_LIBRARY where Python sources are generated and there is no PY_SRCS to place NAMESPACE parameter.
  3048. macro PY_NAMESPACE(Arg) {
  3049. SET(PY_NAMESPACE_VALUE $Arg)
  3050. }
  3051. # tag:internal
  3052. ### @usage: _SRCS_NO_GLOBAL(files...) # internal
  3053. ###
  3054. ### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
  3055. ### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
  3056. ### Note: this macro changes order of source files.
  3057. macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
  3058. SRCS($GLOBAL $FILES)
  3059. }
  3060. # tag:java-specific
  3061. JAVA_VCS_MF_ARG=
  3062. COMPILE_JAVA_MF=${hide:JAVA_FAKEID} $COMPILE_JAVA $MAVEN_EXPORT_CMD
  3063. # tag:java-specific
  3064. when ($EXT_JAVA_VCS_INFO == "yes") {
  3065. JAVA_VCS_MF_ARG=--vcs-mf $VCS_JAVA
  3066. COMPILE_JAVA_MF=${hide:JAVA_FAKEID} $GENERATE_VCS_JAVA_INFO_NODEP && $COMPILE_JAVA $MAVEN_EXPORT_CMD
  3067. }
  3068. # tag:java-specific
  3069. EXT_JAVA_VCS_INFO=no
  3070. ### @usage: EMBED_JAVA_VCS_INFO()
  3071. ###
  3072. ### Embed manifest with vcs info into `EXTERNAL_JAVA_LIBRARY`
  3073. ### By default this is disabled.
  3074. macro EMBED_JAVA_VCS_INFO() {
  3075. .SEM=add_vcs_info_to_mf ${hide;output:"VcsInfoMfDummy.java"}
  3076. ENABLE(EXT_JAVA_VCS_INFO)
  3077. }
  3078. # tag:java-specific tag:internal
  3079. ### @usage: EXTERNAL_JAVA_LIBRARY() #internal
  3080. ###
  3081. ### EXTERNAL_JAVA_LIBRARY() is a module for creating a .jar file using non-Java code (generators etc.)
  3082. ### Unlike regular JAVA_LIBRARY this module doesn't produce .pom file, so it cannot be exported to Maven itself.
  3083. ### PEERDIR it from JAVA_LIBRARY or JAVA_PROGRAM for export to Maven.
  3084. module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
  3085. .EXTS=.jsrc .java .jar .mf
  3086. .NODE_TYPE=Bundle
  3087. .CMD=COMPILE_JAVA_MF
  3088. # TODO(YMAKE-27) all contribs involved into opensource export must be JAVA_CONTRIB modules
  3089. # and this module must not be intended for export. Such hange will break JBUILD and thus is
  3090. # blocked on YMAKE-27
  3091. .SEM=JAVA_CONTRIB_SEM
  3092. .PEERDIR_POLICY=as_build_from
  3093. .FINAL_TARGET=no
  3094. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  3095. .ALLOWED=EMBED_JAVA_VCS_INFO
  3096. .RESTRICTED=EXTERNAL_JAR
  3097. .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS
  3098. PEERDIR(build/platform/java/jdk)
  3099. PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR
  3100. when ($KOTLIN_PROTO == "yes") {
  3101. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION}
  3102. }
  3103. when ($MAVEN_EXPORT == "yes") {
  3104. when ($MAVEN_DEPLOY == "yes") {
  3105. PEERDIR+=build/external_resources/maven
  3106. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM && $MAVEN_DEPLOY_CMD
  3107. }
  3108. otherwise {
  3109. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM
  3110. }
  3111. MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GOUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
  3112. }
  3113. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL PACKAGE_UNION
  3114. HAS_MANAGEABLE_PEERS=yes
  3115. DYNAMIC_LINK=yes
  3116. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  3117. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  3118. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  3119. when ($PACKAGE_PREFIX) {
  3120. PACKAGE_PREFIX_ARGS=--package-prefix=$PACKAGE_PREFIX
  3121. }
  3122. DISABLE(NEED_PLATFORM_PEERDIRS)
  3123. NO_PLATFORM()
  3124. SET(MODULE_SUFFIX .jar)
  3125. SET(MODULE_LANG JAVA)
  3126. _WHEN_EXPORT_GRADLE()
  3127. }
  3128. # tag:java-specific
  3129. ALL_JAR_SOURCES=
  3130. LINT_JAVA_SOURCES=
  3131. ALL_SRCDIRS=
  3132. LINK_JAR_RESOURCES=
  3133. LINK_JAR_JSOURCES=
  3134. JAR_GEN_SRCS=
  3135. JAR_GEN_JSRCS=
  3136. macro _JAR_SRCS(SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], RESOURCES?"yes":"no", Globs...) {
  3137. _CHECK_JAVA_SRCDIR($SRCDIR)
  3138. SET_APPEND(ALL_SRCDIRS $SRCDIR)
  3139. SET(VAR_SALT $SRCDIR $Globs $EXCLUDE $PACKAGE_PREFIX $RESOURCES $FILES)
  3140. SET(JAR_SRCS_GLOB uniq_${hash:VAR_SALT})
  3141. _LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE})
  3142. SET_APPEND(LINT_JAVA_SOURCES \${input;rootrel;ext=.java:${JAR_SRCS_GLOB}})
  3143. 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})
  3144. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_RESOURCES ${quo:SRCDIR} ${BINDIR}/cls ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt)
  3145. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_JSOURCES ${quo:SRCDIR} ${BINDIR}/src ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt)
  3146. _FILL_JAR_GEN_SRCS(JAR_GEN_SRCS JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst $KT_SRCLIST ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt $Globs EXCLUDE $EXCLUDE)
  3147. _FILL_JAR_GEN_SRCS(JAR_GEN_JSRCS SRC_JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst $KT_SRCLIST ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt $Globs EXCLUDE $EXCLUDE)
  3148. }
  3149. macro IDEA_JAR_SRCS(Args...) {
  3150. _JAR_SRCS($Args)
  3151. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  3152. }
  3153. macro _HASH_HELPER(Args...) {
  3154. .CMD=${hash:Args}
  3155. .SEM=${hash:Args}
  3156. }
  3157. macro _GENTAR_HELPER(OUT_DIR[], Args...) {
  3158. .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"}
  3159. }
  3160. # tag:java-specific
  3161. RUN_JAR_PROG_CP_PRE=@
  3162. RUN_JAR_PROG_CP_SUF=.cplst
  3163. when($JDK_VERSION == "8") {
  3164. RUN_JAR_PROG_CP_PRE=
  3165. RUN_JAR_PROG_CP_SUF=
  3166. }
  3167. # tag:java-specific
  3168. JDK_LATEST_VERSION=19
  3169. JDK_LATEST_PEERDIR=build/platform/java/jdk/jdk${JDK_LATEST_VERSION}
  3170. # tag:java-specific
  3171. 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}", STDOUT="", STDOUT_NOAUTO="", Args...) {
  3172. _LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR})
  3173. _CHECK_RUN_JAVA_PROG_CLASSPATH($CLASSPATH)
  3174. .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
  3175. .CMD=${kv;hide:"p RJ"} ${kv;hide:"pc blue"} ${hide:JAVA_FAKEID} ${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"} ${pre=--file=:STDOUT} ${output;hide:STDOUT} ${pre=--file=:STDOUT_NOAUTO} ${output;hide;noauto:STDOUT_NOAUTO} $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}
  3176. }
  3177. # tag:java-specific
  3178. macro _DO_1_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq", Args...) {
  3179. _DO_2_RUN_JAR_PROGRAM($Args IN_DIRS_VAR $IN_DIRS_VAR IN_DIRS_INPUTS ${"$"}{input;hide:$IN_DIRS_VAR})
  3180. }
  3181. # tag:java-specific
  3182. macro RUN_JAVA_PROGRAM(Args...) {
  3183. _DO_1_RUN_JAR_PROGRAM($Args IN_DIRS_VAR uniq_${hash:Args})
  3184. }
  3185. # tag:java-specific
  3186. _JAR_ANN_PROCESSORS=
  3187. _JAR_ANN_PROC_OPT_PREFIX=
  3188. macro JAR_ANNOTATION_PROCESSOR(Classes...) {
  3189. SET_APPEND(_JAR_ANN_PROCESSORS $Classes)
  3190. SET(_JAR_ANN_PROC_OPT_PREFIX -processor)
  3191. # for ya ide idea only
  3192. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Classes)
  3193. }
  3194. # tag:java-specific
  3195. macro _JAR_ANN_PROC_OPTS(Classes...) {
  3196. .CMD=$_JAR_ANN_PROC_OPT_PREFIX ${join=,:Classes}
  3197. }
  3198. # tag:java-specific
  3199. macro _NOOP_MACRO(Args...) {
  3200. ENABLE(UNUSED_MACRO)
  3201. }
  3202. # tag:java-specific
  3203. module _JAR_BASE: _BARE_UNIT {
  3204. .NODE_TYPE=Bundle
  3205. .CMD=TOUCH_UNIT
  3206. .PEERDIR_POLICY=as_build_from
  3207. .FINAL_TARGET=no
  3208. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  3209. .ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE
  3210. .DEFAULT_NAME_GENERATOR=TwoDirNames
  3211. .RESTRICTED=WITH_JDK RESOURCE RESOURCE_FILES
  3212. .GLOBAL=EXPORT_GRADLE_PROJECT_COORDS
  3213. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__
  3214. HAS_MANAGEABLE_PEERS=yes
  3215. DYNAMIC_LINK=yes
  3216. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  3217. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  3218. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  3219. DISABLE(NEED_PLATFORM_PEERDIRS)
  3220. NO_PLATFORM()
  3221. VCS_JAVA=${suf=.__vcs_version__.mf:TARGET}
  3222. SET(MODULE_LANG JAVA)
  3223. _WHEN_EXPORT_GRADLE()
  3224. }
  3225. JAVA_CONTRIB_PROXY_SEM=IGNORED
  3226. # tag:java-specific
  3227. module JAVA_CONTRIB_PROXY: _JAR_BASE {
  3228. .SEM=JAVA_CONTRIB_PROXY_SEM
  3229. }
  3230. # tag:java-specific
  3231. macro _FETCH_CONTRIB(Id, Out, SBR="sbr:") {
  3232. .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"}
  3233. ADD_CHECK(check.resource $Id)
  3234. }
  3235. # tag:java-specific
  3236. LOCAL_JAR_PATH=
  3237. LOCAL_SOURCES_JAR_PATH=
  3238. JAR_RESOURCE_ID=
  3239. SRC_RESOURCE_ID=
  3240. FETCH_SRCS_JAR=
  3241. FETCH_TARGET_JAR=
  3242. FETCH_CONTRIB_JAR=${hide:JAVA_FAKEID} $FETCH_TARGET_JAR $FETCH_SRCS_JAR
  3243. # tag:java-specific
  3244. macro JAR_RESOURCE(Id) {
  3245. SET(JAR_RESOURCE_ID $Id)
  3246. }
  3247. # tag:java-specific
  3248. macro SRC_RESOURCE(Id) {
  3249. SET(SRC_RESOURCE_ID $Id)
  3250. }
  3251. # tag:java-specific
  3252. macro LOCAL_JAR(File) {
  3253. SET(LOCAL_JAR_PATH $File)
  3254. }
  3255. # tag:java-specific
  3256. macro LOCAL_SOURCES_JAR(File) {
  3257. SET(LOCAL_SOURCES_JAR_PATH $File)
  3258. }
  3259. JAVA_CONTRIB_SEM= \
  3260. consumer_classpath $EXPORT_GRADLE_PROJECT_COORDS ${hide:TARGET} ${hide:AUTO_INPUT} && \
  3261. peers_closure $MANAGED_PEERS_CLOSURE && \
  3262. peers_closure_coords $EXPORT_GRADLE_PROJECT_COORDS_GLOBAL && \
  3263. IGNORED
  3264. # tag:java-specific
  3265. module JAVA_CONTRIB: _JAR_BASE {
  3266. .CMD=FETCH_CONTRIB_JAR
  3267. .SEM=JAVA_CONTRIB_SEM
  3268. .FINAL_TARGET=yes
  3269. .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS
  3270. when ($JAR_RESOURCE_ID) {
  3271. FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX})
  3272. }
  3273. otherwise {
  3274. when ($LOCAL_JAR_PATH) {
  3275. FETCH_TARGET_JAR= && $FS_TOOLS copy ${input:LOCAL_JAR_PATH} $TARGET
  3276. }
  3277. otherwise {
  3278. FETCH_TARGET_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:BINDIR} $JDK_RESOURCE/bin/jar cfvm $TARGET $VCS_JAVA .
  3279. PEERDIR+=build/platform/java/jdk
  3280. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3281. }
  3282. }
  3283. when ($SRC_RESOURCE_ID) {
  3284. FETCH_SRCS_JAR= && $_FETCH_CONTRIB($SRC_RESOURCE_ID ${BINDIR}/${REALPRJNAME}-sources.jar)
  3285. }
  3286. otherwise {
  3287. when ($LOCAL_SOURCES_JAR_PATH) {
  3288. FETCH_SRCS_JAR= && $FS_TOOLS copy ${input:LOCAL_SOURCES_JAR_PATH} {output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME}
  3289. }
  3290. otherwise {
  3291. 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 .
  3292. PEERDIR+=build/platform/java/jdk
  3293. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3294. }
  3295. }
  3296. when ($MAVEN_EXPORT == "yes") {
  3297. _MAKEFILE_INCLUDE_LIKE_DEPS+=pom.xml
  3298. FETCH_CONTRIB_JAR+= && $MAVEN_EXPORT_GEN_DEPLST
  3299. }
  3300. SET(MODULE_SUFFIX .jar)
  3301. _SETUP_MAVEN_EXPORT_COORDS_IF_NEED($MODDIR)
  3302. }
  3303. MAKE_JAVA_CLASSPATH_FILE=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} ${input;hide:"build/scripts/process_command_files.py"}
  3304. # tag:kotlin-specific
  3305. KOTLINC_OPTS_VALUE=
  3306. # tag:kotlin-specific
  3307. KT_SRCLIST=${BINDIR}/misc/all-kt-sources.txt
  3308. KT_SRSCLIST_FLAG=--kotlin $KT_SRCLIST
  3309. KT_CLASSES_DIR=${BINDIR}/kt_cls
  3310. KT_CLASSPATH=${BINDIR}/kt_cp.txt
  3311. COLLECT_KT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/kt_bfg.txt -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file
  3312. LINK_KT_CLASSPATH=${MAKE_JAVA_CLASSPATH_FILE} ${BINDIR}/kt_bfg.txt $KT_CLASSPATH && $FS_TOOLS md $KT_CLASSES_DIR
  3313. COMPILE_KT= \
  3314. ${cwd:ARCADIA_BUILD_ROOT} ${env:"LC_ALL=en_US.UTF-8"} $YMAKE_PYTHON ${input:"build/scripts/with_pathsep_resolve.py"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} --kotlin --sources-list $KT_SRCLIST \
  3315. $JDK_RESOURCE/bin/java -jar $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} \
  3316. @$KT_SRCLIST -classpath @$KT_CLASSPATH $KOTLINC_FLAGS_VALUE -d $KT_CLASSES_DIR $KOTLINC_OPTS_VALUE
  3317. ALL_KT_COMMANDS=
  3318. KT_CLASSPATH_ITEM=
  3319. # tag:kotlin-specific
  3320. KT_KAPT_SOURCES_DIR=${BINDIR}/kapt_gen_src
  3321. KT_KAPT_STUBS_DIR=${BINDIR}/kapt_gen_stubs
  3322. KT_KAPT_AP_CLASSPATH=
  3323. KT_KAPT_PLUGIN_OPTS=-P plugin:org.jetbrains.kotlin.kapt3:sources=${KT_KAPT_SOURCES_DIR} -P plugin:org.jetbrains.kotlin.kapt3:classes=${KT_CLASSES_DIR} -P plugin:org.jetbrains.kotlin.kapt3:stubs=${KT_KAPT_STUBS_DIR} -P plugin:org.jetbrains.kotlin.kapt3:aptMode=stubsAndApt
  3324. ### @usage: KAPT_OPTS(opts...)
  3325. ###
  3326. ### Used to specify annotation processor qualified class names.
  3327. ### If specified multiple times, only last specification is used.
  3328. macro KAPT_OPTS(Args...) {
  3329. SET_APPEND(KT_KAPT_PLUGIN_OPTS ${pre=-P :Args})
  3330. }
  3331. ### @usage: KAPT_ANNOTATION_PROCESSOR(processors...)
  3332. ###
  3333. ### Used to specify annotation processor qualified class names.
  3334. ### If specified multiple times, only last specification is used.
  3335. macro KAPT_ANNOTATION_PROCESSOR(Args...) {
  3336. KAPT_OPTS(${pre="plugin:org.jetbrains.kotlin.kapt3:processors=":Args})
  3337. }
  3338. ### @usage: KAPT_ANNOTATION_PROCESSOR_CLASSPATH(jars...)
  3339. ###
  3340. ### Used to specify classpath for annotation processors.
  3341. ### If specified multiple times, all specifications are used.
  3342. macro KAPT_ANNOTATION_PROCESSOR_CLASSPATH(Args...) {
  3343. PEERDIR($Args)
  3344. SET_APPEND(KT_KAPT_AP_CLASSPATH $Args)
  3345. }
  3346. # tag:java-specific
  3347. JAVAC_CMD=$JDK_RESOURCE/bin/javac
  3348. 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
  3349. # tag:java-specific tag:codenav
  3350. JAVA_YNDEXING=no
  3351. # tag:java-specific
  3352. when ($USE_SYSTEM_KYTHE) {
  3353. KYTHE_RESOURCE=$USE_SYSTEM_KYTHE
  3354. }
  3355. otherwise {
  3356. KYTHE_RESOURCE=$KYTHE_RESOURCE_GLOBAL
  3357. }
  3358. # tag:java-specific tag:codenav
  3359. _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
  3360. _DO_JAVA_YNDEXING=
  3361. # tag:java-specific
  3362. SOURCES_JAR=no
  3363. when ($BUILD_TYPE == "DEBUG" && $NO_DEBUGINFO != "yes") {
  3364. SOURCES_JAR=yes
  3365. }
  3366. _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 .
  3367. _PACK_SRC_JAR=
  3368. # tag:java-specific
  3369. _PACK_JNI=
  3370. _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
  3371. # tag:java-specific
  3372. _MAKE_JSTYLE_FILE_LIST=
  3373. # tag:java-specific
  3374. _LINK_UBERJAR=
  3375. _UBERJAR_SELF=
  3376. _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} \
  3377. && $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} $BINDIR/_empty/META-INF \
  3378. && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} $BINDIR/_empty/META-INF/MANIFEST.MF \
  3379. && $UPDATE_VCS_JAVA_INFO_NODEP($TARGET) \
  3380. && ${cwd;suf=/_empty:BINDIR} ${JDK_RESOURCE}/bin/jar ufv ${TARGET} META-INF/MANIFEST.MF \
  3381. && $JDK_RESOURCE/bin/jar ufvm $TARGET $VCS_JAVA
  3382. # tag:java-specific
  3383. macro _PACK_JAR_HELPER(Out) {
  3384. .CMD=${cwd;suf=/cls:BINDIR} ${env:"LC_ALL=en_US.UTF-8"} $JDK_RESOURCE/bin/jar cfvm $Out $VCS_JAVA .
  3385. }
  3386. # tag:java-specific
  3387. macro _JAVAC_RUN_HELPER(JAVAC_CMD_WITH_ARGS...) {
  3388. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${env:"LC_ALL=en_US.UTF-8"} $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
  3389. }
  3390. macro _ADD_HIDDEN_INPUTS(Inputs...) {
  3391. .CMD=${input;hide:Inputs}
  3392. }
  3393. # tag:java-specific
  3394. 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
  3395. ERROR_PRONE_2_7_1_FORCED_OPTS=-Xep:InlineMeInliner:OFF -Xep:SameNameButDifferent:OFF
  3396. # tag:java-specific
  3397. macro _ADD_OPTS_IF_NON_EMPTY(Opt, Args...) {
  3398. .CMD=${pre=$Opt :Args}
  3399. }
  3400. macro _ADD_GEN_POM_FROM_COORD_FILES_ARGS(Deps...) {
  3401. .CMD=${pre=--deps-coords ;ext=.jar;suf=.mvn_coords:Deps}
  3402. }
  3403. MAVEN_EXPORT_OUT_DIR_FLAG=$_ADD_OPTS_IF_NON_EMPTY(--output-dir ${MAVEN_EXPORT_OUT_DIR})
  3404. MAVEN_EXPORT_SOURCE_DIRS=$_ADD_OPTS_IF_NON_EMPTY(--source-dirs ${ALL_SRCDIRS})
  3405. MAVEN_EXPORT_DEPS_COORS=$_ADD_GEN_POM_FROM_COORD_FILES_ARGS(${MANAGED_PEERS_CLOSURE})
  3406. MAVEN_EXPORT_OUT_DIR=
  3407. MAVEN_EXPORT=no
  3408. MAVEN_DEPLOY=no
  3409. MAVEN_DEPLOY_SOURCES=
  3410. MAVEN_EXPORT_VERSION={vcs_revision}
  3411. MAVEN_EXPORT_GEN_DEPLST= \
  3412. $WRITER_PY \
  3413. --file ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mvn_coords:REALPRJNAME} \
  3414. --ya-start-command-file -m ${pre=D=:MAVEN_EXPORT_COORDS_GLOBAL} ${pre=E=:EXCLUDED_MAVEN_EXPORT_COORDS_GLOBAL} --ya-end-command-file \
  3415. ${hide:APPLIED_EXCLUDES}
  3416. MAVEN_EXPORT_GEN_POM=${kv;hide:"mvn_export yes"} \
  3417. $YMAKE_PYTHON ${input:"build/scripts/generate_pom.py"} \
  3418. --from-coord-files \
  3419. --vcs-info $(VCS)/vcs.json \
  3420. --target-path $MODDIR \
  3421. $MAVEN_EXPORT_SOURCE_DIRS \
  3422. $MAVEN_EXPORT_DEPS_COORS \
  3423. $MAVEN_EXPORT_OUT_DIR_FLAG \
  3424. --target-coords ${suf=.mvn_coords:TARGET} \
  3425. --pom-path ${output:"pom.xml"}
  3426. MAVEN_DEPLOY_CMD=$YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} $MAVEN_BIN \
  3427. deploy:deploy-file -DpomFile=$BINDIR/pom.xml \
  3428. -Dfile=$TARGET -DrepositoryId=$MAVEN_REPO_ID -Durl=$MAVEN_REPO_URL -Djava.net.preferIPv4Addresses=false -Djava.net.preferIPv6Addresses=true \
  3429. ${MAVEN_DEPLOY_SOURCES} \
  3430. $_ADD_OPTS_IF_NON_EMPTY(-gs $MAVEN_EXPORT_SETTINGS) \
  3431. $_ADD_OPTS_IF_NON_EMPTY(-s $MAVEN_EXPORT_SETTINGS)
  3432. MAVEN_EXPORT_CMD=
  3433. # tag:java-specific
  3434. JAVA_COVERAGE_SRCLIST_FLAG=--coverage ${output;pre=${MODULE_PREFIX};suf=.cpsf:REALPRJNAME} --source-root ${ARCADIA_ROOT}
  3435. JAVA_COVERAGE_SRCLIST=
  3436. PREPARE_JAVA_BUILD_DIRS=$FS_TOOLS md ${BINDIR}/cls && $FS_TOOLS md ${BINDIR}/misc
  3437. EXTRACT_GENDIRS=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --unpack --ext .gentar ${ext=.gentar:AUTO_INPUT}
  3438. 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
  3439. COLLECT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/bfg.txt -m --ya-start-command-file ${rootrel:MANAGED_PEERS_CLOSURE} $KT_CLASSPATH_ITEM --ya-end-command-file
  3440. LINK_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/bfg.txt ${ARCADIA_BUILD_ROOT}/bfg.jar
  3441. COMPILE_JAVA_SRCLIST=$_JAVAC_RUN_HELPER($JAVAC_CMD)
  3442. PACK_JAR=$_PACK_JAR_HELPER($TARGET)
  3443. # NOTE: No && before LINK_JAR_RESOURCES, ALL_KT_COMMANDS and JAR_GEN_SRCS needed since those vars either empty or starts with &&
  3444. LINK_JAR=${hide:JAVA_FAKEID} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"} \
  3445. $PREPARE_JAVA_BUILD_DIRS \
  3446. && $EXTRACT_GENDIRS \
  3447. && $COLLECT_JAVA_SRCLIST \
  3448. $JAR_GEN_SRCS \
  3449. $ALL_KT_COMMANDS \
  3450. && $COLLECT_CLASSPATH \
  3451. && $LINK_CLASSPATH \
  3452. && $COMPILE_JAVA_SRCLIST \
  3453. $LINK_JAR_RESOURCES \
  3454. && ${cwd;suf=/cls:BINDIR} $GENERATE_VCS_JAVA_INFO_NODEP . \
  3455. $_PACK_SRC_JAR \
  3456. $_PACK_JNI \
  3457. && $PACK_JAR \
  3458. $_DO_JAVA_YNDEXING \
  3459. $_MAKE_JSTYLE_FILE_LIST \
  3460. $_LINK_UBERJAR \
  3461. $MAVEN_EXPORT_CMD \
  3462. $_ADD_HIDDEN_INPUTS($JAVA_EXTERNAL_DEPENDENCIES_VALUE)
  3463. # tag:java-specific
  3464. _EXT_SRC_JAR=
  3465. _EXT_JAR=
  3466. _COPY_EXT_SRC_JAR= && $FS_TOOLS md ${BINDIR}/empty && ${cwd;suf=/empty:BINDIR} $JDK_RESOURCE/bin/jar cfvM ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME} .
  3467. _DO_USE_EXT_JAR=${hide:JAVA_FAKEID} $FS_TOOLS copy ${input:_EXT_JAR} $TARGET $_COPY_EXT_SRC_JAR $MAVEN_EXPORT_CMD
  3468. _DO_COPY_EXT_SRC_JAR= && $FS_TOOLS copy $_EXT_SRC_JAR ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
  3469. macro JAVA_RESOURCE(JAR, SOURCES="") {
  3470. SET(_EXT_SRC_JAR $SOURCES)
  3471. SET(_EXT_JAR $JAR)
  3472. }
  3473. # tag:java-specific tag:fbs
  3474. JAVA_FLATBUFFERS_VERSION = 2.0.0
  3475. # tag:java-specific
  3476. module _COMPILABLE_JAR_BASE : _JAR_BASE {
  3477. # flatbuffers-java
  3478. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3479. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3480. # protobuf-java
  3481. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3482. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3483. # protobuf-javalite
  3484. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3485. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3486. # protobuf-java-util
  3487. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  3488. 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})
  3489. }
  3490. _JAR_MAIN_CLASS=
  3491. macro JAR_MAIN_CLASS(Class) {
  3492. SET(_JAR_MAIN_CLASS ${Class})
  3493. }
  3494. _JAR_MAIN_SEM=
  3495. _ADD_JAR_MAIN_SEM= && app_main_class ${_JAR_MAIN_CLASS}
  3496. GRADLE_EXPORT_PUBLISHING=no
  3497. _GRADLE_EXPORT_PUBLISHING_SEM=
  3498. PUBLISH_MAVEN_VERSION=no
  3499. _DO_GRADLE_EXPORT_PUBLISHING_SEM= && publish True && publish_group $MAVEN_EXPORT_GOUP_ID && publish_version $PUBLISH_MAVEN_VERSION
  3500. BUILD_JAR_SEM= \
  3501. jar $MODDIR $REALPRJNAME ${hide:TARGET} ${hide:AUTO_INPUT} && \
  3502. applied_excludes $EXCLUDED_EXPORT_GRADLE_PROJECT_COORDS_GLOBAL ${hide:APPLIED_EXCLUDES} && \
  3503. excludes_rules $EXCLUDE_VALUE && \
  3504. consumer_classpath $EXPORT_GRADLE_PROJECT_COORDS $_JAR_MAIN_SEM $_GRADLE_EXPORT_PUBLISHING_SEM
  3505. ### _EXPORT_GRADLE_TARGET_ATTR(NAME, VALUE...)
  3506. ###
  3507. ### Add target attribute `NAME` for .SEM if `VALUE` is non-empty
  3508. ### ` && $Name $Value
  3509. macro _EXPORT_GRADLE_TARGET_ATTR(NAME, VALUE...) {
  3510. .SEM=${pre= && $NAME :VALUE}
  3511. }
  3512. BUILD_PROTO_JAR_SEM= \
  3513. jar_proto $MODDIR $REALPRJNAME ${hide:target} ${hide:AUTO_INPUT} && \
  3514. consumer_classpath $EXPORT_GRADLE_PROJECT_COORDS $_EXPORT_GRADLE_TARGET_ATTR(proto_namespace $PROTO_NAMESPACE) $_EXPORT_GRADLE_TARGET_ATTR(proto_grpc ${ext=yes:_GRPC_ENABLED})
  3515. # tag:java-specific tag:internal
  3516. ### @usage: JAR_LIBRARY() #internal
  3517. ###
  3518. ### Reimplementation of the JAVA_LIBRARY with ymake.core.conf and ymake based dependency management
  3519. module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
  3520. .EXTS=.jsrc .java .jar .mf .gentar .kt
  3521. .CMD=LINK_JAR
  3522. .SEM=BUILD_JAR_SEM
  3523. .FINAL_TARGET=yes
  3524. .ALIASES=JAVA_SRCS=IDEA_JAR_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
  3525. .RESTRICTED=EXTERNAL_JAR
  3526. .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS
  3527. MODULE_SUFFIX=.jar
  3528. PEERDIR(build/platform/java/jdk)
  3529. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3530. when ($_EXT_SRC_JAR) {
  3531. _COPY_EXT_SRC_JAR=_DO_COPY_EXT_SRC_JAR
  3532. }
  3533. when ($_EXT_JAR) {
  3534. LINK_JAR=$_DO_USE_EXT_JAR
  3535. }
  3536. when ($OPENSOURCE_EXPORT == "no") {
  3537. BUILD_JAR_SEM=IGNORED
  3538. }
  3539. when ($_JAR_MAIN_CLASS) {
  3540. _JAR_MAIN_SEM=$_ADD_JAR_MAIN_SEM
  3541. }
  3542. when ($GRADLE_EXPORT_PUBLISHING == "yes") {
  3543. _GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
  3544. }
  3545. # in the ideal world this statement must be under condition bellow
  3546. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
  3547. when ($WITH_KOTLIN_VALUE) {
  3548. KT_SRSCLIST=$KT_SRSCLIST_FLAG
  3549. _MAKE_LINT_KT_FILES_LIST = $YMAKE_PYTHON ${input:"build/scripts/kt_copy.py"} $KT_SRCLIST ${output;noauto:"all-kt-sources.txt"} $(SOURCE_ROOT) $(BUILD_ROOT)
  3550. ALL_KT_COMMANDS=&& $COLLECT_KT_CLASSPATH && $LINK_KT_CLASSPATH
  3551. when ($WITH_KAPT_VALUE == "yes") {
  3552. # For Kapt usage see: https://kotlinlang.org/docs/kapt.html#using-in-cli
  3553. # See for kapt.kotlin.generated: https://github.com/JetBrains/kotlin/blob/master/plugins/kapt3/kapt3-cli/testData/integration/kotlinFileGeneration/build.txt
  3554. _KAPT_OPTS=-Xplugin=${tool:"contrib/java/org/jetbrains/kotlin/kotlin-annotation-processing/1.8.20"} $KT_KAPT_PLUGIN_OPTS
  3555. _RUN_KAPT=${YMAKE_PYTHON} ${input:"build/scripts/with_kapt_args.py"} ${pre=--ap-classpath :KT_KAPT_AP_CLASSPATH} -- $COMPILE_KT $_KAPT_OPTS
  3556. _APPEND_KAPT_GENERATED_SRCS=$YMAKE_PYTHON ${input:"build/scripts/resolve_java_srcs.py"} -d $KT_KAPT_SOURCES_DIR --include-patterns '**/*.java' '**/*.kt' --resolve-kotlin --append -s ${BINDIR}/all-java.srclst -k $KT_SRCLIST -r ${BINDIR}/not-used.txt
  3557. ALL_KT_COMMANDS+=&& $_RUN_KAPT && $_APPEND_KAPT_GENERATED_SRCS
  3558. }
  3559. ALL_KT_COMMANDS+=&& $COMPILE_KT && $_MAKE_LINT_KT_FILES_LIST
  3560. LINK_JAR_RESOURCES+=&& $FS_TOOLS copy_all_files ${KT_CLASSES_DIR} ${BINDIR}/cls
  3561. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  3562. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  3563. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  3564. }
  3565. when($WITH_KOTLINC_PLUGIN_LOMBOK) {
  3566. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-lombok-plugin.jar
  3567. }
  3568. when($WITH_KOTLINC_PLUGIN_NOARG) {
  3569. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  3570. }
  3571. when($WITH_KOTLINC_PLUGIN_SERIALIZATION) {
  3572. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-serialization-plugin.jar
  3573. }
  3574. # Must be in sync with KT_CLASSES_DIR!
  3575. # There are problems in JDK13 with abs paths in classpath baked into jar file manifest. Using relative path
  3576. # here assumes that jar file with classpath for javac located in the $ARCADIA_BUILD_ROOT
  3577. KT_CLASSPATH_ITEM=$MODDIR/kt_cls
  3578. }
  3579. otherwise {
  3580. KT_SRSCLIST=
  3581. ALL_KT_COMMANDS=
  3582. KT_CLASSES=
  3583. }
  3584. when ($MAVEN_EXPORT == "yes") {
  3585. when ($MAVEN_DEPLOY == "yes") {
  3586. PEERDIR+=build/external_resources/maven
  3587. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM && $MAVEN_DEPLOY_CMD
  3588. }
  3589. otherwise {
  3590. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM
  3591. }
  3592. MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GOUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
  3593. }
  3594. when ($SOURCES_JAR == "yes") {
  3595. _PACK_SRC_JAR=$_PACK_SRC_JAR_IMPL
  3596. MAVEN_DEPLOY_SOURCES=-Dsources=${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
  3597. }
  3598. when ($JAVA_COVERAGE == "yes") {
  3599. JAVA_COVERAGE_SRCLIST=$JAVA_COVERAGE_SRCLIST_FLAG
  3600. }
  3601. when ($MAKE_UBERJAR_VALUE == "yes") {
  3602. _LINK_UBERJAR=$_DO_LINK_UBERJAR
  3603. PACK_JAR=$_PACK_JAR_HELPER(${BINDIR}/${REALPRJNAME}.lib.jar)
  3604. # TODO: This condition is incorrect in case of autoinputs _UBERJAR_SELF should be empty only for
  3605. # modules without AUTO_INPUT and without JAVA_SRCS added inputs.
  3606. when($ALL_JAR_SOURCES) {
  3607. _UBERJAR_SELF=--jar ${BINDIR}/${REALPRJNAME}.lib.jar
  3608. }
  3609. PEERDIR+=build/platform/java/uberjar
  3610. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  3611. }
  3612. when($JAVA_YNDEXING == "yes") {
  3613. PEERDIR+=build/platform/java/kythe
  3614. _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"}
  3615. }
  3616. when($ERROR_PRONE_VALUE) {
  3617. PEERDIR+=$ERROR_PRONE_PEERDIR
  3618. JAVAC_CMD=$ERROR_PRONE_JAVAC_CMD
  3619. }
  3620. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
  3621. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3622. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3623. }
  3624. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "17") {
  3625. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3626. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3627. }
  3628. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "18") {
  3629. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3630. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3631. }
  3632. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "19") {
  3633. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3634. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3635. }
  3636. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "20") {
  3637. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3638. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3639. }
  3640. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  3641. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3642. JAVAC_OPTS+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3643. }
  3644. when ($JAVA_ADD_DLLS_VALUE == "yes") {
  3645. CONSUME_NON_MANAGEABLE_PEERS=yes
  3646. _PACK_JNI=$_PACK_JNI_CMD
  3647. }
  3648. when ($LINT_LEVEL_VALUE != "none") {
  3649. _MAKE_JSTYLE_FILE_LIST= && ${WRITER_PY} --file ${output;noauto:"lint-java.srclst"} -m --ya-start-command-file $LINT_JAVA_SOURCES --ya-end-command-file
  3650. }
  3651. SET(MODULE_TYPE JAVA_LIBRARY)
  3652. ENABLE(YMAKE_JAVA_TEST)
  3653. _ADD_KOTLIN_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/all-kt-sources.txt REQUIREMENTS cpu:2)
  3654. _ADD_JAVA_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/lint-java.srclst::$(SOURCE_ROOT))
  3655. _ADD_CLASSPATH_CLASH_CHECK()
  3656. JAVA_MODULE()
  3657. }
  3658. # tag:java-specific
  3659. _SCRIPTGEN_FLAGS=
  3660. macro _GEN_JAVA_SCRIPT_IMPL(Out, Template, Props...) {
  3661. .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
  3662. }
  3663. # tag:java-specific
  3664. _GEN_USERSCRIPTS=
  3665. macro _ADD_GEN_JAVA_SCRIPT(Out, Template, Props...) {
  3666. SET_APPEND(_GEN_USERSCRIPTS && \$_GEN_JAVA_SCRIPT_IMPL($Out $Template $Props))
  3667. }
  3668. # tag:java-specific
  3669. _PACK_JDK=
  3670. # tag:java-specific
  3671. DO_GEN_JAVA_RUN_SH=
  3672. _SOURCE_JARS=
  3673. _SOURCE_JARS_CPLIST=
  3674. 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}
  3675. 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}
  3676. 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}
  3677. 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
  3678. TAR_CLASSPATH= && $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} ${output;pre=$MODULE_PREFIX;suf=.tar:REALPRJNAME} ${cwd;pre=$BINDIR/:REALPRJNAME}
  3679. DO_TAR_CLASSPATH=
  3680. LINK_JAR_PROGRAM=${hide:JAVA_FAKEID} $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"}
  3681. # tag:java-specific
  3682. # UBERJAR program link command
  3683. LINK_UBERJAR_PROGRAM=${hide:JAVA_FAKEID} ${kv;hide:"p UJ"} ${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} $TARGET \
  3684. && $FS_TOOLS md ${BINDIR}/${REALPRJNAME} \
  3685. && $FS_TOOLS link_or_copy ${BINDIR}/${REALPRJNAME}.jar $TARGET \
  3686. && $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;output;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} \
  3687. $DO_TAR_CLASSPATH \
  3688. $_GEN_USERSCRIPTS \
  3689. $_PACK_JDK
  3690. # tag:java-specific
  3691. RUN_WITH_SOURCES=no
  3692. # 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
  3693. TARED_CLASSPATH=yes
  3694. _JAR_SRCS_CALLED=no
  3695. # tag:java-specific
  3696. macro _MARK_JAVA_PROG_WITH_SOURCES(Args...) {
  3697. ENABLE(_JAR_SRCS_CALLED)
  3698. }
  3699. # tag:java-specific
  3700. module _JAR_RUNNABLE: _COMPILABLE_JAR_BASE {
  3701. .FINAL_TARGET=yes
  3702. .CMD=LINK_JAR_PROGRAM
  3703. .SEM=IGNORED
  3704. .ALIASES=JAVA_SRCS=_MARK_JAVA_PROG_WITH_SOURCES GENERATE_SCRIPT=_YMAKE_GENERATE_SCRIPT
  3705. .ALLOWED=WITH_JDK
  3706. MODULE_SUFFIX=.run.cp.jar
  3707. CONSUME_NON_MANAGEABLE_PEERS=yes
  3708. when ($RUN_WITH_SOURCES == "yes") {
  3709. _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}
  3710. _SOURCE_JARS_CPLIST=${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
  3711. }
  3712. when ($TARED_CLASSPATH == "yes") {
  3713. DO_TAR_CLASSPATH=$TAR_CLASSPATH
  3714. }
  3715. when ($DISABLE_SCRIPTGEN) {
  3716. DO_GEN_JAVA_RUN_SH=
  3717. }
  3718. otherwise {
  3719. DO_GEN_JAVA_RUN_SH=$GEN_JAVA_RUN_SH
  3720. PEERDIR+=build/platform/java/scriptgen
  3721. }
  3722. when ($WITH_JDK_VALUE) {
  3723. _PACK_JDK= && ${YMAKE_PYTHON} ${input:"build/scripts/tar_directory.py"} ${output;tared:"jdk.tar"} $WITH_JDK_RESOURCE $WITH_JDK_RESOURCE
  3724. }
  3725. when ($MAKE_UBERJAR_VALUE == "yes") {
  3726. LINK_JAR_PROGRAM=$LINK_UBERJAR_PROGRAM
  3727. DYNAMIC_LINK=no
  3728. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=yes
  3729. }
  3730. otherwise {
  3731. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=no
  3732. }
  3733. CHECK_PROVIDES()
  3734. }
  3735. # tag:java-specific
  3736. multimodule JAR_PROGRAM {
  3737. module JAR_RUNNABLE: _JAR_RUNNABLE {
  3738. .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
  3739. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3740. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
  3741. .PEERDIRSELF=JAR_COMPILATION
  3742. SET(MODULE_TYPE JAVA_PROGRAM)
  3743. }
  3744. module JAR_COMPILATION: JAR_LIBRARY {
  3745. .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
  3746. .FINAL_TARGET=no
  3747. SET(MODULE_TYPE JAVA_PROGRAM)
  3748. }
  3749. }
  3750. # tag:java-specific
  3751. LINK_JAR_TEST=${hide:JAVA_FAKEID} ${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} ${kv;hide:"p JT"}
  3752. YMAKE_JAVA_TEST=
  3753. module _JAR_TEST: _COMPILABLE_JAR_BASE {
  3754. .FINAL_TARGET=yes
  3755. .CMD=LINK_JAR_TEST
  3756. .DEFAULT_NAME_GENERATOR=FullPath
  3757. CONSUME_NON_MANAGEABLE_PEERS=yes
  3758. SET(MODULE_SUFFIX .test.cp.jar)
  3759. ENABLE(YMAKE_JAVA_TEST)
  3760. JAVA_TEST()
  3761. CHECK_PROVIDES()
  3762. }
  3763. # tag:python-specific tag:deprecated
  3764. ### @usage: PY2_LIBRARY() # deprecated
  3765. ###
  3766. ### Deprecated. Use PY23_LIBRARY or PY3_LIBRARY instead.
  3767. ### Python 2.x binary built library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM.
  3768. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3769. ### This module is only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3770. ### This module is only compatible with Arcadia Python build.
  3771. ###
  3772. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3773. module PY2_LIBRARY: _LIBRARY {
  3774. _ARCADIA_PYTHON_ADDINCL()
  3775. when ($NO_PYTHON_INCLS != "yes") {
  3776. PEERDIR+=contrib/libs/python
  3777. }
  3778. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3779. MODULE_PREFIX=py
  3780. }
  3781. otherwise {
  3782. MODULE_PREFIX=libpy
  3783. }
  3784. .ALLOWED=FORK_TESTS
  3785. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3786. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS STYLE_PYTHON
  3787. USE_GLOBAL_CMD=yes
  3788. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3789. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3790. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3791. 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}"})
  3792. }
  3793. SET(MODULE_LANG PY2)
  3794. ADD_CLANG_TIDY()
  3795. }
  3796. # tag:python-specific
  3797. ### @usage: PY3_LIBRARY()
  3798. ###
  3799. ### Python 3.x binary library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM
  3800. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3801. ### This module is only compatible with PYTHON3-tagged modules and selects those from multimodules.
  3802. ### This module is only compatible with Arcadia Python build.
  3803. ###
  3804. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3805. module PY3_LIBRARY: _LIBRARY {
  3806. _ARCADIA_PYTHON3_ADDINCL()
  3807. when ($NO_PYTHON_INCLS != "yes") {
  3808. PEERDIR+=contrib/libs/python
  3809. }
  3810. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3811. MODULE_PREFIX=py
  3812. }
  3813. otherwise {
  3814. MODULE_PREFIX=libpy
  3815. }
  3816. .ALLOWED=FORK_TESTS
  3817. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3818. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2 OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3819. USE_GLOBAL_CMD=yes
  3820. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3821. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3822. PYTHON_TYPE_FOR_CYTHON=PY3
  3823. ANTLR_PYTHON=Python3
  3824. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3825. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3826. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3827. 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}"})
  3828. }
  3829. SET(MODULE_LANG PY3)
  3830. ADD_CLANG_TIDY()
  3831. }
  3832. # tag:python-specific
  3833. ### @usage: _BASE_PY_PROGRAM #internal
  3834. ###
  3835. ### The base module for all Python 2.x binary programs. Adds linking logic, relevant module properties and
  3836. ### dependency on Python 2.x interpreter. Also adds import tests on all sources including PEERDIR'ed libraries.
  3837. ### Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  3838. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3839. ###
  3840. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3841. module _BASE_PY_PROGRAM: _BASE_PROGRAM {
  3842. .CMD=PY_PROGRAM_LINK_EXE
  3843. _ARCADIA_PYTHON_ADDINCL()
  3844. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3845. NO_CHECK_IMPORTS_FOR_VALUE=
  3846. }
  3847. ADD_CHECK_PY_IMPORTS()
  3848. when ($NO_PYTHON_INCLS != "yes") {
  3849. PEERDIR += contrib/libs/python
  3850. }
  3851. when ($USE_ARCADIA_PYTHON == "yes") {
  3852. PEERDIR += library/python/runtime/main
  3853. PEERDIR += contrib/deprecated/python/subprocess32
  3854. when ($PYTHON_SQLITE3 != "no") {
  3855. PEERDIR += contrib/tools/python/src/Modules/_sqlite
  3856. }
  3857. }
  3858. when ($PYTHON_COVERAGE == "yes") {
  3859. PEERDIR+=library/python/coverage
  3860. }
  3861. when ($ARCH_PPC64LE == "yes") {
  3862. _MY_ALLOCATOR=SYSTEM
  3863. }
  3864. otherwise {
  3865. _MY_ALLOCATOR=J
  3866. }
  3867. ALLOCATOR($_MY_ALLOCATOR)
  3868. STRIP()
  3869. when ($BUILD_TYPE == "DEBUG") {
  3870. NO_STRIP=yes
  3871. }
  3872. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3873. NO_STRIP=yes
  3874. }
  3875. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3876. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3877. SET(MODULE_LANG PY2)
  3878. }
  3879. # tag:python-specific tag:codenav
  3880. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3881. PY3_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"py3yndex $TARGET"}
  3882. }
  3883. otherwise {
  3884. PY3_PROGRAM_LINK_EXE=$LINK_EXE
  3885. }
  3886. # tag:python-specific
  3887. ### @usage: _BASE_PY_PROGRAM #internal
  3888. ###
  3889. ### The base module for all Python 3.x binary programs. Adds linking logic, relevant module properties and
  3890. ### dependency on Python 3.x interpreter. Also adds import tests on all sources including libraries.
  3891. ### Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  3892. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules
  3893. ###
  3894. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3895. module _BASE_PY3_PROGRAM: _BASE_PROGRAM {
  3896. .CMD=PY3_PROGRAM_LINK_EXE
  3897. _ARCADIA_PYTHON3_ADDINCL()
  3898. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3899. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3900. PYTHON_TYPE_FOR_CYTHON=PY3
  3901. PEERDIR(library/python/runtime_py3/main)
  3902. when ($PYTHON_SQLITE3 != "no") {
  3903. PEERDIR += contrib/tools/python3/src/Modules/_sqlite
  3904. }
  3905. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3906. NO_CHECK_IMPORTS_FOR_VALUE=
  3907. }
  3908. ADD_CHECK_PY_IMPORTS()
  3909. when ($ARCH_PPC64LE == "yes") {
  3910. _MY_ALLOCATOR=SYSTEM
  3911. }
  3912. otherwise {
  3913. _MY_ALLOCATOR=J
  3914. }
  3915. ALLOCATOR($_MY_ALLOCATOR)
  3916. STRIP()
  3917. when ($NO_PYTHON_INCLS != "yes") {
  3918. PEERDIR+=contrib/libs/python
  3919. }
  3920. when ($BUILD_TYPE == "DEBUG") {
  3921. NO_STRIP=yes
  3922. }
  3923. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3924. NO_STRIP=yes
  3925. }
  3926. when ($PYTHON_COVERAGE == "yes") {
  3927. PEERDIR+=library/python/coverage
  3928. }
  3929. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3930. PEERDIR += contrib/python/six
  3931. }
  3932. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3933. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2
  3934. SET(MODULE_LANG PY3)
  3935. SET(ANTLR_PYTHON Python3)
  3936. }
  3937. # tag:python-specific
  3938. ### @usage: PY3_PROGRAM_BIN([progname])
  3939. ### Use instead of PY3_PROGRAM only if ya.make with PY3_PROGRAM() included in another ya.make
  3940. ### In all other cases use PY3_PROGRAM
  3941. module PY3_PROGRAM_BIN: _BASE_PY3_PROGRAM {
  3942. # Look's like we cannot avoid copy-paste util ymake supports multiple inheritance
  3943. # We need to attach coverage.extractor to every py_program target, except pytest targets
  3944. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  3945. }
  3946. # tag:java-specific
  3947. JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
  3948. # tag:java-specific
  3949. JDK_REAL_VERSION=
  3950. JDK_VERSION=
  3951. when ($JDK_VERSION == "20") {
  3952. JDK_REAL_VERSION=20
  3953. }
  3954. elsewhen ($JDK_VERSION == "19") {
  3955. JDK_REAL_VERSION=19
  3956. }
  3957. elsewhen ($JDK_VERSION == "18") {
  3958. JDK_REAL_VERSION=18
  3959. }
  3960. elsewhen ($JDK_VERSION == "17") {
  3961. JDK_REAL_VERSION=17
  3962. }
  3963. elsewhen ($JDK_VERSION == "16") {
  3964. JDK_REAL_VERSION=16
  3965. }
  3966. elsewhen ($JDK_VERSION == "15") {
  3967. JDK_REAL_VERSION=15
  3968. }
  3969. elsewhen ($JDK_VERSION == "11") {
  3970. JDK_REAL_VERSION=11
  3971. }
  3972. elsewhen ($JDK_VERSION == "10") {
  3973. JDK_REAL_VERSION=10
  3974. }
  3975. elsewhen ($JDK_VERSION == "8") {
  3976. JDK_REAL_VERSION=8
  3977. }
  3978. elsewhen ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
  3979. JDK_REAL_VERSION=11
  3980. }
  3981. otherwise {
  3982. JDK_REAL_VERSION=17
  3983. }
  3984. # tag:java-specific
  3985. # remove extra peerdir to jdk11 after https://st.yandex-team.ru/DEVTOOLS-8851 is done
  3986. when ($USE_SYSTEM_JDK) {
  3987. JDK_RESOURCE_PEERDIR=
  3988. }
  3989. otherwise {
  3990. when ($JDK_REAL_VERSION == "20") {
  3991. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk20 build/platform/java/jdk/jdk17
  3992. }
  3993. when ($JDK_REAL_VERSION == "19") {
  3994. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk19 build/platform/java/jdk/jdk17
  3995. }
  3996. when ($JDK_REAL_VERSION == "18") {
  3997. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk18 build/platform/java/jdk/jdk17
  3998. }
  3999. when ($JDK_REAL_VERSION == "17") {
  4000. # need jdk11 for spare parts in "host" platform
  4001. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk17 build/platform/java/jdk/jdk11
  4002. }
  4003. when ($JDK_REAL_VERSION == "16") {
  4004. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk16 build/platform/java/jdk/jdk17
  4005. }
  4006. when ($JDK_REAL_VERSION == "15") {
  4007. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk15 build/platform/java/jdk/jdk17
  4008. }
  4009. when ($JDK_REAL_VERSION == "11") {
  4010. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk11 build/platform/java/jdk/jdk17
  4011. }
  4012. when ($JDK_REAL_VERSION == "10") {
  4013. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk10 build/platform/java/jdk/jdk17
  4014. }
  4015. when ($JDK_REAL_VERSION == "8") {
  4016. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk8 build/platform/java/jdk/jdk17
  4017. }
  4018. }
  4019. # tag:java-specific
  4020. when ($JDK_REAL_VERSION == "20") {
  4021. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar20
  4022. }
  4023. when ($JDK_REAL_VERSION == "19") {
  4024. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
  4025. }
  4026. when ($JDK_REAL_VERSION == "18") {
  4027. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
  4028. }
  4029. when ($JDK_REAL_VERSION == "17") {
  4030. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar17
  4031. }
  4032. when ($JDK_REAL_VERSION == "16") {
  4033. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar16
  4034. }
  4035. when ($JDK_REAL_VERSION == "15") {
  4036. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar15
  4037. }
  4038. when ($JDK_REAL_VERSION == "11") {
  4039. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar11
  4040. }
  4041. when ($JDK_REAL_VERSION == "10") {
  4042. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar10
  4043. }
  4044. when ($JDK_REAL_VERSION == "8") {
  4045. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar8
  4046. }
  4047. # tag:java-specific
  4048. JAVAC_OPTS=
  4049. when ($USE_SYSTEM_JDK) {
  4050. JDK_RESOURCE=$USE_SYSTEM_JDK
  4051. }
  4052. otherwise {
  4053. when ($JDK_REAL_VERSION == "20") {
  4054. JDK_RESOURCE=$JDK20_RESOURCE_GLOBAL
  4055. }
  4056. when ($JDK_REAL_VERSION == "19") {
  4057. JDK_RESOURCE=$JDK19_RESOURCE_GLOBAL
  4058. }
  4059. when ($JDK_REAL_VERSION == "18") {
  4060. JDK_RESOURCE=$JDK18_RESOURCE_GLOBAL
  4061. }
  4062. when ($JDK_REAL_VERSION == "17") {
  4063. JDK_RESOURCE=$JDK17_RESOURCE_GLOBAL
  4064. }
  4065. when ($JDK_REAL_VERSION == "16") {
  4066. JDK_RESOURCE=$JDK16_RESOURCE_GLOBAL
  4067. }
  4068. when ($JDK_REAL_VERSION == "15") {
  4069. JDK_RESOURCE=$JDK15_RESOURCE_GLOBAL
  4070. }
  4071. when ($JDK_REAL_VERSION == "11") {
  4072. JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  4073. }
  4074. when ($JDK_REAL_VERSION == "10") {
  4075. JDK_RESOURCE=$JDK10_RESOURCE_GLOBAL
  4076. }
  4077. when ($JDK_REAL_VERSION == "8") {
  4078. JDK_RESOURCE=$JDK8_RESOURCE_GLOBAL
  4079. }
  4080. }
  4081. # tag:java-specific
  4082. when (!$USE_SYSTEM_ERROR_PRONE) {
  4083. # Still not done: DTCC-667
  4084. when ($JDK_REAL_VERSION == "8" || $JDK_REAL_VERSION == "10") {
  4085. ERROR_PRONE_VERSION=2.3.1
  4086. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.3.1
  4087. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_3_1_RESOURCE_GLOBAL
  4088. }
  4089. elsewhen ($JDK_REAL_VERSION == "11" || $JDK_REAL_VERSION == "15" || $JDK_REAL_VERSION == "16") {
  4090. ERROR_PRONE_VERSION=2.7.1
  4091. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.7.1
  4092. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_7_1_RESOURCE_GLOBAL
  4093. }
  4094. elsewhen ($JDK_REAL_VERSION == "17") {
  4095. ERROR_PRONE_VERSION=2.10.0
  4096. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.10.0
  4097. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_10_0_RESOURCE_GLOBAL
  4098. }
  4099. elsewhen ($JDK_REAL_VERSION == "18") {
  4100. ERROR_PRONE_VERSION=2.14.0
  4101. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.14.0
  4102. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_14_0_RESOURCE_GLOBAL
  4103. }
  4104. elsewhen ($JDK_REAL_VERSION == "19") {
  4105. ERROR_PRONE_VERSION=2.18.0
  4106. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
  4107. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
  4108. }
  4109. elsewhen ($JDK_REAL_VERSION == "20") {
  4110. ERROR_PRONE_VERSION=2.18.0
  4111. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
  4112. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
  4113. }
  4114. otherwise {
  4115. ERROR_PRONE_VERSION=2.7.1
  4116. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  4117. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  4118. }
  4119. }
  4120. otherwise {
  4121. ERROR_PRONE_VERSION=2.7.1
  4122. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  4123. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  4124. }
  4125. # tag:java-specific
  4126. when ($USE_SYSTEM_UBERJAR) {
  4127. UBERJAR_RESOURCE=$USE_SYSTEM_UBERJAR
  4128. }
  4129. otherwise {
  4130. when ($JDK_REAL_VERSION == "20") {
  4131. UBERJAR_RESOURCE=$UBERJAR20_RESOURCE_GLOBAL
  4132. }
  4133. when ($JDK_REAL_VERSION == "19") {
  4134. UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
  4135. }
  4136. when ($JDK_REAL_VERSION == "18") {
  4137. UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
  4138. }
  4139. when ($JDK_REAL_VERSION == "17") {
  4140. UBERJAR_RESOURCE=$UBERJAR17_RESOURCE_GLOBAL
  4141. }
  4142. when ($JDK_REAL_VERSION == "16") {
  4143. UBERJAR_RESOURCE=$UBERJAR16_RESOURCE_GLOBAL
  4144. }
  4145. when ($JDK_REAL_VERSION == "15") {
  4146. UBERJAR_RESOURCE=$UBERJAR15_RESOURCE_GLOBAL
  4147. }
  4148. when ($JDK_REAL_VERSION == "11") {
  4149. UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
  4150. }
  4151. when ($JDK_REAL_VERSION == "10") {
  4152. UBERJAR_RESOURCE=$UBERJAR10_RESOURCE_GLOBAL
  4153. }
  4154. when ($JDK_REAL_VERSION == "8") {
  4155. UBERJAR_RESOURCE=$UBERJAR8_RESOURCE_GLOBAL
  4156. }
  4157. }
  4158. # tag:java-specific
  4159. when ($JDK_REAL_VERSION == "20") {
  4160. WITH_JDK_RESOURCE=$WITH_JDK20_RESOURCE_GLOBAL
  4161. }
  4162. when ($JDK_REAL_VERSION == "19") {
  4163. WITH_JDK_RESOURCE=$WITH_JDK19_RESOURCE_GLOBAL
  4164. }
  4165. when ($JDK_REAL_VERSION == "18") {
  4166. WITH_JDK_RESOURCE=$WITH_JDK18_RESOURCE_GLOBAL
  4167. }
  4168. when ($JDK_REAL_VERSION == "17") {
  4169. WITH_JDK_RESOURCE=$WITH_JDK17_RESOURCE_GLOBAL
  4170. }
  4171. when ($JDK_REAL_VERSION == "16") {
  4172. WITH_JDK_RESOURCE=$WITH_JDK16_RESOURCE_GLOBAL
  4173. }
  4174. when ($JDK_REAL_VERSION == "15") {
  4175. WITH_JDK_RESOURCE=$WITH_JDK15_RESOURCE_GLOBAL
  4176. }
  4177. when ($JDK_REAL_VERSION == "11") {
  4178. WITH_JDK_RESOURCE=$WITH_JDK11_RESOURCE_GLOBAL
  4179. }
  4180. when ($JDK_REAL_VERSION == "10") {
  4181. WITH_JDK_RESOURCE=$WITH_JDK10_RESOURCE_GLOBAL
  4182. }
  4183. when ($JDK_REAL_VERSION == "8") {
  4184. WITH_JDK_RESOURCE=$WITH_JDK8_RESOURCE_GLOBAL
  4185. }
  4186. # tag:java-specific
  4187. EXTERNAL_JAVA_JDK_RESOURCE=
  4188. EXTERNAL_JAVA_EXTRA_PEERDIR=
  4189. when ($USE_SYSTEM_JDK) {
  4190. EXTERNAL_JAVA_EXTRA_PEERDIR=
  4191. EXTERNAL_JAVA_JDK_RESOURCE=$USE_SYSTEM_JDK
  4192. }
  4193. elsewhen ($JDK_VERSION == "") {
  4194. EXTERNAL_JAVA_JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  4195. EXTERNAL_JAVA_EXTRA_PEERDIR=build/platform/java/jdk/jdk11
  4196. }
  4197. otherwise {
  4198. EXTERNAL_JAVA_JDK_RESOURCE=$JDK_RESOURCE
  4199. }
  4200. COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_java.py"} --java-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/java --javac-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/jar --kotlin-compiler $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.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 DELIM -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} ${KOTLINC_OPTS_VALUE} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"}
  4201. ARGS_DELIM="MACRO_CALLS_DELIM"
  4202. SYSTEM_PROPERTIES_VALUE=
  4203. ### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
  4204. ###
  4205. ### List of Key,Value pairs that will be available to test via System.getProperty().
  4206. ### FILE means that parst should be read from file specifies as Path.
  4207. ###
  4208. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4209. macro SYSTEM_PROPERTIES(Args...) {
  4210. SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
  4211. }
  4212. # tag:java-specific
  4213. JVM_ARGS_VALUE=
  4214. ### @usage: JVM_ARGS(Args...)
  4215. ###
  4216. ### Arguments to run Java programs in tests.
  4217. ###
  4218. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4219. macro JVM_ARGS(Args...) {
  4220. SET_APPEND(JVM_ARGS_VALUE $Args)
  4221. }
  4222. # tag:java-specific
  4223. CHECK_JAVA_DEPS_VALUE=
  4224. ### @usage: CHECK_JAVA_DEPS(<yes|no>)
  4225. ###
  4226. ### Check for different classes with duplicate name in classpath.
  4227. ###
  4228. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4229. macro CHECK_JAVA_DEPS(Arg) {
  4230. SET(CHECK_JAVA_DEPS_VALUE $Arg)
  4231. }
  4232. ERROR_PRONE_VALUE=
  4233. ### @usage: USE_ERROR_PRONE()
  4234. ###
  4235. ### Use errorprone instead of javac for .java compilation.
  4236. macro USE_ERROR_PRONE() {
  4237. SET(ERROR_PRONE_VALUE yes)
  4238. }
  4239. TEST_CWD_VALUE=
  4240. ### @usage: TEST_CWD(path)
  4241. ###
  4242. ### Defines working directory for test runs. Often used in conjunction with DATA() macro.
  4243. ### Is only used inside of the TEST modules.
  4244. ###
  4245. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4246. macro TEST_CWD(Arg) {
  4247. SET(TEST_CWD_VALUE $Arg)
  4248. }
  4249. # tag:java-specific
  4250. MAKE_UBERJAR_VALUE=
  4251. ### @usage: UBERJAR()
  4252. ###
  4253. ### UBERJAR is a single all-in-one jar-archive that includes all its Java dependencies (reachable PEERDIR).
  4254. ### It also supports shading classes inside the archive by moving them to a different package (similar to the maven-shade-plugin).
  4255. ### Use UBERJAR inside JAVA_PROGRAM module.
  4256. ###
  4257. ### You can use the following macros to configure the archive:
  4258. ### 1. UBERJAR_HIDING_PREFIX prefix for classes to shade (classes remain in their packages by default)
  4259. ### 2. UBERJAR_HIDE_EXCLUDE_PATTERN exclude classes matching this patterns from shading (if enabled).
  4260. ### 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)
  4261. ### 4. UBERJAR_MANIFEST_TRANSFORMER_MAIN add ManifestResourceTransformer class to uberjar processing and specify main-class
  4262. ### 5. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE add ManifestResourceTransformer class to uberjar processing and specify some attribute
  4263. ### 6. UBERJAR_APPENDING_TRANSFORMER add AppendingTransformer class to uberjar processing
  4264. ### 7. UBERJAR_SERVICES_RESOURCE_TRANSFORMER add ServicesResourceTransformer class to uberjar processing
  4265. ###
  4266. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  4267. ###
  4268. ### @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)
  4269. macro UBERJAR() {
  4270. SET(MAKE_UBERJAR_VALUE yes)
  4271. DISABLE(PASS_PEERS)
  4272. }
  4273. # tag:java-specific
  4274. UBERJAR_PREFIX_VALUE=
  4275. UBERJAR_PREFIX_FLAG=
  4276. ### @usage: UBERJAR_HIDING_PREFIX(Arg)
  4277. ###
  4278. ### Set prefix for classes to shade. All classes in UBERJAR will be moved into package prefixed with Arg.
  4279. ### Classes remain in their packages by default.
  4280. ###
  4281. ### @see: [UBERJAR](#macro_UBERJAR)
  4282. macro UBERJAR_HIDING_PREFIX(Arg) {
  4283. SET(UBERJAR_PREFIX_VALUE $Arg)
  4284. SET(UBERJAR_PREFIX_FLAG ${pre=--shade-prefix :Arg})
  4285. }
  4286. # tag:java-specific
  4287. UBERJAR_HIDE_EXCLUDE_VALUE=
  4288. UBERJAR_HIDE_EXCLUDE_FLAGS=
  4289. ### @usage: UBERJAR_HIDE_EXCLUDE_PATTERN(Args...)
  4290. ###
  4291. ### Exclude classes matching this patterns from shading (if enabled).
  4292. ### Pattern may contain '*' and '**' globs.
  4293. ### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
  4294. ###
  4295. ### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
  4296. macro UBERJAR_HIDE_EXCLUDE_PATTERN(Args...) {
  4297. SET_APPEND(UBERJAR_HIDE_EXCLUDE_VALUE $ARGS_DELIM $Args)
  4298. SET_APPEND(UBERJAR_HIDE_EXCLUDE_FLAGS ${pre=--shade-exclude :Args})
  4299. }
  4300. # tag:java-specific
  4301. UBERJAR_PATH_EXCLUDES=
  4302. UBERJAR_PATH_EXCLUDE_VALUE=
  4303. ### @usage: UBERJAR_PATH_EXCLUDE_PREFIX(Args...)
  4304. ###
  4305. ### Exclude classes matching this patterns from UBERJAR.
  4306. ### By default all dependencies of UBERJAR program will lend in a .jar archive.
  4307. ###
  4308. ### @see: [UBERJAR](#macro_UBERJAR)
  4309. macro UBERJAR_PATH_EXCLUDE_PREFIX(Args...) {
  4310. SET_APPEND(UBERJAR_PATH_EXCLUDE_VALUE $ARGS_DELIM $Args)
  4311. SET_APPEND(UBERJAR_PATH_EXCLUDES ${pre=--uber-exclude :Args})
  4312. }
  4313. # tag:java-specific
  4314. UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE=
  4315. UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG=
  4316. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main)
  4317. ###
  4318. ### Transform manifest.mf for UBERJAR() java programs, set main-class attribute
  4319. ###
  4320. ### @see: [UBERJAR](#macro_UBERJAR)
  4321. macro UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main) {
  4322. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE $Main)
  4323. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG --manifest-main $Main)
  4324. }
  4325. # tag:java-specific
  4326. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE=
  4327. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS=
  4328. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value)
  4329. ###
  4330. ### Transform manifest.mf for UBERJAR() java programs, set attribute
  4331. ###
  4332. ### @see: [UBERJAR](#macro_UBERJAR)
  4333. macro UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value) {
  4334. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Value)
  4335. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:${Value})
  4336. }
  4337. # tag:java-specific
  4338. UBERJAR_APPENDING_TRANSFORMER_VALUE=
  4339. UBERJAR_APPENDING_TRANSFORMER_FLAGS=
  4340. ### @usage: UBERJAR_APPENDING_TRANSFORMER(Resource)
  4341. ###
  4342. ### Add AppendingTransformer for UBERJAR() java programs
  4343. ###
  4344. ### Parameters:
  4345. ### - Resource - Resource name
  4346. ###
  4347. ### @see: [UBERJAR](#macro_UBERJAR)
  4348. macro UBERJAR_APPENDING_TRANSFORMER(Resources...) {
  4349. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_VALUE $ARGS_DELIM $Resources)
  4350. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_FLAGS ${pre=--append-transformer :Resources})
  4351. }
  4352. # tag:java-specific
  4353. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE=
  4354. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG=
  4355. ### @usage: UBERJAR_SERVICES_RESOURCE_TRANSFORMER()
  4356. ###
  4357. ### Add ServicesResourceTransformer for UBERJAR() java programs
  4358. ###
  4359. ### @see: [UBERJAR](#macro_UBERJAR)
  4360. macro UBERJAR_SERVICES_RESOURCE_TRANSFORMER() {
  4361. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE yes)
  4362. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG --service-transformer)
  4363. }
  4364. # tag:idea-specific
  4365. IDEA_EXCLUDE_DIRS_VALUE=
  4366. ### @usage: IDEA_EXCLUDE_DIRS(<excluded dirs>)
  4367. ###
  4368. ### Exclude specified directories from an idea project generated by ya ide idea
  4369. ### Have no effect on regular build.
  4370. macro IDEA_EXCLUDE_DIRS(Args...) {
  4371. SET_APPEND(IDEA_EXCLUDE_DIRS_VALUE $Args)
  4372. }
  4373. # tag:idea-specific
  4374. IDEA_RESOURCE_DIRS_VALUE=
  4375. ### @usage: IDEA_RESOURCE_DIRS(<additional dirs>)
  4376. ###
  4377. ### Set specified resource directories in an idea project generated by ya ide idea
  4378. ### Have no effect on regular build.
  4379. macro IDEA_RESOURCE_DIRS(Args...) {
  4380. SET_APPEND(IDEA_RESOURCE_DIRS_VALUE $Args)
  4381. }
  4382. # tag:idea-specific
  4383. IDEA_MODULE_NAME_VALUE=
  4384. ### @usage: IDEA_MODULE_NAME(module_name)
  4385. ###
  4386. ### Set module name in an idea project generated by ya ide idea
  4387. ### Have no effect on regular build.
  4388. macro IDEA_MODULE_NAME(Name) {
  4389. SET(IDEA_MODULE_NAME_VALUE $Name)
  4390. }
  4391. # tag:java-specific
  4392. JAVAC_FLAGS_VALUE=
  4393. ### @usage: JAVAC_FLAGS(Args...)
  4394. ###
  4395. ### Set additional Java compilation flags.
  4396. macro JAVAC_FLAGS(Args...) {
  4397. SET_APPEND(JAVAC_OPTS $Args)
  4398. SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
  4399. }
  4400. # tag:java-specific
  4401. ENABLE_PREVIEW_VALUE=
  4402. ### @usage: ENABLE_PREVIEW()
  4403. ###
  4404. ### Enable java preview features.
  4405. macro ENABLE_PREVIEW() {
  4406. SET_APPEND(JVM_ARGS_VALUE --enable-preview)
  4407. SET_APPEND(JAVAC_OPTS --enable-preview --release $JDK_REAL_VERSION)
  4408. SET_APPEND(JAVAC_FLAGS_VALUE --enable-preview --release $JDK_REAL_VERSION)
  4409. SET(ENABLE_PREVIEW_VALUE yes)
  4410. }
  4411. # tag:java-specific
  4412. SAVE_JAVAC_GENERATED_SRCS=
  4413. SAVE_JAVAC_GENERATED_SRCS_DIR=
  4414. SAVE_JAVAC_GENERATED_SRCS_TAR=
  4415. when ($SAVE_JAVAC_GENERATED_SRCS) {
  4416. SAVE_JAVAC_GENERATED_SRCS_DIR=${BINDIR}/__javac_generated_srcs__
  4417. SAVE_JAVAC_GENERATED_SRCS_TAR=${BINDIR}/javac_generated.tar
  4418. JAVAC_FLAGS_VALUE+=-s $SAVE_JAVAC_GENERATED_SRCS_DIR
  4419. }
  4420. # tag:java-specific
  4421. # TODO: MAVEN_GROUP_ID_VALUE is only used by jbuild remove it after YMAKE-45 and YMAKE-46
  4422. MAVEN_GROUP_ID_VALUE=
  4423. MAVEN_EXPORT_GOUP_ID=ru.yandex
  4424. ### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
  4425. ###
  4426. ### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
  4427. ### Have no effect on regular build.
  4428. macro MAVEN_GROUP_ID(Arg, VERSION="no") {
  4429. SET(MAVEN_GROUP_ID_VALUE $Arg)
  4430. SET(MAVEN_EXPORT_GOUP_ID $Arg)
  4431. SET(PUBLISH_MAVEN_VERSION $VERSION)
  4432. }
  4433. # tag:java-specific
  4434. ANNOTATION_PROCESSOR_VALUE=
  4435. ### @usage: ANNOTATION_PROCESSOR(processors...)
  4436. ###
  4437. ### The macro is in development.
  4438. ### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
  4439. macro ANNOTATION_PROCESSOR(Args...) {
  4440. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Args)
  4441. }
  4442. EXCLUDE_VALUE=
  4443. ### EXCLUDE(prefixes)
  4444. ###
  4445. ### The macro is in development.
  4446. ### Specifies which libraries should be excluded from the classpath.
  4447. macro EXCLUDE(Args...) {
  4448. SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args)
  4449. }
  4450. # tag:java-specific
  4451. JAVA_SRCS_VALUE=
  4452. ### @usage: JAVA_SRCS(srcs)
  4453. ###
  4454. ### Specify java source files and resources. A macro can be contained in any of four java modules.
  4455. ### Keywords:
  4456. ### 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.
  4457. ### 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.
  4458. ###
  4459. ### @example:
  4460. ### - example/ya.make
  4461. ###
  4462. ### JAVA_PROGRAM()
  4463. ### JAVA_SRCS(SRCDIR src/main/java **/*)
  4464. ### END()
  4465. ###
  4466. ### - example/src/main/java/ru/yandex/example/HelloWorld.java
  4467. ###
  4468. ### package ru.yandex.example;
  4469. ### public class HelloWorld {
  4470. ### public static void main(String[] args) {
  4471. ### System.out.println("Hello, World!");
  4472. ### }
  4473. ### }
  4474. ###
  4475. ### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
  4476. macro JAVA_SRCS(Args...) {
  4477. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  4478. }
  4479. # tag:java-specific
  4480. JAVA_ADD_DLLS_VALUE=no
  4481. macro ADD_DLLS_TO_JAR() {
  4482. SET(JAVA_ADD_DLLS_VALUE yes)
  4483. }
  4484. # tag:java-specific
  4485. MANAGED_PEERS=
  4486. MANAGED_PEERS_CLOSURE=
  4487. RUN_JAVA_PROGRAM_MANAGED=
  4488. MANAGEABLE_PEERS_ROOTS=contrib/java
  4489. HAS_MANAGEABLE_PEERS=no
  4490. PROPAGATES_MANAGEABLE_PEERS=no
  4491. # All items of this list must be PEERS, GHOST PEERS or TOOLS of the test module or module itself.
  4492. # All items of this list must has at least one of HAS_MANAGEABLE_PEERS or PROPAGATES_MANAGEABLE_PEERS flags set yes.
  4493. # This variable is used by JUnit tests but not TestNG.
  4494. TEST_CLASSPATH_VALUE=
  4495. # Calculated and replaced by ymake can be used in DART DATA
  4496. TEST_CLASSPATH_MANAGED=
  4497. # tag:java-specific
  4498. DEPENDENCY_MANAGEMENT_VALUE=
  4499. ### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
  4500. ###
  4501. ### 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.
  4502. ###
  4503. ### For example, if the module has PEERDIR (contrib/java/junit/junit), and
  4504. ### 1. specifies DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12),
  4505. ### the PEERDIR is automatically replaced by contrib/java/junit/junit/4.12;
  4506. ### 2. doesn't specify DEPENDENCY_MANAGEMENT, PEERDIR automatically replaced
  4507. ### with the default from contrib/java/junit/junit/ya.make.
  4508. ### These defaults are always there and are supported by maven-import, which puts
  4509. ### there the maximum version available in contrib/java.
  4510. ###
  4511. ### 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.
  4512. ###
  4513. ### If some module has both DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12) and PERDIR(contrib/java/junit/junit/4.11), the PEERDIR wins.
  4514. ###
  4515. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  4516. macro DEPENDENCY_MANAGEMENT(Args...) {
  4517. SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
  4518. _GHOST_PEERDIR($Args)
  4519. }
  4520. # tag:java-specific
  4521. WITH_JDK_VALUE=
  4522. ### @usage: WITH_JDK()
  4523. ###
  4524. ### Add directory with JDK to JAVA_PROGRAM output
  4525. macro WITH_JDK() {
  4526. SET(WITH_JDK_VALUE yes)
  4527. }
  4528. # tag:kotlin-specific
  4529. WITH_KOTLIN_VALUE=
  4530. ### @usage: WITH_KOTLIN()
  4531. ###
  4532. ### Compile kotlin source code in this java module
  4533. macro WITH_KOTLIN() {
  4534. SET(WITH_KOTLIN_VALUE yes)
  4535. }
  4536. # tag:kotlin-specific
  4537. WITH_KAPT_VALUE=
  4538. ### @usage: WITH_KAPT()
  4539. ###
  4540. ### Use kapt for as annotation processor
  4541. macro WITH_KAPT() {
  4542. SET(WITH_KAPT_VALUE yes)
  4543. }
  4544. # tag:java-specific
  4545. WITH_GROOVY_VALUE=
  4546. ### @usage: WITH_GROOVY()
  4547. ###
  4548. ### Compile groovy source code in this java module
  4549. macro WITH_GROOVY() {
  4550. SET(WITH_GROOVY_VALUE yes)
  4551. }
  4552. # tag:kotlin-specific
  4553. KOTLINC_FLAGS_VALUE=-Xjvm-default=all
  4554. ### @usage: KOTLINC_FLAGS(-flags)
  4555. ###
  4556. ### Set additional Kotlin compilation flags.
  4557. macro KOTLINC_FLAGS(Args...) {
  4558. SET_APPEND(KOTLINC_OPTS_VALUE $Args)
  4559. }
  4560. # tag:kotlin-sppecific
  4561. WITH_KOTLINC_PLUGIN_ALLOPEN=
  4562. macro _WITH_KOTLINC_ALLOPEN(Options...) {
  4563. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.allopen\::Options})
  4564. SET(WITH_KOTLINC_PLUGIN_ALLOPEN yes)
  4565. }
  4566. # tag:kotlin-specific
  4567. ### @usage: WITH_KOTLINC_ALLOPEN(-flags)
  4568. ###
  4569. ### Enable allopen kotlin compiler plugin https://kotlinlang.org/docs/all-open-plugin.html
  4570. macro WITH_KOTLINC_ALLOPEN(HEAD, TAIL...) {
  4571. _WITH_KOTLINC_ALLOPEN($HEAD $TAIL)
  4572. }
  4573. # tag:kotlin-specific
  4574. WITH_KOTLINC_PLUGIN_LOMBOK=
  4575. ### @usage: WITH_KOTLINC_LOMBOK(-flags)
  4576. ###
  4577. ### Enable lombok kotlin compiler plugin https://kotlinlang.org/docs/lombok.html
  4578. macro WITH_KOTLINC_LOMBOK(Options...) {
  4579. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.lombok\::Options})
  4580. SET(WITH_KOTLINC_PLUGIN_LOMBOK yes)
  4581. }
  4582. # tag:kotlin-specific
  4583. WITH_KOTLINC_PLUGIN_NOARG=
  4584. ### @usage: WITH_KOTLINC_NOARG(-flags)
  4585. ###
  4586. ### Enable noarg kotlin compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html
  4587. macro WITH_KOTLINC_NOARG(Options...) {
  4588. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.noarg\::Options})
  4589. SET(WITH_KOTLINC_PLUGIN_NOARG yes)
  4590. }
  4591. # tag:kotlin-specific
  4592. WITH_KOTLINC_PLUGIN_SERIALIZATION=
  4593. ### @usage: WITH_KOTLINC_SERIALIZATION()
  4594. ###
  4595. ### Enable serialization kotlin compiler plugin https://kotlinlang.org/docs/serialization.html
  4596. macro WITH_KOTLINC_SERIALIZATION() {
  4597. SET(WITH_KOTLINC_PLUGIN_SERIALIZATION yes)
  4598. }
  4599. # tag:kotlin-specific
  4600. ### Also search for _KAPT_OPTS and change version there
  4601. KOTLIN_VERSION=1.8.20
  4602. KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.8.20/ya.dependency_management.inc
  4603. GROOVY_VERSION=3.0.5
  4604. # tag:java-specific
  4605. DIRECT_DEPS_ONLY_VALUE=
  4606. ### @usage: DIRECT_DEPS_ONLY
  4607. ###
  4608. ### Add direct PEERDIR's only in java compile classpath
  4609. macro DIRECT_DEPS_ONLY() {
  4610. SET(DIRECT_DEPS_ONLY_VALUE yes)
  4611. }
  4612. # tag:java-specific
  4613. JAVA_EXTERNAL_DEPENDENCIES_VALUE=
  4614. ### @usage: JAVA_EXTERNAL_DEPENDENCIES(file1 file2 ...)
  4615. ###
  4616. ### Add non-source java external build dependency (like lombok config file)
  4617. macro JAVA_EXTERNAL_DEPENDENCIES(Args...) {
  4618. SET_APPEND(JAVA_EXTERNAL_DEPENDENCIES_VALUE $Args)
  4619. }
  4620. # tag:java-specific
  4621. JAVA_CLASSPATH_CMD_TYPE_VALUE=
  4622. # tag:java-specific
  4623. ### @usage:TEST_JAVA_CLASSPATH_CMD_TYPE(Type)
  4624. ### Available types: MANIFEST(default), COMMAND_FILE, LIST
  4625. ### Method for passing a classpath value to a java command line
  4626. ### MANIFEST via empty jar file with manifest that contains Class-Path attribute
  4627. ### COMMAND_FILE via @command_file
  4628. ### LIST via flat args
  4629. macro TEST_JAVA_CLASSPATH_CMD_TYPE(Type) {
  4630. SET(JAVA_CLASSPATH_CMD_TYPE_VALUE $Type)
  4631. }
  4632. # tag:java-specific
  4633. IGNORE_JAVA_DEPENDENCIES_CONFIGURATION=no
  4634. JAVA_DEPENDENCIES_CONFIGURATION_VALUE=
  4635. # tag:java-specific
  4636. ### @usage JAVA_DEPENDENCIES_CONFIGURATION(Vetos...)
  4637. ### Validate contrib/java dependencies
  4638. ### Valid arguments
  4639. ### FORBID_DIRECT_PEERDIRS - fail when module have direct PEERDIR (with version) (non-transitive)
  4640. ### FORBID_CONFLICT - fail when module have resolved without DEPENDENCY_MANAGEMENT version conflict (transitive)
  4641. ### FORBID_CONFLICT_DM - fail when module have resolved with DEPENDENCY_MANAGEMENT version conflict (transitive)
  4642. ### FORBID_CONFLICT_DM_RECENT - like FORBID_CONFLICT_DM but fail only when dependency have more recent version than specified in DEPENDENCY_MANAGEMENT
  4643. ### REQUIRE_DM - all dependencies must be specified in DEPENDENCY_MANAGEMENT (transitive)
  4644. macro JAVA_DEPENDENCIES_CONFIGURATION(Args...) {
  4645. SET_APPEND(JAVA_DEPENDENCIES_CONFIGURATION_VALUE $Args)
  4646. }
  4647. # tag:java-specific
  4648. # TODO(DEVTOOLS-6901): remove this variable when there are no more references to it in jbuild
  4649. JAVA_FORBIDDEN_LIBRARIES_VALUE=
  4650. # tag:java-specific
  4651. JAR_INCLUDE_FILTER_VALUE=
  4652. JAR_EXCLUDE_FILTER_VALUE=
  4653. # tag:java-specific
  4654. ### @usage:JAR_INCLUDE(Filters...)
  4655. ### Filter .jar file content: keep only matched files
  4656. ### * and ** patterns are supported (like JAVA_SRCS)
  4657. macro JAR_INCLUDE(Filters...) {
  4658. SET_APPEND(JAR_INCLUDE_FILTER_VALUE $Filters)
  4659. }
  4660. # tag:java-specific
  4661. ### @usage:JAR_EXCLUDE(Filters...)
  4662. ### Filter .jar file content: remove matched files
  4663. ### * and ** patterns are supported (like JAVA_SRCS)
  4664. macro JAR_EXCLUDE(Filters...) {
  4665. SET_APPEND(JAR_EXCLUDE_FILTER_VALUE $Filters)
  4666. }
  4667. # tag:sandbox-specific
  4668. ### @usage: SANDBOX_TASK([Name])
  4669. ###
  4670. ### Multimodule describing Sandbox task (Python code that can be executed by Sandbox system).
  4671. ###
  4672. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_TASKs as libraries.
  4673. ### The final artifact is provided when SANDBOX_TASK is referred to by DEPENDS and BUNDLE macros.
  4674. ### As PEERDIR target, it works like regular PY2_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_TASKs.
  4675. ###
  4676. ### Currently Sandbox supports only Python 2.x, so both variants will be compatible only with Python 2.x modules
  4677. ### and will select multimodule variants accordingly.
  4678. ###
  4679. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4680. multimodule SANDBOX_TASK {
  4681. module SB_TASK_BIN: _PY2_PROGRAM {
  4682. PY_MAIN(sandbox.taskbox.binary)
  4683. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4684. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4685. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4686. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4687. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4688. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4689. when ($FAIL_PY2 == "yes") {
  4690. _OK=no
  4691. }
  4692. elsewhen ($OPENSOURCE != "yes") {
  4693. PEERDIR+=build/rules/py2_deprecation
  4694. }
  4695. ASSERT(_OK You are using deprecated Python2-only code (SANDBOX_TASK). Please consider rewriting to 2/3-compatible code.)
  4696. }
  4697. module PY2: PY2_LIBRARY {
  4698. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4699. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4700. }
  4701. }
  4702. # tag:sandbox-specific
  4703. multimodule SANDBOX_PY23_TASK {
  4704. module SB_TASK_BIN: _PY2_PROGRAM {
  4705. .RESTRICTED=RUN_ANTLR4_PYTHON
  4706. PY_MAIN(sandbox.taskbox.binary)
  4707. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4708. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4709. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4710. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4711. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4712. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4713. }
  4714. module PY2: PY2_LIBRARY {
  4715. .RESTRICTED=RUN_ANTLR4_PYTHON
  4716. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4717. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4718. OBJ_SUF=.py2
  4719. }
  4720. module PY3: PY3_LIBRARY {
  4721. .RESTRICTED=RUN_ANTLR4_PYTHON
  4722. when ($MSVC == "yes" || $CYGWIN == "yes") {
  4723. MODULE_PREFIX=py3
  4724. }
  4725. otherwise {
  4726. MODULE_PREFIX=libpy3
  4727. }
  4728. OBJ_SUF=.py3
  4729. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  4730. PEERDIR(sandbox/sdk2)
  4731. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4732. }
  4733. }
  4734. # tag:sandbox-specific
  4735. ### @usage: SANDBOX_PY3_TASK([Name])
  4736. ###
  4737. ### Multimodule describing Sandbox task (Python3 code that can be executed by Sandbox system).
  4738. ###
  4739. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_PY3_TASKs as libraries.
  4740. ### The final artifact is provided when SANDBOX_PY3_TASK is referred to by DEPENDS and BUNDLE macros.
  4741. ### As PEERDIR target, it works like regular PY3_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_PY3_TASKs.
  4742. ###
  4743. ### Currently Sandbox supports Python 3.x only in binary tasks, both variants will be compatible only with Python 3.x and py23 libraries
  4744. ### and will select multimodule variants accordingly.
  4745. ###
  4746. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4747. multimodule SANDBOX_PY3_TASK {
  4748. module SB_TASK_BIN: PY3_PROGRAM_BIN {
  4749. .IGNORED=RUN_ANTLR4_PYTHON
  4750. PY_MAIN(sandbox.taskbox.binary)
  4751. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/taskbox/worker)
  4752. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4753. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4754. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4755. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4756. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4757. }
  4758. module PY3: PY3_LIBRARY {
  4759. PEERDIR(sandbox/sdk2)
  4760. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4761. }
  4762. }
  4763. # tag:python-specific tag:internal
  4764. NO_PYTHON_INCLS=no
  4765. ### @usage: NO_PYTHON_INCLUDES() # internal
  4766. ###
  4767. ### Disable dependencies on libraries providing Python headers.
  4768. ### This is only used in Python libraries themselves to avoid PEERDIR loops.
  4769. macro NO_PYTHON_INCLUDES() {
  4770. ENABLE(NO_PYTHON_INCLS)
  4771. }
  4772. # tag:python-specific
  4773. ### @usage: PYTHON2_ADDINCL()
  4774. ###
  4775. ### This macro adds include path for Python headers (Python 2.x variant) without PEERDIR.
  4776. ### This should be used in 2 cases only:
  4777. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4778. ### - In system Python libraries themselves since proper PEERDIR there may create a loop;
  4779. ### In all other cases use USE_PYTHON2 macro instead.
  4780. ###
  4781. ### Never use this macro in PY2_PROGRAM, PY2_LIBRARY and PY23_LIBRARY: they have everything needed by default.
  4782. ###
  4783. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4784. macro PYTHON2_ADDINCL() {
  4785. _PYTHON_ADDINCL()
  4786. SET(MODULE_TAG PY2_NATIVE)
  4787. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4788. }
  4789. # tag:python-specific tag:internal
  4790. ### @usage: _ARCADIA_PYTHON_ADDINCL() # internal
  4791. ### This macro sets up Python headers for modules with Arcadia python (e.g. PY2_LIBRARY) and configures module as Python 2.x.
  4792. macro _ARCADIA_PYTHON_ADDINCL() {
  4793. _PYTHON_ADDINCL()
  4794. SET(MODULE_TAG PY2)
  4795. SET(PEERDIR_TAGS PY2 PY2_NATIVE PY_PROTO PY2_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4796. }
  4797. # tag:python-specific tag:internal
  4798. ### @usage: _PYTHON_ADDINCL() # internal
  4799. ### This macro sets up Python 2.x headers for both Arcadia and non-Arcadia python.
  4800. macro _PYTHON_ADDINCL() {
  4801. SET(PYTHON2 yes)
  4802. SET(PYTHON3 no)
  4803. when ($USE_ARCADIA_PYTHON == "yes") {
  4804. ADDINCL+=GLOBAL contrib/libs/python/Include
  4805. CFLAGS+=-DARCADIA_PYTHON_UNICODE_SIZE=$ARCADIA_PYTHON_UNICODE_SIZE
  4806. }
  4807. otherwise {
  4808. when ($USE_SYSTEM_PYTHON) {
  4809. PEERDIR+=build/platform/python
  4810. }
  4811. otherwise {
  4812. CFLAGS+=$PYTHON_INCLUDE
  4813. }
  4814. }
  4815. }
  4816. # tag:python-specific
  4817. ### @usage: PYTHON3_ADDINCL()
  4818. ###
  4819. ### This macro adds include path for Python headers (Python 3.x variant).
  4820. ### This should be used in 2 cases only:
  4821. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4822. ### - In system Python libraries themselves since peerdir there may create a loop;
  4823. ### In all other cases use USE_PYTHON3() macro instead.
  4824. ###
  4825. ### Never use this macro in PY3_PROGRAM and PY3_LIBRARY and PY23_LIBRARY: they have everything by default.
  4826. ###
  4827. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4828. macro PYTHON3_ADDINCL() {
  4829. _PYTHON3_ADDINCL()
  4830. SET(MODULE_TAG PY3_NATIVE)
  4831. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY3_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4832. }
  4833. # tag:python-specific tag:internal
  4834. ### @usage: _ARCADIA_PYTHON3_ADDINCL() # internal
  4835. ###
  4836. ### This macro sets up Python3 headers for modules with Arcadia python (e.g. PY3_LIBRARY) and configures module as Python 3.x.
  4837. macro _ARCADIA_PYTHON3_ADDINCL() {
  4838. _PYTHON3_ADDINCL()
  4839. SET(MODULE_TAG PY3)
  4840. SET(MODULE_LANG PY3)
  4841. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE PY3_PROTO PY3_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4842. }
  4843. # tag:python-specific tag:internal
  4844. ### @usage: _PYTHON_ADDINCL() # internal
  4845. ###
  4846. ### This macro sets up Python 3.x headers for both Arcadia and non-Arcadia python.
  4847. macro _PYTHON3_ADDINCL() {
  4848. SET(PYTHON3 yes)
  4849. SET(PYTHON2 no)
  4850. when ($USE_ARCADIA_PYTHON == "yes") {
  4851. CFLAGS+=-DUSE_PYTHON3
  4852. ADDINCL+=GLOBAL contrib/libs/python/Include
  4853. }
  4854. otherwise {
  4855. when ($USE_SYSTEM_PYTHON) {
  4856. PEERDIR+=build/platform/python
  4857. }
  4858. otherwise {
  4859. CFLAGS+=$PYTHON_INCLUDE
  4860. }
  4861. }
  4862. }
  4863. # tag:python-specific
  4864. ### @usage: USE_PYTHON2()
  4865. ###
  4866. ### This adds Python 2.x runtime library to your LIBRARY and makes it Python2-compatible.
  4867. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4868. ###
  4869. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4870. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4871. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4872. ###
  4873. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4874. macro USE_PYTHON2() {
  4875. _ARCADIA_PYTHON_ADDINCL()
  4876. SET(PEERDIR_TAGS PY2 PY2_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4877. PEERDIR(contrib/libs/python)
  4878. }
  4879. # tag:python-specific
  4880. ### @usage: USE_PYTHON3()
  4881. ###
  4882. ### This adds Python3 library to your LIBRARY and makes it Python3-compatible.
  4883. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4884. ###
  4885. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4886. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4887. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4888. ###
  4889. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4890. macro USE_PYTHON3() {
  4891. _ARCADIA_PYTHON3_ADDINCL()
  4892. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4893. PEERDIR(contrib/libs/python)
  4894. when ($USE_ARCADIA_PYTHON == "yes") {
  4895. PEERDIR+=library/python/runtime_py3
  4896. }
  4897. }
  4898. # tag:python-specific
  4899. when ($PERL_DEFAULT_PEERDIR == "yes") {
  4900. when (($PERLXS == "yes") || ($PERLXSCPP == "yes") || ($USE_PERL == "yes")) {
  4901. PEERDIR+=build/platform/perl
  4902. }
  4903. }
  4904. # tag:perl-specific
  4905. ### @usage: USE_PERL_LIB()
  4906. ### Add dependency on Perl to your LIBRARY
  4907. macro USE_PERL_LIB() {
  4908. PEERDIR(build/platform/perl)
  4909. }
  4910. # tag:perl-specific
  4911. ### @usage: USE_PERL_514_LIB()
  4912. ### Add dependency on Perl 5.14 to your LIBRARY
  4913. macro USE_PERL_514_LIB() {
  4914. SET(PERL_SDK ubuntu-12)
  4915. SET(PERL_DEFAULT_PEERDIR no)
  4916. PEERDIR(build/platform/perl/5.14)
  4917. }
  4918. # tag:perl-specific
  4919. ### @usage: ADD_PERL_MODULE(Dir ModuleName)
  4920. ### Add dependency on specified Perl module to the library
  4921. macro ADD_PERL_MODULE(Dir, Module) {
  4922. PEERDIR($Dir)
  4923. SET_APPEND(modules $Module)
  4924. }
  4925. # tag:allocator
  4926. ### @usage: ALLOCATOR(Alloc) # Default: LF
  4927. ###
  4928. ### Set memory allocator implementation for the PROGRAM()/DLL() module.
  4929. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
  4930. ###
  4931. ### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU", "PROFILED_HU".
  4932. ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
  4933. ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
  4934. ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
  4935. ### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
  4936. ### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
  4937. ### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
  4938. ### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
  4939. ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
  4940. ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
  4941. ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
  4942. ### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
  4943. ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
  4944. ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
  4945. ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
  4946. ### - SYSTEM - Use target system allocator
  4947. ### - FAKE - Don't link with any allocator
  4948. ### - HU - Huge page allocator by @gulin.
  4949. ### - PROFILED_HU - patched HU. It is a bit slower but has metrics of memory consumption.
  4950. ###
  4951. ### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
  4952. macro ALLOCATOR(Alloc) {
  4953. SET(ALLOCATOR $Alloc)
  4954. 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", "PROFILED_HU" ]) {
  4955. }
  4956. otherwise {
  4957. PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
  4958. }
  4959. }
  4960. when ($MIC_ARCH == "yes") {
  4961. CFLAGS+=-mmic
  4962. LDFLAGS+=-mmic
  4963. }
  4964. when ($USE_OPENMP == "yes") {
  4965. PEERDIR+=contrib/libs/openmp
  4966. }
  4967. when ($STRIP == "yes" && $NO_STRIP != "yes") {
  4968. STRIP_FLAG=$LD_STRIP_FLAG
  4969. DWARF_COMMAND=
  4970. GO_LINK_FLAGS_VALUE+=-s
  4971. }
  4972. when ($NO_LINKER_DCE != "yes") {
  4973. DCE_FLAG=$LD_DCE_FLAG
  4974. }
  4975. when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
  4976. ICF_FLAG=$LD_ICF_FLAG
  4977. }
  4978. OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
  4979. OBJDUMP_TOOL=$OBJDUMP_TOOL_VENDOR
  4980. STRIP_TOOL=$STRIP_TOOL_VENDOR
  4981. NEED_BINUTILS_PEERDIR=
  4982. BINUTILS_USED=
  4983. when (!$OBJCOPY_TOOL_VENDOR) {
  4984. OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
  4985. NEED_BINUTILS_PEERDIR=yes
  4986. }
  4987. when (!$OBJDUMP_TOOL_VENDOR) {
  4988. OBJDUMP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objdump
  4989. NEED_BINUTILS_PEERDIR=yes
  4990. }
  4991. when (!$STRIP_TOOL_VENDOR) {
  4992. STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
  4993. NEED_BINUTILS_PEERDIR=yes
  4994. }
  4995. SPLIT_DWARF_VALUE=no
  4996. NO_SPLIT_DWARF=no
  4997. when ($OS_DARWIN) {
  4998. SPLIT_DWARF_VALUE=yes
  4999. }
  5000. when ($STRIP_DEBUG_INFO) {
  5001. SPLIT_DWARF_VALUE=yes
  5002. NO_SPLIT_DWARF=no
  5003. }
  5004. ### @usage: SPLIT_DWARF()
  5005. ###
  5006. ### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
  5007. ### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
  5008. macro SPLIT_DWARF() {
  5009. SET(SPLIT_DWARF_VALUE yes)
  5010. }
  5011. ### @usage: NO_SPLIT_DWARF()
  5012. ###
  5013. ### Do NOT emit debug info for the PROGRAM/DLL as a separate file.
  5014. ### On macOS this also means do NOT generate dSym files (faster linkage)
  5015. macro NO_SPLIT_DWARF() {
  5016. SET(SPLIT_DWARF_VALUE no)
  5017. }
  5018. SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
  5019. when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
  5020. DWARF_COMMAND+= \
  5021. $OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
  5022. $STRIP_TOOL --strip-debug $TARGET && \
  5023. $OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
  5024. BINUTILS_USED=yes
  5025. }
  5026. ### @usage: EXTRALIBS_STATIC(Libs...)
  5027. ###
  5028. ### Add the specified external static libraries to the program link
  5029. macro EXTRALIBS_STATIC(Args...) {
  5030. LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
  5031. }
  5032. ### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
  5033. ###
  5034. ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
  5035. macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
  5036. __translatename_lower=${tolower:Name}
  5037. __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
  5038. RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
  5039. }
  5040. ### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
  5041. ###
  5042. ### Generate transliteration dictionary code
  5043. ### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
  5044. macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
  5045. __translitname_lower=${tolower:Name}
  5046. __translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
  5047. __untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
  5048. __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
  5049. __gentrie_dir=dict/tools/make_untranslit_trie
  5050. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
  5051. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
  5052. RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
  5053. }
  5054. # tag:python-specific tag:proto tag:deprecated
  5055. ### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated
  5056. ###
  5057. ### Generate python bindings for protobuf files.
  5058. ### Macro is obsolete and not recommended for use!
  5059. macro GENERATE_PY_PROTOS(FILES...) {
  5060. foreach (FILE : $FILES) {
  5061. _PY_PROTO_CMD($FILE)
  5062. }
  5063. }
  5064. # tag:python-specific tag:proto
  5065. macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) {
  5066. foreach (FILE : $FILES) {
  5067. _PY_PROTO_CMD_INTERNAL($FILE)
  5068. }
  5069. }
  5070. # tag:python-specific
  5071. macro _GENERATE_PY_EVS_INTERNAL(FILES...) {
  5072. foreach (FILE : $FILES) {
  5073. _PY_EVLOG_CMD_INTERNAL($FILE)
  5074. }
  5075. }
  5076. macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[], OUTPUT_INCLUDES_INP[]) {
  5077. .CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} ${output_include;from_input;hide:OUTPUT_INCLUDES_INP} $INDUCED_DEPS ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"}
  5078. .SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST}
  5079. }
  5080. ### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
  5081. ###
  5082. ### Copy file to build root. It is possible to change both location and the name.
  5083. ###
  5084. ### Parameters:
  5085. ### - File - Source file name.
  5086. ### - Destination - Output file name.
  5087. ### - AUTO - Consider copied file for further processing automatically.
  5088. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
  5089. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  5090. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type)
  5091. ### and set of dependencies
  5092. ###
  5093. ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
  5094. ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
  5095. macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  5096. .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  5097. .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination)
  5098. }
  5099. ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
  5100. ###
  5101. ### Copy file to build root the same way as it is done for COPY_FILE, but also
  5102. ### propagates the context of the source file.
  5103. macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  5104. .CMD=$_COPY_FILE_IMPL($FILE $AUTO $DEST OUTPUT_INCLUDES_INP $FILE OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  5105. }
  5106. ### This is to join $ALL_RES_ and $EXT
  5107. macro _ARF_HELPER(Args...) {
  5108. RESOURCE_FILES($Args)
  5109. }
  5110. ### @usage ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
  5111. ###
  5112. ### This macro collects all files with extension `Ext` and
  5113. ### Passes them to `RESOURCE_FILES` macro as relative to current directory
  5114. ###
  5115. ### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
  5116. ###
  5117. ### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
  5118. ### Note: Wildcards are not allowed neither as Ext nor in Dirs
  5119. macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
  5120. _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
  5121. _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT})
  5122. }
  5123. macro _BUNDLE_TARGET(Target, Destination) {
  5124. .CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
  5125. }
  5126. ### @usage: TIMEOUT(TIMEOUT)
  5127. ###
  5128. ### Sets a timeout on test execution
  5129. ###
  5130. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5131. macro TIMEOUT(Time) {
  5132. SET(TEST_TIMEOUT $Time)
  5133. }
  5134. SBR_UID_EXT=""
  5135. # tag:test
  5136. ### @usage: VALIDATE_DATA_RESTART(ext)
  5137. ###
  5138. ### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
  5139. ### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
  5140. macro VALIDATE_DATA_RESTART(Ext) {
  5141. SET(SBR_UID_EXT $Ext)
  5142. }
  5143. # tag:test
  5144. TEST_FORK_MODE=none
  5145. TEST_PARTITION=SEQUENTIAL
  5146. # tag:test
  5147. ### @usage: FORK_TESTS()
  5148. ###
  5149. ### Splits a test run on chunks by test classes.
  5150. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  5151. ###
  5152. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  5153. ###
  5154. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5155. macro FORK_TESTS(MODE...) {
  5156. SET(TEST_FORK_MODE tests)
  5157. SET(TEST_PARTITION $MODE)
  5158. }
  5159. # tag:test
  5160. ### @usage: FORK_SUBTESTS()
  5161. ###
  5162. ### Splits the test run in chunks on subtests.
  5163. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  5164. ###
  5165. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  5166. ###
  5167. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5168. macro FORK_SUBTESTS(MODE...) {
  5169. SET(TEST_FORK_MODE subtests)
  5170. SET(TEST_PARTITION $MODE)
  5171. }
  5172. # tag:test
  5173. ### @usage: SPLIT_FACTOR(x)
  5174. ###
  5175. ### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
  5176. ### If none of those is specified this macro implies FORK_TESTS().
  5177. ###
  5178. ### Supports C++ ut and PyTest.
  5179. ###
  5180. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5181. macro SPLIT_FACTOR(Factor) {
  5182. SET(TEST_SPLIT_FACTOR $Factor)
  5183. }
  5184. # tag:test
  5185. FORK_TEST_FILES_MODE=
  5186. ### @usage: FORK_TEST_FILES()
  5187. ###
  5188. ### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
  5189. ### Compatible with FORK_(SUB)TESTS.
  5190. ###
  5191. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5192. macro FORK_TEST_FILES() {
  5193. SET(FORK_TEST_FILES_MODE on)
  5194. }
  5195. # tag:test
  5196. TEST_SIZE_NAME=SMALL
  5197. ### @usage: SIZE(SMALL/MEDIUM/LARGE)
  5198. ###
  5199. ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
  5200. ### See documentation on test system for more details.
  5201. ###
  5202. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5203. macro SIZE(Type) {
  5204. SET(TEST_SIZE_NAME $Type)
  5205. }
  5206. ### @usage: JOIN_SRCS(Out Src...)
  5207. ###
  5208. ### Join set of sources into single file named Out and send it for further processing.
  5209. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  5210. ### You should specify file name with the extension as Out. Further processing will be done according this extension.
  5211. macro JOIN_SRCS(Out, Src...) {
  5212. .CMD=$YMAKE_PYTHON3 ${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;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  5213. .SEM=target_joined_source $Out ${input:Src} ${output;hide;suf=.o:Out} ${input;hide:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"}
  5214. _CONDITIONAL_SRCS($TIDY_VALUE $Src)
  5215. }
  5216. ### @usage: JOIN_SRCS_GLOBAL(Out Src...)
  5217. ###
  5218. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  5219. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  5220. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  5221. macro JOIN_SRCS_GLOBAL(Out, Src...) {
  5222. .CMD=$YMAKE_PYTHON3 ${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;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  5223. SRCS(GLOBAL $Out)
  5224. }
  5225. ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
  5226. ###
  5227. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  5228. ### This macro places all files into single file, so will work with any sources.
  5229. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  5230. macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
  5231. .CMD=$FS_TOOLS cat ${output;noauto:Out} --ya-start-command-file ${input:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  5232. SRCS(GLOBAL $Out)
  5233. }
  5234. # tag:cpu
  5235. PIC_CFLAGS=
  5236. SSE2_CFLAGS=
  5237. SSE3_CFLAGS=
  5238. SSSE3_CFLAGS=
  5239. SSE41_CFLAGS=
  5240. SSE42_CFLAGS=
  5241. POPCNT_CFLAGS=
  5242. PCLMUL_CFLAGS=
  5243. CX16_FLAGS=
  5244. AVX_CFLAGS=
  5245. AVX2_CFLAGS=
  5246. AVX512_CFLAGS=
  5247. AMX_CFLAGS=
  5248. # tag:cpu
  5249. SSE_DEFINES=
  5250. SSE_CFLAGS=
  5251. SSE4_DEFINES=
  5252. SSE4_CFLAGS=
  5253. XOP_CFLAGS=
  5254. NO_LTO_CFLAGS=
  5255. # tag:cpu
  5256. when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
  5257. when ($CLANG || $CLANG_CL || $GCC) {
  5258. PIC_CFLAGS=-fPIC
  5259. SSE2_CFLAGS=-msse2
  5260. SSE3_CFLAGS=-msse3
  5261. SSSE3_CFLAGS=-mssse3
  5262. SSE41_CFLAGS=-msse4.1
  5263. SSE42_CFLAGS=-msse4.2
  5264. XOP_CFLAGS=-mxop
  5265. POPCNT_CFLAGS=-mpopcnt
  5266. PCLMUL_CFLAGS=-mpclmul
  5267. AVX_CFLAGS=-mavx
  5268. # On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell.
  5269. # See:
  5270. # https://en.wikipedia.org/wiki/FMA_instruction_set
  5271. # https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
  5272. #
  5273. # AMD implemented FMA3 in Piledriver architecture over AVX (that is, prior to AVX-2 which was introduced in Zen).
  5274. # BMI2 implementation was released by AMD along with AVX-2 support.
  5275. # See:
  5276. # https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
  5277. #
  5278. # Due to the above, it looks safe to enable all three extensions whenever AVX-2 is enabled.
  5279. AVX2_CFLAGS=-mavx2 -mfma -mbmi -mbmi2
  5280. # All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
  5281. # (these are Xeon Phi)
  5282. # See:
  5283. # https://en.wikichip.org/wiki/x86/avx-512
  5284. AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
  5285. # AMX stands Advanced Matrix Extension supported by modern Intel architectures
  5286. # See:
  5287. # https://en.wikipedia.org/wiki/Advanced_Matrix_Extensions
  5288. # https://en.wikichip.org/wiki/x86/amx
  5289. AMX_CFLAGS=-mamx-tile -mamx-int8 ${AVX512_CFLAGS}
  5290. when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
  5291. CX16_FLAGS=-mcx16
  5292. }
  5293. SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
  5294. SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
  5295. }
  5296. elsewhen ($MSVC) {
  5297. SSE2_CFLAGS=/D__SSE2__=1
  5298. SSE3_CFLAGS=/D__SSE3__=1
  5299. SSSE3_CFLAGS=/D__SSSE3__=1
  5300. SSE41_CFLAGS=/D__SSE4_1__=1
  5301. SSE42_CFLAGS=/D__SSE4_2__=1
  5302. POPCNT_CFLAGS=/D__POPCNT__=1
  5303. PCLMUL_CFLAGS=/D__PCLMUL__=1
  5304. AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
  5305. AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
  5306. AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
  5307. SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
  5308. SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
  5309. }
  5310. SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
  5311. SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
  5312. when ($ARCH_I386 && $OS_ANDROID == "yes") {
  5313. USE_SSE4=no
  5314. }
  5315. }
  5316. otherwise {
  5317. USE_SSE4=no
  5318. CPU_CHECK=no
  5319. }
  5320. # tag:cpu
  5321. when ($NOSSE == "yes") {
  5322. USE_SSE4=no
  5323. }
  5324. # tag:cpu
  5325. ### @usage: NO_SSE4()
  5326. ###
  5327. ### Compile module without SSE4
  5328. macro NO_SSE4() {
  5329. SET(USE_SSE4 no)
  5330. }
  5331. # tag:cpu
  5332. ### @usage: NO_CPU_CHECK()
  5333. ###
  5334. ### Compile module without startup CPU features check
  5335. macro NO_CPU_CHECK() {
  5336. SET(CPU_CHECK no)
  5337. }
  5338. ### @usage: ADDINCLSELF()
  5339. ###
  5340. ### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
  5341. macro ADDINCLSELF(FOR="") {
  5342. when($FOR) {
  5343. ADDINCL+=FOR $FOR ${MODDIR}
  5344. }
  5345. otherwise {
  5346. ADDINCL+=${MODDIR}
  5347. }
  5348. }
  5349. COMPILE_OUT_SUFFIX=
  5350. _COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
  5351. _COMPILE_TIME_TRACE_OUTPUTS=${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
  5352. macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?";norel":"") {
  5353. SET(_COMPILE_OUTPUTS \${output;suf=\${OBJECT_SUF}$NOREL:SRC})
  5354. SET(_COMPILE_TIME_TRACE_OUTPUTS \${output;noauto;suf=\${OBJECT_SUF}.time_trace.json$NOREL:SRC})
  5355. }
  5356. # tag:internal
  5357. ### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
  5358. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " before $Args when GENERATE
  5359. ### is specified in the list of actual arguments
  5360. macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
  5361. .SEM=$GENERATE $Args
  5362. }
  5363. # tag:internal
  5364. ### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
  5365. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " if Args is not empty
  5366. macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
  5367. .SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
  5368. }
  5369. _EMPTY_CMD=
  5370. # tag:src-processing tag:internal
  5371. ### @usage: _SRC(Ext Src Flags) # internal
  5372. ###
  5373. ### Basic building block of extension-based command dispatching
  5374. ### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
  5375. ### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
  5376. ### of other commands (except ones marked as noauto)
  5377. macro _SRC(EXT, SRC, SRCFLAGS...) {
  5378. # Generic macro definition for _SRC (just a placeholder, it does nothing)
  5379. }
  5380. # tag:src-processing
  5381. macro _SRC("swg", SRC, SRCFLAGS...) {
  5382. .CMD=${_SWIG_CMD}
  5383. .ADDINCL=${_SWIG_ADDINCLS}
  5384. .PEERDIR=${_SWIG_PEERDIR}
  5385. .SEM=conan_require_tool swig/4.0.2 && conan_import '"bin, *swig* -> ./bin"' ${input;hide:SRC} ${_SWIG_SEM_TO_MODULE_LINK}
  5386. }
  5387. RODATA_SYMBOL_PREFIX=
  5388. when ($DARWIN == "yes" || $IOS == "yes" || ($WINDOWS == "yes" && $ARCH_TYPE_32 == "yes")) {
  5389. RODATA_SYMBOL_PREFIX=_
  5390. }
  5391. RODATA_ELF_FLAGS=
  5392. when($LINUX == "yes" || $ANDROID == "yes") {
  5393. RODATA_ELF_FLAGS=--elf
  5394. }
  5395. 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})
  5396. when (($ARCH_AARCH64 || $ARCH_ARM || $ARCH_PPC64LE || $ARCH_RISCV32) == "yes") {
  5397. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2cpp.py"} ${noext;nopath:SRC} ${input:SRC} ${output;suf=.cpp:SRC}
  5398. }
  5399. # tag:src-processing
  5400. macro _SRC("rodata", SRC, SRCFLAGS...) {
  5401. .CMD=$RODATA_COMPILE ${hide;kv:"p RD"} ${hide;kv:"pc light-green"}
  5402. .SEM=target_rodata_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} ${input;hide:"build/scripts/rodata2cpp.py"}
  5403. }
  5404. # tag:src-processing
  5405. macro _SRC("S", SRC, SRCFLAGS...) {
  5406. .CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output:SRC.o} ${input:SRC} ${pre=-I:_C__INCLUDE}
  5407. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS) && add_language ASM
  5408. }
  5409. # tag:src-processing
  5410. macro _SRC("s", SRC, SRCFLAGS...) {
  5411. .CMD=$_SRC(S, $SRC $SRCFLAGS)
  5412. }
  5413. # tag:src-processing
  5414. macro _SRC("s79", SRC, SRCFLAGS...) {
  5415. .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
  5416. }
  5417. # tag:src-processing
  5418. macro _SRC("mm", SRC, SRCFLAGS...) {
  5419. .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
  5420. }
  5421. # tag:src-processing
  5422. macro _SRC("fml", SRC, SRCFLAGS...) {
  5423. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output:SRC.inc} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5424. }
  5425. # tag:src-processing
  5426. macro _SRC("fml2", SRC, SRCFLAGS...) {
  5427. .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"}
  5428. }
  5429. # tag:src-processing
  5430. macro _SRC("fml3", SRC, SRCFLAGS...) {
  5431. .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"}
  5432. }
  5433. # tag:src-processing
  5434. macro _SRC("sfdl", SRC, SRCFLAGS...) {
  5435. .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
  5436. }
  5437. macro _XS_SRCS(SRC, TYPEMAPS[], SRCFLAGS...) {
  5438. .CMD=$PERL_LD_LIBRARY_PATH $PERL $PERL_INCLUDE ${suf=/ExtUtils/xsubpp:PERL_PRIVLIB} -typemap ${suf=/ExtUtils/typemap:PERL_PRIVLIB} $PERLSUFFIX $XSUBPPFLAGS ${pre=-typemap :TYPEMAPS} ${input;hide:TYPEMAPS} ${SRCFLAGS} ${input:SRC} ${PERLOUTPUT} ${kv;hide:"p XS"} ${kv;hide:"pc yellow"}
  5439. }
  5440. # tag:src-processing
  5441. macro _SRC("xs", SRC, SRCFLAGS...) {
  5442. .CMD=$_XS_SRCS($SRC TYPEMAPS $_XSTYPEMAPS $SRCFLAGS)
  5443. }
  5444. # tag:src-processing
  5445. macro _SRC("gperf", SRC, SRCFLAGS...) {
  5446. .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"}
  5447. }
  5448. # tag:src-processing
  5449. macro _SRC("rl", SRC, SRCFLAGS...) {
  5450. .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"}
  5451. }
  5452. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5453. .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"}
  5454. }
  5455. # tag:src-processing
  5456. macro _SRC("rl5", SRC, SRCFLAGS...) {
  5457. .CMD=$_SRC(rl $SRC $SRCFLAGS)
  5458. }
  5459. # tag:src-processing
  5460. macro _SRC("asp", SRC, SRCFLAGS...) {
  5461. .CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${kv;hide:"p HT"} ${kv;hide:"pc yellow"}
  5462. }
  5463. # tag:src-processing
  5464. macro _SRC("rl6", SRC, SRCFLAGS...) {
  5465. .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"}
  5466. .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_tool ragel/6.10 && conan_import '"bin, ragel* -> ./bin"' ${input;hide:"build/scripts/run_tool.py"}
  5467. }
  5468. # tag:src-processing
  5469. macro _SRC("pln", SRC, SRCFLAGS...) {
  5470. .CMD=$FML_TOOL -b -o ${output;pre=pln.;nopath;noext:SRC.cpp} -f ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5471. }
  5472. # tag:src-processing
  5473. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5474. .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"}
  5475. }
  5476. # tag:src-processing
  5477. macro _SRC("ev", SRC, SRCFLAGS...) {
  5478. .CMD=$EVLOG_CMD($SRC)
  5479. .SEM=$EVLOG_CMD($SRC)
  5480. }
  5481. # tag:src-processing
  5482. macro _SRC("proto", SRC, SRCFLAGS...) {
  5483. .CMD=$PROTO_CMD($SRC)
  5484. .SEM=$PROTO_CMD($SRC)
  5485. }
  5486. # tag:src-processing
  5487. macro _SRC("gztproto", SRC, SRCFLAGS...) {
  5488. # _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.
  5489. # descriptor.proto must be resolved as google/protobuf/descriptor.proto
  5490. .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"}
  5491. .PEERDIR=kernel/gazetteer/proto
  5492. }
  5493. # tag:src-processing
  5494. macro _SRC("cfgproto", SRC, SRCFLAGS...) {
  5495. .CMD=$_CPP_CFGPROTO_CMD($SRC)
  5496. }
  5497. # tag:src-processing
  5498. macro _SRC("pyx", SRC, SRCFLAGS...) {
  5499. # Copy-paste from BUILDWITH_CYTHON
  5500. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:SRC} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:SRC} $CYTHON_OUTPUT_INCLUDES ${SRCFLAGS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5501. .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
  5502. .ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
  5503. }
  5504. # tag:src-processing
  5505. macro _SRC("in", SRC, SRCFLAGS...) {
  5506. .CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5507. .SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5508. }
  5509. macro MANUAL_GENERATION(Outs...) {
  5510. .SEM=IGNORED ${output;hide;noauto:Outs}
  5511. }
  5512. # tag:src-processing
  5513. macro _SRC("sc", SRC, SRCFLAGS...) {
  5514. .CMD=${tool:"tools/domschemec"} --in ${input:SRC} --out ${output;norel:SRC.h} ${output_include;hide:"util/generic/strbuf.h"} ${output_include;hide:"array"} ${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"}
  5515. }
  5516. # tag:src-processing
  5517. macro _SRC("ssqls", SRC, SRCFLAGS...) {
  5518. .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"}
  5519. }
  5520. # tag:src-processing
  5521. macro _SRC("f", SRC, SRCFLAGS...) {
  5522. .CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${output_include;hide:"f2c.h"} ${kv;hide:"p FT"} ${kv;hide:"pc light-green"}
  5523. .PEERDIR=contrib/libs/libf2c
  5524. .ADDINCL=contrib/libs/libf2c
  5525. }
  5526. # tag:src-processing
  5527. macro _SRC("cpp", SRC, SRCFLAGS...) {
  5528. .CMD=$_SRC_cpp($SRC $SRCFLAGS)
  5529. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5530. }
  5531. # tag:src-processing
  5532. macro _SRC("cxx", SRC, SRCFLAGS...) {
  5533. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5534. }
  5535. # tag:src-processing
  5536. macro _SRC("cc", SRC, SRCFLAGS...) {
  5537. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5538. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5539. }
  5540. # tag:src-processing
  5541. macro _SRC("auxcpp", SRC, SRCFLAGS...) {
  5542. .CMD=$_SRC_cpp($SRC $_FORCE_CPP_FLAGS $SRCFLAGS)
  5543. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($_FORCE_CPP_FLAGS $SRCFLAGS)
  5544. }
  5545. # tag:src-processing
  5546. macro _SRC("C", SRC, SRCFLAGS...) {
  5547. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5548. }
  5549. # tag:src-processing
  5550. macro _SRC("c", SRC, SRCFLAGS...) {
  5551. .CMD=$_SRC_c($SRC $SRCFLAGS)
  5552. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
  5553. }
  5554. # tag:src-processing
  5555. macro _SRC("m", SRC, SRCFLAGS...) {
  5556. .CMD=$_SRC(c $SRC $SRCFLAGS)
  5557. }
  5558. # tag:src-processing
  5559. macro _SRC("masm", SRC, SRCFLAGS...) {
  5560. .CMD=$_SRC_masm($SRC $SRCFLAGS)
  5561. }
  5562. 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} ${input;hide:"build/scripts/run_tool.py"} \
  5563. && 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 \
  5564. && add_language ASM \
  5565. && conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5566. ASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${input;hide:"build/scripts/run_tool.py"} \
  5567. && 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 \
  5568. && add_language ASM \
  5569. && conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5570. # tag:src-processing
  5571. macro _SRC("yasm", SRC, SRCFLAGS...) {
  5572. .CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  5573. .SEM=$YASM_SEM
  5574. }
  5575. # tag:src-processing
  5576. macro _SRC("asm", SRC, SRCFLAGS...) {
  5577. .CMD=$_SRC_ASM($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  5578. .SEM=$ASM_SEM
  5579. }
  5580. # tag:src-processing
  5581. macro _SRC("lua", SRC, SRCFLAGS...) {
  5582. .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"}
  5583. .PEERDIR=$LUAJIT_PATH
  5584. }
  5585. NVCC_CFLAGS=
  5586. when ($IDE_MSVS_CALL == "yes") {
  5587. # This is to avoid issues with .pdb from MSVC calling nvcc calling cl
  5588. NVCC_CFLAGS+=/Fd$(TEMP)
  5589. }
  5590. NVCC_STD_VER=14
  5591. when ($MSVC == "yes") {
  5592. NVCC_STD=/std:c++${NVCC_STD_VER}
  5593. }
  5594. otherwise {
  5595. NVCC_STD=-std=c++${NVCC_STD_VER}
  5596. }
  5597. # tag:src-processing
  5598. macro _SRC("cu", SRC, SRCFLAGS...) {
  5599. .CMD=$_SRC_CU_CMD
  5600. .SEM=target_cuda_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} && set_global_flags CMAKE_CUDA_STANDARD ${NVCC_STD_VER} && target_cuda_flags $CUDA_NVCC_FLAGS && target_cuda_cflags $USER_CXXFLAGS $SRCFLAGS $_SEM_EXTRA_CXX_FLAGS
  5601. .PEERDIR=$_SRC_CU_PEERDIR
  5602. }
  5603. # tag:src-processing
  5604. macro _SRC("fbs", SRC, SRCFLAGS...) {
  5605. .CMD=$FBS_CMD($SRC, $SRCFLAGS)
  5606. .SEM=$FBS_CMD($SRC, $SRCFLAGS)
  5607. }
  5608. # tag:src-processing
  5609. macro _SRC("fbs64", SRC, SRCFLAGS...) {
  5610. .CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
  5611. }
  5612. # tag:src-processing
  5613. macro _SRC("pysrc", SRC, SRCFLAGS...) {
  5614. .CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
  5615. }
  5616. # tag:src-processing
  5617. # This triggers configure error in attempt to add `ya.make` to SRCS macro or apply automatic processing by extension from codegen
  5618. macro _SRC("make", SRC, SRCFLAGS...) {
  5619. .CMD=
  5620. }
  5621. @import "${CONF_ROOT}/conf/bison_lex.conf"
  5622. # tag:src-processing
  5623. macro _SRC_py2src(SRC, SRCFLAGS...) {
  5624. .CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${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"}
  5625. }
  5626. # tag:src-processing
  5627. macro _SRC_py3src(SRC, SRCFLAGS...) {
  5628. .CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${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"}
  5629. }
  5630. # tag:src-processing python-specific
  5631. when ($PYTHON3 == "yes") {
  5632. MACRO_ALIAS(_SRC_PYSRC _SRC_py3src)
  5633. }
  5634. otherwise {
  5635. MACRO_ALIAS(_SRC_PYSRC _SRC_py2src)
  5636. }
  5637. # tag:src-processing
  5638. macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
  5639. .CMD=$_SRC_C_NODEPS_CMD
  5640. }
  5641. # Custom flags for generated cpp-files. To support another generator:
  5642. # - insert additional file extension before .cpp into generated cpp-file name
  5643. # - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
  5644. #
  5645. # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
  5646. # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
  5647. #
  5648. # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
  5649. # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
  5650. #
  5651. # flags -fno-profile-instr-generate -fno-coverage-mapping needed to always disable coverage for .pyx, .rl5, .rl6
  5652. # generated sources
  5653. ## tag:src-processing
  5654. when ($CLANG == "yes") {
  5655. _LANG_CFLAGS_FILTER=\
  5656. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl5:SRC} \
  5657. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl6:SRC} \
  5658. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.pyx:SRC}
  5659. }
  5660. otherwise {
  5661. _LANG_CFLAGS_FILTER=\
  5662. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
  5663. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
  5664. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
  5665. }
  5666. # tag:src-processing
  5667. # Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
  5668. macro _FILTER_EXTS(SKIP="", FLAGS...) {
  5669. .CMD=$FLAGS
  5670. }
  5671. # tag:src-processing
  5672. macro _LANG_CFLAGS(SRC) {
  5673. .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
  5674. }
  5675. # tag:src-processing
  5676. # ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
  5677. # Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
  5678. _LANG_CFLAGS_VALUE=
  5679. when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
  5680. _LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
  5681. }
  5682. # Allows to add single compilation unit name to the node's 'kv' section.
  5683. # This is used by the coverage machinery to instrument only the necessary sources
  5684. # when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
  5685. SCU_NAME_KV=
  5686. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no" && $USE_SCU_VALUE == "yes") {
  5687. SCU_NAME_KV=${hide;kv:"scu_name $KV_VAL"}
  5688. }
  5689. macro _ADD_SCU_NAME(KV_VAL) {
  5690. .CMD=$SCU_NAME_KV
  5691. }
  5692. # tag:src-processing
  5693. macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5694. .CMD=$_SRC_CPP_CMD $_ADD_SCU_NAME(${input:SRC})
  5695. }
  5696. # tag:src-processing
  5697. macro _SRC_c(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5698. .CMD=$_SRC_C_CMD $_ADD_SCU_NAME(${input:SRC})
  5699. }
  5700. # tag:src-processing
  5701. macro _SRC_m(SRC, SRCFLAGS...) {
  5702. .CMD=$_SRC_M_CMD
  5703. }
  5704. # tag:src-processing
  5705. macro _SRC_masm(SRC, SRCFLAGS...) {
  5706. .CMD=$_SRC_MASM_CMD
  5707. }
  5708. # tag:lua-specific
  5709. ### @usage: COMPILE_LUA(Src, [NAME <import_name>])
  5710. ###
  5711. ### Compile LUA source file to object code using LUA 2.0
  5712. ### Optionally override import name which is by default reflects Src name
  5713. macro COMPILE_LUA(Src, NAME="") {
  5714. .CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
  5715. }
  5716. # tag:lua-specific
  5717. ### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
  5718. ###
  5719. ### Compile LUA source file to object code using LUA 2.1
  5720. macro _SRC_lua_21(SRC, SRCFLAGS...) {
  5721. .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"}
  5722. .PEERDIR=$LUAJIT_21_PATH
  5723. }
  5724. # tag:lua-specific
  5725. ### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
  5726. ###
  5727. ### Compile LUA source file to object code using LUA 2.1
  5728. ### Optionally override import name which is by default reflects Src name
  5729. macro COMPILE_LUA_21(Src, NAME="") {
  5730. .CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
  5731. }
  5732. GETTEXT_KEEP_PATH=no
  5733. _MO_OUTPUT=
  5734. when ($GETTEXT_KEEP_PATH == "yes") {
  5735. _MO_OUTPUT=${output;noauto;norel;noext:SRC.mo}
  5736. }
  5737. otherwise {
  5738. _MO_OUTPUT=${output;noauto;nopath;noext;tobindir:SRC.mo}
  5739. }
  5740. # tag:src-processing
  5741. macro _SRC("po", SRC, SRCFLAGS...) {
  5742. .CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
  5743. }
  5744. # tag:ydl-specific
  5745. YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
  5746. YDL_DESC_FLAGS=
  5747. # tag:src-processing tag:ydl-specific
  5748. macro _SRC("ydl", SRC, SRCFLAGS...) {
  5749. .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"}
  5750. .PEERDIR+=statbox/ydl/runtime/cpp
  5751. }
  5752. # tag:ydl-specific
  5753. ### @usage BUILD_YDL_DESC(Input Symbol Output)
  5754. ###
  5755. ### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
  5756. ###
  5757. ### @example:
  5758. ###
  5759. ### PACKAGE()
  5760. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5761. ### END()
  5762. ###
  5763. ### 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.
  5764. macro BUILD_YDL_DESC(Input, Symbol, Output) {
  5765. .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"}
  5766. }
  5767. # tag:ydl-specific
  5768. ### @usage: YDL_DESC_USE_BINARY()
  5769. ###
  5770. ### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
  5771. ###
  5772. ### @example:
  5773. ###
  5774. ### PACKAGE()
  5775. ### YDL_DESC_USE_BINARY()
  5776. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5777. ### END()
  5778. ###
  5779. ### This will generate descriptor Event.ydld in a binary format.
  5780. macro YDL_DESC_USE_BINARY() {
  5781. YDL_DESC_FLAGS_BINARY= --binary
  5782. SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
  5783. }
  5784. ### @usage SRC(File Flags...)
  5785. ###
  5786. ### Compile single file with extra Flags.
  5787. ### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
  5788. macro SRC(FILE, FLAGS...) {
  5789. _SRC(${lastext:FILE} $FILE $FLAGS)
  5790. }
  5791. ### @usage: SRCS(<[GLOBAL] File> ...)
  5792. ###
  5793. ### 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.
  5794. ### Arcadia Paths from the root and is relative to the project's LIST are supported
  5795. ###
  5796. ### 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.
  5797. ### 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)
  5798. ###
  5799. ### @example:
  5800. ###
  5801. ### LIBRARY(test_global)
  5802. ### SRCS(GLOBAL foo.cpp)
  5803. ### END()
  5804. ###
  5805. ### 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.
  5806. macro SRCS(FILES...) {
  5807. foreach (FILE : $FILES) {
  5808. _SRC(${lastext:FILE} $FILE)
  5809. }
  5810. }
  5811. # tag:c-specific
  5812. macro _SRC_C_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  5813. .CMD=$_SRC_c($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  5814. .SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL
  5815. }
  5816. macro _SRC_CPP_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  5817. .CMD=$_SRC_cpp($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  5818. .SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS
  5819. }
  5820. # tag:src-specific tag:cpp-specific
  5821. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5822. ###
  5823. ### Defenition of generic macro. Report an error that the File with Ext is not
  5824. ### supported by macro MacroName if no appropriate macro specialization is found.
  5825. macro _SRC_CUSTOM_C_CPP(EXT, MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5826. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  5827. }
  5828. # tag:src-specific tag:cpp-specific
  5829. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5830. ###
  5831. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single C file (with .c extension)
  5832. macro _SRC_CUSTOM_C_CPP("c", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5833. _SRC_C_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5834. }
  5835. # tag:src-specific tag:cpp-specific
  5836. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5837. ###
  5838. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cpp extension)
  5839. macro _SRC_CUSTOM_C_CPP("cpp", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5840. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5841. }
  5842. # tag:src-specific tag:cpp-specific
  5843. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5844. ###
  5845. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cxx extension)
  5846. macro _SRC_CUSTOM_C_CPP("cxx", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5847. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5848. }
  5849. # tag:src-specific tag:cpp-specific
  5850. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5851. ###
  5852. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cc extension)
  5853. macro _SRC_CUSTOM_C_CPP("cc", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5854. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5855. }
  5856. # tag:src-specific tag:cpp-specific
  5857. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5858. ###
  5859. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .C extension)
  5860. macro _SRC_CUSTOM_C_CPP("C", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5861. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5862. }
  5863. # tag:src-specific tag:cpp-specific tag:cpu
  5864. ### @uasge SRC_C_SSE2(File Flags...)
  5865. ###
  5866. ### Compile a single C/C++ file with SSE2 and additional Flags
  5867. macro SRC_C_SSE2(FILE, FLAGS...) {
  5868. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE2 $FILE .sse2 $SSE2_CFLAGS $FLAGS)
  5869. }
  5870. # tag:src-specific tag:cpp-specific tag:cpu
  5871. ### @uasge SRC_C_SSE3(File Flags...)
  5872. ###
  5873. ### Compile a single C/C++ file with SSE3 and additional Flags
  5874. macro SRC_C_SSE3(FILE, FLAGS...) {
  5875. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE3 $FILE .sse3 $SSE3_CFLAGS $FLAGS)
  5876. }
  5877. # tag:src-specific tag:cpp-specific tag:cpu
  5878. ### @uasge SRC_C_SSSE3(File Flags...)
  5879. ###
  5880. ### Compile a single C/C++ file with SSSE3 and additional Flags
  5881. macro SRC_C_SSSE3(FILE, FLAGS...) {
  5882. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSSE3 $FILE .ssse3 $SSSE3_CFLAGS $FLAGS)
  5883. }
  5884. # tag:src-specific tag:cpp-specific tag:cpu
  5885. ### @uasge SRC_C_SSE4(File Flags...)
  5886. ###
  5887. ### Compile a single C/C++ file with SSE4 and additional Flags
  5888. macro SRC_C_SSE4(FILE, FLAGS...) {
  5889. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE4 $FILE .sse4 $SSE4_CFLAGS $FLAGS)
  5890. }
  5891. # tag:src-specific tag:cpp-specific tag:cpu
  5892. ### @uasge SRC_C_SSE41(File Flags...)
  5893. ###
  5894. ### Compile a single C/C++ file with SSE4.1 and additional Flags
  5895. macro SRC_C_SSE41(FILE, FLAGS...) {
  5896. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE41 $FILE .sse41 $SSE41_CFLAGS $FLAGS)
  5897. }
  5898. # tag:src-specific tag:cpp-specific tag:cpu
  5899. ### @uasge SRC_C_AVX(File Flags...)
  5900. ###
  5901. ### Compile a single C/C++ file with AVX and additional Flags
  5902. macro SRC_C_AVX(FILE, FLAGS...) {
  5903. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX $FILE .avx $AVX_CFLAGS $FLAGS)
  5904. }
  5905. # tag:src-specific tag:cpp-specific tag:cpu
  5906. ### @uasge SRC_C_AVX2(File Flags...)
  5907. ###
  5908. ### Compile a single C/C++ file with AVX2 and additional Flags
  5909. macro SRC_C_AVX2(FILE, FLAGS...) {
  5910. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX2 $FILE .avx2 $AVX2_CFLAGS $FLAGS)
  5911. }
  5912. # tag:src-specific tag:cpp-specific tag:cpu
  5913. ### @uasge SRC_C_AVX512(File Flags...)
  5914. ###
  5915. ### Compile a single C/C++ file with AVX512 and additional Flags
  5916. macro SRC_C_AVX512(FILE, FLAGS...) {
  5917. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX512 $FILE .avx512 $AVX512_CFLAGS $FLAGS)
  5918. }
  5919. # tag:src-specific tag:cpp-specific tag:cpu
  5920. ### @uasge SRC_C_AVX512(File Flags...)
  5921. ###
  5922. ### Compile a single C/C++ file with AVX512 and additional Flags
  5923. macro SRC_C_AMX(FILE, FLAGS...) {
  5924. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AMX $FILE .amx $AMX_CFLAGS $FLAGS)
  5925. }
  5926. # tag:src-specific tag:cpp-specific tag:cpu
  5927. ### @uasge SRC_C_XOP(File Flags...)
  5928. ###
  5929. ### Compile a single C/C++ file with (an AMD-specific instruction set,
  5930. ### see https://en.wikipedia.org/wiki/XOP_instruction_set) and additional Flags
  5931. macro SRC_C_XOP(FILE, FLAGS...) {
  5932. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_XOP $FILE .xop $XOP_CFLAGS $FLAGS)
  5933. }
  5934. # tag:src-specific tag:cpp-specific tag:cpu
  5935. ### @uasge SRC_C_PCLMUL(File Flags...)
  5936. ###
  5937. ### Compile a single C/C++ file with PCLMUL and additional Flags
  5938. macro SRC_C_PCLMUL(FILE, FLAGS...) {
  5939. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE .pclmul $PCLMUL_CFLAGS $FLAGS )
  5940. }
  5941. # tag:src-specific tag:cpp-specific
  5942. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5943. ###
  5944. ### Defenition of generic macro. Report an error that the File with Ext is not
  5945. ### supported by macro MacroName if no appropriate macro specialization is found.
  5946. macro _SRC_STRICT_C_CPP(EXT, MACRO_NAME, FILE, FLAGS...) {
  5947. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  5948. }
  5949. # tag:src-specific tag:cpp-specific
  5950. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5951. ###
  5952. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single C file (with .c extension)
  5953. macro _SRC_STRICT_C_CPP("c", MACRO_NAME, FILE, FLAGS...) {
  5954. _SRC(c $FILE $FLAGS)
  5955. }
  5956. # tag:src-specific tag:cpp-specific
  5957. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5958. ###
  5959. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cpp extension)
  5960. macro _SRC_STRICT_C_CPP("cpp", MACRO_NAME, FILE, FLAGS...) {
  5961. _SRC(cpp $FILE $FLAGS)
  5962. }
  5963. # tag:src-specific tag:cpp-specific
  5964. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5965. ###
  5966. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cxx extension)
  5967. macro _SRC_STRICT_C_CPP("cxx", MACRO_NAME, FILE, FLAGS...) {
  5968. _SRC(cpp $FILE $FLAGS)
  5969. }
  5970. # tag:src-specific tag:cpp-specific
  5971. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5972. ###
  5973. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cc extension)
  5974. macro _SRC_STRICT_C_CPP("cc", MACRO_NAME, FILE, FLAGS...) {
  5975. _SRC(cpp $FILE $FLAGS)
  5976. }
  5977. # tag:src-specific tag:cpp-specific
  5978. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5979. ###
  5980. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .C extension)
  5981. macro _SRC_STRICT_C_CPP("C", MACRO_NAME, FILE, FLAGS...) {
  5982. _SRC(cpp $FILE $FLAGS)
  5983. }
  5984. # tag:src-specific tag:cpp-specific
  5985. ### @uasge SRC_C_PIC(File Flags...)
  5986. ###
  5987. ### Compile a single C/C++ file with -fPIC and additional Flags
  5988. macro SRC_C_PIC(FILE, FLAGS...) {
  5989. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PIC $FILE $PIC_CFLAGS $FLAGS)
  5990. }
  5991. # tag:src-specific tag:cpp-specific
  5992. ### @uasge SRC_C_NO_LTO(File Flags...)
  5993. ###
  5994. ### Compile a single C/C++ file with link-time-optimization disabling and additional Flags
  5995. macro SRC_C_NO_LTO(FILE, FLAGS...) {
  5996. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_NO_LTO $FILE $NO_LTO_CFLAGS $FLAGS)
  5997. }
  5998. # tag:python-processing tag:cython
  5999. # TODO: use it in [.pyx] cmd
  6000. ### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
  6001. ###
  6002. ### Generates .cpp file from .pyx.
  6003. macro BUILDWITH_CYTHON_CPP(Src, Options...) {
  6004. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6005. .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
  6006. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6007. }
  6008. # tag:python-processing tag:cython tag:internal
  6009. ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
  6010. ###
  6011. ### Generates .cpp file from .pyx and attach extra input Dep.
  6012. ### If Dep changes the .cpp file will be re-generated.
  6013. macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
  6014. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6015. .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
  6016. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6017. }
  6018. # tag:python-processing tag:cython tag:internal
  6019. ### @usage: _BUILDWITH_CYTHON_CPP_H(Src Dep Options...) # internal
  6020. ###
  6021. ### BUILDWITH_CYTHON_CPP without .pyx infix and with cdef public .h file.
  6022. macro _BUILDWITH_CYTHON_CPP_H(Src, Dep, Options...) {
  6023. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.cpp} ${output;hide;addincl;noext;tobindir:Src.h} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6024. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6025. }
  6026. # tag:python-processing tag:cython
  6027. ### @usage: BUILDWITH_CYTHON_C(Src Options...)
  6028. ###
  6029. ### Generates .c file from .pyx.
  6030. macro BUILDWITH_CYTHON_C(Src, Options...) {
  6031. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6032. .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
  6033. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6034. }
  6035. # tag:python-processing tag:cython tag:internal
  6036. ### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
  6037. ###
  6038. ### Generates .c file from .pyx and attach extra input Dep.
  6039. ### If Dep changes the .c file will be re-generated.
  6040. macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
  6041. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6042. .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
  6043. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6044. }
  6045. # tag:python-processing tag:cython tag:internal
  6046. ### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
  6047. ###
  6048. ### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
  6049. macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
  6050. .CMD=$RUN_CYTHON_SCRIPT_H $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"}
  6051. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6052. }
  6053. # tag:python-processing tag:cython tag:internal
  6054. ### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
  6055. ###
  6056. ### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
  6057. macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
  6058. .CMD=$RUN_CYTHON_SCRIPT_H $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"}
  6059. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6060. }
  6061. ### @usage: BUILDWITH_RAGEL6(Src Options...)
  6062. ###
  6063. ### Compile .rl file using Ragel6.
  6064. macro BUILDWITH_RAGEL6(Src, Options...) {
  6065. .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"}
  6066. }
  6067. # tag:python-processing tag:internal
  6068. # TODO: use it in [.pyx] cmd
  6069. ### @usage: _PY_REGISTER() # internal
  6070. ###
  6071. ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
  6072. ###
  6073. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  6074. macro _PY_REGISTER(Func) {
  6075. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  6076. SRCS(GLOBAL $Func.reg.cpp)
  6077. }
  6078. # tag:python-processing tag:internal
  6079. ### @usage: _PY3_REGISTER() # internal
  6080. ###
  6081. ### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
  6082. ###
  6083. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  6084. macro _PY3_REGISTER(Func) {
  6085. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${output;noauto:Func.reg3.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  6086. SRCS(GLOBAL $Func.reg3.cpp)
  6087. }
  6088. # tag:python-processing tag:internal
  6089. ### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
  6090. ###
  6091. ### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
  6092. ###
  6093. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  6094. macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
  6095. .CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  6096. }
  6097. # tag:python-processing tag:internal
  6098. ### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
  6099. ###
  6100. ### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
  6101. ###
  6102. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  6103. macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
  6104. .CMD=${env:"PYTHONHASHSEED=0"} ${tool:"contrib/tools/python3/pycc"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc3} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  6105. }
  6106. macro _ARCHIVE_SEM_HELPER(FLAGS[], OUT, Files...) {
  6107. .SEM=add_custom_command OUTPUT ${OUT} DEPENDS $ARCH_TOOL ${join= :Files} COMMAND $ARCH_TOOL $FLAGS ${join=\: :Files}: -o ${OUT}
  6108. }
  6109. ### @usage: ARCHIVE_ASM(NAME archive_name files...)
  6110. ###
  6111. ### Similar to the macro ARCHIVE, but:
  6112. ### 1. works faster and it is better to use for large files.
  6113. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
  6114. macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  6115. .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;suf=$OBJ_SUF.rodata:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"}
  6116. .SEM=$_ARCHIVE_SEM_HELPER(${output;suf=$OBJ_SUF.rodata:NAME} ${input:Files} FLAGS -q $DONTCOMPRESS)
  6117. }
  6118. # tag:yweb-specific
  6119. macro PIRE_INLINE_CMD(SRC) {
  6120. .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"}
  6121. }
  6122. # tag:yweb-specific
  6123. macro PIRE_INLINE(FILES...) {
  6124. foreach (FILE : $FILES) {
  6125. PIRE_INLINE_CMD($FILE)
  6126. }
  6127. }
  6128. ### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
  6129. ###
  6130. ### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  6131. ###
  6132. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  6133. macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  6134. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  6135. .SEM=$_ARCHIVE_SEM_HELPER(${output;addincl;noauto:NAME} ${input:Files} FLAGS -q -x $DONTCOMPRESS) && target_sources PRIVATE $BINDIR/$NAME
  6136. }
  6137. ### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
  6138. ###
  6139. ### Add arbitrary data to a module be accessible by specified key.
  6140. ### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  6141. ###
  6142. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  6143. macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", Files...) {
  6144. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  6145. }
  6146. #scripts
  6147. #special commands
  6148. BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
  6149. SVNVERSION_JAVA_MARKER=output-java-class
  6150. SVNVERSION_GO_MARKER=output-go
  6151. VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
  6152. VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
  6153. VCS_C=$BINDIR/__vcs_version__.c
  6154. VCS_GO=$BINDIR/__vcs_version__.go
  6155. VCS_JAVA=$BINDIR/__vcs_version__.mf
  6156. VCS_INFO_DISABLE_CACHE__NO_UID__=
  6157. YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  6158. CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  6159. CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
  6160. YASM_DEBUG_INFO=
  6161. CL_DEBUG_INFO=
  6162. CL_MACRO_INFO=
  6163. when ($FORCE_VCS_INFO_UPDATE == "yes") {
  6164. VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
  6165. }
  6166. ### Works for pyton too.
  6167. GENERATE_VCS_C_INFO_NODEP=$YMAKE_PYTHON3 ${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))
  6168. GENERATE_VCS_GO_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-go $(VCS)/vcs.json $VCS_GO $VCS_INFO_DISABLE_CACHE__NO_UID__
  6169. 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__
  6170. macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
  6171. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
  6172. }
  6173. VCS_INFO_FILE=
  6174. ### @usage VCS_INFO_FILE([FILE out_file])
  6175. ###
  6176. ### Enable saving vcs info as a json-file into PACKAGE
  6177. ###
  6178. ### Info is saved to 'vcs_info.json' by default.
  6179. ### Use FILE parameter if you want another name.
  6180. ###
  6181. ### Note: macro can be used only once per module
  6182. macro VCS_INFO_FILE(FILE="vcs_info.json") {
  6183. SET(VCS_INFO_FILE $FILE)
  6184. }
  6185. ADD_VCS_INFO_FILE_CMD=
  6186. when ($VCS_INFO_FILE) {
  6187. ADD_VCS_INFO_FILE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-json $(VCS)/vcs.json ${output:VCS_INFO_FILE} $VCS_INFO_DISABLE_CACHE__NO_UID__
  6188. }
  6189. ### @usage: CREATE_BUILDINFO_FOR(GenHdr)
  6190. ###
  6191. ### Creates header file to access some information about build specified via configuration variables.
  6192. ### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
  6193. macro CREATE_BUILDINFO_FOR(GenHdr) {
  6194. .CMD=$YIELD $CXX_COMPILER && $YIELD $CXXFLAGS && $XARGS $YMAKE_PYTHON3 ${input:BUILDVERSION_SCRIPT} ${output:GenHdr} ${kv;hide:"p BI"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"} $SVN_DEPENDS_CACHE__NO_UID__
  6195. .SEM=$RUN_PYTHON3($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
  6196. }
  6197. DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
  6198. DECIMAL_MD5_FIXED=
  6199. ### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
  6200. ###
  6201. ### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
  6202. ### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
  6203. macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
  6204. .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:File} ${kv;hide:"p SV"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"}
  6205. }
  6206. # tag:internal
  6207. ### @usage $CFG_VARS # internal
  6208. ###
  6209. ### Mark commands that embed Configuration variables into files
  6210. macro CFG_VARS() {
  6211. .GEN_FROM_FILE=yes
  6212. }
  6213. ### @usage: CONFIGURE_FILE(from to)
  6214. ###
  6215. ### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
  6216. ### The values are collected during configure stage, while replacement itself happens during build stage.
  6217. ### Used implicitly for .in-files processing.
  6218. macro CONFIGURE_FILE(Src, Dst) {
  6219. .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"}
  6220. .SEM=set_vars ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;addincl;rootrel:Dst}
  6221. }
  6222. ### @usage: BASE_CODEGEN(tool_path prefix)
  6223. ###
  6224. ### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in.
  6225. macro BASE_CODEGEN(Tool, Prefix, Opts...) {
  6226. .CMD=${tool:Tool} ${input:Prefix.in} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc yellow"}
  6227. }
  6228. # tag:internal
  6229. ### @usage: _SPLIT_CODEGEN_BASE(tool prefix OUTS[] OUTPUT_INCLUDES[]) # internal
  6230. ###
  6231. ### Generator of a certain number .the. cpp file + one header .h file from .in.
  6232. ### This is the call of the generator. Python macro SPLIT_CODEGEN() is defined in order to properly fill command outputs from OUT_NUM argument.
  6233. macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) {
  6234. .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"}
  6235. }
  6236. STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \
  6237. ${output_include;hide:"util/generic/strbuf.h"} \
  6238. ${output_include;hide:"util/generic/vector.h"} \
  6239. ${output_include;hide:"util/generic/ptr.h"} \
  6240. ${output_include;hide:"util/generic/yexception.h"} \
  6241. ${output_include;hide:"kernel/struct_codegen/reflection/reflection.h"} \
  6242. ${output_include;hide:"kernel/struct_codegen/reflection/floats.h"}
  6243. ### @usage: STRUCT_CODEGEN(Prefix)
  6244. ### A special case BASE_CODEGEN, in which the kernel/struct_codegen/codegen_tool tool is used.
  6245. macro STRUCT_CODEGEN(Prefix) {
  6246. .CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES)
  6247. .PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection
  6248. }
  6249. ### @usage: DUMPERF_CODEGEN(Prefix)
  6250. ### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used
  6251. macro DUMPERF_CODEGEN(Prefix) {
  6252. .CMD=$BASE_CODEGEN(extsearch/images/robot/tools/dumperf/codegen, $Prefix, ${output_include;hide:"extsearch/images/kernel/erf/erf_format.h"})
  6253. }
  6254. # tag:flags
  6255. ### @usage: LDFLAGS(LinkerFlags...)
  6256. ###
  6257. ### Add flags to the link command line of executable or shared library/dll.
  6258. ### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
  6259. ### Note: remember about the incompatibility of flags for gcc and cl.
  6260. macro LDFLAGS(Flags...) {
  6261. SET_APPEND(LDFLAGS_GLOBAL $Flags)
  6262. }
  6263. # tag:flags
  6264. ### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
  6265. ###
  6266. ### Add the specified flags to the compilation command of C and C++ files.
  6267. ### @params: GLOBAL - Propagates these flags to dependent projects
  6268. ### Note: remember about the incompatibility flags for clang and cl (to set flags specifically for cl.exe use MSVC_FLAGS).
  6269. macro CFLAGS(Flags...) {
  6270. SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
  6271. }
  6272. # tag:flags
  6273. ### @usage: MASMFLAGS(compiler flags)
  6274. ### Add the specified flags to the compilation command of .masm files.
  6275. macro MASMFLAGS(Flags...) {
  6276. SET_APPEND(MASMFLAGS $Flags)
  6277. }
  6278. # tag:flags
  6279. ### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
  6280. ### Add the specified flags to the compilation command of .c (but not .cpp) files.
  6281. ### @params: GLOBAL - Distributes these flags on dependent projects
  6282. macro CONLYFLAGS(Flags...) {
  6283. SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
  6284. }
  6285. # tag:flags
  6286. ### @usage: CXXFLAGS(compiler_flags)
  6287. ### Add the specified flags to the compilation command of .cpp (but not .c) files.
  6288. macro CXXFLAGS(Flags...) {
  6289. SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
  6290. }
  6291. # tag:flags
  6292. ### @usage: CUDA_NVCC_FLAGS(compiler flags)
  6293. ### Add the specified flags to the compile line .cu-files.
  6294. macro CUDA_NVCC_FLAGS(Flags...) {
  6295. SET_APPEND(CUDA_NVCC_FLAGS $Flags)
  6296. }
  6297. # tag:flags
  6298. ### @usage: NVCC_DEVICE_LINK(file.cu...)
  6299. ### Run nvcc --device-link on objects compiled from srcs with --device-c.
  6300. ### This generates a stub object devlink.o that supplies missing pieces for the
  6301. ### host linker to link relocatable device objects into the final executable.
  6302. macro NVCC_DEVICE_LINK(Srcs...) {
  6303. .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"}
  6304. }
  6305. # tag:flags
  6306. ### @usage: CYTHON_FLAGS(compiler_flags)
  6307. ### Add the specified flags to the compilation command of .pyx files.
  6308. macro CYTHON_FLAGS(Flags...) {
  6309. SET_APPEND(CYTHON_OPTIONS $Flags)
  6310. }
  6311. ### @usage: STRIP()
  6312. ### Strip debug info from a PROGRAM, DLL or TEST.
  6313. ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
  6314. macro STRIP() {
  6315. ENABLE(STRIP)
  6316. }
  6317. ### @usage: NO_OPTIMIZE()
  6318. ### Build code without any optimizations (-O0 mode).
  6319. macro NO_OPTIMIZE() {
  6320. ENABLE(NO_OPTIMIZE)
  6321. }
  6322. #TODO(YMAKE-91) read proper compile flags instead of sending explicit flags to semgraph directly
  6323. _SEM_EXTRA_CXX_FLAGS=
  6324. ### @usage: NO_COMPILER_WARNINGS()
  6325. ### Disable all compiler warnings in the module.
  6326. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  6327. macro NO_COMPILER_WARNINGS() {
  6328. ENABLE(NO_COMPILER_WARNINGS)
  6329. SET(_SEM_EXTRA_CXX_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>")
  6330. }
  6331. ### @usage: WERROR()
  6332. ### Consider warnings as errors in the current module.
  6333. ### In the bright future will be removed, since WERROR is the default.
  6334. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  6335. macro WERROR() {
  6336. ENABLE(WERROR)
  6337. }
  6338. ### @usage: NO_WERROR()
  6339. ### Override WERROR() behavior
  6340. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  6341. macro NO_WERROR() {
  6342. DISABLE(WERROR)
  6343. }
  6344. ### @usage: NO_WSHADOW()
  6345. ### Disable C++ shadowing warnings.
  6346. macro NO_WSHADOW() {
  6347. ENABLE(NO_WSHADOW)
  6348. }
  6349. # tag:internal
  6350. ### @usage: NO_PLATFORM_RESOURCES() # internal
  6351. ### Exclude dependency on platform resources libraries.
  6352. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  6353. macro NO_PLATFORM_RESOURCES() {
  6354. ENABLE(NOPLATFORM_RESOURCES)
  6355. }
  6356. # tag:internal tag:codenav
  6357. ### @usage: NO_CODENAVIGATION() # internal
  6358. ### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
  6359. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  6360. macro NO_CODENAVIGATION() {
  6361. ENABLE(NOCODENAVIGATION)
  6362. }
  6363. ### @usage: NO_UTIL()
  6364. ### Build module without dependency on util.
  6365. ### Note: use this with care. Util most likely will be linked into executable anyway,
  6366. ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
  6367. macro NO_UTIL() {
  6368. ENABLE(NOUTIL)
  6369. }
  6370. ### @usage: NO_RUNTIME()
  6371. ###
  6372. ### This macro:
  6373. ### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
  6374. ### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
  6375. ### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
  6376. ### may not be detected at build time and may lead to unpredictable behavors at configure time.
  6377. macro NO_RUNTIME() {
  6378. SET(USE_ARCADIA_LIBM no)
  6379. NO_UTIL()
  6380. ENABLE(NORUNTIME)
  6381. }
  6382. ### @usage: NO_LIBC()
  6383. ###
  6384. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
  6385. ### Note: use this with care. libc most likely will be linked into executable anyway,
  6386. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  6387. macro NO_LIBC() {
  6388. NO_RUNTIME()
  6389. DISABLE(MUSL)
  6390. }
  6391. ### @usage: NO_PLATFORM()
  6392. ###
  6393. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
  6394. ### Note: use this with care. libc most likely will be linked into executable anyway,
  6395. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  6396. macro NO_PLATFORM() {
  6397. NO_LIBC()
  6398. ENABLE(NOPLATFORM)
  6399. }
  6400. # tag:cpp-specific
  6401. ### @usage: USE_CXX()
  6402. ###
  6403. ### Add dependency on C++ runtime
  6404. ### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
  6405. macro USE_CXX() {
  6406. DISABLE(NORUNTIME)
  6407. }
  6408. ### @usage: USE_UTIL()
  6409. ###
  6410. ### Add dependency on util and C++ runtime
  6411. ### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
  6412. macro USE_UTIL() {
  6413. USE_CXX()
  6414. DISABLE(NOUTIL)
  6415. }
  6416. ### @usage: USE_NASM()
  6417. ###
  6418. ### Build only .asm files with nasm toolchain instead of yasm
  6419. ### Add to ya.make file ADDINCL(asm ...) with all folders where .asm files include smth
  6420. macro USE_NASM() {
  6421. ENABLE(USE_NASM_ASSEMBLER)
  6422. PEERDIR(build/external_resources/nasm)
  6423. }
  6424. # tag:deprecated
  6425. ### @usage: NO_JOIN_SRC() # deprecated, does-nothing
  6426. ### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
  6427. macro NO_JOIN_SRC() {
  6428. ENABLE(UNUSED_MACRO)
  6429. }
  6430. # tag:sanitize
  6431. ### @usage: NO_SANITIZE()
  6432. ###
  6433. ### Disable all sanitizers for the module.
  6434. macro NO_SANITIZE() {
  6435. DISABLE(SANITIZER_TYPE)
  6436. }
  6437. # tag:coverage tag:sanitize
  6438. ### @usage: NO_SANITIZE_COVERAGE()
  6439. ###
  6440. ### Disable lightweight coverage (-fsanitize-coverage) for the module.
  6441. ### Sanitize coverage is commonly used with fuzzing.
  6442. ### It might be useful to disable it for libraries that should never
  6443. ### be the main targets for fuzzing, like libfuzzer library itself.
  6444. ### Sanitize coverage instrumentation is enabled by the --sanitize-coverage option.
  6445. macro NO_SANITIZE_COVERAGE() {
  6446. DISABLE(SANITIZE_COVERAGE)
  6447. }
  6448. # tag:sanitize
  6449. ### @usage: NO_SANITIZE_HEADERS()
  6450. ###
  6451. ### Disable dependency on sanitizer headers for the module.
  6452. macro NO_SANITIZE_HEADERS() {
  6453. DISABLE(SANITIZE_HEADERS)
  6454. }
  6455. # tag:coverage
  6456. ### @usage: NO_CLANG_COVERAGE()
  6457. ###
  6458. ### Disable heavyweight clang coverage for the module. Clang coverage instrumentation is enabled by the --clang-coverage option.
  6459. macro NO_CLANG_COVERAGE() {
  6460. DISABLE(CLANG_COVERAGE)
  6461. }
  6462. macro NO_CLANG_TIDY() {
  6463. DISABLE(TIDY_ENABLED)
  6464. }
  6465. # tag:python-specific tag:coverage
  6466. ### @usage: NO_PYTHON_COVERAGE()
  6467. ###
  6468. ### Disable python coverage for module
  6469. macro NO_PYTHON_COVERAGE() {
  6470. DISABLE(PYTHON_COVERAGE)
  6471. }
  6472. # tag:python-specific tag:coverage tag:cython
  6473. ### @usage: NO_CYTHON_COVERAGE()
  6474. ###
  6475. ### Disable cython and cythonized python coverage (CYTHONIZE_PY)
  6476. ### Implies NO_CLANG_COVERAGE() - right now, we can't disable instrumentation for .py.cpp files, but enable for .cpp
  6477. macro NO_CYTHON_COVERAGE() {
  6478. DISABLE(CYTHON_COVERAGE)
  6479. NO_CLANG_COVERAGE()
  6480. }
  6481. # tag:lua-specific
  6482. LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
  6483. macro _LUAJIT_OBJDUMP(Src, OUT="") {
  6484. .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"}
  6485. }
  6486. # tag:lua-specific
  6487. LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
  6488. macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
  6489. .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"}
  6490. }
  6491. macro _MX_BIN_TO_INFO(Src) {
  6492. .CMD=${tool:"tools/mx_bin2info"} ${input:Src} ${output;nopath;noext;noauto:Src.info} ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
  6493. }
  6494. MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \
  6495. ${output_include;hide:"kernel/matrixnet/mn_sse.h"} \
  6496. ${output_include;hide:"library/cpp/archive/yarchive.h"} \
  6497. ${output_include;hide:"util/memory/blob.h"} \
  6498. ${output_include;hide:"util/generic/hash.h"} \
  6499. ${output_include;hide:"util/generic/ptr.h"} \
  6500. ${output_include;hide:"util/generic/singleton.h"}
  6501. macro _MX_GEN_TABLE(Srcs...) {
  6502. .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"}
  6503. PEERDIR(kernel/matrixnet)
  6504. PEERDIR(library/cpp/archive)
  6505. }
  6506. RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"}
  6507. ### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
  6508. ###
  6509. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
  6510. ###
  6511. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6512. macro GENERATE_ENUM_SERIALIZATION(File) {
  6513. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} ${output_include;from_input;hide:File} ${output_include;hide:"util/generic/serialized_enum.h"} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  6514. .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser"}
  6515. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6516. }
  6517. ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
  6518. ###
  6519. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
  6520. ### Provide access to serialization functions via generated header File_serialized.h
  6521. ###
  6522. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6523. macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
  6524. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} --header ${output;suf=_serialized.h:File} ${output_include;from_input;hide:File} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  6525. .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"}
  6526. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6527. }
  6528. ### @usage: DEB_VERSION(File)
  6529. ###
  6530. ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
  6531. macro DEB_VERSION(File) {
  6532. .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"}
  6533. }
  6534. BUILD_MN_SCRIPT=build/scripts/build_mn.py
  6535. # tag:matrixnet
  6536. ### @usage: BUILD_MN([CHECK] [PTR] [MULTI] mninfo mnname) # matrixnet
  6537. ###
  6538. ### Generate MatrixNet data and access code using single command.
  6539. ### Alternative macro BUILD_MNS() works faster and better for large files.
  6540. macro BUILD_MN(MnInfo, MnName, CHECK?"fml_tool=$FML_UNUSED_TOOL CHECK":"", MULTI?, PTR?, RANKING_SUFFIX="") {
  6541. .CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnF $ARCADIA_ROOT $ARCH_TOOL ${input:MnInfo} $MnName ranking_suffix=$RANKING_SUFFIX ${output;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"}
  6542. }
  6543. macro _BUILD_MNS_FILE(Input, Name, Output, Suffix, Check, Fml_tool, AsmDataName) {
  6544. .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"}
  6545. }
  6546. MNS_OUTPUT=mnmodels
  6547. macro _BUILD_MNS_CPP(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6548. .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"}
  6549. }
  6550. macro _BUILD_MNS_HEADER(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6551. .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"}
  6552. }
  6553. # TODO: support foreach_in and keywords simultaneous usage (look at BUILD_MNS_FILES)
  6554. # tag:matrixnet
  6555. ### @usage: BUILD_MNS([CHECK] NAME listname mninfos...) # matrixnet
  6556. ###
  6557. ### Generate MatrixNet data and access code using separate commands for support code, interface and data.
  6558. ### Faster version of BUILD_MN() macro for large files.
  6559. macro BUILD_MNS(Files...) {
  6560. _BUILD_MNS_HEADER($Files)
  6561. _BUILD_MNS_CPP($Files)
  6562. _BUILD_MNS_FILES($Files)
  6563. }
  6564. ### @usage: COMPILE_NLG(nlg_config.json, [TRANSLATIONS_JSON translations.json], Src...)
  6565. ###
  6566. ### Generate and compile .nlg templates (Jinja2-based) and interface for megamind runtime in localized mode.
  6567. ###
  6568. ### Alice-specific macro
  6569. macro COMPILE_NLG(NLG_CONFIG_JSON, TRANSLATIONS_JSON="", Src...) {
  6570. when ($TRANSLATIONS_JSON) {
  6571. TRANSLATIONS_JSON_ARG=--translations-json
  6572. }
  6573. otherwise {
  6574. TRANSLATIONS_JSON_ARG=
  6575. }
  6576. PEERDIR(alice/nlg/library/nlg_project_runtime)
  6577. RUN_PROGRAM(alice/nlg/tools/codegen compile-cpp --import-dir ${ARCADIA_ROOT} --out-dir ${ARCADIA_BUILD_ROOT} --include-prefix ${MODDIR} --nlg-config-json ${NLG_CONFIG_JSON} ${TRANSLATIONS_JSON_ARG} ${TRANSLATIONS_JSON} ${Src} IN ${TRANSLATIONS_JSON} ${NLG_CONFIG_JSON} ${Src} OUT_NOAUTO nlg_renderer_factory.cpp nlg_renderer_factory.h register.cpp translations.cpp translations.h localizable_phrases.pb.txt ${suf=.cpp:Src} ${suf=.h:Src} ${suf=.pb.txt:Src})
  6578. SRCS(GLOBAL register.cpp nlg_renderer_factory.cpp translations.cpp ${suf=.cpp:Src})
  6579. }
  6580. ### @usage: NEED_CHECK()
  6581. ###
  6582. ### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
  6583. ### automatically merged to trunk only if there is no new broken build targets in check results.
  6584. ### The use of this macro is disabled by default.
  6585. macro NEED_CHECK(Flags...) {
  6586. # TODO: FIXME
  6587. ENABLE(UNUSED_MACRO)
  6588. }
  6589. ### @usage: NO_NEED_CHECK()
  6590. ###
  6591. ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
  6592. macro NO_NEED_CHECK(Flags...) {
  6593. ENABLE(UNUSED_MACRO)
  6594. }
  6595. # tag:deprecated
  6596. ### @usage: NEED_REVIEW() # deprecated
  6597. ###
  6598. ### Mark the project as needing review.
  6599. ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
  6600. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
  6601. macro NEED_REVIEW(Flags...) {
  6602. # TODO: FIXME
  6603. ENABLE(UNUSED_MACRO)
  6604. }
  6605. ### @usage: VERSION(Args...)
  6606. ###
  6607. ### Specify version of a module. Currently unused by build system, only informative.
  6608. macro VERSION(Flags...) {
  6609. ENABLE(UNUSED_MACRO)
  6610. }
  6611. DATAWORK_SCHEEME_EXPORT_FLAGS=
  6612. when ($UNIX == "yes") {
  6613. SCHEEME2_CFLAGS= -E -x c++
  6614. }
  6615. when ($WIN32 == "yes") {
  6616. SCHEEME2_CFLAGS= /E /TP
  6617. }
  6618. SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
  6619. ### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
  6620. ###
  6621. ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
  6622. ###
  6623. ### 1. ${scheeme_name}.inc - the name of the generated file.
  6624. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
  6625. ###
  6626. ### @example:
  6627. ###
  6628. ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
  6629. ###
  6630. ### 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)
  6631. ### sets in extra option
  6632. ###
  6633. ### @example:
  6634. ###
  6635. ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
  6636. ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
  6637. ### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
  6638. ###
  6639. ### for compatibility with C++ compiler and the external environment.
  6640. ### See tools/structparser for more details.
  6641. macro GEN_SCHEEME2(ScheemeName, FromFile) {
  6642. .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"}
  6643. }
  6644. ### @usage: SYMLINK(from to)
  6645. ### Add symlink
  6646. macro SYMLINK(From, To) {
  6647. .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"}
  6648. }
  6649. # tag:internal
  6650. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6651. ### Generate prefix " && target_sources PRIVATE " before $Args when GENERATE is specified in the list of actual arguments
  6652. macro _TARGET_SOURCES_FOR_HEADERS_IMPL(GENERATE?" && target_sources PRIVATE ":"", Args...) {
  6653. .SEM=$GENERATE ${output;ext=.h:Args} ${output;ext=.hh:Args} ${output;ext=.hpp:Args} ${output;ext=.inc:Args} ${output;ext=.i:Args}
  6654. }
  6655. # tag:internal
  6656. ### @usage: _TARGET_SOURCES_FOR_HEADERS(Args...) # internal
  6657. ### Generate prefix " && target_sources PRIVATE " before $Args if Args is not empty
  6658. macro _TARGET_SOURCES_FOR_HEADERS(Args...) {
  6659. .SEM=$_TARGET_SOURCES_FOR_HEADERS_IMPL(${pre=GENERATE :Args})
  6660. }
  6661. # tag:internal
  6662. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6663. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args when GENERATE is specified in the list of actual arguments
  6664. macro _SET_ENV_FOR_CUSTOM_COMMAND_IMPL(GENERATE?" ${CMAKE_COMMAND} -E env ":"", Args...) {
  6665. .SEM=$GENERATE ${pre= :Args}
  6666. }
  6667. # tag:internal
  6668. ### @usage: _SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
  6669. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args if Args is not empty
  6670. macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
  6671. .SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args})
  6672. }
  6673. macro _FMT_INDUCED_DEPS(For, Deps...) {
  6674. .CMD=${induced_deps=$For;hide:Deps}
  6675. }
  6676. ### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...)
  6677. ###
  6678. ### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR`
  6679. ### This tells that files of Type resulted from code generation macros (not neccessarily directly,
  6680. ### but in processing chain of generated files) should have extra dependencies from list of Files...
  6681. ###
  6682. ### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from
  6683. ### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp
  6684. ### resulted from Cython-processing of generated pyx. The code ganeration will look like:
  6685. ### ```
  6686. ### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd)
  6687. ### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h)
  6688. ### RUN_PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS)
  6689. ### ```
  6690. ###
  6691. ### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing
  6692. ### as an element of array parameter. This is needed because language of ya.make doesn't support
  6693. ### Dict params right now and so it is impossible to directly pass something
  6694. ### like `{Type1:[Files2...], Type2:[Files2...]}`
  6695. ###
  6696. macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) {
  6697. SET($VAR \$_FMT_INDUCED_DEPS($For $Deps))
  6698. }
  6699. ### @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...])
  6700. ###
  6701. ### Run a program from arcadia.
  6702. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6703. ###
  6704. ### Parameters:
  6705. ### - tool_path - Path to the directory of the tool.
  6706. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6707. ### - CWD dir - Absolute path of the working directory.
  6708. ### - ENV key=value... - Environment variables.
  6709. ### - TOOL tools... - Auxiliary tool directories.
  6710. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6711. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6712. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6713. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6714. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6715. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6716. ###
  6717. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6718. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6719. ### 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).
  6720. 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...) {
  6721. .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"}
  6722. .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)
  6723. }
  6724. # tag:lua-specific
  6725. ### @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...])
  6726. ###
  6727. ### Run a lua script.
  6728. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6729. ###
  6730. ### Parameters:
  6731. ### - script_path - Path to the script.3
  6732. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6733. ### - CWD dir - Absolute path of the working directory.
  6734. ### - ENV key=value... - Environment variables.
  6735. ### - TOOL tools... - Auxiliary tool directories.
  6736. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6737. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6738. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6739. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6740. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6741. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6742. ###
  6743. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6744. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6745. 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...) {
  6746. .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"}
  6747. }
  6748. # tag:python-specific
  6749. ### @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...])
  6750. ###
  6751. ### Run a python script with $(PYTHON)/python built from devtools/huge_python.
  6752. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6753. ###
  6754. ### Parameters:
  6755. ### - script_path - Path to the script.
  6756. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6757. ### - CWD dir - Absolute path of the working directory.
  6758. ### - ENV key=value... - Environment variables.
  6759. ### - TOOL tools... - Auxiliary tool directories.
  6760. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6761. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6762. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6763. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6764. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6765. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6766. ###
  6767. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6768. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6769. 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...) {
  6770. .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"}
  6771. .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)
  6772. }
  6773. # tag:python-specific
  6774. ### @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...])
  6775. ###
  6776. ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
  6777. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6778. ###
  6779. ### Parameters:
  6780. ### - script_path - Path to the script.
  6781. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6782. ### - CWD dir - Absolute path of the working directory.
  6783. ### - ENV key=value... - Environment variables.
  6784. ### - TOOL tools... - Auxiliary tool directories.
  6785. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6786. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6787. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6788. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6789. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6790. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6791. ###
  6792. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6793. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6794. 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...) {
  6795. .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"}
  6796. .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)
  6797. }
  6798. # tag:java-specific
  6799. 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...) {
  6800. PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6801. .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"}
  6802. }
  6803. ### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6804. ###
  6805. ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
  6806. ### 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.
  6807. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
  6808. ###
  6809. ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
  6810. ###
  6811. ### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
  6812. ### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
  6813. ### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
  6814. ### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
  6815. ###
  6816. ### RENAME RESOURCE allows to rename the resource without specifying its file name.
  6817. ###
  6818. ### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6819. ### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6820. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6821. ###
  6822. ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
  6823. ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
  6824. ### so you shall place it immediately after resource_id.
  6825. 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:") {
  6826. .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"}
  6827. ADD_CHECK(check.resource $Id)
  6828. }
  6829. ### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6830. ###
  6831. ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6832. macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6833. .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"}
  6834. ADD_CHECK(check.mds $Key)
  6835. }
  6836. # tag:internal
  6837. ### @usage: _FROM_EXTERNAL(ExtFile [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) #internal
  6838. ###
  6839. ### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS).
  6840. macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") {
  6841. .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"}
  6842. #FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors
  6843. #FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented
  6844. }
  6845. ### @usage LARGE_FILES([AUTOUPDATED] Files...)
  6846. ###
  6847. ### Use large file ether from working copy or from remote storage via placeholder <File>.external
  6848. ### If <File> is present locally (and not a symlink!) it will be copied to build directory.
  6849. ### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
  6850. macro LARGE_FILES(AUTOUPDATED?, Files...) {
  6851. # This is needed to correctly switch between remote and local modes
  6852. _GLOB($LF $Files)
  6853. }
  6854. ### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6855. ###
  6856. ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6857. macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6858. .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"}
  6859. }
  6860. when ($MSVC == "yes") {
  6861. C_AS_CXX_FLAGS=/TP /std:c++17
  6862. }
  6863. otherwise {
  6864. C_AS_CXX_FLAGS=-x c++ -std=c++17
  6865. }
  6866. # tag:cpp-specific
  6867. ### @usage: COMPILE_C_AS_CXX()
  6868. ###
  6869. ### Compile .c files as .cpp ones within a module.
  6870. macro COMPILE_C_AS_CXX() {
  6871. SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
  6872. }
  6873. ### @usage: NO_DEBUG_INFO()
  6874. ###
  6875. ### Compile files without debug info collection.
  6876. macro NO_DEBUG_INFO() {
  6877. SET(NO_DEBUGINFO yes)
  6878. }
  6879. ### @usage: CTEMPLATE_VARNAMES(File)
  6880. ###
  6881. ### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
  6882. ###
  6883. ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
  6884. macro CTEMPLATE_VARNAMES(File) {
  6885. .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
  6886. }
  6887. LLVM_OPTS=
  6888. CLANG_BC_ROOT=${CLANG11_RESOURCE_GLOBAL}
  6889. macro USE_LLVM_BC12() {
  6890. SET(CLANG_BC_ROOT ${CLANG12_RESOURCE_GLOBAL})
  6891. }
  6892. CLANG_DEFAULT_ROOT=${CLANG_RESOURCE_GLOBAL}
  6893. CLANG_C_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang
  6894. CLANG_CPP_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang++
  6895. CLANG_EMIT_EXTRA_OPTS=
  6896. when ($OS_WINDOWS == "yes") {
  6897. # we can't use c++latest for clang14 now
  6898. # so we set c++20 for it
  6899. # for clang11 (actual clang for CLANG_EMIT_AST_CXX and LLVM_COMPILE_* macroses) /std:c++20 provokes "unused-command-line-argument" error
  6900. # !do not forget to change this flag when updating build/platform/clang
  6901. CLANG_EMIT_EXTRA_OPTS+=/std:c++latest
  6902. }
  6903. when ($OS_ANDROID == "yes") {
  6904. # We use clang shipped with android-ndk which has different layout
  6905. CLANG_DEFAULT_ROOT=$CLANG_ANDROID_RESOURCE_GLOBAL
  6906. when ($HOST_OS_DARWIN) {
  6907. CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
  6908. CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
  6909. }
  6910. otherwise {
  6911. CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
  6912. CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
  6913. }
  6914. }
  6915. ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
  6916. ###
  6917. ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
  6918. ### Note: Output name is used as is, no extension added.
  6919. macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
  6920. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_CPP_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS -emit-ast -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p ST"} ${kv;hide:"pc light-green"}
  6921. PEERDIR(build/platform/clang)
  6922. }
  6923. ### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
  6924. ###
  6925. ### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6926. ### Note: Output name is used as is, no extension added.
  6927. macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
  6928. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang++ ${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 $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6929. .SEM=llvm_compile_cxx ${input:Input} ${output;noauto:Output} ${"${CLANGPLUSPLUS}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  6930. PEERDIR(build/platform/clang)
  6931. }
  6932. ### @usage: LLVM_COMPILE_C(Input Output Opts...)
  6933. ###
  6934. ### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6935. ### Note: Output name is used as is, no extension added.
  6936. macro LLVM_COMPILE_C(Input, Output, Opts...) {
  6937. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang ${pre=-I:_C__INCLUDE} $BC_CFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6938. .SEM=llvm_compile_c ${input:Input} ${output;noauto:Output} ${"${CLANGC}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  6939. PEERDIR(build/platform/clang)
  6940. }
  6941. ### @usage: BPF(Input Output Opts...)
  6942. ###
  6943. ### Emit eBPF bytecode from .c file.
  6944. ### Note: Output name is used as is, no extension added.
  6945. macro BPF(Input, Output, Opts...) {
  6946. .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 $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BP"} ${kv;hide:"pc light-green"}
  6947. PEERDIR(build/platform/clang)
  6948. }
  6949. LD_BINARY_NAME=ld
  6950. when($OS_LINUX) {
  6951. LD_BINARY_NAME=ld.lld
  6952. }
  6953. ### @usage: BPF_STATIC(Input Output Opts...)
  6954. ###
  6955. ### Emit eBPF bytecode from .c file.
  6956. ### Note: Output name is used as is, no extension added.
  6957. macro BPF_STATIC(Input, Output, Opts...) {
  6958. .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_BINARY_NAME -r -b binary -m elf_x86_64 -o ${output;noauto;suf=.bpf.o:Input} ${noauto;nopath:Output}
  6959. PEERDIR(build/platform/clang build/platform/lld)
  6960. }
  6961. ### @usage: LLVM_COMPILE_LL(Input Output Opts...)
  6962. ###
  6963. ### Compile LLVM bytecode to object representation.
  6964. ### Note: Output name is used as is, no extension added.
  6965. macro LLVM_COMPILE_LL(Input, Output, Opts...) {
  6966. .CMD=${CLANG_BC_ROOT}/bin/llvm-as ${input:Input} -o ${output;noauto:Output} ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6967. PEERDIR(build/platform/clang)
  6968. }
  6969. ### @usage: LLVM_LINK(Output Inputs...)
  6970. ###
  6971. ### Call llvm-link on set of Inputs to produce Output.
  6972. ### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
  6973. macro LLVM_LINK(Output, Inputs...) {
  6974. .CMD=${CLANG_BC_ROOT}/bin/llvm-link ${input:Inputs} -o ${output;noauto:Output} ${kv;hide:"p LD"} ${kv;hide:"pc light-red"}
  6975. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Inputs} COMMAND ${LLVMLINK} ${input:Inputs} -o ${output;noauto:Output}
  6976. PEERDIR(build/platform/clang)
  6977. }
  6978. ### @usage: LLVM_OPT(Input Output Opts...)
  6979. ###
  6980. ### Call llvm-opt with set of Opts on Input to produce Output.
  6981. ### Note: Output name is used as is, no extension added.
  6982. macro LLVM_OPT(Input, Output, Opts...) {
  6983. .CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} ${CLANG_BC_ROOT}/bin/opt ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p OP"} ${kv;hide:"pc yellow"}
  6984. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMOPT} ${input:Input} -o ${output;noauto:Output} $Opts
  6985. PEERDIR(build/platform/clang)
  6986. }
  6987. ### @usage: LLVM_LLC(Src Opts...)
  6988. ###
  6989. ### Call llvm-llc with set of Opts on Src to produce object file.
  6990. ###
  6991. ### Note: Output name is calculated as concatenation of Src name and platform specific object file extension.
  6992. macro LLVM_LLC(Src, Opts...) {
  6993. .CMD=${tool:"contrib/libs/llvm14/tools/llc"} ${input:Src} --filetype obj -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts ${kv;hide:"p LC"} ${kv;hide:"pc yellow"}
  6994. .SEM=add_custom_command OUTPUT ${output;suf=$OBJECT_SUF;noauto:Src} DEPENDS ${input:Src} COMMAND ${LLVMLLC} --filetype obj ${input:Src} -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts
  6995. PEERDIR(build/platform/clang)
  6996. }
  6997. when ($NO_DEBUGINFO == "yes") {
  6998. DEBUG_INFO_FLAGS=
  6999. }
  7000. when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
  7001. DEBUG_INFO_FLAGS=-gline-tables-only
  7002. }
  7003. # TODO: configurable tar and touch
  7004. PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  7005. # tag:internal
  7006. ### @usage TOUCH(Outputs...) # internal
  7007. ### Just introduce outputs
  7008. macro TOUCH(Outputs...) {
  7009. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
  7010. }
  7011. TOUCH_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p UN"} ${kv;hide:"pc light-cyan"} $TARGET
  7012. FAKE_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"pc light-red"} $TARGET
  7013. COPY_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/copy_to_dir.py"} --dest-dir $BINDIR --build-root $ARCADIA_BUILD_ROOT $PACKED_PACKAGE_ARGS $SRCS_GLOBAL $PEERS_LATE_OUTS ${skip_by_ext=.pkg.fake:PEERS} ${hide;late_out:AUTO_INPUT} ${hide;late_out;to_namespace=$BINDIR/:SRCS_GLOBAL} ${hide;late_out;to_namespace=$BINDIR/:PEERS_LATE_OUTS} ${hide;late_out;skip_by_ext=.pkg.fake;to_namespace=$BINDIR/:PEERS} ${kv;hide:"package PACKAGE"}
  7014. TOUCH_PACKAGE=$FAKE_PACKAGE_CMD $VCS_INFO_DISABLE_CACHE__NO_UID__ && $COPY_PACKAGE_CMD
  7015. _P_PK=${kv;hide:"p PK"}
  7016. TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK && $ADD_VCS_INFO_FILE_CMD
  7017. # Note: we don't use touch.py in the command below to avoid introduction of undesired input
  7018. UNION_CMD=$YMAKE_PYTHON -c open(\'$TARGET\',\'w\').close() ${kv;hide:"p UN"} ${kv;hide:"package UNION"} ${kv;hide:"pc light-cyan"} $UNION_OUTS $VCS_INFO_DISABLE_CACHE__NO_UID__
  7019. UNION_CMD_MF=$UNION_CMD && $GENERATE_MF
  7020. macro _EXPAND_INS_OUTS(FILES{input}[]) {
  7021. .CMD=${input;hide:FILES} ${late_out;hide:INPUT}
  7022. }
  7023. _UNION_EXPLICIT_OUTPUTS=
  7024. ### @usage: EXPLICIT_OUTPUTS(Files...)
  7025. ###
  7026. ### Let UNION has only explicitly specified outputs listed in this macro
  7027. ### The list of files shall contain results of commands in this UNION.
  7028. ### Only these files will be outputs of the UNION. This allows to eliminate
  7029. ### intermediate files being result of the UNION
  7030. macro EXPLICIT_OUTPUTS(Files...) {
  7031. SET_APPEND(_UNION_EXPLICIT_OUTPUTS ${Files})
  7032. }
  7033. NO_CHECK_IMPORTS_FOR_VALUE=None
  7034. ### @usage: NO_CHECK_IMPORTS([patterns])
  7035. ###
  7036. ### Do not run checks on imports of Python modules.
  7037. ### Optional parameter mask patterns describes the names of the modules that do not need to check.
  7038. macro NO_CHECK_IMPORTS(Masks...) {
  7039. SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
  7040. }
  7041. # tag:yasm-specific
  7042. _YASM_FMT_VALUE=
  7043. _YASM_PLATFORM_FLAGS_VALUE=
  7044. _YASM_PREDEFINED_FLAGS_VALUE=
  7045. when ($OS_DARWIN || $OS_IOS) {
  7046. _YASM_FMT_VALUE=macho
  7047. _YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
  7048. }
  7049. elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
  7050. _YASM_FMT_VALUE=win
  7051. _YASM_PLATFORM_FLAGS_VALUE=-D WIN64
  7052. }
  7053. elsewhen ($OS_WINDOWS && $ARCH_I386) {
  7054. _YASM_FMT_VALUE=win
  7055. _YASM_PLATFORM_FLAGS_VALUE=-D WIN32
  7056. }
  7057. otherwise {
  7058. _YASM_FMT_VALUE=elf
  7059. _YASM_PLATFORM_FLAGS_VALUE=-D UNIX
  7060. _YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
  7061. }
  7062. when ($ASM_PREFIX) {
  7063. ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
  7064. }
  7065. otherwise {
  7066. ASM_PREFIX_VALUE=
  7067. }
  7068. # tag:yasm-specific
  7069. YASM_FLAGS=
  7070. YASM_PREINCLUDES_VALUE=
  7071. # tag:yasm-specific
  7072. macro _SRC_yasm_helper(SRC, PREINCLUDES[], SRCFLAGS...) {
  7073. .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"}
  7074. }
  7075. # tag:yasm-specific
  7076. macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  7077. .CMD=$_SRC_yasm_helper(${input:SRC}, $SRCFLAGS, PREINCLUDES $PREINCLUDES)
  7078. }
  7079. # tag:nasm-specific
  7080. NASM_FLAGS=
  7081. # tag:nasm-specific
  7082. macro _SRC_nasm_helper(SRC, SRCFLAGS...) {
  7083. .CMD=${NASM_RESOURCE_GLOBAL}/bin/nasm -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} -D ${pre=_;suf=_:HARDWARE_TYPE} $NASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${SRC}
  7084. }
  7085. # tag:nasm-specific
  7086. macro _SRC_nasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  7087. .CMD=$_SRC_nasm_helper(${input:SRC}, $SRCFLAGS)
  7088. }
  7089. # tag:src-processing
  7090. when ($USE_NASM_ASSEMBLER == "yes") {
  7091. MACRO_ALIAS(_SRC_ASM _SRC_nasm)
  7092. }
  7093. otherwise {
  7094. MACRO_ALIAS(_SRC_ASM _SRC_yasm)
  7095. }
  7096. ### @usage: ASM_PREINCLUDE(AsmFiles...)
  7097. ###
  7098. ### Supply additional .asm files to all assembler calls within a module
  7099. macro ASM_PREINCLUDE(PREINCLUDES...) {
  7100. SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
  7101. }
  7102. ### @usage: RUN_ANTLR(Args...)
  7103. ###
  7104. ### Macro to invoke ANTLR3 generator (general case)
  7105. macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  7106. PEERDIR(build/external_resources/antlr3 build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  7107. .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})
  7108. .SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args
  7109. }
  7110. ### @usage: RUN_ANTLR4(Args...)
  7111. ###
  7112. ### Macro to invoke ANTLR4 generator (general case)
  7113. macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  7114. _RUN_JAVA(-jar ${input:"contrib/java/antlr/antlr4/antlr.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})
  7115. }
  7116. _ANTLR4_LISTENER_GRAMMAR=-listener
  7117. _ANTLR4_LISTENER_PARSER=-listener
  7118. _ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
  7119. _ANTLR4_VISITOR_GRAMMAR=-visitor
  7120. _ANTLR4_VISITOR_PARSER=-visitor
  7121. _ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
  7122. ### @usage: RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  7123. ###
  7124. ### Macro to invoke ANTLR4 generator for separate lexer and parser grammars (Cpp)
  7125. macro RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES[], LISTENER?"PARSER":"_ANTLR4_EMPTY", VISITOR?"PARSER":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  7126. RUN_ANTLR4(${LEXER} ${PARSER} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${LEXER} ${PARSER} OUT ${noext;suf=.cpp:LEXER} ${noext;suf=.h:LEXER} ${noext;suf=.cpp:PARSER} ${noext;suf=.h:PARSER} ${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})
  7127. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  7128. }
  7129. ### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  7130. ###
  7131. ### Macro to invoke ANTLR4 generator for combined lexer+parser grammars (Cpp)
  7132. macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  7133. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} 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})
  7134. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  7135. }
  7136. ### @usage: RUN_ANTLR4_GO(GRAMMAR, DEPS <extra_go_deps>, LISTENER, VISITOR, Args...)
  7137. ###
  7138. ### Macro to invoke ANTLR4 generator (Go)
  7139. macro RUN_ANTLR4_GO(GRAMMAR, DEPS[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  7140. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Go -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} 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})
  7141. PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/sync ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr/v4 $DEPS)
  7142. }
  7143. ### @usage: RUN_ANTLR4_PYTHON(Grammar [LISTENER] [VISITOR] [SUBDIR] [EXTRA_OUTS Outs...] Args...)
  7144. ###
  7145. ### `LISTENER` - emit grammar listener
  7146. ### `VISITOR` - emit grammar visitor
  7147. ### `SUBDIR` - place generated files to specified subdirectory of BINDIR
  7148. ### `EXTRA_OUTS` - list extra outputs produced by Antlr (e.g. .interp and .token files) if they are needed. If `SUBDIR` is specied it will affect these as well. Use file names only.
  7149. ###
  7150. ### Macro to invoke ANTLR4 generator (Python). The Python3 will be used for PY3_LIBRARY/PY3_PROGRAM/PY3TEST, Python2 will be used in all other cases.
  7151. macro RUN_ANTLR4_PYTHON(GRAMMAR, LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", SUBDIR=".", EXTRA_OUTS[], _ANTLR4_EMPTY="", Args...) {
  7152. RUN_ANTLR4(${GRAMMAR} -Dlanguage=$ANTLR_PYTHON -o ${BINDIR}/${SUBDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT_NOAUTO ${nopath;noext;pre=${SUBDIR}/;suf=Lexer.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Parser.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Listener.py:$LISTENER} ${nopath;noext;pre=${SUBDIR}/;suf=Visitor.py:$VISITOR} ${pre=${SUBDIR}/:EXTRA_OUTS})
  7153. PEERDIR(contrib/python/antlr4)
  7154. }
  7155. # tag:cpp-specific
  7156. macro CPP_ADDINCL(Dirs...) {
  7157. ADDINCL($Dirs)
  7158. }
  7159. # tag:internal
  7160. _WHOLE_ARCHIVE_PEERS_VALUE=
  7161. ### @usage: WHOLE_ARCHIVE(dirnames...) # internal
  7162. macro WHOLE_ARCHIVE(PEERS...) {
  7163. SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
  7164. REQUIRES(${PEERS})
  7165. }
  7166. ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
  7167. macro TASKLET() {
  7168. PEERDIR(tasklet/api)
  7169. # CPP
  7170. CPP_PROTO_PLUGIN(tasklet_cpp tasklet/v1/gen/cpp .tasklet.h)
  7171. # Python
  7172. PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/v1/gen/python DEPS tasklet/v1/domain/sandbox tasklet/v1/runtime sandbox/sdk2)
  7173. }
  7174. TASKLET_REG_INCLUDES= \
  7175. ${output_include;hide:"tasklet/v1/runtime/lib/cpp_wrapper.h"} \
  7176. ${output_include;hide:"tasklet/v1/runtime/lib/go_wrapper.h"} \
  7177. ${output_include;hide:"tasklet/v1/runtime/lib/py_wrapper.h"} \
  7178. ${output_include;hide:"tasklet/v1/runtime/lib/js_wrapper.h"} \
  7179. ${output_include;hide:"tasklet/v1/runtime/lib/registry.h"}
  7180. macro TASKLET_REG(Name, Lang, Impl, Includes...) {
  7181. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  7182. when($Lang == "js") {
  7183. # JS runtime links the Node.js from contrib as a library, which is a bit heavy,
  7184. # so we do it, only if any JS tasklets are linked into the target
  7185. PEERDIR+=tasklet/v1/runtime/js
  7186. }
  7187. .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"}
  7188. SRCS(GLOBAL $Name.task.cpp)
  7189. }
  7190. # TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
  7191. # NOT COMPLETE
  7192. macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
  7193. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  7194. .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"}
  7195. SRCS(GLOBAL $Name.task.cpp)
  7196. }
  7197. # tag:cpp-specific
  7198. _CPP_PROTO_MODULE_PREFIX=
  7199. _CPP_PROTO_MODULE_SUFFIX=
  7200. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7201. _CPP_PROTO_MODULE_PREFIX=
  7202. _CPP_PROTO_MODULE_SUFFIX=.lib
  7203. }
  7204. otherwise {
  7205. _CPP_PROTO_MODULE_PREFIX=lib
  7206. _CPP_PROTO_MODULE_SUFFIX=.a
  7207. }
  7208. ### @usage: _EXPOSE(OutputsToExport...)
  7209. ###
  7210. ### Allows to mark outputs of macro command as unused in the current module but intended
  7211. ### to be used in modules consuming current via PEERDIR.
  7212. ###
  7213. ### TODO(DEVTOOLS-9000) proper implementation needed
  7214. macro _EXPOSE(Args...) {
  7215. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).ya_exposed:"empty_"} ${input;hide:Args}
  7216. }
  7217. ### @usage: LIST_PROTO([TO list.proto] Files...) # deprecated
  7218. ###
  7219. ### Create list of .proto files in a list-file (should be .proto, files.proto by default)
  7220. ### with original .proto-files as list's dependencies.
  7221. ###
  7222. ### This allows to process files listed, passing list as an argument to the processor
  7223. ###
  7224. ### TODO: proper implementation needed
  7225. macro LIST_PROTO(TO="files.proto", Files...) {
  7226. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/list.py"} ${Files} ${input;hide:Files} ${stdout;output;noauto:TO} ${output_include;from_input;hide:Files} && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;noext;suf=.pb.h:TO}
  7227. _EXPOSE(${TO})
  7228. }
  7229. # tag:proto
  7230. macro _PROTO_DESC_CMD(File) {
  7231. .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 $_PROTOC_FLAGS ${input;rootrel:File}
  7232. }
  7233. _PROTO_DESC_MERGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $AUTO_INPUT ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
  7234. _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"}
  7235. NEED_GOOGLE_PROTO_PEERDIRS=yes
  7236. CPP_PROTO_LIBRARY_SEM=$CPP_LIBRARY_SEM
  7237. JAVA_PROTO_LIBRARY_SEM=$BUILD_PROTO_JAR_SEM $_GRADLE_EXPORT_PUBLISHING_SEM
  7238. # tag:proto
  7239. ### @usage: PROTO_LIBRARY()
  7240. ###
  7241. ### Build some varian of protocol buffers library.
  7242. ###
  7243. ### The particular variant is selected based on where PEERDIR to PROTO_LIBRARY comes from.
  7244. ###
  7245. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  7246. ### When PEERDIR comes from module for particular language appropriate variant is selected.
  7247. ### PROTO_LIBRARY also supports emission of GRPC code if GRPC() macro is specified.
  7248. ### Notes:
  7249. ### - Python versions emit C++ code in addition to Python as optimization.
  7250. ### - In some PROTO_LIBRARY-es Java or Python versions are excluded via EXCLUDE_TAGS macros due to incompatibilities.
  7251. ### - Use from DEPENDS or BUNDLE is not allowed
  7252. ###
  7253. ### Documentation: https://wiki.yandex-team.ru/yatool/proto_library/
  7254. ###
  7255. ### See: [GRPC()](#macro_GRPC), [OPTIMIZE_PY_PROTOS()](#macro_OPTIMIZE_PY_PROTOS), [INCLUDE_TAGS()](#macro_INCLUDE_TAGS), [EXCLUDE_TAGS()](#macro_EXCLUDE_TAGS)
  7256. multimodule PROTO_LIBRARY {
  7257. module CPP_PROTO : LIBRARY {
  7258. .ALLOWED=_EXPOSE LIST_PROTO
  7259. # TODO(svidyuk): think about marker which forces semantics inheritance
  7260. .SEM=CPP_PROTO_LIBRARY_SEM
  7261. FORCE_COVERAGE_DISABLED=yes
  7262. ENABLE(CPP_PROTO)
  7263. ENABLE(GEN_PROTO)
  7264. NO_CLANG_TIDY()
  7265. SET(PEERDIR_TAGS CPP_PROTO)
  7266. when ($BUILD_PROTO_AS_EVLOG == "yes" && $USE_VANILLA_PROTOC == "yes") {
  7267. _OK=no
  7268. }
  7269. ASSERT(_OK BUILD_PROTO_AS_EVLOG and USE_VANILLA_PROTOC are incompatible yet)
  7270. MODULE_SUFFIX=$_CPP_PROTO_MODULE_SUFFIX
  7271. MODULE_PREFIX=$_CPP_PROTO_MODULE_PREFIX
  7272. when ($_COMMON_GOOGLE_APIS != "None") {
  7273. PEERDIR += contrib/libs/googleapis-common-protos
  7274. }
  7275. }
  7276. module JAVA_PROTO: EXTERNAL_JAVA_LIBRARY {
  7277. .EXTS=.jsrc
  7278. .ALLOWED=GRPC
  7279. .SEM=JAVA_PROTO_LIBRARY_SEM
  7280. SET(PEERDIR_TAGS JAVA_PROTO)
  7281. ENABLE(JAVA_PROTO)
  7282. PEERDIR+=$JAVA_PROTOBUF_PEERS
  7283. when ($KOTLIN_PROTO == "yes") {
  7284. KOTLIN_PROTO_PEERS=contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION}
  7285. KOTLIN_PROTO_FLAGS=--kotlin_out=$ARCADIA_BUILD_ROOT/java_out
  7286. }
  7287. when ($GRADLE_EXPORT_PUBLISHING == "yes") {
  7288. _GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
  7289. }
  7290. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE
  7291. ADDINCL(FOR proto $PROTOBUF_PATH)
  7292. when ($_COMMON_GOOGLE_APIS != "None") {
  7293. PEERDIR += contrib/java/com/google/api/grpc/proto-google-common-protos/${JAVA_PROTO_COMMON_VERSION}
  7294. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  7295. }
  7296. }
  7297. module PY_PROTO: PY2_LIBRARY {
  7298. .ALIASES=SRCS=PY_SRCS
  7299. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  7300. .PEERDIRSELF=CPP_PROTO
  7301. .SEM=IGNORED
  7302. SET(PEERDIR_TAGS PY2 PY_PROTO)
  7303. ENABLE(PY_PROTO)
  7304. OPTIMIZE_PY_PROTOS()
  7305. OBJ_SUF=.py2
  7306. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7307. SET(_NO_LINT_VALUE none_internal)
  7308. when ($_COMMON_GOOGLE_APIS != "None") {
  7309. PEERDIR += contrib/libs/googleapis-common-protos
  7310. }
  7311. _IGNORE_SELF_PEERS=
  7312. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  7313. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  7314. _IGNORE_PEERDIRSELF=CPP_PROTO
  7315. }
  7316. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  7317. }
  7318. module PY3_PROTO: PY3_LIBRARY {
  7319. .ALIASES=SRCS=PY_SRCS
  7320. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  7321. .PEERDIRSELF=CPP_PROTO
  7322. .SEM=IGNORED
  7323. SET(PEERDIR_TAGS PY3 PY3_PROTO)
  7324. ENABLE(PY3_PROTO)
  7325. OPTIMIZE_PY_PROTOS()
  7326. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7327. MODULE_PREFIX=py3
  7328. }
  7329. otherwise {
  7330. MODULE_PREFIX=libpy3
  7331. }
  7332. OBJ_SUF=.py3
  7333. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7334. SET(_NO_LINT_VALUE none_internal)
  7335. when ($_COMMON_GOOGLE_APIS != "None") {
  7336. PEERDIR += contrib/libs/googleapis-common-protos
  7337. }
  7338. _IGNORE_SELF_PEERS=
  7339. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  7340. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  7341. _IGNORE_PEERDIRSELF=CPP_PROTO
  7342. }
  7343. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  7344. }
  7345. module GO_PROTO: GO_LIBRARY {
  7346. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO
  7347. .SEM=IGNORED
  7348. SET(PEERDIR_TAGS GO GO_PROTO)
  7349. ENABLE(GO_PROTO)
  7350. when ($_COMMON_GOOGLE_APIS == "None") {
  7351. }
  7352. elsewhen ($_COMMON_GOOGLE_APIS == "") {
  7353. PEERDIR += $_GO_COMMON_GOOGLE_APIS
  7354. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  7355. }
  7356. otherwise {
  7357. PEERDIR += $_COMMON_GOOGLE_APIS
  7358. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  7359. }
  7360. }
  7361. module DESC_PROTO: _BARE_UNIT {
  7362. .CMD=_PROTO_DESC_MERGE_CMD
  7363. .SEM=IGNORED
  7364. .EXTS=.desc
  7365. .NODE_TYPE=Library
  7366. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
  7367. SET(PEERDIR_TAGS DESC_PROTO)
  7368. ENABLE(DESC_PROTO)
  7369. MODULE_SUFFIX=.self.protodesc
  7370. SET(MODULE_TYPE LIBRARY)
  7371. MACRO_ALIAS(EVLOG_CMD _PROTO_DESC_CMD)
  7372. MACRO_ALIAS(PROTO_CMD _PROTO_DESC_CMD)
  7373. when ($_COMMON_GOOGLE_APIS != "None") {
  7374. PEERDIR += contrib/libs/googleapis-common-protos
  7375. }
  7376. when ($NEED_GOOGLE_PROTO_PEERDIRS == "yes") {
  7377. when ($USE_VANILLA_PROTOC == "yes") {
  7378. PEERDIR += contrib/libs/protobuf_std/builtin_proto/protos_from_protobuf
  7379. }
  7380. otherwise {
  7381. PEERDIR += contrib/libs/protobuf/builtin_proto/protos_from_protoc
  7382. }
  7383. }
  7384. }
  7385. }
  7386. module PROTO_DESCRIPTIONS: _BARE_UNIT {
  7387. .CMD=_PROTO_DESC_MERGE_PEERS_CMD
  7388. .PEERDIR_POLICY=as_build_from
  7389. .NODE_TYPE=Library
  7390. .RESTRICTED=SRCS
  7391. .FINAL_TARGET=yes
  7392. SET(PEERDIR_TAGS DESC_PROTO)
  7393. SET(MODULE_SUFFIX .protodesc)
  7394. SET(MODULE_TYPE PROTO_DESCRIPTIONS)
  7395. }
  7396. module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
  7397. SET(MODULE_TYPE PROTO_REGISTRY)
  7398. }
  7399. # tag:fbs
  7400. _FBS_NAMESPACE_MAP_GLOBAL=
  7401. # tag:fbs
  7402. macro _FBS_NAMESPACE_IMPL(NAMESPACE, PATH, DUMMY...) {
  7403. SET_APPEND(_FBS_NAMESPACE_MAP_GLOBAL ${NAMESPACE}=${PATH})
  7404. }
  7405. # tag:fbs
  7406. macro FBS_NAMESPACE(NAMESPACE, PATH...) {
  7407. _FBS_NAMESPACE_IMPL($NAMESPACE $PATH $MODDIR)
  7408. }
  7409. # tag:fbs
  7410. ### @usage: FBS_LIBRARY()
  7411. ###
  7412. ### Build some variant of Flatbuffers library.
  7413. ###
  7414. ### The particular variant is selected based on where PEERDIR to FBS_LIBRARY
  7415. ### comes from.
  7416. ###
  7417. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  7418. ### When PEERDIR comes from module for particular language appropriate variant
  7419. ### is selected.
  7420. ###
  7421. ### Notes: FBS_NAMESPACE must be specified in all dependent FBS_LIBRARY modules
  7422. ### if build of Go code is requested.
  7423. multimodule FBS_LIBRARY {
  7424. module CPP_FBS: LIBRARY {
  7425. ENABLE(CPP_FBS)
  7426. SET(PEERDIR_TAGS CPP_FBS)
  7427. }
  7428. module GO_FBS: GO_LIBRARY {
  7429. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7430. ENABLE(GO_FBS)
  7431. SET(PEERDIR_TAGS GO GO_FBS)
  7432. }
  7433. module JAVA_FBS: EXTERNAL_JAVA_LIBRARY {
  7434. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7435. ENABLE(JAVA_FBS)
  7436. SET(PEERDIR_TAGS JAVA_FBS)
  7437. }
  7438. module PY2_FBS: PY2_LIBRARY {
  7439. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7440. .ALIASES=SRCS=PY_SRCS
  7441. ENABLE(PY2_FBS)
  7442. SET(PEERDIR_TAGS PY2 PY2_FBS)
  7443. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7444. SET(_NO_LINT_VALUE none_internal)
  7445. }
  7446. module PY3_FBS: PY3_LIBRARY {
  7447. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7448. .ALIASES=SRCS=PY_SRCS
  7449. ENABLE(PY3_FBS)
  7450. SET(PEERDIR_TAGS PY3 PY3_FBS)
  7451. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7452. SET(_NO_LINT_VALUE none_internal)
  7453. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7454. MODULE_PREFIX=py3
  7455. }
  7456. otherwise {
  7457. MODULE_PREFIX=libpy3
  7458. }
  7459. OBJ_SUF=.py3
  7460. }
  7461. }
  7462. # tag:java-specific
  7463. _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"}
  7464. # tag:java-specific
  7465. COMPILE_JSRC_MF=$_COMPILE_JSRC && $GENERATE_MF
  7466. # tag:java-specific tag:internal
  7467. ### @usage: JSRC_LIBRARY() # internal
  7468. module JSRC_LIBRARY: _BARE_UNIT {
  7469. .CMD=COMPILE_JSRC_MF
  7470. .EXTS=.java
  7471. .PEERDIR_POLICY=as_include
  7472. .FINAL_TARGET=no
  7473. .ALIASES=SRCS=FILES
  7474. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  7475. MODULE_TYPE=LIBRARY
  7476. SET(MODULE_SUFFIX .jsrc)
  7477. SET(DONT_RESOLVE_INCLUDES yes)
  7478. SET(NEED_PLATFORM_PEERDIRS no)
  7479. SET(MODULE_LANG JAVA)
  7480. NO_RUNTIME()
  7481. }
  7482. # tag:maps-specific
  7483. @import "${CONF_ROOT}/conf/project_specific/maps/asrc.conf"
  7484. # tag:internal
  7485. ### @usage: _PROXY_LIBRARY() # internal
  7486. ###
  7487. ### The use of this module is strictly prohibited!!!
  7488. module _PROXY_LIBRARY: LIBRARY {
  7489. .EXTS=.a .lib
  7490. .PEERDIR_POLICY=as_build_from
  7491. .PROXY=yes
  7492. .FINAL_TARGET=yes
  7493. DISABLE(NEED_ADD_FAKE_SRC)
  7494. NO_UTIL()
  7495. NO_RUNTIME()
  7496. }
  7497. # tag:maps-specific
  7498. @import "${CONF_ROOT}/conf/project_specific/maps/aar.conf"
  7499. @import "${CONF_ROOT}/conf/project_specific/maps/sproto.conf"
  7500. @import "${CONF_ROOT}/conf/project_specific/maps/mapkit.conf"
  7501. _PRIMARY_OUTPUT_VALUE=
  7502. # tag:internal
  7503. ### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
  7504. ###
  7505. ### The use of this module is strictly prohibited!!!
  7506. macro PRIMARY_OUTPUT(OUTPUT) {
  7507. SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
  7508. }
  7509. _DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${input;hide:_PRIMARY_OUTPUT_VALUE} ${TARGET}
  7510. # tag:internal
  7511. ### @usage: DLL_PROXY_LIBRARY() # internal
  7512. ###
  7513. ### The use of this module is strictly prohibited!!!
  7514. module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
  7515. .ALLOWED=PRIMARY_OUTPUT
  7516. .CMD=_DLL_PROXY_LIBRARY_CMD
  7517. }
  7518. _PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${kv;hide:"p ld"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7519. # tag:internal
  7520. ### @usage: PREBUILT_PROGRAM([programname]) # internal
  7521. ###
  7522. ### Program module which uses a prebuilt prgram as its output.
  7523. module PREBUILT_PROGRAM: _LINK_UNIT {
  7524. .CMD=_PREBUILT_PROGRAM_CMD
  7525. .SYMLINK_POLICY=EXE
  7526. .ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
  7527. .RESTRICTED=SRCS
  7528. _BARE_LINK_MODULE()
  7529. SET(MODULE_TYPE PROGRAM)
  7530. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  7531. MODULE_SUFFIX=.exe
  7532. }
  7533. }
  7534. ### @usage COLLECT_JINJA_TEMPLATES(varname path)
  7535. ###
  7536. ### This macro collects all jinja and yaml files in the directory specified by second argument and
  7537. ### stores result in the variable with mane specified by first parameter.
  7538. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
  7539. _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
  7540. }
  7541. # tag:go-specific
  7542. ### @usage: COLLECT_GO_SWAGGER_FILES(Varname, Dir)
  7543. ###
  7544. ### Recursively collect files for swagger config creation
  7545. macro COLLECT_GO_SWAGGER_FILES(Varname, Dir) {
  7546. _GLOB($Varname $Dir/**/*.go ${ARCADIA_ROOT}/go.mod)
  7547. }
  7548. # tag:go-specific
  7549. GO_HOST_OS=unknown
  7550. when ($HOST_OS_LINUX) {
  7551. GO_HOST_OS=linux
  7552. }
  7553. elsewhen ($HOST_OS_DARWIN) {
  7554. GO_HOST_OS=darwin
  7555. }
  7556. elsewhen($HOST_OS_WINDOWS) {
  7557. GO_HOST_OS=windows
  7558. }
  7559. # tag:go-specific
  7560. GO_HOST_ARCH=unknown
  7561. when ($HOST_ARCH_X86_64) {
  7562. GO_HOST_ARCH=amd64
  7563. }
  7564. elsewhen($HOST_ARCH_ARM64) {
  7565. GO_HOST_ARCH=arm64
  7566. }
  7567. # tag:go-specific
  7568. GO_TARG_OS=unknown
  7569. when ($OS_LINUX) {
  7570. GO_TARG_OS=linux
  7571. }
  7572. elsewhen ($OS_DARWIN) {
  7573. GO_TARG_OS=darwin
  7574. }
  7575. elsewhen ($OS_WINDOWS) {
  7576. GO_TARG_OS=windows
  7577. }
  7578. # tag:go-specific
  7579. GO_TARG_ARCH=unknwon
  7580. when ($ARCH_X86_64) {
  7581. GO_TARG_ARCH=amd64
  7582. }
  7583. elsewhen ($ARCH_I386) {
  7584. GO_TARG_ARCH=x86
  7585. }
  7586. elsewhen ($ARCH_ARM64) {
  7587. GO_TARG_ARCH=arm64
  7588. }
  7589. # tag:go-specific
  7590. GO_HOST_TARG_PARAMS=++host-os $GO_HOST_OS ++host-arch $GO_HOST_ARCH ++targ-os $GO_TARG_OS ++targ-arch $GO_TARG_ARCH
  7591. # tag:go-specific
  7592. GOSTD_VERSION=1.20
  7593. when ($GOSTD_VERSION == "1.20") {
  7594. GOSTD=contrib/go/_std_1.20/src
  7595. }
  7596. otherwise {
  7597. GOSTD=__unsupported_go_std_library_version_[$GOSTD_VERSION]__
  7598. }
  7599. # tag:go-specific
  7600. GO_DEBUG_PATH_RELATIVE=no
  7601. _GO_DEBUG_PATH__NO_UID__=
  7602. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=
  7603. # tag:go-specific
  7604. _GO_BUILDMODE=
  7605. _GO_IMPORT_PATH=${MODDIR}
  7606. # tag:go-specific
  7607. GO_VET=yolint
  7608. GO_VET_TOOL=
  7609. GO_VET_FLAGS=
  7610. GO_VET_EXTRA_FLAGS=
  7611. # tag:go-specific
  7612. _GO_VET_ADD_CHECK=yes
  7613. _GO_FMT_ADD_CHECK=yes
  7614. _GO_YDX_FILE=
  7615. # tag:go-specific
  7616. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=/-B --source-prefix=/-S
  7617. _GO_LINK_EXE_EXT_CMD=
  7618. # tag:go-specific
  7619. GO_WITH_MUSL=
  7620. # tag:go-specific
  7621. GO_TOOLS_ROOT=${GO_TOOLS_RESOURCE_GLOBAL}
  7622. GO_TEST_MINER=${tool:"tools/go_test_miner"}
  7623. GO_TEST_IMPORT_PATH=
  7624. # tag:go-specific
  7625. GO_STD_LIB_PREFIX=${GOSTD}/
  7626. GO_STD_CMD_PREFIX=${GOSTD}/cmd/
  7627. GO_ARCADIA_PROJECT_PREFIX=a.yandex-team.ru/
  7628. GO_CONTRIB_PROJECT_PREFIX=vendor/
  7629. GO_SKIP_IMPORTS=unsafe C
  7630. GO_VET_INFO_EXT=.vet.out
  7631. GO_VET_REPORT_EXT=.vet.txt
  7632. GO_VET_OUTPUT_INFO=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_INFO_EXT}:REALPRJNAME}
  7633. GO_VET_OUTPUT_REPORT=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_REPORT_EXT}:REALPRJNAME}
  7634. # tag:go-specific tag:codenav
  7635. _GO_YNDEXER_EXT=.ydx.pb2
  7636. GO_YNDEXER_OUTPUT=${output;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${_GO_YNDEXER_EXT}:REALPRJNAME}
  7637. # tag:go-specific
  7638. GO_PROJECT_PREFIXES=++std-lib-prefix $GO_STD_LIB_PREFIX ++arc-project-prefix $GO_ARCADIA_PROJECT_PREFIX
  7639. # tag:go-specific
  7640. _GO_FAKEID=${FAKEID}.${BUILD_TYPE}.${GOSTD_VERSION}.${GO_FAKEID}
  7641. _CGO_FAKEID=${_GO_FAKEID}.${CPP_FAKEID}
  7642. # tag:go-specific
  7643. CGO2_CFLAGS_VALUE=
  7644. CGO2_LDFLAGS_VALUE=
  7645. # tag:go-specific
  7646. GO_ASM_FLAGS_VALUE=
  7647. ### @usage: GO_ASM_FLAGS(flags)
  7648. ### Add the specified flags to the go asm compile command line.
  7649. macro GO_ASM_FLAGS(Flags...) {
  7650. SET_APPEND(GO_ASM_FLAGS_VALUE $Flags)
  7651. }
  7652. # tag:go-specific
  7653. GO_CGO1_FLAGS_VALUE=
  7654. ### @usage: GO_CGO1_FLAGS(flags)
  7655. ### Add the specified flags to the go cgo compile command line.
  7656. macro GO_CGO1_FLAGS(Flags...) {
  7657. SET_APPEND(GO_CGO1_FLAGS_VALUE $Flags)
  7658. }
  7659. # tag:go-specific
  7660. GO_CGO2_FLAGS_VALUE=
  7661. ### @usage: GO_CGO2_FLAGS(flags)
  7662. ### Add the specified flags to the go cgo compile command line.
  7663. macro GO_CGO2_FLAGS(Flags...) {
  7664. SET_APPEND(GO_CGO2_FLAGS_VALUE $Flags)
  7665. }
  7666. # tag:go-specific
  7667. GO_COMPILE_FLAGS_VALUE=$USER_GO_COMPILE_FLAGS
  7668. ### @usage: GO_COMPILE_FLAGS(flags)
  7669. ### Add the specified flags to the go compile command line.
  7670. macro GO_COMPILE_FLAGS(Flags...) {
  7671. SET_APPEND(GO_COMPILE_FLAGS_VALUE $Flags)
  7672. }
  7673. # tag:go-specific
  7674. GO_LINK_FLAGS_VALUE=$USER_GO_LINK_FLAGS
  7675. ### @usage: GO_LINK_FLAGS(flags)
  7676. ### Add the specified flags to the go link command line.
  7677. macro GO_LINK_FLAGS(Flags...) {
  7678. SET_APPEND(GO_LINK_FLAGS_VALUE $Flags)
  7679. }
  7680. # tag:go-specific
  7681. _GO_LANG_VERSION_VALUE=
  7682. macro GOLANG_VERSION(Arg) {
  7683. SET(_GO_LANG_VERSION_VALUE $Arg)
  7684. }
  7685. # tag:go-specific
  7686. _GO_TOOL_MODE=
  7687. # tag:go-specific
  7688. _GO_TOOL_COMMON_FLAGS=\
  7689. ++mode $_GO_TOOL_MODE \
  7690. $GO_PROJECT_PREFIXES \
  7691. ++goversion $GOSTD_VERSION \
  7692. ++lang $_GO_LANG_VERSION_VALUE \
  7693. ++source-root $ARCADIA_ROOT \
  7694. ++build-root $ARCADIA_BUILD_ROOT \
  7695. ++output-root $BINDIR \
  7696. ++toolchain-root $GO_TOOLS_ROOT \
  7697. $GO_HOST_TARG_PARAMS \
  7698. ++output $TARGET \
  7699. $GO_VET_OUTPUT \
  7700. $_GO_YDX_FILE \
  7701. $_GO_DEBUG_PATH__NO_UID__ \
  7702. ++srcs $AUTO_INPUT ${input:GO_FILES} \
  7703. ++asm-flags $GO_ASM_FLAGS_VALUE \
  7704. ++compile-flags $GO_COMPILE_FLAGS_VALUE \
  7705. ++link-flags $GO_LINK_FLAGS_VALUE \
  7706. ++cgo-srcs ${input:CGO_FILES} \
  7707. $_GO_EMBED_VALUE \
  7708. $_GO_BUILDMODE \
  7709. $GO_TOOLCHAIN_ENV
  7710. # tag:go-specific
  7711. macro _GO_GEN_COVER_GO(GO_FILE, GO_COVER_OUTPUT, VAR_ID) {
  7712. .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_COVER_OUTPUT} ${input:GO_FILE}
  7713. }
  7714. # tag:go-specific
  7715. macro _GO_COMPILE_SYMABIS(FLAGS[], ASM_FILES...) {
  7716. .CMD=${hide:_CGO_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"}
  7717. .ADDINCL=build/scripts/go_fake_include
  7718. }
  7719. # tag:go-specific
  7720. macro _GO_COMPILE_CGO1(NAME, FLAGS[], FILES...) {
  7721. .CMD=${hide:_CGO_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"}
  7722. }
  7723. # tag:go-specific
  7724. macro _GO_COMPILE_CGO2(NAME, C_FILES[], S_FILES[], OBJ_FILES[], FILES...) {
  7725. .CMD=${hide:_CGO_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"}
  7726. _USE_LINKER()
  7727. }
  7728. GO_TOOL=$YMAKE_PYTHON3 ${input:"build/scripts/go_tool.py"} $_PROCESS_WHOLE_ARCHIVE_SCRIPT
  7729. # tag:go-specific
  7730. macro _GO_LINK_LIB_IMPL(CGO_FILES[], EXTRA_INPUTS[], EXTRA_TEXT_INPUTS[], GO_FILES...) {
  7731. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} ${hide;input;context=TEXT:EXTRA_TEXT_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"}
  7732. }
  7733. # tag:go-specific
  7734. macro _GO_LINK_EXE_IMPL(CGO_FILES[], EXTRA_INPUTS[], EXTRA_TEXT_INPUTS[], GO_FILES...) {
  7735. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} ${hide;input;context=TEXT:EXTRA_TEXT_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
  7736. }
  7737. # tag:go-specific
  7738. macro _GO_LINK_TEST_IMPL(CGO_FILES[], EXTRA_INPUTS[], EXTRA_TEXT_INPUTS[], GO_TEST_FILES[], GO_XTEST_FILES[], GO_FILES...) {
  7739. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} ${hide;input;context=TEXT:EXTRA_TEXT_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_PROGRAM|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_PROGRAM|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"}
  7740. }
  7741. # tag:go-specific
  7742. GO_LINK_LIB=$GENERATE_MF && $_GO_LINK_LIB_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_TEXT_INPUTS $_GO_EMBED_INPUTS)
  7743. 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_TEXT_INPUTS $_GO_EMBED_INPUTS)
  7744. 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_TEXT_INPUTS $_GO_EMBED_INPUTS GO_TEST_FILES $_GO_TEST_SRCS_VALUE GO_XTEST_FILES $_GO_XTEST_SRCS_VALUE)
  7745. GO_LINK_DLL=$GO_LINK_EXE && $COPY_CMD $BINDIR/_cgo_export.h ${output;pre=${MODULE_PREFIX};suf=.h:REALPRJNAME}
  7746. # tag:go-specific
  7747. CGO_ENABLED=yes
  7748. when ($OS_WINDOWS == "yes" || $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  7749. CGO_ENABLED=no
  7750. }
  7751. elsewhen ($CGO_ENABLED == "yes") {
  7752. GO_LINK_FLAGS_VALUE+=-linkmode=external
  7753. }
  7754. # tag:go-specific
  7755. GO_PACKAGE_VALUE=
  7756. ### @usage: GO_PACKAGE_NAME(Name)
  7757. ### Override name of a Go package.
  7758. macro GO_PACKAGE_NAME(NAME) {
  7759. SET(GO_PACKAGE_VALUE $NAME)
  7760. }
  7761. # tag:go-specific tag:internal
  7762. _GO_SRCS_VALUE=
  7763. ### @usage: _GO_SRCS(Files...) # internal
  7764. ### This macro shouldn't be used in ya.make files, use SRCS() instead.
  7765. ### This is internal macro collecting .go sources for processing within Go modules (GO_PROGRAM and GO_LIBRARY)
  7766. macro _GO_SRCS(FILES...) {
  7767. GO_FAKE_OUTPUT($FILES)
  7768. SET_APPEND(_GO_SRCS_VALUE $FILES)
  7769. }
  7770. # tag:go-specific
  7771. _GO_TEST_SRCS_VALUE=
  7772. GO_HAS_INTERNAL_TESTS=no
  7773. ### @usage: GO_TEST_SRCS(Files...)
  7774. ### .go sources for internal tests of a module
  7775. macro GO_TEST_SRCS(FILES...) {
  7776. GO_FAKE_OUTPUT($FILES)
  7777. _SET_FIRST_VALUE(GO_HAS_INTERNAL_TESTS ${pre=yes :FILES} ${GO_HAS_INTERNAL_TESTS})
  7778. SET_APPEND(_GO_TEST_SRCS_VALUE $FILES)
  7779. }
  7780. # tag:go-specific
  7781. _GO_XTEST_SRCS_VALUE=
  7782. GO_HAS_EXTERNAL_TESTS=no
  7783. ### @usage: GO_XTEST_SRCS(Files...)
  7784. ### .go sources for external tests of a module
  7785. macro GO_XTEST_SRCS(FILES...) {
  7786. GO_FAKE_OUTPUT($FILES)
  7787. SET(GO_HAS_EXTERNAL_TESTS yes)
  7788. SET_APPEND(_GO_XTEST_SRCS_VALUE $FILES)
  7789. }
  7790. # tag:go-specific
  7791. macro _GO_UNUSED_SRCS(FLAGS...) {
  7792. ENABLE(UNUSED_MACRO)
  7793. }
  7794. # tag:go-specific
  7795. _CGO_SRCS_VALUE=
  7796. ### @usage: CGO_SRCS(Files...)
  7797. ### .go sources to be built with CGO
  7798. macro CGO_SRCS(FILES...) {
  7799. SET_APPEND(_CGO_SRCS_VALUE $FILES)
  7800. PEERDIR(${GOSTD}/syscall)
  7801. }
  7802. # tag:go-specific
  7803. GO_LDFLAGS_GLOBAL=
  7804. ### @usage: GO_LDFLAGS(Flags...)
  7805. ### Link flags for GO_PROGRAM linking from .go sources
  7806. macro GO_LDFLAGS(FLAGS...) {
  7807. SET_APPEND(GO_LDFLAGS_GLOBAL $FLAGS)
  7808. }
  7809. # tag:go-specific
  7810. CGO_CFLAGS_VALUE=
  7811. ### @usage: CGO_CFLAGS(Flags...)
  7812. ### Compiler flags specific to CGO compilation
  7813. macro CGO_CFLAGS(FLAGS...) {
  7814. SET_APPEND(CGO_CFLAGS_VALUE $FLAGS)
  7815. CFLAGS($FLAGS)
  7816. }
  7817. # tag:go-specific
  7818. CGO_LDFLAGS_VALUE=
  7819. ### @usage: CGO_LDFLAGS(Files...)
  7820. ### Linker flags specific to CGO linking
  7821. macro CGO_LDFLAGS(FLAGS...) {
  7822. SET_APPEND(CGO_LDFLAGS_VALUE $FLAGS)
  7823. GO_LDFLAGS($FLAGS)
  7824. }
  7825. # tag:go-specific
  7826. _GO_SKIP_TEST_VALUE=
  7827. ### @usage: GO_SKIP_TESTS(TestNames...)
  7828. ###
  7829. ### Define a set of tests that should not be run.
  7830. ### NB! Subtests are not taken into account!
  7831. macro GO_SKIP_TESTS(TESTS...) {
  7832. SET_APPEND(_GO_SKIP_TEST_VALUE $TESTS)
  7833. RESTRICT_PATH(vendor MSG This macro is prohibited to be used outside the vendor/ directory)
  7834. }
  7835. # tag:go-specific tag:internal
  7836. _GO_EMBED_VALUE=
  7837. _GO_EMBED_INPUTS=
  7838. ### @usage: _GO_EMBED_PATTERN(PATTERN) # internal
  7839. ###
  7840. ### Define an embed pattern.
  7841. macro _GO_EMBED_PATTERN(XTEST?"_xtest":"", PATTERN, IMPORT_PATH) {
  7842. SET(VAR_SALT1 $XTEST $PATTERN $IMPORT_PATH 1)
  7843. SET(_PATTERN_GLOB1 uniq_embed_${hash:VAR_SALT1})
  7844. _GLOB($_PATTERN_GLOB1 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/.*)
  7845. SET(VAR_SALT2 $XTEST $PATTERN $IMPORT_PATH 2)
  7846. SET(_PATTERN_GLOB2 _uniq_embed_${hash:VAR_SALT2})
  7847. _GLOB($_PATTERN_GLOB2 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN})
  7848. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $PATTERN \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7849. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7850. }
  7851. # tag:go-specific
  7852. ### @usage: GO_EMBED_PATTERN(PATTERN)
  7853. ###
  7854. ### Define an embed pattern.
  7855. macro GO_EMBED_PATTERN(PATTERN) {
  7856. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7857. }
  7858. # tag:go-specific
  7859. ### @usage: GO_TEST_EMBED_PATTERN(PATTERN)
  7860. ###
  7861. ### Define an embed pattern for internal go tests.
  7862. macro GO_TEST_EMBED_PATTERN(PATTERN) {
  7863. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7864. }
  7865. # tag:go-specific
  7866. ### @usage: GO_XTEST_EMBED_PATTERN(PATTERN)
  7867. ###
  7868. ### Define an embed pattern for external go tests.
  7869. macro GO_XTEST_EMBED_PATTERN(PATTERN) {
  7870. _GO_EMBED_PATTERN(XTEST $PATTERN $_GO_IMPORT_PATH)
  7871. }
  7872. # tag:go-specific tag:internal
  7873. ### @usage: _GO_EMBED_DIR(PATTERN) # internal
  7874. ###
  7875. ### Define an embed directory DIR.
  7876. macro _GO_EMBED_DIR(XTEST?"_xtest":"", DIR, IMPORT_PATH, ALL?"all:":"", EXCLUDES...) {
  7877. SET(VAR_SALT $XTEST $DIR $IMPORT_PATH)
  7878. SET(_PATTERN_GLOB uniq_embed_${hash:VAR_SALT})
  7879. _GLOB($_PATTERN_GLOB ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/* EXCLUDE ${pre=${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/:EXCLUDES})
  7880. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $ALL$DIR \$$_PATTERN_GLOB)
  7881. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB)
  7882. }
  7883. # tag:go-specific
  7884. ### @usage: GO_EMBED_DIR(DIR)
  7885. ###
  7886. ### Define an embed directory DIR.
  7887. macro GO_EMBED_DIR(ALL?"ALL":"_* .*", DIR) {
  7888. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH ${ALL})
  7889. }
  7890. # tag:go-specific
  7891. ### @usage: GO_EMBED_TEST_DIR(DIR)
  7892. ###
  7893. ### Define an embed directory DIR for internal go tests.
  7894. macro GO_EMBED_TEST_DIR(ALL?"ALL":"_* .*", DIR) {
  7895. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH ${ALL})
  7896. }
  7897. # tag:go-specific
  7898. ### @usage: GO_EMBED_XTEST_DIR(DIR)
  7899. ###
  7900. ### Define an embed directory DIR for external go tests.
  7901. macro GO_EMBED_XTEST_DIR(ALL?"ALL":"_* .*", DIR) {
  7902. _GO_EMBED_DIR(XTEST $DIR $_GO_IMPORT_PATH ${ALL})
  7903. }
  7904. # tag:go-specific
  7905. _GO_TOOLCHAIN_ENV_GOARCH=unknown
  7906. when ($ARCH_ARM64) {
  7907. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=arm64"}
  7908. }
  7909. elsewhen ($ARCH_X86_64) {
  7910. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=amd64"}
  7911. }
  7912. # tag:go-specific
  7913. _GO_TOOLCHAIN_ENV_GOOS=unknown
  7914. when ($OS_DARWIN) {
  7915. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=darwin"}
  7916. }
  7917. elsewhen ($OS_LINUX) {
  7918. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=linux"}
  7919. }
  7920. elsewhen ($OS_WINDOWS) {
  7921. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=windows"}
  7922. }
  7923. _GO_TOOLCHAIN_ENV_PATH=
  7924. # tag:go-specific
  7925. GO_TOOLCHAIN_ENV=$TOOLCHAIN_ENV $_GO_TOOLCHAIN_ENV_GOARCH $_GO_TOOLCHAIN_ENV_GOOS $_GO_TOOLCHAIN_ENV_PATH
  7926. # tag:go-specific
  7927. _GO_GRPC_WELLKNOWN=\
  7928. vendor/google.golang.org/grpc \
  7929. vendor/google.golang.org/grpc \
  7930. vendor/google.golang.org/grpc/codes \
  7931. vendor/google.golang.org/grpc/grpclog \
  7932. vendor/google.golang.org/grpc/status
  7933. # tag:go-specific
  7934. macro _GO_GRPC() {
  7935. SET(GO_PROTO_GEN_PLUGINS plugins=grpc)
  7936. SET(GO_PROTO_GRPC_OPTS \$GO_PROTO_GRPC_OPTS_V2)
  7937. SET(GO_PROTO_GRPC_OUTS \$GO_PROTO_GRPC_OUTS_V2)
  7938. PEERDIR(${GOSTD}/context ${_GO_GRPC_WELLKNOWN})
  7939. }
  7940. # tag:go-specific
  7941. ### @usage: GO_GRPC_GATEWAY_SRCS()
  7942. ###
  7943. ### Use of grpc-gateway plugin (Supported for Go only).
  7944. macro GO_GRPC_GATEWAY_SRCS(FILE...) {
  7945. ENABLE(UNUSED_MACRO)
  7946. }
  7947. # tag:go-specific
  7948. ### @usage: GO_GRPC_GATEWAY_SWAGGER_SRCS()
  7949. ###
  7950. ### Use of grpc-gateway plugin w/ swagger emission (Supported for Go only).
  7951. macro GO_GRPC_GATEWAY_SWAGGER_SRCS(FILE...) {
  7952. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  7953. }
  7954. # tag:go-specific
  7955. _GO_PROTO_GRPC_GATEWAY_OPTS=
  7956. _GO_PROTO_GRPC_GATEWAY_OUTS=
  7957. # tag:go-specific
  7958. macro _GO_GRPC_GATEWAY_SRCS_IMPL(Files...) {
  7959. foreach (File : $Files) {
  7960. [.proto]=$_GO_PROTO_CMD_IMPL($File $_GO_PROTO_GRPC_GATEWAY_OPTS $_GO_PROTO_GRPC_GATEWAY_OUTS)
  7961. }
  7962. PEERDIR(${GOSTD}/context ${GOSTD}/io ${GOSTD}/net/http)
  7963. PEERDIR(vendor/github.com/golang/protobuf/descriptor)
  7964. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/runtime)
  7965. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/utilities)
  7966. PEERDIR(vendor/google.golang.org/grpc/metadata)
  7967. }
  7968. # tag:go-specific
  7969. macro _SETUP_GO_GRPC_GATEWAY() {
  7970. 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))
  7971. SET(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;nopath;noext;suf=.pb.gw.go:File})
  7972. }
  7973. # tag:go-specific
  7974. macro _GO_GRPC_GATEWAY_SRCS(Files...) {
  7975. _SETUP_GO_GRPC_GATEWAY()
  7976. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  7977. }
  7978. # tag:go-specific
  7979. macro _GO_GRPC_GATEWAY_SWAGGER_SRCS(Files...) {
  7980. _SETUP_GO_GRPC_GATEWAY()
  7981. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OPTS $_PROTO_PLUGIN_ARGS_BASE(swagger vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger logtostderr=true allow_repeated_fields_in_body=true))
  7982. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;noauto;nopath;noext;suf=.swagger.json:File})
  7983. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  7984. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  7985. }
  7986. #tag:go-specific
  7987. ### @usage: GO_GRPC_GATEWAY_V2_OPENAPI_SRCS(Files...)
  7988. ###
  7989. ### Use of grpc-gateway plugin w/ openapi v2 emission (Supported for Go only).
  7990. macro GO_GRPC_GATEWAY_V2_OPENAPI_SRCS(NO_JSON_NAMES_FOR_FIELDS?"":"", Files...) {
  7991. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options)
  7992. }
  7993. macro _GO_GRPC_GATEWAY_V2_OPENAPI_SRCS(NO_JSON_NAMES_FOR_FIELDS?"json_names_for_fields=false":"", Files...) {
  7994. _SETUP_GO_GRPC_GATEWAY_V2()
  7995. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_V2_OPTS $_PROTO_PLUGIN_ARGS_BASE(openapiv2 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 $NO_JSON_NAMES_FOR_FIELDS logtostderr=true))
  7996. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_V2_OPTS \${output;hide;norel;noauto;nopath;noext;suf=.swagger.json:File})
  7997. _GO_GRPC_GATEWAY_V2_SRCS_IMPL($Files)
  7998. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options)
  7999. }
  8000. # tag:go-specific
  8001. ### @usage: GO_GRPC_GATEWAY_V2_SRCS()
  8002. ###
  8003. ### Use of grpc-gateway plugin (Supported for Go only).
  8004. macro GO_GRPC_GATEWAY_V2_SRCS(FILE...) {
  8005. ENABLE(UNUSED_MACRO)
  8006. }
  8007. # tag:go-specific
  8008. _GO_PROTO_GRPC_GATEWAY_V2_OPTS=
  8009. _GO_PROTO_GRPC_GATEWAY_V2_OUTS=
  8010. # tag:go-specific
  8011. macro _GO_GRPC_GATEWAY_V2_SRCS_IMPL(Files...) {
  8012. foreach (File : $Files) {
  8013. [.proto]=$_GO_PROTO_CMD_IMPL($File $_GO_PROTO_GRPC_GATEWAY_V2_OPTS $_GO_PROTO_GRPC_GATEWAY_V2_OUTS)
  8014. }
  8015. PEERDIR(${GOSTD}/context ${GOSTD}/io ${GOSTD}/net/http)
  8016. PEERDIR(vendor/github.com/golang/protobuf/descriptor)
  8017. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime)
  8018. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities)
  8019. PEERDIR(vendor/google.golang.org/grpc/metadata)
  8020. PEERDIR(vendor/google.golang.org/protobuf/proto)
  8021. }
  8022. # tag:go-specific
  8023. macro _SETUP_GO_GRPC_GATEWAY_V2() {
  8024. SET(_GO_PROTO_GRPC_GATEWAY_V2_OPTS $_PROTO_PLUGIN_ARGS_BASE(go_grpc_gw vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway allow_repeated_fields_in_body=true))
  8025. SET(_GO_PROTO_GRPC_GATEWAY_V2_OUTS \${output;hide;norel;nopath;noext;suf=.pb.gw.go:File})
  8026. }
  8027. # tag:go-specific
  8028. macro _GO_GRPC_GATEWAY_V2_SRCS(Files...) {
  8029. _SETUP_GO_GRPC_GATEWAY_V2()
  8030. _GO_GRPC_GATEWAY_V2_SRCS_IMPL($Files)
  8031. }
  8032. # tag:go-specific
  8033. when ($MUSL == "yes") {
  8034. _GO_DEFAULT_ALLOCATOR=LF
  8035. }
  8036. otherwise {
  8037. _GO_DEFAULT_ALLOCATOR=FAKE
  8038. }
  8039. # tag:go-specific tag:internal
  8040. ### @usage _GO_BASE_UNIT # internal
  8041. ###
  8042. ### The base module of all golang modules. Defines common properties, dependencies and rules for go build.
  8043. module _GO_BASE_UNIT: _BASE_UNIT {
  8044. .EXTS=.go .gosrc .o .obj .a .symabis .mf
  8045. .CMD=TOUCH_UNIT
  8046. .NODE_TYPE=Bundle
  8047. .GLOBAL=GO_LDFLAGS
  8048. .PEERDIR_POLICY=as_build_from
  8049. .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 GO_GRPC_GATEWAY_V2_SRCS=_GO_GRPC_GATEWAY_V2_SRCS GO_GRPC_GATEWAY_V2_OPENAPI_SRCS=_GO_GRPC_GATEWAY_V2_OPENAPI_SRCS
  8050. .ALLOWED=GO_PROTO_PLUGIN USE_CXX USE_UTIL RESOURCE_FILES
  8051. .IGNORED=GO_SKIP_TESTS USE_SKIFF
  8052. .RESTRICTED=TEST_SRCS
  8053. .DEFAULT_NAME_GENERATOR=UseDirNameOrSetGoPackage
  8054. ENABLE(_GO_MODULE)
  8055. SET(MODULE_TAG GO)
  8056. SET(PEERDIR_TAGS GO GO_PROTO GO_FBS __EMPTY__)
  8057. DEFAULT(_GO_VET_TOOL)
  8058. DEFAULT(_GO_VET_FLAGS)
  8059. DEFAULT(_GO_VET_EXTS)
  8060. DEFAULT(_GO_SONAME)
  8061. NO_RUNTIME()
  8062. SET(COVERAGE_FLAGS)
  8063. SET(EXTRA_OUTPUT)
  8064. SET(MODULE_LANG GO)
  8065. ENABLE(FORCE_CONSISTENT_DEBUG)
  8066. PEERDIR(build/external_resources/go_tools)
  8067. GO_PROTO_GRPC_OPTS_V2=--plugin=protoc-gen-go-grpc=${tool:_TOOL_PROTOC_GEN_GO_GRPC_V2} --go-grpc_out=${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
  8068. GO_PROTO_GRPC_OUTS_V2=${output;norel;nopath;noext;suf=_grpc.pb.go:File}
  8069. select ($GO_PROTO_V2) {
  8070. "yes" | "on" ? {
  8071. GO_PROTO_OUTS+=${output;hide;norel;nopath;noext;suf=.pb.go:File}
  8072. GO_PROTO_OPTS+=--plugin=protoc-gen-go=${tool:_TOOL_PROTOC_GEN_GO_V2} --go_out=${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
  8073. _GO_PROTO_CHECK_OUTPUT=--check $GO_PROTO_GRPC_OUTS_V2
  8074. GO_PROTO_OPTS+=$GO_PROTO_GRPC_OPTS
  8075. }
  8076. default ? {
  8077. GO_PROTO_OUTS+=${output;hide;norel;nopath;noext;suf=.pb.go:File}
  8078. GO_PROTO_OPTS+=--plugin=protoc-gen-go=${tool:_TOOL_PROTOC_GEN_GO} --go_out=$GO_PROTO_GEN_PLUGINS:${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
  8079. }
  8080. }
  8081. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  8082. PEERDIR+=$COMPILER_PLATFORM
  8083. }
  8084. when ($CLANG == "yes" || $GCC == "yes") {
  8085. CGO_CFLAGS_VALUE += -w -pthread -fpic
  8086. CGO2_CFLAGS_VALUE += -Wno-unused-variable
  8087. }
  8088. select ($GO_VET) {
  8089. "yes" | "on" ? {
  8090. _GO_VET=yes
  8091. _GO_VET_FLAGS+=-cgocall=false
  8092. }
  8093. "yndexer" ? {
  8094. _GO_VET=yes
  8095. PEERDIR+=build/external_resources/goyndexer
  8096. _GO_VET_TOOL=${GOYNDEXER_RESOURCE_GLOBAL}/goyndexer
  8097. _GO_YDX_FILE=++ydx-file ${_GO_YNDEXER_EXT}
  8098. _GO_VET_FLAGS=-indexer.arc ${ARCADIA_ROOT} -indexer.indexfile ${GO_YNDEXER_OUTPUT} -indexer.loglevel info
  8099. _GO_FMT_ADD_CHECK=no
  8100. _GO_VET_ADD_CHECK=no
  8101. GO_VET_INFO_EXT=.ydx.out
  8102. GO_VET_REPORT_EXT=.ydx.txt
  8103. _GO_VET_EXTS=++vet-info-ext .ydx.out ++vet-report-ext .ydx.txt
  8104. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=__ARCADIA_BUILD_ROOT_PREFIX__ --source-prefix=__ARCADIA_SOURCE_ROOT_PREFIX__
  8105. }
  8106. "yolint" ? {
  8107. _GO_VET=yes
  8108. PEERDIR+=build/external_resources/yolint
  8109. _GO_VET_TOOL=${YOLINT_RESOURCE_GLOBAL}/yolint
  8110. _GO_VET_FLAGS=-migration.config=${input:"${ARCADIA_ROOT}/build/rules/go/migrations.yaml"} -scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
  8111. }
  8112. "local" ? {
  8113. _GO_VET=yes
  8114. _GO_VET_FLAGS=
  8115. }
  8116. default ? {
  8117. _GO_VET=no
  8118. _GO_VET_FLAGS=
  8119. }
  8120. }
  8121. SET(_GO_VET $_GO_VET)
  8122. when ($GO_VET_TOOL == "") {
  8123. _GO_VET_TOOL_REAL=$_GO_VET_TOOL
  8124. }
  8125. otherwise {
  8126. _GO_VET_TOOL_REAL=$GO_VET_TOOL
  8127. }
  8128. when ($GO_VET_FLAGS == "") {
  8129. _GO_VET_FLAGS_REAL=$_GO_VET_FLAGS
  8130. }
  8131. otherwise {
  8132. _GO_VET_FLAGS_REAL=$GO_VET_FLAGS
  8133. }
  8134. when ($_GO_VET == "yes" && $NO_GO_VET != "yes") {
  8135. 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
  8136. }
  8137. otherwise {
  8138. GO_VET_OUTPUT=
  8139. _GO_VET_ADD_CHECK=no
  8140. }
  8141. when ($GO_DEBUG_PATH_RELATIVE == "yes") {
  8142. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=;build=;tools= ++tools-root $(TOOL_ROOT)
  8143. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>;$ARCADIA_BUILD_ROOT=>;$(TOOL_ROOT)=>
  8144. }
  8145. otherwise {
  8146. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=/-S;build=/-B;tools=/-T ++tools-root $(TOOL_ROOT)
  8147. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>/-S;$ARCADIA_BUILD_ROOT=>/-B;$(TOOL_ROOT)=>/-T
  8148. }
  8149. _GO_PROCESS_SRCS()
  8150. when ($CLANG == "yes") {
  8151. _GO_EXTLD=clang
  8152. GO_TOOLCHAIN_ENV += ${env:"CC=clang"}
  8153. }
  8154. otherwise {
  8155. _GO_EXTLD=gcc
  8156. GO_TOOLCHAIN_ENV += ${env:"CC=gcc"}
  8157. }
  8158. when ($OS_DARWIN) {
  8159. PEERDIR+=build/external_resources/go_fake_xcrun
  8160. 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
  8161. CGO2_LDFLAGS_VALUE += $LD_SDK_VERSION -undefined dynamic_lookup -nodefaultlibs -lc
  8162. }
  8163. elsewhen ($OS_LINUX) {
  8164. 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
  8165. CGO2_LDFLAGS_VALUE += -Wl,--unresolved-symbols=ignore-all -nodefaultlibs -lc
  8166. }
  8167. otherwise {
  8168. GO_EXTLD = ++extld $_GO_EXTLD
  8169. }
  8170. when ($RACE == "yes") {
  8171. _GO_COMPILE_FLAGS_RACE=-race
  8172. _GO_LINK_FLAGS_RACE=-race
  8173. }
  8174. otherwise {
  8175. _GO_COMPILE_FLAGS_RACE=
  8176. _GO_LINK_FLAGS_RACE=
  8177. }
  8178. when ($PIC == "yes" || $PIE == "yes") {
  8179. _GO_COMPILE_FLAGS_SHARED=-shared
  8180. _GO_ASM_FLAGS_SHARED=-shared
  8181. }
  8182. otherwise {
  8183. _GO_COMPILE_FLAGS_SHARED=
  8184. _GO_ASM_FLAGS_SHARED=
  8185. }
  8186. GO_ASM_FLAGS_VALUE += $_GO_ASM_FLAGS_SHARED
  8187. GO_COMPILE_FLAGS_VALUE += $_GO_COMPILE_FLAGS_RACE $_GO_COMPILE_FLAGS_SHARED
  8188. GO_LINK_FLAGS_VALUE += $_GO_LINK_FLAGS_RACE
  8189. ADDINCL(${GOSTD}/runtime)
  8190. }
  8191. # tag:go-specific
  8192. ### @usage: GO_LIBRARY([name])
  8193. ###
  8194. ### Go library module definition.
  8195. ### Compile Go module as a library suitable for PEERDIR from other Go modules.
  8196. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  8197. module GO_LIBRARY: _GO_BASE_UNIT {
  8198. .CMD=GO_LINK_LIB
  8199. .NODE_TYPE=Bundle
  8200. .FINAL_TARGET=no
  8201. SET(_GO_TOOL_MODE lib)
  8202. SET(MODULE_TYPE LIBRARY)
  8203. SET(PEERDIR_TAGS GO GO_PROTO GO_FBS __EMPTY__ PACKAGE_UNION)
  8204. _REQUIRE_EXPLICIT_LICENSE(vendor)
  8205. MODULE_SUFFIX=.a
  8206. }
  8207. # tag:go-specific
  8208. ### @usage: GO_PROGRAM([name])
  8209. ###
  8210. ### Go program module definition.
  8211. ### Compile and link Go module to an executable program.
  8212. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  8213. module GO_PROGRAM: _GO_BASE_UNIT {
  8214. .CMD=GO_LINK_EXE
  8215. .NODE_TYPE=Program
  8216. .PROXY=yes
  8217. .SYMLINK_POLICY=EXE
  8218. .ALLOWED=INDUCED_DEPS
  8219. .FINAL_TARGET=yes
  8220. SET(MODULE_TAG GO_PROGRAM)
  8221. SET(_GO_TOOL_MODE exe)
  8222. SET(MODULE_TYPE PROGRAM)
  8223. SET(GO_VET_OUTPUT_INFO)
  8224. ALLOCATOR($_GO_DEFAULT_ALLOCATOR)
  8225. _USE_LINKER()
  8226. ENABLE(COMMON_LINK_SETTINGS)
  8227. when ($MUSL == "yes") {
  8228. PEERDIR += contrib/libs/musl/full
  8229. }
  8230. when ($RACE == "yes") {
  8231. PEERDIR += contrib/libs/cxxsupp/builtins
  8232. }
  8233. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8234. MODULE_SUFFIX=.exe
  8235. }
  8236. PEERDIR(${GOSTD}/runtime library/go/core/buildinfo)
  8237. when ($RACE == "yes") {
  8238. PEERDIR += ${GOSTD}/runtime/cgo
  8239. PEERDIR += ${GOSTD}/runtime/race
  8240. }
  8241. when ($MUSL == "yes") {
  8242. GO_WITH_MUSL = ++musl
  8243. }
  8244. when ($HARDENING == "yes") {
  8245. _GO_BUILDMODE=++buildmode=pie
  8246. }
  8247. }
  8248. # tag:go-specific
  8249. module _GO_DLL_BASE_UNIT: GO_PROGRAM {
  8250. .CMD=GO_LINK_DLL
  8251. .SYMLINK_POLICY=SO
  8252. .ALLOWED=WHOLE_ARCHIVE
  8253. .ARGS_PARSER=DLL
  8254. .NODE_TYPE=Library
  8255. .PROXY=yes
  8256. SET(_GO_TOOL_MODE dll)
  8257. SET(MODULE_TYPE DLL)
  8258. GO_PACKAGE_NAME(main)
  8259. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8260. MODULE_SUFFIX=.dll
  8261. }
  8262. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  8263. MODULE_PREFIX=lib
  8264. MODULE_SUFFIX=.dylib$MODULE_VERSION
  8265. }
  8266. otherwise {
  8267. MODULE_PREFIX=lib
  8268. MODULE_SUFFIX=.so$MODULE_VERSION
  8269. }
  8270. when ($OS_DARWIN) {
  8271. _GO_SONAME=-Wl,-install_name,$SONAME
  8272. }
  8273. elsewhen ($OS_LINUX) {
  8274. _GO_SONAME=-Wl,-soname,$SONAME
  8275. }
  8276. when ($MODULE_VERSION) {
  8277. when ($OS_LINUX || $OS_DARWIN) {
  8278. _GO_LINK_EXE_EXT_CMD+= && $LINK_OR_COPY_CMD $TARGET ${output;nopath;noext:SONAME}
  8279. }
  8280. }
  8281. }
  8282. # tag:go-specific
  8283. ### @usage: GO_DLL(name major_ver [minor_ver] [PREFIX prefix])
  8284. ###
  8285. ### Go ishared object module definition.
  8286. ### Compile and link Go module to a shared object.
  8287. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  8288. module GO_DLL: _GO_DLL_BASE_UNIT {
  8289. }
  8290. # tag:go-specific tag:test
  8291. ### @usage: GO_BENCH_TIMEOUT(x)
  8292. ###
  8293. ### Sets timeout in seconds for 1 Benchmark in go benchmark suite
  8294. ###
  8295. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  8296. macro GO_BENCH_TIMEOUT(bench_timeout) {
  8297. SET(GO_BENCH_TIMEOUT $bench_timeout)
  8298. }
  8299. # tag:go-specific tag:test
  8300. ### @usage: GO_TEST([name])
  8301. ###
  8302. ### Go test module definition.
  8303. ### Compile and link Go module as a test suitable for running with Arcadia testing support.
  8304. ### All usual testing support macros like DATA, DEPENDS, SIZE, REQUIREMENTS etc. are supported.
  8305. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  8306. module GO_TEST: GO_PROGRAM {
  8307. .CMD=GO_LINK_TEST
  8308. .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
  8309. .ALLOWED=GO_SKIP_TESTS YT_SPEC
  8310. .FINAL_TARGET=no
  8311. SET(MODULE_TAG GO_TEST)
  8312. SET(PEERDIR_TAGS GO GO_PROGRAM GO_PROTO GO_FBS __EMPTY__)
  8313. SET(_GO_TOOL_MODE test)
  8314. SET(MODULE_TYPE PROGRAM)
  8315. ENABLE(GO_TEST_MODULE)
  8316. SET(GO_COVER_INFO_VALUE)
  8317. # We have to add uncoditionaly PEERDIR to ${GOSTD}/os here thouth it is really
  8318. # needed when TestMain is defined in the source code of the test
  8319. PEERDIR(${GOSTD}/os)
  8320. PEERDIR(${GOSTD}/testing/internal/testdeps)
  8321. PEERDIR(${GOSTD}/testing)
  8322. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.test)
  8323. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.bench)
  8324. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  8325. }
  8326. # tag:go-specific
  8327. macro GO_MOCKGEN_FROM(Path) {
  8328. SET(MOCKGEN_FROM ${Path})
  8329. }
  8330. # tag:go-specific
  8331. macro GO_MOCKGEN_TYPES(Types...) {
  8332. SET(MOCKGEN_TYPES ${join=\\${__COMMA__}:Types})
  8333. }
  8334. # tag:go-specific
  8335. macro GO_MOCKGEN_REFLECT() {
  8336. PEERDIR(${GOSTD}/encoding/gob)
  8337. PEERDIR(${GOSTD}/flag)
  8338. PEERDIR(${GOSTD}/fmt)
  8339. PEERDIR(${GOSTD}/os)
  8340. PEERDIR(${GOSTD}/path)
  8341. PEERDIR(${GOSTD}/reflect)
  8342. PEERDIR(vendor/github.com/golang/mock/mockgen/model)
  8343. PEERDIR(${MOCKGEN_FROM})
  8344. RUN_PROGRAM(vendor/github.com/golang/mock/mockgen -prog_only a.yandex-team.ru/${MOCKGEN_FROM} $MOCKGEN_TYPES STDOUT main.go)
  8345. }
  8346. # tag:internal
  8347. macro _TOOL(TOOL) {
  8348. .CMD=${tool:TOOL}
  8349. }
  8350. # tag:go-specific
  8351. macro GO_MOCKGEN_MOCKS() {
  8352. PEERDIR(${GOSTD}/reflect)
  8353. PEERDIR(vendor/github.com/golang/mock/gomock)
  8354. .CMD=${tool:"vendor/github.com/golang/mock/mockgen"} -package mocks -exec_only $_TOOL($MODDIR/gen) a.yandex-team.ru/${MOCKGEN_FROM} $MOCKGEN_TYPES ${output;stdout:"main.go"}
  8355. }
  8356. # Conflict between protobuf-java and protobuf-javalite ¯\_(ツ)_/¯
  8357. # both libraries are required by grpc
  8358. JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE=\
  8359. com.google.protobuf.AbstractMessageLite \
  8360. com.google.protobuf.AbstractMessageLite$Builder \
  8361. com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream \
  8362. com.google.protobuf.AbstractMessageLite$InternalOneOfEnum \
  8363. com.google.protobuf.AbstractParser \
  8364. com.google.protobuf.AbstractProtobufList \
  8365. com.google.protobuf.AllocatedBuffer \
  8366. com.google.protobuf.AllocatedBuffer$1 \
  8367. com.google.protobuf.AllocatedBuffer$2 \
  8368. com.google.protobuf.Android \
  8369. com.google.protobuf.Any \
  8370. com.google.protobuf.Any$1 \
  8371. com.google.protobuf.Any$Builder \
  8372. com.google.protobuf.AnyOrBuilder \
  8373. com.google.protobuf.AnyProto \
  8374. com.google.protobuf.Api \
  8375. com.google.protobuf.Api$1 \
  8376. com.google.protobuf.Api$Builder \
  8377. com.google.protobuf.ApiOrBuilder \
  8378. com.google.protobuf.ApiProto \
  8379. com.google.protobuf.ArrayDecoders \
  8380. com.google.protobuf.ArrayDecoders$1 \
  8381. com.google.protobuf.ArrayDecoders$Registers \
  8382. com.google.protobuf.BinaryReader \
  8383. com.google.protobuf.BinaryReader$1 \
  8384. com.google.protobuf.BinaryReader$SafeHeapReader \
  8385. com.google.protobuf.BinaryWriter \
  8386. com.google.protobuf.BinaryWriter$1 \
  8387. com.google.protobuf.BinaryWriter$SafeDirectWriter \
  8388. com.google.protobuf.BinaryWriter$SafeHeapWriter \
  8389. com.google.protobuf.BinaryWriter$UnsafeDirectWriter \
  8390. com.google.protobuf.BinaryWriter$UnsafeHeapWriter \
  8391. com.google.protobuf.BooleanArrayList \
  8392. com.google.protobuf.BoolValue \
  8393. com.google.protobuf.BoolValue$1 \
  8394. com.google.protobuf.BoolValue$Builder \
  8395. com.google.protobuf.BoolValueOrBuilder \
  8396. com.google.protobuf.BufferAllocator \
  8397. com.google.protobuf.BufferAllocator$1 \
  8398. com.google.protobuf.ByteBufferWriter \
  8399. com.google.protobuf.ByteOutput \
  8400. com.google.protobuf.ByteString \
  8401. com.google.protobuf.ByteString$1 \
  8402. com.google.protobuf.ByteString$2 \
  8403. com.google.protobuf.ByteString$AbstractByteIterator \
  8404. com.google.protobuf.ByteString$ArraysByteArrayCopier \
  8405. com.google.protobuf.ByteString$BoundedByteString \
  8406. com.google.protobuf.ByteString$ByteArrayCopier \
  8407. com.google.protobuf.ByteString$ByteIterator \
  8408. com.google.protobuf.ByteString$CodedBuilder \
  8409. com.google.protobuf.ByteString$LeafByteString \
  8410. com.google.protobuf.ByteString$LiteralByteString \
  8411. com.google.protobuf.ByteString$Output \
  8412. com.google.protobuf.ByteString$SystemByteArrayCopier \
  8413. com.google.protobuf.BytesValue \
  8414. com.google.protobuf.BytesValue$1 \
  8415. com.google.protobuf.BytesValue$Builder \
  8416. com.google.protobuf.BytesValueOrBuilder \
  8417. com.google.protobuf.CanIgnoreReturnValue \
  8418. com.google.protobuf.CheckReturnValue \
  8419. com.google.protobuf.CodedInputStream \
  8420. com.google.protobuf.CodedInputStream$1 \
  8421. com.google.protobuf.CodedInputStream$ArrayDecoder \
  8422. com.google.protobuf.CodedInputStream$IterableDirectByteBufferDecoder \
  8423. com.google.protobuf.CodedInputStream$StreamDecoder \
  8424. com.google.protobuf.CodedInputStream$StreamDecoder$RefillCallback \
  8425. com.google.protobuf.CodedInputStream$StreamDecoder$SkippedDataSink \
  8426. com.google.protobuf.CodedInputStream$UnsafeDirectNioDecoder \
  8427. com.google.protobuf.CodedInputStreamReader \
  8428. com.google.protobuf.CodedInputStreamReader$1 \
  8429. com.google.protobuf.CodedOutputStream \
  8430. com.google.protobuf.CodedOutputStream$1 \
  8431. com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder \
  8432. com.google.protobuf.CodedOutputStream$ArrayEncoder \
  8433. com.google.protobuf.CodedOutputStream$ByteOutputEncoder \
  8434. com.google.protobuf.CodedOutputStream$HeapNioEncoder \
  8435. com.google.protobuf.CodedOutputStream$OutOfSpaceException \
  8436. com.google.protobuf.CodedOutputStream$OutputStreamEncoder \
  8437. com.google.protobuf.CodedOutputStream$SafeDirectNioEncoder \
  8438. com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder \
  8439. com.google.protobuf.CodedOutputStreamWriter \
  8440. com.google.protobuf.CodedOutputStreamWriter$1 \
  8441. com.google.protobuf.DoubleArrayList \
  8442. com.google.protobuf.DoubleValue \
  8443. com.google.protobuf.DoubleValue$1 \
  8444. com.google.protobuf.DoubleValue$Builder \
  8445. com.google.protobuf.DoubleValueOrBuilder \
  8446. com.google.protobuf.Duration \
  8447. com.google.protobuf.Duration$1 \
  8448. com.google.protobuf.Duration$Builder \
  8449. com.google.protobuf.DurationOrBuilder \
  8450. com.google.protobuf.DurationProto \
  8451. com.google.protobuf.Empty \
  8452. com.google.protobuf.Empty$1 \
  8453. com.google.protobuf.Empty$Builder \
  8454. com.google.protobuf.EmptyOrBuilder \
  8455. com.google.protobuf.EmptyProto \
  8456. com.google.protobuf.Enum \
  8457. com.google.protobuf.Enum$1 \
  8458. com.google.protobuf.Enum$Builder \
  8459. com.google.protobuf.EnumOrBuilder \
  8460. com.google.protobuf.EnumValue \
  8461. com.google.protobuf.EnumValue$1 \
  8462. com.google.protobuf.EnumValue$Builder \
  8463. com.google.protobuf.EnumValueOrBuilder \
  8464. com.google.protobuf.ExperimentalApi \
  8465. com.google.protobuf.ExtensionLite \
  8466. com.google.protobuf.ExtensionRegistryFactory \
  8467. com.google.protobuf.ExtensionRegistryLite \
  8468. com.google.protobuf.ExtensionRegistryLite$ExtensionClassHolder \
  8469. com.google.protobuf.ExtensionRegistryLite$ObjectIntPair \
  8470. com.google.protobuf.ExtensionSchema \
  8471. com.google.protobuf.ExtensionSchemaLite \
  8472. com.google.protobuf.ExtensionSchemaLite$1 \
  8473. com.google.protobuf.ExtensionSchemas \
  8474. com.google.protobuf.Field \
  8475. com.google.protobuf.Field$1 \
  8476. com.google.protobuf.Field$Builder \
  8477. com.google.protobuf.Field$Cardinality \
  8478. com.google.protobuf.Field$Cardinality$1 \
  8479. com.google.protobuf.Field$Kind \
  8480. com.google.protobuf.Field$Kind$1 \
  8481. com.google.protobuf.FieldInfo \
  8482. com.google.protobuf.FieldInfo$1 \
  8483. com.google.protobuf.FieldInfo$Builder \
  8484. com.google.protobuf.FieldMask \
  8485. com.google.protobuf.FieldMask$1 \
  8486. com.google.protobuf.FieldMask$Builder \
  8487. com.google.protobuf.FieldMaskOrBuilder \
  8488. com.google.protobuf.FieldMaskProto \
  8489. com.google.protobuf.FieldOrBuilder \
  8490. com.google.protobuf.FieldSet \
  8491. com.google.protobuf.FieldSet$1 \
  8492. com.google.protobuf.FieldSet$Builder \
  8493. com.google.protobuf.FieldSet$FieldDescriptorLite \
  8494. com.google.protobuf.FieldType \
  8495. com.google.protobuf.FieldType$1 \
  8496. com.google.protobuf.FieldType$Collection \
  8497. com.google.protobuf.FloatArrayList \
  8498. com.google.protobuf.FloatValue \
  8499. com.google.protobuf.FloatValue$1 \
  8500. com.google.protobuf.FloatValue$Builder \
  8501. com.google.protobuf.FloatValueOrBuilder \
  8502. com.google.protobuf.GeneratedMessageInfoFactory \
  8503. com.google.protobuf.GeneratedMessageLite \
  8504. com.google.protobuf.GeneratedMessageLite$1 \
  8505. com.google.protobuf.GeneratedMessageLite$Builder \
  8506. com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser \
  8507. com.google.protobuf.GeneratedMessageLite$ExtendableBuilder \
  8508. com.google.protobuf.GeneratedMessageLite$ExtendableMessage \
  8509. com.google.protobuf.GeneratedMessageLite$ExtendableMessage$ExtensionWriter \
  8510. com.google.protobuf.GeneratedMessageLite$ExtendableMessageOrBuilder \
  8511. com.google.protobuf.GeneratedMessageLite$ExtensionDescriptor \
  8512. com.google.protobuf.GeneratedMessageLite$GeneratedExtension \
  8513. com.google.protobuf.GeneratedMessageLite$MethodToInvoke \
  8514. com.google.protobuf.GeneratedMessageLite$SerializedForm \
  8515. com.google.protobuf.Int32Value \
  8516. com.google.protobuf.Int32Value$1 \
  8517. com.google.protobuf.Int32Value$Builder \
  8518. com.google.protobuf.Int32ValueOrBuilder \
  8519. com.google.protobuf.Int64Value \
  8520. com.google.protobuf.Int64Value$1 \
  8521. com.google.protobuf.Int64Value$Builder \
  8522. com.google.protobuf.Int64ValueOrBuilder \
  8523. com.google.protobuf.IntArrayList \
  8524. com.google.protobuf.Internal \
  8525. com.google.protobuf.Internal$BooleanList \
  8526. com.google.protobuf.Internal$DoubleList \
  8527. com.google.protobuf.Internal$EnumLite \
  8528. com.google.protobuf.Internal$EnumLiteMap \
  8529. com.google.protobuf.Internal$EnumVerifier \
  8530. com.google.protobuf.Internal$FloatList \
  8531. com.google.protobuf.Internal$IntList \
  8532. com.google.protobuf.Internal$ListAdapter \
  8533. com.google.protobuf.Internal$ListAdapter$Converter \
  8534. com.google.protobuf.Internal$LongList \
  8535. com.google.protobuf.Internal$MapAdapter \
  8536. com.google.protobuf.Internal$MapAdapter$1 \
  8537. com.google.protobuf.Internal$MapAdapter$Converter \
  8538. com.google.protobuf.Internal$MapAdapter$EntryAdapter \
  8539. com.google.protobuf.Internal$MapAdapter$IteratorAdapter \
  8540. com.google.protobuf.Internal$MapAdapter$SetAdapter \
  8541. com.google.protobuf.Internal$ProtobufList \
  8542. com.google.protobuf.InvalidProtocolBufferException \
  8543. com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException \
  8544. com.google.protobuf.IterableByteBufferInputStream \
  8545. com.google.protobuf.JavaType \
  8546. com.google.protobuf.LazyField \
  8547. com.google.protobuf.LazyField$1 \
  8548. com.google.protobuf.LazyField$LazyEntry \
  8549. com.google.protobuf.LazyField$LazyIterator \
  8550. com.google.protobuf.LazyFieldLite \
  8551. com.google.protobuf.LazyStringArrayList \
  8552. com.google.protobuf.LazyStringArrayList$ByteArrayListView \
  8553. com.google.protobuf.LazyStringArrayList$ByteStringListView \
  8554. com.google.protobuf.LazyStringList \
  8555. com.google.protobuf.ListFieldSchema \
  8556. com.google.protobuf.ListFieldSchema$1 \
  8557. com.google.protobuf.ListFieldSchema$ListFieldSchemaFull \
  8558. com.google.protobuf.ListFieldSchema$ListFieldSchemaLite \
  8559. com.google.protobuf.ListValue \
  8560. com.google.protobuf.ListValue$1 \
  8561. com.google.protobuf.ListValue$Builder \
  8562. com.google.protobuf.ListValueOrBuilder \
  8563. com.google.protobuf.LongArrayList \
  8564. com.google.protobuf.ManifestSchemaFactory \
  8565. com.google.protobuf.ManifestSchemaFactory$1 \
  8566. com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory \
  8567. com.google.protobuf.MapEntryLite \
  8568. com.google.protobuf.MapEntryLite$1 \
  8569. com.google.protobuf.MapEntryLite$Metadata \
  8570. com.google.protobuf.MapFieldLite \
  8571. com.google.protobuf.MapFieldSchema \
  8572. com.google.protobuf.MapFieldSchemaLite \
  8573. com.google.protobuf.MapFieldSchemas \
  8574. com.google.protobuf.MessageInfo \
  8575. com.google.protobuf.MessageInfoFactory \
  8576. com.google.protobuf.MessageLite \
  8577. com.google.protobuf.MessageLite$Builder \
  8578. com.google.protobuf.MessageLiteOrBuilder \
  8579. com.google.protobuf.MessageLiteToString \
  8580. com.google.protobuf.MessageSchema \
  8581. com.google.protobuf.MessageSchema$1 \
  8582. com.google.protobuf.MessageSetSchema \
  8583. com.google.protobuf.Method \
  8584. com.google.protobuf.Method$1 \
  8585. com.google.protobuf.Method$Builder \
  8586. com.google.protobuf.MethodOrBuilder \
  8587. com.google.protobuf.Mixin \
  8588. com.google.protobuf.Mixin$1 \
  8589. com.google.protobuf.Mixin$Builder \
  8590. com.google.protobuf.MixinOrBuilder \
  8591. com.google.protobuf.MutabilityOracle \
  8592. com.google.protobuf.MutabilityOracle$1 \
  8593. com.google.protobuf.NewInstanceSchema \
  8594. com.google.protobuf.NewInstanceSchemaLite \
  8595. com.google.protobuf.NewInstanceSchemas \
  8596. com.google.protobuf.NioByteString \
  8597. com.google.protobuf.NioByteString$1 \
  8598. com.google.protobuf.NullValue \
  8599. com.google.protobuf.NullValue$1 \
  8600. com.google.protobuf.OneofInfo \
  8601. com.google.protobuf.Option \
  8602. com.google.protobuf.Option$1 \
  8603. com.google.protobuf.Option$Builder \
  8604. com.google.protobuf.OptionOrBuilder \
  8605. com.google.protobuf.Parser \
  8606. com.google.protobuf.PrimitiveNonBoxingCollection \
  8607. com.google.protobuf.Protobuf \
  8608. com.google.protobuf.ProtobufArrayList \
  8609. com.google.protobuf.ProtobufLists \
  8610. com.google.protobuf.ProtocolStringList \
  8611. com.google.protobuf.ProtoSyntax \
  8612. com.google.protobuf.RawMessageInfo \
  8613. com.google.protobuf.Reader \
  8614. com.google.protobuf.RopeByteString \
  8615. com.google.protobuf.RopeByteString$1 \
  8616. com.google.protobuf.RopeByteString$Balancer \
  8617. com.google.protobuf.RopeByteString$PieceIterator \
  8618. com.google.protobuf.RopeByteString$RopeInputStream \
  8619. com.google.protobuf.Schema \
  8620. com.google.protobuf.SchemaFactory \
  8621. com.google.protobuf.SchemaUtil \
  8622. com.google.protobuf.SmallSortedMap \
  8623. com.google.protobuf.SmallSortedMap$1 \
  8624. com.google.protobuf.SmallSortedMap$DescendingEntryIterator \
  8625. com.google.protobuf.SmallSortedMap$DescendingEntrySet \
  8626. com.google.protobuf.SmallSortedMap$EmptySet \
  8627. com.google.protobuf.SmallSortedMap$EmptySet$1 \
  8628. com.google.protobuf.SmallSortedMap$EmptySet$2 \
  8629. com.google.protobuf.SmallSortedMap$Entry \
  8630. com.google.protobuf.SmallSortedMap$EntryIterator \
  8631. com.google.protobuf.SmallSortedMap$EntrySet \
  8632. com.google.protobuf.SourceContext \
  8633. com.google.protobuf.SourceContext$1 \
  8634. com.google.protobuf.SourceContext$Builder \
  8635. com.google.protobuf.SourceContextOrBuilder \
  8636. com.google.protobuf.SourceContextProto \
  8637. com.google.protobuf.StringValue \
  8638. com.google.protobuf.StringValue$1 \
  8639. com.google.protobuf.StringValue$Builder \
  8640. com.google.protobuf.StringValueOrBuilder \
  8641. com.google.protobuf.Struct \
  8642. com.google.protobuf.Struct$1 \
  8643. com.google.protobuf.Struct$Builder \
  8644. com.google.protobuf.Struct$FieldsDefaultEntryHolder \
  8645. com.google.protobuf.StructOrBuilder \
  8646. com.google.protobuf.StructProto \
  8647. com.google.protobuf.StructuralMessageInfo \
  8648. com.google.protobuf.StructuralMessageInfo$Builder \
  8649. com.google.protobuf.Syntax \
  8650. com.google.protobuf.Syntax$1 \
  8651. com.google.protobuf.TextFormatEscaper \
  8652. com.google.protobuf.TextFormatEscaper$1 \
  8653. com.google.protobuf.TextFormatEscaper$2 \
  8654. com.google.protobuf.TextFormatEscaper$ByteSequence \
  8655. com.google.protobuf.Timestamp \
  8656. com.google.protobuf.Timestamp$1 \
  8657. com.google.protobuf.Timestamp$Builder \
  8658. com.google.protobuf.TimestampOrBuilder \
  8659. com.google.protobuf.TimestampProto \
  8660. com.google.protobuf.Type \
  8661. com.google.protobuf.Type$1 \
  8662. com.google.protobuf.Type$Builder \
  8663. com.google.protobuf.TypeOrBuilder \
  8664. com.google.protobuf.TypeProto \
  8665. com.google.protobuf.UInt32Value \
  8666. com.google.protobuf.UInt32Value$1 \
  8667. com.google.protobuf.UInt32Value$Builder \
  8668. com.google.protobuf.UInt32ValueOrBuilder \
  8669. com.google.protobuf.UInt64Value \
  8670. com.google.protobuf.UInt64Value$1 \
  8671. com.google.protobuf.UInt64Value$Builder \
  8672. com.google.protobuf.UInt64ValueOrBuilder \
  8673. com.google.protobuf.UninitializedMessageException \
  8674. com.google.protobuf.UnknownFieldSchema \
  8675. com.google.protobuf.UnknownFieldSetLite \
  8676. com.google.protobuf.UnknownFieldSetLiteSchema \
  8677. com.google.protobuf.UnmodifiableLazyStringList \
  8678. com.google.protobuf.UnmodifiableLazyStringList$1 \
  8679. com.google.protobuf.UnmodifiableLazyStringList$2 \
  8680. com.google.protobuf.UnsafeByteOperations \
  8681. com.google.protobuf.UnsafeUtil \
  8682. com.google.protobuf.UnsafeUtil$1 \
  8683. com.google.protobuf.UnsafeUtil$Android32MemoryAccessor \
  8684. com.google.protobuf.UnsafeUtil$Android64MemoryAccessor \
  8685. com.google.protobuf.UnsafeUtil$JvmMemoryAccessor \
  8686. com.google.protobuf.UnsafeUtil$MemoryAccessor \
  8687. com.google.protobuf.Utf8 \
  8688. com.google.protobuf.Utf8$DecodeUtil \
  8689. com.google.protobuf.Utf8$Processor \
  8690. com.google.protobuf.Utf8$SafeProcessor \
  8691. com.google.protobuf.Utf8$UnpairedSurrogateException \
  8692. com.google.protobuf.Utf8$UnsafeProcessor \
  8693. com.google.protobuf.Value \
  8694. com.google.protobuf.Value$1 \
  8695. com.google.protobuf.Value$Builder \
  8696. com.google.protobuf.Value$KindCase \
  8697. com.google.protobuf.ValueOrBuilder \
  8698. com.google.protobuf.WireFormat \
  8699. com.google.protobuf.WireFormat$1 \
  8700. com.google.protobuf.WireFormat$FieldType \
  8701. com.google.protobuf.WireFormat$FieldType$1 \
  8702. com.google.protobuf.WireFormat$FieldType$2 \
  8703. com.google.protobuf.WireFormat$FieldType$3 \
  8704. com.google.protobuf.WireFormat$FieldType$4 \
  8705. com.google.protobuf.WireFormat$JavaType \
  8706. com.google.protobuf.WireFormat$Utf8Validation \
  8707. com.google.protobuf.WireFormat$Utf8Validation$1 \
  8708. com.google.protobuf.WireFormat$Utf8Validation$2 \
  8709. com.google.protobuf.WireFormat$Utf8Validation$3 \
  8710. com.google.protobuf.WrappersProto \
  8711. com.google.protobuf.Writer \
  8712. com.google.protobuf.Writer$FieldOrder
  8713. # tag:java-specific
  8714. JAVA_IGNORE_CLASSPATH_CLASH_VALUE=$JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE
  8715. ### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
  8716. ### Ignore classpath clash test fails for classes
  8717. macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
  8718. SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args $JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE)
  8719. }
  8720. # tag:python-specific
  8721. ### @usage: PY_SRCS({| CYTHON_C} { | TOP_LEVEL | NAMESPACE ns} Files...)
  8722. ###
  8723. ### Build specified Python sources according to Arcadia binary Python build. Basically creates precompiled and source resources keyed with module paths.
  8724. ### The resources eventually are linked into final program and can be accessed as regular Python modules.
  8725. ### This custom loader linked into the program will add them to sys.meta_path.
  8726. ###
  8727. ### 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.
  8728. ### .pyx and .swg lead to C/C++ Python extensions generation, that are automatically registered in Python as built-in modules.
  8729. ###
  8730. ### 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).
  8731. ###
  8732. ### __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.
  8733. ###
  8734. ### @example
  8735. ###
  8736. ### PY2_LIBRARY(mymodule)
  8737. ### 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)
  8738. ### END()
  8739. ###
  8740. ### PY_SRCS honors Python2 and Python3 differences and adjusts itself to Python version of a current module.
  8741. ### PY_SRCS can be used in any Arcadia Python build modules like PY*_LIBRARY, PY*_PROGRAM, PY*TEST.
  8742. ### PY_SRCS in LIBRARY or PROGRAM effectively converts these into PY2_LIBRARY and PY2_PROGRAM respectively.
  8743. ### 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.
  8744. ###
  8745. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs/#modulipylibrarypy3libraryimakrospysrcs
  8746. macro PY_SRCS() {
  8747. DEFAULT(MODULE_TAG PY2)
  8748. DEFAULT(PYTHON2 yes)
  8749. DEFAULT(PYTHON3 no)
  8750. }
  8751. # tag:python-specific
  8752. _ALL_PY_FILES=
  8753. # tag:python-specific
  8754. macro _ALL_PY_SRCS2(TOP_LEVEL?"TOP_LEVEL":"", RECURSIVE?"/**":"", ONLY_TEST_FILES?"test_*.py":"*.py", ONLY_TEST_FILES2?"*_test.py":"***", NO_TEST_FILES?"**/test_*.py **/*_test.py":"", NAMESPACE[], REST[], REST2[], EAT_TAIL[]) {
  8755. _GLOB(_ALL_PY_FILES ${suf=${RECURSIVE}/${ONLY_TEST_FILES}:REST} ${suf=${RECURSIVE}/${ONLY_TEST_FILES2}:REST2} ${suf=${RECURSIVE}/ya.make:REST} EXCLUDE ya.make ${NO_TEST_FILES})
  8756. }
  8757. # tag:python-specific
  8758. ### @usage: ALL_PY_SRCS([RECURSIVE] [NO_TEST_FILES] { | TOP_LEVEL | NAMESPACE ns} [Dirs...])
  8759. ###
  8760. ### Puts all .py-files from given Dirs (relative to projects') into PY_SRCS of the current module.
  8761. ### If Dirs is ommitted project directory is used
  8762. ###
  8763. ### `RECURSIVE` makes lookup recursive with resprect to Dirs
  8764. ### `NO_TEST_FILES` excludes files `test_*.py` and `*_test.py` those are normally subject to `TEST_SRCS`
  8765. ### `TOP_LEVEL` and `NAMESPACE` are forwarded to `PY_SRCS`
  8766. ###
  8767. ### Note: Only one such macro per module is allowed
  8768. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  8769. ###
  8770. ### @see [PY_SRCS()](#macro_PY_SRCS)
  8771. macro ALL_PY_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", NO_TEST_FILES?"NO_TEST_FILES":"", Files...) {
  8772. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} ${NO_TEST_FILES} REST .${pre=/:Files})
  8773. PY_SRCS(_MR ${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} $_ALL_PY_FILES)
  8774. }
  8775. # tag:python-specific
  8776. ### @usage: ALL_PYTEST_SRCS([RECURSIVE] [Dirs...])
  8777. ###
  8778. ### Puts all .py-files from given Dirs (relative to projects') into TEST_SRCS of the current module.
  8779. ### If Dirs is omitted project directory is used
  8780. ###
  8781. ### `RECURSIVE` makes lookup recursive with respect to Dirs
  8782. ### `ONLY_TEST_FILES` includes only files `test_*.py` and `*_test.py`, others are normally subject to `PY_SRCS`
  8783. ###
  8784. ### Note: Only one such macro per module is allowed
  8785. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  8786. ###
  8787. ### @see [TEST_SRCS()](#macro_TEST_SRCS)
  8788. macro ALL_PYTEST_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", ONLY_TEST_FILES?"ONLY_TEST_FILES ONLY_TEST_FILES2 REST2":"EAT_TAIL", Files...) {
  8789. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files} ${ONLY_TEST_FILES} .${pre=/:Files})
  8790. TEST_SRCS(_MR $_ALL_PY_FILES)
  8791. }
  8792. # tag:python-specific
  8793. _PY_EXTRA_LINT_FILES_VALUE=
  8794. ### @usage: PY_EXTRA_LINT_FILES(files...)
  8795. ###
  8796. ### Add extra Python files for linting. This macro allows adding
  8797. ### Python files which has no .py extension.
  8798. macro PY_EXTRA_LINT_FILES(FILES...) {
  8799. SET_APPEND(_PY_EXTRA_LINT_FILES_VALUE $FILES)
  8800. }
  8801. # tag:python-specific
  8802. ### @usage: PY23_LIBRARY([name])
  8803. ###
  8804. ### Build PY2_LIBRARY or PY3_LIBRARY depending on incoming PEERDIR.
  8805. ### Direct build or build by RECURSE creates both variants.
  8806. ### This multimodule doesn't define any final targets, so use from DEPENDS or BUNDLE is not allowed.
  8807. ###
  8808. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs
  8809. multimodule PY23_LIBRARY {
  8810. module PY2: PY2_LIBRARY {
  8811. .RESTRICTED=RUN_ANTLR4_PYTHON
  8812. OBJ_SUF=.py2
  8813. }
  8814. module PY3: PY3_LIBRARY {
  8815. .RESTRICTED=RUN_ANTLR4_PYTHON
  8816. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  8817. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8818. MODULE_PREFIX=py3
  8819. }
  8820. otherwise {
  8821. MODULE_PREFIX=libpy3
  8822. }
  8823. OBJ_SUF=.py3
  8824. }
  8825. }
  8826. # tag:python-specific
  8827. ### @usage: PY23_NATIVE_LIBRARY([name])
  8828. ###
  8829. ### Build LIBRARY compatible with either Python 2.x or Python 3.x depending on incoming PEERDIR.
  8830. ###
  8831. ### 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.
  8832. ### Use these multimodule instead of PY23_LIBRARY if the C++ extension defined in it will be used in PY2MODULE.
  8833. ### 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.
  8834. ### Proper version will be selected according to Python version of the module PEERDIR comes from.
  8835. ###
  8836. ### This mulrtimodule doesn't define any final targets so cannot be used from DEPENDS or BUNDLE macros.
  8837. ###
  8838. ### For more information read https://wiki.yandex-team.ru/arcadia/python/pysrcs/#pysrcssrcsipy23nativelibrary
  8839. ###
  8840. ### @see [LIBRARY()](#module_LIBRARY), [PY2MODULE()](#module_PY2MODULE)
  8841. multimodule PY23_NATIVE_LIBRARY {
  8842. module PY2: LIBRARY {
  8843. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 PYTHON3_ADDINCL RUN_ANTLR4_PYTHON
  8844. OBJ_SUF=.py2
  8845. PYTHON2_ADDINCL()
  8846. SET(MODULE_LANG PY2)
  8847. }
  8848. module PY3: LIBRARY {
  8849. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 RUN_ANTLR4_PYTHON
  8850. .ALIASES=PYTHON2_ADDINCL=PYTHON3_ADDINCL
  8851. .SEM=CPP_LIBRARY_SEM
  8852. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  8853. PYTHON3_ADDINCL()
  8854. SET(MODULE_LANG PY3)
  8855. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8856. MODULE_PREFIX=py3c
  8857. }
  8858. otherwise {
  8859. MODULE_PREFIX=libpy3c
  8860. }
  8861. OBJ_SUF=.py3
  8862. }
  8863. }
  8864. IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  8865. # tag:src-processing
  8866. STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
  8867. macro _SRC("storyboard", SRC, SRCFLAGS...) {
  8868. .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}
  8869. }
  8870. # tag:src-processing
  8871. macro _SRC("xib", SRC, SRCFLAGS...) {
  8872. .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}
  8873. }
  8874. ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  8875. # tag:ios-specific
  8876. ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
  8877. macro _IOS_ASSETS(AssetsDir, Content...) {
  8878. .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
  8879. }
  8880. # tag:ios-specific
  8881. macro IOS_APP_COMMON_FLAGS(Flags...) {
  8882. SET_APPEND(STORYBOARD_FLAGS $Flags)
  8883. SET_APPEND(ASSETS_FLAGS $Flags)
  8884. }
  8885. # tag:ios-specific
  8886. macro IOS_APP_ASSETS_FLAGS(Flags...) {
  8887. SET_APPEND(ASSETS_FLAGS $Flags)
  8888. }
  8889. macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
  8890. .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
  8891. }
  8892. macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
  8893. .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
  8894. }
  8895. # tag:ios-specific
  8896. DELIM=__DELIM__
  8897. 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
  8898. ### @usage: IOS_INTERFACE()
  8899. ### iOS GUI module definition
  8900. module IOS_INTERFACE: _BARE_UNIT {
  8901. .CMD=PACK_IOS_ARCHIVE
  8902. .EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
  8903. .NODE_TYPE=Library
  8904. .FINAL_TARGET=no
  8905. SET(MODULE_SUFFIX .ios.interface)
  8906. PEERDIR+=build/platform/xcode/tools
  8907. }
  8908. # tag:ios-specific
  8909. module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
  8910. SET(MODULE_SUFFIX .default.ios.interface)
  8911. }
  8912. DEFAULT_IOS_TYPE=
  8913. IOS_TYPE=
  8914. when(!$IOS_TYPE) {
  8915. when($DEFAULT_IOS_TYPE) {
  8916. IOS_TYPE=$DEFAULT_IOS_TYPE
  8917. }
  8918. otherwise {
  8919. IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
  8920. }
  8921. }
  8922. DEFAULT_IOS_RUNTIME=
  8923. IOS_RUNTIME=
  8924. when(!$IOS_RUNTIME) {
  8925. when($DEFAULT_IOS_RUNTIME) {
  8926. IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
  8927. }
  8928. otherwise {
  8929. IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
  8930. }
  8931. }
  8932. when ($ARCH_I386) {
  8933. TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
  8934. TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
  8935. }
  8936. otherwise {
  8937. TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
  8938. TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
  8939. }
  8940. # tag:java-specific
  8941. ### @usage: JDK_VERSION(Version)
  8942. ###
  8943. ### Specify JDK version for module
  8944. macro JDK_VERSION(Arg) {
  8945. .SEM=required_jdk $Arg ${output;hide:"JdkVersionFakeProp.java"}
  8946. SET(JDK_REAL_VERSION $Arg)
  8947. _JDK_VERSION_MACRO_CHECK($Arg)
  8948. }
  8949. # tag:java-specific
  8950. when ($JDK_REAL_VERSION == "10") {
  8951. JDK10=yes # remove this later
  8952. }
  8953. JAVA_PROGRAM_CP_USE_COMMAND_FILE=yes
  8954. when ($JDK_REAL_VERSION == "8") {
  8955. JAVA_PROGRAM_CP_USE_COMMAND_FILE=no
  8956. }
  8957. # tag:kotlin-specific
  8958. KOTLIN_JVM_TARGET=
  8959. when ($JDK_REAL_VERSION == "8") {
  8960. KOTLIN_JVM_TARGET=1.8
  8961. }
  8962. elsewhen ($JDK_REAL_VERSION == "20") {
  8963. # remove when kotlin starts supporting jdk20 bytecode
  8964. # see also devtools/ya/jbuild/gen/actions/idea.py
  8965. KOTLIN_JVM_TARGET=19
  8966. }
  8967. otherwise {
  8968. KOTLIN_JVM_TARGET=$JDK_REAL_VERSION
  8969. }
  8970. # tag:frontend-specific
  8971. ### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
  8972. ###
  8973. ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
  8974. macro COLLECT_FRONTEND_FILES(Varname, Dir) {
  8975. _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
  8976. }
  8977. # tag:java-specific
  8978. # local jdk and tools
  8979. USE_SYSTEM_JDK=
  8980. USE_SYSTEM_UBERJAR=
  8981. USE_SYSTEM_ERROR_PRONE=
  8982. # tag:swift-specific
  8983. CPP_XCODE_TOOLCHAIN_VERSION=9.2
  8984. SWIFT_XCODE_TOOLCHAIN_VERSION=9.2
  8985. XCODE_TOOLS_VERSION=10.1
  8986. macro COMPILE_SWIFT_MODULE(SRCS{input}[], BRIDGE_HEADER{input}="", Flags...) {
  8987. when ($BRIDGE_HEADER != "") {
  8988. SWIFT_BRIDGE_HEADER=-import-objc-header ${input:BRIDGE_HEADER}
  8989. }
  8990. otherwise {
  8991. SWIFT_BRIDGE_HEADER=
  8992. }
  8993. .PEERDIR+=build/platform/xcode/swift
  8994. # swift core libraries
  8995. LDFLAGS($SWIFT_LD_FLAGS)
  8996. .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}
  8997. }
  8998. TEST_TOOL_HOST_LOCAL=
  8999. TEST_TOOL_TARGET_LOCAL=
  9000. when ($MOST_USED_CUDA) {
  9001. CUDA_VERSION=11.4
  9002. CUDNN_VERSION=8.0.5
  9003. TENSORRT_VERSION=7
  9004. }
  9005. when ($TENSORFLOW_WITH_CUDA) {
  9006. CUDA_REQUIRED=yes
  9007. }
  9008. when (!$TENSORRT_VERSION) {
  9009. TENSORRT_VERSION=5
  9010. }
  9011. ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
  9012. MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin/mvn
  9013. when ($QT_REQUIRED) {
  9014. QT_BIN=${HOST_QT_RESOURCE_GLOBAL}/bin
  9015. }
  9016. when ($OPENGL_REQUIRED) {
  9017. OPENGL_VERSION=18.0.5
  9018. }
  9019. # tag:python-specific
  9020. multimodule PY23_TEST {
  9021. module PY2 : PYTEST_BIN {
  9022. .RESTRICTED=RUN_ANTLR4_PYTHON
  9023. MODULE_PREFIX=py2_
  9024. OBJ_SUF=.py2
  9025. CANONIZE_SUB_PATH=py2test
  9026. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  9027. }
  9028. module PY3TEST_PROGRAM: PY3TEST_BIN {
  9029. .FINAL_TARGET=yes
  9030. .RESTRICTED=RUN_ANTLR4_PYTHON
  9031. OBJ_SUF=.py3
  9032. CANONIZE_SUB_PATH=py3test
  9033. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  9034. }
  9035. module PY3TEST_LIBRARY: PY3_LIBRARY {
  9036. .RESTRICTED=RUN_ANTLR4_PYTHON
  9037. PEERDIR+=library/python/pytest
  9038. _REQUIRE_EXPLICIT_LICENSE()
  9039. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  9040. }
  9041. }
  9042. # tag:windows-specific
  9043. WINDOWS_MANIFEST=
  9044. macro WINDOWS_MANIFEST(Manifest) {
  9045. SET(WINDOWS_MANIFEST $Manifest)
  9046. }
  9047. # https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later
  9048. macro WINDOWS_LONG_PATH_MANIFEST() {
  9049. SET(WINDOWS_MANIFEST build/long-path.manifest)
  9050. }
  9051. # tag:windows-specific
  9052. when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
  9053. LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
  9054. }
  9055. # tag:cpp-specific
  9056. _VISIBILITY_LEVEL=
  9057. ### @usage: VISIBILITY(level)
  9058. ###
  9059. ### This macro sets visibility level for symbols compiled for the current module. 'level'
  9060. ### may take only one of the following values: DEFAULT, HIDDEN.
  9061. macro VISIBILITY(LEVEL) {
  9062. SET(_VISIBILITY_LEVEL ${LEVEL})
  9063. select ($LEVEL) {
  9064. "DEFAULT" | "HIDDEN" ? {
  9065. }
  9066. default ? {
  9067. _OK = no
  9068. }
  9069. }
  9070. ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
  9071. }
  9072. # tag:cpp-specific
  9073. _CFLAGS_VISIBILITY=
  9074. when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
  9075. when ($CLANG == "yes" || $GCC == "yes") {
  9076. _CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
  9077. }
  9078. }
  9079. CFLAGS+=$_CFLAGS_VISIBILITY
  9080. # tag:cpp-specific
  9081. macro SDBUS_CPP_ADAPTOR(File) {
  9082. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
  9083. .PEERDIR=contrib/libs/sdbus-cpp
  9084. }
  9085. # tag:cpp-specific
  9086. macro SDBUS_CPP_PROXY(File) {
  9087. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
  9088. .PEERDIR=contrib/libs/sdbus-cpp
  9089. }
  9090. # tag:python-specific
  9091. macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
  9092. .CMD=$ENUM_PARSER_TOOL ${input:File} --output ${output;noext;suf=.generated.h:File} --json-output ${output;noext:File.json} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  9093. }
  9094. # tag:python-specific
  9095. macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
  9096. .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"}
  9097. }
  9098. macro NGINX_MODULES(Modules...) {
  9099. PEERDIR(${Modules})
  9100. 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)
  9101. }
  9102. # tag:external-build
  9103. CONTAINER_LAYER_CMD=$YMAKE_PYTHON ${input:"build/scripts/make_container_layer.py"} -s $SQUASHFS_RESOURCE_GLOBAL -o $TARGET $AUTO_INPUT ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CL"} ${kv;hide:"pc blue"}
  9104. CONTAINER_CMD=$YMAKE_PYTHON ${input:"build/scripts/make_container.py"} -s $SQUASHFS_RESOURCE_GLOBAL -o $TARGET ${rootrel:PEERS} ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CN"} ${kv;hide:"pc blue"}
  9105. # tag:external-build
  9106. module CONTAINER_LAYER: _BARE_UNIT {
  9107. .CMD=CONTAINER_LAYER_CMD
  9108. PEERDIR(build/external_resources/squashfs_tools)
  9109. MODULE_SUFFIX=.container_layer
  9110. CHECK_ALLOWED_PATH()
  9111. CHECK_DEPENDENT_DIRS(ALLOW_ONLY PEERDIRS base_layers build/external_resources/squashfs_tools build/platform/python/ymake_python3 junk)
  9112. }
  9113. # tag:external-build
  9114. module CONTAINER: _BARE_UNIT {
  9115. .NODE_TYPE=Bundle
  9116. .PEERDIR_POLICY=as_build_from
  9117. .FINAL_TARGET=yes
  9118. .CMD=CONTAINER_CMD
  9119. PEERDIR(build/external_resources/squashfs_tools)
  9120. PEERDIR(devtools/contrib/cake/entry)
  9121. }
  9122. # tag:external-build
  9123. CUSTOM_BUILD_LIBRARY_USE=
  9124. 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
  9125. # tag:external-build
  9126. module CUSTOM_BUILD_LIBRARY: LIBRARY {
  9127. .NODE_TYPE=Bundle
  9128. .PEERDIR_POLICY=as_build_from
  9129. .PROXY=yes
  9130. .CMD=CUSTOM_BUILD_LIBRARY_CMD
  9131. DISABLE(NEED_ADD_FAKE_SRC)
  9132. }
  9133. ### @usage: ORIGINAL_SOURCE(Source)
  9134. ###
  9135. ### This macro specifies the source repository for contrib
  9136. ### Does nothing now (just a placeholder for future functionality)
  9137. ### See https://st.yandex-team.ru/DTCC-316
  9138. macro ORIGINAL_SOURCE(Source) {
  9139. ENABLE(UNUSED_MACRO)
  9140. }
  9141. # tag:licence
  9142. CREDITS_FILE_EXTRA_EXT=
  9143. CREDITS_FLAGS=
  9144. CREDITS_TEXTS_FILE=
  9145. NO_CREDITS_TEXTS_FILE=
  9146. WITH_CREDITS=
  9147. ### @usage: LICENSE_TEXTS(File)
  9148. ###
  9149. ### This macro specifies the filename with all library licenses texts
  9150. macro LICENSE_TEXTS(Source) {
  9151. SET(CREDITS_TEXTS_FILE $Source)
  9152. }
  9153. # tag:licence
  9154. ### @usage: WITHOUT_LICENSE_TEXTS()
  9155. ###
  9156. ### This macro indicates that the module has no license text
  9157. macro WITHOUT_LICENSE_TEXTS() {
  9158. ENABLE(NO_CREDITS_TEXTS_FILE)
  9159. }
  9160. # tag:licence
  9161. when ($WITH_CREDITS) {
  9162. CREDITS_FLAGS+=--credits-output ${output;suf=${CREDITS_FILE_EXTRA_EXT}".CREDITS.txt":REALPRJNAME}
  9163. }
  9164. GENERATE_MF=
  9165. when ($WITH_CREDITS) {
  9166. GENERATE_MF=$GENERATE_MF_CMD
  9167. }
  9168. macro _MCU_CONVERT(Bin) {
  9169. .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}
  9170. }
  9171. MCU_LINK_EXE=$LINK_EXE && $_MCU_CONVERT($MODULE_PREFIX$REALPRJNAME)
  9172. ### @usage: MCU_PROGRAM([progname])
  9173. ###
  9174. ### Program module for microcontrollers. Converts ELF to Intel HEX, Motorola S-record and raw binary file formats.
  9175. ### If name is not specified it will be generated from the name of the containing project directory.
  9176. module MCU_PROGRAM: PROGRAM {
  9177. .CMD=MCU_LINK_EXE
  9178. }
  9179. @import "${CONF_ROOT}/conf/project_specific/esp.conf"
  9180. # tag:flags tag:internal tag:windows-specific
  9181. ### @usage: _MSVC_FLAGS_WINDOWS_IMPL(target_platform compiler_flags) # internal
  9182. ###
  9183. ### Add CFLAGS when the firts argument is WINDOWS
  9184. macro _MSVC_FLAGS_WINDOWS_IMPL(WINDOWS[], FLAGS...) {
  9185. CFLAGS($WINDOWS)
  9186. }
  9187. # tag:flags tag:windows-specific tag:cpp-specific
  9188. ### @usage: MSVC_FLAGS([GLOBAL compiler_flag]* compiler_flags)
  9189. ###
  9190. ### Add the specified flags to the compilation line of C/C++files.
  9191. ### Flags apply only if the compiler used is MSVC (cl.exe)
  9192. macro MSVC_FLAGS(FLAGS...) {
  9193. _MSVC_FLAGS_WINDOWS_IMPL($TARGET_PLATFORM $FLAGS)
  9194. }
  9195. ### @usage: COLLECT_YDB_API_SPECS_LEGACY(VarName Paths...) #deprecated
  9196. ###
  9197. ### This macro is ugly hack for legacy YDB go API codegen, any other uses are prohibited
  9198. macro COLLECT_YDB_API_SPECS_LEGACY(FILES_VAR, PATHS...) {
  9199. _GLOB($FILES_VAR ${suf=/*.proto:PATHS})
  9200. RESTRICT_PATH(kikimr/public/sdk/go/ydb/api MSG This is ugly hack for legacy YDB go API codegen, any other uses are probibited)
  9201. }
  9202. # tag:proto tag:apphost
  9203. ### @usage: APPHOST()
  9204. ###
  9205. ### Emit APPHOST service code for all .proto files in a PROTO_LIBRARY.
  9206. ### This works only for C++ and Java at the moment.
  9207. macro APPHOST() {
  9208. # C++
  9209. CPP_PROTO_PLUGIN(cpp_plugin apphost/tools/stub_generator/cpp_plugin .apphost.h DEPS apphost/tools/stub_generator/cpp_includes)
  9210. # Java
  9211. JAVA_PROTO_PLUGIN(java_plugin apphost/tools/stub_generator/java_plugin DEPS apphost/api/service/java/apphost)
  9212. }
  9213. # tag:internal
  9214. ### Add passed ya.conf.json and all bottle's formula external files to resources
  9215. ### File MUST be arcadia root relative path (without "${ARCADIA_ROOT}/" prefix).
  9216. ### NOTE:
  9217. ### An external formula file referenced from ya.conf.json must be passed as an arcadia root relative path and
  9218. ### should be located in any subdirectory of the ya.conf.json location ("build/" if we consider a production).
  9219. ### The later restriction prevents problems in selectively checkouted arcadia.
  9220. macro YA_CONF_JSON(File) {
  9221. _YA_CONF_JSON($File)
  9222. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$File)
  9223. }
  9224. # tag:internal
  9225. # Don't use directly - wrap with custom macros
  9226. macro ADD_LINTER_CHECK(CheckName, Linter, DEPENDS[], EXCLUDE[], FILES[], CONFIGS[]) {
  9227. SET(_FILES_VAR uniq_${hash:VAR_SALT})
  9228. _GLOB($_FILES_VAR $FILES EXCLUDE $EXCLUDE)
  9229. _ADD_LINTER_CHECK($CheckName $Linter ${pre=DEPENDS :DEPENDS} FILES $$_FILES_VAR CONFIGS $CONFIGS)
  9230. }
  9231. # tag:internal
  9232. # Draft. Don't use.
  9233. macro _CPP_STYLE(EXCLUDE[], Files...) {
  9234. ADD_LINTER_CHECK(cpp_style tools/cpp_style_checker/cpp_style_checker DEPENDS contrib/libs/clang12/tools/clang-format EXCLUDE $EXCLUDE FILES $Files CONFIGS devtools/ya/handlers/style/style_config)
  9235. }
  9236. # tag:proto
  9237. macro ALICE_CAPABILITY() {
  9238. CPP_PROTO_PLUGIN(alice_capability_cpp yandex_io/tools/capability_gen .cap.h DEPS yandex_io/libs/protobuf_utils)
  9239. JAVA_PROTO_PLUGIN(alice_capability_java alice/library/go/java_marker_interface_protoc_plugin DEPS alice/protos/endpoint/java_interface alice/megamind/protos/scenarios/java_interface)
  9240. }