aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/java.ymake.conf
blob: ed85153c78586aed26e1f3be66085ec97f2de45d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
YMAKE_JAVA_MODULES=yes
JBUILD_JAVA_MODULES=no

macro _INPUT_WITH_FLAG(Flag, IN[]) {
    .CMD=$_INPUT_WITH_FLAG_IMPL(${pre=$Flag :IN} IN $IN)
}

macro _INPUT_WITH_FLAG_IMPL(IN{input}[], Args...) {
    .CMD=$Args ${input;hide:IN}
}

macro ACCELEO(XSD{input}[], MTL{input}[], MTL_ROOT="${MODDIR}", LANG{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], DEBUG?"stdout2stderr":"stderr2stdout") {
    .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
    .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"}
}

### @usage: JAVA_LIBRARY()
###
### The module describing java library build.
###
### Documentation: https://wiki.yandex-team.ru/yatool/java/
module JAVA_LIBRARY: JAR_LIBRARY {
    .ALIASES=REQUIREMENTS=JAVA_REQUIREMENTS
}

### @usage: JAVA_PROGRAM()
###
### The module describing java programs build.
### Output artifacts: .jar and directory with all the jar to the classpath of the formation.
###
### Documentation: https://wiki.yandex-team.ru/yatool/java/
multimodule JAVA_PROGRAM {
    module JAR_RUNABLE: _JAR_RUNABLE {
        .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
        # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
        # * A -> B -> C -> lib-v1.4
        #    |    |-> DM(lib-v1.1)
        #    |    |-> EXCLUDE(lib-v1.4)
        #    |    |-> FORBID_CONFLICT_DM_RECENT = OK
        #    |-> DM(lib-v1.1)
        #    |-> 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)
        .IGNORED=RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION
        .ALIASES=JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
        .PEERDIRSELF=JAR_COMPILATION

        SET(MODULE_TYPE JAVA_PROGRAM)
    }
    module JAR_COMPILATION: JAR_LIBRARY {
        .IGNORED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
        .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO REQUIREMENTS=JAVA_REQUIREMENTS
        .FINAL_TARGET=no
        SET(MODULE_TYPE JAVA_PROGRAM)
    }
}

multimodule JUNIT5 {
    module JAR_TESTABLE: _JAR_TEST {
        .ALLOWED=YT_SPEC
        # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
        # * A -> B -> C -> lib-v1.4
        #    |    |-> DM(lib-v1.1)
        #    |    |-> EXCLUDE(lib-v1.4)
        #    |    |-> FORBID_CONFLICT_DM_RECENT = OK
        #    |-> DM(lib-v1.1)
        #    |-> 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)
        .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION
        .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
        .PEERDIRSELF=JAR_COMPILATION

        SET(MODULE_TYPE JUNIT5)
    }
    module JAR_COMPILATION: JAR_LIBRARY {
        .ALLOWED=YT_SPEC
        .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
        .FINAL_TARGET=no

        PEERDIR(devtools/junit5-runner build/platform/java/jacoco-agent)
        SET(MODULE_TYPE JUNIT5)
    }
}

multimodule JTEST {
    module JAR_TESTABLE: _JAR_TEST {
        .ALLOWED=YT_SPEC
        # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
        # * A -> B -> C -> lib-v1.4
        #    |    |-> DM(lib-v1.1)
        #    |    |-> EXCLUDE(lib-v1.4)
        #    |    |-> FORBID_CONFLICT_DM_RECENT = OK
        #    |-> DM(lib-v1.1)
        #    |-> 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)
        .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION
        .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
        .PEERDIRSELF=JAR_COMPILATION

        SET(MODULE_TYPE JTEST)
        PEERDIR(devtools/junit-runner)
        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)
    }
    module JAR_COMPILATION: JAR_LIBRARY {
        .ALLOWED=YT_SPEC
        .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
        .FINAL_TARGET=no

        SET(MODULE_TYPE JTEST)
        DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
        PEERDIR(build/platform/java/jacoco-agent)
    }
}

multimodule JTEST_FOR {
    module JAR_TESTABLE: _JAR_TEST {
        .ALLOWED=YT_SPEC
        # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
        # * A -> B -> C -> lib-v1.4
        #    |    |-> DM(lib-v1.1)
        #    |    |-> EXCLUDE(lib-v1.4)
        #    |    |-> FORBID_CONFLICT_DM_RECENT = OK
        #    |-> DM(lib-v1.1)
        #    |-> 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)
        .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION
        .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
        .PEERDIRSELF=JAR_COMPILATION

        SET(MODULE_TYPE JTEST_FOR)
        PEERDIR(${UNITTEST_DIR} devtools/junit-runner)
        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)
    }
    module JAR_COMPILATION: JAR_LIBRARY {
        .ALLOWED=YT_SPEC
        .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
        .FINAL_TARGET=no

        SET(MODULE_TYPE JTEST_FOR)
        DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
        PEERDIR(devtools/junit-runner build/platform/java/jacoco-agent ${UNITTEST_DIR})
    }
}

multimodule JAVA_CONTRIB_PROGRAM {
    module JAR_RUNABLE: _JAR_RUNABLE {
        .IGNORED=JAVA_SRCS RUN_JAR_PROGRAM RUN_JAVA_PROGRAM JAR_RESOURCE SRC_RESOURCE LOCAL_JAR
        .PEERDIRSELF=JAR_COMPILATION

        SET(MODULE_TYPE JAVA_PROGRAM)
        ENABLE(DISABLE_SCRIPTGEN)
    }
    module JAR_COMPILATION: JAVA_CONTRIB {
        .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
        .FINAL_TARGET=no
    }
}

module _DLL_COMPATIBLE_JAVA_LIBRARY: EXTERNAL_JAVA_LIBRARY {
    SET(DONT_RESOLVE_INCLUDES yes)
}

### @usage: DLL_JAVA()
###
### DLL built using swig for Java. Produces dynamic library and a .jar.
### Dynamic library is treated the same as in the case of PEERDIR from Java to DLL.
### .jar goes on the classpath.
###
### Documentation: https://wiki.yandex-team.ru/yatool/java/#integracijascpp/pythonsborkojj
multimodule DLL_JAVA {
    module JNI_DLL: DLL {
        .ALIASES=SRCS=_SWIG_LANG_FILTERED_SRCS
        SET(SWIG_LANG jni_cpp)
        .FINAL_TARGET=no
    }
    module JAR_COMPILATION: _DLL_COMPATIBLE_JAVA_LIBRARY {
        .ALIASES=SRCS=_SWIG_LANG_FILTERED_SRCS PEERDIR=_NOOP_MACRO
        .PEERDIRSELF=JNI_DLL
        SET(SWIG_LANG jni_java)
        PEERDIR+=build/platform/java/jdk
        PEERDIR+=$JDK_RESOURCE_PEERDIR
        .FINAL_TARGET=yes
    }
}