-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
211 lines (185 loc) · 6.05 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
// Default tasks
defaultTasks 'clean', 'licenseFormat', 'check', 'build', 'install'
// Apply plugins
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'cobertura'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'license'
apply plugin: 'maven'
apply plugin: 'signing'
// Project information
ext.projectName = 'Flow Components'
group = 'com.flowpowered'
archivesBaseName = 'flow-components'
version = '0.1.0-SNAPSHOT'
ext.packaging = 'jar'
ext.inceptionYear = '2014'
ext.url = 'http://flowpowered.com'
ext.description = 'Component system framework library for use in game engines.'
// Organization information
ext.organization = 'Spout LLC'
ext.organizationUrl = 'https://spout.org'
// Build properties
ext.buildNumber = project.hasProperty('buildNumber') ? buildNumber : '0'
ext.ciSystem = project.hasProperty('ciSystem') ? ciSystem : 'unknown'
ext.commit = project.hasProperty('commit') ? commit : 'unknown'
// Build repositories and dependencies
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
name = 'sonatype-nexus'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.10.0'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.0'
classpath 'net.saliman:gradle-cobertura-plugin:2.2.4' // Coveralls plugin dependency
}
}
// Project repositories
repositories {
mavenLocal()
mavenCentral()
maven {
name = 'sonatype-nexus'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
// Project dependencies
dependencies {
//compile 'com.google.code.findbugs:jsr305:1.3.9'
//compile 'junit:junit:4.11'
testCompile 'junit:junit:4.11'
}
// Filter, process, and include resources
processResources {
// Include license in final JAR
from 'LICENSE.txt'
}
// License header formatting
license {
ext.project = projectName
ext.year = inceptionYear
ext.name = organization
ext.url = organizationUrl
header file('HEADER.txt')
ignoreFailures false
strictCheck true
useDefaultMappings false
mapping {
java = 'SLASHSTAR_STYLE'
}
}
// Code style checking
checkstyle {
configProperties = [
"project" : projectName,
"name" : organization,
"url" : organizationUrl,
"year" : inceptionYear
]
configFile = file("checkstyle.xml")
}
// Source compiler configuration
configure([compileJava, compileTestJava]) {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
options.compilerArgs += [ '-Xlint:all', '-Xlint:-path' ]
options.deprecation = true
options.encoding = 'UTF-8'
}
// JAR manifest configuration
jar.manifest.mainAttributes(
'Built-By': System.properties['user.name'],
'Created-By': System.properties['java.vm.version'] + ' (' + System.properties['java.vm.vendor'] + ')',
'Specification-Title': projectName,
'Specification-Version': version + '+' + ciSystem + '-b' + buildNumber + '.git-' + commit,
'Specification-Vendor': organization + ' - ' + organizationUrl
)
// Coveralls report configuration
cobertura.coverageFormats = ['html', 'xml'] // Coveralls requires xml format
// Artifact deployment
uploadArchives {
repositories.mavenDeployer {
// Javadoc JAR generation
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
// Source JAR generation
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.java.srcDirs
}
// Set all artifacts
artifacts {
archives jar, javadocJar, sourcesJar
}
// Tasks and variables based on if release or snapshot
if (version.endsWith('-SNAPSHOT')) {
// Set variable to snapshots repository URL
ext.sonatypeUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
} else {
// Set variable to releases repository URL
ext.sonatypeUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
// Artifact signing
signing {
// Sign JAR artifacts
sign configurations.archives
// Sign Maven POM
beforeDeployment {
org.gradle.api.artifacts.maven.MavenDeployment deployment -> signing.signPom(deployment)
}
}
}
// Set login credentials for repository
repository(url: sonatypeUrl) {
authentication(userName: System.getenv("sonatypeUsername"), password: System.getenv("sonatypePassword"))
}
// Maven POM generation
pom.project {
name projectName
artifactId archivesBaseName
packaging packaging
inceptionYear inceptionYear
url url
description project.ext.description
scm {
connection 'scm:git:git://github.com/flow/flow-components.git'
developerConnection 'scm:git:ssh://[email protected]:flow/flow-components.git'
url 'https://github.com/flow/flow-components'
}
licenses {
license {
name 'MIT License'
url 'https://tldrlegal.com/license/mit-license'
distribution 'repo'
}
}
organization {
name organization
url organizationUrl
}
developers {
developer {
id 'Wulfspider'
name 'Luke Spragg'
email '[email protected]'
}
developer {
id 'Zidane'
name 'Chris Sanders'
email '[email protected]'
}
}
issueManagement {
system 'github'
url 'https://github.com/flow/flow-components/issues'
}
}
}
}