forked from crossbario/autobahn-java
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
263 lines (242 loc) · 8.22 KB
/
Copy pathbuild.gradle
File metadata and controls
263 lines (242 loc) · 8.22 KB
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
buildscript {
ext {
kotlin_version = '1.9.24'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:8.9.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24" // if Kotlin
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://jitpack.io"
}
}
}
def IS_ANDROID = project.hasProperty('IS_ANDROID') ? project.IS_ANDROID: true
def IS_NEXT = project.hasProperty('IS_NEXT') ? project.IS_NEXT: false
def IS_NETTY = project.hasProperty('IS_NETTY') ? project.IS_NETTY: false
def ARTIFACT_ANDROID = (project.hasProperty('BUILD_LEGACY') && project.BUILD_LEGACY) ? 'autobahn-android-legacy': 'autobahn-android'
apply plugin: IS_ANDROID ? 'com.android.library': 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.jetbrains.kotlin.android'
def ARTIFACT_JAVA = 'autobahn-java'
def ARTIFACT_NEXT = 'autobahn'
def groupID = 'io.crossbar.autobahn'
def licenseName = 'MIT'
def licenseUrl = 'https://opensource.org/licenses/MIT'
def relVersion = System.getenv().containsKey('AUTOBAHN_BUILD_VERSION') ? System.getenv(
'AUTOBAHN_BUILD_VERSION'): '21.7.2'
def siteUrl = 'https://github.com/crossbario/autobahn-java'
def SONATYPE_USER = System.getenv().containsKey('SONATYPE_USER') ? System.getenv('SONATYPE_USER'): ''
def SONATYPE_PASS = System.getenv().containsKey('SONATYPE_PASS') ? System.getenv('SONATYPE_PASS'): ''
apply from: 'https://gist.githubusercontent.com/tuancoltech/1d9f528b387f84757123a230662c81ae/raw/b326adba12613677e97b04e386a9983cc9fb565a/read_properties.gradle'
def mavenUser = readLocalProperty("PUBLISH_LIB_ACTOR")
def mavenToken = readLocalProperty("PUBLISH_LIB_TOKEN")
dependencies {
api 'com.fasterxml.jackson.core:jackson-core:2.16.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.16.1'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.16.1'
implementation 'org.msgpack:jackson-dataformat-msgpack:0.9.8'
implementation('io.xconn:cryptology:1.0.1') {
exclude group: "org.bouncycastle", module: "bcprov-jdk18on"
}
if (IS_ANDROID) {
implementation 'org.web3j:core:4.8.8-android'
implementation 'org.web3j:abi:4.8.8-android'
implementation 'org.web3j:utils:4.8.8-android'
implementation 'androidx.core:core-ktx:1.17.0'
} else{
implementation 'org.web3j:core:4.11.0'
implementation 'org.web3j:abi:4.11.0'
implementation 'org.web3j:utils:4.11.0'
implementation 'org.json:json:20240205'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.5'
}
if (IS_NETTY) {
implementation 'io.netty:netty-codec-http:4.1.106.Final'
implementation 'io.netty:netty-handler:4.1.106.Final'
}
testImplementation 'junit:junit:4.13.2'
}
// Create the pom configuration:
def pomConfig = {
// Set your license
licenses {
license {
name licenseName
url licenseUrl
}
}
developers {
developer {
id "crossbario"
name "Crossbar.io"
email "support@crossbario.com"
}
}
scm {
url siteUrl
}
}
if (IS_ANDROID) {
android {
namespace "io.crossbar.autobahn"
defaultConfig {
compileSdk 36
minSdkVersion 26
targetSdkVersion 34
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
main {
java {
exclude 'io/crossbar/autobahn/wamp/transports/Netty*'
exclude 'io/crossbar/autobahn/utils/ABJLogger.java'
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/spring.tooling'
exclude 'META-INF/spring.handlers'
exclude 'META-INF/spring.schemas'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}
task sourcesJar(type: Jar) {
archiveClassifier.set("sources")
from android.sourceSets.main.java.srcDirs
}
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
// classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
// classpath += configurations.implementation
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set("javadoc")
from javadoc.destinationDir
}
project.archivesBaseName = ARTIFACT_ANDROID
group = groupID
version = relVersion
afterEvaluate {
javadoc.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompileProvider.get().classpath.files
})
}
publishing {
repositories {
maven {
name = "GithubPackages"
url = "https://maven.pkg.github.com/tuancoltech/autobahn-kotlin"
credentials {
username = mavenUser
password = mavenToken
}
}
}
}
} else {
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set("javadoc")
from javadoc.destinationDir
}
if (IS_NEXT) {
sourceSets {
main {
java {
exclude 'io/crossbar/autobahn/wamp/transports/AndroidWebSocket.java'
exclude 'io/crossbar/autobahn/wamp/transports/Netty*'
exclude 'io/crossbar/autobahn/websocket/utils/AndroidThreadMessenger.java'
exclude 'io/crossbar/autobahn/utils/ABALogger.java'
}
}
}
} else {
sourceSets {
main {
java {
exclude 'io/crossbar/autobahn/wamp/transports/AndroidWebSocket.java'
exclude 'io/crossbar/autobahn/wamp/transports/WebSocket.java'
exclude 'io/crossbar/autobahn/websocket'
exclude 'io/crossbar/autobahn/utils/ABALogger.java'
}
}
}
}
jar {
version = relVersion
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
if (IS_ANDROID) {
from components.findByName('release')
artifactId ARTIFACT_ANDROID
} else {
from components.java
artifactId IS_NEXT ? ARTIFACT_NEXT : ARTIFACT_JAVA
}
artifact sourcesJar
artifact javadocJar
groupId groupID
version relVersion
pom.withXml {
def root = asNode()
root.appendNode('description', 'WebSocket & WAMP for Java8+')
root.appendNode('name', 'Autobahn Java')
root.appendNode('url', siteUrl)
root.children().last() + pomConfig
}
}
}
repositories {
maven {
name = "GithubPackages"
url = "https://maven.pkg.github.com/tuancoltech/autobahn-kotlin"
credentials {
username = mavenUser
password = mavenToken
}
}
}
signing {
required false
sign publishing.publications.release
}
}
}