-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.gradle.kts
147 lines (129 loc) · 4.72 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import org.apache.tools.ant.filters.ReplaceTokens
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
org.openrndr.guide.convention.`kotlin-jvm`
alias(libs.plugins.git.publish)
alias(libs.plugins.dokgen)
alias(libs.plugins.versions)
}
version = "1.0-SNAPSHOT"
dependencies {
implementation(libs.jsoup)
implementation(libs.gson)
implementation(libs.csv)
implementation(libs.kotlinx.coroutines)
implementation(libs.bundles.openrndr.core)
implementation(libs.bundles.openrndr.rest)
implementation(libs.bundles.orx)
implementation(libs.dokgen) {
// Otherwise includes Gradle's slf4j implementation
isTransitive = false
}
runtimeOnly(libs.slf4j.simple)
}
tasks {
dependencyUpdates {
gradleReleaseChannel = "current"
val nonStableKeywords = listOf("alpha", "beta", "rc")
fun isNonStable(
version: String
) = nonStableKeywords.any {
version.lowercase().contains(it)
}
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
}
dokgen {
runner {
if (System.getProperty("os.name") == "Mac OS X") {
jvmArgs = mutableListOf("-XstartOnFirstThread")
}
}
examples {
webRootUrl = "https://github.com/openrndr/openrndr-examples/blob/master/src/main/kotlin"
}
jekyll {
media = listOf(file("$projectDir/media"), file("$projectDir/static-media"))
assets = listOf(file("$projectDir/data/jekyll-assets"))
}
}
val gitPublishPush: Task by tasks.getting
val publishDocs by tasks.registering {
group = org.openrndr.dokgen.PLUGIN_NAME
description = "Publish website to https://github.com/openrndr/openrndr-guide"
doLast {
gitPublish.repoUri.set("[email protected]:openrndr/openrndr-guide.git")
gitPublish.branch.set("generated")
gitPublish.repoDir.set(file("${layout.buildDirectory.get()}/gitrepo-docs"))
gitPublish.contents.from("build/dokgen/jekyll") {
exclude("docs/.jekyll*", "docs/_site", "docs/*-cache", "docs/*.sh")
}
gitPublish.commitMessage.set("Update docs")
}
finalizedBy(gitPublishPush)
}
val publishExamples by tasks.registering {
group = org.openrndr.dokgen.PLUGIN_NAME
description = "Publish examples to https://github.com/openrndr/openrndr-examples"
val repoTemplate = "$projectDir/src/main/resources/examples-repo-template"
doLast {
gitPublish.repoDir.set(file("${layout.buildDirectory.get()}/gitrepo-examples"))
gitPublish.contents {
from(repoTemplate) {
exclude("settings.gradle.kts")
rename("_git(.*)", ".git$1") // skipped without this trick
}
from(repoTemplate) {
include("settings.gradle.kts")
filter<ReplaceTokens>(
"tokens" to mapOf(
"openrndrVersion" to libs.versions.openrndr.get(),
"orxVersion" to libs.versions.orx.get(),
"ormlVersion" to libs.versions.orml.get()
)
)
}
from("$projectDir/build/dokgen/generated/examples-export") {
into("src/main/kotlin/examples")
}
from("$projectDir/data/images") {
into("data/images")
}
from("$projectDir/data/fonts") {
into("data/fonts")
}
from("$projectDir/data/compute-shaders") {
into("data/compute-shaders")
}
}
gitPublish.repoUri.set("[email protected]:openrndr/openrndr-examples.git")
gitPublish.branch.set("master")
gitPublish.commitMessage.set("Update examples")
}
finalizedBy(gitPublishPush)
}
task("add IDE file scopes") {
group = " ★ OPENRNDR"
val scopesFolder = File("${project.projectDir}/.idea/scopes")
scopesFolder.mkdirs()
val files = listOf(
"Code" to "file:*.kt||file:*.frag||file:*.vert||file:*.glsl",
"Text" to "file:*.txt||file:*.md||file:*.xml||file:*.json",
"Gradle" to "file[*buildSrc*]:*/||file:*gradle.*||file:*.gradle||file:*/gradle-wrapper.properties||file:*.toml",
"Media" to "file:*.png||file:*.jpg||file:*.dds||file:*.exr||file:*.mp3||file:*.wav||file:*.mp4||file:*.mov"
)
files.forEach { (name, pattern) ->
val file = File(scopesFolder, "__$name.xml")
if (!file.exists()) {
file.writeText(
"""
<component name="DependencyValidationManager">
<scope name=" ★ $name" pattern="$pattern" />
</component>
""".trimIndent()
)
}
}
}