Skip to content

Commit 15ccc8a

Browse files
committed
Add Gradle build support so Maven doesn't get lonely
1 parent 5b439a7 commit 15ccc8a

File tree

7 files changed

+483
-13
lines changed

7 files changed

+483
-13
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
# Binary files that should not be modified
66
*.dat binary
77
*.db binary
8+
*.gif binary
89
*.icns binary
910
*.ico binary
10-
*.key binary
1111
*.jks binary
1212
*.jpg binary
13+
*.key binary
1314
*.png binary
1415
*.ttf binary
1516
*.wav binary

.gitignore

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ build
1010
dist
1111
lib
1212
out
13+
run
1314
target
1415
*.com
1516
*.class
@@ -28,11 +29,14 @@ target
2829
############
2930
*.7z
3031
*.dmg
32+
*.ear
3133
*.gz
3234
*.iso
3335
*.jar
36+
!/gradle/wrapper/gradle-wrapper.jar
3437
*.rar
3538
*.tar
39+
*.war
3640
*.zip
3741

3842
# Repository #
@@ -47,6 +51,7 @@ target
4751
# Misc #
4852
########
4953
*.bak
54+
*.tmp
5055

5156
# System #
5257
##########
@@ -56,8 +61,11 @@ Thumbs.db
5661

5762
# Project #
5863
###########
64+
.buildpath
5965
.classpath
66+
.cproject
6067
.externalToolBuilders
68+
.gradle
6169
.idea
6270
.project
6371
.settings
@@ -68,15 +76,5 @@ nb-configuration.xml
6876
*.iml
6977
*.ipr
7078
*.iws
71-
72-
# Runtime #
73-
###########
74-
/cache
75-
/config
76-
/data
77-
/natives
78-
/plugins
79-
/resources
80-
/update
81-
/updates
82-
/worlds
79+
*.launch
80+
*.pydevproject

build.gradle

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
// Default tasks
2+
defaultTasks 'clean', 'licenseFormat', 'build', 'install'
3+
4+
// Apply plugins
5+
apply plugin: 'java'
6+
apply plugin: 'cobertura' // Coveralls dependency
7+
apply plugin: 'com.github.kt3k.coveralls'
8+
apply plugin: 'license'
9+
apply plugin: 'maven'
10+
apply plugin: 'signing'
11+
12+
// Project information
13+
ext.projectName = 'Flow React'
14+
group = 'com.flowpowered'
15+
archivesBaseName = 'flow-react'
16+
version = '1.0.0-SNAPSHOT'
17+
ext.packaging = 'jar'
18+
ext.inceptionYear = '2013'
19+
ext.url = 'https://flowpowered.com/react'
20+
ext.description = 'Real-time 3D physics library for Java, based on the ReactPhysics3D library.'
21+
22+
// Organization information
23+
ext.organization = 'Flow Powered'
24+
ext.organizationUrl = 'https://flowpowered.com'
25+
26+
// Build properties
27+
ext.buildNumber = project.hasProperty('buildNumber') ? buildNumber : '0'
28+
ext.ciSystem = project.hasProperty('ciSystem') ? ciSystem : 'unknown'
29+
ext.commit = project.hasProperty('commit') ? commit : 'unknown'
30+
31+
// Build plugin repositories and dependencies
32+
buildscript {
33+
repositories {
34+
mavenLocal()
35+
mavenCentral()
36+
maven {
37+
name = 'sonatype-nexus'
38+
url = 'https://oss.sonatype.org/content/groups/public/'
39+
}
40+
}
41+
dependencies {
42+
classpath 'net.saliman:gradle-cobertura-plugin:2.2.5' // Coveralls dependency
43+
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.10.0'
44+
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
45+
}
46+
}
47+
48+
// Project repositories
49+
repositories {
50+
mavenLocal()
51+
mavenCentral()
52+
maven {
53+
name = 'sonatype-nexus'
54+
url = 'https://oss.sonatype.org/content/groups/public/'
55+
}
56+
}
57+
58+
// Project dependencies
59+
dependencies {
60+
compile 'net.sf.trove4j:trove4j:3.0.3'
61+
testCompile 'junit:junit:4.12'
62+
}
63+
64+
// Filter, process, and include resources
65+
processResources {
66+
// Include in final JAR
67+
from(rootProject.rootDir) {
68+
include 'LICENSE.txt'
69+
}
70+
}
71+
72+
// License header formatting
73+
license {
74+
ext.project = projectName
75+
ext.year = inceptionYear
76+
ext.name = organization
77+
ext.url = organizationUrl
78+
header rootProject.file('HEADER.txt')
79+
ignoreFailures true
80+
strictCheck true
81+
useDefaultMappings false
82+
mapping { java = 'SLASHSTAR_STYLE' }
83+
}
84+
85+
// Source compiler configuration
86+
configure([compileJava, compileTestJava]) {
87+
sourceCompatibility = '1.7'
88+
targetCompatibility = '1.7'
89+
options.encoding = 'UTF-8'
90+
options.compilerArgs << '-Xlint:all'
91+
options.compilerArgs << '-Xlint:-path'
92+
options.deprecation = true
93+
}
94+
95+
// JAR manifest configuration
96+
jar.manifest.mainAttributes(
97+
'Built-By': System.properties['user.name'],
98+
'Created-By': System.properties['java.vm.version'] + ' (' + System.properties['java.vm.vendor'] + ')',
99+
'Specification-Title': projectName,
100+
'Specification-Version': version + '+' + ciSystem + '-b' + buildNumber + '.git-' + commit,
101+
'Specification-Vendor': organization + ' - ' + organizationUrl)
102+
103+
// Javadoc doclint configuration
104+
if (JavaVersion.current().isJava8Compatible()) {
105+
allprojects {
106+
tasks.withType(Javadoc) {
107+
options.addStringOption('Xdoclint:none', '-quiet')
108+
}
109+
}
110+
}
111+
112+
// Coveralls report configuration
113+
cobertura.coverageFormats = ['html', 'xml'] // Coveralls requires xml format
114+
115+
// Artifact deployment
116+
uploadArchives {
117+
repositories.mavenDeployer {
118+
// Javadoc JAR generation
119+
task javadocJar(type: Jar, dependsOn: javadoc) {
120+
classifier = 'javadoc'
121+
from 'build/docs/javadoc'
122+
}
123+
124+
// Source JAR generation
125+
task sourcesJar(type: Jar) {
126+
classifier = 'sources'
127+
from sourceSets.main.java.srcDirs
128+
}
129+
130+
// Set all artifacts
131+
artifacts {
132+
archives jar, javadocJar, sourcesJar
133+
}
134+
135+
// Tasks and variables based on if release or snapshot
136+
if (version.endsWith('-SNAPSHOT')) {
137+
// Set variable to snapshots repository URL
138+
ext.sonatypeUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
139+
} else {
140+
// Set variable to releases repository URL
141+
ext.sonatypeUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
142+
143+
// Artifact signing
144+
signing {
145+
// Sign JAR artifacts
146+
sign configurations.archives
147+
148+
// Sign Maven POM
149+
beforeDeployment {
150+
org.gradle.api.artifacts.maven.MavenDeployment deployment -> signing.signPom(deployment)
151+
}
152+
}
153+
}
154+
155+
// Set login credentials for repository
156+
repository(url: sonatypeUrl) {
157+
authentication(userName: System.getenv("sonatypeUsername"), password: System.getenv("sonatypePassword"))
158+
}
159+
160+
// Maven POM generation
161+
pom.project {
162+
name projectName
163+
artifactId archivesBaseName
164+
packaging packaging
165+
inceptionYear inceptionYear
166+
url url
167+
description project.ext.description
168+
169+
scm {
170+
connection 'scm:git:git://github.com/flow/react.git'
171+
developerConnection 'scm:git:ssh://[email protected]:flow/react.git'
172+
url 'https://github.com/flow/react'
173+
}
174+
175+
licenses {
176+
license {
177+
name 'MIT License'
178+
url 'https://tldrlegal.com/l/mit'
179+
distribution 'repo'
180+
}
181+
}
182+
183+
organization {
184+
name organization
185+
url organizationUrl
186+
}
187+
188+
developers {
189+
developer {
190+
id 'DDoS'
191+
name 'Aleksi Sapon'
192+
193+
}
194+
developer {
195+
id 'kitskub'
196+
name 'Jack Huey'
197+
198+
}
199+
developer {
200+
id 'Wolf480pl'
201+
name 'Wolf480pl'
202+
203+
}
204+
developer {
205+
id 'Wulfspider'
206+
name 'Luke Spragg'
207+
208+
}
209+
}
210+
}
211+
}
212+
}

gradle/wrapper/gradle-wrapper.jar

49.3 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
zipStoreBase=GRADLE_USER_HOME
4+
zipStorePath=wrapper/dists
5+
distributionUrl=http\://services.gradle.org/distributions/gradle-2.0-all.zip

0 commit comments

Comments
 (0)