forked from SpongePowered/Configurate
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
78 lines (69 loc) · 2.65 KB
/
build.gradle
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
import static org.eclipse.jgit.lib.Repository.shortenRefName
plugins {
alias(libs.plugins.kotlin) apply false
alias(libs.plugins.dokka) apply false
alias(libs.plugins.detekt) apply false
alias(libs.plugins.aggregateJavadoc)
alias(libs.plugins.gitPublish)
alias(libs.plugins.indra.git)
alias(libs.plugins.indra.sonatype)
alias(libs.plugins.nexusPublish)
id 'java-base'
id 'org.spongepowered.configurate.build.base'
}
tasks.named('aggregateJavadoc').configure {
def 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)) })
}
configurate.applyCommonAttributes(it)
title = "Configurate $version (all modules)"
def excludedProjects = ["examples"].collect {
project(":$it").projectDir.toPath().toAbsolutePath()
}
exclude {
excludedProjects.find { path -> it.file.toPath().toAbsolutePath().startsWith(path) } != null
}
options.addBooleanOption("Xdoclint:-missing", true)
options.links("https://docs.oracle.com/javase/8/docs/api/")
if (gradleJdk > JavaVersion.VERSION_1_8 && gradleJdk < JavaVersion.VERSION_12) {
options.addBooleanOption("-no-module-directories", true)
}
}
tasks.register('test') {
def vendor = gradle.includedBuild("configurate-vendor")
// dependsOn(vendor.task(":snakeyaml:test")) // tests fail currently
dependsOn(vendor.task(":typesafe-config:test"))
}
tasks.check {
dependsOn('test')
}
gitPublish {
def repo = indraGit.git()
if (repo != null) {
repo.remoteList().call().find { config -> config.name == "origin" }?.with { remote ->
repoUri.set((remote.pushURIs.find() ?: remote.URIs.first()).toPrivateString())
referenceRepoUri.set(remote.URIs.first().toPrivateString())
}
}
branch = "gh-pages"
contents {
from("src/site") {
def versionProvider = {
([project.version as String] + indraGit.tags().collect { tag -> shortenRefName(tag.name) }.reverse())
.unique()
.findAll { tag -> repoDir.get().dir(tag).getAsFile().exists() || tag == project.version }
}
expand project: project, versions: versionProvider
}
from(tasks.aggregateJavadoc) {
into("$version/apidocs")
}
}
preserve {
include(".gitattributes")
include("**/") // include everything in directories
exclude("/*.html")
}
}