diff --git a/README.md b/README.md index 427724fbe..b12ce6c94 100755 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ buildscript { } dependencies { - classpath "dev.icerock.moko:resources-generator:0.22.1" + classpath "dev.icerock.moko:resources-generator:0.22.2" } } @@ -80,10 +80,10 @@ project build.gradle apply plugin: "dev.icerock.mobile.multiplatform-resources" dependencies { - commonMainApi("dev.icerock.moko:resources:0.22.1") - commonMainApi("dev.icerock.moko:resources-compose:0.22.1") // for compose multiplatform + commonMainApi("dev.icerock.moko:resources:0.22.2") + commonMainApi("dev.icerock.moko:resources-compose:0.22.2") // for compose multiplatform - commonTestImplementation("dev.icerock.moko:resources-test:0.22.1") + commonTestImplementation("dev.icerock.moko:resources-test:0.22.2") } multiplatformResources { @@ -102,7 +102,7 @@ should [add `export` declarations](https://kotlinlang.org/docs/multiplatform-bui ``` framework { - export("dev.icerock.moko:resources:0.22.1") + export("dev.icerock.moko:resources:0.22.2") export("dev.icerock.moko:graphics:0.9.0") // toUIColor here } ``` diff --git a/gradle/moko.versions.toml b/gradle/moko.versions.toml index ff7793161..a2692d25e 100644 --- a/gradle/moko.versions.toml +++ b/gradle/moko.versions.toml @@ -1,5 +1,5 @@ [versions] -resourcesVersion = "0.22.1" +resourcesVersion = "0.22.2" [libraries] resources = { module = "dev.icerock.moko:resources", version.ref = "resourcesVersion" } diff --git a/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleMRGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleMRGenerator.kt index a6cfd9ed2..7f143d231 100644 --- a/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleMRGenerator.kt +++ b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleMRGenerator.kt @@ -61,7 +61,7 @@ class AppleMRGenerator( ClassName("platform.Foundation", "NSBundle") private val bundleIdentifier = "${mrSettings.packageName}.MR" - private var assetsDirectory: File? = null + private val assetsDirectory: File get() = File(resourcesGenerationDir, ASSETS_DIR_NAME) override fun getMRClassModifiers(): Array = arrayOf(KModifier.ACTUAL) @@ -101,9 +101,7 @@ class AppleMRGenerator( } override fun beforeMRGeneration() { - assetsDirectory = File(resourcesGenerationDir, ASSETS_DIR_NAME).apply { - mkdirs() - } + assetsDirectory.mkdirs() } private fun setupKLibResources(generationTask: Task) { diff --git a/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/action/PackResourcesToKLibAction.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/action/PackResourcesToKLibAction.kt index 3a6c84058..811c1e796 100644 --- a/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/action/PackResourcesToKLibAction.kt +++ b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/action/PackResourcesToKLibAction.kt @@ -16,7 +16,7 @@ import java.util.Properties internal class PackResourcesToKLibAction( private val baseLocalizationRegion: String, private val bundleIdentifier: String, - private val assetsDirectory: File?, + private val assetsDirectory: File, private val resourcesGenerationDir: File ) : Action { override fun execute(task: Task) { @@ -43,22 +43,21 @@ internal class PackResourcesToKLibAction( ) loadableBundle.write() - assetsDirectory?.let { assetsDir -> - val process = Runtime.getRuntime().exec( - "xcrun actool Assets.xcassets --compile . --platform iphoneos --minimum-deployment-target 9.0", - emptyArray(), - assetsDir.parentFile - ) - val errors = process.errorStream.bufferedReader().readText() - val input = process.inputStream.bufferedReader().readText() - val result = process.waitFor() - if (result != 0) { - println("can't compile assets - $result") - println(input) - println(errors) - } else { - assetsDir.deleteRecursively() - } + val process: Process = Runtime.getRuntime().exec( + "xcrun actool Assets.xcassets --compile . --platform iphoneos --minimum-deployment-target 9.0", + emptyArray(), + assetsDirectory.parentFile + ) + val errors: String = process.errorStream.bufferedReader().readText() + val input: String = process.inputStream.bufferedReader().readText() + val result: Int = process.waitFor() + if (result != 0) { + task.logger.error("can't compile assets - $result") + task.logger.info(input) + task.logger.error(errors) + } else { + task.logger.info("assets compiled") + assetsDirectory.deleteRecursively() } resourcesGenerationDir.copyRecursively(