Browse Source

App API WIP

app-api
Nikolay Igotti 3 years ago
parent
commit
7217dbd549
  1. 29
      components/App/demo/build.gradle.kts
  2. 10
      components/App/demo/src/jvmMain/kotlin/org/jetbrains/compose/app/demo/Main.kt
  3. 33
      components/App/library/build.gradle.kts
  4. 10
      components/App/library/src/desktopMain/kotlin/org/jetbrains/compose/app/App.kt
  5. 5
      components/settings.gradle.kts

29
components/App/demo/build.gradle.kts

@ -0,0 +1,29 @@
import org.jetbrains.compose.compose
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
}
kotlin {
jvm {}
sourceSets {
named("jvmMain") {
dependencies {
implementation(compose.desktop.currentOs)
implementation(project(":App:library"))
}
}
}
}
compose.desktop {
application {
mainClass = "org.jetbrains.compose.app.demo.MainKt"
}
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}

10
components/App/demo/src/jvmMain/kotlin/org/jetbrains/compose/app/demo/Main.kt

@ -0,0 +1,10 @@
package org.jetbrains.compose.app.demo
import androidx.compose.material.Text
import org.jetbrains.compose.app.application
fun main() = application(
title = "App demo"
) {
Text("Hi")
}

33
components/App/library/build.gradle.kts

@ -0,0 +1,33 @@
import org.jetbrains.compose.compose
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
id("maven-publish")
}
kotlin {
jvm("desktop")
sourceSets {
named("commonMain") {
dependencies {
api(compose.runtime)
api(compose.foundation)
api(compose.material)
}
}
named("desktopMain") {}
}
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
configureMavenPublication(
groupId = "org.jetbrains.compose.components",
artifactId = "components-app",
name = "App API for Compose Multiplatform"
)

10
components/App/library/src/desktopMain/kotlin/org/jetbrains/compose/app/App.kt

@ -0,0 +1,10 @@
package org.jetbrains.compose.app
import androidx.compose.runtime.Composable
import androidx.compose.ui.window.singleWindowApplication
fun application(name: String = "application", title: String = "Compose Application", body: @Composable () -> Unit) {
singleWindowApplication {
body()
}
}

5
components/settings.gradle.kts

@ -14,4 +14,7 @@ pluginManagement {
} }
include(":SplitPane:library") include(":SplitPane:library")
include(":SplitPane:demo") include(":SplitPane:demo")
include(":App:library")
include(":App:demo")

Loading…
Cancel
Save