-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild.gradle.kts
123 lines (103 loc) · 3.54 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
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
import com.gradle.publish.*
import kotlinx.knit.build.*
import org.jetbrains.kotlin.gradle.tasks.*
plugins {
kotlin("jvm")
id("org.jetbrains.dokka") apply false
id("com.gradle.plugin-publish") apply false
`java-gradle-plugin`
signing
`maven-publish`
}
repositories {
mavenCentral()
gradlePluginPortal()
}
allprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.gradle.maven-publish")
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.11.1")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.1")
testImplementation(kotlin("test-junit"))
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile> {
kotlinOptions.apply {
languageVersion = "1.4"
jvmTarget = "1.8"
allWarningsAsErrors = true
freeCompilerArgs = freeCompilerArgs + listOf(
"-Xsuppress-version-warnings", // suppress deprecated 1.4
"-opt-in=kotlin.RequiresOptIn" // remove after updating languageVersion to 1.7
)
}
}
sourceSets {
main.kotlin.dir = "src"
test.kotlin.dir = "test"
main.resources.dir = "resources"
}
// Set version when deploying
properties["DeployVersion"]?.let { version = it }
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
mavenCentralArtifacts(project, project.sourceSets.main.allSource)
}
}
mavenCentralMetadata()
mavenRepositoryPublishing(project)
publications.withType(MavenPublication::class).all {
signPublicationIfKeyPresent(this)
}
}
// ---------- This root project -- Gradle plugin ----------
apply(plugin = "org.gradle.java-gradle-plugin")
apply(plugin = "com.gradle.plugin-publish")
extensions.getByType(PluginBundleExtension::class).apply {
website = "https://github.com/Kotlin/kotlinx-knit"
vcsUrl = "https://github.com/Kotlin/kotlinx-knit"
tags = listOf("kotlin", "documentation", "markdown")
}
gradlePlugin {
plugins {
create("kotlinx-knit") {
// This is a fully-qualified plugin id, short id of 'kotlinx-knit' is added manually in resources
id = "org.jetbrains.kotlinx.knit"
implementationClass = "kotlinx.knit.KnitPlugin"
displayName = "Knit documentation plugin"
description = "Produces Kotlin source example files and tests from markdown documents with embedded snippets of Kotlin code"
}
}
}
val publishPlugins by tasks.getting(PublishTask::class)
val deploy: Task by tasks.creating {
dependsOn(getTasksByName("publish", true))
dependsOn(publishPlugins)
}
val freemarkerVersion: String by project
val dokkaVersion: String by project
dependencies {
implementation(gradleApi())
implementation(project(":pathsaver"))
implementation("org.freemarker:freemarker:$freemarkerVersion")
implementation(project(":kotlinx-knit-test"))
implementation("org.jetbrains.dokka:dokka-core:$dokkaVersion")
}
val test: Task by tasks.getting {
dependsOn(tasks.findByPath(":kotlinx-knit-test:dokka"))
dependsOn(tasks.findByPath(":kotlinx-knit-test:dokkaHtml"))
}