Skip to content

Commit 64af309

Browse files
author
Alexander Litus
committed
Extract Jacoco plugin.
1 parent 8ea47e6 commit 64af309

File tree

2 files changed

+45
-22
lines changed

2 files changed

+45
-22
lines changed

build.gradle

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,6 @@ allprojects {
4242

4343
subprojects {
4444

45-
apply plugin: 'java'
46-
apply plugin: 'com.google.protobuf'
47-
48-
sourceCompatibility = 1.7
49-
targetCompatibility = 1.7
50-
51-
// Set Java home to point to JDK7 in gradle.properties file.
52-
//
53-
// For Mac OS X, it looks like this:
54-
//
55-
// # suppress inspection "UnusedProperty"
56-
// org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/
57-
5845
project.ext {
5946
SRC_DIR = "$projectDir/src"
6047
GEN_DIR = "$projectDir/generated"
@@ -70,8 +57,23 @@ subprojects {
7057
TEST_ARTIFACTS_PLUGIN_PATH = '../gradle/plugins/test-artifacts.gradle'
7158
GEN_DESCRIPTOR_SET_PLUGIN_PATH = '../gradle/plugins/generate-descriptor-set.gradle'
7259
GRPC_PLUGIN_PATH = '../gradle/plugins/grpc.gradle'
60+
JACOCO_PLUGIN_PATH = '../gradle/plugins/jacoco.gradle'
7361
}
7462

63+
apply plugin: 'java'
64+
apply plugin: 'com.google.protobuf'
65+
apply from: JACOCO_PLUGIN_PATH
66+
67+
sourceCompatibility = 1.7
68+
targetCompatibility = 1.7
69+
70+
// Set Java home to point to JDK7 in gradle.properties file.
71+
//
72+
// For Mac OS X, it looks like this:
73+
//
74+
// # suppress inspection "UnusedProperty"
75+
// org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/
76+
7577
repositories {
7678
mavenLocal()
7779
mavenCentral()
@@ -132,15 +134,6 @@ subprojects {
132134
classifier "test"
133135
}
134136

135-
jacocoTestReport {
136-
reports {
137-
xml.enabled = true
138-
html.enabled = true
139-
}
140-
}
141-
142-
check.dependsOn jacocoTestReport
143-
144137
idea.module.iml {
145138
beforeMerged { final module ->
146139
module.dependencies.clear()

gradle/plugins/jacoco.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2016, TeamDev Ltd. All rights reserved.
3+
*
4+
* Redistribution and use in source and/or binary forms, with or without
5+
* modification, must retain the above copyright notice and the following
6+
* disclaimer.
7+
*
8+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
10+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
11+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
12+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
13+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
14+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
15+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
16+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
18+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19+
*/
20+
21+
// Apply this script to enable JaCoCo test report.
22+
23+
jacocoTestReport {
24+
reports {
25+
xml.enabled = true
26+
html.enabled = true
27+
}
28+
}
29+
30+
check.dependsOn jacocoTestReport

0 commit comments

Comments
 (0)