From 48af964e8534c918b716b693543d15e570f5dc9e Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sat, 22 Aug 2020 14:19:50 +0700 Subject: [PATCH 01/25] update to kotlin 1.4.0, gradle 6, composite build usage for plugin (no more conditions in gradle setup) --- README.md | 10 +- build.gradle.kts | 33 +++-- buildSrc/build.gradle.kts | 18 +-- buildSrc/src/main/kotlin/Deps.kt | 131 ++++++++++-------- buildSrc/src/main/kotlin/PluginDesc.kt | 31 ----- buildSrc/src/main/kotlin/Versions.kt | 47 ------- gradle.properties | 4 +- gradle/wrapper/gradle-wrapper.properties | 2 +- plugins/buildSrc/build.gradle.kts | 1 + plugins/buildSrc/src | 1 + .../resources-generator}/build.gradle.kts | 29 ++-- .../gradle/MultiplatformResourcesPlugin.kt | 0 .../MultiplatformResourcesPluginExtension.kt | 0 .../icerock/gradle/generator/BaseGenerator.kt | 0 .../gradle/generator/ColorsGenerator.kt | 0 .../generator/EqualStringKeysException.kt | 0 .../FatFrameworkWithResourcesTask.kt | 0 .../gradle/generator/FilesGenerator.kt | 0 .../gradle/generator/FontsGenerator.kt | 0 .../GenerateMultiplatformResourcesTask.kt | 0 .../gradle/generator/ImagesGenerator.kt | 0 .../icerock/gradle/generator/MRGenerator.kt | 0 .../gradle/generator/ObjectBodyExtendable.kt | 0 .../gradle/generator/PluralsGenerator.kt | 0 .../generator/ResourceGeneratorFeature.kt | 0 .../icerock/gradle/generator/SourceInfo.kt | 0 .../gradle/generator/StringsGenerator.kt | 0 .../android/AndroidColorsGenerator.kt | 0 .../android/AndroidFilesGenerator.kt | 0 .../android/AndroidFontsGenerator.kt | 0 .../android/AndroidImagesGenerator.kt | 0 .../generator/android/AndroidMRGenerator.kt | 0 .../android/AndroidPluralsGenerator.kt | 0 .../android/AndroidStringsGenerator.kt | 0 .../generator/common/CommonColorsGenerator.kt | 0 .../generator/common/CommonFilesGenerator.kt | 0 .../generator/common/CommonFontsGenerator.kt | 0 .../generator/common/CommonImagesGenerator.kt | 0 .../generator/common/CommonMRGenerator.kt | 0 .../common/CommonPluralsGenerator.kt | 0 .../common/CommonStringsGenerator.kt | 0 .../generator/ios/IosColorsGenerator.kt | 0 .../gradle/generator/ios/IosFilesGenerator.kt | 0 .../gradle/generator/ios/IosFontsGenerator.kt | 0 .../generator/ios/IosGeneratorHelper.kt | 0 .../generator/ios/IosImagesGenerator.kt | 0 .../gradle/generator/ios/IosMRGenerator.kt | 15 +- .../generator/ios/IosPluralsGenerator.kt | 0 .../generator/ios/IosStringsGenerator.kt | 0 .../gradle/generator/ios/LoadableBundle.kt | 0 .../dev/icerock/gradle/utils/ArgbColor.kt | 0 ....mobile.multiplatform-resources.properties | 0 plugins/settings.gradle.kts | 5 + publishToMavenLocal.sh | 1 - resources/build.gradle.kts | 29 ++-- .../icerock/moko/resources/desc/StringDesc.kt | 2 +- resources/src/iosArm64Main | 1 - .../icerock/moko/resources/desc/StringDesc.kt | 1 + resources/src/iosX64Main | 1 - sample/android-app/build.gradle.kts | 12 +- sample/mpp-conditional/build.gradle.kts | 10 +- sample/mpp-hierarhical/build.gradle.kts | 10 +- sample/mpp-library/build.gradle.kts | 19 +-- .../nested-module/build.gradle.kts | 10 -- sample/mpp-mixed/build.gradle.kts | 10 +- settings.gradle.kts | 21 ++- 66 files changed, 171 insertions(+), 283 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/PluginDesc.kt delete mode 100755 buildSrc/src/main/kotlin/Versions.kt create mode 120000 plugins/buildSrc/build.gradle.kts create mode 120000 plugins/buildSrc/src rename {gradle-plugin => plugins/resources-generator}/build.gradle.kts (58%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPluginExtension.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/BaseGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/EqualStringKeysException.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/GenerateMultiplatformResourcesTask.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ObjectBodyExtendable.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ResourceGeneratorFeature.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/SourceInfo.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidColorsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFilesGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFontsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidImagesGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidMRGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidPluralsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonColorsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFilesGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFontsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonImagesGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonMRGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonPluralsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonStringsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ios/IosColorsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ios/IosFilesGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ios/IosFontsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ios/IosGeneratorHelper.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ios/IosImagesGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt (92%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ios/IosPluralsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ios/IosStringsGenerator.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ios/LoadableBundle.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt (100%) rename {gradle-plugin => plugins/resources-generator}/src/main/resources/META-INF/gradle-plugins/dev.icerock.mobile.multiplatform-resources.properties (100%) create mode 100644 plugins/settings.gradle.kts delete mode 100755 publishToMavenLocal.sh delete mode 120000 resources/src/iosArm64Main delete mode 120000 resources/src/iosX64Main diff --git a/README.md b/README.md index 5e60adcf..d8ec4f8b 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![moko-resources](img/logo.png) -[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://api.bintray.com/packages/icerockdev/moko/moko-resources/images/download.svg) ](https://bintray.com/icerockdev/moko/moko-resources/_latestVersion) ![kotlin-version](https://img.shields.io/badge/kotlin-1.3.72-orange) +[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://api.bintray.com/packages/icerockdev/moko/moko-resources/images/download.svg) ](https://bintray.com/icerockdev/moko/moko-resources/_latestVersion) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.0-orange) # Mobile Kotlin resources This is a Kotlin MultiPlatform library that provides access to the resources on iOS & Android with the support of the default system localization. @@ -21,7 +21,7 @@ This is a Kotlin MultiPlatform library that provides access to the resources on - **FatFrameworkWithResourcesTask** Gradle task. ## Requirements -- Gradle version 5.6.4+ +- Gradle version 6.0+ - Android API 16+ - iOS version 9.0+ @@ -47,6 +47,8 @@ This is a Kotlin MultiPlatform library that provides access to the resources on - 0.10.0 - 0.10.1 - 0.11.0 +- kotlin 1.4.0 + - 0.12.0 ## Installation root build.gradle @@ -57,7 +59,7 @@ buildscript { } dependencies { - classpath "dev.icerock.moko:resources-generator:0.11.0" + classpath "dev.icerock.moko:resources-generator:0.12.0" } } @@ -74,7 +76,7 @@ project build.gradle apply plugin: "dev.icerock.mobile.multiplatform-resources" dependencies { - commonMainApi("dev.icerock.moko:resources:0.11.0") + commonMainApi("dev.icerock.moko:resources:0.12.0") } multiplatformResources { diff --git a/build.gradle.kts b/build.gradle.kts index 75a94d82..985f2743 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,19 +19,7 @@ buildscript { maven { url = uri("https://dl.bintray.com/icerockdev/plugins") } } dependencies { - val libraryPublish: Boolean = properties.containsKey("libraryPublish") - - with(Deps.Plugins) { - listOfNotNull( - androidApplication, - androidLibrary, - kotlinMultiplatform, - kotlinKapt, - kotlinAndroid, - kotlinSerialization, - if (!libraryPublish) mokoResources else null - ) - }.let { plugins(it) } + plugin(Deps.Plugins.mokoResources) } } @@ -50,13 +38,30 @@ allprojects { apply(plugin = Deps.Plugins.detekt.id) configure { - toolVersion = Versions.detekt input.setFrom("src/commonMain/kotlin", "src/androidMain/kotlin", "src/iosMain/kotlin") } dependencies { "detektPlugins"(Deps.Libs.Jvm.detektFormatting) } + + configurations.all { + resolutionStrategy.dependencySubstitution { + substitute(module(Deps.Libs.MultiPlatform.mokoResources.common)) + .with(project(":resources")) + } + } + + plugins.withId(Deps.Plugins.androidLibrary.id) { + configure { + compileSdkVersion(Deps.Android.compileSdk) + + defaultConfig { + minSdkVersion(Deps.Android.minSdk) + targetSdkVersion(Deps.Android.targetSdk) + } + } + } } tasks.register("clean", Delete::class).configure { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index faf8a855..da868696 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,8 +1,14 @@ +/* + * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + plugins { - `kotlin-dsl` + id("org.jetbrains.kotlin.jvm") version("1.4.0") } repositories { + mavenLocal() + jcenter() google() @@ -10,11 +16,7 @@ repositories { } dependencies { - implementation("dev.icerock:mobile-multiplatform:0.6.1") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72") - implementation("com.android.tools.build:gradle:3.6.3") -} - -kotlinDslPluginOptions { - experimentalWarning.set(false) + implementation("dev.icerock:mobile-multiplatform:0.7.0") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0") + implementation("com.android.tools.build:gradle:4.0.1") } diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index a24ac1e3..2819306f 100755 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -3,85 +3,96 @@ */ object Deps { - object Plugins { - val androidApplication = PluginDesc(id = "com.android.application") - val androidLibrary = PluginDesc( - id = "com.android.library", - module = "com.android.tools.build:gradle:${Versions.Plugins.android}" - ) + private const val kotlinVersion = "1.4.0" + private const val androidGradleVersion = "4.0.1" - val kotlinMultiplatform = PluginDesc( - id = "org.jetbrains.kotlin.multiplatform", - module = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.Plugins.kotlin}" - ) - val kotlinKapt = PluginDesc(id = "kotlin-kapt") - val kotlinAndroid = PluginDesc(id = "kotlin-android") - val kotlinAndroidExtensions = PluginDesc(id = "kotlin-android-extensions") - val kotlinSerialization = PluginDesc(id = "kotlin-serialization") + private const val androidAppCompatVersion = "1.1.0" + private const val espressoCoreVersion = "3.2.0" + private const val testRunnerVersion = "1.2.0" + private const val testExtJunitVersion = "1.1.1" + + private const val apacheCommonsTextVersion = "1.3" + private const val kotlinPoetVersion = "1.6.0" + private const val kotlinxSerializationVersion = "0.20.0" + + private const val detektVersion = "1.7.4" + + private const val mokoGraphicsVersion = "0.4.0" + private const val mokoParcelizeVersion = "0.4.0" + const val mokoResourcesVersion = "0.12.0" - val mobileMultiplatform = PluginDesc(id = "dev.icerock.mobile.multiplatform") + object Android { + const val compileSdk = 28 + const val targetSdk = 28 + const val minSdk = 16 + } + + object Plugins { + val androidApplication = GradlePlugin(id = "com.android.application") + val androidLibrary = GradlePlugin(id = "com.android.library") + val kotlinJvm = GradlePlugin(id = "org.jetbrains.kotlin.jvm") + val kotlinMultiplatform = GradlePlugin(id = "org.jetbrains.kotlin.multiplatform") + val kotlinKapt = GradlePlugin(id = "kotlin-kapt") + val kotlinAndroid = GradlePlugin(id = "kotlin-android") + val kotlinAndroidExtensions = GradlePlugin(id = "kotlin-android-extensions") + val kotlinSerialization = GradlePlugin(id = "kotlin-serialization") + val mavenPublish = GradlePlugin(id = "org.gradle.maven-publish") - val mokoResources = PluginDesc( + val mobileMultiplatform = GradlePlugin(id = "dev.icerock.mobile.multiplatform") + val iosFramework = GradlePlugin(id = "dev.icerock.mobile.multiplatform.ios-framework") + + val mokoResources = GradlePlugin( id = "dev.icerock.mobile.multiplatform-resources", - module = "dev.icerock.moko:resources-generator:${Versions.Plugins.mokoResources}" + module = "dev.icerock.moko:resources-generator:$mokoResourcesVersion" ) - val detekt = PluginDesc(id = "io.gitlab.arturbosch.detekt", version = Versions.detekt) + val detekt = GradlePlugin( + id = "io.gitlab.arturbosch.detekt", + version = detektVersion + ) } object Libs { object Android { - val kotlinStdLib = AndroidLibrary( - name = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}" - ) - val appCompat = AndroidLibrary( - name = "androidx.appcompat:appcompat:${Versions.Libs.Android.appCompat}" - ) + val appCompat = + AndroidLibrary(name = "androidx.appcompat:appcompat:$androidAppCompatVersion") object AndroidTest { - val espressoCore = AndroidLibrary( - name = "androidx.test.espresso:espresso-core:${Versions.Libs.Android.AndroidTest.espressoCore}" - ) - val testRunner = AndroidLibrary( - name = "androidx.test:runner:${Versions.Libs.Android.AndroidTest.testRunner}" - ) - val testRules = AndroidLibrary( - name = "androidx.test:rules:${Versions.Libs.Android.AndroidTest.testRunner}" - ) - val testExtJunit = AndroidLibrary( - name = "androidx.test.ext:junit:${Versions.Libs.Android.AndroidTest.testExtJunit}" - ) + val espressoCore = + AndroidLibrary(name = "androidx.test.espresso:espresso-core:$espressoCoreVersion") + val testRunner = + AndroidLibrary(name = "androidx.test:runner:$testRunnerVersion") + val testRules = + AndroidLibrary(name = "androidx.test:rules:$testRunnerVersion") + val testExtJunit = + AndroidLibrary(name = "androidx.test.ext:junit:$testExtJunitVersion") } } object MultiPlatform { - val kotlinStdLib = MultiPlatformLibrary( - android = Android.kotlinStdLib.name, - common = "org.jetbrains.kotlin:kotlin-stdlib-common:${Versions.kotlin}" - ) - val mokoResources = MultiPlatformLibrary( - common = "dev.icerock.moko:resources:${Versions.Libs.MultiPlatform.mokoResources}", - iosX64 = "dev.icerock.moko:resources-iosx64:${Versions.Libs.MultiPlatform.mokoResources}", - iosArm64 = "dev.icerock.moko:resources-iosarm64:${Versions.Libs.MultiPlatform.mokoResources}" - ) - val mokoParcelize = MultiPlatformLibrary( - common = "dev.icerock.moko:parcelize:${Versions.Libs.MultiPlatform.mokoParcelize}", - iosX64 = "dev.icerock.moko:parcelize-iosx64:${Versions.Libs.MultiPlatform.mokoParcelize}", - iosArm64 = "dev.icerock.moko:parcelize-iosarm64:${Versions.Libs.MultiPlatform.mokoParcelize}" - ) - val mokoGraphics = MultiPlatformLibrary( - common = "dev.icerock.moko:graphics:${Versions.Libs.MultiPlatform.mokoGraphics}", - iosX64 = "dev.icerock.moko:graphics-iosx64:${Versions.Libs.MultiPlatform.mokoGraphics}", - iosArm64 = "dev.icerock.moko:graphics-iosarm64:${Versions.Libs.MultiPlatform.mokoGraphics}" - ) - + val mokoResources = + MultiPlatformLibrary(common = "dev.icerock.moko:resources:$mokoResourcesVersion") + val mokoParcelize = + MultiPlatformLibrary(common = "dev.icerock.moko:parcelize:$mokoParcelizeVersion") + val mokoGraphics = + MultiPlatformLibrary(common = "dev.icerock.moko:graphics:$mokoGraphicsVersion") } object Jvm { - const val kotlinPoet = "com.squareup:kotlinpoet:${Versions.Libs.Jvm.kotlinPoet}" - const val kotlinxSerialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Versions.Libs.Jvm.kotlinxSerialization}" - const val apacheCommonsText = "org.apache.commons:commons-text:${Versions.Libs.Jvm.apacheCommonsText}" - const val detektFormatting = "io.gitlab.arturbosch.detekt:detekt-formatting:${Versions.detekt}" + const val kotlinPoet = + "com.squareup:kotlinpoet:$kotlinPoetVersion" + const val kotlinxSerialization = + "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlinxSerializationVersion" + const val apacheCommonsText = + "org.apache.commons:commons-text:$apacheCommonsTextVersion" + const val detektFormatting = + "io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion" + const val kotlinGradlePlugin = + "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" + const val androidGradlePlugin = + "com.android.tools.build:gradle:$androidGradleVersion" + const val kotlinCompilerEmbeddable = + "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlinVersion" } } } diff --git a/buildSrc/src/main/kotlin/PluginDesc.kt b/buildSrc/src/main/kotlin/PluginDesc.kt deleted file mode 100644 index 2850c83a..00000000 --- a/buildSrc/src/main/kotlin/PluginDesc.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. - */ - -import org.gradle.api.artifacts.Dependency -import org.gradle.kotlin.dsl.DependencyHandlerScope -import org.gradle.plugin.use.PluginDependenciesSpec -import org.gradle.plugin.use.PluginDependencySpec - -// TODO move to https://github.com/icerockdev/mobile-multiplatform-gradle-plugin -data class PluginDesc( - val id: String, - val module: String? = null, - val version: String? = null -) - -fun DependencyHandlerScope.plugin(pluginDesc: PluginDesc): Dependency? { - return pluginDesc.module?.let { "classpath"(it) } -} - -fun DependencyHandlerScope.plugins(pluginDescList: List) { - pluginDescList - .distinctBy { it.module } - .forEach { plugin(it) } -} - -fun PluginDependenciesSpec.plugin(pluginDesc: PluginDesc): PluginDependencySpec { - val spec = id(pluginDesc.id) - pluginDesc.version?.also { spec.version(it) } - return spec -} diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt deleted file mode 100755 index 61285b66..00000000 --- a/buildSrc/src/main/kotlin/Versions.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. - */ - -object Versions { - object Android { - const val compileSdk = 28 - const val targetSdk = 28 - const val minSdk = 16 - } - - const val kotlin = "1.3.72" - const val detekt = "1.7.4" - - private const val mokoResources = "0.11.0" - - object Plugins { - const val android = "3.6.2" - - const val kotlin = Versions.kotlin - const val mokoResources = Versions.mokoResources - } - - object Libs { - object Android { - const val appCompat = "1.1.0" - - object AndroidTest { - const val espressoCore = "3.2.0" - const val testRunner = "1.2.0" - const val testExtJunit = "1.1.1" - } - } - - object MultiPlatform { - const val mokoResources = Versions.mokoResources - const val mokoParcelize = "0.3.0" - const val mokoGraphics = "0.3.0" - } - - object Jvm { - const val apacheCommonsText = "1.3" - const val kotlinPoet = "1.6.0" - const val kotlinxSerialization = "0.20.0" - } - } -} diff --git a/gradle.properties b/gradle.properties index 1d662cd6..73f61469 100755 --- a/gradle.properties +++ b/gradle.properties @@ -3,12 +3,12 @@ org.gradle.configureondemand=false org.gradle.parallel=true kotlin.code.style=official +#kotlin.mpp.enableGranularSourceSetsMetadata=true +#kotlin.native.enableDependencyPropagation=false android.useAndroidX=true android.enableJetifier=true -kotlin.native.enableParallelExecutionCheck=false - # Workaround for Bintray treating .sha512 files as artifacts # https://github.com/gradle/gradle/issues/11412 systemProp.org.gradle.internal.publish.checksums.insecure=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4b44297..6c9a2247 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/plugins/buildSrc/build.gradle.kts b/plugins/buildSrc/build.gradle.kts new file mode 120000 index 00000000..f8089930 --- /dev/null +++ b/plugins/buildSrc/build.gradle.kts @@ -0,0 +1 @@ +../../buildSrc/build.gradle.kts \ No newline at end of file diff --git a/plugins/buildSrc/src b/plugins/buildSrc/src new file mode 120000 index 00000000..38645d55 --- /dev/null +++ b/plugins/buildSrc/src @@ -0,0 +1 @@ +../../buildSrc/src \ No newline at end of file diff --git a/gradle-plugin/build.gradle.kts b/plugins/resources-generator/build.gradle.kts similarity index 58% rename from gradle-plugin/build.gradle.kts rename to plugins/resources-generator/build.gradle.kts index 195f2c6a..64d2d434 100644 --- a/gradle-plugin/build.gradle.kts +++ b/plugins/resources-generator/build.gradle.kts @@ -4,29 +4,28 @@ plugins { `kotlin-dsl` - id("org.gradle.maven-publish") + plugin(Deps.Plugins.mavenPublish) + plugin(Deps.Plugins.detekt) } repositories { - mavenLocal() - jcenter() google() } +group = "dev.icerock.moko" +version = Deps.mokoResourcesVersion + dependencies { + compileOnly(Deps.Libs.Jvm.kotlinGradlePlugin) + compileOnly(Deps.Libs.Jvm.androidGradlePlugin) implementation(Deps.Libs.Jvm.kotlinPoet) implementation(Deps.Libs.Jvm.kotlinxSerialization) - compileOnly(Deps.Plugins.kotlinMultiplatform.module!!) - compileOnly(Deps.Plugins.androidLibrary.module!!) implementation(Deps.Libs.Jvm.apacheCommonsText) + implementation(Deps.Libs.Jvm.kotlinCompilerEmbeddable) detektPlugins(Deps.Libs.Jvm.detektFormatting) } -kotlinDslPluginOptions { - experimentalWarning.set(false) -} - publishing { repositories.maven("https://api.bintray.com/maven/icerockdev/plugins/moko-resources-generator/;publish=1") { name = "bintray" @@ -36,14 +35,10 @@ publishing { password = System.getProperty("BINTRAY_KEY") } } +} - publications { - register("plugin", MavenPublication::class) { - groupId = "dev.icerock.moko" - artifactId = "resources-generator" - version = Versions.Libs.MultiPlatform.mokoResources - - from(components["java"]) - } +tasks.withType().configureEach { + kotlinOptions { + jvmTarget = "1.8" } } diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPluginExtension.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPluginExtension.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPluginExtension.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPluginExtension.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/BaseGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/BaseGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/BaseGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/BaseGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/EqualStringKeysException.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/EqualStringKeysException.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/EqualStringKeysException.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/EqualStringKeysException.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/GenerateMultiplatformResourcesTask.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/GenerateMultiplatformResourcesTask.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/GenerateMultiplatformResourcesTask.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/GenerateMultiplatformResourcesTask.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ObjectBodyExtendable.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ObjectBodyExtendable.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ObjectBodyExtendable.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ObjectBodyExtendable.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ResourceGeneratorFeature.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ResourceGeneratorFeature.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ResourceGeneratorFeature.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ResourceGeneratorFeature.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/SourceInfo.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/SourceInfo.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/SourceInfo.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/SourceInfo.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidColorsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidColorsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidColorsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidColorsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFilesGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFilesGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFilesGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFilesGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFontsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFontsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFontsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFontsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidImagesGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidImagesGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidImagesGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidImagesGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidMRGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidMRGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidMRGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidMRGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidPluralsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidPluralsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidPluralsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidPluralsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonColorsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonColorsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonColorsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonColorsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFilesGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFilesGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFilesGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFilesGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFontsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFontsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFontsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFontsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonImagesGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonImagesGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonImagesGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonImagesGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonMRGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonMRGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonMRGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonMRGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonPluralsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonPluralsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonPluralsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonPluralsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonStringsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonStringsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/common/CommonStringsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonStringsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosColorsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosColorsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosColorsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosColorsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosFilesGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosFilesGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosFilesGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosFilesGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosFontsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosFontsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosFontsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosFontsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosGeneratorHelper.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosGeneratorHelper.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosGeneratorHelper.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosGeneratorHelper.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosImagesGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosImagesGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosImagesGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosImagesGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt similarity index 92% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt index 70b33344..1298df54 100644 --- a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile import org.jetbrains.kotlin.konan.file.zipDirAs import org.jetbrains.kotlin.library.impl.KotlinLibraryLayoutImpl import java.io.File -import java.util.Properties +import java.util.* class IosMRGenerator( generatedDir: File, @@ -82,11 +82,12 @@ class IosMRGenerator( val klibFile = this.outputFile.get() val repackDir = File(klibFile.parent, klibFile.nameWithoutExtension) - val resRepackDir = File(repackDir, "resources") + val defaultDir = File(repackDir, "default") + val resRepackDir = File(defaultDir, "resources") unzipTo(zipFile = klibFile, outputDirectory = repackDir) - val manifestFile = File(repackDir, "manifest") + val manifestFile = File(defaultDir, "manifest") val manifest = Properties() manifest.load(manifestFile.inputStream()) @@ -123,6 +124,7 @@ class IosMRGenerator( val repackKonan = org.jetbrains.kotlin.konan.file.File(repackDir.path) val klibKonan = org.jetbrains.kotlin.konan.file.File(klibFile.path) + klibFile.delete() repackKonan.zipDirAs(klibKonan) repackDir.deleteRecursively() @@ -146,10 +148,13 @@ class IosMRGenerator( .forEach { project.logger.info("copy resources from $it") val klibKonan = org.jetbrains.kotlin.konan.file.File(it.path) - val klib = KotlinLibraryLayoutImpl(klibKonan) + val klib = KotlinLibraryLayoutImpl(klib = klibKonan, component = "default") val layout = klib.extractingToTemp - File(layout.resourcesDir.path).copyRecursively(framework.outputFile, overwrite = true) + File(layout.resourcesDir.path).copyRecursively( + framework.outputFile, + overwrite = true + ) } } } diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosPluralsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosPluralsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosPluralsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosPluralsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosStringsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosStringsGenerator.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/IosStringsGenerator.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosStringsGenerator.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/LoadableBundle.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/LoadableBundle.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/generator/ios/LoadableBundle.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/LoadableBundle.kt diff --git a/gradle-plugin/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt rename to plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt diff --git a/gradle-plugin/src/main/resources/META-INF/gradle-plugins/dev.icerock.mobile.multiplatform-resources.properties b/plugins/resources-generator/src/main/resources/META-INF/gradle-plugins/dev.icerock.mobile.multiplatform-resources.properties similarity index 100% rename from gradle-plugin/src/main/resources/META-INF/gradle-plugins/dev.icerock.mobile.multiplatform-resources.properties rename to plugins/resources-generator/src/main/resources/META-INF/gradle-plugins/dev.icerock.mobile.multiplatform-resources.properties diff --git a/plugins/settings.gradle.kts b/plugins/settings.gradle.kts new file mode 100644 index 00000000..9ff48f9c --- /dev/null +++ b/plugins/settings.gradle.kts @@ -0,0 +1,5 @@ +/* + * Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +include(":resources-generator") diff --git a/publishToMavenLocal.sh b/publishToMavenLocal.sh deleted file mode 100755 index f66407b3..00000000 --- a/publishToMavenLocal.sh +++ /dev/null @@ -1 +0,0 @@ -./gradlew -PlibraryPublish :gradle-plugin:publishPluginPublicationToMavenLocal :resources:publishToMavenLocal $* \ No newline at end of file diff --git a/resources/build.gradle.kts b/resources/build.gradle.kts index a02f78d8..b2496fe2 100644 --- a/resources/build.gradle.kts +++ b/resources/build.gradle.kts @@ -7,24 +7,13 @@ plugins { plugin(Deps.Plugins.kotlinMultiplatform) plugin(Deps.Plugins.kotlinAndroidExtensions) plugin(Deps.Plugins.mobileMultiplatform) - id("maven-publish") + plugin(Deps.Plugins.mavenPublish) } group = "dev.icerock.moko" -version = Versions.Libs.MultiPlatform.mokoResources - -android { - compileSdkVersion(Versions.Android.compileSdk) - - defaultConfig { - minSdkVersion(Versions.Android.minSdk) - targetSdkVersion(Versions.Android.targetSdk) - } -} +version = Deps.mokoResourcesVersion dependencies { - mppLibrary(Deps.Libs.MultiPlatform.kotlinStdLib) - mppLibrary(Deps.Libs.MultiPlatform.mokoParcelize) mppLibrary(Deps.Libs.MultiPlatform.mokoGraphics) @@ -43,11 +32,15 @@ publishing { } kotlin { - targets.filterIsInstance().forEach { target -> - target.compilations.getByName("main") { - val pluralizedString by cinterops.creating { - defFile(project.file("src/iosMain/def/pluralizedString.def")) + targets + .matching { it is org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget } + .configureEach { + this as org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget + + compilations.getByName("main") { + val pluralizedString by cinterops.creating { + defFile(project.file("src/iosMain/def/pluralizedString.def")) + } } } - } } diff --git a/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt b/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt index 4b5201b5..6fcc2c50 100644 --- a/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt +++ b/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt @@ -13,7 +13,7 @@ expect interface StringDesc { object System : LocaleType class Custom(locale: String) : LocaleType } - + companion object { var localeType: LocaleType } diff --git a/resources/src/iosArm64Main b/resources/src/iosArm64Main deleted file mode 120000 index 93d7d747..00000000 --- a/resources/src/iosArm64Main +++ /dev/null @@ -1 +0,0 @@ -iosMain \ No newline at end of file diff --git a/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt b/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt index 1eeda9cc..5eb7f778 100644 --- a/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt +++ b/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt @@ -5,6 +5,7 @@ package dev.icerock.moko.resources.desc import platform.Foundation.NSBundle +import kotlin.native.concurrent.ThreadLocal actual interface StringDesc { fun localized(): String diff --git a/resources/src/iosX64Main b/resources/src/iosX64Main deleted file mode 120000 index 93d7d747..00000000 --- a/resources/src/iosX64Main +++ /dev/null @@ -1 +0,0 @@ -iosMain \ No newline at end of file diff --git a/sample/android-app/build.gradle.kts b/sample/android-app/build.gradle.kts index 98dec31e..3dc48589 100644 --- a/sample/android-app/build.gradle.kts +++ b/sample/android-app/build.gradle.kts @@ -8,19 +8,17 @@ plugins { } android { - compileSdkVersion(Versions.Android.compileSdk) + compileSdkVersion(Deps.Android.compileSdk) - dataBinding { - isEnabled = true - } + buildFeatures.dataBinding = true dexOptions { javaMaxHeapSize = "2g" } defaultConfig { - minSdkVersion(Versions.Android.minSdk) - targetSdkVersion(Versions.Android.targetSdk) + minSdkVersion(Deps.Android.minSdk) + targetSdkVersion(Deps.Android.targetSdk) applicationId = "dev.icerock.moko.samples.resources" @@ -48,8 +46,6 @@ android { } dependencies { - implementation(Deps.Libs.Android.kotlinStdLib.name) - implementation(Deps.Libs.Android.appCompat.name) implementation(project(":sample:mpp-library")) diff --git a/sample/mpp-conditional/build.gradle.kts b/sample/mpp-conditional/build.gradle.kts index 9b1b6580..4a20739e 100644 --- a/sample/mpp-conditional/build.gradle.kts +++ b/sample/mpp-conditional/build.gradle.kts @@ -9,13 +9,6 @@ plugins { } android { - compileSdkVersion(Versions.Android.compileSdk) - - defaultConfig { - minSdkVersion(Versions.Android.minSdk) - targetSdkVersion(Versions.Android.targetSdk) - } - lintOptions { disable("ImpliedQuantity") } @@ -39,8 +32,7 @@ kotlin { } dependencies { - commonMainImplementation("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}") - commonMainImplementation("dev.icerock.moko:resources:${Versions.Libs.MultiPlatform.mokoResources}") + commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources.common) } multiplatformResources { diff --git a/sample/mpp-hierarhical/build.gradle.kts b/sample/mpp-hierarhical/build.gradle.kts index f6446be3..cb032a62 100644 --- a/sample/mpp-hierarhical/build.gradle.kts +++ b/sample/mpp-hierarhical/build.gradle.kts @@ -9,13 +9,6 @@ plugins { } android { - compileSdkVersion(Versions.Android.compileSdk) - - defaultConfig { - minSdkVersion(Versions.Android.minSdk) - targetSdkVersion(Versions.Android.targetSdk) - } - lintOptions { disable("ImpliedQuantity") } @@ -27,8 +20,7 @@ kotlin { } dependencies { - commonMainImplementation("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}") - commonMainImplementation("dev.icerock.moko:resources:${Versions.Libs.MultiPlatform.mokoResources}") + commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources.common) } multiplatformResources { diff --git a/sample/mpp-library/build.gradle.kts b/sample/mpp-library/build.gradle.kts index 61b2e13c..969e1807 100644 --- a/sample/mpp-library/build.gradle.kts +++ b/sample/mpp-library/build.gradle.kts @@ -3,29 +3,20 @@ */ plugins { - id("com.android.library") - id("org.jetbrains.kotlin.multiplatform") - id("dev.icerock.mobile.multiplatform") - id("dev.icerock.mobile.multiplatform-resources") + plugin(Deps.Plugins.androidLibrary) + plugin(Deps.Plugins.kotlinMultiplatform) + plugin(Deps.Plugins.mobileMultiplatform) + plugin(Deps.Plugins.iosFramework) + plugin(Deps.Plugins.mokoResources) } android { - compileSdkVersion(Versions.Android.compileSdk) - - defaultConfig { - minSdkVersion(Versions.Android.minSdk) - targetSdkVersion(Versions.Android.targetSdk) - } - lintOptions { disable("ImpliedQuantity") } } -setupFramework(exports = listOf(Deps.Libs.MultiPlatform.mokoGraphics)) - dependencies { - mppLibrary(Deps.Libs.MultiPlatform.kotlinStdLib) mppLibrary(Deps.Libs.MultiPlatform.mokoResources) commonMainImplementation(project("$path:nested-module")) diff --git a/sample/mpp-library/nested-module/build.gradle.kts b/sample/mpp-library/nested-module/build.gradle.kts index c15de7a0..b4266994 100644 --- a/sample/mpp-library/nested-module/build.gradle.kts +++ b/sample/mpp-library/nested-module/build.gradle.kts @@ -9,17 +9,7 @@ plugins { id("dev.icerock.mobile.multiplatform-resources") } -android { - compileSdkVersion(Versions.Android.compileSdk) - - defaultConfig { - minSdkVersion(Versions.Android.minSdk) - targetSdkVersion(Versions.Android.targetSdk) - } -} - dependencies { - mppLibrary(Deps.Libs.MultiPlatform.kotlinStdLib) mppLibrary(Deps.Libs.MultiPlatform.mokoResources) } diff --git a/sample/mpp-mixed/build.gradle.kts b/sample/mpp-mixed/build.gradle.kts index e33b83ba..c239c2f9 100644 --- a/sample/mpp-mixed/build.gradle.kts +++ b/sample/mpp-mixed/build.gradle.kts @@ -9,13 +9,6 @@ plugins { } android { - compileSdkVersion(Versions.Android.compileSdk) - - defaultConfig { - minSdkVersion(Versions.Android.minSdk) - targetSdkVersion(Versions.Android.targetSdk) - } - lintOptions { disable("ImpliedQuantity") } @@ -52,8 +45,7 @@ kotlin { } dependencies { - commonMainImplementation("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}") - commonMainImplementation("dev.icerock.moko:resources:${Versions.Libs.MultiPlatform.mokoResources}") + commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources.common) } multiplatformResources { diff --git a/settings.gradle.kts b/settings.gradle.kts index de8206fc..f39bab5e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,17 +2,12 @@ * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */ -enableFeaturePreview("GRADLE_METADATA") - -val properties: Map = startParameter.projectProperties -val libraryPublish: Boolean = properties.containsKey("libraryPublish") - +includeBuild("plugins") include(":resources") -include(":gradle-plugin") -if (!libraryPublish) { - include(":sample:android-app") - include(":sample:mpp-library", ":sample:mpp-library:nested-module") - include(":sample:mpp-conditional") - include(":sample:mpp-hierarhical") - include(":sample:mpp-mixed") -} + +include(":sample:android-app") +include(":sample:mpp-library") +include(":sample:mpp-library:nested-module") +include(":sample:mpp-conditional") +include(":sample:mpp-hierarhical") +include(":sample:mpp-mixed") From b2c43173d182abce5824e9c25681b9b7dacdbf1a Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sat, 22 Aug 2020 14:21:56 +0700 Subject: [PATCH 02/25] update CI config --- .github/workflows/compilation-check.yml | 10 ++++------ .github/workflows/publish.yml | 6 ++---- .github/workflows/ui-tests-android-sample.yml | 4 ---- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/compilation-check.yml b/.github/workflows/compilation-check.yml index c412431a..14c3e0d5 100644 --- a/.github/workflows/compilation-check.yml +++ b/.github/workflows/compilation-check.yml @@ -16,9 +16,7 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Check plugin build - run: ./gradlew -PlibraryPublish detekt :gradle-plugin:publishPluginPublicationToMavenLocal - - name: Check library build - run: ./gradlew -PlibraryPublish detekt :resources:publishToMavenLocal - - name: Check demo library - run: ./gradlew detekt :sample:mpp-conditional:build :sample:mpp-hierarhical:build :sample:mpp-library:build :sample:mpp-mixed:build + - name: Detekt + run: ./gradlew detekt + - name: Build & Tests + run: ./gradlew build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ff7e8763..2694fb5c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,5 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Publish plugin - run: ./gradlew -PlibraryPublish :gradle-plugin:publishPluginPublicationToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} - - name: Publish library - run: ./gradlew -PlibraryPublish :resources:publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} + - name: Publish all + run: ./gradlew publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} diff --git a/.github/workflows/ui-tests-android-sample.yml b/.github/workflows/ui-tests-android-sample.yml index 47db8c02..1209a67a 100644 --- a/.github/workflows/ui-tests-android-sample.yml +++ b/.github/workflows/ui-tests-android-sample.yml @@ -12,10 +12,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Build plugin - run: ./gradlew -PlibraryPublish :gradle-plugin:publishPluginPublicationToMavenLocal - - name: Build library - run: ./gradlew -PlibraryPublish :resources:publishToMavenLocal - name: Run android tests uses: reactivecircus/android-emulator-runner@v2 with: From bf4662c2e57773e9b17ca6a2ac86552e73d47a71 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sat, 22 Aug 2020 23:52:02 +0700 Subject: [PATCH 03/25] fix CI actions and detekt errors --- .github/workflows/compilation-check.yml | 8 ++++---- .github/workflows/publish.yml | 4 +++- gradle.properties | 2 +- plugins/gradle | 1 + .../gradle/MultiplatformResourcesPlugin.kt | 17 +++++++++++++---- .../icerock/gradle/generator/ColorsGenerator.kt | 3 ++- .../gradle/generator/ios/IosColorsGenerator.kt | 3 +++ .../gradle/generator/ios/IosGeneratorHelper.kt | 1 - .../gradle/generator/ios/IosMRGenerator.kt | 2 +- .../dev/icerock/gradle/utils/ArgbColor.kt | 2 ++ .../icerock/moko/resources/desc/StringDesc.kt | 2 +- 11 files changed, 31 insertions(+), 14 deletions(-) create mode 120000 plugins/gradle diff --git a/.github/workflows/compilation-check.yml b/.github/workflows/compilation-check.yml index 14c3e0d5..7f320b8e 100644 --- a/.github/workflows/compilation-check.yml +++ b/.github/workflows/compilation-check.yml @@ -16,7 +16,7 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Detekt - run: ./gradlew detekt - - name: Build & Tests - run: ./gradlew build + - name: Plugin check + run: ./gradlew -p plugins detekt build + - name: Library check + run: ./gradlew detekt build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2694fb5c..6c712815 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,5 +14,7 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Publish all + - name: Publish plugin + run: ./gradlew -p plugins publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} + - name: Publish library run: ./gradlew publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} diff --git a/gradle.properties b/gradle.properties index 73f61469..7fcecf88 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.parallel=true kotlin.code.style=official #kotlin.mpp.enableGranularSourceSetsMetadata=true -#kotlin.native.enableDependencyPropagation=false +kotlin.native.enableDependencyPropagation=false android.useAndroidX=true android.enableJetifier=true diff --git a/plugins/gradle b/plugins/gradle new file mode 120000 index 00000000..3337596a --- /dev/null +++ b/plugins/gradle @@ -0,0 +1 @@ +../gradle \ No newline at end of file diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt index 9fa8bfb2..be32c43e 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt @@ -67,7 +67,8 @@ class MultiplatformResourcesPlugin : Plugin { multiplatformExtension: KotlinMultiplatformExtension, androidExtension: LibraryExtension ) { - val androidMainSourceSet = androidExtension.sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME) + val androidMainSourceSet = + androidExtension.sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME) val commonSourceSet = multiplatformExtension.sourceSets.getByName(mrExtension.sourceSetName) val commonResources = commonSourceSet.resources @@ -95,8 +96,15 @@ class MultiplatformResourcesPlugin : Plugin { val targets: List = multiplatformExtension.targets.toList() setupCommonGenerator(commonSourceSet, generatedDir, mrClassPackage, features, target) - setupAndroidGenerator(targets, androidMainSourceSet, generatedDir, mrClassPackage, features, target) - if(HostManager.hostIsMac) { + setupAndroidGenerator( + targets, + androidMainSourceSet, + generatedDir, + mrClassPackage, + features, + target + ) + if (HostManager.hostIsMac) { setupIosGenerator( targets, generatedDir, @@ -146,7 +154,8 @@ class MultiplatformResourcesPlugin : Plugin { .filterNot { it.name.endsWith("Test") } // remove tests compilations .map { it.defaultSourceSet } - val androidSourceSet: MRGenerator.SourceSet = createSourceSet(androidMainSourceSet, kotlinSourceSets) + val androidSourceSet: MRGenerator.SourceSet = + createSourceSet(androidMainSourceSet, kotlinSourceSets) AndroidMRGenerator( generatedDir, androidSourceSet, diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt index c47f7c59..f1e3e3b1 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt @@ -30,6 +30,7 @@ abstract class ColorsGenerator( protected val themedColorClassName = ClassName("dev.icerock.moko.resources", "ColorResource.Themed") + @Suppress("SpreadOperator") override fun generate(resourcesGenerationDir: File, objectBuilder: TypeSpec.Builder): TypeSpec { objectBuilder.addModifiers(*getClassModifiers()) extendObjectBody(objectBuilder) @@ -130,7 +131,7 @@ abstract class ColorsGenerator( } protected fun replaceColorAlpha(color: String?): String? { - if(color == null) return color + if (color == null) return color val alpha = color.substring(color.length - 2, color.length) return "$alpha${color.removeRange(color.length - 2, color.length)}" diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosColorsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosColorsGenerator.kt index 4404aa91..ee127840 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosColorsGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosColorsGenerator.kt @@ -41,7 +41,9 @@ class IosColorsGenerator( contentsFile.createNewFile() val colorContentObj = if (colorNode.isThemed()) { + @Suppress("MagicNumber") val lightColor = parseRgbaColor(colorNode.lightColor!!.toLong(16)) + @Suppress("MagicNumber") val darkColor = parseRgbaColor(colorNode.darkColor!!.toLong(16)) /* @@ -58,6 +60,7 @@ class IosColorsGenerator( +darkColorObj } } else { + @Suppress("MagicNumber") val singleColor = parseRgbaColor(colorNode.singleColor!!.toLong(16)) jsonArray { +buildColorIdiomJsonObj(singleColor) } } diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosGeneratorHelper.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosGeneratorHelper.kt index bd84d40c..f4b4241b 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosGeneratorHelper.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosGeneratorHelper.kt @@ -21,6 +21,5 @@ class IosGeneratorHelper(private val propertyName: String = "nsBundle") : .build() classBuilder.addProperty(bundleProperty) - } } diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt index 1298df54..ad7370d7 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile import org.jetbrains.kotlin.konan.file.zipDirAs import org.jetbrains.kotlin.library.impl.KotlinLibraryLayoutImpl import java.io.File -import java.util.* +import java.util.Properties class IosMRGenerator( generatedDir: File, diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt index a61510da..7e6d6926 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt @@ -6,6 +6,7 @@ package dev.icerock.gradle.utils data class ArgbColor(val a: Float, val r: Float, val g: Float, val b: Float) +@Suppress("MagicNumber") internal fun parseArgbColor(argbColor: Long): ArgbColor { val r: Float = (argbColor shr 16 and 0xff) / 255.0f val g: Float = (argbColor shr 8 and 0xff) / 255.0f @@ -14,6 +15,7 @@ internal fun parseArgbColor(argbColor: Long): ArgbColor { return ArgbColor(a, r, g, b) } +@Suppress("MagicNumber") internal fun parseRgbaColor(rgbaColor: Long): ArgbColor { val r: Float = (rgbaColor shr 24 and 0xff) / 255.0f val g: Float = (rgbaColor shr 16 and 0xff) / 255.0f diff --git a/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt b/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt index 6fcc2c50..4b5201b5 100644 --- a/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt +++ b/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt @@ -13,7 +13,7 @@ expect interface StringDesc { object System : LocaleType class Custom(locale: String) : LocaleType } - + companion object { var localeType: LocaleType } From 86c8d2e2229d511b633ffb42fe7a97d808c6a7e6 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 23 Aug 2020 22:24:14 +0700 Subject: [PATCH 04/25] draft with granual source sets --- build.gradle.kts | 2 +- buildSrc/src/main/kotlin/Deps.kt | 9 +++------ gradle.properties | 2 +- resources/build.gradle.kts | 4 ++-- .../resources/desc/PluralFormattedStringDesc.kt | 17 +++++++++-------- .../moko/resources/desc/PluralStringDesc.kt | 15 ++++++++------- sample/mpp-conditional/build.gradle.kts | 2 +- sample/mpp-hierarhical/build.gradle.kts | 2 +- sample/mpp-library/build.gradle.kts | 2 +- .../mpp-library/nested-module/build.gradle.kts | 2 +- sample/mpp-mixed/build.gradle.kts | 2 +- 11 files changed, 29 insertions(+), 30 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 985f2743..04695384 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -47,7 +47,7 @@ allprojects { configurations.all { resolutionStrategy.dependencySubstitution { - substitute(module(Deps.Libs.MultiPlatform.mokoResources.common)) + substitute(module(Deps.Libs.MultiPlatform.mokoResources)) .with(project(":resources")) } } diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index 2819306f..f4a5a76b 100755 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -70,12 +70,9 @@ object Deps { } object MultiPlatform { - val mokoResources = - MultiPlatformLibrary(common = "dev.icerock.moko:resources:$mokoResourcesVersion") - val mokoParcelize = - MultiPlatformLibrary(common = "dev.icerock.moko:parcelize:$mokoParcelizeVersion") - val mokoGraphics = - MultiPlatformLibrary(common = "dev.icerock.moko:graphics:$mokoGraphicsVersion") + const val mokoResources = "dev.icerock.moko:resources:$mokoResourcesVersion" + const val mokoParcelize = "dev.icerock.moko:parcelize:$mokoParcelizeVersion" + const val mokoGraphics = "dev.icerock.moko:graphics:$mokoGraphicsVersion" } object Jvm { diff --git a/gradle.properties b/gradle.properties index 7fcecf88..19ad558a 100755 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,8 @@ org.gradle.configureondemand=false org.gradle.parallel=true kotlin.code.style=official -#kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.native.enableDependencyPropagation=false +kotlin.mpp.enableGranularSourceSetsMetadata=true android.useAndroidX=true android.enableJetifier=true diff --git a/resources/build.gradle.kts b/resources/build.gradle.kts index b2496fe2..03e60b68 100644 --- a/resources/build.gradle.kts +++ b/resources/build.gradle.kts @@ -14,8 +14,8 @@ group = "dev.icerock.moko" version = Deps.mokoResourcesVersion dependencies { - mppLibrary(Deps.Libs.MultiPlatform.mokoParcelize) - mppLibrary(Deps.Libs.MultiPlatform.mokoGraphics) + commonMainApi(Deps.Libs.MultiPlatform.mokoParcelize) + commonMainApi(Deps.Libs.MultiPlatform.mokoGraphics) androidLibrary(Deps.Libs.Android.appCompat) } diff --git a/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt b/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt index 6620bdce..5bcfccfb 100644 --- a/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt +++ b/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt @@ -5,7 +5,7 @@ package dev.icerock.moko.resources.desc import dev.icerock.moko.resources.PluralsResource -import dev.icerock.moko.resources.objc.pluralizedString +//import dev.icerock.moko.resources.objc.pluralizedString actual data class PluralFormattedStringDesc actual constructor( val pluralsRes: PluralsResource, @@ -13,12 +13,13 @@ actual data class PluralFormattedStringDesc actual constructor( val args: List ) : StringDesc { override fun localized(): String { - val pluralized = pluralizedString( - bundle = StringDesc.localeType.getLocaleBundle(pluralsRes.bundle), - baseBundle = pluralsRes.bundle, - resourceId = pluralsRes.resourceId, - number = number - )!! - return Utils.stringWithFormat(pluralized, Utils.processArgs(args)) + TODO() +// val pluralized = pluralizedString( +// bundle = StringDesc.localeType.getLocaleBundle(pluralsRes.bundle), +// baseBundle = pluralsRes.bundle, +// resourceId = pluralsRes.resourceId, +// number = number +// )!! +// return Utils.stringWithFormat(pluralized, Utils.processArgs(args)) } } diff --git a/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt b/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt index a0195f2b..4bad8752 100644 --- a/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt +++ b/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt @@ -6,18 +6,19 @@ package dev.icerock.moko.resources.desc import dev.icerock.moko.parcelize.Parcelable import dev.icerock.moko.resources.PluralsResource -import dev.icerock.moko.resources.objc.pluralizedString +//import dev.icerock.moko.resources.objc.pluralizedString actual data class PluralStringDesc actual constructor( val pluralsRes: PluralsResource, val number: Int ) : StringDesc, Parcelable { override fun localized(): String { - return pluralizedString( - bundle = StringDesc.localeType.getLocaleBundle(pluralsRes.bundle), - baseBundle = pluralsRes.bundle, - resourceId = pluralsRes.resourceId, - number = number - )!! + TODO() +// return pluralizedString( +// bundle = StringDesc.localeType.getLocaleBundle(pluralsRes.bundle), +// baseBundle = pluralsRes.bundle, +// resourceId = pluralsRes.resourceId, +// number = number +// )!! } } diff --git a/sample/mpp-conditional/build.gradle.kts b/sample/mpp-conditional/build.gradle.kts index 4a20739e..bcca447d 100644 --- a/sample/mpp-conditional/build.gradle.kts +++ b/sample/mpp-conditional/build.gradle.kts @@ -32,7 +32,7 @@ kotlin { } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources.common) + commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources) } multiplatformResources { diff --git a/sample/mpp-hierarhical/build.gradle.kts b/sample/mpp-hierarhical/build.gradle.kts index cb032a62..24f1a22b 100644 --- a/sample/mpp-hierarhical/build.gradle.kts +++ b/sample/mpp-hierarhical/build.gradle.kts @@ -20,7 +20,7 @@ kotlin { } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources.common) + commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources) } multiplatformResources { diff --git a/sample/mpp-library/build.gradle.kts b/sample/mpp-library/build.gradle.kts index 969e1807..eab839fd 100644 --- a/sample/mpp-library/build.gradle.kts +++ b/sample/mpp-library/build.gradle.kts @@ -17,7 +17,7 @@ android { } dependencies { - mppLibrary(Deps.Libs.MultiPlatform.mokoResources) + commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources) commonMainImplementation(project("$path:nested-module")) } diff --git a/sample/mpp-library/nested-module/build.gradle.kts b/sample/mpp-library/nested-module/build.gradle.kts index b4266994..86fee77e 100644 --- a/sample/mpp-library/nested-module/build.gradle.kts +++ b/sample/mpp-library/nested-module/build.gradle.kts @@ -10,7 +10,7 @@ plugins { } dependencies { - mppLibrary(Deps.Libs.MultiPlatform.mokoResources) + commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources) } multiplatformResources { diff --git a/sample/mpp-mixed/build.gradle.kts b/sample/mpp-mixed/build.gradle.kts index c239c2f9..27428d2a 100644 --- a/sample/mpp-mixed/build.gradle.kts +++ b/sample/mpp-mixed/build.gradle.kts @@ -45,7 +45,7 @@ kotlin { } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources.common) + commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources) } multiplatformResources { From 77f72d939a46577d03d169024f0d4c13598f13ed Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Wed, 26 Aug 2020 12:38:26 +0700 Subject: [PATCH 05/25] update gradle wrapper --- gradle/wrapper/gradle-wrapper.jar | Bin 58694 -> 59203 bytes gradlew | 2 ++ gradlew.bat | 22 ++++------------------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 490fda8577df6c95960ba7077c43220e5bb2c0d9..e708b1c023ec8b20f512888fe07c5bd3ff77bb8f 100755 GIT binary patch delta 6763 zcmY*d1yoeux`&}Vq&vkKkdST|x*Texk(LmoVTd`>NXyV2GNg!rf(VL8i*$EN2vQ>@ z;N#D`_q}`1+H37!e0#5N@4e1G>wMk)I9~^G>X1a_WjI_~vbb1S(*#&p%2+6`3073w z_+8Wx5fspSazTIgyF^r`bS;8?ttUY=Y16txqx|`pNOoTEXlylV?ZsN$4tQ-aeaKtq;EDcj#ufS~X5l)PmBL0VS*h=y3Li+qdct?J z?FcClysNWmO;%pTGK&0{S_(f?(9-*~A4I!CEfl8GR%`}qg?-86`CE5zW!0SOyaivY zkiRhoaHaER6Q_#*#;TWTrMbR`wnw-+IwyT}G_Z5l`tjySt-xO`<&)UUZwX2Ld8F2m zJ}lBiid@DLwV|>iW$We*nVYK+pYM|g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|kZY;l@{b#OC2;6ukY1 z{)Hq`PGfYS=PC!i);>l;*iUgrLRjgvKKp$*XFNkLCVpjif5VL#uHV?}rz^1OUp{8J zv&gY=R&5-aN=IK6q;@g@^MEjxT|YSY|MX{cx43QNhyNcTD9YxuQ}DbE2k%G{C2A% z^2{wqtCZC-TX9yZzh}xx#&%u5_yzSEs-4T|C$pCU^exX@IDQwClyo5F@jl_pA6>Lg zTaXO1$uN>mB4<BU%PB~yHzBhvIW`e)@;ix=~7`*mAwDeF|-t()O2fS80a{h!&( z-)YQ$p8UW&WI!M<_080ldy13ke}1s>@L2zo`n%=_x={QZyaPl`34khC{wrsuo`W(T z-pGMR4}sJf3c&m)11O*4uf+%?|9l3rF}VDyYAh{xatrHx5}jTw0mnbE(J3ZTPK09LaMpfK|r ztHF}_#>%&&AoE5Hz?lzUrQFW=K{pcX@E3bfu%WJP_io^ zHZKM0`>Wi+0L20Y&@j&c((?E#>4BYjbr8NUfQe@U3>M@-DSkIN96){(oLpc4o%!Eb zWQ(F8*-wA*F<`$a2;vUD!M4R0pyAMe@fJWHK?+DNaf3P{Zmd61jKK6F1yHxd0HTe( zu@09sK>cxlQ5Mj^QUCyk0d$yhQ{hi%1b$(-LBG>)4VCp}iW`JiKDgO5h-Coz zSN*jf0mQ2Ups7w^znc>NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell From fe8f7c29afd6def1d45b88ac16c5b4eee8691b80 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Wed, 26 Aug 2020 13:15:12 +0700 Subject: [PATCH 06/25] fix incompatible kotlin plugin warning --- buildSrc/src/main/kotlin/Deps.kt | 1 + plugins/resources-generator/build.gradle.kts | 3 +- .../gradle/MultiplatformResourcesPlugin.kt | 11 ++-- .../gradle/generator/ColorsGenerator.kt | 2 +- .../FatFrameworkWithResourcesTask.kt | 6 +-- .../gradle/generator/FilesGenerator.kt | 2 +- .../gradle/generator/FontsGenerator.kt | 2 +- .../gradle/generator/ImagesGenerator.kt | 2 +- .../icerock/gradle/generator/MRGenerator.kt | 2 +- .../gradle/generator/PluralsGenerator.kt | 2 +- .../gradle/generator/StringsGenerator.kt | 2 +- .../gradle/generator/ios/IosMRGenerator.kt | 54 ++++++++++++++++--- 12 files changed, 62 insertions(+), 27 deletions(-) diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index f4a5a76b..abd3c485 100755 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -28,6 +28,7 @@ object Deps { } object Plugins { + val javaGradle = GradlePlugin(id = "java-gradle-plugin") val androidApplication = GradlePlugin(id = "com.android.application") val androidLibrary = GradlePlugin(id = "com.android.library") val kotlinJvm = GradlePlugin(id = "org.jetbrains.kotlin.jvm") diff --git a/plugins/resources-generator/build.gradle.kts b/plugins/resources-generator/build.gradle.kts index 64d2d434..9460ba6c 100644 --- a/plugins/resources-generator/build.gradle.kts +++ b/plugins/resources-generator/build.gradle.kts @@ -3,7 +3,8 @@ */ plugins { - `kotlin-dsl` + plugin(Deps.Plugins.javaGradle) + plugin(Deps.Plugins.kotlinJvm) plugin(Deps.Plugins.mavenPublish) plugin(Deps.Plugins.detekt) } diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt index be32c43e..703dbcfd 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt @@ -23,9 +23,6 @@ import dev.icerock.gradle.generator.ios.IosMRGenerator import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.tasks.SourceSet -import org.gradle.kotlin.dsl.create -import org.gradle.kotlin.dsl.getByType -import org.gradle.kotlin.dsl.withType import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper @@ -41,12 +38,12 @@ import javax.xml.parsers.DocumentBuilderFactory class MultiplatformResourcesPlugin : Plugin { override fun apply(target: Project) { val mrExtension = - target.extensions.create("multiplatformResources") + target.extensions.create("multiplatformResources", MultiplatformResourcesPluginExtension::class.java) - target.plugins.withType { - val multiplatformExtension = target.extensions.getByType(this.projectExtensionClass) + target.plugins.withType(KotlinMultiplatformPluginWrapper::class.java) { + val multiplatformExtension = target.extensions.getByType(KotlinMultiplatformExtension::class.java) - target.plugins.withType { + target.plugins.withType(LibraryPlugin::class.java) { val androidExtension = target.extensions.getByName("android") as LibraryExtension target.afterEvaluate { diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt index f1e3e3b1..a2d2ab85 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt @@ -111,7 +111,7 @@ abstract class ColorsGenerator( private val info: SourceInfo ) : ResourceGeneratorFeature { - private val colorsFileTree = info.commonResources.matching { include("MR/**/colors*.xml") } + private val colorsFileTree = info.commonResources.matching { it.include("MR/**/colors*.xml") } override fun createCommonGenerator(): ColorsGenerator { return CommonColorsGenerator(colorsFileTree) diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt index 2af9bd44..364d8579 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt @@ -18,10 +18,8 @@ open class FatFrameworkWithResourcesTask : FatFrameworkTask() { ?.filter { it.name.contains(".bundle") } ?.forEach { bundleFile -> project.copy { - from(bundleFile) { - into(bundleFile.name) - } - into(fatFrameworkDir) + it.from(bundleFile) { it.into(bundleFile.name) } + it.into(fatFrameworkDir) } } } diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt index 7f269037..b2eb5542 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt @@ -82,7 +82,7 @@ abstract class FilesGenerator( class Feature(private val info: SourceInfo) : ResourceGeneratorFeature { private val fileTree = info.commonResources.matching { - include("MR/files/**") + it.include("MR/files/**") } override fun createCommonGenerator(): FilesGenerator { diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt index da31679e..3e4f655d 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt @@ -109,7 +109,7 @@ abstract class FontsGenerator( class Feature(private val info: SourceInfo) : ResourceGeneratorFeature { private val stringsFileTree = info.commonResources.matching { - include("MR/fonts/**.ttf") + it.include("MR/fonts/**.ttf") } override fun createCommonGenerator(): FontsGenerator { diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt index 4581c4db..2af647c3 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt @@ -69,7 +69,7 @@ abstract class ImagesGenerator( class Feature(private val info: SourceInfo) : ResourceGeneratorFeature { private val stringsFileTree = info.commonResources.matching { - include("MR/images/**/*.png", "MR/images/**/*.jpg") + it.include("MR/images/**/*.png", "MR/images/**/*.jpg") } override fun createCommonGenerator(): ImagesGenerator { diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt index 8040248b..5b6ec43b 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt @@ -73,7 +73,7 @@ abstract class MRGenerator( val genTask = runCatching { project.tasks.getByName(genTaskName) }.getOrNull() ?: project.tasks.create(genTaskName, GenerateMultiplatformResourcesTask::class.java) { - doLast { + it.doLast { this@MRGenerator.generate() } } diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt index 57085964..38ea11de 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt @@ -79,7 +79,7 @@ abstract class PluralsGenerator( private val info: SourceInfo, private val iosBaseLocalizationRegion: String ) : ResourceGeneratorFeature { - private val stringsFileTree = info.commonResources.matching { include("MR/**/plurals*.xml") } + private val stringsFileTree = info.commonResources.matching { it.include("MR/**/plurals*.xml") } override fun createCommonGenerator(): PluralsGenerator { return CommonPluralsGenerator(stringsFileTree) } diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt index 523edfac..6c0d751b 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt @@ -75,7 +75,7 @@ abstract class StringsGenerator( private val info: SourceInfo, private val iosBaseLocalizationRegion: String ) : ResourceGeneratorFeature { - private val stringsFileTree = info.commonResources.matching { include("MR/**/strings*.xml") } + private val stringsFileTree = info.commonResources.matching { it.include("MR/**/strings*.xml") } override fun createCommonGenerator(): StringsGenerator { return CommonStringsGenerator(stringsFileTree) } diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt index ad7370d7..b11d5340 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt @@ -12,15 +12,19 @@ import com.squareup.kotlinpoet.TypeSpec import dev.icerock.gradle.generator.MRGenerator import org.gradle.api.Project import org.gradle.api.Task -import org.gradle.kotlin.dsl.support.unzipTo import org.jetbrains.kotlin.gradle.plugin.mpp.AbstractKotlinNativeCompilation import org.jetbrains.kotlin.gradle.plugin.mpp.Framework import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile +import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink import org.jetbrains.kotlin.konan.file.zipDirAs import org.jetbrains.kotlin.library.impl.KotlinLibraryLayoutImpl import java.io.File +import java.io.InputStream import java.util.Properties +import java.util.zip.ZipEntry +import java.util.zip.ZipException +import java.util.zip.ZipFile class IosMRGenerator( generatedDir: File, @@ -77,10 +81,10 @@ class IosMRGenerator( val compileTask: KotlinNativeCompile = compilation.compileKotlinTask compileTask.dependsOn(generationTask) - compileTask.doLast { - this as KotlinNativeCompile + compileTask.doLast { task -> + task as KotlinNativeCompile - val klibFile = this.outputFile.get() + val klibFile = task.outputFile.get() val repackDir = File(klibFile.parent, klibFile.nameWithoutExtension) val defaultDir = File(repackDir, "default") val resRepackDir = File(defaultDir, "resources") @@ -141,12 +145,14 @@ class IosMRGenerator( frameworkBinaries.forEach { framework -> val linkTask = framework.linkTask - linkTask.doLast { - linkTask.libraries - .plus(linkTask.intermediateLibrary.get()) + linkTask.doLast { task -> + task as KotlinNativeLink + + task.libraries + .plus(task.intermediateLibrary.get()) .filter { it.extension == "klib" } .forEach { - project.logger.info("copy resources from $it") + task.project.logger.info("copy resources from $it") val klibKonan = org.jetbrains.kotlin.konan.file.File(it.path) val klib = KotlinLibraryLayoutImpl(klib = klibKonan, component = "default") val layout = klib.extractingToTemp @@ -160,6 +166,38 @@ class IosMRGenerator( } } + private fun unzipTo(outputDirectory: File, zipFile: File) { + ZipFile(zipFile).use { zip -> + val outputDirectoryCanonicalPath = outputDirectory.canonicalPath + for (entry in zip.entries()) { + unzipEntryTo(outputDirectory, outputDirectoryCanonicalPath, zip, entry) + } + } + } + + + private fun unzipEntryTo( + outputDirectory: File, + outputDirectoryCanonicalPath: String, + zip: ZipFile, + entry: ZipEntry + ) { + val output = outputDirectory.resolve(entry.name) + if (!output.canonicalPath.startsWith(outputDirectoryCanonicalPath)) { + throw ZipException("Zip entry '${entry.name}' is outside of the output directory") + } + if (entry.isDirectory) { + output.mkdirs() + } else { + output.parentFile.mkdirs() + zip.getInputStream(entry).use { it.copyTo(output) } + } + } + + + private fun InputStream.copyTo(file: File): Long = + file.outputStream().use { copyTo(it) } + companion object { const val BUNDLE_PROPERTY_NAME = "bundle" const val ASSETS_DIR_NAME = "Assets.xcassets" From 2872a6ba5c53be640a13e946fac9d30ff84f4714 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Wed, 26 Aug 2020 13:15:57 +0700 Subject: [PATCH 07/25] fix cinterop functions usage (not supported from iosMain) --- .../moko/resources/desc/PluralStringDesc.kt | 2 +- .../moko/resources/desc/PluralStringDesc.kt | 3 +-- resources/src/iosArm64Main | 1 + .../desc/PluralFormattedStringDesc.kt | 25 ------------------- .../desc/PluralFormattedStringDesc.kt | 24 ++++++++++++++++++ .../moko/resources/desc/PluralStringDesc.kt | 15 ++++++----- 6 files changed, 34 insertions(+), 36 deletions(-) create mode 120000 resources/src/iosArm64Main delete mode 100644 resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt create mode 100644 resources/src/iosX64Main/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt rename resources/src/{iosMain => iosX64Main}/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt (56%) diff --git a/resources/src/androidMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt b/resources/src/androidMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt index 7351932f..d961bafc 100644 --- a/resources/src/androidMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt +++ b/resources/src/androidMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt @@ -17,4 +17,4 @@ actual data class PluralStringDesc actual constructor( override fun toString(context: Context): String { return Utils.resourcesForContext(context).getQuantityString(pluralsRes.resourceId, number) } -} +} \ No newline at end of file diff --git a/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt b/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt index 993b5309..9e086198 100644 --- a/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt +++ b/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt @@ -7,7 +7,6 @@ package dev.icerock.moko.resources.desc import dev.icerock.moko.parcelize.Parcelable import dev.icerock.moko.resources.PluralsResource -expect class PluralStringDesc(pluralsRes: PluralsResource, number: Int) : StringDesc, Parcelable - @Suppress("FunctionName") fun StringDesc.Companion.Plural(pluralsRes: PluralsResource, number: Int) = PluralStringDesc(pluralsRes, number) +expect class PluralStringDesc(pluralsRes: PluralsResource, number: Int) : StringDesc, Parcelable \ No newline at end of file diff --git a/resources/src/iosArm64Main b/resources/src/iosArm64Main new file mode 120000 index 00000000..46be4b86 --- /dev/null +++ b/resources/src/iosArm64Main @@ -0,0 +1 @@ +iosX64Main \ No newline at end of file diff --git a/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt b/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt deleted file mode 100644 index 5bcfccfb..00000000 --- a/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. - */ - -package dev.icerock.moko.resources.desc - -import dev.icerock.moko.resources.PluralsResource -//import dev.icerock.moko.resources.objc.pluralizedString - -actual data class PluralFormattedStringDesc actual constructor( - val pluralsRes: PluralsResource, - val number: Int, - val args: List -) : StringDesc { - override fun localized(): String { - TODO() -// val pluralized = pluralizedString( -// bundle = StringDesc.localeType.getLocaleBundle(pluralsRes.bundle), -// baseBundle = pluralsRes.bundle, -// resourceId = pluralsRes.resourceId, -// number = number -// )!! -// return Utils.stringWithFormat(pluralized, Utils.processArgs(args)) - } -} diff --git a/resources/src/iosX64Main/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt b/resources/src/iosX64Main/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt new file mode 100644 index 00000000..6620bdce --- /dev/null +++ b/resources/src/iosX64Main/kotlin/dev/icerock/moko/resources/desc/PluralFormattedStringDesc.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +package dev.icerock.moko.resources.desc + +import dev.icerock.moko.resources.PluralsResource +import dev.icerock.moko.resources.objc.pluralizedString + +actual data class PluralFormattedStringDesc actual constructor( + val pluralsRes: PluralsResource, + val number: Int, + val args: List +) : StringDesc { + override fun localized(): String { + val pluralized = pluralizedString( + bundle = StringDesc.localeType.getLocaleBundle(pluralsRes.bundle), + baseBundle = pluralsRes.bundle, + resourceId = pluralsRes.resourceId, + number = number + )!! + return Utils.stringWithFormat(pluralized, Utils.processArgs(args)) + } +} diff --git a/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt b/resources/src/iosX64Main/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt similarity index 56% rename from resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt rename to resources/src/iosX64Main/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt index 4bad8752..a0195f2b 100644 --- a/resources/src/iosMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt +++ b/resources/src/iosX64Main/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt @@ -6,19 +6,18 @@ package dev.icerock.moko.resources.desc import dev.icerock.moko.parcelize.Parcelable import dev.icerock.moko.resources.PluralsResource -//import dev.icerock.moko.resources.objc.pluralizedString +import dev.icerock.moko.resources.objc.pluralizedString actual data class PluralStringDesc actual constructor( val pluralsRes: PluralsResource, val number: Int ) : StringDesc, Parcelable { override fun localized(): String { - TODO() -// return pluralizedString( -// bundle = StringDesc.localeType.getLocaleBundle(pluralsRes.bundle), -// baseBundle = pluralsRes.bundle, -// resourceId = pluralsRes.resourceId, -// number = number -// )!! + return pluralizedString( + bundle = StringDesc.localeType.getLocaleBundle(pluralsRes.bundle), + baseBundle = pluralsRes.bundle, + resourceId = pluralsRes.resourceId, + number = number + )!! } } From 99839b275d0ef7eb84290249b7e4c8d385a03536 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Wed, 26 Aug 2020 13:31:03 +0700 Subject: [PATCH 08/25] fix api usage in sample --- sample/mpp-library/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample/mpp-library/build.gradle.kts b/sample/mpp-library/build.gradle.kts index eab839fd..02bd5b5e 100644 --- a/sample/mpp-library/build.gradle.kts +++ b/sample/mpp-library/build.gradle.kts @@ -17,7 +17,7 @@ android { } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources) + commonMainApi(Deps.Libs.MultiPlatform.mokoResources) commonMainImplementation(project("$path:nested-module")) } From 0ddbf812f95b305cc57201433ea607851815f033 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Wed, 26 Aug 2020 13:32:05 +0700 Subject: [PATCH 09/25] disable granular source sets (nested modules not worked, consumer can't load iosMain of dependencies) --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 19ad558a..78679ac1 100755 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,8 @@ org.gradle.configureondemand=false org.gradle.parallel=true kotlin.code.style=official -kotlin.native.enableDependencyPropagation=false -kotlin.mpp.enableGranularSourceSetsMetadata=true +#kotlin.native.enableDependencyPropagation=false +#kotlin.mpp.enableGranularSourceSetsMetadata=true android.useAndroidX=true android.enableJetifier=true From 1578b434741d43f71d35da67cd72bbc994457b0b Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Wed, 26 Aug 2020 18:28:16 +0700 Subject: [PATCH 10/25] simplify gradle config --- buildSrc/src/main/kotlin/Deps.kt | 20 +++++++++---------- gradle.properties | 5 +++-- resources/build.gradle.kts | 8 +++++++- sample/android-app/build.gradle.kts | 14 ++++++------- sample/mpp-conditional/build.gradle.kts | 2 +- sample/mpp-hierarhical/build.gradle.kts | 2 +- .../nested-module/build.gradle.kts | 10 +++++----- sample/mpp-mixed/build.gradle.kts | 2 +- 8 files changed, 35 insertions(+), 28 deletions(-) diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index abd3c485..bf17f7aa 100755 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -55,18 +55,18 @@ object Deps { object Libs { object Android { - val appCompat = - AndroidLibrary(name = "androidx.appcompat:appcompat:$androidAppCompatVersion") + const val appCompat = + "androidx.appcompat:appcompat:$androidAppCompatVersion" object AndroidTest { - val espressoCore = - AndroidLibrary(name = "androidx.test.espresso:espresso-core:$espressoCoreVersion") - val testRunner = - AndroidLibrary(name = "androidx.test:runner:$testRunnerVersion") - val testRules = - AndroidLibrary(name = "androidx.test:rules:$testRunnerVersion") - val testExtJunit = - AndroidLibrary(name = "androidx.test.ext:junit:$testExtJunitVersion") + const val espressoCore = + "androidx.test.espresso:espresso-core:$espressoCoreVersion" + const val testRunner = + "androidx.test:runner:$testRunnerVersion" + const val testRules = + "androidx.test:rules:$testRunnerVersion" + const val testExtJunit = + "androidx.test.ext:junit:$testExtJunitVersion" } } diff --git a/gradle.properties b/gradle.properties index 78679ac1..07e130a9 100755 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,9 @@ org.gradle.configureondemand=false org.gradle.parallel=true kotlin.code.style=official -#kotlin.native.enableDependencyPropagation=false -#kotlin.mpp.enableGranularSourceSetsMetadata=true +kotlin.native.enableDependencyPropagation=false +kotlin.mpp.enableGranularSourceSetsMetadata=true +kotlin.mpp.enableCompatibilityMetadataVariant=true android.useAndroidX=true android.enableJetifier=true diff --git a/resources/build.gradle.kts b/resources/build.gradle.kts index 03e60b68..e3ac16b3 100644 --- a/resources/build.gradle.kts +++ b/resources/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { commonMainApi(Deps.Libs.MultiPlatform.mokoParcelize) commonMainApi(Deps.Libs.MultiPlatform.mokoGraphics) - androidLibrary(Deps.Libs.Android.appCompat) + androidMainImplementation(Deps.Libs.Android.appCompat) } publishing { @@ -44,3 +44,9 @@ kotlin { } } } + +tasks.named("publishToMavenLocal") { + val pluginPublish = gradle.includedBuild("plugins") + .task(":resources-generator:publishToMavenLocal") + dependsOn(pluginPublish) +} diff --git a/sample/android-app/build.gradle.kts b/sample/android-app/build.gradle.kts index 3dc48589..9cba7027 100644 --- a/sample/android-app/build.gradle.kts +++ b/sample/android-app/build.gradle.kts @@ -3,8 +3,8 @@ */ plugins { - id("com.android.application") - id("kotlin-android") + plugin(Deps.Plugins.androidApplication) + plugin(Deps.Plugins.kotlinAndroid) } android { @@ -46,12 +46,12 @@ android { } dependencies { - implementation(Deps.Libs.Android.appCompat.name) + implementation(Deps.Libs.Android.appCompat) implementation(project(":sample:mpp-library")) - androidTestImplementation(Deps.Libs.Android.AndroidTest.espressoCore.name) - androidTestImplementation(Deps.Libs.Android.AndroidTest.testRunner.name) - androidTestImplementation(Deps.Libs.Android.AndroidTest.testRules.name) - androidTestImplementation(Deps.Libs.Android.AndroidTest.testExtJunit.name) + androidTestImplementation(Deps.Libs.Android.AndroidTest.espressoCore) + androidTestImplementation(Deps.Libs.Android.AndroidTest.testRunner) + androidTestImplementation(Deps.Libs.Android.AndroidTest.testRules) + androidTestImplementation(Deps.Libs.Android.AndroidTest.testExtJunit) } diff --git a/sample/mpp-conditional/build.gradle.kts b/sample/mpp-conditional/build.gradle.kts index bcca447d..74277524 100644 --- a/sample/mpp-conditional/build.gradle.kts +++ b/sample/mpp-conditional/build.gradle.kts @@ -32,7 +32,7 @@ kotlin { } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources) + commonMainApi(Deps.Libs.MultiPlatform.mokoResources) } multiplatformResources { diff --git a/sample/mpp-hierarhical/build.gradle.kts b/sample/mpp-hierarhical/build.gradle.kts index 24f1a22b..5a687d74 100644 --- a/sample/mpp-hierarhical/build.gradle.kts +++ b/sample/mpp-hierarhical/build.gradle.kts @@ -20,7 +20,7 @@ kotlin { } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources) + commonMainApi(Deps.Libs.MultiPlatform.mokoResources) } multiplatformResources { diff --git a/sample/mpp-library/nested-module/build.gradle.kts b/sample/mpp-library/nested-module/build.gradle.kts index 86fee77e..7dd3415b 100644 --- a/sample/mpp-library/nested-module/build.gradle.kts +++ b/sample/mpp-library/nested-module/build.gradle.kts @@ -3,14 +3,14 @@ */ plugins { - id("com.android.library") - id("org.jetbrains.kotlin.multiplatform") - id("dev.icerock.mobile.multiplatform") - id("dev.icerock.mobile.multiplatform-resources") + plugin(Deps.Plugins.androidLibrary) + plugin(Deps.Plugins.kotlinMultiplatform) + plugin(Deps.Plugins.mobileMultiplatform) + plugin(Deps.Plugins.mokoResources) } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources) + commonMainApi(Deps.Libs.MultiPlatform.mokoResources) } multiplatformResources { diff --git a/sample/mpp-mixed/build.gradle.kts b/sample/mpp-mixed/build.gradle.kts index 27428d2a..c4f243f9 100644 --- a/sample/mpp-mixed/build.gradle.kts +++ b/sample/mpp-mixed/build.gradle.kts @@ -45,7 +45,7 @@ kotlin { } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.mokoResources) + commonMainApi(Deps.Libs.MultiPlatform.mokoResources) } multiplatformResources { From b0d662a4bd31154d0dc786a685551d03eff0f01b Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Thu, 27 Aug 2020 20:16:21 +0700 Subject: [PATCH 11/25] fix detekt problems --- .../kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt | 2 +- .../kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/src/androidMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt b/resources/src/androidMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt index d961bafc..7351932f 100644 --- a/resources/src/androidMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt +++ b/resources/src/androidMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt @@ -17,4 +17,4 @@ actual data class PluralStringDesc actual constructor( override fun toString(context: Context): String { return Utils.resourcesForContext(context).getQuantityString(pluralsRes.resourceId, number) } -} \ No newline at end of file +} diff --git a/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt b/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt index 9e086198..c6313cc0 100644 --- a/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt +++ b/resources/src/commonMain/kotlin/dev/icerock/moko/resources/desc/PluralStringDesc.kt @@ -9,4 +9,5 @@ import dev.icerock.moko.resources.PluralsResource @Suppress("FunctionName") fun StringDesc.Companion.Plural(pluralsRes: PluralsResource, number: Int) = PluralStringDesc(pluralsRes, number) -expect class PluralStringDesc(pluralsRes: PluralsResource, number: Int) : StringDesc, Parcelable \ No newline at end of file + +expect class PluralStringDesc(pluralsRes: PluralsResource, number: Int) : StringDesc, Parcelable From 9b02f36f514937360c5adfcab4a45b3125e01936 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Thu, 27 Aug 2020 20:33:36 +0700 Subject: [PATCH 12/25] usage of live collection for framework binary search --- .../gradle/generator/ios/IosMRGenerator.kt | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt index b11d5340..abf1adad 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt @@ -138,32 +138,32 @@ class IosMRGenerator( private fun setupFrameworkResources() { val kotlinNativeTarget = compilation.target as KotlinNativeTarget - val frameworkBinaries: List = kotlinNativeTarget.binaries - .filterIsInstance() - .filter { it.compilation == compilation } - - frameworkBinaries.forEach { framework -> - val linkTask = framework.linkTask - - linkTask.doLast { task -> - task as KotlinNativeLink - - task.libraries - .plus(task.intermediateLibrary.get()) - .filter { it.extension == "klib" } - .forEach { - task.project.logger.info("copy resources from $it") - val klibKonan = org.jetbrains.kotlin.konan.file.File(it.path) - val klib = KotlinLibraryLayoutImpl(klib = klibKonan, component = "default") - val layout = klib.extractingToTemp - - File(layout.resourcesDir.path).copyRecursively( - framework.outputFile, - overwrite = true - ) - } + kotlinNativeTarget.binaries + .matching { it is Framework && it.compilation == compilation } + .configureEach { binary -> + val framework = binary as Framework + + val linkTask = framework.linkTask + + linkTask.doLast { task -> + task as KotlinNativeLink + + task.libraries + .plus(task.intermediateLibrary.get()) + .filter { it.extension == "klib" } + .forEach { + task.project.logger.info("copy resources from $it") + val klibKonan = org.jetbrains.kotlin.konan.file.File(it.path) + val klib = KotlinLibraryLayoutImpl(klib = klibKonan, component = "default") + val layout = klib.extractingToTemp + + File(layout.resourcesDir.path).copyRecursively( + framework.outputFile, + overwrite = true + ) + } + } } - } } private fun unzipTo(outputDirectory: File, zipFile: File) { From 51396524d43a1df590a4eff11d85c6aceb944076 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 30 Aug 2020 02:10:33 +0700 Subject: [PATCH 13/25] use substitution only in sample --- .github/workflows/compilation-check.yml | 4 ++-- build.gradle.kts | 7 ------- sample/build.gradle.kts | 12 ++++++++++++ 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 sample/build.gradle.kts diff --git a/.github/workflows/compilation-check.yml b/.github/workflows/compilation-check.yml index 7f320b8e..5d8abe0d 100644 --- a/.github/workflows/compilation-check.yml +++ b/.github/workflows/compilation-check.yml @@ -17,6 +17,6 @@ jobs: with: java-version: 1.8 - name: Plugin check - run: ./gradlew -p plugins detekt build + run: ./gradlew -p plugins detekt build publishToMavenLocal - name: Library check - run: ./gradlew detekt build + run: ./gradlew detekt build publishToMavenLocal diff --git a/build.gradle.kts b/build.gradle.kts index 04695384..b995ec16 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -45,13 +45,6 @@ allprojects { "detektPlugins"(Deps.Libs.Jvm.detektFormatting) } - configurations.all { - resolutionStrategy.dependencySubstitution { - substitute(module(Deps.Libs.MultiPlatform.mokoResources)) - .with(project(":resources")) - } - } - plugins.withId(Deps.Plugins.androidLibrary.id) { configure { compileSdkVersion(Deps.Android.compileSdk) diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts new file mode 100644 index 00000000..f55f410d --- /dev/null +++ b/sample/build.gradle.kts @@ -0,0 +1,12 @@ +/* + * Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +subprojects { + configurations.all { + resolutionStrategy.dependencySubstitution { + substitute(module(Deps.Libs.MultiPlatform.mokoResources)) + .with(project(":resources")) + } + } +} From b4d1a27d13539f4c650f74e3a25ca4106f3475f9 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Thu, 3 Sep 2020 23:46:40 +0700 Subject: [PATCH 14/25] fix ios swift error --- sample/mpp-library/build.gradle.kts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sample/mpp-library/build.gradle.kts b/sample/mpp-library/build.gradle.kts index 02bd5b5e..ffced953 100644 --- a/sample/mpp-library/build.gradle.kts +++ b/sample/mpp-library/build.gradle.kts @@ -26,6 +26,10 @@ multiplatformResources { multiplatformResourcesPackage = "com.icerockdev.library" } +framework { + export(Deps.Libs.MultiPlatform.mokoGraphics) +} + // uncomment to test static framework // also in sample/mpp-library/MultiPlatformLibrary.podspec:14 flag should be uncommented //kotlin { From 24a3588b8c0aab5b059c0216896cf441ff097c66 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Thu, 3 Sep 2020 23:46:52 +0700 Subject: [PATCH 15/25] add support of KMM AS plugin --- gradle.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gradle.properties b/gradle.properties index 07e130a9..c62d440e 100755 --- a/gradle.properties +++ b/gradle.properties @@ -13,3 +13,5 @@ android.enableJetifier=true # Workaround for Bintray treating .sha512 files as artifacts # https://github.com/gradle/gradle/issues/11412 systemProp.org.gradle.internal.publish.checksums.insecure=true + +xcodeproj=./sample/ios-app \ No newline at end of file From 4e5a760936029f62307f415aaccd0301d07d40da Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 6 Sep 2020 20:18:48 +0700 Subject: [PATCH 16/25] remove mavenLocal --- build.gradle.kts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b995ec16..fa458879 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,8 +8,6 @@ plugins { buildscript { repositories { - mavenLocal() - jcenter() google() @@ -25,8 +23,6 @@ buildscript { allprojects { repositories { - mavenLocal() - google() jcenter() From 034520502ead8784132f6640f5fb18e179ba4221 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 6 Sep 2020 20:58:25 +0700 Subject: [PATCH 17/25] apply export of moko-graphics --- buildSrc/src/main/kotlin/Deps.kt | 6 +++++- resources/build.gradle.kts | 2 +- sample/mpp-library/build.gradle.kts | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index 8ee4bd95..50395843 100755 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -79,7 +79,11 @@ object Deps { object MultiPlatform { const val mokoResources = "dev.icerock.moko:resources:$mokoResourcesVersion" const val mokoParcelize = "dev.icerock.moko:parcelize:$mokoParcelizeVersion" - const val mokoGraphics = "dev.icerock.moko:graphics:$mokoGraphicsVersion" + val mokoGraphics = MultiPlatformLibrary( + common = "dev.icerock.moko:graphics:$mokoGraphicsVersion", + iosX64 = "dev.icerock.moko:graphics-iosx64:$mokoGraphicsVersion", + iosArm64 = "dev.icerock.moko:graphics-iosarm64:$mokoGraphicsVersion" + ) object Tests { const val kotlinTest = diff --git a/resources/build.gradle.kts b/resources/build.gradle.kts index e3ac16b3..759af096 100644 --- a/resources/build.gradle.kts +++ b/resources/build.gradle.kts @@ -15,7 +15,7 @@ version = Deps.mokoResourcesVersion dependencies { commonMainApi(Deps.Libs.MultiPlatform.mokoParcelize) - commonMainApi(Deps.Libs.MultiPlatform.mokoGraphics) + commonMainApi(Deps.Libs.MultiPlatform.mokoGraphics.common) androidMainImplementation(Deps.Libs.Android.appCompat) } diff --git a/sample/mpp-library/build.gradle.kts b/sample/mpp-library/build.gradle.kts index b983f7b0..df34461c 100644 --- a/sample/mpp-library/build.gradle.kts +++ b/sample/mpp-library/build.gradle.kts @@ -18,6 +18,7 @@ android { dependencies { commonMainApi(Deps.Libs.MultiPlatform.mokoResources) + mppLibrary(Deps.Libs.MultiPlatform.mokoGraphics) commonMainImplementation(project("$path:nested-module")) } @@ -27,7 +28,7 @@ multiplatformResources { } framework { -// export(Deps.Libs.MultiPlatform.mokoGraphics) + export(Deps.Libs.MultiPlatform.mokoGraphics) } // uncomment to test static framework From ab125c71af6d27470f7cb2afab902b6b3016331e Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 6 Sep 2020 20:58:42 +0700 Subject: [PATCH 18/25] update export of resources --- sample/mpp-hierarhical/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample/mpp-hierarhical/build.gradle.kts b/sample/mpp-hierarhical/build.gradle.kts index 654e54d1..efabd096 100644 --- a/sample/mpp-hierarhical/build.gradle.kts +++ b/sample/mpp-hierarhical/build.gradle.kts @@ -44,7 +44,7 @@ kotlin { this.binaries.configureEach { if (this is org.jetbrains.kotlin.gradle.plugin.mpp.Framework) { - this.export("dev.icerock.moko:resources-$arch:${Deps.mokoResourcesVersion}") + this.export(project(":resources")) } } } From 0647833ee83500a994742c2c74325d120ae96599 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 6 Sep 2020 20:59:07 +0700 Subject: [PATCH 19/25] remove outdated static framework config --- sample/mpp-library/build.gradle.kts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/sample/mpp-library/build.gradle.kts b/sample/mpp-library/build.gradle.kts index df34461c..7ac8be5d 100644 --- a/sample/mpp-library/build.gradle.kts +++ b/sample/mpp-library/build.gradle.kts @@ -30,15 +30,3 @@ multiplatformResources { framework { export(Deps.Libs.MultiPlatform.mokoGraphics) } - -// uncomment to test static framework -// also in sample/mpp-library/MultiPlatformLibrary.podspec:14 flag should be uncommented -//kotlin { -// targets -// .filterIsInstance() -// .flatMap { it.binaries } -// .filterIsInstance() -// .forEach { framework -> -// framework.isStatic = true -// } -//} From 8a6e16ff25c9ff45238dd35f1513eeaa0955f810 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 6 Sep 2020 20:59:26 +0700 Subject: [PATCH 20/25] disable nested module while https://youtrack.jetbrains.com/issue/KT-41384 not fixed --- sample/mpp-library/build.gradle.kts | 3 ++- .../kotlin/com/icerockdev/library/Testing.kt | 11 +++++++---- settings.gradle.kts | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sample/mpp-library/build.gradle.kts b/sample/mpp-library/build.gradle.kts index 7ac8be5d..92b011e7 100644 --- a/sample/mpp-library/build.gradle.kts +++ b/sample/mpp-library/build.gradle.kts @@ -20,7 +20,8 @@ dependencies { commonMainApi(Deps.Libs.MultiPlatform.mokoResources) mppLibrary(Deps.Libs.MultiPlatform.mokoGraphics) - commonMainImplementation(project("$path:nested-module")) +// disabled while not fixed https://youtrack.jetbrains.com/issue/KT-41384 +// commonMainImplementation(project("$path:nested-module")) } multiplatformResources { diff --git a/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/Testing.kt b/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/Testing.kt index 2b73c948..4f8c6ffb 100644 --- a/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/Testing.kt +++ b/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/Testing.kt @@ -4,8 +4,8 @@ package com.icerockdev.library -import com.icerockdev.library.nested.nestedFile -import com.icerockdev.library.nested.nestedTest +//import com.icerockdev.library.nested.nestedFile +//import com.icerockdev.library.nested.nestedTest import dev.icerock.moko.resources.FileResource import dev.icerock.moko.resources.ImageResource import dev.icerock.moko.resources.desc.Plural @@ -33,7 +33,8 @@ object Testing { MR.plurals.test_plural.desc(1), MR.plurals.test_plural.desc(2), MR.plurals.test_plural.desc(3), - nestedTest() + // disabled while not fixed https://youtrack.jetbrains.com/issue/KT-41384 +// nestedTest() ) } @@ -112,6 +113,8 @@ object Testing { } fun getNestedJsonFile(): FileResource { - return nestedFile() + return MR.files.some + // disabled while not fixed https://youtrack.jetbrains.com/issue/KT-41384 +// return nestedFile() } } diff --git a/settings.gradle.kts b/settings.gradle.kts index f39bab5e..99e8dfde 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,7 +7,8 @@ include(":resources") include(":sample:android-app") include(":sample:mpp-library") -include(":sample:mpp-library:nested-module") +// disabled while not fixed https://youtrack.jetbrains.com/issue/KT-41384 +//include(":sample:mpp-library:nested-module") include(":sample:mpp-conditional") include(":sample:mpp-hierarhical") include(":sample:mpp-mixed") From ab5a41486c868796b5e0996998e607d9a1903f26 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 6 Sep 2020 21:07:10 +0700 Subject: [PATCH 21/25] up version --- buildSrc/src/main/kotlin/Deps.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index 50395843..97de1d15 100755 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -19,7 +19,7 @@ object Deps { private const val mokoGraphicsVersion = "0.4.0" private const val mokoParcelizeVersion = "0.4.0" - const val mokoResourcesVersion = "0.12.0" + const val mokoResourcesVersion = "0.13.0" object Android { const val compileSdk = 28 From 9d02dfd8d357442f5834dea6cccea1774e418ccb Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 6 Sep 2020 21:12:12 +0700 Subject: [PATCH 22/25] fix detekt problems in plugin --- .../icerock/gradle/generator/ColorsGenerator.kt | 14 +++++++++++--- .../icerock/gradle/generator/ios/IosMRGenerator.kt | 9 ++++++--- .../CopyFrameworkResourcesToAppEntryPointTask.kt | 6 +++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt index 319d2f76..ee95b0eb 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt @@ -75,7 +75,7 @@ abstract class ColorsGenerator( val colorNodes = mutableListOf() val colorValues = mutableMapOf() - fun getColor(color: String?): String? { + fun getColor(color: String?): String? { return if (color?.startsWith(XmlColorReferencePrefix) == true) { val colorName = color.replace(XmlColorReferencePrefix, "") colorValues[colorName] @@ -116,7 +116,14 @@ abstract class ColorsGenerator( } } } - colorNodes.add(ColorNode(colorName, getColor(lightColor), getColor(darkColor), getColor(singleColor))) + colorNodes.add( + ColorNode( + colorName, + getColor(lightColor), + getColor(darkColor), + getColor(singleColor) + ) + ) } } @@ -127,7 +134,8 @@ abstract class ColorsGenerator( private val info: SourceInfo ) : ResourceGeneratorFeature { - private val colorsFileTree = info.commonResources.matching { it.include("MR/**/colors*.xml") } + private val colorsFileTree = + info.commonResources.matching { it.include("MR/**/colors*.xml") } override fun createCommonGenerator(): ColorsGenerator { return CommonColorsGenerator(colorsFileTree) diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt index 725b8beb..74b25d56 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ios/IosMRGenerator.kt @@ -30,6 +30,7 @@ import java.util.zip.ZipEntry import java.util.zip.ZipException import java.util.zip.ZipFile +@Suppress("TooManyFunctions") class IosMRGenerator( generatedDir: File, sourceSet: SourceSet, @@ -161,7 +162,11 @@ class IosMRGenerator( val resourcesExtension = project.extensions.getByType(MultiplatformResourcesPluginExtension::class.java) if (resourcesExtension.disableStaticFrameworkWarning.not()) { - project.logger.warn("$linkTask produces static framework, Xcode should have Build Phase with copyFrameworkResourcesToApp gradle task call. Please read readme on https://github.com/icerockdev/moko-resources") + project.logger.warn( + """ +$linkTask produces static framework, Xcode should have Build Phase with copyFrameworkResourcesToApp gradle task call. Please read readme on https://github.com/icerockdev/moko-resources +""" + ) } createCopyFrameworkResourcesTask(linkTask) } @@ -251,7 +256,6 @@ class IosMRGenerator( } } - private fun unzipEntryTo( outputDirectory: File, outputDirectoryCanonicalPath: String, @@ -270,7 +274,6 @@ class IosMRGenerator( } } - private fun InputStream.copyTo(file: File): Long = file.outputStream().use { copyTo(it) } diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt index e64c98e5..95e11286 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt @@ -31,7 +31,11 @@ open class CopyFrameworkResourcesToAppEntryPointTask : DefaultTask() { @TaskAction fun action() { if (dependsOn.isEmpty()) { - throw IllegalStateException("framework link task with konanTarget $konanTarget and buildType $configuration not found!") + throw IllegalStateException( + """ +framework link task with konanTarget $konanTarget and buildType $configuration not found! +""" + ) } } } From 577edbc0a4fa492d1f0a19062c4ad0fc94f5f419 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 6 Sep 2020 21:13:17 +0700 Subject: [PATCH 23/25] fix detekt problems in libs --- .../src/commonMain/kotlin/com/icerockdev/library/Testing.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/Testing.kt b/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/Testing.kt index 4f8c6ffb..1a9a0d18 100644 --- a/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/Testing.kt +++ b/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/Testing.kt @@ -4,8 +4,8 @@ package com.icerockdev.library -//import com.icerockdev.library.nested.nestedFile -//import com.icerockdev.library.nested.nestedTest +// import com.icerockdev.library.nested.nestedFile +// import com.icerockdev.library.nested.nestedTest import dev.icerock.moko.resources.FileResource import dev.icerock.moko.resources.ImageResource import dev.icerock.moko.resources.desc.Plural From 27e5f6308fca04414a9e4dc142061cfc4a7aef0e Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 6 Sep 2020 21:15:53 +0700 Subject: [PATCH 24/25] update ui tests to current config --- .../java/com/icerockdev/StringResourcesTest.kt | 1 - .../java/com/icerockdev/StringResourcesTestEn.kt | 5 +++-- .../java/com/icerockdev/StringResourcesTestRu.kt | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTest.kt b/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTest.kt index 961df7fd..4744a772 100644 --- a/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTest.kt +++ b/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTest.kt @@ -46,5 +46,4 @@ abstract class StringResourcesTest { onView(ViewMatchers.withId(R.id.stringDescTextView)) .check(ViewAssertions.matches(ViewMatchers.withText(stringDescsCheck))) } - } diff --git a/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestEn.kt b/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestEn.kt index 1d8b0e59..4c0adac0 100644 --- a/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestEn.kt +++ b/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestEn.kt @@ -15,10 +15,11 @@ class StringResourcesTestEn : StringResourcesTest() { override val locale: String = "en" override val stringAndPluralsCheck: String - get() = "test\ntest 2\ntest 3\nTest Project\nsome raw string\nother\none\nother\nother\nnested test" + get() = "test\ntest 2\ntest 3\nTest Project\nsome raw string\nother\none\nother\nother" + // commented while not fix https://youtrack.jetbrains.com/issue/KT-41384 + // \nnested test" override val stringDescsCheck: String get() = "test\ntest\nTest data 9\nother\nother\n10 items\nraw string\nraw string" + "\ntestraw string\nCHOOSE PORTFOLIO & AMOUNT\nsecond string str first decimal 9" - } diff --git a/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestRu.kt b/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestRu.kt index 94485a6d..a0616367 100644 --- a/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestRu.kt +++ b/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestRu.kt @@ -15,9 +15,11 @@ class StringResourcesTestRu : StringResourcesTest() { override val locale: String = "ru" override val stringAndPluralsCheck: String - get() = "тест\nтест 2\nтест 3\nТестовый проект\nsome raw string\nмного\nодин\nнесколько\nнесколько\nтест вложенный" + get() = "тест\nтест 2\nтест 3\nТестовый проект\nsome raw string\nмного\nодин\nнесколько\nнесколько" + // commented while not fix https://youtrack.jetbrains.com/issue/KT-41384 + // \nтест вложенный" override val stringDescsCheck: String - get() = "тест\nтест\nТестовые данные 9\nмного\nмного\n10 элементов\nraw string\nraw string\nтестraw string\nВыберите портфель и сумму\nвторая строка str первое число 9" - + get() = "тест\nтест\nТестовые данные 9\nмного\nмного\n10 элементов\nraw string\nraw string\n" + + "тестraw string\nВыберите портфель и сумму\nвторая строка str первое число 9" } From 70efece21330782b0bb8f8f01f9e7545ebda2a1e Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 6 Sep 2020 21:30:55 +0700 Subject: [PATCH 25/25] fix plugin task fields --- .../tasks/CopyFrameworkResourcesToAppEntryPointTask.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt index 95e11286..0eb4c760 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt +++ b/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt @@ -5,13 +5,16 @@ package dev.icerock.gradle.tasks import org.gradle.api.DefaultTask +import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction import org.jetbrains.kotlin.konan.target.KonanTarget open class CopyFrameworkResourcesToAppEntryPointTask : DefaultTask() { - val konanTarget: KonanTarget? - val configuration: String? + @get:Internal + internal val konanTarget: KonanTarget? + @get:Internal + internal val configuration: String? init { group = "moko-resources"