forked from streem/pbandk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
77 lines (67 loc) · 1.85 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
import com.google.protobuf.gradle.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.5.32"
application
id("com.google.protobuf") version "0.8.18"
}
val protobufVersion by extra("3.11.1")
val pbandkVersion by extra("0.14.3-SNAPSHOT")
repositories {
if (System.getenv("CI") == "true") {
mavenLocal()
}
mavenCentral()
}
application {
mainClassName = "pbandk.examples.addressbook.MainKt"
applicationName = "addressbook"
}
kotlin {
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8))
}
}
dependencies {
implementation("pro.streem.pbandk:pbandk-runtime:$pbandkVersion")
}
protobuf {
generatedFilesBaseDir = "$projectDir/src"
protoc {
artifact = "com.google.protobuf:protoc:$protobufVersion"
}
plugins {
id("pbandk") {
artifact = "pro.streem.pbandk:protoc-gen-pbandk-jvm:$pbandkVersion:jvm8@jar"
}
}
generateProtoTasks {
ofSourceSet("main").forEach { task ->
task.builtins {
remove("java")
}
task.plugins {
id("pbandk") {
option("kotlin_package=pbandk.examples.addressbook.pb")
}
}
}
}
}
tasks {
compileJava {
enabled = false
}
withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
}
}
// Workaround the Gradle bug resolving multi-platform dependencies.
// Fix courtesy of https://github.com/square/okio/issues/647
configurations.forEach {
if (it.name.toLowerCase().contains("kapt") || it.name.toLowerCase().contains("proto")) {
it.attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class.java, Usage.JAVA_RUNTIME))
}
}