forked from jMonkeyEngine/jmonkeyengine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.gradle
189 lines (169 loc) · 4.97 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
//
// This file is to be applied to every subproject.
//
apply plugin: 'java-library'
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'signing'
group = 'org.jmonkeyengine'
version = jmeFullVersion
sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
if(JavaVersion.current() >= JavaVersion.VERSION_1_9) {
compileJava {
options.release = 8
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) { // compile-time options:
options.compilerArgs << '-Xlint:unchecked'
}
}
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.8.0'
testImplementation 'org.codehaus.groovy:groovy-all:3.0.7'
}
// 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("-", ".")}"
}
}
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://oss.sonatype.org/service/local/staging/deploy/maven2'
}
}
}
publishToMavenLocal.doLast {
println 'published ' + project.getName() + ' 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') }
}