ymake.core.conf 359 KB

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