Skip to content

Commit 30b334d

Browse files
committed
integrating codenarc & cobertura
1 parent 035f9bd commit 30b334d

File tree

10 files changed

+394
-19
lines changed

10 files changed

+394
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This CUBA component gives users a mailbox for user to user and system to user me
3131

3232
| Platform Version | Add-on Version |
3333
| ---------------- | -------------- |
34-
| 6.6.x | 0.1.x |
34+
| 6.8.x | 0.1.x |
3535

3636
The latest version is: `0.1.0`
3737

build.gradle

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ buildscript {
1212
}
1313
dependencies {
1414
classpath "com.haulmont.gradle:cuba-plugin:$cubaVersion"
15+
16+
17+
classpath 'net.saliman:gradle-cobertura-plugin:2.5.0'
18+
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2"
1519
}
1620
}
1721

22+
23+
apply plugin: "com.github.kt3k.coveralls"
24+
1825
def globalModule = project(':user-inbox-global')
1926
def coreModule = project(':user-inbox-core')
2027
def guiModule = project(':user-inbox-gui')
@@ -26,6 +33,10 @@ def servletApi = 'org.apache.tomcat:tomcat-servlet-api:8.0.26'
2633
apply(plugin: 'idea')
2734
apply(plugin: 'cuba')
2835

36+
37+
def bintrayRepositoryUrl = "https://api.bintray.com/maven/mariodavid/cuba-components/cuba-component-user-inbox/;publish=1"
38+
39+
2940
cuba {
3041
artifact {
3142
group = 'de.diedavids.cuba.userinbox'
@@ -35,6 +46,16 @@ cuba {
3546
tomcat {
3647
dir = "$project.rootDir/deploy/tomcat"
3748
}
49+
uploadRepository {
50+
if (cuba.artifact.isSnapshot) {
51+
url = System.properties['uploadRepositorySnapshot'] ?: System.env.UPLOAD_REPOSITORY_SNAPSHOT
52+
} else {
53+
url = System.properties['uploadRepositoryRelease'] ?: System.env.UPLOAD_REPOSITORY_RELEASE ?: bintrayRepositoryUrl
54+
}
55+
56+
user = System.properties['uploadRepositoryUsername'] ?: System.env.UPLOAD_REPOSITORY_USERNAME
57+
password = System.properties['uploadRepositoryPassword'] ?:System.env.UPLOAD_REPOSITORY_PASSWORD
58+
}
3859
ide {
3960
vcs = 'Git'
4061
}
@@ -47,6 +68,39 @@ dependencies {
4768

4869
def hsql = 'org.hsqldb:hsqldb:2.2.9'
4970

71+
72+
allprojects {
73+
apply plugin: 'net.saliman.cobertura'
74+
}
75+
76+
77+
def files = subprojects
78+
.findAll{ !it.name.toLowerCase().contains('theme') }
79+
.collect { new File(it.projectDir, '/build/cobertura/cobertura.ser')}
80+
def sourceDirs = subprojects
81+
.findAll{ !it.name.toLowerCase().contains('theme') }
82+
.collect { new File(it.projectDir, '/src')}
83+
84+
cobertura {
85+
coverageFormats = ['html', 'xml']
86+
coverageMergeDatafiles = files
87+
coverageCheckTotalBranchRate = 0
88+
coverageCheckTotalLineRate = 0
89+
coverageCheckHaltOnFailure = true
90+
coverageSourceDirs = sourceDirs
91+
// coverageCheckLineRate = 1
92+
coverageCheckRegexes = [[regex: '.*\\$.*', branchRate: 0, lineRate: 0]]
93+
94+
}
95+
96+
97+
test.dependsOn(subprojects.collect{ ":${it.name}:test"} )
98+
test.finalizedBy(project.tasks.cobertura)
99+
test.finalizedBy(project.tasks.coberturaCheck)
100+
101+
102+
103+
50104
configure([globalModule, coreModule, guiModule, webModule]) {
51105
apply(plugin: 'java')
52106
apply(plugin: 'maven')
@@ -55,6 +109,11 @@ configure([globalModule, coreModule, guiModule, webModule]) {
55109

56110
dependencies {
57111
testCompile('junit:junit:4.12')
112+
113+
114+
testCompile('org.spockframework:spock-core:1.0-groovy-2.4')
115+
testCompile('org.springframework:spring-test:4.3.1.RELEASE')
116+
testRuntime "cglib:cglib-nodep:3.2.4"
58117
}
59118

60119
task sourceJar(type: Jar) {
@@ -70,6 +129,39 @@ configure([globalModule, coreModule, guiModule, webModule]) {
70129
configure([globalModule, coreModule, guiModule, webModule]) {
71130
apply(plugin: 'groovy')
72131

132+
apply plugin: 'net.saliman.cobertura'
133+
apply plugin: 'codenarc'
134+
135+
codenarc {
136+
toolVersion = "0.24"
137+
ignoreFailures = false
138+
reportFormat = 'html'
139+
reportsDir = new File("./build/reports/codenarc")
140+
}
141+
142+
codenarcMain {
143+
configFile = rootProject.file("config/codenarc/rulesMain.groovy")
144+
}
145+
codenarcTest {
146+
configFile = rootProject.file("config/codenarc/rulesTests.groovy")
147+
}
148+
149+
150+
cobertura {
151+
coverageFormats = ['html', 'xml']
152+
coverageIgnoreTrivial = true
153+
coverageIgnores = ['org.slf4j.Logger.*']
154+
coverageReportDir = new File("$buildDir/reports/cobertura")
155+
156+
coverageExcludes = [
157+
'.*Generator',
158+
'.*Enum',
159+
'.*Hilfe.*' // Hilfe wird vorerst deaktiviert, da die Hilfe noch einem großen Refactoring unterliegt und dies bisher nur ein Proof of Concept ist
160+
]
161+
}
162+
163+
test.finalizedBy(project.tasks.cobertura)
164+
test.finalizedBy(project.tasks.coberturaCheck)
73165
sourceSets {
74166
main { groovy { srcDirs = ["src"] } }
75167
test { groovy { srcDirs = ["test"] } }
@@ -225,3 +317,9 @@ task wrapper(type: Wrapper) {
225317
}
226318

227319
apply from: 'extra.gradle'
320+
321+
322+
323+
clean {
324+
delete = ['build/libs', 'build/tmp']
325+
}

0 commit comments

Comments
 (0)