Skip to content

Commit

Permalink
Merge pull request #493 from icerockdev/develop
Browse files Browse the repository at this point in the history
Release 0.22.2
  • Loading branch information
Alex009 authored May 23, 2023
2 parents 367c618 + 7e129e6 commit 25e4f29
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 27 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ buildscript {
}
dependencies {
classpath "dev.icerock.moko:resources-generator:0.22.1"
classpath "dev.icerock.moko:resources-generator:0.22.2"
}
}
Expand All @@ -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 {
Expand All @@ -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
}
```
Expand Down
2 changes: 1 addition & 1 deletion gradle/moko.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
resourcesVersion = "0.22.1"
resourcesVersion = "0.22.2"

[libraries]
resources = { module = "dev.icerock.moko:resources", version.ref = "resourcesVersion" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<KModifier> = arrayOf(KModifier.ACTUAL)

Expand Down Expand Up @@ -101,9 +101,7 @@ class AppleMRGenerator(
}

override fun beforeMRGeneration() {
assetsDirectory = File(resourcesGenerationDir, ASSETS_DIR_NAME).apply {
mkdirs()
}
assetsDirectory.mkdirs()
}

private fun setupKLibResources(generationTask: Task) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Task> {
override fun execute(task: Task) {
Expand All @@ -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(
Expand Down

0 comments on commit 25e4f29

Please sign in to comment.