ymake.core.conf 411 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562
  1. # !!! DISCLAIMER! PLEASE DON'T IGNORE !!!
  2. # The FAKEID value is huge hammer. It affects UIDs of all nodes in build graph including, but not limited to
  3. # any resource fetch (think java contrib), build on any language (C++, Python, Java, Go), any code generation.
  4. # Any build after this change will pay the price:
  5. # - Local builds and Sandbox builds will reload all resources from Sandbox and cached data from YT (if ready).
  6. # - Distributed (YT) cache warmup will take significant time to catch up and will need to recache everything.
  7. # - Autocheck will rebuild and recache everything.
  8. # Use this with extreme care and only change if it is ultimately needed. Consider more specific XXX_FAKEIDs below instead.
  9. FAKEID=31415926535
  10. SANDBOX_FAKEID=${FAKEID}.7600000
  11. CPP_FAKEID=2023-06-06
  12. GO_FAKEID=11100371
  13. ANDROID_FAKEID=2023-05-17
  14. CLANG_TIDY_FAKEID=2023-06-06
  15. CYTHON_FAKE_ID=10784829
  16. JAVA_FAKEID=10849009
  17. # Change of this value will invalidate some parts of configure cache
  18. # but will not affect builds anyhow (except tests referring build/ directory)
  19. JSON_CACHE_FAKE_ID=11215402
  20. REPORT_ALL_DUPSRC=yes
  21. CURDIR=.
  22. MODDIR=.
  23. BINDIR=bin:/
  24. SRCDIR=
  25. YMAKE=ymake
  26. ECHO=echo
  27. INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i .ipp .ixx .ya_exposed
  28. CPP_EXT=.cpp
  29. OBJ_SUF=
  30. CFLAGS=
  31. EXTRA_C_FLAGS=
  32. SFLAGS=
  33. FORCE_COVERAGE_ENABLED=
  34. FORCE_COVERAGE_DISABLED=
  35. AUTOCHECK_BALANCING_OPTIONS=
  36. SO_OUTPUTS=no
  37. @import "${CONF_ROOT}/conf/settings.conf"
  38. @import "${CONF_ROOT}/conf/opensource.conf"
  39. @import "${CONF_ROOT}/conf/rules.conf"
  40. @import "${CONF_ROOT}/conf/sysincl.conf"
  41. @import "${CONF_ROOT}/conf/license.conf"
  42. @import "${CONF_ROOT}/conf/ts/ts.conf"
  43. @import "${CONF_ROOT}/conf/docs.conf"
  44. @import "${CONF_ROOT}/conf/java.conf"
  45. @import "${CONF_ROOT}/conf/project_specific/other.conf"
  46. @import "${CONF_ROOT}/conf/project_specific/uservices.conf"
  47. @import "${CONF_ROOT}/conf/project_specific/yt.conf"
  48. USE_GLOBAL_CMD=no
  49. when ($OS_WINDOWS != "yes") {
  50. USE_GLOBAL_CMD=yes
  51. }
  52. when ($USE_PYTHON) {
  53. C_DEFINES+= -DUSE_PYTHON
  54. }
  55. __COMMA__=${comma:""}
  56. ARCADIA_TEST_ROOT=../arcadia_tests_data/
  57. DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32
  58. FAIL_PY2=no
  59. _PREBUILT_TOOLS_ROOT=build/prebuilt
  60. _TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
  61. _TOOL_PROTOC_GEN_GO_V2=vendor/google.golang.org/protobuf/cmd/protoc-gen-go
  62. _TOOL_PROTOC_GEN_GO_GRPC_V2=vendor/google.golang.org/grpc/cmd/protoc-gen-go-grpc
  63. _TOOL_RESCOMPILER=tools/rescompiler
  64. _TOOL_RESCOMPRESSOR=tools/rescompressor
  65. _TOOL_RORESCOMPILER=tools/rorescompiler
  66. when ($DISABLE_SEPARATE_AUX_CPP != "yes") {
  67. SEPARATE_AUX_CPP=yes
  68. }
  69. when ($HOST_ARCH_X86_64 == "yes") {
  70. when ($HOST_OS_DARWIN == "yes" || $HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes") {
  71. VALID_HOST_PLATFORM_FOR_COMMON_PREBUILT_TOOLS=yes
  72. when ($USE_PREBUILT_TOOLS == "yes" && $ARCH_X86_64 == "yes") {
  73. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  74. }
  75. }
  76. }
  77. FAIL_MODULE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
  78. DEFAULT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  79. PROJECT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  80. TIDY=
  81. TIDY_ENABLED=
  82. when($TIDY == "yes") {
  83. TIDY_ENABLED=yes
  84. }
  85. when ($TIDY_ENABLED == "yes") {
  86. when ($TIDY_EXPORT_FIXES=="") {
  87. TIDY_EXPORT_FIXES="no"
  88. }
  89. CLANG_TIDY_ARGS=${hide:CLANG_TIDY_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/clang_tidy.py"} "--ymake-python" $YMAKE_PYTHON "--clang-tidy-bin" "$(CLANG_TIDY_BIN)/bin/clang-tidy" "--config-validation-script" ${input:"build/tests/config/clang_tidy/tidy_config_validation.py"} "--testing-src" ${input:SRC} "--source-root" $(SOURCE_ROOT) "--build-root" $(BUILD_ROOT) "--tidy-json" ${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJ_CROSS_SUF}.tidyjson:SRC} "--export-fixes" $TIDY_EXPORT_FIXES
  90. CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
  91. CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
  92. when ($TIDY_CHECKS) {
  93. CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
  94. }
  95. when ($TIDY_HEADER_FILTER) {
  96. CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
  97. }
  98. TIDY_VALUE=USE_CONDITIONAL_SRCS
  99. }
  100. otherwise {
  101. CLANG_TIDY_ARGS=
  102. TIDY_VALUE=
  103. }
  104. # tag:codenav
  105. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  106. PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
  107. YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
  108. YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.ydx.pb2:SRC}
  109. }
  110. otherwise {
  111. PY_PROGRAM_LINK_EXE=$LINK_EXE
  112. YNDEXER_ARGS=
  113. YNDEXER_OUTPUT=
  114. }
  115. when ($RETRY == "yes") {
  116. RETRY_ARGS=$YMAKE_PYTHON ${input:"build/scripts/wrapcc.py"}
  117. }
  118. otherwise {
  119. RETRY_ARGS=
  120. }
  121. COVERAGE_FLAGS=
  122. EXTRA_OUTPUT=
  123. when ($CLANG == "yes" || $GCC == "yes") {
  124. when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
  125. COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
  126. EXTRA_OUTPUT=${output;noauto;hide;suf=${COMPILE_OUT_SUFFIX}${_CROSS_SUFFIX}.gcno:SRC}
  127. }
  128. }
  129. when ($OS_CYGWIN == "yes") {
  130. CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
  131. USE_ASMLIB=no
  132. FSTACK=
  133. }
  134. CFLAGS+=$COVERAGE_FLAGS
  135. LDFLAGS+=$COVERAGE_FLAGS
  136. CHECKFLAG=
  137. NO_MAPREDUCE=
  138. when ($NO_MAPREDUCE == "yes") {
  139. C_DEFINES+=-DNO_MAPREDUCE
  140. }
  141. when ($OS_ANDROID == "yes") {
  142. PIE=yes
  143. }
  144. # TODO: extract to conf/maps/maps.conf
  145. when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
  146. USE_STL_SYSTEM=yes
  147. ARCADIA_CURL_DNS_RESOLVER=MULTITHREADED
  148. }
  149. when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_IOS == "yes") {
  150. BUILD_IOS_APP=yes
  151. when ($ARCH_ARM7 || $ARCH_ARM64) {
  152. BOOSTTEST_IS_FAT_OBJECT=yes
  153. }
  154. }
  155. when ($CLANG && $OS_DARWIN && $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  156. SO_OUTPUTS=yes
  157. }
  158. when ($OS_NONE == "yes") {
  159. USE_STL_SYSTEM=yes
  160. }
  161. # USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
  162. # select system standard C++ library when USE_INTERNAL_STL=no is set.
  163. #
  164. # USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
  165. #
  166. when ($USE_STL_SYSTEM == "yes") {
  167. USE_INTERNAL_STL=no
  168. }
  169. when ($USE_INTERNAL_STL == "no") {
  170. USE_STL_SYSTEM=yes
  171. }
  172. otherwise {
  173. USE_INTERNAL_STL=yes
  174. # TODO: Extract to conf/sysincl.conf
  175. # This trigger doesn't work for module level since SYSINCL is processed at
  176. # configuration stage (This means that NO_RUNTIME() macro called in ya.make
  177. # won't affect SYSINCL and the only way to make this trigger work correctly
  178. # is to define configuration variable NORUNTIME (-DNORUNTIME) on the command
  179. # line when `ya make ...` is invoked.
  180. when ($NORUNTIME != "yes") {
  181. SYSINCL+=build/sysincl/stl-to-libcxx.yml
  182. when ($MUSL == "yes") {
  183. SYSINCL+=build/sysincl/libc-musl-libcxx.yml
  184. }
  185. }
  186. }
  187. # tag:linux-specific
  188. when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") {
  189. USE_UBUNTU_COMPATIBILITY=yes
  190. }
  191. USE_ARCADIA_PYTHON=yes
  192. USE_ARCADIA_LIBM=no
  193. USE_EAT_MY_DATA=no
  194. HAVE_MKL=
  195. when ($HAVE_MKL == "") {
  196. when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
  197. HAVE_MKL=yes
  198. }
  199. otherwise {
  200. HAVE_MKL=no
  201. }
  202. }
  203. SFDL_TMP_OUT= ${output;tmp:SRC.tmp}
  204. # tag:perl-specific
  205. when ($USE_LOCAL_TOOLS == "yes") {
  206. PERL=$LOCAL_PERL
  207. PERL_VERSION=$LOCAL_PERL_VERSION
  208. PERL_PRIVLIB=$LOCAL_PERL_PRIVLIB
  209. PERL_ARCHLIB=$LOCAL_PERL_ARCHLIB
  210. when ($LOCAL_PERL_LIBS) {
  211. PERL_LIBS=$LOCAL_PERL_LIBS
  212. }
  213. }
  214. otherwise {
  215. PERL=NO-PERL-SELECTED
  216. PERL_VERSION=NO-PERL-SELECTED-VERSION
  217. PERL_PRIVLIB=NO-PERL-SELECTED-PRIVLIB
  218. PERL_ARCHLIB=NO-PERL-SELECTED-ARCHLIB
  219. }
  220. # tag:perl-specific
  221. PERL_LD_LIBRARY_PATH=
  222. PERL_INCLUDE=
  223. USE_PERL_SYSTEM=yes
  224. when ($USE_PERL_SYSTEM == "yes") {
  225. select ($PERL_SDK) {
  226. "ubuntu-12" ? {
  227. PERL_VERSION=5.14
  228. PERL_ROOT=${SYSTEM_PERL_514_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  229. PERL_LIB_ARCH=
  230. }
  231. "ubuntu-14" ? {
  232. PERL_VERSION=5.18
  233. PERL_ROOT=${SYSTEM_PERL_518_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  234. PERL_LIB_ARCH=
  235. }
  236. "ubuntu-16" ? {
  237. PERL_VERSION=5.22
  238. PERL_ROOT=${SYSTEM_PERL_522_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  239. PERL_LIB_ARCH=/x86_64-linux-gnu
  240. }
  241. "ubuntu-18" ? {
  242. PERL_VERSION=5.26
  243. PERL_ROOT=${SYSTEM_PERL_526_RESOURCE_GLOBAL}/perl${PERL_VERSION}
  244. PERL_LIB_ARCH=/x86_64-linux-gnu
  245. }
  246. "ubuntu-20" ? {
  247. PERL_VERSION=5.30
  248. PERL_ROOT=${SYSTEM_PERL_530_RESOURCE_GLOBAL}/usr
  249. PERL_LIB_ARCH=/x86_64-linux-gnu
  250. }
  251. }
  252. PERL=${PERL_ROOT}/bin/perl
  253. PERL_ARCHLIB=${PERL_ROOT}/lib$PERL_LIB_ARCH/perl/${PERL_VERSION}
  254. PERL_PRIVLIB=${PERL_ROOT}/share/perl/${PERL_VERSION}
  255. PERL_LIBS=${PERL_ROOT}/lib${PERL_LIB_ARCH}
  256. PERL_LD_LIBRARY_PATH=${env:"LD_LIBRARY_PATH=${PERL_ROOT}/lib"}
  257. # Perl searches it's modules in INC@ paths. They can not be sysrooted or disabled (at least I haven't found a way),
  258. # so default Perl module directories should be prepended to perl command lines when using non-local perl.
  259. PERL_INCLUDE=-I${PERL_ARCHLIB} -I${PERL_PRIVLIB}
  260. }
  261. PERL_DEFAULT_PEERDIR=yes
  262. # tag:perl-specific
  263. PERLSUFFIX=-csuffix .cpp
  264. PERLOUTPUT=${stdout;output:SRC.cpp}
  265. when ($PERLC == "yes") {
  266. PERLSUFFIX=-csuffix .c
  267. PERLOUTPUT=${stdout;output:SRC.c}
  268. }
  269. XSUBPPFLAGS=
  270. _XSTYPEMAPS=
  271. macro XSTYPEMAPS(Names...) {
  272. SET_APPEND(_XSTYPEMAPS $Names)
  273. }
  274. # tag:tool-specific
  275. ARCH_TOOL=${tool:"tools/archiver"}
  276. # tag:tool-specific tag:proto
  277. PROTOC=${tool:"contrib/tools/protoc"}
  278. PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
  279. PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
  280. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src
  281. USE_VANILLA_PROTOC=no
  282. PROTOC_TRANSITIVE_HEADERS=yes
  283. _PROTOC_FLAGS=
  284. # tag:tool-specific
  285. FML_TOOL=${tool:"tools/relev_fml_codegen"}
  286. FML_UNUSED_TOOL=${tool:"tools/relev_fml_unused"}
  287. LUA_TOOL=${tool:"tools/lua"}
  288. ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
  289. # tag:python-specific tag:cython-specific
  290. CYTHON_SCRIPT=${input:"${ARCADIA_ROOT}/contrib/tools/cython/cython.py"} ${hide:CYTHON_FAKE_ID} $CYTHON_PREDEFINED_INCLUDES
  291. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  292. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  293. PYTHON_TYPE_FOR_CYTHON=PY2
  294. CYTHON_OUTPUT_INCLUDES=\
  295. ${output_include;hide:"contrib/libs/python/Include/compile.h"} \
  296. ${output_include;hide:"contrib/libs/python/Include/frameobject.h"} \
  297. ${output_include;hide:"contrib/libs/python/Include/longintrepr.h"} \
  298. ${output_include;hide:"contrib/libs/python/Include/pyconfig.h"} \
  299. ${output_include;hide:"contrib/libs/python/Include/Python.h"} \
  300. ${output_include;hide:"contrib/libs/python/Include/pythread.h"} \
  301. ${output_include;hide:"contrib/libs/python/Include/structmember.h"} \
  302. ${output_include;hide:"contrib/libs/python/Include/traceback.h"} \
  303. ${output_include;hide:"contrib/tools/cython/generated_c_headers.h"} \
  304. ${output_include;hide:"omp.h"}
  305. # tag:cython-specific
  306. CYTHON_CPP_OUTPUT_INCLUDES=${output_include;hide:"contrib/tools/cython/generated_cpp_headers.h"}
  307. # tag:cython-specific
  308. CYTHON_PREDEFINED_INCLUDES=\
  309. ${input;hide:"contrib/tools/cython/Cython/Utility/Buffer.c"} \
  310. ${input;hide:"contrib/tools/cython/Cython/Utility/Builtins.c"} \
  311. ${input;hide:"contrib/tools/cython/Cython/Utility/CMath.c"} \
  312. ${input;hide:"contrib/tools/cython/Cython/Utility/Capsule.c"} \
  313. ${input;hide:"contrib/tools/cython/Cython/Utility/CommonTypes.c"} \
  314. ${input;hide:"contrib/tools/cython/Cython/Utility/Complex.c"} \
  315. ${input;hide:"contrib/tools/cython/Cython/Utility/Coroutine.c"} \
  316. ${input;hide:"contrib/tools/cython/Cython/Utility/CythonFunction.c"} \
  317. ${input;hide:"contrib/tools/cython/Cython/Utility/Embed.c"} \
  318. ${input;hide:"contrib/tools/cython/Cython/Utility/Exceptions.c"} \
  319. ${input;hide:"contrib/tools/cython/Cython/Utility/ExtensionTypes.c"} \
  320. ${input;hide:"contrib/tools/cython/Cython/Utility/FunctionArguments.c"} \
  321. ${input;hide:"contrib/tools/cython/Cython/Utility/ImportExport.c"} \
  322. ${input;hide:"contrib/tools/cython/Cython/Utility/MemoryView_C.c"} \
  323. ${input;hide:"contrib/tools/cython/Cython/Utility/ModuleSetupCode.c"} \
  324. ${input;hide:"contrib/tools/cython/Cython/Utility/ObjectHandling.c"} \
  325. ${input;hide:"contrib/tools/cython/Cython/Utility/Optimize.c"} \
  326. ${input;hide:"contrib/tools/cython/Cython/Utility/Overflow.c"} \
  327. ${input;hide:"contrib/tools/cython/Cython/Utility/Printing.c"} \
  328. ${input;hide:"contrib/tools/cython/Cython/Utility/Profile.c"} \
  329. ${input;hide:"contrib/tools/cython/Cython/Utility/StringTools.c"} \
  330. ${input;hide:"contrib/tools/cython/Cython/Utility/TestUtilityLoader.c"} \
  331. ${input;hide:"contrib/tools/cython/Cython/Utility/TypeConversion.c"}
  332. # tag:cython-specific
  333. CYTHON_PREDEFINED_INDUCED=\
  334. contrib/libs/python/Include/Python.h
  335. # tag:cython-specific
  336. CYTHON_OPTIONS=
  337. when ($OS_LINUX) {
  338. CYTHON_OPTIONS += -E UNAME_SYSNAME=Linux
  339. }
  340. elsewhen ($OS_DARWIN) {
  341. CYTHON_OPTIONS += -E UNAME_SYSNAME=Darwin
  342. }
  343. elsewhen ($OS_WINDOWS) {
  344. CYTHON_OPTIONS += -E UNAME_SYSNAME=Windows
  345. }
  346. when ($USE_LOCAL_SWIG != "yes") {
  347. _SWIG_TOOL=${tool:"contrib/tools/swig"}
  348. _SWIG_LIBRARY=contrib/tools/swig/Lib
  349. _SWIG_LIBRARY_ABS=$ARCADIA_ROOT/$_SWIG_LIBRARY
  350. }
  351. otherwise {
  352. _SWIG_TOOL=$SWIG_TOOL
  353. _SWIG_LIBRARY=$SWIG_LIBRARY
  354. _SWIG_LIBRARY_ABS=$SWIG_LIBRARY
  355. }
  356. SWIG_IMPLICIT_INCLUDES = swig.swg go.swg java.swg perl5.swg python.swg
  357. FATAL_ERROR_MODULE=no
  358. FATAL_ERROR_MESSAGE=
  359. # tag:python-specific
  360. # PYTHON_DISTR={ "default" | "macos-brew" } determine python system supply
  361. # see build/platform/python/ya.make
  362. PYTHON_DISTR="default"
  363. when ($USE_SYSTEM_PYTHON) {
  364. USE_ARCADIA_PYTHON=no
  365. select ($USE_SYSTEM_PYTHON) {
  366. "2.7" ? {
  367. _SYSTEM_PYTHON27=yes
  368. PY_VERSION=2.7
  369. PY_FRAMEWORK_VERSION=2.7
  370. }
  371. "3.4" ? {
  372. _SYSTEM_PYTHON34=yes
  373. PY_VERSION=3.4m
  374. PY_FRAMEWORK_VERSION=3.4
  375. }
  376. "3.5" ? {
  377. _SYSTEM_PYTHON35=yes
  378. PY_VERSION=3.5m
  379. PY_FRAMEWORK_VERSION=3.5
  380. }
  381. "3.6" ? {
  382. _SYSTEM_PYTHON36=yes
  383. PY_VERSION=3.6m
  384. PY_FRAMEWORK_VERSION=3.6
  385. }
  386. "3.7" ? {
  387. _SYSTEM_PYTHON37=yes
  388. PY_VERSION=3.7m
  389. PY_FRAMEWORK_VERSION=3.7
  390. }
  391. "3.8" ? {
  392. _SYSTEM_PYTHON38=yes
  393. PY_VERSION=3.8
  394. PY_FRAMEWORK_VERSION=3.8
  395. }
  396. "3.9" ? {
  397. _SYSTEM_PYTHON39=yes
  398. PY_VERSION=3.9
  399. PY_FRAMEWORK_VERSION=3.9
  400. }
  401. "3.10" ? {
  402. _SYSTEM_PYTHON310=yes
  403. PY_VERSION=3.10
  404. PY_FRAMEWORK_VERSION=3.10
  405. }
  406. "3.11" ? {
  407. _SYSTEM_PYTHON311=yes
  408. PY_VERSION=3.11
  409. PY_FRAMEWORK_VERSION=3.11
  410. }
  411. default ? {
  412. FATAL_ERROR_MESSAGE+=invalid USE_SYSTEM_PYTHON value
  413. }
  414. }
  415. }
  416. ANTLR_PYTHON=Python2
  417. ### @usage: NO_LTO()
  418. ###
  419. ### Disable any lto (link-time optimizations) for the module.
  420. ### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
  421. ### linking of entire program if global settings say so.
  422. macro NO_LTO() {
  423. DISABLE(USE_LTO)
  424. DISABLE(USE_THINLTO)
  425. }
  426. when ($BUILD_PYTHON3_BIN) {
  427. YMAKE_PYTHON3=${BUILD_PYTHON3_BIN}
  428. YMAKE_PYTHON3_PEERDIR=
  429. }
  430. otherwise {
  431. YMAKE_PYTHON3=${YMAKE_PYTHON3_RESOURCE_GLOBAL}/python3
  432. }
  433. # tag:python-specific
  434. when ($USE_ARCADIA_PYTHON == "no") {
  435. SYSINCL+=build/sysincl/python.yml
  436. }
  437. # tag:allocator
  438. DEFAULT_ALLOCATOR=LF
  439. # tag:allocator
  440. when ($OS_ANDROID == "yes" || $MSVC == "yes" || $ARCH_TYPE_32 == "yes" || $ARCH_AARCH64 == "yes") {
  441. DEFAULT_ALLOCATOR=J
  442. }
  443. # tag:allocator
  444. when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
  445. DEFAULT_ALLOCATOR=SYSTEM
  446. }
  447. # tag:allocator
  448. when ($OS_DARWIN == "yes") {
  449. DEFAULT_ALLOCATOR=SYSTEM
  450. }
  451. # tag:allocator
  452. when ($OS_LINUX == "yes") {
  453. when ($GCC) {
  454. # tcmalloc broken build
  455. }
  456. elsewhen ($SANDBOXING) {
  457. # broken
  458. }
  459. elsewhen ($ARCH_X86_64) {
  460. DEFAULT_ALLOCATOR=TCMALLOC_TC
  461. }
  462. }
  463. # tag:allocator
  464. when ($SANITIZER_TYPE) {
  465. when ($SANITIZER_TYPE != "no") {
  466. DEFAULT_ALLOCATOR=SYSTEM
  467. }
  468. }
  469. # tag:allocator
  470. when ($ARCH_XTENSA == "yes") {
  471. DEFAULT_ALLOCATOR=FAKE
  472. }
  473. # tag:internal
  474. ### @usage: CHECK_CONFIG_H(<conf_header>) # internal
  475. ###
  476. ### This internal macro adds checking code for configuration header in external (contrib) library.
  477. ### The check is needed to avoid conflicts on certain types and functions available in arcadia.
  478. ###
  479. ### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
  480. macro CHECK_CONFIG_H(Conf) {
  481. .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"}
  482. OUTPUT_INCLUDES=$Conf
  483. }
  484. REQUIRED_TRANSITIVE_PEERS=
  485. ### @usage REQUIRES(dirs...)
  486. ###
  487. ### Specify list of dirs which this module must depend on indirectly.
  488. ###
  489. ### This macro can be used if module depends on the directories specified but they can't be listed
  490. ### as direct PEERDIR dependencies (due to public include order or link order issues).
  491. macro REQUIRES(DIRS[]) {
  492. SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
  493. }
  494. CHECK_DEPENDENT_DIRS_TYPES=
  495. CHECK_DEPENDENT_DIRS_RESTRICTIONS=
  496. ### @usage CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
  497. ###
  498. ### Specify project transitive dependencies constraints.
  499. ###
  500. ### @params:
  501. ### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
  502. ### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
  503. ### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
  504. ### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
  505. ### 5. GLOB: next directory constraint is an ANT glob pattern.
  506. ### 6. EXCEPT: next constraint is an exception for the rest of other rules.
  507. ###
  508. ### Directory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
  509. ###
  510. ### Note: Can be used multiple times on the same module all specified constraints will be checked.
  511. ### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
  512. macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
  513. SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
  514. SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
  515. }
  516. # tag:proto
  517. PY_PROTOS_FOR=no
  518. BUILD_PROTO_AS_EVLOG=no
  519. # tag:proto
  520. PROTO_NAMESPACE=
  521. # tag:proto tag:python-specific
  522. GEN_PY_PROTOS=$YMAKE_PYTHON ${input:"build/scripts/gen_py_protos.py"}
  523. # tag:proto tag:cpp-specific
  524. PROTO_HEADER_EXTS=.pb.h
  525. CPP_PROTO_CMDLINE=
  526. CPP_PROTO_OPTS=
  527. CPP_PROTO_OUTS=
  528. CPP_PROTO_OUTS_SEM=
  529. CPP_PROTO_SUFFIXES=.pb.h .pb.cc
  530. CPP_PROTO_PLUGINS=
  531. # tag:proto tag:cpp-specific
  532. CPP_EV_OPTS=--plugin=protoc-gen-event2cpp=${tool:"tools/event2cpp"} --event2cpp_out=$ARCADIA_BUILD_ROOT -I=$ARCADIA_ROOT/library/cpp/eventlog
  533. CPP_EV_OUTS=
  534. CPP_EV_OUTS_SEM=
  535. # tag:proto tag:python-specific
  536. PY_PROTO_OPTS=
  537. PY_PROTO_OUTS=
  538. PY_PROTO_OUTS_INTERNAL=
  539. PY_PROTO_DEPS=
  540. PY_PROTO_SUFFIXES=_pb2.py
  541. PY_EVLOG_SUFFIXES=_ev_pb2.py
  542. # tag:proto tag:java-specific
  543. JAVA_PROTO_ARGS=
  544. # tag:proto tag:python-specific
  545. OPTIMIZE_PY_PROTOS_FLAG=no
  546. macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
  547. SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
  548. .SEM=resources ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${tool;hide:"tools/rescompiler/bin"}
  549. }
  550. # tag:built-in
  551. ### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # built-in
  552. ### Add data (resources, random files, strings) to the program)
  553. ### 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.
  554. ### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
  555. ###
  556. ### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
  557. ### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
  558. ###
  559. ### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
  560. ###
  561. ### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
  562. ###
  563. ### @example:
  564. ###
  565. ### LIBRARY()
  566. ### OWNER(user1)
  567. ###
  568. ### RESOURCE(
  569. ### path/to/file1 /key/in/program/1
  570. ### path/to/file2 /key2
  571. ### )
  572. ### END()
  573. ###
  574. macro RESOURCE(Args...) {
  575. PEERDIR(library/cpp/resource)
  576. }
  577. # tag:internal
  578. ### @usage: _ORDER_ADDINCL([BUILD ...] [SOURCE ...] Args...) # internal
  579. ###
  580. ### Order and filter ADDINCLs (Args - is intentionally omitted in ADDINCL macro)
  581. macro _ORDER_ADDINCL(BUILD[], SOURCE[], ARGS...) {
  582. ADDINCL($BUILD $SOURCE)
  583. }
  584. # tag:proto
  585. ### @usage: PROTO_ADDINCL([GLOBAL] [WITH_GEN] Path)
  586. ###
  587. ### This macro introduces proper ADDINCLs for .proto-files found in sources and
  588. ### .cpp/.h generated files, supplying them to appropriate commands and allowing
  589. ### proper dependency resolution at configure-time.
  590. ###
  591. ### Note: you normally shouldn't use this macro. ADDINCLs should be sent to user
  592. ### from dependency via PROTO_NAMESPACE macro
  593. macro PROTO_ADDINCL(GLOBAL?"GLOBAL":"", Path, WITH_GEN?"BUILD":"") {
  594. _ORDER_ADDINCL($WITH_GEN $GLOBAL FOR proto ${ARCADIA_BUILD_ROOT}/$Path SOURCE $GLOBAL FOR proto ${ARCADIA_ROOT}/$Path)
  595. ADDINCL($GLOBAL ${ARCADIA_BUILD_ROOT}/$Path)
  596. }
  597. # tag:proto
  598. ### @usage: PROTO_NAMESPACE([WITH_GEN] Namespace)
  599. ###
  600. ### Defines protobuf namespace (import/export path prefix) which should be used for imports and
  601. ### which defines output path for .proto generation.
  602. ###
  603. ### For proper importing and configure-time dependency management it sets ADDINCLs
  604. ### for both .cpp headers includes and .proto imports. If .proto expected to be used outside of the
  605. ### processing module use GLOBAL to send proper ADDINCLs to all (transitive) users. PEERDIR to
  606. ### PROTO_LIBRARY with PROTO_NAMESPACE() is enough at user side to correctly use the library.
  607. ### If generated .proto files are going to be used for building a module than use of WITH_GEN
  608. ### parameter will add appropriate dir from the build root for .proto files search.
  609. macro PROTO_NAMESPACE(GLOBAL?"GLOBAL":"", WITH_GEN?"WITH_GEN":"", Namespace) {
  610. SET(PROTO_NAMESPACE $Namespace)
  611. PROTO_ADDINCL(GLOBAL $WITH_GEN $Namespace)
  612. }
  613. # tag:proto
  614. ### @usage PROTOC_FATAL_WARNINGS()
  615. ###
  616. ### Treat protoc warnings as fatal errors that break the build, for example, unused imports
  617. ### Adds `--fatal_warnings` argument to protoc
  618. macro PROTOC_FATAL_WARNINGS() {
  619. SET_APPEND(_PROTOC_FLAGS --fatal_warnings)
  620. }
  621. # tag:proto tag:internal tag:python-specific
  622. ### @usage: OPTIMIZE_PY_PROTOS() # internal
  623. ###
  624. ### Enable Python proto optimization by embedding corresponding C++ code into binary.
  625. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  626. ### This is default mode for most PROTO_LIBRARY's and PY2_LIBRARY's, some system ones being exceptions.
  627. macro OPTIMIZE_PY_PROTOS() {
  628. SET(OPTIMIZE_PY_PROTOS_FLAG yes)
  629. }
  630. # tag:proto tag:python-specific
  631. ### @usage: NO_OPTIMIZE_PY_PROTOS()
  632. ###
  633. ### Disable Python proto optimization using embedding corresponding C++ code into binary.
  634. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  635. ### This is default mode only for some system libraries.
  636. macro NO_OPTIMIZE_PY_PROTOS() {
  637. SET(OPTIMIZE_PY_PROTOS_FLAG no)
  638. }
  639. # tag:proto tag:python-specific
  640. macro _PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  641. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/\$PROTO_NAMESPACE ${pre=--${Name}_opt=:OutParm}
  642. .SEM=IGNORED
  643. }
  644. # tag:proto tag:python-specific
  645. macro _ADD_PY_PROTO_OUT(Suf) {
  646. SET_APPEND(PY_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$Suf:File})
  647. 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}"})
  648. # XXX fix variable expansion in plugins
  649. SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
  650. }
  651. # tag:proto tag:python-specific
  652. ### @usage: PY_PROTO_PLUGIN(Name Ext Tool DEPS <Dependencies>)
  653. ###
  654. ### Define protoc plugin for python with given Name that emits extra output with provided Extension
  655. ### using Tool. Extra dependencies are passed via DEPS
  656. macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  657. SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  658. _ADD_PY_PROTO_OUT($EXT)
  659. # XXX fix variable expansion in plugins
  660. SET(PY_PROTO_DEPS $PY_PROTO_DEPS $DEPS)
  661. }
  662. # tag:proto tag:python-specific
  663. ### @usage: PY_PROTO_PLUGIN2(Name Ext1 Ext2 Tool DEPS <Dependencies>)
  664. ###
  665. ### Define protoc plugin for python with given Name that emits 2 extra outputs with provided Extensions
  666. ### using Tool. Extra dependencies are passed via DEPS
  667. macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
  668. PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
  669. _ADD_PY_PROTO_OUT($EXT2)
  670. }
  671. # tag:proto tag:java-specific
  672. macro _JAVA_PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  673. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/java_out
  674. }
  675. # tag:proto tag:java-specific
  676. ### @usage: JAVA_PROTO_PLUGIN(Name Tool DEPS <Dependencies>)
  677. ###
  678. ### Define protoc plugin for Java with given Name that emits extra outputs
  679. ### using Tool. Extra dependencies are passed via DEPS
  680. macro JAVA_PROTO_PLUGIN(NAME, TOOL, DEPS[]) {
  681. SET_APPEND(JAVA_PROTO_ARGS $_JAVA_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  682. # XXX fix variable expansion in plugins
  683. SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS $DEPS)
  684. }
  685. macro _ADD_SEM_PROP_IF_NON_EMPTY(Prop, Args...) {
  686. .SEM=${pre=&& set_target_property $Prop :Args}
  687. }
  688. # tag:proto tag:cpp-specific
  689. macro _ADD_CPP_PROTO_OUT(Suf) {
  690. .SEM=append_target_property PROTOC_EXTRA_OUTS $Suf ${output;hide;suf=.o:Suf} $_ADD_SEM_PROP_IF_NON_EMPTY(PROTO_NAMESPACE $PROTO_NAMESPACE)
  691. SET_APPEND(CPP_PROTO_OUTS \${output;hide;norel;nopath;noext;suf=$Suf:File})
  692. # XXX fix variable expansion in plugins
  693. SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES $Suf)
  694. }
  695. # tag:proto tag:cpp-specific
  696. HAS_CPP_PROTOBUF_PEERS=no
  697. CPP_PROTOBUF_PEERS=
  698. # tag:proto tag:cpp-specific
  699. ### @usage: CPP_PROTO_PLUGIN0(Name Tool DEPS <Dependencies>)
  700. ###
  701. ### Define protoc plugin for C++ with given Name that emits code into regular outputs
  702. ### using Tool. Extra dependencies are passed via DEPS.
  703. macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) {
  704. .SEM=target_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME}
  705. SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  706. # XXX fix variable expansion in plugins
  707. ENABLE(HAS_CPP_PROTOBUF_PEERS)
  708. SET(CPP_PROTOBUF_PEERS $CPP_PROTOBUF_PEERS $DEPS)
  709. }
  710. # tag:proto tag:cpp-specific
  711. ### @usage: CPP_PROTO_PLUGIN(Name Tool Suf DEPS <Dependencies>)
  712. ###
  713. ### Define protoc plugin for C++ with given Name that emits code into 1 extra output
  714. ### using Tool. Extra dependencies are passed via DEPS.
  715. macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[]) {
  716. CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS)
  717. _ADD_CPP_PROTO_OUT($SUF)
  718. }
  719. # tag:proto tag:cpp-specific
  720. ### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 DEPS <Dependencies>)
  721. ###
  722. ### Define protoc plugin for C++ with given Name that emits code into 2 extra outputs
  723. ### using Tool. Extra dependencies are passed via DEPS.
  724. macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[]) {
  725. CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS)
  726. _ADD_CPP_PROTO_OUT($SUF2)
  727. SET_APPEND(CPP_PROTO_OUTS_SEM \${output;hide;norel;nopath;noext;suf=$SUF2:File})
  728. }
  729. # tag:proto
  730. ### @usage: USE_SKIFF() #wip, do not use
  731. ###
  732. ### Use mapreduce/yt/skiff_proto/plugin for C++
  733. macro USE_SKIFF() {
  734. # Move extra includes to INDUCED_DEPS macro in mapreduce/yt/skiff_proto/plugin/ya.make
  735. CPP_PROTO_PLUGIN0(skiff mapreduce/yt/skiff_proto/plugin DEPS mapreduce/yt/skiff_proto/lib)
  736. }
  737. # tag:go-specific
  738. _GO_COMMON_GOOGLE_APIS = \
  739. vendor/google.golang.org/genproto/googleapis/api/annotations \
  740. vendor/google.golang.org/genproto/googleapis/api/configchange \
  741. vendor/google.golang.org/genproto/googleapis/api/distribution \
  742. vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1 \
  743. vendor/google.golang.org/genproto/googleapis/api/expr/v1beta1 \
  744. vendor/google.golang.org/genproto/googleapis/api/httpbody \
  745. vendor/google.golang.org/genproto/googleapis/api/label \
  746. vendor/google.golang.org/genproto/googleapis/api/metric \
  747. vendor/google.golang.org/genproto/googleapis/api/monitoredres \
  748. vendor/google.golang.org/genproto/googleapis/api/serviceconfig \
  749. vendor/google.golang.org/genproto/googleapis/api/servicecontrol/v1 \
  750. vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1 \
  751. vendor/google.golang.org/genproto/googleapis/iam/admin/v1 \
  752. vendor/google.golang.org/genproto/googleapis/iam/credentials/v1 \
  753. vendor/google.golang.org/genproto/googleapis/iam/v1 \
  754. vendor/google.golang.org/genproto/googleapis/iam/v1/logging \
  755. vendor/google.golang.org/genproto/googleapis/logging/type \
  756. vendor/google.golang.org/genproto/googleapis/logging/v2 \
  757. vendor/google.golang.org/genproto/googleapis/rpc/code \
  758. vendor/google.golang.org/genproto/googleapis/rpc/errdetails \
  759. vendor/google.golang.org/genproto/googleapis/rpc/status \
  760. vendor/google.golang.org/genproto/googleapis/type/calendarperiod \
  761. vendor/google.golang.org/genproto/googleapis/type/color \
  762. vendor/google.golang.org/genproto/googleapis/type/date \
  763. vendor/google.golang.org/genproto/googleapis/type/dayofweek \
  764. vendor/google.golang.org/genproto/googleapis/type/expr \
  765. vendor/google.golang.org/genproto/googleapis/type/fraction \
  766. vendor/google.golang.org/genproto/googleapis/type/latlng \
  767. vendor/google.golang.org/genproto/googleapis/type/money \
  768. vendor/google.golang.org/genproto/googleapis/type/postaladdress \
  769. vendor/google.golang.org/genproto/googleapis/type/quaternion \
  770. vendor/google.golang.org/genproto/googleapis/type/timeofday
  771. # tag:go-specific
  772. _COMMON_GOOGLE_APIS=None
  773. # tag:go-specific
  774. ### @usage: USE_COMMON_GOOGLE_APIS([apis...])
  775. ###
  776. ### Use common-google-apis library set. Pass optional apis list to be used or use them all.
  777. ### This macro is properly handled for all languages including Go, where apis come in
  778. ## pregenerated form. In other languages apis are generated from sources in Arcadia.
  779. macro USE_COMMON_GOOGLE_APIS(APIS...) {
  780. SET(_COMMON_GOOGLE_APIS ${pre=vendor/google.golang.org/genproto/googleapis/:APIS})
  781. }
  782. # tag:go-specific tag:proto
  783. GO_PROTO_GEN_PLUGINS=
  784. GO_PROTO_OPTS=
  785. GO_PROTO_OUTS=
  786. GO_PROTO_GRPC_OPTS=
  787. GO_PROTO_GRPC_OUTS=
  788. GO_PROTO_V2=no
  789. _GO_PROTO_CHECK_OUTPUT=
  790. # tag:go-specific tag:proto
  791. GO_PROTOBUF_IMPORTS=\
  792. ${GOSTD}/sync \
  793. ${GOSTD}/reflect \
  794. ${GOSTD}/fmt \
  795. ${GOSTD}/math \
  796. vendor/github.com/golang/protobuf/proto \
  797. vendor/google.golang.org/protobuf/types/descriptorpb \
  798. vendor/google.golang.org/protobuf/runtime/protoimpl \
  799. vendor/google.golang.org/protobuf/runtime/protoiface \
  800. vendor/google.golang.org/protobuf/reflect/protoreflect
  801. # tag:go-specific tag:proto
  802. GO_PROTOBUF_WELLKNOWN_TYPES=\
  803. vendor/google.golang.org/protobuf/types/known/anypb \
  804. vendor/google.golang.org/protobuf/types/known/apipb \
  805. vendor/google.golang.org/protobuf/types/known/durationpb \
  806. vendor/google.golang.org/protobuf/types/known/emptypb \
  807. vendor/google.golang.org/protobuf/types/known/fieldmaskpb \
  808. vendor/google.golang.org/protobuf/types/known/sourcecontextpb \
  809. vendor/google.golang.org/protobuf/types/known/structpb \
  810. vendor/google.golang.org/protobuf/types/known/timestamppb \
  811. vendor/google.golang.org/protobuf/types/known/typepb \
  812. vendor/google.golang.org/protobuf/types/known/wrapperspb
  813. # tag:go-specific tag:proto
  814. ### @usage: GO_PROTO_PLUGIN(Name Ext Tool [DEPS dependencies...])
  815. ###
  816. ### Define protoc plugin for GO with given Name that emits extra output with provided extension
  817. ### Ext using Tool. Extra dependencies are passed via DEPS.
  818. macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  819. SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  820. SET_APPEND(GO_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$EXT:File})
  821. PEERDIR(${DEPS})
  822. }
  823. # tag:go-specific tag:proto
  824. GO_PROTO_CMDLINE=${cwd;rootdir;input:File} $YMAKE_PYTHON3 ${input:"build/scripts/go_proto_wrapper.py"} --arcadia-prefix $GO_ARCADIA_PROJECT_PREFIX --contrib-prefix $GO_CONTRIB_PROJECT_PREFIX --namespace ./$PROTO_NAMESPACE $_GO_PROTO_CHECK_OUTPUT --proto ${input;rootrel:File} -- $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH $_PROTOC_FLAGS
  825. # tag:go-specific tag:proto
  826. macro _GO_PROTO_CMD_IMPL(File, OPTS...) {
  827. .CMD=$GO_PROTO_CMDLINE $OPTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  828. .PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES}
  829. .ADDINCL=FOR proto contrib/libs/protobuf/src
  830. }
  831. # tag:go-specific tag:proto
  832. macro _GO_PROTO_CMD(File) {
  833. .CMD=$_GO_PROTO_CMD_IMPL($File $GO_PROTO_OPTS $GO_PROTO_OUTS)
  834. }
  835. # tag:proto
  836. ### @usage: YP_PROTO_YSON(Files... OUT_OPTS Opts...)
  837. ###
  838. ### Generate .yson.go from .proto using yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen
  839. macro YP_PROTO_YSON(OUT_OPTS[], Files...) {
  840. .CMD=${cwd:BINDIR} $PROTOC --plugin=protoc-gen-custom=${tool:"yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen"} -I=${ARCADIA_ROOT}/${PROTO_NAMESPACE} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} --custom_out="$OUT_OPTS paths=base_name:." --custom_opt="goroot=${GO_TOOLS_ROOT}" $_PROTOC_FLAGS ${input:Files} ${output;hide;noauto;nopath;noext;suf=.yson.go:Files}
  841. .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
  842. .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
  843. }
  844. _SEM_CPP_PROTO_CMD=target_proto_messages PRIVATE ${input:File} $CPP_PROTO_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
  845. && set_global_flags COMMON_PROTOC_FLAGS \
  846. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
  847. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH
  848. # tag:proto
  849. macro _CPP_PROTO_CMD(File) {
  850. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  851. .SEM=$_SEM_CPP_PROTO_CMD
  852. .PEERDIR=contrib/libs/protobuf
  853. }
  854. # tag:proto
  855. macro _CPP_VANILLA_PROTO_CMD(File) {
  856. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  857. .PEERDIR=contrib/libs/protobuf_std
  858. }
  859. _SEM_CPP_EV_CMD=target_ev_messages PRIVATE ${input:File} $CPP_EV_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"tools/event2cpp/bin"} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
  860. && set_global_flags COMMON_PROTOC_FLAGS \
  861. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT --event2cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE \
  862. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH $ARCADIA_ROOT/library/cpp/eventlog
  863. # tag:proto
  864. macro _CPP_EVLOG_CMD(File) {
  865. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_EV_OUTS ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  866. .SEM=$_SEM_CPP_EV_CMD
  867. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  868. }
  869. # tag:proto
  870. macro _CPP_PROTO_EVLOG_CMD(File) {
  871. # process .proto as .ev
  872. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  873. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  874. }
  875. # tag:proto
  876. macro _CPP_CFGPROTO_CMD(File) {
  877. # keep extension in output just as in EV: this is hard-coded behaviour of protoc for non-.proto extensions
  878. .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"}
  879. .PEERDIR=library/cpp/proto_config/codegen library/cpp/proto_config/protos contrib/libs/protobuf
  880. }
  881. # tag:proto
  882. PY_PROTO_MYPY_ENABLED=yes
  883. 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
  884. # tag:proto tag:python-specific
  885. PY_PROTO_MYPY_SUFFIX=
  886. PY_PROTO_MYPY_PLUGIN=
  887. PY_PROTO_MYPY_PLUGIN_INTERNAL=
  888. # tag:proto tag:python-specific
  889. macro NO_MYPY() {
  890. DISABLE(PY_PROTO_MYPY_ENABLED)
  891. }
  892. # tag:proto tag:python-specific
  893. macro _PY_PROTO_CMD_BASE(File, Suf, Args...) {
  894. .CMD=$PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --python_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $_PROTOC_FLAGS ${input;rootrel:File} ${output;hide;noauto;norel;nopath;noext;suf=$Suf:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $Args
  895. }
  896. # tag:proto tag:python-specific
  897. macro _PY_PROTO_CMD(File) {
  898. .CMD=${cwd;rootdir;input:File} $_PY_PROTO_CMD_BASE($File _pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS $PY_PROTO_MYPY_PLUGIN)
  899. }
  900. # tag:proto tag:python-specific
  901. macro _PY_PROTO_CMD_INTERNAL(File) {
  902. .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)
  903. }
  904. # tag:proto tag:java-specific
  905. JAVA_PROTO_RUNTIME=
  906. # tag:proto tag:java-specific
  907. ### @usage: USE_JAVALITE()
  908. ### Use protobuf-javalite for Java
  909. macro USE_JAVALITE() {
  910. SET(JAVA_PROTO_RUNTIME javalite)
  911. }
  912. # tag:proto tag:java-specific
  913. JAVA_PROTO_RUNTIME_VERSION = 3.21.12
  914. JAVA_PROTO_COMMON_VERSION = 1.12.0
  915. KOTLIN_PROTO=no
  916. KOTLIN_PROTO_PEERS=
  917. when ($JAVA_PROTO_RUNTIME == "javalite") {
  918. _JAVA_PROTO_LITE_ARG=lite:
  919. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
  920. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.43.2
  921. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.43.2
  922. }
  923. otherwise {
  924. _JAVA_PROTO_LITE_ARG=
  925. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
  926. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.43.2
  927. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.43.2
  928. }
  929. KOTLIN_PROTO_FLAGS=
  930. # tag:proto tag:java-specific
  931. macro _JAVA_PROTO_CMD(File) {
  932. .CMD=${cwd;rootdir;input:File} $YMAKE_PYTHON ${input:"build/scripts/tared_protoc.py"} --tar-output ${output;norel;nopath;noext;suf=.jsrc:File} --protoc-out-dir $ARCADIA_BUILD_ROOT/java_out $PROTOC -I=./$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_ROOT --java_out=${_JAVA_PROTO_LITE_ARG}$ARCADIA_BUILD_ROOT/java_out ${KOTLIN_PROTO_FLAGS} $_PROTOC_FLAGS ${input;rootrel:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $JAVA_PROTO_ARGS
  933. .SEM=proto_files ${input;rootrel:File} ${hide;output:File.jsrc}
  934. }
  935. # tag:proto tag:perl-specific tag:deprecated
  936. ### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
  937. ###
  938. ### Generate Perl code from protobuf.
  939. ### In order to use this macro one should predict all outputs protoc will emit from input_proto file and enlist those as outputs.
  940. macro XS_PROTO(File, Dir, Outputs...) {
  941. .CMD=$PROTOC -I=${ARCADIA_ROOT}/${Dir} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} -I=${PROTOBUF_PATH} --perlxs_out=${BINDIR} $_PROTOC_FLAGS ${input:File} ${hide;output:Outputs} ${induced_deps=h+cpp;hide;nopath;noext;suf=.pb.h:File}
  942. PEERDIR(${Dir})
  943. ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir})
  944. }
  945. # tag:proto tag:fbs
  946. ### @usage: PROTO2FBS(InputProto)
  947. ###
  948. ### Produce flatbuf schema out of protobuf description.
  949. macro PROTO2FBS(File) {
  950. .CMD=${cwd:BINDIR} ${tool:"contrib/tools/flatc"} -I . -I ${ARCADIA_ROOT} --proto ${input:File} ${output;hide;norel;noext:File.fbs} ${kv;hide:"p FBS"} ${kv;hide:"pc yellow"} && $MOVE_FILE ${BINDIR}/${nopath;noext:File.fbs} ${output;norel;noext:File.fbs}
  951. }
  952. # tag:proto tag:python-specific
  953. when ($PY_PROTOS_FOR == "yes") {
  954. PEERDIR+=contrib/libs/protobuf/python
  955. }
  956. # tag:python-specific
  957. macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
  958. .CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
  959. .PEERDIR=library/cpp/eventlog/proto
  960. }
  961. # tag:python-specific tag:proto
  962. macro _PY_EVLOG_CMD(File) {
  963. .CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
  964. }
  965. # tag:python-specific tag:proto
  966. macro _PY_EVLOG_CMD_INTERNAL(File) {
  967. .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}"})
  968. }
  969. # tag:java-specific tag:proto
  970. macro _JAVA_EVLOG_CMD(File) {
  971. .CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  972. .PEERDIR=library/cpp/eventlog/proto
  973. }
  974. # tag:sanitize
  975. RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
  976. # tag:sanitize
  977. when ($IS_CROSS_SANITIZE) {
  978. RUN_NO_SANITIZE=
  979. }
  980. YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
  981. XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
  982. WRITER_PY=$YMAKE_PYTHON ${input:"build/scripts/writer.py"} ${input;hide:"build/scripts/process_command_files.py"}
  983. FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} ${input;hide:"build/scripts/process_command_files.py"}
  984. FIX_MSVC_OUTPUT=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ${input;hide:"build/scripts/process_command_files.py"}
  985. _PROCESS_WHOLE_ARCHIVE_SCRIPT=${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/process_whole_archive_option.py"}
  986. COPY_CMD=$FS_TOOLS copy
  987. LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
  988. REMOVE_FILE=$FS_TOOLS remove
  989. MOVE_FILE=$FS_TOOLS rename
  990. # tag:allocator tag:windows-specific
  991. MSVC_DYNAMICBASE=/DYNAMICBASE
  992. when ($ALLOCATOR == "LF") {
  993. MSVC_DYNAMICBASE=/DYNAMICBASE:NO
  994. }
  995. # tag:sanitize
  996. SANITIZE_HEADERS=yes
  997. SANITIZER_CFLAGS=
  998. # tag:proto tag:grpc
  999. _GRPC_ENABLED=no
  1000. # tag:proto tag:grpc
  1001. ### @usage: GRPC()
  1002. ###
  1003. ### Emit GRPC code for all .proto files in a PROTO_LIBRARY.
  1004. ### This works for all available PROTO_LIBRARY versions (C++, Python 2.x, Python 3.x, Java and Go).
  1005. macro GRPC() {
  1006. ENABLE(_GRPC_ENABLED)
  1007. # C++
  1008. CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp .grpc.pb.cc .grpc.pb.h DEPS contrib/libs/grpc)
  1009. # Python
  1010. PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/python/grpcio)
  1011. # Java
  1012. JAVA_PROTO_PLUGIN(grpc_java contrib/tools/protoc/plugins/grpc_java DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  1013. SET_APPEND(JAVA_PROTOBUF_PEERS contrib/java/javax/annotation/javax.annotation-api/1.3.1)
  1014. }
  1015. macro GO_PROTO_USE_V2() {
  1016. ENABLE(GO_PROTO_V2)
  1017. }
  1018. # tag:fbs
  1019. FLATC_FLAGS_VALUE=
  1020. ### @usage: FLATC_FLAGS(flags...)
  1021. ###
  1022. ### Add flags to flatc command line
  1023. macro FLATC_FLAGS(FLAGS...) {
  1024. SET_APPEND(FLATC_FLAGS_VALUE $FLAGS)
  1025. }
  1026. # tag:fbs
  1027. _PY_FBS_DEPS=contrib/python/flatbuffers
  1028. # tag:fbs tag:internal
  1029. ### @usage: FBS_TO_PYSRC(output_base_name fbs_files...) # internal
  1030. ###
  1031. ### Create a tar archive of .py files generated by flatc for Python. Output tar
  1032. ### archive will have .fbs.pysrc extension. This .fbs.pysrc extension is specially
  1033. ### processed when --add-flatbuf-result flag is specified on the command line
  1034. ### for 'ya make ...' (tar archive is extracted to output directory).
  1035. macro FBS_TO_PYSRC(OUT_NAME, IN_FBS_FILES...) {
  1036. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --python --gen-mutable ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR} ${input:IN_FBS_FILES} && $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --exts .py --input $BINDIR --output ${output;noauto;tared:OUT_NAME.fbs.pysrc} ${kv;hide:"p FP"} ${kv;hide:"pc light-green"} ${kv;hide:"tared_kind nodir"}
  1037. }
  1038. # tag:fbs tag:go-specific
  1039. # Implicit dependencies of generated code for Go
  1040. _GO_FLATC_IMPORTS=\
  1041. ${GOSTD}/strconv \
  1042. vendor/github.com/google/flatbuffers/go
  1043. # tag:fbs tag:cpp-specific
  1044. macro _CPP_FLATC_CMD(SRC, SRCFLAGS...) {
  1045. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${input:"build/scripts/cpp_flatc_wrapper.py"} ${tool:"contrib/tools/flatc"} --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --yandex-maps-iter --gen-object-api --filename-suffix .fbs ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${output;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${input:SRC} ${output;hide;noext;norel:SRC.iter.fbs.h} ${output;noauto;hide;noext;norel:SRC.bfbs} ${kv;hide:"p FL"} ${kv;hide:"pc light-green"}
  1046. .SEM=target_fbs_source PRIVATE ${input:SRC} ${pre=-I :_FLATC__INCLUDE} ${output;hide;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${output;hide;noext;norel:SRC.iter.fbs.h} ${output;noauto;hide;noext;norel:SRC.bfbs} ${hide;tool:"contrib/tools/flatc/bin"} && set_global_flags FBS_CPP_FLAGS --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --yandex-maps-iter --gen-object-api --filename-suffix .fbs ${FLATC_FLAGS_VALUE} ${input;hide:"build/scripts/cpp_flatc_wrapper.py"}
  1047. .PEERDIR=contrib/libs/flatbuffers
  1048. }
  1049. # tag:fbs tag:cpp-specific
  1050. macro _CPP_FLATC64_CMD(SRC, SRCFLAGS...) {
  1051. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${input:"build/scripts/cpp_flatc_wrapper.py"} ${tool:"contrib/tools/flatc64"} --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --filename-suffix .fbs64 ${FLATC_FLAGS_VALUE} -I ${ARCADIA_ROOT} -I ${ARCADIA_BUILD_ROOT} -o ${output;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${input:SRC} ${output;noauto;hide;noext;norel:SRC.bfbs64} ${kv;hide:"p FL64"} ${kv;hide:"pc light-green"}
  1052. .PEERDIR=contrib/libs/flatbuffers64
  1053. }
  1054. # tag:fbs tag:go-specific tag:internal
  1055. ### @usage: _GO_FLATC_CMD(fbs_file flags...) # internal
  1056. ###
  1057. ### Create a tar archive of .go files generated by flatc for Go. Output tar archive
  1058. ### will have .fbs.gosrc extension. This .fbs.gosrc is specially processed when
  1059. ### --add-protobuf-result flag is specified on the command line for 'ya make ...'
  1060. ### (tar archive is extracted to output directory).
  1061. macro _GO_FLATC_CMD(SRC, PACKAGE_NAME) {
  1062. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --go --gen-mutable --go-namespace ${PACKAGE_NAME} ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR}/_generated ${input:SRC} && $YMAKE_PYTHON3 ${input:"build/scripts/postprocess_go_fbs.py"} --input-dir ${BINDIR} --map $_FBS_NAMESPACE_MAP_GLOBAL && $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --flat --input ${BINDIR}/_generated --output ${output;noext;tared:SRC.fbs.gosrc} --exts .go ${kv;hide:"p FG"} ${kv;hide:"pc light-green"} ${kv;hide:"tared_kind nodir"}
  1063. .PEERDIR=${_GO_FLATC_IMPORTS}
  1064. }
  1065. # tag:fbs tag:java-specific tag:internal
  1066. ### @usage: _JAVA_FLATC_CMD(fbs_file) # internal
  1067. ###
  1068. ### Create a tar archive of .java files generated by flatc for Java. Output tar
  1069. ### acrchive will have .fbs.jsrc extension. Files with .fbs.jsrc extension will
  1070. ### be added to results when --add-flatbuf-result flag is specified on the command
  1071. ### line for 'ya make ...'
  1072. macro _JAVA_FLATC_CMD(SRC) {
  1073. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --java --gen-mutable ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR} ${input:SRC} && $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --input $BINDIR --output ${output;nopath;noext:SRC.fbs.jsrc} --exts .java ${kv;hide:"p FJ"} ${kv;hide:"pc light-green"}
  1074. .PEERDIR=contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION}
  1075. }
  1076. # variables must be defined for all module types to make generate_mf.py work
  1077. MODULE_PREFIX=
  1078. MODULE_SUFFIX=
  1079. NEED_PLATFORM_PEERDIRS=yes
  1080. PEERDIR_TEST_TOOL=yes
  1081. # tag:python-specific
  1082. PYTHON2=no
  1083. PYTHON3=no
  1084. # tag:python-specific
  1085. when (!$ARCADIA_PYTHON_UNICODE_SIZE) {
  1086. when ($OS_WINDOWS) {
  1087. ARCADIA_PYTHON_UNICODE_SIZE=2
  1088. }
  1089. otherwise {
  1090. ARCADIA_PYTHON_UNICODE_SIZE=4
  1091. }
  1092. }
  1093. YMAKE_PYTHON3_PEERDIR=build/platform/python/ymake_python3
  1094. macro NO_YMAKE_PYTHON3() {
  1095. SET(YMAKE_PYTHON3_PEERDIR)
  1096. }
  1097. ### @usage: _BARE_UNIT # internal
  1098. ###
  1099. ### The base of all modules describing default bare minimum for all modules.
  1100. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1101. module _BARE_UNIT {
  1102. .EXTS=.*
  1103. .CMD=TOUCH_UNIT
  1104. .IGNORED=GO_PROTO_PLUGIN
  1105. .NODE_TYPE=Bundle
  1106. .PEERDIR_POLICY=as_include
  1107. .RESTRICTED=GRPC USE_SKIFF INDUCED_DEPS FUZZ_DICTS FUZZ_OPTS PACK EXPLICIT_OUTPUTS DOCS_DIR DOCS_CONFIG DOCS_VARS YT_SPEC USE_CXX USE_UTIL WHOLE_ARCHIVE PRIMARY_OUTPUT SECONDARY_OUTPUT DEPENDENCY_MANAGEMENT EXCLUDE NO_DOCTESTS EMBED_JAVA_VCS_INFO RESOURCE_FILES PACK_GLOBALS_IN_LIBRARY _EXPOSE GLOBAL_DEPS LIST_PROTO
  1108. .FINAL_TARGET=no
  1109. PEERDIR_TAGS=__EMPTY__
  1110. PEERDIR+=$YMAKE_PYTHON3_PEERDIR
  1111. when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
  1112. PEERDIR+=build/conf_fatal_error
  1113. }
  1114. DEFAULT(MODULE_VERSION)
  1115. DEFAULT(MODULE_PREFIX)
  1116. DEFAULT(MODULE_SUFFIX)
  1117. }
  1118. ### @usage: GEN_LIBRARY()
  1119. ###
  1120. ### Definition of a module that brings generated artefacts. This module can PEERDIRed
  1121. ### from any module. The resulted module is empty and cleaned up during construction
  1122. ### of the build graph.
  1123. ###
  1124. ### NOTE! SRCS macro is not supported for this library.
  1125. module GEN_LIBRARY: _BARE_UNIT {
  1126. .PROXY=yes
  1127. .RESTRICTED=SRCS SRC
  1128. .SEM=IGNORED
  1129. # ENABLE(_FAKE_MODULE)
  1130. SET(MODULE_SUFFIX .pkg.fake)
  1131. }
  1132. ### @usage: _BASE_UNIT # internal
  1133. ###
  1134. ### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
  1135. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1136. module _BASE_UNIT: _BARE_UNIT {
  1137. .GLOBAL=_FBS_NAMESPACE_MAP
  1138. PEERDIR_TAGS=CPP_PROTO CPP_FBS H_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB
  1139. CPP_PROTO_CMDLINE=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --cpp_out=${CPP_PROTO_PLUGINS}$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $_PROTOC_FLAGS $PROTOC_STYLEGUIDE_OUT $PROTOC_PLUGIN_STYLEGUIDE ${input;rootrel:File}
  1140. CPP_PROTO_OUTS+=${output;hide;norel;nopath;noext:File.pb.cc} ${output;main;hide;norel;nopath;noext:File.pb.h}
  1141. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
  1142. CPP_EV_OUTS+=${output;hide;norel:File.pb.cc} ${output;hide;norel:File.pb.h}
  1143. CPP_EV_OUTS_SEM+=${output;hide;norel:File.pb.h}
  1144. when ($SWIG_LANG == "perl") {
  1145. _SWIG_CMD=$_SWIG_PERL_CMD
  1146. _SWIG_ADDINCLS=$_SWIG_PERL_ADDINCLS
  1147. _SWIG_PEERDIR=$_SWIG_PERL_PEERDIR
  1148. }
  1149. elsewhen ($SWIG_LANG == "python") {
  1150. _SWIG_CMD=$_SWIG_PYTHON_CMD
  1151. _SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
  1152. _SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
  1153. }
  1154. elsewhen ($SWIG_LANG == "jni_cpp") {
  1155. _SWIG_CMD=$_SWIG_JNI_CPP_CMD
  1156. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1157. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1158. }
  1159. elsewhen ($SWIG_LANG == "java") {
  1160. _SWIG_CMD=$_SWIG_JNI_CMD
  1161. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1162. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1163. }
  1164. when ($PY_PROTOS_FOR == "yes") {
  1165. MACRO_ALIAS(EVLOG_CMD _PY_EVLOG_CMD)
  1166. MACRO_ALIAS(PROTO_CMD _PY_PROTO_CMD)
  1167. }
  1168. otherwise {
  1169. MACRO_ALIAS(EVLOG_CMD _CPP_EVLOG_CMD)
  1170. MACRO_ALIAS(FBS_CMD _CPP_FLATC_CMD)
  1171. when ($BUILD_PROTO_AS_EVLOG == "yes") {
  1172. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_EVLOG_CMD)
  1173. }
  1174. otherwise {
  1175. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_CMD)
  1176. }
  1177. when ($USE_VANILLA_PROTOC == "yes") {
  1178. PROTOC=${tool:"contrib/tools/protoc_std"}
  1179. PROTOC_STYLEGUIDE_OUT=
  1180. PROTOC_PLUGIN_STYLEGUIDE=
  1181. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std
  1182. MACRO_ALIAS(PROTO_CMD _CPP_VANILLA_PROTO_CMD)
  1183. }
  1184. when ($PROTOC_TRANSITIVE_HEADERS == "no") {
  1185. CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
  1186. }
  1187. }
  1188. SANITIZER_DEFINED=no
  1189. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1190. CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
  1191. LDFLAGS+=-fsanitize=$SANITIZER_TYPE
  1192. SANITIZER_DEFINED=yes
  1193. when ($CLANG) {
  1194. CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  1195. LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  1196. }
  1197. }
  1198. when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
  1199. CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1200. LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1201. }
  1202. POPULATE_CPP_COVERAGE_FLAGS()
  1203. when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
  1204. CFLAGS+=-DNLG_COVERAGE
  1205. }
  1206. when ($GCC) {
  1207. select ($SANITIZER_TYPE) {
  1208. "address" ? {
  1209. LDFLAGS+=-static-libasan
  1210. }
  1211. "undefined" ? {
  1212. LDFLAGS+=-static-libubsan
  1213. }
  1214. "thread" ? {
  1215. PIE=yes
  1216. LDFLAGS+=-static-libtsan
  1217. }
  1218. }
  1219. }
  1220. when ($HARDENING == "yes") {
  1221. when ($CLANG) {
  1222. CFLAGS+=-fstack-protector-all -D_hardening_enabled_
  1223. LDFLAGS+=-z relro -z now -z noexecstack
  1224. PIE=yes
  1225. }
  1226. }
  1227. when ($USE_LTO == "yes") {
  1228. when ($GCC) {
  1229. CFLAGS+=-flto -fno-fat-lto-objects
  1230. LDFLAGS+=-flto
  1231. NO_LTO_CFLAGS=-fno-lto
  1232. }
  1233. when ($CLANG) {
  1234. CFLAGS+=-flto
  1235. LDFLAGS+=-flto
  1236. NO_LTO_CFLAGS=-fno-lto
  1237. }
  1238. }
  1239. when ($USE_THINLTO == "yes") {
  1240. when ($GCC) {
  1241. CFLAGS+=-flto=thin
  1242. LDFLAGS+=-flto=thin
  1243. NO_LTO_CFLAGS=-fno-lto
  1244. }
  1245. when ($CLANG) {
  1246. CFLAGS+=-flto=thin
  1247. LDFLAGS+=-flto=thin
  1248. NO_LTO_CFLAGS=-fno-lto
  1249. }
  1250. }
  1251. when ($CLANG) {
  1252. when ($PGO_ADD == "yes") {
  1253. CFLAGS+=-fprofile-instr-generate
  1254. LDFLAGS+=-fprofile-instr-generate
  1255. }
  1256. when ($PGO_PATH) {
  1257. CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
  1258. LDFLAGS+=-fprofile-instr-use=$PGO_PATH
  1259. }
  1260. }
  1261. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  1262. PEERDIR+=$COMPILER_PLATFORM
  1263. }
  1264. when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
  1265. PEERDIR+=contrib/libs/linux-headers
  1266. }
  1267. # Adding PEERDIR from trigger doesn't always work. In this case it
  1268. # cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl
  1269. # Workaround this issue by setting variable with PEERDIR in trigger
  1270. # and then adding PEERDIR to it's value unconditionally.
  1271. when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1272. _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14
  1273. }
  1274. otherwise {
  1275. _UBUNTU_COMPAT_PEERDIR=
  1276. }
  1277. PEERDIR+=$_UBUNTU_COMPAT_PEERDIR
  1278. when ($NORUNTIME != "yes") {
  1279. PEERDIR+=contrib/libs/cxxsupp
  1280. when ($MAPSMOBI_BUILD_TARGET == "yes") {
  1281. PEERDIR+=build/platform/mapkit
  1282. }
  1283. }
  1284. when ($NOUTIL != "yes") {
  1285. PEERDIR+=util
  1286. }
  1287. when ($MUSL == "yes") {
  1288. CFLAGS += -D_musl_
  1289. LINK_DYN_LIB_FLAGS += --musl
  1290. LINK_SCRIPT_EXE_FLAGS += --musl
  1291. PEERDIR+=contrib/libs/musl/include
  1292. }
  1293. # g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
  1294. # The same problem exists for clang toolchain. On the other hand, the problem
  1295. # doesn't affect cl since it has united C/C++ library and doesn't need
  1296. # proxy C-headers.
  1297. # Disable all C++ headers including proxy C-headers when we use libc++.
  1298. when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
  1299. CXXFLAGS += -nostdinc++
  1300. }
  1301. otherwise {
  1302. CFLAGS += -DUSE_STL_SYSTEM
  1303. }
  1304. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  1305. PEERDIR += build/external_resources/codenavigation
  1306. }
  1307. when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
  1308. CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
  1309. }
  1310. DEFAULT(USE_SSE4 yes)
  1311. when ($NOSSE != "yes") {
  1312. CFLAGS+=$SSE_CFLAGS
  1313. C_DEFINES+=$SSE_DEFINES
  1314. when ($USE_SSE4 == "yes") {
  1315. CFLAGS+=$SSE4_CFLAGS
  1316. C_DEFINES+=$SSE4_DEFINES
  1317. }
  1318. }
  1319. elsewhen ($MSVC != "yes") {
  1320. CFLAGS += -mno-sse
  1321. }
  1322. POPULATE_CPP_COVERAGE_FLAGS()
  1323. _REGISTER_NO_CHECK_IMPORTS()
  1324. DEFAULT(PACKAGE_PREFIX_ARGS)
  1325. DEFAULT(SWIG_LANG python)
  1326. DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
  1327. when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
  1328. PEERDIR+=build/platform/binutils
  1329. }
  1330. }
  1331. _LINKER_ID=
  1332. # GCC does not support -fuse-ld with an executable path,
  1333. # only -fuse-ld=gold or -fuse-ld=lld.
  1334. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1335. when ($_LINKER_ID in [ "gold", "lld" ]) {
  1336. PEERDIR+=build/platform/${_LINKER_ID}
  1337. }
  1338. }
  1339. macro _USE_LINKER_IMPL(LINKER_ID...) {
  1340. SET(_LINKER_ID $LINKER_ID)
  1341. }
  1342. macro _USE_LINKER() {
  1343. _USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
  1344. }
  1345. ### @usage: USE_LINKER_GOLD()
  1346. ### Use gold linker for a program. This doesn't work in libraries
  1347. macro USE_LINKER_GOLD() {
  1348. _USE_LINKER_IMPL(gold)
  1349. }
  1350. COMMON_LINK_SETTINGS=
  1351. LINK_ADDITIONAL_SECTIONS=
  1352. LINK_ADDITIONAL_SECTIONS_COMMAND=
  1353. when ($COMMON_LINK_SETTINGS == "yes") {
  1354. when ($_LINKER_ID == "lld" && ($OS_LINUX == "yes" || $OS_ANDROID == "yes")) {
  1355. LDFLAGS += -Wl,--gdb-index
  1356. }
  1357. when ($EMBED_LINKER_CREF == "yes") {
  1358. LDFLAGS+=-Wl,--cref ${tmp;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1359. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
  1360. }
  1361. elsewhen ($DUMP_LINKER_CREF == "yes") {
  1362. LDFLAGS+=-Wl,--cref ${output;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1363. }
  1364. when ($EMBED_LINKER_MAP == "yes") {
  1365. LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1366. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1367. }
  1368. elsewhen ($DUMP_LINKER_MAP == "yes") {
  1369. LDFLAGS+=-Wl,-Map=${output;rootrel;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1370. }
  1371. when ($USE_MKL == "yes") {
  1372. NOPLATFORM=yes
  1373. }
  1374. when (($USE_EAT_MY_DATA == "yes") && ($WIN32 != "yes") && ($DARWIN != "yes") && ($OS_ANDROID != "yes") && ($OS_IOS != "yes")) {
  1375. PEERDIR+=contrib/libs/libeatmydata/autocheck_wrapper
  1376. }
  1377. when ($USE_ARCADIA_LIBM == "yes") {
  1378. PEERDIR+=contrib/libs/libm
  1379. }
  1380. when ($USE_ARCADIA_LIBM == "no") {
  1381. C_SYSTEM_LIBRARIES+=-lm
  1382. }
  1383. when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
  1384. when ($ALLOCATOR in [ "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "J", "LF", "LF_YT", "LF_DBG", "B", "BM", "C", "LOCKLESS", "YT", "MIM", "HU", "PROFILED_HU" ]) {
  1385. PEERDIR+=library/cpp/malloc/system
  1386. }
  1387. }
  1388. otherwise {
  1389. select ($ALLOCATOR) {
  1390. "MIM" ? {
  1391. PEERDIR+=library/cpp/malloc/mimalloc
  1392. }
  1393. "HU" ? {
  1394. PEERDIR+=library/cpp/malloc/hu
  1395. }
  1396. "PROFILED_HU" ? {
  1397. PEERDIR+=library/cpp/malloc/profiled_hu
  1398. }
  1399. "TCMALLOC_256K" ? {
  1400. PEERDIR+=library/cpp/malloc/tcmalloc
  1401. PEERDIR+=contrib/libs/tcmalloc
  1402. }
  1403. "TCMALLOC_SMALL_BUT_SLOW" ? {
  1404. PEERDIR+=library/cpp/malloc/tcmalloc
  1405. PEERDIR+=contrib/libs/tcmalloc/small_but_slow
  1406. }
  1407. "TCMALLOC_NUMA_256K" ? {
  1408. PEERDIR+=library/cpp/malloc/tcmalloc
  1409. PEERDIR+=contrib/libs/tcmalloc/numa_256k
  1410. }
  1411. "TCMALLOC_NUMA_LARGE_PAGES" ? {
  1412. PEERDIR+=library/cpp/malloc/tcmalloc
  1413. PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
  1414. }
  1415. "TCMALLOC" ? {
  1416. PEERDIR+=library/cpp/malloc/tcmalloc
  1417. PEERDIR+=contrib/libs/tcmalloc/default
  1418. }
  1419. "TCMALLOC_TC" ? {
  1420. PEERDIR+=library/cpp/malloc/tcmalloc
  1421. PEERDIR+=contrib/libs/tcmalloc/no_percpu_cache
  1422. }
  1423. "GOOGLE" ? {
  1424. PEERDIR+=library/cpp/malloc/galloc
  1425. }
  1426. "J" ? {
  1427. when ($WIN32 == "yes") {
  1428. PEERDIR+=library/cpp/malloc/system
  1429. }
  1430. otherwise {
  1431. PEERDIR+=library/cpp/malloc/jemalloc
  1432. }
  1433. }
  1434. "LF" ? {
  1435. PEERDIR+=library/cpp/lfalloc
  1436. }
  1437. "LF_YT" ? {
  1438. PEERDIR+=library/cpp/lfalloc/yt
  1439. }
  1440. "LF_DBG" ? {
  1441. PEERDIR+=library/cpp/lfalloc/dbg
  1442. }
  1443. "B" ? {
  1444. PEERDIR+=library/cpp/balloc
  1445. }
  1446. "BM" ? {
  1447. PEERDIR+=library/cpp/balloc_market
  1448. }
  1449. "C" ? {
  1450. PEERDIR+=library/cpp/malloc/calloc
  1451. }
  1452. "LOCKLESS" ? {
  1453. PEERDIR+=library/cpp/malloc/lockless
  1454. }
  1455. "YT" ? {
  1456. PEERDIR+=library/cpp/ytalloc/impl
  1457. }
  1458. }
  1459. }
  1460. when ($ALLOCATOR == "SYSTEM") {
  1461. PEERDIR+=library/cpp/malloc/system
  1462. }
  1463. when ($WERROR != "no") {
  1464. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  1465. C_WARNING_OPTS += $WERROR_FLAG
  1466. }
  1467. }
  1468. when ($ICC == "yes") {
  1469. PEERDIR+=contrib/libs/intel/core
  1470. }
  1471. when ($WITH_VALGRIND == "yes") {
  1472. PEERDIR+=contrib/libs/valgrind
  1473. # https://st.yandex-team.ru/DTCC-122
  1474. CFLAGS+=-fdebug-default-version=4
  1475. }
  1476. }
  1477. when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
  1478. LINK_ADDITIONAL_SECTIONS_COMMAND+= \
  1479. $OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
  1480. }
  1481. _SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/:PEERS}
  1482. when ($OS_WINDOWS == "yes") {
  1483. _SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/:PEERS}
  1484. }
  1485. elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1486. _SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/:PEERS}
  1487. }
  1488. LINK_OR_COPY_SO_CMD=
  1489. RPATH_GLOBAL=
  1490. when ($SO_OUTPUTS == "yes") {
  1491. LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
  1492. LDFLAGS+=$RPATH_GLOBAL
  1493. }
  1494. # tag:restricted tag:DLL
  1495. ### $usage: WITH_DYNAMIC_LIBS() # restricted
  1496. ###
  1497. ### Include dynamic libraries as extra PROGRAM/DLL outputs
  1498. macro WITH_DYNAMIC_LIBS() {
  1499. ENABLE(SO_OUTPUTS)
  1500. }
  1501. # tag:internal
  1502. ### $usage: REAL_LINK_EXE_IMPL(peers...) # internal
  1503. macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1504. .CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1505. }
  1506. # tag:internal
  1507. ### $usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1508. macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1509. .CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
  1510. }
  1511. # tag:internal
  1512. ### $usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
  1513. macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1514. .CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
  1515. }
  1516. # tag:internal
  1517. ### $usage: LINK_EXE_IMPL(peers...) # internal
  1518. macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1519. .CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1520. }
  1521. # tag:internal
  1522. ### $usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1523. macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1524. .CMD=$LINK_EXEC_DYN_LIB_CMDLINE
  1525. }
  1526. # tag:internal
  1527. ### @usage: _LINK_UNIT # internal
  1528. ###
  1529. ### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
  1530. module _LINK_UNIT: _BASE_UNIT {
  1531. .EXTS=.o .obj .supp .tidyjson .ld
  1532. .CMD=LINK_EXE
  1533. .ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  1534. .NODE_TYPE=Program
  1535. .PEERDIR_POLICY=as_build_from
  1536. .FINAL_TARGET=yes
  1537. .DEFAULT_NAME_GENERATOR=DirName
  1538. .ARGS_PARSER=Base
  1539. DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
  1540. _USE_LINKER()
  1541. #link with libunwind manually
  1542. when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
  1543. PEERDIR += contrib/libs/cxxsupp
  1544. }
  1545. when ($USE_LIBCXXRT == "yes") {
  1546. PEERDIR += contrib/libs/cxxsupp/libcxxrt
  1547. }
  1548. when ($USE_DYNAMIC_CUDA == "yes") {
  1549. LINK_DYN_LIB_FLAGS += --dynamic-cuda
  1550. LINK_SCRIPT_EXE_FLAGS += --dynamic-cuda
  1551. }
  1552. ENABLE(COMMON_LINK_SETTINGS)
  1553. CHECK_PROVIDES()
  1554. }
  1555. MODULE_TYPE=UNKNOWN
  1556. macro ADD_CLANG_TIDY() {
  1557. ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy)
  1558. when ($TIDY_ENABLED == "yes") {
  1559. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json
  1560. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json
  1561. }
  1562. }
  1563. # tag:internal
  1564. ### @usage: _BASE_PROGRAM # internal
  1565. ###
  1566. ### The base of all programs. It adds dependencies to make final artefact complete and runnable.
  1567. module _BASE_PROGRAM: _LINK_UNIT {
  1568. .SYMLINK_POLICY=EXE
  1569. .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
  1570. .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1571. SET(MODULE_TYPE PROGRAM)
  1572. SET(MODULE_LANG CPP)
  1573. FORCE_COVERAGE_ENABLED=yes
  1574. when ($OS_IOS == "yes") {
  1575. EXTS+=.ios.interface
  1576. }
  1577. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  1578. MODULE_SUFFIX=.exe
  1579. }
  1580. when ($TIDY_ENABLED == "yes") {
  1581. MODULE_SUFFIX=.tidyjson
  1582. }
  1583. when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
  1584. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes" && $MUSL != "yes" && $SANITIZER_DEFINED != "yes" && $USE_THINLTO != "yes") {
  1585. PEERDIR+=contrib/libs/glibcasm
  1586. }
  1587. otherwise {
  1588. PEERDIR+=contrib/libs/asmlib
  1589. }
  1590. }
  1591. when ($MUSL == "yes") {
  1592. when ($MUSL_LITE == "yes") {
  1593. PEERDIR += contrib/libs/musl
  1594. }
  1595. otherwise {
  1596. PEERDIR += contrib/libs/musl/full
  1597. }
  1598. }
  1599. DEFAULT(CPU_CHECK yes)
  1600. when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
  1601. CPU_CHECK = no
  1602. }
  1603. when ($CPU_CHECK == "yes") {
  1604. PEERDIR += library/cpp/cpuid_check
  1605. }
  1606. when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
  1607. PEERDIR += library/cpp/execprofile/autostart
  1608. }
  1609. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1610. PEERDIR += contrib/libs/cxxsupp/libsan
  1611. when ($CLANG) {
  1612. select ($TARGET_PLATFORM) {
  1613. "LINUX" ? {
  1614. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/static
  1615. }
  1616. "DARWIN" ? {
  1617. # Memory sanitizer is not supported for darwin platform.
  1618. # https://clang.llvm.org/docs/MemorySanitizer.html#supported-platforms
  1619. when ($SANITIZER_TYPE != "memory") {
  1620. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/dynamic
  1621. }
  1622. }
  1623. default ? {
  1624. FATAL_ERROR_MESSAGE+=Unsupported platform for sanitizer
  1625. }
  1626. }
  1627. }
  1628. when ($SANITIZE_HEADERS && $SANITIZE_HEADERS != "no") {
  1629. PEERDIR += library/cpp/sanitizer/include
  1630. }
  1631. }
  1632. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1633. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1634. }
  1635. when ($IDE_MSVS == "yes") {
  1636. PEERDIR+=build/scripts/c_templates
  1637. }
  1638. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1639. LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1640. }
  1641. }
  1642. VCS_INFO_SEM=vcs_info ${input;hide:"build/scripts/vcs_info.py"} ${input;hide:"build/scripts/c_templates/svn_interface.c"} ${input;hide:"build/scripts/c_templates/svnversion.h"}
  1643. CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  1644. && ${VCS_INFO_SEM} \
  1645. && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE \
  1646. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1647. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1648. && target_compile_options PRIVATE $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  1649. ### @usage: PROGRAM([progname])
  1650. ###
  1651. ### Regular program module.
  1652. ### If name is not specified it will be generated from the name of the containing project directory.
  1653. module PROGRAM: _BASE_PROGRAM {
  1654. .SEM=CPP_PROGRAM_SEM
  1655. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1656. ADD_CLANG_TIDY()
  1657. }
  1658. # tag:python-specific tag:deprecated tag:internal
  1659. module _PY2_PROGRAM: _BASE_PY_PROGRAM {
  1660. SET(MODULE_LANG PY2)
  1661. # Looks like we cannot avoid copy-paste util ymake supports multiple inheritance
  1662. # We need to attach coverage.extractor to every py_program target, except pytest targets
  1663. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1664. }
  1665. # tag:python-specific tag:deprecated
  1666. ### @usage: PY2_PROGRAM([progname]) # deprecated
  1667. ###
  1668. ### Deprecated. Use PY3_PROGRAM instead.
  1669. ### Python 2.x binary program. Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  1670. ### If name is not specified it will be generated from the name of the containing project directory.
  1671. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  1672. ###
  1673. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1674. module PY2_PROGRAM: _PY2_PROGRAM {
  1675. .RESTRICTED=STYLE_PYTHON
  1676. when ($FAIL_PY2 == "yes") {
  1677. _OK=no
  1678. }
  1679. elsewhen ($OPENSOURCE != "yes") {
  1680. PEERDIR+=build/rules/py2_deprecation
  1681. }
  1682. ASSERT(_OK You are using deprecated Python2-only code (PY2_PROGRAM). Please consider rewriting to Python 3.)
  1683. }
  1684. # tag:python-specific
  1685. ### @usage: NO_EXTENDED_SOURCE_SEARCH()
  1686. ###
  1687. ### Prevent module using in extended python source search.
  1688. ### Use the macro if module contains python2-only files (or other python sources which shouldn't be imported by python3 interpreter)
  1689. ### which resides in the same directories with python 3 useful code. contrib/python/future is a example.
  1690. ### Anyway, preferred way is to move such files into separate dir and don't use this macro at all.
  1691. ###
  1692. ### Also see: https://docs.yandex-team.ru/ya-make/manual/python/vars#y_python_extended_source_search for details
  1693. macro NO_EXTENDED_SOURCE_SEARCH() {
  1694. SET(NO_EXTENDED_SOURCE_SEARCH yes)
  1695. }
  1696. # tag:python-specific
  1697. ### @usage: PY3_PROGRAM([progname])
  1698. ###
  1699. ### Python 3.x binary program. Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  1700. ### If name is not specified it will be generated from the name of the containing project directory.
  1701. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules.
  1702. ###
  1703. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1704. multimodule PY3_PROGRAM {
  1705. module PY3_BIN: PY3_PROGRAM_BIN {
  1706. .PEERDIRSELF=PY3_BIN_LIB
  1707. .IGNORED=RESOURCE RESOURCE_FILES PEERDIR TASKLET_REG RUN_ANTLR4_PYTHON BUILDWITH_CYTHON_CPP _BUILDWITH_CYTHON_CPP_DEP _BUILDWITH_CYTHON_CPP_H BUILDWITH_CYTHON_C _BUILDWITH_CYTHON_C_DEP _BUILDWITH_CYTHON_C_H _BUILDWITH_CYTHON_C_API_H
  1708. # Notify pybuild to skip almost all PY_SRCS arguments except MAIN
  1709. ENABLE(PROCESS_PY_MAIN_ONLY)
  1710. _PY_PROGRAM()
  1711. NO_CLANG_TIDY()
  1712. }
  1713. module PY3_BIN_LIB: PY3_LIBRARY {
  1714. .IGNORED=RESTRICT_LICENSES
  1715. # Notify pybuild to skip all python main function definitions
  1716. ENABLE(IGNORE_PY_MAIN)
  1717. _REQUIRE_EXPLICIT_LICENSE()
  1718. NO_CLANG_TIDY()
  1719. }
  1720. }
  1721. ### @usage: EXPORTS_SCRIPT(exports_file)
  1722. ###
  1723. ### Specify exports script within PROGRAM, DLL and DLL-derived modules.
  1724. ### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
  1725. ### The other option use EXPORTS parameter of the DLL module itself.
  1726. ###
  1727. ### @see: [DLL](#module_DLL)
  1728. macro EXPORTS_SCRIPT(Arg) {
  1729. SET(EXPORTS_FILE $Arg)
  1730. }
  1731. ### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
  1732. ###
  1733. ### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
  1734. macro NO_EXPORT_DYNAMIC_SYMBOLS() {
  1735. ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
  1736. }
  1737. ### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
  1738. ###
  1739. ### Export all non-hidden symbols as dynamic when linking a PROGRAM.
  1740. macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
  1741. # Dummy: default behaviour
  1742. ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
  1743. }
  1744. ### @usage: USE_DYNAMIC_CUDA()
  1745. ###
  1746. ### Enable linking of PROGRAM with dynamic CUDA. By default CUDA uses static linking
  1747. macro USE_DYNAMIC_CUDA() {
  1748. LDFLAGS(-Wl,-rpath,$ORIGIN)
  1749. ENABLE(USE_DYNAMIC_CUDA)
  1750. }
  1751. ### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
  1752. ###
  1753. ### Specifies name of a script for custom link step. The scripts
  1754. ### should be placed in the build/scripts directory and are subject to
  1755. ### review by devtools@.
  1756. macro CUSTOM_LINK_STEP_SCRIPT(Name) {
  1757. SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
  1758. }
  1759. ### @usage: _BASE_UNITTEST # internal
  1760. ###
  1761. ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
  1762. module _BASE_UNITTEST: _BASE_PROGRAM {
  1763. .FINAL_TARGET=no
  1764. .NODE_TYPE=Program
  1765. .ALLOWED=YT_SPEC
  1766. when ($UT_SKIP_EXCEPTIONS == "yes") {
  1767. C_DEFINES+=-DUT_SKIP_EXCEPTIONS
  1768. }
  1769. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1770. }
  1771. _TEST_SPLIT_FACTOR_SEM=1
  1772. _TEST_TIMEOUT_SEM=
  1773. _TEST_PARTITION_SEM=
  1774. UNITTEST_SEM=$CPP_PROGRAM_SEM \
  1775. && set_property TARGET $REALPRJNAME PROPERTY SPLIT_FACTOR $_TEST_SPLIT_FACTOR_SEM \
  1776. $_TEST_PARTITION_SEM \
  1777. && add_yunittest NAME $REALPRJNAME TEST_TARGET $REALPRJNAME TEST_ARG --print-before-suite --print-before-test --fork-tests --print-times --show-fails \
  1778. && set_yunittest_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1779. && add_ytest_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1780. $_TEST_TIMEOUT_SEM
  1781. # tag:test
  1782. ### @usage: UNITTEST([name])
  1783. ###
  1784. ### Unit test module based on library/cpp/testing/unittest.
  1785. ### It is recommended not to specify the name.
  1786. ###
  1787. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
  1788. module UNITTEST: _BASE_UNITTEST {
  1789. .SEM=UNITTEST_SEM
  1790. .DEFAULT_NAME_GENERATOR=FullPath
  1791. .ARGS_PARSER=Base
  1792. PEERDIR(library/cpp/testing/unittest_main)
  1793. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1794. when ($TEST_FORK_MODE != "none") {
  1795. when ($TEST_SPLIT_FACTOR) {
  1796. _TEST_SPLIT_FACTOR_SEM=$TEST_SPLIT_FACTOR
  1797. }
  1798. otherwise {
  1799. _TEST_SPLIT_FACTOR_SEM=10
  1800. }
  1801. when ($TEST_PARTITION == "MODULO") {
  1802. _TEST_PARTITION_SEM=&& set_property TARGET $REALPRJNAME PROPERTY SPLIT_TYPE $TEST_PARTITION \
  1803. }
  1804. }
  1805. when ($TEST_TIMEOUT) {
  1806. _TEST_TIMEOUT_SEM=&& set_yunittest_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1807. }
  1808. }
  1809. # tag:yt-specific tag:test
  1810. ### @usage: YT_UNITTEST([name])
  1811. ###
  1812. ### YT Unit test module based on library/cpp/testing/unittest with NYT::Initialize hook
  1813. module YT_UNITTEST: _BASE_UNITTEST {
  1814. PEERDIR(library/cpp/testing/unittest_main mapreduce/yt/tests/yt_initialize_hook)
  1815. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1816. }
  1817. # tag:test
  1818. ### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
  1819. ###
  1820. ### Generic unit test module.
  1821. module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
  1822. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1823. }
  1824. GTEST_SEM=$CPP_PROGRAM_SEM \
  1825. && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
  1826. && set_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1827. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1828. $_TEST_TIMEOUT_SEM
  1829. # tag:cpp-specific tag:test
  1830. ### @usage: GTEST([name])
  1831. ###
  1832. ### Unit test module based on library/cpp/testing/gtest.
  1833. ### It is recommended not to specify the name.
  1834. ###
  1835. ### Documentation: https://docs.yandex-team.ru/arcadia-cpp/cpp_test
  1836. module GTEST: _BASE_UNITTEST {
  1837. .SEM=GTEST_SEM
  1838. .DEFAULT_NAME_GENERATOR=FullPath
  1839. .ARGS_PARSER=Base
  1840. PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
  1841. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
  1842. when ($TEST_TIMEOUT) {
  1843. _TEST_TIMEOUT_SEM=&& set_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1844. }
  1845. }
  1846. USE_AFL=no
  1847. # tag:fuzzing
  1848. ### @usage: FUZZ()
  1849. ###
  1850. ### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
  1851. ### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
  1852. ### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
  1853. ###
  1854. ### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
  1855. ###
  1856. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1857. module FUZZ: _BASE_PROGRAM {
  1858. .NODE_TYPE=Program
  1859. .FINAL_TARGET=no
  1860. .ALLOWED=FUZZ_DICTS FUZZ_OPTS
  1861. SET(LIBFUZZER_PATH contrib/libs/libfuzzer)
  1862. when ($USE_AFL == "no") {
  1863. PEERDIR+=$LIBFUZZER_PATH
  1864. }
  1865. when ($USE_AFL == "yes") {
  1866. PEERDIR+=$LIBFUZZER_PATH/afl
  1867. }
  1868. when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
  1869. PEERDIR+=devtools/nofuzz
  1870. }
  1871. ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
  1872. }
  1873. # tag:ios-specific
  1874. PACK_IOS_CMD=
  1875. when ($OS_IOS && $BUILD_IOS_APP) {
  1876. PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
  1877. }
  1878. LINK_BOOSTTEST_CMD=
  1879. BOOST_TEST_TYPE_STRING=
  1880. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1881. LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
  1882. BOOST_TEST_TYPE_STRING=no.test
  1883. }
  1884. otherwise {
  1885. LINK_BOOSTTEST_CMD=$LINK_EXE
  1886. BOOST_TEST_TYPE_STRING=boost.test
  1887. }
  1888. # tag:deprecated
  1889. ### @usage: BOOSTTEST([name]) #deprecated
  1890. ###
  1891. ### Test module based on boost/test/unit_test.hpp.
  1892. ### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
  1893. ### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
  1894. module BOOSTTEST: _BASE_PROGRAM {
  1895. .NODE_TYPE=Program
  1896. .FINAL_TARGET=no
  1897. .CMD=LINK_BOOSTTEST_CMD
  1898. PEERDIR(library/cpp/testing/boost_test)
  1899. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1900. MODULE_SUFFIX=.a
  1901. }
  1902. elsewhen ($OS_IOS && $BUILD_IOS_APP) {
  1903. PEERDIR+=devtools/boosttest_ios_wrapper/library
  1904. MODULE_SUFFIX=.ios.tar
  1905. }
  1906. ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
  1907. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1908. }
  1909. # tag:deprecated
  1910. ### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated
  1911. ###
  1912. ### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
  1913. module BOOSTTEST_WITH_MAIN: BOOSTTEST {
  1914. PEERDIR(library/cpp/testing/boost_test_main)
  1915. }
  1916. FUZZ_DICTS_VALUE=
  1917. ### @usage: FUZZ_DICTS(path1 [path2...])
  1918. ###
  1919. ### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
  1920. ### Libfuzzer and AFL use a single syntax for dictionary descriptions.
  1921. ### Should only be used in FUZZ modules.
  1922. ###
  1923. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1924. macro FUZZ_DICTS(Data...) {
  1925. SET_APPEND(FUZZ_DICTS_VALUE $Data)
  1926. }
  1927. FUZZ_OPTS_VALUE=
  1928. ### @usage: FUZZ_OPTS(opt1 [Opt2...])
  1929. ###
  1930. ### Overrides or adds options to the corpus mining and fuzzer run.
  1931. ### Currently supported only Libfuzzer, so you should use the options for it.
  1932. ### Should only be used in FUZZ modules.
  1933. ###
  1934. ### @example:
  1935. ###
  1936. ### FUZZ_OPTS (
  1937. ### -max_len=1024
  1938. ### -rss_limit_mb=8192
  1939. ### )
  1940. ###
  1941. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1942. macro FUZZ_OPTS(Data...) {
  1943. SET_APPEND(FUZZ_OPTS_VALUE $Data)
  1944. }
  1945. # tag:yt-specific tag:test
  1946. TEST_YT_SPEC_VALUE=
  1947. ### @usage: YT_SPEC(path1 [path2...])
  1948. ###
  1949. ### Allows you to specify json-files with YT task and operation specs,
  1950. ### which will be used to run test node in the YT.
  1951. ### Test must be marked with ya:yt tag.
  1952. ### Files must be relative to the root of Arcadia.
  1953. ###
  1954. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1955. macro YT_SPEC(Data...) {
  1956. SET_APPEND(TEST_YT_SPEC_VALUE $Data)
  1957. }
  1958. # tag:test
  1959. TEST_SRCS_VALUE=
  1960. ### @usage: TEST_SRCS(Files...)
  1961. ###
  1962. ### 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.
  1963. ###
  1964. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1965. macro TEST_SRCS(Tests...) {
  1966. SET_APPEND(TEST_SRCS_VALUE $Tests)
  1967. }
  1968. macro DISABLE_DATA_VALIDATION() {
  1969. DISABLE(VALIDATE_DATA)
  1970. }
  1971. # tag:test
  1972. TEST_DATA_VALUE=
  1973. ### @usage: DATA([path...])
  1974. ###
  1975. ### Specifies the path to the data necessary test.
  1976. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
  1977. ### In the latter case resource will be brought to the working directory of the test before it is started
  1978. ###
  1979. ### Used only inside TEST modules.
  1980. ###
  1981. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1982. macro DATA(Data...) {
  1983. SET_APPEND(TEST_DATA_VALUE $Data)
  1984. ADD_CHECK(check.data $Data)
  1985. }
  1986. # tag:test
  1987. ### @usage: DATA_FILES([path...])
  1988. ###
  1989. ### Specifies the path to the arcadia source data necessary test.
  1990. ### Used only inside TEST modules.
  1991. ###
  1992. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1993. macro DATA_FILES(Paths...) {
  1994. SET_APPEND(TEST_DATA_VALUE ${pre=arcadia/:Paths})
  1995. _DATA_FILES($Paths)
  1996. }
  1997. # tag:test
  1998. ### @usage: EXPLICIT_DATA()
  1999. ###
  2000. ### Disables implicit macro DATA(<module_path>).
  2001. ADD_SRCDIR_TO_TEST_DATA=yes
  2002. macro EXPLICIT_DATA() {
  2003. SET(ADD_SRCDIR_TO_TEST_DATA no)
  2004. }
  2005. # tag:test
  2006. TEST_TAGS_VALUE=
  2007. ### @usage: TAG ([tag...])
  2008. ###
  2009. ### Each test can have one or more tags used to filter tests list for running.
  2010. ### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
  2011. ###
  2012. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
  2013. macro TAG(Tags...) {
  2014. SET_APPEND(TEST_TAGS_VALUE $Tags)
  2015. }
  2016. # tag:test
  2017. TEST_REQUIREMENTS_VALUE=
  2018. ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
  2019. ###
  2020. ### Allows you to specify the requirements of the test.
  2021. ###
  2022. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2023. macro REQUIREMENTS(Tags...) {
  2024. SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
  2025. }
  2026. # tag:test
  2027. TEST_ENV_VALUE=
  2028. ### @usage: ENV(key[=value])
  2029. ###
  2030. ### Sets env variable key to value (gets value from system env by default).
  2031. macro ENV(Data...) {
  2032. SET_APPEND(TEST_ENV_VALUE ${quo:Data})
  2033. }
  2034. ### @usage: CONFTEST_LOAD_POLICY_LOCAL()
  2035. ###
  2036. ### Loads conftest.py files in a way that pytest does it
  2037. macro CONFTEST_LOAD_POLICY_LOCAL() {
  2038. SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
  2039. }
  2040. # tag:test
  2041. TEST_RECIPES_VALUE=
  2042. ### @usage: USE_RECIPE(path [arg1 arg2...])
  2043. ###
  2044. ### Provides prepared environment via recipe for test.
  2045. ###
  2046. ### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
  2047. macro USE_RECIPE(Data...) {
  2048. SET_APPEND(TEST_RECIPES_VALUE $Data)
  2049. SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
  2050. }
  2051. # tag:python-specific tag:test
  2052. TEST_PYTHON_PATH_VALUE=
  2053. # tag:python-specific tag:test
  2054. ### @usage: PYTHON_PATH(Path)
  2055. ###
  2056. ### Set path to Python that will be used to runs scripts in tests
  2057. macro PYTHON_PATH(Path) {
  2058. SET(TEST_PYTHON_PATH_VALUE $Path)
  2059. }
  2060. # tag:test
  2061. SKIP_TEST_VALUE=
  2062. ### @usage: SKIP_TEST(Reason)
  2063. ###
  2064. ### Skip the suite defined by test module. Provide a reason to be output in test execution report.
  2065. macro SKIP_TEST(Reason...) {
  2066. SET(SKIP_TEST_VALUE $Reason)
  2067. }
  2068. # tag:test
  2069. LINT_LEVEL_VALUE=extended
  2070. _NO_LINT_VALUE=
  2071. ### @usage: NO_LINT([ktlint])
  2072. ###
  2073. ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
  2074. ### Ktlint can be disabled using NO_LINT(ktlint) explicitly.
  2075. macro NO_LINT(ktlint?"ktlint":"none") {
  2076. SET(_NO_LINT_VALUE ${ktlint})
  2077. }
  2078. ### @usage: LINT(<none|base|strict>)
  2079. ###
  2080. ### Set linting level for sources of the module
  2081. macro LINT(level) {
  2082. SET(LINT_LEVEL_VALUE $level)
  2083. }
  2084. # tag:python-specific tag:test
  2085. STYLE_PYTHON_VALUE=no
  2086. STYLE_PYTHON_PYPROJECT_VALUE=
  2087. ### @usage: STYLE_PYTHON([pyproject])
  2088. ###
  2089. ### Check python3 sources for style issues using black.
  2090. macro STYLE_PYTHON(pyproject...) {
  2091. SET(STYLE_PYTHON_VALUE yes)
  2092. SET(STYLE_PYTHON_PYPROJECT_VALUE ${pyproject})
  2093. }
  2094. # tag:python-specific tag:test
  2095. ### @usage: NO_DOCTESTS()
  2096. ###
  2097. ### Disable doctests in PY[|3|23_]TEST
  2098. macro NO_DOCTESTS() {
  2099. ENV(YA_PYTEST_DISABLE_DOCTEST="yes")
  2100. }
  2101. # tag:python-specific tag:test
  2102. ### @usage: _BASE_PYTEST # internal
  2103. ###
  2104. ### Base logic of Python 2.x py.test modules: common module properties and dependencies.
  2105. module _BASE_PYTEST: _BASE_PY_PROGRAM {
  2106. .NODE_TYPE=Program
  2107. .FINAL_TARGET=no
  2108. .ALLOWED=YT_SPEC NO_DOCTESTS
  2109. when ($USE_ARCADIA_PYTHON == "yes") {
  2110. PEERDIR+=library/python/pytest
  2111. }
  2112. when ($USE_ARCADIA_PYTHON == "no") {
  2113. MODULE_SUFFIX=.pkg.fake
  2114. PEERDIR+=library/python/pytest/empty
  2115. }
  2116. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2117. }
  2118. # tag:python-specific tag:deprecated tag:test
  2119. ### @usage: PYTEST_BIN() #deprecated
  2120. ###
  2121. ### Same as PY2TEST. Don't use this, use PY2TEST instead.
  2122. module PYTEST_BIN: _BASE_PYTEST {
  2123. .NODE_TYPE=Program
  2124. .DEFAULT_NAME_GENERATOR=FullPath
  2125. .ARGS_PARSER=Base
  2126. SETUP_PYTEST_BIN()
  2127. }
  2128. # tag:python-specific tag:test
  2129. ### @usage: PY2TEST([name])
  2130. ###
  2131. ### The test module for Python 2.x based on py.test
  2132. ###
  2133. ### This module is compatible only with PYTHON2-tagged modules and selects peers from multimodules accordingly.
  2134. ### This module is compatible with non-Arcadia Python builds.
  2135. ###
  2136. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#python
  2137. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2138. module PY2TEST: PYTEST_BIN {
  2139. .RESTRICTED=STYLE_PYTHON
  2140. .DEFAULT_NAME_GENERATOR=FullPath
  2141. .ARGS_PARSER=Base
  2142. when ($FAIL_PY2 == "yes") {
  2143. _OK=no
  2144. }
  2145. elsewhen ($OPENSOURCE != "yes") {
  2146. PEERDIR+=build/rules/py2_deprecation
  2147. }
  2148. SET(MODULE_LANG PY2)
  2149. ASSERT(_OK You are using deprecated Python2-only code (PY2TEST). Please consider rewriting to Python 3.)
  2150. }
  2151. # tag:python-specific tag:deprecated tag:test
  2152. ### @usage: PY3TEST_BIN() #deprecated
  2153. ###
  2154. ### Same as PY3TEST. Don't use this, use PY3TEST instead.
  2155. module PY3TEST_BIN: _BASE_PY3_PROGRAM {
  2156. .NODE_TYPE=Program
  2157. .FINAL_TARGET=no
  2158. .ALLOWED=YT_SPEC NO_DOCTESTS
  2159. .DEFAULT_NAME_GENERATOR=FullPath
  2160. .ARGS_PARSER=Base
  2161. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2162. SET(MODULE_LANG PY3)
  2163. SETUP_PYTEST_BIN()
  2164. PEERDIR+=library/python/pytest
  2165. }
  2166. # tag:python-specific tag:test
  2167. ### Disable submodules with the specified name(s).
  2168. ### Unlike EXCLUDE_TAGS this variable:
  2169. ### - affects all projects in the build;
  2170. ### - filter by module name and ignore MODULE_TAG.
  2171. EXCLUDE_SUBMODULES=PY3TEST_LIBRARY
  2172. # tag:python-specific tag:test
  2173. ### @usage: PY3TEST([name])
  2174. ###
  2175. ### The test module for Python 3.x based on py.test
  2176. ###
  2177. ### This module is compatible only with PYTHON3-tagged modules and selects peers from multimodules accordingly.
  2178. ### This module is only compatible with Arcadia Python build (to avoid tests duplication from Python2/3-tests). For non-Arcadia python use PYTEST.
  2179. ###
  2180. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  2181. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2182. multimodule PY3TEST {
  2183. module PY3TEST_PROGRAM: PY3TEST_BIN {
  2184. .IGNORED=RUN_ANTLR4_PYTHON
  2185. .FINAL_TARGET=yes
  2186. }
  2187. module PY3TEST_LIBRARY: PY3_LIBRARY {
  2188. PEERDIR+=library/python/pytest
  2189. _REQUIRE_EXPLICIT_LICENSE()
  2190. }
  2191. }
  2192. # tag:cpp-specific tag:test
  2193. module CPP_STYLE_TEST_14: PY3TEST_BIN {
  2194. DEPENDS(contrib/libs/clang14/tools/clang-format)
  2195. PEERDIR+=library/python/cpp_test
  2196. }
  2197. macro STYLE(Globs...) {
  2198. _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
  2199. _STYLE(${STYLE_SRCS_GLOB})
  2200. }
  2201. # tag:cpp-specific tag:deprecated tag:test
  2202. ### @usage: GTEST_UGLY([name])
  2203. ###
  2204. ### Deprecated, do not use in new projects. Use GTEST instead.
  2205. ###
  2206. ### The test module based on gtest (contrib/libs/gtest contrib/libs/gmock).
  2207. ### Use public documentation on gtest for details.
  2208. ###
  2209. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2210. module GTEST_UGLY: _BASE_PROGRAM {
  2211. .NODE_TYPE=Program
  2212. .FINAL_TARGET=no
  2213. PEERDIR(contrib/restricted/googletest/googlemock contrib/restricted/googletest/googletest)
  2214. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gtest)
  2215. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2216. }
  2217. # tag:test
  2218. ### @usage: EXECTEST()
  2219. ###
  2220. ### Module definition of generic test that executes a binary.
  2221. ### Use macro RUN to specify binary to run.
  2222. ###
  2223. ### @example:
  2224. ###
  2225. ### EXECTEST()
  2226. ### OWNER(g:yatool)
  2227. ###
  2228. ### RUN(
  2229. ### cat input.txt
  2230. ### )
  2231. ### DATA(
  2232. ### arcadia/devtools/ya/test/tests/exectest/data
  2233. ### )
  2234. ### DEPENDS(
  2235. ### devtools/dummy_arcadia/cat
  2236. ### )
  2237. ### TEST_CWD(devtools/ya/test/tests/exectest/data)
  2238. ### END()
  2239. ###
  2240. ### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
  2241. ###
  2242. ### @see: [RUN()](#macro_RUN)
  2243. module EXECTEST: _BARE_UNIT {
  2244. .NODE_TYPE=Program
  2245. .FINAL_TARGET=no
  2246. .ALLOWED=YT_SPEC
  2247. .RESTRICTED=FORK_TEST_FILES
  2248. .DEFAULT_NAME_GENERATOR=FullPath
  2249. .ARGS_PARSER=Base
  2250. SET(MODULE_SUFFIX .pkg.fake)
  2251. SETUP_EXECTEST()
  2252. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2253. }
  2254. # tag:cpp-specific tag:test
  2255. ### @usage: Y_BENCHMARK([benchmarkname])
  2256. ###
  2257. ### Benchmark test based on the library/cpp/testing/benchmark.
  2258. ###
  2259. ### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
  2260. module Y_BENCHMARK: PROGRAM {
  2261. .SEM=CPP_PROGRAM_SEM
  2262. PEERDIR(library/cpp/testing/benchmark/main)
  2263. }
  2264. GBENCH_SEM=$CPP_PROGRAM_SEM \
  2265. && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
  2266. && set_property TEST $REALPRJNAME PROPERTY LABELS SMALL $FILTER_ONLY_TEST_TAGS \
  2267. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  2268. $_TEST_TIMEOUT_SEM
  2269. # tag:cpp-specific tag:test
  2270. ### @usage: G_BENCHMARK([benchmarkname])
  2271. ###
  2272. ### Benchmark test based on the google benchmark.
  2273. ###
  2274. ### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
  2275. module G_BENCHMARK: _BASE_PROGRAM {
  2276. .SEM=GBENCH_SEM
  2277. PEERDIR(library/cpp/testing/gbenchmark)
  2278. ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
  2279. }
  2280. # tag:test
  2281. TEST_ROOT=$(TESTS_DATA_ROOT)
  2282. RESULT_MAX_FILE=0
  2283. STRIP_FILES=--dont-strip-files
  2284. VERIFY_RESULTS=--verify-results
  2285. ADDITIONAL_PATH=
  2286. # set for tests variables to fill it by YA_DEV or YA
  2287. YA_ROOT=ya
  2288. when ($YA_DEV == "yes") {
  2289. YA_ROOT=ya-dev
  2290. }
  2291. # tag:test
  2292. ### @usage: UNITTEST_FOR(path/to/lib)
  2293. ###
  2294. ### Convenience extension of UNITTEST module.
  2295. ### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
  2296. ### path/to/lib is the path to the directory with the LIBRARY project.
  2297. ###
  2298. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2299. module UNITTEST_FOR: UNITTEST {
  2300. .SEM=UNITTEST_SEM
  2301. PEERDIR(ADDINCL $UNITTEST_DIR)
  2302. SRCDIR($UNITTEST_DIR)
  2303. }
  2304. ### @usage: _LIBRARY # internal
  2305. ###
  2306. ### Base module definition for all libraries.
  2307. ### Contains basic logic like module properties, default variable values etc.
  2308. ### All libraries similar to C++-libraries should be inherited from it.
  2309. module _LIBRARY: _BASE_UNIT {
  2310. .CMD=LINK_LIB
  2311. .NODE_TYPE=Library
  2312. .PEERDIR_POLICY=as_include
  2313. .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
  2314. .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  2315. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2316. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
  2317. .FINAL_TARGET=no
  2318. .GLOBAL_CMD=GLOBAL_LINK_LIB
  2319. .GLOBAL_EXTS=.o .obj .tidyjson
  2320. GLOBAL_SUFFIX=.global$MODULE_SUFFIX
  2321. #TODO: Remove this hack (really we do not need add fake src at all)
  2322. ENABLE(NEED_ADD_FAKE_SRC)
  2323. _REQUIRE_EXPLICIT_LICENSE(contrib/deprecated contrib/libs contrib/restricted contrib/python)
  2324. CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
  2325. when ($USE_MKL == "yes") {
  2326. NOPLATFORM=yes
  2327. }
  2328. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2329. MODULE_PREFIX=
  2330. MODULE_SUFFIX=.lib
  2331. }
  2332. otherwise {
  2333. when ($TIDY_ENABLED == "yes") {
  2334. MODULE_PREFIX=
  2335. MODULE_SUFFIX=.tidyjson
  2336. }
  2337. otherwise {
  2338. MODULE_PREFIX=lib
  2339. MODULE_SUFFIX=.a
  2340. }
  2341. }
  2342. when ($WERROR != "no") {
  2343. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  2344. C_WARNING_OPTS += $WERROR_FLAG
  2345. }
  2346. }
  2347. when ($WITH_VALGRIND == "yes") {
  2348. PEERDIR+=contrib/libs/valgrind
  2349. # https://st.yandex-team.ru/DTCC-1227
  2350. CFLAGS+=-fdebug-default-version=4
  2351. }
  2352. when ($USE_ARCADIA_LIBM == "yes") {
  2353. PEERDIR+=contrib/libs/libm
  2354. }
  2355. }
  2356. CPP_LIBRARY_INDUCED_SEM_PROPERTY=consumer_link_library
  2357. CPP_LIBRARY_SEM=add_library ${MODDIR} $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  2358. && library_fake_marker FAKE_MODULE ${FAKE_MODULE} \
  2359. && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET \
  2360. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2361. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2362. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2363. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  2364. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW \
  2365. && add_language C && add_language CXX
  2366. CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:CMAKE_TARGET_NAME} $CMAKE_TARGET_NAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
  2367. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2368. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2369. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2370. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  2371. CMAKE_FIND_PKG=
  2372. CMAKE_LINK_TARGET=$REALPRJNAME
  2373. CMAKE_FIND_PKG_COMP=
  2374. CONAN_REQUIRE=
  2375. CONAN_OPTS_SEM=
  2376. ### @usage: LIBRARY()
  2377. ###
  2378. ### The regular static library module.
  2379. ###
  2380. ### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
  2381. ### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
  2382. ###
  2383. ### This is C++ library, and it selects peers from multimodules accordingly.
  2384. ###
  2385. ### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
  2386. ### In order to use library in tests PEERDIR it to link into tests.
  2387. ### If you think you need to distribute static library please contact devtools@ for assistance.
  2388. module LIBRARY: _LIBRARY {
  2389. .GLOBAL=_AARS _PROGUARD_RULES
  2390. .SEM=CPP_LIBRARY_SEM
  2391. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  2392. .DEFAULT_NAME_GENERATOR=ThreeDirNames
  2393. .ARGS_PARSER=Base
  2394. when ($CMAKE_PACKAGE_COMPONENT != "") {
  2395. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  2396. }
  2397. when ($CMAKE_PACKAGE != "") {
  2398. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  2399. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2400. }
  2401. when ($CONAN_REFERENCE != "") {
  2402. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  2403. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2404. }
  2405. when ($CONAN_PKG_OPTS != "") {
  2406. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  2407. }
  2408. when ($OPENSOURCE_EXPORT == "no") {
  2409. CPP_LIBRARY_SEM=IGNORED
  2410. }
  2411. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no" && $SANITIZE_HEADERS && $SANITIZE_HEADERS != "no") {
  2412. PEERDIR += library/cpp/sanitizer/include
  2413. }
  2414. when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
  2415. PEERDIR+=$CPP_PROTOBUF_PEERS
  2416. }
  2417. SET(MODULE_TYPE LIBRARY)
  2418. SET(MODULE_LANG CPP)
  2419. ADD_CLANG_TIDY()
  2420. }
  2421. # tag:internal
  2422. ### @usage: _BARE_MODULE() # internal
  2423. ###
  2424. ### Remove unwanted dependencies for "empty" library module
  2425. macro _BARE_MODULE() {
  2426. SET(NEED_PLATFORM_PEERDIRS no)
  2427. SET(PEERDIR_TEST_TOOL no)
  2428. DISABLE(WITH_VALGRIND)
  2429. NO_CODENAVIGATION()
  2430. NO_PLATFORM()
  2431. NO_RUNTIME()
  2432. NO_UTIL()
  2433. NO_CLANG_TIDY()
  2434. }
  2435. # tag:internal
  2436. ### @usage: _BARE_LINK_MODULE() # internal
  2437. ###
  2438. ### Remove unwanted dependencies for "empty" link module
  2439. macro _BARE_LINK_MODULE() {
  2440. _BARE_MODULE()
  2441. DISABLE(COMMON_LINK_SETTINGS)
  2442. ALLOCATOR(FAKE)
  2443. }
  2444. # tag:internal
  2445. ### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
  2446. ###
  2447. ### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
  2448. ### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
  2449. macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
  2450. SRCS($USE_CONDITIONAL_SRCS)
  2451. }
  2452. # XXX: dirty hack for correct LDFLAGS passing
  2453. RESOURCES_LIBRARY_LINK=$TOUCH_UNIT
  2454. RESOURCES_LIBRARY_SEM=IGNORED
  2455. ### @usage: RESOURCES_LIBRARY()
  2456. ###
  2457. ### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
  2458. ### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
  2459. ###
  2460. ### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
  2461. module RESOURCES_LIBRARY: _BARE_UNIT {
  2462. .CMD=RESOURCES_LIBRARY_LINK
  2463. .SEM=RESOURCES_LIBRARY_SEM
  2464. .ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
  2465. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS PEERDIR SPLIT_DWARF
  2466. .NODE_TYPE=Library
  2467. .PEERDIR_POLICY=as_include
  2468. .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
  2469. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2470. when ($CMAKE_PACKAGE_COMPONENT != "") {
  2471. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  2472. }
  2473. when ($CMAKE_PACKAGE != "") {
  2474. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  2475. RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2476. }
  2477. when ($CONAN_REFERENCE != "") {
  2478. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  2479. RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2480. }
  2481. when ($CONAN_PKG_OPTS != "") {
  2482. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  2483. }
  2484. MODULE_SUFFIX=.pkg.fake
  2485. ENABLE(NEED_ADD_FAKE_SRC)
  2486. WITHOUT_LICENSE_TEXTS()
  2487. }
  2488. FAT_OBJECT_SEM=add_fat_object ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  2489. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2490. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2491. && set_global_flags FAT_OBJECT_PREFIX ${MODULE_PREFIX} \
  2492. && set_global_flags FAT_OBJECT_SUFFIX ${MODULE_SUFFIX}
  2493. ### Do not turn visibility=hidden symbos into static symbos of partially linked object file
  2494. ###
  2495. ### Note: This variable do not have any effect on platforms other than MacOS and iOS.
  2496. KEEP_FAT_OBJECT_SYMBOLS=no
  2497. ### @usage: FAT_OBJECT()
  2498. ###
  2499. ### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2500. ### static libraries, local (from own SRCS) and global (from peers') object files.
  2501. ###
  2502. ### Designed for use in XCode projects for iOS.
  2503. module FAT_OBJECT: LIBRARY {
  2504. .ALLOWED=PACK_GLOBALS_IN_LIBRARY
  2505. .CMD=LINK_FAT_OBJECT
  2506. .SEM=FAT_OBJECT_SEM
  2507. .PEERDIR_POLICY=as_build_from
  2508. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2509. MODULE_SUFFIX=.lib
  2510. }
  2511. otherwise {
  2512. MODULE_SUFFIX=.a
  2513. }
  2514. when (($OS_DARWIN == "yes" || $OS_IOS == "yes") && $KEEP_FAT_OBJECT_SYMBOLS == "yes") {
  2515. LDFLAGS_GLOBAL += -keep_private_externs
  2516. }
  2517. # FIXME: This is weird legacy
  2518. when ($OS_ANDROID == "yes") {
  2519. MODULE_PREFIX=lib
  2520. }
  2521. otherwise {
  2522. MODULE_PREFIX=
  2523. }
  2524. _USE_LINKER()
  2525. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2526. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2527. DISABLE(NEED_ADD_FAKE_SRC)
  2528. SRCS(build/scripts/_fake_src.cpp)
  2529. }
  2530. RECURSIVE_LIBRARY_SEM=add_recursive_library ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  2531. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2532. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2533. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2534. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  2535. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW
  2536. ### @usage: RECURSIVE_LIBRARY()
  2537. ###
  2538. ### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2539. ### from static libraries, local (from own SRCS) and global (from peers') object files.
  2540. ###
  2541. ### Designed for use in XCode projects for iOS.
  2542. module RECURSIVE_LIBRARY: LIBRARY {
  2543. .CMD=LINK_RECURSIVE_LIBRARY
  2544. .SEM=RECURSIVE_LIBRARY_SEM
  2545. .PEERDIR_POLICY=as_build_from
  2546. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2547. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2548. DISABLE(NEED_ADD_FAKE_SRC)
  2549. SRCS(build/scripts/_fake_src.cpp)
  2550. }
  2551. _SONAME=
  2552. _EXPORT_SCRIPT_SEM=
  2553. _CLEAN_TEXTREL=
  2554. macro _ADD_DYNLYB_SEM(Libname) {
  2555. .SEM=add_library ${MODDIR} ${Libname} SHARED ${hide:TARGET} ${hide:AUTO_INPUT} && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && target_include_directories PRIVATE $_C__INCLUDE_OWNED && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE && ${VCS_INFO_SEM} $_EXPORT_SCRIPT_SEM
  2556. }
  2557. CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES
  2558. macro CLEAN_TEXTREL() {
  2559. SET(_CLEAN_TEXTREL yes)
  2560. }
  2561. ### @usage: DLL_UNIT # internal
  2562. ###
  2563. ### Base module for all dynamically linked libraries as final artifacts.
  2564. ### Contains all general logic for such kind of modules. Supports versioning and export files.
  2565. ### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
  2566. module DLL_UNIT: _LINK_UNIT {
  2567. .CMD=LINK_DYN_LIB
  2568. .SEM=CPP_DYN_LIBRARY_SEM
  2569. .NODE_TYPE=Library
  2570. .SYMLINK_POLICY=SO
  2571. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2572. .ALLOWED=WHOLE_ARCHIVE
  2573. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2574. .ARGS_PARSER=DLL
  2575. DYNAMIC_LINK=yes
  2576. ALLOCATOR(FAKE)
  2577. SET(MODULE_TYPE DLL)
  2578. SET(MODULE_TAG DLL)
  2579. SET(MODULE_LANG CPP)
  2580. ADD_CLANG_TIDY()
  2581. when ($EXPORTS_FILE) {
  2582. _EXPORT_SCRIPT_SEM=&& use_export_script ${input:EXPORTS_FILE}
  2583. }
  2584. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2585. MODULE_SUFFIX=.dll
  2586. }
  2587. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2588. MODULE_PREFIX=lib
  2589. MODULE_SUFFIX=.dylib
  2590. }
  2591. elsewhen ($TIDY_ENABLED == "yes") {
  2592. MODULE_PREFIX=
  2593. MODULE_SUFFIX=.tidyjson
  2594. }
  2595. otherwise {
  2596. MODULE_PREFIX=lib
  2597. MODULE_SUFFIX=.so
  2598. }
  2599. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2600. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2601. when ($MODULE_VERSION) {
  2602. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2603. }
  2604. _SONAME=$SONAME$MODULE_VERSION
  2605. when ($LINUX == "yes") {
  2606. # '-z notext' is needed for linking mkl into shared libraries
  2607. when ($_CLEAN_TEXTREL != "yes") {
  2608. LDFLAGS += -Wl,-z,notext
  2609. }
  2610. }
  2611. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes") {
  2612. when ($_NO_FIX_ELF != "yes") {
  2613. LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
  2614. }
  2615. }
  2616. when ($DARWIN == "yes") {
  2617. LDFLAGS += -undefined dynamic_lookup
  2618. }
  2619. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  2620. PEERDIR+=library/cpp/testing/dump_clang_coverage
  2621. }
  2622. when ($IDE_MSVS == "yes") {
  2623. PEERDIR+=build/scripts/c_templates
  2624. }
  2625. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  2626. LINK_DYN_LIB_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  2627. }
  2628. }
  2629. # tag:python-specific
  2630. ### @usage: PY_ANY_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2631. ###
  2632. ### The Python external module for any versio of Arcadia or system Python.
  2633. ### 1. major_ver and minor_ver must be integers.
  2634. ### 2. The resulting .so will have the prefix "lib".
  2635. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2636. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2637. ###
  2638. ### Note: Use PYTHON2_MODULE()/PYTHON3_MODULE() in order to PEERDIR proper version of PY23_NATIVE_LIBRARY.
  2639. ### Do not PEERDIR any PY*_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2640. ###
  2641. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2642. module PY_ANY_MODULE: DLL_UNIT {
  2643. .SEM=CPP_DYN_LIBRARY_SEM
  2644. when ($MSVC != "yes" && $DARWIN != "yes") {
  2645. LDFLAGS+= -Wl,-Bsymbolic
  2646. }
  2647. when ($USE_ARCADIA_PYTHON == "no") {
  2648. when ($USE_SYSTEM_PYTHON) {
  2649. PEERDIR+=build/platform/python
  2650. }
  2651. otherwise {
  2652. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2653. LDFLAGS+=$PYTHON_LIBRARIES
  2654. }
  2655. }
  2656. }
  2657. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2658. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2659. when ($MODULE_VERSION) {
  2660. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2661. }
  2662. _SONAME=$SONAME$MODULE_VERSION
  2663. # -bundle
  2664. when ($DARWIN == "yes") {
  2665. LDFLAGS+=-flat_namespace
  2666. }
  2667. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2668. MODULE_PREFIX=
  2669. MODULE_SUFFIX=.pyd
  2670. }
  2671. otherwise {
  2672. MODULE_PREFIX=
  2673. MODULE_SUFFIX=.so
  2674. }
  2675. .RESTRICTED=USE_PYTHON2 USE_PYTHON3 PY_SRCS PY_MAIN
  2676. }
  2677. # tag:python-specific
  2678. ### @usage: PY2MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2679. ###
  2680. ### The Python external module for Python2 and any system Python
  2681. ### 1. major_ver and minor_ver must be integers.
  2682. ### 2. The resulting .so will have the prefix "lib".
  2683. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2684. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2685. ###
  2686. ### Note: this module will always PEERDIR Python2 version of PY23_NATIVE_LIBRARY.
  2687. ### Do not PEERDIR PY2_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2688. ###
  2689. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2690. module PY2MODULE: PY_ANY_MODULE {
  2691. PYTHON2_MODULE()
  2692. SET(MODULE_LANG PY2)
  2693. .RESTRICTED=PYTHON3_MODULE PYTHON3_ADDINCL
  2694. }
  2695. # tag:python-specific
  2696. ### @usage: PY3MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2697. ###
  2698. ### The Python external module for Python3 and any system Python
  2699. ### 1. major_ver and minor_ver must be integers.
  2700. ### 2. The resulting .so will have the prefix "lib".
  2701. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2702. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2703. ###
  2704. ### Note: this module will always PEERDIR Python3 version of PY23_NATIVE_LIBRARY.
  2705. ### Do not PEERDIR PY3_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2706. ###
  2707. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2708. module PY3MODULE: PY_ANY_MODULE {
  2709. PYTHON3_MODULE()
  2710. SET(MODULE_LANG PY3)
  2711. .RESTRICTED=PYTHON2_MODULE PYTHON2_ADDINCL
  2712. }
  2713. # tag:python-specific
  2714. ### @usage: PYTHON2_MODULE()
  2715. ###
  2716. ### Use in PY_ANY_MODULE to set it up for Python 2.x.
  2717. macro PYTHON2_MODULE() {
  2718. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2719. PEERDIR+=contrib/tools/python/lib
  2720. }
  2721. SET(ANTLR_PYTHON Python2)
  2722. PYTHON2_ADDINCL()
  2723. }
  2724. # tag:python-specific
  2725. ### @usage: PYTHON3_MODULE()
  2726. ###
  2727. ### Use in PY_ANY_MODULE to set it up for Python 3.x.
  2728. macro PYTHON3_MODULE() {
  2729. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2730. PEERDIR+=contrib/tools/python3/lib
  2731. }
  2732. SET(ANTLR_PYTHON Python3)
  2733. PYTHON3_ADDINCL()
  2734. }
  2735. # tag:r-specific
  2736. ### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2737. ###
  2738. ### The external module for R language.
  2739. ### 1. major_ver and minor_ver must be integers.
  2740. ### 2. The resulting .so will have the prefix "lib".
  2741. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2742. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2743. module R_MODULE: DLL_UNIT {
  2744. .SEM=CPP_DYN_LIBRARY_SEM
  2745. when ($DARWIN == "yes") {
  2746. LDFLAGS+=-flat_namespace -dynamiclib
  2747. }
  2748. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2749. MODULE_PREFIX=lib
  2750. MODULE_SUFFIX=.dll
  2751. }
  2752. ADDINCL(contrib/libs/r-lang)
  2753. }
  2754. ### @usage: DYNAMIC_LIBRARY_FROM(Paths)
  2755. ###
  2756. ### Use specified libraries as sources of DLL
  2757. macro DYNAMIC_LIBRARY_FROM(Path...) {
  2758. PEERDIR($Path)
  2759. WHOLE_ARCHIVE($Path)
  2760. }
  2761. ### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2762. ###
  2763. ### Dynamic library module definition.
  2764. ### 1. major_ver and minor_ver must be integers.
  2765. ### 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
  2766. ### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
  2767. ###
  2768. ### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
  2769. module DLL: DLL_UNIT {
  2770. .SEM=CPP_DYN_LIBRARY_SEM
  2771. SET(MAKE_ONLY_SHARED_LIB yes)
  2772. when ($OS_WINDOWS) {
  2773. MODULE_SUFFIX=.dll
  2774. }
  2775. # TODO: Make it possible to use this syntax
  2776. # DEFAULT(DLL_FOR_DIR no)
  2777. ### FIXME: XXX
  2778. ###when ($DLL_FOR_DIR != "no") {
  2779. ### SRCDIR($DLL_FOR_DIR)
  2780. ### ADDINCL($DLL_FOR_DIR)
  2781. ###}
  2782. }
  2783. ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
  2784. module DLL_TOOL: DLL {
  2785. .SEM=CPP_DYN_LIBRARY_SEM
  2786. # ymake resolves only program nodes as tools.
  2787. .NODE_TYPE=Program
  2788. }
  2789. ### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2790. ###
  2791. ### Executable dynamic library module definition.
  2792. ### 1. major_ver and minor_ver must be integers.
  2793. ### 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
  2794. ### 3. PREFIX allows you to change the prefix of the output file.
  2795. module SO_PROGRAM: DLL {
  2796. .CMD=LINK_EXEC_DYN_LIB
  2797. SET(MODULE_TYPE PROGRAM)
  2798. MODULE_PREFIX=
  2799. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2800. MODULE_SUFFIX=.exe
  2801. }
  2802. otherwise {
  2803. MODULE_SUFFIX=
  2804. }
  2805. }
  2806. DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
  2807. # tag:internal
  2808. ### @usage: DEV_DLL_PROXY() # internal
  2809. ###
  2810. ### The use of this module is strictly prohibited!!!
  2811. ### This is a temporary and project-specific solution.
  2812. module DEV_DLL_PROXY: _BARE_UNIT {
  2813. .NODE_TYPE=Library
  2814. .EXTS=.so .dll .dylib .mf
  2815. .CMD=DLL_PROXY_CMD_MF
  2816. DYNAMIC_LINK=yes
  2817. when ($OS_WINDOWS == "yes") {
  2818. MODULE_SUFFIX=.dll
  2819. }
  2820. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2821. MODULE_PREFIX=lib
  2822. MODULE_SUFFIX=.dylib$MODULE_VERSION
  2823. }
  2824. otherwise {
  2825. MODULE_PREFIX=lib
  2826. MODULE_SUFFIX=.so$MODULE_VERSION
  2827. }
  2828. }
  2829. # tag:internal
  2830. ### @usage: DLL_PROXY() # internal
  2831. ###
  2832. ### The use of this module is strictly prohibited!!!
  2833. ### This is a temporary and project-specific solution.
  2834. module DLL_PROXY: DEV_DLL_PROXY {
  2835. .EXTS=.so .dylib .lib .mf
  2836. .PROXY=yes
  2837. .PEERDIR_POLICY=as_build_from
  2838. SET(PEERDIR_TAGS DLL __EMPTY__)
  2839. when ($OS_WINDOWS == "yes") {
  2840. MODULE_SUFFIX=.lib
  2841. }
  2842. }
  2843. # tag:internal
  2844. ### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
  2845. ###
  2846. ### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
  2847. ### This it needed to transfer their outputs through the library to PROGRAM
  2848. ### or dependent DLL/DYNAMIC_LIBRARY.
  2849. ###
  2850. ### Note: this is temporary solution until support of `super-global` variables come
  2851. ### which will enable transfer of some properties though final targets like DLLs.
  2852. macro DYNAMIC_DEPS(Path...) {
  2853. # PEERDIR as macro completely ignored in place where this macro applies
  2854. SET_APPEND(PEERDIR $Path)
  2855. }
  2856. # tag:internal
  2857. ### @usage: DYNAMIC_LIBRARY() # internal
  2858. ###
  2859. ### The use of this module is strictly prohibited except LGPL-related opensourcing
  2860. ### This provides linkable DLL module which brings its results to programs and tests
  2861. ### for seamless testing and packaging
  2862. multimodule DYNAMIC_LIBRARY {
  2863. module DLL_BIN: DLL {
  2864. .PROXY=yes
  2865. .IGNORED=PROVIDES
  2866. SET(MODULE_TAG DLL)
  2867. }
  2868. module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
  2869. .CMD=TOUCH_UNIT_MF
  2870. .PEERDIRSELF=DLL_BIN
  2871. .IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
  2872. .ALLOWED=DYNAMIC_DEPS
  2873. SET(PEERDIR_TAGS DLL_LIB __EMPTY__)
  2874. _BARE_MODULE()
  2875. DYNAMIC_LINK=yes
  2876. MODULE_SUFFIX=.pkg.fake
  2877. PEERDIR+=build/platform/local_so
  2878. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no" && $SANITIZE_HEADERS && $SANITIZE_HEADERS != "no") {
  2879. PEERDIR += library/cpp/sanitizer/include
  2880. }
  2881. # disable credits generation for static library
  2882. SET(CREDITS_FLAGS)
  2883. }
  2884. }
  2885. ### @usage: GLOBAL_SRCS(filenames...)
  2886. ###
  2887. ### Make all source files listed as GLOBAL.
  2888. ### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
  2889. ### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
  2890. ### recognized for GLOBAL_SRCS in contrast to SRCS macro.
  2891. ###
  2892. ### @example:
  2893. ### Consider the file to ya.make:
  2894. ###
  2895. ### LIBRARY()
  2896. ### GLOBAL_SRCS(foo.cpp bar.cpp)
  2897. ### END()
  2898. ###
  2899. ### @see: [SRCS()](#macro_SRCS)
  2900. macro GLOBAL_SRCS(Files...) {
  2901. SRCS(${pre=GLOBAL :Files})
  2902. }
  2903. ### @usage: ALL_SRCS([GLOBAL] filenames...)
  2904. ###
  2905. ### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
  2906. ### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
  2907. ### as the first argument and is equivalent to call to SRCS macro otherwise.
  2908. ###
  2909. ### @example:
  2910. ###
  2911. ### LIBRARY()
  2912. ### SET(MAKE_IT_GLOBAL GLOBAL)
  2913. ### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
  2914. ### END()
  2915. ###
  2916. ### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
  2917. macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
  2918. SRCS(${pre=$GLOBAL :Files})
  2919. }
  2920. ### @usage: _DLL_COMPATIBLE_LIBRARY # internal
  2921. ###
  2922. ### Base module to place DLLs into multimodules back to back with libraries.
  2923. ### In order to function properly all modules in multimodule shall have the
  2924. ### same set of arguments. So this module is just library that accepts but
  2925. ### ignores all DLL arguments.
  2926. module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
  2927. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2928. .ARGS_PARSER=DLL
  2929. }
  2930. @import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
  2931. # as SRCS in packages use macro BUNDLE_SRCS!
  2932. PACKED_PACKAGE_ARGS=
  2933. PACKED_PACKAGE_EXT=
  2934. ### @usage: PACK(archive_type)
  2935. ###
  2936. ### 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`
  2937. ###
  2938. ### Is not allowed other module types than PACKAGE().
  2939. ###
  2940. ### @see: [PACKAGE()](#module_PACKAGE)
  2941. macro PACK(Ext) {
  2942. SET(PACKED_PACKAGE_EXT $Ext)
  2943. }
  2944. PACKAGE_STRICT_VALUE=
  2945. macro PACKAGE_STRICT() {
  2946. SET(PACKAGE_STRICT_VALUE yes)
  2947. }
  2948. ### @usage: PACKAGE(name)
  2949. ###
  2950. ### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
  2951. ### 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.
  2952. ### The data can be optionally packed if macro PACK() is used.
  2953. ###
  2954. ### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
  2955. ###
  2956. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2957. ###
  2958. ### @see: [PACK()](#macro_PACK)
  2959. multimodule PACKAGE {
  2960. module PACKAGE_FINAL: _BASE_UNIT {
  2961. .CMD=TOUCH_PACKAGE_MF
  2962. .ALIASES=SRCS=FILES
  2963. .ALLOWED=PACK
  2964. .PEERDIRSELF=PACKAGE_UNION
  2965. .USE_PEERS_LATE_OUTS=yes
  2966. .PEERDIR_POLICY=as_build_from
  2967. .FINAL_TARGET=yes
  2968. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2 PY3 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM PACKAGE_UNION)
  2969. SET(MODULE_SUFFIX .final.pkg.fake)
  2970. SET(DONT_RESOLVE_INCLUDES yes)
  2971. NO_PLATFORM()
  2972. when ($PACKED_PACKAGE_EXT) {
  2973. PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
  2974. }
  2975. SET(NEED_PLATFORM_PEERDIRS no)
  2976. }
  2977. module PACKAGE_UNION: UNION {
  2978. .CMD=UNION_CMD
  2979. .FINAL_TARGET=no
  2980. .ALLOWED=PACK
  2981. .IGNORED=VCS_INFO_FILE
  2982. SET(MODULE_SUFFIX .pkg.fake)
  2983. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2 PY3 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM PACKAGE_UNION)
  2984. DISABLE(START_TARGET)
  2985. }
  2986. }
  2987. TOUCH_GROUP=$TOUCH_PACKAGE ${kv;hide:"p CI"}
  2988. ### @usage: CI_GROUP()
  2989. ###
  2990. ### Module collects what is described directly inside it transitively by PEERDIRs.
  2991. ### No particular layout of built artifacts is implied. This module is needed primarily for CI dependency analysis and may not trigger builds at all.
  2992. ###
  2993. ### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
  2994. module CI_GROUP: _BARE_UNIT {
  2995. .CMD=TOUCH_GROUP
  2996. .PEERDIR_POLICY=as_build_from
  2997. .FINAL_TARGET=yes
  2998. .RESTRICTED=SRCS
  2999. .USE_PEERS_LATE_OUTS=yes
  3000. MODULE_SUFFIX=.ci.pkg.fake
  3001. PEERDIR_TAGS=CPP_PROTO PY3 PY3_NATIVE PY3_BIN PY3TEST_PROGRAM YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE DLL
  3002. }
  3003. # tag:generic tag:internal
  3004. TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
  3005. # tag:proto
  3006. ### @usage: RESOLVE_PROTO()
  3007. ###
  3008. ### Enable include resolving within UNIONs and let system .proto being resolved
  3009. ### among .proto/.gztproto imports
  3010. ###
  3011. ### Note: it is currently impossible to enable resolving only for .proto, so resolving is enabled for all supported files
  3012. ### also we only add ADDINCL for stock protobuf. So use this macro with care: it may cause resolving problems those are
  3013. ### to be addressed by either ADDINCLs or marking them as TEXT. Please contact devtools for details.
  3014. macro RESOLVE_PROTO() {
  3015. SET(DONT_RESOLVE_INCLUDES no)
  3016. ADDINCL(FOR proto $PROTOBUF_PATH)
  3017. }
  3018. ### @usage: UNION(name)
  3019. ###
  3020. ### Collection of PEERDIR dependencies, files and artifacts.
  3021. ### UNION doesn't build its peers, just provides those to modules depending on it.
  3022. ### When specified in DEPENDS() macro the UNION is transitively closed, building all its peers and providing those by own paths (without adding this module path like PACKAGE does).
  3023. ###
  3024. ### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
  3025. ###
  3026. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  3027. module UNION: _BASE_UNIT {
  3028. .CMD=UNION_CMD_MF
  3029. .FINAL_TARGET=no
  3030. .ALIASES=SRCS=FILES
  3031. .ALLOWED=EXPLICIT_OUTPUTS
  3032. .IGNORED=VCS_INFO_FILE
  3033. NO_PLATFORM()
  3034. SET(MODULE_SUFFIX .pkg.fake)
  3035. SET(DONT_RESOLVE_INCLUDES yes)
  3036. SET(NEED_PLATFORM_PEERDIRS no)
  3037. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN DLL PACKAGE_UNION
  3038. UNION_OUTS=${hide;late_out:AUTO_INPUT}
  3039. when ($_UNION_EXPLICIT_OUTPUTS) {
  3040. UNION_OUTS=$_EXPAND_INS_OUTS($_UNION_EXPLICIT_OUTPUTS)
  3041. }
  3042. }
  3043. # tag:python-specific
  3044. module _PY_PACKAGE: UNION {
  3045. .EXTS=.py
  3046. .ALLOWED=GRPC USE_SKIFF
  3047. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3048. ENABLE(PY_PROTOS_FOR)
  3049. SET(PEERDIR_TAGS PY_PROTO)
  3050. SET(DONT_RESOLVE_INCLUDES no)
  3051. }
  3052. # tag:python-specific tag:deprecated tag:internal
  3053. ### @usage: PY_PACKAGE(name) # internal, deprecated
  3054. ###
  3055. ### This is module created via PY_PROTOS_FOR() macro
  3056. module PY_PACKAGE: _PY_PACKAGE {
  3057. .ALIASES=SRCS=SRCS
  3058. .FINAL_TARGET=yes
  3059. }
  3060. # tag:internal
  3061. ### @usage: _SET_FIRST_VALUE(name args...) # internal
  3062. ###
  3063. ### This macro sets the value of `name` variable to the value of next argument
  3064. macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
  3065. SET($NAME $VALUE)
  3066. }
  3067. # tag:python-specific
  3068. PY_NAMESPACE_VALUE=
  3069. # tag:python-specific
  3070. ### @usage: PY_NAMESPACE(prefix)
  3071. ###
  3072. ### Sets default Python namespace for all python sources in the module.
  3073. ### Especially suitable in PROTO_LIBRARY where Python sources are generated and there is no PY_SRCS to place NAMESPACE parameter.
  3074. macro PY_NAMESPACE(Arg) {
  3075. SET(PY_NAMESPACE_VALUE $Arg)
  3076. }
  3077. # tag:internal
  3078. ### @usage: _SRCS_NO_GLOBAL(files...) # internal
  3079. ###
  3080. ### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
  3081. ### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
  3082. ### Note: this macro changes order of source files.
  3083. macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
  3084. SRCS($GLOBAL $FILES)
  3085. }
  3086. # tag:java-specific
  3087. JAVA_VCS_MF_ARG=
  3088. COMPILE_JAVA_MF=${hide:JAVA_FAKEID} $COMPILE_JAVA $MAVEN_EXPORT_CMD
  3089. # tag:java-specific
  3090. when ($EXT_JAVA_VCS_INFO == "yes") {
  3091. JAVA_VCS_MF_ARG=--vcs-mf $VCS_JAVA
  3092. COMPILE_JAVA_MF=${hide:JAVA_FAKEID} $GENERATE_VCS_JAVA_INFO_NODEP && $COMPILE_JAVA $MAVEN_EXPORT_CMD
  3093. }
  3094. # tag:java-specific
  3095. EXT_JAVA_VCS_INFO=no
  3096. ### @usage: EMBED_JAVA_VCS_INFO()
  3097. ###
  3098. ### Embed manifest with vcs info into `EXTERNAL_JAVA_LIBRARY`
  3099. ### By default this is disabled.
  3100. macro EMBED_JAVA_VCS_INFO() {
  3101. .SEM=add_vcs_info_to_mf ${hide;output:"VcsInfoMfDummy.java"}
  3102. ENABLE(EXT_JAVA_VCS_INFO)
  3103. }
  3104. # tag:java-specific tag:internal
  3105. ### @usage: EXTERNAL_JAVA_LIBRARY() #internal
  3106. ###
  3107. ### EXTERNAL_JAVA_LIBRARY() is a module for creating a .jar file using non-Java code (generators etc.)
  3108. ### Unlike regular JAVA_LIBRARY this module doesn't produce .pom file, so it cannot be exported to Maven itself.
  3109. ### PEERDIR it from JAVA_LIBRARY or JAVA_PROGRAM for export to Maven.
  3110. module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
  3111. .EXTS=.jsrc .java .jar .mf
  3112. .NODE_TYPE=Bundle
  3113. .CMD=COMPILE_JAVA_MF
  3114. # TODO(YMAKE-27) all contribs involved into opensource export must be JAVA_CONTRIB modules
  3115. # and this module must not be intended for export. Such hange will break JBUILD and thus is
  3116. # blocked on YMAKE-27
  3117. .SEM=JAVA_CONTRIB_SEM
  3118. .PEERDIR_POLICY=as_build_from
  3119. .FINAL_TARGET=no
  3120. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  3121. .ALLOWED=EMBED_JAVA_VCS_INFO
  3122. .RESTRICTED=EXTERNAL_JAR
  3123. .GLOBAL=MAVEN_EXPORT_COORDS
  3124. PEERDIR(build/platform/java/jdk)
  3125. PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR
  3126. when ($KOTLIN_PROTO == "yes") {
  3127. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION}
  3128. }
  3129. when ($MAVEN_EXPORT == "yes") {
  3130. when ($MAVEN_DEPLOY == "yes") {
  3131. PEERDIR+=build/external_resources/maven
  3132. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM && $MAVEN_DEPLOY_CMD
  3133. }
  3134. otherwise {
  3135. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM
  3136. }
  3137. MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GOUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
  3138. }
  3139. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL PACKAGE_UNION
  3140. HAS_MANAGEABLE_PEERS=yes
  3141. DYNAMIC_LINK=yes
  3142. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  3143. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  3144. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  3145. when ($PACKAGE_PREFIX) {
  3146. PACKAGE_PREFIX_ARGS=--package-prefix=$PACKAGE_PREFIX
  3147. }
  3148. DISABLE(NEED_PLATFORM_PEERDIRS)
  3149. NO_PLATFORM()
  3150. SET(MODULE_SUFFIX .jar)
  3151. SET(MODULE_LANG JAVA)
  3152. _WHEN_EXPORT_GRADLE()
  3153. }
  3154. # tag:java-specific
  3155. ALL_JAR_SOURCES=
  3156. LINT_JAVA_SOURCES=
  3157. ALL_SRCDIRS=
  3158. LINK_JAR_RESOURCES=
  3159. LINK_JAR_JSOURCES=
  3160. JAR_GEN_SRCS=
  3161. JAR_GEN_JSRCS=
  3162. macro _JAR_SRCS(SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], RESOURCES?"yes":"no", Globs...) {
  3163. _CHECK_JAVA_SRCDIR($SRCDIR)
  3164. SET_APPEND(ALL_SRCDIRS $SRCDIR)
  3165. SET(VAR_SALT $SRCDIR $Globs $EXCLUDE $PACKAGE_PREFIX $RESOURCES $FILES)
  3166. SET(JAR_SRCS_GLOB uniq_${hash:VAR_SALT})
  3167. _LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE})
  3168. SET_APPEND(LINT_JAVA_SOURCES \${input;rootrel;ext=.java:${JAR_SRCS_GLOB}})
  3169. 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})
  3170. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_RESOURCES ${quo:SRCDIR} ${BINDIR}/cls ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt)
  3171. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_JSOURCES ${quo:SRCDIR} ${BINDIR}/src ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt)
  3172. _FILL_JAR_GEN_SRCS(JAR_GEN_SRCS JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst $KT_SRCLIST ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt $Globs EXCLUDE $EXCLUDE)
  3173. _FILL_JAR_GEN_SRCS(JAR_GEN_JSRCS SRC_JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst $KT_SRCLIST ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt $Globs EXCLUDE $EXCLUDE)
  3174. }
  3175. macro IDEA_JAR_SRCS(Args...) {
  3176. _JAR_SRCS($Args)
  3177. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  3178. }
  3179. macro _HASH_HELPER(Args...) {
  3180. .CMD=${hash:Args}
  3181. .SEM=${hash:Args}
  3182. }
  3183. macro _GENTAR_HELPER(OUT_DIR[], Args...) {
  3184. .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"}
  3185. }
  3186. # tag:java-specific
  3187. RUN_JAR_PROG_CP_PRE=@
  3188. RUN_JAR_PROG_CP_SUF=.cplst
  3189. when($JDK_VERSION == "8") {
  3190. RUN_JAR_PROG_CP_PRE=
  3191. RUN_JAR_PROG_CP_SUF=
  3192. }
  3193. # tag:java-specific
  3194. JDK_LATEST_VERSION=19
  3195. JDK_LATEST_PEERDIR=build/platform/java/jdk/jdk${JDK_LATEST_VERSION}
  3196. # tag:java-specific
  3197. macro _DO_2_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq_", IN_DIRS_INPUTS[], IN{input}[], IN_NOPARSE{input}[], IN_DIR[], OUT_NOAUTO{output}[], OUT{output}[], TOOL{tool}[], OUT_DIR[], CLASSPATH[], ADD_SRCS_TO_CLASSPATH?"yes":"no", CWD="${ARCADIA_BUILD_ROOT}", Args...) {
  3198. _LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR})
  3199. _CHECK_RUN_JAVA_PROG_CLASSPATH($CLASSPATH)
  3200. .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
  3201. .CMD=${kv;hide:"p RJ"} ${kv;hide:"pc blue"} ${hide:JAVA_FAKEID} ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} ${OUT_DIR} && ${cwd:CWD} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} $YMAKE_PYTHON ${input:"build/scripts/fix_java_command_file_cp.py"} --build-root ${ARCADIA_BUILD_ROOT} $JDK_RESOURCE/bin/java -Dfile.encoding=utf8 -classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} ${Args} && $_GENTAR_HELPER($CLASSPATH $IN_DIR $IN $IN_NOPARSE $TOOL $Args OUT_DIR $OUT_DIR) ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output;noauto;hide:OUT_NOAUTO} ${output;hide:OUT} ${tool;hide:TOOL} ${IN_DIRS_INPUTS}
  3202. }
  3203. # tag:java-specific
  3204. macro _DO_1_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq", Args...) {
  3205. _DO_2_RUN_JAR_PROGRAM($Args IN_DIRS_VAR $IN_DIRS_VAR IN_DIRS_INPUTS ${"$"}{input;hide:$IN_DIRS_VAR})
  3206. }
  3207. # tag:java-specific
  3208. macro RUN_JAVA_PROGRAM(Args...) {
  3209. _DO_1_RUN_JAR_PROGRAM($Args IN_DIRS_VAR uniq_${hash:Args})
  3210. }
  3211. # tag:java-specific
  3212. _JAR_ANN_PROCESSORS=
  3213. _JAR_ANN_PROC_OPT_PREFIX=
  3214. macro JAR_ANNOTATION_PROCESSOR(Classes...) {
  3215. SET_APPEND(_JAR_ANN_PROCESSORS $Classes)
  3216. SET(_JAR_ANN_PROC_OPT_PREFIX -processor)
  3217. # for ya ide idea only
  3218. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Classes)
  3219. }
  3220. # tag:java-specific
  3221. macro _JAR_ANN_PROC_OPTS(Classes...) {
  3222. .CMD=$_JAR_ANN_PROC_OPT_PREFIX ${join=,:Classes}
  3223. }
  3224. # tag:java-specific
  3225. macro _NOOP_MACRO(Args...) {
  3226. ENABLE(UNUSED_MACRO)
  3227. }
  3228. # tag:java-specific
  3229. module _JAR_BASE: _BARE_UNIT {
  3230. .NODE_TYPE=Bundle
  3231. .CMD=TOUCH_UNIT
  3232. .PEERDIR_POLICY=as_build_from
  3233. .FINAL_TARGET=no
  3234. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  3235. .ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE
  3236. .DEFAULT_NAME_GENERATOR=TwoDirNames
  3237. .RESTRICTED=WITH_JDK RESOURCE RESOURCE_FILES
  3238. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__
  3239. HAS_MANAGEABLE_PEERS=yes
  3240. DYNAMIC_LINK=yes
  3241. MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
  3242. MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
  3243. MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
  3244. DISABLE(NEED_PLATFORM_PEERDIRS)
  3245. NO_PLATFORM()
  3246. VCS_JAVA=${suf=.__vcs_version__.mf:TARGET}
  3247. SET(MODULE_LANG JAVA)
  3248. _WHEN_EXPORT_GRADLE()
  3249. }
  3250. JAVA_CONTRIB_PROXY_SEM=IGNORED
  3251. # tag:java-specific
  3252. module JAVA_CONTRIB_PROXY: _JAR_BASE {
  3253. .SEM=JAVA_CONTRIB_PROXY_SEM
  3254. }
  3255. # tag:java-specific
  3256. macro _FETCH_CONTRIB(Id, Out, SBR="sbr:") {
  3257. .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"}
  3258. ADD_CHECK(check.resource $Id)
  3259. }
  3260. # tag:java-specific
  3261. LOCAL_JAR_PATH=
  3262. LOCAL_SOURCES_JAR_PATH=
  3263. JAR_RESOURCE_ID=
  3264. SRC_RESOURCE_ID=
  3265. FETCH_SRCS_JAR=
  3266. FETCH_TARGET_JAR=
  3267. FETCH_CONTRIB_JAR=${hide:JAVA_FAKEID} $FETCH_TARGET_JAR $FETCH_SRCS_JAR
  3268. # tag:java-specific
  3269. macro JAR_RESOURCE(Id) {
  3270. SET(JAR_RESOURCE_ID $Id)
  3271. }
  3272. # tag:java-specific
  3273. macro SRC_RESOURCE(Id) {
  3274. SET(SRC_RESOURCE_ID $Id)
  3275. }
  3276. # tag:java-specific
  3277. macro LOCAL_JAR(File) {
  3278. SET(LOCAL_JAR_PATH $File)
  3279. }
  3280. # tag:java-specific
  3281. macro LOCAL_SOURCES_JAR(File) {
  3282. SET(LOCAL_SOURCES_JAR_PATH $File)
  3283. }
  3284. JAVA_CONTRIB_SEM=consumer_classpath $_EXPORT_GRADLE_PROJECT_COORDS ${hide:TARGET} ${hide:AUTO_INPUT} && IGNORED
  3285. # tag:java-specific
  3286. module JAVA_CONTRIB: _JAR_BASE {
  3287. .CMD=FETCH_CONTRIB_JAR
  3288. .SEM=JAVA_CONTRIB_SEM
  3289. .FINAL_TARGET=yes
  3290. .GLOBAL=MAVEN_EXPORT_COORDS
  3291. when ($JAR_RESOURCE_ID) {
  3292. FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX})
  3293. }
  3294. otherwise {
  3295. when ($LOCAL_JAR_PATH) {
  3296. FETCH_TARGET_JAR= && $FS_TOOLS copy ${input:LOCAL_JAR_PATH} $TARGET
  3297. }
  3298. otherwise {
  3299. FETCH_TARGET_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:BINDIR} $JDK_RESOURCE/bin/jar cfvm $TARGET $VCS_JAVA .
  3300. PEERDIR+=build/platform/java/jdk
  3301. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3302. }
  3303. }
  3304. when ($SRC_RESOURCE_ID) {
  3305. FETCH_SRCS_JAR= && $_FETCH_CONTRIB($SRC_RESOURCE_ID ${BINDIR}/${REALPRJNAME}-sources.jar)
  3306. }
  3307. otherwise {
  3308. when ($LOCAL_SOURCES_JAR_PATH) {
  3309. FETCH_SRCS_JAR= && $FS_TOOLS copy ${input:LOCAL_SOURCES_JAR_PATH} {output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME}
  3310. }
  3311. otherwise {
  3312. 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 .
  3313. PEERDIR+=build/platform/java/jdk
  3314. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3315. }
  3316. }
  3317. when ($MAVEN_EXPORT == "yes") {
  3318. _MAKEFILE_INCLUDE_LIKE_DEPS+=pom.xml
  3319. FETCH_CONTRIB_JAR+= && $MAVEN_EXPORT_GEN_DEPLST
  3320. }
  3321. SET(MODULE_SUFFIX .jar)
  3322. _SETUP_MAVEN_EXPORT_COORDS_IF_NEED($MODDIR)
  3323. }
  3324. MAKE_JAVA_CLASSPATH_FILE=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} ${input;hide:"build/scripts/process_command_files.py"}
  3325. # tag:kotlin-specific
  3326. KOTLINC_OPTS_VALUE=
  3327. # tag:kotlin-specific
  3328. KT_SRCLIST=${BINDIR}/misc/all-kt-sources.txt
  3329. KT_SRSCLIST_FLAG=--kotlin $KT_SRCLIST
  3330. KT_CLASSES_DIR=${BINDIR}/kt_cls
  3331. KT_CLASSPATH=${BINDIR}/kt_cp.txt
  3332. COLLECT_KT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/kt_bfg.txt -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file
  3333. LINK_KT_CLASSPATH=${MAKE_JAVA_CLASSPATH_FILE} ${BINDIR}/kt_bfg.txt $KT_CLASSPATH && $FS_TOOLS md $KT_CLASSES_DIR
  3334. COMPILE_KT= \
  3335. ${cwd:ARCADIA_BUILD_ROOT} ${env:"LC_ALL=en_US.UTF-8"} $YMAKE_PYTHON ${input:"build/scripts/with_pathsep_resolve.py"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} --kotlin --sources-list $KT_SRCLIST \
  3336. $JDK_RESOURCE/bin/java -jar $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} \
  3337. @$KT_SRCLIST -classpath @$KT_CLASSPATH $KOTLINC_FLAGS_VALUE -d $KT_CLASSES_DIR $KOTLINC_OPTS_VALUE
  3338. ALL_KT_COMMANDS=
  3339. KT_CLASSPATH_ITEM=
  3340. # tag:kotlin-specific
  3341. KT_KAPT_SOURCES_DIR=${BINDIR}/kapt_gen_src
  3342. KT_KAPT_STUBS_DIR=${BINDIR}/kapt_gen_stubs
  3343. KT_KAPT_AP_CLASSPATH=
  3344. KT_KAPT_PLUGIN_OPTS=-P plugin:org.jetbrains.kotlin.kapt3:sources=${KT_KAPT_SOURCES_DIR} -P plugin:org.jetbrains.kotlin.kapt3:classes=${KT_CLASSES_DIR} -P plugin:org.jetbrains.kotlin.kapt3:stubs=${KT_KAPT_STUBS_DIR} -P plugin:org.jetbrains.kotlin.kapt3:aptMode=stubsAndApt
  3345. ### @usage: KAPT_OPTS(opts...)
  3346. ###
  3347. ### Used to specify annotation processor qualified class names.
  3348. ### If specified multiple times, only last specification is used.
  3349. macro KAPT_OPTS(Args...) {
  3350. SET_APPEND(KT_KAPT_PLUGIN_OPTS ${pre=-P :Args})
  3351. }
  3352. ### @usage: KAPT_ANNOTATION_PROCESSOR(processors...)
  3353. ###
  3354. ### Used to specify annotation processor qualified class names.
  3355. ### If specified multiple times, only last specification is used.
  3356. macro KAPT_ANNOTATION_PROCESSOR(Args...) {
  3357. KAPT_OPTS(${pre="plugin:org.jetbrains.kotlin.kapt3:processors=":Args})
  3358. }
  3359. ### @usage: KAPT_ANNOTATION_PROCESSOR_CLASSPATH(jars...)
  3360. ###
  3361. ### Used to specify classpath for annotation processors.
  3362. ### If specified multiple times, all specifications are used.
  3363. macro KAPT_ANNOTATION_PROCESSOR_CLASSPATH(Args...) {
  3364. PEERDIR($Args)
  3365. SET_APPEND(KT_KAPT_AP_CLASSPATH $Args)
  3366. }
  3367. # tag:java-specific
  3368. JAVAC_CMD=$JDK_RESOURCE/bin/javac
  3369. 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
  3370. # tag:java-specific tag:codenav
  3371. JAVA_YNDEXING=no
  3372. # tag:java-specific
  3373. when ($USE_SYSTEM_KYTHE) {
  3374. KYTHE_RESOURCE=$USE_SYSTEM_KYTHE
  3375. }
  3376. otherwise {
  3377. KYTHE_RESOURCE=$KYTHE_RESOURCE_GLOBAL
  3378. }
  3379. # tag:java-specific tag:codenav
  3380. _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
  3381. _DO_JAVA_YNDEXING=
  3382. # tag:java-specific
  3383. SOURCES_JAR=no
  3384. when ($BUILD_TYPE == "DEBUG" && $NO_DEBUGINFO != "yes") {
  3385. SOURCES_JAR=yes
  3386. }
  3387. _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 .
  3388. _PACK_SRC_JAR=
  3389. # tag:java-specific
  3390. _PACK_JNI=
  3391. _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
  3392. # tag:java-specific
  3393. _MAKE_JSTYLE_FILE_LIST=
  3394. # tag:java-specific
  3395. _LINK_UBERJAR=
  3396. _UBERJAR_SELF=
  3397. _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} \
  3398. && $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} $BINDIR/_empty/META-INF \
  3399. && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} $BINDIR/_empty/META-INF/MANIFEST.MF \
  3400. && $UPDATE_VCS_JAVA_INFO_NODEP($TARGET) \
  3401. && ${cwd;suf=/_empty:BINDIR} ${JDK_RESOURCE}/bin/jar ufv ${TARGET} META-INF/MANIFEST.MF \
  3402. && $JDK_RESOURCE/bin/jar ufvm $TARGET $VCS_JAVA
  3403. # tag:java-specific
  3404. macro _PACK_JAR_HELPER(Out) {
  3405. .CMD=${cwd;suf=/cls:BINDIR} ${env:"LC_ALL=en_US.UTF-8"} $JDK_RESOURCE/bin/jar cfvm $Out $VCS_JAVA .
  3406. }
  3407. # tag:java-specific
  3408. macro _JAVAC_RUN_HELPER(JAVAC_CMD_WITH_ARGS...) {
  3409. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${env:"LC_ALL=en_US.UTF-8"} $YMAKE_PYTHON ${input:"build/scripts/with_pathsep_resolve.py"} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} --sources-list ${BINDIR}/all-java.srclst ${JAVAC_CMD_WITH_ARGS} @${BINDIR}/all-java.srclst -classpath ${ARCADIA_BUILD_ROOT}/bfg.jar -Xpkginfo:always ${JAVAC_OPTS} $_JAR_ANN_PROC_OPTS($_JAR_ANN_PROCESSORS) -d ${BINDIR}/cls -g -encoding UTF-8
  3410. }
  3411. macro _ADD_HIDDEN_INPUTS(Inputs...) {
  3412. .CMD=${input;hide:Inputs}
  3413. }
  3414. # tag:java-specific
  3415. 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
  3416. ERROR_PRONE_2_7_1_FORCED_OPTS=-Xep:InlineMeInliner:OFF -Xep:SameNameButDifferent:OFF
  3417. # tag:java-specific
  3418. macro _ADD_OPTS_IF_NON_EMPTY(Opt, Args...) {
  3419. .CMD=${pre=$Opt :Args}
  3420. }
  3421. macro _ADD_GEN_POM_FROM_COORD_FILES_ARGS(Deps...) {
  3422. .CMD=${pre=--deps-coords ;ext=.jar;suf=.mvn_coords:Deps}
  3423. }
  3424. MAVEN_EXPORT_OUT_DIR_FLAG=$_ADD_OPTS_IF_NON_EMPTY(--output-dir ${MAVEN_EXPORT_OUT_DIR})
  3425. MAVEN_EXPORT_SOURCE_DIRS=$_ADD_OPTS_IF_NON_EMPTY(--source-dirs ${ALL_SRCDIRS})
  3426. MAVEN_EXPORT_DEPS_COORS=$_ADD_GEN_POM_FROM_COORD_FILES_ARGS(${MANAGED_PEERS_CLOSURE})
  3427. MAVEN_EXPORT_OUT_DIR=
  3428. MAVEN_EXPORT=no
  3429. MAVEN_DEPLOY=no
  3430. MAVEN_DEPLOY_SOURCES=
  3431. MAVEN_EXPORT_VERSION={vcs_revision}
  3432. MAVEN_EXPORT_GEN_DEPLST= \
  3433. $WRITER_PY \
  3434. --file ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mvn_coords:REALPRJNAME} \
  3435. --ya-start-command-file -m ${pre=D=:MAVEN_EXPORT_COORDS_GLOBAL} ${pre=E=:EXCLUDED_MAVEN_EXPORT_COORDS_GLOBAL} --ya-end-command-file \
  3436. ${hide:APPLIED_EXCLUDES}
  3437. MAVEN_EXPORT_GEN_POM=${kv;hide:"mvn_export yes"} \
  3438. $YMAKE_PYTHON ${input:"build/scripts/generate_pom.py"} \
  3439. --from-coord-files \
  3440. --vcs-info $(VCS)/vcs.json \
  3441. --target-path $MODDIR \
  3442. $MAVEN_EXPORT_SOURCE_DIRS \
  3443. $MAVEN_EXPORT_DEPS_COORS \
  3444. $MAVEN_EXPORT_OUT_DIR_FLAG \
  3445. --target-coords ${suf=.mvn_coords:TARGET} \
  3446. --pom-path ${output:"pom.xml"}
  3447. MAVEN_DEPLOY_CMD=$YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} $MAVEN_BIN \
  3448. deploy:deploy-file -DpomFile=$BINDIR/pom.xml \
  3449. -Dfile=$TARGET -DrepositoryId=$MAVEN_REPO_ID -Durl=$MAVEN_REPO_URL -Djava.net.preferIPv4Addresses=false -Djava.net.preferIPv6Addresses=true \
  3450. ${MAVEN_DEPLOY_SOURCES} \
  3451. $_ADD_OPTS_IF_NON_EMPTY(-gs $MAVEN_EXPORT_SETTINGS) \
  3452. $_ADD_OPTS_IF_NON_EMPTY(-s $MAVEN_EXPORT_SETTINGS)
  3453. MAVEN_EXPORT_CMD=
  3454. # tag:java-specific
  3455. JAVA_COVERAGE_SRCLIST_FLAG=--coverage ${output;pre=${MODULE_PREFIX};suf=.cpsf:REALPRJNAME} --source-root ${ARCADIA_ROOT}
  3456. JAVA_COVERAGE_SRCLIST=
  3457. PREPARE_JAVA_BUILD_DIRS=$FS_TOOLS md ${BINDIR}/cls && $FS_TOOLS md ${BINDIR}/misc
  3458. EXTRACT_GENDIRS=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --unpack --ext .gentar ${ext=.gentar:AUTO_INPUT}
  3459. COLLECT_JAVA_SRCLIST=${YMAKE_PYTHON} ${input:"build/scripts/make_java_srclists.py"} ${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/java_pack_to_file.py"} --moddir ${CURDIR} --java ${BINDIR}/all-java.srclst ${KT_SRSCLIST} ${JAVA_COVERAGE_SRCLIST} --ya-start-command-file ${ALL_JAR_SOURCES} ${ext=.java:AUTO_INPUT} ${ext=.kt:AUTO_INPUT} --ya-end-command-file
  3460. COLLECT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/bfg.txt -m --ya-start-command-file ${rootrel:MANAGED_PEERS_CLOSURE} $KT_CLASSPATH_ITEM --ya-end-command-file
  3461. LINK_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/bfg.txt ${ARCADIA_BUILD_ROOT}/bfg.jar
  3462. COMPILE_JAVA_SRCLIST=$_JAVAC_RUN_HELPER($JAVAC_CMD)
  3463. PACK_JAR=$_PACK_JAR_HELPER($TARGET)
  3464. # NOTE: No && before LINK_JAR_RESOURCES, ALL_KT_COMMANDS and JAR_GEN_SRCS needed since those vars either empty or starts with &&
  3465. LINK_JAR=${hide:JAVA_FAKEID} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"} \
  3466. $PREPARE_JAVA_BUILD_DIRS \
  3467. && $EXTRACT_GENDIRS \
  3468. && $COLLECT_JAVA_SRCLIST \
  3469. $JAR_GEN_SRCS \
  3470. $ALL_KT_COMMANDS \
  3471. && $COLLECT_CLASSPATH \
  3472. && $LINK_CLASSPATH \
  3473. && $COMPILE_JAVA_SRCLIST \
  3474. $LINK_JAR_RESOURCES \
  3475. && ${cwd;suf=/cls:BINDIR} $GENERATE_VCS_JAVA_INFO_NODEP . \
  3476. $_PACK_SRC_JAR \
  3477. $_PACK_JNI \
  3478. && $PACK_JAR \
  3479. $_DO_JAVA_YNDEXING \
  3480. $_MAKE_JSTYLE_FILE_LIST \
  3481. $_LINK_UBERJAR \
  3482. $MAVEN_EXPORT_CMD \
  3483. $_ADD_HIDDEN_INPUTS($JAVA_EXTERNAL_DEPENDENCIES_VALUE)
  3484. # tag:java-specific
  3485. _EXT_SRC_JAR=
  3486. _EXT_JAR=
  3487. _COPY_EXT_SRC_JAR= && $FS_TOOLS md ${BINDIR}/empty && ${cwd;suf=/empty:BINDIR} $JDK_RESOURCE/bin/jar cfvM ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME} .
  3488. _DO_USE_EXT_JAR=${hide:JAVA_FAKEID} $FS_TOOLS copy ${input:_EXT_JAR} $TARGET $_COPY_EXT_SRC_JAR $MAVEN_EXPORT_CMD
  3489. _DO_COPY_EXT_SRC_JAR= && $FS_TOOLS copy $_EXT_SRC_JAR ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
  3490. macro JAVA_RESOURCE(JAR, SOURCES="") {
  3491. SET(_EXT_SRC_JAR $SOURCES)
  3492. SET(_EXT_JAR $JAR)
  3493. }
  3494. # tag:java-specific tag:fbs
  3495. JAVA_FLATBUFFERS_VERSION = 2.0.0
  3496. # tag:java-specific
  3497. module _COMPILABLE_JAR_BASE : _JAR_BASE {
  3498. # flatbuffers-java
  3499. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3500. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  3501. # protobuf-java
  3502. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3503. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  3504. # protobuf-javalite
  3505. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3506. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  3507. # protobuf-java-util
  3508. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  3509. 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})
  3510. }
  3511. _JAR_MAIN_CLASS=
  3512. macro JAR_MAIN_CLASS(Class) {
  3513. SET(_JAR_MAIN_CLASS ${Class})
  3514. }
  3515. _JAR_MAIN_SEM=
  3516. _ADD_JAR_MAIN_SEM= && app_main_class ${_JAR_MAIN_CLASS}
  3517. GRADLE_EXPORT_PUBLISHING=no
  3518. _GRADLE_EXPORT_PUBLISHING_SEM=
  3519. PUBLISH_MAVEN_VERSION=no
  3520. _DO_GRADLE_EXPORT_PUBLISHING_SEM= && publish True && publish_group $MAVEN_EXPORT_GOUP_ID && publish_version $PUBLISH_MAVEN_VERSION
  3521. BUILD_JAR_SEM=jar $MODDIR $REALPRJNAME ${hide:TARGET} ${hide:AUTO_INPUT} && applied_excludes $APPLIED_EXCLUDES && consumer_classpath $_EXPORT_GRADLE_PROJECT_COORDS $_JAR_MAIN_SEM $_GRADLE_EXPORT_PUBLISHING_SEM
  3522. ### _EXPORT_GRADLE_TARGET_ATTR(NAME, VALUE...)
  3523. ###
  3524. ### Add target attribute `NAME` for .SEM if `VALUE` is non-empty
  3525. ### ` && $Name $Value
  3526. macro _EXPORT_GRADLE_TARGET_ATTR(NAME, VALUE...) {
  3527. .SEM=${pre= && $NAME :VALUE}
  3528. }
  3529. BUILD_PROTO_JAR_SEM=jar_proto $MODDIR $REALPRJNAME ${hide:target} ${hide:AUTO_INPUT} && consumer_classpath $_EXPORT_GRADLE_PROJECT_COORDS $_EXPORT_GRADLE_TARGET_ATTR(proto_namespace $PROTO_NAMESPACE) $_EXPORT_GRADLE_TARGET_ATTR(proto_grpc ${ext=yes:_GRPC_ENABLED})
  3530. # tag:java-specific tag:internal
  3531. ### @usage: JAR_LIBRARY() #internal
  3532. ###
  3533. ### Reimplementation of the JAVA_LIBRARY with ymake.core.conf and ymake based dependency management
  3534. module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
  3535. .EXTS=.jsrc .java .jar .mf .gentar .kt
  3536. .CMD=LINK_JAR
  3537. .SEM=BUILD_JAR_SEM
  3538. .FINAL_TARGET=yes
  3539. .ALIASES=JAVA_SRCS=IDEA_JAR_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
  3540. .RESTRICTED=EXTERNAL_JAR
  3541. .GLOBAL=MAVEN_EXPORT_COORDS
  3542. MODULE_SUFFIX=.jar
  3543. PEERDIR(build/platform/java/jdk)
  3544. PEERDIR+=$JDK_RESOURCE_PEERDIR
  3545. when ($_EXT_SRC_JAR) {
  3546. _COPY_EXT_SRC_JAR=_DO_COPY_EXT_SRC_JAR
  3547. }
  3548. when ($_EXT_JAR) {
  3549. LINK_JAR=$_DO_USE_EXT_JAR
  3550. }
  3551. when ($OPENSOURCE_EXPORT == "no") {
  3552. BUILD_JAR_SEM=IGNORED
  3553. }
  3554. when ($_JAR_MAIN_CLASS) {
  3555. _JAR_MAIN_SEM=$_ADD_JAR_MAIN_SEM
  3556. }
  3557. when ($GRADLE_EXPORT_PUBLISHING == "yes") {
  3558. _GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
  3559. }
  3560. # in the ideal world this statement must be under condition bellow
  3561. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
  3562. when ($WITH_KOTLIN_VALUE) {
  3563. KT_SRSCLIST=$KT_SRSCLIST_FLAG
  3564. _MAKE_LINT_KT_FILES_LIST = $YMAKE_PYTHON ${input:"build/scripts/kt_copy.py"} $KT_SRCLIST ${output;noauto:"all-kt-sources.txt"} $(SOURCE_ROOT) $(BUILD_ROOT)
  3565. ALL_KT_COMMANDS=&& $COLLECT_KT_CLASSPATH && $LINK_KT_CLASSPATH
  3566. when ($WITH_KAPT_VALUE == "yes") {
  3567. # For Kapt usage see: https://kotlinlang.org/docs/kapt.html#using-in-cli
  3568. # See for kapt.kotlin.generated: https://github.com/JetBrains/kotlin/blob/master/plugins/kapt3/kapt3-cli/testData/integration/kotlinFileGeneration/build.txt
  3569. _KAPT_OPTS=-Xplugin=${tool:"contrib/java/org/jetbrains/kotlin/kotlin-annotation-processing/1.8.20"} $KT_KAPT_PLUGIN_OPTS
  3570. _RUN_KAPT=${YMAKE_PYTHON} ${input:"build/scripts/with_kapt_args.py"} ${pre=--ap-classpath :KT_KAPT_AP_CLASSPATH} -- $COMPILE_KT $_KAPT_OPTS
  3571. _APPEND_KAPT_GENERATED_SRCS=$YMAKE_PYTHON ${input:"build/scripts/resolve_java_srcs.py"} -d $KT_KAPT_SOURCES_DIR --include-patterns '**/*.java' '**/*.kt' --resolve-kotlin --append -s ${BINDIR}/all-java.srclst -k $KT_SRCLIST -r ${BINDIR}/not-used.txt
  3572. ALL_KT_COMMANDS+=&& $_RUN_KAPT && $_APPEND_KAPT_GENERATED_SRCS
  3573. }
  3574. ALL_KT_COMMANDS+=&& $COMPILE_KT && $_MAKE_LINT_KT_FILES_LIST
  3575. LINK_JAR_RESOURCES+=&& $FS_TOOLS copy_all_files ${KT_CLASSES_DIR} ${BINDIR}/cls
  3576. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  3577. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  3578. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  3579. }
  3580. when($WITH_KOTLINC_PLUGIN_LOMBOK) {
  3581. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-lombok-plugin.jar
  3582. }
  3583. when($WITH_KOTLINC_PLUGIN_NOARG) {
  3584. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  3585. }
  3586. when($WITH_KOTLINC_PLUGIN_SERIALIZATION) {
  3587. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-serialization-plugin.jar
  3588. }
  3589. # Must be in sync with KT_CLASSES_DIR!
  3590. # There are problems in JDK13 with abs paths in classpath baked into jar file manifest. Using relative path
  3591. # here assumes that jar file with classpath for javac located in the $ARCADIA_BUILD_ROOT
  3592. KT_CLASSPATH_ITEM=$MODDIR/kt_cls
  3593. }
  3594. otherwise {
  3595. KT_SRSCLIST=
  3596. ALL_KT_COMMANDS=
  3597. KT_CLASSES=
  3598. }
  3599. when ($MAVEN_EXPORT == "yes") {
  3600. when ($MAVEN_DEPLOY == "yes") {
  3601. PEERDIR+=build/external_resources/maven
  3602. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM && $MAVEN_DEPLOY_CMD
  3603. }
  3604. otherwise {
  3605. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM
  3606. }
  3607. MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GOUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
  3608. }
  3609. when ($SOURCES_JAR == "yes") {
  3610. _PACK_SRC_JAR=$_PACK_SRC_JAR_IMPL
  3611. MAVEN_DEPLOY_SOURCES=-Dsources=${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
  3612. }
  3613. when ($JAVA_COVERAGE == "yes") {
  3614. JAVA_COVERAGE_SRCLIST=$JAVA_COVERAGE_SRCLIST_FLAG
  3615. }
  3616. when ($MAKE_UBERJAR_VALUE == "yes") {
  3617. _LINK_UBERJAR=$_DO_LINK_UBERJAR
  3618. PACK_JAR=$_PACK_JAR_HELPER(${BINDIR}/${REALPRJNAME}.lib.jar)
  3619. # TODO: This condition is incorrect in case of autoinputs _UBERJAR_SELF should be empty only for
  3620. # modules without AUTO_INPUT and without JAVA_SRCS added inputs.
  3621. when($ALL_JAR_SOURCES) {
  3622. _UBERJAR_SELF=--jar ${BINDIR}/${REALPRJNAME}.lib.jar
  3623. }
  3624. PEERDIR+=build/platform/java/uberjar
  3625. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  3626. }
  3627. when($JAVA_YNDEXING == "yes") {
  3628. PEERDIR+=build/platform/java/kythe
  3629. _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"}
  3630. }
  3631. when($ERROR_PRONE_VALUE) {
  3632. PEERDIR+=$ERROR_PRONE_PEERDIR
  3633. JAVAC_CMD=$ERROR_PRONE_JAVAC_CMD
  3634. }
  3635. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
  3636. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3637. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3638. }
  3639. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "17") {
  3640. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3641. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3642. }
  3643. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "18") {
  3644. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3645. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3646. }
  3647. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "19") {
  3648. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3649. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3650. }
  3651. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "20") {
  3652. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
  3653. JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
  3654. }
  3655. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  3656. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3657. JAVAC_OPTS+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  3658. }
  3659. when ($JAVA_ADD_DLLS_VALUE == "yes") {
  3660. CONSUME_NON_MANAGEABLE_PEERS=yes
  3661. _PACK_JNI=$_PACK_JNI_CMD
  3662. }
  3663. when ($LINT_LEVEL_VALUE != "none") {
  3664. _MAKE_JSTYLE_FILE_LIST= && ${WRITER_PY} --file ${output;noauto:"lint-java.srclst"} -m --ya-start-command-file $LINT_JAVA_SOURCES --ya-end-command-file
  3665. }
  3666. SET(MODULE_TYPE JAVA_LIBRARY)
  3667. ENABLE(YMAKE_JAVA_TEST)
  3668. _ADD_KOTLIN_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/all-kt-sources.txt REQUIREMENTS cpu:2)
  3669. _ADD_JAVA_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/lint-java.srclst::$(SOURCE_ROOT))
  3670. _ADD_CLASSPATH_CLASH_CHECK()
  3671. JAVA_MODULE()
  3672. }
  3673. # tag:java-specific
  3674. _SCRIPTGEN_FLAGS=
  3675. macro _GEN_JAVA_SCRIPT_IMPL(Out, Template, Props...) {
  3676. .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
  3677. }
  3678. # tag:java-specific
  3679. _GEN_USERSCRIPTS=
  3680. macro _ADD_GEN_JAVA_SCRIPT(Out, Template, Props...) {
  3681. SET_APPEND(_GEN_USERSCRIPTS && \$_GEN_JAVA_SCRIPT_IMPL($Out $Template $Props))
  3682. }
  3683. # tag:java-specific
  3684. _PACK_JDK=
  3685. # tag:java-specific
  3686. DO_GEN_JAVA_RUN_SH=
  3687. _SOURCE_JARS=
  3688. _SOURCE_JARS_CPLIST=
  3689. GEN_JAVA_RUN_SH=$SCRIPTGEN_RESOURCE_GLOBAL/scriptgen --java $JDK_RESOURCE/bin/java --output ${output:"run.sh"} -D GENERATE_DEFAULT_RUNNER=yes -D JAR_NAME=${REALPRJNAME}.jar -D CLASSPATH=${nopath;join;pre="::":MANAGED_PEERS_CLOSURE} -D PROJECT_DIR=${REALPRJNAME} -D JAR_BASENAME=${REALPRJNAME}
  3690. GEN_RUN_CP=${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${nopath;qe;pre=$REALPRJNAME/:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET}
  3691. 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}
  3692. MAKE_JAR_PROGRAM_CPLST=${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} --ya-start-command-file ${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS_CPLIST} --ya-end-command-file
  3693. TAR_CLASSPATH= && $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} ${output;pre=$MODULE_PREFIX;suf=.tar:REALPRJNAME} ${cwd;pre=$BINDIR/:REALPRJNAME}
  3694. DO_TAR_CLASSPATH=
  3695. LINK_JAR_PROGRAM=${hide:JAVA_FAKEID} $FS_TOOLS md ${BINDIR}/${REALPRJNAME} && $COLLECT_JAR_PROGRAM_CP && $DO_GEN_JAVA_RUN_SH && $GEN_RUN_CP && $MAKE_JAR_PROGRAM_CPLST $DO_TAR_CLASSPATH $_GEN_USERSCRIPTS $_PACK_JDK ${kv;hide:"p JP"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  3696. # tag:java-specific
  3697. # UBERJAR program link command
  3698. LINK_UBERJAR_PROGRAM=${hide:JAVA_FAKEID} ${kv;hide:"p UJ"} ${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} $TARGET \
  3699. && $FS_TOOLS md ${BINDIR}/${REALPRJNAME} \
  3700. && $FS_TOOLS link_or_copy ${BINDIR}/${REALPRJNAME}.jar $TARGET \
  3701. && $FS_TOOLS link_or_copy_to_dir --ya-start-command-file ${BINDIR}/${REALPRJNAME}.jar ${ext=.so:MANAGED_PEERS_CLOSURE} ${ext=.dll:MANAGED_PEERS_CLOSURE} ${ext=.dylib:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS} --ya-end-command-file ${BINDIR}/${REALPRJNAME} ${hide;output;ext=.jar;pre=$BINDIR/$REALPRJNAME/:REALPRJNAME} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} \
  3702. $DO_TAR_CLASSPATH \
  3703. $_GEN_USERSCRIPTS \
  3704. $_PACK_JDK
  3705. # tag:java-specific
  3706. RUN_WITH_SOURCES=no
  3707. # TODO jbuild creates tar with all classpath deps by default and some projects rely on this. In ymake build this tar file creation is not needed and should be disabled by default in future
  3708. TARED_CLASSPATH=yes
  3709. _JAR_SRCS_CALLED=no
  3710. # tag:java-specific
  3711. macro _MARK_JAVA_PROG_WITH_SOURCES(Args...) {
  3712. ENABLE(_JAR_SRCS_CALLED)
  3713. }
  3714. # tag:java-specific
  3715. module _JAR_RUNNABLE: _COMPILABLE_JAR_BASE {
  3716. .FINAL_TARGET=yes
  3717. .CMD=LINK_JAR_PROGRAM
  3718. .SEM=IGNORED
  3719. .ALIASES=JAVA_SRCS=_MARK_JAVA_PROG_WITH_SOURCES GENERATE_SCRIPT=_YMAKE_GENERATE_SCRIPT
  3720. .ALLOWED=WITH_JDK
  3721. MODULE_SUFFIX=.run.cp.jar
  3722. CONSUME_NON_MANAGEABLE_PEERS=yes
  3723. when ($RUN_WITH_SOURCES == "yes") {
  3724. _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}
  3725. _SOURCE_JARS_CPLIST=${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
  3726. }
  3727. when ($TARED_CLASSPATH == "yes") {
  3728. DO_TAR_CLASSPATH=$TAR_CLASSPATH
  3729. }
  3730. when ($DISABLE_SCRIPTGEN) {
  3731. DO_GEN_JAVA_RUN_SH=
  3732. }
  3733. otherwise {
  3734. DO_GEN_JAVA_RUN_SH=$GEN_JAVA_RUN_SH
  3735. PEERDIR+=build/platform/java/scriptgen
  3736. }
  3737. when ($WITH_JDK_VALUE) {
  3738. _PACK_JDK= && ${YMAKE_PYTHON} ${input:"build/scripts/tar_directory.py"} ${output;tared:"jdk.tar"} $WITH_JDK_RESOURCE $WITH_JDK_RESOURCE
  3739. }
  3740. when ($MAKE_UBERJAR_VALUE == "yes") {
  3741. LINK_JAR_PROGRAM=$LINK_UBERJAR_PROGRAM
  3742. DYNAMIC_LINK=no
  3743. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=yes
  3744. }
  3745. otherwise {
  3746. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=no
  3747. }
  3748. CHECK_PROVIDES()
  3749. }
  3750. # tag:java-specific
  3751. multimodule JAR_PROGRAM {
  3752. module JAR_RUNNABLE: _JAR_RUNNABLE {
  3753. .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
  3754. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3755. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
  3756. .PEERDIRSELF=JAR_COMPILATION
  3757. SET(MODULE_TYPE JAVA_PROGRAM)
  3758. }
  3759. module JAR_COMPILATION: JAR_LIBRARY {
  3760. .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
  3761. .FINAL_TARGET=no
  3762. SET(MODULE_TYPE JAVA_PROGRAM)
  3763. }
  3764. }
  3765. # tag:java-specific
  3766. LINK_JAR_TEST=${hide:JAVA_FAKEID} ${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET} ${kv;hide:"p JT"}
  3767. YMAKE_JAVA_TEST=
  3768. module _JAR_TEST: _COMPILABLE_JAR_BASE {
  3769. .FINAL_TARGET=yes
  3770. .CMD=LINK_JAR_TEST
  3771. .DEFAULT_NAME_GENERATOR=FullPath
  3772. CONSUME_NON_MANAGEABLE_PEERS=yes
  3773. SET(MODULE_SUFFIX .test.cp.jar)
  3774. ENABLE(YMAKE_JAVA_TEST)
  3775. JAVA_TEST()
  3776. CHECK_PROVIDES()
  3777. }
  3778. # tag:java-specific
  3779. multimodule JUNIT5_YMAKE {
  3780. module JAR_TESTABLE: _JAR_TEST {
  3781. .ALLOWED=JAVA_TEST_PEERDIR
  3782. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3783. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_TEST_PEERDIR=PEERDIR
  3784. .PEERDIRSELF=JAR_COMPILATION
  3785. SET(MODULE_TYPE JUNIT5)
  3786. }
  3787. module JAR_COMPILATION: JAR_LIBRARY {
  3788. .IGNORED=JAVA_TEST_PEERDIR
  3789. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO
  3790. .FINAL_TARGET=no
  3791. PEERDIR(devtools/junit5-runner build/platform/java/jacoco-agent)
  3792. }
  3793. }
  3794. # tag:java-specific
  3795. multimodule JTEST_YMAKE {
  3796. module JAR_TESTABLE: _JAR_TEST {
  3797. .ALLOWED=YT_SPEC
  3798. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
  3799. .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_TEST_PEERDIR=PEERDIR
  3800. .PEERDIRSELF=JAR_COMPILATION
  3801. SET(MODULE_TYPE JTEST)
  3802. PEERDIR(devtools/junit-runner)
  3803. 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)
  3804. }
  3805. module JAR_COMPILATION: JAR_LIBRARY {
  3806. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO
  3807. .ALLOWED=YT_SPEC
  3808. .FINAL_TARGET=no
  3809. DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
  3810. PEERDIR(build/platform/java/jacoco-agent)
  3811. }
  3812. }
  3813. # tag:python-specific tag:deprecated
  3814. ### @usage: PY2_LIBRARY() # deprecated
  3815. ###
  3816. ### Deprecated. Use PY23_LIBRARY or PY3_LIBRARY instead.
  3817. ### Python 2.x binary built library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM.
  3818. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3819. ### This module is only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3820. ### This module is only compatible with Arcadia Python build.
  3821. ###
  3822. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3823. module PY2_LIBRARY: _LIBRARY {
  3824. _ARCADIA_PYTHON_ADDINCL()
  3825. when ($NO_PYTHON_INCLS != "yes") {
  3826. PEERDIR+=contrib/libs/python
  3827. }
  3828. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3829. MODULE_PREFIX=py
  3830. }
  3831. otherwise {
  3832. MODULE_PREFIX=libpy
  3833. }
  3834. .ALLOWED=FORK_TESTS
  3835. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3836. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS STYLE_PYTHON
  3837. USE_GLOBAL_CMD=yes
  3838. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3839. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3840. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3841. 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}"})
  3842. }
  3843. SET(MODULE_LANG PY2)
  3844. ADD_CLANG_TIDY()
  3845. }
  3846. # tag:python-specific
  3847. ### @usage: PY3_LIBRARY()
  3848. ###
  3849. ### Python 3.x binary library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM
  3850. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3851. ### This module is only compatible with PYTHON3-tagged modules and selects those from multimodules.
  3852. ### This module is only compatible with Arcadia Python build.
  3853. ###
  3854. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3855. module PY3_LIBRARY: _LIBRARY {
  3856. _ARCADIA_PYTHON3_ADDINCL()
  3857. when ($NO_PYTHON_INCLS != "yes") {
  3858. PEERDIR+=contrib/libs/python
  3859. }
  3860. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3861. MODULE_PREFIX=py
  3862. }
  3863. otherwise {
  3864. MODULE_PREFIX=libpy
  3865. }
  3866. .ALLOWED=FORK_TESTS
  3867. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3868. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2 OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3869. USE_GLOBAL_CMD=yes
  3870. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3871. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3872. PYTHON_TYPE_FOR_CYTHON=PY3
  3873. ANTLR_PYTHON=Python3
  3874. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3875. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3876. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3877. 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}"})
  3878. }
  3879. SET(MODULE_LANG PY3)
  3880. ADD_CLANG_TIDY()
  3881. }
  3882. # tag:python-specific
  3883. ### @usage: _BASE_PY_PROGRAM #internal
  3884. ###
  3885. ### The base module for all Python 2.x binary programs. Adds linking logic, relevant module properties and
  3886. ### dependency on Python 2.x interpreter. Also adds import tests on all sources including PEERDIR'ed libraries.
  3887. ### Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  3888. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3889. ###
  3890. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3891. module _BASE_PY_PROGRAM: _BASE_PROGRAM {
  3892. .CMD=PY_PROGRAM_LINK_EXE
  3893. _ARCADIA_PYTHON_ADDINCL()
  3894. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3895. NO_CHECK_IMPORTS_FOR_VALUE=
  3896. }
  3897. ADD_CHECK_PY_IMPORTS()
  3898. when ($NO_PYTHON_INCLS != "yes") {
  3899. PEERDIR += contrib/libs/python
  3900. }
  3901. when ($USE_ARCADIA_PYTHON == "yes") {
  3902. PEERDIR += library/python/runtime/main
  3903. PEERDIR += contrib/deprecated/python/subprocess32
  3904. when ($PYTHON_SQLITE3 != "no") {
  3905. PEERDIR += contrib/tools/python/src/Modules/_sqlite
  3906. }
  3907. }
  3908. when ($PYTHON_COVERAGE == "yes") {
  3909. PEERDIR+=library/python/coverage
  3910. }
  3911. when ($ARCH_PPC64LE == "yes") {
  3912. _MY_ALLOCATOR=SYSTEM
  3913. }
  3914. otherwise {
  3915. _MY_ALLOCATOR=J
  3916. }
  3917. ALLOCATOR($_MY_ALLOCATOR)
  3918. STRIP()
  3919. when ($BUILD_TYPE == "DEBUG") {
  3920. NO_STRIP=yes
  3921. }
  3922. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3923. NO_STRIP=yes
  3924. }
  3925. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3926. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3927. SET(MODULE_LANG PY2)
  3928. }
  3929. # tag:python-specific tag:codenav
  3930. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3931. PY3_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"py3yndex $TARGET"}
  3932. }
  3933. otherwise {
  3934. PY3_PROGRAM_LINK_EXE=$LINK_EXE
  3935. }
  3936. # tag:python-specific
  3937. ### @usage: _BASE_PY_PROGRAM #internal
  3938. ###
  3939. ### The base module for all Python 3.x binary programs. Adds linking logic, relevant module properties and
  3940. ### dependency on Python 3.x interpreter. Also adds import tests on all sources including libraries.
  3941. ### Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  3942. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules
  3943. ###
  3944. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3945. module _BASE_PY3_PROGRAM: _BASE_PROGRAM {
  3946. .CMD=PY3_PROGRAM_LINK_EXE
  3947. _ARCADIA_PYTHON3_ADDINCL()
  3948. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3949. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3950. PYTHON_TYPE_FOR_CYTHON=PY3
  3951. PEERDIR(library/python/runtime_py3/main)
  3952. when ($PYTHON_SQLITE3 != "no") {
  3953. PEERDIR += contrib/tools/python3/src/Modules/_sqlite
  3954. }
  3955. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3956. NO_CHECK_IMPORTS_FOR_VALUE=
  3957. }
  3958. ADD_CHECK_PY_IMPORTS()
  3959. when ($ARCH_PPC64LE == "yes") {
  3960. _MY_ALLOCATOR=SYSTEM
  3961. }
  3962. otherwise {
  3963. _MY_ALLOCATOR=J
  3964. }
  3965. ALLOCATOR($_MY_ALLOCATOR)
  3966. STRIP()
  3967. when ($NO_PYTHON_INCLS != "yes") {
  3968. PEERDIR+=contrib/libs/python
  3969. }
  3970. when ($BUILD_TYPE == "DEBUG") {
  3971. NO_STRIP=yes
  3972. }
  3973. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3974. NO_STRIP=yes
  3975. }
  3976. when ($PYTHON_COVERAGE == "yes") {
  3977. PEERDIR+=library/python/coverage
  3978. }
  3979. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3980. PEERDIR += contrib/python/six
  3981. }
  3982. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3983. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2
  3984. SET(MODULE_LANG PY3)
  3985. SET(ANTLR_PYTHON Python3)
  3986. }
  3987. # tag:python-specific
  3988. ### @usage: PY3_PROGRAM_BIN([progname])
  3989. ### Use instead of PY3_PROGRAM only if ya.make with PY3_PROGRAM() included in another ya.make
  3990. ### In all other cases use PY3_PROGRAM
  3991. module PY3_PROGRAM_BIN: _BASE_PY3_PROGRAM {
  3992. # Look's like we cannot avoid copy-paste util ymake supports multiple inheritance
  3993. # We need to attach coverage.extractor to every py_program target, except pytest targets
  3994. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  3995. }
  3996. # tag:java-specific
  3997. JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
  3998. # tag:java-specific
  3999. JDK_REAL_VERSION=
  4000. JDK_VERSION=
  4001. when ($JDK_VERSION == "20") {
  4002. JDK_REAL_VERSION=20
  4003. }
  4004. elsewhen ($JDK_VERSION == "19") {
  4005. JDK_REAL_VERSION=19
  4006. }
  4007. elsewhen ($JDK_VERSION == "18") {
  4008. JDK_REAL_VERSION=18
  4009. }
  4010. elsewhen ($JDK_VERSION == "17") {
  4011. JDK_REAL_VERSION=17
  4012. }
  4013. elsewhen ($JDK_VERSION == "16") {
  4014. JDK_REAL_VERSION=16
  4015. }
  4016. elsewhen ($JDK_VERSION == "15") {
  4017. JDK_REAL_VERSION=15
  4018. }
  4019. elsewhen ($JDK_VERSION == "11") {
  4020. JDK_REAL_VERSION=11
  4021. }
  4022. elsewhen ($JDK_VERSION == "10") {
  4023. JDK_REAL_VERSION=10
  4024. }
  4025. elsewhen ($JDK_VERSION == "8") {
  4026. JDK_REAL_VERSION=8
  4027. }
  4028. elsewhen ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
  4029. JDK_REAL_VERSION=11
  4030. }
  4031. otherwise {
  4032. JDK_REAL_VERSION=17
  4033. }
  4034. # tag:java-specific
  4035. # remove extra peerdir to jdk11 after https://st.yandex-team.ru/DEVTOOLS-8851 is done
  4036. when ($USE_SYSTEM_JDK) {
  4037. JDK_RESOURCE_PEERDIR=
  4038. }
  4039. otherwise {
  4040. when ($JDK_REAL_VERSION == "20") {
  4041. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk20 build/platform/java/jdk/jdk17
  4042. }
  4043. when ($JDK_REAL_VERSION == "19") {
  4044. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk19 build/platform/java/jdk/jdk17
  4045. }
  4046. when ($JDK_REAL_VERSION == "18") {
  4047. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk18 build/platform/java/jdk/jdk17
  4048. }
  4049. when ($JDK_REAL_VERSION == "17") {
  4050. # need jdk11 for spare parts in "host" platform
  4051. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk17 build/platform/java/jdk/jdk11
  4052. }
  4053. when ($JDK_REAL_VERSION == "16") {
  4054. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk16 build/platform/java/jdk/jdk17
  4055. }
  4056. when ($JDK_REAL_VERSION == "15") {
  4057. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk15 build/platform/java/jdk/jdk17
  4058. }
  4059. when ($JDK_REAL_VERSION == "11") {
  4060. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk11 build/platform/java/jdk/jdk17
  4061. }
  4062. when ($JDK_REAL_VERSION == "10") {
  4063. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk10 build/platform/java/jdk/jdk17
  4064. }
  4065. when ($JDK_REAL_VERSION == "8") {
  4066. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk8 build/platform/java/jdk/jdk17
  4067. }
  4068. }
  4069. # tag:java-specific
  4070. when ($JDK_REAL_VERSION == "20") {
  4071. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar20
  4072. }
  4073. when ($JDK_REAL_VERSION == "19") {
  4074. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
  4075. }
  4076. when ($JDK_REAL_VERSION == "18") {
  4077. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
  4078. }
  4079. when ($JDK_REAL_VERSION == "17") {
  4080. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar17
  4081. }
  4082. when ($JDK_REAL_VERSION == "16") {
  4083. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar16
  4084. }
  4085. when ($JDK_REAL_VERSION == "15") {
  4086. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar15
  4087. }
  4088. when ($JDK_REAL_VERSION == "11") {
  4089. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar11
  4090. }
  4091. when ($JDK_REAL_VERSION == "10") {
  4092. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar10
  4093. }
  4094. when ($JDK_REAL_VERSION == "8") {
  4095. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar8
  4096. }
  4097. # tag:java-specific
  4098. JAVAC_OPTS=
  4099. when ($USE_SYSTEM_JDK) {
  4100. JDK_RESOURCE=$USE_SYSTEM_JDK
  4101. }
  4102. otherwise {
  4103. when ($JDK_REAL_VERSION == "20") {
  4104. JDK_RESOURCE=$JDK20_RESOURCE_GLOBAL
  4105. }
  4106. when ($JDK_REAL_VERSION == "19") {
  4107. JDK_RESOURCE=$JDK19_RESOURCE_GLOBAL
  4108. }
  4109. when ($JDK_REAL_VERSION == "18") {
  4110. JDK_RESOURCE=$JDK18_RESOURCE_GLOBAL
  4111. }
  4112. when ($JDK_REAL_VERSION == "17") {
  4113. JDK_RESOURCE=$JDK17_RESOURCE_GLOBAL
  4114. }
  4115. when ($JDK_REAL_VERSION == "16") {
  4116. JDK_RESOURCE=$JDK16_RESOURCE_GLOBAL
  4117. }
  4118. when ($JDK_REAL_VERSION == "15") {
  4119. JDK_RESOURCE=$JDK15_RESOURCE_GLOBAL
  4120. }
  4121. when ($JDK_REAL_VERSION == "11") {
  4122. JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  4123. }
  4124. when ($JDK_REAL_VERSION == "10") {
  4125. JDK_RESOURCE=$JDK10_RESOURCE_GLOBAL
  4126. }
  4127. when ($JDK_REAL_VERSION == "8") {
  4128. JDK_RESOURCE=$JDK8_RESOURCE_GLOBAL
  4129. }
  4130. }
  4131. # tag:java-specific
  4132. when (!$USE_SYSTEM_ERROR_PRONE) {
  4133. # Still not done: DTCC-667
  4134. when ($JDK_REAL_VERSION == "8" || $JDK_REAL_VERSION == "10") {
  4135. ERROR_PRONE_VERSION=2.3.1
  4136. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.3.1
  4137. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_3_1_RESOURCE_GLOBAL
  4138. }
  4139. elsewhen ($JDK_REAL_VERSION == "11" || $JDK_REAL_VERSION == "15" || $JDK_REAL_VERSION == "16") {
  4140. ERROR_PRONE_VERSION=2.7.1
  4141. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.7.1
  4142. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_7_1_RESOURCE_GLOBAL
  4143. }
  4144. elsewhen ($JDK_REAL_VERSION == "17") {
  4145. ERROR_PRONE_VERSION=2.10.0
  4146. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.10.0
  4147. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_10_0_RESOURCE_GLOBAL
  4148. }
  4149. elsewhen ($JDK_REAL_VERSION == "18") {
  4150. ERROR_PRONE_VERSION=2.14.0
  4151. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.14.0
  4152. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_14_0_RESOURCE_GLOBAL
  4153. }
  4154. elsewhen ($JDK_REAL_VERSION == "19") {
  4155. ERROR_PRONE_VERSION=2.18.0
  4156. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
  4157. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
  4158. }
  4159. elsewhen ($JDK_REAL_VERSION == "20") {
  4160. ERROR_PRONE_VERSION=2.18.0
  4161. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
  4162. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
  4163. }
  4164. otherwise {
  4165. ERROR_PRONE_VERSION=2.7.1
  4166. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  4167. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  4168. }
  4169. }
  4170. otherwise {
  4171. ERROR_PRONE_VERSION=2.7.1
  4172. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  4173. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  4174. }
  4175. # tag:java-specific
  4176. when ($USE_SYSTEM_UBERJAR) {
  4177. UBERJAR_RESOURCE=$USE_SYSTEM_UBERJAR
  4178. }
  4179. otherwise {
  4180. when ($JDK_REAL_VERSION == "20") {
  4181. UBERJAR_RESOURCE=$UBERJAR20_RESOURCE_GLOBAL
  4182. }
  4183. when ($JDK_REAL_VERSION == "19") {
  4184. UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
  4185. }
  4186. when ($JDK_REAL_VERSION == "18") {
  4187. UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
  4188. }
  4189. when ($JDK_REAL_VERSION == "17") {
  4190. UBERJAR_RESOURCE=$UBERJAR17_RESOURCE_GLOBAL
  4191. }
  4192. when ($JDK_REAL_VERSION == "16") {
  4193. UBERJAR_RESOURCE=$UBERJAR16_RESOURCE_GLOBAL
  4194. }
  4195. when ($JDK_REAL_VERSION == "15") {
  4196. UBERJAR_RESOURCE=$UBERJAR15_RESOURCE_GLOBAL
  4197. }
  4198. when ($JDK_REAL_VERSION == "11") {
  4199. UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
  4200. }
  4201. when ($JDK_REAL_VERSION == "10") {
  4202. UBERJAR_RESOURCE=$UBERJAR10_RESOURCE_GLOBAL
  4203. }
  4204. when ($JDK_REAL_VERSION == "8") {
  4205. UBERJAR_RESOURCE=$UBERJAR8_RESOURCE_GLOBAL
  4206. }
  4207. }
  4208. # tag:java-specific
  4209. when ($JDK_REAL_VERSION == "20") {
  4210. WITH_JDK_RESOURCE=$WITH_JDK20_RESOURCE_GLOBAL
  4211. }
  4212. when ($JDK_REAL_VERSION == "19") {
  4213. WITH_JDK_RESOURCE=$WITH_JDK19_RESOURCE_GLOBAL
  4214. }
  4215. when ($JDK_REAL_VERSION == "18") {
  4216. WITH_JDK_RESOURCE=$WITH_JDK18_RESOURCE_GLOBAL
  4217. }
  4218. when ($JDK_REAL_VERSION == "17") {
  4219. WITH_JDK_RESOURCE=$WITH_JDK17_RESOURCE_GLOBAL
  4220. }
  4221. when ($JDK_REAL_VERSION == "16") {
  4222. WITH_JDK_RESOURCE=$WITH_JDK16_RESOURCE_GLOBAL
  4223. }
  4224. when ($JDK_REAL_VERSION == "15") {
  4225. WITH_JDK_RESOURCE=$WITH_JDK15_RESOURCE_GLOBAL
  4226. }
  4227. when ($JDK_REAL_VERSION == "11") {
  4228. WITH_JDK_RESOURCE=$WITH_JDK11_RESOURCE_GLOBAL
  4229. }
  4230. when ($JDK_REAL_VERSION == "10") {
  4231. WITH_JDK_RESOURCE=$WITH_JDK10_RESOURCE_GLOBAL
  4232. }
  4233. when ($JDK_REAL_VERSION == "8") {
  4234. WITH_JDK_RESOURCE=$WITH_JDK8_RESOURCE_GLOBAL
  4235. }
  4236. # tag:java-specific
  4237. EXTERNAL_JAVA_JDK_RESOURCE=
  4238. EXTERNAL_JAVA_EXTRA_PEERDIR=
  4239. when ($USE_SYSTEM_JDK) {
  4240. EXTERNAL_JAVA_EXTRA_PEERDIR=
  4241. EXTERNAL_JAVA_JDK_RESOURCE=$USE_SYSTEM_JDK
  4242. }
  4243. elsewhen ($JDK_VERSION == "") {
  4244. EXTERNAL_JAVA_JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  4245. EXTERNAL_JAVA_EXTRA_PEERDIR=build/platform/java/jdk/jdk11
  4246. }
  4247. otherwise {
  4248. EXTERNAL_JAVA_JDK_RESOURCE=$JDK_RESOURCE
  4249. }
  4250. COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_java.py"} --java-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/java --javac-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/jar --kotlin-compiler $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar $JAVA_VCS_MF_ARG $PACKAGE_PREFIX_ARGS --jar-output $TARGET --srcs-jar-output ${output;suf=-sources.jar:REALPRJNAME} $AUTO_INPUT DELIM $JAVAC_OPTS DELIM $MANAGED_PEERS_CLOSURE DELIM -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} ${KOTLINC_OPTS_VALUE} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"}
  4251. 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
  4252. ARGS_DELIM="MACRO_CALLS_DELIM"
  4253. SYSTEM_PROPERTIES_VALUE=
  4254. ### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
  4255. ###
  4256. ### List of Key,Value pairs that will be available to test via System.getProperty().
  4257. ### FILE means that parst should be read from file specifies as Path.
  4258. ###
  4259. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4260. macro SYSTEM_PROPERTIES(Args...) {
  4261. SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
  4262. }
  4263. # tag:java-specific
  4264. JVM_ARGS_VALUE=
  4265. ### @usage: JVM_ARGS(Args...)
  4266. ###
  4267. ### Arguments to run Java programs in tests.
  4268. ###
  4269. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4270. macro JVM_ARGS(Args...) {
  4271. SET_APPEND(JVM_ARGS_VALUE $Args)
  4272. }
  4273. # tag:java-specific
  4274. CHECK_JAVA_DEPS_VALUE=
  4275. ### @usage: CHECK_JAVA_DEPS(<yes|no>)
  4276. ###
  4277. ### Check for different classes with duplicate name in classpath.
  4278. ###
  4279. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4280. macro CHECK_JAVA_DEPS(Arg) {
  4281. SET(CHECK_JAVA_DEPS_VALUE $Arg)
  4282. }
  4283. ERROR_PRONE_VALUE=
  4284. ### @usage: USE_ERROR_PRONE()
  4285. ###
  4286. ### Use errorprone instead of javac for .java compilation.
  4287. macro USE_ERROR_PRONE() {
  4288. SET(ERROR_PRONE_VALUE yes)
  4289. }
  4290. TEST_CWD_VALUE=
  4291. ### @usage: TEST_CWD(path)
  4292. ###
  4293. ### Defines working directory for test runs. Often used in conjunction with DATA() macro.
  4294. ### Is only used inside of the TEST modules.
  4295. ###
  4296. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  4297. macro TEST_CWD(Arg) {
  4298. SET(TEST_CWD_VALUE $Arg)
  4299. }
  4300. # tag:java-specific
  4301. MAKE_UBERJAR_VALUE=
  4302. ### @usage: UBERJAR()
  4303. ###
  4304. ### UBERJAR is a single all-in-one jar-archive that includes all its Java dependencies (reachable PEERDIR).
  4305. ### It also supports shading classes inside the archive by moving them to a different package (similar to the maven-shade-plugin).
  4306. ### Use UBERJAR inside JAVA_PROGRAM module.
  4307. ###
  4308. ### You can use the following macros to configure the archive:
  4309. ### 1. UBERJAR_HIDING_PREFIX prefix for classes to shade (classes remain in their packages by default)
  4310. ### 2. UBERJAR_HIDE_EXCLUDE_PATTERN exclude classes matching this patterns from shading (if enabled).
  4311. ### 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)
  4312. ### 4. UBERJAR_MANIFEST_TRANSFORMER_MAIN add ManifestResourceTransformer class to uberjar processing and specify main-class
  4313. ### 5. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE add ManifestResourceTransformer class to uberjar processing and specify some attribute
  4314. ### 6. UBERJAR_APPENDING_TRANSFORMER add AppendingTransformer class to uberjar processing
  4315. ### 7. UBERJAR_SERVICES_RESOURCE_TRANSFORMER add ServicesResourceTransformer class to uberjar processing
  4316. ###
  4317. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  4318. ###
  4319. ### @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)
  4320. macro UBERJAR() {
  4321. SET(MAKE_UBERJAR_VALUE yes)
  4322. DISABLE(PASS_PEERS)
  4323. }
  4324. # tag:java-specific
  4325. UBERJAR_PREFIX_VALUE=
  4326. UBERJAR_PREFIX_FLAG=
  4327. ### @usage: UBERJAR_HIDING_PREFIX(Arg)
  4328. ###
  4329. ### Set prefix for classes to shade. All classes in UBERJAR will be moved into package prefixed with Arg.
  4330. ### Classes remain in their packages by default.
  4331. ###
  4332. ### @see: [UBERJAR](#macro_UBERJAR)
  4333. macro UBERJAR_HIDING_PREFIX(Arg) {
  4334. SET(UBERJAR_PREFIX_VALUE $Arg)
  4335. SET(UBERJAR_PREFIX_FLAG ${pre=--shade-prefix :Arg})
  4336. }
  4337. # tag:java-specific
  4338. UBERJAR_HIDE_EXCLUDE_VALUE=
  4339. UBERJAR_HIDE_EXCLUDE_FLAGS=
  4340. ### @usage: UBERJAR_HIDE_EXCLUDE_PATTERN(Args...)
  4341. ###
  4342. ### Exclude classes matching this patterns from shading (if enabled).
  4343. ### Pattern may contain '*' and '**' globs.
  4344. ### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
  4345. ###
  4346. ### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
  4347. macro UBERJAR_HIDE_EXCLUDE_PATTERN(Args...) {
  4348. SET_APPEND(UBERJAR_HIDE_EXCLUDE_VALUE $ARGS_DELIM $Args)
  4349. SET_APPEND(UBERJAR_HIDE_EXCLUDE_FLAGS ${pre=--shade-exclude :Args})
  4350. }
  4351. # tag:java-specific
  4352. UBERJAR_PATH_EXCLUDES=
  4353. UBERJAR_PATH_EXCLUDE_VALUE=
  4354. ### @usage: UBERJAR_PATH_EXCLUDE_PREFIX(Args...)
  4355. ###
  4356. ### Exclude classes matching this patterns from UBERJAR.
  4357. ### By default all dependencies of UBERJAR program will lend in a .jar archive.
  4358. ###
  4359. ### @see: [UBERJAR](#macro_UBERJAR)
  4360. macro UBERJAR_PATH_EXCLUDE_PREFIX(Args...) {
  4361. SET_APPEND(UBERJAR_PATH_EXCLUDE_VALUE $ARGS_DELIM $Args)
  4362. SET_APPEND(UBERJAR_PATH_EXCLUDES ${pre=--uber-exclude :Args})
  4363. }
  4364. # tag:java-specific
  4365. UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE=
  4366. UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG=
  4367. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main)
  4368. ###
  4369. ### Transform manifest.mf for UBERJAR() java programs, set main-class attribute
  4370. ###
  4371. ### @see: [UBERJAR](#macro_UBERJAR)
  4372. macro UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main) {
  4373. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE $Main)
  4374. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG --manifest-main $Main)
  4375. }
  4376. # tag:java-specific
  4377. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE=
  4378. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS=
  4379. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value)
  4380. ###
  4381. ### Transform manifest.mf for UBERJAR() java programs, set attribute
  4382. ###
  4383. ### @see: [UBERJAR](#macro_UBERJAR)
  4384. macro UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value) {
  4385. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Value)
  4386. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:${Value})
  4387. }
  4388. # tag:java-specific
  4389. UBERJAR_APPENDING_TRANSFORMER_VALUE=
  4390. UBERJAR_APPENDING_TRANSFORMER_FLAGS=
  4391. ### @usage: UBERJAR_APPENDING_TRANSFORMER(Resource)
  4392. ###
  4393. ### Add AppendingTransformer for UBERJAR() java programs
  4394. ###
  4395. ### Parameters:
  4396. ### - Resource - Resource name
  4397. ###
  4398. ### @see: [UBERJAR](#macro_UBERJAR)
  4399. macro UBERJAR_APPENDING_TRANSFORMER(Resources...) {
  4400. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_VALUE $ARGS_DELIM $Resources)
  4401. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_FLAGS ${pre=--append-transformer :Resources})
  4402. }
  4403. # tag:java-specific
  4404. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE=
  4405. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG=
  4406. ### @usage: UBERJAR_SERVICES_RESOURCE_TRANSFORMER()
  4407. ###
  4408. ### Add ServicesResourceTransformer for UBERJAR() java programs
  4409. ###
  4410. ### @see: [UBERJAR](#macro_UBERJAR)
  4411. macro UBERJAR_SERVICES_RESOURCE_TRANSFORMER() {
  4412. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE yes)
  4413. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG --service-transformer)
  4414. }
  4415. # tag:idea-specific
  4416. IDEA_EXCLUDE_DIRS_VALUE=
  4417. ### @usage: IDEA_EXCLUDE_DIRS(<excluded dirs>)
  4418. ###
  4419. ### Exclude specified directories from an idea project generated by ya ide idea
  4420. ### Have no effect on regular build.
  4421. macro IDEA_EXCLUDE_DIRS(Args...) {
  4422. SET_APPEND(IDEA_EXCLUDE_DIRS_VALUE $Args)
  4423. }
  4424. # tag:idea-specific
  4425. IDEA_RESOURCE_DIRS_VALUE=
  4426. ### @usage: IDEA_RESOURCE_DIRS(<additional dirs>)
  4427. ###
  4428. ### Set specified resource directories in an idea project generated by ya ide idea
  4429. ### Have no effect on regular build.
  4430. macro IDEA_RESOURCE_DIRS(Args...) {
  4431. SET_APPEND(IDEA_RESOURCE_DIRS_VALUE $Args)
  4432. }
  4433. # tag:idea-specific
  4434. IDEA_MODULE_NAME_VALUE=
  4435. ### @usage: IDEA_MODULE_NAME(module_name)
  4436. ###
  4437. ### Set module name in an idea project generated by ya ide idea
  4438. ### Have no effect on regular build.
  4439. macro IDEA_MODULE_NAME(Name) {
  4440. SET(IDEA_MODULE_NAME_VALUE $Name)
  4441. }
  4442. # tag:java-specific
  4443. JAVAC_FLAGS_VALUE=
  4444. ### @usage: JAVAC_FLAGS(Args...)
  4445. ###
  4446. ### Set additional Java compilation flags.
  4447. macro JAVAC_FLAGS(Args...) {
  4448. SET_APPEND(JAVAC_OPTS $Args)
  4449. SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
  4450. }
  4451. # tag:java-specific
  4452. ENABLE_PREVIEW_VALUE=
  4453. ### @usage: ENABLE_PREVIEW()
  4454. ###
  4455. ### Enable java preview features.
  4456. macro ENABLE_PREVIEW() {
  4457. SET_APPEND(JVM_ARGS_VALUE --enable-preview)
  4458. SET_APPEND(JAVAC_OPTS --enable-preview --release $JDK_REAL_VERSION)
  4459. SET_APPEND(JAVAC_FLAGS_VALUE --enable-preview --release $JDK_REAL_VERSION)
  4460. SET(ENABLE_PREVIEW_VALUE yes)
  4461. }
  4462. # tag:java-specific
  4463. SAVE_JAVAC_GENERATED_SRCS=
  4464. SAVE_JAVAC_GENERATED_SRCS_DIR=
  4465. SAVE_JAVAC_GENERATED_SRCS_TAR=
  4466. when ($SAVE_JAVAC_GENERATED_SRCS) {
  4467. SAVE_JAVAC_GENERATED_SRCS_DIR=${BINDIR}/__javac_generated_srcs__
  4468. SAVE_JAVAC_GENERATED_SRCS_TAR=${BINDIR}/javac_generated.tar
  4469. JAVAC_FLAGS_VALUE+=-s $SAVE_JAVAC_GENERATED_SRCS_DIR
  4470. }
  4471. # tag:java-specific
  4472. # TODO: MAVEN_GROUP_ID_VALUE is only used by jbuild remove it after YMAKE-45 and YMAKE-46
  4473. MAVEN_GROUP_ID_VALUE=
  4474. MAVEN_EXPORT_GOUP_ID=ru.yandex
  4475. ### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
  4476. ###
  4477. ### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
  4478. ### Have no effect on regular build.
  4479. macro MAVEN_GROUP_ID(Arg, VERSION="no") {
  4480. SET(MAVEN_GROUP_ID_VALUE $Arg)
  4481. SET(MAVEN_EXPORT_GOUP_ID $Arg)
  4482. SET(PUBLISH_MAVEN_VERSION $VERSION)
  4483. }
  4484. # tag:java-specific
  4485. ANNOTATION_PROCESSOR_VALUE=
  4486. ### @usage: ANNOTATION_PROCESSOR(processors...)
  4487. ###
  4488. ### The macro is in development.
  4489. ### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
  4490. macro ANNOTATION_PROCESSOR(Args...) {
  4491. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Args)
  4492. }
  4493. EXCLUDE_VALUE=
  4494. ### EXCLUDE(prefixes)
  4495. ###
  4496. ### The macro is in development.
  4497. ### Specifies which libraries should be excluded from the classpath.
  4498. macro EXCLUDE(Args...) {
  4499. SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args)
  4500. }
  4501. # tag:java-specific
  4502. JAVA_SRCS_VALUE=
  4503. ### @usage: JAVA_SRCS(srcs)
  4504. ###
  4505. ### Specify java source files and resources. A macro can be contained in any of four java modules.
  4506. ### Keywords:
  4507. ### 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.
  4508. ### 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.
  4509. ###
  4510. ### @example:
  4511. ### - example/ya.make
  4512. ###
  4513. ### JAVA_PROGRAM()
  4514. ### JAVA_SRCS(SRCDIR src/main/java **/*)
  4515. ### END()
  4516. ###
  4517. ### - example/src/main/java/ru/yandex/example/HelloWorld.java
  4518. ###
  4519. ### package ru.yandex.example;
  4520. ### public class HelloWorld {
  4521. ### public static void main(String[] args) {
  4522. ### System.out.println("Hello, World!");
  4523. ### }
  4524. ### }
  4525. ###
  4526. ### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
  4527. macro JAVA_SRCS(Args...) {
  4528. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  4529. }
  4530. # tag:java-specific
  4531. JAVA_ADD_DLLS_VALUE=no
  4532. macro ADD_DLLS_TO_JAR() {
  4533. SET(JAVA_ADD_DLLS_VALUE yes)
  4534. }
  4535. # tag:java-specific
  4536. MANAGED_PEERS=
  4537. MANAGED_PEERS_CLOSURE=
  4538. RUN_JAVA_PROGRAM_MANAGED=
  4539. MANAGEABLE_PEERS_ROOTS=contrib/java
  4540. HAS_MANAGEABLE_PEERS=no
  4541. PROPAGATES_MANAGEABLE_PEERS=no
  4542. # All items of this list must be PEERS, GHOST PEERS or TOOLS of the test module or module itself.
  4543. # All items of this list must has at least one of HAS_MANAGEABLE_PEERS or PROPAGATES_MANAGEABLE_PEERS flags set yes.
  4544. # This variable is used by JUnit tests but not TestNG.
  4545. TEST_CLASSPATH_VALUE=
  4546. # Calculated and replaced by ymake can be used in DART DATA
  4547. TEST_CLASSPATH_MANAGED=
  4548. # tag:java-specific
  4549. DEPENDENCY_MANAGEMENT_VALUE=
  4550. ### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
  4551. ###
  4552. ### 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.
  4553. ###
  4554. ### For example, if the module has PEERDIR (contrib/java/junit/junit), and
  4555. ### 1. specifies DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12),
  4556. ### the PEERDIR is automatically replaced by contrib/java/junit/junit/4.12;
  4557. ### 2. doesn't specify DEPENDENCY_MANAGEMENT, PEERDIR automatically replaced
  4558. ### with the default from contrib/java/junit/junit/ya.make.
  4559. ### These defaults are always there and are supported by maven-import, which puts
  4560. ### there the maximum version available in contrib/java.
  4561. ###
  4562. ### 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.
  4563. ###
  4564. ### If some module has both DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12) and PERDIR(contrib/java/junit/junit/4.11), the PEERDIR wins.
  4565. ###
  4566. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  4567. macro DEPENDENCY_MANAGEMENT(Args...) {
  4568. SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
  4569. _GHOST_PEERDIR($Args)
  4570. }
  4571. # tag:java-specific
  4572. WITH_JDK_VALUE=
  4573. ### @usage: WITH_JDK()
  4574. ###
  4575. ### Add directory with JDK to JAVA_PROGRAM output
  4576. macro WITH_JDK() {
  4577. SET(WITH_JDK_VALUE yes)
  4578. }
  4579. # tag:kotlin-specific
  4580. WITH_KOTLIN_VALUE=
  4581. ### @usage: WITH_KOTLIN()
  4582. ###
  4583. ### Compile kotlin source code in this java module
  4584. macro WITH_KOTLIN() {
  4585. SET(WITH_KOTLIN_VALUE yes)
  4586. }
  4587. # tag:kotlin-specific
  4588. WITH_KAPT_VALUE=
  4589. ### @usage: WITH_KAPT()
  4590. ###
  4591. ### Use kapt for as annotation processor
  4592. macro WITH_KAPT() {
  4593. SET(WITH_KAPT_VALUE yes)
  4594. }
  4595. # tag:java-specific
  4596. WITH_GROOVY_VALUE=
  4597. ### @usage: WITH_GROOVY()
  4598. ###
  4599. ### Compile groovy source code in this java module
  4600. macro WITH_GROOVY() {
  4601. SET(WITH_GROOVY_VALUE yes)
  4602. }
  4603. # tag:kotlin-specific
  4604. KOTLINC_FLAGS_VALUE=-Xjvm-default=all
  4605. ### @usage: KOTLINC_FLAGS(-flags)
  4606. ###
  4607. ### Set additional Kotlin compilation flags.
  4608. macro KOTLINC_FLAGS(Args...) {
  4609. SET_APPEND(KOTLINC_OPTS_VALUE $Args)
  4610. }
  4611. # tag:kotlin-sppecific
  4612. WITH_KOTLINC_PLUGIN_ALLOPEN=
  4613. macro _WITH_KOTLINC_ALLOPEN(Options...) {
  4614. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.allopen\::Options})
  4615. SET(WITH_KOTLINC_PLUGIN_ALLOPEN yes)
  4616. }
  4617. # tag:kotlin-specific
  4618. ### @usage: WITH_KOTLINC_ALLOPEN(-flags)
  4619. ###
  4620. ### Enable allopen kotlin compiler plugin https://kotlinlang.org/docs/all-open-plugin.html
  4621. macro WITH_KOTLINC_ALLOPEN(HEAD, TAIL...) {
  4622. _WITH_KOTLINC_ALLOPEN($HEAD $TAIL)
  4623. }
  4624. # tag:kotlin-specific
  4625. WITH_KOTLINC_PLUGIN_LOMBOK=
  4626. ### @usage: WITH_KOTLINC_LOMBOK(-flags)
  4627. ###
  4628. ### Enable lombok kotlin compiler plugin https://kotlinlang.org/docs/lombok.html
  4629. macro WITH_KOTLINC_LOMBOK(Options...) {
  4630. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.lombok\::Options})
  4631. SET(WITH_KOTLINC_PLUGIN_LOMBOK yes)
  4632. }
  4633. # tag:kotlin-specific
  4634. WITH_KOTLINC_PLUGIN_NOARG=
  4635. ### @usage: WITH_KOTLINC_NOARG(-flags)
  4636. ###
  4637. ### Enable noarg kotlin compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html
  4638. macro WITH_KOTLINC_NOARG(Options...) {
  4639. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.noarg\::Options})
  4640. SET(WITH_KOTLINC_PLUGIN_NOARG yes)
  4641. }
  4642. # tag:kotlin-specific
  4643. WITH_KOTLINC_PLUGIN_SERIALIZATION=
  4644. ### @usage: WITH_KOTLINC_SERIALIZATION()
  4645. ###
  4646. ### Enable serialization kotlin compiler plugin https://kotlinlang.org/docs/serialization.html
  4647. macro WITH_KOTLINC_SERIALIZATION() {
  4648. SET(WITH_KOTLINC_PLUGIN_SERIALIZATION yes)
  4649. }
  4650. # tag:kotlin-specific
  4651. ### Also search for _KAPT_OPTS and change version there
  4652. KOTLIN_VERSION=1.8.20
  4653. KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.8.20/ya.dependency_management.inc
  4654. GROOVY_VERSION=3.0.5
  4655. # tag:java-specific
  4656. DIRECT_DEPS_ONLY_VALUE=
  4657. ### @usage: DIRECT_DEPS_ONLY
  4658. ###
  4659. ### Add direct PEERDIR's only in java compile classpath
  4660. macro DIRECT_DEPS_ONLY() {
  4661. SET(DIRECT_DEPS_ONLY_VALUE yes)
  4662. }
  4663. # tag:java-specific
  4664. JAVA_EXTERNAL_DEPENDENCIES_VALUE=
  4665. ### @usage: JAVA_EXTERNAL_DEPENDENCIES(file1 file2 ...)
  4666. ###
  4667. ### Add non-source java external build dependency (like lombok config file)
  4668. macro JAVA_EXTERNAL_DEPENDENCIES(Args...) {
  4669. SET_APPEND(JAVA_EXTERNAL_DEPENDENCIES_VALUE $Args)
  4670. }
  4671. # tag:java-specific
  4672. JAVA_CLASSPATH_CMD_TYPE_VALUE=
  4673. # tag:java-specific
  4674. ### @usage:TEST_JAVA_CLASSPATH_CMD_TYPE(Type)
  4675. ### Available types: MANIFEST(default), COMMAND_FILE, LIST
  4676. ### Method for passing a classpath value to a java command line
  4677. ### MANIFEST via empty jar file with manifest that contains Class-Path attribute
  4678. ### COMMAND_FILE via @command_file
  4679. ### LIST via flat args
  4680. macro TEST_JAVA_CLASSPATH_CMD_TYPE(Type) {
  4681. SET(JAVA_CLASSPATH_CMD_TYPE_VALUE $Type)
  4682. }
  4683. # tag:java-specific
  4684. IGNORE_JAVA_DEPENDENCIES_CONFIGURATION=no
  4685. JAVA_DEPENDENCIES_CONFIGURATION_VALUE=
  4686. # tag:java-specific
  4687. ### @usage JAVA_DEPENDENCIES_CONFIGURATION(Vetos...)
  4688. ### Validate contrib/java dependencies
  4689. ### Valid arguments
  4690. ### FORBID_DIRECT_PEERDIRS - fail when module have direct PEERDIR (with version) (non-transitive)
  4691. ### FORBID_CONFLICT - fail when module have resolved without DEPENDENCY_MANAGEMENT version conflict (transitive)
  4692. ### FORBID_CONFLICT_DM - fail when module have resolved with DEPENDENCY_MANAGEMENT version conflict (transitive)
  4693. ### FORBID_CONFLICT_DM_RECENT - like FORBID_CONFLICT_DM but fail only when dependency have more recent version than specified in DEPENDENCY_MANAGEMENT
  4694. ### REQUIRE_DM - all dependencies must be specified in DEPENDENCY_MANAGEMENT (transitive)
  4695. macro JAVA_DEPENDENCIES_CONFIGURATION(Args...) {
  4696. SET_APPEND(JAVA_DEPENDENCIES_CONFIGURATION_VALUE $Args)
  4697. }
  4698. # tag:java-specific
  4699. # TODO(DEVTOOLS-6901): remove this variable when there are no more references to it in jbuild
  4700. JAVA_FORBIDDEN_LIBRARIES_VALUE=
  4701. # tag:java-specific
  4702. JAR_INCLUDE_FILTER_VALUE=
  4703. JAR_EXCLUDE_FILTER_VALUE=
  4704. # tag:java-specific
  4705. ### @usage:JAR_INCLUDE(Filters...)
  4706. ### Filter .jar file content: keep only matched files
  4707. ### * and ** patterns are supported (like JAVA_SRCS)
  4708. macro JAR_INCLUDE(Filters...) {
  4709. SET_APPEND(JAR_INCLUDE_FILTER_VALUE $Filters)
  4710. }
  4711. # tag:java-specific
  4712. ### @usage:JAR_EXCLUDE(Filters...)
  4713. ### Filter .jar file content: remove matched files
  4714. ### * and ** patterns are supported (like JAVA_SRCS)
  4715. macro JAR_EXCLUDE(Filters...) {
  4716. SET_APPEND(JAR_EXCLUDE_FILTER_VALUE $Filters)
  4717. }
  4718. # tag:sandbox-specific
  4719. ### @usage: SANDBOX_TASK([Name])
  4720. ###
  4721. ### Multimodule describing Sandbox task (Python code that can be executed by Sandbox system).
  4722. ###
  4723. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_TASKs as libraries.
  4724. ### The final artifact is provided when SANDBOX_TASK is referred to by DEPENDS and BUNDLE macros.
  4725. ### As PEERDIR target, it works like regular PY2_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_TASKs.
  4726. ###
  4727. ### Currently Sandbox supports only Python 2.x, so both variants will be compatible only with Python 2.x modules
  4728. ### and will select multimodule variants accordingly.
  4729. ###
  4730. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4731. multimodule SANDBOX_TASK {
  4732. module SB_TASK_BIN: _PY2_PROGRAM {
  4733. PY_MAIN(sandbox.taskbox.binary)
  4734. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4735. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4736. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4737. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4738. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4739. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4740. when ($FAIL_PY2 == "yes") {
  4741. _OK=no
  4742. }
  4743. elsewhen ($OPENSOURCE != "yes") {
  4744. PEERDIR+=build/rules/py2_deprecation
  4745. }
  4746. ASSERT(_OK You are using deprecated Python2-only code (SANDBOX_TASK). Please consider rewriting to 2/3-compatible code.)
  4747. }
  4748. module PY2: PY2_LIBRARY {
  4749. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4750. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4751. }
  4752. }
  4753. # tag:sandbox-specific
  4754. multimodule SANDBOX_PY23_TASK {
  4755. module SB_TASK_BIN: _PY2_PROGRAM {
  4756. .RESTRICTED=RUN_ANTLR4_PYTHON
  4757. PY_MAIN(sandbox.taskbox.binary)
  4758. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  4759. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4760. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4761. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4762. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4763. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4764. }
  4765. module PY2: PY2_LIBRARY {
  4766. .RESTRICTED=RUN_ANTLR4_PYTHON
  4767. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  4768. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4769. OBJ_SUF=.py2
  4770. }
  4771. module PY3: PY3_LIBRARY {
  4772. .RESTRICTED=RUN_ANTLR4_PYTHON
  4773. when ($MSVC == "yes" || $CYGWIN == "yes") {
  4774. MODULE_PREFIX=py3
  4775. }
  4776. otherwise {
  4777. MODULE_PREFIX=libpy3
  4778. }
  4779. OBJ_SUF=.py3
  4780. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  4781. PEERDIR(sandbox/sdk2)
  4782. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4783. }
  4784. }
  4785. # tag:sandbox-specific
  4786. ### @usage: SANDBOX_PY3_TASK([Name])
  4787. ###
  4788. ### Multimodule describing Sandbox task (Python3 code that can be executed by Sandbox system).
  4789. ###
  4790. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_PY3_TASKs as libraries.
  4791. ### The final artifact is provided when SANDBOX_PY3_TASK is referred to by DEPENDS and BUNDLE macros.
  4792. ### As PEERDIR target, it works like regular PY3_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_PY3_TASKs.
  4793. ###
  4794. ### Currently Sandbox supports Python 3.x only in binary tasks, both variants will be compatible only with Python 3.x and py23 libraries
  4795. ### and will select multimodule variants accordingly.
  4796. ###
  4797. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  4798. multimodule SANDBOX_PY3_TASK {
  4799. module SB_TASK_BIN: PY3_PROGRAM_BIN {
  4800. .IGNORED=RUN_ANTLR4_PYTHON
  4801. PY_MAIN(sandbox.taskbox.binary)
  4802. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/taskbox/worker)
  4803. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  4804. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  4805. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  4806. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  4807. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4808. }
  4809. module PY3: PY3_LIBRARY {
  4810. PEERDIR(sandbox/sdk2)
  4811. REGISTER_SANDBOX_IMPORT(${MODDIR})
  4812. }
  4813. }
  4814. # tag:python-specific tag:internal
  4815. NO_PYTHON_INCLS=no
  4816. ### @usage: NO_PYTHON_INCLUDES() # internal
  4817. ###
  4818. ### Disable dependencies on libraries providing Python headers.
  4819. ### This is only used in Python libraries themselves to avoid PEERDIR loops.
  4820. macro NO_PYTHON_INCLUDES() {
  4821. ENABLE(NO_PYTHON_INCLS)
  4822. }
  4823. # tag:python-specific
  4824. ### @usage: PYTHON2_ADDINCL()
  4825. ###
  4826. ### This macro adds include path for Python headers (Python 2.x variant) without PEERDIR.
  4827. ### This should be used in 2 cases only:
  4828. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4829. ### - In system Python libraries themselves since proper PEERDIR there may create a loop;
  4830. ### In all other cases use USE_PYTHON2 macro instead.
  4831. ###
  4832. ### Never use this macro in PY2_PROGRAM, PY2_LIBRARY and PY23_LIBRARY: they have everything needed by default.
  4833. ###
  4834. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4835. macro PYTHON2_ADDINCL() {
  4836. _PYTHON_ADDINCL()
  4837. SET(MODULE_TAG PY2_NATIVE)
  4838. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4839. }
  4840. # tag:python-specific tag:internal
  4841. ### @usage: _ARCADIA_PYTHON_ADDINCL() # internal
  4842. ### This macro sets up Python headers for modules with Arcadia python (e.g. PY2_LIBRARY) and configures module as Python 2.x.
  4843. macro _ARCADIA_PYTHON_ADDINCL() {
  4844. _PYTHON_ADDINCL()
  4845. SET(MODULE_TAG PY2)
  4846. SET(PEERDIR_TAGS PY2 PY2_NATIVE PY_PROTO PY2_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4847. }
  4848. # tag:python-specific tag:internal
  4849. ### @usage: _PYTHON_ADDINCL() # internal
  4850. ### This macro sets up Python 2.x headers for both Arcadia and non-Arcadia python.
  4851. macro _PYTHON_ADDINCL() {
  4852. SET(PYTHON2 yes)
  4853. SET(PYTHON3 no)
  4854. when ($USE_ARCADIA_PYTHON == "yes") {
  4855. ADDINCL+=GLOBAL contrib/libs/python/Include
  4856. CFLAGS+=-DARCADIA_PYTHON_UNICODE_SIZE=$ARCADIA_PYTHON_UNICODE_SIZE
  4857. }
  4858. otherwise {
  4859. when ($USE_SYSTEM_PYTHON) {
  4860. PEERDIR+=build/platform/python
  4861. }
  4862. otherwise {
  4863. CFLAGS+=$PYTHON_INCLUDE
  4864. }
  4865. }
  4866. }
  4867. # tag:python-specific
  4868. ### @usage: PYTHON3_ADDINCL()
  4869. ###
  4870. ### This macro adds include path for Python headers (Python 3.x variant).
  4871. ### This should be used in 2 cases only:
  4872. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4873. ### - In system Python libraries themselves since peerdir there may create a loop;
  4874. ### In all other cases use USE_PYTHON3() macro instead.
  4875. ###
  4876. ### Never use this macro in PY3_PROGRAM and PY3_LIBRARY and PY23_LIBRARY: they have everything by default.
  4877. ###
  4878. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4879. macro PYTHON3_ADDINCL() {
  4880. _PYTHON3_ADDINCL()
  4881. SET(MODULE_TAG PY3_NATIVE)
  4882. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY3_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4883. }
  4884. # tag:python-specific tag:internal
  4885. ### @usage: _ARCADIA_PYTHON3_ADDINCL() # internal
  4886. ###
  4887. ### This macro sets up Python3 headers for modules with Arcadia python (e.g. PY3_LIBRARY) and configures module as Python 3.x.
  4888. macro _ARCADIA_PYTHON3_ADDINCL() {
  4889. _PYTHON3_ADDINCL()
  4890. SET(MODULE_TAG PY3)
  4891. SET(MODULE_LANG PY3)
  4892. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE PY3_PROTO PY3_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4893. }
  4894. # tag:python-specific tag:internal
  4895. ### @usage: _PYTHON_ADDINCL() # internal
  4896. ###
  4897. ### This macro sets up Python 3.x headers for both Arcadia and non-Arcadia python.
  4898. macro _PYTHON3_ADDINCL() {
  4899. SET(PYTHON3 yes)
  4900. SET(PYTHON2 no)
  4901. when ($USE_ARCADIA_PYTHON == "yes") {
  4902. CFLAGS+=-DUSE_PYTHON3
  4903. ADDINCL+=GLOBAL contrib/libs/python/Include
  4904. }
  4905. otherwise {
  4906. when ($USE_SYSTEM_PYTHON) {
  4907. PEERDIR+=build/platform/python
  4908. }
  4909. otherwise {
  4910. CFLAGS+=$PYTHON_INCLUDE
  4911. }
  4912. }
  4913. }
  4914. # tag:python-specific
  4915. ### @usage: USE_PYTHON2()
  4916. ###
  4917. ### This adds Python 2.x runtime library to your LIBRARY and makes it Python2-compatible.
  4918. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4919. ###
  4920. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4921. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4922. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4923. ###
  4924. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4925. macro USE_PYTHON2() {
  4926. _ARCADIA_PYTHON_ADDINCL()
  4927. SET(PEERDIR_TAGS PY2 PY2_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4928. PEERDIR(contrib/libs/python)
  4929. }
  4930. # tag:python-specific
  4931. ### @usage: USE_PYTHON3()
  4932. ###
  4933. ### This adds Python3 library to your LIBRARY and makes it Python3-compatible.
  4934. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4935. ###
  4936. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4937. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4938. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4939. ###
  4940. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4941. macro USE_PYTHON3() {
  4942. _ARCADIA_PYTHON3_ADDINCL()
  4943. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4944. PEERDIR(contrib/libs/python)
  4945. when ($USE_ARCADIA_PYTHON == "yes") {
  4946. PEERDIR+=library/python/runtime_py3
  4947. }
  4948. }
  4949. # tag:python-specific
  4950. when ($PERL_DEFAULT_PEERDIR == "yes") {
  4951. when (($PERLXS == "yes") || ($PERLXSCPP == "yes") || ($USE_PERL == "yes")) {
  4952. PEERDIR+=build/platform/perl
  4953. }
  4954. }
  4955. # tag:perl-specific
  4956. ### @usage: USE_PERL_LIB()
  4957. ### Add dependency on Perl to your LIBRARY
  4958. macro USE_PERL_LIB() {
  4959. PEERDIR(build/platform/perl)
  4960. }
  4961. # tag:perl-specific
  4962. ### @usage: USE_PERL_514_LIB()
  4963. ### Add dependency on Perl 5.14 to your LIBRARY
  4964. macro USE_PERL_514_LIB() {
  4965. SET(PERL_SDK ubuntu-12)
  4966. SET(PERL_DEFAULT_PEERDIR no)
  4967. PEERDIR(build/platform/perl/5.14)
  4968. }
  4969. # tag:perl-specific
  4970. ### @usage: ADD_PERL_MODULE(Dir ModuleName)
  4971. ### Add dependency on specified Perl module to the library
  4972. macro ADD_PERL_MODULE(Dir, Module) {
  4973. PEERDIR($Dir)
  4974. SET_APPEND(modules $Module)
  4975. }
  4976. # tag:allocator
  4977. ### @usage: ALLOCATOR(Alloc) # Default: LF
  4978. ###
  4979. ### Set memory allocator implementation for the PROGRAM()/DLL() module.
  4980. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
  4981. ###
  4982. ### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU", "PROFILED_HU".
  4983. ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
  4984. ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
  4985. ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
  4986. ### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
  4987. ### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
  4988. ### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
  4989. ### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
  4990. ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
  4991. ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
  4992. ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
  4993. ### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
  4994. ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
  4995. ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
  4996. ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
  4997. ### - SYSTEM - Use target system allocator
  4998. ### - FAKE - Don't link with any allocator
  4999. ### - HU - Huge page allocator by @gulin.
  5000. ### - PROFILED_HU - patched HU. It is a bit slower but has metrics of memory consumption.
  5001. ###
  5002. ### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
  5003. macro ALLOCATOR(Alloc) {
  5004. SET(ALLOCATOR $Alloc)
  5005. when ($ALLOCATOR in [ "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU", "PROFILED_HU" ]) {
  5006. }
  5007. otherwise {
  5008. PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
  5009. }
  5010. }
  5011. when ($MIC_ARCH == "yes") {
  5012. CFLAGS+=-mmic
  5013. LDFLAGS+=-mmic
  5014. }
  5015. when ($USE_OPENMP == "yes") {
  5016. PEERDIR+=contrib/libs/openmp
  5017. }
  5018. when ($STRIP == "yes" && $NO_STRIP != "yes") {
  5019. STRIP_FLAG=$LD_STRIP_FLAG
  5020. DWARF_COMMAND=
  5021. GO_LINK_FLAGS_VALUE+=-s
  5022. }
  5023. when ($NO_LINKER_DCE != "yes") {
  5024. DCE_FLAG=$LD_DCE_FLAG
  5025. }
  5026. when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
  5027. ICF_FLAG=$LD_ICF_FLAG
  5028. }
  5029. OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
  5030. OBJDUMP_TOOL=$OBJDUMP_TOOL_VENDOR
  5031. STRIP_TOOL=$STRIP_TOOL_VENDOR
  5032. NEED_BINUTILS_PEERDIR=
  5033. BINUTILS_USED=
  5034. when (!$OBJCOPY_TOOL_VENDOR) {
  5035. OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
  5036. NEED_BINUTILS_PEERDIR=yes
  5037. }
  5038. when (!$OBJDUMP_TOOL_VENDOR) {
  5039. OBJDUMP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objdump
  5040. NEED_BINUTILS_PEERDIR=yes
  5041. }
  5042. when (!$STRIP_TOOL_VENDOR) {
  5043. STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
  5044. NEED_BINUTILS_PEERDIR=yes
  5045. }
  5046. SPLIT_DWARF_VALUE=no
  5047. NO_SPLIT_DWARF=no
  5048. when ($OS_DARWIN) {
  5049. SPLIT_DWARF_VALUE=yes
  5050. }
  5051. when ($STRIP_DEBUG_INFO) {
  5052. SPLIT_DWARF_VALUE=yes
  5053. NO_SPLIT_DWARF=no
  5054. }
  5055. ### @usage: SPLIT_DWARF()
  5056. ###
  5057. ### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
  5058. ### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
  5059. macro SPLIT_DWARF() {
  5060. SET(SPLIT_DWARF_VALUE yes)
  5061. }
  5062. ### @usage: NO_SPLIT_DWARF()
  5063. ###
  5064. ### Do NOT emit debug info for the PROGRAM/DLL as a separate file.
  5065. ### On macOS this also means do NOT generate dSym files (faster linkage)
  5066. macro NO_SPLIT_DWARF() {
  5067. SET(SPLIT_DWARF_VALUE no)
  5068. }
  5069. SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
  5070. when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
  5071. DWARF_COMMAND+= \
  5072. $OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
  5073. $STRIP_TOOL --strip-debug $TARGET && \
  5074. $OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
  5075. BINUTILS_USED=yes
  5076. }
  5077. ### @usage: EXTRALIBS_STATIC(Libs...)
  5078. ###
  5079. ### Add the specified external static libraries to the program link
  5080. macro EXTRALIBS_STATIC(Args...) {
  5081. LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
  5082. }
  5083. ### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
  5084. ###
  5085. ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
  5086. macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
  5087. __translatename_lower=${tolower:Name}
  5088. __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
  5089. RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
  5090. }
  5091. ### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
  5092. ###
  5093. ### Generate transliteration dictionary code
  5094. ### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
  5095. macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
  5096. __translitname_lower=${tolower:Name}
  5097. __translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
  5098. __untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
  5099. __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
  5100. __gentrie_dir=dict/tools/make_untranslit_trie
  5101. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
  5102. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
  5103. RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
  5104. }
  5105. # tag:python-specific tag:proto tag:deprecated
  5106. ### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated
  5107. ###
  5108. ### Generate python bindings for protobuf files.
  5109. ### Macro is obsolete and not recommended for use!
  5110. macro GENERATE_PY_PROTOS(FILES...) {
  5111. foreach (FILE : $FILES) {
  5112. _PY_PROTO_CMD($FILE)
  5113. }
  5114. }
  5115. # tag:python-specific tag:proto
  5116. macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) {
  5117. foreach (FILE : $FILES) {
  5118. _PY_PROTO_CMD_INTERNAL($FILE)
  5119. }
  5120. }
  5121. # tag:python-specific
  5122. macro _GENERATE_PY_EVS_INTERNAL(FILES...) {
  5123. foreach (FILE : $FILES) {
  5124. _PY_EVLOG_CMD_INTERNAL($FILE)
  5125. }
  5126. }
  5127. macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[], OUTPUT_INCLUDES_INP[]) {
  5128. .CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} ${output_include;from_input;hide:OUTPUT_INCLUDES_INP} $INDUCED_DEPS ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"}
  5129. .SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST}
  5130. }
  5131. ### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
  5132. ###
  5133. ### Copy file to build root. It is possible to change both location and the name.
  5134. ###
  5135. ### Parameters:
  5136. ### - File - Source file name.
  5137. ### - Destination - Output file name.
  5138. ### - AUTO - Consider copied file for further processing automatically.
  5139. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
  5140. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  5141. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type)
  5142. ### and set of dependencies
  5143. ###
  5144. ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
  5145. ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
  5146. macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  5147. .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  5148. .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination)
  5149. }
  5150. ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
  5151. ###
  5152. ### Copy file to build root the same way as it is done for COPY_FILE, but also
  5153. ### propagates the context of the source file.
  5154. macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  5155. .CMD=$_COPY_FILE_IMPL($FILE $AUTO $DEST OUTPUT_INCLUDES_INP $FILE OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  5156. }
  5157. ### This is to join $ALL_RES_ and $EXT
  5158. macro _ARF_HELPER(Args...) {
  5159. RESOURCE_FILES($Args)
  5160. }
  5161. ### @usage ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
  5162. ###
  5163. ### This macro collects all files with extension `Ext` and
  5164. ### Passes them to `RESOURCE_FILES` macro as relative to current directory
  5165. ###
  5166. ### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
  5167. ###
  5168. ### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
  5169. ### Note: Wildcards are not allowed neither as Ext nor in Dirs
  5170. macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
  5171. _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
  5172. _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT})
  5173. }
  5174. macro _BUNDLE_TARGET(Target, Destination) {
  5175. .CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
  5176. }
  5177. ### @usage: TIMEOUT(TIMEOUT)
  5178. ###
  5179. ### Sets a timeout on test execution
  5180. ###
  5181. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5182. macro TIMEOUT(Time) {
  5183. SET(TEST_TIMEOUT $Time)
  5184. }
  5185. SBR_UID_EXT=""
  5186. # tag:test
  5187. ### @usage: VALIDATE_DATA_RESTART(ext)
  5188. ###
  5189. ### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
  5190. ### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
  5191. macro VALIDATE_DATA_RESTART(Ext) {
  5192. SET(SBR_UID_EXT $Ext)
  5193. }
  5194. # tag:test
  5195. TEST_FORK_MODE=none
  5196. TEST_PARTITION=SEQUENTIAL
  5197. # tag:test
  5198. ### @usage: FORK_TESTS()
  5199. ###
  5200. ### Splits a test run on chunks by test classes.
  5201. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  5202. ###
  5203. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  5204. ###
  5205. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5206. macro FORK_TESTS(MODE...) {
  5207. SET(TEST_FORK_MODE tests)
  5208. SET(TEST_PARTITION $MODE)
  5209. }
  5210. # tag:test
  5211. ### @usage: FORK_SUBTESTS()
  5212. ###
  5213. ### Splits the test run in chunks on subtests.
  5214. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  5215. ###
  5216. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  5217. ###
  5218. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5219. macro FORK_SUBTESTS(MODE...) {
  5220. SET(TEST_FORK_MODE subtests)
  5221. SET(TEST_PARTITION $MODE)
  5222. }
  5223. # tag:test
  5224. ### @usage: SPLIT_FACTOR(x)
  5225. ###
  5226. ### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
  5227. ### If none of those is specified this macro implies FORK_TESTS().
  5228. ###
  5229. ### Supports C++ ut and PyTest.
  5230. ###
  5231. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5232. macro SPLIT_FACTOR(Factor) {
  5233. SET(TEST_SPLIT_FACTOR $Factor)
  5234. }
  5235. # tag:test
  5236. FORK_TEST_FILES_MODE=
  5237. ### @usage: FORK_TEST_FILES()
  5238. ###
  5239. ### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
  5240. ### Compatible with FORK_(SUB)TESTS.
  5241. ###
  5242. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5243. macro FORK_TEST_FILES() {
  5244. SET(FORK_TEST_FILES_MODE on)
  5245. }
  5246. # tag:test
  5247. TEST_SIZE_NAME=SMALL
  5248. ### @usage: SIZE(SMALL/MEDIUM/LARGE)
  5249. ###
  5250. ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
  5251. ### See documentation on test system for more details.
  5252. ###
  5253. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  5254. macro SIZE(Type) {
  5255. SET(TEST_SIZE_NAME $Type)
  5256. }
  5257. ### @usage: JOIN_SRCS(Out Src...)
  5258. ###
  5259. ### Join set of sources into single file named Out and send it for further processing.
  5260. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  5261. ### You should specify file name with the extension as Out. Further processing will be done according this extension.
  5262. macro JOIN_SRCS(Out, Src...) {
  5263. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  5264. .SEM=target_joined_source $Out ${input:Src} ${output;hide;suf=.o:Out} ${input;hide:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"}
  5265. _CONDITIONAL_SRCS($TIDY_VALUE $Src)
  5266. }
  5267. ### @usage: JOIN_SRCS_GLOBAL(Out Src...)
  5268. ###
  5269. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  5270. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  5271. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  5272. macro JOIN_SRCS_GLOBAL(Out, Src...) {
  5273. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output;noauto:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  5274. SRCS(GLOBAL $Out)
  5275. }
  5276. ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
  5277. ###
  5278. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  5279. ### This macro places all files into single file, so will work with any sources.
  5280. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  5281. macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
  5282. .CMD=$FS_TOOLS cat ${output;noauto:Out} --ya-start-command-file ${input:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  5283. SRCS(GLOBAL $Out)
  5284. }
  5285. # tag:cpu
  5286. PIC_CFLAGS=
  5287. SSE2_CFLAGS=
  5288. SSE3_CFLAGS=
  5289. SSSE3_CFLAGS=
  5290. SSE41_CFLAGS=
  5291. SSE42_CFLAGS=
  5292. POPCNT_CFLAGS=
  5293. PCLMUL_CFLAGS=
  5294. CX16_FLAGS=
  5295. AVX_CFLAGS=
  5296. AVX2_CFLAGS=
  5297. AVX512_CFLAGS=
  5298. AMX_CFLAGS=
  5299. # tag:cpu
  5300. SSE_DEFINES=
  5301. SSE_CFLAGS=
  5302. SSE4_DEFINES=
  5303. SSE4_CFLAGS=
  5304. XOP_CFLAGS=
  5305. NO_LTO_CFLAGS=
  5306. # tag:cpu
  5307. when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
  5308. when ($CLANG || $CLANG_CL || $GCC) {
  5309. PIC_CFLAGS=-fPIC
  5310. SSE2_CFLAGS=-msse2
  5311. SSE3_CFLAGS=-msse3
  5312. SSSE3_CFLAGS=-mssse3
  5313. SSE41_CFLAGS=-msse4.1
  5314. SSE42_CFLAGS=-msse4.2
  5315. XOP_CFLAGS=-mxop
  5316. POPCNT_CFLAGS=-mpopcnt
  5317. PCLMUL_CFLAGS=-mpclmul
  5318. AVX_CFLAGS=-mavx
  5319. # On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell.
  5320. # See:
  5321. # https://en.wikipedia.org/wiki/FMA_instruction_set
  5322. # https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
  5323. #
  5324. # AMD implemented FMA3 in Piledriver architecture over AVX (that is, prior to AVX-2 which was introduced in Zen).
  5325. # BMI2 implementation was released by AMD along with AVX-2 support.
  5326. # See:
  5327. # https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
  5328. #
  5329. # Due to the above, it looks safe to enable all three extensions whenever AVX-2 is enabled.
  5330. AVX2_CFLAGS=-mavx2 -mfma -mbmi -mbmi2
  5331. # All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
  5332. # (these are Xeon Phi)
  5333. # See:
  5334. # https://en.wikichip.org/wiki/x86/avx-512
  5335. AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
  5336. # AMX stands Advanced Matrix Extension supported by modern Intel architectures
  5337. # See:
  5338. # https://en.wikipedia.org/wiki/Advanced_Matrix_Extensions
  5339. # https://en.wikichip.org/wiki/x86/amx
  5340. AMX_CFLAGS=-mamx-tile -mamx-int8 ${AVX512_CFLAGS}
  5341. when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
  5342. CX16_FLAGS=-mcx16
  5343. }
  5344. SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
  5345. SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
  5346. }
  5347. elsewhen ($MSVC) {
  5348. SSE2_CFLAGS=/D__SSE2__=1
  5349. SSE3_CFLAGS=/D__SSE3__=1
  5350. SSSE3_CFLAGS=/D__SSSE3__=1
  5351. SSE41_CFLAGS=/D__SSE4_1__=1
  5352. SSE42_CFLAGS=/D__SSE4_2__=1
  5353. POPCNT_CFLAGS=/D__POPCNT__=1
  5354. PCLMUL_CFLAGS=/D__PCLMUL__=1
  5355. AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
  5356. AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
  5357. AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
  5358. SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
  5359. SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
  5360. }
  5361. SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
  5362. SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
  5363. when ($ARCH_I386 && $OS_ANDROID == "yes") {
  5364. USE_SSE4=no
  5365. }
  5366. }
  5367. otherwise {
  5368. USE_SSE4=no
  5369. CPU_CHECK=no
  5370. }
  5371. # tag:cpu
  5372. when ($NOSSE == "yes") {
  5373. USE_SSE4=no
  5374. }
  5375. # tag:cpu
  5376. ### @usage: NO_SSE4()
  5377. ###
  5378. ### Compile module without SSE4
  5379. macro NO_SSE4() {
  5380. SET(USE_SSE4 no)
  5381. }
  5382. # tag:cpu
  5383. ### @usage: NO_CPU_CHECK()
  5384. ###
  5385. ### Compile module without startup CPU features check
  5386. macro NO_CPU_CHECK() {
  5387. SET(CPU_CHECK no)
  5388. }
  5389. ### @usage: ADDINCLSELF()
  5390. ###
  5391. ### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
  5392. macro ADDINCLSELF(FOR="") {
  5393. when($FOR) {
  5394. ADDINCL+=FOR $FOR ${MODDIR}
  5395. }
  5396. otherwise {
  5397. ADDINCL+=${MODDIR}
  5398. }
  5399. }
  5400. COMPILE_OUT_SUFFIX=
  5401. _COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
  5402. _COMPILE_TIME_TRACE_OUTPUTS=${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
  5403. macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?";norel":"") {
  5404. SET(_COMPILE_OUTPUTS \${output;suf=\${OBJECT_SUF}$NOREL:SRC})
  5405. SET(_COMPILE_TIME_TRACE_OUTPUTS \${output;noauto;suf=\${OBJECT_SUF}.time_trace.json$NOREL:SRC})
  5406. }
  5407. # tag:internal
  5408. ### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
  5409. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " before $Args when GENERATE
  5410. ### is specified in the list of actual arguments
  5411. macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
  5412. .SEM=$GENERATE $Args
  5413. }
  5414. # tag:internal
  5415. ### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
  5416. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " if Args is not empty
  5417. macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
  5418. .SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
  5419. }
  5420. _EMPTY_CMD=
  5421. # tag:src-processing tag:internal
  5422. ### @usage: _SRC(Ext Src Flags) # internal
  5423. ###
  5424. ### Basic building block of extension-based command dispatching
  5425. ### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
  5426. ### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
  5427. ### of other commands (except ones marked as noauto)
  5428. macro _SRC(EXT, SRC, SRCFLAGS...) {
  5429. # Generic macro definition for _SRC (just a placeholder, it does nothing)
  5430. }
  5431. _SWIG_CMD=$_SWIG_PYTHON_CMD
  5432. _SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
  5433. _SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
  5434. _SWIG_SEM_TO_MODULE_LINK=${output;hide;suf=.o:SRC}
  5435. _SWIG_PYTHON_CMD=${_SWIG_TOOL} -module ${REALPRJNAME} -cpperraswarn -c++ -python -interface ${MODULE_PREFIX}${REALPRJNAME} -o ${output;noext;main;suf=_wrap.swg.cpp:SRC} ${output;noauto;add_to_outs;hide;tobindir;suf=.py:REALPRJNAME} -outdir ${BINDIR} ${pre=-I:_SWIG__INCLUDE} ${input:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5436. _SWIG_PYTHON_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/python FOR swig ${_SWIG_LIBRARY}
  5437. _SWIG_PYTHON_PEERDIR=
  5438. _SWIG_PERL_CMD=${_SWIG_TOOL} -c++ -cpperraswarn -module ${REALPRJNAME} -shadow -perl -o ${output;noext;main;suf=_wrap.swg.cpp:SRC} ${output;noauto;add_to_outs;hide;tobindir;suf=.pm:REALPRJNAME} -outdir ${ARCADIA_BUILD_ROOT}/${MODDIR} ${pre=-I:_SWIG__INCLUDE} ${input:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5439. _SWIG_PERL_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/perl5 FOR swig ${_SWIG_LIBRARY}
  5440. _SWIG_PERL_PEERDIR=build/platform/perl
  5441. _SWIG_JNI_CPP_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --out-header ${output;main;noext;suf=_wrap.swg.h:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${output;noext;suf=_wrap.swg.cpp:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5442. _SWIG_JNI_JAVA_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} --jsrc ${output;main;suf=.jsrc:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${BINDIR}/unused.cpp ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5443. _SWIG_JNI_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --out-header ${output;main;noext;suf=_wrap.swg.h:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} --jsrc ${output;suf=.jsrc:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${output;noext;suf=_wrap.swg.cpp:SRC} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"}
  5444. _SWIG_JNI_ADDINCLS=FOR swig ${_SWIG_LIBRARY}/java FOR swig $_SWIG_LIBRARY
  5445. _SWIG_JNI_PEERDIR=contrib/libs/jdk
  5446. when ($USE_LOCAL_SWIG == "yes") {
  5447. _SWIG_JNI_ADDINCLS=
  5448. }
  5449. when ($USE_SYSTEM_JDK == "yes" || $OS_ANDROID == "yes") {
  5450. _SWIG_JNI_PEERDIR=
  5451. }
  5452. # tag:src-processing
  5453. macro _SRC("swg", SRC, SRCFLAGS...) {
  5454. .CMD=${_SWIG_CMD}
  5455. .ADDINCL=${_SWIG_ADDINCLS}
  5456. .PEERDIR=${_SWIG_PEERDIR}
  5457. .SEM=conan_require_tool swig/4.0.2 && conan_import '"bin, *swig* -> ./bin"' ${input;hide:SRC} ${_SWIG_SEM_TO_MODULE_LINK}
  5458. }
  5459. RODATA_SYMBOL_PREFIX=
  5460. when ($DARWIN == "yes" || $IOS == "yes" || ($WINDOWS == "yes" && $ARCH_TYPE_32 == "yes")) {
  5461. RODATA_SYMBOL_PREFIX=_
  5462. }
  5463. RODATA_ELF_FLAGS=
  5464. when($LINUX == "yes" || $ANDROID == "yes") {
  5465. RODATA_ELF_FLAGS=--elf
  5466. }
  5467. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2asm.py"} $RODATA_ELF_FLAGS ${RODATA_SYMBOL_PREFIX}${noext;nopath:SRC} ${input:SRC} ${tmp;suf=.asm:SRC} ${hide:OBJECT_SUF} && $_SRC_yasm_helper(${tmp;suf=.asm:SRC})
  5468. when (($ARCH_AARCH64 || $ARCH_ARM || $ARCH_PPC64LE || $ARCH_RISCV32) == "yes") {
  5469. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2cpp.py"} ${noext;nopath:SRC} ${input:SRC} ${output;suf=.cpp:SRC}
  5470. }
  5471. # tag:src-processing
  5472. macro _SRC("rodata", SRC, SRCFLAGS...) {
  5473. .CMD=$RODATA_COMPILE ${hide;kv:"p RD"} ${hide;kv:"pc light-green"}
  5474. .SEM=target_rodata_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} ${input;hide:"build/scripts/rodata2cpp.py"}
  5475. }
  5476. # tag:src-processing
  5477. macro _SRC("S", SRC, SRCFLAGS...) {
  5478. .CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output:SRC.o} ${input:SRC} ${pre=-I:_C__INCLUDE}
  5479. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS) && add_language ASM
  5480. }
  5481. # tag:src-processing
  5482. macro _SRC("s", SRC, SRCFLAGS...) {
  5483. .CMD=$_SRC(S, $SRC $SRCFLAGS)
  5484. }
  5485. # tag:src-processing
  5486. macro _SRC("s79", SRC, SRCFLAGS...) {
  5487. .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
  5488. }
  5489. # tag:src-processing
  5490. macro _SRC("mm", SRC, SRCFLAGS...) {
  5491. .CMD=$C_COMPILER $C_FLAGS_PLATFORM -x objective-c++ -fobjc-arc -fobjc-abi-version=2 -c -o ${output:SRC.o} ${input:SRC} $CXXFLAGS ${pre=-I:_C__INCLUDE} ${SRCFLAGS} ${kv;hide:"p CC"} ${kv;hide:"pc light-green"} $TOOLCHAIN_ENV
  5492. }
  5493. # tag:src-processing
  5494. macro _SRC("fml", SRC, SRCFLAGS...) {
  5495. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output:SRC.inc} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5496. }
  5497. # tag:src-processing
  5498. macro _SRC("fml2", SRC, SRCFLAGS...) {
  5499. .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"}
  5500. }
  5501. # tag:src-processing
  5502. macro _SRC("fml3", SRC, SRCFLAGS...) {
  5503. .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"}
  5504. }
  5505. # tag:src-processing
  5506. macro _SRC("sfdl", SRC, SRCFLAGS...) {
  5507. .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
  5508. }
  5509. macro _XS_SRCS(SRC, TYPEMAPS[], SRCFLAGS...) {
  5510. .CMD=$PERL_LD_LIBRARY_PATH $PERL $PERL_INCLUDE ${suf=/ExtUtils/xsubpp:PERL_PRIVLIB} -typemap ${suf=/ExtUtils/typemap:PERL_PRIVLIB} $PERLSUFFIX $XSUBPPFLAGS ${pre=-typemap :TYPEMAPS} ${input;hide:TYPEMAPS} ${SRCFLAGS} ${input:SRC} ${PERLOUTPUT} ${kv;hide:"p XS"} ${kv;hide:"pc yellow"}
  5511. }
  5512. # tag:src-processing
  5513. macro _SRC("xs", SRC, SRCFLAGS...) {
  5514. .CMD=$_XS_SRCS($SRC TYPEMAPS $_XSTYPEMAPS $SRCFLAGS)
  5515. }
  5516. # tag:src-processing
  5517. macro _SRC("gperf", SRC, SRCFLAGS...) {
  5518. .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"}
  5519. }
  5520. # tag:src-processing
  5521. macro _SRC("rl", SRC, SRCFLAGS...) {
  5522. .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"}
  5523. }
  5524. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5525. .CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${output;stdout;suf=.h.rl5:SRC} ${kv;hide:"p XN"} ${kv;hide:"pc yellow"}
  5526. }
  5527. # tag:src-processing
  5528. macro _SRC("rl5", SRC, SRCFLAGS...) {
  5529. .CMD=$_SRC(rl $SRC $SRCFLAGS)
  5530. }
  5531. # tag:src-processing
  5532. macro _SRC("asp", SRC, SRCFLAGS...) {
  5533. .CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${kv;hide:"p HT"} ${kv;hide:"pc yellow"}
  5534. }
  5535. # tag:src-processing
  5536. macro _SRC("rl6", SRC, SRCFLAGS...) {
  5537. .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"}
  5538. .SEM=target_ragel_lexers PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $RAGEL6_FLAGS ${SRCFLAGS} && set_global_flags RAGEL_FLAGS -L -I $S/ && conan_require_tool ragel/6.10 && conan_import '"bin, ragel* -> ./bin"' ${input;hide:"build/scripts/run_tool.py"}
  5539. }
  5540. # tag:src-processing
  5541. macro _SRC("pln", SRC, SRCFLAGS...) {
  5542. .CMD=$FML_TOOL -b -o ${output;pre=pln.;nopath;noext:SRC.cpp} -f ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  5543. }
  5544. # tag:src-processing
  5545. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  5546. .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"}
  5547. }
  5548. # tag:src-processing
  5549. macro _SRC("ev", SRC, SRCFLAGS...) {
  5550. .CMD=$EVLOG_CMD($SRC)
  5551. .SEM=$EVLOG_CMD($SRC)
  5552. }
  5553. # tag:src-processing
  5554. macro _SRC("proto", SRC, SRCFLAGS...) {
  5555. .CMD=$PROTO_CMD($SRC)
  5556. .SEM=$PROTO_CMD($SRC)
  5557. }
  5558. # tag:src-processing
  5559. macro _SRC("gztproto", SRC, SRCFLAGS...) {
  5560. # _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.
  5561. # descriptor.proto must be resolved as google/protobuf/descriptor.proto
  5562. .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"}
  5563. .PEERDIR=kernel/gazetteer/proto
  5564. }
  5565. # tag:src-processing
  5566. macro _SRC("cfgproto", SRC, SRCFLAGS...) {
  5567. .CMD=$_CPP_CFGPROTO_CMD($SRC)
  5568. }
  5569. # tag:src-processing
  5570. macro _SRC("pyx", SRC, SRCFLAGS...) {
  5571. # Copy-paste from BUILDWITH_CYTHON
  5572. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:SRC} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:SRC} $CYTHON_OUTPUT_INCLUDES ${SRCFLAGS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  5573. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS --cplus ${SRCFLAGS} ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  5574. .ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
  5575. }
  5576. # tag:src-processing
  5577. macro _SRC("in", SRC, SRCFLAGS...) {
  5578. .CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5579. .SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  5580. }
  5581. macro MANUAL_GENERATION(Outs...) {
  5582. .SEM=IGNORED ${output;hide;noauto:Outs}
  5583. }
  5584. # tag:src-processing
  5585. macro _SRC("sc", SRC, SRCFLAGS...) {
  5586. .CMD=${tool:"tools/domschemec"} --in ${input:SRC} --out ${output;norel:SRC.h} ${output_include;hide:"util/generic/strbuf.h"} ${output_include;hide:"array"} ${output_include;hide:"util/generic/string.h"} ${output_include;hide:"util/generic/vector.h"} ${output_include;hide:"util/string/cast.h"} ${SRCFLAGS} ${kv;hide:"p SC"} ${kv;hide:"pc yellow"}
  5587. }
  5588. # tag:src-processing
  5589. macro _SRC("ssqls", SRC, SRCFLAGS...) {
  5590. .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"}
  5591. }
  5592. # tag:src-processing
  5593. macro _SRC("f", SRC, SRCFLAGS...) {
  5594. .CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${output_include;hide:"f2c.h"} ${kv;hide:"p FT"} ${kv;hide:"pc light-green"}
  5595. .PEERDIR=contrib/libs/libf2c
  5596. .ADDINCL=contrib/libs/libf2c
  5597. }
  5598. # tag:src-processing
  5599. macro _SRC("cpp", SRC, SRCFLAGS...) {
  5600. .CMD=$_SRC_cpp($SRC $SRCFLAGS)
  5601. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5602. }
  5603. # tag:src-processing
  5604. macro _SRC("cxx", SRC, SRCFLAGS...) {
  5605. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5606. }
  5607. # tag:src-processing
  5608. macro _SRC("cc", SRC, SRCFLAGS...) {
  5609. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5610. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  5611. }
  5612. # tag:src-processing
  5613. macro _SRC("auxcpp", SRC, SRCFLAGS...) {
  5614. .CMD=$_SRC_cpp($SRC $_FORCE_CPP_FLAGS $SRCFLAGS)
  5615. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($_FORCE_CPP_FLAGS $SRCFLAGS)
  5616. }
  5617. # tag:src-processing
  5618. macro _SRC("C", SRC, SRCFLAGS...) {
  5619. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  5620. }
  5621. # tag:src-processing
  5622. macro _SRC("c", SRC, SRCFLAGS...) {
  5623. .CMD=$_SRC_c($SRC $SRCFLAGS)
  5624. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
  5625. }
  5626. # tag:src-processing
  5627. macro _SRC("m", SRC, SRCFLAGS...) {
  5628. .CMD=$_SRC(c $SRC $SRCFLAGS)
  5629. }
  5630. # tag:src-processing
  5631. macro _SRC("masm", SRC, SRCFLAGS...) {
  5632. .CMD=$_SRC_masm($SRC $SRCFLAGS)
  5633. }
  5634. YASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${pre=-P :PREINCLUDES} ${input;hide:"build/scripts/run_tool.py"} \
  5635. && 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 \
  5636. && add_language ASM \
  5637. && conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5638. ASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${input;hide:"build/scripts/run_tool.py"} \
  5639. && 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 \
  5640. && add_language ASM \
  5641. && conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  5642. # tag:src-processing
  5643. macro _SRC("yasm", SRC, SRCFLAGS...) {
  5644. .CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  5645. .SEM=$YASM_SEM
  5646. }
  5647. # tag:src-processing
  5648. macro _SRC("asm", SRC, SRCFLAGS...) {
  5649. .CMD=$_SRC_ASM($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  5650. .SEM=$ASM_SEM
  5651. }
  5652. # tag:src-processing
  5653. macro _SRC("lua", SRC, SRCFLAGS...) {
  5654. .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"}
  5655. .PEERDIR=$LUAJIT_PATH
  5656. }
  5657. NVCC_CFLAGS=
  5658. when ($IDE_MSVS_CALL == "yes") {
  5659. # This is to avoid issues with .pdb from MSVC calling nvcc calling cl
  5660. NVCC_CFLAGS+=/Fd$(TEMP)
  5661. }
  5662. NVCC_STD_VER=14
  5663. when ($MSVC == "yes") {
  5664. NVCC_STD=/std:c++${NVCC_STD_VER}
  5665. }
  5666. otherwise {
  5667. NVCC_STD=-std=c++${NVCC_STD_VER}
  5668. }
  5669. # tag:src-processing
  5670. macro _SRC("cu", SRC, SRCFLAGS...) {
  5671. .CMD=$_SRC_CU_CMD
  5672. .SEM=target_cuda_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} && set_global_flags CMAKE_CUDA_STANDARD ${NVCC_STD_VER} && target_cuda_flags $CUDA_NVCC_FLAGS && target_cuda_cflags $USER_CXXFLAGS $SRCFLAGS $_SEM_EXTRA_CXX_FLAGS
  5673. .PEERDIR=$_SRC_CU_PEERDIR
  5674. }
  5675. # tag:src-processing
  5676. macro _SRC("fbs", SRC, SRCFLAGS...) {
  5677. .CMD=$FBS_CMD($SRC, $SRCFLAGS)
  5678. .SEM=$FBS_CMD($SRC, $SRCFLAGS)
  5679. }
  5680. # tag:src-processing
  5681. macro _SRC("fbs64", SRC, SRCFLAGS...) {
  5682. .CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
  5683. }
  5684. # tag:src-processing
  5685. macro _SRC("pysrc", SRC, SRCFLAGS...) {
  5686. .CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
  5687. }
  5688. # tag:src-processing
  5689. # This triggers configure error in attempt to add `ya.make` to SRCS macro or apply automatic processing by extension from codegen
  5690. macro _SRC("make", SRC, SRCFLAGS...) {
  5691. .CMD=
  5692. }
  5693. @import "${CONF_ROOT}/conf/bison_lex.conf"
  5694. # tag:src-processing
  5695. macro _SRC_py2src(SRC, SRCFLAGS...) {
  5696. .CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py2_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py2 --python $(PYTHON)/python --py_compile ${input:"build/scripts/py_compile.py"} ${kv;hide:"p P2"} ${kv;hide:"pc light-green"}
  5697. }
  5698. # tag:src-processing
  5699. macro _SRC_py3src(SRC, SRCFLAGS...) {
  5700. .CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py3_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py3 --pycc ${tool:"contrib/tools/python3/pycc"} ${kv;hide:"p P3"} ${kv;hide:"pc light-green"}
  5701. }
  5702. # tag:src-processing python-specific
  5703. when ($PYTHON3 == "yes") {
  5704. MACRO_ALIAS(_SRC_PYSRC _SRC_py3src)
  5705. }
  5706. otherwise {
  5707. MACRO_ALIAS(_SRC_PYSRC _SRC_py2src)
  5708. }
  5709. # tag:src-processing
  5710. macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
  5711. .CMD=$_SRC_C_NODEPS_CMD
  5712. }
  5713. # Custom flags for generated cpp-files. To support another generator:
  5714. # - insert additional file extension before .cpp into generated cpp-file name
  5715. # - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
  5716. #
  5717. # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
  5718. # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
  5719. #
  5720. # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
  5721. # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
  5722. #
  5723. # flags -fno-profile-instr-generate -fno-coverage-mapping needed to always disable coverage for .pyx, .rl5, .rl6
  5724. # generated sources
  5725. ## tag:src-processing
  5726. when ($CLANG == "yes") {
  5727. _LANG_CFLAGS_FILTER=\
  5728. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl5:SRC} \
  5729. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl6:SRC} \
  5730. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.pyx:SRC}
  5731. }
  5732. otherwise {
  5733. _LANG_CFLAGS_FILTER=\
  5734. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
  5735. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
  5736. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
  5737. }
  5738. # tag:src-processing
  5739. # Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
  5740. macro _FILTER_EXTS(SKIP="", FLAGS...) {
  5741. .CMD=$FLAGS
  5742. }
  5743. # tag:src-processing
  5744. macro _LANG_CFLAGS(SRC) {
  5745. .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
  5746. }
  5747. # tag:src-processing
  5748. # ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
  5749. # Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
  5750. _LANG_CFLAGS_VALUE=
  5751. when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
  5752. _LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
  5753. }
  5754. # Allows to add single compilation unit name to the node's 'kv' section.
  5755. # This is used by the coverage machinery to instrument only the necessary sources
  5756. # when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
  5757. SCU_NAME_KV=
  5758. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no" && $USE_SCU_VALUE == "yes") {
  5759. SCU_NAME_KV=${hide;kv:"scu_name $KV_VAL"}
  5760. }
  5761. macro _ADD_SCU_NAME(KV_VAL) {
  5762. .CMD=$SCU_NAME_KV
  5763. }
  5764. # tag:src-processing
  5765. macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5766. .CMD=$_SRC_CPP_CMD $_ADD_SCU_NAME(${input:SRC})
  5767. }
  5768. # tag:src-processing
  5769. macro _SRC_c(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  5770. .CMD=$_SRC_C_CMD $_ADD_SCU_NAME(${input:SRC})
  5771. }
  5772. # tag:src-processing
  5773. macro _SRC_m(SRC, SRCFLAGS...) {
  5774. .CMD=$_SRC_M_CMD
  5775. }
  5776. # tag:src-processing
  5777. macro _SRC_masm(SRC, SRCFLAGS...) {
  5778. .CMD=$_SRC_MASM_CMD
  5779. }
  5780. # tag:lua-specific
  5781. ### @usage: COMPILE_LUA(Src, [NAME <import_name>])
  5782. ###
  5783. ### Compile LUA source file to object code using LUA 2.0
  5784. ### Optionally override import name which is by default reflects Src name
  5785. macro COMPILE_LUA(Src, NAME="") {
  5786. .CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
  5787. }
  5788. # tag:lua-specific
  5789. ### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
  5790. ###
  5791. ### Compile LUA source file to object code using LUA 2.1
  5792. macro _SRC_lua_21(SRC, SRCFLAGS...) {
  5793. .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"}
  5794. .PEERDIR=$LUAJIT_21_PATH
  5795. }
  5796. # tag:lua-specific
  5797. ### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
  5798. ###
  5799. ### Compile LUA source file to object code using LUA 2.1
  5800. ### Optionally override import name which is by default reflects Src name
  5801. macro COMPILE_LUA_21(Src, NAME="") {
  5802. .CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
  5803. }
  5804. GETTEXT_KEEP_PATH=no
  5805. _MO_OUTPUT=
  5806. when ($GETTEXT_KEEP_PATH == "yes") {
  5807. _MO_OUTPUT=${output;noauto;norel;noext:SRC.mo}
  5808. }
  5809. otherwise {
  5810. _MO_OUTPUT=${output;noauto;nopath;noext;tobindir:SRC.mo}
  5811. }
  5812. # tag:src-processing
  5813. macro _SRC("po", SRC, SRCFLAGS...) {
  5814. .CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
  5815. }
  5816. # tag:ydl-specific
  5817. YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
  5818. YDL_DESC_FLAGS=
  5819. # tag:src-processing tag:ydl-specific
  5820. macro _SRC("ydl", SRC, SRCFLAGS...) {
  5821. .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"}
  5822. .PEERDIR+=statbox/ydl/runtime/cpp
  5823. }
  5824. # tag:ydl-specific
  5825. ### @usage BUILD_YDL_DESC(Input Symbol Output)
  5826. ###
  5827. ### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
  5828. ###
  5829. ### @example:
  5830. ###
  5831. ### PACKAGE()
  5832. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5833. ### END()
  5834. ###
  5835. ### 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.
  5836. macro BUILD_YDL_DESC(Input, Symbol, Output) {
  5837. .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"}
  5838. }
  5839. # tag:ydl-specific
  5840. ### @usage: YDL_DESC_USE_BINARY()
  5841. ###
  5842. ### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
  5843. ###
  5844. ### @example:
  5845. ###
  5846. ### PACKAGE()
  5847. ### YDL_DESC_USE_BINARY()
  5848. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5849. ### END()
  5850. ###
  5851. ### This will generate descriptor Event.ydld in a binary format.
  5852. macro YDL_DESC_USE_BINARY() {
  5853. YDL_DESC_FLAGS_BINARY= --binary
  5854. SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
  5855. }
  5856. ### @usage SRC(File Flags...)
  5857. ###
  5858. ### Compile single file with extra Flags.
  5859. ### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
  5860. macro SRC(FILE, FLAGS...) {
  5861. _SRC(${lastext:FILE} $FILE $FLAGS)
  5862. }
  5863. ### @usage: SRCS(<[GLOBAL] File> ...)
  5864. ###
  5865. ### 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.
  5866. ### Arcadia Paths from the root and is relative to the project's LIST are supported
  5867. ###
  5868. ### 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.
  5869. ### 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)
  5870. ###
  5871. ### @example:
  5872. ###
  5873. ### LIBRARY(test_global)
  5874. ### SRCS(GLOBAL foo.cpp)
  5875. ### END()
  5876. ###
  5877. ### 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.
  5878. macro SRCS(FILES...) {
  5879. foreach (FILE : $FILES) {
  5880. _SRC(${lastext:FILE} $FILE)
  5881. }
  5882. }
  5883. # tag:c-specific
  5884. macro _SRC_C_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  5885. .CMD=$_SRC_c($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  5886. .SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL
  5887. }
  5888. macro _SRC_CPP_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  5889. .CMD=$_SRC_cpp($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  5890. .SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS
  5891. }
  5892. # tag:src-specific tag:cpp-specific
  5893. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5894. ###
  5895. ### Defenition of generic macro. Report an error that the File with Ext is not
  5896. ### supported by macro MacroName if no appropriate macro specialization is found.
  5897. macro _SRC_CUSTOM_C_CPP(EXT, MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5898. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  5899. }
  5900. # tag:src-specific tag:cpp-specific
  5901. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5902. ###
  5903. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single C file (with .c extension)
  5904. macro _SRC_CUSTOM_C_CPP("c", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5905. _SRC_C_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5906. }
  5907. # tag:src-specific tag:cpp-specific
  5908. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5909. ###
  5910. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cpp extension)
  5911. macro _SRC_CUSTOM_C_CPP("cpp", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5912. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5913. }
  5914. # tag:src-specific tag:cpp-specific
  5915. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5916. ###
  5917. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cxx extension)
  5918. macro _SRC_CUSTOM_C_CPP("cxx", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5919. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5920. }
  5921. # tag:src-specific tag:cpp-specific
  5922. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5923. ###
  5924. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cc extension)
  5925. macro _SRC_CUSTOM_C_CPP("cc", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5926. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5927. }
  5928. # tag:src-specific tag:cpp-specific
  5929. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5930. ###
  5931. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .C extension)
  5932. macro _SRC_CUSTOM_C_CPP("C", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5933. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5934. }
  5935. # tag:src-specific tag:cpp-specific tag:cpu
  5936. ### @uasge SRC_C_SSE2(File Flags...)
  5937. ###
  5938. ### Compile a single C/C++ file with SSE2 and additional Flags
  5939. macro SRC_C_SSE2(FILE, FLAGS...) {
  5940. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE2 $FILE .sse2 $SSE2_CFLAGS $FLAGS)
  5941. }
  5942. # tag:src-specific tag:cpp-specific tag:cpu
  5943. ### @uasge SRC_C_SSE3(File Flags...)
  5944. ###
  5945. ### Compile a single C/C++ file with SSE3 and additional Flags
  5946. macro SRC_C_SSE3(FILE, FLAGS...) {
  5947. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE3 $FILE .sse3 $SSE3_CFLAGS $FLAGS)
  5948. }
  5949. # tag:src-specific tag:cpp-specific tag:cpu
  5950. ### @uasge SRC_C_SSSE3(File Flags...)
  5951. ###
  5952. ### Compile a single C/C++ file with SSSE3 and additional Flags
  5953. macro SRC_C_SSSE3(FILE, FLAGS...) {
  5954. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSSE3 $FILE .ssse3 $SSSE3_CFLAGS $FLAGS)
  5955. }
  5956. # tag:src-specific tag:cpp-specific tag:cpu
  5957. ### @uasge SRC_C_SSE4(File Flags...)
  5958. ###
  5959. ### Compile a single C/C++ file with SSE4 and additional Flags
  5960. macro SRC_C_SSE4(FILE, FLAGS...) {
  5961. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE4 $FILE .sse4 $SSE4_CFLAGS $FLAGS)
  5962. }
  5963. # tag:src-specific tag:cpp-specific tag:cpu
  5964. ### @uasge SRC_C_SSE41(File Flags...)
  5965. ###
  5966. ### Compile a single C/C++ file with SSE4.1 and additional Flags
  5967. macro SRC_C_SSE41(FILE, FLAGS...) {
  5968. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE41 $FILE .sse41 $SSE41_CFLAGS $FLAGS)
  5969. }
  5970. # tag:src-specific tag:cpp-specific tag:cpu
  5971. ### @uasge SRC_C_AVX(File Flags...)
  5972. ###
  5973. ### Compile a single C/C++ file with AVX and additional Flags
  5974. macro SRC_C_AVX(FILE, FLAGS...) {
  5975. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX $FILE .avx $AVX_CFLAGS $FLAGS)
  5976. }
  5977. # tag:src-specific tag:cpp-specific tag:cpu
  5978. ### @uasge SRC_C_AVX2(File Flags...)
  5979. ###
  5980. ### Compile a single C/C++ file with AVX2 and additional Flags
  5981. macro SRC_C_AVX2(FILE, FLAGS...) {
  5982. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX2 $FILE .avx2 $AVX2_CFLAGS $FLAGS)
  5983. }
  5984. # tag:src-specific tag:cpp-specific tag:cpu
  5985. ### @uasge SRC_C_AVX512(File Flags...)
  5986. ###
  5987. ### Compile a single C/C++ file with AVX512 and additional Flags
  5988. macro SRC_C_AVX512(FILE, FLAGS...) {
  5989. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX512 $FILE .avx512 $AVX512_CFLAGS $FLAGS)
  5990. }
  5991. # tag:src-specific tag:cpp-specific tag:cpu
  5992. ### @uasge SRC_C_AVX512(File Flags...)
  5993. ###
  5994. ### Compile a single C/C++ file with AVX512 and additional Flags
  5995. macro SRC_C_AMX(FILE, FLAGS...) {
  5996. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AMX $FILE .amx $AMX_CFLAGS $FLAGS)
  5997. }
  5998. # tag:src-specific tag:cpp-specific tag:cpu
  5999. ### @uasge SRC_C_XOP(File Flags...)
  6000. ###
  6001. ### Compile a single C/C++ file with (an AMD-specific instruction set,
  6002. ### see https://en.wikipedia.org/wiki/XOP_instruction_set) and additional Flags
  6003. macro SRC_C_XOP(FILE, FLAGS...) {
  6004. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_XOP $FILE .xop $XOP_CFLAGS $FLAGS)
  6005. }
  6006. # tag:src-specific tag:cpp-specific tag:cpu
  6007. ### @uasge SRC_C_PCLMUL(File Flags...)
  6008. ###
  6009. ### Compile a single C/C++ file with PCLMUL and additional Flags
  6010. macro SRC_C_PCLMUL(FILE, FLAGS...) {
  6011. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE .pclmul $PCLMUL_CFLAGS $FLAGS )
  6012. }
  6013. # tag:src-specific tag:cpp-specific
  6014. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  6015. ###
  6016. ### Defenition of generic macro. Report an error that the File with Ext is not
  6017. ### supported by macro MacroName if no appropriate macro specialization is found.
  6018. macro _SRC_STRICT_C_CPP(EXT, MACRO_NAME, FILE, FLAGS...) {
  6019. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  6020. }
  6021. # tag:src-specific tag:cpp-specific
  6022. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  6023. ###
  6024. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single C file (with .c extension)
  6025. macro _SRC_STRICT_C_CPP("c", MACRO_NAME, FILE, FLAGS...) {
  6026. _SRC(c $FILE $FLAGS)
  6027. }
  6028. # tag:src-specific tag:cpp-specific
  6029. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  6030. ###
  6031. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cpp extension)
  6032. macro _SRC_STRICT_C_CPP("cpp", MACRO_NAME, FILE, FLAGS...) {
  6033. _SRC(cpp $FILE $FLAGS)
  6034. }
  6035. # tag:src-specific tag:cpp-specific
  6036. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  6037. ###
  6038. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cxx extension)
  6039. macro _SRC_STRICT_C_CPP("cxx", MACRO_NAME, FILE, FLAGS...) {
  6040. _SRC(cpp $FILE $FLAGS)
  6041. }
  6042. # tag:src-specific tag:cpp-specific
  6043. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  6044. ###
  6045. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cc extension)
  6046. macro _SRC_STRICT_C_CPP("cc", MACRO_NAME, FILE, FLAGS...) {
  6047. _SRC(cpp $FILE $FLAGS)
  6048. }
  6049. # tag:src-specific tag:cpp-specific
  6050. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  6051. ###
  6052. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .C extension)
  6053. macro _SRC_STRICT_C_CPP("C", MACRO_NAME, FILE, FLAGS...) {
  6054. _SRC(cpp $FILE $FLAGS)
  6055. }
  6056. # tag:src-specific tag:cpp-specific
  6057. ### @uasge SRC_C_PIC(File Flags...)
  6058. ###
  6059. ### Compile a single C/C++ file with -fPIC and additional Flags
  6060. macro SRC_C_PIC(FILE, FLAGS...) {
  6061. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PIC $FILE $PIC_CFLAGS $FLAGS)
  6062. }
  6063. # tag:src-specific tag:cpp-specific
  6064. ### @uasge SRC_C_NO_LTO(File Flags...)
  6065. ###
  6066. ### Compile a single C/C++ file with link-time-optimization disabling and additional Flags
  6067. macro SRC_C_NO_LTO(FILE, FLAGS...) {
  6068. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_NO_LTO $FILE $NO_LTO_CFLAGS $FLAGS)
  6069. }
  6070. # tag:python-processing tag:cython
  6071. # TODO: use it in [.pyx] cmd
  6072. ### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
  6073. ###
  6074. ### Generates .cpp file from .pyx.
  6075. macro BUILDWITH_CYTHON_CPP(Src, Options...) {
  6076. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6077. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  6078. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6079. }
  6080. # tag:python-processing tag:cython tag:internal
  6081. ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
  6082. ###
  6083. ### Generates .cpp file from .pyx and attach extra input Dep.
  6084. ### If Dep changes the .cpp file will be re-generated.
  6085. macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
  6086. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6087. .SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  6088. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6089. }
  6090. # tag:python-processing tag:cython tag:internal
  6091. ### @usage: _BUILDWITH_CYTHON_CPP_H(Src Dep Options...) # internal
  6092. ###
  6093. ### BUILDWITH_CYTHON_CPP without .pyx infix and with cdef public .h file.
  6094. macro _BUILDWITH_CYTHON_CPP_H(Src, Dep, Options...) {
  6095. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.cpp} ${output;hide;addincl;noext;tobindir:Src.h} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6096. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6097. }
  6098. # tag:python-processing tag:cython
  6099. ### @usage: BUILDWITH_CYTHON_C(Src Options...)
  6100. ###
  6101. ### Generates .c file from .pyx.
  6102. macro BUILDWITH_CYTHON_C(Src, Options...) {
  6103. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6104. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  6105. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6106. }
  6107. # tag:python-processing tag:cython tag:internal
  6108. ### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
  6109. ###
  6110. ### Generates .c file from .pyx and attach extra input Dep.
  6111. ### If Dep changes the .c file will be re-generated.
  6112. macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
  6113. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6114. .SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  6115. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6116. }
  6117. # tag:python-processing tag:cython tag:internal
  6118. ### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
  6119. ###
  6120. ### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
  6121. macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
  6122. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6123. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6124. }
  6125. # tag:python-processing tag:cython tag:internal
  6126. ### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
  6127. ###
  6128. ### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
  6129. macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
  6130. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} ${output;hide;addincl;noext;defext=_api.h;tobindir:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  6131. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  6132. }
  6133. # tag:python-processing tag:internal
  6134. ### @usage: _SWIG_PYTHON_CPP(Src, DstSubPrefix) # internal
  6135. ###
  6136. ### Run swig on Src to produce DstSubPrefix.py and DstSubPrefix_swg.cpp that
  6137. ### provides DstSubPrefix_swg python module.
  6138. macro _SWIG_PYTHON_CPP(Src, DstSubPrefix) {
  6139. .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"}
  6140. ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY)
  6141. }
  6142. # tag:python-processing tag:internal
  6143. ### @usage: _SWIG_PYTHON_C(Src, DstSubPrefix) # internal
  6144. ###
  6145. ### Like _SWIG_PYTHON_CPP but generate DstSubPrefix_swg.c.
  6146. macro _SWIG_PYTHON_C(Src, DstSubPrefix) {
  6147. .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"}
  6148. ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY)
  6149. }
  6150. ### @usage: BUILDWITH_RAGEL6(Src Options...)
  6151. ###
  6152. ### Compile .rl file using Ragel6.
  6153. macro BUILDWITH_RAGEL6(Src, Options...) {
  6154. .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"}
  6155. }
  6156. # tag:python-processing tag:internal
  6157. # TODO: use it in [.pyx] cmd
  6158. ### @usage: _PY_REGISTER() # internal
  6159. ###
  6160. ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
  6161. ###
  6162. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  6163. macro _PY_REGISTER(Func) {
  6164. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  6165. SRCS(GLOBAL $Func.reg.cpp)
  6166. }
  6167. # tag:python-processing tag:internal
  6168. ### @usage: _PY3_REGISTER() # internal
  6169. ###
  6170. ### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
  6171. ###
  6172. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  6173. macro _PY3_REGISTER(Func) {
  6174. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${output;noauto:Func.reg3.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  6175. SRCS(GLOBAL $Func.reg3.cpp)
  6176. }
  6177. # tag:python-processing tag:internal
  6178. ### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
  6179. ###
  6180. ### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
  6181. ###
  6182. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  6183. macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
  6184. .CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  6185. }
  6186. # tag:python-processing tag:internal
  6187. ### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
  6188. ###
  6189. ### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
  6190. ###
  6191. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  6192. macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
  6193. .CMD=${env:"PYTHONHASHSEED=0"} ${tool:"contrib/tools/python3/pycc"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc3} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  6194. }
  6195. macro _ARCHIVE_SEM_HELPER(FLAGS[], OUT, Files...) {
  6196. .SEM=add_custom_command OUTPUT ${OUT} DEPENDS $ARCH_TOOL ${join= :Files} COMMAND $ARCH_TOOL $FLAGS ${join=\: :Files}: -o ${OUT}
  6197. }
  6198. ### @usage: ARCHIVE_ASM(NAME archive_name files...)
  6199. ###
  6200. ### Similar to the macro ARCHIVE, but:
  6201. ### 1. works faster and it is better to use for large files.
  6202. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
  6203. macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  6204. .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;suf=$OBJ_SUF.rodata:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"}
  6205. .SEM=$_ARCHIVE_SEM_HELPER(${output;suf=$OBJ_SUF.rodata:NAME} ${input:Files} FLAGS -q $DONTCOMPRESS)
  6206. }
  6207. # tag:yweb-specific
  6208. macro PIRE_INLINE_CMD(SRC) {
  6209. .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"}
  6210. }
  6211. # tag:yweb-specific
  6212. macro PIRE_INLINE(FILES...) {
  6213. foreach (FILE : $FILES) {
  6214. PIRE_INLINE_CMD($FILE)
  6215. }
  6216. }
  6217. ### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
  6218. ###
  6219. ### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  6220. ###
  6221. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  6222. macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  6223. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  6224. .SEM=$_ARCHIVE_SEM_HELPER(${output;addincl;noauto:NAME} ${input:Files} FLAGS -q -x $DONTCOMPRESS) && target_sources PRIVATE $BINDIR/$NAME
  6225. }
  6226. ### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
  6227. ###
  6228. ### Add arbitrary data to a module be accessible by specified key.
  6229. ### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  6230. ###
  6231. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  6232. macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", Files...) {
  6233. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  6234. }
  6235. #scripts
  6236. #special commands
  6237. BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
  6238. SVNVERSION_JAVA_MARKER=output-java-class
  6239. SVNVERSION_GO_MARKER=output-go
  6240. VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
  6241. VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
  6242. VCS_C=$BINDIR/__vcs_version__.c
  6243. VCS_GO=$BINDIR/__vcs_version__.go
  6244. VCS_JAVA=$BINDIR/__vcs_version__.mf
  6245. VCS_INFO_DISABLE_CACHE__NO_UID__=
  6246. YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  6247. CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  6248. CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
  6249. YASM_DEBUG_INFO=
  6250. CL_DEBUG_INFO=
  6251. CL_MACRO_INFO=
  6252. when ($FORCE_VCS_INFO_UPDATE == "yes") {
  6253. VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
  6254. }
  6255. ### Works for pyton too.
  6256. GENERATE_VCS_C_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} $(VCS)/vcs.json $VCS_C ${input:"build/scripts/c_templates/svn_interface.c"} $VCS_INFO_DISABLE_CACHE__NO_UID__ && $_SRC_c_nodeps($VCS_C, $VCS_C_OBJ, $(SOURCE_ROOT))
  6257. GENERATE_VCS_GO_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-go $(VCS)/vcs.json $VCS_GO $VCS_INFO_DISABLE_CACHE__NO_UID__
  6258. 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__
  6259. macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
  6260. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
  6261. }
  6262. VCS_INFO_FILE=
  6263. ### @usage VCS_INFO_FILE([FILE out_file])
  6264. ###
  6265. ### Enable saving vcs info as a json-file into PACKAGE
  6266. ###
  6267. ### Info is saved to 'vcs_info.json' by default.
  6268. ### Use FILE parameter if you want another name.
  6269. ###
  6270. ### Note: macro can be used only once per module
  6271. macro VCS_INFO_FILE(FILE="vcs_info.json") {
  6272. SET(VCS_INFO_FILE $FILE)
  6273. }
  6274. ADD_VCS_INFO_FILE_CMD=
  6275. when ($VCS_INFO_FILE) {
  6276. ADD_VCS_INFO_FILE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-json $(VCS)/vcs.json ${output:VCS_INFO_FILE} $VCS_INFO_DISABLE_CACHE__NO_UID__
  6277. }
  6278. ### @usage: CREATE_BUILDINFO_FOR(GenHdr)
  6279. ###
  6280. ### Creates header file to access some information about build specified via configuration variables.
  6281. ### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
  6282. macro CREATE_BUILDINFO_FOR(GenHdr) {
  6283. .CMD=$YIELD $CXX_COMPILER && $YIELD $CXXFLAGS && $XARGS $YMAKE_PYTHON3 ${input:BUILDVERSION_SCRIPT} ${output:GenHdr} ${kv;hide:"p BI"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"} $SVN_DEPENDS_CACHE__NO_UID__
  6284. .SEM=$RUN_PYTHON3($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
  6285. }
  6286. DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
  6287. DECIMAL_MD5_FIXED=
  6288. ### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
  6289. ###
  6290. ### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
  6291. ### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
  6292. macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
  6293. .CMD=$YMAKE_PYTHON ${input:DECIMAL_MD5_SCRIPT} --fixed-output=${DECIMAL_MD5_FIXED} --func-name=${FUNCNAME} --lower-bits 32 --source-root=$ARCADIA_ROOT ${input;context=TEXT:Opts} ${output;stdout:File} ${kv;hide:"p SV"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"}
  6294. }
  6295. # tag:internal
  6296. ### @usage $CFG_VARS # internal
  6297. ###
  6298. ### Mark commands that embed Configuration variables into files
  6299. macro CFG_VARS() {
  6300. .GEN_FROM_FILE=yes
  6301. }
  6302. ### @usage: CONFIGURE_FILE(from to)
  6303. ###
  6304. ### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
  6305. ### The values are collected during configure stage, while replacement itself happens during build stage.
  6306. ### Used implicitly for .in-files processing.
  6307. macro CONFIGURE_FILE(Src, Dst) {
  6308. .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"}
  6309. .SEM=set_vars ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;addincl;rootrel:Dst}
  6310. }
  6311. ### @usage: BASE_CODEGEN(tool_path prefix)
  6312. ###
  6313. ### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in.
  6314. macro BASE_CODEGEN(Tool, Prefix, Opts...) {
  6315. .CMD=${tool:Tool} ${input:Prefix.in} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc yellow"}
  6316. }
  6317. # tag:internal
  6318. ### @usage: _SPLIT_CODEGEN_BASE(tool prefix OUTS[] OUTPUT_INCLUDES[]) # internal
  6319. ###
  6320. ### Generator of a certain number .the. cpp file + one header .h file from .in.
  6321. ### This is the call of the generator. Python macro SPLIT_CODEGEN() is defined in order to properly fill command outputs from OUT_NUM argument.
  6322. macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) {
  6323. .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"}
  6324. }
  6325. STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \
  6326. ${output_include;hide:"util/generic/strbuf.h"} \
  6327. ${output_include;hide:"util/generic/vector.h"} \
  6328. ${output_include;hide:"util/generic/ptr.h"} \
  6329. ${output_include;hide:"util/generic/yexception.h"} \
  6330. ${output_include;hide:"kernel/struct_codegen/reflection/reflection.h"} \
  6331. ${output_include;hide:"kernel/struct_codegen/reflection/floats.h"}
  6332. ### @usage: STRUCT_CODEGEN(Prefix)
  6333. ### A special case BASE_CODEGEN, in which the kernel/struct_codegen/codegen_tool tool is used.
  6334. macro STRUCT_CODEGEN(Prefix) {
  6335. .CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES)
  6336. .PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection
  6337. }
  6338. ### @usage: DUMPERF_CODEGEN(Prefix)
  6339. ### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used
  6340. macro DUMPERF_CODEGEN(Prefix) {
  6341. .CMD=$BASE_CODEGEN(extsearch/images/robot/tools/dumperf/codegen, $Prefix, ${output_include;hide:"extsearch/images/kernel/erf/erf_format.h"})
  6342. }
  6343. # tag:flags
  6344. ### @usage: LDFLAGS(LinkerFlags...)
  6345. ###
  6346. ### Add flags to the link command line of executable or shared library/dll.
  6347. ### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
  6348. ### Note: remember about the incompatibility of flags for gcc and cl.
  6349. macro LDFLAGS(Flags...) {
  6350. SET_APPEND(LDFLAGS_GLOBAL $Flags)
  6351. }
  6352. # tag:flags
  6353. ### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
  6354. ###
  6355. ### Add the specified flags to the compilation command of C and C++ files.
  6356. ### @params: GLOBAL - Propagates these flags to dependent projects
  6357. ### Note: remember about the incompatibility flags for clang and cl (to set flags specifically for cl.exe use MSVC_FLAGS).
  6358. macro CFLAGS(Flags...) {
  6359. SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
  6360. }
  6361. # tag:flags
  6362. ### @usage: MASMFLAGS(compiler flags)
  6363. ### Add the specified flags to the compilation command of .masm files.
  6364. macro MASMFLAGS(Flags...) {
  6365. SET_APPEND(MASMFLAGS $Flags)
  6366. }
  6367. # tag:flags
  6368. ### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
  6369. ### Add the specified flags to the compilation command of .c (but not .cpp) files.
  6370. ### @params: GLOBAL - Distributes these flags on dependent projects
  6371. macro CONLYFLAGS(Flags...) {
  6372. SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
  6373. }
  6374. # tag:flags
  6375. ### @usage: CXXFLAGS(compiler_flags)
  6376. ### Add the specified flags to the compilation command of .cpp (but not .c) files.
  6377. macro CXXFLAGS(Flags...) {
  6378. SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
  6379. }
  6380. # tag:flags
  6381. ### @usage: CUDA_NVCC_FLAGS(compiler flags)
  6382. ### Add the specified flags to the compile line .cu-files.
  6383. macro CUDA_NVCC_FLAGS(Flags...) {
  6384. SET_APPEND(CUDA_NVCC_FLAGS $Flags)
  6385. }
  6386. # tag:flags
  6387. ### @usage: NVCC_DEVICE_LINK(file.cu...)
  6388. ### Run nvcc --device-link on objects compiled from srcs with --device-c.
  6389. ### This generates a stub object devlink.o that supplies missing pieces for the
  6390. ### host linker to link relocatable device objects into the final executable.
  6391. macro NVCC_DEVICE_LINK(Srcs...) {
  6392. .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"}
  6393. }
  6394. # tag:flags
  6395. ### @usage: CYTHON_FLAGS(compiler_flags)
  6396. ### Add the specified flags to the compilation command of .pyx files.
  6397. macro CYTHON_FLAGS(Flags...) {
  6398. SET_APPEND(CYTHON_OPTIONS $Flags)
  6399. }
  6400. ### @usage: STRIP()
  6401. ### Strip debug info from a PROGRAM, DLL or TEST.
  6402. ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
  6403. macro STRIP() {
  6404. ENABLE(STRIP)
  6405. }
  6406. ### @usage: NO_OPTIMIZE()
  6407. ### Build code without any optimizations (-O0 mode).
  6408. macro NO_OPTIMIZE() {
  6409. ENABLE(NO_OPTIMIZE)
  6410. }
  6411. #TODO(YMAKE-91) read proper compile flags instead of sending explicit flags to semgraph directly
  6412. _SEM_EXTRA_CXX_FLAGS=
  6413. ### @usage: NO_COMPILER_WARNINGS()
  6414. ### Disable all compiler warnings in the module.
  6415. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  6416. macro NO_COMPILER_WARNINGS() {
  6417. ENABLE(NO_COMPILER_WARNINGS)
  6418. SET(_SEM_EXTRA_CXX_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>")
  6419. }
  6420. ### @usage: WERROR()
  6421. ### Consider warnings as errors in the current module.
  6422. ### In the bright future will be removed, since WERROR is the default.
  6423. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  6424. macro WERROR() {
  6425. ENABLE(WERROR)
  6426. }
  6427. ### @usage: NO_WERROR()
  6428. ### Override WERROR() behavior
  6429. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  6430. macro NO_WERROR() {
  6431. DISABLE(WERROR)
  6432. }
  6433. ### @usage: NO_WSHADOW()
  6434. ### Disable C++ shadowing warnings.
  6435. macro NO_WSHADOW() {
  6436. ENABLE(NO_WSHADOW)
  6437. }
  6438. # tag:internal
  6439. ### @usage: NO_PLATFORM_RESOURCES() # internal
  6440. ### Exclude dependency on platform resources libraries.
  6441. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  6442. macro NO_PLATFORM_RESOURCES() {
  6443. ENABLE(NOPLATFORM_RESOURCES)
  6444. }
  6445. # tag:internal tag:codenav
  6446. ### @usage: NO_CODENAVIGATION() # internal
  6447. ### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
  6448. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  6449. macro NO_CODENAVIGATION() {
  6450. ENABLE(NOCODENAVIGATION)
  6451. }
  6452. ### @usage: NO_UTIL()
  6453. ### Build module without dependency on util.
  6454. ### Note: use this with care. Util most likely will be linked into executable anyway,
  6455. ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
  6456. macro NO_UTIL() {
  6457. ENABLE(NOUTIL)
  6458. }
  6459. ### @usage: NO_RUNTIME()
  6460. ###
  6461. ### This macro:
  6462. ### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
  6463. ### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
  6464. ### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
  6465. ### may not be detected at build time and may lead to unpredictable behavors at configure time.
  6466. macro NO_RUNTIME() {
  6467. SET(USE_ARCADIA_LIBM no)
  6468. NO_UTIL()
  6469. ENABLE(NORUNTIME)
  6470. }
  6471. ### @usage: NO_LIBC()
  6472. ###
  6473. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
  6474. ### Note: use this with care. libc most likely will be linked into executable anyway,
  6475. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  6476. macro NO_LIBC() {
  6477. NO_RUNTIME()
  6478. DISABLE(MUSL)
  6479. }
  6480. ### @usage: NO_PLATFORM()
  6481. ###
  6482. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
  6483. ### Note: use this with care. libc most likely will be linked into executable anyway,
  6484. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  6485. macro NO_PLATFORM() {
  6486. NO_LIBC()
  6487. ENABLE(NOPLATFORM)
  6488. }
  6489. # tag:cpp-specific
  6490. ### @usage: USE_CXX()
  6491. ###
  6492. ### Add dependency on C++ runtime
  6493. ### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
  6494. macro USE_CXX() {
  6495. DISABLE(NORUNTIME)
  6496. }
  6497. ### @usage: USE_UTIL()
  6498. ###
  6499. ### Add dependency on util and C++ runtime
  6500. ### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
  6501. macro USE_UTIL() {
  6502. USE_CXX()
  6503. DISABLE(NOUTIL)
  6504. }
  6505. ### @usage: USE_NASM()
  6506. ###
  6507. ### Build only .asm files with nasm toolchain instead of yasm
  6508. ### Add to ya.make file ADDINCL(asm ...) with all folders where .asm files include smth
  6509. macro USE_NASM() {
  6510. ENABLE(USE_NASM_ASSEMBLER)
  6511. PEERDIR(build/external_resources/nasm)
  6512. }
  6513. # tag:deprecated
  6514. ### @usage: NO_JOIN_SRC() # deprecated, does-nothing
  6515. ### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
  6516. macro NO_JOIN_SRC() {
  6517. ENABLE(UNUSED_MACRO)
  6518. }
  6519. # tag:sanitize
  6520. ### @usage: NO_SANITIZE()
  6521. ###
  6522. ### Disable all sanitizers for the module.
  6523. macro NO_SANITIZE() {
  6524. DISABLE(SANITIZER_TYPE)
  6525. }
  6526. # tag:coverage tag:sanitize
  6527. ### @usage: NO_SANITIZE_COVERAGE()
  6528. ###
  6529. ### Disable lightweight coverage (-fsanitize-coverage) for the module.
  6530. ### Sanitize coverage is commonly used with fuzzing.
  6531. ### It might be useful to disable it for libraries that should never
  6532. ### be the main targets for fuzzing, like libfuzzer library itself.
  6533. ### Sanitize coverage instrumentation is enabled by the --sanitize-coverage option.
  6534. macro NO_SANITIZE_COVERAGE() {
  6535. DISABLE(SANITIZE_COVERAGE)
  6536. }
  6537. # tag:sanitize
  6538. ### @usage: NO_SANITIZE_HEADERS()
  6539. ###
  6540. ### Disable dependency on sanitizer headers for the module.
  6541. macro NO_SANITIZE_HEADERS() {
  6542. DISABLE(SANITIZE_HEADERS)
  6543. }
  6544. # tag:coverage
  6545. ### @usage: NO_CLANG_COVERAGE()
  6546. ###
  6547. ### Disable heavyweight clang coverage for the module. Clang coverage instrumentation is enabled by the --clang-coverage option.
  6548. macro NO_CLANG_COVERAGE() {
  6549. DISABLE(CLANG_COVERAGE)
  6550. }
  6551. macro NO_CLANG_TIDY() {
  6552. DISABLE(TIDY_ENABLED)
  6553. }
  6554. # tag:python-specific tag:coverage
  6555. ### @usage: NO_PYTHON_COVERAGE()
  6556. ###
  6557. ### Disable python coverage for module
  6558. macro NO_PYTHON_COVERAGE() {
  6559. DISABLE(PYTHON_COVERAGE)
  6560. }
  6561. # tag:python-specific tag:coverage tag:cython
  6562. ### @usage: NO_CYTHON_COVERAGE()
  6563. ###
  6564. ### Disable cython and cythonized python coverage (CYTHONIZE_PY)
  6565. ### Implies NO_CLANG_COVERAGE() - right now, we can't disable instrumentation for .py.cpp files, but enable for .cpp
  6566. macro NO_CYTHON_COVERAGE() {
  6567. DISABLE(CYTHON_COVERAGE)
  6568. NO_CLANG_COVERAGE()
  6569. }
  6570. # tag:lua-specific
  6571. LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
  6572. macro _LUAJIT_OBJDUMP(Src, OUT="") {
  6573. .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"}
  6574. }
  6575. # tag:lua-specific
  6576. LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
  6577. macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
  6578. .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"}
  6579. }
  6580. macro _MX_BIN_TO_INFO(Src) {
  6581. .CMD=${tool:"tools/mx_bin2info"} ${input:Src} ${output;nopath;noext;noauto:Src.info} ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
  6582. }
  6583. MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \
  6584. ${output_include;hide:"kernel/matrixnet/mn_sse.h"} \
  6585. ${output_include;hide:"library/cpp/archive/yarchive.h"} \
  6586. ${output_include;hide:"util/memory/blob.h"} \
  6587. ${output_include;hide:"util/generic/hash.h"} \
  6588. ${output_include;hide:"util/generic/ptr.h"} \
  6589. ${output_include;hide:"util/generic/singleton.h"}
  6590. macro _MX_GEN_TABLE(Srcs...) {
  6591. .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"}
  6592. PEERDIR(kernel/matrixnet)
  6593. PEERDIR(library/cpp/archive)
  6594. }
  6595. RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"}
  6596. ### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
  6597. ###
  6598. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
  6599. ###
  6600. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6601. macro GENERATE_ENUM_SERIALIZATION(File) {
  6602. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} ${output_include;from_input;hide:File} ${output_include;hide:"util/generic/serialized_enum.h"} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  6603. .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser"}
  6604. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6605. }
  6606. ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
  6607. ###
  6608. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
  6609. ### Provide access to serialization functions via generated header File_serialized.h
  6610. ###
  6611. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  6612. macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
  6613. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} --header ${output;suf=_serialized.h:File} ${output_include;from_input;hide:File} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  6614. .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"}
  6615. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  6616. }
  6617. ### @usage: DEB_VERSION(File)
  6618. ###
  6619. ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
  6620. macro DEB_VERSION(File) {
  6621. .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"}
  6622. }
  6623. BUILD_MN_SCRIPT=build/scripts/build_mn.py
  6624. # tag:matrixnet
  6625. ### @usage: BUILD_MN([CHECK] [PTR] [MULTI] mninfo mnname) # matrixnet
  6626. ###
  6627. ### Generate MatrixNet data and access code using single command.
  6628. ### Alternative macro BUILD_MNS() works faster and better for large files.
  6629. macro BUILD_MN(MnInfo, MnName, CHECK?"fml_tool=$FML_UNUSED_TOOL CHECK":"", MULTI?, PTR?, RANKING_SUFFIX="") {
  6630. .CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnF $ARCADIA_ROOT $ARCH_TOOL ${input:MnInfo} $MnName ranking_suffix=$RANKING_SUFFIX ${output;pre=mn.:MnName.cpp} ${output;hide;pre=MN_External_;suf=.rodata:MnName} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} $CHECK $MULTI $PTR ${kv;hide:"p MN"} ${kv;hide:"pc yellow"}
  6631. }
  6632. macro _BUILD_MNS_FILE(Input, Name, Output, Suffix, Check, Fml_tool, AsmDataName) {
  6633. .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"}
  6634. }
  6635. MNS_OUTPUT=mnmodels
  6636. macro _BUILD_MNS_CPP(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6637. .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"}
  6638. }
  6639. macro _BUILD_MNS_HEADER(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  6640. .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"}
  6641. }
  6642. # TODO: support foreach_in and keywords simultaneous usage (look at BUILD_MNS_FILES)
  6643. # tag:matrixnet
  6644. ### @usage: BUILD_MNS([CHECK] NAME listname mninfos...) # matrixnet
  6645. ###
  6646. ### Generate MatrixNet data and access code using separate commands for support code, interface and data.
  6647. ### Faster version of BUILD_MN() macro for large files.
  6648. macro BUILD_MNS(Files...) {
  6649. _BUILD_MNS_HEADER($Files)
  6650. _BUILD_MNS_CPP($Files)
  6651. _BUILD_MNS_FILES($Files)
  6652. }
  6653. ### @usage: COMPILE_NLG(nlg_config.json, [TRANSLATIONS_JSON translations.json], Src...)
  6654. ###
  6655. ### Generate and compile .nlg templates (Jinja2-based) and interface for megamind runtime in localized mode.
  6656. ###
  6657. ### Alice-specific macro
  6658. macro COMPILE_NLG(NLG_CONFIG_JSON, TRANSLATIONS_JSON="", Src...) {
  6659. when ($TRANSLATIONS_JSON) {
  6660. TRANSLATIONS_JSON_ARG=--translations-json
  6661. }
  6662. otherwise {
  6663. TRANSLATIONS_JSON_ARG=
  6664. }
  6665. PEERDIR(alice/nlg/library/nlg_project_runtime)
  6666. RUN_PROGRAM(alice/nlg/tools/codegen compile-cpp --import-dir ${ARCADIA_ROOT} --out-dir ${ARCADIA_BUILD_ROOT} --include-prefix ${MODDIR} --nlg-config-json ${NLG_CONFIG_JSON} ${TRANSLATIONS_JSON_ARG} ${TRANSLATIONS_JSON} ${Src} IN ${TRANSLATIONS_JSON} ${NLG_CONFIG_JSON} ${Src} OUT_NOAUTO nlg_renderer_factory.cpp nlg_renderer_factory.h register.cpp translations.cpp translations.h localizable_phrases.pb.txt ${suf=.cpp:Src} ${suf=.h:Src} ${suf=.pb.txt:Src})
  6667. SRCS(GLOBAL register.cpp nlg_renderer_factory.cpp translations.cpp ${suf=.cpp:Src})
  6668. }
  6669. ### @usage: NEED_CHECK()
  6670. ###
  6671. ### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
  6672. ### automatically merged to trunk only if there is no new broken build targets in check results.
  6673. ### The use of this macro is disabled by default.
  6674. macro NEED_CHECK(Flags...) {
  6675. # TODO: FIXME
  6676. ENABLE(UNUSED_MACRO)
  6677. }
  6678. ### @usage: NO_NEED_CHECK()
  6679. ###
  6680. ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
  6681. macro NO_NEED_CHECK(Flags...) {
  6682. ENABLE(UNUSED_MACRO)
  6683. }
  6684. # tag:deprecated
  6685. ### @usage: NEED_REVIEW() # deprecated
  6686. ###
  6687. ### Mark the project as needing review.
  6688. ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
  6689. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
  6690. macro NEED_REVIEW(Flags...) {
  6691. # TODO: FIXME
  6692. ENABLE(UNUSED_MACRO)
  6693. }
  6694. ### @usage: VERSION(Args...)
  6695. ###
  6696. ### Specify version of a module. Currently unused by build system, only informative.
  6697. macro VERSION(Flags...) {
  6698. ENABLE(UNUSED_MACRO)
  6699. }
  6700. DATAWORK_SCHEEME_EXPORT_FLAGS=
  6701. when ($UNIX == "yes") {
  6702. SCHEEME2_CFLAGS= -E -x c++
  6703. }
  6704. when ($WIN32 == "yes") {
  6705. SCHEEME2_CFLAGS= /E /TP
  6706. }
  6707. SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
  6708. ### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
  6709. ###
  6710. ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
  6711. ###
  6712. ### 1. ${scheeme_name}.inc - the name of the generated file.
  6713. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
  6714. ###
  6715. ### @example:
  6716. ###
  6717. ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
  6718. ###
  6719. ### 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)
  6720. ### sets in extra option
  6721. ###
  6722. ### @example:
  6723. ###
  6724. ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
  6725. ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
  6726. ### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
  6727. ###
  6728. ### for compatibility with C++ compiler and the external environment.
  6729. ### See tools/structparser for more details.
  6730. macro GEN_SCHEEME2(ScheemeName, FromFile) {
  6731. .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"}
  6732. }
  6733. ### @usage: SYMLINK(from to)
  6734. ### Add symlink
  6735. macro SYMLINK(From, To) {
  6736. .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"}
  6737. }
  6738. # tag:internal
  6739. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6740. ### Generate prefix " && target_sources PRIVATE " before $Args when GENERATE is specified in the list of actual arguments
  6741. macro _TARGET_SOURCES_FOR_HEADERS_IMPL(GENERATE?" && target_sources PRIVATE ":"", Args...) {
  6742. .SEM=$GENERATE ${output;ext=.h:Args} ${output;ext=.hh:Args} ${output;ext=.hpp:Args} ${output;ext=.inc:Args} ${output;ext=.i:Args}
  6743. }
  6744. # tag:internal
  6745. ### @usage: _TARGET_SOURCES_FOR_HEADERS(Args...) # internal
  6746. ### Generate prefix " && target_sources PRIVATE " before $Args if Args is not empty
  6747. macro _TARGET_SOURCES_FOR_HEADERS(Args...) {
  6748. .SEM=$_TARGET_SOURCES_FOR_HEADERS_IMPL(${pre=GENERATE :Args})
  6749. }
  6750. # tag:internal
  6751. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  6752. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args when GENERATE is specified in the list of actual arguments
  6753. macro _SET_ENV_FOR_CUSTOM_COMMAND_IMPL(GENERATE?" ${CMAKE_COMMAND} -E env ":"", Args...) {
  6754. .SEM=$GENERATE ${pre= :Args}
  6755. }
  6756. # tag:internal
  6757. ### @usage: _SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
  6758. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args if Args is not empty
  6759. macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
  6760. .SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args})
  6761. }
  6762. macro _FMT_INDUCED_DEPS(For, Deps...) {
  6763. .CMD=${induced_deps=$For;hide:Deps}
  6764. }
  6765. ### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...)
  6766. ###
  6767. ### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR`
  6768. ### This tells that files of Type resulted from code generation macros (not neccessarily directly,
  6769. ### but in processing chain of generated files) should have extra dependencies from list of Files...
  6770. ###
  6771. ### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from
  6772. ### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp
  6773. ### resulted from Cython-processing of generated pyx. The code ganeration will look like:
  6774. ### ```
  6775. ### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd)
  6776. ### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h)
  6777. ### RUN_PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS)
  6778. ### ```
  6779. ###
  6780. ### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing
  6781. ### as an element of array parameter. This is needed because language of ya.make doesn't support
  6782. ### Dict params right now and so it is impossible to directly pass something
  6783. ### like `{Type1:[Files2...], Type2:[Files2...]}`
  6784. ###
  6785. macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) {
  6786. SET($VAR \$_FMT_INDUCED_DEPS($For $Deps))
  6787. }
  6788. ### @usage: RUN_PROGRAM(tool_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6789. ###
  6790. ### Run a program from arcadia.
  6791. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6792. ###
  6793. ### Parameters:
  6794. ### - tool_path - Path to the directory of the tool.
  6795. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6796. ### - CWD dir - Absolute path of the working directory.
  6797. ### - ENV key=value... - Environment variables.
  6798. ### - TOOL tools... - Auxiliary tool directories.
  6799. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6800. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6801. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6802. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6803. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6804. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6805. ###
  6806. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6807. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6808. ### 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).
  6809. macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6810. .CMD=${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6811. .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)
  6812. }
  6813. # tag:lua-specific
  6814. ### @usage: RUN_LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6815. ###
  6816. ### Run a lua script.
  6817. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6818. ###
  6819. ### Parameters:
  6820. ### - script_path - Path to the script.3
  6821. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6822. ### - CWD dir - Absolute path of the working directory.
  6823. ### - ENV key=value... - Environment variables.
  6824. ### - TOOL tools... - Auxiliary tool directories.
  6825. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6826. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6827. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6828. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6829. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6830. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6831. ###
  6832. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6833. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6834. macro RUN_LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6835. .CMD=${cwd:CWD} ${env:ENV} $LUA_TOOL ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p LU"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6836. }
  6837. # tag:python-specific
  6838. ### @usage: PYTHON(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6839. ###
  6840. ### Run a python script with $(PYTHON)/python built from devtools/huge_python.
  6841. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6842. ###
  6843. ### Parameters:
  6844. ### - script_path - Path to the script.
  6845. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6846. ### - CWD dir - Absolute path of the working directory.
  6847. ### - ENV key=value... - Environment variables.
  6848. ### - TOOL tools... - Auxiliary tool directories.
  6849. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6850. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6851. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6852. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6853. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6854. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6855. ###
  6856. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6857. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6858. macro PYTHON(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6859. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6860. .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)
  6861. }
  6862. # tag:python-specific
  6863. ### @usage: RUN_PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  6864. ###
  6865. ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
  6866. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  6867. ###
  6868. ### Parameters:
  6869. ### - script_path - Path to the script.
  6870. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6871. ### - CWD dir - Absolute path of the working directory.
  6872. ### - ENV key=value... - Environment variables.
  6873. ### - TOOL tools... - Auxiliary tool directories.
  6874. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6875. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6876. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6877. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6878. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6879. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6880. ###
  6881. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6882. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6883. macro RUN_PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  6884. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6885. .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)
  6886. }
  6887. # tag:java-specific
  6888. macro _RUN_JAVA(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) {
  6889. PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6890. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input;pre=build/scripts/:HIDE_OUTPUT.py} $JDK_RESOURCE/bin/java $Args ${tool;hide:TOOL} ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  6891. }
  6892. ### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6893. ###
  6894. ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
  6895. ### You may specify extra dependencies that output files bring using OUTPUT_INCLUDES or INDUCED_DEPS. The change of these may e.g. lead to recompilation of .cpp files extracted from resource.
  6896. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
  6897. ###
  6898. ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
  6899. ###
  6900. ### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
  6901. ### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
  6902. ### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
  6903. ### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
  6904. ###
  6905. ### RENAME RESOURCE allows to rename the resource without specifying its file name.
  6906. ###
  6907. ### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6908. ### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6909. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6910. ###
  6911. ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
  6912. ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
  6913. ### so you shall place it immediately after resource_id.
  6914. macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:") {
  6915. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6916. ADD_CHECK(check.resource $Id)
  6917. }
  6918. ### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6919. ###
  6920. ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6921. macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6922. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_mds.py"} --key $Key $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p MD"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6923. ADD_CHECK(check.mds $Key)
  6924. }
  6925. # tag:internal
  6926. ### @usage: _FROM_EXTERNAL(ExtFile [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) #internal
  6927. ###
  6928. ### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS).
  6929. macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") {
  6930. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$EXT;suf=.external:OutFile} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_external.py"} --external-file ${input:File} --resource-file $(RESOURCE_ROOT)/ext/$OutFile --copy-to-dir $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/fetch_from_sandbox.py"} ${input;hide:"build/scripts/fetch_from_mds.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p XT"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6931. #FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors
  6932. #FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented
  6933. }
  6934. ### @usage LARGE_FILES([AUTOUPDATED] Files...)
  6935. ###
  6936. ### Use large file ether from working copy or from remote storage via placeholder <File>.external
  6937. ### If <File> is present locally (and not a symlink!) it will be copied to build directory.
  6938. ### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
  6939. macro LARGE_FILES(AUTOUPDATED?, Files...) {
  6940. # This is needed to correctly switch between remote and local modes
  6941. _GLOB($LF $Files)
  6942. }
  6943. ### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6944. ###
  6945. ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6946. macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6947. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_archive.py"} "--archive" ${input:Src} "--file-name" ${suf=-:Src} "--untar-to" $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p FA"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  6948. }
  6949. when ($MSVC == "yes") {
  6950. C_AS_CXX_FLAGS=/TP /std:c++17
  6951. }
  6952. otherwise {
  6953. C_AS_CXX_FLAGS=-x c++ -std=c++17
  6954. }
  6955. # tag:cpp-specific
  6956. ### @usage: COMPILE_C_AS_CXX()
  6957. ###
  6958. ### Compile .c files as .cpp ones within a module.
  6959. macro COMPILE_C_AS_CXX() {
  6960. SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
  6961. }
  6962. ### @usage: NO_DEBUG_INFO()
  6963. ###
  6964. ### Compile files without debug info collection.
  6965. macro NO_DEBUG_INFO() {
  6966. SET(NO_DEBUGINFO yes)
  6967. }
  6968. ### @usage: CTEMPLATE_VARNAMES(File)
  6969. ###
  6970. ### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
  6971. ###
  6972. ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
  6973. macro CTEMPLATE_VARNAMES(File) {
  6974. .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
  6975. }
  6976. LLVM_OPTS=
  6977. CLANG_BC_ROOT=${CLANG11_RESOURCE_GLOBAL}
  6978. macro USE_LLVM_BC12() {
  6979. SET(CLANG_BC_ROOT ${CLANG12_RESOURCE_GLOBAL})
  6980. }
  6981. CLANG_DEFAULT_ROOT=${CLANG_RESOURCE_GLOBAL}
  6982. CLANG_C_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang
  6983. CLANG_CPP_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang++
  6984. CLANG_EMIT_EXTRA_OPTS=
  6985. when ($OS_WINDOWS == "yes") {
  6986. # we can't use c++latest for clang14 now
  6987. # so we set c++20 for it
  6988. # for clang11 (actual clang for CLANG_EMIT_AST_CXX and LLVM_COMPILE_* macroses) /std:c++20 provokes "unused-command-line-argument" error
  6989. # !do not forget to change this flag when updating build/platform/clang
  6990. CLANG_EMIT_EXTRA_OPTS+=/std:c++latest
  6991. }
  6992. when ($OS_ANDROID == "yes") {
  6993. # We use clang shipped with android-ndk which has different layout
  6994. CLANG_DEFAULT_ROOT=$CLANG_ANDROID_RESOURCE_GLOBAL
  6995. when ($HOST_OS_DARWIN) {
  6996. CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
  6997. CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
  6998. }
  6999. otherwise {
  7000. CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
  7001. CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
  7002. }
  7003. }
  7004. ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
  7005. ###
  7006. ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
  7007. ### Note: Output name is used as is, no extension added.
  7008. macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
  7009. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_CPP_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS -emit-ast -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p ST"} ${kv;hide:"pc light-green"}
  7010. PEERDIR(build/platform/clang)
  7011. }
  7012. ### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
  7013. ###
  7014. ### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  7015. ### Note: Output name is used as is, no extension added.
  7016. macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
  7017. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang++ ${pre=-I:_C__INCLUDE} $BC_CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  7018. .SEM=llvm_compile_cxx ${input:Input} ${output;noauto:Output} ${"${CLANGPLUSPLUS}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  7019. PEERDIR(build/platform/clang)
  7020. }
  7021. ### @usage: LLVM_COMPILE_C(Input Output Opts...)
  7022. ###
  7023. ### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  7024. ### Note: Output name is used as is, no extension added.
  7025. macro LLVM_COMPILE_C(Input, Output, Opts...) {
  7026. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang ${pre=-I:_C__INCLUDE} $BC_CFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  7027. .SEM=llvm_compile_c ${input:Input} ${output;noauto:Output} ${"${CLANGC}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  7028. PEERDIR(build/platform/clang)
  7029. }
  7030. ### @usage: BPF(Input Output Opts...)
  7031. ###
  7032. ### Emit eBPF bytecode from .c file.
  7033. ### Note: Output name is used as is, no extension added.
  7034. macro BPF(Input, Output, Opts...) {
  7035. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_C_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BP"} ${kv;hide:"pc light-green"}
  7036. PEERDIR(build/platform/clang)
  7037. }
  7038. LD_BINARY_NAME=ld
  7039. when($OS_LINUX) {
  7040. LD_BINARY_NAME=ld.lld
  7041. }
  7042. ### @usage: BPF_STATIC(Input Output Opts...)
  7043. ###
  7044. ### Emit eBPF bytecode from .c file.
  7045. ### Note: Output name is used as is, no extension added.
  7046. macro BPF_STATIC(Input, Output, Opts...) {
  7047. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_C_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BP"} ${kv;hide:"pc light-green"} && ${cwd:BINDIR} $LLD_ROOT_RESOURCE_GLOBAL/$LD_BINARY_NAME -r -b binary -m elf_x86_64 -o ${output;noauto;suf=.bpf.o:Input} ${noauto;nopath:Output}
  7048. PEERDIR(build/platform/clang build/platform/lld)
  7049. }
  7050. ### @usage: LLVM_COMPILE_LL(Input Output Opts...)
  7051. ###
  7052. ### Compile LLVM bytecode to object representation.
  7053. ### Note: Output name is used as is, no extension added.
  7054. macro LLVM_COMPILE_LL(Input, Output, Opts...) {
  7055. .CMD=${CLANG_BC_ROOT}/bin/llvm-as ${input:Input} -o ${output;noauto:Output} ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  7056. PEERDIR(build/platform/clang)
  7057. }
  7058. ### @usage: LLVM_LINK(Output Inputs...)
  7059. ###
  7060. ### Call llvm-link on set of Inputs to produce Output.
  7061. ### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
  7062. macro LLVM_LINK(Output, Inputs...) {
  7063. .CMD=${CLANG_BC_ROOT}/bin/llvm-link ${input:Inputs} -o ${output;noauto:Output} ${kv;hide:"p LD"} ${kv;hide:"pc light-red"}
  7064. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Inputs} COMMAND ${LLVMLINK} ${input:Inputs} -o ${output;noauto:Output}
  7065. PEERDIR(build/platform/clang)
  7066. }
  7067. ### @usage: LLVM_OPT(Input Output Opts...)
  7068. ###
  7069. ### Call llvm-opt with set of Opts on Input to produce Output.
  7070. ### Note: Output name is used as is, no extension added.
  7071. macro LLVM_OPT(Input, Output, Opts...) {
  7072. .CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} ${CLANG_BC_ROOT}/bin/opt ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p OP"} ${kv;hide:"pc yellow"}
  7073. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMOPT} ${input:Input} -o ${output;noauto:Output} $Opts
  7074. PEERDIR(build/platform/clang)
  7075. }
  7076. ### @usage: LLVM_LLC(Src Opts...)
  7077. ###
  7078. ### Call llvm-llc with set of Opts on Src to produce object file.
  7079. ###
  7080. ### Note: Output name is calculated as concatenation of Src name and platform specific object file extension.
  7081. macro LLVM_LLC(Src, Opts...) {
  7082. .CMD=${tool:"contrib/libs/llvm14/tools/llc"} ${input:Src} --filetype obj -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts ${kv;hide:"p LC"} ${kv;hide:"pc yellow"}
  7083. .SEM=add_custom_command OUTPUT ${output;suf=$OBJECT_SUF;noauto:Src} DEPENDS ${input:Src} COMMAND ${LLVMLLC} --filetype obj ${input:Src} -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts
  7084. PEERDIR(build/platform/clang)
  7085. }
  7086. when ($NO_DEBUGINFO == "yes") {
  7087. DEBUG_INFO_FLAGS=
  7088. }
  7089. when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
  7090. DEBUG_INFO_FLAGS=-gline-tables-only
  7091. }
  7092. # TODO: configurable tar and touch
  7093. PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  7094. # tag:internal
  7095. ### @usage TOUCH(Outputs...) # internal
  7096. ### Just introduce outputs
  7097. macro TOUCH(Outputs...) {
  7098. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
  7099. }
  7100. TOUCH_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p UN"} ${kv;hide:"pc light-cyan"} $TARGET
  7101. FAKE_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"pc light-red"} $TARGET
  7102. COPY_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/copy_to_dir.py"} --dest-dir $BINDIR --build-root $ARCADIA_BUILD_ROOT $PACKED_PACKAGE_ARGS $SRCS_GLOBAL $PEERS_LATE_OUTS ${skip_by_ext=.pkg.fake:PEERS} ${hide;late_out:AUTO_INPUT} ${hide;late_out;to_namespace=$BINDIR/:SRCS_GLOBAL} ${hide;late_out;to_namespace=$BINDIR/:PEERS_LATE_OUTS} ${hide;late_out;skip_by_ext=.pkg.fake;to_namespace=$BINDIR/:PEERS} ${kv;hide:"package PACKAGE"}
  7103. TOUCH_PACKAGE=$FAKE_PACKAGE_CMD $VCS_INFO_DISABLE_CACHE__NO_UID__ && $COPY_PACKAGE_CMD
  7104. _P_PK=${kv;hide:"p PK"}
  7105. TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK && $ADD_VCS_INFO_FILE_CMD
  7106. # Note: we don't use touch.py in the command below to avoid introduction of undesired input
  7107. UNION_CMD=$YMAKE_PYTHON -c open(\'$TARGET\',\'w\').close() ${kv;hide:"p UN"} ${kv;hide:"package UNION"} ${kv;hide:"pc light-cyan"} $UNION_OUTS $VCS_INFO_DISABLE_CACHE__NO_UID__
  7108. UNION_CMD_MF=$UNION_CMD && $GENERATE_MF
  7109. macro _EXPAND_INS_OUTS(FILES{input}[]) {
  7110. .CMD=${input;hide:FILES} ${late_out;hide:INPUT}
  7111. }
  7112. _UNION_EXPLICIT_OUTPUTS=
  7113. ### @usage: EXPLICIT_OUTPUTS(Files...)
  7114. ###
  7115. ### Let UNION has only explicitly specified outputs listed in this macro
  7116. ### The list of files shall contain results of commands in this UNION.
  7117. ### Only these files will be outputs of the UNION. This allows to eliminate
  7118. ### intermediate files being result of the UNION
  7119. macro EXPLICIT_OUTPUTS(Files...) {
  7120. SET_APPEND(_UNION_EXPLICIT_OUTPUTS ${Files})
  7121. }
  7122. NO_CHECK_IMPORTS_FOR_VALUE=None
  7123. ### @usage: NO_CHECK_IMPORTS([patterns])
  7124. ###
  7125. ### Do not run checks on imports of Python modules.
  7126. ### Optional parameter mask patterns describes the names of the modules that do not need to check.
  7127. macro NO_CHECK_IMPORTS(Masks...) {
  7128. SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
  7129. }
  7130. # tag:yasm-specific
  7131. _YASM_FMT_VALUE=
  7132. _YASM_PLATFORM_FLAGS_VALUE=
  7133. _YASM_PREDEFINED_FLAGS_VALUE=
  7134. when ($OS_DARWIN || $OS_IOS) {
  7135. _YASM_FMT_VALUE=macho
  7136. _YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
  7137. }
  7138. elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
  7139. _YASM_FMT_VALUE=win
  7140. _YASM_PLATFORM_FLAGS_VALUE=-D WIN64
  7141. }
  7142. elsewhen ($OS_WINDOWS && $ARCH_I386) {
  7143. _YASM_FMT_VALUE=win
  7144. _YASM_PLATFORM_FLAGS_VALUE=-D WIN32
  7145. }
  7146. otherwise {
  7147. _YASM_FMT_VALUE=elf
  7148. _YASM_PLATFORM_FLAGS_VALUE=-D UNIX
  7149. _YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
  7150. }
  7151. when ($ASM_PREFIX) {
  7152. ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
  7153. }
  7154. otherwise {
  7155. ASM_PREFIX_VALUE=
  7156. }
  7157. # tag:yasm-specific
  7158. YASM_FLAGS=
  7159. YASM_PREINCLUDES_VALUE=
  7160. # tag:yasm-specific
  7161. macro _SRC_yasm_helper(SRC, PREINCLUDES[], SRCFLAGS...) {
  7162. .CMD=${tool:"contrib/tools/yasm"} -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE $YASM_DEBUG_INFO $YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__ -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${pre=-P :PREINCLUDES} ${input;hide:PREINCLUDES} ${SRC} ${kv;hide:"p AS"} ${kv;hide:"pc light-green"}
  7163. }
  7164. # tag:yasm-specific
  7165. macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  7166. .CMD=$_SRC_yasm_helper(${input:SRC}, $SRCFLAGS, PREINCLUDES $PREINCLUDES)
  7167. }
  7168. # tag:nasm-specific
  7169. NASM_FLAGS=
  7170. # tag:nasm-specific
  7171. macro _SRC_nasm_helper(SRC, SRCFLAGS...) {
  7172. .CMD=${NASM_RESOURCE_GLOBAL}/bin/nasm -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} -D ${pre=_;suf=_:HARDWARE_TYPE} $NASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${SRC}
  7173. }
  7174. # tag:nasm-specific
  7175. macro _SRC_nasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  7176. .CMD=$_SRC_nasm_helper(${input:SRC}, $SRCFLAGS)
  7177. }
  7178. # tag:src-processing
  7179. when ($USE_NASM_ASSEMBLER == "yes") {
  7180. MACRO_ALIAS(_SRC_ASM _SRC_nasm)
  7181. }
  7182. otherwise {
  7183. MACRO_ALIAS(_SRC_ASM _SRC_yasm)
  7184. }
  7185. ### @usage: ASM_PREINCLUDE(AsmFiles...)
  7186. ###
  7187. ### Supply additional .asm files to all assembler calls within a module
  7188. macro ASM_PREINCLUDE(PREINCLUDES...) {
  7189. SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
  7190. }
  7191. ### @usage: RUN_ANTLR(Args...)
  7192. ###
  7193. ### Macro to invoke ANTLR3 generator (general case)
  7194. macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  7195. PEERDIR(build/external_resources/antlr3 build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  7196. .CMD=$_RUN_JAVA(-jar $ANTLR3_RESOURCE_GLOBAL/antlr-3.5.2-complete-no-st3.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
  7197. .SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args
  7198. }
  7199. ### @usage: RUN_ANTLR4(Args...)
  7200. ###
  7201. ### Macro to invoke ANTLR4 generator (general case)
  7202. macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  7203. _RUN_JAVA(-jar ${input:"contrib/java/antlr/antlr4/antlr.jar"} $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
  7204. }
  7205. _ANTLR4_LISTENER_GRAMMAR=-listener
  7206. _ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
  7207. _ANTLR4_VISITOR_GRAMMAR=-visitor
  7208. _ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
  7209. ### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  7210. ###
  7211. ### Macro to invoke ANTLR4 generator (Cpp)
  7212. macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  7213. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;suf=Lexer.cpp:GRAMMAR} ${noext;suf=Lexer.h:GRAMMAR} ${noext;suf=Parser.cpp:GRAMMAR} ${noext;suf=Parser.h:GRAMMAR} ${noext;suf=Listener.h:$LISTENER} ${noext;suf=BaseListener.h:$LISTENER} ${noext;suf=Visitor.h:$VISITOR} ${noext;suf=BaseVisitor.h:$VISITOR} OUTPUT_INCLUDES ${ARCADIA_ROOT}/contrib/libs/antlr4_cpp_runtime/src/antlr4-runtime.h ${OUTPUT_INCLUDES})
  7214. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  7215. }
  7216. ### @usage: RUN_ANTLR4_GO(GRAMMAR, DEPS <extra_go_deps>, LISTENER, VISITOR, Args...)
  7217. ###
  7218. ### Macro to invoke ANTLR4 generator (Go)
  7219. macro RUN_ANTLR4_GO(GRAMMAR, DEPS[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  7220. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Go -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;tolower;suf=_lexer.go:GRAMMAR} ${noext;tolower;suf=_parser.go:GRAMMAR} ${noext;tolower;suf=_listener.go:$LISTENER} ${noext;tolower;suf=_base_listener.go:$LISTENER} ${noext;tolower;suf=_visitor.go:$VISITOR} ${noext;tolower;suf=_base_visitor.go:$VISITOR})
  7221. PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/sync ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr/v4 $DEPS)
  7222. }
  7223. ### @usage: RUN_ANTLR4_PYTHON(Grammar [LISTENER] [VISITOR] [SUBDIR] [EXTRA_OUTS Outs...] Args...)
  7224. ###
  7225. ### `LISTENER` - emit grammar listener
  7226. ### `VISITOR` - emit grammar visitor
  7227. ### `SUBDIR` - place generated files to specified subdirectory of BINDIR
  7228. ### `EXTRA_OUTS` - list extra outputs produced by Antlr (e.g. .interp and .token files) if they are needed. If `SUBDIR` is specied it will affect these as well. Use file names only.
  7229. ###
  7230. ### Macro to invoke ANTLR4 generator (Python). The Python3 will be used for PY3_LIBRARY/PY3_PROGRAM/PY3TEST, Python2 will be used in all other cases.
  7231. macro RUN_ANTLR4_PYTHON(GRAMMAR, LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", SUBDIR=".", EXTRA_OUTS[], _ANTLR4_EMPTY="", Args...) {
  7232. RUN_ANTLR4(${GRAMMAR} -Dlanguage=$ANTLR_PYTHON -o ${BINDIR}/${SUBDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT_NOAUTO ${nopath;noext;pre=${SUBDIR}/;suf=Lexer.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Parser.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Listener.py:$LISTENER} ${nopath;noext;pre=${SUBDIR}/;suf=Visitor.py:$VISITOR} ${pre=${SUBDIR}/:EXTRA_OUTS})
  7233. PEERDIR(contrib/python/antlr4)
  7234. }
  7235. # tag:cpp-specific
  7236. macro CPP_ADDINCL(Dirs...) {
  7237. ADDINCL($Dirs)
  7238. }
  7239. # tag:internal
  7240. _WHOLE_ARCHIVE_PEERS_VALUE=
  7241. ### @usage: WHOLE_ARCHIVE(dirnames...) # internal
  7242. macro WHOLE_ARCHIVE(PEERS...) {
  7243. SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
  7244. REQUIRES(${PEERS})
  7245. }
  7246. ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
  7247. macro TASKLET() {
  7248. PEERDIR(tasklet/api)
  7249. # CPP
  7250. CPP_PROTO_PLUGIN(tasklet_cpp tasklet/v1/gen/cpp .tasklet.h)
  7251. # Python
  7252. PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/v1/gen/python DEPS tasklet/v1/domain/sandbox tasklet/v1/runtime sandbox/sdk2)
  7253. }
  7254. TASKLET_REG_INCLUDES= \
  7255. ${output_include;hide:"tasklet/v1/runtime/lib/cpp_wrapper.h"} \
  7256. ${output_include;hide:"tasklet/v1/runtime/lib/go_wrapper.h"} \
  7257. ${output_include;hide:"tasklet/v1/runtime/lib/py_wrapper.h"} \
  7258. ${output_include;hide:"tasklet/v1/runtime/lib/js_wrapper.h"} \
  7259. ${output_include;hide:"tasklet/v1/runtime/lib/registry.h"}
  7260. macro TASKLET_REG(Name, Lang, Impl, Includes...) {
  7261. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  7262. when($Lang == "js") {
  7263. # JS runtime links the Node.js from contrib as a library, which is a bit heavy,
  7264. # so we do it, only if any JS tasklets are linked into the target
  7265. PEERDIR+=tasklet/v1/runtime/js
  7266. }
  7267. .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"}
  7268. SRCS(GLOBAL $Name.task.cpp)
  7269. }
  7270. # TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
  7271. # NOT COMPLETE
  7272. macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
  7273. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  7274. .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"}
  7275. SRCS(GLOBAL $Name.task.cpp)
  7276. }
  7277. # tag:cpp-specific
  7278. _CPP_PROTO_MODULE_PREFIX=
  7279. _CPP_PROTO_MODULE_SUFFIX=
  7280. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7281. _CPP_PROTO_MODULE_PREFIX=
  7282. _CPP_PROTO_MODULE_SUFFIX=.lib
  7283. }
  7284. otherwise {
  7285. _CPP_PROTO_MODULE_PREFIX=lib
  7286. _CPP_PROTO_MODULE_SUFFIX=.a
  7287. }
  7288. ### @usage: _EXPOSE(OutputsToExport...)
  7289. ###
  7290. ### Allows to mark outputs of macro command as unused in the current module but intended
  7291. ### to be used in modules consuming current via PEERDIR.
  7292. ###
  7293. ### TODO(DEVTOOLS-9000) proper implementation needed
  7294. macro _EXPOSE(Args...) {
  7295. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).ya_exposed:"empty_"} ${input;hide:Args}
  7296. }
  7297. ### @usage: LIST_PROTO([TO list.proto] Files...) # deprecated
  7298. ###
  7299. ### Create list of .proto files in a list-file (should be .proto, files.proto by default)
  7300. ### with original .proto-files as list's dependencies.
  7301. ###
  7302. ### This allows to process files listed, passing list as an argument to the processor
  7303. ###
  7304. ### TODO: proper implementation needed
  7305. macro LIST_PROTO(TO="files.proto", Files...) {
  7306. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/list.py"} ${Files} ${input;hide:Files} ${stdout;output;noauto:TO} ${output_include;from_input;hide:Files} && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;noext;suf=.pb.h:TO}
  7307. _EXPOSE(${TO})
  7308. }
  7309. # tag:proto
  7310. macro _PROTO_DESC_CMD(File) {
  7311. .CMD=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --descriptor_set_out=${output;suf=.desc:File} --include_source_info $_PROTOC_FLAGS ${input;rootrel:File}
  7312. }
  7313. _PROTO_DESC_MERGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $AUTO_INPUT ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
  7314. _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"}
  7315. NEED_GOOGLE_PROTO_PEERDIRS=yes
  7316. CPP_PROTO_LIBRARY_SEM=$CPP_LIBRARY_SEM
  7317. JAVA_PROTO_LIBRARY_SEM=$BUILD_PROTO_JAR_SEM $_GRADLE_EXPORT_PUBLISHING_SEM
  7318. # tag:proto
  7319. ### @usage: PROTO_LIBRARY()
  7320. ###
  7321. ### Build some varian of protocol buffers library.
  7322. ###
  7323. ### The particular variant is selected based on where PEERDIR to PROTO_LIBRARY comes from.
  7324. ###
  7325. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  7326. ### When PEERDIR comes from module for particular language appropriate variant is selected.
  7327. ### PROTO_LIBRARY also supports emission of GRPC code if GRPC() macro is specified.
  7328. ### Notes:
  7329. ### - Python versions emit C++ code in addition to Python as optimization.
  7330. ### - In some PROTO_LIBRARY-es Java or Python versions are excluded via EXCLUDE_TAGS macros due to incompatibilities.
  7331. ### - Use from DEPENDS or BUNDLE is not allowed
  7332. ###
  7333. ### Documentation: https://wiki.yandex-team.ru/yatool/proto_library/
  7334. ###
  7335. ### See: [GRPC()](#macro_GRPC), [OPTIMIZE_PY_PROTOS()](#macro_OPTIMIZE_PY_PROTOS), [INCLUDE_TAGS()](#macro_INCLUDE_TAGS), [EXCLUDE_TAGS()](#macro_EXCLUDE_TAGS)
  7336. multimodule PROTO_LIBRARY {
  7337. module CPP_PROTO : LIBRARY {
  7338. .ALLOWED=_EXPOSE LIST_PROTO
  7339. # TODO(svidyuk): think about marker which forces semantics inheritance
  7340. .SEM=CPP_PROTO_LIBRARY_SEM
  7341. FORCE_COVERAGE_DISABLED=yes
  7342. ENABLE(CPP_PROTO)
  7343. ENABLE(GEN_PROTO)
  7344. NO_CLANG_TIDY()
  7345. SET(PEERDIR_TAGS CPP_PROTO)
  7346. when ($BUILD_PROTO_AS_EVLOG == "yes" && $USE_VANILLA_PROTOC == "yes") {
  7347. _OK=no
  7348. }
  7349. ASSERT(_OK BUILD_PROTO_AS_EVLOG and USE_VANILLA_PROTOC are incompatible yet)
  7350. MODULE_SUFFIX=$_CPP_PROTO_MODULE_SUFFIX
  7351. MODULE_PREFIX=$_CPP_PROTO_MODULE_PREFIX
  7352. when ($_COMMON_GOOGLE_APIS != "None") {
  7353. PEERDIR += contrib/libs/googleapis-common-protos
  7354. }
  7355. }
  7356. module JAVA_PROTO: EXTERNAL_JAVA_LIBRARY {
  7357. .EXTS=.jsrc
  7358. .ALLOWED=GRPC
  7359. .SEM=JAVA_PROTO_LIBRARY_SEM
  7360. SET(PEERDIR_TAGS JAVA_PROTO)
  7361. ENABLE(JAVA_PROTO)
  7362. PEERDIR+=$JAVA_PROTOBUF_PEERS
  7363. when ($KOTLIN_PROTO == "yes") {
  7364. KOTLIN_PROTO_PEERS=contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION}
  7365. KOTLIN_PROTO_FLAGS=--kotlin_out=$ARCADIA_BUILD_ROOT/java_out
  7366. }
  7367. when ($GRADLE_EXPORT_PUBLISHING == "yes") {
  7368. _GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
  7369. }
  7370. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE
  7371. ADDINCL(FOR proto $PROTOBUF_PATH)
  7372. when ($_COMMON_GOOGLE_APIS != "None") {
  7373. PEERDIR += contrib/java/com/google/api/grpc/proto-google-common-protos/${JAVA_PROTO_COMMON_VERSION}
  7374. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  7375. }
  7376. }
  7377. module PY_PROTO: PY2_LIBRARY {
  7378. .ALIASES=SRCS=PY_SRCS
  7379. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  7380. .PEERDIRSELF=CPP_PROTO
  7381. .SEM=IGNORED
  7382. SET(PEERDIR_TAGS PY2 PY_PROTO)
  7383. ENABLE(PY_PROTO)
  7384. OPTIMIZE_PY_PROTOS()
  7385. OBJ_SUF=.py2
  7386. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7387. SET(_NO_LINT_VALUE none_internal)
  7388. when ($_COMMON_GOOGLE_APIS != "None") {
  7389. PEERDIR += contrib/libs/googleapis-common-protos
  7390. }
  7391. _IGNORE_SELF_PEERS=
  7392. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  7393. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  7394. _IGNORE_PEERDIRSELF=CPP_PROTO
  7395. }
  7396. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  7397. }
  7398. module PY3_PROTO: PY3_LIBRARY {
  7399. .ALIASES=SRCS=PY_SRCS
  7400. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  7401. .PEERDIRSELF=CPP_PROTO
  7402. .SEM=IGNORED
  7403. SET(PEERDIR_TAGS PY3 PY3_PROTO)
  7404. ENABLE(PY3_PROTO)
  7405. OPTIMIZE_PY_PROTOS()
  7406. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7407. MODULE_PREFIX=py3
  7408. }
  7409. otherwise {
  7410. MODULE_PREFIX=libpy3
  7411. }
  7412. OBJ_SUF=.py3
  7413. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7414. SET(_NO_LINT_VALUE none_internal)
  7415. when ($_COMMON_GOOGLE_APIS != "None") {
  7416. PEERDIR += contrib/libs/googleapis-common-protos
  7417. }
  7418. _IGNORE_SELF_PEERS=
  7419. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  7420. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  7421. _IGNORE_PEERDIRSELF=CPP_PROTO
  7422. }
  7423. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  7424. }
  7425. module GO_PROTO: GO_LIBRARY {
  7426. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO
  7427. .SEM=IGNORED
  7428. SET(PEERDIR_TAGS GO GO_PROTO)
  7429. ENABLE(GO_PROTO)
  7430. when ($_COMMON_GOOGLE_APIS == "None") {
  7431. }
  7432. elsewhen ($_COMMON_GOOGLE_APIS == "") {
  7433. PEERDIR += $_GO_COMMON_GOOGLE_APIS
  7434. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  7435. }
  7436. otherwise {
  7437. PEERDIR += $_COMMON_GOOGLE_APIS
  7438. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  7439. }
  7440. }
  7441. module DESC_PROTO: _BARE_UNIT {
  7442. .CMD=_PROTO_DESC_MERGE_CMD
  7443. .SEM=IGNORED
  7444. .EXTS=.desc
  7445. .NODE_TYPE=Library
  7446. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
  7447. SET(PEERDIR_TAGS DESC_PROTO)
  7448. ENABLE(DESC_PROTO)
  7449. MODULE_SUFFIX=.self.protodesc
  7450. SET(MODULE_TYPE LIBRARY)
  7451. MACRO_ALIAS(EVLOG_CMD _PROTO_DESC_CMD)
  7452. MACRO_ALIAS(PROTO_CMD _PROTO_DESC_CMD)
  7453. when ($_COMMON_GOOGLE_APIS != "None") {
  7454. PEERDIR += contrib/libs/googleapis-common-protos
  7455. }
  7456. when ($NEED_GOOGLE_PROTO_PEERDIRS == "yes") {
  7457. when ($USE_VANILLA_PROTOC == "yes") {
  7458. PEERDIR += contrib/libs/protobuf_std/builtin_proto/protos_from_protobuf
  7459. }
  7460. otherwise {
  7461. PEERDIR += contrib/libs/protobuf/builtin_proto/protos_from_protoc
  7462. }
  7463. }
  7464. }
  7465. }
  7466. module PROTO_DESCRIPTIONS: _BARE_UNIT {
  7467. .CMD=_PROTO_DESC_MERGE_PEERS_CMD
  7468. .PEERDIR_POLICY=as_build_from
  7469. .NODE_TYPE=Library
  7470. .RESTRICTED=SRCS
  7471. .FINAL_TARGET=yes
  7472. SET(PEERDIR_TAGS DESC_PROTO)
  7473. SET(MODULE_SUFFIX .protodesc)
  7474. SET(MODULE_TYPE PROTO_DESCRIPTIONS)
  7475. }
  7476. module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
  7477. SET(MODULE_TYPE PROTO_REGISTRY)
  7478. }
  7479. # tag:fbs
  7480. _FBS_NAMESPACE_MAP_GLOBAL=
  7481. # tag:fbs
  7482. macro _FBS_NAMESPACE_IMPL(NAMESPACE, PATH, DUMMY...) {
  7483. SET_APPEND(_FBS_NAMESPACE_MAP_GLOBAL ${NAMESPACE}=${PATH})
  7484. }
  7485. # tag:fbs
  7486. macro FBS_NAMESPACE(NAMESPACE, PATH...) {
  7487. _FBS_NAMESPACE_IMPL($NAMESPACE $PATH $MODDIR)
  7488. }
  7489. # tag:fbs
  7490. ### @usage: FBS_LIBRARY()
  7491. ###
  7492. ### Build some variant of Flatbuffers library.
  7493. ###
  7494. ### The particular variant is selected based on where PEERDIR to FBS_LIBRARY
  7495. ### comes from.
  7496. ###
  7497. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  7498. ### When PEERDIR comes from module for particular language appropriate variant
  7499. ### is selected.
  7500. ###
  7501. ### Notes: FBS_NAMESPACE must be specified in all dependent FBS_LIBRARY modules
  7502. ### if build of Go code is requested.
  7503. multimodule FBS_LIBRARY {
  7504. module CPP_FBS: LIBRARY {
  7505. ENABLE(CPP_FBS)
  7506. SET(PEERDIR_TAGS CPP_FBS)
  7507. }
  7508. module GO_FBS: GO_LIBRARY {
  7509. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7510. ENABLE(GO_FBS)
  7511. SET(PEERDIR_TAGS GO GO_FBS)
  7512. }
  7513. module JAVA_FBS: EXTERNAL_JAVA_LIBRARY {
  7514. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7515. ENABLE(JAVA_FBS)
  7516. SET(PEERDIR_TAGS JAVA_FBS)
  7517. }
  7518. module PY2_FBS: PY2_LIBRARY {
  7519. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7520. .ALIASES=SRCS=PY_SRCS
  7521. ENABLE(PY2_FBS)
  7522. SET(PEERDIR_TAGS PY2 PY2_FBS)
  7523. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7524. SET(_NO_LINT_VALUE none_internal)
  7525. }
  7526. module PY3_FBS: PY3_LIBRARY {
  7527. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  7528. .ALIASES=SRCS=PY_SRCS
  7529. ENABLE(PY3_FBS)
  7530. SET(PEERDIR_TAGS PY3 PY3_FBS)
  7531. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  7532. SET(_NO_LINT_VALUE none_internal)
  7533. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7534. MODULE_PREFIX=py3
  7535. }
  7536. otherwise {
  7537. MODULE_PREFIX=libpy3
  7538. }
  7539. OBJ_SUF=.py3
  7540. }
  7541. }
  7542. # tag:java-specific
  7543. _COMPILE_JSRC=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_jsrc.py"} --input $AUTO_INPUT --output $TARGET --prefix $BINDIR ${kv;hide:"p JC"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7544. # tag:java-specific
  7545. COMPILE_JSRC_MF=$_COMPILE_JSRC && $GENERATE_MF
  7546. # tag:java-specific tag:internal
  7547. ### @usage: JSRC_LIBRARY() # internal
  7548. module JSRC_LIBRARY: _BARE_UNIT {
  7549. .CMD=COMPILE_JSRC_MF
  7550. .EXTS=.java
  7551. .PEERDIR_POLICY=as_include
  7552. .FINAL_TARGET=no
  7553. .ALIASES=SRCS=FILES
  7554. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  7555. MODULE_TYPE=LIBRARY
  7556. SET(MODULE_SUFFIX .jsrc)
  7557. SET(DONT_RESOLVE_INCLUDES yes)
  7558. SET(NEED_PLATFORM_PEERDIRS no)
  7559. SET(MODULE_LANG JAVA)
  7560. NO_RUNTIME()
  7561. }
  7562. # tag:maps-specific
  7563. @import "${CONF_ROOT}/conf/project_specific/maps/asrc.conf"
  7564. # tag:internal
  7565. ### @usage: _PROXY_LIBRARY() # internal
  7566. ###
  7567. ### The use of this module is strictly prohibited!!!
  7568. module _PROXY_LIBRARY: LIBRARY {
  7569. .EXTS=.a .lib
  7570. .PEERDIR_POLICY=as_build_from
  7571. .PROXY=yes
  7572. .FINAL_TARGET=yes
  7573. DISABLE(NEED_ADD_FAKE_SRC)
  7574. NO_UTIL()
  7575. NO_RUNTIME()
  7576. }
  7577. # tag:maps-specific
  7578. @import "${CONF_ROOT}/conf/project_specific/maps/aar.conf"
  7579. @import "${CONF_ROOT}/conf/project_specific/maps/sproto.conf"
  7580. @import "${CONF_ROOT}/conf/project_specific/maps/mapkit.conf"
  7581. _PRIMARY_OUTPUT_VALUE=
  7582. # tag:internal
  7583. ### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
  7584. ###
  7585. ### The use of this module is strictly prohibited!!!
  7586. macro PRIMARY_OUTPUT(OUTPUT) {
  7587. SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
  7588. }
  7589. _DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${input;hide:_PRIMARY_OUTPUT_VALUE} ${TARGET}
  7590. # tag:internal
  7591. ### @usage: DLL_PROXY_LIBRARY() # internal
  7592. ###
  7593. ### The use of this module is strictly prohibited!!!
  7594. module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
  7595. .ALLOWED=PRIMARY_OUTPUT
  7596. .CMD=_DLL_PROXY_LIBRARY_CMD
  7597. }
  7598. _PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${kv;hide:"p ld"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7599. # tag:internal
  7600. ### @usage: PREBUILT_PROGRAM([programname]) # internal
  7601. ###
  7602. ### Program module which uses a prebuilt prgram as its output.
  7603. module PREBUILT_PROGRAM: _LINK_UNIT {
  7604. .CMD=_PREBUILT_PROGRAM_CMD
  7605. .SYMLINK_POLICY=EXE
  7606. .ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
  7607. .RESTRICTED=SRCS
  7608. _BARE_LINK_MODULE()
  7609. SET(MODULE_TYPE PROGRAM)
  7610. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  7611. MODULE_SUFFIX=.exe
  7612. }
  7613. }
  7614. ### @usage COLLECT_JINJA_TEMPLATES(varname path)
  7615. ###
  7616. ### This macro collects all jinja and yaml files in the directory specified by second argument and
  7617. ### stores result in the variable with mane specified by first parameter.
  7618. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
  7619. _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
  7620. }
  7621. # tag:go-specific
  7622. ### @usage: COLLECT_GO_SWAGGER_FILES(Varname, Dir)
  7623. ###
  7624. ### Recursively collect files for swagger config creation
  7625. macro COLLECT_GO_SWAGGER_FILES(Varname, Dir) {
  7626. _GLOB($Varname $Dir/**/*.go ${ARCADIA_ROOT}/go.mod)
  7627. }
  7628. # tag:go-specific
  7629. GO_HOST_OS=unknown
  7630. when ($HOST_OS_LINUX) {
  7631. GO_HOST_OS=linux
  7632. }
  7633. elsewhen ($HOST_OS_DARWIN) {
  7634. GO_HOST_OS=darwin
  7635. }
  7636. elsewhen($HOST_OS_WINDOWS) {
  7637. GO_HOST_OS=windows
  7638. }
  7639. # tag:go-specific
  7640. GO_HOST_ARCH=unknown
  7641. when ($HOST_ARCH_X86_64) {
  7642. GO_HOST_ARCH=amd64
  7643. }
  7644. elsewhen($HOST_ARCH_ARM64) {
  7645. GO_HOST_ARCH=arm64
  7646. }
  7647. # tag:go-specific
  7648. GO_TARG_OS=unknown
  7649. when ($OS_LINUX) {
  7650. GO_TARG_OS=linux
  7651. }
  7652. elsewhen ($OS_DARWIN) {
  7653. GO_TARG_OS=darwin
  7654. }
  7655. elsewhen ($OS_WINDOWS) {
  7656. GO_TARG_OS=windows
  7657. }
  7658. # tag:go-specific
  7659. GO_TARG_ARCH=unknwon
  7660. when ($ARCH_X86_64) {
  7661. GO_TARG_ARCH=amd64
  7662. }
  7663. elsewhen ($ARCH_I386) {
  7664. GO_TARG_ARCH=x86
  7665. }
  7666. elsewhen ($ARCH_ARM64) {
  7667. GO_TARG_ARCH=arm64
  7668. }
  7669. # tag:go-specific
  7670. GO_HOST_TARG_PARAMS=++host-os $GO_HOST_OS ++host-arch $GO_HOST_ARCH ++targ-os $GO_TARG_OS ++targ-arch $GO_TARG_ARCH
  7671. # tag:go-specific
  7672. GOSTD_VERSION=1.20
  7673. when ($GOSTD_VERSION == "1.20") {
  7674. GOSTD=contrib/go/_std_1.20/src
  7675. }
  7676. otherwise {
  7677. GOSTD=__unsupported_go_std_library_version_[$GOSTD_VERSION]__
  7678. }
  7679. # tag:go-specific
  7680. GO_DEBUG_PATH_RELATIVE=no
  7681. _GO_DEBUG_PATH__NO_UID__=
  7682. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=
  7683. # tag:go-specific
  7684. _GO_BUILDMODE=
  7685. _GO_IMPORT_PATH=${MODDIR}
  7686. # tag:go-specific
  7687. GO_VET=yolint
  7688. GO_VET_TOOL=
  7689. GO_VET_FLAGS=
  7690. GO_VET_EXTRA_FLAGS=
  7691. # tag:go-specific
  7692. _GO_VET_ADD_CHECK=yes
  7693. _GO_FMT_ADD_CHECK=yes
  7694. _GO_YDX_FILE=
  7695. # tag:go-specific
  7696. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=/-B --source-prefix=/-S
  7697. _GO_LINK_EXE_EXT_CMD=
  7698. # tag:go-specific
  7699. GO_WITH_MUSL=
  7700. # tag:go-specific
  7701. GO_TOOLS_ROOT=${GO_TOOLS_RESOURCE_GLOBAL}
  7702. GO_TEST_MINER=${tool:"tools/go_test_miner"}
  7703. GO_TEST_IMPORT_PATH=
  7704. # tag:go-specific
  7705. GO_STD_LIB_PREFIX=${GOSTD}/
  7706. GO_STD_CMD_PREFIX=${GOSTD}/cmd/
  7707. GO_ARCADIA_PROJECT_PREFIX=a.yandex-team.ru/
  7708. GO_CONTRIB_PROJECT_PREFIX=vendor/
  7709. GO_SKIP_IMPORTS=unsafe C
  7710. GO_VET_INFO_EXT=.vet.out
  7711. GO_VET_REPORT_EXT=.vet.txt
  7712. GO_VET_OUTPUT_INFO=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_INFO_EXT}:REALPRJNAME}
  7713. GO_VET_OUTPUT_REPORT=${output;rootrel;hide;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${GO_VET_REPORT_EXT}:REALPRJNAME}
  7714. # tag:go-specific tag:codenav
  7715. _GO_YNDEXER_EXT=.ydx.pb2
  7716. GO_YNDEXER_OUTPUT=${output;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${_GO_YNDEXER_EXT}:REALPRJNAME}
  7717. # tag:go-specific
  7718. GO_PROJECT_PREFIXES=++std-lib-prefix $GO_STD_LIB_PREFIX ++arc-project-prefix $GO_ARCADIA_PROJECT_PREFIX
  7719. # tag:go-specific
  7720. _GO_FAKEID=${FAKEID}.${BUILD_TYPE}.${GOSTD_VERSION}.${GO_FAKEID}
  7721. _CGO_FAKEID=${_GO_FAKEID}.${CPP_FAKEID}
  7722. # tag:go-specific
  7723. CGO2_CFLAGS_VALUE=
  7724. CGO2_LDFLAGS_VALUE=
  7725. # tag:go-specific
  7726. GO_ASM_FLAGS_VALUE=
  7727. ### @usage: GO_ASM_FLAGS(flags)
  7728. ### Add the specified flags to the go asm compile command line.
  7729. macro GO_ASM_FLAGS(Flags...) {
  7730. SET_APPEND(GO_ASM_FLAGS_VALUE $Flags)
  7731. }
  7732. # tag:go-specific
  7733. GO_CGO1_FLAGS_VALUE=
  7734. ### @usage: GO_CGO1_FLAGS(flags)
  7735. ### Add the specified flags to the go cgo compile command line.
  7736. macro GO_CGO1_FLAGS(Flags...) {
  7737. SET_APPEND(GO_CGO1_FLAGS_VALUE $Flags)
  7738. }
  7739. # tag:go-specific
  7740. GO_CGO2_FLAGS_VALUE=
  7741. ### @usage: GO_CGO2_FLAGS(flags)
  7742. ### Add the specified flags to the go cgo compile command line.
  7743. macro GO_CGO2_FLAGS(Flags...) {
  7744. SET_APPEND(GO_CGO2_FLAGS_VALUE $Flags)
  7745. }
  7746. # tag:go-specific
  7747. GO_COMPILE_FLAGS_VALUE=$USER_GO_COMPILE_FLAGS
  7748. ### @usage: GO_COMPILE_FLAGS(flags)
  7749. ### Add the specified flags to the go compile command line.
  7750. macro GO_COMPILE_FLAGS(Flags...) {
  7751. SET_APPEND(GO_COMPILE_FLAGS_VALUE $Flags)
  7752. }
  7753. # tag:go-specific
  7754. GO_LINK_FLAGS_VALUE=$USER_GO_LINK_FLAGS
  7755. ### @usage: GO_LINK_FLAGS(flags)
  7756. ### Add the specified flags to the go link command line.
  7757. macro GO_LINK_FLAGS(Flags...) {
  7758. SET_APPEND(GO_LINK_FLAGS_VALUE $Flags)
  7759. }
  7760. # tag:go-specific
  7761. _GO_LANG_VERSION_VALUE=
  7762. macro GOLANG_VERSION(Arg) {
  7763. SET(_GO_LANG_VERSION_VALUE $Arg)
  7764. }
  7765. # tag:go-specific
  7766. _GO_TOOL_MODE=
  7767. # tag:go-specific
  7768. _GO_TOOL_COMMON_FLAGS=\
  7769. ++mode $_GO_TOOL_MODE \
  7770. $GO_PROJECT_PREFIXES \
  7771. ++goversion $GOSTD_VERSION \
  7772. ++lang $_GO_LANG_VERSION_VALUE \
  7773. ++source-root $ARCADIA_ROOT \
  7774. ++build-root $ARCADIA_BUILD_ROOT \
  7775. ++output-root $BINDIR \
  7776. ++toolchain-root $GO_TOOLS_ROOT \
  7777. $GO_HOST_TARG_PARAMS \
  7778. ++output $TARGET \
  7779. $GO_VET_OUTPUT \
  7780. $_GO_YDX_FILE \
  7781. $_GO_DEBUG_PATH__NO_UID__ \
  7782. ++srcs $AUTO_INPUT ${input:GO_FILES} \
  7783. ++asm-flags $GO_ASM_FLAGS_VALUE \
  7784. ++compile-flags $GO_COMPILE_FLAGS_VALUE \
  7785. ++link-flags $GO_LINK_FLAGS_VALUE \
  7786. ++cgo-srcs ${input:CGO_FILES} \
  7787. $_GO_EMBED_VALUE \
  7788. $_GO_BUILDMODE \
  7789. $GO_TOOLCHAIN_ENV
  7790. # tag:go-specific
  7791. macro _GO_GEN_COVER_GO(GO_FILE, GO_COVER_OUTPUT, VAR_ID) {
  7792. .CMD=${hide:_GO_FAKEID} $GO_TOOLS_ROOT/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cover -mode set -var $VAR_ID -o ${output;noext;suf=.cover.go:GO_COVER_OUTPUT} ${input:GO_FILE}
  7793. }
  7794. # tag:go-specific
  7795. macro _GO_COMPILE_SYMABIS(FLAGS[], ASM_FILES...) {
  7796. .CMD=${hide:_CGO_FAKEID} $GO_TOOLS_ROOT/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/asm $_GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__ ${pre=-I :_C__INCLUDE} -I $GO_TOOLS_ROOT/pkg/include -D GOOS_${GO_TARG_OS} -D GOARCH_${GO_TARG_ARCH} $FLAGS $GO_ASM_FLAGS_VALUE -gensymabis -o ${output:"gen.symabis"} ${input:ASM_FILES} ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7797. .ADDINCL=build/scripts/go_fake_include
  7798. }
  7799. # tag:go-specific
  7800. macro _GO_COMPILE_CGO1(NAME, FLAGS[], FILES...) {
  7801. .CMD=${hide:_CGO_FAKEID} ${cwd:ARCADIA_ROOT} $YMAKE_PYTHON ${input:"build/scripts/cgo1_wrapper.py"} $_GO_CGO1_WRAPPER_FLAGS --build-root ${ARCADIA_BUILD_ROOT} --source-root ${ARCADIA_ROOT} --cgo1-files ${output;noext:FILES.cgo1.go} --cgo2-files ${output;noauto;noext:FILES.cgo2.c} -- ${GO_TOOLS_ROOT}/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cgo -objdir $BINDIR -importpath $NAME $GO_CGO1_FLAGS_VALUE $FLAGS -- $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} ${CGO_CFLAGS_VALUE} ${input:FILES} ${output;hide:"_cgo_export.h"} ${output;hide:"_cgo_export.c"} ${output;hide:"_cgo_gotypes.go"} ${output;noauto;hide:"_cgo_main.c"} ${output;noauto;hide:"_cgo_flags"} $GO_TOOLCHAIN_ENV ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7802. }
  7803. # tag:go-specific
  7804. macro _GO_COMPILE_CGO2(NAME, C_FILES[], S_FILES[], OBJ_FILES[], FILES...) {
  7805. .CMD=${hide:_CGO_FAKEID} $C_COMPILER $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} $CGO_CFLAGS_VALUE ${input;tobindir:"_cgo_main.c"} -c -o ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_main.c"} && $C_COMPILER $C_FLAGS_PLATFORM ${pre=-I:_C__INCLUDE} -o ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_"} $LDFLAGS $LDFLAGS_GLOBAL $CGO2_LDFLAGS_VALUE ${input;hide:"_cgo_export.h"} ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_main.c"} ${input;suf=${OBJECT_SUF}:"_cgo_export.c"} ${input;nopath;noext;suf=.cgo2.c${OBJECT_SUF}:FILES} ${input;suf=${OBJECT_SUF}:C_FILES} ${input;suf=.o:S_FILES} ${input:OBJ_FILES} $CGO_LDFLAGS_VALUE && ${GO_TOOLS_ROOT}/pkg/tool/${GO_HOST_OS}_${GO_HOST_ARCH}/cgo -dynpackage $NAME -dynimport ${tmp;noauto;suf=${OBJECT_SUF}:"_cgo_"} -dynout ${output:"_cgo_import.go"} -dynlinker $GO_CGO2_FLAGS_VALUE $GO_TOOLCHAIN_ENV ${kv;hide:"p go"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  7806. _USE_LINKER()
  7807. }
  7808. GO_TOOL=$YMAKE_PYTHON3 ${input:"build/scripts/go_tool.py"} $_PROCESS_WHOLE_ARCHIVE_SCRIPT
  7809. # tag:go-specific
  7810. macro _GO_LINK_LIB_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
  7811. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} --ya-end-command-file ${kv;hide:"p GO"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"}
  7812. }
  7813. # tag:go-specific
  7814. macro _GO_LINK_EXE_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_FILES...) {
  7815. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++vcs $VCS_GO $GO_WITH_MUSL $GO_EXTLD ++peers ${rootrel;tags_in=local,GO|local,GO_PROTO|local,GO_FBS:PEERS} ++non-local-peers ${rootrel;tags_in=GO|GO_PROTO|GO_FBS;tags_out=local:PEERS} ++cgo-peers ${VCS_C_OBJ_RR} ${rootrel;tags_out=GO|GO_PROTO|GO_FBS:PEERS} --ya-end-command-file ${kv;hide:"p LD"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"} $_GO_LINK_EXE_EXT_CMD
  7816. }
  7817. # tag:go-specific
  7818. macro _GO_LINK_TEST_IMPL(CGO_FILES[], EXTRA_INPUTS[], GO_TEST_FILES[], GO_XTEST_FILES[], GO_FILES...) {
  7819. .CMD=${hide:_GO_FAKEID} $GO_TOOL ${hide;input:EXTRA_INPUTS} --ya-start-command-file $_GO_TOOL_COMMON_FLAGS ++vcs $VCS_GO $GO_WITH_MUSL $GO_EXTLD ++test-miner $GO_TEST_MINER ++test-import-path $GO_TEST_IMPORT_PATH ++peers ${rootrel;tags_in=local,GO|local,GO_PROGRAM|local,GO_PROTO|local,GO_FBS:PEERS} ++non-local-peers ${rootrel;tags_in=GO|GO_PROTO|GO_FBS;tags_out=local:PEERS} ++cgo-peers ${VCS_C_OBJ_RR} ${rootrel;tags_out=GO|GO_PROGRAM|GO_PROTO|GO_FBS:PEERS} ++test_srcs ${input:GO_TEST_FILES} ++xtest_srcs ${input:GO_XTEST_FILES} ++cover_info $GO_COVER_INFO_VALUE ++skip-tests $_GO_SKIP_TEST_VALUE --ya-end-command-file ${kv;hide:"p GO"} ${kv;hide:"pc light-red"} ${kv;hide:"show_out"}
  7820. }
  7821. # tag:go-specific
  7822. GO_LINK_LIB=$GENERATE_MF && $_GO_LINK_LIB_IMPL($_GO_SRCS_VALUE CGO_FILES $_CGO_SRCS_VALUE EXTRA_INPUTS $_GO_EMBED_INPUTS)
  7823. 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)
  7824. 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)
  7825. GO_LINK_DLL=$GO_LINK_EXE && $COPY_CMD $BINDIR/_cgo_export.h ${output;pre=${MODULE_PREFIX};suf=.h:REALPRJNAME}
  7826. # tag:go-specific
  7827. CGO_ENABLED=yes
  7828. when ($OS_WINDOWS == "yes" || $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  7829. CGO_ENABLED=no
  7830. }
  7831. elsewhen ($CGO_ENABLED == "yes") {
  7832. GO_LINK_FLAGS_VALUE+=-linkmode=external
  7833. }
  7834. # tag:go-specific
  7835. GO_PACKAGE_VALUE=
  7836. ### @usage: GO_PACKAGE_NAME(Name)
  7837. ### Override name of a Go package.
  7838. macro GO_PACKAGE_NAME(NAME) {
  7839. SET(GO_PACKAGE_VALUE $NAME)
  7840. }
  7841. # tag:go-specific tag:internal
  7842. _GO_SRCS_VALUE=
  7843. ### @usage: _GO_SRCS(Files...) # internal
  7844. ### This macro shouldn't be used in ya.make files, use SRCS() instead.
  7845. ### This is internal macro collecting .go sources for processing within Go modules (GO_PROGRAM and GO_LIBRARY)
  7846. macro _GO_SRCS(FILES...) {
  7847. GO_FAKE_OUTPUT($FILES)
  7848. SET_APPEND(_GO_SRCS_VALUE $FILES)
  7849. }
  7850. # tag:go-specific
  7851. _GO_TEST_SRCS_VALUE=
  7852. GO_HAS_INTERNAL_TESTS=no
  7853. ### @usage: GO_TEST_SRCS(Files...)
  7854. ### .go sources for internal tests of a module
  7855. macro GO_TEST_SRCS(FILES...) {
  7856. GO_FAKE_OUTPUT($FILES)
  7857. _SET_FIRST_VALUE(GO_HAS_INTERNAL_TESTS ${pre=yes :FILES} ${GO_HAS_INTERNAL_TESTS})
  7858. SET_APPEND(_GO_TEST_SRCS_VALUE $FILES)
  7859. }
  7860. # tag:go-specific
  7861. _GO_XTEST_SRCS_VALUE=
  7862. GO_HAS_EXTERNAL_TESTS=no
  7863. ### @usage: GO_XTEST_SRCS(Files...)
  7864. ### .go sources for external tests of a module
  7865. macro GO_XTEST_SRCS(FILES...) {
  7866. GO_FAKE_OUTPUT($FILES)
  7867. SET(GO_HAS_EXTERNAL_TESTS yes)
  7868. SET_APPEND(_GO_XTEST_SRCS_VALUE $FILES)
  7869. }
  7870. # tag:go-specific
  7871. macro _GO_UNUSED_SRCS(FLAGS...) {
  7872. ENABLE(UNUSED_MACRO)
  7873. }
  7874. # tag:go-specific
  7875. _CGO_SRCS_VALUE=
  7876. ### @usage: CGO_SRCS(Files...)
  7877. ### .go sources to be built with CGO
  7878. macro CGO_SRCS(FILES...) {
  7879. SET_APPEND(_CGO_SRCS_VALUE $FILES)
  7880. PEERDIR(${GOSTD}/syscall)
  7881. }
  7882. # tag:go-specific
  7883. GO_LDFLAGS_GLOBAL=
  7884. ### @usage: GO_LDFLAGS(Flags...)
  7885. ### Link flags for GO_PROGRAM linking from .go sources
  7886. macro GO_LDFLAGS(FLAGS...) {
  7887. SET_APPEND(GO_LDFLAGS_GLOBAL $FLAGS)
  7888. }
  7889. # tag:go-specific
  7890. CGO_CFLAGS_VALUE=
  7891. ### @usage: CGO_CFLAGS(Flags...)
  7892. ### Compiler flags specific to CGO compilation
  7893. macro CGO_CFLAGS(FLAGS...) {
  7894. SET_APPEND(CGO_CFLAGS_VALUE $FLAGS)
  7895. CFLAGS($FLAGS)
  7896. }
  7897. # tag:go-specific
  7898. CGO_LDFLAGS_VALUE=
  7899. ### @usage: CGO_LDFLAGS(Files...)
  7900. ### Linker flags specific to CGO linking
  7901. macro CGO_LDFLAGS(FLAGS...) {
  7902. SET_APPEND(CGO_LDFLAGS_VALUE $FLAGS)
  7903. GO_LDFLAGS($FLAGS)
  7904. }
  7905. # tag:go-specific
  7906. _GO_SKIP_TEST_VALUE=
  7907. ### @usage: GO_SKIP_TESTS(TestNames...)
  7908. ###
  7909. ### Define a set of tests that should not be run.
  7910. ### NB! Subtests are not taken into account!
  7911. macro GO_SKIP_TESTS(TESTS...) {
  7912. SET_APPEND(_GO_SKIP_TEST_VALUE $TESTS)
  7913. RESTRICT_PATH(vendor MSG This macro is prohibited to be used outside the vendor/ directory)
  7914. }
  7915. # tag:go-specific tag:internal
  7916. _GO_EMBED_VALUE=
  7917. _GO_EMBED_INPUTS=
  7918. ### @usage: _GO_EMBED_PATTERN(PATTERN) # internal
  7919. ###
  7920. ### Define an embed pattern.
  7921. macro _GO_EMBED_PATTERN(XTEST?"_xtest":"", PATTERN, IMPORT_PATH) {
  7922. SET(VAR_SALT1 $XTEST $PATTERN $IMPORT_PATH 1)
  7923. SET(_PATTERN_GLOB1 uniq_embed_${hash:VAR_SALT1})
  7924. _GLOB($_PATTERN_GLOB1 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/.*)
  7925. SET(VAR_SALT2 $XTEST $PATTERN $IMPORT_PATH 2)
  7926. SET(_PATTERN_GLOB2 _uniq_embed_${hash:VAR_SALT2})
  7927. _GLOB($_PATTERN_GLOB2 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN})
  7928. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $PATTERN \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7929. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2)
  7930. }
  7931. # tag:go-specific
  7932. ### @usage: GO_EMBED_PATTERN(PATTERN)
  7933. ###
  7934. ### Define an embed pattern.
  7935. macro GO_EMBED_PATTERN(PATTERN) {
  7936. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7937. }
  7938. # tag:go-specific
  7939. ### @usage: GO_TEST_EMBED_PATTERN(PATTERN)
  7940. ###
  7941. ### Define an embed pattern for internal go tests.
  7942. macro GO_TEST_EMBED_PATTERN(PATTERN) {
  7943. _GO_EMBED_PATTERN($PATTERN $_GO_IMPORT_PATH)
  7944. }
  7945. # tag:go-specific
  7946. ### @usage: GO_XTEST_EMBED_PATTERN(PATTERN)
  7947. ###
  7948. ### Define an embed pattern for external go tests.
  7949. macro GO_XTEST_EMBED_PATTERN(PATTERN) {
  7950. _GO_EMBED_PATTERN(XTEST $PATTERN $_GO_IMPORT_PATH)
  7951. }
  7952. # tag:go-specific tag:internal
  7953. ### @usage: _GO_EMBED_DIR(PATTERN) # internal
  7954. ###
  7955. ### Define an embed directory DIR.
  7956. macro _GO_EMBED_DIR(XTEST?"_xtest":"", DIR, IMPORT_PATH, ALL?"all:":"", EXCLUDES...) {
  7957. SET(VAR_SALT $XTEST $DIR $IMPORT_PATH)
  7958. SET(_PATTERN_GLOB uniq_embed_${hash:VAR_SALT})
  7959. _GLOB($_PATTERN_GLOB ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/* EXCLUDE ${pre=${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/:EXCLUDES})
  7960. SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST $ALL$DIR \$$_PATTERN_GLOB)
  7961. SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB)
  7962. }
  7963. # tag:go-specific
  7964. ### @usage: GO_EMBED_DIR(DIR)
  7965. ###
  7966. ### Define an embed directory DIR.
  7967. macro GO_EMBED_DIR(ALL?"ALL":"_* .*", DIR) {
  7968. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH ${ALL})
  7969. }
  7970. # tag:go-specific
  7971. ### @usage: GO_EMBED_TEST_DIR(DIR)
  7972. ###
  7973. ### Define an embed directory DIR for internal go tests.
  7974. macro GO_EMBED_TEST_DIR(ALL?"ALL":"_* .*", DIR) {
  7975. _GO_EMBED_DIR($DIR $_GO_IMPORT_PATH ${ALL})
  7976. }
  7977. # tag:go-specific
  7978. ### @usage: GO_EMBED_XTEST_DIR(DIR)
  7979. ###
  7980. ### Define an embed directory DIR for external go tests.
  7981. macro GO_EMBED_XTEST_DIR(ALL?"ALL":"_* .*", DIR) {
  7982. _GO_EMBED_DIR(XTEST $DIR $_GO_IMPORT_PATH ${ALL})
  7983. }
  7984. # tag:go-specific
  7985. _GO_TOOLCHAIN_ENV_GOARCH=unknown
  7986. when ($ARCH_ARM64) {
  7987. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=arm64"}
  7988. }
  7989. elsewhen ($ARCH_X86_64) {
  7990. _GO_TOOLCHAIN_ENV_GOARCH=${env:"GOARCH=amd64"}
  7991. }
  7992. # tag:go-specific
  7993. _GO_TOOLCHAIN_ENV_GOOS=unknown
  7994. when ($OS_DARWIN) {
  7995. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=darwin"}
  7996. }
  7997. elsewhen ($OS_LINUX) {
  7998. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=linux"}
  7999. }
  8000. elsewhen ($OS_WINDOWS) {
  8001. _GO_TOOLCHAIN_ENV_GOOS=${env:"GOOS=windows"}
  8002. }
  8003. _GO_TOOLCHAIN_ENV_PATH=
  8004. # tag:go-specific
  8005. GO_TOOLCHAIN_ENV=$TOOLCHAIN_ENV $_GO_TOOLCHAIN_ENV_GOARCH $_GO_TOOLCHAIN_ENV_GOOS $_GO_TOOLCHAIN_ENV_PATH
  8006. # tag:go-specific
  8007. _GO_GRPC_WELLKNOWN=\
  8008. vendor/google.golang.org/grpc \
  8009. vendor/google.golang.org/grpc \
  8010. vendor/google.golang.org/grpc/codes \
  8011. vendor/google.golang.org/grpc/grpclog \
  8012. vendor/google.golang.org/grpc/status
  8013. # tag:go-specific
  8014. macro _GO_GRPC() {
  8015. SET(GO_PROTO_GEN_PLUGINS plugins=grpc)
  8016. SET(GO_PROTO_GRPC_OPTS \$GO_PROTO_GRPC_OPTS_V2)
  8017. SET(GO_PROTO_GRPC_OUTS \$GO_PROTO_GRPC_OUTS_V2)
  8018. PEERDIR(${GOSTD}/context ${_GO_GRPC_WELLKNOWN})
  8019. }
  8020. # tag:go-specific
  8021. ### @usage: GO_GRPC_GATEWAY_SRCS()
  8022. ###
  8023. ### Use of grpc-gateway plugin (Supported for Go only).
  8024. macro GO_GRPC_GATEWAY_SRCS(FILE...) {
  8025. ENABLE(UNUSED_MACRO)
  8026. }
  8027. # tag:go-specific
  8028. ### @usage: GO_GRPC_GATEWAY_SWAGGER_SRCS()
  8029. ###
  8030. ### Use of grpc-gateway plugin w/ swagger emission (Supported for Go only).
  8031. macro GO_GRPC_GATEWAY_SWAGGER_SRCS(FILE...) {
  8032. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  8033. }
  8034. # tag:go-specific
  8035. _GO_PROTO_GRPC_GATEWAY_OPTS=
  8036. _GO_PROTO_GRPC_GATEWAY_OUTS=
  8037. # tag:go-specific
  8038. macro _GO_GRPC_GATEWAY_SRCS_IMPL(Files...) {
  8039. foreach (File : $Files) {
  8040. [.proto]=$_GO_PROTO_CMD_IMPL($File $_GO_PROTO_GRPC_GATEWAY_OPTS $_GO_PROTO_GRPC_GATEWAY_OUTS)
  8041. }
  8042. PEERDIR(${GOSTD}/context ${GOSTD}/io ${GOSTD}/net/http)
  8043. PEERDIR(vendor/github.com/golang/protobuf/descriptor)
  8044. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/runtime)
  8045. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/utilities)
  8046. PEERDIR(vendor/google.golang.org/grpc/metadata)
  8047. }
  8048. # tag:go-specific
  8049. macro _SETUP_GO_GRPC_GATEWAY() {
  8050. 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))
  8051. SET(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;nopath;noext;suf=.pb.gw.go:File})
  8052. }
  8053. # tag:go-specific
  8054. macro _GO_GRPC_GATEWAY_SRCS(Files...) {
  8055. _SETUP_GO_GRPC_GATEWAY()
  8056. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  8057. }
  8058. # tag:go-specific
  8059. macro _GO_GRPC_GATEWAY_SWAGGER_SRCS(Files...) {
  8060. _SETUP_GO_GRPC_GATEWAY()
  8061. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OPTS $_PROTO_PLUGIN_ARGS_BASE(swagger vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger logtostderr=true allow_repeated_fields_in_body=true))
  8062. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_OUTS \${output;hide;norel;noauto;nopath;noext;suf=.swagger.json:File})
  8063. _GO_GRPC_GATEWAY_SRCS_IMPL($Files)
  8064. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options)
  8065. }
  8066. #tag:go-specific
  8067. ### @usage: GO_GRPC_GATEWAY_V2_OPENAPI_SRCS(Files...)
  8068. ###
  8069. ### Use of grpc-gateway plugin w/ openapi v2 emission (Supported for Go only).
  8070. macro GO_GRPC_GATEWAY_V2_OPENAPI_SRCS(NO_JSON_NAMES_FOR_FIELDS?"":"", Files...) {
  8071. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options)
  8072. }
  8073. macro _GO_GRPC_GATEWAY_V2_OPENAPI_SRCS(NO_JSON_NAMES_FOR_FIELDS?"json_names_for_fields=false":"", Files...) {
  8074. _SETUP_GO_GRPC_GATEWAY_V2()
  8075. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_V2_OPTS $_PROTO_PLUGIN_ARGS_BASE(openapiv2 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 $NO_JSON_NAMES_FOR_FIELDS logtostderr=true))
  8076. SET_APPEND(_GO_PROTO_GRPC_GATEWAY_V2_OPTS \${output;hide;norel;noauto;nopath;noext;suf=.swagger.json:File})
  8077. _GO_GRPC_GATEWAY_V2_SRCS_IMPL($Files)
  8078. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options)
  8079. }
  8080. # tag:go-specific
  8081. ### @usage: GO_GRPC_GATEWAY_V2_SRCS()
  8082. ###
  8083. ### Use of grpc-gateway plugin (Supported for Go only).
  8084. macro GO_GRPC_GATEWAY_V2_SRCS(FILE...) {
  8085. ENABLE(UNUSED_MACRO)
  8086. }
  8087. # tag:go-specific
  8088. _GO_PROTO_GRPC_GATEWAY_V2_OPTS=
  8089. _GO_PROTO_GRPC_GATEWAY_V2_OUTS=
  8090. # tag:go-specific
  8091. macro _GO_GRPC_GATEWAY_V2_SRCS_IMPL(Files...) {
  8092. foreach (File : $Files) {
  8093. [.proto]=$_GO_PROTO_CMD_IMPL($File $_GO_PROTO_GRPC_GATEWAY_V2_OPTS $_GO_PROTO_GRPC_GATEWAY_V2_OUTS)
  8094. }
  8095. PEERDIR(${GOSTD}/context ${GOSTD}/io ${GOSTD}/net/http)
  8096. PEERDIR(vendor/github.com/golang/protobuf/descriptor)
  8097. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime)
  8098. PEERDIR(vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities)
  8099. PEERDIR(vendor/google.golang.org/grpc/metadata)
  8100. PEERDIR(vendor/google.golang.org/protobuf/proto)
  8101. }
  8102. # tag:go-specific
  8103. macro _SETUP_GO_GRPC_GATEWAY_V2() {
  8104. SET(_GO_PROTO_GRPC_GATEWAY_V2_OPTS $_PROTO_PLUGIN_ARGS_BASE(go_grpc_gw vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway allow_repeated_fields_in_body=true))
  8105. SET(_GO_PROTO_GRPC_GATEWAY_V2_OUTS \${output;hide;norel;nopath;noext;suf=.pb.gw.go:File})
  8106. }
  8107. # tag:go-specific
  8108. macro _GO_GRPC_GATEWAY_V2_SRCS(Files...) {
  8109. _SETUP_GO_GRPC_GATEWAY_V2()
  8110. _GO_GRPC_GATEWAY_V2_SRCS_IMPL($Files)
  8111. }
  8112. # tag:go-specific
  8113. when ($MUSL == "yes") {
  8114. _GO_DEFAULT_ALLOCATOR=LF
  8115. }
  8116. otherwise {
  8117. _GO_DEFAULT_ALLOCATOR=FAKE
  8118. }
  8119. # tag:go-specific tag:internal
  8120. ### @usage _GO_BASE_UNIT # internal
  8121. ###
  8122. ### The base module of all golang modules. Defines common properties, dependencies and rules for go build.
  8123. module _GO_BASE_UNIT: _BASE_UNIT {
  8124. .EXTS=.go .gosrc .o .obj .a .symabis .mf
  8125. .CMD=TOUCH_UNIT
  8126. .NODE_TYPE=Bundle
  8127. .GLOBAL=GO_LDFLAGS
  8128. .PEERDIR_POLICY=as_build_from
  8129. .ALIASES=SRCS=_GO_SRCS RESOURCE=_GO_RESOURCE GO_TEST_SRCS=_GO_UNUSED_SRCS GO_XTEST_SRCS=_GO_UNUSED_SRCS GRPC=_GO_GRPC GO_GRPC_GATEWAY_SRCS=_GO_GRPC_GATEWAY_SRCS GO_GRPC_GATEWAY_SWAGGER_SRCS=_GO_GRPC_GATEWAY_SWAGGER_SRCS CFLAGS=CGO_CFLAGS GO_TEST_EMBED_PATTERN=_GO_UNUSED_SRCS GO_XTEST_EMBED_PATTERN=_GO_UNUSED_SRCS GO_TEST_EMBED_DIR=_GO_UNUSED_SRCS GO_XTEST_EMBED_DIR=_GO_UNUSED_SRCS GO_GRPC_GATEWAY_V2_SRCS=_GO_GRPC_GATEWAY_V2_SRCS GO_GRPC_GATEWAY_V2_OPENAPI_SRCS=_GO_GRPC_GATEWAY_V2_OPENAPI_SRCS
  8130. .ALLOWED=GO_PROTO_PLUGIN USE_CXX USE_UTIL RESOURCE_FILES
  8131. .IGNORED=GO_SKIP_TESTS USE_SKIFF
  8132. .RESTRICTED=TEST_SRCS
  8133. .DEFAULT_NAME_GENERATOR=UseDirNameOrSetGoPackage
  8134. ENABLE(_GO_MODULE)
  8135. SET(MODULE_TAG GO)
  8136. PEERDIR_TAGS=GO GO_PROTO GO_FBS __EMPTY__
  8137. DEFAULT(_GO_VET_TOOL)
  8138. DEFAULT(_GO_VET_FLAGS)
  8139. DEFAULT(_GO_VET_EXTS)
  8140. DEFAULT(_GO_SONAME)
  8141. NO_RUNTIME()
  8142. SET(COVERAGE_FLAGS)
  8143. SET(EXTRA_OUTPUT)
  8144. SET(MODULE_LANG GO)
  8145. ENABLE(FORCE_CONSISTENT_DEBUG)
  8146. PEERDIR(build/external_resources/go_tools)
  8147. GO_PROTO_GRPC_OPTS_V2=--plugin=protoc-gen-go-grpc=${tool:_TOOL_PROTOC_GEN_GO_GRPC_V2} --go-grpc_out=${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
  8148. GO_PROTO_GRPC_OUTS_V2=${output;norel;nopath;noext;suf=_grpc.pb.go:File}
  8149. select ($GO_PROTO_V2) {
  8150. "yes" | "on" ? {
  8151. GO_PROTO_OUTS+=${output;hide;norel;nopath;noext;suf=.pb.go:File}
  8152. GO_PROTO_OPTS+=--plugin=protoc-gen-go=${tool:_TOOL_PROTOC_GEN_GO_V2} --go_out=${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
  8153. _GO_PROTO_CHECK_OUTPUT=--check $GO_PROTO_GRPC_OUTS_V2
  8154. GO_PROTO_OPTS+=$GO_PROTO_GRPC_OPTS
  8155. }
  8156. default ? {
  8157. GO_PROTO_OUTS+=${output;hide;norel;nopath;noext;suf=.pb.go:File}
  8158. GO_PROTO_OPTS+=--plugin=protoc-gen-go=${tool:_TOOL_PROTOC_GEN_GO} --go_out=$GO_PROTO_GEN_PLUGINS:${ARCADIA_BUILD_ROOT}/$PROTO_NAMESPACE
  8159. }
  8160. }
  8161. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  8162. PEERDIR+=$COMPILER_PLATFORM
  8163. }
  8164. when ($CLANG == "yes" || $GCC == "yes") {
  8165. CGO_CFLAGS_VALUE += -w -pthread -fpic
  8166. CGO2_CFLAGS_VALUE += -Wno-unused-variable
  8167. }
  8168. select ($GO_VET) {
  8169. "yes" | "on" ? {
  8170. _GO_VET=yes
  8171. _GO_VET_FLAGS+=-cgocall=false
  8172. }
  8173. "yndexer" ? {
  8174. _GO_VET=yes
  8175. PEERDIR+=build/external_resources/goyndexer
  8176. _GO_VET_TOOL=${GOYNDEXER_RESOURCE_GLOBAL}/goyndexer
  8177. _GO_YDX_FILE=++ydx-file ${_GO_YNDEXER_EXT}
  8178. _GO_VET_FLAGS=-indexer.arc ${ARCADIA_ROOT} -indexer.indexfile ${GO_YNDEXER_OUTPUT} -indexer.loglevel info
  8179. _GO_FMT_ADD_CHECK=no
  8180. _GO_VET_ADD_CHECK=no
  8181. GO_VET_INFO_EXT=.ydx.out
  8182. GO_VET_REPORT_EXT=.ydx.txt
  8183. _GO_VET_EXTS=++vet-info-ext .ydx.out ++vet-report-ext .ydx.txt
  8184. _GO_CGO1_WRAPPER_FLAGS=--build-prefix=__ARCADIA_BUILD_ROOT_PREFIX__ --source-prefix=__ARCADIA_SOURCE_ROOT_PREFIX__
  8185. }
  8186. "yolint" ? {
  8187. _GO_VET=yes
  8188. PEERDIR+=build/external_resources/yolint
  8189. _GO_VET_TOOL=${YOLINT_RESOURCE_GLOBAL}/yolint
  8190. _GO_VET_FLAGS=-migration.config=${input:"${ARCADIA_ROOT}/build/rules/go/migrations.yaml"} -scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
  8191. }
  8192. "yolint_next" ? {
  8193. _GO_VET=yes
  8194. PEERDIR+=build/external_resources/yolint
  8195. _GO_VET_TOOL=${YOLINT_NEXT_RESOURCE_GLOBAL}/yolint
  8196. _GO_VET_FLAGS=-scopelint.config=${input:"${ARCADIA_ROOT}/build/rules/go/extended_lint.yaml"}
  8197. }
  8198. "local" ? {
  8199. _GO_VET=yes
  8200. _GO_VET_FLAGS=
  8201. }
  8202. default ? {
  8203. _GO_VET=no
  8204. _GO_VET_FLAGS=
  8205. }
  8206. }
  8207. SET(_GO_VET $_GO_VET)
  8208. when ($GO_VET_TOOL == "") {
  8209. _GO_VET_TOOL_REAL=$_GO_VET_TOOL
  8210. }
  8211. otherwise {
  8212. _GO_VET_TOOL_REAL=$GO_VET_TOOL
  8213. }
  8214. when ($GO_VET_FLAGS == "") {
  8215. _GO_VET_FLAGS_REAL=$_GO_VET_FLAGS
  8216. }
  8217. otherwise {
  8218. _GO_VET_FLAGS_REAL=$GO_VET_FLAGS
  8219. }
  8220. when ($_GO_VET == "yes" && $NO_GO_VET != "yes") {
  8221. 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
  8222. }
  8223. otherwise {
  8224. GO_VET_OUTPUT=
  8225. _GO_VET_ADD_CHECK=no
  8226. }
  8227. when ($GO_DEBUG_PATH_RELATIVE == "yes") {
  8228. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=;build=;tools= ++tools-root $(TOOL_ROOT)
  8229. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>;$ARCADIA_BUILD_ROOT=>;$(TOOL_ROOT)=>
  8230. }
  8231. otherwise {
  8232. _GO_DEBUG_PATH__NO_UID__=++debug-root-map source=/-S;build=/-B;tools=/-T ++tools-root $(TOOL_ROOT)
  8233. _GO_COMPILE_SYMABIS_TRIMPATH__NO_UID__=-trimpath $ARCADIA_ROOT=>/-S;$ARCADIA_BUILD_ROOT=>/-B;$(TOOL_ROOT)=>/-T
  8234. }
  8235. _GO_PROCESS_SRCS()
  8236. when ($CLANG == "yes") {
  8237. _GO_EXTLD=clang
  8238. GO_TOOLCHAIN_ENV += ${env:"CC=clang"}
  8239. }
  8240. otherwise {
  8241. _GO_EXTLD=gcc
  8242. GO_TOOLCHAIN_ENV += ${env:"CC=gcc"}
  8243. }
  8244. when ($OS_DARWIN) {
  8245. PEERDIR+=build/external_resources/go_fake_xcrun
  8246. 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
  8247. CGO2_LDFLAGS_VALUE += $LD_SDK_VERSION -undefined dynamic_lookup -nodefaultlibs -lc
  8248. }
  8249. elsewhen ($OS_LINUX) {
  8250. 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
  8251. CGO2_LDFLAGS_VALUE += -Wl,--unresolved-symbols=ignore-all -nodefaultlibs -lc
  8252. }
  8253. otherwise {
  8254. GO_EXTLD = ++extld $_GO_EXTLD
  8255. }
  8256. when ($RACE == "yes") {
  8257. _GO_COMPILE_FLAGS_RACE=-race
  8258. _GO_LINK_FLAGS_RACE=-race
  8259. }
  8260. otherwise {
  8261. _GO_COMPILE_FLAGS_RACE=
  8262. _GO_LINK_FLAGS_RACE=
  8263. }
  8264. when ($PIC == "yes" || $PIE == "yes") {
  8265. _GO_COMPILE_FLAGS_SHARED=-shared
  8266. _GO_ASM_FLAGS_SHARED=-shared
  8267. }
  8268. otherwise {
  8269. _GO_COMPILE_FLAGS_SHARED=
  8270. _GO_ASM_FLAGS_SHARED=
  8271. }
  8272. GO_ASM_FLAGS_VALUE += $_GO_ASM_FLAGS_SHARED
  8273. GO_COMPILE_FLAGS_VALUE += $_GO_COMPILE_FLAGS_RACE $_GO_COMPILE_FLAGS_SHARED
  8274. GO_LINK_FLAGS_VALUE += $_GO_LINK_FLAGS_RACE
  8275. ADDINCL(${GOSTD}/runtime)
  8276. }
  8277. # tag:go-specific
  8278. ### @usage: GO_LIBRARY([name])
  8279. ###
  8280. ### Go library module definition.
  8281. ### Compile Go module as a library suitable for PEERDIR from other Go modules.
  8282. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  8283. module GO_LIBRARY: _GO_BASE_UNIT {
  8284. .CMD=GO_LINK_LIB
  8285. .NODE_TYPE=Bundle
  8286. .FINAL_TARGET=no
  8287. SET(_GO_TOOL_MODE lib)
  8288. SET(MODULE_TYPE LIBRARY)
  8289. SET(PEERDIR_TAGS GO GO_PROTO GO_FBS __EMPTY__ PACKAGE_UNION)
  8290. _REQUIRE_EXPLICIT_LICENSE(vendor)
  8291. MODULE_SUFFIX=.a
  8292. }
  8293. # tag:go-specific
  8294. ### @usage: GO_PROGRAM([name])
  8295. ###
  8296. ### Go program module definition.
  8297. ### Compile and link Go module to an executable program.
  8298. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  8299. module GO_PROGRAM: _GO_BASE_UNIT {
  8300. .CMD=GO_LINK_EXE
  8301. .NODE_TYPE=Program
  8302. .PROXY=yes
  8303. .SYMLINK_POLICY=EXE
  8304. .ALLOWED=INDUCED_DEPS
  8305. .FINAL_TARGET=yes
  8306. SET(MODULE_TAG GO_PROGRAM)
  8307. SET(_GO_TOOL_MODE exe)
  8308. SET(MODULE_TYPE PROGRAM)
  8309. SET(GO_VET_OUTPUT_INFO)
  8310. ALLOCATOR($_GO_DEFAULT_ALLOCATOR)
  8311. _USE_LINKER()
  8312. ENABLE(COMMON_LINK_SETTINGS)
  8313. when ($MUSL == "yes") {
  8314. PEERDIR += contrib/libs/musl/full
  8315. }
  8316. when ($RACE == "yes") {
  8317. PEERDIR += contrib/libs/cxxsupp/builtins
  8318. }
  8319. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8320. MODULE_SUFFIX=.exe
  8321. }
  8322. PEERDIR(${GOSTD}/runtime library/go/core/buildinfo)
  8323. when ($RACE == "yes") {
  8324. PEERDIR += ${GOSTD}/runtime/cgo
  8325. PEERDIR += ${GOSTD}/runtime/race
  8326. }
  8327. when ($MUSL == "yes") {
  8328. GO_WITH_MUSL = ++musl
  8329. }
  8330. when ($HARDENING == "yes") {
  8331. _GO_BUILDMODE=++buildmode=pie
  8332. }
  8333. }
  8334. # tag:go-specific
  8335. module _GO_DLL_BASE_UNIT: GO_PROGRAM {
  8336. .CMD=GO_LINK_DLL
  8337. .SYMLINK_POLICY=SO
  8338. .ALLOWED=WHOLE_ARCHIVE
  8339. .ARGS_PARSER=DLL
  8340. .NODE_TYPE=Library
  8341. .PROXY=yes
  8342. SET(_GO_TOOL_MODE dll)
  8343. SET(MODULE_TYPE DLL)
  8344. GO_PACKAGE_NAME(main)
  8345. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8346. MODULE_SUFFIX=.dll
  8347. }
  8348. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  8349. MODULE_PREFIX=lib
  8350. MODULE_SUFFIX=.dylib$MODULE_VERSION
  8351. }
  8352. otherwise {
  8353. MODULE_PREFIX=lib
  8354. MODULE_SUFFIX=.so$MODULE_VERSION
  8355. }
  8356. when ($OS_DARWIN) {
  8357. _GO_SONAME=-Wl,-install_name,$SONAME
  8358. }
  8359. elsewhen ($OS_LINUX) {
  8360. _GO_SONAME=-Wl,-soname,$SONAME
  8361. }
  8362. when ($MODULE_VERSION) {
  8363. when ($OS_LINUX || $OS_DARWIN) {
  8364. _GO_LINK_EXE_EXT_CMD+= && $LINK_OR_COPY_CMD $TARGET ${output;nopath;noext:SONAME}
  8365. }
  8366. }
  8367. }
  8368. # tag:go-specific
  8369. ### @usage: GO_DLL(name major_ver [minor_ver] [PREFIX prefix])
  8370. ###
  8371. ### Go ishared object module definition.
  8372. ### Compile and link Go module to a shared object.
  8373. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  8374. module GO_DLL: _GO_DLL_BASE_UNIT {
  8375. }
  8376. # tag:go-specific tag:test
  8377. ### @usage: GO_BENCH_TIMEOUT(x)
  8378. ###
  8379. ### Sets timeout in seconds for 1 Benchmark in go benchmark suite
  8380. ###
  8381. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  8382. macro GO_BENCH_TIMEOUT(bench_timeout) {
  8383. SET(GO_BENCH_TIMEOUT $bench_timeout)
  8384. }
  8385. # tag:go-specific tag:test
  8386. ### @usage: GO_TEST([name])
  8387. ###
  8388. ### Go test module definition.
  8389. ### Compile and link Go module as a test suitable for running with Arcadia testing support.
  8390. ### All usual testing support macros like DATA, DEPENDS, SIZE, REQUIREMENTS etc. are supported.
  8391. ### Will select Go implementation on PEERDIR to PROTO_LIBRARY.
  8392. module GO_TEST: GO_PROGRAM {
  8393. .CMD=GO_LINK_TEST
  8394. .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
  8395. .ALLOWED=GO_SKIP_TESTS YT_SPEC
  8396. .FINAL_TARGET=no
  8397. SET(MODULE_TAG GO_TEST)
  8398. SET(PEERDIR_TAGS GO GO_PROGRAM GO_PROTO GO_FBS __EMPTY__)
  8399. SET(_GO_TOOL_MODE test)
  8400. SET(MODULE_TYPE PROGRAM)
  8401. ENABLE(GO_TEST_MODULE)
  8402. SET(GO_COVER_INFO_VALUE)
  8403. # We have to add uncoditionaly PEERDIR to ${GOSTD}/os here thouth it is really
  8404. # needed when TestMain is defined in the source code of the test
  8405. PEERDIR(${GOSTD}/os)
  8406. PEERDIR(${GOSTD}/testing/internal/testdeps)
  8407. PEERDIR(${GOSTD}/testing)
  8408. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.test)
  8409. ADD_YTEST($MODULE_PREFIX$REALPRJNAME go.bench)
  8410. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  8411. }
  8412. # tag:go-specific
  8413. macro GO_MOCKGEN_FROM(Path) {
  8414. SET(MOCKGEN_FROM ${Path})
  8415. }
  8416. # tag:go-specific
  8417. macro GO_MOCKGEN_TYPES(Types...) {
  8418. SET(MOCKGEN_TYPES ${join=\\${__COMMA__}:Types})
  8419. }
  8420. # tag:go-specific
  8421. macro GO_MOCKGEN_REFLECT() {
  8422. PEERDIR(${GOSTD}/encoding/gob)
  8423. PEERDIR(${GOSTD}/flag)
  8424. PEERDIR(${GOSTD}/fmt)
  8425. PEERDIR(${GOSTD}/os)
  8426. PEERDIR(${GOSTD}/path)
  8427. PEERDIR(${GOSTD}/reflect)
  8428. PEERDIR(vendor/github.com/golang/mock/mockgen/model)
  8429. PEERDIR(${MOCKGEN_FROM})
  8430. RUN_PROGRAM(vendor/github.com/golang/mock/mockgen -prog_only a.yandex-team.ru/${MOCKGEN_FROM} $MOCKGEN_TYPES STDOUT main.go)
  8431. }
  8432. # tag:internal
  8433. macro _TOOL(TOOL) {
  8434. .CMD=${tool:TOOL}
  8435. }
  8436. # tag:go-specific
  8437. macro GO_MOCKGEN_MOCKS() {
  8438. PEERDIR(${GOSTD}/reflect)
  8439. PEERDIR(vendor/github.com/golang/mock/gomock)
  8440. .CMD=${tool:"vendor/github.com/golang/mock/mockgen"} -package mocks -exec_only $_TOOL($MODDIR/gen) a.yandex-team.ru/${MOCKGEN_FROM} $MOCKGEN_TYPES ${output;stdout:"main.go"}
  8441. }
  8442. # Conflict between protobuf-java and protobuf-javalite ¯\_(ツ)_/¯
  8443. # both libraries are required by grpc
  8444. JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE=\
  8445. com.google.protobuf.AbstractMessageLite \
  8446. com.google.protobuf.AbstractMessageLite$Builder \
  8447. com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream \
  8448. com.google.protobuf.AbstractMessageLite$InternalOneOfEnum \
  8449. com.google.protobuf.AbstractParser \
  8450. com.google.protobuf.AbstractProtobufList \
  8451. com.google.protobuf.AllocatedBuffer \
  8452. com.google.protobuf.AllocatedBuffer$1 \
  8453. com.google.protobuf.AllocatedBuffer$2 \
  8454. com.google.protobuf.Android \
  8455. com.google.protobuf.Any \
  8456. com.google.protobuf.Any$1 \
  8457. com.google.protobuf.Any$Builder \
  8458. com.google.protobuf.AnyOrBuilder \
  8459. com.google.protobuf.AnyProto \
  8460. com.google.protobuf.Api \
  8461. com.google.protobuf.Api$1 \
  8462. com.google.protobuf.Api$Builder \
  8463. com.google.protobuf.ApiOrBuilder \
  8464. com.google.protobuf.ApiProto \
  8465. com.google.protobuf.ArrayDecoders \
  8466. com.google.protobuf.ArrayDecoders$1 \
  8467. com.google.protobuf.ArrayDecoders$Registers \
  8468. com.google.protobuf.BinaryReader \
  8469. com.google.protobuf.BinaryReader$1 \
  8470. com.google.protobuf.BinaryReader$SafeHeapReader \
  8471. com.google.protobuf.BinaryWriter \
  8472. com.google.protobuf.BinaryWriter$1 \
  8473. com.google.protobuf.BinaryWriter$SafeDirectWriter \
  8474. com.google.protobuf.BinaryWriter$SafeHeapWriter \
  8475. com.google.protobuf.BinaryWriter$UnsafeDirectWriter \
  8476. com.google.protobuf.BinaryWriter$UnsafeHeapWriter \
  8477. com.google.protobuf.BooleanArrayList \
  8478. com.google.protobuf.BoolValue \
  8479. com.google.protobuf.BoolValue$1 \
  8480. com.google.protobuf.BoolValue$Builder \
  8481. com.google.protobuf.BoolValueOrBuilder \
  8482. com.google.protobuf.BufferAllocator \
  8483. com.google.protobuf.BufferAllocator$1 \
  8484. com.google.protobuf.ByteBufferWriter \
  8485. com.google.protobuf.ByteOutput \
  8486. com.google.protobuf.ByteString \
  8487. com.google.protobuf.ByteString$1 \
  8488. com.google.protobuf.ByteString$2 \
  8489. com.google.protobuf.ByteString$AbstractByteIterator \
  8490. com.google.protobuf.ByteString$ArraysByteArrayCopier \
  8491. com.google.protobuf.ByteString$BoundedByteString \
  8492. com.google.protobuf.ByteString$ByteArrayCopier \
  8493. com.google.protobuf.ByteString$ByteIterator \
  8494. com.google.protobuf.ByteString$CodedBuilder \
  8495. com.google.protobuf.ByteString$LeafByteString \
  8496. com.google.protobuf.ByteString$LiteralByteString \
  8497. com.google.protobuf.ByteString$Output \
  8498. com.google.protobuf.ByteString$SystemByteArrayCopier \
  8499. com.google.protobuf.BytesValue \
  8500. com.google.protobuf.BytesValue$1 \
  8501. com.google.protobuf.BytesValue$Builder \
  8502. com.google.protobuf.BytesValueOrBuilder \
  8503. com.google.protobuf.CanIgnoreReturnValue \
  8504. com.google.protobuf.CheckReturnValue \
  8505. com.google.protobuf.CodedInputStream \
  8506. com.google.protobuf.CodedInputStream$1 \
  8507. com.google.protobuf.CodedInputStream$ArrayDecoder \
  8508. com.google.protobuf.CodedInputStream$IterableDirectByteBufferDecoder \
  8509. com.google.protobuf.CodedInputStream$StreamDecoder \
  8510. com.google.protobuf.CodedInputStream$StreamDecoder$RefillCallback \
  8511. com.google.protobuf.CodedInputStream$StreamDecoder$SkippedDataSink \
  8512. com.google.protobuf.CodedInputStream$UnsafeDirectNioDecoder \
  8513. com.google.protobuf.CodedInputStreamReader \
  8514. com.google.protobuf.CodedInputStreamReader$1 \
  8515. com.google.protobuf.CodedOutputStream \
  8516. com.google.protobuf.CodedOutputStream$1 \
  8517. com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder \
  8518. com.google.protobuf.CodedOutputStream$ArrayEncoder \
  8519. com.google.protobuf.CodedOutputStream$ByteOutputEncoder \
  8520. com.google.protobuf.CodedOutputStream$HeapNioEncoder \
  8521. com.google.protobuf.CodedOutputStream$OutOfSpaceException \
  8522. com.google.protobuf.CodedOutputStream$OutputStreamEncoder \
  8523. com.google.protobuf.CodedOutputStream$SafeDirectNioEncoder \
  8524. com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder \
  8525. com.google.protobuf.CodedOutputStreamWriter \
  8526. com.google.protobuf.CodedOutputStreamWriter$1 \
  8527. com.google.protobuf.DoubleArrayList \
  8528. com.google.protobuf.DoubleValue \
  8529. com.google.protobuf.DoubleValue$1 \
  8530. com.google.protobuf.DoubleValue$Builder \
  8531. com.google.protobuf.DoubleValueOrBuilder \
  8532. com.google.protobuf.Duration \
  8533. com.google.protobuf.Duration$1 \
  8534. com.google.protobuf.Duration$Builder \
  8535. com.google.protobuf.DurationOrBuilder \
  8536. com.google.protobuf.DurationProto \
  8537. com.google.protobuf.Empty \
  8538. com.google.protobuf.Empty$1 \
  8539. com.google.protobuf.Empty$Builder \
  8540. com.google.protobuf.EmptyOrBuilder \
  8541. com.google.protobuf.EmptyProto \
  8542. com.google.protobuf.Enum \
  8543. com.google.protobuf.Enum$1 \
  8544. com.google.protobuf.Enum$Builder \
  8545. com.google.protobuf.EnumOrBuilder \
  8546. com.google.protobuf.EnumValue \
  8547. com.google.protobuf.EnumValue$1 \
  8548. com.google.protobuf.EnumValue$Builder \
  8549. com.google.protobuf.EnumValueOrBuilder \
  8550. com.google.protobuf.ExperimentalApi \
  8551. com.google.protobuf.ExtensionLite \
  8552. com.google.protobuf.ExtensionRegistryFactory \
  8553. com.google.protobuf.ExtensionRegistryLite \
  8554. com.google.protobuf.ExtensionRegistryLite$ExtensionClassHolder \
  8555. com.google.protobuf.ExtensionRegistryLite$ObjectIntPair \
  8556. com.google.protobuf.ExtensionSchema \
  8557. com.google.protobuf.ExtensionSchemaLite \
  8558. com.google.protobuf.ExtensionSchemaLite$1 \
  8559. com.google.protobuf.ExtensionSchemas \
  8560. com.google.protobuf.Field \
  8561. com.google.protobuf.Field$1 \
  8562. com.google.protobuf.Field$Builder \
  8563. com.google.protobuf.Field$Cardinality \
  8564. com.google.protobuf.Field$Cardinality$1 \
  8565. com.google.protobuf.Field$Kind \
  8566. com.google.protobuf.Field$Kind$1 \
  8567. com.google.protobuf.FieldInfo \
  8568. com.google.protobuf.FieldInfo$1 \
  8569. com.google.protobuf.FieldInfo$Builder \
  8570. com.google.protobuf.FieldMask \
  8571. com.google.protobuf.FieldMask$1 \
  8572. com.google.protobuf.FieldMask$Builder \
  8573. com.google.protobuf.FieldMaskOrBuilder \
  8574. com.google.protobuf.FieldMaskProto \
  8575. com.google.protobuf.FieldOrBuilder \
  8576. com.google.protobuf.FieldSet \
  8577. com.google.protobuf.FieldSet$1 \
  8578. com.google.protobuf.FieldSet$Builder \
  8579. com.google.protobuf.FieldSet$FieldDescriptorLite \
  8580. com.google.protobuf.FieldType \
  8581. com.google.protobuf.FieldType$1 \
  8582. com.google.protobuf.FieldType$Collection \
  8583. com.google.protobuf.FloatArrayList \
  8584. com.google.protobuf.FloatValue \
  8585. com.google.protobuf.FloatValue$1 \
  8586. com.google.protobuf.FloatValue$Builder \
  8587. com.google.protobuf.FloatValueOrBuilder \
  8588. com.google.protobuf.GeneratedMessageInfoFactory \
  8589. com.google.protobuf.GeneratedMessageLite \
  8590. com.google.protobuf.GeneratedMessageLite$1 \
  8591. com.google.protobuf.GeneratedMessageLite$Builder \
  8592. com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser \
  8593. com.google.protobuf.GeneratedMessageLite$ExtendableBuilder \
  8594. com.google.protobuf.GeneratedMessageLite$ExtendableMessage \
  8595. com.google.protobuf.GeneratedMessageLite$ExtendableMessage$ExtensionWriter \
  8596. com.google.protobuf.GeneratedMessageLite$ExtendableMessageOrBuilder \
  8597. com.google.protobuf.GeneratedMessageLite$ExtensionDescriptor \
  8598. com.google.protobuf.GeneratedMessageLite$GeneratedExtension \
  8599. com.google.protobuf.GeneratedMessageLite$MethodToInvoke \
  8600. com.google.protobuf.GeneratedMessageLite$SerializedForm \
  8601. com.google.protobuf.Int32Value \
  8602. com.google.protobuf.Int32Value$1 \
  8603. com.google.protobuf.Int32Value$Builder \
  8604. com.google.protobuf.Int32ValueOrBuilder \
  8605. com.google.protobuf.Int64Value \
  8606. com.google.protobuf.Int64Value$1 \
  8607. com.google.protobuf.Int64Value$Builder \
  8608. com.google.protobuf.Int64ValueOrBuilder \
  8609. com.google.protobuf.IntArrayList \
  8610. com.google.protobuf.Internal \
  8611. com.google.protobuf.Internal$BooleanList \
  8612. com.google.protobuf.Internal$DoubleList \
  8613. com.google.protobuf.Internal$EnumLite \
  8614. com.google.protobuf.Internal$EnumLiteMap \
  8615. com.google.protobuf.Internal$EnumVerifier \
  8616. com.google.protobuf.Internal$FloatList \
  8617. com.google.protobuf.Internal$IntList \
  8618. com.google.protobuf.Internal$ListAdapter \
  8619. com.google.protobuf.Internal$ListAdapter$Converter \
  8620. com.google.protobuf.Internal$LongList \
  8621. com.google.protobuf.Internal$MapAdapter \
  8622. com.google.protobuf.Internal$MapAdapter$1 \
  8623. com.google.protobuf.Internal$MapAdapter$Converter \
  8624. com.google.protobuf.Internal$MapAdapter$EntryAdapter \
  8625. com.google.protobuf.Internal$MapAdapter$IteratorAdapter \
  8626. com.google.protobuf.Internal$MapAdapter$SetAdapter \
  8627. com.google.protobuf.Internal$ProtobufList \
  8628. com.google.protobuf.InvalidProtocolBufferException \
  8629. com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException \
  8630. com.google.protobuf.IterableByteBufferInputStream \
  8631. com.google.protobuf.JavaType \
  8632. com.google.protobuf.LazyField \
  8633. com.google.protobuf.LazyField$1 \
  8634. com.google.protobuf.LazyField$LazyEntry \
  8635. com.google.protobuf.LazyField$LazyIterator \
  8636. com.google.protobuf.LazyFieldLite \
  8637. com.google.protobuf.LazyStringArrayList \
  8638. com.google.protobuf.LazyStringArrayList$ByteArrayListView \
  8639. com.google.protobuf.LazyStringArrayList$ByteStringListView \
  8640. com.google.protobuf.LazyStringList \
  8641. com.google.protobuf.ListFieldSchema \
  8642. com.google.protobuf.ListFieldSchema$1 \
  8643. com.google.protobuf.ListFieldSchema$ListFieldSchemaFull \
  8644. com.google.protobuf.ListFieldSchema$ListFieldSchemaLite \
  8645. com.google.protobuf.ListValue \
  8646. com.google.protobuf.ListValue$1 \
  8647. com.google.protobuf.ListValue$Builder \
  8648. com.google.protobuf.ListValueOrBuilder \
  8649. com.google.protobuf.LongArrayList \
  8650. com.google.protobuf.ManifestSchemaFactory \
  8651. com.google.protobuf.ManifestSchemaFactory$1 \
  8652. com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory \
  8653. com.google.protobuf.MapEntryLite \
  8654. com.google.protobuf.MapEntryLite$1 \
  8655. com.google.protobuf.MapEntryLite$Metadata \
  8656. com.google.protobuf.MapFieldLite \
  8657. com.google.protobuf.MapFieldSchema \
  8658. com.google.protobuf.MapFieldSchemaLite \
  8659. com.google.protobuf.MapFieldSchemas \
  8660. com.google.protobuf.MessageInfo \
  8661. com.google.protobuf.MessageInfoFactory \
  8662. com.google.protobuf.MessageLite \
  8663. com.google.protobuf.MessageLite$Builder \
  8664. com.google.protobuf.MessageLiteOrBuilder \
  8665. com.google.protobuf.MessageLiteToString \
  8666. com.google.protobuf.MessageSchema \
  8667. com.google.protobuf.MessageSchema$1 \
  8668. com.google.protobuf.MessageSetSchema \
  8669. com.google.protobuf.Method \
  8670. com.google.protobuf.Method$1 \
  8671. com.google.protobuf.Method$Builder \
  8672. com.google.protobuf.MethodOrBuilder \
  8673. com.google.protobuf.Mixin \
  8674. com.google.protobuf.Mixin$1 \
  8675. com.google.protobuf.Mixin$Builder \
  8676. com.google.protobuf.MixinOrBuilder \
  8677. com.google.protobuf.MutabilityOracle \
  8678. com.google.protobuf.MutabilityOracle$1 \
  8679. com.google.protobuf.NewInstanceSchema \
  8680. com.google.protobuf.NewInstanceSchemaLite \
  8681. com.google.protobuf.NewInstanceSchemas \
  8682. com.google.protobuf.NioByteString \
  8683. com.google.protobuf.NioByteString$1 \
  8684. com.google.protobuf.NullValue \
  8685. com.google.protobuf.NullValue$1 \
  8686. com.google.protobuf.OneofInfo \
  8687. com.google.protobuf.Option \
  8688. com.google.protobuf.Option$1 \
  8689. com.google.protobuf.Option$Builder \
  8690. com.google.protobuf.OptionOrBuilder \
  8691. com.google.protobuf.Parser \
  8692. com.google.protobuf.PrimitiveNonBoxingCollection \
  8693. com.google.protobuf.Protobuf \
  8694. com.google.protobuf.ProtobufArrayList \
  8695. com.google.protobuf.ProtobufLists \
  8696. com.google.protobuf.ProtocolStringList \
  8697. com.google.protobuf.ProtoSyntax \
  8698. com.google.protobuf.RawMessageInfo \
  8699. com.google.protobuf.Reader \
  8700. com.google.protobuf.RopeByteString \
  8701. com.google.protobuf.RopeByteString$1 \
  8702. com.google.protobuf.RopeByteString$Balancer \
  8703. com.google.protobuf.RopeByteString$PieceIterator \
  8704. com.google.protobuf.RopeByteString$RopeInputStream \
  8705. com.google.protobuf.Schema \
  8706. com.google.protobuf.SchemaFactory \
  8707. com.google.protobuf.SchemaUtil \
  8708. com.google.protobuf.SmallSortedMap \
  8709. com.google.protobuf.SmallSortedMap$1 \
  8710. com.google.protobuf.SmallSortedMap$DescendingEntryIterator \
  8711. com.google.protobuf.SmallSortedMap$DescendingEntrySet \
  8712. com.google.protobuf.SmallSortedMap$EmptySet \
  8713. com.google.protobuf.SmallSortedMap$EmptySet$1 \
  8714. com.google.protobuf.SmallSortedMap$EmptySet$2 \
  8715. com.google.protobuf.SmallSortedMap$Entry \
  8716. com.google.protobuf.SmallSortedMap$EntryIterator \
  8717. com.google.protobuf.SmallSortedMap$EntrySet \
  8718. com.google.protobuf.SourceContext \
  8719. com.google.protobuf.SourceContext$1 \
  8720. com.google.protobuf.SourceContext$Builder \
  8721. com.google.protobuf.SourceContextOrBuilder \
  8722. com.google.protobuf.SourceContextProto \
  8723. com.google.protobuf.StringValue \
  8724. com.google.protobuf.StringValue$1 \
  8725. com.google.protobuf.StringValue$Builder \
  8726. com.google.protobuf.StringValueOrBuilder \
  8727. com.google.protobuf.Struct \
  8728. com.google.protobuf.Struct$1 \
  8729. com.google.protobuf.Struct$Builder \
  8730. com.google.protobuf.Struct$FieldsDefaultEntryHolder \
  8731. com.google.protobuf.StructOrBuilder \
  8732. com.google.protobuf.StructProto \
  8733. com.google.protobuf.StructuralMessageInfo \
  8734. com.google.protobuf.StructuralMessageInfo$Builder \
  8735. com.google.protobuf.Syntax \
  8736. com.google.protobuf.Syntax$1 \
  8737. com.google.protobuf.TextFormatEscaper \
  8738. com.google.protobuf.TextFormatEscaper$1 \
  8739. com.google.protobuf.TextFormatEscaper$2 \
  8740. com.google.protobuf.TextFormatEscaper$ByteSequence \
  8741. com.google.protobuf.Timestamp \
  8742. com.google.protobuf.Timestamp$1 \
  8743. com.google.protobuf.Timestamp$Builder \
  8744. com.google.protobuf.TimestampOrBuilder \
  8745. com.google.protobuf.TimestampProto \
  8746. com.google.protobuf.Type \
  8747. com.google.protobuf.Type$1 \
  8748. com.google.protobuf.Type$Builder \
  8749. com.google.protobuf.TypeOrBuilder \
  8750. com.google.protobuf.TypeProto \
  8751. com.google.protobuf.UInt32Value \
  8752. com.google.protobuf.UInt32Value$1 \
  8753. com.google.protobuf.UInt32Value$Builder \
  8754. com.google.protobuf.UInt32ValueOrBuilder \
  8755. com.google.protobuf.UInt64Value \
  8756. com.google.protobuf.UInt64Value$1 \
  8757. com.google.protobuf.UInt64Value$Builder \
  8758. com.google.protobuf.UInt64ValueOrBuilder \
  8759. com.google.protobuf.UninitializedMessageException \
  8760. com.google.protobuf.UnknownFieldSchema \
  8761. com.google.protobuf.UnknownFieldSetLite \
  8762. com.google.protobuf.UnknownFieldSetLiteSchema \
  8763. com.google.protobuf.UnmodifiableLazyStringList \
  8764. com.google.protobuf.UnmodifiableLazyStringList$1 \
  8765. com.google.protobuf.UnmodifiableLazyStringList$2 \
  8766. com.google.protobuf.UnsafeByteOperations \
  8767. com.google.protobuf.UnsafeUtil \
  8768. com.google.protobuf.UnsafeUtil$1 \
  8769. com.google.protobuf.UnsafeUtil$Android32MemoryAccessor \
  8770. com.google.protobuf.UnsafeUtil$Android64MemoryAccessor \
  8771. com.google.protobuf.UnsafeUtil$JvmMemoryAccessor \
  8772. com.google.protobuf.UnsafeUtil$MemoryAccessor \
  8773. com.google.protobuf.Utf8 \
  8774. com.google.protobuf.Utf8$DecodeUtil \
  8775. com.google.protobuf.Utf8$Processor \
  8776. com.google.protobuf.Utf8$SafeProcessor \
  8777. com.google.protobuf.Utf8$UnpairedSurrogateException \
  8778. com.google.protobuf.Utf8$UnsafeProcessor \
  8779. com.google.protobuf.Value \
  8780. com.google.protobuf.Value$1 \
  8781. com.google.protobuf.Value$Builder \
  8782. com.google.protobuf.Value$KindCase \
  8783. com.google.protobuf.ValueOrBuilder \
  8784. com.google.protobuf.WireFormat \
  8785. com.google.protobuf.WireFormat$1 \
  8786. com.google.protobuf.WireFormat$FieldType \
  8787. com.google.protobuf.WireFormat$FieldType$1 \
  8788. com.google.protobuf.WireFormat$FieldType$2 \
  8789. com.google.protobuf.WireFormat$FieldType$3 \
  8790. com.google.protobuf.WireFormat$FieldType$4 \
  8791. com.google.protobuf.WireFormat$JavaType \
  8792. com.google.protobuf.WireFormat$Utf8Validation \
  8793. com.google.protobuf.WireFormat$Utf8Validation$1 \
  8794. com.google.protobuf.WireFormat$Utf8Validation$2 \
  8795. com.google.protobuf.WireFormat$Utf8Validation$3 \
  8796. com.google.protobuf.WrappersProto \
  8797. com.google.protobuf.Writer \
  8798. com.google.protobuf.Writer$FieldOrder
  8799. # tag:java-specific
  8800. JAVA_IGNORE_CLASSPATH_CLASH_VALUE=$JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE
  8801. ### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
  8802. ### Ignore classpath clash test fails for classes
  8803. macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
  8804. SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args $JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE)
  8805. }
  8806. # tag:python-specific
  8807. ### @usage: PY_SRCS({| CYTHON_C} { | TOP_LEVEL | NAMESPACE ns} Files...)
  8808. ###
  8809. ### Build specified Python sources according to Arcadia binary Python build. Basically creates precompiled and source resources keyed with module paths.
  8810. ### The resources eventually are linked into final program and can be accessed as regular Python modules.
  8811. ### This custom loader linked into the program will add them to sys.meta_path.
  8812. ###
  8813. ### 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.
  8814. ### .pyx and .swg lead to C/C++ Python extensions generation, that are automatically registered in Python as built-in modules.
  8815. ###
  8816. ### 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).
  8817. ###
  8818. ### __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.
  8819. ###
  8820. ### @example
  8821. ###
  8822. ### PY2_LIBRARY(mymodule)
  8823. ### 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)
  8824. ### END()
  8825. ###
  8826. ### PY_SRCS honors Python2 and Python3 differences and adjusts itself to Python version of a current module.
  8827. ### PY_SRCS can be used in any Arcadia Python build modules like PY*_LIBRARY, PY*_PROGRAM, PY*TEST.
  8828. ### PY_SRCS in LIBRARY or PROGRAM effectively converts these into PY2_LIBRARY and PY2_PROGRAM respectively.
  8829. ### 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.
  8830. ###
  8831. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs/#modulipylibrarypy3libraryimakrospysrcs
  8832. macro PY_SRCS() {
  8833. DEFAULT(MODULE_TAG PY2)
  8834. DEFAULT(PYTHON2 yes)
  8835. DEFAULT(PYTHON3 no)
  8836. }
  8837. # tag:python-specific
  8838. _ALL_PY_FILES=
  8839. # tag:python-specific
  8840. macro _ALL_PY_SRCS2(TOP_LEVEL?"TOP_LEVEL":"", RECURSIVE?"/**":"", ONLY_TEST_FILES?"test_*.py":"*.py", ONLY_TEST_FILES2?"*_test.py":"***", NO_TEST_FILES?"**/test_*.py **/*_test.py":"", NAMESPACE[], REST[], REST2[], EAT_TAIL[]) {
  8841. _GLOB(_ALL_PY_FILES ${suf=${RECURSIVE}/${ONLY_TEST_FILES}:REST} ${suf=${RECURSIVE}/${ONLY_TEST_FILES2}:REST2} ${suf=${RECURSIVE}/ya.make:REST} EXCLUDE ya.make ${NO_TEST_FILES})
  8842. }
  8843. # tag:python-specific
  8844. ### @usage: ALL_PY_SRCS([RECURSIVE] [NO_TEST_FILES] { | TOP_LEVEL | NAMESPACE ns} [Dirs...])
  8845. ###
  8846. ### Puts all .py-files from given Dirs (relative to projects') into PY_SRCS of the current module.
  8847. ### If Dirs is ommitted project directory is used
  8848. ###
  8849. ### `RECURSIVE` makes lookup recursive with resprect to Dirs
  8850. ### `NO_TEST_FILES` excludes files `test_*.py` and `*_test.py` those are normally subject to `TEST_SRCS`
  8851. ### `TOP_LEVEL` and `NAMESPACE` are forwarded to `PY_SRCS`
  8852. ###
  8853. ### Note: Only one such macro per module is allowed
  8854. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  8855. ###
  8856. ### @see [PY_SRCS()](#macro_PY_SRCS)
  8857. macro ALL_PY_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", NO_TEST_FILES?"NO_TEST_FILES":"", Files...) {
  8858. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} ${NO_TEST_FILES} REST .${pre=/:Files})
  8859. PY_SRCS(_MR ${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} $_ALL_PY_FILES)
  8860. }
  8861. # tag:python-specific
  8862. ### @usage: ALL_PYTEST_SRCS([RECURSIVE] [Dirs...])
  8863. ###
  8864. ### Puts all .py-files from given Dirs (relative to projects') into TEST_SRCS of the current module.
  8865. ### If Dirs is omitted project directory is used
  8866. ###
  8867. ### `RECURSIVE` makes lookup recursive with respect to Dirs
  8868. ### `ONLY_TEST_FILES` includes only files `test_*.py` and `*_test.py`, others are normally subject to `PY_SRCS`
  8869. ###
  8870. ### Note: Only one such macro per module is allowed
  8871. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  8872. ###
  8873. ### @see [TEST_SRCS()](#macro_TEST_SRCS)
  8874. macro ALL_PYTEST_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", ONLY_TEST_FILES?"ONLY_TEST_FILES ONLY_TEST_FILES2 REST2":"EAT_TAIL", Files...) {
  8875. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files} ${ONLY_TEST_FILES} .${pre=/:Files})
  8876. TEST_SRCS(_MR $_ALL_PY_FILES)
  8877. }
  8878. # tag:python-specific
  8879. _PY_EXTRA_LINT_FILES_VALUE=
  8880. ### @usage: PY_EXTRA_LINT_FILES(files...)
  8881. ###
  8882. ### Add extra Python files for linting. This macro allows adding
  8883. ### Python files which has no .py extension.
  8884. macro PY_EXTRA_LINT_FILES(FILES...) {
  8885. SET_APPEND(_PY_EXTRA_LINT_FILES_VALUE $FILES)
  8886. }
  8887. # tag:python-specific
  8888. ### @usage: PY23_LIBRARY([name])
  8889. ###
  8890. ### Build PY2_LIBRARY or PY3_LIBRARY depending on incoming PEERDIR.
  8891. ### Direct build or build by RECURSE creates both variants.
  8892. ### This multimodule doesn't define any final targets, so use from DEPENDS or BUNDLE is not allowed.
  8893. ###
  8894. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs
  8895. multimodule PY23_LIBRARY {
  8896. module PY2: PY2_LIBRARY {
  8897. .RESTRICTED=RUN_ANTLR4_PYTHON
  8898. OBJ_SUF=.py2
  8899. }
  8900. module PY3: PY3_LIBRARY {
  8901. .RESTRICTED=RUN_ANTLR4_PYTHON
  8902. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  8903. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8904. MODULE_PREFIX=py3
  8905. }
  8906. otherwise {
  8907. MODULE_PREFIX=libpy3
  8908. }
  8909. OBJ_SUF=.py3
  8910. }
  8911. }
  8912. # tag:python-specific
  8913. ### @usage: PY23_NATIVE_LIBRARY([name])
  8914. ###
  8915. ### Build LIBRARY compatible with either Python 2.x or Python 3.x depending on incoming PEERDIR.
  8916. ###
  8917. ### 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.
  8918. ### Use these multimodule instead of PY23_LIBRARY if the C++ extension defined in it will be used in PY2MODULE.
  8919. ### 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.
  8920. ### Proper version will be selected according to Python version of the module PEERDIR comes from.
  8921. ###
  8922. ### This mulrtimodule doesn't define any final targets so cannot be used from DEPENDS or BUNDLE macros.
  8923. ###
  8924. ### For more information read https://wiki.yandex-team.ru/arcadia/python/pysrcs/#pysrcssrcsipy23nativelibrary
  8925. ###
  8926. ### @see [LIBRARY()](#module_LIBRARY), [PY2MODULE()](#module_PY2MODULE)
  8927. multimodule PY23_NATIVE_LIBRARY {
  8928. module PY2: LIBRARY {
  8929. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 PYTHON3_ADDINCL RUN_ANTLR4_PYTHON
  8930. OBJ_SUF=.py2
  8931. PYTHON2_ADDINCL()
  8932. SET(MODULE_LANG PY2)
  8933. }
  8934. module PY3: LIBRARY {
  8935. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 RUN_ANTLR4_PYTHON
  8936. .ALIASES=PYTHON2_ADDINCL=PYTHON3_ADDINCL
  8937. .SEM=CPP_LIBRARY_SEM
  8938. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  8939. PYTHON3_ADDINCL()
  8940. SET(MODULE_LANG PY3)
  8941. when ($MSVC == "yes" || $CYGWIN == "yes") {
  8942. MODULE_PREFIX=py3c
  8943. }
  8944. otherwise {
  8945. MODULE_PREFIX=libpy3c
  8946. }
  8947. OBJ_SUF=.py3
  8948. }
  8949. }
  8950. IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  8951. # tag:src-processing
  8952. STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
  8953. macro _SRC("storyboard", SRC, SRCFLAGS...) {
  8954. .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}
  8955. }
  8956. # tag:src-processing
  8957. macro _SRC("xib", SRC, SRCFLAGS...) {
  8958. .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}
  8959. }
  8960. ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  8961. # tag:ios-specific
  8962. ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
  8963. macro _IOS_ASSETS(AssetsDir, Content...) {
  8964. .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
  8965. }
  8966. # tag:ios-specific
  8967. macro IOS_APP_COMMON_FLAGS(Flags...) {
  8968. SET_APPEND(STORYBOARD_FLAGS $Flags)
  8969. SET_APPEND(ASSETS_FLAGS $Flags)
  8970. }
  8971. # tag:ios-specific
  8972. macro IOS_APP_ASSETS_FLAGS(Flags...) {
  8973. SET_APPEND(ASSETS_FLAGS $Flags)
  8974. }
  8975. macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
  8976. .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
  8977. }
  8978. macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
  8979. .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
  8980. }
  8981. # tag:ios-specific
  8982. DELIM=__DELIM__
  8983. 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
  8984. ### @usage: IOS_INTERFACE()
  8985. ### iOS GUI module definition
  8986. module IOS_INTERFACE: _BARE_UNIT {
  8987. .CMD=PACK_IOS_ARCHIVE
  8988. .EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
  8989. .NODE_TYPE=Library
  8990. .FINAL_TARGET=no
  8991. SET(MODULE_SUFFIX .ios.interface)
  8992. PEERDIR+=build/platform/xcode/tools
  8993. }
  8994. # tag:ios-specific
  8995. module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
  8996. SET(MODULE_SUFFIX .default.ios.interface)
  8997. }
  8998. DEFAULT_IOS_TYPE=
  8999. IOS_TYPE=
  9000. when(!$IOS_TYPE) {
  9001. when($DEFAULT_IOS_TYPE) {
  9002. IOS_TYPE=$DEFAULT_IOS_TYPE
  9003. }
  9004. otherwise {
  9005. IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
  9006. }
  9007. }
  9008. DEFAULT_IOS_RUNTIME=
  9009. IOS_RUNTIME=
  9010. when(!$IOS_RUNTIME) {
  9011. when($DEFAULT_IOS_RUNTIME) {
  9012. IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
  9013. }
  9014. otherwise {
  9015. IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
  9016. }
  9017. }
  9018. when ($ARCH_I386) {
  9019. TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
  9020. TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
  9021. }
  9022. otherwise {
  9023. TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
  9024. TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
  9025. }
  9026. # tag:java-specific
  9027. ### @usage: JDK_VERSION(Version)
  9028. ###
  9029. ### Specify JDK version for module
  9030. macro JDK_VERSION(Arg) {
  9031. .SEM=required_jdk $Arg ${output;hide:"JdkVersionFakeProp.java"}
  9032. SET(JDK_REAL_VERSION $Arg)
  9033. _JDK_VERSION_MACRO_CHECK($Arg)
  9034. }
  9035. # tag:java-specific
  9036. when ($JDK_REAL_VERSION == "10") {
  9037. JDK10=yes # remove this later
  9038. }
  9039. JAVA_PROGRAM_CP_USE_COMMAND_FILE=yes
  9040. when ($JDK_REAL_VERSION == "8") {
  9041. JAVA_PROGRAM_CP_USE_COMMAND_FILE=no
  9042. }
  9043. # tag:kotlin-specific
  9044. KOTLIN_JVM_TARGET=
  9045. when ($JDK_REAL_VERSION == "8") {
  9046. KOTLIN_JVM_TARGET=1.8
  9047. }
  9048. elsewhen ($JDK_REAL_VERSION == "20") {
  9049. # remove when kotlin starts supporting jdk20 bytecode
  9050. # see also devtools/ya/jbuild/gen/actions/idea.py
  9051. KOTLIN_JVM_TARGET=19
  9052. }
  9053. otherwise {
  9054. KOTLIN_JVM_TARGET=$JDK_REAL_VERSION
  9055. }
  9056. # tag:frontend-specific
  9057. ### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
  9058. ###
  9059. ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
  9060. macro COLLECT_FRONTEND_FILES(Varname, Dir) {
  9061. _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
  9062. }
  9063. # tag:java-specific
  9064. # local jdk and tools
  9065. USE_SYSTEM_JDK=
  9066. USE_SYSTEM_UBERJAR=
  9067. USE_SYSTEM_ERROR_PRONE=
  9068. # tag:swift-specific
  9069. CPP_XCODE_TOOLCHAIN_VERSION=9.2
  9070. SWIFT_XCODE_TOOLCHAIN_VERSION=9.2
  9071. XCODE_TOOLS_VERSION=10.1
  9072. macro COMPILE_SWIFT_MODULE(SRCS{input}[], BRIDGE_HEADER{input}="", Flags...) {
  9073. when ($BRIDGE_HEADER != "") {
  9074. SWIFT_BRIDGE_HEADER=-import-objc-header ${input:BRIDGE_HEADER}
  9075. }
  9076. otherwise {
  9077. SWIFT_BRIDGE_HEADER=
  9078. }
  9079. .PEERDIR+=build/platform/xcode/swift
  9080. # swift core libraries
  9081. LDFLAGS($SWIFT_LD_FLAGS)
  9082. .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}
  9083. }
  9084. TEST_TOOL_HOST_LOCAL=
  9085. TEST_TOOL_TARGET_LOCAL=
  9086. when ($MOST_USED_CUDA) {
  9087. CUDA_VERSION=11.4
  9088. CUDNN_VERSION=8.0.5
  9089. TENSORRT_VERSION=7
  9090. }
  9091. when ($TENSORFLOW_WITH_CUDA) {
  9092. CUDA_REQUIRED=yes
  9093. }
  9094. when (!$TENSORRT_VERSION) {
  9095. TENSORRT_VERSION=5
  9096. }
  9097. ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
  9098. MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin/mvn
  9099. when ($QT_REQUIRED) {
  9100. QT_BIN=${HOST_QT_RESOURCE_GLOBAL}/bin
  9101. }
  9102. when ($OPENGL_REQUIRED) {
  9103. OPENGL_VERSION=18.0.5
  9104. }
  9105. # tag:python-specific
  9106. multimodule PY23_TEST {
  9107. module PY2 : PYTEST_BIN {
  9108. .RESTRICTED=RUN_ANTLR4_PYTHON
  9109. MODULE_PREFIX=py2_
  9110. OBJ_SUF=.py2
  9111. CANONIZE_SUB_PATH=py2test
  9112. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  9113. }
  9114. module PY3TEST_PROGRAM: PY3TEST_BIN {
  9115. .FINAL_TARGET=yes
  9116. .RESTRICTED=RUN_ANTLR4_PYTHON
  9117. OBJ_SUF=.py3
  9118. CANONIZE_SUB_PATH=py3test
  9119. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  9120. }
  9121. module PY3TEST_LIBRARY: PY3_LIBRARY {
  9122. .RESTRICTED=RUN_ANTLR4_PYTHON
  9123. PEERDIR+=library/python/pytest
  9124. _REQUIRE_EXPLICIT_LICENSE()
  9125. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  9126. }
  9127. }
  9128. # tag:windows-specific
  9129. WINDOWS_MANIFEST=
  9130. macro WINDOWS_MANIFEST(Manifest) {
  9131. SET(WINDOWS_MANIFEST $Manifest)
  9132. }
  9133. # https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later
  9134. macro WINDOWS_LONG_PATH_MANIFEST() {
  9135. SET(WINDOWS_MANIFEST build/long-path.manifest)
  9136. }
  9137. # tag:windows-specific
  9138. when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
  9139. LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
  9140. }
  9141. # tag:cpp-specific
  9142. _VISIBILITY_LEVEL=
  9143. ### @usage: VISIBILITY(level)
  9144. ###
  9145. ### This macro sets visibility level for symbols compiled for the current module. 'level'
  9146. ### may take only one of the following values: DEFAULT, HIDDEN.
  9147. macro VISIBILITY(LEVEL) {
  9148. SET(_VISIBILITY_LEVEL ${LEVEL})
  9149. select ($LEVEL) {
  9150. "DEFAULT" | "HIDDEN" ? {
  9151. }
  9152. default ? {
  9153. _OK = no
  9154. }
  9155. }
  9156. ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
  9157. }
  9158. # tag:cpp-specific
  9159. _CFLAGS_VISIBILITY=
  9160. when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
  9161. when ($CLANG == "yes" || $GCC == "yes") {
  9162. _CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
  9163. }
  9164. }
  9165. CFLAGS+=$_CFLAGS_VISIBILITY
  9166. # tag:cpp-specific
  9167. macro SDBUS_CPP_ADAPTOR(File) {
  9168. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
  9169. .PEERDIR=contrib/libs/sdbus-cpp
  9170. }
  9171. # tag:cpp-specific
  9172. macro SDBUS_CPP_PROXY(File) {
  9173. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
  9174. .PEERDIR=contrib/libs/sdbus-cpp
  9175. }
  9176. # tag:python-specific
  9177. macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
  9178. .CMD=$ENUM_PARSER_TOOL ${input:File} --output ${output;noext;suf=.generated.h:File} --json-output ${output;noext:File.json} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  9179. }
  9180. # tag:python-specific
  9181. macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
  9182. .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"}
  9183. }
  9184. macro NGINX_MODULES(Modules...) {
  9185. PEERDIR(${Modules})
  9186. 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)
  9187. }
  9188. # tag:external-build
  9189. CONTAINER_LAYER_CMD=$YMAKE_PYTHON ${input:"build/scripts/make_container_layer.py"} -s $SQUASHFS_RESOURCE_GLOBAL -o $TARGET $AUTO_INPUT ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CL"} ${kv;hide:"pc blue"}
  9190. CONTAINER_CMD=$YMAKE_PYTHON ${input:"build/scripts/make_container.py"} -s $SQUASHFS_RESOURCE_GLOBAL -o $TARGET ${rootrel:PEERS} ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CN"} ${kv;hide:"pc blue"}
  9191. # tag:external-build
  9192. module CONTAINER_LAYER: _BARE_UNIT {
  9193. .CMD=CONTAINER_LAYER_CMD
  9194. PEERDIR(build/external_resources/squashfs_tools)
  9195. MODULE_SUFFIX=.container_layer
  9196. CHECK_ALLOWED_PATH()
  9197. CHECK_DEPENDENT_DIRS(ALLOW_ONLY PEERDIRS base_layers build/external_resources/squashfs_tools build/platform/python/ymake_python3 junk)
  9198. }
  9199. # tag:external-build
  9200. module CONTAINER: _BARE_UNIT {
  9201. .NODE_TYPE=Bundle
  9202. .PEERDIR_POLICY=as_build_from
  9203. .FINAL_TARGET=yes
  9204. .CMD=CONTAINER_CMD
  9205. PEERDIR(build/external_resources/squashfs_tools)
  9206. PEERDIR(devtools/contrib/cake/entry)
  9207. }
  9208. # tag:external-build
  9209. CUSTOM_BUILD_LIBRARY_USE=
  9210. 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
  9211. # tag:external-build
  9212. module CUSTOM_BUILD_LIBRARY: LIBRARY {
  9213. .NODE_TYPE=Bundle
  9214. .PEERDIR_POLICY=as_build_from
  9215. .PROXY=yes
  9216. .CMD=CUSTOM_BUILD_LIBRARY_CMD
  9217. DISABLE(NEED_ADD_FAKE_SRC)
  9218. }
  9219. ### @usage: ORIGINAL_SOURCE(Source)
  9220. ###
  9221. ### This macro specifies the source repository for contrib
  9222. ### Does nothing now (just a placeholder for future functionality)
  9223. ### See https://st.yandex-team.ru/DTCC-316
  9224. macro ORIGINAL_SOURCE(Source) {
  9225. ENABLE(UNUSED_MACRO)
  9226. }
  9227. # tag:licence
  9228. CREDITS_FILE_EXTRA_EXT=
  9229. CREDITS_FLAGS=
  9230. CREDITS_TEXTS_FILE=
  9231. NO_CREDITS_TEXTS_FILE=
  9232. WITH_CREDITS=
  9233. ### @usage: LICENSE_TEXTS(File)
  9234. ###
  9235. ### This macro specifies the filename with all library licenses texts
  9236. macro LICENSE_TEXTS(Source) {
  9237. SET(CREDITS_TEXTS_FILE $Source)
  9238. }
  9239. # tag:licence
  9240. ### @usage: WITHOUT_LICENSE_TEXTS()
  9241. ###
  9242. ### This macro indicates that the module has no license text
  9243. macro WITHOUT_LICENSE_TEXTS() {
  9244. ENABLE(NO_CREDITS_TEXTS_FILE)
  9245. }
  9246. # tag:licence
  9247. when ($WITH_CREDITS) {
  9248. CREDITS_FLAGS+=--credits-output ${output;suf=${CREDITS_FILE_EXTRA_EXT}".CREDITS.txt":REALPRJNAME}
  9249. }
  9250. GENERATE_MF=
  9251. when ($WITH_CREDITS) {
  9252. GENERATE_MF=$GENERATE_MF_CMD
  9253. }
  9254. macro _MCU_CONVERT(Bin) {
  9255. .CMD=${cwd:BINDIR} $OBJCOPY_TOOL -O ihex $Bin ${output;noext:Bin.hex} && ${cwd:BINDIR} $OBJCOPY_TOOL -O srec $Bin ${output;noext:Bin.s37} && ${cwd:BINDIR} $OBJCOPY_TOOL -O binary $Bin ${output;noext:Bin.bin}
  9256. }
  9257. MCU_LINK_EXE=$LINK_EXE && $_MCU_CONVERT($MODULE_PREFIX$REALPRJNAME)
  9258. ### @usage: MCU_PROGRAM([progname])
  9259. ###
  9260. ### Program module for microcontrollers. Converts ELF to Intel HEX, Motorola S-record and raw binary file formats.
  9261. ### If name is not specified it will be generated from the name of the containing project directory.
  9262. module MCU_PROGRAM: PROGRAM {
  9263. .CMD=MCU_LINK_EXE
  9264. }
  9265. @import "${CONF_ROOT}/conf/project_specific/esp.conf"
  9266. # tag:flags tag:internal tag:windows-specific
  9267. ### @usage: _MSVC_FLAGS_WINDOWS_IMPL(target_platform compiler_flags) # internal
  9268. ###
  9269. ### Add CFLAGS when the firts argument is WINDOWS
  9270. macro _MSVC_FLAGS_WINDOWS_IMPL(WINDOWS[], FLAGS...) {
  9271. CFLAGS($WINDOWS)
  9272. }
  9273. # tag:flags tag:windows-specific tag:cpp-specific
  9274. ### @usage: MSVC_FLAGS([GLOBAL compiler_flag]* compiler_flags)
  9275. ###
  9276. ### Add the specified flags to the compilation line of C/C++files.
  9277. ### Flags apply only if the compiler used is MSVC (cl.exe)
  9278. macro MSVC_FLAGS(FLAGS...) {
  9279. _MSVC_FLAGS_WINDOWS_IMPL($TARGET_PLATFORM $FLAGS)
  9280. }
  9281. ### @usage: COLLECT_YDB_API_SPECS_LEGACY(VarName Paths...) #deprecated
  9282. ###
  9283. ### This macro is ugly hack for legacy YDB go API codegen, any other uses are prohibited
  9284. macro COLLECT_YDB_API_SPECS_LEGACY(FILES_VAR, PATHS...) {
  9285. _GLOB($FILES_VAR ${suf=/*.proto:PATHS})
  9286. RESTRICT_PATH(kikimr/public/sdk/go/ydb/api MSG This is ugly hack for legacy YDB go API codegen, any other uses are probibited)
  9287. }
  9288. # tag:proto tag:apphost
  9289. ### @usage: APPHOST()
  9290. ###
  9291. ### Emit APPHOST service code for all .proto files in a PROTO_LIBRARY.
  9292. ### This works only for C++ and Java at the moment.
  9293. macro APPHOST() {
  9294. # C++
  9295. CPP_PROTO_PLUGIN(cpp_plugin apphost/tools/stub_generator/cpp_plugin .apphost.h DEPS apphost/tools/stub_generator/cpp_includes)
  9296. # Java
  9297. JAVA_PROTO_PLUGIN(java_plugin apphost/tools/stub_generator/java_plugin DEPS apphost/api/service/java/apphost)
  9298. }
  9299. # tag:internal
  9300. ### Add passed ya.conf.json and all bottle's formula external files to resources
  9301. ### File MUST be arcadia root relative path (without "${ARCADIA_ROOT}/" prefix).
  9302. ### NOTE:
  9303. ### An external formula file referenced from ya.conf.json must be passed as an arcadia root relative path and
  9304. ### should be located in any subdirectory of the ya.conf.json location ("build/" if we consider a production).
  9305. ### The later restriction prevents problems in selectively checkouted arcadia.
  9306. macro YA_CONF_JSON(File) {
  9307. _YA_CONF_JSON($File)
  9308. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$File)
  9309. }
  9310. # tag:internal
  9311. # Don't use directly - wrap with custom macros
  9312. macro ADD_LINTER_CHECK(CheckName, Linter, DEPENDS[], EXCLUDE[], FILES[], CONFIGS[]) {
  9313. SET(_FILES_VAR uniq_${hash:VAR_SALT})
  9314. _GLOB($_FILES_VAR $FILES EXCLUDE $EXCLUDE)
  9315. _ADD_LINTER_CHECK($CheckName $Linter ${pre=DEPENDS :DEPENDS} FILES $$_FILES_VAR CONFIGS $CONFIGS)
  9316. }
  9317. # tag:internal
  9318. # Draft. Don't use.
  9319. macro _CPP_STYLE(EXCLUDE[], Files...) {
  9320. ADD_LINTER_CHECK(cpp_style tools/cpp_style_checker/cpp_style_checker DEPENDS contrib/libs/clang12/tools/clang-format EXCLUDE $EXCLUDE FILES $Files CONFIGS devtools/ya/handlers/style/style_config)
  9321. }
  9322. # tag:proto
  9323. macro ALICE_CAPABILITY() {
  9324. CPP_PROTO_PLUGIN(alice_capability_cpp yandex_io/tools/capability_gen .cap.h DEPS yandex_io/libs/protobuf_utils)
  9325. JAVA_PROTO_PLUGIN(alice_capability_java alice/library/go/java_marker_interface_protoc_plugin DEPS alice/protos/endpoint/java_interface alice/megamind/protos/scenarios/java_interface)
  9326. }