-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
executable file
·181 lines (150 loc) · 5.31 KB
/
build.gradle
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
175
176
177
178
179
180
181
defaultTasks "build"
configure(allprojects) {
group = 'name.mitterdorfer.perlock'
version = '0.3.1'
ext.slf4jVersion = '1.7.5'
ext.log4jVersion = '1.2.17'
ext.junitVersion = '4.11'
ext.mockitoVersion = '1.9.5'
ext.jimfsVersion = '1.1'
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.7
targetCompatibility = 1.7
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
testCompile group: 'junit', name: 'junit', version: junitVersion
testCompile group: 'com.google.jimfs', name: 'jimfs', version: jimfsVersion
testCompile group: 'org.mockito', name: 'mockito-core', version: mockitoVersion
//provide log4j binding for test and demo code only!
testRuntime group: 'org.slf4j', name: 'slf4j-log4j12', version: slf4jVersion
testRuntime group: 'log4j', name: 'log4j', version: log4jVersion
}
}
idea {
project {
languageLevel = '1.7'
}
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
//see http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html
//configurations.all {
// resolutionStrategy.failOnVersionConflict()
//}
configure(subprojects) { subproject ->
jar {
manifest {
attributes(
"Implementation-Title": subproject.name,
"Implementation-Version": subproject.version,
"Author": "Daniel Mitterdorfer <[email protected]>",
)
}
}
javadoc {
options.author = true
options.header = project.name
//options.links(project.ext.javadocLinks)
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
//exclude 'impl' package as they only consists of internal implementation classes which should not be used by clients
excludes = ["**/impl/**"] as Set
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = "sources"
from sourceSets.main.allJava.srcDirs
include "**/*.java"
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
}
configure([project(":perlock-core"), project(":perlock-spring")]) { subproject ->
// This build script is based on https://github.com/GradleFx/GradleFx/blob/master/build.gradle
apply plugin: 'maven'
apply plugin: 'signing'
def isDevBuild
def isCiBuild
def isReleaseBuild
def sonatypeRepositoryUrl
//set build variables based on build type
// hasProperty check has to be done on subproject - see http://issues.gradle.org/browse/GRADLE-1826
if(subproject.hasProperty("release")) {
isReleaseBuild = true
sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
} else if (subproject.hasProperty("ci")) {
isCiBuild = true
version += "-SNAPSHOT"
sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
} else {
version += "-SNAPSHOT"
isDevBuild = true
}
//********* artifact signing *********
if(isReleaseBuild) {
signing {
sign configurations.archives
}
} else {
task signArchives {
// do nothing
}
}
uploadArchives {
repositories {
if (isDevBuild) {
mavenLocal()
}
else {
mavenDeployer {
if(isReleaseBuild) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
repository(url: sonatypeRepositoryUrl) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name subproject.name
description subproject.description
packaging 'jar'
url 'https://github.com/danielmitterdorfer/perlock'
scm {
url 'scm:[email protected]:danielmitterdorfer/perlock.git'
connection 'scm:[email protected]:danielmitterdorfer/perlock.git'
developerConnection 'scm:[email protected]:danielmitterdorfer/perlock.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'danielmitterdorfer'
name 'Daniel Mitterdorfer'
}
}
}
}
}
}
}
}