Skip to content

Commit

Permalink
Merge pull request #22 from siarhei-luskanau/toml-and-deps
Browse files Browse the repository at this point in the history
Update Gradle wrapper to 8.10. Added TOML file with dependencies declarations. Added dependabot config. Fixed ktlint.
  • Loading branch information
nbransby authored Aug 29, 2024
2 parents 2ca898f + eb705e5 commit 642e6bd
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 145 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
6 changes: 3 additions & 3 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 26 additions & 27 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand All @@ -183,7 +182,7 @@ tasks.named("publish").configure {
}

ktlint {
version.set("0.41.0")
version.set(libs.versions.ktlint.get())
}

signing {
Expand Down
38 changes: 38 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
34 changes: 21 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -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/.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -133,26 +134,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 +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" \
Expand Down
Loading

0 comments on commit 642e6bd

Please sign in to comment.