ymake.core.conf 360 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482
  1. # !!! DISCLAIMER! PLEASE DON'T IGNORE !!!
  2. # The FAKEID value is huge hammer. It affects UIDs of all nodes in build graph including, but not limnited to
  3. # any resource fetch (think java contrib), build on any language (C++, Python, Java, Go), any code generation.
  4. # Any build after this change will pay the price:
  5. # - Local builds and Sandbox builds will reload all resources from Sandbox and cached data from YT (if ready).
  6. # - Distributed (YT) cache warmup will take signigicant time to catch up and will need to recache everithing.
  7. # - Autocheck will rebuild and recache everything.
  8. # Use this with extreme care and only change if it is utlimately needed. Consider more specific XXX_FAKEIDs below instead.
  9. FAKEID=3141592653
  10. SANDBOX_FAKEID=${FAKEID}.7600000
  11. CPP_FAKEID=9184729
  12. GO_FAKEID=9056219
  13. ANDROID_FAKEID=8821472
  14. CLANG_TIDY_FAKEID=8625699
  15. CURDIR=.
  16. MODDIR=.
  17. BINDIR=bin:/
  18. SRCDIR=
  19. YMAKE=ymake
  20. ECHO=echo
  21. INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i
  22. CPP_EXT=.cpp
  23. OBJ_SUF=
  24. CFLAGS=
  25. EXTRA_C_FLAGS=
  26. SFLAGS=
  27. AUTOCHECK_BALANCING_OPTIONS=
  28. SO_OTPUTS=no
  29. @import "${CONF_ROOT}/conf/settings.conf"
  30. @import "${CONF_ROOT}/conf/opensource.conf"
  31. @import "${CONF_ROOT}/conf/rules.conf"
  32. @import "${CONF_ROOT}/conf/sysincl.conf"
  33. @import "${CONF_ROOT}/conf/license.conf"
  34. @import "${CONF_ROOT}/conf/ts.conf"
  35. @import "${CONF_ROOT}/conf/project_specific/other.conf"
  36. USE_GLOBAL_CMD=no
  37. when ($OS_WINDOWS != "yes") {
  38. USE_GLOBAL_CMD=yes
  39. }
  40. YMAKE_RESOURCE_BIN=${YMAKE_RESOURCE_GLOBAL}/ymake
  41. YMAKE_RESOURCE_DIR=build/external_resources/ymake
  42. when ($USE_YMAKE_RESOURCE == "yes") {
  43. PEERDIR+=${YMAKE_RESOURCE_DIR}
  44. }
  45. __COMMA__=${comma:""}
  46. ARCADIA_TEST_ROOT=../arcadia_tests_data/
  47. DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32
  48. CC_REQUIREMENTS=$DEFAULT_REQUIREMENTS
  49. LIB_REQUIREMENTS=$DEFAULT_REQUIREMENTS
  50. LD_REQUIREMENTS=$DEFAULT_REQUIREMENTS
  51. JAVA_REQUIREMENTS=$DEFAULT_REQUIREMENTS
  52. PY_REQUIREMENTS=$DEFAULT_REQUIREMENTS
  53. BISON_DATA_DIR=contrib/tools/bison/bison/data
  54. CPP_BISON_SKELS=${BISON_DATA_DIR}/glr.cc ${BISON_DATA_DIR}/lalr1.cc ${BISON_DATA_DIR}/yacc.c ${BISON_DATA_DIR}/stack.hh ${BISON_DATA_DIR}/variant.hh ${BISON_DATA_DIR}/c++.m4 ${BISON_DATA_DIR}/c++-skel.m4
  55. USE_PREBUILT_TOOLS=yes
  56. when ($OPENSOURCE == "yes") {
  57. USE_PREBUILT_TOOLS=no
  58. }
  59. FAIL_PY2=no
  60. _PREBUILT_TOOLS_ROOT=build/prebuilt
  61. _TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
  62. _TOOL_RESCOMPILER=tools/rescompiler
  63. _TOOL_RESCOMPRESSOR=tools/rescompressor
  64. _TOOL_RORESCOMPILER=tools/rorescompiler
  65. when ($HOST_ARCH_X86_64 == "yes") {
  66. when ($HOST_OS_DARWIN == "yes" || $HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes") {
  67. VALID_HOST_PLATFORM_FOR_COMMON_PREBUILT_TOOLS=yes
  68. when ($USE_PREBUILT_TOOLS == "yes" && $ARCH_X86_64 == "yes") {
  69. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  70. }
  71. }
  72. }
  73. FAIL_MODULE_CMD=$YMAKE_PYTHON ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
  74. when ($TIDY == "yes") {
  75. when ($TIDY_EXPORT_FIXES=="") {
  76. TIDY_EXPORT_FIXES="no"
  77. }
  78. CLANG_TIDY_ARGS=${hide:CLANG_TIDY_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/clang_tidy.py"} "--ymake-python" $YMAKE_PYTHON "--clang-tidy-bin" "$(CLANG_TIDY_BIN)/bin/clang-tidy" "--config-validation-script" ${input:"build/tests/config/clang_tidy/tidy_config_validation.py"} "--testing-src" ${input:SRC} "--source-root" $(SOURCE_ROOT) "--build-root" $(BUILD_ROOT) "--tidy-json" ${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.tidyjson:SRC} "--export-fixes" $TIDY_EXPORT_FIXES
  79. CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
  80. CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
  81. when ($TIDY_CHECKS) {
  82. CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
  83. }
  84. when ($TIDY_HEADER_FILTER) {
  85. CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
  86. }
  87. TIDY_VALUE=USE_CONDITIONAL_SRCS
  88. }
  89. otherwise {
  90. CLANG_TIDY_ARGS=
  91. TIDY_VALUE=
  92. }
  93. # tag:codenav
  94. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  95. PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
  96. YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
  97. YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}.ydx.pb2:SRC}
  98. }
  99. otherwise {
  100. PY_PROGRAM_LINK_EXE=$LINK_EXE
  101. YNDEXER_ARGS=
  102. YNDEXER_OUTPUT=
  103. }
  104. COVERAGE_FLAGS=
  105. EXTRA_OUTPUT=
  106. when ($CLANG == "yes" || $GCC == "yes") {
  107. when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
  108. COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
  109. EXTRA_OUTPUT=${output;noauto;hide;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.gcno:SRC}
  110. }
  111. }
  112. when ($OS_CYGWIN == "yes") {
  113. CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
  114. USE_ASMLIB=no
  115. FSTACK=
  116. }
  117. CFLAGS+=$COVERAGE_FLAGS
  118. LDFLAGS+=$COVERAGE_FLAGS
  119. CHECKFLAG=
  120. LEX_FLAGS=
  121. NO_MAPREDUCE=
  122. when ($NO_MAPREDUCE == "yes") {
  123. C_DEFINES+=-DNO_MAPREDUCE
  124. }
  125. when ($OS_ANDROID == "yes") {
  126. PIE=yes
  127. }
  128. # TODO: extract to conf/maps/maps.conf
  129. when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
  130. USE_STL_SYSTEM=yes
  131. }
  132. when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_IOS == "yes") {
  133. BUILD_IOS_APP=yes
  134. when ($ARCH_ARM7 || $ARCH_ARM64) {
  135. BOOSTTEST_IS_FAT_OBJECT=yes
  136. }
  137. }
  138. # USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
  139. # select system standard C++ library when USE_INTERNAL_STL=no is set.
  140. #
  141. # USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
  142. #
  143. when ($USE_STL_SYSTEM == "yes") {
  144. USE_INTERNAL_STL=no
  145. }
  146. when ($USE_INTERNAL_STL == "no") {
  147. USE_STL_SYSTEM=yes
  148. }
  149. otherwise {
  150. USE_INTERNAL_STL=yes
  151. # TODO: Extract to conf/sysincl.conf
  152. # This trigger doesn't work for module level since SYSINCL is processed at
  153. # configuration stage (This means that NO_RUNTIME() macro called in ya.make
  154. # won't affect SYSINCL and the only way to make this trigger work correctly
  155. # is to define configuration varaible NORUNTIME (-DNORUNTIME) on the command
  156. # line when `ya make ...` is invoked.
  157. when ($NORUNTIME != "yes") {
  158. SYSINCL+=build/sysincl/stl-to-libcxx.yml
  159. when ($MUSL == "yes") {
  160. SYSINCL+=build/sysincl/libc-musl-libcxx.yml
  161. }
  162. }
  163. }
  164. # tag:linux-specific
  165. when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") {
  166. USE_UBUNTU_COMPATIBILITY=yes
  167. }
  168. USE_ARCADIA_PYTHON=yes
  169. USE_ARCADIA_LIBM=no
  170. USE_EAT_MY_DATA=no
  171. HAVE_MKL=
  172. when ($HAVE_MKL == "") {
  173. when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
  174. HAVE_MKL=yes
  175. }
  176. otherwise {
  177. HAVE_MKL=no
  178. }
  179. }
  180. SFDL_TMP_OUT= ${output;tmp:SRC.tmp}
  181. # tag:perl-specific
  182. when ($USE_LOCAL_TOOLS == "yes") {
  183. PERL=$LOCAL_PERL
  184. PERL_VERSION=$LOCAL_PERL_VERSION
  185. PERL_PRIVLIB=$LOCAL_PERL_PRIVLIB
  186. PERL_ARCHLIB=$LOCAL_PERL_ARCHLIB
  187. when ($LOCAL_PERL_LIBS) {
  188. PERL_LIBS=$LOCAL_PERL_LIBS
  189. }
  190. }
  191. otherwise {
  192. PERL=NO-PERL-SELECTED
  193. PERL_VERSION=NO-PERL-SELECTED-VERSION
  194. PERL_PRIVLIB=NO-PERL-SELECTED-PRIVLIB
  195. PERL_ARCHLIB=NO-PERL-SELECTED-ARCHLIB
  196. }
  197. # tag:perl-specific
  198. PERL_LD_LIBRARY_PATH=
  199. PERL_INCLUDE=
  200. USE_PERL_SYSTEM=yes
  201. when ($USE_PERL_SYSTEM == "yes") {
  202. select ($PERL_SDK) {
  203. "ubuntu-12" ? {
  204. PERL_VERSION=5.14
  205. PERL_ROOT=${SYSTEM_PERL_514_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  206. PERL_LIB_ARCH=
  207. }
  208. "ubuntu-14" ? {
  209. PERL_VERSION=5.18
  210. PERL_ROOT=${SYSTEM_PERL_518_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  211. PERL_LIB_ARCH=
  212. }
  213. "ubuntu-16" ? {
  214. PERL_VERSION=5.22
  215. PERL_ROOT=${SYSTEM_PERL_522_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  216. PERL_LIB_ARCH=/x86_64-linux-gnu
  217. }
  218. "ubuntu-18" ? {
  219. PERL_VERSION=5.26
  220. PERL_ROOT=${SYSTEM_PERL_526_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  221. PERL_LIB_ARCH=/x86_64-linux-gnu
  222. }
  223. "ubuntu-20" ? {
  224. PERL_VERSION=5.30
  225. PERL_ROOT=${SYSTEM_PERL_530_RESOURCE_GLOBAL}/usr
  226. PERL_LIB_ARCH=/x86_64-linux-gnu
  227. }
  228. }
  229. PERL=${PERL_ROOT}/bin/perl
  230. PERL_ARCHLIB=${PERL_ROOT}/lib$PERL_LIB_ARCH/perl/${PERL_VERSION}
  231. PERL_PRIVLIB=${PERL_ROOT}/share/perl/${PERL_VERSION}
  232. PERL_LIBS=${PERL_ROOT}/lib${PERL_LIB_ARCH}
  233. PERL_LD_LIBRARY_PATH=${env:"LD_LIBRARY_PATH=${PERL_ROOT}/lib"}
  234. # Perl searches it's modules in INC@ paths. They can not be sysrooted or disabled (at least I haven't found a way),
  235. # so default Perl module directories should be prepended to perl command lines when using non-local perl.
  236. PERL_INCLUDE=-I${PERL_ARCHLIB} -I${PERL_PRIVLIB}
  237. }
  238. PERL_DEFAULT_PEERDIR=yes
  239. # tag:perl-specific
  240. PERLSUFFIX=-csuffix .cpp
  241. PERLOUTPUT=${stdout;output:SRC.cpp}
  242. when ($PERLC == "yes") {
  243. PERLSUFFIX=-csuffix .c
  244. PERLOUTPUT=${stdout;output:SRC.c}
  245. }
  246. XSUBPPFLAGS=
  247. # tag:tool-specific
  248. ARCH_TOOL=${tool:"tools/archiver"}
  249. # tag:tool-specific tag:proto
  250. PROTOC=${tool:"contrib/tools/protoc"}
  251. PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
  252. PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
  253. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src
  254. USE_VANILLA_PROTOC=no
  255. PROTOC_TRANSITIVE_HEADERS=yes
  256. # tag:tool-specific
  257. FML_TOOL=${tool:"tools/relev_fml_codegen"}
  258. FML_UNUSED_TOOL=${tool:"tools/relev_fml_unused"}
  259. LUA_TOOL=${tool:"tools/lua"}
  260. ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
  261. # tag:python-specific tag:cython-specific
  262. CYTHON_SCRIPT=${input:"${ARCADIA_ROOT}/contrib/tools/cython/cython.py"}
  263. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  264. CYTHON_OUTPUT_INCLUDES=\
  265. ${output_include;hide:"contrib/libs/python/Include/compile.h"} \
  266. ${output_include;hide:"contrib/libs/python/Include/frameobject.h"} \
  267. ${output_include;hide:"contrib/libs/python/Include/longintrepr.h"} \
  268. ${output_include;hide:"contrib/libs/python/Include/pyconfig.h"} \
  269. ${output_include;hide:"contrib/libs/python/Include/Python.h"} \
  270. ${output_include;hide:"contrib/libs/python/Include/pythread.h"} \
  271. ${output_include;hide:"contrib/libs/python/Include/structmember.h"} \
  272. ${output_include;hide:"contrib/libs/python/Include/traceback.h"} \
  273. ${output_include;hide:"contrib/tools/cython/generated_c_headers.h"} \
  274. ${output_include;hide:"omp.h"}
  275. # tag:cython-specific
  276. CYTHON_CPP_OUTPUT_INCLUDES=${output_include;hide:"contrib/tools/cython/generated_cpp_headers.h"}
  277. # tag:cython-specific
  278. CYTHON_OPTIONS=
  279. when ($OS_LINUX) {
  280. CYTHON_OPTIONS += -E UNAME_SYSNAME=Linux
  281. }
  282. elsewhen ($OS_DARWIN) {
  283. CYTHON_OPTIONS += -E UNAME_SYSNAME=Darwin
  284. }
  285. elsewhen ($OS_WINDOWS) {
  286. CYTHON_OPTIONS += -E UNAME_SYSNAME=Windows
  287. }
  288. when ($USE_LOCAL_SWIG != "yes") {
  289. _SWIG_TOOL=${tool:"contrib/tools/swig"}
  290. _SWIG_LIBRARY=contrib/tools/swig/Lib
  291. _SWIG_LIBRARY_ABS=$ARCADIA_ROOT/$_SWIG_LIBRARY
  292. }
  293. otherwise {
  294. _SWIG_TOOL=$SWIG_TOOL
  295. _SWIG_LIBRARY=$SWIG_LIBRARY
  296. _SWIG_LIBRARY_ABS=$SWIG_LIBRARY
  297. }
  298. SWIG_IMPLICIT_INCLUDES = swig.swg go.swg java.swg perl5.swg python.swg
  299. FATAL_ERROR_MODULE=no
  300. FATAL_ERROR_MESSAGE=
  301. # tag:python-specific
  302. # PYTHON_DISTR={ "default" | "macos-brew" } determine python system supply
  303. # see build/platform/python/ya.make
  304. PYTHON_DISTR="default"
  305. when ($USE_SYSTEM_PYTHON) {
  306. USE_ARCADIA_PYTHON=no
  307. select ($USE_SYSTEM_PYTHON) {
  308. "2.7" ? {
  309. _SYSTEM_PYTHON27=yes
  310. PY_VERSION=2.7
  311. PY_FRAMEWORK_VERSION=2.7
  312. }
  313. "3.4" ? {
  314. _SYSTEM_PYTHON34=yes
  315. PY_VERSION=3.4m
  316. PY_FRAMEWORK_VERSION=3.4
  317. }
  318. "3.5" ? {
  319. _SYSTEM_PYTHON35=yes
  320. PY_VERSION=3.5m
  321. PY_FRAMEWORK_VERSION=3.5
  322. }
  323. "3.6" ? {
  324. _SYSTEM_PYTHON36=yes
  325. PY_VERSION=3.6m
  326. PY_FRAMEWORK_VERSION=3.6
  327. }
  328. "3.7" ? {
  329. _SYSTEM_PYTHON37=yes
  330. PY_VERSION=3.7m
  331. PY_FRAMEWORK_VERSION=3.7
  332. }
  333. "3.8" ? {
  334. _SYSTEM_PYTHON38=yes
  335. PY_VERSION=3.8
  336. PY_FRAMEWORK_VERSION=3.8
  337. }
  338. "3.9" ? {
  339. _SYSTEM_PYTHON39=yes
  340. PY_VERSION=3.9
  341. PY_FRAMEWORK_VERSION=3.9
  342. }
  343. "3.10" ? {
  344. _SYSTEM_PYTHON310=yes
  345. PY_VERSION=3.10
  346. PY_FRAMEWORK_VERSION=3.10
  347. }
  348. default ? {
  349. FATAL_ERROR_MESSAGE+=invalid USE_SYSTEM_PYTHON value
  350. }
  351. }
  352. }
  353. ### @usage: NO_LTO()
  354. ###
  355. ### Diasble any lto (link-time optimizations) for the module.
  356. ### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
  357. ### linking of entire program if global settings say so.
  358. macro NO_LTO() {
  359. DISABLE(USE_LTO)
  360. DISABLE(USE_THINLTO)
  361. }
  362. when ($USE_LTO == "yes" && $OS_LINUX != "yes" && $OS_ANDROID != "yes") {
  363. FATAL_ERROR_MESSAGE+=lto is only supported for linux
  364. }
  365. # tag:python-specific
  366. YMAKE_PYTHON3_PEER=build/platform/python/ymake_python3
  367. YMAKE_PYTHON3=$YMAKE_PYTHON3_RESOURCE_GLOBAL/python3
  368. when ($HOST_OS_WINDOWS == "yes") {
  369. YMAKE_PYTHON3=$YMAKE_PYTHON3_RESOURCE_GLOBAL/python3.exe
  370. }
  371. # tag:python-specific
  372. when ($USE_ARCADIA_PYTHON == "no") {
  373. SYSINCL+=build/sysincl/python.yml
  374. }
  375. # tag:allocator
  376. DEFAULT_ALLOCATOR=LF
  377. # tag:allocator
  378. when ($OS_ANDROID == "yes" || $MSVC == "yes") {
  379. DEFAULT_ALLOCATOR=J
  380. }
  381. # tag:allocator
  382. when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
  383. DEFAULT_ALLOCATOR=SYSTEM
  384. }
  385. # tag:allocator
  386. when ($OS_DARWIN == "yes") {
  387. DEFAULT_ALLOCATOR=SYSTEM
  388. }
  389. # tag:allocator
  390. when ($SANITIZER_TYPE) {
  391. when ($SANITIZER_TYPE != "no") {
  392. DEFAULT_ALLOCATOR=SYSTEM
  393. }
  394. }
  395. # tag:internal
  396. ### @usage: CHECK_CONFIG_H(<conf_header>) # internal
  397. ###
  398. ### This internal macro adds checking code for configuration header in external (contrib) library.
  399. ### The check is needed to avoid conflicts on certain types and functions available in arcadia.
  400. ###
  401. ### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
  402. macro CHECK_CONFIG_H(Conf) {
  403. .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"}
  404. OUTPUT_INCLUDES=$Conf
  405. }
  406. REQUIRED_TRANSITIVE_PEERS=
  407. ### @usage REQUIRES(dirs...)
  408. ###
  409. ### Specify list of dirs which this module must depend on indirectly.
  410. ###
  411. ### This macro can be used if module depends on the directories specified but they can't be listed
  412. ### as direct PEERDIR dependencies (due to public include order or link order issues).
  413. macro REQUIRES(DIRS[]) {
  414. SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
  415. }
  416. CHECK_DEPENDENT_DIRS_TYPES=
  417. CHECK_DEPENDENT_DIRS_RESTRICTIONS=
  418. ### @usage CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
  419. ###
  420. ### Specify project transitive dependencies constraints.
  421. ###
  422. ### @params:
  423. ### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
  424. ### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
  425. ### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
  426. ### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
  427. ### 5. GLOB: next directory constraint is an ANT glob pattern.
  428. ### 6. EXCEPT: next constraint is an excption for the rest of other rules.
  429. ###
  430. ### Direcory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
  431. ###
  432. ### Note: Can be used multiple times on the same module all specified constraints will be checked.
  433. ### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
  434. macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
  435. SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
  436. SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
  437. }
  438. # tag:proto
  439. PY_PROTOS_FOR=no
  440. BUILD_PROTO_AS_EVLOG=no
  441. # tag:proto
  442. PROTO_NAMESPACE=
  443. # tag:proto tag:python-specific
  444. GEN_PY_PROTOS=$YMAKE_PYTHON ${input:"build/scripts/gen_py_protos.py"}
  445. # tag:proto tag:cpp-specific
  446. PROTO_HEADER_EXTS=.pb.h
  447. CPP_PROTO_CMDLINE=
  448. CPP_PROTO_OPTS=
  449. CPP_PROTO_OUTS=
  450. CPP_PROTO_OUTS_SEM=
  451. CPP_PROTO_SUFFIXES=.pb.h .pb.cc
  452. CPP_PROTO_PLUGINS=
  453. # tag:proto tag:cpp-specific
  454. CPP_EV_OPTS=--plugin=protoc-gen-event2cpp=${tool:"tools/event2cpp"} --event2cpp_out=$ARCADIA_BUILD_ROOT -I=$ARCADIA_ROOT/library/cpp/eventlog
  455. CPP_EV_OUTS=
  456. # tag:proto tag:python-specific
  457. PY_PROTO_OPTS=
  458. PY_PROTO_OUTS=
  459. PY_PROTO_OUTS_INTERNAL=
  460. PY_PROTO_DEPS=
  461. PY_PROTO_SUFFIXES=_pb2.py
  462. PY_EVLOG_SUFFIXES=_ev_pb2.py
  463. # tag:proto tag:java-specific
  464. JAVA_PROTO_ARGS=
  465. # tag:proto tag:python-specific
  466. OPTIMIZE_PY_PROTOS_FLAG=no
  467. macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
  468. SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
  469. .SEM=resources ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${tool;hide:"tools/rescompiler/bin"}
  470. }
  471. # tag:built-in
  472. ### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # built-in
  473. ### Add data (resources, random files, strings) to the program)
  474. ### 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.
  475. ### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
  476. ###
  477. ### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
  478. ### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
  479. ###
  480. ### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
  481. ###
  482. ### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
  483. ###
  484. ### @example:
  485. ###
  486. ### LIBRARY()
  487. ### OWNER(user1)
  488. ###
  489. ### RESOURCE(
  490. ### path/to/file1 /key/in/program/1
  491. ### path/to/file2 /key2
  492. ### )
  493. ### END()
  494. ###
  495. macro RESOURCE(Args...) {
  496. PEERDIR(library/cpp/resource)
  497. }
  498. # tag:internal
  499. ### @usage: _ORDER_ADDINCL([BUILD ...] [SOURCE ...] Args...) # internal
  500. ###
  501. ### Order and filter ADDINCLs (Args - is intentionally omitted in ADDINCL macro)
  502. macro _ORDER_ADDINCL(BUILD[], SOURCE[], ARGS...) {
  503. ADDINCL($BUILD $SOURCE)
  504. }
  505. # tag:proto
  506. ### @usage: PROTO_ADDINCL([GLOBAL] [WITH_GEN] Path)
  507. ###
  508. ### This macro introduces proper ADDINCLs for .proto-files found in sources and
  509. ### .cpp/.h generated files, supplying them to appropriate commands and allowing
  510. ### proper dependency resolution at configure-time.
  511. ###
  512. ### Note: you normally shouldn't use this macro. ADDINCLs should be sent to user
  513. ### from dependency via PROTO_NAMESPACE macro
  514. macro PROTO_ADDINCL(GLOBAL?"GLOBAL":"", Path, WITH_GEN?"BUILD":"") {
  515. _ORDER_ADDINCL($WITH_GEN $GLOBAL FOR proto ${ARCADIA_BUILD_ROOT}/$Path SOURCE $GLOBAL FOR proto ${ARCADIA_ROOT}/$Path)
  516. ADDINCL($GLOBAL ${ARCADIA_BUILD_ROOT}/$Path)
  517. }
  518. # tag:proto
  519. ### @usage: PROTO_NAMESPACE([GLOBAL] [WITH_GEN] Namespace)
  520. ###
  521. ### Defines protobuf namespace (import/export path prefix) which should be used for imports and
  522. ### which defines output path for .proto generation.
  523. ###
  524. ### For proper importing and configure-time depenedency management it sets ADDINCLs
  525. ### for both .cpp headers includes and .proto imports. If .proto expected to be used outsed of the
  526. ### processing module use GLOBAL to send proper ADDINCLs to all (transitive) users. PEERDIR to
  527. ### PROTO_LIBRARY with PROTO_NAMESPACE(GLOBAL ) is enough at user side to correctly use the library.
  528. ### If generated .proto files are going to be used for building a module than use of WITH_GEN
  529. ### parameter will add appropriate dir from the build root for .proto files search.
  530. macro PROTO_NAMESPACE(GLOBAL?"GLOBAL":"", WITH_GEN?"WITH_GEN":"", Namespace) {
  531. SET(PROTO_NAMESPACE $Namespace)
  532. PROTO_ADDINCL($GLOBAL $WITH_GEN $Namespace)
  533. }
  534. # tag:proto tag:internal tag:python-specific
  535. ### @usage: OPTIMIZE_PY_PROTOS() # internal
  536. ###
  537. ### Enable Python proto optimization by embedding corresponding C++ code into binary.
  538. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  539. ### This is default mode for most PROTO_LIBRARY's and PY2_LIBRARY's, some system ones being exceptions.
  540. macro OPTIMIZE_PY_PROTOS() {
  541. SET(OPTIMIZE_PY_PROTOS_FLAG yes)
  542. }
  543. # tag:proto tag:python-specific
  544. ### @usage: NO_OPTIMIZE_PY_PROTOS()
  545. ###
  546. ### Disable Python proto optimization using embedding corresponding C++ code into binary.
  547. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  548. ### This is default mode only for some system libraries.
  549. macro NO_OPTIMIZE_PY_PROTOS() {
  550. SET(OPTIMIZE_PY_PROTOS_FLAG no)
  551. }
  552. # tag:proto tag:python-specific
  553. macro _PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  554. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$OutParm$ARCADIA_BUILD_ROOT/\$PROTO_NAMESPACE
  555. .SEM=ignored
  556. }
  557. # tag:proto tag:python-specific
  558. macro _ADD_PY_PROTO_OUT(Suf) {
  559. SET_APPEND(PY_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$Suf:File})
  560. 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}"})
  561. # XXX fix variable expansion in plugins
  562. SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
  563. }
  564. # tag:proto tag:python-specific
  565. ### @usage: PY_PROTO_PLUGIN(Name Ext Tool DEPS <Dependencies>)
  566. ###
  567. ### Define protoc plugin for python with given Name that emits extra output with provided Extension
  568. ### using Tool. Extra dependencies are passed via DEPS
  569. macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  570. SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  571. _ADD_PY_PROTO_OUT($EXT)
  572. # XXX fix variable expansion in plugins
  573. SET(PY_PROTO_DEPS $PY_PROTO_DEPS $DEPS)
  574. }
  575. # tag:proto tag:python-specific
  576. ### @usage: PY_PROTO_PLUGIN2(Name Ext1 Ext2 Tool DEPS <Dependencies>)
  577. ###
  578. ### Define protoc plugin for python with given Name that emits 2 extra outputs with provided Extensions
  579. ### using Tool. Extra dependencies are passed via DEPS
  580. macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
  581. PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
  582. _ADD_PY_PROTO_OUT($EXT2)
  583. }
  584. # tag:proto tag:java-specific
  585. macro _JAVA_PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  586. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/java_out
  587. }
  588. # tag:proto tag:java-specific
  589. ### @usage: JAVA_PROTO_PLUGIN(Name Tool DEPS <Dependencies>)
  590. ###
  591. ### Define protoc plugin for Java with given Name that emits extra outputs
  592. ### using Tool. Extra dependencies are passed via DEPS
  593. macro JAVA_PROTO_PLUGIN(NAME, TOOL, DEPS[]) {
  594. SET_APPEND(JAVA_PROTO_ARGS $_JAVA_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  595. # XXX fix variable expansion in plugins
  596. SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS $DEPS)
  597. }
  598. # tag:proto tag:cpp-specific
  599. macro _ADD_CPP_PROTO_OUT(Suf) {
  600. .SEM=append_target_property PROTOC_EXTRA_OUTS $Suf ${output;hide;suf=.o:Suf}
  601. SET_APPEND(CPP_PROTO_OUTS \${output;hide;norel;nopath;noext;suf=$Suf:File})
  602. # XXX fix variable expansion in plugins
  603. SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES $Suf)
  604. }
  605. # tag:proto tag:cpp-specific
  606. HAS_CPP_PROTOBUF_PEERS=no
  607. CPP_PROTOBUF_PEERS=
  608. # tag:proto tag:cpp-specific
  609. ### @usage: CPP_PROTO_PLUGIN0(Name Tool DEPS <Dependencies>)
  610. ###
  611. ### Define protoc plugin for C++ with given Name that emits code into regular outputs
  612. ### using Tool. Extra dependencies are passed via DEPS.
  613. macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) {
  614. .SEM=target_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME}
  615. SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  616. # XXX fix variable expansion in plugins
  617. ENABLE(HAS_CPP_PROTOBUF_PEERS)
  618. SET(CPP_PROTOBUF_PEERS $CPP_PROTOBUF_PEERS $DEPS)
  619. }
  620. # tag:proto tag:cpp-specific
  621. ### @usage: CPP_PROTO_PLUGIN(Name Tool Suf DEPS <Dependencies>)
  622. ###
  623. ### Define protoc plugin for C++ with given Name that emits code into 1 extra output
  624. ### using Tool. Extra dependencies are passed via DEPS.
  625. macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[]) {
  626. CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS)
  627. _ADD_CPP_PROTO_OUT($SUF)
  628. }
  629. # tag:proto tag:cpp-specific
  630. ### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 DEPS <Dependencies>)
  631. ###
  632. ### Define protoc plugin for C++ with given Name that emits code into 2 extra outputs
  633. ### using Tool. Extra dependencies are passed via DEPS.
  634. macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[]) {
  635. CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS)
  636. _ADD_CPP_PROTO_OUT($SUF2)
  637. SET_APPEND(CPP_PROTO_OUTS_SEM \${output;hide;norel;nopath;noext;suf=$SUF2:File})
  638. }
  639. # tag:proto
  640. ### @usage: USE_SKIFF() #wip, do not use
  641. ###
  642. ### Use mapreduce/yt/skiff_proto/plugin for C++
  643. macro USE_SKIFF() {
  644. # Move extra includes to INDUCED_DEPS macro in mapreduce/yt/skiff_proto/plugin/ya.make
  645. CPP_PROTO_PLUGIN0(skiff mapreduce/yt/skiff_proto/plugin DEPS mapreduce/yt/skiff_proto/lib)
  646. }
  647. # tag:go-specific
  648. _GO_COMMON_GOOGLE_APIS = \
  649. vendor/google.golang.org/genproto/googleapis/api/annotations \
  650. vendor/google.golang.org/genproto/googleapis/api/configchange \
  651. vendor/google.golang.org/genproto/googleapis/api/distribution \
  652. vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1 \
  653. vendor/google.golang.org/genproto/googleapis/api/expr/v1beta1 \
  654. vendor/google.golang.org/genproto/googleapis/api/httpbody \
  655. vendor/google.golang.org/genproto/googleapis/api/label \
  656. vendor/google.golang.org/genproto/googleapis/api/metric \
  657. vendor/google.golang.org/genproto/googleapis/api/monitoredres \
  658. vendor/google.golang.org/genproto/googleapis/api/serviceconfig \
  659. vendor/google.golang.org/genproto/googleapis/api/servicecontrol/v1 \
  660. vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1 \
  661. vendor/google.golang.org/genproto/googleapis/iam/admin/v1 \
  662. vendor/google.golang.org/genproto/googleapis/iam/credentials/v1 \
  663. vendor/google.golang.org/genproto/googleapis/iam/v1 \
  664. vendor/google.golang.org/genproto/googleapis/iam/v1/logging \
  665. vendor/google.golang.org/genproto/googleapis/logging/type \
  666. vendor/google.golang.org/genproto/googleapis/logging/v2 \
  667. vendor/google.golang.org/genproto/googleapis/rpc/code \
  668. vendor/google.golang.org/genproto/googleapis/rpc/errdetails \
  669. vendor/google.golang.org/genproto/googleapis/rpc/status \
  670. vendor/google.golang.org/genproto/googleapis/type/calendarperiod \
  671. vendor/google.golang.org/genproto/googleapis/type/color \
  672. vendor/google.golang.org/genproto/googleapis/type/date \
  673. vendor/google.golang.org/genproto/googleapis/type/dayofweek \
  674. vendor/google.golang.org/genproto/googleapis/type/expr \
  675. vendor/google.golang.org/genproto/googleapis/type/fraction \
  676. vendor/google.golang.org/genproto/googleapis/type/latlng \
  677. vendor/google.golang.org/genproto/googleapis/type/money \
  678. vendor/google.golang.org/genproto/googleapis/type/postaladdress \
  679. vendor/google.golang.org/genproto/googleapis/type/quaternion \
  680. vendor/google.golang.org/genproto/googleapis/type/timeofday
  681. # tag:go-specific
  682. _COMMON_GOOGLE_APIS=None
  683. # tag:go-specific
  684. ### @usage: USE_COMMON_GOOGLE_APIS([apis...])
  685. ###
  686. ### Use common-google-apis library set. Pass optional apis list to be used or use them all.
  687. ### This macro is properly handled for all languages including Go, where apis come in
  688. ## pregenerated form. In other languages apis are generated from sources in Arcadia.
  689. macro USE_COMMON_GOOGLE_APIS(APIS...) {
  690. SET(_COMMON_GOOGLE_APIS ${pre=vendor/google.golang.org/genproto/googleapis/:APIS})
  691. }
  692. # tag:go-specific tag:proto
  693. GO_PROTO_GEN_TOOL=$_TOOL_PROTOC_GEN_GO
  694. GO_PROTO_GEN_PLUGINS=
  695. GO_PROTO_PACKAGE_MAP=
  696. GO_PROTO_OPTS=$_GO_PROTOC_PLUGIN_ARGS_BASE(go $GO_PROTO_GEN_TOOL MAP $GO_PROTO_PACKAGE_MAP PLUGINS $GO_PROTO_GEN_PLUGINS)
  697. GO_PROTO_OUTS=
  698. # tag:go-specific tag:proto
  699. GO_PROTOBUF_IMPORTS=\
  700. ${GOSTD}/sync \
  701. ${GOSTD}/reflect \
  702. ${GOSTD}/fmt \
  703. ${GOSTD}/math \
  704. vendor/github.com/golang/protobuf/proto \
  705. vendor/google.golang.org/protobuf/types/descriptorpb \
  706. vendor/google.golang.org/protobuf/runtime/protoimpl \
  707. vendor/google.golang.org/protobuf/runtime/protoiface \
  708. vendor/google.golang.org/protobuf/reflect/protoreflect
  709. # tag:go-specific tag:proto
  710. GO_PROTOBUF_WELLKNOWN_TYPES=\
  711. vendor/google.golang.org/protobuf/types/known/anypb \
  712. vendor/google.golang.org/protobuf/types/known/apipb \
  713. vendor/google.golang.org/protobuf/types/known/durationpb \
  714. vendor/google.golang.org/protobuf/types/known/emptypb \
  715. vendor/google.golang.org/protobuf/types/known/fieldmaskpb \
  716. vendor/google.golang.org/protobuf/types/known/sourcecontextpb \
  717. vendor/google.golang.org/protobuf/types/known/structpb \
  718. vendor/google.golang.org/protobuf/types/known/timestamppb \
  719. vendor/google.golang.org/protobuf/types/known/typepb \
  720. vendor/google.golang.org/protobuf/types/known/wrapperspb
  721. # tag:go-specific tag:proto
  722. ### @usage: GO_PROTO_PLUGIN(Name Ext Tool [DEPS dependencies...])
  723. ###
  724. ### Define protoc plugin for GO with given Name that emits extra output with provided extension
  725. ### Ext using Tool. Extra dependencies are passed via DEPS.
  726. macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  727. SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  728. SET_APPEND(GO_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$EXT:File})
  729. PEERDIR(${DEPS})
  730. }
  731. # tag:go-specific tag:proto
  732. macro _GO_PROTOC_PLUGIN_ARGS_BASE_IMPL(Name, Tool, PLUGINS...) {
  733. .CMD=--plugin=protoc-gen-${Name}=${tool:Tool} --${Name}_out=${join=|:PLUGINS}:${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
  734. }
  735. # tag:go-specific tag:proto
  736. macro _GO_PROTOC_PLUGIN_ARGS_BASE_PROXY(Name, Tool, MAP[], PLUGINS[]) {
  737. .CMD=$_GO_PROTOC_PLUGIN_ARGS_BASE_IMPL($Name $Tool $MAP ${pre=plugins=:PLUGINS})
  738. }
  739. # tag:go-specific tag:proto
  740. macro _GO_PROTOC_PLUGIN_ARGS_BASE(Name, Tool, MAP[], PLUGINS[]) {
  741. .CMD=$_GO_PROTOC_PLUGIN_ARGS_BASE_PROXY($Name $Tool MAP ${pre=M:MAP} PLUGINS ${join=|:PLUGINS})
  742. }
  743. # tag:go-specific tag:proto
  744. GO_PROTO_CMDLINE=${cwd;rootdir;input:File} $YMAKE_PYTHON ${input:"build/scripts/go_proto_wrapper.py"} $GO_ARCADIA_PROJECT_PREFIX $GO_CONTRIB_PROJECT_PREFIX ./$PROTO_NAMESPACE $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH ${input;rootrel:File}
  745. # tag:go-specific tag:proto
  746. macro _GO_PROTO_CMD_IMPL(File, OPTS[], OUTS[]) {
  747. .CMD=$GO_PROTO_CMDLINE $OPTS $OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  748. .PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES}
  749. .ADDINCL=FOR proto contrib/libs/protobuf/src
  750. }
  751. # tag:go-specific tag:proto
  752. macro _GO_PROTO_CMD(File) {
  753. .CMD=$_GO_PROTO_CMD_IMPL($File OPTS $GO_PROTO_OPTS OUTS $GO_PROTO_OUTS)
  754. }
  755. # tag:proto
  756. ### @usage: YP_PROTO_YSON(Files... OUT_OPTS Opts...)
  757. ###
  758. ### Genereate .yson.go from .proto using yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen
  759. macro YP_PROTO_YSON(OUT_OPTS[], Files...) {
  760. .CMD=${cwd:BINDIR} $PROTOC --plugin=protoc-gen-custom=${tool:"yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen"} -I=${ARCADIA_ROOT}/${PROTO_NAMESPACE} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} --custom_out="$OUT_OPTS paths=base_name:." --custom_opt="goroot=${GO_TOOLS_ROOT}" ${input:Files} ${output;hide;noauto;nopath;noext;suf=.yson.go:Files}
  761. .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
  762. .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
  763. }
  764. # tag:proto
  765. macro _CPP_PROTO_CMD(File) {
  766. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  767. .SEM=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"} && set_global_flags COMMON_PROTOC_FLAGS -I=$ARCADIA_ROOT -I=$ARCADIA_BUILD_ROOT
  768. .PEERDIR=contrib/libs/protobuf
  769. }
  770. # tag:proto
  771. macro _CPP_VANILLA_PROTO_CMD(File) {
  772. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  773. .PEERDIR=contrib/libs/protobuf_std
  774. }
  775. # tag:proto
  776. macro _CPP_EVLOG_CMD(File) {
  777. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_EV_OUTS ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  778. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  779. }
  780. # tag:proto
  781. macro _CPP_PROTO_EVLOG_CMD(File) {
  782. # process .proto as .ev
  783. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  784. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  785. }
  786. # tag:proto
  787. macro _CPP_CFGPROTO_CMD(File) {
  788. # keep extension in output just as in EV: this is hard-codeded behaviour of protoc for non-.proto extensions
  789. .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"}
  790. .PEERDIR=library/cpp/proto_config/codegen library/cpp/proto_config/protos contrib/libs/protobuf
  791. }
  792. # tag:proto
  793. PY_PROTO_MYPY_ENABLED=yes
  794. 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
  795. # tag:proto tag:python-specific
  796. PY_PROTO_MYPY_SUFFIX=
  797. PY_PROTO_MYPY_PLUGIN=
  798. PY_PROTO_MYPY_PLUGIN_INTERNAL=
  799. # tag:proto tag:python-specific
  800. macro NO_MYPY() {
  801. DISABLE(PY_PROTO_MYPY_ENABLED)
  802. }
  803. # tag:proto tag:python-specific
  804. macro _PY_PROTO_CMD_BASE(File, Suf, Args...) {
  805. .CMD=$PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --python_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE ${input;rootrel:File} ${output;hide;noauto;norel;nopath;noext;suf=$Suf:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $Args
  806. }
  807. # tag:proto tag:python-specific
  808. macro _PY_PROTO_CMD(File) {
  809. .CMD=${cwd;rootdir;input:File} $_PY_PROTO_CMD_BASE($File _pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS $PY_PROTO_MYPY_PLUGIN)
  810. }
  811. # tag:proto tag:python-specific
  812. macro _PY_PROTO_CMD_INTERNAL(File) {
  813. .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)
  814. }
  815. # tag:proto tag:java-specific
  816. JAVA_PROTO_RUNTIME=
  817. # tag:proto tag:java-specific
  818. ### @usage: USE_JAVALITE()
  819. ### Use protobuf-javalite for Java
  820. macro USE_JAVALITE() {
  821. SET(JAVA_PROTO_RUNTIME javalite)
  822. }
  823. # tag:proto tag:java-specific
  824. JAVA_PROTO_RUNTIME_VERSION = 3.18.2
  825. JAVA_PROTO_COMMON_VERSION = 1.12.0
  826. when ($JAVA_PROTO_RUNTIME == "javalite") {
  827. _JAVA_PROTO_OUT_ARG=--java_out=lite:
  828. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION}
  829. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.19.0
  830. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.19.0
  831. }
  832. otherwise {
  833. _JAVA_PROTO_OUT_ARG=--java_out=
  834. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION}
  835. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.26.0
  836. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.26.0
  837. }
  838. # tag:proto tag:java-specific
  839. macro _JAVA_PROTO_CMD(File) {
  840. .CMD=${cwd;rootdir;input:File} $YMAKE_PYTHON ${input:"build/scripts/tared_protoc.py"} --tar-output ${output;norel;nopath;noext;suf=.jsrc:File} --protoc-out-dir $ARCADIA_BUILD_ROOT/java_out $PROTOC -I=./$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_ROOT $_JAVA_PROTO_OUT_ARG$ARCADIA_BUILD_ROOT/java_out ${input;rootrel:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $JAVA_PROTO_ARGS
  841. }
  842. # tag:proto tag:perl-specific tag:deprecated
  843. ### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
  844. ###
  845. ### Generate Perl code from protobuf.
  846. ### In order to use this macro one should predict all outputs protoc will emit from input_proto file and enlist those as outputs.
  847. macro XS_PROTO(File, Dir, Outputs...) {
  848. .CMD=$PROTOC -I=${ARCADIA_ROOT}/${Dir} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} -I=${PROTOBUF_PATH} --perlxs_out=${BINDIR} ${input:File} ${hide;output:Outputs} ${output_include;hide;nopath;noext;suf=.pb.h:File}
  849. PEERDIR(${Dir})
  850. ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir})
  851. }
  852. # tag:proto tag:fbs
  853. ### @usage: PROTO2FBS(InputProto)
  854. ###
  855. ### Produce flatbuf schema out of protobuf description.
  856. macro PROTO2FBS(File) {
  857. .CMD=${cwd:BINDIR} ${tool:"contrib/tools/flatc"} -I . -I ${ARCADIA_ROOT} --proto ${input:File} ${output;hide;nopath;noext:File.fbs} ${kv;hide:"p FBS"} ${kv;hide:"pc yellow"}
  858. }
  859. # tag:proto tag:python-specific
  860. when ($PY_PROTOS_FOR == "yes") {
  861. PEERDIR+=contrib/libs/protobuf/python
  862. }
  863. # tag:python-specific
  864. macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
  865. .CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
  866. .PEERDIR=library/cpp/eventlog/proto
  867. }
  868. # tag:python-specific tag:proto
  869. macro _PY_EVLOG_CMD(File) {
  870. .CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
  871. }
  872. # tag:python-specific tag:proto
  873. macro _PY_EVLOG_CMD_INTERNAL(File) {
  874. .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}"})
  875. }
  876. # tag:java-specific tag:proto
  877. macro _JAVA_EVLOG_CMD(File) {
  878. .CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  879. .PEERDIR=library/cpp/eventlog/proto
  880. }
  881. # tag:sanitize
  882. RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
  883. # tag:sanitize
  884. when ($IS_CROSS_SANITIZE) {
  885. RUN_NO_SANITIZE=
  886. }
  887. YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
  888. XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
  889. RESPFILE_CMD=$YMAKE_PYTHON ${input:"build/scripts/writer.py"}
  890. FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"}
  891. COPY_CMD=$FS_TOOLS copy
  892. LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
  893. REMOVE_FILE=$FS_TOOLS remove
  894. MOVE_FILE=$FS_TOOLS rename
  895. # tag:allocator tag:windows-specific
  896. MSVC_DYNAMICBASE=/DYNAMICBASE
  897. when ($ALLOCATOR == "LF") {
  898. MSVC_DYNAMICBASE=/DYNAMICBASE:NO
  899. }
  900. # tag:sanitize
  901. SANITIZER_CFLAGS=
  902. # tag:proto tag:grpc
  903. ### @usage: GRPC()
  904. ###
  905. ### Emit GRPC code for all .proto files in a PROTO_LIBRARY.
  906. ### This works for all available PROTO_LIBRARY versions (C++, Python 2.x, Pyton 3.x, Java and Go).
  907. macro GRPC() {
  908. # C++
  909. CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp .grpc.pb.cc .grpc.pb.h DEPS contrib/libs/grpc)
  910. # Python
  911. PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/libs/grpc/python contrib/libs/grpc)
  912. # Java
  913. JAVA_PROTO_PLUGIN(grpc_java contrib/tools/protoc/plugins/grpc_java DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  914. }
  915. # tag:fbs
  916. FLATC_FLAGS_VALUE=
  917. ### @usage: FLATC_FLAGS(flags...)
  918. ###
  919. ### Add flags to flatc command line
  920. macro FLATC_FLAGS(FLAGS...) {
  921. SET_APPEND(FLATC_FLAGS_VALUE $FLAGS)
  922. }
  923. # tag:fbs
  924. _PY_FBS_DEPS=contrib/python/flatbuffers
  925. # tag:fbs tag:internal
  926. ### @usage: FBS_TO_PYSRC(output_base_name fbs_files...) # internal
  927. ###
  928. ### Create a tar archive of .py files generated by flatc for Python. Output tar
  929. ### archive will have .fbs.pysrc extension. This .fbs.pysrc extension is specially
  930. ### processed when --add-flatbuf-result flag is specified on the command line
  931. ### for 'ya make ...' (tar archive is extracted to output directory).
  932. macro FBS_TO_PYSRC(OUT_NAME, IN_FBS_FILES...) {
  933. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --python --gen-mutable ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR} ${input:IN_FBS_FILES} && $YMAKE_PYTHON ${input:"build/scripts/tar_sources.py"} --exts .py --input $BINDIR --output ${output;noauto;tared:OUT_NAME.fbs.pysrc} ${kv;hide:"p FP"} ${kv;hide:"pc light-green"} ${kv;hide:"tared_kind nodir"}
  934. }
  935. # tag:fbs tag:go-specific
  936. # Implicit dependencies of generated code for Go
  937. _GO_FLATC_IMPORTS=\
  938. ${GOSTD}/strconv \
  939. vendor/github.com/google/flatbuffers/go
  940. # tag:fbs tag:cpp-specific
  941. macro _CPP_FLATC_CMD(SRC, SRCFLAGS...) {
  942. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/cpp_flatc_wrapper.py"} ${tool:"contrib/tools/flatc"} --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --yandex-maps-iter --gen-object-api --filename-suffix .fbs ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${output;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${input:SRC} ${output;hide;noext;norel:SRC.iter.fbs.h} ${output;noauto;hide;noext;norel:SRC.bfbs} ${kv;hide:"p FL"} ${kv;hide:"pc light-green"}
  943. .PEERDIR=contrib/libs/flatbuffers
  944. }
  945. # tag:fbs tag:cpp-specific
  946. macro _CPP_FLATC64_CMD(SRC, SRCFLAGS...) {
  947. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/cpp_flatc_wrapper.py"} ${tool:"contrib/tools/flatc64"} --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --filename-suffix .fbs64 ${FLATC_FLAGS_VALUE} -I ${ARCADIA_ROOT} -I ${ARCADIA_BUILD_ROOT} -o ${output;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${input:SRC} ${output;noauto;hide;noext;norel:SRC.bfbs64} ${kv;hide:"p FL64"} ${kv;hide:"pc light-green"}
  948. .PEERDIR=contrib/libs/flatbuffers64
  949. }
  950. # tag:fbs tag:go-specific tag:internal
  951. ### @usage: _GO_FLATC_CMD(fbs_file flags...) # internal
  952. ###
  953. ### Create a tar archive of .go files generated by flatc for Go. Output tar archive
  954. ### wiil have .fbs.gosrc extension. This .fbs.gosrc is specially processed when
  955. ### --add-protobuf-result flag is specified on the command line for 'ya make ...'
  956. ### (tar archive is extracted to output directory).
  957. macro _GO_FLATC_CMD(SRC, PACKAGE_NAME) {
  958. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --go --gen-mutable --go-namespace ${PACKAGE_NAME} ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR}/_generated ${input:SRC} && $YMAKE_PYTHON ${input:"build/scripts/postprocess_go_fbs.py"} --input-dir ${BINDIR} --map $_FBS_NAMESPACE_MAP_GLOBAL && $YMAKE_PYTHON ${input:"build/scripts/tar_sources.py"} --flat --input ${BINDIR}/_generated --output ${output;noext;tared:SRC.fbs.gosrc} --exts .go ${kv;hide:"p FG"} ${kv;hide:"pc light-green"} ${kv;hide:"tared_kind nodir"}
  959. .PEERDIR=${_GO_FLATC_IMPORTS}
  960. }
  961. # tag:fbs tag:java-specific tag:internal
  962. ### @usage: _JAVA_FLATC_CMD(fbs_file) # internal
  963. ###
  964. ### Create a tar archive of .java files generated by flatc for Java. Output tar
  965. ### acrchive will have .fbs.jsrc extension. Files with .fbs.jsrc extension will
  966. ### be added to results when --add-flatbuf-result flag is specified on the command
  967. ### line for 'ya make ...'
  968. macro _JAVA_FLATC_CMD(SRC) {
  969. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --java --gen-mutable ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR} ${input:SRC} && $YMAKE_PYTHON ${input:"build/scripts/tar_sources.py"} --input $BINDIR --output ${output;nopath;noext:SRC.fbs.jsrc} --exts .java ${kv;hide:"p FJ"} ${kv;hide:"pc light-green"}
  970. .PEERDIR=contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION}
  971. }
  972. # variables must be defined for all module types to make generate_mf.py work
  973. MODULE_PREFIX=
  974. MODULE_SUFFIX=
  975. NEED_PLATFORM_PEERDIRS=yes
  976. PEERDIR_TEST_TOOL=yes
  977. # tag:python-specific
  978. PYTHON2=no
  979. PYTHON3=no
  980. # tag:python-specific
  981. when (!$ARCADIA_PYTHON_UNICODE_SIZE) {
  982. when ($OS_WINDOWS) {
  983. ARCADIA_PYTHON_UNICODE_SIZE=2
  984. }
  985. otherwise {
  986. ARCADIA_PYTHON_UNICODE_SIZE=4
  987. }
  988. }
  989. ### @usage: _BARE_UNIT # internal
  990. ###
  991. ### The base of all modules describing default bare minimum for all modules.
  992. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  993. module _BARE_UNIT {
  994. .EXTS=.*
  995. .CMD=TOUCH_UNIT
  996. .IGNORED=GO_PROTO_PLUGIN
  997. .NODE_TYPE=Bundle
  998. .PEERDIR_POLICY=as_include
  999. .RESTRICTED=GRPC USE_SKIFF INDUCED_DEPS FUZZ_DICTS FUZZ_OPTS PACK DOCS_DIR DOCS_CONFIG DOCS_VARS YT_SPEC USE_CXX USE_UTIL WHOLE_ARCHIVE PRIMARY_OUTPUT SECONDARY_OUTPUT DEPENDENCY_MANAGEMENT EXCLUDE NO_DOCTESTS EMBED_JAVA_VCS_INFO RESOURCE_FILES PACK_GLOBALS_IN_LIBRARY EXPOSE GLOBAL_DEPS
  1000. .FINAL_TARGET=no
  1001. PEERDIR_TAGS=__EMPTY__
  1002. when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
  1003. PEERDIR+=build/conf_fatal_error
  1004. }
  1005. DEFAULT(MODULE_VERSION)
  1006. DEFAULT(MODULE_PREFIX)
  1007. DEFAULT(MODULE_SUFFIX)
  1008. }
  1009. ### @usage: _BASE_UNIT # internal
  1010. ###
  1011. ### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
  1012. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1013. module _BASE_UNIT: _BARE_UNIT {
  1014. .GLOBAL=_FBS_NAMESPACE_MAP
  1015. PEERDIR_TAGS=CPP_PROTO CPP_FBS CPP_SSQLS CPP_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB
  1016. CPP_PROTO_CMDLINE=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --cpp_out=${CPP_PROTO_PLUGINS}$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT $PROTOC_PLUGIN_STYLEGUIDE ${input;rootrel:File}
  1017. CPP_PROTO_OUTS+=${output;hide;norel;nopath;noext:File.pb.cc} ${output;main;hide;norel;nopath;noext:File.pb.h}
  1018. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
  1019. CPP_EV_OUTS+=${output;hide;norel:File.pb.cc} ${output;hide;norel:File.pb.h}
  1020. when ($PY_PROTOS_FOR == "yes") {
  1021. MACRO_ALIAS(EVLOG_CMD _PY_EVLOG_CMD)
  1022. MACRO_ALIAS(PROTO_CMD _PY_PROTO_CMD)
  1023. }
  1024. otherwise {
  1025. MACRO_ALIAS(EVLOG_CMD _CPP_EVLOG_CMD)
  1026. MACRO_ALIAS(FBS_CMD _CPP_FLATC_CMD)
  1027. when ($BUILD_PROTO_AS_EVLOG == "yes") {
  1028. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_EVLOG_CMD)
  1029. }
  1030. otherwise {
  1031. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_CMD)
  1032. }
  1033. when ($USE_VANILLA_PROTOC == "yes") {
  1034. PROTOC=${tool:"contrib/tools/protoc_std"}
  1035. PROTOC_STYLEGUIDE_OUT=
  1036. PROTOC_PLUGIN_STYLEGUIDE=
  1037. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std
  1038. MACRO_ALIAS(PROTO_CMD _CPP_VANILLA_PROTO_CMD)
  1039. }
  1040. when ($PROTOC_TRANSITIVE_HEADERS == "no") {
  1041. CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
  1042. }
  1043. }
  1044. SANITIZER_DEFINED=no
  1045. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1046. CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
  1047. LDFLAGS+=-fsanitize=$SANITIZER_TYPE
  1048. SANITIZER_DEFINED=yes
  1049. when ($CLANG) {
  1050. CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"}
  1051. LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"}
  1052. }
  1053. }
  1054. when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
  1055. CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1056. LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1057. }
  1058. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1059. CFLAGS+=-fprofile-instr-generate -fcoverage-mapping -DCLANG_COVERAGE
  1060. LDFLAGS+=-fprofile-instr-generate -fcoverage-mapping
  1061. }
  1062. when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
  1063. CFLAGS+=-DNLG_COVERAGE
  1064. }
  1065. when ($GCC) {
  1066. select ($SANITIZER_TYPE) {
  1067. "address" ? {
  1068. LDFLAGS+=-static-libasan
  1069. }
  1070. "undefined" ? {
  1071. LDFLAGS+=-static-libubsan
  1072. }
  1073. "thread" ? {
  1074. PIE=yes
  1075. LDFLAGS+=-static-libtsan
  1076. }
  1077. }
  1078. }
  1079. when ($HARDENING == "yes") {
  1080. when ($CLANG) {
  1081. CFLAGS+=-fstack-protector-all -D_hardening_enabled_
  1082. LDFLAGS+=-z relro -z now -z noexecstack
  1083. PIE=yes
  1084. }
  1085. }
  1086. when ($USE_LTO == "yes") {
  1087. when ($GCC) {
  1088. CFLAGS+=-flto -fno-fat-lto-objects
  1089. LDFLAGS+=-flto
  1090. NO_LTO_CFLAGS=-fno-lto
  1091. }
  1092. when ($CLANG) {
  1093. CFLAGS+=-flto
  1094. LDFLAGS+=-flto
  1095. NO_LTO_CFLAGS=-fno-lto
  1096. }
  1097. }
  1098. when ($USE_THINLTO == "yes") {
  1099. when ($GCC) {
  1100. CFLAGS+=-flto=thin
  1101. LDFLAGS+=-flto=thin
  1102. NO_LTO_CFLAGS=-fno-lto
  1103. }
  1104. when ($CLANG) {
  1105. CFLAGS+=-flto=thin
  1106. LDFLAGS+=-flto=thin
  1107. NO_LTO_CFLAGS=-fno-lto
  1108. }
  1109. }
  1110. when ($CLANG) {
  1111. when ($PGO_ADD == "yes") {
  1112. CFLAGS+=-fprofile-instr-generate
  1113. LDFLAGS+=-fprofile-instr-generate
  1114. }
  1115. when ($PGO_PATH) {
  1116. CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
  1117. LDFLAGS+=-fprofile-instr-use=$PGO_PATH
  1118. }
  1119. }
  1120. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  1121. PEERDIR+=$COMPILER_PLATFORM
  1122. }
  1123. when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
  1124. PEERDIR+=contrib/libs/linux-headers
  1125. }
  1126. # Adding PEERDIR from trigger doesn't always work. In this case it
  1127. # cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl
  1128. # Workaround this issue by setting variable with PEERDIR in trigger
  1129. # and then adding PEERDIR to it's value unconditionally.
  1130. when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1131. _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14
  1132. }
  1133. otherwise {
  1134. _UBUNTU_COMPAT_PEERDIR=
  1135. }
  1136. PEERDIR+=$_UBUNTU_COMPAT_PEERDIR
  1137. when ($NORUNTIME != "yes") {
  1138. PEERDIR+=contrib/libs/cxxsupp
  1139. when ($MAPSMOBI_BUILD_TARGET == "yes") {
  1140. PEERDIR+=build/platform/mapkit
  1141. }
  1142. }
  1143. when ($NOUTIL != "yes") {
  1144. PEERDIR+=util
  1145. }
  1146. when ($MUSL == "yes") {
  1147. CFLAGS += -D_musl_
  1148. LINK_DYN_LIB_FLAGS += --musl
  1149. LINK_SCRIPT_EXE_FLAGS += --musl
  1150. PEERDIR+=contrib/libs/musl/include
  1151. }
  1152. # g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
  1153. # The same problem exists for clang toolchain. On the other hand, the problem
  1154. # doesn't affect cl since it has united C/C++ library and doesn't need
  1155. # proxy C-headers.
  1156. # Disable all C++ headers including proxy C-headers when we use libc++.
  1157. when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
  1158. CXXFLAGS += -nostdinc++
  1159. }
  1160. otherwise {
  1161. CFLAGS += -DUSE_STL_SYSTEM
  1162. }
  1163. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  1164. PEERDIR += build/external_resources/codenavigation
  1165. }
  1166. when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
  1167. CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
  1168. }
  1169. DEFAULT(USE_SSE4 yes)
  1170. when ($NOSSE != "yes") {
  1171. CFLAGS+=$SSE_CFLAGS
  1172. C_DEFINES+=$SSE_DEFINES
  1173. when ($USE_SSE4 == "yes") {
  1174. CFLAGS+=$SSE4_CFLAGS
  1175. C_DEFINES+=$SSE4_DEFINES
  1176. }
  1177. }
  1178. elsewhen ($MSVC != "yes") {
  1179. CFLAGS += -mno-sse
  1180. }
  1181. when ($LIPO == "yes" && $NEED_PLATFORM_PEERDIRS != "no") {
  1182. when ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1183. PEERDIR += build/platform/cctools
  1184. }
  1185. }
  1186. _REGISTER_NO_CHECK_IMPORTS()
  1187. DEFAULT(PACKAGE_PREFIX_ARGS)
  1188. DEFAULT(BYACC_FLAGS -v)
  1189. DEFAULT(SWIG_LANG python)
  1190. DEFAULT(BISON_FLAGS -v)
  1191. DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
  1192. when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
  1193. PEERDIR+=build/platform/binutils
  1194. }
  1195. }
  1196. _LINKER_ID=
  1197. # GCC does not support -fuse-ld with an executable path, only
  1198. # -fuse-ld=bfd or -fuse-ld=gold (or -fuse-ld=lld in later versions).
  1199. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1200. when ($_LINKER_ID in [ "bfd", "gold", "lld" ]) {
  1201. PEERDIR+=build/platform/${_LINKER_ID}
  1202. }
  1203. }
  1204. macro _USE_LINKER_IMPL(LINKER_ID...) {
  1205. SET(_LINKER_ID $LINKER_ID)
  1206. }
  1207. macro _USE_LINKER() {
  1208. _USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
  1209. }
  1210. ### @usage: USE_LINKER_BFD()
  1211. ### Use bfd linker for a program. This doesn't work in libraries
  1212. macro USE_LINKER_BFD() {
  1213. _USE_LINKER_IMPL(bfd)
  1214. }
  1215. ### @usage: USE_LINKER_GOLD()
  1216. ### Use gold linker for a program. This doesn't work in libraries
  1217. macro USE_LINKER_GOLD() {
  1218. _USE_LINKER_IMPL(gold)
  1219. }
  1220. ### @usage: USE_LINKER_LLD()
  1221. ### Use lld linker for a program. This doesn't work in libraries
  1222. macro USE_LINKER_LLD() {
  1223. _USE_LINKER_IMPL(lld)
  1224. }
  1225. COMMON_LINK_SETTINGS=
  1226. LINK_ADDITIONAL_SECTIONS=
  1227. LINK_ADDITIONAL_SECTIONS_COMMAND=
  1228. when ($COMMON_LINK_SETTINGS == "yes") {
  1229. when ($_LINKER_ID == "lld" || $_LINKER_ID == "gold") {
  1230. LDFLAGS += -Wl,--gdb-index
  1231. }
  1232. when ($EMBED_LINKER_CREF == "yes") {
  1233. LDFLAGS+=-Wl,--cref ${tmp;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1234. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
  1235. }
  1236. elsewhen ($DUMP_LINKER_CREF == "yes") {
  1237. LDFLAGS+=-Wl,--cref ${output;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1238. }
  1239. when ($EMBED_LINKER_MAP == "yes") {
  1240. LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1241. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1242. }
  1243. elsewhen ($DUMP_LINKER_MAP == "yes") {
  1244. LDFLAGS+=-Wl,-Map=${output;rootrel;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1245. }
  1246. when ($USE_MKL == "yes") {
  1247. NOPLATFORM=yes
  1248. }
  1249. when (($USE_EAT_MY_DATA == "yes") && ($WIN32 != "yes") && ($DARWIN != "yes") && ($OS_ANDROID != "yes") && ($OS_IOS != "yes")) {
  1250. PEERDIR+=contrib/libs/libeatmydata/autocheck_wrapper
  1251. }
  1252. when ($USE_ARCADIA_LIBM == "yes") {
  1253. PEERDIR+=contrib/libs/libm
  1254. }
  1255. when ($USE_ARCADIA_LIBM == "no") {
  1256. C_SYSTEM_LIBRARIES+=-lm
  1257. }
  1258. when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
  1259. when ($ALLOCATOR in [ "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "GOOGLE", "J", "LF", "LF_YT", "LF_DBG", "B", "BM", "C", "LOCKLESS", "YT", "MIM", "HU" ]) {
  1260. PEERDIR+=library/cpp/malloc/system
  1261. }
  1262. }
  1263. otherwise {
  1264. select ($ALLOCATOR) {
  1265. "MIM" ? {
  1266. PEERDIR+=library/cpp/malloc/mimalloc
  1267. }
  1268. "HU" ? {
  1269. PEERDIR+=library/cpp/malloc/hu
  1270. }
  1271. "TCMALLOC_256K" ? {
  1272. PEERDIR+=library/cpp/malloc/tcmalloc
  1273. PEERDIR+=contrib/libs/tcmalloc
  1274. }
  1275. "TCMALLOC_SMALL_BUT_SLOW" ? {
  1276. PEERDIR+=library/cpp/malloc/tcmalloc
  1277. PEERDIR+=contrib/libs/tcmalloc/small_but_slow
  1278. }
  1279. "TCMALLOC_NUMA_256K" ? {
  1280. PEERDIR+=library/cpp/malloc/tcmalloc
  1281. PEERDIR+=contrib/libs/tcmalloc/numa_256k
  1282. }
  1283. "TCMALLOC_NUMA_LARGE_PAGES" ? {
  1284. PEERDIR+=library/cpp/malloc/tcmalloc
  1285. PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
  1286. }
  1287. "TCMALLOC" ? {
  1288. PEERDIR+=library/cpp/malloc/tcmalloc
  1289. PEERDIR+=contrib/libs/tcmalloc/default
  1290. }
  1291. "GOOGLE" ? {
  1292. PEERDIR+=library/cpp/malloc/galloc
  1293. }
  1294. "J" ? {
  1295. when ($WIN32 == "yes") {
  1296. PEERDIR+=library/cpp/malloc/system
  1297. }
  1298. otherwise {
  1299. PEERDIR+=library/cpp/malloc/jemalloc
  1300. }
  1301. }
  1302. "LF" ? {
  1303. PEERDIR+=library/cpp/lfalloc
  1304. }
  1305. "LF_YT" ? {
  1306. PEERDIR+=library/cpp/lfalloc/yt
  1307. }
  1308. "LF_DBG" ? {
  1309. PEERDIR+=library/cpp/lfalloc/dbg
  1310. }
  1311. "B" ? {
  1312. PEERDIR+=library/cpp/balloc
  1313. }
  1314. "BM" ? {
  1315. PEERDIR+=library/cpp/balloc_market
  1316. }
  1317. "C" ? {
  1318. PEERDIR+=library/cpp/malloc/calloc
  1319. }
  1320. "LOCKLESS" ? {
  1321. PEERDIR+=library/cpp/malloc/lockless
  1322. }
  1323. "YT" ? {
  1324. PEERDIR+=library/cpp/ytalloc/impl
  1325. }
  1326. }
  1327. }
  1328. when ($ALLOCATOR == "SYSTEM") {
  1329. PEERDIR+=library/cpp/malloc/system
  1330. }
  1331. when ($WERROR != "no") {
  1332. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  1333. C_WARNING_OPTS += $WERROR_FLAG
  1334. }
  1335. }
  1336. when ($ICC == "yes") {
  1337. PEERDIR+=contrib/libs/intel/core
  1338. }
  1339. when ($WITH_VALGRIND == "yes") {
  1340. PEERDIR+=contrib/libs/valgrind
  1341. }
  1342. }
  1343. when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
  1344. LINK_ADDITIONAL_SECTIONS_COMMAND+= \
  1345. $OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
  1346. }
  1347. _SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/:PEERS}
  1348. when ($OS_WINDOWS == "yes") {
  1349. _SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/:PEERS}
  1350. }
  1351. elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1352. _SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/:PEERS}
  1353. }
  1354. LINK_OR_COPY_SO_CMD=
  1355. when ($SO_OUTPUTS == "yes") {
  1356. LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
  1357. LDFLAGS+=$RPATH_GLOBAL
  1358. }
  1359. # tag:restrinced tag:DLL
  1360. ### $usage: WITH_DYNAMIC_LIBS() # restricted
  1361. ###
  1362. ### Include dynamic libraries as extra PROGRAM/DLL outputs
  1363. macro WITH_DYNAMIC_LIBS() {
  1364. ENABLE(SO_OUTPUTS)
  1365. }
  1366. # tag:internal
  1367. ### $usage: REAL_LINK_EXE_IMPL(peers...) # internal
  1368. macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1369. .CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1370. }
  1371. # tag:internal
  1372. ### $usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1373. macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1374. .CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
  1375. }
  1376. # tag:internal
  1377. ### $usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
  1378. macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1379. .CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
  1380. }
  1381. # tag:internal
  1382. ### $usage: LINK_EXE_IMPL(peers...) # internal
  1383. macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1384. .CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1385. }
  1386. # tag:internal
  1387. ### $usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1388. macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1389. .CMD=$LINK_EXEC_DYN_LIB_CMDLINE
  1390. }
  1391. # tag:internal
  1392. ### @usage: _LINK_UNIT # internal
  1393. ###
  1394. ### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
  1395. module _LINK_UNIT: _BASE_UNIT {
  1396. .EXTS=.o .obj .supp .tidyjson .ld
  1397. .CMD=LINK_EXE
  1398. .ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  1399. .NODE_TYPE=Program
  1400. .PEERDIR_POLICY=as_build_from
  1401. .FINAL_TARGET=yes
  1402. .ALIASES=RES_REQUIREMENTS=PY_REQUIREMENTS
  1403. DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
  1404. _USE_LINKER()
  1405. #link with libunwind manually
  1406. when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
  1407. PEERDIR += contrib/libs/cxxsupp
  1408. }
  1409. when ($USE_LIBCXXRT == "yes") {
  1410. PEERDIR += contrib/libs/cxxsupp/libcxxrt
  1411. }
  1412. ENABLE(COMMON_LINK_SETTINGS)
  1413. CHECK_PROVIDES()
  1414. }
  1415. MODULE_TYPE=UNKNOWN
  1416. macro ADD_CLANG_TIDY() {
  1417. ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy)
  1418. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json)
  1419. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json)
  1420. }
  1421. # tag:internal
  1422. ### @usage: _BASE_PROGRAM # internal
  1423. ###
  1424. ### The base of all programs. It adds dependencies to make final artefact complete and runnable.
  1425. module _BASE_PROGRAM: _LINK_UNIT {
  1426. .SYMLINK_POLICY=EXE
  1427. .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
  1428. .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1429. SET(MODULE_TYPE PROGRAM)
  1430. when ($OS_IOS == "yes") {
  1431. EXTS+=.ios.interface
  1432. }
  1433. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  1434. MODULE_SUFFIX=.exe
  1435. }
  1436. when ($TIDY == "yes") {
  1437. MODULE_SUFFIX=.tidyjson
  1438. }
  1439. when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
  1440. PEERDIR+=contrib/libs/asmlib
  1441. }
  1442. when ($MUSL == "yes") {
  1443. when ($MUSL_LITE == "yes") {
  1444. PEERDIR += contrib/libs/musl
  1445. }
  1446. otherwise {
  1447. PEERDIR += contrib/libs/musl/full
  1448. }
  1449. }
  1450. DEFAULT(CPU_CHECK yes)
  1451. when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
  1452. CPU_CHECK = no
  1453. }
  1454. when ($CPU_CHECK == "yes") {
  1455. PEERDIR += library/cpp/cpuid_check
  1456. }
  1457. when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
  1458. PEERDIR += library/cpp/execprofile/autostart
  1459. }
  1460. when ($SANITIZER_DEFINED == "yes") {
  1461. PEERDIR += contrib/libs/cxxsupp/libsan
  1462. }
  1463. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1464. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1465. }
  1466. when ($IDE_MSVS == "yes") {
  1467. PEERDIR+=build/scripts/c_templates
  1468. }
  1469. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1470. LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1471. }
  1472. }
  1473. CPP_PROGRAM_SEM=add_executable $MODDIR $REALPRJNAME ${hide:TARGET} ${hide:AUTO_INPUT} \
  1474. && vcs_info \
  1475. && target_link_flags PUBLIC $LDFLAGS $LDFLAGS_GLOBAL $OBJADDE_LIB $OBJADDE \
  1476. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1477. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS
  1478. ### @usage: PROGRAM([progname])
  1479. ###
  1480. ### Regular program module.
  1481. ### If name is not specified it will be generated from the name of the containing project directory.
  1482. module PROGRAM: _BASE_PROGRAM {
  1483. .ALIASES=REQUIREMENTS=CC_REQUIREMENTS
  1484. .SEM=CPP_PROGRAM_SEM
  1485. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1486. ADD_CLANG_TIDY()
  1487. SET(MODULE_LANG CPP)
  1488. }
  1489. # tag:python-specific tag:deprecated tag:internal
  1490. module _PY2_PROGRAM: _BASE_PY_PROGRAM {
  1491. .ALIASES=REQUIREMENTS=PY_REQUIREMENTS
  1492. SET(MODULE_LANG PY2)
  1493. # Looks like we cannot avoid copy-paste util ymake supports multiple inheritance
  1494. # We need to attach coverage.extractor to every py_program target, except pytest targets
  1495. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1496. }
  1497. # tag:python-specific tag:deprecated
  1498. ### @usage: PY2_PROGRAM([progname]) # deprecated
  1499. ###
  1500. ### Deprecated. Use PY3_PROGRAM instead.
  1501. ### Python 2.x binary program. Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  1502. ### If name is not specified it will be generated from the name of the containing project directory.
  1503. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  1504. ###
  1505. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1506. module PY2_PROGRAM: _PY2_PROGRAM {
  1507. when ($FAIL_PY2 == "yes") {
  1508. _OK=no
  1509. }
  1510. otherwise {
  1511. PEERDIR+=build/rules/py2_deprecation
  1512. }
  1513. ASSERT(_OK You are using deprecated Python2-only code (PY2_PROGRAM). Please consider rewriting to Python 3.)
  1514. }
  1515. # tag:python-specific
  1516. ### @usage: NO_EXTENDED_SOURCE_SEARCH()
  1517. ###
  1518. ### Prevent module using in extended python source search.
  1519. ### Use the macro if module contains python2-only files (or other python sources which shouldn't be imported by python3 interpreter)
  1520. ### which resides in the same directories with python 3 usefull code. contrib/python/future is a example.
  1521. ### Anyway, preferred way is to move such files into separate dir and don't use this macro at all.
  1522. ###
  1523. ### Also see: https://docs.yandex-team.ru/ya-make/manual/python/vars#y_python_extended_source_search for details
  1524. macro NO_EXTENDED_SOURCE_SEARCH() {
  1525. SET(NO_EXTENDED_SOURCE_SEARCH yes)
  1526. }
  1527. # tag:python-specific
  1528. ### @usage: PY3_PROGRAM([progname])
  1529. ###
  1530. ### Python 3.x binary program. Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  1531. ### If name is not specified it will be generated from the name of the containing project directory.
  1532. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules.
  1533. ###
  1534. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1535. multimodule PY3_PROGRAM {
  1536. module PY3_BIN: PY3_PROGRAM_BIN {
  1537. .PEERDIRSELF=PY3_BIN_LIB
  1538. .IGNORED=RESOURCE RESOURCE_FILES PEERDIR TASKLET_REG
  1539. # Notify pybuild to skip almost all PY_SRCS arguments except MAIN
  1540. ENABLE(PROCESS_PY_MAIN_ONLY)
  1541. _PY_PROGRAM()
  1542. }
  1543. module PY3_BIN_LIB: PY3_LIBRARY {
  1544. .IGNORED=RESTRICT_LICENSES
  1545. # Notify pybuild to skip all python main function definitions
  1546. ENABLE(IGNORE_PY_MAIN)
  1547. _REQUIRE_EXPLICIT_LICENSE()
  1548. }
  1549. }
  1550. # tag:ycr-specific
  1551. macro _YCR_GENERATE_CONFIGS_INTL(Package, App, Configs...) {
  1552. .CMD=${tool:"maps/infra/yacare/scripts/make_configs"} $Package $App ${cwd:BINDIR} ${output;hide;pre=debian/$Package/:Configs}
  1553. }
  1554. # tag:ycr-specific
  1555. macro _YCR_GENERATE_CONFIGS(Package, App) {
  1556. .CMD=$_YCR_GENERATE_CONFIGS_INTL($Package $App ${pre=etc/yandex/maps/yacare/:App.conf} ${pre=etc/template_generator/templates/etc/logrotate.d/:App} ${pre=etc/nginx/sites-available/:App.conf} ${pre=etc/syslog-ng/conf-available/:App.conf} ${pre=etc/template_generator/config.d/:App.yaml} ${pre=/juggler/checks-available/yacare_;suf=/MANIFEST.json:App} ${pre=etc/yandex/maps/roquefort/:App.conf} ${pre=usr/lib/yandex/maps/yacare/lua/init_worker.d/rate_limiter_:App.lua} ${pre=usr/lib/yandex/maps/yacare/lua/init_worker.d/tvm_:App.lua} ${pre=usr/lib/yandex/maps/yacare/lua/init.d/tvm_:App.lua} ${pre=etc/template_generator/templates/etc/supervisor/conf-available/:App.conf} ${pre=etc/template_generator/templates/etc/yandex/unified_agent/conf.d/04_yacare_:App.yml})
  1557. }
  1558. # tag:ycr-specific
  1559. when ($TIDY=="yes") {
  1560. YCR_LINK_EXE=$LINK_EXE
  1561. }
  1562. otherwise {
  1563. YCR_LINK_EXE=$LINK_EXE && $_YCR_GENERATE_CONFIGS($MODULE_PREFIX$REALPRJNAME $MODULE_PREFIX$REALPRJNAME)
  1564. }
  1565. # tag:ycr-specific
  1566. ### @usage: YCR_PROGRAM([progname])
  1567. ###
  1568. ### yacare-specific program module. Generates yacare configs in addition to producing the program.
  1569. ### If name is not specified it will be generated from the name of the containing project directory.
  1570. module YCR_PROGRAM: PROGRAM {
  1571. .CMD=YCR_LINK_EXE
  1572. }
  1573. # tag:ycr-specific tag:python-specific
  1574. macro _PYCR_GENERATE_CONFIGS_INTL(Package, App, Configs...) {
  1575. .CMD=${tool:"maps/infra/pycare/scripts/make_configs"} $Package $App ${cwd:BINDIR} ${output;hide;pre=configs/:Configs}
  1576. }
  1577. # tag:ycr-specific tag:python-specific
  1578. macro _PYCR_GENERATE_CONFIGS(Package, App) {
  1579. .CMD=$_PYCR_GENERATE_CONFIGS_INTL($Package $App ${pre=etc/nginx/sites-available/:App.conf} ${pre=etc/template_generator/templates/etc/logrotate.d/:App} ${pre=etc/syslog-ng/conf-available/:App.conf} ${pre=etc/yandex/maps/roquefort/:App.conf} ${pre=etc/template_generator/config.d/:App.yaml} ${pre=etc/supervisor/conf-available/:App.conf} ${pre=etc/template_generator/templates/etc/yandex/unified_agent/conf.d/04_pycare_:App.yml})
  1580. }
  1581. # tag:ycr-specific tag:python-specific
  1582. PYCR_LINK_EXE=$LINK_EXE && $_PYCR_GENERATE_CONFIGS($MODULE_PREFIX$REALPRJNAME $MODULE_PREFIX$REALPRJNAME)
  1583. # tag:ycr-specific tag:python-specific
  1584. ### @usage: PYCR_PROGRAM([progname])
  1585. ###
  1586. ### pycare-specific program module. Generates pycare configs in addition to producing the program.
  1587. ### If name is not specified it will be generated from the name of the containing project directory.
  1588. module PYCR_PROGRAM: PY3_PROGRAM_BIN {
  1589. .CMD=PYCR_LINK_EXE
  1590. }
  1591. ### @usage: EXPORTS_SCRIPT(exports_file)
  1592. ###
  1593. ### Specify exports script within PROGRAM, DLL and DLL-derived modules.
  1594. ### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
  1595. ### The other option use EXPORTS parameter of the DLL module itself.
  1596. ###
  1597. ### @see: [DLL](#module_DLL)
  1598. macro EXPORTS_SCRIPT(Arg) {
  1599. SET(EXPORTS_FILE $Arg)
  1600. }
  1601. ### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
  1602. ###
  1603. ### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
  1604. macro NO_EXPORT_DYNAMIC_SYMBOLS() {
  1605. ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
  1606. }
  1607. ### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
  1608. ###
  1609. ### Export all non-hidden symbols as dynamic when linking a PROGRAM.
  1610. macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
  1611. # Dummy: default behaviour
  1612. ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
  1613. }
  1614. ### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
  1615. ###
  1616. ### Specifies name of a script for custom link step. The scripts
  1617. ### should be placed in the build/scripts directory and are subject to
  1618. ### review by devtools@.
  1619. macro CUSTOM_LINK_STEP_SCRIPT(Name) {
  1620. SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
  1621. }
  1622. ### @usage: _BASE_UNITTEST # internal
  1623. ###
  1624. ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
  1625. module _BASE_UNITTEST: _BASE_PROGRAM {
  1626. .FINAL_TARGET=no
  1627. .NODE_TYPE=Program
  1628. .ALLOWED=YT_SPEC
  1629. when ($UT_SKIP_EXCEPTIONS == "yes") {
  1630. C_DEFINES+=-DUT_SKIP_EXCEPTIONS
  1631. }
  1632. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1633. }
  1634. UNITTEST_SEM=$CPP_PROGRAM_SEM && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME
  1635. # tag:test
  1636. ### @usage: UNITTEST([name])
  1637. ###
  1638. ### Unit test module based on library/cpp/testing/unittest.
  1639. ### It is recommended not to specify the name.
  1640. ###
  1641. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
  1642. module UNITTEST: _BASE_UNITTEST {
  1643. .SEM=UNITTEST_SEM
  1644. PEERDIR(library/cpp/testing/unittest_main)
  1645. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1646. SET(MODULE_LANG CPP)
  1647. }
  1648. # tag:yt-specific tag:test
  1649. ### @usage: YT_UNITTEST([name])
  1650. ###
  1651. ### YT Unit test module based on mapreduce/yt/library/utlib
  1652. module YT_UNITTEST: _BASE_UNITTEST {
  1653. PEERDIR(mapreduce/yt/library/utlib)
  1654. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1655. }
  1656. # tag:test
  1657. ### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
  1658. ###
  1659. ### Generic unit test module.
  1660. module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
  1661. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1662. }
  1663. # tag:cpp-specific tag:test
  1664. ### @usage: GTEST([name])
  1665. ###
  1666. ### Unit test module based on library/cpp/testing/gtest.
  1667. ### It is recommended not to specify the name.
  1668. ###
  1669. ### Documentation: https://docs.yandex-team.ru/arcadia-cpp/cpp_test
  1670. module GTEST: _BASE_UNITTEST {
  1671. .SEM=UNITTEST_SEM
  1672. PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
  1673. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
  1674. SET(MODULE_LANG CPP)
  1675. }
  1676. USE_AFL=no
  1677. # tag:fuzzing
  1678. ### @usage: FUZZ()
  1679. ###
  1680. ### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
  1681. ### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
  1682. ### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
  1683. ###
  1684. ### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
  1685. ###
  1686. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1687. module FUZZ: _BASE_PROGRAM {
  1688. .NODE_TYPE=Program
  1689. .FINAL_TARGET=no
  1690. .ALLOWED=FUZZ_DICTS FUZZ_OPTS
  1691. DEFAULT(LIBFUZZER_PATH contrib/libs/libfuzzer12)
  1692. when ($USE_AFL == "no") {
  1693. PEERDIR+=$LIBFUZZER_PATH
  1694. }
  1695. when ($USE_AFL == "yes") {
  1696. PEERDIR+=$LIBFUZZER_PATH/afl
  1697. }
  1698. when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
  1699. PEERDIR+=devtools/nofuzz
  1700. }
  1701. ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
  1702. }
  1703. # tag:ios-specific
  1704. PACK_IOS_CMD=
  1705. when ($OS_IOS && $BUILD_IOS_APP) {
  1706. PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
  1707. }
  1708. LINK_BOOSTTEST_CMD=
  1709. BOOST_TEST_TYPE_STRING=
  1710. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1711. LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
  1712. BOOST_TEST_TYPE_STRING=no.test
  1713. }
  1714. otherwise {
  1715. LINK_BOOSTTEST_CMD=$LINK_EXE
  1716. BOOST_TEST_TYPE_STRING=boost.test
  1717. }
  1718. # tag:deprecated
  1719. ### @usage: BOOSTTEST([name]) #deprecated
  1720. ###
  1721. ### Test module based on boost/test/unit_test.hpp.
  1722. ### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
  1723. ### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
  1724. module BOOSTTEST: _BASE_PROGRAM {
  1725. .NODE_TYPE=Program
  1726. .FINAL_TARGET=no
  1727. .CMD=LINK_BOOSTTEST_CMD
  1728. PEERDIR(library/cpp/testing/boost_test)
  1729. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1730. MODULE_SUFFIX=.a
  1731. }
  1732. elsewhen ($OS_IOS && $BUILD_IOS_APP) {
  1733. PEERDIR+=devtools/boosttest_ios_wrapper/library
  1734. MODULE_SUFFIX=.ios.tar
  1735. }
  1736. ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
  1737. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1738. }
  1739. # tag:deprecated
  1740. ### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated
  1741. ###
  1742. ### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
  1743. module BOOSTTEST_WITH_MAIN: BOOSTTEST {
  1744. PEERDIR(library/cpp/testing/boost_test_main)
  1745. }
  1746. FUZZ_DICTS_VALUE=
  1747. ### @usage: FUZZ_DICTS(path1 [path2...])
  1748. ###
  1749. ### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
  1750. ### Libfuzzer and AFL use a single syntax for dictionary descriptions.
  1751. ### Should only be used in FUZZ modules.
  1752. ###
  1753. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1754. macro FUZZ_DICTS(Data...) {
  1755. SET_APPEND(FUZZ_DICTS_VALUE $Data)
  1756. }
  1757. FUZZ_OPTS_VALUE=
  1758. ### @usage: FUZZ_OPTS(opt1 [Opt2...])
  1759. ###
  1760. ### Overrides or adds options to the corpus mining and fuzzer run.
  1761. ### Currently supported only Libfuzzer, so you should use the options for it.
  1762. ### Should only be used in FUZZ modules.
  1763. ###
  1764. ### @example:
  1765. ###
  1766. ### FUZZ_OPTS (
  1767. ### -max_len=1024
  1768. ### -rss_limit_mb=8192
  1769. ### )
  1770. ###
  1771. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1772. macro FUZZ_OPTS(Data...) {
  1773. SET_APPEND(FUZZ_OPTS_VALUE $Data)
  1774. }
  1775. # tag:yt-specific tag:test
  1776. TEST_YT_SPEC_VALUE=
  1777. ### @usage: YT_SPEC(path1 [path2...])
  1778. ###
  1779. ### Allows you to specify json-files with YT task and operation specs,
  1780. ### which will be used to run test node in the YT.
  1781. ### Test must be marked with ya:yt tag.
  1782. ### Files must be relative to the root of Arcadia.
  1783. ###
  1784. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1785. macro YT_SPEC(Data...) {
  1786. SET_APPEND(TEST_YT_SPEC_VALUE $Data)
  1787. }
  1788. # tag:test
  1789. TEST_SRCS_VALUE=
  1790. ### @usage: TEST_SRCS(Files...)
  1791. ###
  1792. ### 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.
  1793. ###
  1794. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1795. macro TEST_SRCS(Tests...) {
  1796. SET_APPEND(TEST_SRCS_VALUE $Tests)
  1797. }
  1798. macro DISABLE_DATA_VALIDATION() {
  1799. DISABLE(VALIDATE_DATA)
  1800. }
  1801. # tag:test
  1802. TEST_DATA_VALUE=
  1803. ### @usage: DATA([path...])
  1804. ###
  1805. ### Specifies the path to the data necessary test.
  1806. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
  1807. ### In the latter case resource will be brought to the working directory of the test before it is started
  1808. ###
  1809. ### Used only inside TEST modules.
  1810. ###
  1811. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1812. macro DATA(Data...) {
  1813. SET_APPEND(TEST_DATA_VALUE $Data)
  1814. ADD_CHECK(check.data $Data)
  1815. }
  1816. # tag:test
  1817. TEST_TAGS_VALUE=
  1818. ### @usage: TAG ([tag...])
  1819. ###
  1820. ### Each test can have one or more tags used to filter tests list for running.
  1821. ### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
  1822. ###
  1823. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
  1824. macro TAG(Tags...) {
  1825. SET_APPEND(TEST_TAGS_VALUE $Tags)
  1826. }
  1827. # tag:test
  1828. TEST_REQUIREMENTS_VALUE=
  1829. ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
  1830. ###
  1831. ### Allows you to specify the requirements of the test.
  1832. ###
  1833. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1834. macro REQUIREMENTS(Tags...) {
  1835. SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
  1836. }
  1837. # tag:test
  1838. TEST_ENV_VALUE=
  1839. ### @usage: ENV(key[=value])
  1840. ###
  1841. ### Sets env variable key to value (gets value from system env by default).
  1842. macro ENV(Data...) {
  1843. SET_APPEND(TEST_ENV_VALUE ${quo:Data})
  1844. }
  1845. ### @usage: CONFTEST_LOAD_POLICY_LOCAL()
  1846. ###
  1847. ### Loads conftest.py files in a way that pytest does it
  1848. macro CONFTEST_LOAD_POLICY_LOCAL() {
  1849. SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
  1850. }
  1851. # tag:test
  1852. TEST_RECIPES_VALUE=
  1853. ### @usage: USE_RECIPE(path [arg1 arg2...])
  1854. ###
  1855. ### Provides prepared environment via recipe for test.
  1856. ###
  1857. ### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
  1858. macro USE_RECIPE(Data...) {
  1859. SET_APPEND(TEST_RECIPES_VALUE $Data)
  1860. SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
  1861. }
  1862. # tag:python-specific tag:test
  1863. TEST_PYTHON_PATH_VALUE=
  1864. # tag:python-specific tag:test
  1865. ### @usage: PYTHON_PATH(Path)
  1866. ###
  1867. ### Set path to Python that will be used to runs scripts in tests
  1868. macro PYTHON_PATH(Path) {
  1869. SET(TEST_PYTHON_PATH_VALUE $Path)
  1870. }
  1871. # tag:test
  1872. SKIP_TEST_VALUE=
  1873. ### @usage: SKIP_TEST(Reason)
  1874. ###
  1875. ### Skip the suite defined by test module. Provide a reason to be output in test execution report.
  1876. macro SKIP_TEST(Reason...) {
  1877. SET(SKIP_TEST_VALUE $Reason)
  1878. }
  1879. # tag:test
  1880. LINT_LEVEL_VALUE=extended
  1881. ### @usage: NO_LINT()
  1882. ###
  1883. ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
  1884. macro NO_LINT() {
  1885. SET(LINT_LEVEL_VALUE none)
  1886. }
  1887. ### @usage: LINT(<none|base|strict>)
  1888. ###
  1889. ### Set linting levem for sources of the module
  1890. macro LINT(level) {
  1891. SET(LINT_LEVEL_VALUE $level)
  1892. }
  1893. # tag:python-specific tag:test
  1894. ### @usage: NO_DOCTESTS()
  1895. ###
  1896. ### Disable doctests in PY[|3|23_]TEST
  1897. macro NO_DOCTESTS() {
  1898. ENV(YA_PYTEST_DISABLE_DOCTEST="yes")
  1899. }
  1900. # tag:python-specific tag:test
  1901. ### @usage: _BASE_PYTEST # internal
  1902. ###
  1903. ### Base logic of Python 2.x py.test modules: common module properties and dependencies.
  1904. module _BASE_PYTEST: _BASE_PY_PROGRAM {
  1905. .NODE_TYPE=Program
  1906. .FINAL_TARGET=no
  1907. .ALLOWED=YT_SPEC NO_DOCTESTS
  1908. when ($USE_ARCADIA_PYTHON == "yes") {
  1909. PEERDIR+=library/python/pytest
  1910. }
  1911. when ($USE_ARCADIA_PYTHON == "no") {
  1912. MODULE_SUFFIX=.pkg.fake
  1913. PEERDIR+=library/python/pytest/empty
  1914. }
  1915. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1916. }
  1917. # tag:python-specific tag:deprecated tag:test
  1918. ### @usage: PYTEST_BIN() #deprecated
  1919. ###
  1920. ### Same as PY2TEST. Don't use this, use PY2TEST instead.
  1921. module PYTEST_BIN: _BASE_PYTEST {
  1922. .NODE_TYPE=Program
  1923. SETUP_PYTEST_BIN()
  1924. }
  1925. # tag:python-specific tag:test
  1926. ### @usage: PY2TEST([name])
  1927. ###
  1928. ### The test module for Python 2.x based on py.test
  1929. ###
  1930. ### This module is compatible only with PYTHON2-tagged modules and selects peers from multimodules accordingly.
  1931. ### This module is compatible with non-Arcadia Python builds.
  1932. ###
  1933. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#python
  1934. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1935. module PY2TEST: PYTEST_BIN {
  1936. when ($FAIL_PY2 == "yes") {
  1937. _OK=no
  1938. }
  1939. otherwise {
  1940. PEERDIR+=build/rules/py2_deprecation
  1941. }
  1942. SET(MODULE_LANG PY2)
  1943. ASSERT(_OK You are using deprecated Python2-only code (PY2TEST). Please consider rewriting to Python 3.)
  1944. }
  1945. # tag:python-specific tag:deprecated tag:test
  1946. ### @usage: PY3TEST_BIN() #deprecated
  1947. ###
  1948. ### Same as PY3TEST. Don't use this, use PY3TEST instead.
  1949. module PY3TEST_BIN: _BASE_PY3_PROGRAM {
  1950. .NODE_TYPE=Program
  1951. .FINAL_TARGET=no
  1952. .ALLOWED=YT_SPEC NO_DOCTESTS
  1953. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1954. SET(MODULE_LANG PY3)
  1955. SETUP_PYTEST_BIN()
  1956. PEERDIR+=library/python/pytest
  1957. }
  1958. # tag:python-specific tag:test
  1959. ### Disable submodules with the specified name(s).
  1960. ### Unlike EXCLUDE_TAGS this variable:
  1961. ### - affects all projects in the build;
  1962. ### - filter by module name and ignore MODULE_TAG.
  1963. EXCLUDE_SUBMODULES=PY3TEST_LIBRARY
  1964. # tag:python-specific tag:test
  1965. ### @usage: PY3TEST([name])
  1966. ###
  1967. ### The test module for Python 3.x based on py.test
  1968. ###
  1969. ### This module is compatible only with PYTHON3-tagged modules and selects peers from multimodules accordingly.
  1970. ### This module is only compatible with Arcadia Python build (to avoid tests duplication from Python2/3-tests). For non-Arcadia python use PYTEST.
  1971. ###
  1972. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1973. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1974. multimodule PY3TEST {
  1975. module PY3TEST_PROGRAM: PY3TEST_BIN {
  1976. .FINAL_TARGET=yes
  1977. }
  1978. module PY3TEST_LIBRARY: _PY3_LIBRARY {
  1979. PEERDIR+=library/python/pytest
  1980. _REQUIRE_EXPLICIT_LICENSE()
  1981. }
  1982. }
  1983. # tag:cpp-specific tag:test
  1984. module CPP_STYLE_TEST: PY3TEST_BIN {
  1985. DEPENDS(contrib/libs/clang12/tools/clang-format)
  1986. PEERDIR+=library/python/cpp_test
  1987. }
  1988. macro STYLE(Globs...) {
  1989. _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
  1990. _STYLE(${STYLE_SRCS_GLOB})
  1991. }
  1992. # tag:cpp-specific tag:deprecated tag:test
  1993. ### @usage: GTEST_UGLY([name])
  1994. ###
  1995. ### Deprecated, do not use in new projects. Use GTEST instead.
  1996. ###
  1997. ### The test module based on gtest (contrib/libs/gtest contrib/libs/gmock).
  1998. ### Use public documentation on gtest for details.
  1999. ###
  2000. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2001. module GTEST_UGLY: _BASE_PROGRAM {
  2002. .NODE_TYPE=Program
  2003. .FINAL_TARGET=no
  2004. PEERDIR(contrib/restricted/googletest/googlemock contrib/restricted/googletest/googletest)
  2005. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gtest)
  2006. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2007. }
  2008. # tag:test
  2009. ### @usage: EXECTEST()
  2010. ###
  2011. ### Module definition of generic test that executes a binary.
  2012. ### Use macro RUN to specify binary to run.
  2013. ###
  2014. ### @example:
  2015. ###
  2016. ### EXECTEST()
  2017. ### OWNER(g:yatool)
  2018. ###
  2019. ### RUN(
  2020. ### cat input.txt
  2021. ### )
  2022. ### DATA(
  2023. ### arcadia/devtools/ya/test/tests/exectest/data
  2024. ### )
  2025. ### DEPENDS(
  2026. ### devtools/dummy_arcadia/cat
  2027. ### )
  2028. ### TEST_CWD(devtools/ya/test/tests/exectest/data)
  2029. ### END()
  2030. ###
  2031. ### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
  2032. ###
  2033. ### @see: [RUN()](#macro_RUN)
  2034. module EXECTEST: _BARE_UNIT {
  2035. .NODE_TYPE=Program
  2036. .FINAL_TARGET=no
  2037. .ALLOWED=YT_SPEC
  2038. .RESTRICTED=FORK_TEST_FILES
  2039. SET(MODULE_SUFFIX .pkg.fake)
  2040. SETUP_EXECTEST()
  2041. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2042. }
  2043. # tag:cpp-specific tag:test
  2044. ### @usage: Y_BENCHMARK([benchmarkname])
  2045. ###
  2046. ### Benchmark test based on the library/cpp/testing/benchmark.
  2047. ###
  2048. ### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
  2049. module Y_BENCHMARK: PROGRAM {
  2050. .SEM=CPP_PROGRAM_SEM
  2051. PEERDIR(library/cpp/testing/benchmark/main)
  2052. SET(MODULE_LANG CPP)
  2053. }
  2054. # tag:cpp-specific tag:test
  2055. ### @usage: G_BENCHMARK([benchmarkname])
  2056. ###
  2057. ### Benchmark test based on the google benchmark.
  2058. ###
  2059. ### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
  2060. module G_BENCHMARK: _BASE_PROGRAM {
  2061. PEERDIR(library/cpp/testing/gbenchmark_main)
  2062. ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
  2063. SET(MODULE_LANG CPP)
  2064. }
  2065. # tag:test
  2066. TEST_ROOT=$(TESTS_DATA_ROOT)
  2067. RESULT_MAX_FILE=0
  2068. STRIP_FILES=--dont-strip-files
  2069. VERIFY_RESULTS=--verify-results
  2070. ADDITIONAL_PATH=
  2071. # set for tests variables to fill it by YA_DEV or YA
  2072. YA_ROOT=ya
  2073. when ($YA_DEV == "yes") {
  2074. YA_ROOT=ya-dev
  2075. }
  2076. # tag:test
  2077. ### @usage: UNITTEST_FOR(path/to/lib)
  2078. ###
  2079. ### Convenience extension of UNITTEST module.
  2080. ### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
  2081. ### path/to/lib is the path to the directory with the LIBRARY project.
  2082. ###
  2083. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2084. module UNITTEST_FOR: UNITTEST {
  2085. .SEM=UNITTEST_SEM
  2086. PEERDIR(ADDINCL $UNITTEST_DIR)
  2087. SRCDIR($UNITTEST_DIR)
  2088. }
  2089. ### @usage: _LIBRARY # internal
  2090. ###
  2091. ### Base module definition for all libraries.
  2092. ### Contains basic logic like module properties, default variable values etc.
  2093. ### All libraries similar to C++-libraries should be inherited from it.
  2094. module _LIBRARY: _BASE_UNIT {
  2095. .CMD=LINK_LIB
  2096. .NODE_TYPE=Library
  2097. .PEERDIR_POLICY=as_include
  2098. .EXTS=.o .obj .a .mf .supp .tidyjson .ld
  2099. .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  2100. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2101. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
  2102. .FINAL_TARGET=no
  2103. .GLOBAL_CMD=GLOBAL_LINK_LIB
  2104. .GLOBAL_EXTS=.o .obj .tidyjson
  2105. .ALIASES=RES_REQUIREMENTS=PY_REQUIREMENTS
  2106. GLOBAL_SUFFIX=.global$MODULE_SUFFIX
  2107. #TODO: Remove this hack (really we do not need add fake src at all)
  2108. ENABLE(NEED_ADD_FAKE_SRC)
  2109. _REQUIRE_EXPLICIT_LICENSE(contrib/deprecated contrib/libs contrib/restricted contrib/python)
  2110. CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
  2111. when ($USE_MKL == "yes") {
  2112. NOPLATFORM=yes
  2113. }
  2114. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2115. MODULE_PREFIX=
  2116. MODULE_SUFFIX=.lib
  2117. }
  2118. otherwise {
  2119. when ($TIDY == "yes") {
  2120. MODULE_PREFIX=
  2121. MODULE_SUFFIX=.tidyjson
  2122. }
  2123. otherwise {
  2124. MODULE_PREFIX=lib
  2125. MODULE_SUFFIX=.a
  2126. }
  2127. }
  2128. when ($WERROR != "no") {
  2129. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  2130. C_WARNING_OPTS += $WERROR_FLAG
  2131. }
  2132. }
  2133. when ($WITH_VALGRIND == "yes") {
  2134. PEERDIR+=contrib/libs/valgrind
  2135. }
  2136. when ($USE_ARCADIA_LIBM == "yes") {
  2137. PEERDIR+=contrib/libs/libm
  2138. }
  2139. }
  2140. CPP_LIBRARY_SEM=add_library ${MODDIR} $REALPRJNAME ${hide:TARGET} ${hide:AUTO_INPUT} \
  2141. && library_fake_marker FAKE_MODULE ${FAKE_MODULE} \
  2142. && consumer_link_library PUBLIC $CMAKE_LINK_TARGET \
  2143. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2144. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2145. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS \
  2146. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  2147. CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:REALPRJNAME} $REALPRJNAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
  2148. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2149. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2150. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS \
  2151. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  2152. CMAKE_FIND_PKG=
  2153. CMAKE_LINK_TARGET=$REALPRJNAME
  2154. CMAKE_FIND_PKG_COMP=
  2155. CONAN_REQUIRE=
  2156. ### @usage: LIBRARY()
  2157. ###
  2158. ### The regular static library module.
  2159. ###
  2160. ### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
  2161. ### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
  2162. ###
  2163. ### This is C++ library, and it selects peers from multimodules accordingly.
  2164. ###
  2165. ### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
  2166. ### In order to use library in tests PEERDIR it to link into tests.
  2167. ### If you think you need to distribute static library please contact devtools@ for assistance.
  2168. module LIBRARY: _LIBRARY {
  2169. .GLOBAL=_AARS _PROGUARD_RULES
  2170. .ALIASES=REQUIREMENTS=CC_REQUIREMENTS
  2171. .SEM=CPP_LIBRARY_SEM
  2172. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  2173. when ($CMAKE_PACKAGE_COMPONENT != "") {
  2174. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  2175. }
  2176. when ($CMAKE_PACKAGE != "") {
  2177. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  2178. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && consumer_link_library PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && ignored
  2179. }
  2180. when ($CONAN_REFERENCE != "") {
  2181. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  2182. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && consumer_link_library PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && ignored
  2183. }
  2184. when ($CONAN_PKG_OPTS != "") {
  2185. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  2186. }
  2187. when ($OPENSOURCE_EXPORT == "no") {
  2188. CPP_LIBRARY_SEM=ignored
  2189. }
  2190. when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
  2191. PEERDIR+=$CPP_PROTOBUF_PEERS
  2192. }
  2193. SET(MODULE_TYPE LIBRARY)
  2194. SET(MODULE_LANG CPP)
  2195. ADD_CLANG_TIDY()
  2196. }
  2197. # tag:internal
  2198. ### @usage: _BARE_MODULE() # internal
  2199. ###
  2200. ### Remove unwanted dependencies for "empty" library module
  2201. macro _BARE_MODULE() {
  2202. SET(NEED_PLATFORM_PEERDIRS no)
  2203. SET(PEERDIR_TEST_TOOL no)
  2204. DISABLE(WITH_VALGRIND)
  2205. NO_CODENAVIGATION()
  2206. NO_PLATFORM()
  2207. NO_RUNTIME()
  2208. NO_UTIL()
  2209. NO_CLANG_TIDY()
  2210. }
  2211. # tag:internal
  2212. ### @usage: _BARE_LINK_MODULE() # internal
  2213. ###
  2214. ### Remove unwanted dependencies for "empty" link module
  2215. macro _BARE_LINK_MODULE() {
  2216. _BARE_MODULE()
  2217. ALLOCATOR(FAKE)
  2218. }
  2219. # tag:internal
  2220. ### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
  2221. ###
  2222. ### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
  2223. ### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
  2224. macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
  2225. SRCS($USE_CONDITIONAL_SRCS)
  2226. }
  2227. # XXX: dirty hack for correct LDFLAGS passing
  2228. RESOURCES_LIBRARY_LINK=$TOUCH_UNIT ${hide:LDFLAGS_GLOBAL} ${hide:LDFLAGS}
  2229. RESOURCES_LIBRARY_SEM=ignored
  2230. ### @usage: RESOURCES_LIBRARY()
  2231. ###
  2232. ### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
  2233. ### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
  2234. ###
  2235. ### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
  2236. module RESOURCES_LIBRARY: _BARE_UNIT {
  2237. .CMD=RESOURCES_LIBRARY_LINK
  2238. .SEM=RESOURCES_LIBRARY_SEM
  2239. .ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
  2240. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS PEERDIR SPLIT_DWARF
  2241. .NODE_TYPE=Library
  2242. .PEERDIR_POLICY=as_include
  2243. .EXTS=.o .obj .a .mf .supp .tidyjson .ld
  2244. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2245. MODULE_SUFFIX=.pkg.fake
  2246. ENABLE(NEED_ADD_FAKE_SRC)
  2247. WITHOUT_LICENSE_TEXTS()
  2248. }
  2249. FAT_OBJECT_ARGS=
  2250. FAT_OBJECT_OUTS=
  2251. macro _FAT_OBJECT_ARGS_BASE(Flag, Lib) {
  2252. .CMD=$Flag=$Lib
  2253. }
  2254. macro PACK_GLOBALS_IN_LIBRARY() {
  2255. SET_APPEND(FAT_OBJECT_ARGS $_FAT_OBJECT_ARGS_BASE(--globals-lib, ${BINDIR}/${pre=$MODULE_PREFIX:REALPRJNAME.globals.a}))
  2256. SET_APPEND(FAT_OBJECT_OUTS \${output;hide;noauto;norel;nopath;noext;pre=$MODULE_PREFIX;suf=$BINDIR:REALPRJNAME.globals.a})
  2257. }
  2258. when ($OS_ANDROID != "yes") {
  2259. LINK_FAT_OBJECT_CMD=$LINK_FAT_OBJECT
  2260. }
  2261. otherwise {
  2262. LINK_FAT_OBJECT_CMD=$LINK_FAT_OBJECT_LIBRARY
  2263. }
  2264. ### @usage: FAT_OBJECT()
  2265. ###
  2266. ### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2267. ### static libraries, local (from own SRCS) and global (from peers') object files.
  2268. ###
  2269. ### Designed for use in XCode projects for iOS.
  2270. module FAT_OBJECT: LIBRARY {
  2271. .ALLOWED=PACK_GLOBALS_IN_LIBRARY
  2272. .CMD=LINK_FAT_OBJECT_CMD
  2273. .PEERDIR_POLICY=as_build_from
  2274. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2275. MODULE_SUFFIX=.global.lib
  2276. }
  2277. elsewhen ($OS_ANDROID == "yes") {
  2278. MODULE_SUFFIX=.a
  2279. }
  2280. otherwise {
  2281. MODULE_SUFFIX=.o
  2282. }
  2283. _USE_LINKER()
  2284. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2285. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2286. DISABLE(NEED_ADD_FAKE_SRC)
  2287. SRCS(build/scripts/_fake_src.cpp)
  2288. }
  2289. ### @usage: RECURSIVE_LIBRARY()
  2290. ###
  2291. ### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2292. ### from static libraries, local (from own SRCS) and global (from peers') object files.
  2293. ###
  2294. ### Designed for use in XCode projects for iOS.
  2295. module RECURSIVE_LIBRARY: LIBRARY {
  2296. .CMD=LINK_RECURSIVE_LIBRARY
  2297. .PEERDIR_POLICY=as_build_from
  2298. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2299. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2300. DISABLE(NEED_ADD_FAKE_SRC)
  2301. SRCS(build/scripts/_fake_src.cpp)
  2302. }
  2303. _SONAME=
  2304. macro _ADD_DYNLYB_SEM(Libname) {
  2305. .SEM=add_library ${MODDIR} ${Libname} SHARED ${hide:TARGET} ${hide:AUTO_INPUT} && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && target_include_directories PRIVATE $_C__INCLUDE_OWNED && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && vcs_info
  2306. }
  2307. CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($REALPRJNAME)
  2308. ### @usage: DLL_UNIT # internal
  2309. ###
  2310. ### Base module for all dynamically linked libraries as final artifacts.
  2311. ### Contains all general logic for such kind of modules. Supports versioning and export files.
  2312. ### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
  2313. module DLL_UNIT: _LINK_UNIT {
  2314. .CMD=LINK_DYN_LIB
  2315. .SEM=CPP_DYN_LIBRARY_SEM
  2316. .NODE_TYPE=Library
  2317. .SYMLINK_POLICY=SO
  2318. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2319. .ALLOWED=WHOLE_ARCHIVE
  2320. DYNAMIC_LINK=yes
  2321. ALLOCATOR(FAKE)
  2322. SET(MODULE_TYPE DLL)
  2323. SET(MODULE_TAG DLL)
  2324. SET(MODULE_LANG CPP)
  2325. ADD_CLANG_TIDY()
  2326. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2327. MODULE_SUFFIX=.dll
  2328. }
  2329. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2330. MODULE_PREFIX=lib
  2331. MODULE_SUFFIX=.dylib
  2332. }
  2333. elsewhen ($TIDY == "yes") {
  2334. MODULE_PREFIX=
  2335. MODULE_SUFFIX=.tidyjson
  2336. }
  2337. otherwise {
  2338. MODULE_PREFIX=lib
  2339. MODULE_SUFFIX=.so
  2340. }
  2341. # This by now replicates ymake's bahavior. We'll get rid of SONAME setting in ymake and fix this code alltogether
  2342. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2343. when ($MODULE_VERSION) {
  2344. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2345. }
  2346. _SONAME=$SONAME$MODULE_VERSION
  2347. when ($LINUX == "yes") {
  2348. # '-z notext' is needed for linking mkl into shared libraries
  2349. LDFLAGS += -Wl,-z,notext
  2350. when ($_NO_FIX_ELF != "yes") {
  2351. LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
  2352. }
  2353. }
  2354. when ($DARWIN == "yes") {
  2355. LDFLAGS += -undefined dynamic_lookup
  2356. }
  2357. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  2358. PEERDIR+=library/cpp/testing/dump_clang_coverage
  2359. }
  2360. when ($IDE_MSVS == "yes") {
  2361. PEERDIR+=build/scripts/c_templates
  2362. }
  2363. }
  2364. # tag:python-specific
  2365. ### @usage: PY_ANY_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2366. ###
  2367. ### The Python external module for any versio of Arcadia or system Python.
  2368. ### 1. major_ver and minor_ver must be integers.
  2369. ### 2. The resulting .so will have the prefix "lib".
  2370. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2371. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2372. ###
  2373. ### Note: Use PYTHON2_MODULE()/PYTHON3_MODULE() in order to PEERDIR proper version of PY23_NATIVE_LIBRARY.
  2374. ### Do not PEERDIR any PY*_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2375. ###
  2376. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2377. module PY_ANY_MODULE: DLL_UNIT {
  2378. .SEM=CPP_DYN_LIBRARY_SEM
  2379. when ($MSVC != "yes" && $DARWIN != "yes") {
  2380. LDFLAGS+= -Wl,-Bsymbolic
  2381. }
  2382. when ($USE_ARCADIA_PYTHON == "no") {
  2383. when ($USE_SYSTEM_PYTHON) {
  2384. PEERDIR+=build/platform/python
  2385. }
  2386. otherwise {
  2387. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2388. LDFLAGS+=$PYTHON_LIBRARIES
  2389. }
  2390. }
  2391. }
  2392. # This by now replicates ymake's bahavior. We'll get rid of SONAME setting in ymake and fix this code alltogether
  2393. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2394. when ($MODULE_VERSION) {
  2395. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2396. }
  2397. _SONAME=$SONAME$MODULE_VERSION
  2398. # -bundle
  2399. when ($DARWIN == "yes") {
  2400. LDFLAGS+=-flat_namespace
  2401. }
  2402. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2403. MODULE_PREFIX=
  2404. MODULE_SUFFIX=.pyd
  2405. }
  2406. otherwise {
  2407. MODULE_PREFIX=
  2408. MODULE_SUFFIX=.so
  2409. }
  2410. .RESTRICTED=USE_PYTHON2 USE_PYTHON3 PY_SRCS PY_MAIN
  2411. }
  2412. # tag:python-specific
  2413. ### @usage: PY2MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2414. ###
  2415. ### The Python external module for Python2 and any system Python
  2416. ### 1. major_ver and minor_ver must be integers.
  2417. ### 2. The resulting .so will have the prefix "lib".
  2418. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2419. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2420. ###
  2421. ### Note: this module will always PEERDIR Python2 version of PY23_NATIVE_LIBRARY.
  2422. ### Do not PEERDIR PY2_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2423. ###
  2424. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2425. module PY2MODULE: PY_ANY_MODULE {
  2426. PYTHON2_MODULE()
  2427. SET(MODULE_LANG PY2)
  2428. .RESTRICTED=PYTHON3_MODULE PYTHON3_ADDINCL
  2429. }
  2430. # tag:python-specific
  2431. ### @usage: PY3MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2432. ###
  2433. ### The Python external module for Python3 and any system Python
  2434. ### 1. major_ver and minor_ver must be integers.
  2435. ### 2. The resulting .so will have the prefix "lib".
  2436. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2437. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2438. ###
  2439. ### Note: this module will always PEERDIR Python3 version of PY23_NATIVE_LIBRARY.
  2440. ### Do not PEERDIR PY3_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2441. ###
  2442. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2443. module PY3MODULE: PY_ANY_MODULE {
  2444. PYTHON3_MODULE()
  2445. SET(MODULE_LANG PY3)
  2446. .RESTRICTED=PYTHON2_MODULE PYTHON2_ADDINCL
  2447. }
  2448. # tag:python-specific
  2449. ### @usage: PYTHON2_MODULE()
  2450. ###
  2451. ### Use in PY_ANY_MODULE to set it up for Python 2.x.
  2452. macro PYTHON2_MODULE() {
  2453. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2454. PEERDIR+=contrib/tools/python/lib
  2455. }
  2456. PYTHON2_ADDINCL()
  2457. }
  2458. # tag:python-specific
  2459. ### @usage: PYTHON3_MODULE()
  2460. ###
  2461. ### Use in PY_ANY_MODULE to set it up for Python 3.x.
  2462. macro PYTHON3_MODULE() {
  2463. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2464. PEERDIR+=contrib/tools/python3/lib
  2465. }
  2466. PYTHON3_ADDINCL()
  2467. }
  2468. # tag:r-specific
  2469. ### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2470. ###
  2471. ### The external module for R language.
  2472. ### 1. major_ver and minor_ver must be integers.
  2473. ### 2. The resulting .so will have the prefix "lib".
  2474. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2475. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2476. module R_MODULE: DLL_UNIT {
  2477. .SEM=CPP_DYN_LIBRARY_SEM
  2478. when ($DARWIN == "yes") {
  2479. LDFLAGS+=-flat_namespace -dynamiclib
  2480. }
  2481. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2482. MODULE_PREFIX=lib
  2483. MODULE_SUFFIX=.dll
  2484. }
  2485. ADDINCL(contrib/libs/r-lang)
  2486. }
  2487. ### @usage: DYNAMIC_LIBRARY_FROM(Paths)
  2488. ###
  2489. ### Use specified libraries as sources of DLL
  2490. macro DYNAMIC_LIBRARY_FROM(Path...) {
  2491. PEERDIR($Path)
  2492. WHOLE_ARCHIVE($Path)
  2493. }
  2494. ### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2495. ###
  2496. ### Dynamic library module defintion.
  2497. ### 1. major_ver and minor_ver must be integers.
  2498. ### 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
  2499. ### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
  2500. ###
  2501. ### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
  2502. module DLL: DLL_UNIT {
  2503. .SEM=CPP_DYN_LIBRARY_SEM
  2504. SET(MAKE_ONLY_SHARED_LIB yes)
  2505. SET(MODULE_LANG CPP)
  2506. when ($OS_WINDOWS) {
  2507. MODULE_SUFFIX=.dll
  2508. }
  2509. # TODO: Make it possible to use this syntax
  2510. # DEFAULT(DLL_FOR_DIR no)
  2511. ### FIXME: XXX
  2512. ###when ($DLL_FOR_DIR != "no") {
  2513. ### SRCDIR($DLL_FOR_DIR)
  2514. ### ADDINCL($DLL_FOR_DIR)
  2515. ###}
  2516. }
  2517. ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
  2518. module DLL_TOOL: DLL {
  2519. .SEM=CPP_DYN_LIBRARY_SEM
  2520. # ymake resolves only program nodes as tools.
  2521. .NODE_TYPE=Program
  2522. }
  2523. ### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2524. ###
  2525. ### Executable dynamic library module defintion.
  2526. ### 1. major_ver and minor_ver must be integers.
  2527. ### 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
  2528. ### 3. PREFIX allows you to change the prefix of the output file.
  2529. module SO_PROGRAM: DLL {
  2530. .CMD=LINK_EXEC_DYN_LIB
  2531. SET(MODULE_TYPE PROGRAM)
  2532. MODULE_PREFIX=
  2533. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2534. MODULE_SUFFIX=.exe
  2535. }
  2536. otherwise {
  2537. MODULE_SUFFIX=
  2538. }
  2539. }
  2540. DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
  2541. # tag:internal
  2542. ### @usage: DEV_DLL_PROXY() # internal
  2543. ###
  2544. ### The use of this module is strictly prohibited!!!
  2545. ### This is a temporary and project-specific solution.
  2546. module DEV_DLL_PROXY: _BARE_UNIT {
  2547. .NODE_TYPE=Library
  2548. .EXTS=.so .dll .dylib .mf
  2549. .CMD=DLL_PROXY_CMD_MF
  2550. DYNAMIC_LINK=yes
  2551. when ($OS_WINDOWS == "yes") {
  2552. MODULE_SUFFIX=.dll
  2553. }
  2554. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2555. MODULE_PREFIX=lib
  2556. MODULE_SUFFIX=.dylib$MODULE_VERSION
  2557. }
  2558. otherwise {
  2559. MODULE_PREFIX=lib
  2560. MODULE_SUFFIX=.so$MODULE_VERSION
  2561. }
  2562. }
  2563. # tag:internal
  2564. ### @usage: DLL_PROXY() # internal
  2565. ###
  2566. ### The use of this module is strictly prohibited!!!
  2567. ### This is a temporary and project-specific solution.
  2568. module DLL_PROXY: DEV_DLL_PROXY {
  2569. .EXTS=.so .dylib .lib .mf
  2570. .PROXY=yes
  2571. .PEERDIR_POLICY=as_build_from
  2572. SET(PEERDIR_TAGS DLL __EMPTY__)
  2573. when ($OS_WINDOWS == "yes") {
  2574. MODULE_SUFFIX=.lib
  2575. }
  2576. }
  2577. # tag:internal
  2578. ### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
  2579. ###
  2580. ### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
  2581. ### This it needed to transfer their outputs through the library to PROGRAM
  2582. ### or dependent DLL/DYNAMIC_LIBRARY.
  2583. ###
  2584. ### Note: this is temporary solution until support of `super-global` variables come
  2585. ### which will enable transfer of some properies though final targets like DLLs.
  2586. macro DYNAMIC_DEPS(Path...) {
  2587. # PEERDIR as macro completely ignored in place where this macro applies
  2588. SET_APPEND(PEERDIR $Path)
  2589. }
  2590. # tag:internal
  2591. ### @usage: DYNAMIC_LIBRARY() # internal
  2592. ###
  2593. ### The use of this module is strictly prohibited except LGPL-related opensourcing
  2594. ### This provides linkable DLL module which brings its results to programs and tests
  2595. ### for seamless tesing and packaging
  2596. multimodule DYNAMIC_LIBRARY {
  2597. module DLL_BIN: DLL {
  2598. .PROXY=yes
  2599. .IGNORED=PROVIDES
  2600. SET(MODULE_TAG DLL)
  2601. }
  2602. module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
  2603. .CMD=TOUCH_UNIT_MF
  2604. .PEERDIRSELF=DLL_BIN
  2605. .IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
  2606. .ALLOWED=DYNAMIC_DEPS
  2607. SET(PEERDIR_TAGS DLL_LIB __EMPTY__)
  2608. _BARE_MODULE()
  2609. DYNAMIC_LINK=yes
  2610. MODULE_SUFFIX=.pkg.fake
  2611. PEERDIR+=build/platform/local_so
  2612. RESTRICT_PATH(contrib devtools/dummy_arcadia MSG Use of this module type outside contrib/libs is prohibited)
  2613. # disable credits generation for static library
  2614. SET(CREDITS_FLAGS)
  2615. }
  2616. }
  2617. ### @usage: GLOBAL_SRCS(filenames...)
  2618. ###
  2619. ### Make all source files listed as GLOBAL.
  2620. ### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
  2621. ### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
  2622. ### recognized for GLOBAL_SRCS in contrast to SRCS macro.
  2623. ###
  2624. ### @example:
  2625. ### Consider the file to ya.make:
  2626. ###
  2627. ### LIBRARY()
  2628. ### GLOBAL_SRCS(foo.cpp bar.cpp)
  2629. ### END()
  2630. ###
  2631. ### @see: [SRCS()](#macro_SRCS)
  2632. macro GLOBAL_SRCS(Files...) {
  2633. SRCS(${pre=GLOBAL :Files})
  2634. }
  2635. ### @usage: ALL_SRCS([GLOBAL] filenames...)
  2636. ###
  2637. ### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
  2638. ### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
  2639. ### as the first argument and is equivalent to call to SRCS macro otherwise.
  2640. ###
  2641. ### @example:
  2642. ###
  2643. ### LIBRARY()
  2644. ### SET(MAKE_IT_GLOBAL GLOBAL)
  2645. ### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
  2646. ### END()
  2647. ###
  2648. ### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
  2649. macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
  2650. SRCS(${pre=$GLOBAL :Files})
  2651. }
  2652. ### @usage: _DLL_COMPATIBLE_LIBRARY # internal
  2653. ###
  2654. ### Base module to place DLLs into multimodules back to back with libraries.
  2655. ### In order to function properly all modules in multimodule shall have the
  2656. ### same set of arguments. So this module is just library that accepts but
  2657. ### ignores all DLL arguments.
  2658. module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
  2659. }
  2660. @import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
  2661. # as SRCS in packages use macro BUNDLE_SRCS!
  2662. PACKED_PACKAGE_ARGS=
  2663. PACKED_PACKAGE_EXT=
  2664. ### @usage: PACK(archive_type)
  2665. ###
  2666. ### 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`
  2667. ###
  2668. ### Is not allowed other module types than PACKAGE().
  2669. ###
  2670. ### @see: [PACKAGE()](#module_PACKAGE)
  2671. macro PACK(Ext) {
  2672. SET(PACKED_PACKAGE_EXT $Ext)
  2673. }
  2674. PACKAGE_STRICT_VALUE=
  2675. macro PACKAGE_STRICT() {
  2676. SET(PACKAGE_STRICT_VALUE yes)
  2677. }
  2678. ### @usage: PACKAGE(name)
  2679. ###
  2680. ### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
  2681. ### 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.
  2682. ### The data can be optionally packed if macro PACK() is used.
  2683. ###
  2684. ### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
  2685. ###
  2686. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2687. ###
  2688. ### @see: [PACK()](#macro_PACK)
  2689. module PACKAGE: _BASE_UNIT {
  2690. .CMD=TOUCH_PACKAGE_MF
  2691. .PEERDIR_POLICY=as_build_from
  2692. .ALL_INS_TO_OUT=yes
  2693. .FINAL_TARGET=yes
  2694. .ALLOWED=PACK
  2695. SET(MODULE_SUFFIX .pkg.fake)
  2696. SET(DONT_RESOLVE_INCLUDES yes)
  2697. NO_PLATFORM()
  2698. when ($PACKED_PACKAGE_EXT) {
  2699. PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
  2700. }
  2701. SET(NEED_PLATFORM_PEERDIRS no)
  2702. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL
  2703. }
  2704. TOUCH_GROUP=$TOUCH_PACKAGE ${kv;hide:"p CI"}
  2705. ### @usage: CI_GROUP()
  2706. ###
  2707. ### Module collects what is described directly inside it transitively by PEERDIRs.
  2708. ### No particular layout of built artifacts is implied. This module is needed primarilly for CI dependency analysis and may not trigger builds at all.
  2709. ###
  2710. ### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
  2711. module CI_GROUP: _BARE_UNIT {
  2712. .CMD=TOUCH_GROUP
  2713. .PEERDIR_POLICY=as_build_from
  2714. .ALL_INS_TO_OUT=yes
  2715. .FINAL_TARGET=yes
  2716. .RESTRICTED=SRCS
  2717. MODULE_SUFFIX=.ci.pkg.fake
  2718. PEERDIR_TAGS=CPP_PROTO PY3 PY3_NATIVE YQL_UDF_SHARED __EMPTY__ DOCBOOK JAR_RUNNABLE DLL
  2719. }
  2720. TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
  2721. TOUCH_DOCS=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p DC"} ${kv;hide:"pc light-cyan"} $TARGET
  2722. TOUCH_DOCS_MF=$TOUCH_DOCS && $GENERATE_MF
  2723. # tag:proto
  2724. ### @usage: RESOLVE_PROTO()
  2725. ###
  2726. ### Enable include resolving within UNIONs and let system .proto being resolved
  2727. ### among .proto/.gztproto imports
  2728. ###
  2729. ### Note: it is currently impossible to enbale resolving only for .proto, so resolving is enabled for all supported files
  2730. ### also we only add ADDINCL for stock protobuf. So use this macro with care: it may cause resolving problems those are
  2731. ### to be addressed by either ADDINCLs or marking them as TEXT. Please contact devtools for details.
  2732. macro RESOLVE_PROTO() {
  2733. SET(DONT_RESOLVE_INCLUDES no)
  2734. ADDINCL(FOR proto $PROTOBUF_PATH)
  2735. }
  2736. ### @usage: UNION(name)
  2737. ###
  2738. ### Collection of PEERDIR dependencies, files and artifacts.
  2739. ### UNION doesn't build its peers, just provides those to modules depending on it.
  2740. ### When specied in DEPENDS() macro the UNION is transitively closed, building all its peers and providing those by own paths (without adding this module path like PACKAGE does).
  2741. ###
  2742. ### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
  2743. ###
  2744. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2745. module UNION: _BASE_UNIT {
  2746. .ALL_INS_TO_OUT=yes
  2747. .FINAL_TARGET=no
  2748. NO_PLATFORM()
  2749. SET(MODULE_SUFFIX .pkg.fake)
  2750. SET(DONT_RESOLVE_INCLUDES yes)
  2751. .CMD=TOUCH_UNIT_MF
  2752. SET(NEED_PLATFORM_PEERDIRS no)
  2753. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCBOOK JAR_RUNABLE PY3_BIN DLL
  2754. }
  2755. # tag:python-specific
  2756. module _PY_PACKAGE: UNION {
  2757. .EXTS=.py
  2758. .ALL_INS_TO_OUT=yes
  2759. .ALLOWED=GRPC USE_SKIFF
  2760. ENABLE(PY_PROTOS_FOR)
  2761. SET(PEERDIR_TAGS PY_PROTO)
  2762. SET(DONT_RESOLVE_INCLUDES no)
  2763. }
  2764. # tag:python-specific tag:deprecated tag:internal
  2765. ### @usage: PY_PACKAGE(name) # internal, deprecated
  2766. ###
  2767. ### This is module created via PY_PROTOS_FOR() macro
  2768. module PY_PACKAGE: _PY_PACKAGE {
  2769. .FINAL_TARGET=yes
  2770. }
  2771. # tag:internal
  2772. ### @usage: _SET_FIRST_VALUE(name args...) # interanl
  2773. ###
  2774. ### This macro sets the value of `name` vraiable to the value of next argument
  2775. macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
  2776. SET($NAME $VALUE)
  2777. }
  2778. # tag:internal
  2779. macro _EVAL_HIDE_TOOLS(ARGS...) {
  2780. .CMD=${tool;hide:ARGS}
  2781. }
  2782. # tag:internal
  2783. macro _EVAL_HIDE_INPUTS(ARGS...) {
  2784. .CMD=${input;hide:ARGS}
  2785. }
  2786. # tag:docs
  2787. _DOCS_USE_PLANTUML=no
  2788. _DOCS_EXTRA_TOOLS=
  2789. _DOCS_EXTRA_INPUTS=
  2790. _DOCS_ENV=
  2791. _DOCS_KV=${kv;hide:"p DO"} ${kv;hide:"pc light-cyan"} ${kv;hide:"show_out yes"}
  2792. _DOCS_PLANTUML_ENV=\
  2793. ${env:"JAVA_PATH=$JDK_RESOURCE_GLOBAL/bin/java"} \
  2794. ${env:"PLANTUML_PATH=${ARCADIA_BUILD_ROOT}/contrib/tools/plantuml/plantuml.run.cp.jar"} \
  2795. ${env:"_JAVA_OPTIONS=-Dsun.awt.fontconfig=$BINDIR/fontconfig.properties"} \
  2796. ${env:"LANG=en_US.UTF-8"} \
  2797. ${env:"LC_ALL=C.UTF-8"}
  2798. _DOCS_BOOK_CMD=$TOUCH_DOCS_MF
  2799. _DOCS_LIB_CMD=$TOUCH_DOCS_MF
  2800. _DOCS_VARS_FLAG=
  2801. _DOCS_COMMON_PROCESS_DEPS=
  2802. _DOCS_COMMON_LIB_PROCESS_DEPS=
  2803. _DOCS_YFM_OUTPUT_FORMAT=
  2804. _DOCS_YFM_BOOK_OUTPUT_FORMAT=--output-format html --allowHTML
  2805. _DOCS_YFM_LIB_OUTPUT_FORMAT=--output-format md
  2806. _DOCS_YFM_BOOK_PROCESS_DEPS=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/extract_docs.py"} --skip-prefix $ARCADIA_BUILD_ROOT --dest-dir $BINDIR/__s ${rootrel:PEERS}
  2807. _DOCS_COMMON_CMDLINE_PREFIX=\
  2808. ${cwd:ARCADIA_ROOT} $FS_TOOLS copy_all_files $_DOCS_DIR_VALUE $BINDIR/__s $_DOCS_SRCS_VALUE \
  2809. && $_DOCS_COMMON_PROCESS_DEPS \
  2810. && $YMAKE_PYTHON ${input:"build/scripts/copy_files_to_dir.py"} --dest-dir $BINDIR/__s --skip-prefix $ARCADIA_ROOT --skip-prefix $ARCADIA_BUILD_ROOT ${input;context=TEXT:INCLUDE_SRCS}
  2811. _DOCS_YFM_BOOK_CMDLINIE=\
  2812. $_DOCS_COMMON_CMDLINE_PREFIX \
  2813. && $YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} $YFM_TOOL_RESOURCE_GLOBAL/yfm-docs --input $BINDIR/__s --output $BINDIR/__docsbuild $_DOCS_VARS_FLAG $_DOCS_YFM_OUTPUT_FORMAT --config ${input:CONFIG} $_DOCS_EXTRA_TOOLS ${hide;input:EXTRA_INPUTS} $_DOCS_ENV \
  2814. && $YMAKE_PYTHON ${input:"build/scripts/tar_sources.py"} --output $TARGET --input $BINDIR/__docsbuild $_DOCS_KV
  2815. # tag:internal tag:docs
  2816. macro _DOCS_YFM_BOOK_IMPL(CONFIG, INCLUDE_SRCS[], EXTRA_INPUTS[]) {
  2817. .CMD=$_DOCS_YFM_BOOK_CMDLINIE
  2818. }
  2819. _DOCS_YFM_CMD=$_DOCS_YFM_BOOK_IMPL($_DOCS_CONFIG_VALUE INCLUDE_SRCS $_DOCS_INCLUDE_SOURCES_VALUE EXTRA_INPUTS $_DOCS_EXTRA_INPUTS)
  2820. _DOCS_MKDOCS_CMDLINE_SUFFIX=
  2821. _DOCS_MKDOCS_BOOK_CMDLINE_SUFFIX=${pre=--dep ;ext=preprocessed.tar.gz:PEERS}
  2822. _DOCS_MKDOCS_LIB_CMDLINE_SUFFIX=--preprocess-md-only
  2823. _DOCS_MKDOCS_BOOK_PROCESS_DEPS=
  2824. _DOCS_MKDOCS_CMDLINIE=\
  2825. $_DOCS_COMMON_CMDLINE_PREFIX \
  2826. && ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/mkdocs_builder_wrapper.py"} $ARCADIA_BUILD_ROOT ${tool:"tools/mkdocs_builder"} --docs-dir $BINDIR/__s --output-tar $TARGET --config ${input:CONFIG} $_DOCS_VARS_FLAG $_DOCS_MKDOCS_CMDLINE_SUFFIX $_DOCS_EXTRA_TOOLS ${hide;input:EXTRA_INPUTS} $_DOCS_ENV $_DOCS_KV
  2827. macro _DOCS_MKDOCS_CMD_IMPL(CONFIG, INCLUDE_SRCS[], EXTRA_INPUTS[]) {
  2828. .CMD=$_DOCS_MKDOCS_CMDLINIE
  2829. }
  2830. _DOCS_MKDOCS_CMD=$_DOCS_MKDOCS_CMD_IMPL($_DOCS_CONFIG_VALUE INCLUDE_SRCS $_DOCS_INCLUDE_SOURCES_VALUE)
  2831. _DOCS_YFM_DEFAULT_CONFIG=$MODDIR/.yfm
  2832. _DOCS_MKDOCS_DEFAULT_CONFIG=$MODDIR/mkdocs.yml
  2833. ### FIXME(snermolaev)
  2834. module _DOCS_BASE_UNIT: _BARE_UNIT {
  2835. .ALLOWED=DOCS_DIR DOCS_CONFIG DOCS_VARS
  2836. .CMD=TOUCH_DOCS_MF
  2837. .FINAL_TARGET=no
  2838. ENABLE(_DOCS_BASE_UNIT)
  2839. SET(MODULE_SUFFIX .tar.gz)
  2840. SET(MODULE_LANG DOCS)
  2841. DEFAULT(_DOCS_BUILDER_VALUE yfm)
  2842. DEFAULT(_DOCS_DIR_VALUE ${MODDIR})
  2843. select ($_DOCS_BUILDER) {
  2844. "yfm" ? {
  2845. PEERDIR+=build/platform/yfm
  2846. _DOCS_BOOK_CMD=$_DOCS_YFM_CMD
  2847. _DOCS_LIB_CMD=$_DOCS_YFM_CMD
  2848. _DOCS_DEFAULT_CONFIG=$_DOCS_YFM_DEFAULT_CONFIG
  2849. _DOCS_COMMON_BOOK_PROCESS_DEPS=$_DOCS_YFM_BOOK_PROCESS_DEPS
  2850. }
  2851. "mkdocs" ? {
  2852. _DOCS_BOOK_CMD=$_DOCS_MKDOCS_CMD
  2853. _DOCS_LIB_CMD=$_DOCS_MKDOCS_CMD
  2854. _DOCS_DEFAULT_CONFIG=$_DOCS_MKDOCS_DEFAULT_CONFIG
  2855. _DOCS_COMMON_BOOK_PROCESS_DEPS=$_DOCS_MKDOCS_BOOK_PROCESS_DEPS
  2856. }
  2857. }
  2858. }
  2859. # tag:internal tag:docs
  2860. ### _DOCS_EPILOOGUE() # internal
  2861. ###
  2862. ### This macro executes macros which should be envoked after all user
  2863. ### specified macros in the ya.make file
  2864. macro _DOCS_EPILOGUE() {
  2865. SET(_DOCS_BUILDER $_DOCS_BUILDER_VALUE)
  2866. _LATE_GLOB(_DOCS_SRCS_GLOB ${pre=${ARCADIA_ROOT}/;suf=/**/*:_DOCS_DIR_VALUE})
  2867. SET(_DOCS_SRCS_VALUE \${input;hide:_DOCS_SRCS_GLOB})
  2868. }
  2869. # tag:internal tag:docs
  2870. ### _DOCS_YFM_USE_PLANTUML() # internal
  2871. ###
  2872. ### This macr sets appropriate dependencies for use of plantuml plugin
  2873. macro _DOCS_YFM_USE_PLANTUML() {
  2874. PEERDIR(build/platform/java/jdk contrib/java/openjdk-fontconfig)
  2875. COPY_FILE(${ARCADIA_BUILD_ROOT}/contrib/java/openjdk-fontconfig/fontconfig.properties fontconfig.properties)
  2876. SET_APPEND(_DOCS_EXTRA_TOOLS \${hide;tool:"contrib/tools/plantuml"})
  2877. SET_APPEND(_DOCS_EXTRA_INPUTS fontconfig.properties)
  2878. # It's rather strange that a commented statement below doesn't work
  2879. # SET_APPEND(_DOCS_ENV ${_DOCS_PLANTUML_ENV})
  2880. when ($_DOCS_USE_PLANTUML) {
  2881. _DOCS_ENV+=$_DOCS_PLANTUML_ENV
  2882. }
  2883. }
  2884. # tag:docs
  2885. ### @usage: DOCS()
  2886. ###
  2887. ### Documentation project multimodule.
  2888. ###
  2889. ### When built directly, via RECURSE, DEPENDS or BUNDLE the output artifact is docs.tar.gz with statically generated site (using mkdocs as builder).
  2890. ### When PEERDIRed from other DOCS() module behaves like a UNION (supplying own content and dependencies to build target).
  2891. ### Peerdirs from modules other than DOCS are not accepted.
  2892. ### Most usual macros are not accepted, only used with the macros DOCS_DIR(), DOCS_CONFIG(), DOCS_VARS(), DOCS_BUILDER().
  2893. ###
  2894. ### @see: [DOCS_DIR()](#macro_DOCS_DIR), [DOCS_CONFIG()](#macro_DOCS_CONFIG), [DOCS_VARS()](#macro_DOCS_VARS), [DOCS_BUILDER()](#macro_DOCS_BUILDER).
  2895. multimodule DOCS {
  2896. module DOCSBOOK: _DOCS_BASE_UNIT {
  2897. .CMD=_DOCS_BOOK_CMD
  2898. .EPILOGUE=_DOCS_EPILOGUE
  2899. .FINAL_TARGET=yes
  2900. .PEERDIR_POLICY=as_build_from
  2901. ENABLE(DOCSBOOK)
  2902. SET(MODULE_TYPE PROGRAM)
  2903. SET(PEERDIR_TAGS DOCSLIB)
  2904. SET(MODULE_TAG DOCBOOK)
  2905. _DOCS_YFM_OUTPUT_FORMAT=$_DOCS_YFM_BOOK_OUTPUT_FORMAT
  2906. _DOCS_MKDOCS_CMDLINE_SUFFIX=$_DOCS_MKDOCS_BOOK_CMDLINE_SUFFIX
  2907. _DOCS_COMMON_PROCESS_DEPS=$_DOCS_COMMON_BOOK_PROCESS_DEPS
  2908. PROCESS_DOCS()
  2909. }
  2910. module DOCSLIB: _DOCS_BASE_UNIT {
  2911. .CMD=_DOCS_LIB_CMD
  2912. .EPILOGUE=_DOCS_EPILOGUE
  2913. .PEERDIR_POLICY=as_include
  2914. ENABLE(DOCSLIB)
  2915. SET(MODULE_TYPE LIBRARY)
  2916. SET(PEERDIR_TAGS DOCSLIB)
  2917. SET(MODULE_TAG DOCSLIB)
  2918. REALPRJNAME=preprocessed
  2919. _DOCS_YFM_OUTPUT_FORMAT=$_DOCS_YFM_LIB_OUTPUT_FORMAT
  2920. _DOCS_MKDOCS_CMDLINE_SUFFIX=$_DOCS_MKDOCS_LIB_CMDLINE_SUFFIX
  2921. _DOCS_COMMON_PROCESS_DEPS=$_DOCS_COMMON_LIB_PROCESS_DEPS
  2922. PROCESS_DOCS()
  2923. }
  2924. }
  2925. # tag:docs
  2926. _DOCS_USE_PLANTUML=
  2927. ### @usage: USE_PLANTUML()
  2928. ###
  2929. ### Use PlantUML plug-in for yfm builder to render UML diagrams into documentation
  2930. macro USE_PLANTUML() {
  2931. ENABLE(_DOCS_USE_PLANTUML)
  2932. }
  2933. # tag:docs
  2934. DOCSBUILDER=yfm
  2935. ### @usage: DOCS_BUILDER(tool)
  2936. ###
  2937. ### Specify docs builder tool.
  2938. ### Avalialbe tools: mkdocs and yfm (by default).
  2939. ###
  2940. ### @see: [DOCS](#multimodule_DOCS)
  2941. macro DOCS_BUILDER(DocsTool) {
  2942. SET(_DOCS_BUILDER_VALUE $DocsTool)
  2943. }
  2944. # tag:docs
  2945. ### @usage: DOCS_DIR(path)
  2946. ###
  2947. ### Specify directory with source .md files for DOCS multimodule if it differs from project directory.
  2948. ### Path must be Arcadia root relative.
  2949. ###
  2950. ### @see: [DOCS](#multimodule_DOCS)
  2951. macro DOCS_DIR(Dir) {
  2952. SET(_DOCS_DIR_VALUE $Dir)
  2953. }
  2954. # tag:docs
  2955. _DOCS_DEFAULT_CONFIG=
  2956. _DOCS_CONFIG_VALUE=$_DOCS_DEFAULT_CONFIG
  2957. ### @usage: DOCS_CONFIG(path)
  2958. ###
  2959. ### Specify path to config file for DOCS multimodule if it differs from default path.
  2960. ### If [DOCS_BUILDER()](#macro_DOCS_BUILDER) is set to "mkdocs" the default path is "%%project_directory%%/mkdocs.yml".
  2961. ### If [DOCS_BUILDER()](#macro_DOCS_BUILDER) is not set or set to "yfm" the default path is "%%project_directory%%/.yfm".
  2962. ### Path must be either Arcadia root relative.
  2963. ###
  2964. ### @see: [DOCS](#multimodule_DOCS)
  2965. macro DOCS_CONFIG(File) {
  2966. SET(_DOCS_CONFIG_VALUE $File)
  2967. }
  2968. # tag:docs
  2969. _DOCS_VARS_VALUE=
  2970. ### @usage: DOCS_VARS(variable1=value1 variable2=value2 ...)
  2971. ###
  2972. ### Specify a set of default values of template variables for DOCS multimodule.
  2973. ### There must be no spaces around "=". Values will be treated as strings.
  2974. ###
  2975. ### @see: [DOCS](#multimodule_DOCS)
  2976. macro DOCS_VARS(Args...) {
  2977. SET_APPEND(_DOCS_VARS_VALUE $Args)
  2978. }
  2979. # tag:docs
  2980. _DOCS_INCLUDE_SOURCES_VALUE=
  2981. ### @usage: DOCS_INCLUDE_SOURCES(path...)
  2982. ###
  2983. ### Specify a list of paths to source code files which will be used as text includes in a documentation project.
  2984. ### Paths must be Arcadia root relative.
  2985. ###
  2986. ### @see: [DOCS](#multimodule_DOCS)
  2987. macro DOCS_INCLUDE_SOURCES(Args...) {
  2988. SET_APPEND(_DOCS_INCLUDE_SOURCES_VALUE $Args)
  2989. }
  2990. # tag:python-specific
  2991. PY_NAMESPACE_VALUE=
  2992. # tag:python-specific
  2993. ### @usage: PY_NAMESPACE(prefix)
  2994. ###
  2995. ### Sets default Python namespace for all python sources in the module.
  2996. ### Especially suitable in PROTO_LIBRARY where Python sources are generated and there is no PY_SRCS to place NAMESPACE parameter.
  2997. macro PY_NAMESPACE(Arg) {
  2998. SET(PY_NAMESPACE_VALUE $Arg)
  2999. }
  3000. # tag:internal
  3001. ### @usage: _SRCS_NO_GLOBAL(files...) # internal
  3002. ###
  3003. ### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
  3004. ### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
  3005. ### Note: this macro changes order of source files.
  3006. macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
  3007. SRCS($GLOBAL $FILES)
  3008. }
  3009. # tag:java-specific
  3010. JAVA_VCS_MF_ARG=
  3011. COMPILE_JAVA_MF=$COMPILE_JAVA
  3012. # tag:java-specific
  3013. when ($EXT_JAVA_VCS_INFO == "yes") {
  3014. JAVA_VCS_MF_ARG=--vcs-mf $VCS_JAVA
  3015. COMPILE_JAVA_MF=$GENERATE_VCS_JAVA_INFO_NODEP && $COMPILE_JAVA
  3016. }
  3017. # tag:java-specific
  3018. EXT_JAVA_VCS_INFO=no
  3019. ### @usage: EMBED_JAVA_VCS_INFO()
  3020. ###
  3021. ### Embed manifest with vcs info into `EXTERNAL_JAVA_LIBRARY`
  3022. ### By default this is disabled.
  3023. macro EMBED_JAVA_VCS_INFO() {
  3024. ENABLE(EXT_JAVA_VCS_INFO)
  3025. }
  3026. # tag:java-specific tag:internal
  3027. ### @usage: EXTERNAL_JAVA_LIBRARY() #internal
  3028. ###
  3029. ### EXTERNAL_JAVA_LIBRARY() is a module for creating a .jar file using non-Java code (generators etc.)
  3030. ### Unlike regular JAVA_LIBRARY this module doesn't produce .pom file, so it cannot be exported to Maven itself.
  3031. ### PEERDIR it from JAVA_LIBRARY or JAVA_PROGRAM for export to Maven.
  3032. module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
  3033. .EXTS=.jsrc .java .jar .mf
  3034. .NODE_TYPE=Bundle
  3035. .CMD=COMPILE_JAVA_MF
  3036. .PEERDIR_POLICY=as_build_from
  3037. .FINAL_TARGET=no
  3038. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  3039. .ALLOWED=EMBED_JAVA_VCS_INFO
  3040. .RESTRICTED=EXTERNAL_JAR
  3041. PEERDIR(build/platform/java/jdk)
  3042. PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR
  3043. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  3044. PROPAGATES_MANAGEABLE_PEERS=yes
  3045. DYNAMIC_LINK=yes
  3046. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  3047. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  3048. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  3049. when ($PACKAGE_PREFIX) {
  3050. PACKAGE_PREFIX_ARGS=--package-prefix=$PACKAGE_PREFIX
  3051. }
  3052. DISABLE(NEED_PLATFORM_PEERDIRS)
  3053. NO_PLATFORM()
  3054. SET(MODULE_SUFFIX .jar)
  3055. SET(MODULE_LANG JAVA)
  3056. }
  3057. # tag:java-specific
  3058. ALL_JAR_SOURCES=
  3059. LINT_JAVA_SOURCES=
  3060. ALL_SRCDIRS=
  3061. LINK_JAR_RESOURCES=
  3062. LINK_JAR_JSOURCES=
  3063. JAR_GEN_SRCS=
  3064. JAR_GEN_JSRCS=
  3065. macro _JAR_SRCS(SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], RESOURCES?"yes":"no", Globs...) {
  3066. _CHECK_JAVA_SRCDIR($SRCDIR)
  3067. SET_APPEND(ALL_SRCDIRS $SRCDIR)
  3068. SET(VAR_SALT $SRCDIR $Globs $EXCLUDE $PACKAGE_PREFIX $RESOURCES $FILES)
  3069. SET(JAR_SRCS_GLOB uniq_${hash:VAR_SALT})
  3070. _LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE})
  3071. SET_APPEND(LINT_JAVA_SOURCES \${input;rootrel;ext=.java:${JAR_SRCS_GLOB}})
  3072. 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})
  3073. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_RESOURCES ${quo:SRCDIR} ${BINDIR}/cls ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt)
  3074. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_JSOURCES ${quo:SRCDIR} ${BINDIR}/src ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt)
  3075. _FILL_JAR_GEN_SRCS(JAR_GEN_SRCS JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst ${BINDIR}/misc/all-kt-sources.txt ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt $Globs EXCLUDE $EXCLUDE)
  3076. _FILL_JAR_GEN_SRCS(JAR_GEN_JSRCS SRC_JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst ${BINDIR}/misc/all-kt-sources.txt ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt $Globs EXCLUDE $EXCLUDE)
  3077. }
  3078. macro IDEA_JAR_SRCS(Args...) {
  3079. _JAR_SRCS($Args)
  3080. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  3081. }
  3082. macro _HASH_HELPER(Args...) {
  3083. .CMD=${hash:Args}
  3084. }
  3085. macro _GENTAR_HELPER(OUT_DIR[], Args...) {
  3086. .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"}
  3087. }
  3088. # tag:java-specific
  3089. RUN_JAR_PROG_CP_PRE=@
  3090. RUN_JAR_PROG_CP_SUF=.cplst
  3091. when($JDK_VERSION == "8") {
  3092. RUN_JAR_PROG_CP_PRE=
  3093. RUN_JAR_PROG_CP_SUF=
  3094. }
  3095. # tag:java-specific
  3096. 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[], REQUIREMENTS[], ADD_SRCS_TO_CLASSPATH?"yes":"no", CWD="${ARCADIA_BUILD_ROOT}", Args...) {
  3097. _LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR})
  3098. _CHECK_RUN_JAVA_PROG_CLASSPATH($CLASSPATH)
  3099. .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
  3100. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} ${OUT_DIR} && ${cwd:CWD} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} $YMAKE_PYTHON ${input:"build/scripts/fix_java_command_file_cp.py"} --build-root ${ARCADIA_BUILD_ROOT} $JDK_RESOURCE/bin/java -Dfile.encoding=utf8 -classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} ${Args} ${requirements;hide:REQUIREMENTS} ${requirements;hide:"network:restricted"} && $_GENTAR_HELPER($CLASSPATH $IN_DIR $IN $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}
  3101. }
  3102. # tag:java-specific
  3103. macro _DO_1_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq", Args...) {
  3104. _DO_2_RUN_JAR_PROGRAM($Args IN_DIRS_VAR $IN_DIRS_VAR IN_DIRS_INPUTS ${"$"}{input;hide:$IN_DIRS_VAR})
  3105. }
  3106. # tag:java-specific
  3107. macro RUN_JAVA_PROGRAM(Args...) {
  3108. _DO_1_RUN_JAR_PROGRAM($Args IN_DIRS_VAR uniq_${hash:Args})
  3109. }
  3110. # tag:java-specific
  3111. _JAR_ANN_PROCESSORS=
  3112. _JAR_ANN_PROC_OPT_PREFIX=
  3113. macro JAR_ANNOTATION_PROCESSOR(Classes...) {
  3114. SET_APPEND(_JAR_ANN_PROCESSORS $Classes)
  3115. SET(_JAR_ANN_PROC_OPT_PREFIX -processor)
  3116. # for ya ide idea only
  3117. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Classes)
  3118. }
  3119. # tag:java-specific
  3120. macro _JAR_ANN_PROC_OPTS(Classes...) {
  3121. .CMD=$_JAR_ANN_PROC_OPT_PREFIX ${join=,:Classes}
  3122. }
  3123. # tag:java-specific
  3124. macro _NOOP_MACRO(Args...) {
  3125. ENABLE(UNUSED_MACRO)
  3126. }
  3127. # tag:java-specific
  3128. module _JAR_BASE: _BARE_UNIT {
  3129. .NODE_TYPE=Bundle
  3130. .CMD=TOUCH_UNIT
  3131. .PEERDIR_POLICY=as_build_from
  3132. .FINAL_TARGET=no
  3133. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  3134. .ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE
  3135. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__
  3136. HAS_MANAGEABLE_PEERS=yes
  3137. DYNAMIC_LINK=yes
  3138. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  3139. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  3140. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  3141. DISABLE(NEED_PLATFORM_PEERDIRS)
  3142. NO_PLATFORM()
  3143. VCS_JAVA=${suf=.__vcs_version__.mf:TARGET}
  3144. SET(MODULE_LANG JAVA)
  3145. }
  3146. # tag:java-specific
  3147. module JAVA_CONTRIB_PROXY: _JAR_BASE {
  3148. }
  3149. # tag:java-specific
  3150. macro _FETCH_CONTRIB(Id, Out, SBR="sbr:") {
  3151. .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"}
  3152. ADD_CHECK(check.resource $Id)
  3153. }
  3154. # tag:java-specific
  3155. LOCAL_JAR_PATH=
  3156. LOCAL_SOURCES_JAR_PATH=
  3157. JAR_RESOURCE_ID=
  3158. SRC_RESOURCE_ID=
  3159. FETCH_SRCS_JAR=
  3160. FETCH_TARGET_JAR=
  3161. FETCH_CONTRIB_JAR=$FETCH_TARGET_JAR $FETCH_SRCS_JAR
  3162. # tag:java-specific
  3163. macro JAR_RESOURCE(Id) {
  3164. SET(JAR_RESOURCE_ID $Id)
  3165. }
  3166. # tag:java-specific
  3167. macro SRC_RESOURCE(Id) {
  3168. SET(SRC_RESOURCE_ID $Id)
  3169. }
  3170. # tag:java-specific
  3171. macro LOCAL_JAR(File) {
  3172. SET(LOCAL_JAR_PATH $File)
  3173. }
  3174. # tag:java-specific
  3175. macro LOCAL_SOURCES_JAR(File) {
  3176. SET(LOCAL_SOURCES_JAR_PATH $File)
  3177. }
  3178. # tag:java-specific
  3179. module JAVA_CONTRIB: _JAR_BASE {
  3180. .CMD=FETCH_CONTRIB_JAR
  3181. .FINAL_TARGET=yes
  3182. when ($JAR_RESOURCE_ID) {
  3183. FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX})
  3184. }
  3185. otherwise {
  3186. when ($LOCAL_JAR_PATH) {
  3187. FETCH_TARGET_JAR= && $FS_TOOLS copy ${input:LOCAL_JAR_PATH} $TARGET
  3188. }
  3189. otherwise {
  3190. FETCH_TARGET_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:BINDIR} $JDK_RESOURCE/bin/jar cfvm $TARGET $VCS_JAVA .
  3191. PEERDIR+=build/platform/java/jdk
  3192. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3193. }
  3194. }
  3195. when ($SRC_RESOURCE_ID) {
  3196. FETCH_SRCS_JAR= && $_FETCH_CONTRIB($SRC_RESOURCE_ID ${BINDIR}/${REALPRJNAME}-sources.jar)
  3197. }
  3198. otherwise {
  3199. when ($LOCAL_SOURCES_JAR_PATH) {
  3200. FETCH_SRCS_JAR= && $FS_TOOLS copy ${input:LOCAL_SOURCES_JAR_PATH} {output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME}
  3201. }
  3202. otherwise {
  3203. 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 .
  3204. PEERDIR+=build/platform/java/jdk
  3205. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3206. }
  3207. }
  3208. SET(MODULE_SUFFIX .jar)
  3209. }
  3210. # tag:kotlin-specific
  3211. KOTLINC_OPTS_VALUE=
  3212. # tag:kotlin-specific
  3213. KT_SRSCLIST_FLAG=--kotlin ${BINDIR}/misc/all-kt-sources.txt
  3214. KT_CLASSES_DIR=${BINDIR}/kt_cls
  3215. COLLECT_KT_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/writer.py"} --file ${BINDIR}/kt_bfg.txt -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file
  3216. LINK_KT_CLASSPATH=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} ${BINDIR}/kt_bfg.txt ${BINDIR}/kt_cp.txt && $FS_TOOLS md $KT_CLASSES_DIR
  3217. COMPILE_KT=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/with_pathsep_resolve.py"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} --kotlin --sources-list ${BINDIR}/misc/all-kt-sources.txt $JDK_RESOURCE/bin/java -jar $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} @${BINDIR}/misc/all-kt-sources.txt -classpath @${BINDIR}/kt_cp.txt $KOTLINC_FLAGS_VALUE -d $KT_CLASSES_DIR $KOTLINC_OPTS_VALUE
  3218. ALL_KT_COMMANDS=
  3219. KT_CLASSPATH_ITEM=
  3220. # tag:java-specific
  3221. JAVAC_CMD=$JDK_RESOURCE/bin/javac
  3222. 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
  3223. # tag:java-specific tag:codenav
  3224. JAVA_YNDEXING=no
  3225. # tag:java-specific
  3226. when ($USE_SYSTEM_KYTHE) {
  3227. KYTHE_RESOURCE=$USE_SYSTEM_KYTHE
  3228. }
  3229. otherwise {
  3230. KYTHE_RESOURCE=$KYTHE_RESOURCE_GLOBAL
  3231. }
  3232. # tag:java-specific tag:codenav
  3233. _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
  3234. _DO_JAVA_YNDEXING=
  3235. # tag:java-specific
  3236. SOURCES_JAR=no
  3237. _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 .
  3238. _PACK_SRC_JAR=
  3239. # tag:java-specific
  3240. _PACK_JNI=
  3241. _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
  3242. # tag:java-specific
  3243. _MAKE_JSTYLE_FILE_LIST=
  3244. # tag:java-specific
  3245. _LINK_UBERJAR=
  3246. _UBERJAR_SELF=
  3247. _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} \
  3248. && $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} $BINDIR/_empty/META-INF \
  3249. && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} $BINDIR/_empty/META-INF/MANIFEST.MF \
  3250. && $UPDATE_VCS_JAVA_INFO_NODEP($TARGET) \
  3251. && ${cwd;suf=/_empty:BINDIR} ${JDK_RESOURCE}/bin/jar ufv ${TARGET} META-INF/MANIFEST.MF \
  3252. && $JDK_RESOURCE/bin/jar ufvm $TARGET $VCS_JAVA
  3253. # tag:java-specific
  3254. macro _PACK_JAR_HELPER(Out) {
  3255. .CMD=${cwd;suf=/cls:BINDIR} $JDK_RESOURCE/bin/jar cfvm $Out $VCS_JAVA .
  3256. }
  3257. # tag:java-specific
  3258. macro _JAVAC_RUN_HELPER(JAVAC_CMD_WITH_ARGS...) {
  3259. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/with_pathsep_resolve.py"} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} --sources-list ${BINDIR}/all-java.srclst ${JAVAC_CMD_WITH_ARGS} @${BINDIR}/all-java.srclst -classpath ${ARCADIA_BUILD_ROOT}/bfg.jar -Xpkginfo:always ${JAVAC_OPTS} $_JAR_ANN_PROC_OPTS($_JAR_ANN_PROCESSORS) -d ${BINDIR}/cls -g -encoding UTF-8
  3260. }
  3261. macro _ADD_HIDDEN_INPUTS(Inputs...) {
  3262. .CMD=${input;hide:Inputs}
  3263. }
  3264. # tag:java-specific
  3265. 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
  3266. ERROR_PRONE_2_7_1_FORCED_OPTS=-Xep:InlineMeInliner:OFF -Xep:SameNameButDifferent:OFF
  3267. # tag:java-specific
  3268. JAVA_COVERAGE_SRCLIST_FLAG=--coverage ${output;pre=${MODULE_PREFIX};suf=.cpsf:REALPRJNAME} --source-root ${ARCADIA_ROOT}
  3269. JAVA_COVERAGE_SRCLIST=
  3270. PREPARE_JAVA_BUILD_DIRS=$FS_TOOLS md ${BINDIR}/cls && $FS_TOOLS md ${BINDIR}/misc
  3271. EXTRACT_GENDIRS=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --unpack --ext .gentar ${ext=.gentar:AUTO_INPUT}
  3272. COLLECT_JAVA_SRCLIST=${YMAKE_PYTHON} ${input:"build/scripts/make_java_srclists.py"} --moddir ${CURDIR} --java ${BINDIR}/all-java.srclst ${KT_SRSCLIST} ${JAVA_COVERAGE_SRCLIST} --ya-start-command-file ${ALL_JAR_SOURCES} ${ext=.java:AUTO_INPUT} ${ext=.kt:AUTO_INPUT} --ya-end-command-file
  3273. COLLECT_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/writer.py"} --file ${BINDIR}/bfg.txt -m --ya-start-command-file ${rootrel:MANAGED_PEERS_CLOSURE} $KT_CLASSPATH_ITEM --ya-end-command-file
  3274. LINK_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/bfg.txt ${ARCADIA_BUILD_ROOT}/bfg.jar
  3275. COMPILE_JAVA_SRCLIST=$_JAVAC_RUN_HELPER($JAVAC_CMD)
  3276. PACK_JAR=$_PACK_JAR_HELPER($TARGET)
  3277. # NOTE: No && before LINK_JAR_RESOURCES, ALL_KT_COMMANDS and JAR_GEN_SRCS needed since those vars either empty or starts with &&
  3278. LINK_JAR=$PREPARE_JAVA_BUILD_DIRS \
  3279. && $EXTRACT_GENDIRS \
  3280. && $COLLECT_JAVA_SRCLIST \
  3281. $JAR_GEN_SRCS \
  3282. $ALL_KT_COMMANDS \
  3283. && $COLLECT_CLASSPATH \
  3284. && $LINK_CLASSPATH \
  3285. && $COMPILE_JAVA_SRCLIST \
  3286. $LINK_JAR_RESOURCES \
  3287. && ${cwd;suf=/cls:BINDIR} $GENERATE_VCS_JAVA_INFO_NODEP . \
  3288. $_PACK_SRC_JAR \
  3289. $_PACK_JNI \
  3290. && $PACK_JAR \
  3291. $_DO_JAVA_YNDEXING \
  3292. ${requirements;hide:JAVA_REQUIREMENTS} \
  3293. ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} \
  3294. $_MAKE_JSTYLE_FILE_LIST \
  3295. $_LINK_UBERJAR \
  3296. $_ADD_HIDDEN_INPUTS($JAVA_EXTERNAL_DEPENDENCIES_VALUE)
  3297. # tag:java-specific
  3298. _EXT_SRC_JAR=
  3299. _EXT_JAR=
  3300. _COPY_EXT_SRC_JAR=
  3301. _DO_USE_EXT_JAR=$FS_TOOLS copy ${input:_EXT_JAR} $TARGET $_COPY_EXT_SRC_JAR
  3302. _DO_COPY_EXT_SRC_JAR= && $FS_TOOLS copy $_EXT_SRC_JAR ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
  3303. macro JAVA_RESOURCE(JAR, SOURCES="") {
  3304. SET(_EXT_SRC_JAR $SOURCES)
  3305. SET(_EXT_JAR $JAR)
  3306. }
  3307. # tag:java-specific tag:fbs
  3308. JAVA_FLATBUFFERS_VERSION = 2.0.0
  3309. # tag:java-specific
  3310. module _COMPILABLE_JAR_BASE : _JAR_BASE {
  3311. # flatbuffers-java
  3312. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3313. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3314. # protobuf-java
  3315. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3316. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3317. # protobuf-javalite
  3318. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3319. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3320. # protobuf-java-util
  3321. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  3322. 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})
  3323. }
  3324. # tag:java-specific tag:internal
  3325. ### @usage: JAR_LIBRARY() #internal
  3326. ###
  3327. ### Reimplementation of the JAVA_LIBRARY with ymake.core.conf and ymake based dependency management
  3328. module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
  3329. .EXTS=.jsrc .java .jar .mf .gentar .kt
  3330. .CMD=LINK_JAR
  3331. .FINAL_TARGET=yes
  3332. .ALIASES=JAVA_SRCS=IDEA_JAR_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
  3333. .RESTRICTED=EXTERNAL_JAR
  3334. MODULE_SUFFIX=.jar
  3335. PEERDIR(build/platform/java/jdk)
  3336. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3337. when ($_EXT_SRC_JAR) {
  3338. _COPY_EXT_SRC_JAR=_DO_COPY_EXT_SRC_JAR
  3339. }
  3340. when ($_EXT_JAR) {
  3341. LINK_JAR=$_DO_USE_EXT_JAR
  3342. }
  3343. # in the ideal world this statement must be under condition bellow
  3344. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
  3345. when ($WITH_KOTLIN_VALUE) {
  3346. KT_SRSCLIST=$KT_SRSCLIST_FLAG
  3347. ALL_KT_COMMANDS=&& $COLLECT_KT_CLASSPATH && $LINK_KT_CLASSPATH && $COMPILE_KT
  3348. LINK_JAR_RESOURCES+=&& $FS_TOOLS copy_all_files ${KT_CLASSES_DIR} ${BINDIR}/cls
  3349. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  3350. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  3351. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  3352. }
  3353. when($WITH_KOTLINC_PLUGIN_NOARG) {
  3354. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  3355. }
  3356. # Must be in sync with KT_CLASSES_DIR!
  3357. # There are problems in JDK13 with abs paths in classapth baked into jar file manifest. Using relative path
  3358. # here assumes that jar file with classpath for javac located in the $ARCADIA_BUILD_ROOT
  3359. KT_CLASSPATH_ITEM=$MODDIR/kt_cls
  3360. }
  3361. otherwise {
  3362. KT_SRSCLIST=
  3363. ALL_KT_COMMANDS=
  3364. KT_CLASSES=
  3365. }
  3366. when ($SOURCES_JAR == "yes") {
  3367. _PACK_SRC_JAR=$_PACK_SRC_JAR_IMPL
  3368. }
  3369. when ($JAVA_COVERAGE == "yes") {
  3370. JAVA_COVERAGE_SRCLIST=$JAVA_COVERAGE_SRCLIST_FLAG
  3371. }
  3372. when ($MAKE_UBERJAR_VALUE == "yes") {
  3373. _LINK_UBERJAR=$_DO_LINK_UBERJAR
  3374. PACK_JAR=$_PACK_JAR_HELPER(${BINDIR}/${REALPRJNAME}.lib.jar)
  3375. # TODO: This condition is incorrect in case of autoinputs _UBERJAR_SELF should be empty only for
  3376. # modules without AUTO_INPUT and withuout JAVA_SRCS added inputs.
  3377. when($ALL_JAR_SOURCES) {
  3378. _UBERJAR_SELF=--jar ${BINDIR}/${REALPRJNAME}.lib.jar
  3379. }
  3380. PEERDIR+=build/platform/java/uberjar
  3381. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  3382. }
  3383. when($JAVA_YNDEXING == "yes") {
  3384. PEERDIR+=build/platform/java/kythe
  3385. _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"}
  3386. }
  3387. when($ERROR_PRONE_VALUE) {
  3388. PEERDIR+=$ERROR_PRONE_PEERDIR
  3389. JAVAC_CMD=$ERROR_PRONE_JAVAC_CMD
  3390. }
  3391. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
  3392. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3393. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3394. }
  3395. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "17") {
  3396. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3397. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3398. }
  3399. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  3400. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3401. JAVAC_OPTS+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3402. }
  3403. when ($JAVA_ADD_DLLS_VALUE == "yes") {
  3404. CONSUME_NON_MANAGEABLE_PEERS=yes
  3405. _PACK_JNI=$_PACK_JNI_CMD
  3406. }
  3407. when ($LINT_LEVEL_VALUE != "none") {
  3408. _MAKE_JSTYLE_FILE_LIST= && $YMAKE_PYTHON ${input:"build/scripts/writer.py"} --file ${output;noauto:"lint-java.srclst"} -m --ya-start-command-file $LINT_JAVA_SOURCES --ya-end-command-file
  3409. }
  3410. SET(MODULE_TYPE JAVA_LIBRARY)
  3411. ENABLE(YMAKE_JAVA_TEST)
  3412. _ADD_JAVA_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/lint-java.srclst::$(SOURCE_ROOT))
  3413. _ADD_CLASSPATH_CLASH_CHECK()
  3414. JAVA_MODULE(IDEA_ONLY)
  3415. }
  3416. # tag:java-specific
  3417. _SCRIPTGEN_FLAGS=
  3418. macro _GEN_JAVA_SCRIPT_IMPL(Out, Template, Props...) {
  3419. .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
  3420. }
  3421. # tag:java-specific
  3422. _GEN_USERSCRIPTS=
  3423. macro _ADD_GEN_JAVA_SCRIPT(Out, Template, Props...) {
  3424. SET_APPEND(_GEN_USERSCRIPTS && \$_GEN_JAVA_SCRIPT_IMPL($Out $Template $Props))
  3425. }
  3426. # tag:java-specific
  3427. _PACK_JDK=
  3428. # tag:java-specific
  3429. DO_GEN_JAVA_RUN_SH=
  3430. _SOURCE_JARS=
  3431. _SOURCE_JARS_CPLIST=
  3432. 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}
  3433. GEN_RUN_CP=${YMAKE_PYTHON} ${input:"build/scripts/writer.py"} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${nopath;qe;pre=$REALPRJNAME/:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET}
  3434. 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}
  3435. MAKE_JAR_PROGRAM_CPLST=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} --ya-start-command-file ${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS_CPLIST} --ya-end-command-file
  3436. TAR_CLASSPATH= && $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} ${output;pre=$MODULE_PREFIX;suf=.tar:REALPRJNAME} ${cwd;pre=$BINDIR/:REALPRJNAME}
  3437. DO_TAR_CLASSPATH=
  3438. LINK_JAR_PROGRAM=$FS_TOOLS md ${BINDIR}/${REALPRJNAME} && $COLLECT_JAR_PROGRAM_CP && $DO_GEN_JAVA_RUN_SH && $GEN_RUN_CP && $MAKE_JAR_PROGRAM_CPLST $DO_TAR_CLASSPATH $_GEN_USERSCRIPTS $_PACK_JDK ${kv;hide:"p JP"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  3439. # tag:java-specific
  3440. # UBERJAR program link command
  3441. LINK_UBERJAR_PROGRAM=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} $TARGET \
  3442. && $FS_TOOLS md ${BINDIR}/${REALPRJNAME} \
  3443. && $FS_TOOLS link_or_copy ${BINDIR}/${REALPRJNAME}.jar $TARGET \
  3444. && $FS_TOOLS link_or_copy_to_dir --ya-start-command-file ${BINDIR}/${REALPRJNAME}.jar ${ext=.so:MANAGED_PEERS_CLOSURE} ${ext=.dll:MANAGED_PEERS_CLOSURE} ${ext=.dylib:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS} --ya-end-command-file ${BINDIR}/${REALPRJNAME} ${hide;late_out;ext=.jar;pre=$BINDIR/$REALPRJNAME/:REALPRJNAME} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} \
  3445. $DO_TAR_CLASSPATH \
  3446. $_GEN_USERSCRIPTS \
  3447. $_PACK_JDK
  3448. # tag:java-specific
  3449. RUN_WITH_SOURCES=no
  3450. TARED_CLASSPATH=yes # TODO jbuild creates tar with all classpath deps by default and some projects rely on this. In ymake build this tar file creation is not needed and should be disabled by dafault in future
  3451. _JAR_SRCS_CALLED=no
  3452. # tag:java-specific
  3453. macro _MARK_JAVA_PROG_WITH_SOURCES(Args...) {
  3454. ENABLE(_JAR_SRCS_CALLED)
  3455. }
  3456. # tag:java-specific
  3457. module _JAR_RUNABLE: _COMPILABLE_JAR_BASE {
  3458. .FINAL_TARGET=yes
  3459. .CMD=LINK_JAR_PROGRAM
  3460. .ALIASES=JAVA_SRCS=_MARK_JAVA_PROG_WITH_SOURCES GENERATE_SCRIPT=_YMAKE_GENERATE_SCRIPT
  3461. MODULE_SUFFIX=.run.cp.jar
  3462. CONSUME_NON_MANAGEABLE_PEERS=yes
  3463. when ($RUN_WITH_SOURCES == "yes") {
  3464. _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}
  3465. _SOURCE_JARS_CPLIST=${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
  3466. }
  3467. when ($_JAR_SRCS_CALLED && $TARED_CLASSPATH) {
  3468. DO_TAR_CLASSPATH=$TAR_CLASSPATH
  3469. }
  3470. when ($DISABLE_SCRIPTGEN) {
  3471. DO_GEN_JAVA_RUN_SH=
  3472. }
  3473. otherwise {
  3474. DO_GEN_JAVA_RUN_SH=$GEN_JAVA_RUN_SH
  3475. PEERDIR+=build/platform/java/scriptgen
  3476. }
  3477. when ($WITH_JDK_VALUE) {
  3478. _PACK_JDK= && ${YMAKE_PYTHON} ${input:"build/scripts/tar_directory.py"} ${output;tared:"jdk.tar"} $WITH_JDK_RESOURCE $WITH_JDK_RESOURCE
  3479. }
  3480. when ($MAKE_UBERJAR_VALUE == "yes") {
  3481. LINK_JAR_PROGRAM=$LINK_UBERJAR_PROGRAM
  3482. DYNAMIC_LINK=no
  3483. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=yes
  3484. }
  3485. otherwise {
  3486. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=no
  3487. }
  3488. CHECK_PROVIDES()
  3489. }
  3490. # tag:java-specific
  3491. multimodule JAR_PROGRAM {
  3492. module JAR_RUNABLE: _JAR_RUNABLE {
  3493. .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
  3494. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3495. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
  3496. .PEERDIRSELF=JAR_COMPILATION
  3497. SET(MODULE_TYPE JAVA_PROGRAM)
  3498. }
  3499. module JAR_COMPILATION: JAR_LIBRARY {
  3500. .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
  3501. .FINAL_TARGET=no
  3502. SET(MODULE_TYPE JAVA_PROGRAM)
  3503. }
  3504. }
  3505. # tag:java-specific
  3506. LINK_JAR_TEST=${YMAKE_PYTHON} ${input:"build/scripts/writer.py"} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET}
  3507. YMAKE_JAVA_TEST=
  3508. module _JAR_TEST: _COMPILABLE_JAR_BASE {
  3509. .FINAL_TARGET=yes
  3510. .CMD=LINK_JAR_TEST
  3511. CONSUME_NON_MANAGEABLE_PEERS=yes
  3512. SET(MODULE_SUFFIX .test.cp.jar)
  3513. ENABLE(YMAKE_JAVA_TEST)
  3514. JAVA_TEST()
  3515. CHECK_PROVIDES()
  3516. }
  3517. # tag:java-specific
  3518. multimodule JUNIT5_YMAKE {
  3519. module JAR_TESTABLE: _JAR_TEST {
  3520. .ALLOWED=JAVA_TEST_PEERDIR
  3521. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3522. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_TEST_PEERDIR=PEERDIR
  3523. .PEERDIRSELF=JAR_COMPILATION
  3524. SET(MODULE_TYPE JUNIT5)
  3525. }
  3526. module JAR_COMPILATION: JAR_LIBRARY {
  3527. .IGNORED=JAVA_TEST_PEERDIR
  3528. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO
  3529. .FINAL_TARGET=no
  3530. PEERDIR(devtools/junit5-runner build/platform/java/jacoco-agent)
  3531. }
  3532. }
  3533. # tag:java-specific
  3534. multimodule JTEST_YMAKE {
  3535. module JAR_TESTABLE: _JAR_TEST {
  3536. .ALLOWED=YT_SPEC
  3537. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3538. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_TEST_PEERDIR=PEERDIR
  3539. .PEERDIRSELF=JAR_COMPILATION
  3540. SET(MODULE_TYPE JTEST)
  3541. PEERDIR(devtools/junit-runner)
  3542. DEPENDENCY_MANAGEMENT(contrib/java/org/hamcrest/hamcrest-core/1.3 contrib/java/com/google/code/gson/gson/2.8.6 contrib/java/com/beust/jcommander/1.72 contrib/java/junit/junit/4.12)
  3543. }
  3544. module JAR_COMPILATION: JAR_LIBRARY {
  3545. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO
  3546. .ALLOWED=YT_SPEC
  3547. .FINAL_TARGET=no
  3548. DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
  3549. PEERDIR(build/platform/java/jacoco-agent)
  3550. }
  3551. }
  3552. # tag:python-specific tag:deprecated
  3553. ### @usage: PY2_LIBRARY() # deprecated
  3554. ###
  3555. ### Deprecated. Use PY23_LIBRARY or PY3_LIBRARY instead.
  3556. ### Python 2.x binary built library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM.
  3557. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3558. ### This module is only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3559. ### This module is only compatible with Arcadia Python build.
  3560. ###
  3561. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3562. module PY2_LIBRARY: _LIBRARY {
  3563. .ALIASES=REQUIREMENTS=PY_REQUIREMENTS
  3564. _ARCADIA_PYTHON_ADDINCL()
  3565. when ($NO_PYTHON_INCLS != "yes") {
  3566. PEERDIR+=contrib/libs/python
  3567. }
  3568. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3569. MODULE_PREFIX=py
  3570. }
  3571. otherwise {
  3572. MODULE_PREFIX=libpy
  3573. }
  3574. .ALLOWED=FORK_TESTS
  3575. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3576. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3577. USE_GLOBAL_CMD=yes
  3578. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3579. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3580. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3581. 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}"})
  3582. }
  3583. SET(MODULE_LANG PY2)
  3584. }
  3585. ### @usage: _PY3_LIBRARY()
  3586. ###
  3587. ### Basic Python3 library module
  3588. module _PY3_LIBRARY: _LIBRARY {
  3589. _ARCADIA_PYTHON3_ADDINCL()
  3590. when ($NO_PYTHON_INCLS != "yes") {
  3591. PEERDIR+=contrib/libs/python
  3592. }
  3593. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3594. MODULE_PREFIX=py
  3595. }
  3596. otherwise {
  3597. MODULE_PREFIX=libpy
  3598. }
  3599. .ALLOWED=FORK_TESTS
  3600. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3601. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2 OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3602. USE_GLOBAL_CMD=yes
  3603. PEERDIR($YMAKE_PYTHON3_PEER)
  3604. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3605. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3606. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3607. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3608. 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}"})
  3609. }
  3610. SET(MODULE_LANG PY3)
  3611. }
  3612. # tag:python-specific
  3613. ### @usage: PY3_LIBRARY()
  3614. ###
  3615. ### Python 3.x binary library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM
  3616. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3617. ### This module is only compatible with PYTHON3-tagged modules and selects those from multimodules.
  3618. ### This module is only compatible with Arcadia Python build.
  3619. ###
  3620. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3621. module PY3_LIBRARY: _PY3_LIBRARY {
  3622. .ALIASES=REQUIREMENTS=PY_REQUIREMENTS
  3623. }
  3624. # tag:python-specific
  3625. ### @usage: _BASE_PY_PROGRAM #internal
  3626. ###
  3627. ### The base module for all Python 2.x binary programs. Adds linking logic, relevant module properties and
  3628. ### dependency on Python 2.x interpreter. Also adds import tests on all sources including PEERDIR'ed libraries.
  3629. ### Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  3630. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3631. ###
  3632. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3633. module _BASE_PY_PROGRAM: _BASE_PROGRAM {
  3634. .CMD=PY_PROGRAM_LINK_EXE
  3635. _ARCADIA_PYTHON_ADDINCL()
  3636. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3637. NO_CHECK_IMPORTS_FOR_VALUE=
  3638. }
  3639. ADD_CHECK_PY_IMPORTS()
  3640. when ($NO_PYTHON_INCLS != "yes") {
  3641. PEERDIR += contrib/libs/python
  3642. }
  3643. when ($USE_ARCADIA_PYTHON == "yes") {
  3644. PEERDIR += library/python/runtime/main
  3645. PEERDIR += contrib/python/subprocess32
  3646. when ($PYTHON_SQLITE3 != "no") {
  3647. PEERDIR += contrib/tools/python/src/Modules/_sqlite
  3648. }
  3649. }
  3650. when ($PYTHON_COVERAGE == "yes") {
  3651. PEERDIR+=library/python/coverage
  3652. }
  3653. when ($ARCH_PPC64LE == "yes") {
  3654. _MY_ALLOCATOR=SYSTEM
  3655. }
  3656. otherwise {
  3657. _MY_ALLOCATOR=J
  3658. }
  3659. ALLOCATOR($_MY_ALLOCATOR)
  3660. STRIP()
  3661. when ($BUILD_TYPE == "DEBUG") {
  3662. NO_STRIP=yes
  3663. }
  3664. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3665. NO_STRIP=yes
  3666. }
  3667. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3668. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3669. SET(MODULE_LANG PY2)
  3670. }
  3671. # tag:python-specific tag:codenav
  3672. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3673. PY3_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"py3yndex $TARGET"}
  3674. }
  3675. otherwise {
  3676. PY3_PROGRAM_LINK_EXE=$LINK_EXE
  3677. }
  3678. # tag:python-specific
  3679. ### @usage: _BASE_PY_PROGRAM #internal
  3680. ###
  3681. ### The base module for all Python 3.x binary programs. Adds linking logic, relevant module properties and
  3682. ### dependency on Python 3.x interpreter. Also adds import tests on all sources including libraries.
  3683. ### Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  3684. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules
  3685. ###
  3686. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3687. module _BASE_PY3_PROGRAM: _BASE_PROGRAM {
  3688. .CMD=PY3_PROGRAM_LINK_EXE
  3689. _ARCADIA_PYTHON3_ADDINCL()
  3690. PEERDIR(library/python/runtime_py3/main)
  3691. when ($PYTHON_SQLITE3 != "no") {
  3692. PEERDIR += contrib/tools/python3/src/Modules/_sqlite
  3693. }
  3694. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3695. NO_CHECK_IMPORTS_FOR_VALUE=
  3696. }
  3697. ADD_CHECK_PY_IMPORTS()
  3698. when ($ARCH_PPC64LE == "yes") {
  3699. _MY_ALLOCATOR=SYSTEM
  3700. }
  3701. otherwise {
  3702. _MY_ALLOCATOR=J
  3703. }
  3704. ALLOCATOR($_MY_ALLOCATOR)
  3705. STRIP()
  3706. when ($NO_PYTHON_INCLS != "yes") {
  3707. PEERDIR+=contrib/libs/python
  3708. }
  3709. when ($BUILD_TYPE == "DEBUG") {
  3710. NO_STRIP=yes
  3711. }
  3712. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3713. NO_STRIP=yes
  3714. }
  3715. when ($PYTHON_COVERAGE == "yes") {
  3716. PEERDIR+=library/python/coverage
  3717. }
  3718. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3719. PEERDIR += contrib/python/six
  3720. }
  3721. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3722. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2
  3723. SET(MODULE_LANG PY3)
  3724. }
  3725. # tag:python-specific
  3726. ### @usage: PY3_PROGRAM_BIN([progname])
  3727. ### Use instead of PY3_PROGRAM only if ya.make with PY3_PROGRAM() included in another ya.make
  3728. ### In all other cases use PY3_PROGRAM
  3729. module PY3_PROGRAM_BIN: _BASE_PY3_PROGRAM {
  3730. .ALIASES=REQUIREMENTS=PY_REQUIREMENTS
  3731. # Look's like we cannot avoid copy-paste util ymake supports multiple inheritance
  3732. # We need to attach coverage.extractor to every py_program target, except pytest targets
  3733. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  3734. }
  3735. # tag:java-specific
  3736. JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
  3737. # tag:java-specific
  3738. JDK_REAL_VERSION=
  3739. JDK_VERSION=
  3740. when ($JDK_VERSION == "17") {
  3741. JDK_REAL_VERSION=17
  3742. }
  3743. elsewhen ($JDK_VERSION == "16") {
  3744. JDK_REAL_VERSION=16
  3745. }
  3746. elsewhen ($JDK_VERSION == "15") {
  3747. JDK_REAL_VERSION=15
  3748. }
  3749. elsewhen ($JDK_VERSION == "14") {
  3750. JDK_REAL_VERSION=14
  3751. }
  3752. elsewhen ($JDK_VERSION == "13") {
  3753. JDK_REAL_VERSION=13
  3754. }
  3755. elsewhen ($JDK_VERSION == "12") {
  3756. JDK_REAL_VERSION=12
  3757. }
  3758. elsewhen ($JDK_VERSION == "11") {
  3759. JDK_REAL_VERSION=11
  3760. }
  3761. elsewhen ($JDK_VERSION == "10") {
  3762. JDK_REAL_VERSION=10
  3763. }
  3764. elsewhen ($JDK_VERSION == "8") {
  3765. JDK_REAL_VERSION=8
  3766. }
  3767. elsewhen ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
  3768. JDK_REAL_VERSION=8
  3769. }
  3770. otherwise {
  3771. JDK_REAL_VERSION=17
  3772. }
  3773. # tag:java-specific
  3774. # remove extra peerdir to jdk11 after https://st.yandex-team.ru/DEVTOOLS-8851 is done
  3775. when ($USE_SYSTEM_JDK) {
  3776. JDK_RESOURCE_PEERDIR=
  3777. }
  3778. otherwise {
  3779. when ($JDK_REAL_VERSION == "17") {
  3780. # need jdk11 for spare parts in "host" platform
  3781. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk17 build/platform/java/jdk/jdk11
  3782. }
  3783. when ($JDK_REAL_VERSION == "16") {
  3784. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk16 build/platform/java/jdk/jdk17
  3785. }
  3786. when ($JDK_REAL_VERSION == "15") {
  3787. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk15 build/platform/java/jdk/jdk17
  3788. }
  3789. when ($JDK_REAL_VERSION == "14") {
  3790. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk14 build/platform/java/jdk/jdk17
  3791. }
  3792. when ($JDK_REAL_VERSION == "13") {
  3793. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk13 build/platform/java/jdk/jdk17
  3794. }
  3795. when ($JDK_REAL_VERSION == "12") {
  3796. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk12 build/platform/java/jdk/jdk17
  3797. }
  3798. when ($JDK_REAL_VERSION == "11") {
  3799. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk11 build/platform/java/jdk/jdk17
  3800. }
  3801. when ($JDK_REAL_VERSION == "10") {
  3802. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk10 build/platform/java/jdk/jdk17
  3803. }
  3804. when ($JDK_REAL_VERSION == "8") {
  3805. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk8 build/platform/java/jdk/jdk17
  3806. }
  3807. }
  3808. # tag:java-specific
  3809. when ($JDK_REAL_VERSION == "17") {
  3810. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar17
  3811. }
  3812. when ($JDK_REAL_VERSION == "16") {
  3813. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar16
  3814. }
  3815. when ($JDK_REAL_VERSION == "15") {
  3816. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar15
  3817. }
  3818. when ($JDK_REAL_VERSION == "14") {
  3819. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar14
  3820. }
  3821. when ($JDK_REAL_VERSION == "13") {
  3822. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar13
  3823. }
  3824. when ($JDK_REAL_VERSION == "12") {
  3825. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar12
  3826. }
  3827. when ($JDK_REAL_VERSION == "11") {
  3828. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar11
  3829. }
  3830. when ($JDK_REAL_VERSION == "10") {
  3831. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar10
  3832. }
  3833. when ($JDK_REAL_VERSION == "8") {
  3834. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar8
  3835. }
  3836. # tag:java-specific
  3837. JAVAC_OPTS=
  3838. when ($USE_SYSTEM_JDK) {
  3839. JDK_RESOURCE=$USE_SYSTEM_JDK
  3840. }
  3841. otherwise {
  3842. when ($JDK_REAL_VERSION == "17") {
  3843. JDK_RESOURCE=$JDK17_RESOURCE_GLOBAL
  3844. }
  3845. when ($JDK_REAL_VERSION == "16") {
  3846. JDK_RESOURCE=$JDK16_RESOURCE_GLOBAL
  3847. }
  3848. when ($JDK_REAL_VERSION == "15") {
  3849. JDK_RESOURCE=$JDK15_RESOURCE_GLOBAL
  3850. }
  3851. when ($JDK_REAL_VERSION == "14") {
  3852. JDK_RESOURCE=$JDK14_RESOURCE_GLOBAL
  3853. }
  3854. when ($JDK_REAL_VERSION == "13") {
  3855. JDK_RESOURCE=$JDK13_RESOURCE_GLOBAL
  3856. }
  3857. when ($JDK_REAL_VERSION == "12") {
  3858. JDK_RESOURCE=$JDK12_RESOURCE_GLOBAL
  3859. }
  3860. when ($JDK_REAL_VERSION == "11") {
  3861. JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  3862. }
  3863. when ($JDK_REAL_VERSION == "10") {
  3864. JDK_RESOURCE=$JDK10_RESOURCE_GLOBAL
  3865. }
  3866. when ($JDK_REAL_VERSION == "8") {
  3867. JDK_RESOURCE=$JDK8_RESOURCE_GLOBAL
  3868. }
  3869. }
  3870. # tag:java-specific
  3871. when (!$USE_SYSTEM_ERROR_PRONE) {
  3872. when ($JDK_REAL_VERSION == "8" || $JDK_REAL_VERSION == "10") {
  3873. ERROR_PRONE_VERSION=2.3.1
  3874. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.3.1
  3875. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_3_1_RESOURCE_GLOBAL
  3876. }
  3877. elsewhen ($JDK_REAL_VERSION == "11" || $JDK_REAL_VERSION == "12" || $JDK_REAL_VERSION == "13" || $JDK_REAL_VERSION == "14" || $JDK_REAL_VERSION == "15" || $JDK_REAL_VERSION == "16") {
  3878. ERROR_PRONE_VERSION=2.7.1
  3879. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.7.1
  3880. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_7_1_RESOURCE_GLOBAL
  3881. }
  3882. elsewhen ($JDK_REAL_VERSION == "17") {
  3883. ERROR_PRONE_VERSION=2.10.0
  3884. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.10.0
  3885. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_10_0_RESOURCE_GLOBAL
  3886. }
  3887. otherwise {
  3888. ERROR_PRONE_VERSION=2.7.1
  3889. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  3890. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  3891. }
  3892. }
  3893. otherwise {
  3894. ERROR_PRONE_VERSION=2.7.1
  3895. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  3896. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  3897. }
  3898. # tag:java-specific
  3899. when ($USE_SYSTEM_UBERJAR) {
  3900. UBERJAR_RESOURCE=$USE_SYSTEM_UBERJAR
  3901. }
  3902. otherwise {
  3903. when ($JDK_REAL_VERSION == "17") {
  3904. UBERJAR_RESOURCE=$UBERJAR17_RESOURCE_GLOBAL
  3905. }
  3906. when ($JDK_REAL_VERSION == "16") {
  3907. UBERJAR_RESOURCE=$UBERJAR16_RESOURCE_GLOBAL
  3908. }
  3909. when ($JDK_REAL_VERSION == "15") {
  3910. UBERJAR_RESOURCE=$UBERJAR15_RESOURCE_GLOBAL
  3911. }
  3912. when ($JDK_REAL_VERSION == "14") {
  3913. UBERJAR_RESOURCE=$UBERJAR14_RESOURCE_GLOBAL
  3914. }
  3915. when ($JDK_REAL_VERSION == "13") {
  3916. UBERJAR_RESOURCE=$UBERJAR13_RESOURCE_GLOBAL
  3917. }
  3918. when ($JDK_REAL_VERSION == "12") {
  3919. UBERJAR_RESOURCE=$UBERJAR12_RESOURCE_GLOBAL
  3920. }
  3921. when ($JDK_REAL_VERSION == "11") {
  3922. UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
  3923. }
  3924. when ($JDK_REAL_VERSION == "10") {
  3925. UBERJAR_RESOURCE=$UBERJAR10_RESOURCE_GLOBAL
  3926. }
  3927. when ($JDK_REAL_VERSION == "8") {
  3928. UBERJAR_RESOURCE=$UBERJAR8_RESOURCE_GLOBAL
  3929. }
  3930. }
  3931. # tag:java-specific
  3932. when ($JDK_REAL_VERSION == "17") {
  3933. WITH_JDK_RESOURCE=$WITH_JDK17_RESOURCE_GLOBAL
  3934. }
  3935. when ($JDK_REAL_VERSION == "16") {
  3936. WITH_JDK_RESOURCE=$WITH_JDK16_RESOURCE_GLOBAL
  3937. }
  3938. when ($JDK_REAL_VERSION == "15") {
  3939. WITH_JDK_RESOURCE=$WITH_JDK15_RESOURCE_GLOBAL
  3940. }
  3941. when ($JDK_REAL_VERSION == "14") {
  3942. WITH_JDK_RESOURCE=$WITH_JDK14_RESOURCE_GLOBAL
  3943. }
  3944. when ($JDK_REAL_VERSION == "13") {
  3945. WITH_JDK_RESOURCE=$WITH_JDK13_RESOURCE_GLOBAL
  3946. }
  3947. when ($JDK_REAL_VERSION == "12") {
  3948. WITH_JDK_RESOURCE=$WITH_JDK12_RESOURCE_GLOBAL
  3949. }
  3950. when ($JDK_REAL_VERSION == "11") {
  3951. WITH_JDK_RESOURCE=$WITH_JDK11_RESOURCE_GLOBAL
  3952. }
  3953. when ($JDK_REAL_VERSION == "10") {
  3954. WITH_JDK_RESOURCE=$WITH_JDK10_RESOURCE_GLOBAL
  3955. }
  3956. when ($JDK_REAL_VERSION == "8") {
  3957. WITH_JDK_RESOURCE=$WITH_JDK8_RESOURCE_GLOBAL
  3958. }
  3959. # tag:java-specific
  3960. EXTERNAL_JAVA_JDK_RESOURCE=
  3961. EXTERNAL_JAVA_EXTRA_PEERDIR=
  3962. when ($USE_SYSTEM_JDK) {
  3963. EXTERNAL_JAVA_EXTRA_PEERDIR=
  3964. EXTERNAL_JAVA_JDK_RESOURCE=$USE_SYSTEM_JDK
  3965. }
  3966. elsewhen ($JDK_VERSION == "") {
  3967. EXTERNAL_JAVA_JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  3968. EXTERNAL_JAVA_EXTRA_PEERDIR=build/platform/java/jdk/jdk11
  3969. }
  3970. otherwise {
  3971. EXTERNAL_JAVA_JDK_RESOURCE=$JDK_RESOURCE
  3972. }
  3973. COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_java.py"} --javac-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/jar $JAVA_VCS_MF_ARG $PACKAGE_PREFIX_ARGS --jar-output $TARGET --srcs-jar-output ${output;suf=-sources.jar:REALPRJNAME} $AUTO_INPUT DELIM $JAVAC_OPTS DELIM $PEERS ${requirements;hide:JAVA_REQUIREMENTS} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${kv;hide:"PEERS $PEERS"}
  3974. REAL_SWIG_DLL_JAR_CMD=$GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/build_dll_and_java.py"} $JAVA_SWIG_DELIM $REAL_LINK_DYN_LIB $JAVA_SWIG_DELIM $COMPILE_JAVA $JAVA_SWIG_DELIM $AUTO_INPUT $JAVA_SWIG_DELIM $TARGET $JAVA_SWIG_DELIM ${output;suf=.jar:REALPRJNAME} $JAVA_SWIG_DELIM ${output;suf=-sources.jar:REALPRJNAME} $JAVA_SWIG_DELIM $ARCADIA_BUILD_ROOT $ARCADIA_ROOT
  3975. # tag:deprecated
  3976. ### @usage: METAQUERY() #deprecated
  3977. ###
  3978. ### Project Definition - KIWI Meta query. (Objected)
  3979. ###
  3980. ### https://wiki.yandex-team.ru/robot/manual/kiwi/techdoc/design/metaquery/
  3981. module METAQUERY: _BASE_UNIT {
  3982. .ALL_INS_TO_OUT=yes
  3983. .FINAL_TARGET=yes
  3984. PRINT_MODULE_TYPE(METAQUERY $MODULE_PREFIX$REALPRJNAME)
  3985. }
  3986. ARGS_DELIM="MACRO_CALLS_DELIM"
  3987. SYSTEM_PROPERTIES_VALUE=
  3988. ### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
  3989. ###
  3990. ### List of Key,Value pairs that will be available to test via System.getProperty().
  3991. ### FILE means that parst should be read from file specifies as Path.
  3992. ###
  3993. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3994. macro SYSTEM_PROPERTIES(Args...) {
  3995. SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
  3996. }
  3997. # tag:java-specific
  3998. JVM_ARGS_VALUE=
  3999. ### @usage: JVM_ARGS(Args...)
  4000. ###
  4001. ### Arguments to run Java programs in tests.
  4002. ###
  4003. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4004. macro JVM_ARGS(Args...) {
  4005. SET_APPEND(JVM_ARGS_VALUE $Args)
  4006. }
  4007. # tag:java-specific
  4008. CHECK_JAVA_DEPS_VALUE=
  4009. ### @usage: CHECK_JAVA_DEPS(<yes|no>)
  4010. ###
  4011. ### Check for different classes with duplicate name in classpath.
  4012. ###
  4013. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4014. macro CHECK_JAVA_DEPS(Arg) {
  4015. SET(CHECK_JAVA_DEPS_VALUE $Arg)
  4016. }
  4017. ERROR_PRONE_VALUE=
  4018. ### @usage: USE_ERROR_PRONE()
  4019. ###
  4020. ### Use errorprone instead of javac for .java compilation.
  4021. macro USE_ERROR_PRONE() {
  4022. SET(ERROR_PRONE_VALUE yes)
  4023. }
  4024. TEST_CWD_VALUE=
  4025. ### @usage: TEST_CWD(path)
  4026. ###
  4027. ### Defines working directory for test runs. Othen used in conjunction with DATA() macro.
  4028. ### Is only used inside of the TEST modules.
  4029. ###
  4030. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4031. macro TEST_CWD(Arg) {
  4032. SET(TEST_CWD_VALUE $Arg)
  4033. }
  4034. # tag:java-specific
  4035. MAKE_UBERJAR_VALUE=
  4036. ### @usage: UBERJAR()
  4037. ###
  4038. ### UBERJAR is a single all-in-one jar-archive that includes all its Java dependencies (reachable PEERDIR).
  4039. ### It also supports shading classes inside the archive by moving them to a different package (similar to the maven-shade-plugin).
  4040. ### Use UBERJAR inside JAVA_PROGRAM module.
  4041. ###
  4042. ### You can use the following macros to configure the archive:
  4043. ### 1. UBERJAR_HIDING_PREFIX prefix for classes to shade (classes remain in their packages by default)
  4044. ### 2. UBERJAR_HIDE_EXCLUDE_PATTERN exclude classes matching this patterns from shading (if enabled).
  4045. ### 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)
  4046. ### 4. UBERJAR_MANIFEST_TRANSFORMER_MAIN add ManifestResourceTransformer class to uberjar processing and specify main-class
  4047. ### 5. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE add ManifestResourceTransformer class to uberjar processing and specify some attribute
  4048. ### 6. UBERJAR_APPENDING_TRANSFORMER add AppendingTransformer class to uberjar processing
  4049. ### 7. UBERJAR_SERVICES_RESOURCE_TRANSFORMER add ServicesResourceTransformer class to uberjar processing
  4050. ###
  4051. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  4052. ###
  4053. ### @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)
  4054. macro UBERJAR() {
  4055. SET(MAKE_UBERJAR_VALUE yes)
  4056. }
  4057. # tag:java-specific
  4058. UBERJAR_PREFIX_VALUE=
  4059. UBERJAR_PREFIX_FLAG=
  4060. ### @usage: UBERJAR_HIDING_PREFIX(Arg)
  4061. ###
  4062. ### Set prefix for classes to shade. All classes in UBERJAR will be moved into package prefixed with Arg.
  4063. ### Classes remain in their packages by default.
  4064. ###
  4065. ### @see: [UBERJAR](#macro_UBERJAR)
  4066. macro UBERJAR_HIDING_PREFIX(Arg) {
  4067. SET(UBERJAR_PREFIX_VALUE $Arg)
  4068. SET(UBERJAR_PREFIX_FLAG ${pre=--shade-prefix :Arg})
  4069. }
  4070. # tag:java-specific
  4071. UBERJAR_HIDE_EXCLUDE_VALUE=
  4072. UBERJAR_HIDE_EXCLUDE_FLAGS=
  4073. ### @usage: UBERJAR_HIDE_EXCLUDE_PATTERN(Args...)
  4074. ###
  4075. ### Exculude classes matching this patterns from shading (if enabled).
  4076. ### Pattern may contain '*' and '**' globs.
  4077. ### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
  4078. ###
  4079. ### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
  4080. macro UBERJAR_HIDE_EXCLUDE_PATTERN(Args...) {
  4081. SET_APPEND(UBERJAR_HIDE_EXCLUDE_VALUE $ARGS_DELIM $Args)
  4082. SET_APPEND(UBERJAR_HIDE_EXCLUDE_FLAGS ${pre=--shade-exclude :Args})
  4083. }
  4084. # tag:java-specific
  4085. UBERJAR_PATH_EXCLUDES=
  4086. UBERJAR_PATH_EXCLUDE_VALUE=
  4087. ### @usage: UBERJAR_PATH_EXCLUDE_PREFIX(Args...)
  4088. ###
  4089. ### Exculude classes matching this patterns from UBERJAR.
  4090. ### By default all dependencies of UBERJAR program will lend in a .jar archive.
  4091. ###
  4092. ### @see: [UBERJAR](#macro_UBERJAR)
  4093. macro UBERJAR_PATH_EXCLUDE_PREFIX(Args...) {
  4094. SET_APPEND(UBERJAR_PATH_EXCLUDE_VALUE $ARGS_DELIM $Args)
  4095. SET_APPEND(UBERJAR_PATH_EXCLUDES ${pre=--uber-exclude :Args})
  4096. }
  4097. # tag:java-specific
  4098. UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE=
  4099. UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG=
  4100. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main)
  4101. ###
  4102. ### Transform manifest.mf for UBERJAR() java programs, set main-class attribute
  4103. ###
  4104. ### @see: [UBERJAR](#macro_UBERJAR)
  4105. macro UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main) {
  4106. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE $Main)
  4107. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG --manifest-main $Main)
  4108. }
  4109. # tag:java-specific
  4110. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE=
  4111. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS=
  4112. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value)
  4113. ###
  4114. ### Transform manifest.mf for UBERJAR() java programs, set attribute
  4115. ###
  4116. ### @see: [UBERJAR](#macro_UBERJAR)
  4117. macro UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value) {
  4118. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Value)
  4119. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:${Value})
  4120. }
  4121. # tag:java-specific
  4122. UBERJAR_APPENDING_TRANSFORMER_VALUE=
  4123. UBERJAR_APPENDING_TRANSFORMER_FLAGS=
  4124. ### @usage: UBERJAR_APPENDING_TRANSFORMER(Resource)
  4125. ###
  4126. ### Add AppendingTransformer for UBERJAR() java programs
  4127. ###
  4128. ### Parameters:
  4129. ### - Resource - Resource name
  4130. ###
  4131. ### @see: [UBERJAR](#macro_UBERJAR)
  4132. macro UBERJAR_APPENDING_TRANSFORMER(Resources...) {
  4133. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_VALUE $ARGS_DELIM $Resources)
  4134. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_FLAGS ${pre=--append-transformer :Resources})
  4135. }
  4136. # tag:java-specific
  4137. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE=
  4138. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG=
  4139. ### @usage: UBERJAR_SERVICES_RESOURCE_TRANSFORMER()
  4140. ###
  4141. ### Add ServicesResourceTransformer for UBERJAR() java programs
  4142. ###
  4143. ### @see: [UBERJAR](#macro_UBERJAR)
  4144. macro UBERJAR_SERVICES_RESOURCE_TRANSFORMER() {
  4145. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE yes)
  4146. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG --service-transformer)
  4147. }
  4148. # tag:idea-specific
  4149. IDEA_EXCLUDE_DIRS_VALUE=
  4150. ### @usage: IDEA_EXCLUDE_DIRS(<excluded dirs>)
  4151. ###
  4152. ### Exclude specified directories from an idea project generated by ya ide idea
  4153. ### Have no effect on regular build.
  4154. macro IDEA_EXCLUDE_DIRS(Args...) {
  4155. SET_APPEND(IDEA_EXCLUDE_DIRS_VALUE $Args)
  4156. }
  4157. # tag:idea-specific
  4158. IDEA_RESOURCE_DIRS_VALUE=
  4159. ### @usage: IDEA_RESOURCE_DIRS(<additional dirs>)
  4160. ###
  4161. ### Set specified resource directories in an idea project generated by ya ide idea
  4162. ### Have no effect on regular build.
  4163. macro IDEA_RESOURCE_DIRS(Args...) {
  4164. SET_APPEND(IDEA_RESOURCE_DIRS_VALUE $Args)
  4165. }
  4166. # tag:idea-specific
  4167. IDEA_MODULE_NAME_VALUE=
  4168. ### @usage: IDEA_MODULE_NAME(module_name)
  4169. ###
  4170. ### Set module name in an idea project generated by ya ide idea
  4171. ### Have no effect on regular build.
  4172. macro IDEA_MODULE_NAME(Name) {
  4173. SET(IDEA_MODULE_NAME_VALUE $Name)
  4174. }
  4175. # tag:java-specific
  4176. JAVAC_FLAGS_VALUE=
  4177. ### @usage: JAVAC_FLAGS(Args...)
  4178. ###
  4179. ### Set additional Java compilation flags.
  4180. macro JAVAC_FLAGS(Args...) {
  4181. SET_APPEND(JAVAC_OPTS $Args)
  4182. SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
  4183. }
  4184. # tag:java-specific
  4185. ENABLE_PREVIEW_VALUE=
  4186. ### @usage: ENABLE_PREVIEW()
  4187. ###
  4188. ### Enable java preview features.
  4189. macro ENABLE_PREVIEW() {
  4190. SET_APPEND(JVM_ARGS_VALUE --enable-preview)
  4191. SET_APPEND(JAVAC_OPTS --enable-preview --release $JDK_REAL_VERSION)
  4192. SET_APPEND(JAVAC_FLAGS_VALUE --enable-preview --release $JDK_REAL_VERSION)
  4193. SET(ENABLE_PREVIEW_VALUE yes)
  4194. }
  4195. # tag:java-specific
  4196. SAVE_JAVAC_GENERATED_SRCS=
  4197. SAVE_JAVAC_GENERATED_SRCS_DIR=
  4198. SAVE_JAVAC_GENERATED_SRCS_TAR=
  4199. when ($SAVE_JAVAC_GENERATED_SRCS) {
  4200. SAVE_JAVAC_GENERATED_SRCS_DIR=${BINDIR}/__javac_generated_srcs__
  4201. SAVE_JAVAC_GENERATED_SRCS_TAR=${BINDIR}/javac_generated.tar
  4202. JAVAC_FLAGS_VALUE+=-s $SAVE_JAVAC_GENERATED_SRCS_DIR
  4203. }
  4204. # tag:java-specific
  4205. MAVEN_GROUP_ID_VALUE=
  4206. ### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
  4207. ###
  4208. ### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
  4209. ### Have no effect on regular build.
  4210. macro MAVEN_GROUP_ID(Arg) {
  4211. SET(MAVEN_GROUP_ID_VALUE $Arg)
  4212. }
  4213. # tag:java-specific
  4214. ANNOTATION_PROCESSOR_VALUE=
  4215. ### @usage: ANNOTATION_PROCESSOR(processors...)
  4216. ###
  4217. ### The macro is in development.
  4218. ### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
  4219. macro ANNOTATION_PROCESSOR(Args...) {
  4220. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Args)
  4221. }
  4222. EXCLUDE_VALUE=
  4223. ### EXCLUDE(prefixes)
  4224. ###
  4225. ### The macro is in development.
  4226. ### Specifies which libraries should be excluded from the classpath.
  4227. macro EXCLUDE(Args...) {
  4228. SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args)
  4229. }
  4230. # tag:java-specific
  4231. JAVA_SRCS_VALUE=
  4232. ### @usage: JAVA_SRCS(srcs)
  4233. ###
  4234. ### Specify java source files and resources. A macro can be contained in any of four java modules.
  4235. ### Keywords:
  4236. ### 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.
  4237. ### 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.
  4238. ###
  4239. ### @example:
  4240. ### - example/ya.make
  4241. ###
  4242. ### JAVA_PROGRAM()
  4243. ### JAVA_SRCS(SRCDIR src/main/java **/*)
  4244. ### END()
  4245. ###
  4246. ### - example/src/main/java/ru/yandex/example/HelloWorld.java
  4247. ###
  4248. ### package ru.yandex.example;
  4249. ### public class HelloWorld {
  4250. ### public static void main(String[] args) {
  4251. ### System.out.println("Hello, World!");
  4252. ### }
  4253. ### }
  4254. ###
  4255. ### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
  4256. macro JAVA_SRCS(Args...) {
  4257. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  4258. }
  4259. # tag:java-specific
  4260. JAVA_ADD_DLLS_VALUE=no
  4261. macro ADD_DLLS_TO_JAR() {
  4262. SET(JAVA_ADD_DLLS_VALUE yes)
  4263. }
  4264. # tag:java-specific
  4265. MANAGED_PEERS=
  4266. MANAGED_PEERS_CLOSURE=
  4267. RUN_JAVA_PROGRAM_MANAGED=
  4268. MANAGEABLE_PEERS_ROOTS=contrib/java
  4269. HAS_MANAGEABLE_PEERS=no
  4270. PROPAGATES_MANAGEABLE_PEERS=no
  4271. YMAKE_CLASSPATH_CHECKS=yes
  4272. # All items of this list must be PEERS, GHOST PEERS or TOOLS of the test module or module itself.
  4273. # All items of this list must has at least one of HAS_MANAGEABLE_PEERS or PROPAGATES_MANAGEABLE_PEERS flags set yes.
  4274. # This variable is used by JUnit tests but not TestNG.
  4275. TEST_CLASSPATH_VALUE=
  4276. # Calculated and replaced by ymake can be used in DART DATA
  4277. TEST_CLASSPATH_MANAGED=
  4278. # tag:java-specific
  4279. DEPENDENCY_MANAGEMENT_VALUE=
  4280. ### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
  4281. ###
  4282. ### 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.
  4283. ###
  4284. ### For example, if the moduse has PEERDIR (contrib/java/junit/junit), and
  4285. ### 1. specifies DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12),
  4286. ### the PEERDIR is automatically replaced by contrib/java/junit/junit/4.12;
  4287. ### 2. doesn't specify DEPENDENCY_MANAGEMENT, PEERDIR automatically replaced
  4288. ### with the default from contrib/java/junit/junit/ya.make.
  4289. ### These defaults are always there and are supported by maven-import, which puts
  4290. ### there the maximum version available in contrib/java.
  4291. ###
  4292. ### 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.
  4293. ###
  4294. ### If some module has both DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12) and PERDIR(contrib/java/junit/junit/4.11), the PEERDIR wins.
  4295. ###
  4296. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  4297. macro DEPENDENCY_MANAGEMENT(Args...) {
  4298. SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
  4299. _GHOST_PEERDIR($Args)
  4300. }
  4301. # tag:java-specific
  4302. WITH_JDK_VALUE=
  4303. ### @usage: WITH_JDK()
  4304. ###
  4305. ### Add directory with JDK to JAVA_PROGRAM output
  4306. macro WITH_JDK() {
  4307. SET(WITH_JDK_VALUE yes)
  4308. }
  4309. # tag:kotlin-specific
  4310. WITH_KOTLIN_VALUE=
  4311. ### @usage: WITH_KOTLIN()
  4312. ###
  4313. ### Compile kotlin source code in this java module
  4314. macro WITH_KOTLIN() {
  4315. SET(WITH_KOTLIN_VALUE yes)
  4316. }
  4317. # tag:java-specific
  4318. WITH_GROOVY_VALUE=
  4319. ### @usage: WITH_GROOVY()
  4320. ###
  4321. ### Compile groovy source code in this java module
  4322. macro WITH_GROOVY() {
  4323. SET(WITH_GROOVY_VALUE yes)
  4324. }
  4325. # tag:kotlin-specific
  4326. KOTLINC_FLAGS_VALUE=-Xjvm-default=all
  4327. ### @usage: KOTLINC_FLAGS(-flags)
  4328. ###
  4329. ### Set additional Kotlin compilation flags.
  4330. macro KOTLINC_FLAGS(Args...) {
  4331. SET_APPEND(KOTLINC_OPTS_VALUE $Args)
  4332. }
  4333. # tag:kotlin-specific
  4334. WITH_KOTLINC_PLUGIN_ALLOPEN=
  4335. ### @usage: WITH_KOTLINC_ALLOPEN(-flags)
  4336. ###
  4337. ### Enable allopen kotlin compiler plugin https://kotlinlang.org/docs/all-open-plugin.html
  4338. macro WITH_KOTLINC_ALLOPEN(Options...) {
  4339. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.allopen\::Options})
  4340. SET(WITH_KOTLINC_PLUGIN_ALLOPEN yes)
  4341. }
  4342. # tag:kotlin-specific
  4343. WITH_KOTLINC_PLUGIN_NOARG=
  4344. ### @usage: WITH_KOTLINC_NOARG(-flags)
  4345. ###
  4346. ### Enable noarg kotlin compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html
  4347. macro WITH_KOTLINC_NOARG(Options...) {
  4348. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.noarg\::Options})
  4349. SET(WITH_KOTLINC_PLUGIN_NOARG yes)
  4350. }
  4351. # tag:kotlin-specific
  4352. KOTLIN_VERSION=1.6.10
  4353. KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.6.10/ya.dependency_management.inc
  4354. GROOVY_VERSION=3.0.5
  4355. # tag:java-specific
  4356. DIRECT_DEPS_ONLY_VALUE=
  4357. ### @usage: DIRECT_DEPS_ONLY
  4358. ###
  4359. ### Add direct PEERDIR's only in java compile classpath
  4360. macro DIRECT_DEPS_ONLY() {
  4361. SET(DIRECT_DEPS_ONLY_VALUE yes)
  4362. }
  4363. # tag:java-specific
  4364. JAVA_EXTERNAL_DEPENDENCIES_VALUE=
  4365. ### @usage: JAVA_EXTERNAL_DEPENDENCIES(file1 file2 ...)
  4366. ###
  4367. ### Add non-source java external build dependency (like lombok config file)
  4368. macro JAVA_EXTERNAL_DEPENDENCIES(Args...) {
  4369. SET_APPEND(JAVA_EXTERNAL_DEPENDENCIES_VALUE $Args)
  4370. }
  4371. # tag:java-specific
  4372. ### @usage _JAVA_PLACEHOLDER #internal
  4373. ### The base module for all Java modules. Defines common properties and dependencies.
  4374. module _JAVA_PLACEHOLDER: _BASE_UNIT {
  4375. .CMD=TOUCH_JAVA_UNIT
  4376. .FINAL_TARGET=yes
  4377. .ALLOWED=DEPENDENCY_MANAGEMENT EXCLUDE
  4378. .ALIASES=RUN_JAVA_PROGRAM=_RUN_JBUILD_PROGRAM
  4379. HAS_MANAGEABLE_PEERS=yes
  4380. DYNAMIC_LINK=yes
  4381. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL JAR_COMPILATION
  4382. PEERDIR(build/platform/java/jdk)
  4383. PEERDIR+=$JDK_RESOURCE_PEERDIR
  4384. when($MAKE_UBERJAR_VALUE) {
  4385. PEERDIR+=build/platform/java/uberjar
  4386. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  4387. }
  4388. when($ERROR_PRONE_VALUE) {
  4389. # Jbuild assumes hardcoded resource name https://a.yandex-team.ru/arc_vcs/devtools/ya/jbuild/gen/consts/__init__.py?rev=1739368ed5aaa585b8300b84e5dea708a2bedd3a#L130
  4390. # adding default peerdir as a hack to make `ya ide idea` and `ya maven-export` work for now
  4391. PEERDIR+=build/platform/java/error_prone
  4392. PEERDIR+=$ERROR_PRONE_PEERDIR
  4393. }
  4394. # in the ideal world this statement must be under condition bellow
  4395. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
  4396. when($WITH_KOTLIN_VALUE) {
  4397. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  4398. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  4399. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  4400. }
  4401. when($WITH_KOTLINC_PLUGIN_NOARG) {
  4402. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  4403. }
  4404. }
  4405. when($WITH_GROOVY_VALUE) {
  4406. PEERDIR+=build/platform/java/groovy contrib/java/org/codehaus/groovy/groovy/${GROOVY_VERSION}
  4407. }
  4408. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
  4409. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  4410. }
  4411. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  4412. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  4413. }
  4414. JAVA_DEPENDENCIES_CONFIGURATION(FORBID_DEFAULT_VERSIONS)
  4415. DISABLE(NEED_PLATFORM_PEERDIRS)
  4416. NO_PLATFORM()
  4417. JAVA_MODULE()
  4418. # flatbuffers-java
  4419. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  4420. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  4421. # protobuf-java
  4422. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  4423. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  4424. # protobuf-javalite
  4425. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  4426. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  4427. # protobuf-java-util
  4428. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  4429. 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})
  4430. SET(MODULE_LANG JAVA)
  4431. }
  4432. # tag:java-specific
  4433. JAVA_CLASSPATH_CMD_TYPE_VALUE=
  4434. # tag:java-specific
  4435. ### @usage:TEST_JAVA_CLASSPATH_CMD_TYPE(Type)
  4436. ### Availible types: MANIFEST(default), COMMAND_FILE, LIST
  4437. ### Method for passing a classpath value to a java command line
  4438. ### MANIFEST via empty jar file with manifest that cantains Class-Path attribute
  4439. ### COMMAND_FILE via @command_file
  4440. ### LIST via flat args
  4441. macro TEST_JAVA_CLASSPATH_CMD_TYPE(Type) {
  4442. SET(JAVA_CLASSPATH_CMD_TYPE_VALUE $Type)
  4443. }
  4444. # tag:java-specific
  4445. IGNORE_JAVA_DEPENDENCIES_CONFIGURATION=no
  4446. JAVA_DEPENDENCIES_CONFIGURATION_VALUE=
  4447. # tag:java-specific
  4448. ### @usage JAVA_DEPENDENCIES_CONFIGURATION(Vetos...)
  4449. ### Validate contrib/java dependencies
  4450. ### Valid arguments
  4451. ### FORBID_DIRECT_PEERDIRS - fail when module have direct PEERDIR (with version) (non-transitive)
  4452. ### FORBID_DEFAULT_VERSIONS - fail when module have PEERDIR to library with default (last) version (transitive)
  4453. ### FORBID_CONFLICT - fail when module have resolved without DEPENDENCY_MANAGEMENT version conflict (transitive)
  4454. ### FORBID_CONFLICT_DM - fail when module have resolved with DEPENDENCY_MANAGEMENT version conflict (transitive)
  4455. ### FORBID_CONFLICT_DM_RECENT - like FORBID_CONFLICT_DM but fail only when dependency have more recent version than specified in DEPENDENCY_MANAGEMENT
  4456. ### REQUIRE_DM - all dependencies must be specified in DEPENDENCY_MANAGEMENT (transitive)
  4457. macro JAVA_DEPENDENCIES_CONFIGURATION(Args...) {
  4458. SET_APPEND(JAVA_DEPENDENCIES_CONFIGURATION_VALUE $Args)
  4459. }
  4460. # tag:java-specific
  4461. # TODO(DEVTOOLS-6901): remove this variable when there are no more references to it in jbuild
  4462. JAVA_FORBIDDEN_LIBRARIES_VALUE=
  4463. # tag:java-specific
  4464. JAR_INCLUDE_FILTER_VALUE=
  4465. JAR_EXCLUDE_FILTER_VALUE=
  4466. # tag:java-specific
  4467. ### @usage:JAR_INCLUDE(Filters...)
  4468. ### Filter .jar file content: keep only matched files
  4469. ### * and ** patterns are supported (like JAVA_SRCS)
  4470. macro JAR_INCLUDE(Filters...) {
  4471. SET_APPEND(JAR_INCLUDE_FILTER_VALUE $Filters)
  4472. }
  4473. # tag:java-specific
  4474. ### @usage:JAR_EXCLUDE(Filters...)
  4475. ### Filter .jar file content: remove matched files
  4476. ### * and ** patterns are supported (like JAVA_SRCS)
  4477. macro JAR_EXCLUDE(Filters...) {
  4478. SET_APPEND(JAR_EXCLUDE_FILTER_VALUE $Filters)
  4479. }
  4480. # tag:sandbox-specific
  4481. ### @usage: SANDBOX_TASK([Name])
  4482. ###
  4483. ### Multimodule describing Sandbox task (Python code that can be executed by Sandbox system).
  4484. ###
  4485. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_TASKs as libraries.
  4486. ### The final artifact is provided when SANDBOX_TASK is referred to by DEPENDS and BUNDLE macros.
  4487. ### As PEERDIR target, it works like regular PY2_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_TASKs.
  4488. ###
  4489. ### Currently Sandbox supports only Python 2.x, so both variants will be compatible only with Python 2.x modules
  4490. ### and will select multimodule variants accordingly.
  4491. ###
  4492. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4493. multimodule SANDBOX_TASK {
  4494. module SB_TASK_BIN: _PY2_PROGRAM {
  4495. PY_MAIN(sandbox.taskbox.binary)
  4496. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4497. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4498. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4499. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4500. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4501. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4502. when ($FAIL_PY2 == "yes") {
  4503. _OK=no
  4504. }
  4505. otherwise {
  4506. PEERDIR+=build/rules/py2_deprecation
  4507. }
  4508. ASSERT(_OK You are using deprecated Python2-only code (SANDBOX_TASK). Please consider rewriting to 2/3-compatible code.)
  4509. }
  4510. module PY2: PY2_LIBRARY {
  4511. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4512. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4513. }
  4514. }
  4515. # tag:sandbox-specific
  4516. multimodule SANDBOX_PY23_TASK {
  4517. module SB_TASK_BIN: _PY2_PROGRAM {
  4518. PY_MAIN(sandbox.taskbox.binary)
  4519. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4520. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4521. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4522. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4523. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4524. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4525. }
  4526. module PY2: PY2_LIBRARY {
  4527. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4528. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4529. OBJ_SUF=.py2
  4530. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  4531. }
  4532. module PY3: PY3_LIBRARY {
  4533. when ($MSVC == "yes" || $CYGWIN == "yes") {
  4534. MODULE_PREFIX=py3
  4535. }
  4536. otherwise {
  4537. MODULE_PREFIX=libpy3
  4538. }
  4539. OBJ_SUF=.py3
  4540. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  4541. PEERDIR(sandbox/sdk2)
  4542. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4543. }
  4544. }
  4545. # tag:sandbox-specific
  4546. ### @usage: SANDBOX_PY3_TASK([Name])
  4547. ###
  4548. ### Multimodule describing Sandbox task (Python3 code that can be executed by Sandbox system).
  4549. ###
  4550. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_PY3_TASKs as libraries.
  4551. ### The final artifact is provided when SANDBOX_PY3_TASK is referred to by DEPENDS and BUNDLE macros.
  4552. ### As PEERDIR target, it works like regular PY3_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_PY3_TASKs.
  4553. ###
  4554. ### Currently Sandbox supports Python 3.x only in binary tasks, both variants will be compatible only with Python 3.x and py23 libraries
  4555. ### and will select multimodule variants accordingly.
  4556. ###
  4557. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4558. multimodule SANDBOX_PY3_TASK {
  4559. module SB_TASK_BIN: PY3_PROGRAM_BIN {
  4560. PY_MAIN(sandbox.taskbox.binary)
  4561. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/taskbox/worker)
  4562. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4563. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4564. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4565. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4566. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4567. }
  4568. module PY3: PY3_LIBRARY {
  4569. PEERDIR(sandbox/sdk2)
  4570. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4571. }
  4572. }
  4573. # tag:python-specific tag:internal
  4574. NO_PYTHON_INCLS=no
  4575. ### @usage: NO_PYTHON_INCLUDES() # internal
  4576. ###
  4577. ### Disable dependencies on libraries providing Python headers.
  4578. ### This is only used in Python libraries themselves to avoid PEERDIR loops.
  4579. macro NO_PYTHON_INCLUDES() {
  4580. ENABLE(NO_PYTHON_INCLS)
  4581. }
  4582. # tag:python-specific
  4583. ### @usage: PYTHON2_ADDINCL()
  4584. ###
  4585. ### This macro adds include path for Python headers (Python 2.x variant) without PEERDIR.
  4586. ### This should be used in 2 cases only:
  4587. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4588. ### - In system Python libraries themselves since proper PEERDIR there may create a loop;
  4589. ### In all other cases use USE_PYTHON2 macro instead.
  4590. ###
  4591. ### Never use this macro in PY2_PROGRAM, PY2_LIBRARY and PY23_LIBRARY: they have everything needed by default.
  4592. ###
  4593. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4594. macro PYTHON2_ADDINCL() {
  4595. _PYTHON_ADDINCL()
  4596. SET(MODULE_TAG PY2_NATIVE)
  4597. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4598. }
  4599. # tag:python-specific tag:internal
  4600. ### @usage: _ARCADIA_PYTHON_ADDINCL() # internal
  4601. ### This macro sets up Python headers for modules with Arcadia python (e.g. PY2_LIBRARY) and configures module as Python 2.x.
  4602. macro _ARCADIA_PYTHON_ADDINCL() {
  4603. _PYTHON_ADDINCL()
  4604. SET(MODULE_TAG PY2)
  4605. SET(PEERDIR_TAGS PY2 PY2_NATIVE PY_PROTO PY2_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4606. }
  4607. # tag:python-specific tag:internal
  4608. ### @usage: _PYTHON_ADDINCL() # internal
  4609. ### This macro sets up Python 2.x headers for both Arcadia and non-Arcadia python.
  4610. macro _PYTHON_ADDINCL() {
  4611. SET(PYTHON2 yes)
  4612. SET(PYTHON3 no)
  4613. when ($USE_ARCADIA_PYTHON == "yes") {
  4614. ADDINCL+=GLOBAL contrib/libs/python/Include
  4615. CFLAGS+=-DARCADIA_PYTHON_UNICODE_SIZE=$ARCADIA_PYTHON_UNICODE_SIZE
  4616. }
  4617. otherwise {
  4618. when ($USE_SYSTEM_PYTHON) {
  4619. PEERDIR+=build/platform/python
  4620. }
  4621. otherwise {
  4622. CFLAGS+=$PYTHON_INCLUDE
  4623. }
  4624. }
  4625. }
  4626. # tag:python-specific
  4627. ### @usage: PYTHON3_ADDINCL()
  4628. ###
  4629. ### This macro adds include path for Python headers (Python 3.x variant).
  4630. ### This should be used in 2 cases only:
  4631. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4632. ### - In system Python libraries themselves since peerdir there may create a loop;
  4633. ### In all other cases use USE_PYTHON3() macro instead.
  4634. ###
  4635. ### Never use this macro in PY3_PROGRAM and PY3_LIBRARY and PY23_LIBRARY: they have everything by default.
  4636. ###
  4637. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4638. macro PYTHON3_ADDINCL() {
  4639. _PYTHON3_ADDINCL()
  4640. SET(MODULE_TAG PY3_NATIVE)
  4641. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY3_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4642. }
  4643. # tag:python-specific tag:internal
  4644. ### @usage: _ARCADIA_PYTHON3_ADDINCL() # internal
  4645. ###
  4646. ### This macro sets up Python3 headers for modules with Arcadia python (e.g. PY3_LIBRARY) and configures module as Python 3.x.
  4647. macro _ARCADIA_PYTHON3_ADDINCL() {
  4648. _PYTHON3_ADDINCL()
  4649. SET(MODULE_TAG PY3)
  4650. SET(MODULE_LANG PY3)
  4651. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE PY3_PROTO PY3_FBS PY3_SSQLS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4652. }
  4653. # tag:python-specific tag:internal
  4654. ### @usage: _PYTHON_ADDINCL() # internal
  4655. ###
  4656. ### This macro sets up Python 3.x headers for both Arcadia and non-Arcadia python.
  4657. macro _PYTHON3_ADDINCL() {
  4658. SET(PYTHON3 yes)
  4659. SET(PYTHON2 no)
  4660. when ($USE_ARCADIA_PYTHON == "yes") {
  4661. CFLAGS+=-DUSE_PYTHON3
  4662. ADDINCL+=GLOBAL contrib/libs/python/Include
  4663. }
  4664. otherwise {
  4665. when ($USE_SYSTEM_PYTHON) {
  4666. PEERDIR+=build/platform/python
  4667. }
  4668. otherwise {
  4669. CFLAGS+=$PYTHON_INCLUDE
  4670. }
  4671. }
  4672. }
  4673. # tag:python-specific
  4674. ### @usage: USE_PYTHON2()
  4675. ###
  4676. ### This adds Python 2.x runtime library to your LIBRARY and makes it Python2-compatible.
  4677. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4678. ###
  4679. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4680. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4681. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4682. ###
  4683. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4684. macro USE_PYTHON2() {
  4685. _ARCADIA_PYTHON_ADDINCL()
  4686. SET(PEERDIR_TAGS PY2 PY2_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4687. PEERDIR(contrib/libs/python)
  4688. }
  4689. # tag:python-specific
  4690. ### @usage: USE_PYTHON3()
  4691. ###
  4692. ### This adds Python3 library to your LIBRARY and makes it Python3-compatible.
  4693. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4694. ###
  4695. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4696. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4697. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4698. ###
  4699. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4700. macro USE_PYTHON3() {
  4701. _ARCADIA_PYTHON3_ADDINCL()
  4702. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4703. PEERDIR(contrib/libs/python)
  4704. when ($USE_ARCADIA_PYTHON == "yes") {
  4705. PEERDIR+=library/python/runtime_py3
  4706. }
  4707. }
  4708. # tag:python-specific
  4709. when ($PERL_DEFAULT_PEERDIR == "yes") {
  4710. when (($PERLXS == "yes") || ($PERLXSCPP == "yes") || ($USE_PERL == "yes")) {
  4711. PEERDIR+=build/platform/perl
  4712. }
  4713. }
  4714. # tag:perl-specific
  4715. ### @usage: USE_PERL_LIB()
  4716. ### Add dependency on Perl to your LIBRARY
  4717. macro USE_PERL_LIB() {
  4718. PEERDIR(build/platform/perl)
  4719. }
  4720. # tag:perl-specific
  4721. ### @usage: USE_PERL_514_LIB()
  4722. ### Add dependency on Perl 5.14 to your LIBRARY
  4723. macro USE_PERL_514_LIB() {
  4724. SET(PERL_SDK ubuntu-12)
  4725. SET(PERL_DEFAULT_PEERDIR no)
  4726. PEERDIR(build/platform/perl/5.14)
  4727. }
  4728. # tag:perl-specific
  4729. ### @usage: ADD_PERL_MODULE(Dir ModuleName)
  4730. ### Add dependency on specified Perl module to the library
  4731. macro ADD_PERL_MODULE(Dir, Module) {
  4732. PEERDIR($Dir)
  4733. SET_APPEND(modules $Module)
  4734. }
  4735. # tag:allocator
  4736. ### @usage: ALLOCATOR(Alloc) # Default: LF
  4737. ###
  4738. ### Set memory allocator implementation for the PROGRAM()/DLL() module.
  4739. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
  4740. ###
  4741. ### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU".
  4742. ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
  4743. ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
  4744. ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
  4745. ### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
  4746. ### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
  4747. ### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
  4748. ### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
  4749. ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
  4750. ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
  4751. ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
  4752. ### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
  4753. ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
  4754. ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
  4755. ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
  4756. ### - SYSTEM - Use target system allocator
  4757. ### - FAKE - Don't link with any allocator
  4758. ###
  4759. ### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
  4760. macro ALLOCATOR(Alloc) {
  4761. SET(ALLOCATOR $Alloc)
  4762. when ($ALLOCATOR in [ "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU" ]) {
  4763. }
  4764. otherwise {
  4765. PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
  4766. }
  4767. }
  4768. ### @usage: CC_REQUIREMENTS([cpu: <value>] [ram: <value>])
  4769. ###
  4770. ### Override CPU and RAM requirements for all C/C++ compilation commands in the module
  4771. macro CC_REQUIREMENTS(reqs...) {
  4772. # Here we use the fact that quierements ara put into map during rendering, so last value wins
  4773. SET_APPEND(CC_REQUIREMENTS $reqs)
  4774. }
  4775. ### @usage: LIB_REQUIREMENTS([cpu: <value>] [ram: <value>])
  4776. ###
  4777. ### Override CPU and RAM requirements for library creation comand of a x_LIBRARY modules
  4778. macro LIB_REQUIREMENTS(reqs...) {
  4779. # Here we use the fact that quierements ara put into map during rendering, so last value wins
  4780. SET_APPEND(LIB_REQUIREMENTS $reqs)
  4781. }
  4782. ### @usage: LD_REQUIREMENTS([cpu: <value>] [ram: <value>])
  4783. ###
  4784. ### Override CPU and RAM requirements for link command in the module
  4785. macro LD_REQUIREMENTS(reqs...) {
  4786. # Here we use the fact that quierements ara put into map during rendering, so last value wins
  4787. SET_APPEND(LD_REQUIREMENTS $reqs)
  4788. }
  4789. ### @usage: JAVA_REQUIREMENTS([cpu: <value>] [ram: <value>])
  4790. ###
  4791. ### Override CPU and RAM requirements for all C/C++ compilation commands in the module
  4792. macro JAVA_REQUIREMENTS(reqs...) {
  4793. # Here we use the fact that quierements ara put into map during rendering, so last value wins
  4794. SET_APPEND(JAVA_REQUIREMENTS $reqs)
  4795. }
  4796. ### @usage: PY_REQUIREMENTS([cpu: <value>] [ram: <value>])
  4797. ###
  4798. ### Override CPU and RAM requirements for all Python build commands
  4799. macro PY_REQUIREMENTS(reqs) {
  4800. # Here we use the fact that quierem
  4801. SET_APPEND(PY_REQUIREMENTS $reqs)
  4802. }
  4803. when ($MIC_ARCH == "yes") {
  4804. CFLAGS+=-mmic
  4805. LDFLAGS+=-mmic
  4806. }
  4807. when ($USE_OPENMP == "yes") {
  4808. PEERDIR+=contrib/libs/openmp
  4809. }
  4810. when ($STRIP == "yes" && $NO_STRIP != "yes") {
  4811. STRIP_FLAG=$LD_STRIP_FLAG
  4812. DWARF_COMMAND=
  4813. GO_LINK_FLAGS_VALUE+=-s
  4814. }
  4815. when ($NO_LINKER_DCE != "yes") {
  4816. DCE_FLAG=$LD_DCE_FLAG
  4817. }
  4818. when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
  4819. ICF_FLAG=$LD_ICF_FLAG
  4820. }
  4821. OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
  4822. STRIP_TOOL=$STRIP_TOOL_VENDOR
  4823. NEED_BINUTILS_PEERDIR=
  4824. BINUTILS_USED=
  4825. when (!$OBJCOPY_TOOL_VENDOR) {
  4826. OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
  4827. NEED_BINUTILS_PEERDIR=yes
  4828. }
  4829. when (!$STRIP_TOOL_VENDOR) {
  4830. STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
  4831. NEED_BINUTILS_PEERDIR=yes
  4832. }
  4833. SPLIT_DWARF_VALUE=no
  4834. NO_SPLIT_DWARF=no
  4835. when ($STRIP_DEBUG_INFO) {
  4836. SPLIT_DWARF_VALUE=yes
  4837. NO_SPLIT_DWARF=no
  4838. }
  4839. ### @usage: SPLIT_DWARF()
  4840. ###
  4841. ### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
  4842. ### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
  4843. macro SPLIT_DWARF() {
  4844. SET(SPLIT_DWARF_VALUE yes)
  4845. }
  4846. SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
  4847. when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
  4848. DWARF_COMMAND+= \
  4849. $OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
  4850. $STRIP_TOOL --strip-debug $TARGET && \
  4851. $OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
  4852. BINUTILS_USED=yes
  4853. }
  4854. ### @usage: EXTRALIBS_STATIC(Libs...)
  4855. ###
  4856. ### Add the specified external static libraries to the program link
  4857. macro EXTRALIBS_STATIC(Args...) {
  4858. LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
  4859. }
  4860. ### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
  4861. ###
  4862. ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
  4863. macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
  4864. __translatename_lower=${tolower:Name}
  4865. __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
  4866. RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
  4867. }
  4868. ### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
  4869. ###
  4870. ### Generate transliteration dictionary code
  4871. ### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
  4872. macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
  4873. __translitname_lower=${tolower:Name}
  4874. __translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
  4875. __untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
  4876. __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
  4877. __gentrie_dir=dict/tools/make_untranslit_trie
  4878. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
  4879. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
  4880. RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
  4881. }
  4882. # tag:python-specific tag:proto tag:deprecated
  4883. ### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated
  4884. ###
  4885. ### Generate python bindings for protobuf files.
  4886. ### Macro is obsolete and not recommended for use!
  4887. macro GENERATE_PY_PROTOS(FILES...) {
  4888. foreach (FILE : $FILES) {
  4889. _PY_PROTO_CMD($FILE)
  4890. }
  4891. }
  4892. # tag:python-specific tag:proto
  4893. macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) {
  4894. foreach (FILE : $FILES) {
  4895. _PY_PROTO_CMD_INTERNAL($FILE)
  4896. }
  4897. }
  4898. # tag:python-specific
  4899. macro _GENERATE_PY_EVS_INTERNAL(FILES...) {
  4900. foreach (FILE : $FILES) {
  4901. _PY_EVLOG_CMD_INTERNAL($FILE)
  4902. }
  4903. }
  4904. macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], REQUIREMENTS[]) {
  4905. .CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} ${requirements;hide:REQUIREMENTS} ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"}
  4906. .SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST}
  4907. }
  4908. ### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
  4909. ###
  4910. ### Copy file to build root. It is possible to change both location and the name.
  4911. ###
  4912. ### Parameters:
  4913. ### - File - Source file name.
  4914. ### - Destination - Output file name.
  4915. ### - AUTO - Consider copied file for further processing automtically.
  4916. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
  4917. ###
  4918. ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
  4919. ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
  4920. macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], REQUIREMENTS[]) {
  4921. .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES REQUIREMENTS $REQUIREMENTS)
  4922. .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES REQUIREMENTS $REQUIREMENTS)
  4923. }
  4924. ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
  4925. ###
  4926. ### Copy file to build root the same way as it is done for COPY_FILE, but also
  4927. ### propagates the context of the source file.
  4928. macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO":"", OUTPUT_INCLUDES[]) {
  4929. .CMD=$COPY_FILE($FILE $DEST $AUTO OUTPUT_INCLUDES $FILE $OUTPUT_INCLUDES)
  4930. }
  4931. macro _BUNDLE_TARGET(Target, Destination) {
  4932. .CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
  4933. }
  4934. ### @usage: TIMEOUT(TIMEOUT)
  4935. ###
  4936. ### Sets a timeout on test execution
  4937. ###
  4938. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4939. macro TIMEOUT(Time) {
  4940. SET(TEST_TIMEOUT $Time)
  4941. }
  4942. SBR_UID_EXT=""
  4943. # tag:test
  4944. ### @usage: VALIDATE_DATA_RESTART(ext)
  4945. ###
  4946. ### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
  4947. ### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
  4948. macro VALIDATE_DATA_RESTART(Ext) {
  4949. SET(SBR_UID_EXT $Ext)
  4950. }
  4951. # tag:test
  4952. TEST_FORK_MODE=none
  4953. TEST_PARTITION=SEQUENTIAL
  4954. # tag:test
  4955. ### @usage: FORK_TESTS()
  4956. ###
  4957. ### Splits a test run on chunks by test classes.
  4958. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  4959. ###
  4960. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  4961. ###
  4962. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4963. macro FORK_TESTS(MODE...) {
  4964. SET(TEST_FORK_MODE tests)
  4965. SET(TEST_PARTITION $MODE)
  4966. }
  4967. # tag:test
  4968. ### @usage: FORK_SUBTESTS()
  4969. ###
  4970. ### Splits the test run in chunks on subtests.
  4971. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  4972. ###
  4973. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  4974. ###
  4975. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4976. macro FORK_SUBTESTS(MODE...) {
  4977. SET(TEST_FORK_MODE subtests)
  4978. SET(TEST_PARTITION $MODE)
  4979. }
  4980. # tag:test
  4981. ### @usage: SPLIT_FACTOR(x)
  4982. ###
  4983. ### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
  4984. ### If none of those is specified this macro implies FORK_TESTS().
  4985. ###
  4986. ### Supports C++ ut and PyTest.
  4987. ###
  4988. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4989. macro SPLIT_FACTOR(Factor) {
  4990. SET(TEST_SPLIT_FACTOR $Factor)
  4991. }
  4992. # tag:test
  4993. FORK_TEST_FILES_MODE=
  4994. ### @usage: FORK_TEST_FILES()
  4995. ###
  4996. ### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
  4997. ### Compatible with FORK_(SUB)TESTS.
  4998. ###
  4999. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5000. macro FORK_TEST_FILES() {
  5001. SET(FORK_TEST_FILES_MODE on)
  5002. }
  5003. # tag:test
  5004. TEST_SIZE_NAME=SMALL
  5005. ### @usage: SIZE(SMALL/MEDIUM/LARGE)
  5006. ###
  5007. ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
  5008. ### See documentation on test system for more details.
  5009. ###
  5010. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5011. macro SIZE(Type) {
  5012. SET(TEST_SIZE_NAME $Type)
  5013. }
  5014. ### @usage: JOIN_SRCS(Out Src...)
  5015. ###
  5016. ### Join set of sources into single file named Out and send it for further processing.
  5017. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  5018. ### You should specify file name with the extension as Out. Futher processing will be done according this extension.
  5019. macro JOIN_SRCS(Out, Src...) {
  5020. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_join_srcs.py"} ${output:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  5021. .SEM=target_joined_source $Out ${input:Src} ${output;hide;suf=.o:Out}
  5022. _CONDITIONAL_SRCS($TIDY_VALUE $Src)
  5023. }
  5024. ### @usage: JOIN_SRCS_GLOBAL(Out Src...)
  5025. ###
  5026. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  5027. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  5028. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  5029. macro JOIN_SRCS_GLOBAL(Out, Src...) {
  5030. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_join_srcs.py"} ${output;noauto:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  5031. SRCS(GLOBAL $Out)
  5032. }
  5033. ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
  5034. ###
  5035. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  5036. ### This macro places all files into single file, so will work with any sources.
  5037. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  5038. macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
  5039. .CMD=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} cat ${output;noauto:Out} --ya-start-command-file ${input:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  5040. SRCS(GLOBAL $Out)
  5041. }
  5042. # tag:cpu
  5043. PIC_CFLAGS=
  5044. SSE2_CFLAGS=
  5045. SSE3_CFLAGS=
  5046. SSSE3_CFLAGS=
  5047. SSE41_CFLAGS=
  5048. SSE42_CFLAGS=
  5049. POPCNT_CFLAGS=
  5050. PCLMUL_CFLAGS=
  5051. CX16_FLAGS=
  5052. AVX_CFLAGS=
  5053. AVX2_CFLAGS=
  5054. AVX512_CFLAGS=
  5055. # tag:cpu
  5056. SSE_DEFINES=
  5057. SSE_CFLAGS=
  5058. SSE4_DEFINES=
  5059. SSE4_CFLAGS=
  5060. NO_LTO_CFLAGS=
  5061. # tag:cpu
  5062. when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
  5063. when ($CLANG || $CLANG_CL || $GCC) {
  5064. PIC_CFLAGS=-fPIC
  5065. SSE2_CFLAGS=-msse2
  5066. SSE3_CFLAGS=-msse3
  5067. SSSE3_CFLAGS=-mssse3
  5068. SSE41_CFLAGS=-msse4.1
  5069. SSE42_CFLAGS=-msse4.2
  5070. POPCNT_CFLAGS=-mpopcnt
  5071. PCLMUL_CFLAGS=-mpclmul
  5072. AVX_CFLAGS=-mavx
  5073. # On Intel FMA3 instruction set comes together with AVX-2 extension starting with Broadwell / Haswell.
  5074. # See:
  5075. # https://en.wikipedia.org/wiki/FMA_instruction_set
  5076. #
  5077. # AMD implemented it in Piledriver architecture over AVX prior to AVX-2 which was introduced in Zen.
  5078. # See:
  5079. # https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
  5080. AVX2_CFLAGS=-mavx2 -mfma
  5081. # All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
  5082. # (these are Xeon Phi)
  5083. # See:
  5084. # https://en.wikichip.org/wiki/x86/avx-512
  5085. AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
  5086. when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
  5087. CX16_FLAGS=-mcx16
  5088. }
  5089. SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
  5090. SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
  5091. }
  5092. elsewhen ($MSVC) {
  5093. SSE2_CFLAGS=/D__SSE2__=1
  5094. SSE3_CFLAGS=/D__SSE3__=1
  5095. SSSE3_CFLAGS=/D__SSSE3__=1
  5096. SSE41_CFLAGS=/D__SSE4_1__=1
  5097. SSE42_CFLAGS=/D__SSE4_2__=1
  5098. POPCNT_CFLAGS=/D__POPCNT__=1
  5099. PCLMUL_CFLAGS=/D__PCLMUL__=1
  5100. AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
  5101. AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
  5102. AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
  5103. SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
  5104. SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
  5105. }
  5106. SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
  5107. SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
  5108. when ($ARCH_I386 && $OS_ANDROID == "yes") {
  5109. USE_SSE4=no
  5110. }
  5111. }
  5112. otherwise {
  5113. USE_SSE4=no
  5114. CPU_CHECK=no
  5115. }
  5116. # tag:cpu
  5117. when ($NOSSE == "yes") {
  5118. USE_SSE4=no
  5119. }
  5120. # tag:cpu
  5121. ### @usage: NO_SSE4()
  5122. ###
  5123. ### Compile module without SSE4
  5124. macro NO_SSE4() {
  5125. SET(USE_SSE4 no)
  5126. }
  5127. # tag:cpu
  5128. ### @usage: NO_CPU_CHECK()
  5129. ###
  5130. ### Compile module without startup CPU features check
  5131. macro NO_CPU_CHECK() {
  5132. SET(CPU_CHECK no)
  5133. }
  5134. ### @usage: ADDINCLSELF()
  5135. ###
  5136. ### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
  5137. macro ADDINCLSELF(FOR="") {
  5138. when($FOR) {
  5139. ADDINCL+=FOR $FOR ${MODDIR}
  5140. }
  5141. otherwise {
  5142. ADDINCL+=${MODDIR}
  5143. }
  5144. }
  5145. COMPILE_OUT_SUFFIX=
  5146. _COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
  5147. _COMPILE_TIME_TRACE_OUTPUTS=${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
  5148. macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?";norel":"") {
  5149. SET(_COMPILE_OUTPUTS \${output;suf=\${OBJECT_SUF}$NOREL:SRC})
  5150. SET(_COMPILE_TIME_TRACE_OUTPUTS \${output;noauto;suf=\${OBJECT_SUF}.time_trace.json$NOREL:SRC})
  5151. }
  5152. # tag:internal
  5153. ### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
  5154. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " before $Args when GENERATE
  5155. ### is specified in the list of actual arguments
  5156. macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
  5157. .SEM=$GENERATE $Args
  5158. }
  5159. # tag:internal
  5160. ### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
  5161. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " if Args is not empty
  5162. macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
  5163. .SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
  5164. }
  5165. _EMPTY_CMD=
  5166. # tag:src-processing tag:internal
  5167. ### @usage: _SRC(Ext Src Flags) # internal
  5168. ###
  5169. ### Basic building block of extension-based command dispatching
  5170. ### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
  5171. ### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
  5172. ### of other commands (except ones marked as noauto)
  5173. macro _SRC(EXT, SRC, SRCFLAGS...) {
  5174. # Generic macro definition for _SRC (just a placeholder, it does nothing)
  5175. }
  5176. # tag:src-processing
  5177. macro _SRC("S", SRC, SRCFLAGS...) {
  5178. .CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output:SRC.o} ${input:SRC} ${pre=-I:_C__INCLUDE}
  5179. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5180. }
  5181. # tag:src-processing
  5182. macro _SRC("s", SRC, SRCFLAGS...) {
  5183. .CMD=$_SRC(S, $SRC $SRCFLAGS)
  5184. }
  5185. # tag:src-processing
  5186. macro _SRC("s79", SRC, SRCFLAGS...) {
  5187. .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
  5188. }
  5189. # tag:src-processing
  5190. macro _SRC("mm", SRC, SRCFLAGS...) {
  5191. .CMD=$C_COMPILER $C_FLAGS_PLATFORM -x objective-c++ -fobjc-arc -fobjc-abi-version=2 -c -o ${output:SRC.o} ${input:SRC} $CXXFLAGS ${pre=-I:_C__INCLUDE} ${SRCFLAGS} ${requirements;hide:CC_REQUIREMENTS} ${kv;hide:"p CC"} ${kv;hide:"pc light-green"} $TOOLCHAIN_ENV
  5192. }
  5193. # tag:src-processing
  5194. macro _SRC("fml", SRC, SRCFLAGS...) {
  5195. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output:SRC.inc} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5196. }
  5197. # tag:src-processing
  5198. macro _SRC("fml2", SRC, SRCFLAGS...) {
  5199. .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"}
  5200. }
  5201. # tag:src-processing
  5202. macro _SRC("fml3", SRC, SRCFLAGS...) {
  5203. .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"}
  5204. }
  5205. # tag:src-processing
  5206. macro _SRC("sfdl", SRC, SRCFLAGS...) {
  5207. .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
  5208. }
  5209. # tag:src-processing
  5210. macro _SRC("xs", SRC, SRCFLAGS...) {
  5211. .CMD=$PERL_LD_LIBRARY_PATH $PERL $PERL_INCLUDE ${suf=/ExtUtils/xsubpp:PERL_PRIVLIB} -typemap ${suf=/ExtUtils/typemap:PERL_PRIVLIB} $PERLSUFFIX $XSUBPPFLAGS ${SRCFLAGS} ${input:SRC} $PERLOUTPUT ${kv;hide:"p XS"} ${kv;hide:"pc yellow"}
  5212. }
  5213. # tag:src-processing
  5214. macro _SRC("y", SRC, SRCFLAGS...) {
  5215. # .CMD=${tool:"contrib/tools/byacc"} $BYACC_FLAGS ${nopath;noext;output:SRC.cpp} ${input:SRC} ${nopath;noext;hide;output;addincl:SRC.h} ${kv;hide:"p YC"} ${kv;hide:"pc light-green"}
  5216. .CMD=${tool:"contrib/tools/bison/bison"} $BISON_FLAGS --m4=${tool:"contrib/tools/bison/m4"} --defines=${nopath;noext;output;main;addincl;norel:SRC.h} -o ${nopath;noext;output:SRC.cpp} ${input:SRC} ${SRCFLAGS} && $YMAKE_PYTHON ${input:"build/scripts/preprocess.py"} $_ADD_HIDDEN_INPUTS($CPP_BISON_SKELS) ${nopath;noext;tmp:SRC.h} ${kv;hide:"p YC"} ${kv;hide:"pc light-green"}
  5217. .SEM=target_bison_parser PRIVATE ${input:SRC} ${output;nopath;noext;hide;suf=${OBJ_SUF}.o:SRC} ${nopath;noext;output;hide:SRC.h} ${nopath;noext;output;addincl;hide:SRC.h} && set_global_flags BISON_FLAGS $BISON_FLAGS && conan_require bison/3.5.3 && conan_import '"bin, bison* -> ./bin/bison/bin"' && conan_import '"res, * -> ./bin/bison/res"'
  5218. }
  5219. # tag:src-processing
  5220. macro _SRC("ypp", SRC, SRCFLAGS...) {
  5221. .CMD=$_SRC(y $SRC $SRCFLAGS)
  5222. }
  5223. # tag:src-processing
  5224. macro _SRC("gperf", SRC, SRCFLAGS...) {
  5225. .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"}
  5226. }
  5227. # tag:src-processing
  5228. macro _SRC("rl", SRC, SRCFLAGS...) {
  5229. .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"}
  5230. }
  5231. # tag:src-processing
  5232. macro _SRC("rl5", SRC, SRCFLAGS...) {
  5233. .CMD=$_SRC(rl $SRC $SRCFLAGS)
  5234. }
  5235. # tag:src-processing
  5236. macro _SRC("asp", SRC, SRCFLAGS...) {
  5237. .CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${kv;hide:"p HT"} ${kv;hide:"pc yellow"}
  5238. }
  5239. # tag:src-processing
  5240. macro _SRC("rl6", SRC, SRCFLAGS...) {
  5241. .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"}
  5242. .SEM=target_ragel_lexers PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $RAGEL6_FLAGS ${SRCFLAGS} && set_global_flags RAGEL_FLAGS -L -I $S/ && conan_require ragel/6.10 && conan_import '"bin, ragel* -> ./bin"'
  5243. }
  5244. # tag:src-processing
  5245. macro _SRC("l", SRC, SRCFLAGS...) {
  5246. .CMD=${tool:"contrib/tools/flex-old"} $LEX_FLAGS ${SRCFLAGS} -o${output:SRC.cpp} ${output_include;hide:"util/system/compiler.h"} ${input:SRC} ${kv;hide:"p LX"} ${kv;hide:"pc yellow"}
  5247. .ADDINCL=contrib/tools/flex-old
  5248. .SEM=target_flex_lexers ${tool;hide:"contrib/tools/flex-old"} ${output;hide;suf=${OBJ_SUF}.o:SRC} ${input:SRC} && set_global_flags LEX_FLAGS $LEX_FLAGS
  5249. }
  5250. # tag:src-processing
  5251. macro _SRC("lex", SRC, SRCFLAGS...) {
  5252. .CMD=$_SRC(l $SRC $SRCFLAGS)
  5253. }
  5254. # tag:src-processing
  5255. macro _SRC("lpp", SRC, SRCFLAGS...) {
  5256. .CMD=$_SRC(l $SRC $SRCFLAGS)
  5257. }
  5258. # tag:src-processing
  5259. macro _SRC("pln", SRC, SRCFLAGS...) {
  5260. .CMD=$FML_TOOL -b -o ${output;pre=pln.;nopath;noext:SRC.cpp} -f ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5261. }
  5262. # tag:src-processing
  5263. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5264. .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"}
  5265. }
  5266. # tag:src-processing
  5267. macro _SRC("ev", SRC, SRCFLAGS...) {
  5268. .CMD=$EVLOG_CMD($SRC)
  5269. }
  5270. # tag:src-processing
  5271. macro _SRC("proto", SRC, SRCFLAGS...) {
  5272. .CMD=$PROTO_CMD($SRC)
  5273. .SEM=$PROTO_CMD($SRC)
  5274. }
  5275. # tag:src-processing
  5276. macro _SRC("gztproto", SRC, SRCFLAGS...) {
  5277. # _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.
  5278. # descriptor.proto must be resolved as google/protobuf/descriptor.proto
  5279. .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"}
  5280. .PEERDIR=kernel/gazetteer/proto
  5281. }
  5282. # tag:src-processing
  5283. macro _SRC("cfgproto", SRC, SRCFLAGS...) {
  5284. .CMD=$_CPP_CFGPROTO_CMD($SRC)
  5285. }
  5286. # tag:src-processing
  5287. macro _SRC("pyx", SRC, SRCFLAGS...) {
  5288. # Copy-paste from BUILDWITH_CYTHON
  5289. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:SRC} -o ${output;tobindir:SRC.cpp} $CYTHON_OUTPUT_INCLUDES ${SRCFLAGS} ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5290. .ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
  5291. }
  5292. # tag:src-processing
  5293. macro _SRC("in", SRC, SRCFLAGS...) {
  5294. .CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5295. .SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5296. }
  5297. macro MANUAL_GENERATION(Outs...) {
  5298. .SEM=ignored ${output;hide;noauto:Outs}
  5299. }
  5300. # tag:src-processing
  5301. macro _SRC("sc", SRC, SRCFLAGS...) {
  5302. .CMD=${tool:"tools/domschemec"} --in ${input:SRC} --out ${output;norel:SRC.h} ${output_include;hide:"util/generic/strbuf.h"} ${output_include;hide:"util/generic/string.h"} ${output_include;hide:"util/generic/vector.h"} ${output_include;hide:"util/string/cast.h"} ${SRCFLAGS} ${kv;hide:"p SC"} ${kv;hide:"pc yellow"}
  5303. }
  5304. # tag:src-processing
  5305. macro _SRC("ssqls", SRC, SRCFLAGS...) {
  5306. .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"}
  5307. }
  5308. # tag:src-processing
  5309. macro _SRC("f", SRC, SRCFLAGS...) {
  5310. .CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${requirements;hide:CC_REQUIREMENTS} ${kv;hide:"p FT"} ${kv;hide:"pc light-green"}
  5311. .PEERDIR=contrib/libs/libf2c
  5312. .ADDINCL=contrib/libs/libf2c
  5313. }
  5314. # tag:src-processing
  5315. macro _SRC("cpp", SRC, SRCFLAGS...) {
  5316. .CMD=$_SRC_cpp($SRC $SRCFLAGS)
  5317. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5318. }
  5319. # tag:src-processing
  5320. macro _SRC("cxx", SRC, SRCFLAGS...) {
  5321. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5322. }
  5323. # tag:src-processing
  5324. macro _SRC("cc", SRC, SRCFLAGS...) {
  5325. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5326. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5327. }
  5328. # tag:src-processing
  5329. macro _SRC("C", SRC, SRCFLAGS...) {
  5330. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5331. }
  5332. # tag:src-processing
  5333. macro _SRC("c", SRC, SRCFLAGS...) {
  5334. .CMD=$_SRC_c($SRC $SRCFLAGS)
  5335. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
  5336. }
  5337. # tag:src-processing
  5338. macro _SRC("m", SRC, SRCFLAGS...) {
  5339. .CMD=$_SRC(c $SRC $SRCFLAGS)
  5340. }
  5341. # tag:src-processing
  5342. macro _SRC("masm", SRC, SRCFLAGS...) {
  5343. .CMD=$_SRC_masm($SRC $SRCFLAGS)
  5344. }
  5345. # tag:src-processing
  5346. macro _SRC("yasm", SRC, SRCFLAGS...) {
  5347. .CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  5348. .SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${pre=-P :PREINCLUDES} && set_global_flags YASM_FLAGS -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE && conan_require yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5349. }
  5350. # tag:src-processing
  5351. macro _SRC("asm", SRC, SRCFLAGS...) {
  5352. .CMD=$_SRC(yasm $SRC $SRCFLAGS)
  5353. .SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS && set_global_flags YASM_FLAGS -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE && conan_require yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5354. }
  5355. # tag:src-processing
  5356. macro _SRC("lua", SRC, SRCFLAGS...) {
  5357. .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"}
  5358. .PEERDIR=$LUAJIT_PATH
  5359. }
  5360. # tag:src-processing
  5361. macro _SRC("cu", SRC, SRCFLAGS...) {
  5362. .CMD=$_SRC_CU_CMD
  5363. .PEERDIR=$_SRC_CU_PEERDIR
  5364. }
  5365. # tag:src-processing
  5366. macro _SRC("fbs", SRC, SRCFLAGS...) {
  5367. .CMD=$FBS_CMD($SRC, $SRCFLAGS)
  5368. }
  5369. # tag:src-processing
  5370. macro _SRC("fbs64", SRC, SRCFLAGS...) {
  5371. .CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
  5372. }
  5373. # tag:src-processing
  5374. macro _SRC("pysrc", SRC, SRCFLAGS...) {
  5375. .CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
  5376. }
  5377. # tag:src-processing
  5378. macro _SRC_py2src(SRC, SRCFLAGS...) {
  5379. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py2_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py2 --python $(PYTHON)/python --py_compile ${input:"build/scripts/py_compile.py"} ${kv;hide:"p P2"} ${kv;hide:"pc light-green"}
  5380. }
  5381. # tag:src-processing
  5382. macro _SRC_py3src(SRC, SRCFLAGS...) {
  5383. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py3_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py3 --pycc ${tool:"contrib/tools/python3/pycc"} ${kv;hide:"p P3"} ${kv;hide:"pc light-green"}
  5384. }
  5385. # tag:src-processing python-specific
  5386. when ($PYTHON3 == "yes") {
  5387. MACRO_ALIAS(_SRC_PYSRC _SRC_py3src)
  5388. }
  5389. otherwise {
  5390. MACRO_ALIAS(_SRC_PYSRC _SRC_py2src)
  5391. }
  5392. # tag:src-processing
  5393. macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
  5394. .CMD=$_SRC_C_NODEPS_CMD
  5395. }
  5396. # Custom flags for generated cpp-files. To support another generator:
  5397. # - insert additional file extension before .cpp into generated cpp-file name
  5398. # - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
  5399. #
  5400. # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
  5401. # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
  5402. #
  5403. # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
  5404. # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
  5405. ## tag:src-processing
  5406. _LANG_CFLAGS_FILTER=\
  5407. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
  5408. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
  5409. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
  5410. # tag:src-processing
  5411. # Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
  5412. macro _FILTER_EXTS(SKIP="", FLAGS...) {
  5413. .CMD=$FLAGS
  5414. }
  5415. # tag:src-processing
  5416. macro _LANG_CFLAGS(SRC) {
  5417. .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
  5418. }
  5419. # tag:src-processing
  5420. # ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
  5421. # Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
  5422. _LANG_CFLAGS_VALUE=
  5423. when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
  5424. _LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
  5425. }
  5426. # tag:src-processing
  5427. macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5428. .CMD=$_SRC_CPP_CMD
  5429. }
  5430. # tag:src-processing
  5431. macro _SRC_c(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5432. .CMD=$_SRC_C_CMD
  5433. }
  5434. # tag:src-processing
  5435. macro _SRC_m(SRC, SRCFLAGS...) {
  5436. .CMD=$_SRC_M_CMD
  5437. }
  5438. # tag:src-processing
  5439. macro _SRC_masm(SRC, SRCFLAGS...) {
  5440. .CMD=$_SRC_MASM_CMD
  5441. }
  5442. # tag:lua-specific
  5443. ### @usage: COMPILE_LUA(Src, [NAME <import_name>])
  5444. ###
  5445. ### Compile LUA source file to object code using LUA 2.0
  5446. ### Optionally override import name which is by default reflects Src name
  5447. macro COMPILE_LUA(Src, NAME="") {
  5448. .CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
  5449. }
  5450. # tag:lua-specific
  5451. ### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
  5452. ###
  5453. ### Compile LUA source file to object code using LUA 2.1
  5454. macro _SRC_lua_21(SRC, SRCFLAGS...) {
  5455. .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"}
  5456. .PEERDIR=$LUAJIT_21_PATH
  5457. }
  5458. # tag:lua-specific
  5459. ### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
  5460. ###
  5461. ### Compile LUA source file to object code using LUA 2.1
  5462. ### Optionally override import name which is by default reflects Src name
  5463. macro COMPILE_LUA_21(Src, NAME="") {
  5464. .CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
  5465. }
  5466. GETTEXT_KEEP_PATH=no
  5467. _MO_OUTPUT=
  5468. when ($GETTEXT_KEEP_PATH == "yes") {
  5469. _MO_OUTPUT=${output;noauto;norel;noext:SRC.mo}
  5470. }
  5471. otherwise {
  5472. _MO_OUTPUT=${output;noauto;nopath;noext;tobindir:SRC.mo}
  5473. }
  5474. # tag:src-processing
  5475. macro _SRC("po", SRC, SRCFLAGS...) {
  5476. .CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
  5477. }
  5478. # tag:ydl-specific
  5479. YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
  5480. YDL_DESC_FLAGS=
  5481. # tag:src-processing tag:ydl-specific
  5482. macro _SRC("ydl", SRC, SRCFLAGS...) {
  5483. .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"}
  5484. .PEERDIR+=statbox/ydl/runtime/cpp
  5485. }
  5486. # tag:ydl-specific
  5487. ### @usage BUILD_YDL_DESC(Input Symbol Output)
  5488. ###
  5489. ### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
  5490. ###
  5491. ### @example:
  5492. ###
  5493. ### PACKAGE()
  5494. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5495. ### END()
  5496. ###
  5497. ### 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.
  5498. macro BUILD_YDL_DESC(Input, Symbol, Output) {
  5499. .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"}
  5500. }
  5501. # tag:ydl-specific
  5502. ### @usage: YDL_DESC_USE_BINARY()
  5503. ###
  5504. ### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
  5505. ###
  5506. ### @example:
  5507. ###
  5508. ### PACKAGE()
  5509. ### YDL_DESC_USE_BINARY()
  5510. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5511. ### END()
  5512. ###
  5513. ### This will generate descriptor Event.ydld in a binary format.
  5514. macro YDL_DESC_USE_BINARY() {
  5515. YDL_DESC_FLAGS_BINARY= --binary
  5516. SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
  5517. }
  5518. ### @usage SRC(File Flags...)
  5519. ###
  5520. ### Compile single file with extra Flags.
  5521. ### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
  5522. macro SRC(FILE, FLAGS...) {
  5523. _SRC(${lastext:FILE} $FILE $FLAGS)
  5524. }
  5525. ### @usage: SRCS(<[GLOBAL] File> ...)
  5526. ###
  5527. ### 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.
  5528. ### Arcadia Paths from the root and is relative to the project's LIST are supported
  5529. ###
  5530. ### 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.
  5531. ### 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)
  5532. ###
  5533. ### @example:
  5534. ###
  5535. ### LIBRARY(test_global)
  5536. ### SRCS(GLOBAL foo.cpp)
  5537. ### END()
  5538. ###
  5539. ### 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.
  5540. macro SRCS(FILES...) {
  5541. foreach (FILE : $FILES) {
  5542. _SRC(${lastext:FILE} $FILE)
  5543. }
  5544. }
  5545. # tag:cpu tag:src-processing
  5546. ### @usage SRC_C_SSE2(File Flags...)
  5547. ### Compile single .c-file with SSE2 and extra Flags.
  5548. macro SRC_C_SSE2(FILE, FLAGS...) {
  5549. _SRC(c $FILE $SSE2_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse2)
  5550. }
  5551. # tag:cpu tag:src-processing
  5552. ### @usage SRC_C_SSE3(File Flags...)
  5553. ### Compile single .c-file with SSE3 and extra Flags.
  5554. macro SRC_C_SSE3(FILE, FLAGS...) {
  5555. _SRC(c $FILE $SSE3_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse3)
  5556. }
  5557. # tag:cpu tag:src-processing
  5558. ### @usage SRC_C_SSSE3(File Flags...)
  5559. ### Compile single .c-file with SSSE3 and extra Flags.
  5560. macro SRC_C_SSSE3(FILE, FLAGS...) {
  5561. _SRC(c $FILE $SSSE3_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .ssse3)
  5562. }
  5563. # tag:cpu tag:src-processing
  5564. ### @usage SRC_C_SSE41(File Flags...)
  5565. ### Compile single .c-file with SSE4.1 and extra Flags.
  5566. macro SRC_C_SSE41(FILE, FLAGS...) {
  5567. _SRC(c $FILE $SSE41_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse41)
  5568. }
  5569. # tag:cpu tag:src-processing
  5570. ### @usage SRC_C_SSE4(File Flags...)
  5571. ### Compile single .c-file with SSE4 (SSE4.1, SSE4.2 and POPCNT) and extra Flags.
  5572. macro SRC_C_SSE4(FILE, FLAGS...) {
  5573. _SRC(c $FILE $SSE4_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse4)
  5574. }
  5575. # tag:cpu tag:src-processing
  5576. ### @usage SRC_C_AVX(File Flags...)
  5577. ### Compile single .c-file with AVX and extra Flags.
  5578. macro SRC_C_AVX(FILE, FLAGS...) {
  5579. _SRC(c $FILE $AVX_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx)
  5580. }
  5581. # tag:cpu tag:src-processing
  5582. ### @usage SRC_C_AVX2(File Flags...)
  5583. ### Compile single .c-file with AVX2 and extra Flags.
  5584. macro SRC_C_AVX2(FILE, FLAGS...) {
  5585. _SRC(c $FILE $AVX2_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx2)
  5586. }
  5587. # tag:cpu tag:src-processing
  5588. ### @usage SRC_CPP_PIC(File Flags...)
  5589. ### Compile single .c-file with -fPIC and extra Flags.
  5590. macro SRC_CPP_PIC(FILE, FLAGS...) {
  5591. _SRC(cpp $FILE $PIC_CFLAGS $FLAGS)
  5592. }
  5593. # tag:cpu tag:src-processing
  5594. ### @uage SRC_CPP_NO_LTO(File)
  5595. ### Compile single .cpp file with link-time-optimization disabled
  5596. macro SRC_CPP_NO_LTO(FILE) {
  5597. _SRC(cpp $FILE $NO_LTO_CFLAGS)
  5598. }
  5599. # tag:cpu tag:src-processing
  5600. ### @usage SRC_CPP_SSE2(File Flags...)
  5601. ### Compile single .cpp-file with SSE2 and extra Flags.
  5602. macro SRC_CPP_SSE2(FILE, FLAGS...) {
  5603. _SRC(cpp $FILE $SSE2_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse2)
  5604. }
  5605. # tag:cpu tag:src-processing
  5606. ### @usage SRC_CPP_SSE3(File Flags...)
  5607. ### Compile single .cpp-file with SSE3 and extra Flags.
  5608. macro SRC_CPP_SSE3(FILE, FLAGS...) {
  5609. _SRC(cpp $FILE $SSE3_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse3)
  5610. }
  5611. # tag:cpu tag:src-processing
  5612. ### @usage SRC_CPP_SSSE3(File Flags...)
  5613. ### Compile single .cpp-file with SSSE3 and extra Flags.
  5614. macro SRC_CPP_SSSE3(FILE, FLAGS...) {
  5615. _SRC(cpp $FILE $SSSE3_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sss3)
  5616. }
  5617. # tag:cpu tag:src-processing
  5618. ### @usage SRC_CPP_SSE41(File Flags...)
  5619. ### Compile single .cpp-file with SSE4.1 and extra Flags.
  5620. macro SRC_CPP_SSE41(FILE, FLAGS...) {
  5621. _SRC(cpp $FILE $SSE41_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse41)
  5622. }
  5623. # tag:cpu tag:src-processing
  5624. ### @usage SRC_CPP_SSE4(File Flags...)
  5625. ### Compile single .cpp-file with SSE4 (SSE4.1, SSE4.2 and POPCNT) and extra Flags.
  5626. macro SRC_CPP_SSE4(FILE, FLAGS...) {
  5627. _SRC(cpp $FILE $SSE4_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .sse4)
  5628. }
  5629. # tag:cpu tag:src-processing
  5630. ### @usage SRC_CPP_AVX(File Flags...)
  5631. ### Compile single .cpp-file with AVX and extra Flags.
  5632. macro SRC_CPP_AVX(FILE, FLAGS...) {
  5633. _SRC(cpp $FILE $AVX_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx)
  5634. }
  5635. # tag:cpu tag:src-processing
  5636. ### @usage SRC_CPP_AVX2(File Flags...)
  5637. ### Compile single .cpp-file with AVX2 and extra Flags.
  5638. macro SRC_CPP_AVX2(FILE, FLAGS...) {
  5639. _SRC(cpp $FILE $AVX2_CFLAGS $FLAGS COMPILE_OUT_SUFFIX .avx2)
  5640. }
  5641. # tag:python-processing tag:cython
  5642. # TODO: use it in [.pyx] cmd
  5643. ### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
  5644. ###
  5645. ### Generates .cpp file from .pyx.
  5646. macro BUILDWITH_CYTHON_CPP(Src, Options...) {
  5647. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir:Src.cpp} $CYTHON_OUTPUT_INCLUDES ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5648. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5649. }
  5650. # tag:python-processing tag:cython tag:internal
  5651. ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
  5652. ###
  5653. ### Generates .cpp file from .pyx and attach extra input Dep.
  5654. ### If Dep changes the .cpp file will be re-generated.
  5655. macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
  5656. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir:Src.cpp} $CYTHON_OUTPUT_INCLUDES ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5657. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5658. }
  5659. # tag:python-processing tag:cython
  5660. ### @usage: BUILDWITH_CYTHON_C(Src Options...)
  5661. ###
  5662. ### Generates .c file from .pyx.
  5663. macro BUILDWITH_CYTHON_C(Src, Options...) {
  5664. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir:Src.c} $CYTHON_OUTPUT_INCLUDES ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5665. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5666. }
  5667. # tag:python-processing tag:cython tag:internal
  5668. ### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
  5669. ###
  5670. ### Generates .c file from .pyx and attach extra input Dep.
  5671. ### If Dep changes the .c file will be re-generated.
  5672. macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
  5673. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir:Src.c} $CYTHON_OUTPUT_INCLUDES ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5674. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5675. }
  5676. # tag:python-processing tag:cython tag:internal
  5677. ### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
  5678. ###
  5679. ### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
  5680. macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
  5681. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} $CYTHON_OUTPUT_INCLUDES ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5682. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5683. }
  5684. # tag:python-processing tag:cython tag:internal
  5685. ### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
  5686. ###
  5687. ### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
  5688. macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
  5689. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} ${output;hide;addincl;noext;defext=_api.h;tobindir:Src} $CYTHON_OUTPUT_INCLUDES ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5690. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5691. }
  5692. # tag:python-processing tag:internal
  5693. ### @usage: _SWIG_PYTHON_CPP(Src, DstSubPrefix) # internal
  5694. ###
  5695. ### Run swig on Src to produce DstSubPrefix.py and DstSubPrefix_swg.cpp that
  5696. ### provides DstSubPrefix_swg python module.
  5697. macro _SWIG_PYTHON_CPP(Src, DstSubPrefix) {
  5698. .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -c++ -python -module ${nopath:DstSubPrefix} -interface ${nopath;suf=_swg:DstSubPrefix} -o ${output;suf=.swg.cpp:DstSubPrefix} ${input:Src} ${output;noauto;hide;suf=.py:DstSubPrefix} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5699. ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY)
  5700. }
  5701. # tag:python-processing tag:internal
  5702. ### @usage: _SWIG_PYTHON_C(Src, DstSubPrefix) # internal
  5703. ###
  5704. ### Like _SWIG_PYTHON_CPP but generate DstSubPrefix_swg.c.
  5705. macro _SWIG_PYTHON_C(Src, DstSubPrefix) {
  5706. .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -python -module ${nopath:DstSubPrefix} -interface ${nopath;suf=_swg:DstSubPrefix} -o ${output;suf=.swg.c:DstSubPrefix} ${input:Src} ${output;noauto;hide;suf=.py:DstSubPrefix} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5707. ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY)
  5708. }
  5709. ### @usage: BUILDWITH_RAGEL6(Src Options...)
  5710. ###
  5711. ### Compile .rl file using Ragel6.
  5712. macro BUILDWITH_RAGEL6(Src, Options...) {
  5713. .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"}
  5714. }
  5715. # tag:python-processing tag:internal
  5716. # TODO: use it in [.pyx] cmd
  5717. ### @usage: _PY_REGISTER() # internal
  5718. ###
  5719. ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
  5720. ###
  5721. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5722. macro _PY_REGISTER(Func) {
  5723. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5724. SRCS(GLOBAL $Func.reg.cpp)
  5725. }
  5726. # tag:python-processing tag:internal
  5727. ### @usage: _PY3_REGISTER() # internal
  5728. ###
  5729. ### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
  5730. ###
  5731. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5732. macro _PY3_REGISTER(Func) {
  5733. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${output;noauto:Func.reg3.cpp} ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5734. SRCS(GLOBAL $Func.reg3.cpp)
  5735. }
  5736. # tag:python-processing tag:internal
  5737. ### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
  5738. ###
  5739. ### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
  5740. ###
  5741. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5742. macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
  5743. .CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc} ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5744. }
  5745. # tag:python-processing tag:internal
  5746. ### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
  5747. ###
  5748. ### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
  5749. ###
  5750. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5751. macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
  5752. .CMD=${env:"PYTHONHASHSEED=0"} ${tool:"contrib/tools/python3/pycc"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc3} ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5753. }
  5754. ### @usage: ARCHIVE_ASM(NAME archive_name files...)
  5755. ###
  5756. ### Similar to the macro ARCHIVE, but:
  5757. ### 1. works faster and it is better to use for large files.
  5758. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
  5759. macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", REQUIREMENTS[], Files...) {
  5760. .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;chksum;suf=$OBJ_SUF.rodata:NAME} ${requirements;hide:REQUIREMENTS} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"}
  5761. }
  5762. # tag:yweb-specific
  5763. macro PIRE_INLINE_CMD(SRC) {
  5764. .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"}
  5765. }
  5766. # tag:yweb-specific
  5767. macro PIRE_INLINE(FILES...) {
  5768. foreach (FILE : $FILES) {
  5769. PIRE_INLINE_CMD($FILE)
  5770. }
  5771. }
  5772. ### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
  5773. ###
  5774. ### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  5775. ###
  5776. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  5777. macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", REQUIREMENTS[], Files...) {
  5778. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;chksum;addincl;noauto:NAME} ${requirements;hide:REQUIREMENTS} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  5779. }
  5780. ### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
  5781. ###
  5782. ### Add arbitrary data to a module be accessible by specified key.
  5783. ### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  5784. ###
  5785. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  5786. macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", REQUIREMENTS[], Files...) {
  5787. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;chksum;addincl;noauto:NAME} ${requirements;hide:REQUIREMENTS} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  5788. }
  5789. #scripts
  5790. #special commands
  5791. BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
  5792. SVNVERSION_JAVA_MARKER=output-java-class
  5793. SVNVERSION_GO_MARKER=output-go
  5794. VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
  5795. VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
  5796. VCS_C=$BINDIR/__vcs_version__.c
  5797. VCS_GO=$BINDIR/__vcs_version__.go
  5798. VCS_JAVA=$BINDIR/__vcs_version__.mf
  5799. VCS_INFO_DISABLE_CACHE__NO_UID__=
  5800. YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  5801. CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  5802. CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
  5803. YASM_DEBUG_INFO=
  5804. CL_DEBUG_INFO=
  5805. CL_MACRO_INFO=
  5806. when ($FORCE_VCS_INFO_UPDATE == "yes") {
  5807. VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
  5808. }
  5809. ### Works for pyton too.
  5810. GENERATE_VCS_C_INFO_NODEP=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} $(VCS)/vcs.json $VCS_C ${input:"build/scripts/c_templates/svn_interface.c"} $VCS_INFO_DISABLE_CACHE__NO_UID__ && $_SRC_c_nodeps($VCS_C, $VCS_C_OBJ, $(SOURCE_ROOT))
  5811. GENERATE_VCS_GO_INFO_NODEP=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} output-go $(VCS)/vcs.json $VCS_GO $VCS_INFO_DISABLE_CACHE__NO_UID__
  5812. 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__
  5813. macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
  5814. .CMD=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
  5815. }
  5816. ### @usage: CREATE_BUILDINFO_FOR(GenHdr)
  5817. ###
  5818. ### Creates header file to access some information about build specified via configuration variables.
  5819. ### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
  5820. macro CREATE_BUILDINFO_FOR(GenHdr) {
  5821. .CMD=$YIELD $CXX_COMPILER && $YIELD $CXXFLAGS && $XARGS $YMAKE_PYTHON ${input:BUILDVERSION_SCRIPT} ${output:GenHdr} ${kv;hide:"p BI"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"} $SVN_DEPENDS_CACHE__NO_UID__
  5822. .SEM=$PYTHON($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
  5823. }
  5824. DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
  5825. DECIMAL_MD5_FIXED=
  5826. ### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
  5827. ###
  5828. ### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
  5829. ### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
  5830. macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
  5831. .CMD=$YMAKE_PYTHON ${input:DECIMAL_MD5_SCRIPT} --fixed-output=${DECIMAL_MD5_FIXED} --func-name=${FUNCNAME} --lower-bits 32 --source-root=$ARCADIA_ROOT ${input;context=TEXT:Opts} ${output;stdout;chksum:File} ${kv;hide:"p SV"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"}
  5832. }
  5833. # tag:internal
  5834. ### @usage $CFG_VARS # internal
  5835. ###
  5836. ### Mark commands that embed Configuration variables into files
  5837. macro CFG_VARS() {
  5838. .GEN_FROM_FILE=yes
  5839. }
  5840. ### @usage: CONFIGURE_FILE(from to)
  5841. ###
  5842. ### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
  5843. ### The values are collected during configure stage, while replacement itself happens during build stage.
  5844. ### Used implicitly for .in-files processing.
  5845. macro CONFIGURE_FILE(Src, Dst) {
  5846. .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"}
  5847. .SEM=set_vasrs ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;rootrel:Dst}
  5848. }
  5849. ### @usage: BASE_CODEGEN(tool_path prefix)
  5850. ###
  5851. ### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in.
  5852. macro BASE_CODEGEN(Tool, Prefix, Opts...) {
  5853. .CMD=${tool:Tool} ${input:Prefix.in} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc yellow"}
  5854. }
  5855. # tag:internal
  5856. ### @usage: _SPLIT_CODEGEN_BASE(tool prefix OUTS[] OUTPUT_INCLUDES[]) # internal
  5857. ###
  5858. ### Generator of a certain number .the. cpp file + one header .h file from .in.
  5859. ### This is the call of the generator. Python macro SPLIT_CODEGEN() is defined in order to properly fill command outputs from OUT_NUM argument.
  5860. macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) {
  5861. .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"}
  5862. }
  5863. STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \
  5864. ${output_include;hide:"util/generic/strbuf.h"} \
  5865. ${output_include;hide:"util/generic/vector.h"} \
  5866. ${output_include;hide:"util/generic/ptr.h"} \
  5867. ${output_include;hide:"util/generic/yexception.h"} \
  5868. ${output_include;hide:"kernel/struct_codegen/reflection/reflection.h"} \
  5869. ${output_include;hide:"kernel/struct_codegen/reflection/floats.h"}
  5870. ### @usage: STRUCT_CODEGEN(Prefix)
  5871. ### A special case BASE_CODEGEN, in which the kernel/struct_codegen/codegen_tool tool is used.
  5872. macro STRUCT_CODEGEN(Prefix) {
  5873. .CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES)
  5874. .PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection
  5875. }
  5876. ### @usage: DUMPERF_CODEGEN(Prefix)
  5877. ### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used
  5878. macro DUMPERF_CODEGEN(Prefix) {
  5879. .CMD=$BASE_CODEGEN(extsearch/images/robot/tools/dumperf/codegen, $Prefix, ${output_include;hide:"extsearch/images/kernel/erf/erf_format.h"})
  5880. }
  5881. # tag:flags
  5882. ### @usage: LDFLAGS(LinkerFlags...)
  5883. ###
  5884. ### Add flags to the link command line of executable or shared library/dll.
  5885. ### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
  5886. ### Note: remember about the incompatibility of flags for gcc and cl.
  5887. macro LDFLAGS(Flags...) {
  5888. SET_APPEND(LDFLAGS_GLOBAL $Flags)
  5889. }
  5890. # tag:flags
  5891. ### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
  5892. ###
  5893. ### Add the specified flags to the compilation command of C and C++ files.
  5894. ### @params: GLOBAL - Propagates these flags to dependent projects
  5895. ### Note: remember about the incompatibility flags for clang and cl (to set flags specifically for cl.exe use MSVC_FLAGS).
  5896. macro CFLAGS(Flags...) {
  5897. SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
  5898. }
  5899. # tag:flags
  5900. ### @usage: MASMFLAGS(compiler flags)
  5901. ### Add the specified flags to the compilation command of .masm files.
  5902. macro MASMFLAGS(Flags...) {
  5903. SET_APPEND(MASMFLAGS $Flags)
  5904. }
  5905. # tag:flags
  5906. ### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
  5907. ### Add the specified flags to the compilation command of .c (but not .cpp) files.
  5908. ### @params: GLOBAL - Distributes these flags on dependent projects
  5909. macro CONLYFLAGS(Flags...) {
  5910. SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
  5911. }
  5912. # tag:flags
  5913. ### @usage: CXXFLAGS(compiler_flags)
  5914. ### Add the specified flags to the compilation command of .cpp (but not .c) files.
  5915. macro CXXFLAGS(Flags...) {
  5916. SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
  5917. }
  5918. # tag:flags
  5919. ### @usage: CUDA_NVCC_FLAGS(compiler flags)
  5920. ### Add the specified flags to the compile line .cu-files.
  5921. macro CUDA_NVCC_FLAGS(Flags...) {
  5922. SET_APPEND(CUDA_NVCC_FLAGS $Flags)
  5923. }
  5924. # tag:flags
  5925. ### @usage: NVCC_DEVICE_LINK(file.cu...)
  5926. ### Run nvcc --device-link on objects compiled from srcs with --device-c.
  5927. ### This generates a stub object devlink.o that supplies missing pieces for the
  5928. ### host linker to link relocatable device objects into the final executable.
  5929. macro NVCC_DEVICE_LINK(Srcs...) {
  5930. .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"}
  5931. }
  5932. ### @usage: STRIP()
  5933. ### Strip debug info from a PROGRAM, DLL or TEST.
  5934. ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
  5935. macro STRIP() {
  5936. ENABLE(STRIP)
  5937. }
  5938. ### @usage: NO_OPTIMIZE()
  5939. ### Build code without any optimizations (-O0 mode).
  5940. macro NO_OPTIMIZE() {
  5941. ENABLE(NO_OPTIMIZE)
  5942. }
  5943. ### @usage: NO_COMPILER_WARNINGS()
  5944. ### Disable all compiler warnings in the module.
  5945. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5946. macro NO_COMPILER_WARNINGS() {
  5947. ENABLE(NO_COMPILER_WARNINGS)
  5948. }
  5949. ### @usage: WERROR()
  5950. ### Consider warnings as errors in the current module.
  5951. ### In the bright future will be removed, since WERROR is the default.
  5952. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5953. macro WERROR() {
  5954. ENABLE(WERROR)
  5955. }
  5956. ### @usage: NO_WERROR()
  5957. ### Override WERROR() behavior
  5958. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5959. macro NO_WERROR() {
  5960. DISABLE(WERROR)
  5961. }
  5962. ### @usage: NO_WSHADOW()
  5963. ### Disable C++ shadowing warnings.
  5964. macro NO_WSHADOW() {
  5965. ENABLE(NO_WSHADOW)
  5966. }
  5967. # tag:internal
  5968. ### @usage: NO_PLATFORM_RESOURCES() # internal
  5969. ### Exclude dependency on platform resources libraries.
  5970. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  5971. macro NO_PLATFORM_RESOURCES() {
  5972. ENABLE(NOPLATFORM_RESOURCES)
  5973. }
  5974. # tag:internal tag:codenav
  5975. ### @usage: NO_CODENAVIGATION() # internal
  5976. ### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
  5977. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  5978. macro NO_CODENAVIGATION() {
  5979. ENABLE(NOCODENAVIGATION)
  5980. }
  5981. ### @usage: NO_UTIL()
  5982. ### Build module without dependency on util.
  5983. ### Note: use this with care. Util most likely will be linked into executable anyway,
  5984. ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
  5985. macro NO_UTIL() {
  5986. ENABLE(NOUTIL)
  5987. }
  5988. ### @usage: NO_RUNTIME()
  5989. ###
  5990. ### This macro:
  5991. ### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
  5992. ### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
  5993. ### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
  5994. ### may not be detected at build time and may lead to unpredictable behavors at configure time.
  5995. macro NO_RUNTIME() {
  5996. SET(USE_ARCADIA_LIBM no)
  5997. NO_UTIL()
  5998. ENABLE(NORUNTIME)
  5999. }
  6000. ### @usage: NO_LIBC()
  6001. ###
  6002. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
  6003. ### Note: use this with care. libc most likely will be linked into executable anyway,
  6004. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  6005. macro NO_LIBC() {
  6006. NO_RUNTIME()
  6007. DISABLE(MUSL)
  6008. }
  6009. ### @usage: NO_PLATFORM()
  6010. ###
  6011. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
  6012. ### Note: use this with care. libc most likely will be linked into executable anyway,
  6013. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  6014. macro NO_PLATFORM() {
  6015. NO_LIBC()
  6016. ENABLE(NOPLATFORM)
  6017. }
  6018. # tag:cpp-specific
  6019. ### @usage: USE_CXX()
  6020. ###
  6021. ### Add dependency on C++ runtime
  6022. ### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
  6023. macro USE_CXX() {
  6024. DISABLE(NORUNTIME)
  6025. }
  6026. ### @usage: USE_UTIL()
  6027. ###
  6028. ### Add dependency on util and C++ runtime
  6029. ### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
  6030. macro USE_UTIL() {
  6031. USE_CXX()
  6032. DISABLE(NOUTIL)
  6033. }
  6034. # tag:deprecated
  6035. ### @usage: NO_JOIN_SRC() # deprecated, does-nothing
  6036. ### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
  6037. macro NO_JOIN_SRC() {
  6038. ENABLE(UNUSED_MACRO)
  6039. }
  6040. # tag:deprecated
  6041. ### @usage: JOINSRC() # deprecated, does-nothing
  6042. ### This macro currently does nothing. Use JOIN_SRCS and similar macros to make one file of set of sources.
  6043. macro JOINSRC() {
  6044. ENABLE(UNUSED_MACRO)
  6045. }
  6046. # tag:sanitize
  6047. ### @usage: NO_SANITIZE()
  6048. ###
  6049. ### Disable all sanitizers for the module.
  6050. macro NO_SANITIZE() {
  6051. DISABLE(SANITIZER_TYPE)
  6052. }
  6053. # tag:coverage tag:sanitize
  6054. ### @usage: NO_SANITIZE_COVERAGE()
  6055. ###
  6056. ### Disable lightweight coverage (-fsanitize-coverage) for the module.
  6057. macro NO_SANITIZE_COVERAGE() {
  6058. DISABLE(SANITIZE_COVERAGE)
  6059. }
  6060. # tag:coverage
  6061. ### @usage: NO_CLANG_COVERAGE()
  6062. ###
  6063. ### Disable heavyweight clang coverage for the module
  6064. macro NO_CLANG_COVERAGE() {
  6065. DISABLE(CLANG_COVERAGE)
  6066. }
  6067. macro NO_CLANG_TIDY() {
  6068. DISABLE(TIDY)
  6069. }
  6070. # tag:python-specific tag:coverage
  6071. ### @usage: NO_PYTHON_COVERAGE()
  6072. ###
  6073. ### Disable python coverage for module
  6074. macro NO_PYTHON_COVERAGE() {
  6075. DISABLE(PYTHON_COVERAGE)
  6076. }
  6077. # tag:python-specific tag:coverage tag:cython
  6078. ### @usage: NO_CYTHON_COVERAGE()
  6079. ###
  6080. ### Disable cython and cythonized python coverage (CYTHONIZE_PY)
  6081. ### Implies NO_CLANG_COVERAGE() - right now, we can't disable instrumentation for .py.cpp files, but enable for .cpp
  6082. macro NO_CYTHON_COVERAGE() {
  6083. DISABLE(CYTHON_COVERAGE)
  6084. NO_CLANG_COVERAGE()
  6085. }
  6086. # tag:lua-specific
  6087. LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
  6088. macro _LUAJIT_OBJDUMP(Src, OUT="") {
  6089. .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"}
  6090. }
  6091. # tag:lua-specific
  6092. LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
  6093. macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
  6094. .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"}
  6095. }
  6096. macro _MX_BIN_TO_INFO(Src) {
  6097. .CMD=${tool:"tools/mx_bin2info"} ${input:Src} ${output;nopath;noext;noauto:Src.info} ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
  6098. }
  6099. MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \
  6100. ${output_include;hide:"kernel/matrixnet/mn_sse.h"} \
  6101. ${output_include;hide:"library/cpp/archive/yarchive.h"} \
  6102. ${output_include;hide:"util/memory/blob.h"} \
  6103. ${output_include;hide:"util/generic/hash.h"} \
  6104. ${output_include;hide:"util/generic/ptr.h"} \
  6105. ${output_include;hide:"util/generic/singleton.h"}
  6106. macro _MX_GEN_TABLE(Srcs...) {
  6107. .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"}
  6108. PEERDIR(kernel/matrixnet)
  6109. PEERDIR(library/cpp/archive)
  6110. }
  6111. RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"}
  6112. ### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
  6113. ###
  6114. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
  6115. ###
  6116. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6117. macro GENERATE_ENUM_SERIALIZATION(File) {
  6118. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;chksum;suf=_serialized.cpp:File} ${output_include;hide:File} ${output_include;hide:"util/generic/serialized_enum.h"} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  6119. .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser/bin"}
  6120. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6121. }
  6122. ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
  6123. ###
  6124. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
  6125. ### Provide access to serialization functions via generated header File_serialized.h
  6126. ###
  6127. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6128. macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
  6129. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;chksum;suf=_serialized.cpp:File} --header ${output;chksum;suf=_serialized.h:File} ${output_include;hide:File} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  6130. .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} GEN_HEADER ${output;suf=_serialized.h:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser/bin"}
  6131. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6132. }
  6133. ### @usage: DEB_VERSION(File)
  6134. ###
  6135. ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
  6136. macro DEB_VERSION(File) {
  6137. .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"}
  6138. }
  6139. BUILD_MN_SCRIPT=build/scripts/build_mn.py
  6140. # tag:matrixnet
  6141. ### @usage: BUILD_MN([CHECK] [PTR] [MULTI] mninfo mnname) # matrixnet
  6142. ###
  6143. ### Generate MatrixNet data and access code using single command.
  6144. ### Alternative macro BUILD_MNS() works faster and better for large files.
  6145. macro BUILD_MN(MnInfo, MnName, CHECK?"fml_tool=$FML_UNUSED_TOOL CHECK":"", MULTI?, PTR?, RANKING_SUFFIX="") {
  6146. .CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnF $ARCADIA_ROOT $ARCH_TOOL ${input:MnInfo} $MnName ranking_suffix=$RANKING_SUFFIX ${output;chksum;pre=mn.:MnName.cpp} ${output;hide;pre=MN_External_;suf=.rodata:MnName} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} $CHECK $MULTI $PTR ${kv;hide:"p MN"} ${kv;hide:"pc yellow"}
  6147. }
  6148. macro _BUILD_MNS_FILE(Input, Name, Output, Suffix, Check, Fml_tool, AsmDataName) {
  6149. .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"}
  6150. }
  6151. MNS_OUTPUT=mnmodels
  6152. macro _BUILD_MNS_CPP(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6153. .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"}
  6154. }
  6155. macro _BUILD_MNS_HEADER(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6156. .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"}
  6157. }
  6158. # TODO: support foreach_in and keywords simultaneous usage (look at BUILD_MNS_FILES)
  6159. # tag:matrixnet
  6160. ### @usage: BUILD_MNS([CHECK] NAME listname mninfos...) # matrixnet
  6161. ###
  6162. ### Generate MatrixNet data and access code using separate commands for support code, interface and data.
  6163. ### Faster version of BUILD_MN() macro for large files.
  6164. macro BUILD_MNS(Files...) {
  6165. _BUILD_MNS_HEADER($Files)
  6166. _BUILD_MNS_CPP($Files)
  6167. _BUILD_MNS_FILES($Files)
  6168. }
  6169. ### @usage: BUILD_PLNS(Src...)
  6170. ###
  6171. ### Generate interface header plnmodels.h for Relev model (PLN).
  6172. ### Relev specific macro.
  6173. macro BUILD_PLNS(Src...) {
  6174. .CMD=$YMAKE_PYTHON ${input:"build/scripts/build_pln_header.py"} ${output:"plnmodels.h"} ${input:Src} $RELEV_FML_CODEGEN_INCLS ${kv;hide:"p PN"} ${kv;hide:"pc yellow"}
  6175. .PEERDIR=kernel/relevfml library/cpp/sse
  6176. }
  6177. ### @usage: COMPILE_NLG(Src...)
  6178. ###
  6179. ### Generate and compile .nlg templates (Jinja2-based) and interface for megamind runtime.
  6180. ###
  6181. ### Alice-specific macro
  6182. macro COMPILE_NLG(Src...) {
  6183. PEERDIR(alice/nlg/runtime)
  6184. RUN_PROGRAM(alice/nlg/bin compile-cpp --import-dir ${ARCADIA_ROOT} --out-dir ${ARCADIA_BUILD_ROOT} --include-prefix ${MODDIR} ${Src} IN ${Src} OUT register.cpp register.h ${suf=.cpp:Src} ${suf=.h:Src} OUT_NOAUTO ${suf=.pb.txt:Src})
  6185. }
  6186. ### @usage: NEED_CHECK()
  6187. ###
  6188. ### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
  6189. ### automatically merged to trunk only if there is no new broken build targets in check results.
  6190. ### The use of this macro is disabled by default.
  6191. macro NEED_CHECK(Flags...) {
  6192. # TODO: FIXME
  6193. ENABLE(UNUSED_MACRO)
  6194. }
  6195. ### @usage: NO_NEED_CHECK()
  6196. ###
  6197. ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
  6198. macro NO_NEED_CHECK(Flags...) {
  6199. ENABLE(UNUSED_MACRO)
  6200. }
  6201. # tag:deprecated
  6202. ### @usage: NEED_REVIEW() # deprecated
  6203. ###
  6204. ### Mark the project as needing review.
  6205. ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
  6206. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
  6207. macro NEED_REVIEW(Flags...) {
  6208. # TODO: FIXME
  6209. ENABLE(UNUSED_MACRO)
  6210. }
  6211. ### @usage: VERSION(Args...)
  6212. ###
  6213. ### Specify version of a module. Currently unused by build system, only informative.
  6214. macro VERSION(Flags...) {
  6215. ENABLE(UNUSED_MACRO)
  6216. }
  6217. DATAWORK_SCHEEME_EXPORT_FLAGS=
  6218. when ($UNIX == "yes") {
  6219. SCHEEME2_CFLAGS= -E -x c++
  6220. }
  6221. when ($WIN32 == "yes") {
  6222. SCHEEME2_CFLAGS= /E /TP
  6223. }
  6224. SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
  6225. ### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
  6226. ###
  6227. ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
  6228. ###
  6229. ### 1. ${scheeme_name}.inc - the name of the generated file.
  6230. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
  6231. ###
  6232. ### @example:
  6233. ###
  6234. ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
  6235. ###
  6236. ### all options are passed to structparser (in this example --final_only - do not export heirs with public base that contains the required field,,- m "::" only from the root namespace)
  6237. ### sets in extra option
  6238. ###
  6239. ### @example:
  6240. ###
  6241. ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
  6242. ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
  6243. ### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
  6244. ###
  6245. ### for compatibility with C++ compiler and the external environment.
  6246. ### See tools/structparser for more details.
  6247. macro GEN_SCHEEME2(ScheemeName, FromFile) {
  6248. .CMD=$CXX_COMPILER $C_FLAGS_PLATFORM -c ${tmp;stdout:FromFile.cph} $SCHEEME2_CFLAGS ${input:FromFile} ${pre=-I:_C__INCLUDE} $CXXFLAGS -Wno-error && ${tool:"tools/structparser"} -o ${output:ScheemeName.inc} -n N${ScheemeName}SchemeInfo $SCHEEME2_STRUCT_INFO_FLAGS $DATAWORK_SCHEEME_EXPORT_FLAGS ${tmp:FromFile.cph} ${output;stdout;noauto:ScheemeName.inc.log} ${kv;hide:"p SH"} ${kv;hide:"pc yellow"}
  6249. }
  6250. ### @usage: SYMLINK(from to)
  6251. ### Add symlink
  6252. macro SYMLINK(From, To) {
  6253. .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"}
  6254. }
  6255. # tag:internal
  6256. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6257. ### Generate prefix " && target_sources PRIVATE " before $Args when GENERATE is specified in the list of actual arguments
  6258. macro _TARGET_SOURCES_FOR_HEADERS_IMPL(GENERATE?" && target_sources PRIVATE ":"", Args...) {
  6259. .SEM=$GENERATE ${output;ext=.h:Args} ${output;ext=.hh:Args} ${output;ext=.hpp:Args} ${output;ext=.inc:Args} ${output;ext=.i:Args}
  6260. }
  6261. # tag:internal
  6262. ### @usage: _TARGET_SOURCES_FOR_HEADERS(Args...) # internal
  6263. ### Generate prefix " && target_sources PRIVATE " before $Args if Args is not empty
  6264. macro _TARGET_SOURCES_FOR_HEADERS(Args...) {
  6265. .SEM=$_TARGET_SOURCES_FOR_HEADERS_IMPL(${pre=GENERATE :Args})
  6266. }
  6267. # tag:internal
  6268. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6269. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args when GENERATE is specified in the list of actual arguments
  6270. macro _SET_ENV_FOR_CUSTOM_COMMAND_IMPL(GENERATE?" ${CMAKE_COMMAND} -E env ":"", Args...) {
  6271. .SEM=$GENERATE ${pre= :Args}
  6272. }
  6273. # tag:internal
  6274. ### @usage: _SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
  6275. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args if Args is not empty
  6276. macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
  6277. .SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args})
  6278. }
  6279. ### @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...] [REQUIREMENTS reqs])
  6280. ###
  6281. ### Run a program from arcadia.
  6282. ### These macros are similar: RUN_PROGRAM, LUA, PYTHON.
  6283. ###
  6284. ### Parameters:
  6285. ### - tool_path - Path to the directory of the tool.
  6286. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6287. ### - CWD dir - Absolute path of the working directory.
  6288. ### - ENV key=value... - Environment variables.
  6289. ### - TOOL tools... - Auxiliary tool directories.
  6290. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6291. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6292. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6293. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6294. ### - REQUIREMENTS - Override default requirements for CPU and RAM
  6295. ###
  6296. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6297. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6298. ### 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).
  6299. macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], REQUIREMENTS[], Args...) {
  6300. .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} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${requirements;hide:REQUIREMENTS} ${requirements;hide:"network:restricted"} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6301. .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)
  6302. }
  6303. # tag:lua-specific
  6304. ### @usage: LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...][ REQUIREMENTS reqs])
  6305. ###
  6306. ### Run a lua script.
  6307. ### These macros are similar: RUN_PROGRAM, LUA, PYTHON.
  6308. ###
  6309. ### Parameters:
  6310. ### - script_path - Path to the script.3
  6311. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6312. ### - CWD dir - Absolute path of the working directory.
  6313. ### - ENV key=value... - Environment variables.
  6314. ### - TOOL tools... - Auxiliary tool directories.
  6315. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6316. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6317. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6318. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6319. ### - REQUIREMENTS - Override default requirements for CPU and RAM
  6320. ###
  6321. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6322. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6323. macro LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], REQUIREMENTS[], Args...) {
  6324. .CMD=${cwd:CWD} ${env:ENV} $LUA_TOOL ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${requirements;hide:REQUIREMENTS} ${requirements;hide:"network:restricted"} ${kv;hide:"p LU"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6325. }
  6326. # tag:python-specific
  6327. ### @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...] [REQUIREMENTS reqs])
  6328. ###
  6329. ### Run a python script with $(PYTHON)/python built from devtools/huge_python.
  6330. ### These macros are similar: RUN_PROGRAM, LUA, PYTHON.
  6331. ###
  6332. ### Parameters:
  6333. ### - script_path - Path to the script.
  6334. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6335. ### - CWD dir - Absolute path of the working directory.
  6336. ### - ENV key=value... - Environment variables.
  6337. ### - TOOL tools... - Auxiliary tool directories.
  6338. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6339. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6340. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6341. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6342. ### - REQUIREMENTS - Override default requirements for CPU and RAM
  6343. ###
  6344. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6345. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6346. macro PYTHON(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], REQUIREMENTS[], Args...) {
  6347. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${requirements;hide:REQUIREMENTS} ${requirements;hide:"network:restricted"} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6348. .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)
  6349. }
  6350. # tag:python-specific
  6351. ### @usage: PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [REQUIREMENTS reqs])
  6352. ###
  6353. ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
  6354. ### These macros are similar: RUN_PROGRAM, LUA, PYTHON.
  6355. ###
  6356. ### Parameters:
  6357. ### - script_path - Path to the script.
  6358. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6359. ### - CWD dir - Absolute path of the working directory.
  6360. ### - ENV key=value... - Environment variables.
  6361. ### - TOOL tools... - Auxiliary tool directories.
  6362. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6363. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6364. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6365. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6366. ### - REQUIREMENTS - Override default requirements for CPU and RAM
  6367. ###
  6368. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6369. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6370. macro PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], REQUIREMENTS[], Args...) {
  6371. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${requirements;hide:REQUIREMENTS} ${requirements;hide:"network:restricted"} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6372. .PEERDIR=$YMAKE_PYTHON3_PEER
  6373. .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)
  6374. }
  6375. # tag:java-specific
  6376. macro _RUN_JAVA(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", REQUIREMENTS[], Args...) {
  6377. PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6378. .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} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${requirements;hide:REQUIREMENTS} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  6379. }
  6380. ### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>])
  6381. ###
  6382. ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
  6383. ### You may specify extra dependencies that output files bring using OUTPUT_INCLUDES. The change of these may e.g. lead to recompilation of .cpp files extracted from resource.
  6384. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
  6385. ###
  6386. ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
  6387. ###
  6388. ### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
  6389. ### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
  6390. ### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
  6391. ### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
  6392. ###
  6393. ### RENAME RESOURCE allows to rename the resource without specifying its file name.
  6394. ###
  6395. ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
  6396. ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
  6397. ### so you shall place it immediately after resource_id.
  6398. macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:", REQUIREMENTS[]) {
  6399. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:REQUIREMENTS} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6400. ADD_CHECK(check.resource $Id)
  6401. }
  6402. ### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE])
  6403. ###
  6404. ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6405. macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6406. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_mds.py"} --key $Key $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p MD"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6407. ADD_CHECK(check.mds $Key)
  6408. }
  6409. # tag:internal
  6410. ### @usage: _FROM_EXTERNAL(ExtFile [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) #internal
  6411. ###requirements;hide
  6412. ### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS).
  6413. macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") {
  6414. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$EXT;suf=.external:OutFile} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_external.py"} --external-file ${input:File} --resource-file $(RESOURCE_ROOT)/ext/$OutFile --copy-to-dir $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/fetch_from_sandbox.py"} ${input;hide:"build/scripts/fetch_from_mds.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p XT"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6415. #FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors
  6416. #FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented
  6417. }
  6418. ### @usage LARGE_FILES([AUTOUPDATED] Files...)
  6419. ###
  6420. ### Use large file ether from working copy or from remote storage via placeholder <File>.external
  6421. ### If <File> is present locally (and not a symlink!) it will be copied to build directory.
  6422. ### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
  6423. macro LARGE_FILES(AUTOUPDATED?, Files...) {
  6424. # This is needed to correctly switch between remote and local modes
  6425. _GLOB($LF $Files)
  6426. }
  6427. ### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE])
  6428. ###
  6429. ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6430. macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6431. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_archive.py"} "--archive" ${input:Src} "--file-name" ${suf=-:Src} "--untar-to" $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p FA"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6432. }
  6433. when ($MSVC == "yes") {
  6434. C_AS_CXX_FLAGS=/TP /std:c++17
  6435. }
  6436. otherwise {
  6437. C_AS_CXX_FLAGS=-x c++ -std=c++17
  6438. }
  6439. # tag:cpp-specific
  6440. ### @usage: COMPILE_C_AS_CXX()
  6441. ###
  6442. ### Compile .c files as .cpp ones within a module.
  6443. macro COMPILE_C_AS_CXX() {
  6444. SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
  6445. }
  6446. ### @usage: NO_DEBUG_INFO()
  6447. ###
  6448. ### Compile files without debug info collection.
  6449. macro NO_DEBUG_INFO() {
  6450. SET(NO_DEBUGINFO yes)
  6451. }
  6452. ### @usage: CTEMPLATE_VARNAMES(File)
  6453. ###
  6454. ### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
  6455. ###
  6456. ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
  6457. macro CTEMPLATE_VARNAMES(File) {
  6458. .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
  6459. }
  6460. LLVM_OPTS=
  6461. CLANG_ROOT=$CLANG_RESOURCE_GLOBAL
  6462. CLANG_CPP_COMPILER_BIN=$CLANG_ROOT/bin/clang++
  6463. CLANG_C_COMPILER_BIN=$CLANG_ROOT/bin/clang
  6464. when ($OS_ANDROID == "yes") {
  6465. CLANG_ROOT=$CLANG_ANDROID_RESOURCE_GLOBAL
  6466. CLANG_CPP_COMPILER_BIN=$CLANG_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
  6467. CLANG_C_COMPILER_BIN=$CLANG_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
  6468. }
  6469. ### @usage: GENERATED_SRCS(srcs... PARSE_META_FROM cpp_srcs... [OUTPUT_INCLUDES output_includes...] [OPTIONS])
  6470. ###
  6471. ### Generate sources using Jinja 2 template engine.
  6472. ###
  6473. ### srcs... - list of text files which will be generated during build time by templates. Each template must be
  6474. ### placed to the place in source tree where corresponding source file should be generated. Name of
  6475. ### template must be "<name_of_src_file>.markettemplate". For example if you want to generate file "example.cpp"
  6476. ### then template should be named "example.cpp.markettemplate".
  6477. ### PARSE_META_FROM cpp_srcs... - list of C++ source files (.cpp, .h) which will be parsed using clang library
  6478. ### and metainformation extracted from the files will be made available for templates. Example of
  6479. ### template code fragment using metainformation: {{ meta.objects["@N@std@S@string"].name }}
  6480. ### OUTPUT_INCLUDES output_includes... - in cases when build system parser fails to determine all headers
  6481. ### which generated files include, you can specify additional headers here. In a normal situation this should
  6482. ### not be needed and this feature could be removed in the future.
  6483. ### OPTIONS - additional options for code_generator utility
  6484. ###
  6485. ### Examples of templates can be found in directory market/tools/code_generator/templates.
  6486. ### Metainformation does not contain entries for every object declared in C++ files specified in PARSE_META_FROM
  6487. ### parameter. To include some object into consideration you need to mark it by attribute. Attributes can
  6488. ### automatically add more attributes to dependent objects. This behavior depends on attribute definition.
  6489. ###
  6490. ### More information will be available (eventually:) here: https://wiki.yandex-team.ru/Users/denisk/codegenerator/
  6491. macro GENERATED_SRCS(PARSE_META_FROM{input}[], OUTPUT_INCLUDES[], OPTIONS[], TEMPLATES...) {
  6492. .CMD=${tool:"market/tools/code_generator"} --cpp-file ${input:PARSE_META_FROM} --templates-dir / ${ARCADIA_ROOT} --templates ${input:TEMPLATES.markettemplate} --generated-files ${output:TEMPLATES} ${output_include;hide:OUTPUT_INCLUDES} ${output_include;hide:PARSE_META_FROM} --arcadia-root ${ARCADIA_ROOT} --arcadia-build-root ${ARCADIA_BUILD_ROOT} --clang-root $CLANG_ROOT ${OPTIONS} -- $C_FLAGS_PLATFORM $CXXFLAGS ${pre=-I:_C__INCLUDE} -std=c++17 -Wno-unknown-warning-option -Wno-unused-parameter -Wno-undefined-inline -Wno-undefined-internal -Wno-unused-function $LLVM_OPTS -fno-lto
  6493. PEERDIR(build/platform/clang)
  6494. }
  6495. ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
  6496. ###
  6497. ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
  6498. ### Note: Output name is used as is, no extension added.
  6499. macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
  6500. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_CPP_COMPILER_BIN ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS -emit-ast -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p ST"} ${kv;hide:"pc light-green"}
  6501. PEERDIR(build/platform/clang)
  6502. }
  6503. ### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
  6504. ###
  6505. ### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6506. ### Note: Output name is used as is, no extension added.
  6507. macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
  6508. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_CPP_COMPILER_BIN ${pre=-I:_C__INCLUDE} $BC_CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6509. .SEM=llvm_compile_cxx ${input:Input} ${output;noauto:Output} ${CLANGPLUSPLUS} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  6510. PEERDIR(build/platform/clang)
  6511. }
  6512. ### @usage: LLVM_COMPILE_C(Input Output Opts...)
  6513. ###
  6514. ### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6515. ### Note: Output name is used as is, no extension added.
  6516. macro LLVM_COMPILE_C(Input, Output, Opts...) {
  6517. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_C_COMPILER_BIN ${pre=-I:_C__INCLUDE} $BC_CFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6518. PEERDIR(build/platform/clang)
  6519. }
  6520. ### @usage: BPF(Input Output Opts...)
  6521. ###
  6522. ### Emit eBPF bytecode from .c file.
  6523. ### Note: Output name is used as is, no extension added.
  6524. macro BPF(Input, Output, Opts...) {
  6525. .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"}
  6526. PEERDIR(build/platform/clang)
  6527. }
  6528. ### @usage: BPF_STATIC(Input Output Opts...)
  6529. ###
  6530. ### Emit eBPF bytecode from .c file.
  6531. ### Note: Output name is used as is, no extension added.
  6532. macro BPF_STATIC(Input, Output, Opts...) {
  6533. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS $CLANG_C_COMPILER_BIN ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BP"} ${kv;hide:"pc light-green"} && ${cwd:BINDIR} $LLD_ROOT_RESOURCE_GLOBAL/ld -r -b binary -m elf_x86_64 -o ${output;noauto;suf=.bpf.o:Input} ${noauto;nopath:Output}
  6534. PEERDIR(build/platform/clang build/platform/lld)
  6535. }
  6536. ### @usage: LLVM_COMPILE_LL(Input Output Opts...)
  6537. ###
  6538. ### Compile LLVM bytecode to object representation.
  6539. ### Note: Output name is used as is, no extension added.
  6540. macro LLVM_COMPILE_LL(Input, Output, Opts...) {
  6541. .CMD=$CLANG_ROOT/bin/llvm-as ${input:Input} -o ${output;noauto:Output} ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6542. PEERDIR(build/platform/clang)
  6543. }
  6544. ### @usage: LLVM_LINK(Output Inputs...)
  6545. ###
  6546. ### Call llvm-link on set of Inputs to produce Output.
  6547. ### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
  6548. macro LLVM_LINK(Output, Inputs...) {
  6549. .CMD=$CLANG_ROOT/bin/llvm-link ${input:Inputs} -o ${output;noauto:Output} ${kv;hide:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-red"}
  6550. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Inputs} COMMAND ${LLVMLINK} ${input:Inputs} -o ${output;noauto:Output}
  6551. PEERDIR(build/platform/clang)
  6552. }
  6553. ### @usage: LLVM_OPT(Input Output Opts...)
  6554. ###
  6555. ### Call llvm-opt with set of Opts on Input to produce Output.
  6556. ### Note: Output name is used as is, no extension added.
  6557. macro LLVM_OPT(Input, Output, Opts...) {
  6558. .CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} $CLANG_ROOT/bin/opt ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p OP"} ${kv;hide:"pc yellow"}
  6559. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMOPT} ${input:Input} -o ${output;noauto:Output} $Opts
  6560. PEERDIR(build/platform/clang)
  6561. }
  6562. when ($NO_DEBUGINFO == "yes") {
  6563. DEBUG_INFO_FLAGS=
  6564. }
  6565. when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
  6566. DEBUG_INFO_FLAGS=-gline-tables-only
  6567. }
  6568. # TODO: configurable tar and touch
  6569. PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  6570. # tag:internal
  6571. ### @usage TOUCH(Outputs...) # internal
  6572. ### Just introduce outputs
  6573. macro TOUCH(Outputs...) {
  6574. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
  6575. }
  6576. TOUCH_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p UN"} ${kv;hide:"pc light-cyan"} $TARGET
  6577. TOUCH_PACKAGE=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"pc light-red"} $TARGET && $YMAKE_PYTHON ${input:"build/scripts/copy_to_dir.py"} --dest-dir $BINDIR --build-root $ARCADIA_BUILD_ROOT $PACKED_PACKAGE_ARGS $SRCS_GLOBAL $PEERS
  6578. _P_PK=${kv;hide:"p PK"}
  6579. TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK
  6580. TOUCH_JAVA_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"java $CURDIR"} $TARGET
  6581. NO_CHECK_IMPORTS_FOR_VALUE=None
  6582. ### @usage: NO_CHECK_IMPORTS([patterns])
  6583. ###
  6584. ### Do not run checks on imports of Python modules.
  6585. ### Optional parameter mask patterns describes the names of the modules that do not need to check.
  6586. macro NO_CHECK_IMPORTS(Masks...) {
  6587. SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
  6588. }
  6589. # tag:yasm-specific
  6590. _YASM_FMT_VALUE=
  6591. _YASM_PLATFORM_FLAGS_VALUE=
  6592. _YASM_PREDEFINED_FLAGS_VALUE=
  6593. when ($OS_DARWIN || $OS_IOS) {
  6594. _YASM_FMT_VALUE=macho
  6595. _YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
  6596. }
  6597. elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
  6598. _YASM_FMT_VALUE=win
  6599. _YASM_PLATFORM_FLAGS_VALUE=-D WIN64
  6600. }
  6601. elsewhen ($OS_WINDOWS && $ARCH_I386) {
  6602. _YASM_FMT_VALUE=win
  6603. _YASM_PLATFORM_FLAGS_VALUE=-D WIN32
  6604. }
  6605. otherwise {
  6606. _YASM_FMT_VALUE=elf
  6607. _YASM_PLATFORM_FLAGS_VALUE=-D UNIX
  6608. _YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
  6609. }
  6610. when ($ASM_PREFIX) {
  6611. ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
  6612. }
  6613. otherwise {
  6614. ASM_PREFIX_VALUE=
  6615. }
  6616. # tag:yasm-specific
  6617. YASM_FLAGS=
  6618. YASM_PREINCLUDES_VALUE=
  6619. # tag:yasm-specific
  6620. macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  6621. .CMD=${tool:"contrib/tools/yasm"} -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE $YASM_DEBUG_INFO $YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__ -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${pre=-P :PREINCLUDES} ${input;hide:PREINCLUDES} ${input:SRC} ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p AS"} ${kv;hide:"pc light-green"}
  6622. }
  6623. ### @usage: ASM_PREINCLUDE(AsmFiles...)
  6624. ###
  6625. ### Supply additional .asm files to all assembler calls within a module
  6626. macro ASM_PREINCLUDE(PREINCLUDES...) {
  6627. SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
  6628. }
  6629. # tag:python-specific
  6630. ### @usage: RUN_PYTHON(Args...)
  6631. ###
  6632. ### Version of RUN() macro to invoke Python scripts
  6633. ### @see: [RUN()](#macro_RUN)
  6634. macro RUN_PYTHON(Args...) {
  6635. SETUP_RUN_PYTHON()
  6636. RUN(${PYTHON_BIN} $Args)
  6637. }
  6638. ### @usage: RUN_ANTLR(Args...)
  6639. ###
  6640. ### Macro to invoke ANTLR3 generator (general case)
  6641. macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], REQUIREMENTS[], CWD="", Args...) {
  6642. PEERDIR(build/external_resources/antlr3 build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6643. .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 REQUIREMENTS $REQUIREMENTS ${pre=CWD :CWD})
  6644. .SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args
  6645. }
  6646. ### @usage: RUN_ANTLR4(Args...)
  6647. ###
  6648. ### Macro to invoke ANTLR4 generator (general case)
  6649. macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], REQUIREMENTS[], CWD="", Args...) {
  6650. PEERDIR(build/external_resources/antlr4)
  6651. _RUN_JAVA(-jar $ANTLR4_RESOURCE_GLOBAL/antlr-4.9-complete.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES REQUIREMENTS $REQUIREMENTS ${pre=CWD :CWD})
  6652. }
  6653. _ANTLR4_LISTENER_GRAMMAR=-listener
  6654. _ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
  6655. _ANTLR4_VISITOR_GRAMMAR=-visitor
  6656. _ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
  6657. ### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  6658. ###
  6659. ### Macro to invoke ANTLR4 generator (Cpp)
  6660. macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6661. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Cpp -o ${BINDIR} ${Args} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;suf=Lexer.cpp:GRAMMAR} ${noext;suf=Lexer.h:GRAMMAR} ${noext;suf=Parser.cpp:GRAMMAR} ${noext;suf=Parser.h:GRAMMAR} ${noext;suf=Listener.h:$LISTENER} ${noext;suf=BaseListener.h:$LISTENER} ${noext;suf=Visitor.h:$VISITOR} ${noext;suf=BaseVisitor.h:$VISITOR} OUTPUT_INCLUDES ${ARCADIA_ROOT}/contrib/libs/antlr4_cpp_runtime/src/antlr4-runtime.h ${OUTPUT_INCLUDES})
  6662. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  6663. }
  6664. ### @usage: RUN_ANTLR4_GO(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  6665. ###
  6666. ### Macro to invoke ANTLR4 generator (Go)
  6667. macro RUN_ANTLR4_GO(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6668. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Go -o ${BINDIR} ${Args} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;tolower;suf=_lexer.go:GRAMMAR} ${noext;tolower;suf=_parser.go:GRAMMAR} ${noext;tolower;suf=_listener.go:$LISTENER} ${noext;tolower;suf=_base_listener.go:$LISTENER} ${noext;tolower;suf=_visitor.go:$VISITOR} ${noext;tolower;suf=_base_visitor.go:$VISITOR} OUTPUT_INCLUDES ${OUTPUT_INCLUDES})
  6669. PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr)
  6670. }
  6671. # tag:cpp-specific
  6672. macro CPP_ADDINCL(Dirs...) {
  6673. ADDINCL($Dirs)
  6674. }
  6675. # tag:internal
  6676. _WHOLE_ARCHIVE_PEERS_VALUE=
  6677. ### @usage: WHOLE_ARCHIVE(dirnames...) # internal
  6678. macro WHOLE_ARCHIVE(PEERS...) {
  6679. SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
  6680. REQUIRES(${PEERS})
  6681. }
  6682. ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
  6683. macro TASKLET() {
  6684. PEERDIR(tasklet/api)
  6685. # CPP
  6686. CPP_PROTO_PLUGIN(tasklet_cpp tasklet/gen/cpp .tasklet.h)
  6687. # Python
  6688. PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/gen/python DEPS tasklet/domain/sandbox tasklet/runtime sandbox/sdk2)
  6689. #Java
  6690. JAVA_PROTO_PLUGIN(tasket_java tasklet/gen/java DEPS tasklet/runtime/java/lib $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  6691. }
  6692. TASKLET_REG_INCLUDES= \
  6693. ${output_include;hide:"tasklet/runtime/lib/cpp_wrapper.h"} \
  6694. ${output_include;hide:"tasklet/runtime/lib/go_wrapper.h"} \
  6695. ${output_include;hide:"tasklet/runtime/lib/py_wrapper.h"} \
  6696. ${output_include;hide:"tasklet/runtime/lib/js_wrapper.h"} \
  6697. ${output_include;hide:"tasklet/runtime/lib/registry.h"}
  6698. macro TASKLET_REG(Name, Lang, Impl, Includes...) {
  6699. PEERDIR(tasklet/domain sandbox/bin sandbox/taskbox/worker)
  6700. when($Lang == "js") {
  6701. # JS runtime links the Node.js from contrib as a library, which is a bit heavy,
  6702. # so we do it, only if any JS tasklets are linked into the target
  6703. PEERDIR+=tasklet/runtime/js
  6704. }
  6705. .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"}
  6706. SRCS(GLOBAL $Name.task.cpp)
  6707. }
  6708. # TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
  6709. # NOT COMPLETE
  6710. macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
  6711. PEERDIR(tasklet/domain sandbox/bin sandbox/taskbox/worker)
  6712. .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"}
  6713. SRCS(GLOBAL $Name.task.cpp)
  6714. }
  6715. # tag:cpp-specific
  6716. _CPP_PROTO_MODULE_PREFIX=
  6717. _CPP_PROTO_MODULE_SUFFIX=
  6718. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6719. _CPP_PROTO_MODULE_PREFIX=
  6720. _CPP_PROTO_MODULE_SUFFIX=.lib
  6721. }
  6722. otherwise {
  6723. _CPP_PROTO_MODULE_PREFIX=lib
  6724. _CPP_PROTO_MODULE_SUFFIX=.a
  6725. }
  6726. ### @usage: EXPOSE(OutputsToExport...)
  6727. ###
  6728. ### Allows to mark outputs of macro command as unused in the current module but intended
  6729. ### to be used in modules consuming current via PEERDIR.
  6730. ###
  6731. ### TODO(DEVTOOLS-9000) proper implementation needed
  6732. macro EXPOSE(Args...) {
  6733. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).cpp:"empty_"} ${input;hide:Args}
  6734. }
  6735. # tag:proto
  6736. macro _PROTO_DESC_CMD(File) {
  6737. .CMD=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --descriptor_set_out=${output;suf=.desc:File} --include_source_info ${input;rootrel:File}
  6738. }
  6739. _PROTO_DESC_MERGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $AUTO_INPUT ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
  6740. _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"}
  6741. NEED_GOOGLE_PROTO_PEERDIRS=yes
  6742. PROTO_LIBRARY_SEM=$CPP_LIBRARY_SEM
  6743. # tag:proto
  6744. ### @usage: PROTO_LIBRARY()
  6745. ###
  6746. ### Build some varian of protocol buffers library.
  6747. ###
  6748. ### The particular variant is selected based on where PEERDIR to PROTO_LIBRARY comes from.
  6749. ###
  6750. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  6751. ### When PEERDIR comes from module for particular language appropriate variant is selected.
  6752. ### PROTO_LIBRARY also supports emission of GRPC code if GRPC() macro is specified.
  6753. ### Notes:
  6754. ### - Python versions emit C++ code in addition to Python as optimization.
  6755. ### - In some PROTO_LIBRARY-es Java or Python versions are excluded via EXCLUDE_TAGS macros due to incompatibilities.
  6756. ### - Use from DEPENDS or BUNDLE is not allowed
  6757. ###
  6758. ### Documentation: https://wiki.yandex-team.ru/yatool/proto_library/
  6759. ###
  6760. ### See: [GRPC()](#macro_GRPC), [OPTIMIZE_PY_PROTOS()](#macro_OPTIMIZE_PY_PROTOS), [INCLUDE_TAGS()](#macro_INCLUDE_TAGS), [EXCLUDE_TAGS()](#macro_EXCLUDE_TAGS)
  6761. multimodule PROTO_LIBRARY {
  6762. module CPP_PROTO : LIBRARY {
  6763. .ALLOWED=EXPOSE
  6764. # TODO(svidyuk): think about marker which forces semantics inheritance
  6765. .SEM=PROTO_LIBRARY_SEM
  6766. ENABLE(CPP_PROTO)
  6767. ENABLE(GEN_PROTO)
  6768. NO_CLANG_TIDY()
  6769. SET(PEERDIR_TAGS CPP_PROTO)
  6770. when ($BUILD_PROTO_AS_EVLOG == "yes" && $USE_VANILLA_PROTOC == "yes") {
  6771. _OK=no
  6772. }
  6773. ASSERT(_OK BUILD_PROTO_AS_EVLOG and USE_VANILLA_PROTOC are incompatible yet)
  6774. MODULE_SUFFIX=$_CPP_PROTO_MODULE_SUFFIX
  6775. MODULE_PREFIX=$_CPP_PROTO_MODULE_PREFIX
  6776. when ($_COMMON_GOOGLE_APIS != "None") {
  6777. PEERDIR += contrib/libs/googleapis-common-protos
  6778. }
  6779. }
  6780. module JAVA_PROTO: EXTERNAL_JAVA_LIBRARY {
  6781. .EXTS=.jsrc
  6782. .ALLOWED=GRPC
  6783. .SEM=ignored
  6784. SET(PEERDIR_TAGS JAVA_PROTO)
  6785. ENABLE(JAVA_PROTO)
  6786. PEERDIR+=$JAVA_PROTOBUF_PEERS contrib/java/javax/annotation/javax.annotation-api/1.3.1
  6787. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE
  6788. ADDINCL(FOR proto $PROTOBUF_PATH)
  6789. when ($_COMMON_GOOGLE_APIS != "None") {
  6790. PEERDIR += contrib/java/com/google/api/grpc/proto-google-common-protos/${JAVA_PROTO_COMMON_VERSION}
  6791. ADDINCL += FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6792. }
  6793. }
  6794. module PY_PROTO: PY2_LIBRARY {
  6795. .ALIASES=SRCS=PY_SRCS
  6796. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  6797. .PEERDIRSELF=CPP_PROTO
  6798. .SEM=ignored
  6799. SET(PEERDIR_TAGS PY2 PY_PROTO)
  6800. ENABLE(PY_PROTO)
  6801. OPTIMIZE_PY_PROTOS()
  6802. OBJ_SUF=.py2
  6803. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6804. SET(LINT_LEVEL_VALUE none_internal)
  6805. when ($_COMMON_GOOGLE_APIS != "None") {
  6806. PEERDIR += contrib/libs/googleapis-common-protos
  6807. }
  6808. _IGNORE_SELF_PEERS=
  6809. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  6810. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  6811. _IGNORE_PEERDIRSELF=CPP_PROTO
  6812. }
  6813. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  6814. }
  6815. module PY3_PROTO: PY3_LIBRARY {
  6816. .ALIASES=SRCS=PY_SRCS
  6817. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  6818. .PEERDIRSELF=CPP_PROTO
  6819. .SEM=ignored
  6820. SET(PEERDIR_TAGS PY3 PY3_PROTO)
  6821. ENABLE(PY3_PROTO)
  6822. OPTIMIZE_PY_PROTOS()
  6823. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6824. MODULE_PREFIX=py3
  6825. }
  6826. otherwise {
  6827. MODULE_PREFIX=libpy3
  6828. }
  6829. OBJ_SUF=.py3
  6830. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6831. SET(LINT_LEVEL_VALUE none_internal)
  6832. when ($_COMMON_GOOGLE_APIS != "None") {
  6833. PEERDIR += contrib/libs/googleapis-common-protos
  6834. }
  6835. _IGNORE_SELF_PEERS=
  6836. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  6837. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  6838. _IGNORE_PEERDIRSELF=CPP_PROTO
  6839. }
  6840. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  6841. }
  6842. module GO_PROTO: GO_LIBRARY {
  6843. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO
  6844. .SEM=ignored
  6845. SET(PEERDIR_TAGS GO GO_PROTO)
  6846. ENABLE(GO_PROTO)
  6847. when ($_COMMON_GOOGLE_APIS == "None") {
  6848. }
  6849. elsewhen ($_COMMON_GOOGLE_APIS == "") {
  6850. PEERDIR += $_GO_COMMON_GOOGLE_APIS
  6851. ADDINCL += FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6852. }
  6853. otherwise {
  6854. PEERDIR += $_COMMON_GOOGLE_APIS
  6855. ADDINCL += FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6856. }
  6857. }
  6858. module EXT_PROTO: _BARE_UNIT {
  6859. .ALIASES=SRCS=_RAW_PROTO_SRCS
  6860. .CMD=TOUCH_UNIT_MF
  6861. .SEM=ignored
  6862. .EXTS=.*
  6863. .PROXY=yes
  6864. .PEERDIR_POLICY=as_build_from
  6865. SET(PEERDIR_TAGS EXT_PROTO)
  6866. ENABLE(EXT_PROTO)
  6867. SET(MODULE_SUFFIX .raw.fake.pkg)
  6868. SET(MODULE_TYPE LIBRARY)
  6869. when ($_COMMON_GOOGLE_APIS != "None") {
  6870. PEERDIR += contrib/libs/googleapis-common-protos
  6871. }
  6872. SET(CREDITS_FILE_EXTRA_EXT .ext_proto)
  6873. }
  6874. module DESC_PROTO: _BARE_UNIT {
  6875. .CMD=_PROTO_DESC_MERGE_CMD
  6876. .SEM=ignored
  6877. .EXTS=.desc
  6878. .NODE_TYPE=Library
  6879. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
  6880. SET(PEERDIR_TAGS DESC_PROTO)
  6881. ENABLE(DESC_PROTO)
  6882. MODULE_SUFFIX=.self.protodesc
  6883. SET(MODULE_TYPE LIBRARY)
  6884. MACRO_ALIAS(EVLOG_CMD _PROTO_DESC_CMD)
  6885. MACRO_ALIAS(PROTO_CMD _PROTO_DESC_CMD)
  6886. when ($_COMMON_GOOGLE_APIS != "None") {
  6887. PEERDIR += contrib/libs/googleapis-common-protos
  6888. }
  6889. when ($NEED_GOOGLE_PROTO_PEERDIRS == "yes") {
  6890. when ($USE_VANILLA_PROTOC == "yes") {
  6891. PEERDIR += contrib/libs/protobuf_std/builtin_proto/protos_from_protobuf
  6892. }
  6893. otherwise {
  6894. PEERDIR += contrib/libs/protobuf/builtin_proto/protos_from_protoc
  6895. }
  6896. }
  6897. }
  6898. module PB_PY_PROTO: _PY_PACKAGE {
  6899. .INCLUDE_TAG=no
  6900. .PROXY=yes
  6901. .SEM=ignored
  6902. SET(MODULE_SUFFIX .pb_py.fake.pkg)
  6903. ENABLE(PB_PY_PROTO)
  6904. # WARN:
  6905. # _COMMON_GOOGLE_APIS aren't handled intentionally.
  6906. # PB_PY_PROTO is a legacy module type, stop using it.
  6907. }
  6908. }
  6909. # tag:proto
  6910. _EXT_PROTO_DIR=_RAW_
  6911. # tag:proto
  6912. ### This var defines the root of the tree for copied proto files from EXT_PROTO
  6913. ### submodule of PROTO_LIBRARY module
  6914. EXT_PROTO_ROOT=${ARCADIA_BUILD_ROOT}/${_EXT_PROTO_DIR}
  6915. # tag:proto
  6916. ### @usage: USE_EXT_PROTO(peerdir_tag...)
  6917. ###
  6918. ### Configure module to use proto files from existing PROTO_LIBRARY module.
  6919. ### Additional PEERDIR tags required to build a module can be passed through
  6920. ### EXTRA_TAGS vararg parameter.
  6921. macro USE_EXT_PROTO(EXTRA_TAGS...) {
  6922. SET(PEERDIR_TAGS EXT_PROTO ${EXTRA_TAGS})
  6923. SRCDIR(${EXT_PROTO_ROOT})
  6924. }
  6925. # tag:proto tag:internal
  6926. ### @usage: _RAW_PROTO_SRCS(files...) # internal
  6927. ###
  6928. ### _RAW_PROTO_SRCS is a proxy macro to FILES macro which filters out
  6929. ### GLOBAL keyword from the list of files (NOTE! The order of files listed
  6930. ### originally in call to _RAW_PROTO_SRCS() macro is changed in call to
  6931. ### FILES() macro). Currently this macro copies only files with the following
  6932. ### extensions: .proto, .gztproto, .ev
  6933. macro _RAW_PROTO_SRCS(FILES...) {
  6934. COPY_FILES_TO_BUILD_PREFIX(${ext=.proto:FILES} PREFIX ${_EXT_PROTO_DIR})
  6935. COPY_FILES_TO_BUILD_PREFIX(${ext=.gztproto:FILES} PREFIX ${_EXT_PROTO_DIR})
  6936. COPY_FILES_TO_BUILD_PREFIX(${ext=.ev:FILES} PREFIX ${_EXT_PROTO_DIR})
  6937. }
  6938. module PROTO_DESCRIPTIONS: _BARE_UNIT {
  6939. .CMD=_PROTO_DESC_MERGE_PEERS_CMD
  6940. .PEERDIR_POLICY=as_build_from
  6941. .NODE_TYPE=Library
  6942. .RESTRICTED=SRCS
  6943. .FINAL_TARGET=yes
  6944. SET(PEERDIR_TAGS DESC_PROTO)
  6945. SET(MODULE_SUFFIX .protodesc)
  6946. SET(MODULE_TYPE PROTO_DESCRIPTIONS)
  6947. }
  6948. module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
  6949. SET(MODULE_TYPE PROTO_REGISTRY)
  6950. }
  6951. # tag:fbs
  6952. _FBS_NAMESPACE_MAP_GLOBAL=
  6953. # tag:fbs
  6954. macro _FBS_NAMESPACE_IMPL(NAMESPACE, PATH, DUMMY...) {
  6955. SET_APPEND(_FBS_NAMESPACE_MAP_GLOBAL ${NAMESPACE}=${PATH})
  6956. }
  6957. # tag:fbs
  6958. macro FBS_NAMESPACE(NAMESPACE, PATH...) {
  6959. _FBS_NAMESPACE_IMPL($NAMESPACE $PATH $MODDIR)
  6960. }
  6961. # tag:fbs
  6962. ### @usage: FBS_LIBRARY()
  6963. ###
  6964. ### Build some variant of Flatbuffers library.
  6965. ###
  6966. ### The particular variant is selected based on where PEERDIR to FBS_LIBRARY
  6967. ### comes from.
  6968. ###
  6969. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  6970. ### When PEERDIR comes from module for particular language appropriate variant
  6971. ### is selected.
  6972. ###
  6973. ### Notes: FBS_NAMESPACE must be specified in all dependent FBS_LIBRARY modules
  6974. ### if build of Go code is requested.
  6975. multimodule FBS_LIBRARY {
  6976. module CPP_FBS: LIBRARY {
  6977. ENABLE(CPP_FBS)
  6978. SET(PEERDIR_TAGS CPP_FBS)
  6979. }
  6980. module GO_FBS: GO_LIBRARY {
  6981. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  6982. ENABLE(GO_FBS)
  6983. SET(PEERDIR_TAGS GO GO_FBS)
  6984. }
  6985. module JAVA_FBS: EXTERNAL_JAVA_LIBRARY {
  6986. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  6987. ENABLE(JAVA_FBS)
  6988. SET(PEERDIR_TAGS JAVA_FBS)
  6989. }
  6990. module PY2_FBS: PY2_LIBRARY {
  6991. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  6992. .ALIASES=SRCS=PY_SRCS
  6993. ENABLE(PY2_FBS)
  6994. SET(PEERDIR_TAGS PY2 PY2_FBS)
  6995. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6996. SET(LINT_LEVEL_VALUE none_internal)
  6997. }
  6998. module PY3_FBS: PY3_LIBRARY {
  6999. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7000. .ALIASES=SRCS=PY_SRCS
  7001. ENABLE(PY3_FBS)
  7002. SET(PEERDIR_TAGS PY3 PY3_FBS)
  7003. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7004. SET(LINT_LEVEL_VALUE none_internal)
  7005. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7006. MODULE_PREFIX=py3
  7007. }
  7008. otherwise {
  7009. MODULE_PREFIX=libpy3
  7010. }
  7011. OBJ_SUF=.py3
  7012. }
  7013. }
  7014. # tag:java-specific
  7015. _COMPILE_JSRC=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_jsrc.py"} --input $AUTO_INPUT --output $TARGET --prefix $BINDIR ${requirements;hide:JAVA_REQUIREMENTS} ${kv;hide:"p JC"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7016. # tag:java-specific
  7017. COMPILE_JSRC_MF=$_COMPILE_JSRC && $GENERATE_MF
  7018. # tag:java-specific tag:internal
  7019. ### @usage: JSRC_LIBRARY() # internal
  7020. module JSRC_LIBRARY: _BARE_UNIT {
  7021. .CMD=COMPILE_JSRC_MF
  7022. .EXTS=.java
  7023. .ALL_INS_TO_OUT=no
  7024. .PEERDIR_POLICY=as_include
  7025. .FINAL_TARGET=no
  7026. .ALIASES=SRCS=FILES
  7027. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  7028. MODULE_TYPE=Library
  7029. SET(MODULE_SUFFIX .jsrc)
  7030. SET(DONT_RESOLVE_INCLUDES yes)
  7031. SET(NEED_PLATFORM_PEERDIRS no)
  7032. SET(MODULE_LANG JAVA)
  7033. NO_RUNTIME()
  7034. }
  7035. # tag:maps-specific
  7036. @import "${CONF_ROOT}/conf/project_specific/maps/asrc.conf"
  7037. # tag:internal
  7038. ### @usage: _PROXY_LIBRARY() # internal
  7039. ###
  7040. ### The use of this module is strictly prohibited!!!
  7041. module _PROXY_LIBRARY: LIBRARY {
  7042. .EXTS=.a .lib
  7043. .PEERDIR_POLICY=as_build_from
  7044. .PROXY=yes
  7045. .FINAL_TARGET=yes
  7046. DISABLE(NEED_ADD_FAKE_SRC)
  7047. NO_UTIL()
  7048. NO_RUNTIME()
  7049. }
  7050. # tag:maps-specific
  7051. @import "${CONF_ROOT}/conf/project_specific/maps/aar.conf"
  7052. @import "${CONF_ROOT}/conf/project_specific/maps/sproto.conf"
  7053. @import "${CONF_ROOT}/conf/project_specific/maps/mapkit.conf"
  7054. _PRIMARY_OUTPUT_VALUE=
  7055. # tag:internal
  7056. ### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
  7057. ###
  7058. ### The use of this module is strictly prohibited!!!
  7059. macro PRIMARY_OUTPUT(OUTPUT) {
  7060. SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
  7061. }
  7062. _DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${input;hide:_PRIMARY_OUTPUT_VALUE} ${TARGET}
  7063. # tag:internal
  7064. ### @usage: DLL_PROXY_LIBRARY() # internal
  7065. ###
  7066. ### The use of this module is strictly prohibited!!!
  7067. module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
  7068. .ALLOWED=PRIMARY_OUTPUT
  7069. .CMD=_DLL_PROXY_LIBRARY_CMD
  7070. }
  7071. _PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${kv;hide:"p ld"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7072. # tag:internal
  7073. ### @usage: PREBUILT_PROGRAM([programname]) # internal
  7074. ###
  7075. ### Program module which uses a prebuilt prgram as its output.
  7076. module PREBUILT_PROGRAM: _LINK_UNIT {
  7077. .CMD=_PREBUILT_PROGRAM_CMD
  7078. .SYMLINK_POLICY=EXE
  7079. .ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
  7080. .RESTRICTED=SRCS
  7081. _BARE_LINK_MODULE()
  7082. SET(MODULE_TYPE PROGRAM)
  7083. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  7084. MODULE_SUFFIX=.exe
  7085. }
  7086. }
  7087. ### @usage COLLECT_JINJA_TEMPLATES(varname path)
  7088. ###
  7089. ### This macro collects all jinja and yaml files in the directory specified by second argument and
  7090. ### stores result in the variable with mane specified by first parameter.
  7091. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
  7092. _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
  7093. }
  7094. # tag:go-specific
  7095. GO_HOST_OS=unknown
  7096. when ($HOST_OS_LINUX) {
  7097. GO_HOST_OS=linux
  7098. }
  7099. elsewhen ($HOST_OS_DARWIN) {
  7100. GO_HOST_OS=darwin
  7101. }
  7102. elsewhen($HOST_OS_WINDOWS) {
  7103. GO_HOST_OS=windows
  7104. }
  7105. # tag:go-specific
  7106. GO_HOST_ARCH=unknown
  7107. when ($HOST_ARCH_X86_64) {
  7108. GO_HOST_ARCH=amd64
  7109. }
  7110. elsewhen($HOST_ARCH_ARM64) {
  7111. GO_HOST_ARCH=arm64
  7112. }
  7113. # tag:go-specific
  7114. GO_TARG_OS=unknown
  7115. when ($OS_LINUX) {
  7116. GO_TARG_OS=linux
  7117. }
  7118. elsewhen ($OS_DARWIN) {
  7119. GO_TARG_OS=darwin
  7120. }
  7121. elsewhen ($OS_WINDOWS) {
  7122. GO_TARG_OS=windows
  7123. }
  7124. # tag:go-specific
  7125. GO_TARG_ARCH=unknwon
  7126. when ($ARCH_X86_64) {
  7127. GO_TARG_ARCH=amd64
  7128. }
  7129. elsewhen ($ARCH_I386) {
  7130. GO_TARG_ARCH=x86
  7131. }
  7132. elsewhen ($ARCH_ARM64) {
  7133. GO_TARG_ARCH=arm64
  7134. }
  7135. # tag:go-specific
  7136. GO_HOST_TARG_PARAMS=++host-os $GO_HOST_OS ++host-arch $GO_HOST_ARCH ++targ-os $GO_TARG_OS ++targ-arch $GO_TARG_ARCH
  7137. # tag:go-specific
  7138. GOSTD_VERSION=1.17.7
  7139. when ($GOSTD_VERSION == "1.17.7") {
  7140. GOSTD=contrib/go/_std/src
  7141. }
  7142. elsewhen ($GOSTD_VERSION == "1.18rc1") {
  7143. GOSTD=contrib/go/_std_1.18rc1/src
  7144. }
  7145. otherwise {
  7146. GOSTD=__unsupported_go_std_library_version_[$GOSTD_VERSION]__
  7147. }
  7148. # tag:go-specific
  7149. GO_DEBUG_PATH_RELATIVE=no
  7150. _GO_DEBUG_PATH__NO_UID__=
  7151. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=
  7152. # tag:go-specific
  7153. _GO_IMPORT_PATH=${MODDIR}
  7154. # tag:go-specific
  7155. GO_VET=yolint
  7156. GO_VET_TOOL=
  7157. GO_VET_FLAGS=
  7158. GO_VET_EXTRA_FLAGS=
  7159. # tag:go-specific
  7160. _GO_VET_ADD_CHECK=yes
  7161. _GO_FMT_ADD_CHECK=yes
  7162. _GO_YDX_FILE=
  7163. # tag:go-specific
  7164. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=/-B --source-prefix=/-S
  7165. _GO_LINK_EXE_EXT_CMD=
  7166. # tag:go-specific
  7167. GO_WITH_MUSL=
  7168. # tag:go-specific
  7169. GO_TOOLS_ROOT=${GO_TOOLS_RESOURCE_GLOBAL}
  7170. GO_TEST_MINER=${tool:"tools/go_test_miner"}
  7171. GO_TEST_IMPORT_PATH=
  7172. # tag:go-specific
  7173. GO_STD_LIB_PREFIX=${GOSTD}/
  7174. GO_ARCADIA_PROJECT_PREFIX=a.yandex-team.ru/
  7175. GO_CONTRIB_PROJECT_PREFIX=vendor/
  7176. GO_SKIP_IMPORTS=unsafe C
  7177. GO_VET_INFO_EXT=.vet.out
  7178. GO_VET_REPORT_EXT=.vet.txt
  7179. GO_VET_OUTPUT_INFO=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_INFO_EXT}:REALPRJNAME}
  7180. GO_VET_OUTPUT_REPORT=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_REPORT_EXT}:REALPRJNAME}
  7181. # tag:go-specific tag:codenav
  7182. _GO_YNDEXER_EXT=.ydx.pb2
  7183. GO_YNDEXER_OUTPUT=${output;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${_GO_YNDEXER_EXT}:REALPRJNAME}
  7184. # tag:go-specific
  7185. GO_PROJECT_PREFIXES=++std-lib-prefix $GO_STD_LIB_PREFIX ++arc-project-prefix $GO_ARCADIA_PROJECT_PREFIX
  7186. # tag:go-specific
  7187. _GO_FAKEID=${FAKEID}.${BUILD_TYPE}.${GO_FAKEID}
  7188. # tag:go-specific
  7189. CGO2_CFLAGS_VALUE=
  7190. CGO2_LDFLAGS_VALUE=
  7191. # tag:go-specific
  7192. GO_ASM_FLAGS_VALUE=
  7193. ### @usage: GO_ASM_FLAGS(flags)
  7194. ### Add the specified flags to the go asm compile command line.
  7195. macro GO_ASM_FLAGS(Flags...) {
  7196. SET_APPEND(GO_ASM_FLAGS_VALUE $Flags)
  7197. }
  7198. # tag:go-specific
  7199. GO_CGO1_FLAGS_VALUE=
  7200. ### @usage: GO_CGO1_FLAGS(flags)
  7201. ### Add the specified flags to the go cgo compile command line.
  7202. macro GO_CGO1_FLAGS(Flags...) {
  7203. SET_APPEND(GO_CGO1_FLAGS_VALUE $Flags)
  7204. }
  7205. # tag:go-specific
  7206. GO_CGO2_FLAGS_VALUE=
  7207. ### @usage: GO_CGO2_FLAGS(flags)
  7208. ### Add the specified flags to the go cgo compile command line.
  7209. macro GO_CGO2_FLAGS(Flags...) {
  7210. SET_APPEND(GO_CGO2_FLAGS_VALUE $Flags)
  7211. }
  7212. # tag:go-specific
  7213. GO_COMPILE_FLAGS_VALUE=$USER_GO_COMPILE_FLAGS
  7214. ### @usage: GO_COMPILE_FLAGS(flags)
  7215. ### Add the specified flags to the go compile command line.
  7216. macro GO_COMPILE_FLAGS(Flags...) {
  7217. SET_APPEND(GO_COMPILE_FLAGS_VALUE $Flags)
  7218. }
  7219. # tag:go-specific
  7220. GO_LINK_FLAGS_VALUE=$USER_GO_LINK_FLAGS
  7221. ### @usage: GO_LINK_FLAGS(flags)
  7222. ### Add the specified flags to the go link command line.
  7223. macro GO_LINK_FLAGS(Flags...) {
  7224. SET_APPEND(GO_LINK_FLAGS_VALUE $Flags)
  7225. }
  7226. # tag:go-specific
  7227. _GO_TOOL_MODE=
  7228. # tag:go-specific
  7229. _GO_TOOL_COMMON_FLAGS=\
  7230. ++mode $_GO_TOOL_MODE \
  7231. $GO_PROJECT_PREFIXES \
  7232. ++goversion $GOSTD_VERSION \
  7233. ++source-root $ARCADIA_ROOT \
  7234. ++build-root $ARCADIA_BUILD_ROOT \
  7235. ++output-root $BINDIR \
  7236. ++toolchain-root $GO_TOOLS_ROOT \
  7237. $GO_HOST_TARG_PARAMS \
  7238. ++output $TARGET \
  7239. $GO_VET_OUTPUT \
  7240. $_GO_YDX_FILE \
  7241. $_GO_DEBUG_PATH__NO_UID__ \
  7242. ++srcs $AUTO_INPUT ${input:GO_FILES} \
  7243. ++asm-flags $GO_ASM_FLAGS_VALUE \
  7244. ++compile-flags $GO_COMPILE_FLAGS_VALUE \
  7245. ++link-flags $GO_LINK_FLAGS_VALUE \
  7246. ++cgo-srcs ${input:CGO_FILES} \
  7247. $_GO_EMBED_VALUE \
  7248. $GO_TOOLCHAIN_ENV
  7249. # tag:go-specific
  7250. macro _GO_GEN_COVER_GO(GO_FILE, VAR_ID) {
  7251. .CMD=${hide:_GO_FAKEID} $GO_TOOLS_ROOT/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cover -mode set -var $VAR_ID -o ${output;noext;suf=.cover.go:GO_FILE} ${input:GO_FILE}
  7252. }
  7253. # tag:go-specific
  7254. macro _GO_COMPILE_SYMABIS(FLAGS[], ASM_FILES...) {
  7255. .CMD=${hide:_GO_FAKEID} $GO_TOOLS_ROOT/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/asm $_GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__ ${pre=-I :_C__INCLUDE} -I $GO_TOOLS_ROOT/pkg/include -D GOOS_${GO_TARG_OS} -D GOARCH_${GO_TARG_ARCH} $FLAGS $GO_ASM_FLAGS_VALUE -gensymabis -o ${output:"gen.symabis"} ${input:ASM_FILES} ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7256. .ADDINCL=build/scripts/go_fake_include
  7257. }
  7258. # tag:go-specific
  7259. macro _GO_COMPILE_CGO1(NAME, FLAGS[], FILES...) {
  7260. .CMD=${hide:_GO_FAKEID} ${cwd:ARCADIA_ROOT} $YMAKE_PYTHON ${input:"build/scripts/cgo1_wrapper.py"} $_GO_CGO1_WRAPPER_FLAGS --build-root ${ARCADIA_BUILD_ROOT} --source-root ${ARCADIA_ROOT} --cgo1-files ${output;noext:FILES.cgo1.go} --cgo2-files ${output;noauto;noext:FILES.cgo2.c} -- ${GO_TOOLS_ROOT}/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cgo -objdir $BINDIR -importpath $NAME $GO_CGO1_FLAGS_VALUE $FLAGS -- $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} ${CGO_CFLAGS_VALUE} ${input:FILES} ${output;hide:"_cgo_export.h"} ${output;hide:"_cgo_export.c"} ${output;hide:"_cgo_gotypes.go"} ${output;noauto;hide:"_cgo_main.c"} ${output;noauto;hide:"_cgo_flags"} $GO_TOOLCHAIN_ENV ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7261. }
  7262. # tag:go-specific
  7263. macro _GO_COMPILE_CGO2(NAME, C_FILES[], S_FILES[], OBJ_FILES[], FILES...) {
  7264. .CMD=${hide:_GO_FAKEID} $C_COMPILER $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} $CGO_CFLAGS_VALUE ${input;tobindir:"_cgo_main.c"} -c -o ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_main.c"} && $C_COMPILER $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} -o ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_"} $LDFLAGS $LDFLAGS_GLOBAL $CGO2_LDFLAGS_VALUE ${input;hide:"_cgo_export.h"} ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_main.c"} ${input;suf=${OBJECT_SUF}:"_cgo_export.c"} ${input;nopath;noext;suf=.cgo2.c${OBJECT_SUF}:FILES} ${input;suf=${OBJECT_SUF}:C_FILES} ${input;suf=.o:S_FILES} ${input:OBJ_FILES} $CGO_LDFLAGS_VALUE && ${GO_TOOLS_ROOT}/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cgo -dynpackage $NAME -dynimport ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_"} -dynout ${output:"_cgo_import.go"} -dynlinker $GO_CGO2_FLAGS_VALUE $GO_TOOLCHAIN_ENV ${requirements;hide:CC_REQUIREMENTS} ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7265. _USE_LINKER()
  7266. }
  7267. # tag:go-specific
  7268. macro _GO_LINK_LIB_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
  7269. .CMD=${hide:_GO_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/go_tool.py"} ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} --ya-end-command-file ${requirements;hide:LIB_REQUIREMENTS} ${kv;hide:"p GO"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"}
  7270. }
  7271. # tag:go-specific
  7272. macro _GO_LINK_EXE_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
  7273. .CMD=${hide:_GO_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/go_tool.py"} ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++vcs $VCS_GO $GO_WITH_MUSL $GO_EXTLD ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} ++non-local-peers ${rootrel;tags_in=GO|GO_PROTO|GO_FBS;tags_out=local:PEERS} ++cgo-peers ${VCS_C_OBJ_RR} ${rootrel;tags_out=GO|GO_PROTO|GO_FBS:PEERS} --ya-end-command-file ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"p LD"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"} $_GO_LINK_EXE_EXT_CMD
  7274. }
  7275. # tag:go-specific
  7276. macro _GO_LINK_TEST_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_TEST_FILES[], GO_XTEST_FILES[], GO_FILES...) {
  7277. .CMD=${hide:_GO_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/go_tool.py"} ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++vcs $VCS_GO $GO_WITH_MUSL $GO_EXTLD ++test-miner $GO_TEST_MINER ++test-import-path $GO_TEST_IMPORT_PATH ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} ++non-local-peers ${rootrel;tags_in=GO|GO_PROTO|GO_FBS;tags_out=local:PEERS} ++cgo-peers ${VCS_C_OBJ_RR} ${rootrel;tags_out=GO|GO_PROTO|GO_FBS:PEERS} ++test_srcs ${input:GO_TEST_FILES} ++xtest_srcs ${input:GO_XTEST_FILES} ++cover_info $GO_COVER_INFO_VALUE ++skip-tests $_GO_SKIP_TEST_VALUE --ya-end-command-file ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"p GO"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"}
  7278. }
  7279. # tag:go-specific
  7280. GO_LINK_LIB=$GENERATE_MF && $_GO_LINK_LIB_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_INPUTS $_GO_EMBED_INPUTS)
  7281. GO_LINK_EXE=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $GENERATE_VCS_GO_INFO_NODEP && $_GO_LINK_EXE_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_INPUTS $_GO_EMBED_INPUTS)
  7282. GO_LINK_TEST=$GENERATE_VCS_C_INFO_NODEP && $GENERATE_VCS_GO_INFO_NODEP && $_GO_LINK_TEST_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_INPUTS $_GO_EMBED_INPUTS GO_TEST_FILES $_GO_TEST_SRCS_VALUE GO_XTEST_FILES $_GO_XTEST_SRCS_VALUE)
  7283. GO_LINK_DLL=$GO_LINK_EXE && $COPY_CMD $BINDIR/_cgo_export.h ${output;pre=${MODULE_PREFIX};suf=.h:REALPRJNAME}
  7284. # tag:go-specific
  7285. CGO_ENABLED=yes
  7286. when ($OS_WINDOWS == "yes" || $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  7287. CGO_ENABLED=no
  7288. }
  7289. # tag:go-specific
  7290. GO_PACKAGE_VALUE=
  7291. ### @usage: GO_PACKAGE_NAME(Name)
  7292. ### Override name of a Go package.
  7293. macro GO_PACKAGE_NAME(NAME) {
  7294. SET(GO_PACKAGE_VALUE $NAME)
  7295. }
  7296. # tag:go-specific tag:internal
  7297. _GO_SRCS_VALUE=
  7298. ### @usage: _GO_SRCS(Files...) # internal
  7299. ### This macro shouldn't be used in ya.make files, use SRCS() instead.
  7300. ### This is internal macro collecting .go sources for processing within Go modules (GO_PROGRAM and GO_LIBRARY)
  7301. macro _GO_SRCS(FILES...) {
  7302. GO_FAKE_OUTPUT($FILES)
  7303. SET_APPEND(_GO_SRCS_VALUE $FILES)
  7304. }
  7305. # tag:go-specific
  7306. _GO_TEST_SRCS_VALUE=
  7307. ### @usage: GO_TEST_SRCS(Files...)
  7308. ### .go sources for internal tests of a module
  7309. macro GO_TEST_SRCS(FILES...) {
  7310. GO_FAKE_OUTPUT($FILES)
  7311. SET_APPEND(_GO_TEST_SRCS_VALUE $FILES)
  7312. }
  7313. # tag:go-specific
  7314. _GO_XTEST_SRCS_VALUE=
  7315. ### @usage: GO_XTEST_SRCS(Files...)
  7316. ### .go sources for external tests of a module
  7317. macro GO_XTEST_SRCS(FILES...) {
  7318. GO_FAKE_OUTPUT($FILES)
  7319. SET_APPEND(_GO_XTEST_SRCS_VALUE $FILES)
  7320. }
  7321. # tag:go-specific
  7322. macro _GO_UNUSED_SRCS(FLAGS...) {
  7323. ENABLE(UNUSED_MACRO)
  7324. }
  7325. # tag:go-specific
  7326. _CGO_SRCS_VALUE=
  7327. ### @usage: CGO_SRCS(Files...)
  7328. ### .go sources to be built with CGO
  7329. macro CGO_SRCS(FILES...) {
  7330. SET_APPEND(_CGO_SRCS_VALUE $FILES)
  7331. PEERDIR(${GOSTD}/syscall)
  7332. }
  7333. # tag:go-specific
  7334. GO_LDFLAGS_GLOBAL=
  7335. ### @usage: GO_LDFLAGS(Flags...)
  7336. ### Link flags for GO_PROGRAM linking from .go sources
  7337. macro GO_LDFLAGS(FLAGS...) {
  7338. SET_APPEND(GO_LDFLAGS_GLOBAL $FLAGS)
  7339. }
  7340. # tag:go-specific
  7341. CGO_CFLAGS_VALUE=
  7342. ### @usage: CGO_CFLAGS(Flags...)
  7343. ### Compiler flags specific to CGO compilation
  7344. macro CGO_CFLAGS(FLAGS...) {
  7345. SET_APPEND(CGO_CFLAGS_VALUE $FLAGS)
  7346. CFLAGS($FLAGS)
  7347. }
  7348. # tag:go-specific
  7349. CGO_LDFLAGS_VALUE=
  7350. ### @usage: CGO_LDFLAGS(Files...)
  7351. ### Linker flags specific to CGO linking
  7352. macro CGO_LDFLAGS(FLAGS...) {
  7353. SET_APPEND(CGO_LDFLAGS_VALUE $FLAGS)
  7354. GO_LDFLAGS($FLAGS)
  7355. }
  7356. # tag:go-specific
  7357. _GO_SKIP_TEST_VALUE=
  7358. ### @usage: GO_SKIP_TESTS(TestNames...)
  7359. ###
  7360. ### Define a set of tests that should not be run.
  7361. ### NB! Subtests are not taken into account!
  7362. macro GO_SKIP_TESTS(TESTS...) {
  7363. SET_APPEND(_GO_SKIP_TEST_VALUE $TESTS)
  7364. RESTRICT_PATH(vendor MSG This macro is prohibited to be used outside the vendor/ directory)
  7365. }
  7366. # tag:go-specific tag:internal
  7367. _GO_EMBED_VALUE=
  7368. _GO_EMBED_INPUTS=
  7369. ### @usage: _GO_EMBED_PATTERN(PATTERN) # internal
  7370. ###
  7371. ### Define an embed pattern.
  7372. macro _GO_EMBED_PATTERN(XTEST?"_xtest":"", PATTERN, IMPORT_PATH) {
  7373. SET(VAR_SALT1 $XTEST $PATTERN $IMPORT_PATH 1)
  7374. SET(_PATTERN_GLOB1 uniq_embed_${hash:VAR_SALT1})
  7375. _GLOB($_PATTERN_GLOB1 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/.*)
  7376. SET(VAR_SALT2 $XTEST $PATTERN $IMPORT_PATH 2)
  7377. SET(_PATTERN_GLOB2 _uniq_embed_${hash:VAR_SALT2})
  7378. _GLOB($_PATTERN_GLOB2 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN})
  7379. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $PATTERN \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7380. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7381. }
  7382. # tag:go-specific
  7383. ### @usage: GO_EMBED_PATTERN(PATTERN)
  7384. ###
  7385. ### Define an embed pattern.
  7386. macro GO_EMBED_PATTERN(PATTERN) {
  7387. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7388. }
  7389. # tag:go-specific
  7390. ### @usage: GO_TEST_EMBED_PATTERN(PATTERN)
  7391. ###
  7392. ### Define an embed pattern for internal go tests.
  7393. macro GO_TEST_EMBED_PATTERN(PATTERN) {
  7394. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7395. }
  7396. # tag:go-specific
  7397. ### @usage: GO_XTEST_EMBED_PATTERN(PATTERN)
  7398. ###
  7399. ### Define an embed pattern for external go tests.
  7400. macro GO_XTEST_EMBED_PATTERN(PATTERN) {
  7401. _GO_EMBED_PATTERN(XTEST $PATTERN $_GO_IMPORT_PATH)
  7402. }
  7403. # tag:go-specific tag:internal
  7404. ### @usage: _GO_EMBED_DIR(PATTERN) # internal
  7405. ###
  7406. ### Define an embed directory DIR.
  7407. macro _GO_EMBED_DIR(XTEST?"_xtest":"", DIR, IMPORT_PATH) {
  7408. SET(VAR_SALT $XTEST $DIR $IMPORT_PATH)
  7409. SET(_PATTERN_GLOB uniq_embed_${hash:VAR_SALT})
  7410. _GLOB($_PATTERN_GLOB ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/.*)
  7411. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $DIR \$$_PATTERN_GLOB)
  7412. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB)
  7413. }
  7414. # tag:go-specific
  7415. ### @usage: GO_EMBED_DIR(DIR)
  7416. ###
  7417. ### Define an embed directory DIR.
  7418. macro GO_EMBED_DIR(DIR) {
  7419. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH)
  7420. }
  7421. # tag:go-specific
  7422. ### @usage: GO_TEST_EMBED_DIR(DIR)
  7423. ###
  7424. ### Define an embed directory DIR for internal go tests.
  7425. macro GO_EMBED_TEST_DIR(DIR) {
  7426. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH)
  7427. }
  7428. # tag:go-specific
  7429. ### @usage: GO_XTEST_EMBED_DIR(DIR)
  7430. ###
  7431. ### Define an embed directory DIR for external go tests.
  7432. macro GO_EMBED_XTEST_DIR(DIR) {
  7433. _GO_EMBED_DIR(XTEST $DIR $_GO_IMPORT_PATH)
  7434. }
  7435. # tag:go-specific
  7436. _GO_TOOLCHAIN_ENV_GOARCH=unknown
  7437. when ($ARCH_ARM64) {
  7438. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=arm64"}
  7439. }
  7440. elsewhen ($ARCH_X86_64) {
  7441. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=amd64"}
  7442. }
  7443. # tag:go-specific
  7444. _GO_TOOLCHAIN_ENV_GOOS=unknown
  7445. when ($OS_DARWIN) {
  7446. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=darwin"}
  7447. }
  7448. elsewhen ($OS_LINUX) {
  7449. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=linux"}
  7450. }
  7451. elsewhen ($OS_WINDOWS) {
  7452. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=windows"}
  7453. }
  7454. _GO_TOOLCHAIN_ENV_PATH=
  7455. # tag:go-specific
  7456. GO_TOOLCHAIN_ENV=$TOOLCHAIN_ENV $_GO_TOOLCHAIN_ENV_GOARCH $_GO_TOOLCHAIN_ENV_GOOS $_GO_TOOLCHAIN_ENV_PATH
  7457. # tag:go-specific
  7458. _GO_GRPC_WELLKNOWN=\
  7459. vendor/google.golang.org/grpc \
  7460. vendor/google.golang.org/grpc \
  7461. vendor/google.golang.org/grpc/codes \
  7462. vendor/google.golang.org/grpc/grpclog \
  7463. vendor/google.golang.org/grpc/status
  7464. # tag:go-specific
  7465. macro _GO_GRPC() {
  7466. SET(GO_PROTO_GEN_PLUGINS grpc)
  7467. PEERDIR(${GOSTD}/context ${_GO_GRPC_WELLKNOWN})
  7468. }
  7469. # tag:go-specific
  7470. ### @usage: GO_GRPC_GATEWAY_SRCS()
  7471. ###
  7472. ### Use of grpc-gateway plugin (Supported for Go only).
  7473. macro GO_GRPC_GATEWAY_SRCS(FILE...) {
  7474. ENABLE(UNUSED_MACRO)
  7475. }
  7476. # tag:go-specific
  7477. ### @usage: GO_GRPC_GATEWAY_SWAGGER_SRCS()
  7478. ###
  7479. ### Use of grpc-gateway plugin w/ swagger emission (Supported for Go only).
  7480. macro GO_GRPC_GATEWAY_SWAGGER_SRCS(FILE...) {
  7481. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  7482. }
  7483. # tag:go-specific
  7484. _GO_PROTO_GRPC_GATEWAY_OPTS=
  7485. _GO_PROTO_GRPC_GATEWAY_OUTS=
  7486. # tag:go-specific
  7487. macro _GO_GRPC_GATEWAY_SRCS_IMPL(Files...) {
  7488. foreach (File : $Files) {
  7489. [.proto]=$_GO_PROTO_CMD_IMPL($File OPTS $_GO_PROTO_GRPC_GATEWAY_OPTS OUTS $_GO_PROTO_GRPC_GATEWAY_OUTS)
  7490. }
  7491. PEERDIR(${GOSTD}/context ${GOSTD}/io ${GOSTD}/net/http)
  7492. PEERDIR(vendor/github.com/golang/protobuf/descriptor)
  7493. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/runtime)
  7494. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/utilities)
  7495. PEERDIR(vendor/google.golang.org/grpc/metadata)
  7496. }
  7497. # tag:go-specific
  7498. macro _SETUP_GO_GRPC_GATEWAY() {
  7499. 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:))
  7500. SET(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;nopath;noext;suf=.pb.gw.go:File})
  7501. }
  7502. # tag:go-specific
  7503. macro _GO_GRPC_GATEWAY_SRCS(Files...) {
  7504. _SETUP_GO_GRPC_GATEWAY()
  7505. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  7506. }
  7507. # tag:go-specific
  7508. macro _GO_GRPC_GATEWAY_SWAGGER_SRCS(Files...) {
  7509. _SETUP_GO_GRPC_GATEWAY()
  7510. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OPTS $_PROTO_PLUGIN_ARGS_BASE(swagger vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger logtostderr=true:))
  7511. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;noauto;nopath;noext;suf=.swagger.json:File})
  7512. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  7513. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  7514. }
  7515. # tag:go-specific
  7516. when ($MUSL == "yes") {
  7517. _GO_DEFAULT_ALLOCATOR=$DEFAULT_ALLOCATOR
  7518. }
  7519. otherwise {
  7520. _GO_DEFAULT_ALLOCATOR=FAKE
  7521. }
  7522. # tag:go-specific tag:internal
  7523. ### @usage _GO_BASE_UNIT # internal
  7524. ###
  7525. ### The base module of all golang modules. Defines common properties, dependencies and rules for go build.
  7526. module _GO_BASE_UNIT: _BASE_UNIT {
  7527. .EXTS=.go .gosrc .o .obj .a .symabis .mf
  7528. .CMD=TOUCH_UNIT
  7529. .NODE_TYPE=Bundle
  7530. .GLOBAL=GO_LDFLAGS
  7531. .PEERDIR_POLICY=as_build_from
  7532. .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
  7533. .ALLOWED=GO_PROTO_PLUGIN USE_CXX USE_UTIL RESOURCE_FILES
  7534. .IGNORED=GO_SKIP_TESTS USE_SKIFF
  7535. ENABLE(_GO_MODULE)
  7536. SET(MODULE_TAG GO)
  7537. PEERDIR_TAGS=GO GO_PROTO GO_FBS __EMPTY__
  7538. DEFAULT(_GO_VET_TOOL)
  7539. DEFAULT(_GO_VET_FLAGS)
  7540. DEFAULT(_GO_VET_EXTS)
  7541. DEFAULT(_GO_SONAME)
  7542. NO_RUNTIME()
  7543. SET(COVERAGE_FLAGS)
  7544. SET(EXTRA_OUTPUT)
  7545. SET(MODULE_LANG GO)
  7546. PEERDIR(build/external_resources/go_tools)
  7547. GO_PROTO_OUTS+=${output;hide;norel;nopath;noext;suf=.pb.go:File}
  7548. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  7549. PEERDIR+=$COMPILER_PLATFORM
  7550. }
  7551. when ($CLANG == "yes" || $GCC == "yes") {
  7552. CGO_CFLAGS_VALUE += -w -pthread -fpic
  7553. CGO2_CFLAGS_VALUE += -Wno-unused-variable
  7554. }
  7555. select ($GO_VET) {
  7556. "yes" | "on" ? {
  7557. _GO_VET=yes
  7558. _GO_VET_FLAGS+=-cgocall=false
  7559. }
  7560. "yndexer" ? {
  7561. _GO_VET=yes
  7562. PEERDIR+=build/external_resources/goyndexer
  7563. _GO_VET_TOOL=${GOYNDEXER_RESOURCE_GLOBAL}/goyndexer
  7564. _GO_YDX_FILE=++ydx-file ${_GO_YNDEXER_EXT}
  7565. _GO_VET_FLAGS=-indexer.arc ${ARCADIA_ROOT} -indexer.indexfile ${GO_YNDEXER_OUTPUT} -indexer.loglevel info
  7566. _GO_FMT_ADD_CHECK=no
  7567. _GO_VET_ADD_CHECK=no
  7568. GO_VET_INFO_EXT=.ydx.out
  7569. GO_VET_REPORT_EXT=.ydx.txt
  7570. _GO_VET_EXTS=++vet-info-ext .ydx.out ++vet-report-ext .ydx.txt
  7571. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=__ARCADIA_BUILD_ROOT_PREFIX__ --source-prefix=__ARCADIA_SOURCE_ROOT_PREFIX__
  7572. }
  7573. "yolint" ? {
  7574. _GO_VET=yes
  7575. PEERDIR+=build/external_resources/yolint
  7576. _GO_VET_TOOL=${YOLINT_RESOURCE_GLOBAL}/yolint
  7577. _GO_VET_FLAGS=-migration.config=${input:"${ARCADIA_ROOT}/build/rules/go/migrations.yaml"} -importcheck=false -SA1019=false -copyproto=false -bodyclose=false -rowserrcheck=false -ytcheck=false
  7578. }
  7579. "yolint_next" ? {
  7580. _GO_VET=yes
  7581. PEERDIR+=build/external_resources/yolint
  7582. _GO_VET_TOOL=${YOLINT_NEXT_RESOURCE_GLOBAL}/yolint
  7583. _GO_VET_FLAGS=-copyproto=false
  7584. }
  7585. "local" ? {
  7586. _GO_VET=yes
  7587. _GO_VET_FLAGS=
  7588. }
  7589. default ? {
  7590. _GO_VET=no
  7591. _GO_VET_FLAGS=
  7592. }
  7593. }
  7594. SET(_GO_VET $_GO_VET)
  7595. when ($GO_VET_TOOL == "") {
  7596. _GO_VET_TOOL_REAL=$_GO_VET_TOOL
  7597. }
  7598. otherwise {
  7599. _GO_VET_TOOL_REAL=$GO_VET_TOOL
  7600. }
  7601. when ($GO_VET_FLAGS == "") {
  7602. _GO_VET_FLAGS_REAL=$_GO_VET_FLAGS
  7603. }
  7604. otherwise {
  7605. _GO_VET_FLAGS_REAL=$GO_VET_FLAGS
  7606. }
  7607. when ($_GO_VET == "yes" && $NO_GO_VET != "yes") {
  7608. 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
  7609. }
  7610. otherwise {
  7611. GO_VET_OUTPUT=
  7612. _GO_VET_ADD_CHECK=no
  7613. }
  7614. when ($GO_DEBUG_PATH_RELATIVE == "yes") {
  7615. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=;build=;tools= ++tools-root $(TOOL_ROOT)
  7616. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>;$ARCADIA_BUILD_ROOT=>;$(TOOL_ROOT)=>
  7617. }
  7618. otherwise {
  7619. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=/-S;build=/-B;tools=/-T ++tools-root $(TOOL_ROOT)
  7620. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>/-S;$ARCADIA_BUILD_ROOT=>/-B;$(TOOL_ROOT)=>/-T
  7621. }
  7622. _GO_PROCESS_SRCS()
  7623. when ($CLANG == "yes") {
  7624. _GO_EXTLD=clang
  7625. GO_TOOLCHAIN_ENV += ${env:"CC=clang"}
  7626. }
  7627. otherwise {
  7628. _GO_EXTLD=gcc
  7629. GO_TOOLCHAIN_ENV += ${env:"CC=gcc"}
  7630. }
  7631. when ($OS_DARWIN) {
  7632. PEERDIR+=build/external_resources/go_fake_xcrun
  7633. 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
  7634. CGO2_LDFLAGS_VALUE += $LD_SDK_VERSION -undefined dynamic_lookup -nodefaultlibs -lc
  7635. }
  7636. elsewhen ($OS_LINUX) {
  7637. 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
  7638. CGO2_LDFLAGS_VALUE += -Wl,--unresolved-symbols=ignore-all -nodefaultlibs -lc
  7639. }
  7640. otherwise {
  7641. GO_EXTLD = ++extld $_GO_EXTLD
  7642. }
  7643. when ($RACE == "yes") {
  7644. _GO_COMPILE_FLAGS_RACE=-race
  7645. _GO_LINK_FLAGS_RACE=-race
  7646. }
  7647. otherwise {
  7648. _GO_COMPILE_FLAGS_RACE=
  7649. _GO_LINK_FLAGS_RACE=
  7650. }
  7651. when ($PIC == "yes") {
  7652. _GO_COMPILE_FLAGS_SHARED=-shared
  7653. _GO_ASM_FLAGS_SHARED=-shared
  7654. }
  7655. otherwise {
  7656. _GO_COMPILE_FLAGS_SHARED=
  7657. _GO_ASM_FLAGS_SHARED=
  7658. }
  7659. GO_ASM_FLAGS_VALUE += $_GO_ASM_FLAGS_SHARED
  7660. GO_COMPILE_FLAGS_VALUE += $_GO_COMPILE_FLAGS_RACE $_GO_COMPILE_FLAGS_SHARED
  7661. GO_LINK_FLAGS_VALUE += $_GO_LINK_FLAGS_RACE
  7662. ADDINCL(${GOSTD}/runtime)
  7663. }
  7664. # tag:go-specific
  7665. ### @usage: GO_LIBRARY([name])
  7666. ###
  7667. ### Go library module definition.
  7668. ### Compile Go module as a library suitable for PEERDIR from other Go modules.
  7669. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7670. module GO_LIBRARY: _GO_BASE_UNIT {
  7671. .CMD=GO_LINK_LIB
  7672. .NODE_TYPE=Bundle
  7673. .FINAL_TARGET=no
  7674. .ALIASES=GO_REQUIREMENTS=LIB_REQUIREMENTS
  7675. SET(_GO_TOOL_MODE lib)
  7676. SET(MODULE_TYPE LIBRARY)
  7677. _REQUIRE_EXPLICIT_LICENSE(vendor)
  7678. MODULE_SUFFIX=.a
  7679. }
  7680. # tag:go-specific
  7681. ### @usage: GO_PROGRAM([name])
  7682. ###
  7683. ### Go program module definition.
  7684. ### Compile and link Go module to an executable program.
  7685. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7686. module GO_PROGRAM: _GO_BASE_UNIT {
  7687. .CMD=GO_LINK_EXE
  7688. .NODE_TYPE=Bundle
  7689. .SYMLINK_POLICY=EXE
  7690. .ALLOWED=INDUCED_DEPS
  7691. .FINAL_TARGET=yes
  7692. .ALIASES=GO_REQUIREMENTS=LD_REQUIREMENTS
  7693. SET(_GO_TOOL_MODE exe)
  7694. SET(MODULE_TYPE PROGRAM)
  7695. SET(GO_VET_OUTPUT_INFO)
  7696. ALLOCATOR($_GO_DEFAULT_ALLOCATOR)
  7697. _USE_LINKER()
  7698. ENABLE(COMMON_LINK_SETTINGS)
  7699. when ($MUSL == "yes") {
  7700. PEERDIR += contrib/libs/musl/full
  7701. }
  7702. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7703. MODULE_SUFFIX=.exe
  7704. }
  7705. PEERDIR(${GOSTD}/runtime library/go/core/buildinfo)
  7706. when ($RACE == "yes") {
  7707. PEERDIR += ${GOSTD}/runtime/cgo
  7708. PEERDIR += ${GOSTD}/runtime/race
  7709. }
  7710. when ($MUSL == "yes") {
  7711. GO_WITH_MUSL = ++musl
  7712. }
  7713. }
  7714. # tag:go-specific
  7715. module _GO_DLL_BASE_UNIT: GO_PROGRAM {
  7716. .CMD=GO_LINK_DLL
  7717. .SYMLINK_POLICY=SO
  7718. .ALLOWED=WHOLE_ARCHIVE
  7719. SET(_GO_TOOL_MODE dll)
  7720. SET(MODULE_TYPE DLL)
  7721. GO_PACKAGE_NAME(main)
  7722. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7723. MODULE_SUFFIX=.dll
  7724. }
  7725. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  7726. MODULE_PREFIX=lib
  7727. MODULE_SUFFIX=.dylib$MODULE_VERSION
  7728. }
  7729. otherwise {
  7730. MODULE_PREFIX=lib
  7731. MODULE_SUFFIX=.so$MODULE_VERSION
  7732. }
  7733. when ($OS_DARWIN) {
  7734. _GO_SONAME=-Wl,-install_name,$SONAME
  7735. }
  7736. elsewhen ($OS_LINUX) {
  7737. _GO_SONAME=-Wl,-soname,$SONAME
  7738. }
  7739. when ($MODULE_VERSION) {
  7740. when ($OS_LINUX || $OS_DARWIN) {
  7741. _GO_LINK_EXE_EXT_CMD+= && $LINK_OR_COPY_CMD $TARGET ${output;nopath;noext:SONAME}
  7742. }
  7743. }
  7744. }
  7745. # tag:go-specific
  7746. ### @usage: GO_DLL(name major_ver [minor_ver] [PREFIX prefix])
  7747. ###
  7748. ### Go ishared object module definition.
  7749. ### Compile and link Go module to a shared object.
  7750. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7751. module GO_DLL: _GO_DLL_BASE_UNIT {
  7752. }
  7753. # tag:go-specific tag:test
  7754. ### @usage: GO_BENCH_TIMEOUT(x)
  7755. ###
  7756. ### Sets timeout in seconds for 1 Benchmark in go benchmark suite
  7757. ###
  7758. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  7759. macro GO_BENCH_TIMEOUT(bench_timeout) {
  7760. SET(GO_BENCH_TIMEOUT $bench_timeout)
  7761. }
  7762. # tag:go-specific tag:test
  7763. ### @usage: GO_TEST([name])
  7764. ###
  7765. ### Go test module definition.
  7766. ### Compile and link Go module as a test suitable for running with Arcadia testing support.
  7767. ### All usual testing support macros like DATA, DEPENDS, SIZE, REQUIREMENTS etc. are supported.
  7768. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  7769. module GO_TEST: GO_PROGRAM {
  7770. .CMD=GO_LINK_TEST
  7771. .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
  7772. .ALLOWED=GO_SKIP_TESTS YT_SPEC
  7773. .FINAL_TARGET=no
  7774. SET(_GO_TOOL_MODE test)
  7775. SET(MODULE_TYPE PROGRAM)
  7776. ENABLE(GO_TEST_MODULE)
  7777. SET(GO_COVER_INFO_VALUE)
  7778. # We have to add uncoditionaly PEERDIR to ${GOSTD}/os here thouth it is really
  7779. # needed when TestMain is defined in the source code of the test
  7780. PEERDIR(${GOSTD}/os)
  7781. PEERDIR(${GOSTD}/testing/internal/testdeps)
  7782. PEERDIR(${GOSTD}/testing)
  7783. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.test)
  7784. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.bench)
  7785. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  7786. }
  7787. # tag:go-specific
  7788. macro GO_MOCKGEN_FROM(Path) {
  7789. SET(MOCKGEN_FROM ${Path})
  7790. }
  7791. # tag:go-specific
  7792. macro GO_MOCKGEN_TYPES(First, Rest...) {
  7793. SET(MOCKGEN_FIRST $First)
  7794. SET(MOCKGEN_REST $Rest)
  7795. }
  7796. # tag:go-specific
  7797. macro GO_MOCKGEN_REFLECT() {
  7798. PEERDIR(${GOSTD}/encoding/gob)
  7799. PEERDIR(${GOSTD}/flag)
  7800. PEERDIR(${GOSTD}/fmt)
  7801. PEERDIR(${GOSTD}/os)
  7802. PEERDIR(${GOSTD}/path)
  7803. PEERDIR(${GOSTD}/reflect)
  7804. PEERDIR(vendor/github.com/golang/mock/mockgen/model)
  7805. PEERDIR(${MOCKGEN_FROM})
  7806. RUN_PROGRAM(vendor/github.com/golang/mock/mockgen -prog_only a.yandex-team.ru/${MOCKGEN_FROM} $MOCKGEN_FIRST${pre=$__COMMA__:MOCKGEN_REST} STDOUT main.go)
  7807. }
  7808. # tag:go-specific
  7809. macro GO_MOCKGEN_MOCKS() {
  7810. PEERDIR(${GOSTD}/reflect)
  7811. PEERDIR(vendor/github.com/golang/mock/gomock)
  7812. RUN_PROGRAM(vendor/github.com/golang/mock/mockgen -package mocks -exec_only ${BINDIR}/gen/gen a.yandex-team.ru/${MOCKGEN_FROM} $MOCKGEN_FIRST${pre=$__COMMA__:MOCKGEN_REST} TOOL ${MODDIR}/gen STDOUT mocks.go)
  7813. }
  7814. # tag:java-specific
  7815. JAVA_IGNORE_CLASSPATH_CLASH_VALUE=
  7816. ### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
  7817. ### Ignore classpath clash test fails for classes
  7818. macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
  7819. SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args)
  7820. }
  7821. # tag:python-specific
  7822. ### @usage: PY_SRCS({| CYTHON_C} { | TOP_LEVEL | NAMESPACE ns} Files...)
  7823. ###
  7824. ### Build specified Python sources according to Arcadia binary Python build. Basically creates precompiled and source resources keyed with module paths.
  7825. ### The resources eventually are linked into final program and can be accessed as regular Python modules.
  7826. ### This custom loader linked into the program will add them to sys.meta_path.
  7827. ###
  7828. ### 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.
  7829. ### .pyx and .swg lead to C/C++ Python extensions generation, that are automatically registered in Python as built-in modules.
  7830. ###
  7831. ### 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).
  7832. ###
  7833. ### __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.
  7834. ###
  7835. ### @example
  7836. ###
  7837. ### PY2_LIBRARY(mymodule)
  7838. ### 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)
  7839. ### END()
  7840. ###
  7841. ### PY_SRCS honors Python2 and Python3 differences and adjusts itself to Python version of a current module.
  7842. ### PY_SRCS can be used in any Arcadia Python build modules like PY*_LIBRARY, PY*_PROGRAM, PY*TEST.
  7843. ### PY_SRCS in LIBRARY or PROGRAM effectively converts these into PY2_LIBRARY and PY2_PROGRAM respectively.
  7844. ### 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.
  7845. ###
  7846. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs/#modulipylibrarypy3libraryimakrospysrcs
  7847. macro PY_SRCS() {
  7848. DEFAULT(MODULE_TAG PY2)
  7849. DEFAULT(PYTHON2 yes)
  7850. DEFAULT(PYTHON3 no)
  7851. }
  7852. # tag:python-specific
  7853. _ALL_PY_FILES=
  7854. # tag:python-specific
  7855. macro _ALL_PY_SRCS2(TOP_LEVEL?"TOP_LEVEL":"", RECURSIVE?"/**":"", NAMESPACE[], REST[]) {
  7856. _GLOB(_ALL_PY_FILES ${suf=${RECURSIVE}/*.py:REST} ${suf=${RECURSIVE}/ya.make:REST} EXCLUDE ya.make)
  7857. PY_SRCS(_MR ${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} $_ALL_PY_FILES)
  7858. }
  7859. # tag:python-specific
  7860. ### @usage: ALL_PY_SRCS([RECURSIVE] { | TOP_LEVEL | NAMESPACE ns} [Dirs...])
  7861. ###
  7862. ### Puts all .py-files from given Dirs (relative to projects') into PY_SRCS of the current module.
  7863. ### If Dirs is ommitted project directory is used
  7864. ###
  7865. ### `RECURSIVE` makes lookup recursive with resprect to Dirs
  7866. ### `TOP_LEVEL` and `NAMESPACE` are forwarded to `PY_SRCS`
  7867. ###
  7868. ### Note: Only one such macro per module is allowed
  7869. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  7870. ###
  7871. ### @see [PY_SRCS()](#macro_PY_SRCS)
  7872. macro ALL_PY_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", Files...) {
  7873. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files})
  7874. }
  7875. # tag:python-specific
  7876. _PY_EXTRA_LINT_FILES_VALUE=
  7877. ### @usage: PY_EXTRA_LINT_FILES(files...)
  7878. ###
  7879. ### Add extra Python files for linting. This macro allows adding
  7880. ### Python files which has no .py extension.
  7881. macro PY_EXTRA_LINT_FILES(FILES...) {
  7882. SET_APPEND(_PY_EXTRA_LINT_FILES_VALUE $FILES)
  7883. }
  7884. # tag:python-specific
  7885. ### @usage: PY23_LIBRARY([name])
  7886. ###
  7887. ### Build PY2_LIBRARY or PY3_LIBRARY depending on incoming PEERDIR.
  7888. ### Direct build or build by RECURSE creates both variants.
  7889. ### This multimodule doesn't define any final targets, so use from DEPENDS or BUNDLE is not allowed.
  7890. ###
  7891. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs
  7892. multimodule PY23_LIBRARY {
  7893. module PY2: PY2_LIBRARY {
  7894. OBJ_SUF=.py2
  7895. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  7896. }
  7897. module PY3: PY3_LIBRARY {
  7898. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  7899. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7900. MODULE_PREFIX=py3
  7901. }
  7902. otherwise {
  7903. MODULE_PREFIX=libpy3
  7904. }
  7905. OBJ_SUF=.py3
  7906. }
  7907. }
  7908. # tag:python-specific
  7909. ### @usage: PY23_NATIVE_LIBRARY([name])
  7910. ###
  7911. ### Build LIBRARY compatible with either Python 2.x or Python 3.x depending on incoming PEERDIR.
  7912. ###
  7913. ### 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.
  7914. ### Use these multimodule instead of PY23_LIBRARY if the C++ extension defined in it will be used in PY2MODULE.
  7915. ### 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.
  7916. ### Proper version will be selected according to Python version of the module PEERDIR comes from.
  7917. ###
  7918. ### This mulrtimodule doesn't define any final targets so cannot be used from DEPENDS or BUNDLE macros.
  7919. ###
  7920. ### For more information read https://wiki.yandex-team.ru/arcadia/python/pysrcs/#pysrcssrcsipy23nativelibrary
  7921. ###
  7922. ### @see [LIBRARY()](#module_LIBRARY), [PY2MODULE()](#module_PY2MODULE)
  7923. multimodule PY23_NATIVE_LIBRARY {
  7924. module PY2: LIBRARY {
  7925. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 PYTHON3_ADDINCL
  7926. OBJ_SUF=.py2
  7927. PYTHON2_ADDINCL()
  7928. SET(MODULE_LANG PY2)
  7929. }
  7930. module PY3: LIBRARY {
  7931. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3
  7932. .ALIASES=PYTHON2_ADDINCL=PYTHON3_ADDINCL
  7933. PYTHON3_ADDINCL()
  7934. SET(MODULE_LANG PY3)
  7935. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7936. MODULE_PREFIX=py3c
  7937. }
  7938. otherwise {
  7939. MODULE_PREFIX=libpy3c
  7940. }
  7941. OBJ_SUF=.py3
  7942. }
  7943. }
  7944. IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  7945. # tag:src-processing
  7946. STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
  7947. macro _SRC("storyboard", SRC, SRCFLAGS...) {
  7948. .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}
  7949. }
  7950. # tag:src-processing
  7951. macro _SRC("xib", SRC, SRCFLAGS...) {
  7952. .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}
  7953. }
  7954. ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  7955. # tag:ios-specific
  7956. ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
  7957. macro _IOS_ASSETS(AssetsDir, Content...) {
  7958. .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
  7959. }
  7960. # tag:ios-specific
  7961. macro IOS_APP_COMMON_FLAGS(Flags...) {
  7962. SET_APPEND(STORYBOARD_FLAGS $Flags)
  7963. SET_APPEND(ASSETS_FLAGS $Flags)
  7964. }
  7965. # tag:ios-specific
  7966. macro IOS_APP_ASSETS_FLAGS(Flags...) {
  7967. SET_APPEND(ASSETS_FLAGS $Flags)
  7968. }
  7969. macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
  7970. .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
  7971. }
  7972. macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
  7973. .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
  7974. }
  7975. # tag:ios-specific
  7976. DELIM=__DELIM__
  7977. 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
  7978. ### @usage: IOS_INTERFACE()
  7979. ### iOS GUI module definition
  7980. module IOS_INTERFACE: _BARE_UNIT {
  7981. .CMD=PACK_IOS_ARCHIVE
  7982. .EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
  7983. .NODE_TYPE=Library
  7984. .FINAL_TARGET=no
  7985. SET(MODULE_SUFFIX .ios.interface)
  7986. PEERDIR+=build/platform/xcode/tools
  7987. }
  7988. # tag:ios-specific
  7989. module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
  7990. SET(MODULE_SUFFIX .default.ios.interface)
  7991. }
  7992. DEFAULT_IOS_TYPE=
  7993. IOS_TYPE=
  7994. when(!$IOS_TYPE) {
  7995. when($DEFAULT_IOS_TYPE) {
  7996. IOS_TYPE=$DEFAULT_IOS_TYPE
  7997. }
  7998. otherwise {
  7999. IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
  8000. }
  8001. }
  8002. DEFAULT_IOS_RUNTIME=
  8003. IOS_RUNTIME=
  8004. when(!$IOS_RUNTIME) {
  8005. when($DEFAULT_IOS_RUNTIME) {
  8006. IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
  8007. }
  8008. otherwise {
  8009. IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
  8010. }
  8011. }
  8012. when ($ARCH_I386) {
  8013. TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
  8014. TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
  8015. }
  8016. otherwise {
  8017. TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
  8018. TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
  8019. }
  8020. # tag:java-specific
  8021. ### @usage: MODULE_JDK(Version)
  8022. ###
  8023. ### Specify JDK version for module
  8024. macro JDK_VERSION(Arg) {
  8025. SET(JDK_REAL_VERSION $Arg)
  8026. _JDK_VERSION_MACRO_CHECK($Arg)
  8027. }
  8028. # tag:java-specific
  8029. when ($JDK_REAL_VERSION == "10") {
  8030. JDK10=yes # remove this later
  8031. }
  8032. JAVA_PROGRAM_CP_USE_COMMAND_FILE=yes
  8033. when ($JDK_REAL_VERSION == "8") {
  8034. JAVA_PROGRAM_CP_USE_COMMAND_FILE=no
  8035. }
  8036. # tag:kotlin-specific
  8037. KOTLIN_JVM_TARGET=
  8038. when ($JDK_REAL_VERSION == "8") {
  8039. KOTLIN_JVM_TARGET=1.8
  8040. }
  8041. elsewhen ($JDK_REAL_VERSION == "18") {
  8042. # remove when kotlin starts supporting jdk18 bytecode
  8043. # see also devtools/ya/jbuild/gen/actions/idea.py
  8044. KOTLIN_JVM_TARGET=17
  8045. }
  8046. otherwise {
  8047. KOTLIN_JVM_TARGET=$JDK_REAL_VERSION
  8048. }
  8049. # tag:frontend-specific
  8050. ### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
  8051. ###
  8052. ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
  8053. macro COLLECT_FRONTEND_FILES(Varname, Dir) {
  8054. _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
  8055. }
  8056. # tag:java-specific
  8057. # local jdk and tools
  8058. USE_SYSTEM_JDK=
  8059. USE_SYSTEM_UBERJAR=
  8060. USE_SYSTEM_ERROR_PRONE=
  8061. # tag:swift-specific
  8062. CPP_XCODE_TOOLCHAIN_VERSION=9.2
  8063. SWIFT_XCODE_TOOLCHAIN_VERSION=9.2
  8064. XCODE_TOOLS_VERSION=10.1
  8065. macro COMPILE_SWIFT_MODULE(SRCS{input}[], BRIDGE_HEADER{input}="", Flags...) {
  8066. when ($BRIDGE_HEADER != "") {
  8067. SWIFT_BRIDGE_HEADER=-import-objc-header ${input:BRIDGE_HEADER}
  8068. }
  8069. otherwise {
  8070. SWIFT_BRIDGE_HEADER=
  8071. }
  8072. .PEERDIR+=build/platform/xcode/swift
  8073. # swift core libraries
  8074. LDFLAGS($SWIFT_LD_FLAGS)
  8075. .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}
  8076. }
  8077. TEST_TOOL_HOST_LOCAL=
  8078. TEST_TOOL_TARGET_LOCAL=
  8079. when ($TENSORFLOW_WITH_CUDA) {
  8080. CUDA_REQUIRED=yes
  8081. }
  8082. when (!$TENSORRT_VERSION) {
  8083. TENSORRT_VERSION=5
  8084. }
  8085. ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
  8086. MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin
  8087. when ($QT_REQUIRED) {
  8088. QT_BIN=${HOST_QT_RESOURCE_GLOBAL}/bin
  8089. }
  8090. when ($OPENGL_REQUIRED) {
  8091. OPENGL_VERSION=18.0.5
  8092. }
  8093. # tag:python-specific
  8094. multimodule PY23_TEST {
  8095. module PY2 : PYTEST_BIN {
  8096. MODULE_PREFIX=py2_
  8097. OBJ_SUF=.py2
  8098. CANONIZE_SUB_PATH=py2test
  8099. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8100. }
  8101. module PY3TEST_PROGRAM: PY3TEST_BIN {
  8102. .FINAL_TARGET=yes
  8103. OBJ_SUF=.py3
  8104. CANONIZE_SUB_PATH=py3test
  8105. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8106. }
  8107. module PY3TEST_LIBRARY: _PY3_LIBRARY {
  8108. PEERDIR+=library/python/pytest
  8109. _REQUIRE_EXPLICIT_LICENSE()
  8110. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  8111. }
  8112. }
  8113. # tag:windows-specific
  8114. WINDOWS_MANIFEST=
  8115. macro WINDOWS_MANIFEST(Manifest) {
  8116. SET(WINDOWS_MANIFEST $Manifest)
  8117. }
  8118. # tag:windows-specific
  8119. when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
  8120. LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
  8121. }
  8122. # tag:cpp-specific
  8123. _VISIBILITY_LEVEL=
  8124. ### @usage: VISIBILITY(level)
  8125. ###
  8126. ### This macro sets visibility level for symbols compiled for the current module. 'level'
  8127. ### may take only one of the following values: DEFAULT, HIDDEN.
  8128. macro VISIBILITY(LEVEL) {
  8129. SET(_VISIBILITY_LEVEL ${LEVEL})
  8130. select ($LEVEL) {
  8131. "DEFAULT" | "HIDDEN" ? {
  8132. }
  8133. default ? {
  8134. _OK = no
  8135. }
  8136. }
  8137. ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
  8138. }
  8139. # tag:cpp-specific
  8140. _CFLAGS_VISIBILITY=
  8141. when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
  8142. when ($CLANG == "yes" || $GCC == "yes") {
  8143. _CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
  8144. }
  8145. }
  8146. CFLAGS+=$_CFLAGS_VISIBILITY
  8147. # tag:cpp-specific
  8148. macro SDBUS_CPP_ADAPTOR(File) {
  8149. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
  8150. .PEERDIR=contrib/libs/sdbus-cpp
  8151. }
  8152. # tag:cpp-specific
  8153. macro SDBUS_CPP_PROXY(File) {
  8154. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
  8155. .PEERDIR=contrib/libs/sdbus-cpp
  8156. }
  8157. # tag:python-specific
  8158. macro _PY_SSQLS_SRC(EXT, SRC, SRCFLAGS...) {
  8159. #generic macro
  8160. }
  8161. # tag:python-specific
  8162. macro _PY_SSQLS_SRC("ssqls", SRC, SRCFLAGS...) {
  8163. .CMD=${tool:"metrika/core/tools/ssqls"} ${input;notransformbuilddir:SRC} -S $ARCADIA_ROOT -B $ARCADIA_BUILD_ROOT -L "python" -D $MODDIR $SRCFLAGS ${output;tobindir;noext;hide;pre=autogenerated/$MODDIR/:SRC.py}
  8164. }
  8165. # tag:python-specific
  8166. macro _PY_SSQLS_SRCS(Srcs...) {
  8167. foreach(Src: $Srcs) {
  8168. _PY_SSQLS_SRC(${lastext:Src} $Src)
  8169. }
  8170. }
  8171. # tag:python-specific
  8172. macro PY_SSQLS_SRCS(Srcs...) {
  8173. _PY_SSQLS_SRCS(KEEP_DIR_STRUCT $Srcs)
  8174. PY_SRCS(${noext;pre=autogenerated/$MODDIR/:Srcs.py})
  8175. }
  8176. # tag:python-specific
  8177. macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
  8178. .CMD=$ENUM_PARSER_TOOL ${input:File} --output ${output;chksum;noext;suf=.generated.h:File} --json-output ${output;noext:File.json} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  8179. }
  8180. # tag:python-specific
  8181. macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
  8182. .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"}
  8183. }
  8184. # tag:metrika
  8185. multimodule SSQLS_LIBRARY {
  8186. module CPP_SSQLS : LIBRARY {
  8187. .ALIASES=ENUMS_SERIALIZATION=CPP_ENUMS_SERIALIZATION
  8188. SET(PEERDIR_TAGS CPP_SSQLS)
  8189. PEERDIR(metrika/core/libs/appmetrica/types metrika/core/libs/types)
  8190. ADDINCL(GLOBAL ${ARCADIA_BUILD_ROOT}/metrika/core/common_tables/include)
  8191. }
  8192. module PY3_SSQLS : PY3_LIBRARY {
  8193. .ALIASES=SRCS=PY_SSQLS_SRCS ENUMS_SERIALIZATION=PY_ENUMS_SERIALIZATION
  8194. SET(PEERDIR_TAGS PY3 PY3_SSQLS)
  8195. }
  8196. }
  8197. macro NGINX_MODULES(Modules...) {
  8198. PEERDIR(${Modules})
  8199. 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)
  8200. }
  8201. # Experimental: container as output. https://st.yandex-team.ru/DTCC-179
  8202. # tag:external-build
  8203. CONTAINER_LAYER_CMD=$YMAKE_PYTHON ${input:"devtools/experimental/solar/selfcontainer/scripts/make_container_layer.py"} -o $TARGET $AUTO_INPUT ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CL"} ${kv;hide:"pc blue"}
  8204. CONTAINER_CMD=$YMAKE_PYTHON ${input:"devtools/experimental/solar/selfcontainer/scripts/make_container.py"} -o $TARGET ${rootrel:PEERS} ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CN"} ${kv;hide:"pc blue"}
  8205. # tag:external-build
  8206. module CONTAINER_LAYER: _BARE_UNIT {
  8207. .CMD=CONTAINER_LAYER_CMD
  8208. MODULE_SUFFIX=.container_layer
  8209. }
  8210. # tag:external-build
  8211. module CONTAINER: _BARE_UNIT {
  8212. .NODE_TYPE=Bundle
  8213. .PEERDIR_POLICY=as_build_from
  8214. .FINAL_TARGET=yes
  8215. .CMD=CONTAINER_CMD
  8216. }
  8217. # tag:external-build
  8218. CUSTOM_BUILD_LIBRARY_USE=
  8219. 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
  8220. # tag:external-build
  8221. module CUSTOM_BUILD_LIBRARY: LIBRARY {
  8222. .NODE_TYPE=Bundle
  8223. .PEERDIR_POLICY=as_build_from
  8224. .PROXY=yes
  8225. .CMD=CUSTOM_BUILD_LIBRARY_CMD
  8226. DISABLE(NEED_ADD_FAKE_SRC)
  8227. }
  8228. ### @usage: ORIGINAL_SOURCE(Source)
  8229. ###
  8230. ### This macro specifies the source repository for contrib
  8231. ### Does nothing now (just a placeholder for future functionality)
  8232. ### See https://st.yandex-team.ru/DTCC-316
  8233. macro ORIGINAL_SOURCE(Source) {
  8234. ENABLE(UNUSED_MACRO)
  8235. }
  8236. CMAKE_PACKAGE=
  8237. CMAKE_PACKAGE_COMPONENT=
  8238. CMAKE_PACKAGE_TARGET=
  8239. CONAN_REFERENCE=
  8240. CONAN_PKG_OPTS=
  8241. ### @usage: OPENSOURCE_EXPORT_REPLACEMENT(CMAKE PkgName CMAKE_TARGET PkgName::PkgTarget CONAN ConanRef CMAKE_COMPONENT OptCmakePkgComponent)
  8242. ###
  8243. ### Use specified conan/system pacakcge when exporting cmake build scripts for arcadia C++ project
  8244. ### for opensource publication.
  8245. macro OPENSOURCE_EXPORT_REPLACEMENT(CMAKE[], CMAKE_TARGET[], CMAKE_COMPONENET[], CONAN[], CONAN_OPTIONS[]) {
  8246. SET(CMAKE_PACKAGE $CMAKE)
  8247. SET(CMAKE_PACKAGE_COMPONENT $CMAKE_COMPONENET)
  8248. SET(CMAKE_LINK_TARGET $CMAKE_TARGET)
  8249. SET(CONAN_REFERENCE $CONAN)
  8250. SET(CONAN_PKG_OPTS $CONAN_OPTIONS)
  8251. }
  8252. # tag:licence
  8253. CREDITS_FILE_EXTRA_EXT=
  8254. CREDITS_FLAGS=
  8255. CREDITS_TEXTS_FILE=
  8256. NO_CREDITS_TEXTS_FILE=
  8257. WITH_CREDITS=
  8258. ### @usage: LICENSE_TEXTS(File)
  8259. ###
  8260. ### This macro specifies the filename with all library licenses texts
  8261. macro LICENSE_TEXTS(Source) {
  8262. SET(CREDITS_TEXTS_FILE $Source)
  8263. }
  8264. # tag:licence
  8265. ### @usage: WITHOUT_LICENSE_TEXTS()
  8266. ###
  8267. ### This macro indicates that the module has no license text
  8268. macro WITHOUT_LICENSE_TEXTS() {
  8269. ENABLE(NO_CREDITS_TEXTS_FILE)
  8270. }
  8271. # tag:licence
  8272. when ($WITH_CREDITS) {
  8273. CREDITS_FLAGS+=--credits-output ${output;suf=${CREDITS_FILE_EXTRA_EXT}".CREDITS.txt":REALPRJNAME}
  8274. }
  8275. GENERATE_MF=
  8276. when ($WITH_CREDITS) {
  8277. GENERATE_MF=$GENERATE_MF_CMD
  8278. }
  8279. macro _MCU_CONVERT(Bin) {
  8280. .CMD=${cwd:BINDIR} $OBJCOPY_TOOL -O ihex $Bin ${output;noext:Bin.hex} && ${cwd:BINDIR} $OBJCOPY_TOOL -O srec $Bin ${output;noext:Bin.s37}
  8281. }
  8282. MCU_LINK_EXE=$LINK_EXE && $_MCU_CONVERT($MODULE_PREFIX$REALPRJNAME)
  8283. ### @usage: MCU_PROGRAM([progname])
  8284. ###
  8285. ### Program module for microcontrollers. Converts binary to Intel HEX and Motorola S-record file formats.
  8286. ### If name is not specified it will be generated from the name of the containing project directory.
  8287. module MCU_PROGRAM: PROGRAM {
  8288. .CMD=MCU_LINK_EXE
  8289. }
  8290. # tag:deprecated
  8291. ### @usage: METAQUERYFILES(filenames...) #deprecated
  8292. ###
  8293. ### This macro does nothing and will be removed
  8294. macro METAQUERYFILES(Files...) {
  8295. ENABLE(UNUSED_MACRO)
  8296. }
  8297. # tag:flags tag:internal tag:windows-specific
  8298. ### @usage: _MSVC_FLAGS_WINDOWS_IMPL(target_platform compiler_flags) # internal
  8299. ###
  8300. ### Add CFLAGS when the firts argument is WINDOWS
  8301. macro _MSVC_FLAGS_WINDOWS_IMPL(WINDOWS[], FLAGS...) {
  8302. CFLAGS($WINDOWS)
  8303. }
  8304. # tag:flags tag:windows-specific tag:cpp-specific
  8305. ### @usage: MSVC_FLAGS([GLOBAL compiler_flag]* compiler_flags)
  8306. ###
  8307. ### Add the specified flags to the compilation line of C/C++files.
  8308. ### Flags apply only if the compiler used is MSVC (cl.exe)
  8309. macro MSVC_FLAGS(FLAGS...) {
  8310. _MSVC_FLAGS_WINDOWS_IMPL($TARGET_PLATFORM $FLAGS)
  8311. }
  8312. ### @usage: COLLECT_YDB_API_SPECS_LEGACY(VarName Paths...) #deprecated
  8313. ###
  8314. ### This macro is ugly hack for legacy YDB go API codegen, any other uses are prohibited
  8315. macro COLLECT_YDB_API_SPECS_LEGACY(FILES_VAR, PATHS...) {
  8316. _GLOB($FILES_VAR ${suf=/*.proto:PATHS})
  8317. RESTRICT_PATH(kikimr/public/sdk/go/ydb/api MSG This is ugly hack for legacy YDB go API codegen, any other uses are probibited)
  8318. }