@@ -74,6 +74,24 @@ multimodule JAVA_PROGRAM {
74
74
}
75
75
}
76
76
77
+ ### Usage JUNIT_TESTS_JAR(path/to/some/peer realname.jar)
78
+ ###
79
+ ### Specifies jar to search test suites and test cases. By default tests are
80
+ ### searched in the jar compild by JTEST or JUNIT5 module sources. This macro
81
+ ### allows to specify diferent jar to search tests.
82
+ ###
83
+ ### Only one jar file is used to search tests. If this macro invoked multiple
84
+ ### times (which is not reccomended practice) only the last invocation will
85
+ ### have effect.
86
+ ###
87
+ ### If this macro is used no test from the module build by current ya.make
88
+ ### will be searched and executed.
89
+ macro JUNIT_TESTS_JAR(Dir, Jar) {
90
+ SET(UNITTEST_DIR $Dir)
91
+ PEERDIR($Dir)
92
+ SET(UNITTEST_MOD $Dir/$Jar)
93
+ }
94
+
77
95
BUILD_JUNIT5_JAR_SEM=$BUILD_JAR_SEM && junit5_test
78
96
79
97
multimodule JUNIT5 {
@@ -102,6 +120,7 @@ multimodule JUNIT5 {
102
120
.FINAL_TARGET=no
103
121
.DEFAULT_NAME_GENERATOR=FullPath
104
122
.SEM=BUILD_JUNIT5_JAR_SEM
123
+ .IGNORED=JUNIT_TESTS_JAR
105
124
106
125
PEERDIR+=devtools/junit5-runner
107
126
PEERDIR+=build/platform/java/jacoco-agent
@@ -157,6 +176,7 @@ multimodule JTEST {
157
176
.FINAL_TARGET=no
158
177
.DEFAULT_NAME_GENERATOR=FullPath
159
178
.SEM=BUILD_JUNIT4_JAR_SEM
179
+ .IGNORED=JUNIT_TESTS_JAR
160
180
161
181
SET(MODULE_TYPE JTEST)
162
182
DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
@@ -197,6 +217,7 @@ multimodule JTEST_FOR {
197
217
# |-> 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)
198
218
.IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION PROVIDES FEATURE_VERSION
199
219
.ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
220
+ .RESTRICTED=JUNIT_TESTS_JAR
200
221
.PEERDIRSELF=JAR_COMPILATION
201
222
.SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM
202
223
@@ -210,6 +231,7 @@ multimodule JTEST_FOR {
210
231
.FINAL_TARGET=no
211
232
.DEFAULT_NAME_GENERATOR=FullPath
212
233
.SEM=BUILD_JUNIT4_JAR_SEM
234
+ .RESTRICTED=JUNIT_TESTS_JAR
213
235
214
236
SET(MODULE_TYPE JTEST_FOR)
215
237
DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
@@ -272,7 +294,7 @@ module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
272
294
.ALIASES=SRCS=_SRCS_NO_GLOBAL
273
295
.ALLOWED=EMBED_JAVA_VCS_INFO
274
296
.RESTRICTED=EXTERNAL_JAR
275
- .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_CLASSPATH
297
+ .GLOBAL=MAVEN_EXPORT_COORDS
276
298
277
299
PEERDIR(build/platform/java/jdk)
278
300
PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR
@@ -440,7 +462,6 @@ module _JAR_BASE: _BARE_UNIT {
440
462
.ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE
441
463
.DEFAULT_NAME_GENERATOR=TwoDirNames
442
464
.RESTRICTED=WITH_JDK RESOURCE RESOURCE_FILES
443
- .GLOBAL=EXPORT_GRADLE_CLASSPATH
444
465
445
466
PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__
446
467
@@ -506,8 +527,6 @@ JAVA_CONTRIB_SEM= \
506
527
consumer-classpath $EXPORT_GRADLE_CLASSPATH \
507
528
&& consumer-jar ${MODDIR}/${REALPRJNAME}.jar \
508
529
&& consumer-type contrib \
509
- && peers_closure $MANAGED_PEERS_CLOSURE \
510
- && peers_closure_coords $EXPORT_GRADLE_CLASSPATH_GLOBAL \
511
530
&& IGNORED
512
531
513
532
# tag:java-specific
@@ -516,7 +535,7 @@ module JAVA_CONTRIB: _JAR_BASE {
516
535
.PEERDIR_POLICY=as_include
517
536
.SEM=JAVA_CONTRIB_SEM
518
537
.FINAL_TARGET=yes
519
- .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_CLASSPATH
538
+ .GLOBAL=MAVEN_EXPORT_COORDS
520
539
521
540
when ($JAR_RESOURCE_ID) {
522
541
FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX})
@@ -868,7 +887,6 @@ BUILD_JAR_SEM= \
868
887
&& consumer-classpath $EXPORT_GRADLE_CLASSPATH \
869
888
&& consumer-jar ${MODDIR}/${REALPRJNAME}.jar \
870
889
&& consumer-type library \
871
- && excludes_rules $EXCLUDE_VALUE \
872
890
$_KOTLIN_SEM \
873
891
$_JAR_MAIN_SEM \
874
892
$_GRADLE_EXPORT_PUBLISHING_SEM \
@@ -894,7 +912,7 @@ module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
894
912
.FINAL_TARGET=yes
895
913
.ALIASES=JAVA_SRCS=FULL_JAVA_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
896
914
.RESTRICTED=EXTERNAL_JAR
897
- .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_CLASSPATH
915
+ .GLOBAL=MAVEN_EXPORT_COORDS
898
916
MODULE_SUFFIX=.jar
899
917
900
918
PEERDIR(build/platform/java/jdk)
0 commit comments