Skip to content

Commit 31868cd

Browse files
author
Manuel Vivo
committed
[Crane] Update to SNAPSHOT 6891475
1 parent f26bcc8 commit 31868cd

File tree

5 files changed

+9
-50
lines changed

5 files changed

+9
-50
lines changed

Crane/app/build.gradle

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,8 @@ android {
7272
}
7373

7474
buildFeatures {
75-
// We turn off the Compose feature for now, due to using Compose SNAPSHOTs where the
76-
// Compose compiler artifact has changed artifact group/name.
77-
// Instead we add the compiler manually below in the dependencies {}. Also see
78-
// the root build.gradle for info on how to apply the plugin.
79-
// TODO: remove this once we upgrade to an AGP version which uses the new artifact details
75+
compose true
8076

81-
// compose true
8277
// Disable unused AGP features
8378
buildConfig false
8479
aidl false
@@ -93,10 +88,6 @@ android {
9388
}
9489

9590
dependencies {
96-
// Temporary workaround (see above)
97-
// TODO: remove this once we upgrade to an AGP version which uses the new artifact details
98-
kotlinCompilerPlugin Libs.AndroidX.Compose.compiler
99-
10091
implementation Libs.Kotlin.stdlib
10192
implementation Libs.googleMaps
10293

Crane/app/src/main/java/androidx/compose/samples/crane/base/BaseUserInput.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
package androidx.compose.samples.crane.base
1818

1919
import androidx.annotation.DrawableRes
20+
import androidx.compose.foundation.AmbientContentColor
2021
import androidx.compose.foundation.BaseTextField
2122
import androidx.compose.foundation.ExperimentalFoundationApi
2223
import androidx.compose.foundation.Icon
2324
import androidx.compose.foundation.Text
24-
import androidx.compose.foundation.contentColor
2525
import androidx.compose.foundation.layout.Row
2626
import androidx.compose.foundation.layout.Spacer
2727
import androidx.compose.foundation.layout.padding
@@ -63,7 +63,7 @@ fun CraneUserInput(
6363
modifier: Modifier = Modifier,
6464
caption: String? = null,
6565
@DrawableRes vectorImageId: Int? = null,
66-
tint: Color = contentColor()
66+
tint: Color = AmbientContentColor.current
6767
) {
6868
CraneBaseUserInput(
6969
modifier = modifier,
@@ -111,7 +111,7 @@ private fun CraneBaseUserInput(
111111
@DrawableRes vectorImageId: Int? = null,
112112
showCaption: () -> Boolean = { true },
113113
tintIcon: () -> Boolean,
114-
tint: Color = contentColor(),
114+
tint: Color = AmbientContentColor.current,
115115
children: @Composable () -> Unit
116116
) {
117117
Surface(modifier = modifier, color = MaterialTheme.colors.primaryVariant) {

Crane/app/src/main/java/androidx/compose/samples/crane/home/LandingScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import androidx.compose.foundation.Image
2020
import androidx.compose.foundation.layout.Box
2121
import androidx.compose.foundation.layout.fillMaxSize
2222
import androidx.compose.runtime.Composable
23-
import androidx.compose.runtime.launchInComposition
23+
import androidx.compose.runtime.LaunchedTask
2424
import androidx.compose.samples.crane.R
2525
import androidx.compose.ui.Alignment
2626
import androidx.compose.ui.Modifier
@@ -32,7 +32,7 @@ private const val SplashWaitTime: Long = 2000
3232
@Composable
3333
fun LandingScreen(modifier: Modifier = Modifier, onTimeout: () -> Unit) {
3434
Box(modifier = modifier.fillMaxSize(), alignment = Alignment.Center) {
35-
launchInComposition {
35+
LaunchedTask {
3636
delay(SplashWaitTime)
3737
onTimeout()
3838
}

Crane/build.gradle

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,7 @@ subprojects {
5656
}
5757
}
5858

59-
// Create a configuration which allows us to intercept the JARs, and add them to
60-
// Kotlin Compiler freeCompilerArgs. This is needed because we can't currently use the
61-
// built-in `compose` feature in AGP, since it depends on the old Compose Compiler artifacts.
62-
// TODO: Remove this once AGP uses the new Compose Compiler artifact name
63-
def compilerPluginConfig = project.configurations.create("kotlinCompilerPlugin")
64-
65-
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { compile ->
59+
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
6660
kotlinOptions {
6761
// Treat all Kotlin warnings as errors
6862
allWarningsAsErrors = true
@@ -73,30 +67,5 @@ subprojects {
7367
freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
7468
freeCompilerArgs += '-Xallow-jvm-ir-dependencies'
7569
}
76-
77-
compile.dependsOn(compilerPluginConfig)
78-
compile.doFirst {
79-
if (!compilerPluginConfig.isEmpty()) {
80-
// Add the compiler plugin JARs using the -Xplugin flag
81-
compile.kotlinOptions.freeCompilerArgs +=
82-
"-Xplugin=${compilerPluginConfig.files.first()}"
83-
// Need to turn on the IR compiler too
84-
compile.kotlinOptions.useIR = true
85-
}
86-
}
87-
}
88-
89-
// Crane uses Compose alpha03 and Android Gradle Plugin 4.2.0-alpha13 which are incompatible
90-
// TODO: Remove this workaround when updating to >alpha04
91-
configurations.configureEach {
92-
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
93-
def group = details.requested.group
94-
def module = details.requested.module.name
95-
def version = details.requested.version
96-
97-
if (group == 'androidx.compose.compiler' && module == 'compiler') {
98-
details.useTarget("androidx.compose:compose-compiler:$version")
99-
}
100-
}
10170
}
10271
}

Crane/buildSrc/src/main/java/com/example/crane/buildsrc/Dependencies.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ object Libs {
2626
const val googleMaps = "com.google.android.libraries.maps:maps:3.1.0-beta"
2727

2828
object Accompanist {
29-
private const val version = "0.2.3.compose-6860046-SNAPSHOT"
29+
private const val version = "0.3.1.compose-6891475-SNAPSHOT"
3030
const val coil = "dev.chrisbanes.accompanist:accompanist-coil:$version"
3131
}
3232

@@ -41,10 +41,9 @@ object Libs {
4141
const val appcompat = "androidx.appcompat:appcompat:1.3.0-alpha02"
4242

4343
object Compose {
44-
const val snapshot = "6860046"
44+
const val snapshot = "6891475"
4545
const val version = "1.0.0-SNAPSHOT"
4646

47-
const val compiler = "androidx.compose.compiler:compiler:$version"
4847
const val runtime = "androidx.compose.runtime:runtime:$version"
4948
const val runtimeLivedata = "androidx.compose.runtime:runtime-livedata:$version"
5049
const val material = "androidx.compose.material:material:$version"

0 commit comments

Comments
 (0)