Skip to content

Commit e209b52

Browse files
committed
feat:使用KMP组织工程
1 parent 12d3c7f commit e209b52

File tree

87 files changed

+78
-33
lines changed

Some content is hidden

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

87 files changed

+78
-33
lines changed

README.md

+1-1

build.gradle.kts

+41-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
22

33
plugins {
4-
kotlin("jvm")
4+
kotlin("multiplatform")
55
id("org.jetbrains.compose")
66
}
77

@@ -14,24 +14,46 @@ repositories {
1414
google()
1515
}
1616

17-
dependencies {
18-
// Note, if you develop a library, you should use compose.desktop.common.
19-
// compose.desktop.currentOs should be used in launcher-sourceSet
20-
// (in a separate module for demo project and in testMain).
21-
// With compose.desktop.common you will also lose @Preview functionality
22-
// implementation(compose.desktop.currentOs){
23-
// exclude("org.jetbrains.compose.material")
24-
// }
25-
implementation(compose.desktop.linux_x64)
26-
implementation(compose.desktop.linux_arm64)
27-
implementation(compose.desktop.windows_x64)
28-
implementation(compose.desktop.macos_x64)
29-
implementation(compose.desktop.macos_arm64)
30-
// https://mvnrepository.com/artifact/com.formdev/flatlaf
31-
// runtimeOnly("com.formdev:flatlaf:3.4.1")
32-
33-
implementation(compose.material3)
34-
implementation(project(":kra"))
17+
kotlin {
18+
jvm{
19+
withJava()
20+
}
21+
jvmToolchain(17)
22+
23+
24+
sourceSets {
25+
// val desktopMain by getting
26+
27+
// val commonMain by getting{
28+
//
29+
// }
30+
val jvmMain by getting{
31+
dependencies {
32+
// Note, if you develop a library, you should use compose.desktop.common.
33+
// compose.desktop.currentOs should be used in launcher-sourceSet
34+
// (in a separate module for demo project and in testMain).
35+
// With compose.desktop.common you will also lose @Preview functionality
36+
// implementation(compose.desktop.currentOs){
37+
// exclude("org.jetbrains.compose.material")
38+
// }
39+
implementation(compose.desktop.linux_x64)
40+
implementation(compose.desktop.linux_arm64)
41+
implementation(compose.desktop.windows_x64)
42+
implementation(compose.desktop.macos_x64)
43+
implementation(compose.desktop.macos_arm64)
44+
// https://mvnrepository.com/artifact/com.formdev/flatlaf
45+
// runtimeOnly("com.formdev:flatlaf:3.4.1")
46+
47+
implementation(compose.material3)
48+
implementation(project(":kra"))
49+
}
50+
}
51+
52+
val jvmTest by getting{
53+
dependencies {
54+
}
55+
}
56+
}
3557
}
3658

3759
compose.desktop {

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
22
kotlin.code.style=official
3-
kotlin.version=1.9.22
3+
kotlin.version=1.9.23
44
compose.version=1.6.11

kra/build.gradle.kts

+33-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
plugins {
3-
kotlin("jvm")
3+
kotlin("multiplatform")
44
}
55

66
group = "me.yricky"
@@ -11,16 +11,39 @@ repositories {
1111
// google()
1212
}
1313

14-
dependencies {
15-
testImplementation ("junit:junit:4.13.1")
16-
api("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.1")
17-
18-
// Note, if you develop a library, you should use compose.desktop.common.
19-
// compose.desktop.currentOs should be used in launcher-sourceSet
20-
// (in a separate module for demo project and in testMain).
21-
// With compose.desktop.common you will also lose @Preview functionality
22-
}
14+
//dependencies {
15+
// testImplementation ("junit:junit:4.13.1")
16+
// api("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.1")
17+
//
18+
// // Note, if you develop a library, you should use compose.desktop.common.
19+
// // compose.desktop.currentOs should be used in launcher-sourceSet
20+
// // (in a separate module for demo project and in testMain).
21+
// // With compose.desktop.common you will also lose @Preview functionality
22+
//}
2323

2424
kotlin {
25+
jvm{
26+
withJava()
27+
}
2528
jvmToolchain(17)
29+
30+
31+
sourceSets {
32+
// val desktopMain by getting
33+
34+
// val commonMain by getting{
35+
//
36+
// }
37+
val jvmMain by getting{
38+
dependencies {
39+
api("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.1")
40+
}
41+
}
42+
43+
val jvmTest by getting{
44+
dependencies {
45+
implementation("junit:junit:4.13.1")
46+
}
47+
}
48+
}
2649
}
File renamed without changes.

kra/src/test/java/me/yricky/oh/abcd/AbcHeaderTest.kt kra/src/jvmTest/java/me/yricky/oh/abcd/AbcHeaderTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import java.io.File
77
import java.nio.channels.FileChannel
88

99
class AbcHeaderTest{
10-
val file = File("/Users/yricky/Downloads/ohbili/ets/modules.abc")
10+
val file = File("/home/yricky/Downloads/modules.abc")
1111
val mmap = FileChannel.open(file.toPath()).map(FileChannel.MapMode.READ_ONLY,0,file.length())
1212
val abc = AbcBuf("",mmap)
1313

settings.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pluginManagement {
77
}
88

99
plugins {
10-
kotlin("jvm").version(extra["kotlin.version"] as String)
10+
kotlin("multiplatform").version(extra["kotlin.version"] as String)
1111
id("org.jetbrains.compose").version(extra["compose.version"] as String)
1212
}
1313
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)