|
1 | 1 | import org.gradle.api.tasks.testing.logging.TestExceptionFormat |
2 | 2 | import org.gradle.api.tasks.testing.logging.TestLogEvent |
3 | 3 |
|
| 4 | +//this plugin is for projects that are pure java, meaning they don't have the |
| 5 | +//org.jetbrains.intellij plugin. |
| 6 | +//for example analytics-provider, model |
| 7 | + |
4 | 8 | plugins { |
5 | 9 | id("digma-base") |
6 | 10 | `java-library` |
7 | 11 | } |
8 | 12 |
|
9 | 13 |
|
10 | 14 | tasks { |
11 | | - create("buildPlugin") { |
12 | | - //a workaround: if the project is built by calling buildPlugin |
13 | | - // then build is not called for projects that are not intellij plugin project. |
14 | | - dependsOn(build) |
15 | | - } |
16 | | - |
17 | | - |
18 | | - withType<Test> { |
19 | | - doFirst { |
20 | | - logger.lifecycle("${project.name}:${name}: testing java with {}", javaLauncher.get().executablePath) |
21 | | - } |
22 | | - |
23 | | - addTestListener(object : TestListener { |
24 | | - override fun beforeTest(testDescriptor: TestDescriptor) {} |
25 | | - override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {} |
26 | | - |
27 | | - override fun beforeSuite(suite: TestDescriptor) { |
28 | | - if (suite.parent == null) { // root suite |
29 | | - logger.lifecycle("Starting Test suite {}", suite) |
30 | | - } |
31 | | - } |
32 | | - |
33 | | - override fun afterSuite(suite: TestDescriptor, result: TestResult) { |
34 | | - if (suite.parent == null) { // root suite |
35 | | - logger.lifecycle( |
36 | | - "Test suite ${suite.name} completed:: ${result.resultType}, " + |
37 | | - "success ${result.successfulTestCount}, " + |
38 | | - "failed ${result.failedTestCount}, " + |
39 | | - "skipped ${result.skippedTestCount}." |
40 | | - ) |
41 | | - |
42 | | - } |
43 | | - } |
44 | | - }) |
45 | | - |
46 | | - |
47 | | - testLogging { |
48 | | - lifecycle { |
49 | | - events = mutableSetOf(TestLogEvent.FAILED) |
50 | | - exceptionFormat = TestExceptionFormat.SHORT |
51 | | - showExceptions = true |
52 | | - showCauses = true |
53 | | - showStackTraces = false |
54 | | - showStandardStreams = false |
55 | | - } |
56 | | - debug { |
57 | | - events = mutableSetOf(TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED) |
58 | | - exceptionFormat = TestExceptionFormat.FULL |
59 | | - showExceptions = true |
60 | | - showCauses = true |
61 | | - showStackTraces = true |
62 | | - showStandardStreams = true |
63 | | - } |
64 | | - info.events = debug.events |
65 | | - info.exceptionFormat = debug.exceptionFormat |
66 | | - |
67 | | - |
68 | | - } |
69 | | - |
70 | | - addTestOutputListener { testDescriptor, outputEvent -> |
71 | | - if (outputEvent.destination == TestOutputEvent.Destination.StdErr) { |
72 | | - logger.error("Test: " + testDescriptor + ", error: " + outputEvent.message) |
73 | | - } |
74 | | - } |
75 | | - } |
| 15 | + //a workaround: if the project is built by calling buildPlugin |
| 16 | + // then build is not called for projects that are not intellij plugin project. |
| 17 | + create("buildPlugin").dependsOn(build) |
76 | 18 | } |
0 commit comments