From 862d259ea3ae00c58a2897b6d2b9b6c859fd85b6 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Tue, 16 Mar 2021 15:11:50 +0700 Subject: [PATCH 01/11] #174 test strings --- .../mpp-library/src/commonMain/resources/MR/base/strings.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sample/mpp-library/src/commonMain/resources/MR/base/strings.xml b/sample/mpp-library/src/commonMain/resources/MR/base/strings.xml index a2fb6d81..6c26ddf6 100644 --- a/sample/mpp-library/src/commonMain/resources/MR/base/strings.xml +++ b/sample/mpp-library/src/commonMain/resources/MR/base/strings.xml @@ -4,4 +4,8 @@ Test data %d CHOOSE PORTFOLIO & AMOUNT second string %2$s first decimal %1$d + first line +second line +third line. + Alex009 said "hello world" & "write tests". \ No newline at end of file From 0be8fab67696655bd4764b1799ef0c339b486c6a Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Tue, 16 Mar 2021 16:52:44 +0700 Subject: [PATCH 02/11] #174 fix invalid generation of ios strings and #147 move plugin to composite build due errors --- build.gradle.kts | 15 +++++++---- buildSrc/build.gradle.kts | 20 --------------- gradle/wrapper/gradle-wrapper.properties | 2 +- plugins/buildSrc/build.gradle.kts | 1 - plugins/buildSrc/src | 1 - plugins/gradle | 1 - plugins/settings.gradle.kts | 5 ---- resources-deps/build.gradle.kts | 25 +++++++++++++++++++ .../src/main/kotlin/Deps.kt | 13 +++------- .../build.gradle.kts | 23 +++++++++++++---- resources-generator/settings.gradle.kts | 5 ++++ .../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 .../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/apple/AppleColorsGenerator.kt | 0 .../generator/apple/AppleFilesGenerator.kt | 0 .../generator/apple/AppleFontsGenerator.kt | 0 .../generator/apple/AppleGeneratorHelper.kt | 0 .../generator/apple/AppleImagesGenerator.kt | 0 .../generator/apple/AppleMRGenerator.kt | 0 .../generator/apple/ApplePluralsGenerator.kt | 0 .../generator/apple/AppleStringsGenerator.kt | 14 ++++++++++- .../gradle/generator/apple/LoadableBundle.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 ...pyFrameworkResourcesToAppEntryPointTask.kt | 0 .../tasks/CopyFrameworkResourcesToAppTask.kt | 0 .../GenerateMultiplatformResourcesTask.kt | 0 .../dev/icerock/gradle/utils/ArgbColor.kt | 0 ....mobile.multiplatform-resources.properties | 0 resources/build.gradle.kts | 10 ++++---- sample/android-app/build.gradle.kts | 4 +-- .../mpp-hierarhical/mpp_hierarhical.podspec | 2 +- .../src/clientTest/kotlin/Test.kt | 16 ++++++++++++ sample/mpp-library/build.gradle.kts | 10 ++++---- .../nested-module/build.gradle.kts | 8 +++--- .../kotlin/com/icerockdev/library/Testing.kt | 2 ++ .../commonMain/resources/MR/es/strings.xml | 4 +++ .../commonMain/resources/MR/ru/strings.xml | 4 +++ settings.gradle.kts | 3 ++- 64 files changed, 121 insertions(+), 67 deletions(-) delete mode 100644 buildSrc/build.gradle.kts delete mode 120000 plugins/buildSrc/build.gradle.kts delete mode 120000 plugins/buildSrc/src delete mode 120000 plugins/gradle delete mode 100644 plugins/settings.gradle.kts create mode 100644 resources-deps/build.gradle.kts rename {buildSrc => resources-deps}/src/main/kotlin/Deps.kt (93%) rename {plugins/resources-generator => resources-generator}/build.gradle.kts (71%) create mode 100644 resources-generator/settings.gradle.kts rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPluginExtension.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/BaseGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/EqualStringKeysException.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ObjectBodyExtendable.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/ResourceGeneratorFeature.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/SourceInfo.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidColorsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFilesGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFontsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidImagesGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidMRGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidPluralsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleColorsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleFilesGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleFontsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleGeneratorHelper.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleImagesGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleMRGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/apple/ApplePluralsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt (78%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/apple/LoadableBundle.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonColorsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFilesGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFontsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonImagesGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonMRGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonPluralsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/generator/common/CommonStringsGenerator.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppTask.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/tasks/GenerateMultiplatformResourcesTask.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt (100%) rename {plugins/resources-generator => resources-generator}/src/main/resources/META-INF/gradle-plugins/dev.icerock.mobile.multiplatform-resources.properties (100%) diff --git a/build.gradle.kts b/build.gradle.kts index fa458879..e045b9e4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,35 +3,40 @@ */ plugins { - plugin(Deps.Plugins.detekt) apply false + id("io.gitlab.arturbosch.detekt") version("1.15.0") apply(false) } buildscript { repositories { - jcenter() + mavenCentral() google() maven { url = uri("https://dl.bintray.com/kotlin/kotlin") } maven { url = uri("https://kotlin.bintray.com/kotlinx") } maven { url = uri("https://plugins.gradle.org/m2/") } maven { url = uri("https://dl.bintray.com/icerockdev/plugins") } + + jcenter() } dependencies { - plugin(Deps.Plugins.mokoResources) + classpath("dev.icerock.moko:resources-generator:0.15.0") + classpath("gradle:resources-deps:1") } } allprojects { repositories { + mavenCentral() google() - jcenter() maven { url = uri("https://kotlin.bintray.com/kotlin") } maven { url = uri("https://kotlin.bintray.com/kotlinx") } maven { url = uri("https://dl.bintray.com/icerockdev/moko") } + + jcenter() } - apply(plugin = Deps.Plugins.detekt.id) + apply(plugin = "io.gitlab.arturbosch.detekt") configure { input.setFrom("src/commonMain/kotlin", "src/androidMain/kotlin", "src/iosMain/kotlin") diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index 78979083..00000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. - */ - -plugins { - id("org.jetbrains.kotlin.jvm") version("1.4.21") -} - -repositories { - jcenter() - google() - - maven { url = uri("https://dl.bintray.com/icerockdev/plugins") } -} - -dependencies { - implementation("dev.icerock:mobile-multiplatform:0.9.0") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21") - implementation("com.android.tools.build:gradle:4.0.1") -} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4d9ca164..442d9132 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.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/plugins/buildSrc/build.gradle.kts b/plugins/buildSrc/build.gradle.kts deleted file mode 120000 index f8089930..00000000 --- a/plugins/buildSrc/build.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -../../buildSrc/build.gradle.kts \ No newline at end of file diff --git a/plugins/buildSrc/src b/plugins/buildSrc/src deleted file mode 120000 index 38645d55..00000000 --- a/plugins/buildSrc/src +++ /dev/null @@ -1 +0,0 @@ -../../buildSrc/src \ No newline at end of file diff --git a/plugins/gradle b/plugins/gradle deleted file mode 120000 index 3337596a..00000000 --- a/plugins/gradle +++ /dev/null @@ -1 +0,0 @@ -../gradle \ No newline at end of file diff --git a/plugins/settings.gradle.kts b/plugins/settings.gradle.kts deleted file mode 100644 index 9ff48f9c..00000000 --- a/plugins/settings.gradle.kts +++ /dev/null @@ -1,5 +0,0 @@ -/* - * Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. - */ - -include(":resources-generator") diff --git a/resources-deps/build.gradle.kts b/resources-deps/build.gradle.kts new file mode 100644 index 00000000..e8fe1055 --- /dev/null +++ b/resources-deps/build.gradle.kts @@ -0,0 +1,25 @@ +/* + * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +plugins { + id("org.jetbrains.kotlin.jvm") version("1.4.31") +} + +repositories { + mavenCentral() + google() + + maven { url = uri("https://dl.bintray.com/icerockdev/plugins") } + + jcenter() +} + +dependencies { + api("dev.icerock:mobile-multiplatform:0.9.0") + api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31") + api("com.android.tools.build:gradle:4.1.2") +} + +group = "gradle" +version = "1" diff --git a/buildSrc/src/main/kotlin/Deps.kt b/resources-deps/src/main/kotlin/Deps.kt similarity index 93% rename from buildSrc/src/main/kotlin/Deps.kt rename to resources-deps/src/main/kotlin/Deps.kt index 0e4bfa66..1076ff82 100644 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/resources-deps/src/main/kotlin/Deps.kt @@ -3,7 +3,7 @@ */ object Deps { - private const val kotlinVersion = "1.4.21" + private const val kotlinVersion = "1.4.31" private const val androidGradleVersion = "4.0.1" private const val androidAppCompatVersion = "1.1.0" @@ -15,11 +15,11 @@ object Deps { private const val kotlinPoetVersion = "1.6.0" private const val kotlinxSerializationVersion = "1.0.0" - private const val detektVersion = "1.7.4" + private const val detektVersion = "1.15.0" private const val mokoGraphicsVersion = "0.5.0" private const val mokoParcelizeVersion = "0.5.0" - const val mokoResourcesVersion = "0.15.0" + const val mokoResourcesVersion = "0.15.1" object Android { const val compileSdk = 28 @@ -46,11 +46,6 @@ object Deps { id = "dev.icerock.mobile.multiplatform-resources", module = "dev.icerock.moko:resources-generator:$mokoResourcesVersion" ) - - val detekt = GradlePlugin( - id = "io.gitlab.arturbosch.detekt", - version = detektVersion - ) } object Libs { @@ -66,7 +61,7 @@ object Deps { const val testCore = "androidx.test:core:1.3.0" const val robolectric = - "org.robolectric:robolectric:4.3" + "org.robolectric:robolectric:4.4" const val testRunner = "androidx.test:runner:$testRunnerVersion" const val testRules = diff --git a/plugins/resources-generator/build.gradle.kts b/resources-generator/build.gradle.kts similarity index 71% rename from plugins/resources-generator/build.gradle.kts rename to resources-generator/build.gradle.kts index 9460ba6c..ae47d5d1 100644 --- a/plugins/resources-generator/build.gradle.kts +++ b/resources-generator/build.gradle.kts @@ -3,21 +3,34 @@ */ plugins { - plugin(Deps.Plugins.javaGradle) - plugin(Deps.Plugins.kotlinJvm) - plugin(Deps.Plugins.mavenPublish) - plugin(Deps.Plugins.detekt) + id("org.jetbrains.kotlin.jvm") version ("1.4.31") + id("org.gradle.maven-publish") + id("io.gitlab.arturbosch.detekt") version ("1.15.0") +} + +buildscript { + repositories { + mavenCentral() + google() + + maven { url = uri("https://dl.bintray.com/icerockdev/plugins") } + } + dependencies { + classpath("gradle:resources-deps:1") + } } repositories { - jcenter() + mavenCentral() google() + jcenter() } group = "dev.icerock.moko" version = Deps.mokoResourcesVersion dependencies { + implementation(gradleKotlinDsl()) compileOnly(Deps.Libs.Jvm.kotlinGradlePlugin) compileOnly(Deps.Libs.Jvm.androidGradlePlugin) implementation(Deps.Libs.Jvm.kotlinPoet) diff --git a/resources-generator/settings.gradle.kts b/resources-generator/settings.gradle.kts new file mode 100644 index 00000000..aba94d40 --- /dev/null +++ b/resources-generator/settings.gradle.kts @@ -0,0 +1,5 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +includeBuild("../resources-deps") diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPlugin.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPluginExtension.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPluginExtension.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPluginExtension.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/MultiplatformResourcesPluginExtension.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/BaseGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/BaseGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/BaseGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/BaseGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ColorsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/EqualStringKeysException.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/EqualStringKeysException.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/EqualStringKeysException.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/EqualStringKeysException.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FatFrameworkWithResourcesTask.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FilesGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/FontsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ImagesGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/MRGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ObjectBodyExtendable.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ObjectBodyExtendable.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ObjectBodyExtendable.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ObjectBodyExtendable.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/PluralsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ResourceGeneratorFeature.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ResourceGeneratorFeature.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ResourceGeneratorFeature.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/ResourceGeneratorFeature.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/SourceInfo.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/SourceInfo.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/SourceInfo.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/SourceInfo.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/StringsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidColorsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidColorsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidColorsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidColorsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFilesGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFilesGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFilesGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFilesGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFontsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFontsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFontsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidFontsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidImagesGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidImagesGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidImagesGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidImagesGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidMRGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidMRGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidMRGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidMRGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidPluralsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidPluralsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidPluralsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidPluralsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleColorsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleColorsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleColorsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleColorsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleFilesGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleFilesGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleFilesGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleFilesGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleFontsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleFontsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleFontsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleFontsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleGeneratorHelper.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleGeneratorHelper.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleGeneratorHelper.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleGeneratorHelper.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleImagesGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleImagesGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleImagesGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleImagesGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleMRGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleMRGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleMRGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleMRGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/ApplePluralsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/ApplePluralsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/ApplePluralsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/ApplePluralsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt similarity index 78% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt index f9fa791c..2e6798f7 100644 --- a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt +++ b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt @@ -10,8 +10,12 @@ import dev.icerock.gradle.generator.apple.AppleMRGenerator.Companion.BUNDLE_PROP import dev.icerock.gradle.generator.KeyType import dev.icerock.gradle.generator.ObjectBodyExtendable import dev.icerock.gradle.generator.StringsGenerator +import org.apache.commons.text.StringEscapeUtils import org.gradle.api.file.FileTree +import org.gradle.internal.impldep.com.googlecode.jatl.Html import java.io.File +import java.net.URLDecoder +import java.nio.charset.Charset @Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") class AppleStringsGenerator( @@ -43,7 +47,9 @@ class AppleStringsGenerator( val localizableFile = File(resDir, "Localizable.strings") resDir.mkdirs() - val content = strings.map { (key, value) -> + val content = strings.mapValues { (_, value) -> + convertXmlStringToAppleLocalization(value) + }.map { (key, value) -> "\"$key\" = \"$value\";" }.joinToString("\n") localizableFile.writeText(content) @@ -55,4 +61,10 @@ class AppleStringsGenerator( regionFile.writeText(content) } } + + private fun convertXmlStringToAppleLocalization(input: String): String { + val xmlDecoded = StringEscapeUtils.unescapeXml(input) + return xmlDecoded.replace("\n", "\\n") + .replace("\"", "\\\"") + } } diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/LoadableBundle.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/LoadableBundle.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/LoadableBundle.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/LoadableBundle.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonColorsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonColorsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonColorsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonColorsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFilesGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFilesGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFilesGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFilesGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFontsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFontsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFontsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonFontsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonImagesGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonImagesGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonImagesGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonImagesGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonMRGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonMRGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonMRGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonMRGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonPluralsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonPluralsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonPluralsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonPluralsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonStringsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonStringsGenerator.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonStringsGenerator.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/generator/common/CommonStringsGenerator.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppEntryPointTask.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppTask.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppTask.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppTask.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/CopyFrameworkResourcesToAppTask.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/GenerateMultiplatformResourcesTask.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/GenerateMultiplatformResourcesTask.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/GenerateMultiplatformResourcesTask.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/tasks/GenerateMultiplatformResourcesTask.kt diff --git a/plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt similarity index 100% rename from plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt rename to resources-generator/src/main/kotlin/dev/icerock/gradle/utils/ArgbColor.kt diff --git a/plugins/resources-generator/src/main/resources/META-INF/gradle-plugins/dev.icerock.mobile.multiplatform-resources.properties b/resources-generator/src/main/resources/META-INF/gradle-plugins/dev.icerock.mobile.multiplatform-resources.properties similarity index 100% rename from plugins/resources-generator/src/main/resources/META-INF/gradle-plugins/dev.icerock.mobile.multiplatform-resources.properties rename to resources-generator/src/main/resources/META-INF/gradle-plugins/dev.icerock.mobile.multiplatform-resources.properties diff --git a/resources/build.gradle.kts b/resources/build.gradle.kts index 1965c0b3..e9c9c64e 100644 --- a/resources/build.gradle.kts +++ b/resources/build.gradle.kts @@ -3,11 +3,11 @@ */ plugins { - plugin(Deps.Plugins.androidLibrary) - plugin(Deps.Plugins.kotlinMultiplatform) - plugin(Deps.Plugins.kotlinParcelize) - plugin(Deps.Plugins.mobileMultiplatform) - plugin(Deps.Plugins.mavenPublish) + id("com.android.library") + id("org.jetbrains.kotlin.multiplatform") + id("dev.icerock.mobile.multiplatform") + id("kotlin-parcelize") + id("org.gradle.maven-publish") } group = "dev.icerock.moko" diff --git a/sample/android-app/build.gradle.kts b/sample/android-app/build.gradle.kts index ef2f7b82..f3b49194 100644 --- a/sample/android-app/build.gradle.kts +++ b/sample/android-app/build.gradle.kts @@ -3,8 +3,8 @@ */ plugins { - plugin(Deps.Plugins.androidApplication) - plugin(Deps.Plugins.kotlinAndroid) + id("com.android.application") + id("kotlin-android") } android { diff --git a/sample/mpp-hierarhical/mpp_hierarhical.podspec b/sample/mpp-hierarhical/mpp_hierarhical.podspec index 79035799..712ecf11 100644 --- a/sample/mpp-hierarhical/mpp_hierarhical.podspec +++ b/sample/mpp-hierarhical/mpp_hierarhical.podspec @@ -19,7 +19,7 @@ Pod::Spec.new do |spec| spec.pod_target_xcconfig = { 'KOTLIN_TARGET[sdk=iphonesimulator*]' => 'ios_x64', 'KOTLIN_TARGET[sdk=iphoneos*]' => 'ios_arm', - 'KOTLIN_TARGET[sdk=watchsimulator*]' => 'watchos_x86', + 'KOTLIN_TARGET[sdk=watchsimulator*]' => 'watchos_x64', 'KOTLIN_TARGET[sdk=watchos*]' => 'watchos_arm', 'KOTLIN_TARGET[sdk=appletvsimulator*]' => 'tvos_x64', 'KOTLIN_TARGET[sdk=appletvos*]' => 'tvos_arm64', diff --git a/sample/mpp-hierarhical/src/clientTest/kotlin/Test.kt b/sample/mpp-hierarhical/src/clientTest/kotlin/Test.kt index 5498dd11..aad04480 100644 --- a/sample/mpp-hierarhical/src/clientTest/kotlin/Test.kt +++ b/sample/mpp-hierarhical/src/clientTest/kotlin/Test.kt @@ -14,4 +14,20 @@ class Test : BaseUnitTest() { val rawString = stringDesc.getString() assertEquals(expected = "test", actual = rawString) } + + @Test + fun `test multiline string`() { + val stringDesc = MR.strings.multilined.desc() + val rawString = stringDesc.getString() + assertEquals(expected = """first line +second line +third line.""", actual = rawString) + } + + @Test + fun `test quotes string`() { + val stringDesc = MR.strings.quotes.desc() + val rawString = stringDesc.getString() + assertEquals(expected = """Alex009 said "hello world" & "write tests".""", actual = rawString) + } } diff --git a/sample/mpp-library/build.gradle.kts b/sample/mpp-library/build.gradle.kts index 7f7aa012..c6304756 100644 --- a/sample/mpp-library/build.gradle.kts +++ b/sample/mpp-library/build.gradle.kts @@ -3,11 +3,11 @@ */ plugins { - plugin(Deps.Plugins.androidLibrary) - plugin(Deps.Plugins.kotlinMultiplatform) - plugin(Deps.Plugins.mobileMultiplatform) - plugin(Deps.Plugins.appleFramework) - plugin(Deps.Plugins.mokoResources) + id("com.android.library") + id("org.jetbrains.kotlin.multiplatform") + id("dev.icerock.mobile.multiplatform") + id("dev.icerock.mobile.multiplatform.apple-framework") + id("dev.icerock.mobile.multiplatform-resources") } android { diff --git a/sample/mpp-library/nested-module/build.gradle.kts b/sample/mpp-library/nested-module/build.gradle.kts index a825cb3c..73309a3f 100644 --- a/sample/mpp-library/nested-module/build.gradle.kts +++ b/sample/mpp-library/nested-module/build.gradle.kts @@ -3,10 +3,10 @@ */ plugins { - plugin(Deps.Plugins.androidLibrary) - plugin(Deps.Plugins.kotlinMultiplatform) - plugin(Deps.Plugins.mobileMultiplatform) - plugin(Deps.Plugins.mokoResources) + id("com.android.library") + id("org.jetbrains.kotlin.multiplatform") + id("dev.icerock.mobile.multiplatform") + id("dev.icerock.mobile.multiplatform-resources") } kotlin { 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..bc72cde7 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 @@ -33,6 +33,8 @@ object Testing { MR.plurals.test_plural.desc(1), MR.plurals.test_plural.desc(2), MR.plurals.test_plural.desc(3), + MR.strings.multilined.desc(), + MR.strings.quotes.desc(), nestedTest() ) } diff --git a/sample/mpp-library/src/commonMain/resources/MR/es/strings.xml b/sample/mpp-library/src/commonMain/resources/MR/es/strings.xml index 9e32eba8..8d4ddd9c 100644 --- a/sample/mpp-library/src/commonMain/resources/MR/es/strings.xml +++ b/sample/mpp-library/src/commonMain/resources/MR/es/strings.xml @@ -8,4 +8,8 @@ datos de prueba %d ELIJA LA CARTERA Y LA CANTIDAD segunda cadena %2$s primer decimal %1$d + primera linea +segunda linea +tercera linea. + Alex009 dijo "hola mundo" & "escribir pruebas". \ No newline at end of file diff --git a/sample/mpp-library/src/commonMain/resources/MR/ru/strings.xml b/sample/mpp-library/src/commonMain/resources/MR/ru/strings.xml index 053c4698..ecf5ef8b 100644 --- a/sample/mpp-library/src/commonMain/resources/MR/ru/strings.xml +++ b/sample/mpp-library/src/commonMain/resources/MR/ru/strings.xml @@ -8,4 +8,8 @@ Тестовые данные %d Выберите портфель и сумму вторая строка %2$s первое число %1$d + первая строка +вторая строка +третья строка. + Alex009 сказал "привет мир" & "пишите тесты". \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 1a10a5b5..545d531b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,7 +2,8 @@ * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */ -includeBuild("plugins") +includeBuild("resources-deps") +includeBuild("resources-generator") include(":resources") include(":sample:android-app") From e20d86a4704485543f5465a5133f07d95fd131fe Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Tue, 16 Mar 2021 17:20:27 +0700 Subject: [PATCH 03/11] #174 fix android localization bug with new lines and quotes --- resources-deps/src/main/kotlin/Deps.kt | 2 +- .../generator/android/AndroidStringsGenerator.kt | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/resources-deps/src/main/kotlin/Deps.kt b/resources-deps/src/main/kotlin/Deps.kt index 1076ff82..e97e533f 100644 --- a/resources-deps/src/main/kotlin/Deps.kt +++ b/resources-deps/src/main/kotlin/Deps.kt @@ -4,7 +4,7 @@ object Deps { private const val kotlinVersion = "1.4.31" - private const val androidGradleVersion = "4.0.1" + private const val androidGradleVersion = "4.1.2" private const val androidAppCompatVersion = "1.1.0" private const val espressoCoreVersion = "3.2.0" diff --git a/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt index 01766733..dcc0f83f 100644 --- a/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt +++ b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/android/AndroidStringsGenerator.kt @@ -9,9 +9,9 @@ import com.squareup.kotlinpoet.CodeBlock import com.squareup.kotlinpoet.KModifier import dev.icerock.gradle.generator.KeyType import dev.icerock.gradle.generator.StringsGenerator -import org.apache.commons.lang3.StringEscapeUtils import org.gradle.api.file.FileTree import java.io.File +import org.apache.commons.text.StringEscapeUtils class AndroidStringsGenerator( stringsFileTree: FileTree, @@ -53,7 +53,7 @@ class AndroidStringsGenerator( val content = strings.map { (key, value) -> val processedKey = processKey(key) - val processedValue = StringEscapeUtils.escapeXml(value) + val processedValue = convertXmlStringToAndroidLocalization(value) "\t$processedValue" }.joinToString("\n") @@ -69,4 +69,10 @@ class AndroidStringsGenerator( private fun processKey(key: String): String { return key.replace(".", "_") } + + private fun convertXmlStringToAndroidLocalization(input: String): String { + val xmlDecoded = StringEscapeUtils.unescapeXml(input) + return xmlDecoded.replace("\n", "\\n") + .replace("\"", "\\\"").let { StringEscapeUtils.escapeXml11(it) } + } } From c98b9ace4b45283bbb5f08895ed947a04daea644 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Tue, 16 Mar 2021 17:29:02 +0700 Subject: [PATCH 04/11] #174 fix publish to local --- .github/workflows/compilation-check.yml | 2 +- .github/workflows/publish.yml | 2 +- resources/build.gradle.kts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/compilation-check.yml b/.github/workflows/compilation-check.yml index e2658cad..2fcc35bf 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 publishToMavenLocal + run: ./gradlew -p resources-generator detekt build publishToMavenLocal - name: Library check run: ./gradlew detekt build publishToMavenLocal check diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6c712815..7dfa275c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,6 +15,6 @@ jobs: with: java-version: 1.8 - name: Publish plugin - run: ./gradlew -p plugins publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} + run: ./gradlew -p resources-generator 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/resources/build.gradle.kts b/resources/build.gradle.kts index e9c9c64e..daf0c433 100644 --- a/resources/build.gradle.kts +++ b/resources/build.gradle.kts @@ -60,7 +60,7 @@ kotlin { } tasks.named("publishToMavenLocal") { - val pluginPublish = gradle.includedBuild("plugins") - .task(":resources-generator:publishToMavenLocal") + val pluginPublish = gradle.includedBuild("resources-generator") + .task(":publishToMavenLocal") dependsOn(pluginPublish) } From aef2cff43e7a7c23259ffb87fd904f2390f5b892 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Tue, 16 Mar 2021 18:10:31 +0700 Subject: [PATCH 05/11] #147 fix plugin publication --- resources-generator/build.gradle.kts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources-generator/build.gradle.kts b/resources-generator/build.gradle.kts index ae47d5d1..a7e7a99d 100644 --- a/resources-generator/build.gradle.kts +++ b/resources-generator/build.gradle.kts @@ -49,6 +49,11 @@ publishing { password = System.getProperty("BINTRAY_KEY") } } + publications { + register("maven", MavenPublication::class) { + from(components["java"]) + } + } } tasks.withType().configureEach { From 9591f27f0ee93f72123cc4a5637e395b0f002f6d Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Tue, 16 Mar 2021 19:12:22 +0700 Subject: [PATCH 06/11] #174 fix detekt problems --- build.gradle.kts | 2 +- .../icerock/gradle/generator/apple/AppleStringsGenerator.kt | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index e045b9e4..75fa24f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,7 +19,7 @@ buildscript { jcenter() } dependencies { - classpath("dev.icerock.moko:resources-generator:0.15.0") + classpath("dev.icerock.moko:resources-generator") // composite build used classpath("gradle:resources-deps:1") } } diff --git a/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt index 2e6798f7..e9bb63d3 100644 --- a/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt +++ b/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/AppleStringsGenerator.kt @@ -6,16 +6,13 @@ package dev.icerock.gradle.generator.apple import com.squareup.kotlinpoet.CodeBlock import com.squareup.kotlinpoet.KModifier -import dev.icerock.gradle.generator.apple.AppleMRGenerator.Companion.BUNDLE_PROPERTY_NAME import dev.icerock.gradle.generator.KeyType import dev.icerock.gradle.generator.ObjectBodyExtendable import dev.icerock.gradle.generator.StringsGenerator +import dev.icerock.gradle.generator.apple.AppleMRGenerator.Companion.BUNDLE_PROPERTY_NAME import org.apache.commons.text.StringEscapeUtils import org.gradle.api.file.FileTree -import org.gradle.internal.impldep.com.googlecode.jatl.Html import java.io.File -import java.net.URLDecoder -import java.nio.charset.Charset @Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") class AppleStringsGenerator( From ec3ccc1d83d47822308a3206a8f2106d888cb46c Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Tue, 16 Mar 2021 19:37:25 +0700 Subject: [PATCH 07/11] #174 fix android tests expectations --- .../androidTest/java/com/icerockdev/StringResourcesTestEn.kt | 2 +- .../androidTest/java/com/icerockdev/StringResourcesTestRu.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 6315635d..e076a390 100644 --- a/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestEn.kt +++ b/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestEn.kt @@ -15,7 +15,7 @@ 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\nfirst line\nsecond line\nthird line.\nAlex009 said \"hello world\" & \"write tests\".\nnested test" override val stringDescsCheck: String get() = "test\ntest\nTest data 9\nother\nother\n10 items\nraw string\nraw string" + 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 446de4ba..755739de 100644 --- a/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestRu.kt +++ b/sample/android-app/src/androidTest/java/com/icerockdev/StringResourcesTestRu.kt @@ -15,7 +15,7 @@ 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несколько\nпервая строка\nвторая строка\nтретья строка.\nAlex009 сказал \"привет мир\" & \"пишите тесты\".\nтест вложенный" override val stringDescsCheck: String get() = "тест\nтест\nТестовые данные 9\nмного\nмного\n10 элементов\nraw string\nraw string\n" + From 7edf66c1fa8d2b6a37d1faf17c084fd31d67ae75 Mon Sep 17 00:00:00 2001 From: kilg Date: Wed, 31 Mar 2021 02:36:50 +0500 Subject: [PATCH 08/11] #168 fix incorrect generation RGBA color resources --- .../dev/icerock/gradle/generator/ColorsGenerator.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 0f661e17..81f81781 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 @@ -156,14 +156,18 @@ abstract class ColorsGenerator( protected fun replaceColorAlpha(color: String?): String? { if (color == null) return color - val alpha = color.substring(color.length - 2, color.length) - return "$alpha${color.removeRange(color.length - 2, color.length)}" + val alpha = if (isRgbFormat(color)) DefaultAlpha else color.substring(color.length - 2, color.length) + return if (isRgbFormat(color)) "$alpha$color" else "$alpha${color.removeRange(color.length - 2, color.length)}" } + private fun isRgbFormat(color: String): Boolean = color.length == RgbFormatLength + companion object { internal const val XmlColorTag = "color" internal const val XmlNodeAttrColorName = "name" internal const val XmlColorReferencePrefix = "@color/" + internal const val RgbFormatLength = 6 + internal const val DefaultAlpha = "FF" } } From ba7c47bde4ce01325841fc28a7a0fc41ac596389 Mon Sep 17 00:00:00 2001 From: Andrey Dorofeev Date: Thu, 1 Apr 2021 12:29:29 +0700 Subject: [PATCH 09/11] #170 move to mavenCentral --- .github/workflows/publish.yml | 39 +++++++++++-- README.md | 14 +++-- build.gradle.kts | 15 ++--- gradle.properties | 4 -- resources-deps/build.gradle.kts | 10 ++-- resources-deps/src/main/kotlin/Deps.kt | 5 +- resources-generator/build.gradle.kts | 78 ++++++++++++++++++++++++-- resources/build.gradle.kts | 74 ++++++++++++++++++++++-- 8 files changed, 198 insertions(+), 41 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7dfa275c..ee7f893a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,12 +1,23 @@ -name: KMP library publish +name: Create release on: - release: - types: [published] + workflow_dispatch: + inputs: + version: + description: 'Version' + default: '0.1.0' + required: true jobs: - build: + publish: + name: Publish library at mavenCentral runs-on: macOS-latest + env: + OSSRH_USER: ${{ secrets.OSSRH_USER }} + OSSRH_KEY: ${{ secrets.OSSRH_KEY }} + SIGNING_KEY_ID: ${{ secrets.SIGNING_KEYID }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_KEY: ${{ secrets.GPG_KEY_CONTENTS }} steps: - uses: actions/checkout@v1 @@ -15,6 +26,22 @@ jobs: with: java-version: 1.8 - name: Publish plugin - run: ./gradlew -p resources-generator publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} + run: ./gradlew -p resources-generator publishMavenJavaPublicationToOSSRHRepository - name: Publish library - run: ./gradlew publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} + run: ./gradlew publish + release: + name: Create release + needs: publish + runs-on: ubuntu-latest + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + commitish: ${{ github.ref }} + tag_name: release/${{ github.event.inputs.version }} + release_name: Release ${{ github.event.inputs.version }} + body: "Will be filled later" + draft: true \ No newline at end of file diff --git a/README.md b/README.md index 422dc965..41adb72e 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.4.21-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://img.shields.io/maven-central/v/dev.icerock.moko/moko-resources) ](https://repo1.maven.org/maven2/dev/icerock/moko/moko-resources) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.31-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. @@ -28,6 +28,7 @@ This is a Kotlin MultiPlatform library that provides access to the resources on - iOS version 9.0+ ## Versions +### Bintray - kotlin 1.3.50 - 0.1.0 - 0.2.0 @@ -58,24 +59,27 @@ This is a Kotlin MultiPlatform library that provides access to the resources on - 0.13.2 - 0.14.0 - 0.15.0 +### mavenCentral +- kotlin 1.4.31 + - 0.15.1 ## Installation root build.gradle ```groovy buildscript { repositories { - maven { url = "https://dl.bintray.com/icerockdev/plugins" } + mavenCentral() } dependencies { - classpath "dev.icerock.moko:resources-generator:0.15.0" + classpath "dev.icerock.moko:resources-generator:0.15.1" } } allprojects { repositories { - maven { url = "https://dl.bintray.com/icerockdev/moko" } + mavenCentral() } } ``` @@ -85,7 +89,7 @@ project build.gradle apply plugin: "dev.icerock.mobile.multiplatform-resources" dependencies { - commonMainApi("dev.icerock.moko:resources:0.15.0") + commonMainApi("dev.icerock.moko:resources:0.15.1") } multiplatformResources { diff --git a/build.gradle.kts b/build.gradle.kts index 75fa24f8..2dfdc1af 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,12 +11,7 @@ buildscript { mavenCentral() google() - maven { url = uri("https://dl.bintray.com/kotlin/kotlin") } - maven { url = uri("https://kotlin.bintray.com/kotlinx") } maven { url = uri("https://plugins.gradle.org/m2/") } - maven { url = uri("https://dl.bintray.com/icerockdev/plugins") } - - jcenter() } dependencies { classpath("dev.icerock.moko:resources-generator") // composite build used @@ -29,11 +24,11 @@ allprojects { mavenCentral() google() - maven { url = uri("https://kotlin.bintray.com/kotlin") } - maven { url = uri("https://kotlin.bintray.com/kotlinx") } - maven { url = uri("https://dl.bintray.com/icerockdev/moko") } - - jcenter() + jcenter { + content { + includeGroup("org.jetbrains.trove4j") + } + } } apply(plugin = "io.gitlab.arturbosch.detekt") diff --git a/gradle.properties b/gradle.properties index ca690dd3..53a36a70 100755 --- a/gradle.properties +++ b/gradle.properties @@ -9,8 +9,4 @@ kotlin.mpp.enableCompatibilityMetadataVariant=true android.useAndroidX=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 diff --git a/resources-deps/build.gradle.kts b/resources-deps/build.gradle.kts index e8fe1055..a57be1d6 100644 --- a/resources-deps/build.gradle.kts +++ b/resources-deps/build.gradle.kts @@ -10,13 +10,15 @@ repositories { mavenCentral() google() - maven { url = uri("https://dl.bintray.com/icerockdev/plugins") } - - jcenter() + jcenter { + content { + includeGroup("org.jetbrains.trove4j") + } + } } dependencies { - api("dev.icerock:mobile-multiplatform:0.9.0") + api("dev.icerock:mobile-multiplatform:0.9.1") api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31") api("com.android.tools.build:gradle:4.1.2") } diff --git a/resources-deps/src/main/kotlin/Deps.kt b/resources-deps/src/main/kotlin/Deps.kt index e97e533f..76d5cf01 100644 --- a/resources-deps/src/main/kotlin/Deps.kt +++ b/resources-deps/src/main/kotlin/Deps.kt @@ -17,8 +17,8 @@ object Deps { private const val detektVersion = "1.15.0" - private const val mokoGraphicsVersion = "0.5.0" - private const val mokoParcelizeVersion = "0.5.0" + private const val mokoGraphicsVersion = "0.6.1" + private const val mokoParcelizeVersion = "0.6.1" const val mokoResourcesVersion = "0.15.1" object Android { @@ -38,6 +38,7 @@ object Deps { val kotlinParcelize = GradlePlugin(id = "kotlin-parcelize") val kotlinSerialization = GradlePlugin(id = "kotlin-serialization") val mavenPublish = GradlePlugin(id = "org.gradle.maven-publish") + val signing = GradlePlugin(id = "signing") val mobileMultiplatform = GradlePlugin(id = "dev.icerock.mobile.multiplatform") val appleFramework = GradlePlugin(id = "dev.icerock.mobile.multiplatform.apple-framework") diff --git a/resources-generator/build.gradle.kts b/resources-generator/build.gradle.kts index a7e7a99d..498fe24d 100644 --- a/resources-generator/build.gradle.kts +++ b/resources-generator/build.gradle.kts @@ -2,10 +2,14 @@ * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */ +import java.util.Base64 +import kotlin.text.String + plugins { id("org.jetbrains.kotlin.jvm") version ("1.4.31") id("org.gradle.maven-publish") id("io.gitlab.arturbosch.detekt") version ("1.15.0") + id("signing") } buildscript { @@ -13,7 +17,6 @@ buildscript { mavenCentral() google() - maven { url = uri("https://dl.bintray.com/icerockdev/plugins") } } dependencies { classpath("gradle:resources-deps:1") @@ -23,7 +26,12 @@ buildscript { repositories { mavenCentral() google() - jcenter() + + jcenter { + content { + includeGroup("org.jetbrains.trove4j") + } + } } group = "dev.icerock.moko" @@ -40,18 +48,76 @@ dependencies { detektPlugins(Deps.Libs.Jvm.detektFormatting) } +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + withJavadocJar() + withSourcesJar() +} + publishing { - repositories.maven("https://api.bintray.com/maven/icerockdev/plugins/moko-resources-generator/;publish=1") { + repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { name = "bintray" credentials { - username = System.getProperty("BINTRAY_USER") - password = System.getProperty("BINTRAY_KEY") + username = System.getenv("OSSRH_USER") + password = System.getenv("OSSRH_KEY") } } publications { - register("maven", MavenPublication::class) { + register("mavenJava", MavenPublication::class) { from(components["java"]) + pom { + name.set("MOKO resources gradle plugin") + description.set("Gradle plugin for generation resources for android and iOS from common resources") + url.set("https://github.com/icerockdev/moko-resources") + licenses { + license { + url.set("https://github.com/icerockdev/moko-resources/blob/master/LICENSE.md") + } + } + + developers { + developer { + id.set("Alex009") + name.set("Aleksey Mikhailov") + email.set("aleksey.mikhailov@icerockdev.com") + } + developer { + id.set("Tetraquark") + name.set("Vladislav Areshkin") + email.set("vareshkin@icerockdev.com") + } + developer { + id.set("ATchernov") + name.set("Andrey Tchernov") + email.set("tchernov@icerockdev.com") + } + developer { + id.set("nrobi144") + name.set("Nagy Robert") + email.set("nagyrobi144@gmail.com") + } + } + + scm { + connection.set("scm:git:ssh://github.com/icerockdev/moko-resources.git") + developerConnection.set("scm:git:ssh://github.com/icerockdev/moko-resources.git") + url.set("https://github.com/icerockdev/moko-resources") + } + } + } + + signing { + val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") + val signingPassword: String? = System.getenv("SIGNING_PASSWORD") + val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> + String(Base64.getDecoder().decode(base64Key)) + } + if (signingKeyId != null) { + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign(publishing.publications["mavenJava"]) + } } } } diff --git a/resources/build.gradle.kts b/resources/build.gradle.kts index daf0c433..daf97435 100644 --- a/resources/build.gradle.kts +++ b/resources/build.gradle.kts @@ -2,12 +2,16 @@ * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */ +import java.util.Base64 +import kotlin.text.String + plugins { id("com.android.library") id("org.jetbrains.kotlin.multiplatform") id("dev.icerock.mobile.multiplatform") id("kotlin-parcelize") id("org.gradle.maven-publish") + id("signing") } group = "dev.icerock.moko" @@ -20,13 +24,75 @@ dependencies { androidMainImplementation(Deps.Libs.Android.appCompat) } +val javadocJar by tasks.registering(Jar::class) { + archiveClassifier.set("javadoc") +} + publishing { - repositories.maven("https://api.bintray.com/maven/icerockdev/moko/moko-resources/;publish=1") { - name = "bintray" + repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { + name = "OSSRH" credentials { - username = System.getProperty("BINTRAY_USER") - password = System.getProperty("BINTRAY_KEY") + username = System.getenv("OSSRH_USER") + password = System.getenv("OSSRH_KEY") + } + } + + publications.withType { + // Stub javadoc.jar artifact + artifact(javadocJar.get()) + + // Provide artifacts information requited by Maven Central + pom { + name.set("MOKO resources") + description.set("Resources access for mobile (android & ios) Kotlin Multiplatform development") + url.set("https://github.com/icerockdev/moko-resources") + licenses { + license { + url.set("https://github.com/icerockdev/moko-resources/blob/master/LICENSE.md") + } + } + + developers { + developer { + id.set("Alex009") + name.set("Aleksey Mikhailov") + email.set("aleksey.mikhailov@icerockdev.com") + } + developer { + id.set("Tetraquark") + name.set("Vladislav Areshkin") + email.set("vareshkin@icerockdev.com") + } + developer { + id.set("ATchernov") + name.set("Andrey Tchernov") + email.set("tchernov@icerockdev.com") + } + developer { + id.set("nrobi144") + name.set("Nagy Robert") + email.set("nagyrobi144@gmail.com") + } + } + + scm { + connection.set("scm:git:ssh://github.com/icerockdev/moko-resources.git") + developerConnection.set("scm:git:ssh://github.com/icerockdev/moko-resources.git") + url.set("https://github.com/icerockdev/moko-resources") + } + } + } + + signing { + val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") + val signingPassword: String? = System.getenv("SIGNING_PASSWORD") + val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> + String(Base64.getDecoder().decode(base64Key)) + } + if (signingKeyId != null) { + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign(publishing.publications) } } } From b4b0bab59d8b1d7605a4c8ff5ad87205f290479e Mon Sep 17 00:00:00 2001 From: Andrey Dorofeev Date: Thu, 1 Apr 2021 13:56:46 +0700 Subject: [PATCH 10/11] #170 detekt dependencies fix, review fixes --- README.md | 2 +- build.gradle.kts | 3 ++- resources-generator/build.gradle.kts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 41adb72e..f51e605a 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://img.shields.io/maven-central/v/dev.icerock.moko/moko-resources) ](https://repo1.maven.org/maven2/dev/icerock/moko/moko-resources) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.31-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://img.shields.io/maven-central/v/dev.icerock.moko/resources) ](https://repo1.maven.org/maven2/dev/icerock/moko/moko-resources) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.31-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. diff --git a/build.gradle.kts b/build.gradle.kts index 2dfdc1af..0e9e3375 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ buildscript { mavenCentral() google() - maven { url = uri("https://plugins.gradle.org/m2/") } + gradlePluginPortal() } dependencies { classpath("dev.icerock.moko:resources-generator") // composite build used @@ -27,6 +27,7 @@ allprojects { jcenter { content { includeGroup("org.jetbrains.trove4j") + includeModule("org.jetbrains.kotlinx", "kotlinx-html-jvm") } } } diff --git a/resources-generator/build.gradle.kts b/resources-generator/build.gradle.kts index 498fe24d..91e35b93 100644 --- a/resources-generator/build.gradle.kts +++ b/resources-generator/build.gradle.kts @@ -57,7 +57,7 @@ java { publishing { repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { - name = "bintray" + name = "OSSRH" credentials { username = System.getenv("OSSRH_USER") @@ -116,7 +116,7 @@ publishing { } if (signingKeyId != null) { useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) - sign(publishing.publications["mavenJava"]) + sign(publishing.publications) } } } From d52fc2810a78a2f809fd1980053b2651ebb3f8de Mon Sep 17 00:00:00 2001 From: Andrey Dorofeev Date: Thu, 1 Apr 2021 14:03:51 +0700 Subject: [PATCH 11/11] #170 fixed detekt dependencies for plugin --- resources-generator/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/resources-generator/build.gradle.kts b/resources-generator/build.gradle.kts index 91e35b93..1ec78e70 100644 --- a/resources-generator/build.gradle.kts +++ b/resources-generator/build.gradle.kts @@ -30,6 +30,7 @@ repositories { jcenter { content { includeGroup("org.jetbrains.trove4j") + includeModule("org.jetbrains.kotlinx", "kotlinx-html-jvm") } } }