-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
91 lines (73 loc) · 2.26 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
import com.expediagroup.graphql.plugin.gradle.graphql
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.FileInputStream
import java.util.*
val githubAccessToken: String by lazy { readProperty("githubAccessToken") }
val repositories: String by lazy { readProperty("repositoriesToScan") }
plugins {
application
kotlin("jvm") version "1.4.21"
id("com.expediagroup.graphql") version "3.7.0"
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven("https://dl.bintray.com/kotlin/kotlin-eap")
}
dependencies {
implementation("com.expediagroup:graphql-kotlin-client:3.7.0")
implementation("io.ktor:ktor-client-okhttp:1.3.1")
implementation("io.ktor:ktor-client-logging-jvm:1.3.1")
implementation(kotlin("stdlib-jdk8"))
implementation("org.apache.commons:commons-exec:1.3")
}
application {
mainClass.set("ApplicationKt")
}
graphql {
client {
endpoint = "https://api.github.com/graphql"
packageName = "com.adaptics.drop_github_stats.gql"
headers["Authorization"] = "bearer $githubAccessToken"
}
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_11
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "11"
kotlinOptions.freeCompilerArgs = listOf("-Xjsr305=strict")
}
compileTestKotlin {
kotlinOptions.jvmTarget = "11"
}
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "11"
freeCompilerArgs = listOf("-Xjsr305=strict")
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "11"
}
task("runDefault", JavaExec::class) {
main = "ApplicationKt"
classpath = sourceSets["main"].runtimeClasspath
args = listOf("githubAccessToken=$githubAccessToken", "repositoriesToScan=$repositories")
}
fun readProperty(name: String): String {
val localFile = File("local.properties")
if (localFile.exists()) {
val fis = FileInputStream("local.properties")
val props = Properties()
props.load(fis)
val localProp = props.getProperty(name)
if (localProp != null) return localProp
}
return if (project.hasProperty(name)) {
project.property(name).toString()
} else ""
}