forked from SpongePowered/Configurate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
91 lines (80 loc) · 2.92 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
79
80
81
82
83
84
85
86
87
88
89
90
91
import org.jetbrains.gradle.ext.ActionDelegationConfig
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.indra.git)
alias(libs.plugins.gitPublish)
alias(libs.plugins.ideaExt)
id 'java-base'
id 'org.spongepowered.configurate.build.base'
id 'maven-publish'
}
idea.project.settings {
delegateActions {
delegateBuildRunToGradle = false
testRunner = ActionDelegationConfig.TestRunner.PLATFORM
}
}
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)
}
}
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")
}
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/LemonGamingLtd/Configurate"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}