-
Notifications
You must be signed in to change notification settings - Fork 581
/
Copy pathbuild.gradle.kts
93 lines (80 loc) · 2.98 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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
kotlin("jvm")
id("com.github.gmazzo.buildconfig")
id("java-gradle-plugin")
id("com.gradle.plugin-publish").version("1.2.2").apply(false)
}
// This module is included in two projects:
// - In the root project where it's released as one of our artifacts
// - In build-support project where we can use it for the test-schema and samples.
//
// We only want to publish when it's being built in the root project.
if (project.rootProject.name == "wire") {
apply(plugin = "com.gradle.plugin-publish")
}
gradlePlugin {
website.set("https://github.com/square/wire")
vcsUrl.set("https://github.com/square/wire")
description = "generate code from .proto files"
plugins {
create("wire") {
id = "com.squareup.wire"
displayName = "Wire"
implementationClass = "com.squareup.wire.gradle.WirePlugin"
description = "generate code from .proto files"
tags.set(listOf("wire", "protobuf"))
}
}
}
dependencies {
compileOnly(gradleApi())
compileOnly(libs.pluginz.android)
compileOnly(libs.pluginz.kotlin)
implementation(projects.wireCompiler)
implementation(projects.wireKotlinGenerator)
implementation(libs.swiftpoet)
testImplementation(libs.junit)
testImplementation(libs.assertj)
testImplementation(libs.pluginz.kotlin)
testImplementation(projects.wireTestUtils)
}
val installProtoJars by tasks.creating(Copy::class) {
into("${rootDir.path}/build/localMaven")
from("${projectDir.path}/src/test/libs")
}
tasks.withType<Test>().configureEach {
jvmArgs("--add-opens", "java.base/java.util=ALL-UNNAMED")
dependsOn(installProtoJars)
dependsOn(":wire-runtime:installLocally")
dependsOn(":wire-java-generator:publishAllPublicationsToLocalMavenRepository")
dependsOn(":wire-kotlin-generator:publishAllPublicationsToLocalMavenRepository")
dependsOn(":wire-swift-generator:publishAllPublicationsToLocalMavenRepository")
dependsOn(":wire-schema:publishAllPublicationsToLocalMavenRepository")
dependsOn(":wire-grpc-client:publishAllPublicationsToLocalMavenRepository")
dependsOn(":wire-compiler:publishAllPublicationsToLocalMavenRepository")
dependsOn(":wire-gradle-plugin:publishAllPublicationsToLocalMavenRepository")
}
val test by tasks.getting(Test::class) {
// Fixtures run in a separate JVM, routing properties from the VM running the build into test VM.
systemProperty("kjs", System.getProperty("kjs"))
systemProperty("knative", System.getProperty("knative"))
}
buildConfig {
useKotlinOutput {
internalVisibility = true
topLevelConstants = true
}
packageName("com.squareup.wire")
buildConfigField("String", "VERSION", "\"${project.version}\"")
}
tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
}
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}