-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
88 lines (75 loc) · 2.94 KB
/
build.gradle.kts
File metadata and controls
88 lines (75 loc) · 2.94 KB
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
import build.getApkTargets
import build.getLogs
import build.getReleaseQuoteAndAuthor
import build.getServerTargets
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
`kotlin-dsl` apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.ktlint) apply false
}
// TODO: List of supported installations for debugging. Reduce to one for final production!
val baseDomains by extra(listOf("id.siros.org", "demo.wwwallet.org", "qa.wwwallet.org"))
tasks.register("createReleaseNotes") {
description = "Create a release log of all recent commits."
doLast {
val log = getLogs()
val (quote, author) = getReleaseQuoteAndAuthor()
val citation = "<sub>(Inspirational quotes provided by https://zenquotes.io API.)</sub>"
val releaseNote = "# Release Notes\n\n${
if (!quote.isBlank()) {
"> $quote\n> \n> <i>\\- $author</i>\n\n$citation\n"
} else {
""
}
}\n## Changes${
if (log.lines().size > 10) {
" (abbreviated)"
} else ""
}\n${
log.lines().take(10).joinToString("\n") {
"* $it"
}
}"
println(releaseNote)
File(".release-note.md").writeText(releaseNote)
}
}
tasks.register("checkFingerprints") {
description = "Check apk's sha256fingerprint is ./well-known files on given host."
val url = "https://${baseDomains[0]}/"
doLast {
val serverTargets = getServerTargets(url)
val apkTargets = getApkTargets()
val foundMatch = apkTargets.firstNotNullOfOrNull { apkTarget ->
serverTargets.firstNotNullOfOrNull { serverTarget ->
if (apkTarget.packageName == serverTarget.packageName) {
val serverShaFound = serverTarget.shas.firstOrNull { serverSha ->
apkTarget.shas.contains(serverSha)
}
if (serverShaFound != null) {
serverTarget
} else {
null
}
} else {
null
}
}
}
if (foundMatch != null) {
println("✅ Found signatures for all apks(${apkTargets.joinToString(", ") { it.name.split('/').last() }}) with package '${foundMatch.packageName}' on server '$url'.")
} else {
throw GradleException(
"🙅Could not find any matching signarure from host '$url' for\n${
apkTargets.joinToString(separator = "\n") {
" ${it.name} with package ${it.packageName} and sha ${it.shas.joinToString()}"
}
}"
)
}
}
}
group = "yubico.labs"
version = findProperty("wallet.versionName")!!