aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/java.conf
blob: 47982484f2a224bca5b05e871b3663bce032e60c (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
180
181
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 {
    .SEM=BUILD_JAR_SEM
}

PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM=IGNORED

### @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_RUNNABLE: _JAR_RUNNABLE {
        .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
        .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM
        # 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 PROVIDES
        .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
        .SEM=BUILD_JAR_SEM
        .FINAL_TARGET=no
        SET(MODULE_TYPE JAVA_PROGRAM)
    }
}

BUILD_JUNIT5_JAR_SEM=$BUILD_JAR_SEM && junit5_test

multimodule JUNIT5 {
    # ATTENTION ya ide idea relies on this submodule name to find scope of `ya make` build before project generation
    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
        .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM

        PEERDIR(devtools/jtest-annotations/junit5)

        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
        .DEFAULT_NAME_GENERATOR=FullPath
        .SEM=BUILD_JUNIT5_JAR_SEM

        PEERDIR+=devtools/junit5-runner
        PEERDIR+=build/platform/java/jacoco-agent

        when ($OPENSOURCE != "yes") {
            PEERDIR+=devtools/jtest-annotations/junit5
        }
        SET(MODULE_TYPE JUNIT5)
    }
}

BUILD_JUNIT4_JAR_SEM=$BUILD_JAR_SEM && junit4_test

multimodule JTEST {
    # ATTENTION ya ide idea relies on this submodule name to find scope of `ya make` build before project generation
    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
        .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM

        SET(MODULE_TYPE JTEST)
        PEERDIR(devtools/junit-runner devtools/jtest-annotations/junit4)
        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
        .DEFAULT_NAME_GENERATOR=FullPath
        .SEM=BUILD_JUNIT4_JAR_SEM

        SET(MODULE_TYPE JTEST)
        DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)

        PEERDIR+=build/platform/java/jacoco-agent
        when ($OPENSOURCE != "yes") {
            PEERDIR+=devtools/jtest-annotations/junit4
        }
    }
}

multimodule JTEST_FOR {
    # ATTENTION ya ide idea relies on this submodule name to find scope of `ya make` build before project generation
    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
        .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM

        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
        .DEFAULT_NAME_GENERATOR=FullPath
        .SEM=BUILD_JUNIT4_JAR_SEM

        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_RUNNABLE: _JAR_RUNNABLE {
        .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
        .SEM=BUILD_JAR_SEM
    }
}