Skip to content

Commit 232c8e5

Browse files
committed
Fix after version upgrade
1 parent af10d26 commit 232c8e5

File tree

10 files changed

+24
-42
lines changed

10 files changed

+24
-42
lines changed

build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ allprojects {
3333
maven("https://repo.spring.io/snapshot")
3434
maven("https://repo.spring.io/milestone")
3535
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide")
36+
maven("https://packages.jetbrains.team/maven/p/kt/dev/")
3637
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
3738
maven("https://cache-redirector.jetbrains.com/jetbrains.bintray.com/intellij-third-party-dependencies")
3839
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies")
@@ -186,13 +187,15 @@ val buildLambda by tasks.creating(Zip::class) {
186187
from(libJVMFolder) { into(libJVM) }
187188
from(compilerPluginsForJVMFolder) {into(compilerPluginsForJVM)}
188189
from(libComposeWasmCompilerPluginsFolder) { into(libComposeWasmCompilerPlugins) }
190+
dependsOn(kotlinComposeWasmStdlibTypeInfo)
189191
from(kotlinComposeWasmStdlibTypeInfo) { into(cachesComposeWasm) }
190192
into("lib") {
191193
from(configurations.compileClasspath) { exclude("tomcat-embed-*") }
192194
}
193195
}
194196

195197
tasks.named<Copy>("processResources") {
198+
dependsOn(kotlinComposeWasmStdlibTypeInfo)
196199
dependsOn(composeWasmPropertiesUpdater)
197200
}
198201

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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class KotlinEnvironment(
8787
return f(environment)
8888
}
8989

90+
val disposable = Disposer.newDisposable()
91+
9092
private val configuration = createConfiguration()
9193
val jsConfiguration: CompilerConfiguration = configuration.copy().apply {
9294
put(CommonConfigurationKeys.MODULE_NAME, "playground")
@@ -111,12 +113,13 @@ class KotlinEnvironment(
111113
COMPOSE_WASM_COMPILER_PLUGINS,
112114
composeWasmCompilerPluginOptions,
113115
emptyList(),
114-
this
116+
this,
117+
disposable
115118
)
116119
}
117120

118121
private val environment = KotlinCoreEnvironment.createForProduction(
119-
projectDisposable = Disposer.newDisposable(),
122+
projectDisposable = disposable,
120123
configuration = configuration.copy(),
121124
configFiles = EnvironmentConfigFiles.JVM_CONFIG_FILES
122125
)

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
2-
kotlin = "2.2.0-dev-1011"
3-
kotlinWasmStdlibCompiler = "2.2.0-dev-1010"
2+
kotlin = "2.2.0-dev-8507"
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 = "2.7.10"

indexation/src/main/kotlin/WebIndexationBuilder.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class WebIndexationBuilder(
2929
compilerPlugins,
3030
compilerPluginOptions,
3131
emptyList(),
32-
configuration
32+
configuration,
33+
kotlinEnvironment.disposable
3334
)
3435
}
3536
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> {

settings.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ pluginManagement {
77
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
88

99
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
10+
11+
maven("https://packages.jetbrains.team/maven/p/kt/dev/")
1012
}
1113
}
1214
plugins {

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)