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

Update libraries #716

Merged
merged 2 commits into from
Aug 30, 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
2 changes: 2 additions & 0 deletions .github/workflows/build_1.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- 1.x
pull_request:
branches:
- 1.x
workflow_dispatch:

env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build_2.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- 2.x
pull_request:
branches:
- 2.x
workflow_dispatch:

env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.iml
.gradle
.idea
.kotlin
/local.properties
/.idea/caches
/.idea/libraries
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Pending changes

- [#705](https://github.com/bumble-tech/appyx/pull/705) – **Fixed**: ChildAware extension functions now allow Any type as a parameter
- [#716](https://github.com/bumble-tech/appyx/pull/716) – **Updated**: Kotlin (2.0.20), Compose Compiler (now implicit from Kotlin), Coroutines (1.9.0-RC.2), AGP (8.5.2), numerous Androidx libs

---

Expand Down
31 changes: 27 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import com.android.Version
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

buildscript {
repositories {
Expand All @@ -17,6 +21,7 @@ plugins {
id("com.autonomousapps.dependency-analysis") version libs.versions.dependencyAnalysis.get()
id("release-dependencies-diff-compare")
id("release-dependencies-diff-create") apply false
alias(libs.plugins.compose.compiler) apply false
}

dependencyAnalysis {
Expand Down Expand Up @@ -85,12 +90,30 @@ tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}

// TODO: Enable K2 in a later PR
tasks.withType(KotlinJvmCompile::class.java).configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
apiVersion.set(KotlinVersion.KOTLIN_1_9)
languageVersion.set(KotlinVersion.KOTLIN_1_9)
}
}

allprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("com.bumble.appyx:customisations"))
.using(project(":libraries:customisations"))
.because("RIBs uses Appyx customisations as external dependency")
resolutionStrategy {
failOnNonReproducibleResolution()
dependencySubstitution {
substitute(module("com.bumble.appyx:customisations"))
.using(project(":libraries:customisations"))
.because("RIBs uses Appyx customisations as external dependency")
}
eachDependency {
when (requested.group) {
// Version 1.0 and 1.1 are included which cause ':libraries:core' espresso tests to fail
"androidx.tracing" -> useVersion(libs.versions.androidx.tracing.get())
}
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ org.gradle.parallel=true
android.useAndroidX=true
kotlin.code.style=official
library.version=1.5.0
android.experimental.lint.version=8.3.0
27 changes: 14 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ androidTargetSdk = "34"
accompanist = "0.28.0"
androidx-lifecycle = "2.6.1"
androidx-navigation-compose = "2.5.1"
androidx-tracing = "1.2.0"
coil = "2.2.1"
composeBom = "2024.04.00"
composeCompiler = "1.5.11"
ribs = "0.39.0"
mvicore = "1.2.6"
coroutines = "1.6.4"
kotlin = "1.9.23"
coroutines = "1.9.0-RC.2"
kotlin = "2.0.20"
junit5 = "5.8.2"
detekt = "1.22.0"
detekt = "1.23.6"
dependencyAnalysis = "1.31.0"

[libraries]
androidx-activity-compose = "androidx.activity:activity-compose:1.7.2"
androidx-appcompat = "androidx.appcompat:appcompat:1.3.1"
androidx-arch-core-testing = "androidx.arch.core:core-testing:2.1.0"
androidx-core = "androidx.core:core-ktx:1.9.0"
androidx-core-splashscreen = "androidx.core:core-splashscreen:1.0.0"
androidx-appcompat = "androidx.appcompat:appcompat:1.6.1"
androidx-arch-core-testing = "androidx.arch.core:core-testing:2.2.0"
androidx-core = "androidx.core:core-ktx:1.12.0"
androidx-core-splashscreen = "androidx.core:core-splashscreen:1.0.1"
androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "androidx-lifecycle" }
androidx-lifecycle-java8 = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref = "androidx-lifecycle" }
androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidx-navigation-compose" }
androidx-test-espresso-core = "androidx.test.espresso:espresso-core:3.5.0"
androidx-test-junit = "androidx.test.ext:junit:1.1.3"
androidx-test-rules = "androidx.test:rules:1.4.0"
androidx-test-espresso-core = "androidx.test.espresso:espresso-core:3.6.0"
androidx-test-junit = "androidx.test.ext:junit:1.2.0"
androidx-test-rules = "androidx.test:rules:1.6.0"
coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
# compose versions are resolved by BOM
Expand Down Expand Up @@ -74,10 +74,11 @@ junit-vintage = { module = "org.junit.vintage:junit-vintage-engine", version.ref

plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
plugin-detekt = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" }
plugin-android = "com.android.tools.build:gradle:8.2.2"
plugin-android = "com.android.tools.build:gradle:8.5.2"

detekt-compose = "io.nlopez.compose.rules:detekt:0.1.5"
detekt-compose = "io.nlopez.compose.rules:detekt:0.1.6"
toolargetool = "com.gu.android:toolargetool:0.3.0"

[plugins]
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
41 changes: 28 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# 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"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
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=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=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,18 +198,28 @@ if "$cygwin" || "$msys" ; then
done
fi

# 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.

# 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, 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" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
4 changes: 1 addition & 3 deletions libraries/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget

plugins {
id("com.android.library")
alias(libs.plugins.compose.compiler)
id("kotlin-android")
id("kotlin-parcelize")
id("appyx-publish-android")
Expand Down Expand Up @@ -30,9 +31,6 @@ android {
kotlinOptions {
jvmTarget = JvmTarget.JVM_11.toString()
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
}
testOptions {
unitTests.all {
// interface method default implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ internal class ChildNodeCreationManager<NavTarget : Any>(
when (keepMode) {
ChildEntry.KeepMode.KEEP -> {
navModelKeepKeys =
(state.onScreen + state.offScreen).mapNotNullToSet { element -> element.key }
state.onScreen.mapNotNullToSet { element -> element.key } +
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Kotlin compiler reeeeeeally doesn't like (state.onScreen + state.offScreen)

I assume it has something to do with the generics, but even after attempting to change a lot of code to use : Any it still didn't work 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those are 2 lists of the same type, looks like a compiler bug

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least there was a workaround 🫠

Copy link
Collaborator

@KovalevAndrey KovalevAndrey Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does set + set create a new set or a collection?

Copy link
Collaborator Author

@LachlanMcKee LachlanMcKee Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a new set.

the definition of navModelKeepKeys is val navModelKeepKeys: Set<NavKey<NavTarget>> so it wouldn't compile unless it returned a set.

state.offScreen.mapNotNullToSet { element -> element.key }
navModelSuspendKeys = emptySet()
navModelKeys = navModelKeepKeys
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ fun <NavTarget : Any, State> ParentNode<NavTarget>.Child(
transitionParams: TransitionParams,
transitionHandler: TransitionHandler<NavTarget, State>,
decorator: @Composable ChildTransitionScope<State>.(
child: ChildRenderer,
transitionDescriptor: TransitionDescriptor<NavTarget, State>
ChildRenderer,
TransitionDescriptor<NavTarget, State>
Comment on lines +41 to +42
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer allowed in Kotlin 2.0
https://developer.android.com/jetpack/androidx/releases/compose-compiler#1.5.0

Named arguments for @Composable lambda calls have been deprecated. This feature is relying on internal compiler APIs and will not be supported by K2.

) -> Unit
) {
val childEntry = remember(navElement.key.id) { childOrCreate(navElement.key) }
Expand All @@ -55,11 +55,11 @@ fun <NavTarget : Any, State> ParentNode<NavTarget>.Child(
)

transitionScope.decorator(
child = ChildRendererImpl(
ChildRendererImpl(
node = childEntry.node,
transitionModifier = transitionScope.transitionModifier
),
transitionDescriptor = descriptor,
descriptor,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,25 @@ class ChildrenTransitionScope<T : Any, S>(
@Composable
fun ParentNode<T>.children(
clazz: KClass<out T>,
block: @Composable ChildTransitionScope<S>.(child: ChildRenderer) -> Unit,
block: @Composable ChildTransitionScope<S>.(ChildRenderer) -> Unit,
) {
_children(clazz) { scope, child, _ ->
scope.block(
child = child
)
scope.block(child)
}
}

@Composable
fun ParentNode<T>.children(
clazz: KClass<out T>,
block: @Composable ChildTransitionScope<S>.(
child: ChildRenderer,
transitionDescriptor: TransitionDescriptor<T, S>
ChildRenderer,
TransitionDescriptor<T, S>
) -> Unit,
) {
_children(clazz) { scope, child, descriptor ->
scope.block(
transitionDescriptor = descriptor,
child = child,
child,
descriptor,
)
}
}
Expand Down
Loading