ymake.core.conf 356 KB

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