1
- // Gradle repositories and dependencies
2
1
buildscript {
3
2
repositories {
4
- mavenCentral()
5
3
jcenter()
6
4
}
5
+
7
6
dependencies {
8
7
classpath ' nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
9
8
}
10
9
}
11
10
12
- // Apply plugin
13
- apply plugin : ' java'
14
- apply plugin : ' license'
15
- apply plugin : ' checkstyle'
16
- apply plugin : ' maven'
17
- apply plugin : ' eclipse'
18
- apply plugin : ' idea'
19
-
20
- // Default tasks
21
- defaultTasks ' licenseFormat' , ' check' , ' build'
22
-
23
- // Basic project information
24
- group = ' org.spongepowered'
25
- archivesBaseName = ' spongeapi'
26
11
version = ' 1.1-SNAPSHOT'
27
12
28
- // Extended project information
29
- ext. projectName = ' SpongeAPI'
30
- ext. inceptionYear = ' 2014'
31
- ext. packaging = ' jar'
32
- ext. url = ' http://spongepowered.org'
33
- ext. description = ' SpongeAPI'
34
- ext. organization = ' SpongePowered'
35
-
36
- // Define variables
37
- ext. buildNumber = project. hasProperty(" buildNumber" ) ? buildNumber : ' 0'
38
- ext. ciSystem = project. hasProperty(" ciSystem" ) ? ciSystem : ' unknown'
39
- ext. commit = project. hasProperty(" commit" ) ? commit : ' unknown'
40
-
41
- // Minimum version of Java required
42
- sourceCompatibility = ' 1.6'
43
- targetCompatibility = ' 1.6'
44
-
45
- // Project repositories
46
- repositories {
47
- mavenCentral()
48
-
49
- // Add Sponge repo for custom checkstyle implementation to fix some wrong warnings
50
- maven { url ' http://repo.spongepowered.org/maven' }
51
- }
52
-
53
- configurations {
54
- deployerJars // maven stuff
55
- }
13
+ ext. api = project
14
+ apply from : ' gradle/java.gradle'
56
15
57
16
// Project dependencies
58
17
dependencies {
@@ -63,150 +22,11 @@ dependencies {
63
22
compile ' ninja.leaping.configurate:configurate-hocon:1.1'
64
23
compile ' com.flowpowered:flow-math:1.0.0'
65
24
compile ' org.ow2.asm:asm:5.0.3'
66
- testCompile ' junit:junit:4.11'
67
- testCompile ' org.hamcrest:hamcrest-library:1.3'
68
- testCompile ' org.mockito:mockito-core:1.9.0'
69
-
70
- checkstyle ' org.spongepowered:checkstyle:6.1.1-sponge1'
71
-
72
- // maven
73
- deployerJars ' org.apache.maven.wagon:wagon-ftp:2.7'
74
- }
75
-
76
- // Filter, process, and include resources
77
- processResources {
78
- // Include in final JAR
79
- from ' LICENSE.txt'
80
- }
81
-
82
- // License header formatting
83
- license {
84
- ext. name = project. name
85
- ext. organization = project. organization
86
- ext. url = project. url
87
- ext. year = project. inceptionYear
88
- exclude " **/*.info"
89
- exclude " assets/**"
90
- header file(' HEADER.txt' )
91
- sourceSets = project. sourceSets
92
- ignoreFailures false
93
- strictCheck true
94
- mapping {
95
- java = ' SLASHSTAR_STYLE'
96
- }
97
- }
98
-
99
- test {
100
- testLogging {
101
- exceptionFormat = ' full'
102
- }
103
- }
104
-
105
- checkstyle {
106
- configFile = file(' checkstyle.xml' )
107
- configProperties = [
108
- " name" : project. name,
109
- " organization" : project. organization,
110
- " url" : project. url,
111
- " year" : project. inceptionYear,
112
- " basedir" : project. projectDir,
113
- " severity" : ' warning'
114
- ]
115
- }
116
-
117
- // Source compiler configuration
118
- configure([compileJava, compileTestJava]) {
119
- options. compilerArgs + = [' -Xlint:all' , ' -Xlint:-path' ]
120
- options. deprecation = true
121
- options. encoding = ' utf8'
122
- }
123
-
124
- javadoc {
125
- options. jFlags(' -Xms256m' , ' -Xmx512m' )
126
- options. links(" http://docs.guava-libraries.googlecode.com/git-history/v17.0/javadoc/" ,
127
- " http://google.github.io/guice/api-docs/latest/javadoc/" ,
128
- " http://flowpowered.com/math/" ,
129
- " http://asm.ow2.org/asm50/javadoc/user/" ,
130
- " http://www.slf4j.org/apidocs/" ,
131
- " http://docs.oracle.com/javase/6/docs/api/" )
132
- }
133
-
134
- if (JavaVersion . current(). isJava8Compatible()) {
135
- tasks. withType(Javadoc ) {
136
- // disable the crazy super-strict doclint tool in Java 8
137
- options. addStringOption(' Xdoclint:none' , ' -quiet' )
138
- }
139
25
}
140
26
141
27
// JAR manifest configuration
142
- jar. manifest. mainAttributes(
143
- " Built-By" : System . properties[' user.name' ],
144
- " Created-By" : System . properties[' java.vm.version' ] + " (" + System . properties[' java.vm.vendor' ] + " )" ,
145
- " Implementation-Title" : name,
146
- " Implementation-Version" : version + " +" + ciSystem + " -b" + buildNumber + " .git-" + commit,
147
- " Implementation-Vendor" : url,
148
- " Main-Class" : " org.spongepowered.api.util.InformativeMain" )
149
-
150
- task sourceJar (type : Jar ) {
151
- from sourceSets. main. java
152
- from sourceSets. main. resources
153
- classifier = " sources"
154
- }
155
-
156
- task javadocJar (type : Jar , dependsOn : javadoc) {
157
- from javadoc. destinationDir
158
- classifier = " javadoc"
159
- }
160
-
161
- artifacts {
162
- archives jar
163
- archives sourceJar
164
- archives javadocJar
165
- }
166
-
167
- uploadArchives {
168
- repositories {
169
-
170
- mavenDeployer {
171
- configuration = configurations. deployerJars
172
-
173
- if (project. hasProperty(" chRepo" ))
174
- {
175
- repository(url : project. chRepo) {
176
- authentication(userName : project. chUsername, password : project. chPassword)
177
- }
178
- }
179
-
180
- pom {
181
- groupId = project. group
182
- version = project. version
183
- artifactId = project. archivesBaseName
184
- project {
185
- name project. archivesBaseName
186
- packaging ' jar'
187
- description ' Sponge API'
188
- url ' http://www.spongepowered.org/'
189
-
190
- scm {
191
- url ' https://github.com/SpongePowered/SpongeAPI'
192
- connection ' scm:git:git://github.com/SpongePowered/SpongeAPI.git'
193
- developerConnection
' scm:git:[email protected] :SpongePowered/SpongeAPI.git'
194
- }
195
-
196
- issueManagement {
197
- system ' youtrack'
198
- url ' https://issues.spongepowered.org/'
199
- }
200
-
201
- licenses {
202
- license {
203
- name ' MIT license'
204
- url ' http://opensource.org/licenses/MIT'
205
- distribution ' repo'
206
- }
207
- }
208
- }
209
- }
210
- }
28
+ jar {
29
+ manifest {
30
+ attributes(' Main-Class' : ' org.spongepowered.api.util.InformativeMain' )
211
31
}
212
32
}
0 commit comments