mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-17 21:27:01 +05:30
build: setup compose multiplatform
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
This commit is contained in:
parent
c5fafba7b5
commit
9517531388
12 changed files with 96 additions and 11 deletions
8
.idea/artifacts/common_jvm.xml
generated
Normal file
8
.idea/artifacts/common_jvm.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<component name="ArtifactManager">
|
||||||
|
<artifact type="jar" name="common-jvm">
|
||||||
|
<output-path>$PROJECT_DIR$/common/build/libs</output-path>
|
||||||
|
<root id="archive" name="common-jvm.jar">
|
||||||
|
<element id="module-output" name="Claw.common.jvmMain" />
|
||||||
|
</root>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
|
@ -14,6 +14,7 @@
|
||||||
<option value="$PROJECT_DIR$/api" />
|
<option value="$PROJECT_DIR$/api" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
<option value="$PROJECT_DIR$/buildSrc" />
|
<option value="$PROJECT_DIR$/buildSrc" />
|
||||||
|
<option value="$PROJECT_DIR$/common" />
|
||||||
<option value="$PROJECT_DIR$/database" />
|
<option value="$PROJECT_DIR$/database" />
|
||||||
<option value="$PROJECT_DIR$/desktop" />
|
<option value="$PROJECT_DIR$/desktop" />
|
||||||
</set>
|
</set>
|
||||||
|
|
|
@ -3,29 +3,29 @@ plugins {
|
||||||
kotlin("android")
|
kotlin("android")
|
||||||
kotlin("kapt")
|
kotlin("kapt")
|
||||||
id("dagger.hilt.android.plugin")
|
id("dagger.hilt.android.plugin")
|
||||||
|
id("org.jetbrains.compose") version "0.4.0-build173"
|
||||||
id("shot")
|
id("shot")
|
||||||
`versioning-plugin`
|
`versioning-plugin`
|
||||||
`lobsters-plugin`
|
`lobsters-plugin`
|
||||||
`core-library-desugaring`
|
`core-library-desugaring`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "dev.msfjarvis.lobsters"
|
applicationId = "dev.msfjarvis.lobsters"
|
||||||
testInstrumentationRunner = "com.karumi.shot.ShotTestRunner"
|
testInstrumentationRunner = "com.karumi.shot.ShotTestRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures.compose = true
|
|
||||||
|
|
||||||
composeOptions {
|
|
||||||
kotlinCompilerExtensionVersion = Dependencies.COMPOSE_VERSION
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
kapt(Dependencies.AndroidX.Hilt.daggerCompiler)
|
kapt(Dependencies.AndroidX.Hilt.daggerCompiler)
|
||||||
implementation(project(":api"))
|
implementation(project(":api"))
|
||||||
|
implementation(project(":common"))
|
||||||
implementation(project(":database"))
|
implementation(project(":database"))
|
||||||
implementation(Dependencies.AndroidX.appCompat)
|
implementation(Dependencies.AndroidX.appCompat)
|
||||||
implementation(Dependencies.AndroidX.browser)
|
implementation(Dependencies.AndroidX.browser)
|
||||||
|
|
|
@ -7,13 +7,13 @@ import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.android.components.ActivityComponent
|
import dagger.hilt.android.components.ActivityComponent
|
||||||
import dagger.hilt.android.qualifiers.ActivityContext
|
import dagger.hilt.android.qualifiers.ActivityContext
|
||||||
import dev.msfjarvis.lobsters.ui.urllauncher.UrlLauncher
|
import dev.msfjarvis.lobsters.ui.urllauncher.UrlLauncher
|
||||||
import dev.msfjarvis.lobsters.ui.urllauncher.UrlLauncherImpl
|
import dev.msfjarvis.lobsters.ui.urllauncher.AndroidUrlLauncherImpl
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(ActivityComponent::class)
|
@InstallIn(ActivityComponent::class)
|
||||||
object UrlLauncherModule {
|
object UrlLauncherModule {
|
||||||
@Provides
|
@Provides
|
||||||
fun provideUrlLauncher(@ActivityContext context: Context): UrlLauncher {
|
fun provideUrlLauncher(@ActivityContext context: Context): UrlLauncher {
|
||||||
return UrlLauncherImpl(context)
|
return AndroidUrlLauncherImpl(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
58
common/build.gradle.kts
Normal file
58
common/build.gradle.kts
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
id("com.android.library")
|
||||||
|
id("org.jetbrains.compose") version "0.4.0-build173"
|
||||||
|
`lobsters-plugin`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||||||
|
google()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||||
|
useIR = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// workaround for https://youtrack.jetbrains.com/issue/KT-43944
|
||||||
|
android {
|
||||||
|
configurations {
|
||||||
|
create("androidTestApi")
|
||||||
|
create("androidTestDebugApi")
|
||||||
|
create("androidTestReleaseApi")
|
||||||
|
create("testApi")
|
||||||
|
create("testDebugApi")
|
||||||
|
create("testReleaseApi")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvm()
|
||||||
|
android()
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
val androidMain by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(Dependencies.AndroidX.Compose.runtime)
|
||||||
|
implementation(Dependencies.AndroidX.browser)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val commonMain by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(Dependencies.AndroidX.Compose.runtime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val jvmMain by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(Dependencies.AndroidX.Compose.runtime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,8 +3,9 @@ package dev.msfjarvis.lobsters.ui.urllauncher
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.browser.customtabs.CustomTabsIntent
|
import androidx.browser.customtabs.CustomTabsIntent
|
||||||
|
import dev.msfjarvis.lobsters.ui.urllauncher.UrlLauncher
|
||||||
|
|
||||||
class UrlLauncherImpl(private val context: Context) : UrlLauncher {
|
class AndroidUrlLauncherImpl(private val context: Context) : UrlLauncher {
|
||||||
override fun launch(url: String) {
|
override fun launch(url: String) {
|
||||||
val customTabsIntent = CustomTabsIntent.Builder()
|
val customTabsIntent = CustomTabsIntent.Builder()
|
||||||
.setShareState(CustomTabsIntent.SHARE_STATE_ON)
|
.setShareState(CustomTabsIntent.SHARE_STATE_ON)
|
|
@ -2,4 +2,4 @@ package dev.msfjarvis.lobsters.ui.urllauncher
|
||||||
|
|
||||||
import androidx.compose.runtime.staticCompositionLocalOf
|
import androidx.compose.runtime.staticCompositionLocalOf
|
||||||
|
|
||||||
val LocalUrlLauncher = staticCompositionLocalOf<UrlLauncher> { error("Needs to be provided") }
|
val LocalUrlLauncher = staticCompositionLocalOf { error("Needs to be provided") }
|
|
@ -0,0 +1,14 @@
|
||||||
|
package dev.msfjarvis.lobsters.ui.urllauncher
|
||||||
|
|
||||||
|
import java.awt.Desktop
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
|
class JVMLocalLauncherImpl() : UrlLauncher {
|
||||||
|
override fun launch(url: String) {
|
||||||
|
val desktop = Desktop.getDesktop()
|
||||||
|
|
||||||
|
if (Desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) {
|
||||||
|
desktop.browse(URI(url))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
common/src/main/AndroidManifest.xml
Normal file
2
common/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="dev.msfjarvis.lobsters" />
|
|
@ -12,6 +12,7 @@ repositories {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":api"))
|
implementation(project(":api"))
|
||||||
|
implementation(project(":common"))
|
||||||
implementation(project(":database"))
|
implementation(project(":database"))
|
||||||
implementation(compose.desktop.currentOs)
|
implementation(compose.desktop.currentOs)
|
||||||
implementation(compose.runtime)
|
implementation(compose.runtime)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
rootProject.name = "Claw"
|
rootProject.name = "Claw"
|
||||||
include(":app", ":api", ":database", ":desktop")
|
include(":app", ":api", ":common", ":database", ":desktop")
|
||||||
enableFeaturePreview("GRADLE_METADATA")
|
enableFeaturePreview("GRADLE_METADATA")
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue