java.conf 72 KB

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