Commit ea01275
authored
refactor: replace kotlinx-io with okio for file I/O (#123)
* refactor: replace kotlinx-io with okio for file I/O
Okio provides a unified cross-platform FileHandle API with built-in
random access support (positional read/write, flush, resize), eliminating
the need for the RandomAccessHandle abstraction and its per-platform
implementations (JvmRandomAccessHandle, IosRandomAccessHandle).
- Replace kotlinx-io 0.9.0 with okio 3.16.4 across all modules
- Delete RandomAccessHandle interface and JVM/Android/iOS implementations
- Rewrite PathFileAccessor to use okio FileHandle (openReadWrite)
- Add platformFileSystem expect/actual to abstract FileSystem.SYSTEM
(unavailable on WasmJs; throws UnsupportedOperationException there)
- Simplify createFileAccessor on JVM/iOS (no more handleFactory param)
- Update resolveChildPath to use okio Path division operator
- Update DownloadExecution.deduplicatePath to use okio Path/FileSystem
- Update FileConfigStore to use okio source/sink/buffer APIs
- Remove unused kotlinx-io dependency from library:sqlite
- Update GraalVM --initialize-at-build-time from kotlinx.io to okio
* feat: add JS and WasmWasi targets with real filesystem support
Replace wasmJs with js target in library:api and library:core to
enable okio-nodefilesystem (NodeJsFileSystem) for Kotlin/JS. Add
wasmWasi target with okio-wasifilesystem (WasiFileSystem) for WASI
runtimes. Remove wasmJs from these modules since app/web (the only
wasmJs consumer) only uses RemoteKetch and doesn't need core/api.
* fix: update CI to run jsNodeTest instead of wasmJsBrowserTest
The wasmJs target was replaced with js in library modules, so the
wasmJsBrowserTest/wasmJsNodeTest Gradle tasks no longer exist.
* refactor: move Ketch creation out of InstanceFactory into platform code
InstanceFactory no longer references library:core types (Ketch,
DownloadSource, TaskStore, KtorHttpEngine). Instead, each platform
(Android, Desktop, iOS) creates the embedded Ketch instance inline
and passes it as an embeddedFactory lambda.
This removes the library:core dependency from app:shared's commonMain,
allowing wasmJs builds to work without the core engine. Also restores
wasmJs target on library:api since downstream modules still need it.
* Fix kotlin targets in library modules1 parent 2c1ae06 commit ea01275
64 files changed
Lines changed: 410 additions & 367 deletions
File tree
- .github/workflows
- app
- android
- src/main/kotlin/com/linroid/ketch/app/android
- desktop
- src/main/kotlin/com/linroid/ketch/app/desktop
- cli
- config
- src
- androidMain/kotlin/com/linroid/ketch/config
- commonMain/kotlin/com/linroid/ketch/config
- iosMain/kotlin/com/linroid/ketch/config
- jvmMain/kotlin/com/linroid/ketch/config
- wasmJsMain/kotlin/com/linroid/ketch/config
- gradle
- library
- api
- src
- jsMain/kotlin/com/linroid/ketch/api
- log
- wasmJsMain/kotlin/com/linroid/ketch/api/log
- wasmWasiMain/kotlin/com/linroid/ketch/api
- log
- core
- src
- androidMain/kotlin/com/linroid/ketch/core/file
- commonMain/kotlin/com/linroid/ketch/core
- engine
- file
- iosMain/kotlin/com/linroid/ketch/core/file
- jsMain/kotlin/com/linroid/ketch/core
- file
- jvmMain/kotlin/com/linroid/ketch/core/file
- wasmJsMain/kotlin/com/linroid/ketch/core/file
- wasmWasiMain/kotlin/com/linroid/ketch/core
- file
- ftp
- kermit
- ktor
- sqlite
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
| 88 | + | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
| 101 | + | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
| |||
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| |||
86 | 91 | | |
87 | 92 | | |
88 | 93 | | |
89 | | - | |
90 | | - | |
91 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
92 | 108 | | |
93 | 109 | | |
94 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
43 | | - | |
44 | | - | |
45 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
46 | 62 | | |
47 | 63 | | |
48 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | 43 | | |
45 | | - | |
| 44 | + | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| 82 | + | |
| 83 | + | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| |||
Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | | - | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
Lines changed: 9 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | 5 | | |
12 | 6 | | |
13 | 7 | | |
14 | 8 | | |
15 | 9 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | 10 | | |
20 | 11 | | |
21 | | - | |
| 12 | + | |
22 | 13 | | |
23 | | - | |
24 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
25 | 17 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
30 | 21 | | |
31 | 22 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 23 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 24 | + | |
46 | 25 | | |
47 | 26 | | |
48 | 27 | | |
| |||
54 | 33 | | |
55 | 34 | | |
56 | 35 | | |
57 | | - | |
| 36 | + | |
58 | 37 | | |
59 | 38 | | |
60 | 39 | | |
| |||
106 | 85 | | |
107 | 86 | | |
108 | 87 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
| 26 | + | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
0 commit comments