forked from bufbuild/buf-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
118 lines (103 loc) · 2.81 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import com.gradle.publish.PublishTask.GRADLE_PUBLISH_KEY
import com.gradle.publish.PublishTask.GRADLE_PUBLISH_SECRET
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
repositories {
gradlePluginPortal()
}
plugins {
`kotlin-dsl`
alias(libs.plugins.kotlin)
alias(libs.plugins.pluginPublish)
alias(libs.plugins.spotless)
alias(libs.plugins.mavenPublish)
}
group = "build.buf"
allprojects {
spotless {
kotlin {
ktlint()
target("**/*.kt")
}
kotlinGradle {
ktlint()
}
}
}
dependencies {
testImplementation(libs.junit)
testImplementation(libs.truth)
}
object ProjectInfo {
const val NAME = "Buf Gradle Plugin"
const val URL = "https://github.com/bufbuild/buf-gradle-plugin"
const val DESCRIPTION = "Buf plugin for Gradle"
}
fun isRelease() = !version.toString().endsWith("-SNAPSHOT")
gradlePlugin {
website.set(ProjectInfo.URL)
vcsUrl.set(ProjectInfo.URL)
plugins {
create("buf") {
id = "build.buf"
implementationClass = "build.buf.gradle.BufPlugin"
displayName = ProjectInfo.NAME
description = ProjectInfo.DESCRIPTION
tags.set(listOf("protobuf", "kotlin", "buf"))
}
}
}
ext[GRADLE_PUBLISH_KEY] = System.getenv("GRADLE_PORTAL_PUBLISH_KEY")
ext[GRADLE_PUBLISH_SECRET] = System.getenv("GRADLE_PORTAL_PUBLISH_SECRET")
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
mavenPublishing {
publishToMavenCentral(SonatypeHost.S01)
signAllPublications()
pom {
name.set(ProjectInfo.NAME)
description.set(ProjectInfo.DESCRIPTION)
url.set(ProjectInfo.URL)
scm {
url.set(ProjectInfo.URL)
}
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("Andrew Parmet")
name.set("Andrew Parmet")
email.set("[email protected]")
}
developer {
id.set("bufbuild")
name.set("Buf")
email.set("[email protected]")
url.set("https://buf.build")
organization.set("Buf Technologies, Inc.")
organizationUrl.set("https://buf.build")
}
}
}
}
tasks {
// Only enable publishing to the Gradle Portal for release builds.
named("publishPlugins") {
enabled = isRelease()
}
withType<Test> {
useJUnitPlatform()
}
withType<KotlinCompile> {
kotlinOptions {
allWarningsAsErrors = true
}
}
}