Skip to content

Commit 3c945aa

Browse files
committed
chore(emojis): suppress verbose logging and skip when already generated
Remove thousands of per-emoji println calls that flooded CI logs and caused the GitHub Actions UI to stall. Add onlyIf check to skip generation when output already exists. Single summary line now. Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent f3d3625 commit 3c945aa

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

libs/emojis/build.gradle.kts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,25 @@ tasks.register("generateEmojiList") {
4141
"Fetches Unicode emoji list and generates categorized Kotlin source file if needed"
4242
group = "emoji"
4343

44-
outputs.file(outputFile) // Task generates this file
44+
outputs.dir(outputDir)
45+
// Skip generation if output already exists (cached emoji-test.txt and keywords are inputs)
46+
onlyIf { !outputFile.exists() }
4547

4648
doLast {
4749
try {
48-
println("Executing generateEmojiList task")
4950
outputDir.mkdirs()
5051
if (!emojiFile.exists()) {
51-
println("Downloading emoji-test.txt from $emojiUrl")
52+
println("Downloading emoji-test.txt")
5253
URL(emojiUrl).openStream().use { input ->
5354
Files.copy(input, emojiFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
5455
}
55-
} else {
56-
println("Using existing emoji-test.txt")
5756
}
5857

5958
if (!keywordsFile.exists()) {
60-
println("Downloading CLDR annotations from $emojiKeywordsUrl")
59+
println("Downloading CLDR annotations")
6160
URL(emojiKeywordsUrl).openStream().use { input ->
6261
Files.copy(input, keywordsFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
6362
}
64-
} else {
65-
println("Using existing CLDR annotations")
6663
}
6764

6865
val json = Json { ignoreUnknownKeys = true }
@@ -87,20 +84,16 @@ tasks.register("generateEmojiList") {
8784
}
8885
emojiCategories.getOrPut(currentGroup) { mutableMapOf() }
8986
emojiCategoriesNoSkinTones.getOrPut(currentGroup) { mutableMapOf() }
90-
println("Group: $currentGroup")
9187
}
9288

9389
line.startsWith("# subgroup:") -> {
9490
currentSubgroup = line.removePrefix("# subgroup:").trim()
9591
emojiCategories[currentGroup]?.getOrPut(currentSubgroup) { mutableListOf() }
9692
emojiCategoriesNoSkinTones[currentGroup]?.getOrPut(currentSubgroup) { mutableListOf() }
97-
println("Subgroup: $currentSubgroup")
9893
}
9994

10095
line.isNotBlank() && !line.startsWith("#") -> {
10196
val parts = line.split(";").map { it.trim() }
102-
println("Line: $line")
103-
println("Parts: $parts")
10497
if (parts.size > 1 && parts[1].contains("fully-qualified")) {
10598
val codePoints = parts[0].split(" ").map { it.toInt(16) }
10699
val unicode = codePoints.map { codePoint ->
@@ -125,16 +118,12 @@ tasks.register("generateEmojiList") {
125118
"keywords" to allKeywords
126119
)
127120
emojiCategories[currentGroup]?.get(currentSubgroup)?.add(emojiEntry)
128-
println("Added fully-qualified emoji: $unicode - $name")
129121

130122
val hasSkinTone = codePoints.any { it in 0x1F3FB..0x1F3FF }
131123
if (!hasSkinTone) {
132124
emojiCategoriesNoSkinTones[currentGroup]?.get(currentSubgroup)
133125
?.add(emojiEntry)
134-
println("Added to no-skin-tones: $unicode - $name")
135126
}
136-
} else {
137-
println("Skipped non-fully-qualified: ${parts[0]} - Status: ${parts[1]}")
138127
}
139128
}
140129
}
@@ -198,7 +187,6 @@ tasks.register("generateEmojiList") {
198187
appendLine("}")
199188
}.trimIndent()
200189
mainFile.writeText(mainCode)
201-
println("Generated Emojis.kt at ${mainFile.absolutePath}")
202190

203191
// Generate separate files for each subgroup
204192
emojiCategories.forEach { (group, subgroups) ->
@@ -235,9 +223,10 @@ tasks.register("generateEmojiList") {
235223
appendLine("}")
236224
}.trimIndent()
237225
subgroupFile.writeText(subgroupCode)
238-
println("Generated ${safeGroupName}${safeSubgroupName}Emojis.kt at ${subgroupFile.absolutePath}")
239226
}
240227
}
228+
val totalEmojis = emojiCategories.values.sumOf { it.values.sumOf { e -> e.size } }
229+
println("Generated $totalEmojis emojis across ${emojiCategories.size} categories")
241230
} catch (e: Exception) {
242231
println("Error in generateEmojiList: ${e.message}")
243232
throw e

0 commit comments

Comments
 (0)