Rework KotlinModuleMetadata to align it with KotlinClassMetadata:

- Public constructor with KmModule and JvmMetadataVersion
- make write() member function
This commit is contained in:
Leonid Startsev
2023-11-21 17:58:41 +01:00
committed by Space Team
parent 6e9a62c317
commit 048802e143
6 changed files with 102 additions and 93 deletions
+3 -3
View File
@@ -202,11 +202,11 @@ The only difference is that the source for the reader (and the result of the wri
```kotlin
// Read the module metadata
val bytes = File("META-INF/main.kotlin_module").readBytes()
val metadata = KotlinModuleMetadata.read(bytes)
val module = metadata.kmModule
val moduleMetadata = KotlinModuleMetadata.read(bytes)
val module = moduleMetadata.kmModule
...
// Write the module metadata
val bytes = KotlinModuleMetadata.write(module)
val bytes = moduleMetadata.write()
File("META-INF/main.kotlin_module").writeBytes(bytes)
```