Skip to content

Commit

Permalink
Add a privacy policy subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
madhead committed Jul 11, 2024
1 parent a6fa11a commit 1b6cc1b
Show file tree
Hide file tree
Showing 7 changed files with 2,455 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ picocli = "4.7.3"

jacoco = "0.8.10"

asciidoctor = "4.0.2"

[libraries]
kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" }
kotlinx-coroutines-bom = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-bom", version.ref = "kotlinx-coroutines" }
Expand Down Expand Up @@ -48,3 +50,6 @@ picocli = { module = "info.picocli:picocli", version.ref = "picocli" }
[bundles]
boms = ["kotlin-bom", "kotlinx-serialization-bom", "kotlinx-coroutines-bom", "log4j-bom", "junit-bom"]
ktor = ["ktor-server-netty", "ktor-server-metrics-micrometer", "ktor-server-auth", "koin-ktor", "ktor-serialization-kotlinx-json"]

[plugins]
asciidoctor = { id = "org.asciidoctor.jvm.convert", version.ref = "asciidoctor" }
36 changes: 36 additions & 0 deletions policies/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import java.io.ByteArrayOutputStream
import org.asciidoctor.gradle.jvm.AsciidoctorTask

plugins {
alias(libs.plugins.asciidoctor)
}

tasks {
register<AsciidoctorTask>("privacy") {
setSourceDir(file("src/main/asciidoc"))
sources {
include("privacy.adoc")
}
setOutputDir(layout.buildDirectory.asFile)
setBaseDir(file("src/main/asciidoc"))
attributes(mapOf(
"revdate" to shellout(
"git", "log", "-1", "--pretty=format:%cd", "--date=format:%b %d, %Y", file("src/main/asciidoc/privacy.adoc").absolutePath
),
"revnumber" to shellout(
"git", "log", "-1", "--pretty=format:%h", file("src/main/asciidoc/privacy.adoc").absolutePath
),
"version-label" to "Revision:",
))
}
}

private fun shellout(vararg command: String): String =
ByteArrayOutputStream().use { stdout ->
exec {
commandLine(*command)
standardOutput = stdout
}

stdout.toString()
}
Loading

0 comments on commit 1b6cc1b

Please sign in to comment.