java.conf 87 KB

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