File tree Expand file tree Collapse file tree 5 files changed +37
-9
lines changed
src/main/java/com/example/compose/rally
buildSrc/src/main/java/com/example/compose/rally/buildsrc Expand file tree Collapse file tree 5 files changed +37
-9
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ package com.example.compose.rally
1818
1919import android.os.Bundle
2020import androidx.activity.ComponentActivity
21- import androidx.compose.foundation.Box
21+ import androidx.compose.foundation.layout. Box
2222import androidx.compose.foundation.layout.padding
2323import androidx.compose.material.Scaffold
2424import androidx.compose.runtime.Composable
Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ package com.example.compose.rally.ui.components
1818
1919import androidx.compose.foundation.ScrollableColumn
2020import androidx.compose.foundation.Text
21+ import androidx.compose.foundation.layout.Box
2122import androidx.compose.foundation.layout.Column
2223import androidx.compose.foundation.layout.Spacer
23- import androidx.compose.foundation.layout.Stack
2424import androidx.compose.foundation.layout.fillMaxWidth
2525import androidx.compose.foundation.layout.padding
2626import 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 (
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 1717package com.example.compose.rally.buildsrc
1818
1919object Versions {
20- const val ktlint = " 0.38.1 "
20+ const val ktlint = " 0.39.0 "
2121}
2222
2323object 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 "
You can’t perform that action at this time.
0 commit comments