Skip to content

Commit 942c930

Browse files
0xeraMinhNguyen-nvm
authored andcommitted
support kotlin multiplatform modules
generate classes in kmp module add KmpJarAppSizeVariant
1 parent 26a0a97 commit 942c930

File tree

100 files changed

+8895
-35
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+8895
-35
lines changed

sample/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ android {
9393
dependencies {
9494
implementation project(":android-module-level1")
9595
implementation project(":kotlin-module")
96+
implementation project(":kotlin-multiplatform-module")
9697
implementation libs.androidx.appcompat
9798
implementation libs.androidx.navigation.ktx
9899
implementation libs.androidx.navigation.fragment.ktx

sample/build-logic/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,9 @@ gradlePlugin {
5555
id = 'com.sample.kotlin.library'
5656
implementationClass = 'com.grab.sample.buildplugin.KotlinLibraryConfigPlugin'
5757
}
58+
kotlinMultiplatformLibConfigPlugin {
59+
id = 'com.sample.kotlin.multiplatform.library'
60+
implementationClass = 'com.grab.sample.buildplugin.KotlinMultiplatformLibraryConfigPlugin'
61+
}
5862
}
5963
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.grab.sample.buildplugin
2+
3+
import org.gradle.api.Plugin
4+
import org.gradle.api.Project
5+
import org.gradle.kotlin.dsl.getByType
6+
import org.gradle.kotlin.dsl.withType
7+
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
8+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
9+
10+
class KotlinMultiplatformLibraryConfigPlugin : Plugin<Project> {
11+
override fun apply(project: Project) {
12+
with(project) {
13+
plugins.apply("org.jetbrains.kotlin.multiplatform")
14+
15+
extensions.getByType<KotlinMultiplatformExtension>().apply {
16+
jvm()
17+
jvmToolchain(JAVA_VERSION.toString().toInt())
18+
}
19+
20+
tasks.withType<KotlinCompile>().configureEach {
21+
kotlinOptions {
22+
jvmTarget = JVM_TARGET
23+
}
24+
}
25+
}
26+
}
27+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2024. Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
5+
*
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
*
15+
* The above copyright notice and this permission notice shall be included in all
16+
* copies or substantial portions of the Software.
17+
*
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
* SOFTWARE
26+
*/
27+
28+
plugins {
29+
id 'com.sample.kotlin.multiplatform.library'
30+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2025. Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
5+
*
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
*
15+
* The above copyright notice and this permission notice shall be included in all
16+
* copies or substantial portions of the Software.
17+
*
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
* SOFTWARE
26+
*/
27+
28+
package com.grab.sample.dummy
29+
30+
class KMPDummyClass1 {
31+
32+
fun method1(): String {
33+
method2()
34+
method3()
35+
method4()
36+
method5()
37+
method6()
38+
method7()
39+
method8()
40+
method9()
41+
method10()
42+
return KMPDummyClass2().method1()
43+
}
44+
45+
fun method2(): String {
46+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
47+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
48+
return str1 + str2
49+
}
50+
51+
fun method3(): String {
52+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
53+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
54+
return str1 + str2
55+
}
56+
57+
fun method4(): String {
58+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
59+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
60+
return str1 + str2
61+
}
62+
63+
fun method5(): String {
64+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
65+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
66+
return str1 + str2
67+
}
68+
69+
fun method6(): String {
70+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
71+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
72+
return str1 + str2
73+
}
74+
75+
fun method7(): String {
76+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
77+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
78+
return str1 + str2
79+
}
80+
81+
fun method8(): String {
82+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
83+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
84+
return str1 + str2
85+
}
86+
87+
fun method9(): String {
88+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
89+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
90+
return str1 + str2
91+
}
92+
93+
fun method10(): String {
94+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
95+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
96+
return str1 + str2
97+
}
98+
99+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2025. Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
5+
*
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
*
15+
* The above copyright notice and this permission notice shall be included in all
16+
* copies or substantial portions of the Software.
17+
*
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
* SOFTWARE
26+
*/
27+
28+
package com.grab.sample.dummy
29+
30+
class KMPDummyClass10 {
31+
32+
fun method1(): String {
33+
method2()
34+
method3()
35+
method4()
36+
method5()
37+
method6()
38+
method7()
39+
method8()
40+
method9()
41+
method10()
42+
return KMPDummyClass11().method1()
43+
}
44+
45+
fun method2(): String {
46+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
47+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
48+
return str1 + str2
49+
}
50+
51+
fun method3(): String {
52+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
53+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
54+
return str1 + str2
55+
}
56+
57+
fun method4(): String {
58+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
59+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
60+
return str1 + str2
61+
}
62+
63+
fun method5(): String {
64+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
65+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
66+
return str1 + str2
67+
}
68+
69+
fun method6(): String {
70+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
71+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
72+
return str1 + str2
73+
}
74+
75+
fun method7(): String {
76+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
77+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
78+
return str1 + str2
79+
}
80+
81+
fun method8(): String {
82+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
83+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
84+
return str1 + str2
85+
}
86+
87+
fun method9(): String {
88+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
89+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
90+
return str1 + str2
91+
}
92+
93+
fun method10(): String {
94+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
95+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
96+
return str1 + str2
97+
}
98+
99+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2025. Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
5+
*
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
*
15+
* The above copyright notice and this permission notice shall be included in all
16+
* copies or substantial portions of the Software.
17+
*
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
* SOFTWARE
26+
*/
27+
28+
package com.grab.sample.dummy
29+
30+
class KMPDummyClass11 {
31+
32+
fun method1(): String {
33+
method2()
34+
method3()
35+
method4()
36+
method5()
37+
method6()
38+
method7()
39+
method8()
40+
method9()
41+
method10()
42+
return KMPDummyClass12().method1()
43+
}
44+
45+
fun method2(): String {
46+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
47+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
48+
return str1 + str2
49+
}
50+
51+
fun method3(): String {
52+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
53+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
54+
return str1 + str2
55+
}
56+
57+
fun method4(): String {
58+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
59+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
60+
return str1 + str2
61+
}
62+
63+
fun method5(): String {
64+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
65+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
66+
return str1 + str2
67+
}
68+
69+
fun method6(): String {
70+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
71+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
72+
return str1 + str2
73+
}
74+
75+
fun method7(): String {
76+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
77+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
78+
return str1 + str2
79+
}
80+
81+
fun method8(): String {
82+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
83+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
84+
return str1 + str2
85+
}
86+
87+
fun method9(): String {
88+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
89+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
90+
return str1 + str2
91+
}
92+
93+
fun method10(): String {
94+
val str1 = (1..5).map { ('a'..'z').random() }.joinToString("")
95+
val str2 = (1..5).map { ('a'..'z').random() }.joinToString("")
96+
return str1 + str2
97+
}
98+
99+
}

0 commit comments

Comments
 (0)