Skip to content

Commit

Permalink
build: compose shared lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Cdm2883 committed Oct 3, 2024
1 parent 8dd6cd6 commit fd97e97
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 2 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.jetbrains.compose) apply false
alias(libs.plugins.gradleup.shadow) apply false
}

Expand Down
4 changes: 3 additions & 1 deletion example/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.jetbrains.compose)
alias(libs.plugins.gradleup.shadow)
}

dependencies {
compileOnly(libs.allaymc.api)
compileOnly(projects.plugin)
compileOnly(projects.plugin.composeLib)
}

kotlin {
Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ allaymc-kotlinx = "0.1.0-alpha"
allaymc-api = "master-SNAPSHOT"

kotlin = "2.0.20"
compose-plugin = "1.6.11"
gradleup-shadow = "8.3.0"

kotlinx-coroutines-core = "1.9.0"
Expand All @@ -15,4 +16,6 @@ kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
gradleup-shadow = { id = "com.gradleup.shadow", version.ref = "gradleup-shadow" }
39 changes: 39 additions & 0 deletions plugin/compose-lib.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import org.jetbrains.compose.ExperimentalComposeLibrary

plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.jetbrains.compose)
alias(libs.plugins.gradleup.shadow)
}

@Suppress("DEPRECATION")
buildDir = file("../build")

@OptIn(ExperimentalComposeLibrary::class)
dependencies {
api(projects.plugin)

api(compose.runtime)
api(compose.ui)
api(compose.foundation)
api(compose.material)
api(compose.material3)
api(compose.materialIconsExtended)
api(compose.animation)
api(compose.animationGraphics)
api(compose.runtimeSaveable)
api(compose.components.resources)
api(compose.components.uiToolingPreview)
api(compose.desktop.linux_x64)
api(compose.desktop.linux_arm64)
api(compose.desktop.macos_x64)
api(compose.desktop.macos_arm64)
api(compose.desktop.windows_x64)
api(compose.desktop.components.splitPane)
api(compose.desktop.components.animatedImage)
}

kotlin {
jvmToolchain(21)
}
22 changes: 21 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

pluginManagement {
repositories {
google {
@Suppress("UnstableApiUsage")
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
mavenCentral()
gradlePluginPortal()
}
Expand All @@ -11,6 +19,13 @@ pluginManagement {
dependencyResolutionManagement {
@Suppress("UnstableApiUsage")
repositories {
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
mavenCentral()
maven("https://jitpack.io/")
maven("https://www.jitpack.io/")
Expand All @@ -21,5 +36,10 @@ dependencyResolutionManagement {
}

include(":core")
include(":plugin")
include(":plugin", ":plugin:compose-lib")
project(":plugin:compose-lib").apply {
buildFileName = "../compose-lib.gradle.kts"
projectDir = file("plugin/build") // set to any existing dir
}

include(":example")

0 comments on commit fd97e97

Please sign in to comment.