Skip to content

Commit

Permalink
[next] Initial upgrade to Compose Multiplatform 1.7.0-alpha (#250)
Browse files Browse the repository at this point in the history
This is the initial PR to integrate Compose Multiplatform 1.7.0
(currently alpha) in Haze.

The big goal here is to merge the different platform implementations
into 1 common implementation powered by the new `GraphicsLayer` APIs in
Compose 1.7.0.

Since Compose GraphicsLayers are similar in concept and API to Android
RenderNodes, refactoring the existing Android implementation to work on
all platforms has been fairly easy. The `RenderEffect` applied is
different per platform, but all of the layer handling is in
`commonMain`.
  • Loading branch information
chrisbanes committed Jul 13, 2024
1 parent 031549a commit aa3663a
Show file tree
Hide file tree
Showing 43 changed files with 1,083 additions and 1,095 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ playground.xcworkspace
# .swiftpm

.build/
.kotlin/

# fastlane
#
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ plugins {
alias(libs.plugins.android.test) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.spotless) apply false
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.compose.multiplatform) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.mavenpublish) apply false
alias(libs.plugins.metalava) apply false
alias(libs.plugins.roborazzi) apply false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.gradle.api.Project
class ComposeMultiplatformConventionPlugin : Plugin<Project> {
override fun apply(target: Project) = with(target) {
pluginManager.apply("org.jetbrains.compose")
pluginManager.apply("org.jetbrains.kotlin.plugin.compose")
configureCompose()
}
}
Expand Down
7 changes: 4 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ agp = "8.5.1"
androidx-benchmark = "1.2.4"
androidx-test-ext-junit = "1.2.1"
coil = "3.0.0-alpha08"
compose-multiplatform = "1.6.11"
compose-multiplatform = "1.7.0-alpha01"
kotlinx-coroutines-swing = "1.8.1"
ktlint = "1.0.1"
kotlin = "1.9.24"
kotlin = "2.0.0"
ktor = "3.0.0-wasm2"
metalava = "0.3.5"
robolectric = "4.13"
Expand All @@ -20,7 +20,8 @@ android-lint = { id = "com.android.lint", version.ref = "agp" }
android-test = { id = "com.android.test", version.ref = "agp" }
baselineprofile = { id = "androidx.baselineprofile", version.ref = "androidx-benchmark" }
cacheFixPlugin = { id = "org.gradle.android.cache-fix", version = "3.0.1" }
composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
compose-multiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" }
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
metalava = { id = "me.tylerbwong.gradle.metalava", version = "0.3.5" }
Expand Down
14 changes: 11 additions & 3 deletions haze/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
testOptions {
unitTests.isIncludeAndroidResources = true
unitTests {
isIncludeAndroidResources = true

all {
it.systemProperties["robolectric.pixelCopyRenderMode"] = "hardware"
}
}
}
}

Expand Down Expand Up @@ -60,6 +66,8 @@ kotlin {
}

val screenshotTest by creating {
dependsOn(commonTest.get())

dependencies {
implementation(kotlin("test"))
implementation(projects.internal.screenshotTest)
Expand All @@ -77,8 +85,8 @@ kotlin {
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += "-Xcontext-receivers"
compilerOptions {
freeCompilerArgs.add("-Xcontext-receivers")
}
}

Expand Down
Binary file modified haze/screenshots/android/HazeScreenshotTest.creditCard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified haze/screenshots/desktop/HazeScreenshotTest.creditCard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit aa3663a

Please sign in to comment.