Update net.osmand.plus to version 4.0.7 (No CV Bump)

Includes new build script code to remove/stub the Android billing
library, as well as code changes to prevent the payments preference
screen from being reachable (as it relies on a working billing system).
This commit is contained in:
Matthew Hague 2021-08-31 21:20:07 +01:00 committed by Licaon_Kter
parent 817b6a9c3d
commit bc90571ad2

View file

@ -4110,6 +4110,122 @@ Builds:
- cp $$icu50-2-1-patched$$/icu4j/icu4j.jar ../OsmAnd-java/libs/
ndk: r17c
- versionName: 4.0.7
versionCode: 407
commit: v4.0.7
subdir: android/OsmAnd
submodules: true
sudo:
- apt-get update || apt-get update
- apt-get install --yes swig
gradle:
- android
- full
- legacy
- fat
srclibs:
- icu50-2-1-patched@0d825a9779eeb8ee35977ddf8bb4bea4119bf638
- osmand-external-skia@android/oreo
rm:
- android/OsmAnd-java/libs/*.jar
- android/OsmAnd/libs/*.jar
- android/OsmAnd-telegram/
- help/website/images/features.zip
- resources/icons/tools/SVGtoXML/vd-tool
prebuild:
- sed -i -e "/.*OsmAndCore.*SNAPSHOT.*/d" build-common.gradle
- sed -i -e "/.*OsmAndCore.*SNAPSHOT.*/d" build.gradle
- sed -i -e "/ivy {/,+6d" ../build.gradle
- rm build-library.gradle
- perl -i -0 -p -e "s|maven {\n\s*url 'https://developer.huawei.com/repo/'\n\s*}||g"
../build.gradle
- sed -i -e "/huaweiImplementation/d" build.gradle
- sed -i -e "s/System.getenv(\"APK_VERSION\")/\"$$VERSION$$\"/g" build.gradle
- sed -i -e "s/System.getenv(\"APK_NUMBER_VERSION\")/\"$$VERCODE$$\"/g" build.gradle
- sed -i -e "s/System.getenv(\"TARGET_APP_NAME\")/\"OsmAnd~\"/g" build.gradle
- "sed -i -e \"s/implementation fileTree.*/implementation fileTree(include:\
\ ['icu4j.jar'], dir: 'libs')\\n implementation group: 'net.sf.trove4j', name:\
\ 'trove4j', version: '3.0.3'\\n/\" ../OsmAnd-java/build.gradle"
- "sed -i -e \"s/implementation fileTree.*/implementation fileTree(include:\
\ ['classes.jar','icu4j.jar'], dir: 'libs')\\n implementation group: 'net.sf.trove4j',\
\ name: 'trove4j', version: '3.0.3'\\n/\" build-common.gradle"
- sed -i -e "s/, ':OsmAnd-telegram'//" ../settings.gradle
- pushd ../../core-legacy/externals
- sed -i "s/# Extract/sha256sum \$SRCLOC\/upstream.tar.bz2 | grep 13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677
|| { echo 'Failed checksum' 1>\&2; exit; }/" protobuf/configure.sh
- sed -i "/# Download/,+8d" skia/configure.sh
- sed -i "s/# Patch/cp -r $(echo $$osmand-external-skia$$ | sed 's/\//\\\//g')
\$SRCLOC\/upstream.original/" skia/configure.sh
- popd
- echo -e "\norg.gradle.jvmargs=-XX:MaxHeapSize=2048m" >> ../gradle.properties
- sed -i -e "/.*com.google.android.play.*/d" build-common.gradle
- "echo \" package net.osmand.plus.helpers; import net.osmand.plus.OsmandApplication;\
\ import net.osmand.plus.activities.MapActivity; import androidx.annotation.Nullable;\
\ import androidx.fragment.app.FragmentActivity;\npublic class RateUsHelper\
\ { public RateUsHelper() { } public void storeRateResult(FragmentActivity\
\ activity) { } public void updateState(@Nullable RateUsState state) { } public\
\ static boolean shouldShowRateDialog(OsmandApplication app) { return false;\
\ } public static void showRateDialog(MapActivity mapActivity) { } public\
\ enum RateUsState { INITIAL_STATE, IGNORED, LIKED, DISLIKED_WITH_MESSAGE,\
\ DISLIKED_WITHOUT_MESSAGE, DISLIKED_OR_IGNORED_AGAIN; } }\" > src/net/osmand/plus/helpers/RateUsHelper.java"
- sed -i -e "/.*com.amazon.in-app-purchasing.*/d" build.gradle
- sed -i -e "/.*com.android.billingclient.*/d" build-common.gradle
- echo " package net.osmand.plus.inapp; import android.app.Activity; import
android.content.Context; import androidx.annotation.NonNull; import androidx.annotation.Nullable;
import net.osmand.plus.OsmandApplication; import java.lang.ref.WeakReference;
public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { public
InAppPurchaseHelperImpl(OsmandApplication ctx) { super(ctx); } public void
isInAppPurchaseSupported(@NonNull final Activity activity, @Nullable final
InAppPurchaseInitCallback callback) { } protected void execImpl(@NonNull final
InAppPurchaseTaskType taskType, @NonNull final InAppCommand runnable) { }
public void purchaseFullVersion(@NonNull final Activity activity) { } public
void purchaseDepthContours(@NonNull final Activity activity) { } public void
purchaseContourLines(@NonNull Activity activity) throws UnsupportedOperationException
{ } public void manageSubscription(@NonNull Context ctx, @Nullable String
sku) { } protected InAppCommand getPurchaseSubscriptionCommand(final WeakReference<Activity>
activity, final String sku, final String userInfo) { return null; } protected
InAppCommand getRequestInventoryCommand(boolean userRequested) { return null;
} protected boolean isBillingManagerExists() { return false; } protected void
destroyBillingManager() { } } " > src-google/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java
- rm src-google/net/osmand/plus/inapp/util/BillingManager.java
- rm src-google/net/osmand/plus/inapp/InAppPurchasesImpl.java
- perl -i -0 -p -e 's|<Preference\n.*android:key="purchases_settings"(.*\n){9}||g'
res/xml/settings_main_screen.xml
- sed -i -e "/.*Preference purchasesSettings.*/,+1d" src/net/osmand/plus/settings/fragments/MainSettingsFragment.java
scanignore:
- help/website/fonts/*.woff
- help/website/fonts/*.eot
- help/website/fonts/*.ttf
- resources/voice/tr/voice/*.ogg
scandelete:
- resources/test-resources
build:
- pushd ../../OsmAnd-core/wrappers/android/
- sed -i -e "/Native/d" settings.gradle
- sed -i -e "/Native/d" build.gradle
- sed -i -e "/compileTask.*copyNdkSharedLibs/d" build.gradle
- sed -i -e "/compileTask.*copyQtSharedLibs/d" build.gradle
- sed -i -e "/compileTask.*copyQtJarLibs/d" build.gradle
- gradle assembleRelease
- cd build/outputs/aar
- unzip OsmAndCore_android-release.aar
- cp classes.jar ../../../../../../android/OsmAnd/libs/
- popd
- pushd $$icu50-2-1-patched$$/icu4j
- ant jar
- zip -d icu4j.jar "com/ibm/icu/impl/data/icudt50b/brkitr/*"
- zip -d icu4j.jar "com/ibm/icu/impl/data/icudt50b/coll/*"
- zip -d icu4j.jar "com/ibm/icu/impl/data/icudt50b/curr/*"
- zip -d icu4j.jar "com/ibm/icu/impl/data/icudt50b/lang/*"
- zip -d icu4j.jar "com/ibm/icu/impl/data/icudt50b/rbnf/*"
- zip -d icu4j.jar "com/ibm/icu/impl/data/icudt50b/region/*"
- zip -d icu4j.jar "com/ibm/icu/impl/data/icudt50b/translit/*"
- zip -d icu4j.jar "com/ibm/icu/impl/data/icudt50b/zone/*"
- popd
- cp $$icu50-2-1-patched$$/icu4j/icu4j.jar libs/
- cp $$icu50-2-1-patched$$/icu4j/icu4j.jar ../OsmAnd-java/libs/
ndk: r17c
MaintainerNotes: |-
Update CV only after sucessfully built and tested.
@ -4122,13 +4238,13 @@ MaintainerNotes: |-
been released). This includes preventing the various Qt files being built,
also with sed commands. Once this is built, the jar file is extracted from
build/outputs/aar/OsmAndCore_android-release.aar and it is copied to the
android/OsmAnd submodule as libs/classes.jar.
android/OsmAnd submodule as libs/classes.jar.
In the prebuild, the very first sed command prevents gradle downloading
OsmAndCore*SNAPSHOT.(j|a)ar, which contains the files built above. To
be extra sure the next command removes the osmand ivy repository.
We delete the huawei maven repo afterwards (with perl because multi-line sed is
We delete the huawei maven repo afterwards (with perl because multi-line sed is
annoying).
Some other jar files are distributed, prebuilt, with the OsmAnd submodules.
@ -4147,7 +4263,7 @@ MaintainerNotes: |-
In core-legacy/externals the build fetches in source tarballs from external
sources. Checksums for these need to be verified but are not. Hence the lines
that fallow add sha256sum checks to the build scripts where tarballs are
that follow add sha256sum checks to the build scripts where tarballs are
downloaded. As part of this, the skia library, which was fetched from a git
repo, has been made a srclib. Note, we have to adjust the build script here
because if we link to the srclib before building, it will be deleted (see
@ -4155,7 +4271,22 @@ MaintainerNotes: |-
are run from the android/OsmAnd directory, with $SRCLOC being the location of
the configure script.)
For all externals, check that the added checksums cover all, and that the skia version hasn't changed (it can be found in skia/configure.sh before the sed commands are applied).
For all externals, check that the added checksums cover all, and
that the skia version hasn't changed (it can be found in
skia/configure.sh before the sed commands are applied).
Also in the prebuild, delete com.google.android.play dependency and
replace RateUsHelper (which used it) with a stub.
Then delete the Android billing dependency and replace
InAppPurchaseHelperImpl with stubs. Delete BillingManager and
InAppPurchasesImpl as they were only used by
InAppPurchaseHelperImpl.
The next perl command removes to purchases_settings from the
settings screen as the stubs will crash if OsmAnd actually tries to
use them. The MainSettingFragment is also updated to avoid trying to
manipulate the removed setting.
AutoUpdateMode: None
UpdateCheckMode: None