Skip to content

Commit

Permalink
Fix running the client (reset main class for KMP JVM app)
Browse files Browse the repository at this point in the history
  • Loading branch information
tresat committed Feb 18, 2025
1 parent 28eef0c commit 23260e9
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package org.gradle.client.softwaretype.compose;

import kotlin.Unit;
import org.gradle.api.Project;
import org.gradle.api.provider.Property;
import org.gradle.client.softwaretype.CustomDesktopComposeApplication;
import org.jetbrains.compose.ComposeExtension;
import org.jetbrains.compose.desktop.DesktopExtension;
import org.jetbrains.compose.desktop.application.dsl.*;
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension;

import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -33,6 +35,16 @@ public static void wireCompose(Project project, CustomDesktopComposeApplication
wireBuildTypes(composeModel, application.getBuildTypes());

wireNativeDistribution(composeModel.getNativeDistributions(), nativeDistributions);

// Need to set the main class for the JVM run task in the KMP model from the one nested in the Compose model
// TODO: default this
KotlinMultiplatformExtension kotlin = project.getExtensions().getByType(KotlinMultiplatformExtension.class);
kotlin.jvm("jvm" , jvm -> {
jvm.mainRun(kotlinJvmRunDsl -> {
kotlinJvmRunDsl.getMainClass().set(composeModel.getMainClass());
return Unit.INSTANCE;
});
});
});
}

Expand Down

0 comments on commit 23260e9

Please sign in to comment.