-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.main.kts
176 lines (168 loc) ยท 11 KB
/
profile.main.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/usr/bin/env kotlin
@file:Repository("https://repo1.maven.org/maven2/")
@file:DependsOn("org.jetbrains.kotlinx:kotlinx-html:0.10.1")
@file:DependsOn("org.jetbrains.kotlinx:kotlinx-html-jvm:0.10.1")
import Profile_main.Group.*
import Profile_main.Type.*
import kotlinx.html.a
import kotlinx.html.b
import kotlinx.html.br
import kotlinx.html.consumers.measureTime
import kotlinx.html.i
import kotlinx.html.img
import kotlinx.html.small
import kotlinx.html.stream.createHTML
import kotlinx.html.table
import kotlinx.html.tbody
import kotlinx.html.td
import kotlinx.html.th
import kotlinx.html.thead
import kotlinx.html.tr
import kotlin.io.path.Path
import kotlin.io.path.readText
import kotlin.io.path.writeText
import kotlin.text.RegexOption.DOT_MATCHES_ALL
data class Entry(
val author: String = "SimonMarquis",
val name: String,
val label: String = name,
val quote: String? = null,
val packages: Map<Type, String?> = emptyMap(),
)
enum class Group { AndroidApp, AndroidLibrary, GitHubAction, KotlinTool, Misc, AdventOfCode }
enum class Type { GooglePlay, FDroid, GitHubRelease, GitHubMarketplace, GitHubPages, Web, Maven }
// @formatter:off
val map = mapOf(
AndroidApp to listOf(
Entry(name = "InternalAppStore", label = "Internal App Store", quote = "๐ฆ Manage your own internal Android App Store", packages = mapOf(Web to "https://public-app-store.web.app/", GitHubRelease to null)),
Entry(name = "AR-Toolbox", label = "AR Toolbox", quote = "๐งฐ ARCore & Sceneform Playground", packages = mapOf(GooglePlay to "fr.smarquis.ar_toolbox", GitHubRelease to null)),
Entry(name = "FCM-toolbox", label = "FCM toolbox", quote = "๐ฒ Firebase Cloud Messaging toolbox", packages = mapOf(GooglePlay to "fr.smarquis.fcm", Web to "https://fcm-toolbox-public.web.app")),
Entry(name = "QrCode", label = "QrCode", quote = "๐ Scan and create QR Codes", packages = mapOf(GooglePlay to "fr.smarquis.qrcode", GitHubPages to null)),
Entry(name = "SleepTimer", label = "Sleep Timer", quote = "๐ค Simplest Sleep Timer", packages = listOf(GooglePlay, FDroid).associateWith { "fr.smarquis.sleeptimer" }),
Entry(name = "Android-SoundQuickSettings", label = "Sound Quick Settings", quote = "๐ A simple Quick Settings Tile to control the sound volume", packages = mapOf(GooglePlay to "fr.smarquis.soundquicksettings")),
Entry(name = "Android-PreferencesManager", label = "Preferences Manager", quote = "โ๏ธ Seamlessly edit application's preferences", packages = listOf(GooglePlay, FDroid).associateWith { "fr.simon.marquis.preferencesmanager" }),
Entry(name = "Android-SecretCodes", label = "Secret Codes", quote = "๐ช Browse through hidden codes of your Android phone", packages = listOf(GooglePlay, FDroid).associateWith { "fr.simon.marquis.secretcodes" }),
),
AndroidLibrary to listOf(
Entry(name = "Android-App-Linking", label = "Android App Linking", quote = "๐ The ultimate developer guide to Android app linking methods", packages = mapOf(GooglePlay to "fr.smarquis.applinks", GitHubPages to null)),
Entry(name = "Preferences-filtering", label = "Preferences filtering", quote = "๐ Search through Android's Preferences screens", packages = mapOf(GitHubRelease to null)),
Entry(name = "Android-InstallReferrer", label = "Install Referrer", quote = "Test the referrer attribute on the Google Play Store", packages = mapOf(GooglePlay to "fr.simon.marquis.installreferrer", GitHubPages to null)),
Entry(name = "Android-UrlSchemeInterceptor", label = "Url Scheme Interceptor", quote = "Intercept and debug url scheme on Android", packages = mapOf(GooglePlay to "fr.smarquis.usi.sample", GitHubPages to null)),
Entry(name = "Android-Spans", label = "Android Spans", quote = "Kotlin and Java wrappers around SpannableStringBuilder"),
),
KotlinTool to listOf(
Entry(name = "SealedObjectInstances", label = "Sealed Object Instances", quote = "๐๏ธ A Kotlin Symbol Processor to list sealed object instances", packages = mapOf(Maven to "fr.smarquis.sealed/sealed-object-instances", GitHubRelease to null)),
Entry(name = "JavaAgent", label = "Java Agent", quote = "๐ฎ Detect suppressed exceptions in unit tests"),
Entry(name = "Maven-Dependency-Tree", label = "Maven Dependency Tree", quote = "๐ฒ Kotlin script to list transitive dependencies of Maven artifacts"),
Entry(name = "svg2avd", label = "svg2avd", quote = "โ๏ธ Kotlin script to convert SVG files to AVD"),
),
GitHubAction to listOf(
Entry(name = "android-accept-licenses", label = "Android accept licenses", quote = "๐ค Accept Android licenses with `sdkmanager`", packages = mapOf(GitHubMarketplace to "android-accept-licenses", GitHubRelease to null)),
Entry(name = "ci-gradle-properties-action", label = "CI Gradle properties", quote = "๐ Copy Gradle properties file to the CI's home directory", packages = mapOf(GitHubMarketplace to "setup-gradle-properties-file", GitHubRelease to null)),
),
Misc to listOf(
Entry(name = "TIL", label = "Today I Learned", quote = "๐๏ธ Today I Learned", packages = mapOf(GitHubPages to null)),
Entry(name = "Firebase-Remote-Config-Changes-Notifier", label = "Firebase Remote Config changes notifier", quote = "๐ฅ Notify changes in real time through Slack Webhooks"),
Entry(name = "GitHub-Actions-Playground", label = "GitHub Actions Playground", quote = "๐ Playground for GitHub Actions"),
Entry(name = "Android-Version-Distribution", label = "๐ Android Version Distribution"),
Entry(name = "Firebase-Test-Lab-Devices", label = "๐ฑ Firebase Test Lab Devices"),
),
AdventOfCode to listOf(
Entry(name = "advent-of-code-2023", label = "Advent of Code 2023", packages = mapOf(Web to "https://adventofcode.com/2023")),
Entry(name = "advent-of-code-2022", label = "Advent of Code 2022", packages = mapOf(Web to "https://adventofcode.com/2022")),
Entry(name = "advent-of-code-2021", label = "Advent of Code 2021", packages = mapOf(Web to "https://adventofcode.com/2021")),
Entry(name = "advent-of-code-2020", label = "Advent of Code 2020", packages = mapOf(Web to "https://adventofcode.com/2020")),
Entry(name = "advent-of-code-2019", label = "Advent of Code 2019", packages = mapOf(Web to "https://adventofcode.com/2019")),
)
)
// @formatter:on
fun Entry.github() = "https://github.com/$author/$name"
fun shield(value: String) = "https://img.shields.io/$value"
createHTML().measureTime().run {
table {
map.forEach { (group, entries) ->
thead {
attributes["style"] = "font-size: larger; background-color: #FFFFFF11;"
tr {
th {
attributes["style"] = "text-align: left"
b {
+when (group) {
AndroidApp -> "๐ค Android apps"
AndroidLibrary -> "๐ค Android libraries"
GitHubAction -> "๐ Github Actions"
KotlinTool -> "๐งฐ Kotlin libraries & tools"
Misc -> "๐ Miscellaneous"
AdventOfCode -> "๐ Advent of Code"
}
}
}
th { b { +"โญ" } }
th { b { +"๐๏ธ" } }
th { b { +"๐" } }
}
}
tbody {
entries.forEach {
tr {
/* Project */
td {
a(it.github()) {
b { +it.label }
it.quote?.let { br; i { small { +it } } }
}
}
/* Stars & Forks */
td {
a("${it.github()}/stargazers") { img(alt = "Stars", src = shield("github/stars/SimonMarquis/${it.name}")) }; br
a("${it.github()}/forks") { img(alt = "Forks", src = shield("github/forks/SimonMarquis/${it.name}")) }
}
/* Issues & PRs */
td {
a("${it.github()}/issues") { img(alt = "Issues", src = shield("github/issues/SimonMarquis/${it.name}?label=Issues")) }; br
a("${it.github()}/pulls") { img(alt = "Pull Requests", src = shield("github/issues-pr/SimonMarquis/${it.name}?label=PRs%E2%A0%80%E2%A0%80")) }
}
/* Links */
td {
it.packages.entries.forEachIndexed { index, (type, name) ->
if (index != 0) br
a(
href = when (type) {
GooglePlay -> "https://play.google.com/store/apps/details?id=$name"
FDroid -> "https://f-droid.org/en/packages/$name"
Maven -> "https://central.sonatype.com/artifact/$name"
GitHubMarketplace -> "https://github.com/marketplace/actions/$name"
GitHubRelease -> "https://github.com/${it.author}/${it.name}/releases/latest"
GitHubPages -> "https://${it.author.lowercase()}.github.io/${it.name}"
Web -> name
},
) {
img(
alt = "Download",
src = when (type) {
GooglePlay -> shield("badge/Google%20Play-%20?logo=googleplay&color=grey")
FDroid -> shield("badge/F--Droid-%20?logo=f-droid&color=grey")
GitHubMarketplace -> shield("badge/Marketplace-%20?logo=github&logoColor=white&color=grey")
GitHubRelease -> shield("github/v/release/${it.author}/${it.name}?logo=github&label=%20&color=grey")
Web, GitHubPages -> shield("badge/Web-%20?logo=html5&logoColor=white&color=grey")
Maven -> shield("maven-central/v/$name?label=Maven&color=grey")
},
)
}
}
}
}
}
}
}
}
}.let {
println("Generated in ${it.time} ms")
with(Path("README.md")) {
writeText(
readText().replace("""(<!--region-->)(.*?)(<!--endregion-->)""".toRegex(DOT_MATCHES_ALL)) { match ->
match.destructured.let { (start, _, end) -> "$start\n${it.result}$end" }
},
)
}
}