Skip to content

Commit a5d3ffa

Browse files
[Rally] Updates to alpha04 snapshot (#198)
1 parent f7ca1f6 commit a5d3ffa

File tree

5 files changed

+37
-9
lines changed

5 files changed

+37
-9
lines changed

Rally/app/build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ android {
6666
}
6767

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

7278
composeOptions {
@@ -80,6 +86,10 @@ dependencies {
8086
implementation Libs.Kotlin.stdlib
8187
implementation Libs.Coroutines.android
8288

89+
// Temporary workaround (see above)
90+
// TODO: remove Compose.compiler once we upgrade to an AGP version which uses the new artifact details
91+
kotlinCompilerPlugin Libs.AndroidX.Compose.compiler
92+
8393
implementation Libs.AndroidX.coreKtx
8494
implementation Libs.AndroidX.appcompat
8595
implementation Libs.AndroidX.Navigation.fragment

Rally/app/src/main/java/com/example/compose/rally/RallyActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package com.example.compose.rally
1818

1919
import android.os.Bundle
2020
import androidx.activity.ComponentActivity
21-
import androidx.compose.foundation.Box
21+
import androidx.compose.foundation.layout.Box
2222
import androidx.compose.foundation.layout.padding
2323
import androidx.compose.material.Scaffold
2424
import androidx.compose.runtime.Composable

Rally/app/src/main/java/com/example/compose/rally/ui/components/DetailsScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ package com.example.compose.rally.ui.components
1818

1919
import androidx.compose.foundation.ScrollableColumn
2020
import androidx.compose.foundation.Text
21+
import androidx.compose.foundation.layout.Box
2122
import androidx.compose.foundation.layout.Column
2223
import androidx.compose.foundation.layout.Spacer
23-
import androidx.compose.foundation.layout.Stack
2424
import androidx.compose.foundation.layout.fillMaxWidth
2525
import androidx.compose.foundation.layout.padding
2626
import androidx.compose.foundation.layout.preferredHeight
@@ -45,7 +45,7 @@ fun <T> StatementBody(
4545
rows: @Composable (T) -> Unit
4646
) {
4747
ScrollableColumn {
48-
Stack(Modifier.padding(16.dp)) {
48+
Box(Modifier.padding(16.dp)) {
4949
val accountsProportion = items.extractProportions { amounts(it) }
5050
val circleColors = items.map { colors(it) }
5151
AnimatedCircle(

Rally/build.gradle

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,24 @@ subprojects {
6060
}
6161
}
6262

63-
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
63+
// Create a configuration which allows us to intercept the JARs, and add them to
64+
// Kotlin Compiler freeCompilerArgs. This is needed because we can't currently use the
65+
// built-in `compose` feature in AGP, since it depends on the old Compose Compiler artifacts.
66+
// TODO: Remove this once AGP uses the new Compose Compiler artifact name
67+
def compilerPluginConfig = project.configurations.create("kotlinCompilerPlugin")
68+
69+
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { compile ->
70+
71+
compile.dependsOn(compilerPluginConfig)
72+
compile.doFirst {
73+
if (!compilerPluginConfig.isEmpty()) {
74+
// Add the compiler plugin JARs using the -Xplugin flag
75+
compile.kotlinOptions.freeCompilerArgs +=
76+
"-Xplugin=${compilerPluginConfig.files.first()}"
77+
// Need to turn on the IR compiler too
78+
compile.kotlinOptions.useIR = true
79+
}
80+
}
6481
kotlinOptions {
6582
// Treat all Kotlin warnings as errors
6683
allWarningsAsErrors = true

Rally/buildSrc/src/main/java/com/example/compose/rally/buildsrc/dependencies.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
package com.example.compose.rally.buildsrc
1818

1919
object Versions {
20-
const val ktlint = "0.38.1"
20+
const val ktlint = "0.39.0"
2121
}
2222

2323
object Libs {
24-
const val androidGradlePlugin = "com.android.tools.build:gradle:4.2.0-alpha11"
24+
const val androidGradlePlugin = "com.android.tools.build:gradle:4.2.0-alpha12"
2525
const val jdkDesugar = "com.android.tools:desugar_jdk_libs:1.0.9"
2626

2727
const val junit = "junit:junit:4.13"
@@ -47,9 +47,10 @@ object Libs {
4747
const val coreKtx = "androidx.core:core-ktx:1.5.0-alpha02"
4848

4949
object Compose {
50-
const val snapshot = ""
51-
const val version = "1.0.0-alpha03"
50+
const val snapshot = "6860046"
51+
const val version = "1.0.0-SNAPSHOT"
5252

53+
const val compiler = "androidx.compose.compiler:compiler:$version"
5354
const val core = "androidx.compose.ui:ui:$version"
5455
const val foundation = "androidx.compose.foundation:foundation:$version"
5556
const val layout = "androidx.compose.foundation:foundation-layout:$version"

0 commit comments

Comments
 (0)