forked from jMonkeyEngine/jmonkeyengine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.gradle
225 lines (202 loc) · 6.23 KB
/
common.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
//
// This file is to be applied to every subproject.
//
apply plugin: 'java-library'
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'eclipse'
apply plugin: 'checkstyle'
eclipse.jdt.file.withProperties { props ->
props.setProperty "org.eclipse.jdt.core.circularClasspath", "warning"
}
group = 'org.jmonkeyengine'
version = jmeFullVersion
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
tasks.withType(JavaCompile) { // compile-time options:
//options.compilerArgs << '-Xlint:deprecation' // to show deprecation warnings
options.compilerArgs << '-Xlint:unchecked'
options.encoding = 'UTF-8'
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_1_10)) {
options.release = 8
}
}
ext {
lwjgl3Version = '3.3.3' // used in both the jme3-lwjgl3 and jme3-vr build scripts
niftyVersion = '1.4.3' // used in both the jme3-niftygui and jme3-examples build scripts
}
repositories {
mavenCentral()
flatDir {
dirs rootProject.file('lib')
}
}
dependencies {
// Adding dependencies here will add the dependencies to each subproject.
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:3.12.4'
testImplementation 'org.codehaus.groovy:groovy-test:3.0.19'
}
// Uncomment if you want to see the status of every test that is run and
// the test output.
/*
test {
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
}
*/
jar {
manifest {
attributes 'Implementation-Title': 'jMonkeyEngine',
'Implementation-Version': jmeFullVersion,
'Automatic-Module-Name': "${project.name.replace("-", ".")}",
'Created-By': "${JavaVersion.current()} (${System.getProperty("java.vendor")})"
}
}
javadoc {
failOnError = false
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.docTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
options.windowTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
options.header = "<b>jMonkeyEngine ${jmeFullVersion} ${project.name}</b>"
options.author = "true"
options.use = "true"
options.charSet = "UTF-8"
options.encoding = "UTF-8"
source = sourceSets.main.allJava // main only, exclude tests
}
test {
testLogging {
exceptionFormat = 'full'
}
}
task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
classifier = 'sources'
from sourceSets*.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
classifier = 'javadoc'
from javadoc.destinationDir
}
ext.pomConfig = {
name POM_NAME
description POM_DESCRIPTION
url POM_URL
inceptionYear POM_INCEPTION_YEAR
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEVELOPER_CONNECTION
}
licenses {
license {
name POM_LICENSE_NAME
url POM_LICENSE_URL
distribution POM_LICENSE_DISTRIBUTION
}
}
developers {
developer {
name 'jMonkeyEngine Team'
id 'jMonkeyEngine'
}
}
}
artifacts {
archives jar
archives sourcesJar
if (buildJavaDoc == "true") {
archives javadocJar
}
}
publishing {
publications {
maven(MavenPublication) {
artifact javadocJar
artifact sourcesJar
from components.java
pom {
description = POM_DESCRIPTION
developers {
developer {
id = 'jMonkeyEngine'
name = 'jMonkeyEngine Team'
}
}
inceptionYear = POM_INCEPTION_YEAR
licenses {
license {
distribution = POM_LICENSE_DISTRIBUTION
name = POM_LICENSE_NAME
url = POM_LICENSE_URL
}
}
name = POM_NAME
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEVELOPER_CONNECTION
url = POM_SCM_URL
}
url = POM_URL
}
version project.version
}
}
repositories {
maven {
name = 'Dist'
url = gradle.rootProject.projectDir.absolutePath + '/dist/maven'
}
maven {
credentials {
username = gradle.rootProject.hasProperty('ossrhUsername') ? ossrhUsername : 'Unknown user'
password = gradle.rootProject.hasProperty('ossrhPassword') ? ossrhPassword : 'Unknown password'
}
name = 'OSSRH'
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
}
maven {
credentials {
username = gradle.rootProject.hasProperty('ossrhUsername') ? ossrhUsername : 'Unknown user'
password = gradle.rootProject.hasProperty('ossrhPassword') ? ossrhPassword : 'Unknown password'
}
name = 'SNAPSHOT'
url = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
}
}
}
publishToMavenLocal.doLast {
println 'published ' + project.getName() + "-${jmeFullVersion} to mavenLocal"
}
task('install') {
dependsOn 'publishToMavenLocal'
}
signing {
def signingKey = gradle.rootProject.findProperty('signingKey')
def signingPassword = gradle.rootProject.findProperty('signingPassword')
useInMemoryPgpKeys(signingKey, signingPassword)
sign configurations.archives
sign publishing.publications.maven
}
tasks.withType(Sign) {
onlyIf { gradle.rootProject.hasProperty('signingKey') }
}
checkstyle {
toolVersion '9.3'
configFile file("${gradle.rootProject.rootDir}/config/checkstyle/checkstyle.xml")
}
checkstyleMain {
source ='src/main/java'
}
checkstyleTest {
source ='src/test/java'
}
tasks.withType(Checkstyle) {
reports {
xml.enabled false
html.enabled true
}
include("**/com/jme3/renderer/**/*.java")
}