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

Migrate to Kotlin 2.0.0 and Compose Compiler plugin and optimize Gradle maven repositories #5303

Merged
merged 7 commits into from
Jun 27, 2024
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ library/.env
# Java class files
*.class

# Kotlin class files
/.kotlin

# Generated files
bin/
gen/
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
### 🐞 Fixed

### ⬆️ Improved
- Enabled Strong Skipping Mode for Compose compiler and improved Compose performance. [#5303](https://github.com/GetStream/stream-chat-android/pull/5303)

### ✅ Added
- Added `MessageOptionItemVisibility` class that controls menu item visibility in the selected message options menu. [#5226](https://github.com/GetStream/stream-chat-android/pull/5226)
Expand All @@ -93,6 +94,7 @@
### ⚠️ Changed
- Used the new `ChatTheme.messageOptionItemVisibility` property in `defaultMessageOptionsState()` in combination with own capabilities to control menu option item visibility. [#5226](https://github.com/GetStream/stream-chat-android/pull/5226)
- Now, Compose components use `StreamImage`, which delegates [Landscapist-Coil](https://github.com/skydoves/landscapist) for loading internal images. [#5299](https://github.com/GetStream/stream-chat-android/pull/5299)
- Migrated to Kotlin 2.0 and Compose compiler plugin [#5303](https://github.com/GetStream/stream-chat-android/pull/5303)

### ❌ Removed

Expand Down
73 changes: 68 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,48 @@ apply plugin: MinorBumpPlugin
apply plugin: VersionPrintPlugin
apply plugin: ChangelogAddModelSectionPlugin


buildscript {
repositories {
// fetch plugins from google maven (https://maven.google.com)
google() {
content {
includeGroupByRegex("androidx\\..*")
aleksandar-apostolov marked this conversation as resolved.
Show resolved Hide resolved
includeGroupByRegex("com\\.android(\\..*|)")
includeGroupByRegex("com\\.google\\.android\\..*")
includeGroupByRegex("com\\.google\\.firebase(\\..*|)")
includeGroupByRegex("com\\.google\\.gms(\\..*|)")
includeGroupByRegex("com\\.google\\.mlkit")
includeGroupByRegex("com\\.google\\.oboe")
includeGroupByRegex("com\\.google\\.prefab")
includeGroupByRegex("com\\.google\\.testing\\.platform")
}
mavenContent {
releasesOnly()
}
}

// fetch dagger plugin only
mavenCentral() {
content {
includeGroup("com.google.dagger")
includeGroup("com.google.dagger.hilt.android")
}
mavenContent {
releasesOnly()
}
}

// fetch plugins from gradle plugin portal (https://plugins.gradle.org)
gradlePluginPortal()

// fetch plugins from gradle maven publication
maven { url "https://plugins.gradle.org/m2/" }
google()
mavenCentral()
}

dependencies {
classpath Dependencies.androidGradlePlugin
classpath Dependencies.kotlinGradlePlugin
classpath Dependencies.composeCompilerPlugin
classpath Dependencies.googleServicesPlugin
classpath Dependencies.androidJunit5GradlePlugin
classpath Dependencies.gitversionerPlugin
Expand Down Expand Up @@ -58,8 +89,40 @@ subprojects {

allprojects {
repositories {
google()
mavenCentral()
// fetch plugins from google maven (https://maven.google.com)
google() {
content {
includeGroupByRegex("androidx\\..*")
includeGroupByRegex("com\\.android(\\..*|)")
includeGroupByRegex("com\\.google\\.android\\..*")
includeGroupByRegex("com\\.google\\.firebase(\\..*|)")
includeGroupByRegex("com\\.google\\.gms(\\..*|)")
includeGroupByRegex("com\\.google\\.mlkit")
includeGroupByRegex("com\\.google\\.oboe")
includeGroupByRegex("com\\.google\\.prefab")
includeGroupByRegex("com\\.google\\.testing\\.platform")
}
mavenContent {
releasesOnly()
}
}

// fetch dagger plugin only
mavenCentral() {
content {
includeGroup("com.google.dagger")
includeGroup("com.google.dagger.hilt.android")
}
mavenContent {
releasesOnly()
}
}

// fetch plugins from gradle plugin portal (https://plugins.gradle.org)
gradlePluginPortal()

// fetch plugins from gradle maven publication
maven { url "https://plugins.gradle.org/m2/" }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
package io.getstream.chat.android

object Versions {
internal const val ANDROID_GRADLE_PLUGIN = "8.2.0"
internal const val ANDROID_GRADLE_PLUGIN = "8.4.2"
internal const val ANDROID_JUNIT5_GRADLE_PLUGIN = "1.9.3.0"
internal const val ANDROID_LEGACY_SUPPORT = "1.0.0"
internal const val ANDROIDX_ACTIVITY_COMPOSE = "1.7.2"
internal const val ANDROIDX_ACTIVITY_KTX = "1.7.2"
internal const val ANDROIDX_ANNOTATIONS = "1.6.0"
internal const val ANDROIDX_APPCOMPAT = "1.6.1"
internal const val ANDROIDX_COMPOSE = "1.6.2"
public const val ANDROIDX_COMPOSE_COMPILER = "1.5.10"
internal const val ANDROIDX_CORE_TEST = "2.2.0"
internal const val ANDROIDX_FRAGMENT = "1.6.1"
internal const val ANDROIDX_KTX = "1.10.1"
Expand Down Expand Up @@ -52,13 +51,13 @@ object Versions {
internal const val JUNIT5 = "5.10.0"
internal const val KEYBOARD_VISIBILITY_EVENT = "2.3.0"
internal const val KLUENT = "1.73"
internal const val KOTLIN = "1.9.22"
internal const val KOTLIN_BINARY_VALIDATOR = "0.13.2"
internal const val KSP = "1.9.22-1.0.17"
internal const val KOTLIN = "2.0.0"
internal const val KOTLIN_BINARY_VALIDATOR = "0.14.0"
internal const val KSP = "2.0.0-1.0.22"
internal const val LANDSCAPIST = "2.3.4"
internal const val LEAK_CANARY = "2.4"
internal const val MATERIAL_COMPONENTS = "1.8.0"
internal const val MACRO_BENCHMARK = "1.2.0"
internal const val MACRO_BENCHMARK = "1.2.3"
internal const val MARKWON = "4.6.2"
internal const val MOCKITO_KOTLIN = "5.0.0"
internal const val MOCKITO = "5.4.0"
Expand Down Expand Up @@ -116,7 +115,7 @@ object Dependencies {
const val coilGif = "io.coil-kt:coil-gif:${Versions.COIL}"
const val coilVideo = "io.coil-kt:coil-video:${Versions.COIL}"
const val composeCoil = "io.coil-kt:coil-compose:${Versions.COIL}"
const val composeCompiler = "androidx.compose.compiler:compiler:${Versions.ANDROIDX_COMPOSE_COMPILER}"
const val composeCompilerPlugin = "org.jetbrains.kotlin:compose-compiler-gradle-plugin:${Versions.KOTLIN}"
const val composeRuntime = "androidx.compose.runtime:runtime:${Versions.ANDROIDX_COMPOSE}"
const val composeUi = "androidx.compose.ui:ui:${Versions.ANDROIDX_COMPOSE}"
const val composeUiTest = "androidx.compose.ui:ui-test-junit4:${Versions.ANDROIDX_COMPOSE}"
Expand Down
8 changes: 8 additions & 0 deletions compose_compiler_config.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Kotlin collections and datetime classes
kotlin.collections.*
org.threeten.bp.*
java.time.*

// We always use immutable classes for our data model, to avoid running the Compose compiler
// in the module we declare it to be stable here.
io.getstream.chat.android.models.*
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
51 changes: 0 additions & 51 deletions stream-chat-android-client/api/stream-chat-android-client.api
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,6 @@ public final class io/getstream/chat/android/client/channel/ChannelClientExtensi
public static final fun subscribeFor (Lio/getstream/chat/android/client/channel/ChannelClient;[Lkotlin/reflect/KClass;Lio/getstream/chat/android/client/ChatEventListener;)Lio/getstream/chat/android/client/utils/observable/Disposable;
}

public final class io/getstream/chat/android/client/channel/ChannelMessagesUpdateLogic$DefaultImpls {
public static synthetic fun upsertMessage$default (Lio/getstream/chat/android/client/channel/ChannelMessagesUpdateLogic;Lio/getstream/chat/android/models/Message;ZILjava/lang/Object;)V
public static synthetic fun upsertMessages$default (Lio/getstream/chat/android/client/channel/ChannelMessagesUpdateLogic;Ljava/util/List;ZZILjava/lang/Object;)V
}

public abstract interface class io/getstream/chat/android/client/channel/state/ChannelState {
public abstract fun getChannelConfig ()Lkotlinx/coroutines/flow/StateFlow;
public abstract fun getChannelData ()Lkotlinx/coroutines/flow/StateFlow;
Expand Down Expand Up @@ -822,10 +817,6 @@ public final class io/getstream/chat/android/client/errorhandler/ErrorHandler$Co
public static final field DEFAULT_PRIORITY I
}

public final class io/getstream/chat/android/client/errorhandler/ErrorHandler$DefaultImpls {
public static fun compareTo (Lio/getstream/chat/android/client/errorhandler/ErrorHandler;Lio/getstream/chat/android/client/errorhandler/ErrorHandler;)I
}

public final class io/getstream/chat/android/client/errors/ChatError {
public fun <init> ()V
public fun <init> (ILjava/lang/String;ILjava/util/Map;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;)V
Expand Down Expand Up @@ -2245,41 +2236,17 @@ public final class io/getstream/chat/android/client/extensions/MessageExtensions
public static final fun getCreatedAtOrThrow (Lio/getstream/chat/android/models/Message;)Ljava/util/Date;
}

public final class io/getstream/chat/android/client/extensions/SharedPreferencesKt {
}

public final class io/getstream/chat/android/client/extensions/StringExtensionsKt {
public static final fun cidToTypeAndId (Ljava/lang/String;)Lkotlin/Pair;
public static final fun createResizedStreamCdnImageUrl (Ljava/lang/String;FFLio/getstream/chat/android/models/streamcdn/image/StreamCdnResizeImageMode;Lio/getstream/chat/android/models/streamcdn/image/StreamCdnCropImageMode;)Ljava/lang/String;
public static synthetic fun createResizedStreamCdnImageUrl$default (Ljava/lang/String;FFLio/getstream/chat/android/models/streamcdn/image/StreamCdnResizeImageMode;Lio/getstream/chat/android/models/streamcdn/image/StreamCdnCropImageMode;ILjava/lang/Object;)Ljava/lang/String;
public static final fun getStreamCdnHostedImageDimensions (Ljava/lang/String;)Lio/getstream/chat/android/models/streamcdn/image/StreamCdnOriginalImageDimensions;
}

public final class io/getstream/chat/android/client/extensions/internal/ChannelKt {
}

public final class io/getstream/chat/android/client/extensions/internal/ChatEventKt {
public static final fun enrichIfNeeded (Lio/getstream/chat/android/client/events/ChatEvent;)Lio/getstream/chat/android/client/events/ChatEvent;
}

public final class io/getstream/chat/android/client/extensions/internal/MemberKt {
}

public final class io/getstream/chat/android/client/extensions/internal/MessageKt {
}

public final class io/getstream/chat/android/client/extensions/internal/MessageReactionsKt {
}

public final class io/getstream/chat/android/client/extensions/internal/PairKt {
}

public final class io/getstream/chat/android/client/extensions/internal/ReactionKt {
}

public final class io/getstream/chat/android/client/extensions/internal/UserKt {
}

public final class io/getstream/chat/android/client/header/VersionPrefixHeader$Compose : io/getstream/chat/android/client/header/VersionPrefixHeader {
public static final field INSTANCE Lio/getstream/chat/android/client/header/VersionPrefixHeader$Compose;
public fun equals (Ljava/lang/Object;)Z
Expand Down Expand Up @@ -2831,9 +2798,6 @@ public final class io/getstream/chat/android/client/sync/SyncState {
public fun toString ()Ljava/lang/String;
}

public final class io/getstream/chat/android/client/sync/SyncStateKt {
}

public abstract interface class io/getstream/chat/android/client/token/TokenProvider {
public abstract fun loadToken ()Ljava/lang/String;
}
Expand Down Expand Up @@ -2872,18 +2836,12 @@ public abstract interface class io/getstream/chat/android/client/utils/ProgressC
public abstract fun onSuccess (Ljava/lang/String;)V
}

public final class io/getstream/chat/android/client/utils/ResultUtilsKt {
}

public final class io/getstream/chat/android/client/utils/TimeProvider {
public static final field INSTANCE Lio/getstream/chat/android/client/utils/TimeProvider;
public final fun provideCurrentTimeInMilliseconds ()J
public final fun provideCurrentTimeInSeconds ()J
}

public final class io/getstream/chat/android/client/utils/UserUtilsKt {
}

public final class io/getstream/chat/android/client/utils/attachment/AttachmentUtilsKt {
public static final fun isAudio (Lio/getstream/chat/android/models/Attachment;)Z
public static final fun isAudioRecording (Lio/getstream/chat/android/models/Attachment;)Z
Expand All @@ -2895,15 +2853,6 @@ public final class io/getstream/chat/android/client/utils/attachment/AttachmentU
public static final fun isVideo (Lio/getstream/chat/android/models/Attachment;)Z
}

public final class io/getstream/chat/android/client/utils/channel/ChannelUtilsKt {
}

public final class io/getstream/chat/android/client/utils/internal/MessageUtilsKt {
}

public final class io/getstream/chat/android/client/utils/internal/ValidationKt {
}

public final class io/getstream/chat/android/client/utils/internal/toggle/ToggleService$Companion {
}

Expand Down
6 changes: 1 addition & 5 deletions stream-chat-android-compose-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import io.getstream.chat.android.Versions

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'androidx.baselineprofile'
Expand Down Expand Up @@ -79,10 +80,6 @@ android {
buildConfig true
}

composeOptions {
kotlinCompilerExtensionVersion Versions.ANDROIDX_COMPOSE_COMPILER
}

lintOptions {
disable 'MissingTranslation'
}
Expand All @@ -106,7 +103,6 @@ dependencies {
implementation Dependencies.streamPushFirebase

// Compose
implementation Dependencies.composeCompiler
implementation Dependencies.composeUi
implementation Dependencies.composeUiTooling
implementation Dependencies.composeFoundation
Expand Down
Loading
Loading