Skip to content

Commit b2b9162

Browse files
mikehardydavid-allison
authored andcommitted
feat: create and upload un-minified release during publish
Now that we are minifying release builds, we may have problems. A quick way to tell for sure if it is related to minification is to have a user try a non-minified build. This is very difficult unless you have one already available for the same commit the minified builds are on, so build them and upload them at the same time This will also provide a way for users to self-help if it was a minification problem, as they can run unminified until fixed
1 parent 8eb1b5e commit b2b9162

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

AnkiDroid/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ android {
143143
}
144144
named('release') {
145145
testCoverageEnabled = testReleaseBuild
146-
minifyEnabled true
146+
minifyEnabled System.getenv("MINIFY_ENABLED") ? System.getenv("MINIFY_ENABLED") != "false" : true
147147
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
148148
testProguardFile 'proguard-test-rules.pro'
149149
splits.abi.universalApk = universalApkEnabled // Build universal APK for release with `-Duniversal-apk=true`

tools/release.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@ done
144144
# Pack up our proguard mapping file for debugging in case needed
145145
tar -zcf proguard-mappings.tar.gz AnkiDroid/build/outputs/mapping
146146

147+
# Create a full universal build that disables minify, to help diagnose proguard issues
148+
./gradlew --stop
149+
echo Running assembleFullRelease target with universal APK flag and MINIFY_ENABLED=false
150+
if ! MINIFY_ENABLED=false ./gradlew assembleFullRelease -Duniversal-apk=true
151+
then
152+
echo "unable to build full unminified APKs"
153+
exit 1
154+
fi
155+
# Copy our unminified full universal release out
156+
cp AnkiDroid/build/outputs/apk/full/release/AnkiDroid-full-universal-release.apk AnkiDroid-"$VERSION"-full-universal-nominify.apk
157+
147158
# Push to Github Releases.
148159
GITHUB_TOKEN=$(cat ~/src/my-github-personal-access-token)
149160
export GITHUB_TOKEN
@@ -181,6 +192,8 @@ for FLAVOR in $FLAVORS; do
181192
echo "Adding universal APK for $FLAVOR to Github release"
182193
github-release upload --tag v"$VERSION" --name AnkiDroid-"$VERSION"-"$FLAVOR"-universal.apk --file AnkiDroid-"$VERSION"-"$FLAVOR"-universal.apk
183194
done
195+
echo "Adding un-minified full universal APK to GitHub release"
196+
github-release upload --tag v"$VERSION" --name AnkiDroid-"$VERSION"-full-universal-nominify.apk --file AnkiDroid-"$VERSION"-full-universal-nominify.apk
184197
echo "Adding proguard mappings file to Github release"
185198
github-release upload --tag v"$VERSION" --name proguard-mappings.tar.gz --file proguard-mappings.tar.gz
186199

0 commit comments

Comments
 (0)