-
Notifications
You must be signed in to change notification settings - Fork 33
/
build.gradle.kts
95 lines (77 loc) · 2.63 KB
/
build.gradle.kts
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
import groovy.json.JsonOutput
import java.net.URL
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.6.10")
}
}
plugins {
`java-library`
`maven-publish`
kotlin("jvm") version "1.6.10"
kotlin("plugin.serialization") version "1.6.10"
kotlin("kapt") version "1.6.10"
}
group = "com.github.polygon-io"
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10")
val ktorVersion = "2.1.3"
implementation("io.ktor:ktor-client-core-jvm:$ktorVersion")
implementation("io.ktor:ktor-client-websockets-jvm:$ktorVersion")
implementation("io.ktor:ktor-client-okhttp-jvm:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
// Annotation processor that generates Java builders for data classes
val ktBuilderVersion = "1.2.1"
implementation("com.thinkinglogic.builder:kotlin-builder-annotation:$ktBuilderVersion")
kapt("com.thinkinglogic.builder:kotlin-builder-processor:$ktBuilderVersion")
testImplementation("junit:junit:4.13.2")
}
allprojects {
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
val sourcesJar = tasks.create("sources", Jar::class) {
dependsOn(JavaPlugin.CLASSES_TASK_NAME)
classifier = "sources"
from(sourceSets["main"].allSource)
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString()
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
register("restSpec") {
group = "Gather Spec"
description = "Retrieve the most recent Polygon.io REST openapi spec"
val spec = JsonOutput.prettyPrint(URL("https://api.polygon.io/openapi").readText())
File(".polygon/rest.json").writeText(spec)
}
register("websocketSpec") {
group = "Gather Spec"
description = "Retrieve the most recent Polygon.io websocket spec"
val spec = JsonOutput.prettyPrint(URL("https://api.polygon.io/specs/websocket.json").readText())
File(".polygon/websocket.json").writeText(spec)
}
artifacts {
add("archives", sourcesJar)
add("archives", jar)
}
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "com.github.polygon-io"
artifactId = "client-jvm"
artifact(sourcesJar)
from(components["java"])
}
}
}