Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[All] Updating to Compose 1.2 #905

Merged
merged 5 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object Libs {
object Compose {
const val compilerVersion = "1.2.0"
const val snapshot = ""
const val version = "1.2.0-rc03"
const val version = "1.2.0"

const val runtime = "androidx.compose.runtime:runtime:$version"
const val runtimeLivedata = "androidx.compose.runtime:runtime-livedata:$version"
Expand Down
6 changes: 4 additions & 2 deletions JetNews/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
buildscript {
ext.kotlin_version = '1.7.0'
ext.compose_compiler_version = '1.2.0'
ext.compose_version = '1.2.0-rc03'
ext.compose_version = '1.2.0'
ext.compose_snapshot_version = ''
ext.coroutines_version = '1.6.0'
ext.accompanist_version = '0.24.13-rc'
ext.accompanist_version = '0.25.0'

repositories {
google()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

dependencies {
Expand All @@ -46,6 +47,7 @@ subprojects {
maven { url "https://androidx.dev/snapshots/builds/" +
"${compose_snapshot_version}/artifacts/repository/" }
}
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

apply plugin: 'com.diffplug.spotless'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object Libs {
const val jdkDesugar = "com.android.tools:desugar_jdk_libs:1.1.5"

object Accompanist {
const val version = "0.24.13-rc"
const val version = "0.25.0"
const val pager = "com.google.accompanist:accompanist-pager:$version"
}

Expand Down Expand Up @@ -71,7 +71,7 @@ object Libs {
object Compose {
const val compilerVersion = "1.2.0"
const val snapshot = ""
const val version = "1.2.0-rc03"
const val version = "1.2.0"

@get:JvmStatic
val snapshotUrl: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object Libs {
object Compose {
const val compilerVersion = "1.2.0"
const val snapshot = ""
const val version = "1.2.0-rc03"
const val version = "1.2.0"

const val foundation = "androidx.compose.foundation:foundation:$version"
const val layout = "androidx.compose.foundation:foundation-layout:$version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object Libs {
const val androidGradlePlugin = "com.android.tools.build:gradle:7.2.1"

object Accompanist {
const val version = "0.24.13-rc"
const val version = "0.25.0"
const val systemuicontroller = "com.google.accompanist:accompanist-systemuicontroller:$version"
const val flowlayouts = "com.google.accompanist:accompanist-flowlayout:$version"
}
Expand All @@ -49,7 +49,7 @@ object Libs {
object Compose {
const val compilerVersion = "1.2.0"
const val snapshot = ""
const val version = "1.2.0-rc03"
const val version = "1.2.0"

const val foundation = "androidx.compose.foundation:foundation:${version}"
const val layout = "androidx.compose.foundation:foundation-layout:${version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object Libs {
const val junit = "junit:junit:4.13.2"

object Accompanist {
const val version = "0.24.13-rc"
const val version = "0.25.0"
const val permissions = "com.google.accompanist:accompanist-permissions:$version"
}

Expand Down Expand Up @@ -62,7 +62,7 @@ object Libs {
object Compose {
const val compilerVersion = "1.2.0"
const val snapshot = ""
const val version = "1.2.0-rc03"
const val version = "1.2.0"

@get:JvmStatic
val snapshotUrl: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,35 @@ package com.example.owl.buildsrc
object Versions {
const val ktlint = "0.45.2"
}

object Libs {
const val androidGradlePlugin = "com.android.tools.build:gradle:7.2.1"

object Kotlin {
private const val version = "1.7.0"
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:$version"
}

object Coroutines {
private const val version = "1.6.0"
const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version"
const val test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:$version"
}

object JUnit {
private const val version = "4.13"
const val junit = "junit:junit:$version"
}

object AndroidX {
const val coreKtx = "androidx.core:core-ktx:1.7.0"
const val navigation = "androidx.navigation:navigation-compose:2.4.2"

object Activity {
const val activityCompose = "androidx.activity:activity-compose:1.4.0"
}

object Compose {
const val compilerVersion = "1.2.0"
const val snapshot = ""
const val version = "1.2.0-rc03"
const val version = "1.2.0"

const val animation = "androidx.compose.animation:animation:$version"
const val foundation = "androidx.compose.foundation:foundation:$version"
Expand All @@ -73,7 +67,6 @@ object Libs {
const val constraintLayoutCompose =
"androidx.constraintlayout:constraintlayout-compose:1.0.0"
}

object Test {
private const val version = "1.4.0"
const val core = "androidx.test:core:$version"
Expand All @@ -85,8 +78,7 @@ object Libs {
}
}
}

object Coil {
const val coilCompose = "io.coil-kt:coil-compose:2.0.0"
const val coilCompose = "io.coil-kt:coil-compose:2.1.0"
}
}
11 changes: 3 additions & 8 deletions Reply/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
buildscript {
ext {
kotlin_version = '1.7.0'
compose_version = '1.2.0-rc03'
compose_version = '1.2.0'
compose_compiler_version = '1.2.0'
material3_version = "1.0.0-alpha14"
coroutines_version = '1.6.0'
Expand All @@ -30,13 +30,14 @@ plugins {
id 'com.android.application' version "$agp_version" apply false
id 'com.android.library' version "$agp_version" apply false
id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
id 'com.diffplug.spotless' version '6.4.2'
id 'com.diffplug.spotless' version '6.7.0'
}

subprojects {
repositories {
google()
mavenCentral()
maven { url "https://androidx.dev/snapshots/builds/8843244/artifacts/repository/" }
florina-muntenescu marked this conversation as resolved.
Show resolved Hide resolved
}

apply plugin: 'com.diffplug.spotless'
Expand All @@ -50,9 +51,3 @@ subprojects {
licenseHeaderFile rootProject.file('spotless/copyright.kt')
}
}
}
florina-muntenescu marked this conversation as resolved.
Show resolved Hide resolved


task clean(type: Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions Reply/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url "https://androidx.dev/snapshots/builds/8843244/artifacts/repository/" }
florina-muntenescu marked this conversation as resolved.
Show resolved Hide resolved
}
}
rootProject.name = "Reply"
Expand Down
24 changes: 11 additions & 13 deletions scripts/upgrade_samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ read ktlint_version;
echo "Version to change Accompanist to (e.g 0.24.9-beta): ";
read accompanist_version;

echo "Version to change Kotlin to (e.g 1.7.0): ";
read kotlin_version;
echo "Version to change AGP to (e.g. 7.2.1): ";
read androidGradlePlugin_version;

if [ -z "$snapshot_version" ]; then
echo "Changing Compose version to $compose_version"
Expand All @@ -61,36 +61,32 @@ fi
for DEPENDENCIES_FILE in `find . -type f -iname "dependencies.kt"` ; do
COMPOSE_BLOCK=false;
ACCOMPANIST_BLOCK=false;
KOTLIN_BLOCK=false;
MADE_CHANGE=false;
TEMP_FILENAME="${DEPENDENCIES_FILE}_new";
while IFS= read -r line; do
if [[ $line == *"val version ="* && "$compose_version" != "" ]] && $COMPOSE_BLOCK = true; then
echo "$line" | sed -En 's/".*"/"'$compose_version'"/p'
MADE_CHANGE=true;
elif [[ $line == *"val snapshot ="* ]] && $COMPOSE_BLOCK = true; then
elif [[ $line == *"val snapshot ="* && "$snapshot_version" != "" ]] && $COMPOSE_BLOCK = true; then
florina-muntenescu marked this conversation as resolved.
Show resolved Hide resolved
echo "$line" | sed -En 's/".*"/"'$snapshot_version'"/p'
MADE_CHANGE=true;
elif [[ $line == *"val version ="* && "$accompanist_version" != "" ]] && $ACCOMPANIST_BLOCK = true; then
echo "$line" | sed -En 's/".*"/"'$accompanist_version'"/p'
MADE_CHANGE=true;
elif [[ $line == *"val version ="* && "$kotlin_version" != "" ]] && $KOTLIN_BLOCK = true; then
echo "$line" | sed -En 's/".*"/"'$kotlin_version'"/p'
MADE_CHANGE=true;
elif [[ $line == *"val ktlint ="* && "$ktlint_version" != "" ]]; then
echo "$line" | sed -En 's/".*"/"'$ktlint_version'"/p'
MADE_CHANGE=true;
elif [[ $line == *"val androidGradlePlugin ="* && "$androidGradlePlugin_version" != "" ]]; then
echo "$line" | sed -En 's/".*"/"com.android.tools.build:gradle:'$androidGradlePlugin_version'"/p'
MADE_CHANGE=true;
else
if [[ $line == *"object Compose {"* ]]; then
COMPOSE_BLOCK=true;
elif [[ $line == *"object Accompanist {"* ]]; then
ACCOMPANIST_BLOCK=true;
elif [[ $line == *"object Kotlin {"* ]]; then
KOTLIN_BLOCK=true;
elif [[ $line == *"}"* ]]; then
COMPOSE_BLOCK=false;
ACCOMPANIST_BLOCK=false;
KOTLIN_BLOCK=false;
fi
echo "$line";
fi
Expand All @@ -101,7 +97,7 @@ for DEPENDENCIES_FILE in `find . -type f -iname "dependencies.kt"` ; do
else
rm $TEMP_FILENAME;
fi

done

# Change build.gradle versions
Expand All @@ -112,12 +108,15 @@ for DEPENDENCIES_FILE in `find . -type f -iname "build.gradle"` ; do
if [[ $line == *"ext.compose_version ="* && "$compose_version" != "" ]]; then
echo "$line" | sed -En "s/\'.*'/\'$compose_version\'/p"
MADE_CHANGE=true;
elif [[ $line == *"ext.compose_snapshot_version ="* ]]; then
elif [[ $line == *"ext.compose_snapshot_version ="* && "$snapshot_version" != "" ]]; then
florina-muntenescu marked this conversation as resolved.
Show resolved Hide resolved
echo "$line" | sed -En "s/\'.*'/\'$snapshot_version\'/p"
MADE_CHANGE=true;
elif [[ $line == *"ext.accompanist_version ="* && "$accompanist_version" != "" ]]; then
echo "$line" | sed -En "s/\'.*'/\'$accompanist_version\'/p"
MADE_CHANGE=true;
elif [[ $line == *"ext.androidGradlePlugin_version ="* && "$androidGradlePlugin_version" != "" ]]; then
echo "$line" | sed -En "s/\'.*'/\'com.android.tools.build:gradle:$androidGradlePlugin_version\'/p"
MADE_CHANGE=true;
elif [[ $line == *"'com.diffplug.spotless' version"* && "$spotless_version" != "" ]]; then
echo "$line" | sed -En "s/\'.*'/\'com.diffplug.spotless\' version \'$spotless_version\'/p"
MADE_CHANGE=true;
Expand All @@ -135,4 +134,3 @@ for DEPENDENCIES_FILE in `find . -type f -iname "build.gradle"` ; do
rm $TEMP_FILENAME;
fi
done