java.conf 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077
  1. macro _INPUT_WITH_FLAG(Flag, IN[]) {
  2. .CMD=$_INPUT_WITH_FLAG_IMPL(${pre=$Flag :IN} IN $IN)
  3. }
  4. macro _INPUT_WITH_FLAG_IMPL(IN{input}[], Args...) {
  5. .CMD=$Args ${input;hide:IN}
  6. }
  7. macro ACCELEO(XSD{input}[], MTL{input}[], MTL_ROOT="${MODDIR}", LANG{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], DEBUG?"stdout2stderr":"stderr2stdout") {
  8. .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
  9. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input;pre=build/scripts/:DEBUG.py} $JDK_RESOURCE/bin/java -Dfile.encoding=utf8 -classpath ${RUN_JAR_PROG_CP_PRE}${tool:"tools/acceleo"}${RUN_JAR_PROG_CP_SUF} ru.yandex.se.logsng.tool.Cli $_INPUT_WITH_FLAG(--xsd IN $XSD) $_INPUT_WITH_FLAG(--mtl IN $MTL) $_INPUT_WITH_FLAG(--lang IN $LANG) --output-dir $BINDIR --build-root ${ARCADIA_BUILD_ROOT} --source-root ${ARCADIA_ROOT} --mtl-root $MTL_ROOT ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  10. }
  11. ### @usage: JAVA_LIBRARY()
  12. ###
  13. ### The module describing java library build.
  14. ###
  15. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  16. module JAVA_LIBRARY: JAR_LIBRARY {
  17. .SEM=BUILD_JAR_SEM
  18. }
  19. PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM=IGNORED
  20. ### @usage: JAVA_PROGRAM()
  21. ###
  22. ### The module describing java programs build.
  23. ### Output artifacts: .jar and directory with all the jar to the classpath of the formation.
  24. ###
  25. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  26. multimodule JAVA_PROGRAM {
  27. module JAR_RUNNABLE: _JAR_RUNNABLE {
  28. .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
  29. .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM
  30. # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
  31. # * A -> B -> C -> lib-v1.4
  32. # | |-> DM(lib-v1.1)
  33. # | |-> EXCLUDE(lib-v1.4)
  34. # | |-> FORBID_CONFLICT_DM_RECENT = OK
  35. # |-> DM(lib-v1.1)
  36. # |-> FORBID_CONFLICT_DM_RECENT = FAIL (because downgrade from v1.4 to v1.1 is detected before understanding that v1.4 was excuded on the examined path)
  37. .IGNORED=RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION PROVIDES FEATURE_VERSION
  38. .ALIASES=JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
  39. .PEERDIRSELF=JAR_COMPILATION
  40. SET(MODULE_TYPE JAVA_PROGRAM)
  41. }
  42. module JAR_COMPILATION: JAR_LIBRARY {
  43. .IGNORED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
  44. .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
  45. .SEM=BUILD_JAR_SEM
  46. .FINAL_TARGET=no
  47. SET(MODULE_TYPE JAVA_PROGRAM)
  48. when ($OPENSOURCE == "yes" && $AUTOCHECK == "yes") {
  49. # FIXME: Replace AUTOCHECK == yes with _not a host platform_ check after YMAKE-218
  50. MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
  51. MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION REQUIRE_MODIFICATIONS_DISCLOSURE
  52. when ($MAKE_UBERJAR_VALUE == "yes") {
  53. # At the time LICENCE_RESTRICTION does not properly distinct static / dynamic linkage in UBERJAR() modules.
  54. # Hence we forbid using UBERJAR() in OPENSOURCE()
  55. #
  56. # Should be fixed in YMAKE-1043
  57. _OK = no
  58. }
  59. }
  60. when ($OS_IOS == "yes" || $OS_ANDROID == "yes" || $MAPSMOBI_BUILD_TARGET == "yes") {
  61. MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
  62. MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION
  63. }
  64. ASSERT(_OK "UBERJAR() macro can not be used in this configuration, see YMAKE-1043")
  65. }
  66. }
  67. ### Usage JUNIT_TESTS_JAR(path/to/some/peer realname.jar)
  68. ###
  69. ### Specifies jar to search test suites and test cases. By default tests are
  70. ### searched in the jar compild by JTEST or JUNIT5 module sources. This macro
  71. ### allows to specify diferent jar to search tests.
  72. ###
  73. ### Only one jar file is used to search tests. If this macro invoked multiple
  74. ### times (which is not reccomended practice) only the last invocation will
  75. ### have effect.
  76. ###
  77. ### If this macro is used no test from the module build by current ya.make
  78. ### will be searched and executed.
  79. macro JUNIT_TESTS_JAR(Dir, Jar) {
  80. SET(UNITTEST_DIR $Dir)
  81. PEERDIR($Dir)
  82. SET(UNITTEST_MOD $Dir/$Jar)
  83. }
  84. BUILD_JUNIT5_JAR_SEM=$BUILD_JAR_SEM && junit5_test
  85. multimodule JUNIT5 {
  86. # ATTENTION ya ide idea relies on this submodule name to find scope of `ya make` build before project generation
  87. module JAR_TESTABLE: _JAR_TEST {
  88. .ALLOWED=YT_SPEC
  89. # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
  90. # * A -> B -> C -> lib-v1.4
  91. # | |-> DM(lib-v1.1)
  92. # | |-> EXCLUDE(lib-v1.4)
  93. # | |-> FORBID_CONFLICT_DM_RECENT = OK
  94. # |-> DM(lib-v1.1)
  95. # |-> FORBID_CONFLICT_DM_RECENT = FAIL (because downgrade from v1.4 to v1.1 is detected before understanding that v1.4 was excuded on the examined path)
  96. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION PROVIDES FEATURE_VERSION
  97. .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
  98. .PEERDIRSELF=JAR_COMPILATION
  99. .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM
  100. PEERDIR(devtools/jtest-annotations/junit5)
  101. SET(MODULE_TYPE JUNIT5)
  102. }
  103. module JAR_COMPILATION: JAR_LIBRARY {
  104. .ALLOWED=YT_SPEC
  105. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
  106. .FINAL_TARGET=no
  107. .DEFAULT_NAME_GENERATOR=FullPath
  108. .SEM=BUILD_JUNIT5_JAR_SEM
  109. .IGNORED=JUNIT_TESTS_JAR
  110. PEERDIR+=devtools/junit5-runner
  111. PEERDIR+=build/platform/java/jacoco-agent
  112. when ($OPENSOURCE != "yes") {
  113. PEERDIR+=devtools/jtest-annotations/junit5
  114. }
  115. SET(MODULE_TYPE JUNIT5)
  116. when ($OPENSOURCE == "yes" && $AUTOCHECK == "yes") {
  117. # FIXME: Replace AUTOCHECK == yes with _not a host platform_ check after YMAKE-218
  118. MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
  119. MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION REQUIRE_MODIFICATIONS_DISCLOSURE
  120. when ($MAKE_UBERJAR_VALUE == "yes") {
  121. # At the time LICENCE_RESTRICTION does not properly distinct static / dynamic linkage in UBERJAR() modules.
  122. # Hence we forbid using UBERJAR() in OPENSOURCE()
  123. #
  124. # Should be fixed in YMAKE-1043
  125. _OK = no
  126. }
  127. }
  128. ASSERT(_OK "UBERJAR() macro can not be used in this condfiguration, see YMAKE-1043")
  129. }
  130. }
  131. BUILD_JUNIT4_JAR_SEM=$BUILD_JAR_SEM && junit4_test
  132. multimodule JTEST {
  133. # ATTENTION ya ide idea relies on this submodule name to find scope of `ya make` build before project generation
  134. module JAR_TESTABLE: _JAR_TEST {
  135. .ALLOWED=YT_SPEC
  136. # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
  137. # * A -> B -> C -> lib-v1.4
  138. # | |-> DM(lib-v1.1)
  139. # | |-> EXCLUDE(lib-v1.4)
  140. # | |-> FORBID_CONFLICT_DM_RECENT = OK
  141. # |-> DM(lib-v1.1)
  142. # |-> FORBID_CONFLICT_DM_RECENT = FAIL (because downgrade from v1.4 to v1.1 is detected before understanding that v1.4 was excuded on the examined path)
  143. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION PROVIDES FEATURE_VERSION
  144. .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
  145. .PEERDIRSELF=JAR_COMPILATION
  146. .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM
  147. SET(MODULE_TYPE JTEST)
  148. PEERDIR(devtools/junit-runner devtools/jtest-annotations/junit4)
  149. DEPENDENCY_MANAGEMENT(contrib/java/com/google/code/gson/gson/2.10.1 contrib/java/com/beust/jcommander/1.72 contrib/java/junit/junit/4.12)
  150. }
  151. module JAR_COMPILATION: JAR_LIBRARY {
  152. .ALLOWED=YT_SPEC
  153. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
  154. .FINAL_TARGET=no
  155. .DEFAULT_NAME_GENERATOR=FullPath
  156. .SEM=BUILD_JUNIT4_JAR_SEM
  157. .IGNORED=JUNIT_TESTS_JAR
  158. SET(MODULE_TYPE JTEST)
  159. DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
  160. PEERDIR+=build/platform/java/jacoco-agent
  161. when ($OPENSOURCE != "yes") {
  162. PEERDIR+=devtools/jtest-annotations/junit4
  163. }
  164. when ($OPENSOURCE == "yes" && $AUTOCHECK == "yes") {
  165. # FIXME: Replace AUTOCHECK == yes with _not a host platform_ check after YMAKE-218
  166. MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
  167. MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION REQUIRE_MODIFICATIONS_DISCLOSURE
  168. when ($MAKE_UBERJAR_VALUE == "yes") {
  169. # At the time LICENCE_RESTRICTION does not properly distinct static / dynamic linkage in UBERJAR() modules.
  170. # Hence we forbid using UBERJAR() in OPENSOURCE()
  171. #
  172. # Should be fixed in YMAKE-1043
  173. _OK = no
  174. }
  175. }
  176. ASSERT(_OK "UBERJAR() macro can not be used in this configuration, see YMAKE-1043")
  177. }
  178. }
  179. multimodule JTEST_FOR {
  180. # ATTENTION ya ide idea relies on this submodule name to find scope of `ya make` build before project generation
  181. module JAR_TESTABLE: _JAR_TEST {
  182. .ALLOWED=YT_SPEC
  183. # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
  184. # * A -> B -> C -> lib-v1.4
  185. # | |-> DM(lib-v1.1)
  186. # | |-> EXCLUDE(lib-v1.4)
  187. # | |-> FORBID_CONFLICT_DM_RECENT = OK
  188. # |-> DM(lib-v1.1)
  189. # |-> FORBID_CONFLICT_DM_RECENT = FAIL (because downgrade from v1.4 to v1.1 is detected before understanding that v1.4 was excuded on the examined path)
  190. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION PROVIDES FEATURE_VERSION
  191. .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
  192. .RESTRICTED=JUNIT_TESTS_JAR
  193. .PEERDIRSELF=JAR_COMPILATION
  194. .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM
  195. SET(MODULE_TYPE JTEST_FOR)
  196. PEERDIR(${UNITTEST_DIR} devtools/junit-runner)
  197. DEPENDENCY_MANAGEMENT(contrib/java/com/google/code/gson/gson/2.8.6 contrib/java/com/beust/jcommander/1.72 contrib/java/junit/junit/4.12)
  198. }
  199. module JAR_COMPILATION: JAR_LIBRARY {
  200. .ALLOWED=YT_SPEC
  201. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
  202. .FINAL_TARGET=no
  203. .DEFAULT_NAME_GENERATOR=FullPath
  204. .SEM=BUILD_JUNIT4_JAR_SEM
  205. .RESTRICTED=JUNIT_TESTS_JAR
  206. SET(MODULE_TYPE JTEST_FOR)
  207. DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
  208. PEERDIR(devtools/junit-runner build/platform/java/jacoco-agent ${UNITTEST_DIR})
  209. }
  210. }
  211. # TODO Something for using tool in RUN_JAVA_PROGRAM
  212. _SEM_JAR_RUNNABLE=
  213. multimodule JAVA_CONTRIB_PROGRAM {
  214. module JAR_RUNNABLE: _JAR_RUNNABLE {
  215. .IGNORED=JAVA_SRCS RUN_JAR_PROGRAM RUN_JAVA_PROGRAM JAR_RESOURCE SRC_RESOURCE LOCAL_JAR
  216. .PEERDIRSELF=JAR_COMPILATION
  217. .SEM=_SEM_JAR_RUNNABLE
  218. SET(MODULE_TYPE JAVA_PROGRAM)
  219. ENABLE(DISABLE_SCRIPTGEN)
  220. }
  221. module JAR_COMPILATION: JAVA_CONTRIB {
  222. .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
  223. .FINAL_TARGET=no
  224. .SEM=BUILD_JAR_SEM
  225. }
  226. }
  227. # tag:java-specific
  228. JAVA_VCS_MF_ARG=
  229. COMPILE_JAVA_MF=${hide:JAVA_FAKEID} $COMPILE_JAVA $MAVEN_EXPORT_CMD
  230. # tag:java-specific
  231. when ($EXT_JAVA_VCS_INFO == "yes") {
  232. JAVA_VCS_MF_ARG=--vcs-mf $VCS_JAVA
  233. COMPILE_JAVA_MF=${hide:JAVA_FAKEID} $GENERATE_VCS_JAVA_INFO_NODEP && $COMPILE_JAVA $MAVEN_EXPORT_CMD
  234. }
  235. # tag:java-specific
  236. EXT_JAVA_VCS_INFO=no
  237. ### @usage: EMBED_JAVA_VCS_INFO()
  238. ###
  239. ### Embed manifest with vcs info into `EXTERNAL_JAVA_LIBRARY`
  240. ### By default this is disabled.
  241. macro EMBED_JAVA_VCS_INFO() {
  242. .SEM=add_vcs_info_to_mf ${hide;output:"VcsInfoMfDummy.java"}
  243. ENABLE(EXT_JAVA_VCS_INFO)
  244. }
  245. # tag:java-specific tag:internal
  246. ### @usage: EXTERNAL_JAVA_LIBRARY() #internal
  247. ###
  248. ### EXTERNAL_JAVA_LIBRARY() is a module for creating a .jar file using non-Java code (generators etc.)
  249. ### Unlike regular JAVA_LIBRARY this module doesn't produce .pom file, so it cannot be exported to Maven itself.
  250. ### PEERDIR it from JAVA_LIBRARY or JAVA_PROGRAM for export to Maven.
  251. module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
  252. .EXTS=.jsrc .java .jar .mf
  253. .NODE_TYPE=Bundle
  254. .CMD=COMPILE_JAVA_MF
  255. # TODO(YMAKE-27) all contribs involved into opensource export must be JAVA_CONTRIB modules
  256. # and this module must not be intended for export. Such hange will break JBUILD and thus is
  257. # blocked on YMAKE-27
  258. .SEM=JAVA_CONTRIB_SEM
  259. .PEERDIR_POLICY=as_build_from
  260. .FINAL_TARGET=no
  261. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  262. .ALLOWED=EMBED_JAVA_VCS_INFO
  263. .RESTRICTED=EXTERNAL_JAR
  264. .GLOBAL=MAVEN_EXPORT_COORDS
  265. SET(MODULE_TAG JAVA)
  266. PEERDIR(build/platform/java/jdk)
  267. PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR
  268. when ($KOTLIN_PROTO == "yes") {
  269. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${_KOTLIN_VERSION}
  270. }
  271. when ($MAVEN_EXPORT == "yes") {
  272. when ($MAVEN_DEPLOY == "yes") {
  273. PEERDIR+=build/external_resources/maven
  274. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM && $MAVEN_DEPLOY_CMD
  275. }
  276. otherwise {
  277. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM
  278. }
  279. MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GROUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
  280. }
  281. PEERDIR_TAGS=JAVA JAVA_PROTO JAVA_FBS JAVA_IDL PACKAGE_UNION
  282. HAS_MANAGEABLE_PEERS=yes
  283. DYNAMIC_LINK=yes
  284. _PROTO_CMDLINE=$_JAVA_PROTO_CMDLINE
  285. _EVLOG_CMDLINE=$_JAVA_EVLOG_CMDLINE
  286. _FBS_CMDLINE=$_JAVA_FLATC_CMDLINE
  287. when ($PACKAGE_PREFIX) {
  288. PACKAGE_PREFIX_ARGS=--package-prefix=$PACKAGE_PREFIX
  289. }
  290. DISABLE(NEED_PLATFORM_PEERDIRS)
  291. NO_PLATFORM()
  292. SET(MODULE_SUFFIX .jar)
  293. SET(MODULE_LANG JAVA)
  294. _WHEN_EXPORT_GRADLE()
  295. }
  296. # tag:java-specific
  297. ALL_JAR_SOURCES=
  298. LINT_JAVA_SOURCES=
  299. ALL_SRCDIRS=
  300. LINK_JAR_RESOURCES=
  301. LINK_JAR_JSOURCES=
  302. JAR_GEN_SRCS=
  303. JAR_GEN_JSRCS=
  304. macro _JAVA_SRCS(RESOURCES?"yes":"no", SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], SKIP_CHECK_SRCDIR?"SKIP_CHECK_SRCDIR":"", Globs...) {
  305. _CHECK_JAVA_SRCDIR($SKIP_CHECK_SRCDIR $SRCDIR)
  306. SET_APPEND(ALL_SRCDIRS $SRCDIR)
  307. SET(VAR_SALT $SRCDIR $Globs $EXCLUDE $PACKAGE_PREFIX $RESOURCES $FILES)
  308. SET(JAR_SRCS_GLOB uniq_${hash:VAR_SALT})
  309. _LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE})
  310. SET_APPEND(LINT_JAVA_SOURCES \${input;rootrel;ext=.java:${JAR_SRCS_GLOB}})
  311. 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})
  312. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_RESOURCES ${quo:SRCDIR} ${BINDIR}/cls ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt)
  313. _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_JSOURCES ${quo:SRCDIR} ${BINDIR}/src ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt)
  314. _FILL_JAR_GEN_SRCS(JAR_GEN_SRCS JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst $KT_SRCLIST ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt $Globs EXCLUDE $EXCLUDE)
  315. _FILL_JAR_GEN_SRCS(JAR_GEN_JSRCS SRC_JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst $KT_SRCLIST ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt $Globs EXCLUDE $EXCLUDE)
  316. }
  317. # tag:java-specific
  318. # Fill semantic jar_source_set by JAVA_SRCS() Args
  319. SEM_JAR_SOURCE_SET=
  320. macro _SEM_JAR_SOURCE_SET(SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], RESOURCES?"RESOURCES":"", SKIP_CHECK_SRCDIR?"SKIP_CHECK_SRCDIR":"", Globs...) {
  321. # Now ignore SKIP_CHECK_SRCDIR, PACKAGE_PREFIX, EXCLUDE, RESOURCES, FILES
  322. SET_APPEND(SEM_JAR_SOURCE_SET && jar_source_set ${pre=${SRCDIR}\::Globs})
  323. }
  324. ### Fill JAVA_SRCS to value for ya ide idea and real apply for late globs
  325. macro FULL_JAVA_SRCS(Args...) {
  326. _IDEA_JAVA_SRCS_VALUE($Args)
  327. _JAVA_SRCS($Args)
  328. }
  329. # tag:java-specific
  330. ### @usage: DEFAULT_JAVA_SRCS_LAYOUT()
  331. ###
  332. ### DEFAULT_JAVA_SRCS_LAYOUT() declare all source files can be find at maven/gradle standard path src/main/java **/*.java
  333. ### and all resources an be find at maven/gradle standard path src/main/resources **/*
  334. macro DEFAULT_JAVA_SRCS_LAYOUT() {
  335. # Maven default source paths, supported by gradle too
  336. # JAVA_SRCS may be alias of FULL_JAVA_SRCS
  337. FULL_JAVA_SRCS(SRCDIR src/main/java **/*.java SKIP_CHECK_SRCDIR)
  338. FULL_JAVA_SRCS(RESOURCES SRCDIR src/main/resources **/* SKIP_CHECK_SRCDIR)
  339. }
  340. # tag:java-specific
  341. ### @usage: DEFAULT_JUNIT_JAVA_SRCS_LAYOUT()
  342. ###
  343. ### DEFAULT_JUNIT_JAVA_SRCS_LAYOUT() declare all test source files can be find at maven/gradle standard path src/test/java **/*.java
  344. ### and all resources can be find at maven/gradle standard path src/test/resources **/*
  345. macro DEFAULT_JUNIT_JAVA_SRCS_LAYOUT() {
  346. # Maven default test source paths, supported by gradle too
  347. # JAVA_SRCS may be alias of FULL_JAVA_SRCS
  348. FULL_JAVA_SRCS(SRCDIR java **/*.java SKIP_CHECK_SRCDIR)
  349. FULL_JAVA_SRCS(RESOURCES SRCDIR resources **/* SKIP_CHECK_SRCDIR)
  350. }
  351. macro _HASH_HELPER(Args...) {
  352. .CMD=${hash:Args}
  353. .SEM=${hash:Args}
  354. }
  355. macro _GENTAR_HELPER(OUT_DIR[], Args...) {
  356. .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"}
  357. }
  358. # tag:java-specific
  359. RUN_JAR_PROG_CP_PRE=@
  360. RUN_JAR_PROG_CP_SUF=.cplst
  361. when($JDK_VERSION == "8") {
  362. RUN_JAR_PROG_CP_PRE=
  363. RUN_JAR_PROG_CP_SUF=
  364. }
  365. # tag:java-specific
  366. JDK_LATEST_VERSION=22
  367. JDK_LATEST_PEERDIR=build/platform/java/jdk/jdk${JDK_LATEST_VERSION}
  368. # tag:java-specific
  369. # Fill semantic by RUN_JAVA_PROGRAM()
  370. _SEM_RUN_JAVA_PROGRAM=runs-ITEM \
  371. && runs-args ${Args} \
  372. && runs-classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} \
  373. && runs-cwd ${CWD} ${hide;cwd:CWD} \
  374. && runs-in ${IN} ${hide;input:IN} \
  375. && runs-in_dir ${IN_DIR} \
  376. && runs-in_dirs_inputs ${IN_DIRS_INPUTS} \
  377. && runs-in_noparse ${IN_NOPARSE} ${hide;input;context=TEXT:IN_NOPARSE} \
  378. && runs-out ${OUT} ${hide;output:OUT} ${OUT_NOAUTO} ${hide;output;noauto:OUT_NOAUTO} ${hide;output;suf=.$_HASH_HELPER($CLASSPATH $IN_DIR $IN $IN_NOPARSE $TOOL $Args).gentar:OUT_DIR} \
  379. && runs-out_dir ${OUT_DIR} \
  380. && runs-tool ${TOOL} ${hide;tool:TOOL}
  381. macro _DO_2_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq_", IN_DIRS_INPUTS[], IN{input}[], IN_NOPARSE{input}[], IN_DIR[], OUT_NOAUTO{output}[], OUT{output}[], TOOL{tool}[], OUT_DIR[], CLASSPATH[], ADD_SRCS_TO_CLASSPATH?"yes":"no", CWD="${ARCADIA_BUILD_ROOT}", STDOUT="", STDOUT_NOAUTO="", Args...) {
  382. _LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR})
  383. _CHECK_RUN_JAVA_PROG_CLASSPATH($CLASSPATH)
  384. .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
  385. .CMD=${kv;hide:"p RJ"} ${kv;hide:"pc blue"} ${hide:JAVA_FAKEID} ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} ${OUT_DIR} && ${cwd:CWD} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} ${pre=--file=:STDOUT} ${output;hide:STDOUT} ${pre=--file=:STDOUT_NOAUTO} ${output;hide;noauto:STDOUT_NOAUTO} $YMAKE_PYTHON ${input:"build/scripts/fix_java_command_file_cp.py"} --build-root ${ARCADIA_BUILD_ROOT} $JDK_RESOURCE/bin/java -Dfile.encoding=utf8 -classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} ${Args} && $_GENTAR_HELPER($CLASSPATH $IN_DIR $IN $IN_NOPARSE $TOOL $Args OUT_DIR $OUT_DIR) ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output;noauto;hide:OUT_NOAUTO} ${output;hide:OUT} ${tool;hide:TOOL} ${IN_DIRS_INPUTS}
  386. .SEM=$_SEM_RUN_JAVA_PROGRAM
  387. }
  388. # tag:java-specific
  389. macro _DO_1_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq", Args...) {
  390. _DO_2_RUN_JAR_PROGRAM($Args IN_DIRS_VAR $IN_DIRS_VAR IN_DIRS_INPUTS ${"$"}{input;hide:$IN_DIRS_VAR})
  391. }
  392. # tag:java-specific
  393. macro RUN_JAVA_PROGRAM(Args...) {
  394. _DO_1_RUN_JAR_PROGRAM($Args IN_DIRS_VAR uniq_${hash:Args})
  395. }
  396. # tag:java-specific
  397. _JAR_ANN_PROCESSORS=
  398. _JAR_ANN_PROC_OPT_PREFIX=
  399. _ANN_PROCESSORS_SEM=
  400. macro JAR_ANNOTATION_PROCESSOR(Classes...) {
  401. SET_APPEND(_JAR_ANN_PROCESSORS $Classes)
  402. SET(_JAR_ANN_PROC_OPT_PREFIX -processor)
  403. SET_APPEND(_ANN_PROCESSORS_SEM && annotation_processors $Classes)
  404. # for ya ide idea only
  405. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Classes)
  406. }
  407. # tag:java-specific
  408. macro _JAR_ANN_PROC_OPTS(Classes...) {
  409. .CMD=$_JAR_ANN_PROC_OPT_PREFIX ${join=,:Classes}
  410. }
  411. # tag:java-specific
  412. _USE_ANNOTATION_PROCESSOR_OPT=
  413. _USE_ANNOTATION_PROCESSOR_SEM=
  414. ### @usage: USE_ANNOTATION_PROCESSOR(AnnotationProcessor)
  415. ###
  416. ### Used to specify annotation processor for building JAVA_PROGRAM() and JAVA_LIBRARY().
  417. macro USE_ANNOTATION_PROCESSOR(AnnotationProcessor) {
  418. SET(_USE_ANNOTATION_PROCESSOR_OPT -processorpath @${tool:AnnotationProcessor}.cplist)
  419. SET(_USE_ANNOTATION_PROCESSOR_SEM && use_annotation_processor $AnnotationProcessor)
  420. }
  421. # tag:java-specific
  422. macro _NOOP_MACRO(Args...) {
  423. ENABLE(UNUSED_MACRO)
  424. }
  425. # tag:java-specific
  426. module _JAR_BASE: _BARE_UNIT {
  427. .NODE_TYPE=Bundle
  428. .CMD=TOUCH_UNIT
  429. .PEERDIR_POLICY=as_build_from
  430. .FINAL_TARGET=no
  431. .ALIASES=SRCS=_SRCS_NO_GLOBAL
  432. .ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE
  433. .DEFAULT_NAME_GENERATOR=TwoDirNames
  434. .RESTRICTED=WITH_JDK RESOURCE RESOURCE_FILES
  435. SET(MODULE_TAG JAVA)
  436. PEERDIR_TAGS=JAVA JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__ RESOURCE_LIB
  437. HAS_MANAGEABLE_PEERS=yes
  438. DYNAMIC_LINK=yes
  439. _PROTO_CMDLINE=$_JAVA_PROTO_CMDLINE
  440. _EVLOG_CMDLINE=$_JAVA_EVLOG_CMDLINE
  441. _FBS_CMDLINE=$_JAVA_FLATC_CMDLINE
  442. DISABLE(NEED_PLATFORM_PEERDIRS)
  443. NO_PLATFORM()
  444. VCS_JAVA=${suf=.__vcs_version__.mf:TARGET}
  445. SET(MODULE_LANG JAVA)
  446. _WHEN_EXPORT_GRADLE()
  447. }
  448. JAVA_CONTRIB_PROXY_SEM=IGNORED
  449. # tag:java-specific
  450. module JAVA_CONTRIB_PROXY: _JAR_BASE {
  451. .SEM=JAVA_CONTRIB_PROXY_SEM
  452. _DONT_REQUIRE_LICENSE()
  453. }
  454. # tag:java-specific
  455. macro _FETCH_CONTRIB(Id, Out, SBR="sbr:") {
  456. .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"}
  457. ADD_CHECK(check.resource $Id)
  458. }
  459. # tag:java-specific
  460. LOCAL_JAR_PATH=
  461. LOCAL_SOURCES_JAR_PATH=
  462. JAR_RESOURCE_ID=
  463. SRC_RESOURCE_ID=
  464. FETCH_SRCS_JAR=
  465. FETCH_TARGET_JAR=
  466. FETCH_CONTRIB_JAR=${hide:JAVA_FAKEID} $FETCH_TARGET_JAR $FETCH_SRCS_JAR
  467. # tag:java-specific
  468. macro JAR_RESOURCE(Id) {
  469. SET(JAR_RESOURCE_ID $Id)
  470. }
  471. # tag:java-specific
  472. macro SRC_RESOURCE(Id) {
  473. SET(SRC_RESOURCE_ID $Id)
  474. }
  475. # tag:java-specific
  476. macro LOCAL_JAR(File) {
  477. SET(LOCAL_JAR_PATH $File)
  478. }
  479. # tag:java-specific
  480. macro LOCAL_SOURCES_JAR(File) {
  481. SET(LOCAL_SOURCES_JAR_PATH $File)
  482. }
  483. JAVA_CONTRIB_SEM= \
  484. ${hide:TARGET} ${hide:AUTO_INPUT} \
  485. consumer-classpath $EXPORT_GRADLE_CLASSPATH \
  486. && consumer-jar ${MODDIR}/${REALPRJNAME}.jar \
  487. && consumer-type contrib \
  488. $_JAVAC_SEM \
  489. && IGNORED
  490. # tag:java-specific
  491. module JAVA_CONTRIB: _JAR_BASE {
  492. .CMD=FETCH_CONTRIB_JAR
  493. .PEERDIR_POLICY=as_include
  494. .SEM=JAVA_CONTRIB_SEM
  495. .FINAL_TARGET=yes
  496. .GLOBAL=MAVEN_EXPORT_COORDS
  497. when ($JAR_RESOURCE_ID) {
  498. FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX})
  499. }
  500. otherwise {
  501. when ($LOCAL_JAR_PATH) {
  502. FETCH_TARGET_JAR= && $FS_TOOLS copy ${input:LOCAL_JAR_PATH} $TARGET
  503. }
  504. otherwise {
  505. FETCH_TARGET_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:BINDIR} $JDK_RESOURCE/bin/jar cfvm $TARGET $VCS_JAVA .
  506. PEERDIR+=build/platform/java/jdk
  507. PEERDIR+=$JDK_RESOURCE_PEERDIR
  508. }
  509. }
  510. when ($SRC_RESOURCE_ID) {
  511. FETCH_SRCS_JAR= && $_FETCH_CONTRIB($SRC_RESOURCE_ID ${BINDIR}/${REALPRJNAME}-sources.jar)
  512. }
  513. otherwise {
  514. when ($LOCAL_SOURCES_JAR_PATH) {
  515. FETCH_SRCS_JAR= && $FS_TOOLS copy ${input:LOCAL_SOURCES_JAR_PATH} ${output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME}
  516. }
  517. otherwise {
  518. 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 .
  519. PEERDIR+=build/platform/java/jdk
  520. PEERDIR+=$JDK_RESOURCE_PEERDIR
  521. }
  522. }
  523. when ($MAVEN_EXPORT == "yes") {
  524. _MAKEFILE_INCLUDE_LIKE_DEPS+=pom.xml
  525. FETCH_CONTRIB_JAR+= && $MAVEN_EXPORT_GEN_DEPLST
  526. }
  527. SET(MODULE_SUFFIX .jar)
  528. _SETUP_MAVEN_EXPORT_COORDS_IF_NEED($MODDIR)
  529. }
  530. MAKE_JAVA_CLASSPATH_FILE=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} ${input;hide:"build/scripts/process_command_files.py"}
  531. # tag:kotlin-specific
  532. KOTLINC_OPTS_VALUE=
  533. # tag:kotlin-specific
  534. KT_SRCLIST=${BINDIR}/misc/all-kt-sources.txt
  535. KT_SRSCLIST_FLAG=--kotlin $KT_SRCLIST
  536. KT_CLASSES_DIR=${BINDIR}/kt_cls
  537. KT_CLASSPATH=${BINDIR}/kt_cp.txt
  538. COLLECT_KT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/kt_bfg.txt -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file
  539. LINK_KT_CLASSPATH=${MAKE_JAVA_CLASSPATH_FILE} ${BINDIR}/kt_bfg.txt $KT_CLASSPATH && $FS_TOOLS md $KT_CLASSES_DIR
  540. COMPILE_KT= \
  541. ${cwd:ARCADIA_BUILD_ROOT} ${env:"LC_ALL=en_US.UTF-8"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} \
  542. ${input;hide:"build/scripts/build_java_with_error_prone2.py"} \
  543. ${input;hide:"build/scripts/setup_java_tmpdir.py"} \
  544. --kotlin --sources-list $KT_SRCLIST \
  545. $JDK_RESOURCE/bin/java -jar $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar -no-stdlib -module-name $REALPRJNAME \
  546. -jvm-target ${KOTLIN_JVM_TARGET} @$KT_SRCLIST -classpath @$KT_CLASSPATH $KOTLINC_FLAGS_VALUE -d $KT_CLASSES_DIR $KOTLINC_OPTS_VALUE
  547. ALL_KT_COMMANDS=
  548. KT_CLASSPATH_ITEM=
  549. # tag:kotlin-specific
  550. KT_KAPT_SOURCES_DIR=${BINDIR}/kapt_gen_src
  551. KT_KAPT_STUBS_DIR=${BINDIR}/kapt_gen_stubs
  552. KT_KAPT_AP_CLASSPATH=
  553. KT_KAPT_PLUGIN_OPTS=-P plugin:org.jetbrains.kotlin.kapt3:sources=${KT_KAPT_SOURCES_DIR} -P plugin:org.jetbrains.kotlin.kapt3:classes=${KT_CLASSES_DIR} -P plugin:org.jetbrains.kotlin.kapt3:stubs=${KT_KAPT_STUBS_DIR} -P plugin:org.jetbrains.kotlin.kapt3:aptMode=stubsAndApt
  554. ### @usage: KAPT_OPTS(opts...)
  555. ###
  556. ### Used to specify annotation processor qualified class names.
  557. ### If specified multiple times, only last specification is used.
  558. macro KAPT_OPTS(Args...) {
  559. SET_APPEND(KT_KAPT_PLUGIN_OPTS ${pre=-P :Args})
  560. }
  561. ### @usage: KAPT_ANNOTATION_PROCESSOR(processors...)
  562. ###
  563. ### Used to specify annotation processor qualified class names.
  564. ### If specified multiple times, only last specification is used.
  565. macro KAPT_ANNOTATION_PROCESSOR(Args...) {
  566. KAPT_OPTS(${pre="plugin:org.jetbrains.kotlin.kapt3:processors=":Args})
  567. }
  568. ### @usage: KAPT_ANNOTATION_PROCESSOR_CLASSPATH(jars...)
  569. ###
  570. ### Used to specify classpath for annotation processors.
  571. ### If specified multiple times, all specifications are used.
  572. macro KAPT_ANNOTATION_PROCESSOR_CLASSPATH(Args...) {
  573. PEERDIR($Args)
  574. SET_APPEND(KT_KAPT_AP_CLASSPATH $Args)
  575. }
  576. # tag:java-specific
  577. JAVAC_CMD=$JDK_RESOURCE/bin/javac
  578. RUN_JAVAC_ARGS=
  579. # tag:java-specific tag:codenav
  580. JAVA_YNDEXING=no
  581. # tag:java-specific
  582. when ($USE_SYSTEM_KYTHE) {
  583. KYTHE_RESOURCE=$USE_SYSTEM_KYTHE
  584. }
  585. otherwise {
  586. KYTHE_RESOURCE=$KYTHE_RESOURCE_GLOBAL
  587. }
  588. # tag:java-specific tag:codenav
  589. _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
  590. _DO_JAVA_YNDEXING=
  591. # tag:java-specific
  592. SOURCES_JAR=no
  593. when ($BUILD_TYPE == "DEBUG" && $NO_DEBUGINFO != "yes") {
  594. SOURCES_JAR=yes
  595. }
  596. _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 .
  597. _PACK_SRC_JAR=
  598. # tag:java-specific
  599. _PACK_JNI=
  600. _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
  601. # tag:java-specific
  602. _MAKE_JSTYLE_FILE_LIST=
  603. # tag:java-specific
  604. _LINK_UBERJAR=
  605. _UBERJAR_SELF=
  606. _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_HIDE_INCLUDE_FLAGS} $UBERJAR_PATH_EXCLUDES ${UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG} ${UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS} ${UBERJAR_APPENDING_TRANSFORMER_FLAGS} ${UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG} \
  607. && $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} $BINDIR/_empty/META-INF \
  608. && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} $BINDIR/_empty/META-INF/MANIFEST.MF \
  609. && $UPDATE_VCS_JAVA_INFO_NODEP($TARGET) \
  610. && ${cwd;suf=/_empty:BINDIR} ${JDK_RESOURCE}/bin/jar ufv ${TARGET} META-INF/MANIFEST.MF \
  611. && $JDK_RESOURCE/bin/jar ufvm $TARGET $VCS_JAVA
  612. # tag:java-specific
  613. macro _PACK_JAR_HELPER(Out) {
  614. .CMD=${cwd;suf=/cls:BINDIR} ${env:"LC_ALL=en_US.UTF-8"} $JDK_RESOURCE/bin/jar cfvm $Out $VCS_JAVA .
  615. }
  616. # tag:java-specific
  617. macro _JAVAC_RUN_HELPER(JAVAC_CMD_WITH_ARGS...) {
  618. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${env:"LC_ALL=en_US.UTF-8"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} ${input;hide:"build/scripts/build_java_with_error_prone2.py"} ${input;hide:"build/scripts/setup_java_tmpdir.py"} --with-setup-java-tmpdir --sources-list ${BINDIR}/all-java.srclst ${RUN_JAVAC_ARGS} ${JAVAC_CMD_WITH_ARGS} @${BINDIR}/all-java.srclst -classpath ${ARCADIA_BUILD_ROOT}/bfg.jar -Xpkginfo:always ${JAVAC_OPTS} ${_USE_ANNOTATION_PROCESSOR_OPT} $_JAR_ANN_PROC_OPTS($_JAR_ANN_PROCESSORS) -d ${BINDIR}/cls -g -encoding UTF-8
  619. }
  620. # tag:java-specific
  621. ERROR_PRONE_JDK16PLUS_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
  622. ERROR_PRONE_2_7_1_FORCED_OPTS=-Xep:InlineMeInliner:OFF -Xep:SameNameButDifferent:OFF
  623. # tag:java-specific
  624. macro _ADD_OPTS_IF_NON_EMPTY(Opt, Args...) {
  625. .CMD=${pre=$Opt :Args}
  626. }
  627. macro _ADD_GEN_POM_FROM_COORD_FILES_ARGS(Deps...) {
  628. .CMD=${pre=--deps-coords ;ext=.jar;suf=.mvn_coords:Deps}
  629. }
  630. MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin/mvn
  631. MAVEN_EXPORT_OUT_DIR_FLAG=$_ADD_OPTS_IF_NON_EMPTY(--output-dir ${MAVEN_EXPORT_OUT_DIR})
  632. MAVEN_EXPORT_SOURCE_DIRS=$_ADD_OPTS_IF_NON_EMPTY(--source-dirs ${ALL_SRCDIRS})
  633. MAVEN_EXPORT_DEPS_COORS=$_ADD_GEN_POM_FROM_COORD_FILES_ARGS(${MANAGED_PEERS_CLOSURE})
  634. MAVEN_EXPORT_OUT_DIR=
  635. MAVEN_EXPORT=no
  636. MAVEN_DEPLOY=no
  637. MAVEN_DEPLOY_SOURCES=
  638. MAVEN_EXPORT_VERSION={vcs_revision}
  639. MAVEN_EXPORT_GEN_DEPLST= \
  640. $WRITER_PY \
  641. --file ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mvn_coords:REALPRJNAME} \
  642. --ya-start-command-file -m ${pre=D=:MAVEN_EXPORT_COORDS_GLOBAL} ${pre=E=:EXCLUDED_MAVEN_EXPORT_COORDS_GLOBAL} --ya-end-command-file \
  643. ${hide:APPLIED_EXCLUDES}
  644. MAVEN_EXPORT_GEN_POM=${kv;hide:"mvn_export yes"} \
  645. $YMAKE_PYTHON ${input:"build/scripts/generate_pom.py"} \
  646. --from-coord-files \
  647. --vcs-info $(VCS)/vcs.json \
  648. --target-path $MODDIR \
  649. $MAVEN_EXPORT_SOURCE_DIRS \
  650. $MAVEN_EXPORT_DEPS_COORS \
  651. $MAVEN_EXPORT_OUT_DIR_FLAG \
  652. --target-coords ${suf=.mvn_coords:TARGET} \
  653. --pom-path ${output:"pom.xml"}
  654. MAVEN_DEPLOY_CMD=$YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} $MAVEN_BIN \
  655. deploy:deploy-file -DpomFile=$BINDIR/pom.xml \
  656. -Dfile=$TARGET -DrepositoryId=$MAVEN_REPO_ID -Durl=$MAVEN_REPO_URL -Djava.net.preferIPv4Addresses=false -Djava.net.preferIPv6Addresses=true \
  657. ${MAVEN_DEPLOY_SOURCES} \
  658. $_ADD_OPTS_IF_NON_EMPTY(-gs $MAVEN_EXPORT_SETTINGS) \
  659. $_ADD_OPTS_IF_NON_EMPTY(-s $MAVEN_EXPORT_SETTINGS)
  660. MAVEN_EXPORT_CMD=
  661. # tag:java-specific
  662. JAVA_COVERAGE_SRCLIST_FLAG=--coverage ${output;pre=${MODULE_PREFIX};suf=.cpsf:REALPRJNAME} --source-root ${ARCADIA_ROOT}
  663. JAVA_COVERAGE_SRCLIST=
  664. PREPARE_JAVA_BUILD_DIRS=$FS_TOOLS md ${BINDIR}/cls && $FS_TOOLS md ${BINDIR}/misc
  665. EXTRACT_GENDIRS=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --unpack --ext .gentar ${ext=.gentar:AUTO_INPUT}
  666. COLLECT_JAVA_SRCLIST=${YMAKE_PYTHON} ${input:"build/scripts/make_java_srclists.py"} ${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/java_pack_to_file.py"} --moddir ${CURDIR} --java ${BINDIR}/all-java.srclst ${KT_SRSCLIST} ${JAVA_COVERAGE_SRCLIST} --ya-start-command-file ${ALL_JAR_SOURCES} ${ext=.java:AUTO_INPUT} ${ext=.kt:AUTO_INPUT} --ya-end-command-file
  667. COLLECT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/bfg.txt -m --ya-start-command-file ${rootrel:MANAGED_PEERS_CLOSURE} $KT_CLASSPATH_ITEM --ya-end-command-file
  668. LINK_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/bfg.txt ${ARCADIA_BUILD_ROOT}/bfg.jar
  669. COMPILE_JAVA_SRCLIST=$_JAVAC_RUN_HELPER($JAVAC_CMD)
  670. PACK_JAR=$_PACK_JAR_HELPER($TARGET)
  671. # NOTE: No && before LINK_JAR_RESOURCES, ALL_KT_COMMANDS and JAR_GEN_SRCS needed since those vars either empty or starts with &&
  672. LINK_JAR=${hide:JAVA_FAKEID} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"} \
  673. $PREPARE_JAVA_BUILD_DIRS \
  674. && $EXTRACT_GENDIRS \
  675. && $COLLECT_JAVA_SRCLIST \
  676. $JAR_GEN_SRCS \
  677. $ALL_KT_COMMANDS \
  678. && $COLLECT_CLASSPATH \
  679. && $LINK_CLASSPATH \
  680. && $COMPILE_JAVA_SRCLIST \
  681. $LINK_JAR_RESOURCES \
  682. && ${cwd;suf=/cls:BINDIR} $GENERATE_VCS_JAVA_INFO_NODEP . \
  683. $_PACK_SRC_JAR \
  684. $_PACK_JNI \
  685. && $PACK_JAR \
  686. $_DO_JAVA_YNDEXING \
  687. $_MAKE_JSTYLE_FILE_LIST \
  688. $_LINK_UBERJAR \
  689. $MAVEN_EXPORT_CMD \
  690. $_ADD_HIDDEN_INPUTS($JAVA_EXTERNAL_DEPENDENCIES_VALUE)
  691. # tag:java-specific
  692. _EXT_SRC_JAR=
  693. _EXT_JAR=
  694. _COPY_EXT_SRC_JAR= && $FS_TOOLS md ${BINDIR}/empty && ${cwd;suf=/empty:BINDIR} $JDK_RESOURCE/bin/jar cfvM ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME} .
  695. _DO_USE_EXT_JAR=${hide:JAVA_FAKEID} $FS_TOOLS copy ${input:_EXT_JAR} $TARGET $_COPY_EXT_SRC_JAR $MAVEN_EXPORT_CMD
  696. _DO_COPY_EXT_SRC_JAR= && $FS_TOOLS copy $_EXT_SRC_JAR ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
  697. macro JAVA_RESOURCE(JAR, SOURCES="") {
  698. SET(_EXT_SRC_JAR $SOURCES)
  699. SET(_EXT_JAR $JAR)
  700. }
  701. # tag:java-specific tag:fbs
  702. JAVA_FLATBUFFERS_VERSION = 24.3.25
  703. _KOTLIN_ALLOWED_VERSIONS = contrib/java/org/jetbrains/kotlin/kotlin-allopen/${_KOTLIN_VERSION} \
  704. contrib/java/org/jetbrains/kotlin/kotlin-allopen-compiler-plugin/${_KOTLIN_VERSION} \
  705. contrib/java/org/jetbrains/kotlin/kotlin-annotation-processing/${_KOTLIN_VERSION} \
  706. contrib/java/org/jetbrains/kotlin/kotlin-compiler/${_KOTLIN_VERSION} \
  707. contrib/java/org/jetbrains/kotlin/kotlin-compiler-embeddable/${_KOTLIN_VERSION} \
  708. contrib/java/org/jetbrains/kotlin/kotlin-daemon-client/${_KOTLIN_VERSION} \
  709. contrib/java/org/jetbrains/kotlin/kotlin-daemon-embeddable/${_KOTLIN_VERSION} \
  710. contrib/java/org/jetbrains/kotlin/kotlin-gradle-plugin-api/${_KOTLIN_VERSION} \
  711. contrib/java/org/jetbrains/kotlin/kotlin-gradle-plugin-model/${_KOTLIN_VERSION} \
  712. contrib/java/org/jetbrains/kotlin/kotlin-lombok-compiler-plugin/${_KOTLIN_VERSION} \
  713. contrib/java/org/jetbrains/kotlin/kotlin-main-kts/${_KOTLIN_VERSION} \
  714. contrib/java/org/jetbrains/kotlin/kotlin-maven-allopen/${_KOTLIN_VERSION} \
  715. contrib/java/org/jetbrains/kotlin/kotlin-maven-lombok/${_KOTLIN_VERSION} \
  716. contrib/java/org/jetbrains/kotlin/kotlin-maven-noarg/${_KOTLIN_VERSION} \
  717. contrib/java/org/jetbrains/kotlin/kotlin-maven-serialization/${_KOTLIN_VERSION} \
  718. contrib/java/org/jetbrains/kotlin/kotlin-noarg-compiler-plugin/${_KOTLIN_VERSION} \
  719. contrib/java/org/jetbrains/kotlin/kotlin-osgi-bundle/${_KOTLIN_VERSION} \
  720. contrib/java/org/jetbrains/kotlin/kotlin-reflect/${_KOTLIN_VERSION} \
  721. contrib/java/org/jetbrains/kotlin/kotlin-scripting-common/${_KOTLIN_VERSION} \
  722. contrib/java/org/jetbrains/kotlin/kotlin-scripting-compiler-embeddable/${_KOTLIN_VERSION} \
  723. contrib/java/org/jetbrains/kotlin/kotlin-scripting-compiler-impl-embeddable/${_KOTLIN_VERSION} \
  724. contrib/java/org/jetbrains/kotlin/kotlin-scripting-ide-services/${_KOTLIN_VERSION} \
  725. contrib/java/org/jetbrains/kotlin/kotlin-scripting-jsr223/${_KOTLIN_VERSION} \
  726. contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm/${_KOTLIN_VERSION} \
  727. contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm-host/${_KOTLIN_VERSION} \
  728. contrib/java/org/jetbrains/kotlin/kotlin-script-runtime/${_KOTLIN_VERSION} \
  729. contrib/java/org/jetbrains/kotlin/kotlin-script-util/${_KOTLIN_VERSION} \
  730. contrib/java/org/jetbrains/kotlin/kotlin-serialization-compiler-plugin/${_KOTLIN_VERSION} \
  731. contrib/java/org/jetbrains/kotlin/kotlin-stdlib/${_KOTLIN_VERSION} \
  732. contrib/java/org/jetbrains/kotlin/kotlin-stdlib-common/${_KOTLIN_VERSION} \
  733. contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk7/${_KOTLIN_VERSION} \
  734. contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${_KOTLIN_VERSION} \
  735. contrib/java/org/jetbrains/kotlin/kotlin-stdlib-js/${_KOTLIN_VERSION} \
  736. contrib/java/org/jetbrains/kotlin/kotlin-test/${_KOTLIN_VERSION} \
  737. contrib/java/org/jetbrains/kotlin/kotlin-test-annotations-common/${_KOTLIN_VERSION} \
  738. contrib/java/org/jetbrains/kotlin/kotlin-test-common/${_KOTLIN_VERSION} \
  739. contrib/java/org/jetbrains/kotlin/kotlin-test-js/${_KOTLIN_VERSION} \
  740. contrib/java/org/jetbrains/kotlin/kotlin-test-junit/${_KOTLIN_VERSION} \
  741. contrib/java/org/jetbrains/kotlin/kotlin-test-junit5/${_KOTLIN_VERSION} \
  742. contrib/java/org/jetbrains/kotlin/kotlin-test-testng/${_KOTLIN_VERSION}
  743. # tag:java-specific
  744. module _COMPILABLE_JAR_BASE : _JAR_BASE {
  745. _GHOST_PEERDIR($_FORCED_DEPENDENCY_MANAGEMENT_VALUE)
  746. # flatbuffers-java
  747. DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  748. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
  749. # protobuf-java
  750. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  751. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
  752. # protobuf-javalite
  753. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  754. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
  755. # protobuf-java-util
  756. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
  757. 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})
  758. # protobuf-kotlin
  759. DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION})
  760. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-kotlin EXCEPT contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION})
  761. # kotlin
  762. DEPENDENCY_MANAGEMENT($_KOTLIN_ALLOWED_VERSIONS)
  763. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-stdlib EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-stdlib/${_KOTLIN_VERSION})
  764. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk7 EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk7/${_KOTLIN_VERSION})
  765. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8 EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${_KOTLIN_VERSION})
  766. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-stdlib-js EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-stdlib-js/${_KOTLIN_VERSION})
  767. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-stdlib-common EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-stdlib-common/${_KOTLIN_VERSION})
  768. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-reflect EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-reflect/${_KOTLIN_VERSION})
  769. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-osgi-bundle EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-osgi-bundle/${_KOTLIN_VERSION})
  770. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test/${_KOTLIN_VERSION})
  771. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-junit EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-junit/${_KOTLIN_VERSION})
  772. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-junit5 EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-junit5/${_KOTLIN_VERSION})
  773. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-testng EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-testng/${_KOTLIN_VERSION})
  774. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-js EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-js/${_KOTLIN_VERSION})
  775. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-common EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-common/${_KOTLIN_VERSION})
  776. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-annotations-common EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-annotations-common/${_KOTLIN_VERSION})
  777. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-main-kts EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-main-kts/${_KOTLIN_VERSION})
  778. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-script-runtime EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-script-runtime/${_KOTLIN_VERSION})
  779. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-script-util EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-script-util/${_KOTLIN_VERSION})
  780. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-scripting-common EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-scripting-common/${_KOTLIN_VERSION})
  781. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-scripting-jsr223 EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-scripting-jsr223/${_KOTLIN_VERSION})
  782. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm/${_KOTLIN_VERSION})
  783. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm-host EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm-host/${_KOTLIN_VERSION})
  784. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-scripting-ide-services EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-scripting-ide-services/${_KOTLIN_VERSION})
  785. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-compiler EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-compiler/${_KOTLIN_VERSION})
  786. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-compiler-embeddable EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-compiler-embeddable/${_KOTLIN_VERSION})
  787. CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-daemon-client EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-daemon-client/${_KOTLIN_VERSION})
  788. }
  789. _JAR_MAIN_CLASS=
  790. macro JAR_MAIN_CLASS(Class) {
  791. SET(_JAR_MAIN_CLASS ${Class})
  792. }
  793. _JAR_MAIN_SEM=
  794. _ADD_JAR_MAIN_SEM= && app_main_class ${_JAR_MAIN_CLASS}
  795. GRADLE_EXPORT_PUBLISHING=no
  796. _GRADLE_EXPORT_PUBLISHING_SEM=
  797. PUBLISH_MAVEN_VERSION=no
  798. _DO_GRADLE_EXPORT_PUBLISHING_SEM= \
  799. && publish \
  800. && publish_group $MAVEN_EXPORT_GROUP_ID \
  801. && publish_version $PUBLISH_MAVEN_VERSION
  802. BUILD_JAR_SEM= \
  803. ${hide:TARGET} ${hide:AUTO_INPUT} ${hide:APPLIED_EXCLUDES} \
  804. jar $MODDIR $REALPRJNAME \
  805. && consumer-classpath $EXPORT_GRADLE_CLASSPATH \
  806. && consumer-jar ${MODDIR}/${REALPRJNAME}.jar \
  807. && consumer-type library \
  808. $_JAVAC_SEM \
  809. $_KOTLIN_SEM \
  810. $_JAR_MAIN_SEM \
  811. $_GRADLE_EXPORT_PUBLISHING_SEM \
  812. $_ANN_PROCESSORS_SEM \
  813. $_USE_ANNOTATION_PROCESSOR_SEM \
  814. $_ENABLE_PREVIEW_SEM \
  815. $SEM_JAR_SOURCE_SET
  816. BUILD_PROTO_JAR_SEM= \
  817. ${hide:target} ${hide:AUTO_INPUT} \
  818. jar_proto $MODDIR $REALPRJNAME \
  819. $_JAVA_PROTO_SEM \
  820. && consumer-classpath $EXPORT_GRADLE_CLASSPATH \
  821. && consumer-jar ${MODDIR}/${REALPRJNAME}.jar \
  822. && consumer-type library \
  823. $_JAVAC_SEM \
  824. $_ANN_PROCESSORS_SEM \
  825. $_USE_ANNOTATION_PROCESSOR_SEM \
  826. $_ENABLE_PREVIEW_SEM \
  827. $_KOTLIN_SEM
  828. # tag:java-specific tag:internal
  829. ### @usage: JAR_LIBRARY() #internal
  830. ###
  831. ### Reimplementation of the JAVA_LIBRARY with ymake.core.conf and ymake based dependency management
  832. module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
  833. .EXTS=.jsrc .java .jar .mf .gentar .kt
  834. .CMD=LINK_JAR
  835. .SEM=BUILD_JAR_SEM
  836. .FINAL_TARGET=yes
  837. .ALIASES=JAVA_SRCS=FULL_JAVA_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
  838. .RESTRICTED=EXTERNAL_JAR
  839. .GLOBAL=MAVEN_EXPORT_COORDS
  840. MODULE_SUFFIX=.jar
  841. PEERDIR(build/platform/java/jdk)
  842. PEERDIR+=$JDK_RESOURCE_PEERDIR
  843. when ($_EXT_SRC_JAR) {
  844. _COPY_EXT_SRC_JAR=_DO_COPY_EXT_SRC_JAR
  845. }
  846. when ($_EXT_JAR) {
  847. LINK_JAR=$_DO_USE_EXT_JAR
  848. }
  849. when ($OPENSOURCE_EXPORT == "no") {
  850. BUILD_JAR_SEM=IGNORED
  851. }
  852. when ($_JAR_MAIN_CLASS) {
  853. _JAR_MAIN_SEM=$_ADD_JAR_MAIN_SEM
  854. }
  855. when ($GRADLE_EXPORT_PUBLISHING == "yes") {
  856. _GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
  857. }
  858. # in the ideal world this statement must be under condition bellow
  859. DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${_KOTLIN_VERSION})
  860. when ($WITH_KOTLIN_VALUE) {
  861. KT_SRSCLIST=$KT_SRSCLIST_FLAG
  862. _MAKE_LINT_KT_FILES_LIST = $YMAKE_PYTHON ${input:"build/scripts/kt_copy.py"} $KT_SRCLIST ${output;noauto:"all-kt-sources.txt"} $(SOURCE_ROOT) $(BUILD_ROOT)
  863. ALL_KT_COMMANDS=&& $COLLECT_KT_CLASSPATH && $LINK_KT_CLASSPATH
  864. when ($WITH_KAPT_VALUE == "yes") {
  865. # For Kapt usage see: https://kotlinlang.org/docs/kapt.html#using-in-cli
  866. # See for kapt.kotlin.generated: https://github.com/JetBrains/kotlin/blob/master/plugins/kapt3/kapt3-cli/testData/integration/kotlinFileGeneration/build.txt
  867. _KAPT_OPTS=-Xplugin=${tool:"contrib/java/org/jetbrains/kotlin/kotlin-annotation-processing/1.9.24"} $KT_KAPT_PLUGIN_OPTS
  868. _RUN_KAPT=${YMAKE_PYTHON} ${input:"build/scripts/with_kapt_args.py"} ${pre=--ap-classpath :KT_KAPT_AP_CLASSPATH} -- $COMPILE_KT $_KAPT_OPTS
  869. _APPEND_KAPT_GENERATED_SRCS=$YMAKE_PYTHON ${input:"build/scripts/resolve_java_srcs.py"} -d $KT_KAPT_SOURCES_DIR --include-patterns '**/*.java' '**/*.kt' --resolve-kotlin --append -s ${BINDIR}/all-java.srclst -k $KT_SRCLIST -r ${BINDIR}/not-used.txt
  870. ALL_KT_COMMANDS+=&& $_RUN_KAPT && $_APPEND_KAPT_GENERATED_SRCS
  871. }
  872. ALL_KT_COMMANDS+=&& $COMPILE_KT && $_MAKE_LINT_KT_FILES_LIST
  873. LINK_JAR_RESOURCES+=&& $FS_TOOLS copy_all_files ${KT_CLASSES_DIR} ${BINDIR}/cls
  874. PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
  875. when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
  876. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
  877. }
  878. when($WITH_KOTLINC_PLUGIN_LOMBOK) {
  879. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-lombok-plugin.jar
  880. }
  881. when($WITH_KOTLINC_PLUGIN_NOARG) {
  882. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
  883. }
  884. when($WITH_KOTLINC_PLUGIN_SERIALIZATION) {
  885. KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-serialization-plugin.jar
  886. }
  887. # Must be in sync with KT_CLASSES_DIR!
  888. # There are problems in JDK13 with abs paths in classpath baked into jar file manifest. Using relative path
  889. # here assumes that jar file with classpath for javac located in the $ARCADIA_BUILD_ROOT
  890. KT_CLASSPATH_ITEM=$MODDIR/kt_cls
  891. }
  892. otherwise {
  893. KT_SRSCLIST=
  894. ALL_KT_COMMANDS=
  895. KT_CLASSES=
  896. }
  897. when ($MAVEN_EXPORT == "yes") {
  898. when ($MAVEN_DEPLOY == "yes") {
  899. PEERDIR+=build/external_resources/maven
  900. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM && $MAVEN_DEPLOY_CMD
  901. }
  902. otherwise {
  903. MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM
  904. }
  905. MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GROUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
  906. }
  907. when ($SOURCES_JAR == "yes") {
  908. _PACK_SRC_JAR=$_PACK_SRC_JAR_IMPL
  909. MAVEN_DEPLOY_SOURCES=-Dsources=${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
  910. }
  911. when ($JAVA_COVERAGE == "yes") {
  912. JAVA_COVERAGE_SRCLIST=$JAVA_COVERAGE_SRCLIST_FLAG
  913. }
  914. when ($MAKE_UBERJAR_VALUE == "yes") {
  915. _LINK_UBERJAR=$_DO_LINK_UBERJAR
  916. PACK_JAR=$_PACK_JAR_HELPER(${BINDIR}/${REALPRJNAME}.lib.jar)
  917. # TODO: This condition is incorrect in case of autoinputs _UBERJAR_SELF should be empty only for
  918. # modules without AUTO_INPUT and without JAVA_SRCS added inputs.
  919. when($ALL_JAR_SOURCES) {
  920. _UBERJAR_SELF=--jar ${BINDIR}/${REALPRJNAME}.lib.jar
  921. }
  922. PEERDIR+=build/platform/java/uberjar
  923. PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
  924. }
  925. when($JAVA_YNDEXING == "yes") {
  926. PEERDIR+=build/platform/java/kythe
  927. _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"}
  928. }
  929. when($ERROR_PRONE_VALUE) {
  930. PEERDIR+=$ERROR_PRONE_PEERDIR
  931. RUN_JAVAC_ARGS=--error-prone $ERROR_PRONE_RESOURCE/error_prone.jar
  932. }
  933. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "17") {
  934. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16PLUS_ADD_OPENS
  935. JAVAC_OPTS+=$ERROR_PRONE_JDK16PLUS_ADD_OPENS
  936. }
  937. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "20") {
  938. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16PLUS_ADD_OPENS
  939. JAVAC_OPTS+=$ERROR_PRONE_JDK16PLUS_ADD_OPENS
  940. }
  941. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "21") {
  942. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16PLUS_ADD_OPENS
  943. JAVAC_OPTS+=$ERROR_PRONE_JDK16PLUS_ADD_OPENS
  944. }
  945. when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "22") {
  946. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16PLUS_ADD_OPENS
  947. JAVAC_OPTS+=$ERROR_PRONE_JDK16PLUS_ADD_OPENS
  948. }
  949. when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
  950. JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  951. JAVAC_OPTS+=$ERROR_PRONE_2_7_1_FORCED_OPTS
  952. }
  953. when ($JAVA_ADD_DLLS_VALUE == "yes") {
  954. CONSUME_NON_MANAGEABLE_PEERS=yes
  955. _PACK_JNI=$_PACK_JNI_CMD
  956. }
  957. when ($LINT_LEVEL_VALUE != "none") {
  958. _MAKE_JSTYLE_FILE_LIST= && ${WRITER_PY} --file ${output;noauto:"lint-java.srclst"} -m --ya-start-command-file $LINT_JAVA_SOURCES --ya-end-command-file
  959. }
  960. SET(MODULE_TYPE JAVA_LIBRARY)
  961. ENABLE(YMAKE_JAVA_TEST)
  962. _ADD_KOTLIN_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/all-kt-sources.txt REQUIREMENTS cpu:2)
  963. _ADD_JAVA_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/lint-java.srclst::$(SOURCE_ROOT))
  964. _ADD_CLASSPATH_CLASH_CHECK()
  965. JAVA_MODULE()
  966. }
  967. # tag:java-specific
  968. _SCRIPTGEN_FLAGS=
  969. macro _GEN_JAVA_SCRIPT_IMPL(Out, Template, Props...) {
  970. .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
  971. }
  972. # tag:java-specific
  973. _GEN_USERSCRIPTS=
  974. macro _ADD_GEN_JAVA_SCRIPT(Out, Template, Props...) {
  975. SET_APPEND(_GEN_USERSCRIPTS && \$_GEN_JAVA_SCRIPT_IMPL($Out $Template $Props))
  976. }
  977. # tag:java-specific
  978. _PACK_JDK=
  979. # tag:java-specific
  980. DO_GEN_JAVA_RUN_SH=
  981. _SOURCE_JARS=
  982. _SOURCE_JARS_CPLIST=
  983. _GEN_JAVA_RUN_SH_OUTPUT=run.sh
  984. when ($HOST_OS_WINDOWS == "yes") {
  985. _GEN_JAVA_RUN_SH_OUTPUT=run.bat
  986. }
  987. GEN_JAVA_RUN_SH=$SCRIPTGEN_RESOURCE_GLOBAL/scriptgen --java $JDK_RESOURCE/bin/java --output ${output:_GEN_JAVA_RUN_SH_OUTPUT} -D GENERATE_DEFAULT_RUNNER=yes -D JAR_NAME=${REALPRJNAME}.jar -D CLASSPATH=${nopath;join;pre="::":MANAGED_PEERS_CLOSURE} -D PROJECT_DIR=${REALPRJNAME} -D JAR_BASENAME=${REALPRJNAME}
  988. GEN_RUN_CP=${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${nopath;qe;pre=$REALPRJNAME/:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET}
  989. 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}
  990. MAKE_JAR_PROGRAM_CPLST=${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} --ya-start-command-file ${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS_CPLIST} --ya-end-command-file
  991. TAR_CLASSPATH= && $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} ${output;pre=$MODULE_PREFIX;suf=.tar:REALPRJNAME} ${cwd;pre=$BINDIR/:REALPRJNAME}
  992. DO_TAR_CLASSPATH=
  993. LINK_JAR_PROGRAM=${hide:JAVA_FAKEID} $FS_TOOLS md ${BINDIR}/${REALPRJNAME} && $COLLECT_JAR_PROGRAM_CP && $DO_GEN_JAVA_RUN_SH && $GEN_RUN_CP && $MAKE_JAR_PROGRAM_CPLST $DO_TAR_CLASSPATH $_GEN_USERSCRIPTS $_PACK_JDK ${kv;hide:"p JP"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  994. # tag:java-specific
  995. # UBERJAR program link command
  996. LINK_UBERJAR_PROGRAM=${hide:JAVA_FAKEID} ${kv;hide:"p UJ"} ${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} $TARGET \
  997. && $FS_TOOLS md ${BINDIR}/${REALPRJNAME} \
  998. && $FS_TOOLS link_or_copy ${BINDIR}/${REALPRJNAME}.jar $TARGET \
  999. && $FS_TOOLS link_or_copy_to_dir --ya-start-command-file ${BINDIR}/${REALPRJNAME}.jar ${ext=.so:MANAGED_PEERS_CLOSURE} ${ext=.dll:MANAGED_PEERS_CLOSURE} ${ext=.dylib:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS} --ya-end-command-file ${BINDIR}/${REALPRJNAME} ${hide;output;ext=.jar;pre=$BINDIR/$REALPRJNAME/:REALPRJNAME} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} \
  1000. $DO_TAR_CLASSPATH \
  1001. $_GEN_USERSCRIPTS \
  1002. $_PACK_JDK
  1003. # tag:java-specific
  1004. RUN_WITH_SOURCES=no
  1005. # TODO jbuild creates tar with all classpath deps by default and some projects rely on this. In ymake build this tar file creation is not needed and should be disabled by default in future
  1006. TARED_CLASSPATH=yes
  1007. _JAR_SRCS_CALLED=no
  1008. # tag:java-specific
  1009. macro _MARK_JAVA_PROG_WITH_SOURCES(Args...) {
  1010. ENABLE(_JAR_SRCS_CALLED)
  1011. }
  1012. # tag:java-specific
  1013. module _JAR_RUNNABLE: _COMPILABLE_JAR_BASE {
  1014. .FINAL_TARGET=yes
  1015. .CMD=LINK_JAR_PROGRAM
  1016. .SEM=IGNORED
  1017. .ALIASES=JAVA_SRCS=_MARK_JAVA_PROG_WITH_SOURCES GENERATE_SCRIPT=_YMAKE_GENERATE_SCRIPT
  1018. .ALLOWED=WITH_JDK
  1019. .PEERDIR_POLICY=as_build_from
  1020. MODULE_SUFFIX=.run.cp.jar
  1021. CONSUME_NON_MANAGEABLE_PEERS=yes
  1022. when ($RUN_WITH_SOURCES == "yes") {
  1023. _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}
  1024. _SOURCE_JARS_CPLIST=${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
  1025. }
  1026. when ($TARED_CLASSPATH == "yes") {
  1027. DO_TAR_CLASSPATH=$TAR_CLASSPATH
  1028. }
  1029. when ($DISABLE_SCRIPTGEN) {
  1030. DO_GEN_JAVA_RUN_SH=
  1031. }
  1032. otherwise {
  1033. DO_GEN_JAVA_RUN_SH=$GEN_JAVA_RUN_SH
  1034. PEERDIR+=build/platform/java/scriptgen
  1035. }
  1036. when ($MAKE_UBERJAR_VALUE == "yes") {
  1037. LINK_JAR_PROGRAM=$LINK_UBERJAR_PROGRAM
  1038. DYNAMIC_LINK=no
  1039. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=yes
  1040. }
  1041. otherwise {
  1042. _SCRIPTGEN_FLAGS=-D IS_UBERJAR=no
  1043. }
  1044. CHECK_PROVIDES()
  1045. }
  1046. # tag:java-specific
  1047. LINK_JAR_TEST=${hide:JAVA_FAKEID} ${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET} ${kv;hide:"p JT"}
  1048. YMAKE_JAVA_TEST=
  1049. module _JAR_TEST: _COMPILABLE_JAR_BASE {
  1050. .FINAL_TARGET=yes
  1051. .CMD=LINK_JAR_TEST
  1052. .DEFAULT_NAME_GENERATOR=FullPath
  1053. CONSUME_NON_MANAGEABLE_PEERS=yes
  1054. SET(MODULE_SUFFIX .test.cp.jar)
  1055. ENABLE(YMAKE_JAVA_TEST)
  1056. JAVA_TEST()
  1057. CHECK_PROVIDES()
  1058. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1059. }
  1060. # tag:java-specific
  1061. JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
  1062. # tag:java-specific
  1063. JDK_REAL_VERSION=
  1064. JDK_VERSION=
  1065. when ($JDK_VERSION == "22") {
  1066. JDK_REAL_VERSION=22
  1067. }
  1068. elsewhen ($JDK_VERSION == "21") {
  1069. JDK_REAL_VERSION=21
  1070. }
  1071. elsewhen ($JDK_VERSION == "20") {
  1072. JDK_REAL_VERSION=20
  1073. }
  1074. elsewhen ($JDK_VERSION == "17") {
  1075. JDK_REAL_VERSION=17
  1076. }
  1077. elsewhen ($JDK_VERSION == "11") {
  1078. JDK_REAL_VERSION=11
  1079. }
  1080. elsewhen ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
  1081. JDK_REAL_VERSION=11
  1082. }
  1083. otherwise {
  1084. JDK_REAL_VERSION=17
  1085. }
  1086. # tag:java-specific
  1087. # remove extra peerdir to jdk11 after https://st.yandex-team.ru/DEVTOOLS-8851 is done
  1088. when ($USE_SYSTEM_JDK) {
  1089. JDK_RESOURCE_PEERDIR=
  1090. }
  1091. otherwise {
  1092. when ($JDK_REAL_VERSION == "22") {
  1093. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk22 build/platform/java/jdk/jdk17
  1094. }
  1095. when ($JDK_REAL_VERSION == "21") {
  1096. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk21 build/platform/java/jdk/jdk17
  1097. }
  1098. when ($JDK_REAL_VERSION == "20") {
  1099. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk20 build/platform/java/jdk/jdk17
  1100. }
  1101. when ($JDK_REAL_VERSION == "17") {
  1102. # need jdk11 for spare parts in "host" platform
  1103. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk17 build/platform/java/jdk/jdk11
  1104. }
  1105. when ($JDK_REAL_VERSION == "11") {
  1106. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk11 build/platform/java/jdk/jdk17
  1107. }
  1108. }
  1109. # tag:java-specific
  1110. when ($JDK_REAL_VERSION == "22") {
  1111. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar22
  1112. }
  1113. when ($JDK_REAL_VERSION == "21") {
  1114. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar21
  1115. }
  1116. when ($JDK_REAL_VERSION == "20") {
  1117. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar20
  1118. }
  1119. when ($JDK_REAL_VERSION == "17") {
  1120. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar17
  1121. }
  1122. when ($JDK_REAL_VERSION == "11") {
  1123. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar11
  1124. }
  1125. # tag:java-specific
  1126. JAVAC_OPTS=
  1127. when ($USE_SYSTEM_JDK) {
  1128. JDK_RESOURCE=$USE_SYSTEM_JDK
  1129. }
  1130. otherwise {
  1131. when ($JDK_REAL_VERSION == "22") {
  1132. JDK_RESOURCE=$JDK22_RESOURCE_GLOBAL
  1133. }
  1134. when ($JDK_REAL_VERSION == "21") {
  1135. JDK_RESOURCE=$JDK21_RESOURCE_GLOBAL
  1136. }
  1137. when ($JDK_REAL_VERSION == "20") {
  1138. JDK_RESOURCE=$JDK20_RESOURCE_GLOBAL
  1139. }
  1140. when ($JDK_REAL_VERSION == "17") {
  1141. JDK_RESOURCE=$JDK17_RESOURCE_GLOBAL
  1142. }
  1143. when ($JDK_REAL_VERSION == "11") {
  1144. JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  1145. }
  1146. }
  1147. # tag:java-specific
  1148. when (!$USE_SYSTEM_ERROR_PRONE) {
  1149. # Still not done: DTCC-667
  1150. when ($JDK_REAL_VERSION == "11") {
  1151. ERROR_PRONE_VERSION=2.7.1
  1152. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.7.1
  1153. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_7_1_RESOURCE_GLOBAL
  1154. }
  1155. elsewhen ($JDK_REAL_VERSION == "17") {
  1156. ERROR_PRONE_VERSION=2.10.0
  1157. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.10.0
  1158. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_10_0_RESOURCE_GLOBAL
  1159. }
  1160. elsewhen ($JDK_REAL_VERSION == "20") {
  1161. ERROR_PRONE_VERSION=2.18.0
  1162. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
  1163. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
  1164. }
  1165. elsewhen ($JDK_REAL_VERSION == "21") {
  1166. ERROR_PRONE_VERSION=2.30.0
  1167. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.30.0
  1168. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_30_0_RESOURCE_GLOBAL
  1169. }
  1170. elsewhen ($JDK_REAL_VERSION == "22") {
  1171. ERROR_PRONE_VERSION=2.30.0
  1172. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.30.0
  1173. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_30_0_RESOURCE_GLOBAL
  1174. }
  1175. otherwise {
  1176. ERROR_PRONE_VERSION=2.7.1
  1177. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  1178. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  1179. }
  1180. }
  1181. otherwise {
  1182. ERROR_PRONE_VERSION=2.7.1
  1183. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  1184. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  1185. }
  1186. # tag:java-specific
  1187. when ($USE_SYSTEM_UBERJAR) {
  1188. UBERJAR_RESOURCE=$USE_SYSTEM_UBERJAR
  1189. }
  1190. otherwise {
  1191. when ($JDK_REAL_VERSION == "22") {
  1192. UBERJAR_RESOURCE=$UBERJAR22_RESOURCE_GLOBAL
  1193. }
  1194. when ($JDK_REAL_VERSION == "21") {
  1195. UBERJAR_RESOURCE=$UBERJAR21_RESOURCE_GLOBAL
  1196. }
  1197. when ($JDK_REAL_VERSION == "20") {
  1198. UBERJAR_RESOURCE=$UBERJAR20_RESOURCE_GLOBAL
  1199. }
  1200. when ($JDK_REAL_VERSION == "17") {
  1201. UBERJAR_RESOURCE=$UBERJAR17_RESOURCE_GLOBAL
  1202. }
  1203. when ($JDK_REAL_VERSION == "11") {
  1204. UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
  1205. }
  1206. }
  1207. # tag:java-specific
  1208. when ($JDK_REAL_VERSION == "22") {
  1209. WITH_JDK_RESOURCE=$WITH_JDK22_RESOURCE_GLOBAL
  1210. }
  1211. when ($JDK_REAL_VERSION == "21") {
  1212. WITH_JDK_RESOURCE=$WITH_JDK21_RESOURCE_GLOBAL
  1213. }
  1214. when ($JDK_REAL_VERSION == "20") {
  1215. WITH_JDK_RESOURCE=$WITH_JDK20_RESOURCE_GLOBAL
  1216. }
  1217. when ($JDK_REAL_VERSION == "17") {
  1218. WITH_JDK_RESOURCE=$WITH_JDK17_RESOURCE_GLOBAL
  1219. }
  1220. when ($JDK_REAL_VERSION == "11") {
  1221. WITH_JDK_RESOURCE=$WITH_JDK11_RESOURCE_GLOBAL
  1222. }
  1223. # tag:java-specific
  1224. EXTERNAL_JAVA_JDK_RESOURCE=
  1225. EXTERNAL_JAVA_EXTRA_PEERDIR=
  1226. when ($USE_SYSTEM_JDK) {
  1227. EXTERNAL_JAVA_EXTRA_PEERDIR=
  1228. EXTERNAL_JAVA_JDK_RESOURCE=$USE_SYSTEM_JDK
  1229. }
  1230. elsewhen ($JDK_VERSION == "") {
  1231. EXTERNAL_JAVA_JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  1232. EXTERNAL_JAVA_EXTRA_PEERDIR=build/platform/java/jdk/jdk11
  1233. }
  1234. otherwise {
  1235. EXTERNAL_JAVA_JDK_RESOURCE=$JDK_RESOURCE
  1236. }
  1237. COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${input:"build/scripts/compile_java.py"} --ya-start-command-file --java-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/java --javac-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/jar --kotlin-compiler $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar $JAVA_VCS_MF_ARG $PACKAGE_PREFIX_ARGS --jar-output $TARGET --srcs-jar-output ${output;suf=-sources.jar:REALPRJNAME} $AUTO_INPUT DELIM $JAVAC_OPTS DELIM $MANAGED_PEERS_CLOSURE DELIM -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} ${KOTLINC_OPTS_VALUE} --ya-end-command-file ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"} ${hide;input:"build/scripts/java_command_file.py"} ${hide;input:"build/scripts/process_command_files.py"}
  1238. ARGS_DELIM="MACRO_CALLS_DELIM"
  1239. SYSTEM_PROPERTIES_VALUE=
  1240. ### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
  1241. ###
  1242. ### List of Key,Value pairs that will be available to test via System.getProperty().
  1243. ### FILE means that parst should be read from file specifies as Path.
  1244. ###
  1245. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1246. macro SYSTEM_PROPERTIES(Args...) {
  1247. SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
  1248. }
  1249. # tag:java-specific
  1250. JVM_ARGS_VALUE=-ea
  1251. ### @usage: JVM_ARGS(Args...)
  1252. ###
  1253. ### Arguments to run Java programs in tests.
  1254. ###
  1255. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1256. macro JVM_ARGS(Args...) {
  1257. SET_APPEND(JVM_ARGS_VALUE $Args)
  1258. }
  1259. # tag:java-specific
  1260. CHECK_JAVA_DEPS_VALUE=
  1261. ### @usage: CHECK_JAVA_DEPS(<yes|no|strict>)
  1262. ###
  1263. ### Check for different classes with duplicate name in classpath.
  1264. ###
  1265. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1266. macro CHECK_JAVA_DEPS(Arg) {
  1267. SET(CHECK_JAVA_DEPS_VALUE $Arg)
  1268. }
  1269. ERROR_PRONE_VALUE=
  1270. ### @usage: USE_ERROR_PRONE()
  1271. ###
  1272. ### Use errorprone instead of javac for .java compilation.
  1273. macro USE_ERROR_PRONE() {
  1274. SET(ERROR_PRONE_VALUE yes)
  1275. }
  1276. # tag:java-specific
  1277. MAKE_UBERJAR_VALUE=
  1278. ### @usage: UBERJAR()
  1279. ###
  1280. ### UBERJAR is a single all-in-one jar-archive that includes all its Java dependencies (reachable PEERDIR).
  1281. ### It also supports shading classes inside the archive by moving them to a different package (similar to the maven-shade-plugin).
  1282. ### Use UBERJAR inside JAVA_PROGRAM module.
  1283. ###
  1284. ### You can use the following macros to configure the archive:
  1285. ### 1. UBERJAR_HIDING_PREFIX prefix for classes to shade (classes remain in their packages by default)
  1286. ### 2. UBERJAR_HIDE_INCLUDE_PATTERN include classes matching this patterns to shading, include LDC mapping
  1287. ### 3. UBERJAR_HIDE_EXCLUDE_PATTERN exclude classes matching this patterns from shading (if enabled).
  1288. ### 4. 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)
  1289. ### 5. UBERJAR_MANIFEST_TRANSFORMER_MAIN add ManifestResourceTransformer class to uberjar processing and specify main-class
  1290. ### 6. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE add ManifestResourceTransformer class to uberjar processing and specify some attribute
  1291. ### 7. UBERJAR_APPENDING_TRANSFORMER add AppendingTransformer class to uberjar processing
  1292. ### 8. UBERJAR_SERVICES_RESOURCE_TRANSFORMER add ServicesResourceTransformer class to uberjar processing
  1293. ###
  1294. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  1295. ###
  1296. ### @see: [JAVA_PROGRAM](#module_JAVA_PROGRAM), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX), [UBERJAR_HIDE_INCLUDE_PATTERN](#macro_UBERJAR_HIDE_INCLUDE_PATTERN) [UBERJAR_HIDE_EXCLUDE_PATTERN](#macro_UBERJAR_HIDE_EXCLUDE_PATTERN), [UBERJAR_PATH_EXCLUDE_PREFIX](#macro_UBERJAR_PATH_EXCLUDE_PREFIX)
  1297. macro UBERJAR() {
  1298. SET(MAKE_UBERJAR_VALUE yes)
  1299. DISABLE(PASS_PEERS)
  1300. }
  1301. # tag:java-specific
  1302. UBERJAR_PREFIX_VALUE=
  1303. UBERJAR_PREFIX_FLAG=
  1304. ### @usage: UBERJAR_HIDING_PREFIX(Arg)
  1305. ###
  1306. ### Set prefix for classes to shade. All classes in UBERJAR will be moved into package prefixed with Arg.
  1307. ### Classes remain in their packages by default.
  1308. ###
  1309. ### @see: [UBERJAR](#macro_UBERJAR)
  1310. macro UBERJAR_HIDING_PREFIX(Arg) {
  1311. SET(UBERJAR_PREFIX_VALUE $Arg)
  1312. SET(UBERJAR_PREFIX_FLAG ${pre=--shade-prefix :Arg})
  1313. }
  1314. # tag:java-specific
  1315. UBERJAR_HIDE_EXCLUDE_VALUE=
  1316. UBERJAR_HIDE_EXCLUDE_FLAGS=
  1317. ### @usage: UBERJAR_HIDE_EXCLUDE_PATTERN(Args...)
  1318. ###
  1319. ### Exclude classes matching this patterns from shading (if enabled).
  1320. ### Pattern may contain '*' and '**' globs.
  1321. ### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
  1322. ###
  1323. ### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
  1324. macro UBERJAR_HIDE_EXCLUDE_PATTERN(Args...) {
  1325. SET_APPEND(UBERJAR_HIDE_EXCLUDE_VALUE $ARGS_DELIM $Args)
  1326. SET_APPEND(UBERJAR_HIDE_EXCLUDE_FLAGS ${pre=--shade-exclude :Args})
  1327. }
  1328. UBERJAR_HIDE_INCLUDE_VALUE=
  1329. UBERJAR_HIDE_INCLUDE_FLAGS=
  1330. ### @usage: UBERJAR_HIDE_INCLUDE_PATTERN(Args...)
  1331. ###
  1332. ### Include classes matching this patterns to shading, enabled LDC processing.
  1333. ### Pattern may contain '*' and '**' globs.
  1334. ### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
  1335. ###
  1336. ### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
  1337. macro UBERJAR_HIDE_INCLUDE_PATTERN(Args...) {
  1338. SET_APPEND(UBERJAR_HIDE_INCLUDE_VALUE $ARGS_DELIM $Args)
  1339. SET_APPEND(UBERJAR_HIDE_INCLUDE_FLAGS ${pre=--shade-include :Args})
  1340. }
  1341. # tag:java-specific
  1342. UBERJAR_PATH_EXCLUDES=
  1343. UBERJAR_PATH_EXCLUDE_VALUE=
  1344. ### @usage: UBERJAR_PATH_EXCLUDE_PREFIX(Args...)
  1345. ###
  1346. ### Exclude classes matching this patterns from UBERJAR.
  1347. ### By default all dependencies of UBERJAR program will lend in a .jar archive.
  1348. ###
  1349. ### @see: [UBERJAR](#macro_UBERJAR)
  1350. macro UBERJAR_PATH_EXCLUDE_PREFIX(Args...) {
  1351. SET_APPEND(UBERJAR_PATH_EXCLUDE_VALUE $ARGS_DELIM $Args)
  1352. SET_APPEND(UBERJAR_PATH_EXCLUDES ${pre=--uber-exclude :Args})
  1353. }
  1354. # tag:java-specific
  1355. UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE=
  1356. UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG=
  1357. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main)
  1358. ###
  1359. ### Transform manifest.mf for UBERJAR() java programs, set main-class attribute
  1360. ###
  1361. ### @see: [UBERJAR](#macro_UBERJAR)
  1362. macro UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main) {
  1363. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE $Main)
  1364. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG --manifest-main $Main)
  1365. }
  1366. # tag:java-specific
  1367. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE=
  1368. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS=
  1369. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value)
  1370. ###
  1371. ### Transform manifest.mf for UBERJAR() java programs, set attribute
  1372. ###
  1373. ### @see: [UBERJAR](#macro_UBERJAR)
  1374. macro UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Values...) {
  1375. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Values)
  1376. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:'${Values}')
  1377. }
  1378. # tag:java-specific
  1379. UBERJAR_APPENDING_TRANSFORMER_VALUE=
  1380. UBERJAR_APPENDING_TRANSFORMER_FLAGS=
  1381. ### @usage: UBERJAR_APPENDING_TRANSFORMER(Resource)
  1382. ###
  1383. ### Add AppendingTransformer for UBERJAR() java programs
  1384. ###
  1385. ### Parameters:
  1386. ### - Resource - Resource name
  1387. ###
  1388. ### @see: [UBERJAR](#macro_UBERJAR)
  1389. macro UBERJAR_APPENDING_TRANSFORMER(Resources...) {
  1390. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_VALUE $ARGS_DELIM $Resources)
  1391. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_FLAGS ${pre=--append-transformer :Resources})
  1392. }
  1393. # tag:java-specific
  1394. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE=
  1395. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG=
  1396. ### @usage: UBERJAR_SERVICES_RESOURCE_TRANSFORMER()
  1397. ###
  1398. ### Add ServicesResourceTransformer for UBERJAR() java programs
  1399. ###
  1400. ### @see: [UBERJAR](#macro_UBERJAR)
  1401. macro UBERJAR_SERVICES_RESOURCE_TRANSFORMER() {
  1402. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE yes)
  1403. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG --service-transformer)
  1404. }
  1405. # tag:idea-specific
  1406. IDEA_EXCLUDE_DIRS_VALUE=
  1407. ### @usage: IDEA_EXCLUDE_DIRS(<excluded dirs>)
  1408. ###
  1409. ### Exclude specified directories from an idea project generated by ya ide idea
  1410. ### Have no effect on regular build.
  1411. macro IDEA_EXCLUDE_DIRS(Args...) {
  1412. SET_APPEND(IDEA_EXCLUDE_DIRS_VALUE $Args)
  1413. }
  1414. # tag:idea-specific
  1415. IDEA_RESOURCE_DIRS_VALUE=
  1416. ### @usage: IDEA_RESOURCE_DIRS(<additional dirs>)
  1417. ###
  1418. ### Set specified resource directories in an idea project generated by ya ide idea
  1419. ### Have no effect on regular build.
  1420. macro IDEA_RESOURCE_DIRS(Args...) {
  1421. SET_APPEND(IDEA_RESOURCE_DIRS_VALUE $Args)
  1422. }
  1423. # tag:idea-specific
  1424. IDEA_MODULE_NAME_VALUE=
  1425. ### @usage: IDEA_MODULE_NAME(module_name)
  1426. ###
  1427. ### Set module name in an idea project generated by ya ide idea
  1428. ### Have no effect on regular build.
  1429. macro IDEA_MODULE_NAME(Name) {
  1430. SET(IDEA_MODULE_NAME_VALUE $Name)
  1431. }
  1432. # tag:java-specific
  1433. JAVAC_FLAGS_VALUE=
  1434. _JAVAC_SEM=
  1435. ### @usage: JAVAC_FLAGS(Args...)
  1436. ###
  1437. ### Set additional Java compilation flags.
  1438. macro JAVAC_FLAGS(Args...) {
  1439. SET_APPEND(JAVAC_OPTS $Args)
  1440. SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
  1441. SET_APPEND(_JAVAC_SEM && javac-flags $Args)
  1442. }
  1443. # tag:java-specific
  1444. ENABLE_PREVIEW_VALUE=
  1445. _ENABLE_PREVIEW_SEM=
  1446. ### @usage: ENABLE_PREVIEW()
  1447. ###
  1448. ### Enable java preview features.
  1449. macro ENABLE_PREVIEW() {
  1450. SET_APPEND(JVM_ARGS_VALUE --enable-preview)
  1451. SET_APPEND(JAVAC_OPTS --enable-preview --release $JDK_REAL_VERSION)
  1452. SET_APPEND(JAVAC_FLAGS_VALUE --enable-preview --release $JDK_REAL_VERSION)
  1453. SET(ENABLE_PREVIEW_VALUE yes)
  1454. SET(_ENABLE_PREVIEW_SEM && enable_preview)
  1455. }
  1456. # tag:java-specific
  1457. SAVE_JAVAC_GENERATED_SRCS=
  1458. SAVE_JAVAC_GENERATED_SRCS_DIR=
  1459. SAVE_JAVAC_GENERATED_SRCS_TAR=
  1460. when ($SAVE_JAVAC_GENERATED_SRCS) {
  1461. SAVE_JAVAC_GENERATED_SRCS_DIR=${BINDIR}/__javac_generated_srcs__
  1462. SAVE_JAVAC_GENERATED_SRCS_TAR=${BINDIR}/javac_generated.tar
  1463. JAVAC_FLAGS_VALUE+=-s $SAVE_JAVAC_GENERATED_SRCS_DIR
  1464. }
  1465. # tag:java-specific
  1466. # TODO: MAVEN_GROUP_ID_VALUE is only used by jbuild remove it after YMAKE-45 and YMAKE-46
  1467. MAVEN_GROUP_ID_VALUE=
  1468. MAVEN_EXPORT_GROUP_ID=ru.yandex
  1469. ### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
  1470. ###
  1471. ### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
  1472. ### Have no effect on regular build.
  1473. macro MAVEN_GROUP_ID(Arg, VERSION="no") {
  1474. SET(MAVEN_GROUP_ID_VALUE $Arg)
  1475. SET(MAVEN_EXPORT_GROUP_ID $Arg)
  1476. SET(PUBLISH_MAVEN_VERSION $VERSION)
  1477. }
  1478. # tag:java-specific
  1479. ANNOTATION_PROCESSOR_VALUE=
  1480. ### @usage: ANNOTATION_PROCESSOR(processors...)
  1481. ###
  1482. ### The macro is in development.
  1483. ### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
  1484. macro ANNOTATION_PROCESSOR(Args...) {
  1485. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Args)
  1486. }
  1487. EXCLUDE_VALUE=
  1488. ### EXCLUDE(prefixes)
  1489. ###
  1490. ### Specifies which libraries should be excluded from the classpath.
  1491. macro EXCLUDE(Args...) {
  1492. SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args)
  1493. }
  1494. # tag:java-specific
  1495. JAVA_SRCS_VALUE=
  1496. ### Fill JAVA_SRCS_VALUE for ya ide idea, skip SKIP_CHECK_SRCDIR option
  1497. macro _IDEA_JAVA_SRCS_VALUE(RESOURCES?"RESOURCES":"", SKIP_CHECK_SRCDIR?"SKIP_CHECK_SRCDIR":"", Args...) {
  1498. # RESOURCES must be at first position, else ya ide idea will fault
  1499. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $RESOURCES $Args)
  1500. }
  1501. ### @usage: JAVA_SRCS(srcs)
  1502. ###
  1503. ### Specify java source files and resources. A macro can be contained in any of four java modules.
  1504. ### Keywords:
  1505. ### 1. SRCDIR x - 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.
  1506. ### 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.
  1507. ###
  1508. ### @example:
  1509. ### - example/ya.make
  1510. ###
  1511. ### JAVA_PROGRAM()
  1512. ### JAVA_SRCS(SRCDIR src/main/java **/*)
  1513. ### END()
  1514. ###
  1515. ### - example/src/main/java/ru/yandex/example/HelloWorld.java
  1516. ###
  1517. ### package ru.yandex.example;
  1518. ### public class HelloWorld {
  1519. ### public static void main(String[] args) {
  1520. ### System.out.println("Hello, World!");
  1521. ### }
  1522. ### }
  1523. ###
  1524. ### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
  1525. macro JAVA_SRCS(Args...) {
  1526. # TODO Use FULL_JAVA_SRCS
  1527. _IDEA_JAVA_SRCS_VALUE($Args)
  1528. # Fill semantic for non-standard sources/resources
  1529. _SEM_JAR_SOURCE_SET($Args)
  1530. }
  1531. # tag:java-specific
  1532. JAVA_ADD_DLLS_VALUE=no
  1533. macro ADD_DLLS_TO_JAR() {
  1534. SET(JAVA_ADD_DLLS_VALUE yes)
  1535. }
  1536. # tag:java-specific
  1537. MANAGED_PEERS=
  1538. MANAGED_PEERS_CLOSURE=
  1539. MANAGEABLE_PEERS_ROOTS=contrib/java
  1540. HAS_MANAGEABLE_PEERS=no
  1541. PROPAGATES_MANAGEABLE_PEERS=no
  1542. # All items of this list must be PEERS, GHOST PEERS or TOOLS of the test module or module itself.
  1543. # All items of this list must has at least one of HAS_MANAGEABLE_PEERS or PROPAGATES_MANAGEABLE_PEERS flags set yes.
  1544. # This variable is used by JUnit tests but not TestNG.
  1545. TEST_CLASSPATH_VALUE=
  1546. # Calculated and replaced by ymake can be used in DART DATA
  1547. TEST_CLASSPATH_MANAGED=
  1548. # tag:java-specific
  1549. DEPENDENCY_MANAGEMENT_VALUE=
  1550. ### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
  1551. ###
  1552. ### 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.
  1553. ###
  1554. ### For example, if the module has PEERDIR (contrib/java/junit/junit), and
  1555. ### 1. specifies DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12),
  1556. ### the PEERDIR is automatically replaced by contrib/java/junit/junit/4.12;
  1557. ### 2. doesn't specify DEPENDENCY_MANAGEMENT, PEERDIR automatically replaced
  1558. ### with the default from contrib/java/junit/junit/ya.make.
  1559. ### These defaults are always there and are supported by maven-import, which puts
  1560. ### there the maximum version available in contrib/java.
  1561. ###
  1562. ### 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.
  1563. ###
  1564. ### If some module has both DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12) and PERDIR(contrib/java/junit/junit/4.11), the PEERDIR wins.
  1565. ###
  1566. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  1567. macro DEPENDENCY_MANAGEMENT(Args...) {
  1568. SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
  1569. _GHOST_PEERDIR($Args)
  1570. }
  1571. # tag:java-specific
  1572. WITH_JDK_VALUE=
  1573. ### @usage: WITH_JDK()
  1574. ###
  1575. ### Add directory with JDK to JAVA_PROGRAM output
  1576. macro WITH_JDK() {
  1577. when ($REALPRJNAME == "jdk") {
  1578. _OK=no
  1579. }
  1580. otherwise {
  1581. _PACK_JDK= && ${YMAKE_PYTHON} ${input:"build/scripts/tar_directory.py"} ${output;tared:"jdk.tar"} $WITH_JDK_RESOURCE $WITH_JDK_RESOURCE
  1582. WITH_JDK_VALUE=yes
  1583. }
  1584. ASSERT(_OK [[alt1]]jdk[[rst]] name is prohibited for [[imp]]JAVA_PROGRAM[[rst]] module when [[imp]]WITH_JDK[[rst]] is used, [[imp]]WITH_JDK[[rst]] will be ignored.)
  1585. }
  1586. # tag:kotlin-specific
  1587. WITH_KOTLIN_VALUE=
  1588. _WITH_KOTLIN_SEM=
  1589. _KOTLIN_VERSION_SEM=
  1590. ### @usage: WITH_KOTLIN()
  1591. ###
  1592. ### Compile kotlin source code in this java module
  1593. macro WITH_KOTLIN() {
  1594. SET(WITH_KOTLIN_VALUE yes)
  1595. SET(_WITH_KOTLIN_SEM && with_kotlin)
  1596. SET(_KOTLIN_VERSION_SEM && kotlin_version ${_KOTLIN_VERSION})
  1597. }
  1598. # tag:kotlin-specific
  1599. WITH_KAPT_VALUE=
  1600. ### @usage: WITH_KAPT()
  1601. ###
  1602. ### Use kapt for as annotation processor
  1603. macro WITH_KAPT() {
  1604. SET(WITH_KAPT_VALUE yes)
  1605. }
  1606. # tag:java-specific
  1607. WITH_GROOVY_VALUE=
  1608. ### @usage: WITH_GROOVY()
  1609. ###
  1610. ### Compile groovy source code in this java module
  1611. macro WITH_GROOVY() {
  1612. SET(WITH_GROOVY_VALUE yes)
  1613. }
  1614. # tag:kotlin-specific
  1615. KOTLINC_FLAGS_VALUE=-Xjvm-default=all
  1616. ### @usage: KOTLINC_FLAGS(-flags)
  1617. ###
  1618. ### Set additional Kotlin compilation flags.
  1619. macro KOTLINC_FLAGS(Args...) {
  1620. SET_APPEND(KOTLINC_OPTS_VALUE $Args)
  1621. }
  1622. # tag:kotlin-sppecific
  1623. WITH_KOTLINC_PLUGIN_ALLOPEN=
  1624. _WITH_KOTLINC_PLUGIN_ALLOPEN_SEM=
  1625. macro _WITH_KOTLINC_ALLOPEN(Options...) {
  1626. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.allopen\::Options})
  1627. SET(WITH_KOTLINC_PLUGIN_ALLOPEN yes)
  1628. SET(_WITH_KOTLINC_ALLOPEN_SEM && with_kotlinc_plugin_allopen)
  1629. }
  1630. # tag:kotlin-specific
  1631. ### @usage: WITH_KOTLINC_ALLOPEN(-flags)
  1632. ###
  1633. ### Enable allopen kotlin compiler plugin https://kotlinlang.org/docs/all-open-plugin.html
  1634. macro WITH_KOTLINC_ALLOPEN(HEAD, TAIL...) {
  1635. _WITH_KOTLINC_ALLOPEN($HEAD $TAIL)
  1636. }
  1637. # tag:kotlin-specific
  1638. WITH_KOTLINC_PLUGIN_LOMBOK=
  1639. _WITH_KOTLINC_PLUGIN_LOMBOK_SEM=
  1640. ### @usage: WITH_KOTLINC_LOMBOK(-flags)
  1641. ###
  1642. ### Enable lombok kotlin compiler plugin https://kotlinlang.org/docs/lombok.html
  1643. macro WITH_KOTLINC_LOMBOK(Options...) {
  1644. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.lombok\::Options})
  1645. SET(WITH_KOTLINC_PLUGIN_LOMBOK yes)
  1646. SET(_WITH_KOTLINC_PLUGIN_LOMBOK_SEM && with_kotlinc_plugin_lombok)
  1647. }
  1648. # tag:kotlin-specific
  1649. WITH_KOTLINC_PLUGIN_NOARG=
  1650. _WITH_KOTLINC_PLUGIN_NOARG_SEM=
  1651. ### @usage: WITH_KOTLINC_NOARG(-flags)
  1652. ###
  1653. ### Enable noarg kotlin compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html
  1654. macro WITH_KOTLINC_NOARG(Options...) {
  1655. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.noarg\::Options})
  1656. SET(WITH_KOTLINC_PLUGIN_NOARG yes)
  1657. SET(_WITH_KOTLINC_PLUGIN_NOARG_SEM && with_kotlinc_plugin_noarg)
  1658. }
  1659. # tag:kotlin-specific
  1660. WITH_KOTLINC_PLUGIN_SERIALIZATION=
  1661. _WITH_KOTLINC_PLUGIN_SERIALIZATION_SEM=
  1662. ### @usage: WITH_KOTLINC_SERIALIZATION()
  1663. ###
  1664. ### Enable serialization kotlin compiler plugin https://kotlinlang.org/docs/serialization.html
  1665. macro WITH_KOTLINC_SERIALIZATION() {
  1666. SET(WITH_KOTLINC_PLUGIN_SERIALIZATION yes)
  1667. SET(_WITH_KOTLINC_PLUGIN_SERIALIZATION_SEM && with_kotlinc_plugin_serialization)
  1668. }
  1669. # tag:kotlin-specific
  1670. ### Also search for _KAPT_OPTS and change version there
  1671. _KOTLIN_VERSION=1.9.24
  1672. KOTLIN_VERSION=1.9.24
  1673. KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.9.24/ya.dependency_management.inc
  1674. GROOVY_VERSION=3.0.5
  1675. _KOTLIN_SEM= \
  1676. ${_WITH_KOTLIN_SEM} \
  1677. ${_KOTLIN_VERSION_SEM} \
  1678. ${_WITH_KOTLINC_PLUGIN_ALLOPEN_SEM} \
  1679. ${_WITH_KOTLINC_PLUGIN_LOMBOK_SEM} \
  1680. ${_WITH_KOTLINC_PLUGIN_NOARG_SEM} \
  1681. ${_WITH_KOTLINC_PLUGIN_SERIALIZATION_SEM}
  1682. _JAVA_PROTO_GRPC_SEM=
  1683. when ($_GRPC_ENABLED == "yes") {
  1684. _JAVA_PROTO_GRPC_SEM= && proto_grpc && proto_grpc_version ${JAVA_GRPC_VERSION}
  1685. }
  1686. _JAVA_PROTO_NAMESPACE_SEM=
  1687. when ($PROTO_NAMESPACE != "") {
  1688. _JAVA_PROTO_NAMESPACE_SEM= && proto_namespace $PROTO_NAMESPACE
  1689. }
  1690. _JAVA_PROTO_SEM= \
  1691. ${_JAVA_PROTO_NAMESPACE_SEM} \
  1692. && proto_compiler_version ${JAVA_PROTO_COMPILER_VERSION} \
  1693. && proto_runtime_version ${JAVA_PROTO_RUNTIME_VERSION} \
  1694. && proto_common_version ${JAVA_PROTO_COMMON_VERSION} \
  1695. ${_JAVA_PROTO_GRPC_SEM}
  1696. # tag:java-specific
  1697. DIRECT_DEPS_ONLY_VALUE=
  1698. ### @usage: DIRECT_DEPS_ONLY
  1699. ###
  1700. ### Add direct PEERDIR's only in java compile classpath
  1701. macro DIRECT_DEPS_ONLY() {
  1702. SET(DIRECT_DEPS_ONLY_VALUE yes)
  1703. }
  1704. # tag:java-specific
  1705. JAVA_EXTERNAL_DEPENDENCIES_VALUE=
  1706. ### @usage: JAVA_EXTERNAL_DEPENDENCIES(file1 file2 ...)
  1707. ###
  1708. ### Add non-source java external build dependency (like lombok config file)
  1709. macro JAVA_EXTERNAL_DEPENDENCIES(Args...) {
  1710. SET_APPEND(JAVA_EXTERNAL_DEPENDENCIES_VALUE $Args)
  1711. }
  1712. # tag:java-specific
  1713. JAVA_CLASSPATH_CMD_TYPE_VALUE=
  1714. # tag:java-specific
  1715. ### @usage:TEST_JAVA_CLASSPATH_CMD_TYPE(Type)
  1716. ### Available types: MANIFEST(default), COMMAND_FILE, LIST
  1717. ### Method for passing a classpath value to a java command line
  1718. ### MANIFEST via empty jar file with manifest that contains Class-Path attribute
  1719. ### COMMAND_FILE via @command_file
  1720. ### LIST via flat args
  1721. macro TEST_JAVA_CLASSPATH_CMD_TYPE(Type) {
  1722. SET(JAVA_CLASSPATH_CMD_TYPE_VALUE $Type)
  1723. }
  1724. # tag:java-specific
  1725. IGNORE_JAVA_DEPENDENCIES_CONFIGURATION=no
  1726. JAVA_DEPENDENCIES_CONFIGURATION_VALUE=
  1727. # tag:java-specific
  1728. ### @usage JAVA_DEPENDENCIES_CONFIGURATION(Vetos...)
  1729. ### Validate contrib/java dependencies
  1730. ### Valid arguments
  1731. ### FORBID_DIRECT_PEERDIRS - fail when module have direct PEERDIR (with version) (non-transitive)
  1732. ### FORBID_CONFLICT - fail when module have resolved without DEPENDENCY_MANAGEMENT version conflict (transitive)
  1733. ### FORBID_CONFLICT_DM - fail when module have resolved with DEPENDENCY_MANAGEMENT version conflict (transitive)
  1734. ### FORBID_CONFLICT_DM_RECENT - like FORBID_CONFLICT_DM but fail only when dependency have more recent version than specified in DEPENDENCY_MANAGEMENT
  1735. ### REQUIRE_DM - all dependencies must be specified in DEPENDENCY_MANAGEMENT (transitive)
  1736. macro JAVA_DEPENDENCIES_CONFIGURATION(Args...) {
  1737. SET_APPEND(JAVA_DEPENDENCIES_CONFIGURATION_VALUE $Args)
  1738. }
  1739. # tag:java-specific
  1740. # TODO(DEVTOOLS-6901): remove this variable when there are no more references to it in jbuild
  1741. JAVA_FORBIDDEN_LIBRARIES_VALUE=
  1742. # tag:java-specific
  1743. JAR_INCLUDE_FILTER_VALUE=
  1744. JAR_EXCLUDE_FILTER_VALUE=
  1745. # tag:java-specific
  1746. ### @usage:JAR_INCLUDE(Filters...)
  1747. ### Filter .jar file content: keep only matched files
  1748. ### * and ** patterns are supported (like JAVA_SRCS)
  1749. macro JAR_INCLUDE(Filters...) {
  1750. SET_APPEND(JAR_INCLUDE_FILTER_VALUE $Filters)
  1751. }
  1752. # tag:java-specific
  1753. ### @usage:JAR_EXCLUDE(Filters...)
  1754. ### Filter .jar file content: remove matched files
  1755. ### * and ** patterns are supported (like JAVA_SRCS)
  1756. macro JAR_EXCLUDE(Filters...) {
  1757. SET_APPEND(JAR_EXCLUDE_FILTER_VALUE $Filters)
  1758. }
  1759. # tag:java-specific
  1760. _COMPILE_JSRC=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_jsrc.py"} --input $AUTO_INPUT --output $TARGET --prefix $BINDIR ${kv;hide:"p JC"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  1761. # tag:java-specific
  1762. COMPILE_JSRC_MF=$_COMPILE_JSRC && $GENERATE_MF
  1763. # tag:java-specific tag:internal
  1764. ### @usage: JSRC_LIBRARY() # internal
  1765. module JSRC_LIBRARY: _BARE_UNIT {
  1766. .CMD=COMPILE_JSRC_MF
  1767. .EXTS=.java
  1768. .PEERDIR_POLICY=as_include
  1769. .FINAL_TARGET=no
  1770. .ALIASES=SRCS=FILES
  1771. PEERDIR_TAGS=JAVA JAVA_PROTO JAVA_FBS JAVA_IDL
  1772. MODULE_TYPE=LIBRARY
  1773. SET(MODULE_SUFFIX .jsrc)
  1774. SET(DONT_RESOLVE_INCLUDES yes)
  1775. SET(NEED_PLATFORM_PEERDIRS no)
  1776. SET(MODULE_LANG JAVA)
  1777. NO_RUNTIME()
  1778. }
  1779. # tag:java-specific
  1780. JAVA_PROGRAM_CP_USE_COMMAND_FILE=yes
  1781. when ($JDK_REAL_VERSION == "8") {
  1782. JAVA_PROGRAM_CP_USE_COMMAND_FILE=no
  1783. }
  1784. # tag:kotlin-specific
  1785. KOTLIN_JVM_TARGET=
  1786. when ($JDK_REAL_VERSION == "8") {
  1787. KOTLIN_JVM_TARGET=1.8
  1788. }
  1789. elsewhen ($JDK_REAL_VERSION == "22") {
  1790. # remove when kotlin starts supporting jdk21 bytecode
  1791. # see also devtools/ya/jbuild/gen/actions/idea.py
  1792. KOTLIN_JVM_TARGET=21
  1793. }
  1794. otherwise {
  1795. KOTLIN_JVM_TARGET=$JDK_REAL_VERSION
  1796. }
  1797. # tag:java-specific
  1798. ### @usage: JDK_VERSION(Version)
  1799. ###
  1800. ### Specify JDK version for module
  1801. macro JDK_VERSION(Arg) {
  1802. .SEM=required_jdk $Arg ${output;hide:"JdkVersionFakeProp.java"}
  1803. SET(JDK_REAL_VERSION $Arg)
  1804. _JDK_VERSION_MACRO_CHECK($Arg)
  1805. }
  1806. # tag:java-specific
  1807. ### @usage: DEFAULT_JDK_VERSION(Version)
  1808. ###
  1809. ### Specify JDK version for module, can be overridden by setting the JDK_VERSION variable
  1810. macro DEFAULT_JDK_VERSION(Arg) {
  1811. _SET_FIRST_VALUE(_JDK_VERSION $JDK_VERSION $Arg)
  1812. JDK_VERSION($_JDK_VERSION)
  1813. }
  1814. # tag:java-specific
  1815. # local jdk and tools
  1816. USE_SYSTEM_JDK=
  1817. USE_SYSTEM_UBERJAR=
  1818. USE_SYSTEM_ERROR_PRONE=
  1819. # tag:kotlin-specific
  1820. _USE_KTLINT_OLD=no
  1821. # tag:kotlin-specific
  1822. ### @usage: USE_KTLINT_OLD()
  1823. ### Marks that need use the old version of ktlint
  1824. macro USE_KTLINT_OLD() {
  1825. ENABLE(_USE_KTLINT_OLD)
  1826. }
  1827. # tag:kotlin-specific
  1828. _KTLINT_BASELINE_FILE=
  1829. # tag:kotlin-specific
  1830. ### @usage: #deprecated KTLINT_BASELINE_FILE(ktlint-baseline.xml "https://st.yandex-team.ru/REMOVE-BASELINE-1")
  1831. ### Path to baseline file for ktlint test and ticket to fix all ktlint warnings in file and then remove it
  1832. macro KTLINT_BASELINE_FILE(File, Ticket) {
  1833. SET(_KTLINT_BASELINE_FILE $File)
  1834. }
  1835. # tag:kotlin-specific
  1836. _WITH_YA_1931=no
  1837. # tag:kotlin-specific
  1838. ### @usage: WITH_YA_1931()
  1839. ### Interim macro to temporarily remove ALL_SRCDIRS from being added to ktlint test sources.
  1840. macro WITH_YA_1931() {
  1841. MESSAGE(WARNING Some files in this project have style errors that were not caught by prior ktlint runs. Remove WITH_YA_1931 macro to see them.)
  1842. ENABLE(_WITH_YA_1931)
  1843. }