Skip to content

Commit 5baac3f

Browse files
committed
No need docker in local case
1 parent 2c6ebb2 commit 5baac3f

File tree

5 files changed

+27
-20
lines changed

5 files changed

+27
-20
lines changed

cache-maker/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
FROM amazoncorretto:17
22

33
ARG BASE_DIR
4+
ARG KOTLIN_VERSION
5+
6+
RUN if [ -z "$KOTLIN_VERSION" ]; then \
7+
echo "Error: KOTLIN_VERSION argument is not set. Use docker-build-incremental-cache.sh to build the image." >&2; \
8+
exit 1; \
9+
fi
10+
11+
ENV KOTLIN_LIB=$KOTLIN_VERSION
12+
ENV KOTLIN_LIB_JS=${KOTLIN_VERSION}-js
13+
ENV KOTLIN_LIB_WASM=${KOTLIN_VERSION}-wasm
14+
ENV KOTLIN_LIB_COMPOSE_WASM=${KOTLIN_VERSION}-compose-wasm
15+
ENV KOTLIN_COMPOSE_WASM_COMPILER_PLUGINS=${KOTLIN_VERSION}-compose-wasm-compiler-plugins
16+
ENV KOTLIN_CACHES_COMPOSE_WASM=${KOTLIN_VERSION}-caches-compose-wasm
417

518
RUN mkdir -p $BASE_DIR
619
WORKDIR $BASE_DIR
720
ADD . $BASE_DIR
821

22+
RUN rm -rf $KOTLIN_LIB
23+
RUN rm -rf $KOTLIN_LIB_JS
24+
RUN rm -rf $KOTLIN_LIB_WASM
25+
RUN rm -rf $KOTLIN_LIB_COMPOSE_WASM
26+
RUN rm -rf $KOTLIN_COMPOSE_WASM_COMPILER_PLUGINS
27+
RUN rm -rf KOTLIN_CACHES_COMPOSE_WASM
28+
RUN ./gradlew clean
29+
930
RUN ./gradlew :cache-maker:run

cache-maker/build.gradle.kts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ application {
1111
mainClass.set("cache.MainKt")
1212
}
1313

14-
tasks.withType<JavaExec> {
14+
val runTask = tasks.named<JavaExec>("run") {
1515
dependsOn(":dependencies:copyDependencies")
1616
dependsOn(":dependencies:copyWasmDependencies")
1717
dependsOn(":dependencies:copyComposeWasmCompilerPlugins")
@@ -39,15 +39,6 @@ tasks.withType<JavaExec> {
3939
}
4040

4141
val outputLocalCacheDir = rootDir.resolve(cachesComposeWasm)
42-
val buildCacheLocal by tasks.registering(Exec::class) {
43-
workingDir = rootDir
44-
executable = "${project.name}/docker-build-incremental-cache.sh"
45-
outputs.dir(outputLocalCacheDir)
46-
args = listOf(
47-
rootDir.normalize().absolutePath, // baseDir
48-
rootDir.normalize().absolutePath // targetDir
49-
)
50-
}
5142

5243
val outputLambdaCacheDir: Provider<Directory> = layout.buildDirectory.dir("incremental-cache")
5344
val buildCacheForLambda by tasks.registering(Exec::class) {
@@ -91,7 +82,7 @@ val kotlinComposeWasmIcLambdaCache: Configuration by configurations.creating {
9182
}
9283

9384
artifacts.add(kotlinComposeWasmIcLocalCache.name, outputLocalCacheDir) {
94-
builtBy(buildCacheLocal)
85+
builtBy(runTask)
9586
}
9687

9788
artifacts.add(kotlinComposeWasmIcLambdaCache.name, outputLambdaCacheDir) {

cache-maker/docker-build-incremental-cache.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ echo "Target directory: $targetDir"
1111

1212
image_tag=my-image-name:$(date +%s)
1313

14-
docker build . --file cache-maker/Dockerfile --tag $image_tag --build-arg BASE_DIR=$baseDir
14+
docker build . --file cache-maker/Dockerfile --tag $image_tag --build-arg BASE_DIR=$baseDir --build-arg KOTLIN_VERSION=$kotlinVersion
1515

1616
container=$(docker create $image_tag)
1717

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
kotlin = "2.1.0-Beta2"
2+
kotlin = "2.1.20-dev-3031"
33
kotlinIdeVersion = "1.9.20-506"
44
kotlinIdeVersionWithSuffix = "231-1.9.20-506-IJ8109.175"
55
spring-boot = "2.7.10"

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,10 @@ class KotlinToJSTranslator(
203203
a = cacheDir?.let { dir ->
204204
usingTempDirectory { tmpDir ->
205205
val cachesDir = tmpDir.resolve("caches").normalize()
206-
val originalCachesDirExists = dir.exists()
207-
if (originalCachesDirExists) {
206+
if (dir.exists()) {
208207
dir.copyRecursively(cachesDir.toFile())
209208
}
210-
val result = compileAction(cachesDir)
211-
if (!originalCachesDirExists) {
212-
cachesDir.toFile().copyRecursively(dir)
213-
}
214-
result
209+
compileAction(cachesDir)
215210
}
216211
} ?: compileAction(null)
217212
}

0 commit comments

Comments
 (0)