java.conf 87 KB

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