Skip to content

Commit

Permalink
#58 added samples of different target configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex009 committed Apr 20, 2020
1 parent fd30dde commit 182e3ca
Show file tree
Hide file tree
Showing 20 changed files with 216 additions and 12 deletions.
8 changes: 3 additions & 5 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
plugins {
`kotlin-dsl`
id("org.gradle.kotlin.kotlin-dsl") version "1.3.6"
}

repositories {
mavenLocal()

jcenter()
google()

Expand All @@ -13,8 +11,8 @@ repositories {

dependencies {
implementation("dev.icerock:mobile-multiplatform:0.6.1")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71")
implementation("com.android.tools.build:gradle:3.6.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72")
implementation("com.android.tools.build:gradle:3.6.3")
}

kotlinDslPluginOptions {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ object Deps {
"kotlin-android" to Plugins.kotlin,
"dev.icerock.mobile.multiplatform-resources" to Plugins.mokoResources
)
}
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ object Versions {
const val kotlinPoet = "1.3.0"
}
}
}
}
44 changes: 44 additions & 0 deletions sample/mpp-conditional/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.multiplatform")
id("dev.icerock.mobile.multiplatform-resources")
}

android {
compileSdkVersion(Versions.Android.compileSdk)

defaultConfig {
minSdkVersion(Versions.Android.minSdk)
targetSdkVersion(Versions.Android.targetSdk)
}
}

kotlin {
android()
val onPhone = System.getenv("SDK_NAME")?.startsWith("iphoneos") ?: false
if (onPhone) {
iosArm64("ios")
} else {
iosX64("ios")
}

targets.getByName<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>("ios") {
binaries.framework {
baseName = "MultiPlatformLibrary"
isStatic = false
}
}
}

dependencies {
commonMainImplementation("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}")
commonMainImplementation("dev.icerock.moko:resources:${Versions.Libs.MultiPlatform.mokoResources}")
}

multiplatformResources {
multiplatformResourcesPackage = "com.icerockdev.library"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package com.icerockdev.library

fun test() {

}
1 change: 1 addition & 0 deletions sample/mpp-conditional/src/commonMain/resources
2 changes: 2 additions & 0 deletions sample/mpp-conditional/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.icerockdev.library"/>
32 changes: 32 additions & 0 deletions sample/mpp-hierarhical/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.multiplatform")
id("dev.icerock.mobile.multiplatform-resources")
}

android {
compileSdkVersion(Versions.Android.compileSdk)

defaultConfig {
minSdkVersion(Versions.Android.minSdk)
targetSdkVersion(Versions.Android.targetSdk)
}
}

kotlin {
android()
ios()
}

dependencies {
commonMainImplementation("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}")
commonMainImplementation("dev.icerock.moko:resources:${Versions.Libs.MultiPlatform.mokoResources}")
}

multiplatformResources {
multiplatformResourcesPackage = "com.icerockdev.library"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package com.icerockdev.library

fun test() {

}
1 change: 1 addition & 0 deletions sample/mpp-hierarhical/src/commonMain/resources
2 changes: 2 additions & 0 deletions sample/mpp-hierarhical/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.icerockdev.library"/>
27 changes: 27 additions & 0 deletions sample/mpp-library/src/commonMain/resources/MR/es/plurals.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<plural name="test.plural">
<item quantity="zero">cero</item>
<item quantity="one">uno</item>
<item quantity="two">dos</item>
<item quantity="few">algo</item>
<item quantity="many">mucho</item>
<item quantity="other">otro</item>
</plural>
<plural name="my_plural">
<item quantity="zero">cero</item>
<item quantity="one">uno</item>
<item quantity="two">dos</item>
<item quantity="few">algo</item>
<item quantity="many">mucho</item>
<item quantity="other">otro</item>
</plural>
<plural name="myPlural">
<item quantity="zero">cero</item>
<item quantity="one">uno</item>
<item quantity="two">dos</item>
<item quantity="few">algo</item>
<item quantity="many">mucho</item>
<item quantity="other">otro</item>
</plural>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<string name="test.simple">prueba</string>
<string name="test2">prueba 2</string>
<string name="test3">prueba 3</string>
<string name="Test4">prueba 4</string>
<string name="common.name">proyecto de prueba</string>
<string name="format">datos de prueba %d</string>
<string name="encoding">ELIJA LA CARTERA Y LA CANTIDAD</string>
Expand Down
18 changes: 13 additions & 5 deletions sample/mpp-library/src/commonMain/resources/MR/ru/plurals.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<resources>
<plural name="test.plural">
<item quantity="zero">ноль</item>
<item quantity="one">один</item>
<item quantity="two">два</item>
<item quantity="few">несколько</item>
<item quantity="many">много</item>
<item quantity="other">другое</item>
<item quantity="one">%d - один</item>
<item quantity="two">%d - два</item>
<item quantity="few">%d - несколько</item>
<item quantity="many">%d - много</item>
<item quantity="other">%d - другое</item>
</plural>
<plural name="my_plural">
<item quantity="zero">нет элементов</item>
Expand All @@ -16,4 +16,12 @@
<item quantity="many">%d элементов</item>
<item quantity="other">%d элемента</item>
</plural>
<plural name="myPlural">
<item quantity="zero">нет элементов</item>
<item quantity="one">%d элемент</item>
<item quantity="two">%d элемента</item>
<item quantity="few">%d элементов</item>
<item quantity="many">%d элементов</item>
<item quantity="other">%d элемента</item>
</plural>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<string name="test.simple">тест</string>
<string name="test2">тест 2</string>
<string name="test3">тест 3</string>
<string name="Test4">тест 4</string>
<string name="common.name">Тестовый проект</string>
<string name="format">Тестовые данные %d</string>
<string name="encoding">Выберите портфель и сумму</string>
Expand Down
54 changes: 54 additions & 0 deletions sample/mpp-mixed/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.multiplatform")
id("dev.icerock.mobile.multiplatform-resources")
}

android {
compileSdkVersion(Versions.Android.compileSdk)

defaultConfig {
minSdkVersion(Versions.Android.minSdk)
targetSdkVersion(Versions.Android.targetSdk)
}
}

kotlin {
android()
iosX64 {
binaries.framework {
baseName = "MultiPlatformLibrary"
isStatic = false
}
}
iosArm64 {
binaries.framework {
baseName = "MultiPlatformLibrary"
isStatic = false
}
}

sourceSets {
val iosX64Main by getting {}
val iosX64Test by getting {}
val iosArm64Main by getting {
dependsOn(iosX64Main)
}
val iosArm64Test by getting {
dependsOn(iosX64Test)
}
}
}

dependencies {
commonMainImplementation("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}")
commonMainImplementation("dev.icerock.moko:resources:${Versions.Libs.MultiPlatform.mokoResources}")
}

multiplatformResources {
multiplatformResourcesPackage = "com.icerockdev.library"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package com.icerockdev.library

fun test() {

}
1 change: 1 addition & 0 deletions sample/mpp-mixed/src/commonMain/resources
2 changes: 2 additions & 0 deletions sample/mpp-mixed/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.icerockdev.library"/>
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ include(":gradle-plugin")
if(!libraryPublish) {
include(":sample:android-app")
include(":sample:mpp-library")
include(":sample:mpp-conditional")
include(":sample:mpp-hierarhical")
include(":sample:mpp-mixed")
}

0 comments on commit 182e3ca

Please sign in to comment.