Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support kotlin multiplatform modules #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ android {
dependencies {
implementation project(":android-module-level1")
implementation project(":kotlin-module")
implementation project(":kotlin-multiplatform-module")
implementation libs.androidx.appcompat
implementation libs.androidx.navigation.ktx
implementation libs.androidx.navigation.fragment.ktx
Expand Down
4 changes: 4 additions & 0 deletions sample/build-logic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,9 @@ gradlePlugin {
id = 'com.sample.kotlin.library'
implementationClass = 'com.grab.sample.buildplugin.KotlinLibraryConfigPlugin'
}
kotlinMultiplatformLibConfigPlugin {
id = 'com.sample.kotlin.multiplatform.library'
implementationClass = 'com.grab.sample.buildplugin.KotlinMultiplatformLibraryConfigPlugin'
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.grab.sample.buildplugin

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

class KotlinMultiplatformLibraryConfigPlugin : Plugin<Project> {
override fun apply(project: Project) {
with(project) {
plugins.apply("org.jetbrains.kotlin.multiplatform")

extensions.getByType<KotlinMultiplatformExtension>().apply {
jvm()
jvmToolchain(JAVA_VERSION.toString().toInt())
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JVM_TARGET
}
}
}
}
}
30 changes: 30 additions & 0 deletions sample/kotlin-multiplatform-module/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* MIT License
*
* Copyright (c) 2024. Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE
*/

plugins {
id 'com.sample.kotlin.multiplatform.library'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* MIT License
*
* Copyright (c) 2025. Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE
*/

package com.grab.sample.dummy

class KMPDummyClass1 {

fun method1(): String {
method2()
method3()
method4()
method5()
method6()
method7()
method8()
method9()
method10()
return KMPDummyClass2().method1()
}

fun method2(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method3(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method4(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method5(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method6(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method7(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method8(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method9(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method10(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* MIT License
*
* Copyright (c) 2025. Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE
*/

package com.grab.sample.dummy

class KMPDummyClass10 {

fun method1(): String {
method2()
method3()
method4()
method5()
method6()
method7()
method8()
method9()
method10()
return KMPDummyClass11().method1()
}

fun method2(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method3(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method4(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method5(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method6(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method7(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method8(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method9(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method10(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* MIT License
*
* Copyright (c) 2025. Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE
*/

package com.grab.sample.dummy

class KMPDummyClass11 {

fun method1(): String {
method2()
method3()
method4()
method5()
method6()
method7()
method8()
method9()
method10()
return KMPDummyClass12().method1()
}

fun method2(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method3(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method4(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method5(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method6(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method7(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method8(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method9(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

fun method10(): String {
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
return str1 + str2
}

}
Loading
Loading