forked from SpongePowered/Configurate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
90 lines (78 loc) · 2.88 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
import org.eclipse.jgit.lib.Repository.shortenRefName
import org.spongepowered.configurate.build.applyCommonAttributes
plugins {
kotlin("jvm") version "1.4.20" apply false
id("org.jetbrains.dokka") version "1.4.20" apply false
id("io.gitlab.arturbosch.detekt") version "1.16.0" apply false
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
id("io.freefair.aggregate-javadoc-jar") version "5.3.3.3"
id("net.kyori.indra.publishing.sonatype")
id("net.kyori.indra.git")
id("org.ajoberstar.git-publish") version "3.0.0"
id("com.github.ben-manes.versions") version "0.38.0"
`java-base`
}
group = "org.spongepowered"
version = "4.2.0-SNAPSHOT"
subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
}
allprojects {
ktlint {
version.set("0.41.0")
}
}
tasks.aggregateJavadoc.configure {
val gradleJdk = JavaVersion.current()
// at least java 11, but not 12 (java 12 is broken for some reason :( )
if (gradleJdk < JavaVersion.VERSION_11 || gradleJdk == JavaVersion.VERSION_12) {
javadocTool.set(javaToolchains.javadocToolFor { this.languageVersion.set(JavaLanguageVersion.of(11)) })
}
applyCommonAttributes()
title = "Configurate $version (all modules)"
val excludedProjects = listOf("examples").map {
project(":$it").projectDir.toPath().toAbsolutePath()
}
exclude {
excludedProjects.find { path -> it.file.toPath().toAbsolutePath().startsWith(path) } != null
}
(options as? StandardJavadocDocletOptions)?.apply {
addBooleanOption("Xdoclint:-missing", true)
links("https://docs.oracle.com/javase/8/docs/api/")
if (JavaVersion.current() > JavaVersion.VERSION_1_8 && JavaVersion.current() < JavaVersion.VERSION_12) {
addBooleanOption("-no-module-directories", true)
}
}
}
gitPublish {
val repo = indraGit.git()
if (repo != null) {
repo.remoteList().call().find { config -> config.name == "origin" }?.apply {
repoUri.set((this.pushURIs.firstOrNull() ?: this.urIs.first()).toPrivateString())
referenceRepoUri.set(this.urIs.first().toPrivateString())
}
}
branch.set("gh-pages")
contents {
from("src/site") {
val versions = {
(listOf(project.version as String) + indraGit.tags().map { shortenRefName(it.name) }.reversed())
.distinct()
.filter { repoDir.get().dir(it).getAsFile().exists() || it == project.version }
}
expand("project" to project, "versions" to versions)
}
from(tasks.aggregateJavadoc) {
into("$version/apidocs")
}
}
preserve {
include(".gitattributes")
include("**/") // include everything in directories
exclude("/*.html")
}
}
tasks.dependencyUpdates {
gradleReleaseChannel = "current"
revision = "release"
}