-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle.kts
110 lines (92 loc) · 2.71 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
/*
Copyright (c) 2019 Codice Foundation
Released under the GNU Lesser General Public License; see
http://www.gnu.org/licenses/lgpl.html
*/
import com.diffplug.gradle.spotless.FormatExtension
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version Versions.kotlin
id("org.jetbrains.dokka") version Versions.dokka
id("com.diffplug.spotless") version Versions.spotless
id("io.gitlab.arturbosch.detekt") version Versions.detekt
`maven-publish`
}
group = "org.codice.ddms"
version = Versions.project
description = "Library for parsing and creating DoD Discovery Metadata Specification (DDMS) documents."
repositories {
jcenter()
}
dependencyLocking {
lockAllConfigurations()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
testImplementation(kotlin("test-junit"))
implementation(Libs.slf4j)
testImplementation(Libs.mockito)
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = Versions.javaTarget
}
}
spotless {
fun FormatExtension.commonFormat(delimiter: String) {
licenseHeaderFile("codice.license.kt", delimiter)
trimTrailingWhitespace()
endWithNewline()
}
kotlin {
target(fileTree(projectDir) {
include("**/src/**/*.kt")
})
commonFormat("(package |@file|// Default package)")
ktlint()
}
kotlinGradle {
target(fileTree(projectDir) {
include("**/build.gradle.kts")
})
commonFormat("(import |plugins )")
ktlint()
}
}
detekt {
input = files("src/main/kotlin", "buildSrc/src/main/kotlin")
config = files("detekt.yml")
}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
exclude("**/resources/**")
exclude("**/build/**")
}
tasks.withType<DokkaTask> {
outputFormat = "html"
outputDirectory = "$buildDir/dokka"
jdkVersion = Versions.dokkaJvmVersion
}
val sourcesJar by tasks.registering(Jar::class) {
classifier = "sources"
from(sourceSets.main.get().allSource)
}
publishing {
repositories {
var urlString = "http://artifacts.codice.org/content/repositories/releases/"
if (Versions.project.endsWith("SNAPSHOT")) urlString = "http://artifacts.codice.org/content/repositories/snapshots/"
maven {
url = uri(urlString)
credentials {
username = project.findProperty("username") as? String
password = project.findProperty("password") as? String
}
}
}
publications {
register("mavenJava", MavenPublication::class) {
from(components["java"])
artifact(sourcesJar.get())
}
}
}