File tree Expand file tree Collapse file tree 3 files changed +24
-11
lines changed
gradle-plugins/compose/src
main/kotlin/org/jetbrains/compose/resources
test/kotlin/org/jetbrains/compose/test/tests/integration Expand file tree Collapse file tree 3 files changed +24
-11
lines changed Original file line number Diff line number Diff line change @@ -153,12 +153,7 @@ private fun Project.configureResourceAccessorsGeneration(
153
153
task.packagingDir.set(packagingDir)
154
154
}
155
155
task.onlyIf { shouldGenerateCode.get() }
156
- task.generateResourceContentHashAnnotation.set(
157
- project.providers
158
- .systemProperty(" compose.resources.generate.ResourceContentHash.annotation" )
159
- .map { it.toBoolean() }
160
- .orElse(false )
161
- )
156
+ task.generateResourceContentHashAnnotation.set(false )
162
157
}
163
158
164
159
// register generated source set
Original file line number Diff line number Diff line change @@ -14,7 +14,18 @@ import java.io.File
14
14
import java.nio.file.Path
15
15
import kotlin.io.path.relativeTo
16
16
17
- internal abstract class GenerateResourceAccessorsTask : IdeaImportTask () {
17
+ /* *
18
+ * Defines the property responsible for enabling or disabling
19
+ * the generation of @ResourceContentHash annotation for resource accessors.
20
+ */
21
+ interface ResourceContentHashAnnotationGenerationConfiguration {
22
+ @get:Input
23
+ val generateResourceContentHashAnnotation: Property <Boolean >
24
+ }
25
+
26
+ internal abstract class GenerateResourceAccessorsTask : IdeaImportTask (),
27
+ ResourceContentHashAnnotationGenerationConfiguration
28
+ {
18
29
@get:Input
19
30
abstract val packageName: Property <String >
20
31
@@ -31,9 +42,6 @@ internal abstract class GenerateResourceAccessorsTask : IdeaImportTask() {
31
42
@get:Input
32
43
abstract val makeAccessorsPublic: Property <Boolean >
33
44
34
- @get:Input
35
- abstract val generateResourceContentHashAnnotation: Property <Boolean >
36
-
37
45
@get:InputFiles
38
46
@get:SkipWhenEmpty
39
47
@get:PathSensitive(PathSensitivity .RELATIVE )
Original file line number Diff line number Diff line change @@ -586,8 +586,18 @@ class ResourcesTest : GradlePluginTestBase() {
586
586
587
587
@Test
588
588
fun testGeneratedAccessorsAnnotatedWithResourceContentHash (): Unit = with (testProject(" misc/commonResources" )) {
589
+ file(" build.gradle.kts" ).appendText(
590
+ """
591
+ tasks.configureEach {
592
+ if (this is org.jetbrains.compose.resources.ResourceContentHashAnnotationGenerationConfiguration) {
593
+ generateResourceContentHashAnnotation.set(true)
594
+ }
595
+ }
596
+ """ .trimIndent()
597
+ )
598
+
589
599
// check generated resource's accessors
590
- gradle(" prepareKotlinIdeaImport" , " -Dcompose.resources.generate.ResourceContentHash.annotation=true " ).checks {
600
+ gradle(" prepareKotlinIdeaImport" ).checks {
591
601
val expected = if (System .getProperty(" os.name" ).lowercase().contains(" windows" )) {
592
602
// Windows has different line endings in comparison with Unixes,
593
603
// thus the XML resource files differ and produce different content hashes,
You can’t perform that action at this time.
0 commit comments