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

Predictive back & lots of small improvements #55

Merged
merged 22 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6fd48fe
chore: bump dependencies
matejdro May 6, 2024
dca9058
fix(gradle): disable build cache on reportMerge task
matejdro May 31, 2024
2d60ac8
chore: bump dependencies
matejdro Jun 3, 2024
675fb3c
docs(navigation): update sample dependencies
matejdro Jun 14, 2024
823ef81
chore: ignore more .idea files
matejdro Jun 14, 2024
22aa6cb
feat(navigation): enable predictive back animations
matejdro Jun 21, 2024
1013bac
feat(navigation): enable predictive back animations
matejdro Jun 21, 2024
1df3b6e
chore: fix detekt hook crashing on kts files
matejdro Jun 21, 2024
d5614b1
docs(navigation): fix sample fragment's text not visible
matejdro Jun 21, 2024
6416012
feat(core): added better-named Bundle.toMap()
matejdro Jun 21, 2024
f09daa8
chore: bump dependencies
matejdro Jul 1, 2024
df683b1
fix(compose): remove garbage collected callbacks on unregister
matejdro Jul 5, 2024
831a7cf
fix(compose): FakeCoilLoader crashing on many colors
matejdro Jul 12, 2024
9a305e0
chore: bump dependencies
matejdro Aug 1, 2024
8b354a3
fix(gradle): detect pre-commit hook compatibility with project isolation
matejdro Jul 12, 2024
2b18514
chore: add more computer-specific files to gitignore
matejdro Aug 2, 2024
3316e16
fix(gradle): sarif merging compatibility with project isolation
matejdro Aug 2, 2024
93f0280
fix(retrofit): ErrorHandlingAdapterFactory stripping headers from res…
matejdro Aug 23, 2024
ed9cc01
chore: bump dependencies
matejdro Sep 2, 2024
fa4a35d
ci: update changelog action
matejdro Sep 6, 2024
7a46a78
Merge branch 'refs/heads/predictive-back' into next
matejdro Sep 13, 2024
4579631
refactor(core): suppress lint false positive
matejdro Sep 13, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- run: "v=$(cat version.txt);echo \"OLD_VERSION=$v\" > $GITHUB_ENV"
- name: Check if there were any new fix or feature commits
id: version-check
uses: inovait/actions-common/bump-version-since-last-build@21a4069c8686686b5d0a1429f4d1f7ebf0d59f1a
uses: inovait/actions-common/bump-version-since-last-build@v10
with:
version: '${{ env.OLD_VERSION }}'
- run: "echo \"No feature or fix commits. Skipping build...\""
Expand All @@ -53,7 +53,7 @@ jobs:
run: "./gradlew test jvmTest"
- name: Generate Changelog
id: changelog
uses: inovait/actions-common/changelog-since-last-build@21a4069c8686686b5d0a1429f4d1f7ebf0d59f1a
uses: inovait/actions-common/changelog-since-last-build@v10
with:
git_commit_url_prefix: 'https://github.com/inovait/kotlinova/commit/'
- run: "old_changelog=$(cat CHANGELOG.MD); echo \"# ${{ env.VERSION }}\n\n${{ steps.changelog.outputs.changelog }}\n\n$old_changelog\" > CHANGELOG.MD"
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@
local.properties
/.idea/deploymentTargetDropDown.xml
merge.sarif
/.idea/appInsightsSettings.xml
/.idea/deploymentTargetSelector.xml
/.idea/git_toolbox_blame.xml
/navigation/sample/.idea/appInsightsSettings.xml
/navigation/sample/.idea/deploymentTargetSelector.xml
/navigation/sample/.idea/other.xml
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 INOVA IT d.o.o.
* Copyright 2024 INOVA IT d.o.o.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
Expand Down Expand Up @@ -79,7 +79,7 @@ class FakeCoilLoader(
}

private fun generateNextColorDrawable(): Drawable {
val nextColor = colors[currentColor++]
val nextColor = colors[currentColor++ % colors.size]
return ColorDrawable(nextColor)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 INOVA IT d.o.o.
* Copyright 2024 INOVA IT d.o.o.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
Expand Down Expand Up @@ -56,7 +56,8 @@ class ResultPassingStore(private val store: @RawValue HashMap<Int, Any> = HashMa

fun <T> unregisterCallback(callback: (T) -> Unit) {
callbacks.values.removeIf {
it.get() == callback
// Also remove all callbacks that have been garbage collected (are null)
it.get() == callback || it.get() == null
}
}

Expand Down
1 change: 1 addition & 0 deletions config/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ potential-bugs:
active: false
MissingPackageDeclaration:
active: true
excludes: [ '**/*.kts' ]
NullableToStringCall:
active: true
UnconditionalJumpStatementInLoop:
Expand Down
2 changes: 1 addition & 1 deletion config/hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

./gradlew -q --continue --parallel -Pprecommit=true buildSrc:detekt detektMetadataMain detektJvmMain detektAndroidDebug detektAndroidRelease detektJvmTest detektMain detektTest :kotlinova-gradle:detektMain
./gradlew -q --continue --parallel -Pprecommit=true buildSrc:detekt detekt
38 changes: 19 additions & 19 deletions config/libs.toml
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
[versions]
androidGradlePlugin = "8.3.1"
androidGradlePlugin = "8.6.0"
androidGradleCacheFix = "3.0.1"
androidx-activity = "1.8.2"
androidx-activity = "1.9.1"
# See https://developer.android.com/jetpack/androidx/releases/compose-kotlin
androidx-compose-compiler = "1.5.11"
androidx-compose-compiler = "1.5.14"
androidx-compose-material3 = "1.2.1"
androidx-compose-runtime = "1.6.5"
androidx-core = "1.12.0"
androidx-fragment = "1.6.2"
androidx-lifecycle = "2.7.0"
androidx-test-espresso = "3.5.1"
androidx-compose-runtime = "1.7.1"
androidx-core = "1.13.1"
androidx-fragment = "1.8.2"
androidx-lifecycle = "2.8.4"
androidx-test-espresso = "3.6.1"
autoService = "1.1.1"
coil = "2.6.0"
coil = "2.7.0"
dokka = "1.9.20"
espresso = "3.5.1"
anvil = "2.5.0-beta04"
desugarJdkLibs = "2.0.4"
dagger = "2.51.1"
espresso = "3.6.1"
anvil = "2.5.0-beta11"
desugarJdkLibs = "2.1.1"
dagger = "2.52"
detekt = "1.23.6"
dispatch = "1.0.0-beta10"
# Do not update this until we update gradle
# there is a version conflict with a gradle-supplied grpc, resulting in
# AbstractManagedChannelImplBuilder error
googleCloud-monitoring = "3.10.0"
googleCloud-protobufUtil = "3.25.1"
googleCloud-protobufUtil = "3.25.3"
okhttp = "4.12.0"
orgJson = "20240303"
kotlin = "1.9.23"
kotlin-coroutines = "1.8.0"
kotest = "5.8.1"
kotlin = "1.9.24"
kotlin-coroutines = "1.8.1"
kotest = "5.9.1"
nexusPublish = "0.30.0"
junit4 = "4.13.2"
junit5 = "5.10.2"
junit5 = "5.11.0"
moshi = "1.15.1"
retrofit = "2.11.0"
sarif4k = "0.5.0"
simpleStack = "2.8.0"
simpleStack = "2.9.0"
tomlj = "1.1.1"
turbine = "1.1.0"
versionsChecker = "0.51.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 INOVA IT d.o.o.
* Copyright 2024 INOVA IT d.o.o.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
Expand Down Expand Up @@ -50,7 +50,15 @@ operator fun Bundle.set(key: String, value: Any) {
/**
* Convert bundle to regular map. Mostly useful for logging.
*/
@Deprecated("Naming was not indicative of what that function does. Use toMap() instead.", ReplaceWith("toMap()"))
fun Bundle.asMap(): Map<String, Any?> {
return toMap()
}

/**
* Convert bundle to regular map. Mostly useful for logging.
*/
fun Bundle.toMap(): Map<String, Any?> {
return keySet().associateWith {
@Suppress("DEPRECATION") // We cannot use type safe APIs in this case
get(it)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 INOVA IT d.o.o.
* Copyright 2024 INOVA IT d.o.o.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
Expand All @@ -16,6 +16,7 @@

package si.inova.kotlinova.core.time

import android.annotation.SuppressLint
import android.text.format.DateFormat
import java.time.chrono.IsoChronology
import java.time.format.DateTimeFormatter
Expand All @@ -29,6 +30,7 @@ import java.util.Locale
*
* Adapted from https://github.com/drewhamilton/AndroidDateTimeFormatters/blob/9dee359a916a6d6e30bfa83613638ece0c3eb688/javatime/src/main/java/dev/drewhamilton/androidtime/format/AndroidDateTimeFormatter.java
*/
@SuppressLint("NewApi") // java.time is desugared, so we don't need later SDK, https://issuetracker.google.com/issues/347167978
abstract class BaseAndroidDateTimeFormatter : AndroidDateTimeFormatter {

/**
Expand All @@ -41,6 +43,7 @@ abstract class BaseAndroidDateTimeFormatter : AndroidDateTimeFormatter {
*
* @return the time formatter
*/

override fun ofLocalizedTime(): DateTimeFormatter {
val contextPrimaryLocale = extractPrimaryLocale()

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
distributionSha256Sum=194717442575a6f96e1c1befa2c30e9a4fc90f701d7aee33eb879b79e7ff05c0
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
distributionSha256Sum=258e722ec21e955201e31447b0aed14201765a3bfbae296a46cf60b70e66db70
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
31 changes: 18 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/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/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 Down Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# 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,26 +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=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 @@ -197,11 +198,15 @@ 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" \
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
23 changes: 15 additions & 8 deletions kotlinova-gradle/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,24 @@ After all of that, you can update all of your libraries with a single command:

`./gradlew dependencyUpdates -q && ./gradlew app:updateLibsToml -q`

# Detekt sarif report merging
# Sarif merging

This allows one-line enabling of the
sarif lint report mechanism that will setup detekt
in this project with .sarif output and then merge output of all detekt tasks to `merge.sarif` file in top level project's root.
Sarif merging feature allows you to simply enable merging of all sarif reports of all static checks in sub-modules into
one big top level `merge.sarif`.

## Detekt

To include detekt's sarif output, enable this on all sub-modules that produce detekt reports:

```kotlin
kotlinova {
mergeDetektSarif = true
}
```

# Android Lint sarif report merging
## Android Lint

This allows one-line enabling of the
sarif lint report mechanism that will
merge sarif output of all Android Lint tasks to `merge.sarif` file in top level project's root.
To include detekt's sarif output, enable this on all sub-modules that produce lint reports:

```kotlin
kotlinova {
Expand All @@ -118,6 +119,12 @@ android {
}
```

## Top Level

Lastly, you need to apply `kotlinova` plugin to your top-level project.
Afterwards, you can call `reportMerge` to merge all sarif tasks. Note that, for this to work properly, you MUST call
merging at the same time as detekt reporting (for example `./gradlew detekt reportMerge`).

# Detekt's pre-commit hook

This allows one-line enabling of the
Expand Down
Loading
Loading