aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/jbuild.ymake.conf
blob: b9c88dd2db952bed86a2a688db4b2c922fa375df (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
YMAKE_JAVA_MODULES=no
JBUILD_JAVA_MODULES=yes

EXTERNAL_JAR_VALUE=
### @usage: EXTERNAL_JAR(library.jar)
###
### Provide an external name for built JAVA_LIBRARY() or JAVA_PROGRAM()
###
### Documentation: https://wiki.yandex-team.ru/yatool/java/#ispolzovanievneshnixmavenbibliotek
macro EXTERNAL_JAR(Args...) {
    SET_APPEND(EXTERNAL_JAR_VALUE $ARGS_DELIM $Args)
}

### @usage: JAVA_LIBRARY()
###
### The module describing java library build.
###
### Documentation: https://wiki.yandex-team.ru/yatool/java/
module JAVA_LIBRARY: _JAVA_PLACEHOLDER {
    SET(MODULE_TYPE JAVA_LIBRARY)
}

### @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/
module JAVA_PROGRAM: _JAVA_PLACEHOLDER {
    .ALIASES=JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
    SET(MODULE_TYPE JAVA_PROGRAM)
}

### @usage: JUNIT5()
###
### Java tests module based on JUnit 5 framework.
###
### If requested, build system will scan the source code of the module for the presence of junit tests and run them.
### Output artifacts: a jar, a directory of exhaust tests(if required run the tests) - test logs, system logs testiranja, temporary files, tests, etc.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynajava
module JUNIT5: _JAVA_PLACEHOLDER {
    .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
    SET(MODULE_TYPE JUNIT5)
    SET(TEST_RUNNER devtools/junit5-runner)
    SET(TEST_CLASSPATH_VALUE ${MODDIR} ${TEST_RUNNER})
    PEERDIR(devtools/jtest-annotations/junit5)
    # Used as place to add managed dependencies for test execution and take them into account
    # during traverses properly.
    _RUN_JAVA(TOOL ${TEST_RUNNER} OUT fake.out.java_test_cmd)

    PEERDIR(${TEST_RUNNER})
    PEERDIR(build/platform/java/jacoco-agent)
    JAVA_TEST()
}

### @usage: JTEST()
###
### Java tests module based on JUnit 4 framework.
###
### If requested, build system will scan the source code of the module for the presence of junit tests and run them.
### Output artifacts: a jar, a directory of exhaust tests(if required run the tests) - test logs, system logs testiranja, temporary files, tests, etc.
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynajava
module JTEST: _JAVA_PLACEHOLDER {
    .ALLOWED=YT_SPEC
    .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
    SET(MODULE_TYPE JTEST)
    SET(TEST_RUNNER devtools/junit-runner)
    SET(TEST_CLASSPATH_VALUE ${MODDIR} ${TEST_RUNNER})
    # Used as place to add managed dependencies for test execution and take them into account
    # during traverses properly.
    _RUN_JAVA(TOOL ${TEST_RUNNER} OUT fake.out.java_test_cmd)

    PEERDIR(devtools/jtest-annotations/junit4)

    # TODO: if <needs_sonar>
    DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
    DEPENDS(${TEST_RUNNER})
    _GHOST_PEERDIR(${TEST_RUNNER})
    PEERDIR(build/platform/java/jacoco-agent)
    JAVA_TEST()

    SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
}

### @usage: JTEST_FOR(ModuleDir)
###
### Convinience java tests module based on JUnit 4 framework for specified library or program.
###
### In contrast to the JTEST, the build system will scan for the presence of the test sources of the module in ModuleDir . As ModuleDir should contain JAVA_PROGRAM or JAVA_LIBRARY . JTEST_FOR also can have its own source, in this case they will be compiled and added to the classpath of a test run.
### Output artifacts: a jar, a directory of exhaust tests(if requested tests are run).
###
### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynajava
module JTEST_FOR: JTEST {
    .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
    SET(MODULE_TYPE JTEST_FOR)
    SET(TEST_CLASSPATH_VALUE ${MODDIR} ${TEST_RUNNER} ${UNITTEST_DIR})

    PEERDIR(devtools/jtest-annotations/junit4 $UNITTEST_DIR)
    SET(REALPRJNAME jtest)
    JAVA_TEST()
}

module JAVA_CONTRIB_PROGRAM: JAVA_CONTRIB {
    SET(MODULE_TYPE JAVA_PROGRAM)
    ENABLE(DISABLE_SCRIPTGEN)
}

### @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
module DLL_JAVA: DLL {
    .EXTS=.o .obj .jsrc .java .mf
    .CMD=SWIG_DLL_JAR_CMD
    PEERDIR(build/platform/java/jdk)
    PEERDIR+=$JDK_RESOURCE_PEERDIR

    SWIG_LANG=java
}