java.conf 86 KB

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