-
-
Notifications
You must be signed in to change notification settings - Fork 139
/
build.gradle
233 lines (199 loc) · 6.76 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
plugins {
id 'java'
id 'base'
}
group 'com.frostwire'
base {
archivesName = 'jlibtorrent'
}
// Just changing version here should be all that's necessary to bump the version on the library
version '2.0.11.0'
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
}
// make build stop at the first error
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xmaxerrs" << "1"
}
if (!hasProperty('ossrhUsername')) {
ext.ossrhUsername = ''
}
if (!hasProperty('ossrhPassword')) {
ext.ossrhPassword = ''
}
repositories {
mavenCentral()
}
dependencies {
implementation 'junit:junit:4.13.1'
}
tasks.withType(Test).configureEach {
systemProperty "java.library.path", "."
}
tasks.test {
outputs.upToDateWhen { false }
}
test {
testLogging {
events "passed", "skipped", "failed", "standard_out"
}
}
tasks.register('sourcesJar', Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
tasks.register('javadoc2', Javadoc) {
source = sourceSets.main.allJava
}
tasks.register('javadocJar', Jar) {
dependsOn javadoc2
archiveClassifier = 'javadoc'
from javadoc2.destinationDir
}
tasks.register('nativeMacOSArm64Jar', Zip) {
destinationDirectory = file("$buildDir/libs")
archiveBaseName = 'jlibtorrent-macosx-arm64'
archiveExtension = 'jar'
from fileTree(dir: 'swig/bin/release/macosx', excludes: ['**/ed25519', '**/src'], include: 'arm64/*libjlibtorrent.arm64.dylib')
into 'lib/'
rename(".dylib", "-${version}.dylib")
}
tasks.register('nativeMacOSX86_64Jar', Zip) {
destinationDirectory = file("$buildDir/libs")
archiveBaseName = 'jlibtorrent-macosx-x86_64'
archiveExtension = 'jar'
from fileTree(dir: 'swig/bin/release/macosx', excludes: ['**/ed25519', '**/src'], include: 'x86_64/*libjlibtorrent.x86_64.dylib')
into 'lib/'
rename(".dylib", "-${version}.dylib")
}
tasks.register('nativeWindowsX86_64Jar', Zip) {
destinationDirectory = file("$buildDir/libs")
archiveBaseName = 'jlibtorrent-windows'
archiveExtension = 'jar'
from fileTree(dir: 'swig/bin/release/windows', excludes: ['**/ed25519', '**/src'], include: '**/*jlibtorrent.dll')
into 'lib/'
rename(".dll", "-${version}.dll")
}
tasks.register('nativeLinuxJar', Zip) {
destinationDirectory = file("$buildDir/libs")
archiveBaseName = 'jlibtorrent-linux'
archiveExtension = 'jar'
from fileTree(dir: 'swig/bin/release/linux', excludes: ['**/ed25519', '**/src'], include: '**/*libjlibtorrent.so')
into 'lib/'
rename(".so", "-${version}.so")
}
tasks.register('nativeAndroidArmJar', Zip) {
destinationDirectory = file("$buildDir/libs")
archiveBaseName = 'jlibtorrent-android-arm'
archiveExtension = 'jar'
from fileTree(dir: 'swig/bin/release/android', include: 'armeabi-v7a/libjlibtorrent.so')
into 'lib/'
rename(".so", "-${version}.so")
}
tasks.register('nativeAndroidX86Jar', Zip) {
destinationDirectory = file("$buildDir/libs")
archiveBaseName = 'jlibtorrent-android-x86'
archiveExtension = 'jar'
from fileTree(dir: 'swig/bin/release/android', include: 'x86/libjlibtorrent.so')
into 'lib/'
rename(".so", "-${version}.so")
}
tasks.register('nativeAndroidArm64Jar', Zip) {
destinationDirectory = file("$buildDir/libs")
archiveBaseName = 'jlibtorrent-android-arm64'
archiveExtension = 'jar'
from fileTree(dir: 'swig/bin/release/android', include: 'arm64-v8a/libjlibtorrent.so')
into 'lib/'
rename(".so", "-${version}.so")
}
tasks.register('nativeAndroidX64Jar', Zip) {
destinationDirectory = file("$buildDir/libs")
archiveBaseName = 'jlibtorrent-android-x86_64'
archiveExtension = 'jar'
from fileTree(dir: 'swig/bin/release/android', include: 'x86_64/libjlibtorrent.so')
into 'lib/'
rename(".so", "-${version}.so")
}
// Clean task for nativeMacOSArm64Jar
tasks.register('cleanNativeMacOSArm64Jar', Delete) {
delete "${buildDir}/libs/jlibtorrent-macosx-arm64-${version}.jar"
}
// Clean task for nativeMacOSX86_64Jar
tasks.register('cleanNativeMacOSX86_64Jar', Delete) {
delete "${buildDir}/libs/jlibtorrent-macosx-x86_64-${version}.jar"
}
// Clean task for nativeWindowsX86_64Jar
tasks.register('cleanNativeWindowsX86_64Jar', Delete) {
delete "${buildDir}/libs/jlibtorrent-windows-${version}.jar"
}
// Clean task for nativeLinuxJar
tasks.register('cleanNativeLinuxJar', Delete) {
delete "${buildDir}/libs/jlibtorrent-linux-${version}.jar"
}
// Clean task for nativeAndroidArmJar
tasks.register('cleanNativeAndroidArmJar', Delete) {
delete "${buildDir}/libs/jlibtorrent-android-arm-${version}.jar"
}
// Clean task for nativeAndroidX86Jar
tasks.register('cleanNativeAndroidX86Jar', Delete) {
delete "${buildDir}/libs/jlibtorrent-android-x86-${version}.jar"
}
// Clean task for nativeAndroidArm64Jar
tasks.register('cleanNativeAndroidArm64Jar', Delete) {
delete "${buildDir}/libs/jlibtorrent-android-arm64-${version}.jar"
}
// Clean task for nativeAndroidX64Jar
tasks.register('cleanNativeAndroidX64Jar', Delete) {
delete "${buildDir}/libs/jlibtorrent-android-x86_64-${version}.jar"
}
artifacts {
archives sourcesJar
archives javadocJar
archives nativeMacOSArm64Jar
archives nativeMacOSX86_64Jar
archives nativeWindowsX86_64Jar
archives nativeLinuxJar
archives nativeAndroidArmJar
archives nativeAndroidX86Jar
archives nativeAndroidArm64Jar
archives nativeAndroidX64Jar
}
def pomData() {
return {
resolveStrategy = DELEGATE_FIRST
name 'frostwire-jlibtorrent'
description 'A swig Java interface for libtorrent by the makers of FrostWire.'
url 'https://github.com/frostwire/frostwire-jlibtorrent'
scm {
connection 'scm:git:git://github.com/frostwire/frostwire-jlibtorrent.git'
developerConnection 'scm:git:ssh:[email protected]/frostwire/frostwire-jlibtorrent.git'
url 'https://github.com/frostwire/frostwire-jlibtorrent'
}
licenses {
license {
name 'The MIT License'
url 'https://github.com/frostwire/frostwire-jlibtorrent/blob/master/LICENSE.md'
}
}
developers {
developer {
id 'gubatron'
name 'Angel Leon'
email '[email protected]'
}
}
}
}
def addDependency(root) {
def dependenciesNode = root.dependencies[0]
if (!dependenciesNode) {
dependenciesNode = root.appendNode('dependencies')
}
def depNode = dependenciesNode.appendNode('dependency')
depNode.appendNode('groupId', group)
depNode.appendNode('artifactId', archivesBaseName)
depNode.appendNode('version', version)
}