Alexey Tsvetkov
2 years ago
committed by
GitHub
7 changed files with 111 additions and 14 deletions
@ -0,0 +1,34 @@ |
|||||||
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat |
||||||
|
|
||||||
|
plugins { |
||||||
|
id "org.jetbrains.kotlin.jvm" |
||||||
|
id "org.jetbrains.compose" |
||||||
|
} |
||||||
|
|
||||||
|
repositories { |
||||||
|
jetbrainsCompose() |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib" |
||||||
|
implementation compose.desktop.currentOs |
||||||
|
} |
||||||
|
|
||||||
|
compose.desktop { |
||||||
|
application { |
||||||
|
mainClass = "MainKt" |
||||||
|
nativeDistributions { |
||||||
|
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) |
||||||
|
|
||||||
|
packageVersion = "1.0.0" |
||||||
|
packageName = "TestPackage" |
||||||
|
description = "Test description" |
||||||
|
copyright = "Test Copyright Holder" |
||||||
|
vendor = "Test Vendor" |
||||||
|
|
||||||
|
javaHome = javaToolchains.launcherFor { |
||||||
|
languageVersion.set(JavaLanguageVersion.of(CUSTOM_JAVA_TOOLCHAIN_VERSION_PLACEHOLDER)) |
||||||
|
}.get().metadata.installationPath.asFile.absolutePath |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
pluginManagement { |
||||||
|
plugins { |
||||||
|
id 'org.jetbrains.kotlin.jvm' version 'KOTLIN_VERSION_PLACEHOLDER' |
||||||
|
id 'org.jetbrains.compose' version 'COMPOSE_GRADLE_PLUGIN_VERSION_PLACEHOLDER' |
||||||
|
} |
||||||
|
repositories { |
||||||
|
mavenLocal() |
||||||
|
gradlePluginPortal() |
||||||
|
} |
||||||
|
} |
||||||
|
rootProject.name = "simple" |
@ -0,0 +1,18 @@ |
|||||||
|
import androidx.compose.material.Text |
||||||
|
import androidx.compose.material.Button |
||||||
|
import androidx.compose.material.MaterialTheme |
||||||
|
import androidx.compose.ui.window.singleWindowApplication |
||||||
|
import androidx.compose.runtime.* |
||||||
|
|
||||||
|
fun main() = singleWindowApplication { |
||||||
|
val scope = rememberCoroutineScope() |
||||||
|
var text by remember { mutableStateOf("Hello, World!") } |
||||||
|
|
||||||
|
MaterialTheme { |
||||||
|
Button(onClick = { |
||||||
|
text = "Hello, Desktop!" |
||||||
|
}) { |
||||||
|
Text(text) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue