-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
151 lines (137 loc) · 5.13 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
import java.io.File
import java.io.FileInputStream
import java.util.Properties
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
group = "dk.cachet.detekt.extensions"
version = "1.2.6"
val jvmTarget = "1.8"
val detektVersion = "1.23.5"
val junit5Version = "5.10.2"
val spek2Version = "2.0.19"
plugins {
kotlin( "jvm" ) version "1.9.22"
id( "org.jetbrains.dokka" ) version "1.9.20"
`maven-publish`
signing
id( "io.github.gradle-nexus.publish-plugin" ) version "1.3.0"
}
repositories {
mavenCentral()
}
dependencies {
implementation( kotlin( "stdlib" ) )
implementation( "io.gitlab.arturbosch.detekt:detekt-api:$detektVersion" )
testImplementation( "org.junit.jupiter:junit-jupiter-api:$junit5Version" )
testRuntimeOnly( "org.junit.jupiter:junit-jupiter-engine:$junit5Version" )
testImplementation( "org.spekframework.spek2:spek-dsl-jvm:$spek2Version" )
testRuntimeOnly( "org.spekframework.spek2:spek-runner-junit5:$spek2Version" )
testImplementation( "io.gitlab.arturbosch.detekt:detekt-parser:$detektVersion" )
testImplementation( "io.gitlab.arturbosch.detekt:detekt-test:$detektVersion" )
}
tasks {
withType<Test> {
useJUnitPlatform {
includeEngines( "spek2" )
}
}
withType<JavaCompile> {
this.targetCompatibility = jvmTarget
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = jvmTarget
}
dokkaHtml {
outputDirectory.set(layout.projectDirectory.asFile.resolve("dokka"))
}
}
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( tasks.dokkaJavadoc )
}
// Publish configuration.
// For signing and publishing to work, a 'publish.properties' file needs to be added to the root containing:
// The OpenPGP credentials to sign all artifacts:
// > signing.keyFile=<ABSOLUTE PATH TO THE ASCII-ARMORED KEY FILE>
// > signing.password=<SECRET>
// A username and password to upload artifacts to the Sonatype repository:
// > repository.username=<SONATYPE USERNAME>
// > repository.password=<SONATYPE PASSWORD>
val publishProperties = Properties()
val publishPropertiesFile = file( "publish.properties" )
if ( publishPropertiesFile.exists() )
{
publishProperties.load( FileInputStream( publishPropertiesFile ) )
}
val nexusUsername: String = publishProperties.getProperty( "repository.username", "" )
val nexusPassword: String = publishProperties.getProperty( "repository.password", "" )
publishing {
repositories {
maven {
name = "local"
url = uri( "${layout.projectDirectory}/repository" )
}
maven {
name = "GitHubPackages"
url = uri( "https://maven.pkg.github.com/cph-cachet/detekt-verify-implementation" )
credentials {
username = System.getenv( "GITHUB_ACTOR" )
password = System.getenv( "GITHUB_TOKEN" )
}
}
}
publications {
create<MavenPublication>( "default" ) {
from( components[ "java" ] )
artifact( sourcesJar )
artifact( javadocJar )
with ( pom )
{
name.set( "Detekt Verify Implementation Plugin" )
description.set( "A detekt plugin to enable static checking of concrete classes according to annotations on base classes." )
url.set( "https://github.com/cph-cachet/detekt-verify-implementation" )
licenses {
license {
name.set( "MIT License" )
url.set( "https://github.com/cph-cachet/detekt-verify-implementation/blob/master/LICENSE.md" )
}
}
developers {
developer {
id.set( "whathecode" )
name.set( "Steven Jeuris" )
email.set( "[email protected]" )
organization.set( "CACHET" )
organizationUrl.set( "http://www.cachet.dk" )
}
}
scm {
connection.set( "scm:git:https://github.com/cph-cachet/detekt-verify-implementation.git" )
developerConnection.set( "scm:git:https://github.com/cph-cachet/detekt-verify-implementation.git" )
url.set( "https://github.com/cph-cachet/detekt-verify-implementation" )
}
}
}
}
}
signing {
val isSigningSetUp = publishProperties.propertyNames().toList().isNotEmpty()
if (!isSigningSetUp) return@signing
val signingKeyFile = File( uri( publishProperties.getProperty( "signing.keyFile", "" ) ) )
val signingPassword = publishProperties.getProperty( "signing.password", "" )
signing.useInMemoryPgpKeys( signingKeyFile.readText(), signingPassword )
sign( publishing.publications[ "default" ] )
}
nexusPublishing {
repositories {
sonatype {
username.set( nexusUsername )
password.set( nexusPassword )
}
}
}