-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
149 lines (126 loc) · 4.5 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
149 lines (126 loc) · 4.5 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
plugins {
id("java-library")
id("maven-publish")
id("checkstyle")
id("com.google.protobuf") version "0.9.4"
id("ru.vyarus.animalsniffer") version "2.0.1"
}
group = "com.unicity.sdk"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
gradlePluginPortal()
}
// Define configurations for different flavors
configurations {
create("android")
create("jvm")
}
dependencies {
// Core dependencies that work on both platforms
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.19.2")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.19.2")
implementation("com.fasterxml.jackson.core:jackson-databind:2.19.2")
implementation("org.bouncycastle:bcprov-jdk18on:1.81")
implementation("org.slf4j:slf4j-api:2.0.13")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
// Platform-specific Guava
compileOnly("com.google.guava:guava:33.0.0-jre")
"android"("com.google.guava:guava:33.0.0-android")
"jvm"("com.google.guava:guava:33.0.0-jre")
// Animal Sniffer signatures
signature("com.toasttab.android:gummy-bears-api-31:0.7.0@signature")
// Testing
testImplementation(platform("org.junit:junit-bom:5.10.2"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.testcontainers:testcontainers:1.19.8")
testImplementation("org.testcontainers:junit-jupiter:1.19.8")
testImplementation("org.testcontainers:mongodb:1.19.8")
testImplementation("org.slf4j:slf4j-simple:2.0.13")
testImplementation("com.google.guava:guava:33.0.0-jre")
checkstyle("com.puppycrawl.tools:checkstyle:10.26.1")
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}
checkstyle {
configFile = file("config/checkstyle/checkstyle.xml")
}
tasks.test {
useJUnitPlatform {
excludeTags("integration")
}
maxHeapSize = "1024m"
}
tasks.withType<Checkstyle>{
reports {
xml.required.set(false)
html.required.set(true)
}
}
tasks.register<Test>("integrationTest") {
useJUnitPlatform {
includeTags("integration")
}
maxHeapSize = "2048m"
shouldRunAfter(tasks.test)
}
// Create separate JARs for each platform
tasks.register<Jar>("androidJar") {
archiveClassifier.set("android")
from(sourceSets["main"].output)
manifest {
attributes["Target-Platform"] = "Android"
}
}
tasks.register<Jar>("jvmJar") {
archiveClassifier.set("jvm")
from(sourceSets["main"].output)
manifest {
attributes["Target-Platform"] = "JVM"
}
}
// Publishing configuration
publishing {
publications {
create<MavenPublication>("android") {
artifactId = "unicity-sdk-android"
from(components["java"])
artifact(tasks["androidJar"])
pom {
name.set("Unicity SDK for Android")
description.set("Unicity State Transition SDK for Android 12+")
withXml {
val dependenciesNode = asNode().appendNode("dependencies")
configurations["implementation"].dependencies.forEach { dep ->
if (dep.group != "com.google.guava") {
val dependencyNode = dependenciesNode.appendNode("dependency")
dependencyNode.appendNode("groupId", dep.group)
dependencyNode.appendNode("artifactId", dep.name)
dependencyNode.appendNode("version", dep.version)
dependencyNode.appendNode("scope", "compile")
}
}
// Add Android-specific Guava
val guavaDep = dependenciesNode.appendNode("dependency")
guavaDep.appendNode("groupId", "com.google.guava")
guavaDep.appendNode("artifactId", "guava")
guavaDep.appendNode("version", "33.0.0-android")
guavaDep.appendNode("scope", "compile")
}
}
}
create<MavenPublication>("jvm") {
artifactId = "unicity-sdk"
from(components["java"])
artifact(tasks["jvmJar"])
pom {
name.set("Unicity SDK")
description.set("Unicity State Transition SDK for JVM")
}
}
}
}