-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec90734
commit f05095f
Showing
19 changed files
with
939 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
...c/main/kotlin/monster/scoop/tooling/plugins/KotlinComposeMultiplatformConventionPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package monster.scoop.tooling.plugins | ||
|
||
import com.android.build.gradle.LibraryExtension | ||
import monster.scoop.tooling.extensions.configureAndroidCompose | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.configurationcache.extensions.capitalized | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.gradle.kotlin.dsl.getByType | ||
import org.gradle.kotlin.dsl.withType | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget | ||
import monster.scoop.tooling.extensions.configureKotlin | ||
import monster.scoop.tooling.extensions.libs | ||
|
||
class KotlinComposeMultiplatformConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) = with(target) { | ||
with(pluginManager) { | ||
apply("org.jetbrains.kotlin.multiplatform") | ||
} | ||
|
||
version = libs.findVersion("scoop") | ||
|
||
extensions.configure<KotlinMultiplatformExtension> { | ||
applyDefaultHierarchyTemplate() | ||
|
||
if (pluginManager.hasPlugin("com.android.library")) { | ||
androidTarget() | ||
} | ||
|
||
jvm() | ||
|
||
iosX64() | ||
iosArm64() | ||
iosSimulatorArm64() | ||
|
||
targets.all { | ||
compilations.all { | ||
compilerOptions.configure { | ||
freeCompilerArgs.add("-Xexpect-actual-classes") | ||
} | ||
} | ||
} | ||
|
||
targets.withType<KotlinNativeTarget>().configureEach { | ||
compilations.configureEach { | ||
compilerOptions.configure { | ||
freeCompilerArgs.add("-Xallocator=custom") | ||
freeCompilerArgs.add("-XXLanguage:+ImplicitSignedToUnsignedIntegerConversion") | ||
freeCompilerArgs.add("-Xadd-light-debug=enable") | ||
|
||
freeCompilerArgs.addAll( | ||
"-opt-in=kotlin.RequiresOptIn", | ||
"-opt-in=kotlin.time.ExperimentalTime", | ||
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", | ||
"-opt-in=kotlinx.coroutines.FlowPreview", | ||
"-opt-in=kotlinx.cinterop.ExperimentalForeignApi", | ||
"-opt-in=kotlinx.cinterop.BetaInteropApi", | ||
|
||
) | ||
} | ||
} | ||
} | ||
|
||
configureKotlin() | ||
|
||
} | ||
|
||
extensions.configure<LibraryExtension> { | ||
buildFeatures { | ||
compose = true | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerExtensionVersion = libs.findVersion("compose-compiler").get().toString() | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
|
||
private fun Project.addKspDependencyForAllTargets( | ||
configurationNameSuffix: String, | ||
dependencyNotation: Any, | ||
) { | ||
val kmpExtension = extensions.getByType<KotlinMultiplatformExtension>() | ||
dependencies { | ||
kmpExtension.targets | ||
.asSequence() | ||
.filter { target -> | ||
target.platformType != KotlinPlatformType.common | ||
} | ||
.forEach { target -> | ||
add( | ||
"ksp${target.targetName.capitalized()}$configurationNameSuffix", | ||
dependencyNotation, | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,4 @@ kotlin { | |
|
||
android { | ||
namespace = "monster.scoop.xplat.common.market" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,4 @@ kotlin { | |
|
||
android { | ||
namespace = "monster.scoop.xplat.domain.story.api" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,4 @@ dependencies { | |
|
||
android { | ||
namespace = "monster.scoop.xplat.domain.story.impl" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 0 additions & 62 deletions
62
...eat/homeTab/impl/src/commonMain/kotlin/monster/scoop/xplat/feat/homeTab/impl/HomeTabUi.kt
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
.../homeTab/impl/src/commonMain/kotlin/monster/scoop/xplat/feat/homeTab/impl/ui/HomeTabUi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package monster.scoop.xplat.feat.homeTab.impl.ui | ||
|
||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import me.tatarka.inject.annotations.Inject | ||
import monster.scoop.xplat.feat.homeTab.api.HomeTab | ||
import monster.scoop.xplat.feat.homeTab.impl.ui.compose.HomeTabFeed | ||
|
||
@Inject | ||
class HomeTabUi : HomeTab.Ui { | ||
@Composable | ||
override fun Content(state: HomeTab.State, modifier: Modifier) { | ||
Column { | ||
if (state.stories.isEmpty()) { | ||
// Show loading indicator | ||
} else { | ||
HomeTabFeed(state.stories) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.