-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
155 lines (137 loc) · 4.77 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
plugins {
`java-gradle-plugin`
id("org.jetbrains.kotlin.jvm") version "1.5.21"
id("io.gitlab.arturbosch.detekt") version "1.17.1"
id("com.github.ben-manes.versions") version "0.39.0"
id("org.jetbrains.dokka") version "1.5.0"
id("io.codearte.nexus-staging") version "0.30.0"
jacoco
`maven-publish`
signing
}
repositories {
mavenCentral()
jcenter()
mavenLocal()
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") }
}
val projectName = "zally-gradle-plugin"
val nexusUsername: String by project
val nexusPassword: String by project
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
testImplementation(kotlin("test"))
implementation("org.zalando:zally-core:2.0.0")
implementation("org.zalando:zally-ruleset-zally:2.0.0")
implementation("org.zalando:zally-ruleset-zalando:2.0.0")
implementation("com.fasterxml.jackson.core:jackson-core:2.12.4")
implementation("com.diogonunes:JColor:5.0.1")
testImplementation(kotlin("test-junit5"))
testImplementation("org.junit.jupiter:junit-jupiter:5.7.2")
testImplementation("org.assertj:assertj-core:3.20.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.2")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-html:0.7.3")
}
gradlePlugin {
plugins {
register("zallyLint") {
id = "io.github.thiyagu06"
implementationClass = "org.thiyagu.zally.ZallyGradlePlugin"
}
}
}
tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "13"
}
}
tasks.test {
finalizedBy(tasks.jacocoTestReport)
}
tasks.jacocoTestReport {
reports {
xml.required.set(true)
html.outputLocation.set(layout.buildDirectory.dir("jacoco"))
xml.outputLocation.set(file("$buildDir/jacoco/jacocoTestReport.xml"))
}
classDirectories.setFrom(
sourceSets.main.get().output.asFileTree.matching {
exclude("org/thiyagu/zally/internal/ZallyLint.class")
exclude("org/thiyagu/zally/internal/ZallyFactory.class")
exclude("org/thiyagu/zally/reports/ZallyReport.class")
exclude("org/thiyagu/zally/reports/ZallyReportType.class")
exclude("org/thiyagu/zally/rules/ZallyViolationRule.class")
exclude()
}
)
dependsOn(tasks.test) // tests are required to run before generating the report
}
(tasks.findByName("test") as Test).useJUnitPlatform()
tasks.jar {
archiveBaseName.set(rootProject.name)
}
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}
val javadocJar by tasks.creating(Jar::class) {
archiveClassifier.set("javadoc")
from("$buildDir/reports/javadoc")
}
publishing {
publications {
create<MavenPublication>("pluginMaven") {
artifactId = projectName
artifact(sourcesJar)
artifact(javadocJar)
setPomDetails(this)
}
afterEvaluate{
named<MavenPublication>("zallyLintPluginMarkerMaven") {
setPomDetails(this)
}
}
}
repositories {
maven {
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
credentials {
// defined in travis project settings or in $HOME/.gradle/gradle.properties
username = nexusUsername
password = nexusPassword
}
}
}
}
signing {
sign(publishing.publications)
}
fun setPomDetails(mavenPublication: MavenPublication) {
mavenPublication.pom {
description.set("OpenAPI linter service")
url.set("https://github.com/thiyagu06/zally-gradle-plugin")
name.set("Gradle plugin for zally Linter")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
name.set("Thiyagu GK")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/thiyagu06/zally-gradle-plugin.git")
developerConnection.set("scm:git:ssh://github.com:thiyagu06/zally-gradle-plugin.git")
url.set("https://github.com/thiyagu06/zally-gradle-plugin/tree/main")
}
}
}
group = "io.github.thiyagu06"