diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..10ef831 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "gradle" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index daf4e10..15b5ace 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -6,12 +6,12 @@ jobs: name: Build and Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: 17 - name: Build - uses: eskatos/gradle-command-action@v1 + uses: eskatos/gradle-command-action@v3 with: arguments: build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 07adbe3..2fd7751 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,14 +17,14 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '17' - name: CopyAars - uses: eskatos/gradle-command-action@v1 + uses: eskatos/gradle-command-action@v3 with: arguments: copyAars - name: Grant execute permission for gradlew diff --git a/build.gradle.kts b/build.gradle.kts index dfc44a4..e9f40bf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,10 +16,10 @@ plugins { `java-library` `maven-publish` signing - id("org.jetbrains.kotlin.jvm") version "1.9.22" - kotlin("plugin.serialization") version "1.9.22" - id("org.jlleitschuh.gradle.ktlint") version "10.0.0" - id("com.github.ben-manes.versions") version "0.42.0" + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.kotlinx.serialization) + alias(libs.plugins.jlleitschuh.ktlint) + alias(libs.plugins.ben.manes.versions) } group = "dev.gitlive" @@ -144,34 +144,33 @@ publishing { } dependencies { - compileOnly("org.robolectric:android-all:12.1-robolectric-8229987") - testImplementation("junit:junit:4.13.2") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.7.3") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.7.3") + compileOnly(libs.robolectric.android.all) + testImplementation(libs.junit) + testImplementation(libs.kotlinx.coroutines.swing) + testImplementation(libs.kotlinx.coroutines.play.services) // firebase aars - aar("com.google.firebase:firebase-firestore:24.10.0") - aar("com.google.firebase:firebase-functions:20.4.0") - aar("com.google.firebase:firebase-database:20.3.0") - aar("com.google.firebase:firebase-config:21.6.0") - aar("com.google.firebase:firebase-installations:17.2.0") + aar(libs.google.firebase.firestore) + aar(libs.google.firebase.functions) + aar(libs.google.firebase.database) + aar(libs.google.firebase.config) + aar(libs.google.firebase.installations) // extracted aar dependencies // exclude lifecycle libs due to https://github.com/GitLiveApp/firebase-java-sdk/pull/15 - remove the exclude once the dependencies in the aars are updated to the required version api(fileTree(mapOf("dir" to "build/jar", "include" to listOf("*.jar"), "exclude" to listOf("lifecycle-*")))) // polyfill dependencies - implementation("org.jetbrains.kotlin:kotlin-stdlib") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.0") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0") - implementation("org.xerial:sqlite-jdbc:3.44.1.0") + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.serialization.core) + implementation(libs.kotlinx.serialization.json) + implementation(libs.xerial.sqlite.jdbc) // firebase dependencies - implementation("javax.inject:javax.inject:1") - implementation("com.squareup.okhttp3:okhttp:3.12.13") - implementation("io.grpc:grpc-protobuf-lite:1.52.1") - implementation("io.grpc:grpc-stub:1.52.1") - implementation("androidx.collection:collection:1.2.0") - implementation("io.grpc:grpc-okhttp:1.52.1") - implementation("androidx.lifecycle:lifecycle-common:2.8.0-rc01") - implementation("androidx.lifecycle:lifecycle-viewmodel:2.8.0-rc01") + implementation(libs.javax.inject) + implementation(libs.okhttp) + implementation(libs.io.grpc.protobuf.lite) + implementation(libs.io.grpc.stub) + implementation(libs.androidx.collection) + implementation(libs.io.grpc.okhttp) + implementation(libs.androidx.lifecycle.common) + implementation(libs.androidx.lifecycle.viewmodel) } tasks.named("publishToMavenLocal").configure { @@ -183,7 +182,7 @@ tasks.named("publish").configure { } ktlint { - version.set("0.41.0") + version.set(libs.versions.ktlint.get()) } signing { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..9650101 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,38 @@ +[versions] +androidx-lifecycle = "2.9.0-alpha01" +ben-manes-versions = "0.51.0" +io-grpc = "1.66.0" +jlleitschuh-ktlint = "12.1.1" +kotlin = "2.0.20" +kotlinx-coroutines = "1.8.1" +kotlinx-serialization = "1.7.1" +ktlint = "0.47.1" + +[libraries] +androidx-collection = { module = "androidx.collection:collection", version = "1.4.3" } +androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "androidx-lifecycle" } +androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel", version.ref = "androidx-lifecycle" } +google-firebase-config = { module = "com.google.firebase:firebase-config", version = "21.6.0" } +google-firebase-database = { module = "com.google.firebase:firebase-database", version = "20.3.0" } +google-firebase-firestore = { module = "com.google.firebase:firebase-firestore", version = "24.10.0" } +google-firebase-functions = { module = "com.google.firebase:firebase-functions", version = "20.4.0" } +google-firebase-installations = { module = "com.google.firebase:firebase-installations", version = "17.2.0" } +io-grpc-okhttp = { module = "io.grpc:grpc-okhttp", version.ref = "io-grpc" } +io-grpc-protobuf-lite = { module = "io.grpc:grpc-protobuf-lite", version.ref = "io-grpc" } +io-grpc-stub = { module = "io.grpc:grpc-stub", version.ref = "io-grpc" } +javax-inject = { module = "javax.inject:javax.inject", version = "1" } +junit = { module = "junit:junit", version = "4.13.2" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" } +kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" } +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } +okhttp = { module = "com.squareup.okhttp3:okhttp", version = "3.12.13" } +robolectric-android-all = { module = "org.robolectric:android-all", version = "14-robolectric-10818077" } +xerial-sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version = "3.46.1.0" } + +[plugins] +ben-manes-versions = { id = "com.github.ben-manes.versions", version.ref = "ben-manes-versions" } +jlleitschuh-ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "jlleitschuh-ktlint" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f398c33..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68..f5feea6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,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/. @@ -83,10 +85,9 @@ 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 -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +134,13 @@ 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. @@ -144,7 +148,7 @@ 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 @@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | 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 @@ -197,11 +201,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" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..9b42019 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,92 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -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. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -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. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -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! -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 - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +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 + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +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 + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +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! +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 + +:omega diff --git a/src/main/java/android/net/SSLCertificateSocketFactory.kt b/src/main/java/android/net/SSLCertificateSocketFactory.kt index 378654c..da5253d 100644 --- a/src/main/java/android/net/SSLCertificateSocketFactory.kt +++ b/src/main/java/android/net/SSLCertificateSocketFactory.kt @@ -12,6 +12,7 @@ class SSLCertificateSocketFactory() : SSLSocketFactory() { init { HttpsURLConnection.setDefaultHostnameVerifier { _, _ -> true } } + @JvmStatic fun getDefault(timeout: Int, cache: SSLSessionCache): SSLSocketFactory = SSLCertificateSocketFactory() } diff --git a/src/main/java/com/google/firebase/auth/FirebaseAuth.kt b/src/main/java/com/google/firebase/auth/FirebaseAuth.kt index 666949c..d08e893 100644 --- a/src/main/java/com/google/firebase/auth/FirebaseAuth.kt +++ b/src/main/java/com/google/firebase/auth/FirebaseAuth.kt @@ -52,7 +52,7 @@ class FirebaseUserImpl private constructor( val idToken: String, val refreshToken: String, val expiresIn: Int, - val createdAt: Long, + val createdAt: Long ) : FirebaseUser() { constructor(app: FirebaseApp, data: JsonObject, isAnonymous: Boolean = data["isAnonymous"]?.jsonPrimitive?.booleanOrNull ?: false) : this( @@ -102,7 +102,7 @@ class FirebaseUserImpl private constructor( FirebaseAuth.getInstance(app).createAuthInvalidUserException( "deleteAccount", request, - response, + response ) ) } else { @@ -159,9 +159,9 @@ class FirebaseAuth constructor(val app: FirebaseApp) : InternalAuthProvider { val prev = field field = value - if (value == null) + if (value == null) { FirebasePlatform.firebasePlatform.clear(app.key) - else { + } else { FirebasePlatform.firebasePlatform.store(app.key, jsonParser.encodeToString(FirebaseUserImpl.serializer(), value)) } @@ -280,7 +280,7 @@ class FirebaseAuth constructor(val app: FirebaseApp) : InternalAuthProvider { internal fun createAuthInvalidUserException( action: String, request: Request, - response: Response, + response: Response ): FirebaseAuthInvalidUserException { val body = response.body()!!.use { it.string() } val jsonObject = jsonParser.parseToJsonElement(body).jsonObject diff --git a/src/main/java/com/google/firebase/auth/stubs.kt b/src/main/java/com/google/firebase/auth/Stubs.kt similarity index 100% rename from src/main/java/com/google/firebase/auth/stubs.kt rename to src/main/java/com/google/firebase/auth/Stubs.kt diff --git a/src/main/java/org/sqlite/core/native.kt b/src/main/java/org/sqlite/core/Native.kt similarity index 99% rename from src/main/java/org/sqlite/core/native.kt rename to src/main/java/org/sqlite/core/Native.kt index f93e100..7e30942 100644 --- a/src/main/java/org/sqlite/core/native.kt +++ b/src/main/java/org/sqlite/core/Native.kt @@ -124,7 +124,6 @@ fun ExecuteForLastInsertedRowId(connectionPtr: NativeDB, statementPtr: Long): Lo } fun ExecuteForCursorWindow(connectionPtr: NativeDB, statementPtr: Long, win: CursorWindow, startPos: Int, iRowRequired: Int, countAllRows: Boolean): Long { - /* Set the number of columns in the window */ if (!win.setNumColumns(connectionPtr.column_count(statementPtr))) return 0