forked from SpongePowered/SpongeAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
176 lines (151 loc) · 4.68 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
// Gradle repositories and dependencies
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
}
}
// Apply plugin
apply plugin: 'java'
apply plugin: 'license'
apply plugin: 'checkstyle'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
// Default tasks
defaultTasks 'licenseFormat', 'check', 'build'
// Basic project information
group = 'org.spongepowered'
archivesBaseName = 'spongeapi'
version = '1.0.0-SNAPSHOT'
// Extended project information
ext.projectName = 'SpongeAPI'
ext.inceptionYear = '2014'
ext.packaging = 'jar'
ext.url = 'http://spongepowered.org'
ext.description = 'SpongeAPI'
ext.organization = 'SpongePowered'
// Define variables
ext.buildNumber = project.hasProperty("buildNumber") ? buildNumber : '0'
ext.ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown'
ext.commit = project.hasProperty("commit") ? commit : 'unknown'
// Minimum version of Java required
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
// Project repositories
repositories {
mavenCentral()
}
configurations {
deployerJars // maven stuff
}
// Project dependencies
dependencies {
compile 'org.apache.logging.log4j:log4j-api:2.0-beta9'
compile 'com.google.guava:guava:16.0'
compile 'com.google.code.findbugs:jsr305:1.3.9'
testCompile 'junit:junit:4.11'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.mockito:mockito-core:1.9.0'
// maven
deployerJars 'org.apache.maven.wagon:wagon-ftp:2.7'
}
// Filter, process, and include resources
processResources {
// Include in final JAR
from 'LICENSE.txt'
}
// License header formatting
license {
ext.name = project.name
ext.organization = project.organization
ext.url = project.url
ext.year = project.inceptionYear
exclude "**/*.info"
exclude "assets/**"
header file('HEADER.txt')
sourceSets = project.sourceSets
ignoreFailures false
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE'
}
}
checkstyle {
configProperties = [
"name" : project.name,
"organization": project.organization,
"url" : project.url,
"year" : project.inceptionYear
]
configFile = file("checkstyle.xml")
}
// Source compiler configuration
configure([compileJava, compileTestJava]) {
options.compilerArgs += ['-Xlint:all', '-Xlint:-path']
options.deprecation = true
options.encoding = 'utf8'
}
// JAR manifest configuration
jar.manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": name,
"Implementation-Version": version + "+" + ciSystem + "-b" + buildNumber + ".git-" + commit,
"Implementation-Vendor": url)
task sourceJar(type: Jar) {
from sourceSets.main.java
from sourceSets.main.resources
classifier = "sources"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = "javadoc"
}
artifacts {
archives jar
archives sourceJar
archives javadocJar
}
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
if (project.hasProperty("chRepo"))
{
repository(url: project.chRepo) {
authentication(userName: project.chUsername, password: project.chPassword)
}
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'Sponge API'
url 'http://www.spongepowered.org/'
scm {
url 'https://github.com/SpongePowered/SpongeAPI'
connection 'scm:git:git://github.com/SpongePowered/SpongeAPI.git'
developerConnection 'scm:git:[email protected]:SpongePowered/SpongeAPI.git'
}
issueManagement {
system 'youtrack'
url 'https://issues.spongepowered.org/'
}
licenses {
license {
name 'MIT liscence'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
}
}
}
}
}
}
}