-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
237 lines (208 loc) · 6.35 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
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
226
227
228
229
230
231
232
233
234
235
236
237
import org.apache.tools.ant.filters.*
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://github.com/steffenschaefer/gwt-gradle-plugin/raw/maven-repo/' }
jcenter()
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.9.0'
}
}
if(project.hasProperty('ossrhUser') && project.hasProperty("release")) {
apply plugin: "io.codearte.nexus-staging"
nexusStaging {
packageGroup = 'org.mini2Dx'
username = ossrhUser
password = ossrhPassword
}
}
apply plugin: "java"
apply plugin: "signing"
apply plugin: "maven"
group = 'org.mini2Dx'
version = "$libgdxVersion"
description = "LibGDX collection classes extracted into a standalone library"
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {}
task cleanSrcDir(type: Delete) {
delete 'src/main/java/com'
}
clean.dependsOn cleanSrcDir
File libGdxDirectory = file("libgdx");
if(libGdxDirectory.exists()) {
task checkoutLibGdxMaster(type: Exec) {
workingDir './libgdx'
commandLine 'git', 'checkout', 'master'
}
task pullLatestLibGdxMaster(type: Exec, dependsOn: checkoutLibGdxMaster) {
workingDir './libgdx'
commandLine 'git', 'pull', 'origin', 'master'
}
task fetchLatestLibGdxTags(type: Exec, dependsOn: pullLatestLibGdxMaster) {
workingDir './libgdx'
commandLine 'git', 'fetch', '--tags', 'origin', 'master'
}
} else {
task fetchLatestLibGdxTags(type: Exec) {
commandLine 'git', 'clone', '--progress', 'https://github.com/libgdx/libgdx.git', 'libgdx'
}
}
task checkoutLibGdxTag(type: Exec, dependsOn: fetchLatestLibGdxTags) {
workingDir './libgdx'
commandLine 'git', 'checkout', "gdx-parent-$libgdxVersion"
}
task copyLicenseFiles(type: Copy, dependsOn: checkoutLibGdxTag) {
from('libgdx') {
include 'LICENSE'
}
into './'
}
task copyRequiredMathClasses(type: Copy, dependsOn: copyLicenseFiles) {
from('libgdx/gdx/src/com/badlogic/gdx/math') {
include 'MathUtils.java'
include 'RandomXS128.java'
filter { String line ->
line.contains('com.badlogic.gdx.math') ? line.replace('com.badlogic.gdx.math', 'org.mini2Dx.gdx.utils.compat') : (
line.contains('com.badlogic.gdx.utils.reflect') ? line.replace('com.badlogic.gdx.utils.reflect', 'org.mini2Dx.gdx.utils.compat') : line
)
}
}
into 'src/main/java/org/mini2Dx/gdx/utils/compat'
}
task copyRequiredReflectClasses(type: Copy, dependsOn: copyRequiredMathClasses) {
from('libgdx/gdx/src/com/badlogic/gdx/utils/reflect') {
include '*.java'
filter { String line ->
line.contains('com.badlogic.gdx.math') ? line.replace('com.badlogic.gdx.math', 'org.mini2Dx.gdx.utils.compat') : (
line.contains('com.badlogic.gdx.utils.reflect') ? line.replace('com.badlogic.gdx.utils.reflect', 'org.mini2Dx.gdx.utils.compat') : line
)
}
}
into 'src/main/java/org/mini2Dx/gdx/utils/compat'
}
task copyCollectionClasses(type: Copy, dependsOn: copyRequiredReflectClasses) {
from('libgdx/gdx/src/com/badlogic/gdx/utils') {
include 'Array.java'
include 'ArrayMap.java'
include 'AtomicQueue.java'
include 'BinaryHeap.java'
include 'Bits.java'
include 'BooleanArray.java'
include 'ByteArray.java'
include 'CharArray.java'
include 'ComparableTimSort.java'
include 'Collections.java'
include 'DelayedRemovalArray.java'
include 'Disposable.java'
include 'FloatArray.java'
include 'FlushablePool.java'
include 'GdxRuntimeException.java'
include 'IdentityMap.java'
include 'IntArray.java'
include 'IntFloatMap.java'
include 'IntIntMap.java'
include 'IntMap.java'
include 'IntSet.java'
include 'LongArray.java'
include 'LongMap.java'
include 'Null.java'
include 'NumberUtils.java'
include 'ObjectFloatMap.java'
include 'ObjectIntMap.java'
include 'ObjectLongMap.java'
include 'ObjectMap.java'
include 'ObjectSet.java'
include 'OrderedMap.java'
include 'OrderedSet.java'
include 'Pool.java'
include 'PooledLinkedList.java'
include 'Pools.java'
include 'Predicate.java'
include 'Queue.java'
include 'QuickSelect.java'
include 'ReflectionPool.java'
include 'Select.java'
include 'ShortArray.java'
include 'SnapshotArray.java'
include 'Sort.java'
include 'SortedIntList.java'
include 'TimSort.java'
include 'TimeUtils.java'
filter { String line ->
line.contains('com.badlogic.gdx.math') ? line.replace('com.badlogic.gdx.math', 'org.mini2Dx.gdx.utils.compat') : (
line.contains('com.badlogic.gdx.utils.reflect') ? line.replace('com.badlogic.gdx.utils.reflect', 'org.mini2Dx.gdx.utils.compat') : (
line.contains('com.badlogic.gdx.utils') ? line.replace('com.badlogic.gdx.utils', 'org.mini2Dx.gdx.utils') : line
)
)
}
}
into 'src/main/java/org/mini2Dx/gdx/utils'
}
compileJava.dependsOn copyCollectionClasses
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
if(project.hasProperty('ossrhUser')) {
signing {
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
// POM signature
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// Target repository
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUser, password: ossrhPassword)
}
pom.project {
name project.name
description project.description
packaging 'jar'
url 'https://github.com/mini2Dx/gdx-collections'
scm {
connection 'scm:git:https://github.com/mini2Dx/gdx-collections.git'
developerConnection 'scm:git:[email protected]:mini2Dx/gdx-collections.git'
url 'https://github.com/mini2Dx/gdx-collections.git'
}
licenses {
license {
name 'Apache License, Version 2.0'
url 'https://opensource.org/licenses/Apache-2.0'
distribution 'repo'
}
}
developers {
developer {
id = 'tomcashman'
name = 'Thomas Cashman'
email = '[email protected]'
}
}
}
}
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.8'
}