Skip to content

try upgrade the demo project compose version to beta or stable #88

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
37 changes: 34 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
def android_builder_version = "4.0.1"

ext {
android_builder_main_version = Integer.parseInt(android_builder_version.split("\\.")[0])
android_builder_mid_version = Integer.parseInt(android_builder_version.split("\\.")[1])
}

android {
this.rootProject.buildscript.configurations.classpath
.resolvedConfiguration
.firstLevelModuleDependencies.
each {
def name = it.name
if (name.contains('com.android.tools.build:gradle')) {
def moduleVersion = it.moduleVersion
if (moduleVersion.contains("-")) {
def versionArray = moduleVersion.split("-")
ext.android_builder_main_version = Integer.parseInt(versionArray[0])
ext.android_builder_mid_version = Integer.parseInt(versionArray[1])
} else {
version = moduleVersion
android_builder_version = moduleVersion
ext.android_builder_main_version = Integer.parseInt(android_builder_version.split("\\.")[0])
ext.android_builder_mid_version = Integer.parseInt(android_builder_version.split("\\.")[1])
}
}
}


compileSdkVersion 30
buildToolsVersion "29.0.2"

Expand All @@ -29,8 +56,10 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
if (ext.android_builder_main_version >= 7 || (ext.android_builder_main_version > 4 && ext.android_builder_mid_version > 1)) {
buildFeatures {
compose true
}
}
composeOptions {
kotlinCompilerVersion "${versions.kotlinCompilerVersion}"
Expand All @@ -55,6 +84,9 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
}

dependencies {
if (android_builder_main_version < 7) {
add("kotlinCompilerPluginClasspath", "androidx.compose.compiler:compiler:1.0.0-beta05")
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Kotlin
implementation deps.kotlinStdLib
Expand Down Expand Up @@ -83,7 +115,6 @@ dependencies {
implementation deps.compose.layout
implementation deps.compose.material
implementation deps.compose.materialRipple
implementation deps.compose.savedInstanceState
implementation deps.compose.uiLiveData
androidTestImplementation deps.compose.uiTest

Expand Down
14 changes: 8 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

buildscript {
ext.versions = [
'gradle': '4.0.2',
'kotlin': '1.4.32',
'kotlinCompilerVersion': '1.4.32',
'cardView': '1.0.0',
'compose': '1.0.0-alpha10',
'compose': '1.0.0-beta05',
'constraintLayout' : '1.1.3',
'coroutine': '1.3.7',
'espresso': '3.2.0',
'glide': '4.10.0',
'gradle': '4.2.0-alpha15',

'junit' : '4.12',
'junitImplementation' : '1.1.1',
'kotlin': '1.4.21',
'kotlinCompilerVersion': '1.4.21',


'ktx': '1.1.0',
'ktxSupport': '2.2.0',
'lifecycle':'2.2.0',
Expand All @@ -31,7 +34,6 @@ buildscript {
'layout': "androidx.compose.foundation:foundation-layout:${versions.compose}",
'material': "androidx.compose.material:material:${versions.compose}",
'materialRipple': "androidx.compose.material:material-ripple:${versions.compose}",
'savedInstanceState': "androidx.compose.runtime:runtime-saved-instance-state:${versions.compose}",
'uiTest': "androidx.compose.ui:ui-test-junit4:${versions.compose}",
'uiLiveData': "androidx.compose.runtime:runtime-livedata:${versions.compose}"
],
Expand All @@ -46,7 +48,7 @@ buildscript {
'glideCompiler': "com.github.bumptech.glide:compiler:${versions.glide}"
],
'support': [
'appCompat': "androidx.appcompat:appcompat:${versions.supportLibrary}",
'appCompat': "androidx.appcompat:appcompat:1.3.0-beta01",
'ktx': "androidx.core:core-ktx:${versions.supportLibrary}",
'ktxLiveData': "androidx.lifecycle:lifecycle-livedata-ktx:${versions.ktxSupport}",
'ktxViewModel': "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.ktxSupport}",
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionUrl=https://services.gradle.org/distributions/gradle-7.0-bin.zip