java.ymake.conf 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. YMAKE_JAVA_MODULES=yes
  2. JBUILD_JAVA_MODULES=no
  3. macro _INPUT_WITH_FLAG(Flag, IN[]) {
  4. .CMD=$_INPUT_WITH_FLAG_IMPL(${pre=$Flag :IN} IN $IN)
  5. }
  6. macro _INPUT_WITH_FLAG_IMPL(IN{input}[], Args...) {
  7. .CMD=$Args ${input;hide:IN}
  8. }
  9. macro ACCELEO(XSD{input}[], MTL{input}[], MTL_ROOT="${MODDIR}", LANG{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], DEBUG?"stdout2stderr":"stderr2stdout") {
  10. .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
  11. .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"}
  12. }
  13. ### @usage: JAVA_LIBRARY()
  14. ###
  15. ### The module describing java library build.
  16. ###
  17. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  18. module JAVA_LIBRARY: JAR_LIBRARY {
  19. }
  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. # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
  30. # * A -> B -> C -> lib-v1.4
  31. # | |-> DM(lib-v1.1)
  32. # | |-> EXCLUDE(lib-v1.4)
  33. # | |-> FORBID_CONFLICT_DM_RECENT = OK
  34. # |-> DM(lib-v1.1)
  35. # |-> 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)
  36. .IGNORED=RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION PROVIDES
  37. .ALIASES=JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
  38. .PEERDIRSELF=JAR_COMPILATION
  39. SET(MODULE_TYPE JAVA_PROGRAM)
  40. }
  41. module JAR_COMPILATION: JAR_LIBRARY {
  42. .IGNORED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
  43. .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
  44. .FINAL_TARGET=no
  45. SET(MODULE_TYPE JAVA_PROGRAM)
  46. }
  47. }
  48. multimodule JUNIT5 {
  49. module JAR_TESTABLE: _JAR_TEST {
  50. .ALLOWED=YT_SPEC
  51. # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
  52. # * A -> B -> C -> lib-v1.4
  53. # | |-> DM(lib-v1.1)
  54. # | |-> EXCLUDE(lib-v1.4)
  55. # | |-> FORBID_CONFLICT_DM_RECENT = OK
  56. # |-> DM(lib-v1.1)
  57. # |-> 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)
  58. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION
  59. .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
  60. .PEERDIRSELF=JAR_COMPILATION
  61. PEERDIR(devtools/jtest-annotations/junit5)
  62. SET(MODULE_TYPE JUNIT5)
  63. }
  64. module JAR_COMPILATION: JAR_LIBRARY {
  65. .ALLOWED=YT_SPEC
  66. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
  67. .FINAL_TARGET=no
  68. .DEFAULT_NAME_GENERATOR=FullPath
  69. PEERDIR(devtools/junit5-runner devtools/jtest-annotations/junit5 build/platform/java/jacoco-agent)
  70. SET(MODULE_TYPE JUNIT5)
  71. }
  72. }
  73. multimodule JTEST {
  74. module JAR_TESTABLE: _JAR_TEST {
  75. .ALLOWED=YT_SPEC
  76. # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
  77. # * A -> B -> C -> lib-v1.4
  78. # | |-> DM(lib-v1.1)
  79. # | |-> EXCLUDE(lib-v1.4)
  80. # | |-> FORBID_CONFLICT_DM_RECENT = OK
  81. # |-> DM(lib-v1.1)
  82. # |-> 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)
  83. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION
  84. .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
  85. .PEERDIRSELF=JAR_COMPILATION
  86. SET(MODULE_TYPE JTEST)
  87. PEERDIR(devtools/junit-runner devtools/jtest-annotations/junit4)
  88. 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)
  89. }
  90. module JAR_COMPILATION: JAR_LIBRARY {
  91. .ALLOWED=YT_SPEC
  92. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
  93. .FINAL_TARGET=no
  94. .DEFAULT_NAME_GENERATOR=FullPath
  95. SET(MODULE_TYPE JTEST)
  96. DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
  97. PEERDIR(build/platform/java/jacoco-agent devtools/jtest-annotations/junit4)
  98. }
  99. }
  100. multimodule JTEST_FOR {
  101. module JAR_TESTABLE: _JAR_TEST {
  102. .ALLOWED=YT_SPEC
  103. # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
  104. # * A -> B -> C -> lib-v1.4
  105. # | |-> DM(lib-v1.1)
  106. # | |-> EXCLUDE(lib-v1.4)
  107. # | |-> FORBID_CONFLICT_DM_RECENT = OK
  108. # |-> DM(lib-v1.1)
  109. # |-> 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)
  110. .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION
  111. .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
  112. .PEERDIRSELF=JAR_COMPILATION
  113. SET(MODULE_TYPE JTEST_FOR)
  114. PEERDIR(${UNITTEST_DIR} devtools/junit-runner)
  115. 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)
  116. }
  117. module JAR_COMPILATION: JAR_LIBRARY {
  118. .ALLOWED=YT_SPEC
  119. .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
  120. .FINAL_TARGET=no
  121. .DEFAULT_NAME_GENERATOR=FullPath
  122. SET(MODULE_TYPE JTEST_FOR)
  123. DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
  124. PEERDIR(devtools/junit-runner build/platform/java/jacoco-agent ${UNITTEST_DIR})
  125. }
  126. }
  127. multimodule JAVA_CONTRIB_PROGRAM {
  128. module JAR_RUNNABLE: _JAR_RUNNABLE {
  129. .IGNORED=JAVA_SRCS RUN_JAR_PROGRAM RUN_JAVA_PROGRAM JAR_RESOURCE SRC_RESOURCE LOCAL_JAR
  130. .PEERDIRSELF=JAR_COMPILATION
  131. SET(MODULE_TYPE JAVA_PROGRAM)
  132. ENABLE(DISABLE_SCRIPTGEN)
  133. }
  134. module JAR_COMPILATION: JAVA_CONTRIB {
  135. .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
  136. .FINAL_TARGET=no
  137. }
  138. }
  139. _EXPLICIT_SWIG_JAVA_SOURCES=
  140. _EXPLICIT_SWIG_IFACE_SOURCES=
  141. macro _EXPORT_JAVA_BINDINGS(JavaSrcs...) {
  142. SET_APPEND(_EXPLICIT_SWIG_JAVA_SOURCES ${input:JavaSrcs})
  143. .SEM=find_package SWIG COMPONENTS java && find_package Java && find_package JNI && include UseSWIG && include UseJava ${input;hide:JavaSrcs} ${output;hide;pre=$_HASH_HELPER($Args):".o"}
  144. }
  145. macro _EXPORT_SWIG_SOURCES(SwigSrcs...) {
  146. SET_APPEND(_EXPLICIT_SWIG_IFACE_SOURCES ${input:SwigSrcs})
  147. }
  148. macro _JNI_CPP_SWIG_SRCS(Srcs...) {
  149. SRCS(${ext=.cpp:Srcs} ${ext=.swg:Srcs})
  150. _EXPORT_JAVA_BINDINGS(${ext=.java:Srcs})
  151. _EXPORT_SWIG_SOURCES(${ext=.swg:Srcs})
  152. }
  153. macro _JNI_JAVA_SWIG_SRCS(Srcs...) {
  154. SRCS(${ext=.java:Srcs} ${ext=.swg:Srcs})
  155. }
  156. SWIG_JNI_BINDINGS_SEM= \
  157. add_swig_jni_library ${MODDIR} ${REALPRJNAME}-cpp GEN_JAVA_FILES_LIST ${"$"}{CMAKE_CURRENT_BINARY_DIR}/swig_gen_java.lst SOURCES ${_EXPLICIT_SWIG_IFACE_SOURCES} && \
  158. set_target_property OUTPUT_NAME $REALPRJNAME && \
  159. vcs_info && \
  160. add_jar ${REALPRJNAME} SOURCES $_EXPLICIT_SWIG_JAVA_SOURCES @${"$"}{CMAKE_CURRENT_BINARY_DIR}/swig_gen_java.lst ${hide:TARGET}
  161. ### @usage: DLL_JAVA()
  162. ###
  163. ### DLL built using swig for Java. Produces dynamic library and a .jar.
  164. ### Dynamic library is treated the same as in the case of PEERDIR from Java to DLL.
  165. ### .jar goes on the classpath.
  166. ###
  167. ### Documentation: https://wiki.yandex-team.ru/yatool/java/#integracijascpp/pythonsborkojj
  168. multimodule DLL_JAVA {
  169. module JNI_DLL: DLL {
  170. .ALIASES=SRCS=_JNI_CPP_SWIG_SRCS
  171. .FINAL_TARGET=no
  172. .SEM=SWIG_JNI_BINDINGS_SEM
  173. SWIG_LANG=jni_cpp
  174. }
  175. module JAR_COMPILATION: EXTERNAL_JAVA_LIBRARY {
  176. .ARGS_PARSER=DLL
  177. .ALIASES=SRCS=_JNI_JAVA_SWIG_SRCS PEERDIR=_NOOP_MACRO
  178. .PEERDIRSELF=JNI_DLL
  179. PEERDIR+=build/platform/java/jdk
  180. PEERDIR+=$JDK_RESOURCE_PEERDIR
  181. SET(DONT_RESOLVE_INCLUDES yes)
  182. .FINAL_TARGET=yes
  183. SWIG_LANG=jni_java
  184. _SWIG_CMD=$_SWIG_JNI_JAVA_CMD
  185. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  186. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  187. _SWIG_SEM_TO_MODULE_LINK=${output;hide;suf=.jsrc:SRC}
  188. }
  189. }