Skip to content

Commit 95675e2

Browse files
author
ubourdon_kyriba
committed
fix: baseDir property value for multi-module projects
1 parent ac4a9ab commit 95675e2

File tree

5 files changed

+20
-22
lines changed

5 files changed

+20
-22
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build
2+
.gradle
3+
4+
*.iml
5+
*.ipr
6+
*.iws
7+
*.idea

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ apply plugin: 'idea'
1111
apply plugin: 'maven'
1212
apply plugin: 'signing'
1313
apply plugin: 'groovy'
14-
apply plugin: 'release'
14+
//apply plugin: 'release'
1515

1616
group 'com.github.maiflai'
1717

@@ -36,11 +36,11 @@ artifacts {
3636
archives sourcesJar
3737
}
3838

39-
signing {
39+
/*signing {
4040
sign configurations.archives
41-
}
41+
}*/
4242

43-
uploadArchives {
43+
/*uploadArchives {
4444
repositories {
4545
mavenDeployer {
4646
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
@@ -80,4 +80,4 @@ uploadArchives {
8080
}
8181
}
8282
}
83-
}
83+
}*/

src/main/groovy/com/github/maiflai/OverallCheckTask.groovy

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,19 @@ import org.gradle.api.tasks.TaskAction
88
* Throws a GradleException if overall line coverage dips below the configured percentage.
99
*/
1010
class OverallCheckTask extends DefaultTask {
11-
1211
File cobertura
1312
double minimumLineRate = 1
1413

1514
@TaskAction
1615
void requireLineCoverage() {
17-
1816
def reportDirName = project.extensions[ScctPlugin.CONFIGURATION_NAME].reportDirName
19-
if (cobertura == null){
20-
cobertura = project.file("$project.buildDir/reports/$reportDirName/cobertura.xml")
21-
}
17+
18+
if (cobertura == null) cobertura = project.file("$project.buildDir/reports/$reportDirName/cobertura.xml")
2219

2320
def xml = new XmlParser().parse(cobertura)
2421
def overallLineRate = xml.attribute('line-rate').toDouble()
2522
def difference = (minimumLineRate - overallLineRate)
23+
2624
if (difference > 0.001) throw new GradleException("Line coverage of $overallLineRate is below $minimumLineRate by $difference")
2725
}
28-
29-
}
26+
}

src/main/groovy/com/github/maiflai/ScctExtension.groovy

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.github.maiflai
22

33
import org.gradle.api.Action
4-
import org.gradle.api.Plugin
54
import org.gradle.api.Project
6-
import org.gradle.api.Task
75
import org.gradle.api.plugins.JavaPlugin
86
import org.gradle.api.plugins.scala.ScalaPlugin
97
import org.gradle.api.tasks.SourceSet
@@ -64,6 +62,8 @@ class ScctExtension {
6462
}
6563
t.tasks[ScctPlugin.TEST_NAME].configure {
6664
systemProperty 'scct.report.dir', "${t.buildDir}/reports/${t.extensions[ScctPlugin.CONFIGURATION_NAME].reportDirName}"
65+
systemProperty 'scct.basedir', "${t.rootDir.absolutePath}" // for multi-module checking
66+
6767
def existingClasspath = classpath
6868
classpath = t.files(t.sourceSets[ScctPlugin.CONFIGURATION_NAME].output.classesDir) +
6969
project.configurations[ScctPlugin.CONFIGURATION_NAME] +
@@ -73,8 +73,4 @@ class ScctExtension {
7373
}
7474

7575
String reportDirName = 'scct'
76-
77-
78-
}
79-
80-
76+
}

src/main/groovy/com/github/maiflai/ScctPlugin.groovy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import org.gradle.api.Plugin
44
import org.gradle.api.Project
55

66
class ScctPlugin implements Plugin<Project> {
7-
87
static String CONFIGURATION_NAME = 'scct'
98

109
static String TEST_NAME = 'testScct'
@@ -17,5 +16,4 @@ class ScctPlugin implements Plugin<Project> {
1716
t.extensions.create(CONFIGURATION_NAME, ScctExtension, t)
1817
}
1918
}
20-
21-
}
19+
}

0 commit comments

Comments
 (0)