diff --git a/metadata/net.osmand.plus.yml b/metadata/net.osmand.plus.yml index 18da6f0828..b690cb05c1 100644 --- a/metadata/net.osmand.plus.yml +++ b/metadata/net.osmand.plus.yml @@ -4588,74 +4588,197 @@ Builds: - cp $$icu50-2-1-patched$$/icu4j/icu4j.jar ../OsmAnd-java/libs/ ndk: r19c + - versionName: 4.2.4 + versionCode: 424 + commit: v4.2.4 + subdir: android/OsmAnd + submodules: true + sudo: + - apt-get update || apt-get update + - apt-get install --yes swig openjdk-11-jdk-headless + - update-alternatives --auto java + gradle: + - android + - full + - legacy + - fat + srclibs: + - icu50-2-1-patched@7c3cf2d32b30a342eb48f755080db832abb5ade9 + - skia@android/11-release + - osmand-mpandroidchart@7628c347edbf577bf7522afc1ba829a538a02d0c + 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 "/.*mplementation.*OsmAndCore.*/d" -e "/play-services-location/d" + -e '/MPAndroidChart/d' build-common.gradle + - sed -i -e "/.*mplementation.*OsmAndCore.*/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','MPChartLib-release.aar'], 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 $$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, 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|!!' AndroidManifest.xml + 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-mpandroidchart$$ + - sed -i -e "s/android {/android { lintOptions { checkReleaseBuilds false }/" + MPChartLib/build.gradle + - rm -r MPChartExample + - gradle assembleRelease + - popd + - cp $$osmand-mpandroidchart$$/MPChartLib/build/outputs/aar/MPChartLib-release.aar + libs/ + - 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: r23c + MaintainerNotes: |- Update CV only after sucessfully built and tested. - Initial section of build commands builds the OsmAnd core java - interface. The standard build downloads a prebuilt jar file from the OsmAnd - build server. To avoid this, the required jar file is built in - OsmAnd-core/wrappers/android, with some sed commands to prevent building of the - full core (only the jar file is needed, the full core is not used (the legacy - core is used, built in the core-legacy module. OsmAnd-core in full has not yet - 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 + Initial build commands builds the OsmAnd core java interface. + Standard build downloads prebuilt jar file. We build the required + jar file in OsmAnd-core/wrappers/android, with some sed commands to + avoid building full core (only legacy jar needed). E.g. avoid Qt + files being built. Jar file extracted from + build/outputs/aar/OsmAndCore_android-release.aar copied to 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. + In the prebuild, the first sed commands prevent gradle downloading + prebuilt binaries. Also, remove osmand ivy repository and huwei maven. - We delete the huawei maven repo afterwards (with perl because multi-line sed is - annoying). + Other prebuilt jar files are distributed. The rm= command removes + these, and replacements from Maven. This is what the sed commands + replacing "compile fileTree" sections are doing. - Some other jar files are distributed, prebuilt, with the OsmAnd submodules. - The rm= command removes all of these, and replacements are sought through - Maven. This is what the sed commands replacing "compile fileTree" sections are - doing. Details of replaced jars are below. - - Replacement of jar files in OsmAnd-java where versions did not match: + Replacements where versions did not match: gnu-trove-osmand.jar replaced with net.sf.trove4j:trove4j:3.0.3 - icu4j-49_1_patched.jar was replaced with the icu50-2-1 srclib which is a - mirror of the nearest icu version i could find with the patch applied - (http://bugs.icu-project.org/trac/ticket/12021). The end of the build - process compiles this library and removes a bunch of unwanted data - files. + icu4j-49_1_patched.jar was replaced with the icu50-2-1 srclib, a + mirror of the nearest icu version available, plus the patch applied + (http://bugs.icu-project.org/trac/ticket/12021). The build process + compiles this and removes a bunch of unwanted data files. - 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 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 - skia/configure.sh). (Note, have to be careful with paths, because the scripts - are run from the android/OsmAnd directory, with $SRCLOC being the location of - the configure script.) + In core-legacy/externals source tarballs gotten from external + sources. Add checksum verification. As part of this, skia has been + made a srclib. Adjust the build script here to avoid build deleting + srclib skia. - 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 prebuild, delete com.google.android.play dependency and + replace RateUsHelper (which used it) with a stub. Delete the Android + billing dependency and replace InAppPurchaseHelperImpl with stubs. + Delete BillingManager and InAppPurchasesImpl as they were only used + by InAppPurchaseHelperImpl. - Also in the prebuild, delete com.google.android.play dependency and - replace RateUsHelper (which used it) with a stub. + Removes purchases_settings from the settings screen as stubs crash + if actually used. MainSettingFragment updated to avoid the removed + setting. Similarly, remove of addRestorePurchasesRow prevents the + restore purchases option on the downloads page. Adjust lines in + InAppPurchaseHelper.java to avoid subscriptions on startup. - Then delete the Android billing dependency and replace - InAppPurchaseHelperImpl with stubs. Delete BillingManager and - InAppPurchasesImpl as they were only used by - InAppPurchaseHelperImpl. + OsmAnd have custom MPAndroidChart, added as a srclib. Use the head + of customize_chart branch. This has a compilation error about SDK 28 + being targetted but not supported. Set checkReleaseBuilds to false + in lintOptions and delete unused example directory. - 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. Similarly, the removal of - addRestorePurchasesRow prevents the restore purchases option on the - downloads page. + Remove google-based location helper and replace with the + standard Android API throughout. Hide the settings options. - Then, since a start up attempt to get subscriptions was reported, - various lines in InAppPurchaseHelper.java are adjusted to avoid - attempting to access a null purchases variable. This has not be - tested to ensure there are not consequences down the line. + Add MANAGE_EXTERNAL_STORAGE permission to enable storage on external SD cards. See #2691. AutoUpdateMode: None UpdateCheckMode: None diff --git a/srclibs/osmand-mpandroidchart.yml b/srclibs/osmand-mpandroidchart.yml new file mode 100644 index 0000000000..48e9b4643c --- /dev/null +++ b/srclibs/osmand-mpandroidchart.yml @@ -0,0 +1,2 @@ +RepoType: git +Repo: https://github.com/osmandapp/MPAndroidChart.git