-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.gradle
More file actions
175 lines (144 loc) · 5.28 KB
/
build.gradle
File metadata and controls
175 lines (144 loc) · 5.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
// ============================================================================ // KASPER - Kasper is the treasure keeper
// www.viadeo.com - mobile.viadeo.com - api.viadeo.com - dev.viadeo.com
// Viadeo Framework for effective CQRS/DDD architecture
// ============================================================================
ext.gradleDir = "${rootProject.rootDir}/gradle"
ext.nexusCredentials = {
username nexus_username
password nexus_password
}
wrapper.gradleVersion = '2.9'
configure(allprojects) {
apply plugin: 'idea'
apply plugin: 'maven'
}
configure(rootProject) {
idea.project {
languageLevel = '1.8'
ipr {
withXml { provider ->
def mapping = provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping
mapping.@vcs = 'Git'
mapping.@directory = '$PROJECT_DIR$'
}
}
}
apply plugin: 'sonar-runner'
// Sonar configuration for root project
sonarRunner {
sonarProperties {
property "sonar.host.url", "http://${sonar_host}:8080/sonar/"
property "sonar.jdbc.url", "jdbc:mysql://${sonar_host}:3306/sonar?useUnicode=true&characterEncoding=utf8"
property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
property "sonar.jdbc.username", "sonar"
property "sonar.jdbc.password", "sonar"
property "sonar.dynamicAnalysis", "true"
}
}
}
configure(subprojects) {
apply plugin: 'java'
apply from: "${rootProject.rootDir}/libraries.gradle"
group = 'com.viadeo.kasper'
version = '1.5.2'
if (project.name =~ /kasper-api|kasper-client|kasper-common/) {
sourceCompatibility = 1.6
targetCompatibility = 1.6
} else {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
idea.module.iml.withXml {
it.node.component.find { it.@name == 'NewModuleRootManager' }.@LANGUAGE_LEVEL = '1.8'
}
configure([compileJava, compileTestJava]) {
options.encoding = 'UTF-8'
options.warnings = false
}
configurations {
all*.exclude module: 'slf4j-log4j12'
all*.exclude module: 'slf4j-jcl'
all*.exclude module: 'slf4j-jdk14'
all*.exclude module: 'log4j'
deployerJars
}
repositories {
// mavenLocal()
// Maven Central is first to be the default repository (ordering is important)
mavenCentral()
// Viadeo Nexus
// Variables must be present in the 'gradle.properties' file
maven {
url "https://${nexus_host}/content/groups/all_repositories"
credentials nexusCredentials
}
}
test {
// Ensure we don't write where the task 'test' already writes
def junitXmlDestination = System.getenv("CIRCLE_TEST_REPORTS") ?: "${rootProject.buildDir}"
reports {
junitXml.destination = "${junitXmlDestination}/test-results"
}
}
// Adding javadoc and sources jars, it is really nice to have! --------------
// custom tasks for creating source jar
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
javadoc {
failOnError = false
}
// custom tasks for creating javadoc jar
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
// add the jars as artifacts
artifacts {
archives sourcesJar
archives javadocJar
}
jar {
manifest {
attributes(
"Manifest-Version" : "1.0",
"Kasper-Version" : version
)
}
}
// -----------------------------------------------------------------------------------------------------------------
apply plugin: 'jacoco'
// Jacoco configuration
tasks.withType(Test) {
jacoco {
append = true
destinationFile = file("$rootDir/build/jacoco/jacocoTest.exec")
}
}
// -----------------------------------------------------------------------------------------------------------------
uploadArchives {
repositories.mavenDeployer {
configuration = configurations.deployerJars
repository(url: "https://${nexus_host}/content/repositories/kasper-releases") {
authentication(userName: nexus_username, password: nexus_password)
}
snapshotRepository(url: "https://${nexus_host}/content/repositories/kasper-snapshots") {
authentication(userName: nexus_username, password: nexus_password)
}
}
}
// -----------------------------------------------------------------------------------------------------------------
// Sonar configuration for sub-projects
sonarRunner {
sonarProperties {
property "sonar.sourceEncoding", "UTF-8"
}
}
}
task alljavadoc(type: Javadoc) {
source rootProject.subprojects.collect { project -> project.sourceSets.main.allJava }
classpath = files(rootProject.subprojects.collect { project -> project.sourceSets.main.compileClasspath })
destinationDir = file('build/javadoc')
}
apply from: "${gradleDir}/circleci.gradle"