Skip to content

Commit 278c883

Browse files
ilgonmicdkrasnoff
authored andcommitted
Fix after version upgrade
1 parent 7c01e96 commit 278c883

File tree

9 files changed

+18
-41
lines changed

9 files changed

+18
-41
lines changed

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,15 @@ val buildLambda by tasks.creating(Zip::class) {
161161
from(libJVMFolder) { into(libJVM) }
162162
from(compilerPluginsForJVMFolder) {into(compilerPluginsForJVM)}
163163
from(libComposeWasmCompilerPluginsFolder) { into(libComposeWasmCompilerPlugins) }
164+
dependsOn(kotlinComposeWasmStdlibTypeInfo)
164165
from(kotlinComposeWasmStdlibTypeInfo) { into(cachesComposeWasm) }
165166
into("lib") {
166167
from(configurations.compileClasspath) { exclude("tomcat-embed-*") }
167168
}
168169
}
169170

170171
tasks.named<Copy>("processResources") {
172+
dependsOn(kotlinComposeWasmStdlibTypeInfo)
171173
dependsOn(composeWasmPropertiesUpdater)
172174
}
173175

cache-maker/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ kotlin {
88
binaries.executable().forEach {
99
it.linkTask.configure {
1010
compilerOptions.freeCompilerArgs.add("-Xir-dce=false")
11+
compilerOptions.freeCompilerArgs.add("-Xwasm-multimodule-mode=master")
1112
}
1213
}
1314
}
@@ -25,7 +26,7 @@ kotlin {
2526
val composeWasmStdlib: Provider<Directory> = layout.buildDirectory
2627
.dir("compose-wasm-stdlib-output")
2728
val composeWasmStdlibTypeInfo: Provider<RegularFile> = composeWasmStdlib
28-
.map { it.file("stdlib.typeinfo.bin") }
29+
.map { it.file("stdlib_master.wasm") }
2930

3031
val buildComposeWasmStdlibModule by tasks.registering(Exec::class) {
3132

@@ -70,7 +71,7 @@ kotlinComposeWasmStdlibTypeInfo.outgoing.variants.create("stdlib") {
7071
}
7172

7273
artifact(composeWasmStdlib) {
73-
builtBy(prepareTypeInfoIntoComposeWasmCache)
74+
builtBy(buildComposeWasmStdlibModule)
7475
}
7576
}
7677

@@ -82,7 +83,7 @@ kotlinComposeWasmStdlibTypeInfo.outgoing.variants.create("typeinfo") {
8283
)
8384
}
8485

85-
artifact(cachesComposeWasmFolder.file("stdlib.typeinfo.bin")) {
86+
artifact(composeWasmStdlibTypeInfo) {
8687
builtBy(prepareTypeInfoIntoComposeWasmCache)
8788
}
8889
}

common/src/main/kotlin/com/compiler/server/common/components/CliUtils.kt

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ fun compileWasmArgs(
5151
"-ir-output-name=$moduleName",
5252
).also {
5353
if (icDir != null) {
54-
typeInfoArg(icDir, log)?.let { stdlibTypeInfoArg ->
55-
it.add(stdlibTypeInfoArg)
56-
}
54+
it.add("-Xwasm-multimodule-mode=slave")
5755
}
5856
} + compilerPluginsArgs
5957

@@ -67,7 +65,6 @@ fun linkWasmArgs(
6765
icDir: Path?,
6866
outputDir: Path,
6967
debugInfo: Boolean,
70-
log: (String) -> Unit,
7168
): List<String> {
7269
return mutableListOf(
7370
"-Xreport-all-warnings",
@@ -82,37 +79,11 @@ fun linkWasmArgs(
8279
if (debugInfo) it.add("-Xwasm-generate-wat")
8380

8481
if (icDir != null) {
85-
typeInfoArg(icDir, log)?.let { stdlibTypeInfoArg ->
86-
it.add(stdlibTypeInfoArg)
87-
}
82+
it.add("-Xwasm-multimodule-mode=slave")
8883
} else {
8984
it.add("-Xir-dce")
9085
}
9186
}
9287
}
9388

94-
private fun typeInfoArg(
95-
icDir: Path,
96-
log: (String) -> Unit,
97-
): String? {
98-
val allTypeInfoFiles = icDir.toFile().listFiles() ?: run {
99-
log("No typeinfo files in $icDir, probably you need to run :cache-maker:prepareTypeInfoIntoComposeWasmCache task")
100-
return null
101-
}
102-
103-
val stdlibTypeInfo = allTypeInfoFiles
104-
.firstOrNull { file -> file.name.endsWith(".typeinfo.bin") }
105-
106-
if (stdlibTypeInfo == null) {
107-
log("No typeinfo files in $icDir, probably you need to run :cache-maker:prepareTypeInfoIntoComposeWasmCache task")
108-
return null
109-
}
110-
111-
if (allTypeInfoFiles.size > 1) {
112-
log("There are more than 1 typeinfo files in $icDir: ${allTypeInfoFiles.joinToString(", ") { it.name }}")
113-
}
114-
115-
return "-Xwasm-typeinfo-file=${stdlibTypeInfo.normalize().absolutePath}"
116-
}
117-
11889
val PATH_SEPARATOR: String = File.pathSeparator

common/src/main/kotlin/com/compiler/server/common/components/KotlinEnvironment.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ class KotlinEnvironment(
9090
return f(environment)
9191
}
9292

93+
val disposable = Disposer.newDisposable()
94+
9395
private val configuration = createConfiguration()
9496
val jsConfiguration: CompilerConfiguration = configuration.copy().apply {
9597
put(CommonConfigurationKeys.MODULE_NAME, "playground")
@@ -117,12 +119,12 @@ class KotlinEnvironment(
117119
composeWasmCompilerPluginOptions,
118120
emptyList<String>(),
119121
this,
120-
rootDisposable
122+
disposable
121123
)
122124
}
123125

124126
private val environment = KotlinCoreEnvironment.createForProduction(
125-
projectDisposable = rootDisposable,
127+
projectDisposable = disposable,
126128
configuration = configuration.copy(),
127129
configFiles = EnvironmentConfigFiles.JVM_CONFIG_FILES
128130
)

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
kotlin = "2.2.0"
3-
kotlinWasmStdlibCompiler = "2.2.0-dev-1010"
3+
kotlinWasmStdlibCompiler = "2.2.0-dev-8507"
44
kotlinIdeVersion = "1.9.20-506"
55
kotlinIdeVersionWithSuffix = "231-1.9.20-506-IJ8109.175"
66
spring-boot = "3.5.3"

indexation/src/main/kotlin/WebIndexationBuilder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class WebIndexationBuilder(
3030
compilerPluginOptions,
3131
emptyList<String>(),
3232
configuration,
33-
kotlinEnvironment.rootDisposable
33+
kotlinEnvironment.disposable
3434
)
3535
}
3636
val sourceModule = prepareAnalyzedSourceModule(

resource-server/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,12 @@ val composeWasmPropertiesUpdater by tasks.registering(ComposeWasmPropertiesUpdat
8484
}
8585

8686
tasks.withType<KotlinCompile> {
87+
dependsOn(kotlinComposeWasmStdlibTypeInfo)
8788
dependsOn(composeWasmPropertiesUpdater)
8889
}
8990

9091
tasks.named<Copy>("processResources") {
92+
dependsOn(kotlinComposeWasmStdlibTypeInfo)
9193
dependsOn(composeWasmPropertiesUpdater)
9294
val archiveOperation = project.serviceOf<ArchiveOperations>()
9395
from(resourceDependency.map {

resource-server/src/main/kotlin/com/compiler/server/controllers/ResourceRestController.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ class ResourceRestController(
4040
if (hash != dependenciesComposeWasm) {
4141
throw IllegalArgumentException("Unexpected stdlib")
4242
}
43-
return cacheableResource("/com/compiler/server/stdlib.uninstantiated.mjs", MediaType("text", "javascript"))
43+
return cacheableResource("/com/compiler/server/stdlib_master.uninstantiated.mjs", MediaType("text", "javascript"))
4444
}
4545

4646
@GetMapping("/stdlib-{hash}.wasm")
4747
fun getStdlibWasm(@PathVariable hash: String): ResponseEntity<Resource> {
4848
if (hash != dependenciesComposeWasm) {
4949
throw IllegalArgumentException("Unexpected stdlib")
5050
}
51-
return cacheableResource("/com/compiler/server/stdlib.wasm", MediaType("application", "wasm"))
51+
return cacheableResource("/com/compiler/server/stdlib_master.wasm", MediaType("application", "wasm"))
5252
}
5353

5454
private fun cacheableResource(path: String, mediaType: MediaType): ResponseEntity<Resource> {

src/main/kotlin/com/compiler/server/compiler/components/KotlinToJSTranslator.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ class KotlinToJSTranslator(
188188
icDir,
189189
outputDir,
190190
debugInfo,
191-
log::warn,
192191
)
193192
)
194193
}

0 commit comments

Comments
 (0)