Skip to content

Commit 227d3ba

Browse files
committed
Review fixes
1 parent 3dec5d3 commit 227d3ba

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GenerateResourceAccessorsTask.kt

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,15 @@ internal abstract class GenerateResourceAccessorsTask : IdeaImportTask() {
110110
}
111111

112112
val type = ResourceType.fromString(typeString) ?: error("Unknown resource type: '$typeString'.")
113-
return listOf(ResourceItem(type, qualifiers, file.nameWithoutExtension.asUnderscoredIdentifier(), path,
114-
file.readBytes().contentHashCode()))
113+
return listOf(
114+
ResourceItem(
115+
type,
116+
qualifiers,
117+
file.nameWithoutExtension.asUnderscoredIdentifier(),
118+
path,
119+
file.readBytes().contentHashCode()
120+
)
121+
)
115122
}
116123

117124
private fun getValueResourceItems(dataFile: File, qualifiers: List<String>, path: Path): List<ResourceItem> {
@@ -142,8 +149,15 @@ internal abstract class GenerateResourceAccessorsTask : IdeaImportTask() {
142149
path: Path
143150
): ResourceItem {
144151
val record = ValueResourceRecord.createFromString(recordString)
145-
return ResourceItem(record.type, qualifiers, record.key.asUnderscoredIdentifier(), path,
146-
record.content.hashCode(), offset, size)
152+
return ResourceItem(
153+
record.type,
154+
qualifiers,
155+
record.key.asUnderscoredIdentifier(),
156+
path,
157+
record.content.hashCode(),
158+
offset,
159+
size
160+
)
147161
}
148162
}
149163

gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GeneratedResClassSpec.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,9 @@ private fun getChunkFileSpec(
292292
if (System.getProperty("compose.resources.generate.ResourceContentHash.annotation") == "true") {
293293
accessorBuilder.addAnnotation(
294294
AnnotationSpec.builder(resourceContentHashAnnotationClass)
295-
.useSiteTarget(AnnotationSpec.UseSiteTarget.DELEGATE)
296-
.addMember("%L", items.fold(0){acc, item -> ((acc * 31) + item.contentHash)}).build()
295+
.useSiteTarget(AnnotationSpec.UseSiteTarget.DELEGATE)
296+
.addMember("%L", items.fold(0) { acc, item -> ((acc * 31) + item.contentHash) })
297+
.build()
297298
)
298299
}
299300
chunkFile.addProperty(accessorBuilder.build())

0 commit comments

Comments
 (0)