Skip to content
Draft
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
3 changes: 1 addition & 2 deletions .github/workflows/assembleFlavors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@ jobs:
echo "kotlin.daemon.jvmargs=-Xmx3g -XX:+UseParallelGC -XX:MaxMetaspaceSize=512m"
echo "org.gradle.workers.max=2"
} >> gradle.properties
./gradlew ${{ matrix.tasks }}
./gradlew ${{ matrix.tasks }} -Pminify
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0

- name: Run unit tests with coverage
run: ./gradlew jacocoTestGplayDebugUnitTest
run: ./gradlew jacocoTestGplayDebugUnitTest -Pminify

- name: Upload failing results
if: ${{ failure() }}
Expand Down
13 changes: 12 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ val shotTest = System.getenv("SHOT_TEST") == "true"
val ciBuild = System.getenv("CI") == "true"
val perfAnalysis = project.hasProperty("perfAnalysis")

val minify = project.hasProperty("minify") // shall be off by default

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)
Expand Down Expand Up @@ -141,11 +143,20 @@ android {
flavorDimensions += "default"

buildTypes {
fun com.android.build.api.dsl.BuildType.commonMinifyConfig() {
isMinifyEnabled = minify
isShrinkResources = minify
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
release {
commonMinifyConfig()
buildConfigField("String", "NC_TEST_SERVER_DATA_STRING", "\"\"")
}

debug {
commonMinifyConfig()
enableUnitTestCoverage = project.hasProperty("coverage")
enableAndroidTestCoverage = project.hasProperty("coverage")
resConfigs("xxxhdpi")
Expand Down
24 changes: 24 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Nextcloud - Android Client
#
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later

# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.

# Silence missing-class warnings from optional transitive dependencies and Android/JDK API gaps.
-dontwarn com.gemalto.jp2.JP2Decoder
-dontwarn com.gemalto.jp2.JP2Encoder
-dontwarn java.time.zone.ZoneRulesProvider
-dontwarn org.joda.convert.ToString

# Commons HttpClient is still used at runtime, so keep these packages from being stripped or renamed.
-keep class org.apache.commons.httpclient.* { *; }
-keep class org.apache.commons.httpclient.auth.** { *; }

# Some libraries load .properties resources relative to their package.
# Keeping the package names preserves Class.getResourceAsStream(...) lookups after shrinking.
-keeppackagenames org.apache.jackrabbit.webdav
-keeppackagenames net.fortuna.ical4j
-keep class org.apache.commons.httpclient.cookie.** { *; }
2 changes: 2 additions & 0 deletions scripts/runAllScreenshotCombinations
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ do
if [[ $1 = "noCI" ]]; then
./gradlew --console plain genericDebugExecuteScreenshotTests \
$record \
-Pminify \
-Pscreenshot=true \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
Expand All @@ -43,6 +44,7 @@ do
else
./gradlew --console plain genericDebugExecuteScreenshotTests \
$record \
-Pminify \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
-Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" </dev/null > /dev/null \
Expand Down
3 changes: 2 additions & 1 deletion scripts/runCombinedTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ scripts/deleteOldComments.sh "$BRANCH" "IT" "$DRONE_PULL_REQUEST"

scripts/wait_for_emulator.sh || exit 1

./gradlew installGplayDebugAndroidTest
./gradlew installGplayDebugAndroidTest -Pminify

gradle_arguments=(
-Pcoverage
-Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest
-Pandroid.testInstrumentationRunnerArguments.filter=com.nextcloud.test.FlakyTestFilter,com.nextcloud.test.ServerVersionFilter
-Pminify
)

if [[ "$BRANCH" =~ ^stable([0-9]+)$ ]]; then
Expand Down
Loading