get rid of androidLibraryVersion changes

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2025-06-05 19:21:09 +08:00 committed by Alper Öztürk
parent d7204243dc
commit 82141c8885
7 changed files with 14 additions and 20 deletions

View File

@ -161,7 +161,7 @@ If automatic backport fails, it will create a comment.
For speeding up developing, we do use a master snapshot of nextcloud-library, provided by jitpack.io.
This means that if a breaking change is merged on library, master branch of the app will fail.
To limit this risk please follow this approach:
- on app PR: first use a reference to your library branch in gradle/libs.versions.toml: ext -> androidLibraryVersion, e.g. androidLibraryVersion = "changeSearch-SNAPSHOT"
- on app PR: first use a reference to your library branch in build.gradle: ext -> androidLibraryVersion, e.g. androidLibraryVersion = "changeSearch-SNAPSHOT"
- on library PR: use label "client change required" to indicate that this is breaking change. This will prevent GitHub from merging it.
Once both PRs are reviewed and ready to merge:

View File

@ -268,8 +268,7 @@ android {
}
dependencies {
// region Nextcloud Libs
implementation(libs.android.library) {
implementation("com.github.nextcloud:android-library:$androidLibraryVersion") {
exclude group: "org.ogce", module: "xpp3" // unused in Android and brings wrong Junit version
}

View File

@ -10,6 +10,7 @@
*/
buildscript {
ext {
androidLibraryVersion ="8e561c7e65f208492c20b106eb25cfbe43dc7189"
androidPluginVersion = "8.9.2"
androidxMediaVersion = "1.5.1"
androidxTestVersion = "1.6.1"

View File

@ -261,12 +261,12 @@ end
desc "check if library is set correctly"
private_lane :checkLibrary_RC do
sh(" if [ $(egrep 'androidLibraryVersion.*master.*' ../gradle/libs.versions.toml -c) -eq 1 ] ; then echo 'Library is set to master tag; aborting!' ; exit 1 ; fi")
sh(" if [ $(egrep 'androidLibraryVersion.*master.*' ../build.gradle -c) -eq 1 ] ; then echo 'Library is set to master tag; aborting!' ; exit 1 ; fi")
end
desc "check if library is set correctly: must NOT contain master nor rc"
private_lane :checkLibrary_Final do
sh(" if [ $(grep 'androidLibraryVersion' ../gradle/libs.versions.toml | egrep 'master|rc' -c) -eq 1 ] ; then echo 'Library is still set to rc tag; aborting!' ; exit 1 ; fi")
sh(" if [ $(grep 'androidLibraryVersion' ../build.gradle | egrep 'master|rc' -c) -eq 1 ] ; then echo 'Library is still set to rc tag; aborting!' ; exit 1 ; fi")
end
desc "check if screenshots exists and exit"

View File

@ -3,7 +3,6 @@
[versions]
androidCommonLibraryVersion = "0.25.0"
androidLibraryVersion = "cb9ebaa0c8839c8593ac5fe5930e633bf8b41328"
daggerVersion = "2.56.2"
espressoVersion = "3.6.1"
media3 = "1.5.1"
@ -52,7 +51,6 @@ kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", v
detekt-gradle-plugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detektGradlePlugin" }
# Android Library
android-library = { module = "com.github.nextcloud:android-library", version.ref = "androidLibraryVersion" }
android-common = { module = "com.github.nextcloud.android-common:ui", version.ref = "androidCommonLibraryVersion" }
# Dagger

View File

@ -4,15 +4,12 @@
# SPDX-FileCopyrightText: 2016 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$SCRIPT_DIR/../../"
snapshotCount=$(./gradlew dependencies | grep SNAPSHOT -c)
betaCount=$(grep "<bool name=\"is_beta\">true</bool>" app/src/main/res/values/setup.xml -c)
libraryHash=$(grep androidLibraryVersion build.gradle | cut -d= -f2 | tr -d \")
snapshotCount=$("$PROJECT_ROOT/gradlew" -p "$PROJECT_ROOT" dependencies | grep SNAPSHOT -c)
betaCount=$(grep "<bool name=\"is_beta\">true</bool>" "$PROJECT_ROOT/app/src/main/res/values/setup.xml" -c)
libraryHash=$(grep androidLibraryVersion "$PROJECT_ROOT/gradle/libs.versions.toml" | cut -d= -f2 | tr -d \")
baseBranch="master"
lastHashes=$(curl "https://api.github.com/repos/nextcloud/android-library/commits?sha=$baseBranch" | jq ".[] .sha" | head -n 20)
baseBranch="master"
if [[ $(echo "$lastHashes" | grep -c $libraryHash) -ne 1 ]]; then
echo "Library commit not within last 10 hashes, please rebase!"
@ -27,4 +24,6 @@ if [[ $betaCount -gt 0 ]] ; then
echo "Beta is set in setup.xml"
exit 1
fi
exit 0

View File

@ -9,18 +9,15 @@ git checkout master
git pull
latestCommit=$(curl -s https://api.github.com/repos/nextcloud/android-library/commits/master | jq .sha | sed s'/\"//g')
SCRIPT_DIR="$(cd "$(dirname \"${BASH_SOURCE[0]}\")" && pwd)"
PROJECT_ROOT="$SCRIPT_DIR/../../"
currentCommit=$(grep "androidLibraryVersion" "$PROJECT_ROOT/gradle/libs.versions.toml" | cut -f2 -d'"')
currentCommit=$(grep "androidLibraryVersion" build.gradle | cut -f2 -d'"')
[[ $latestCommit == "$currentCommit" ]] && echo "Nothing to do. Commit is: $latestCommit" && exit # nothing to do
git fetch
git checkout -B update-library-"$(date +%F)" origin/master
sed -i s"#androidLibraryVersion\ =.*#androidLibraryVersion =\"$latestCommit\"#" "$PROJECT_ROOT/gradle/libs.versions.toml"
"$PROJECT_ROOT/gradlew" --console=plain --dependency-verification lenient -q --write-verification-metadata sha256,pgp help
sed -i s"#androidLibraryVersion\ =.*#androidLibraryVersion =\"$latestCommit\"#" build.gradle
./gradlew --console=plain --dependency-verification lenient -q --write-verification-metadata sha256,pgp help
git add build.gradle
git add gradle/verification-metadata.xml