osmand: update to 2.8.2, revamp build recipe

Get rid of all prebuilt jar files in all off OsmAnd's repos.
Build the native (legacy) core from source (maybe this was already done before?).
We now additionally build the jni bridge from source, this requires
swig from jessie-backports. It also requires an additional repository,
OsmAnd-core, which actually contains the new, non-legacy core.
The tools submodule is not actually needed, so it was removed from the
build.

Many thanks to @Hague for all the work!
This commit is contained in:
Marcus Hoffmann 2017-11-07 18:43:54 +01:00
parent 49f76f6753
commit e130e8a11e

View file

@ -304,11 +304,85 @@ Build:2.7.5,275
sed -i -e '/javaMaxHeapSize/s/4g/1536m/g' build.gradle
ndk=r11c
Build:2.8.2,282
commit=eb0ec22a1bfc0266574a0ee9dcf21161054006b6
subdir=android/OsmAnd
submodules=yes
sudo=apt-get update && \
apt-get install --yes -t jessie-backports swig
gradle=full,legacy,fat
rm=android/eclipse-compile,android/OsmAnd-java/libs/*.jar,android/OsmAnd-java/test/libs/*.jar,android/OsmAnd/ant-lib/*.jar,android/OsmAnd/libs/*.jar,android/OsmAndCore-sample
prebuild=sed -i -e "/net.osmand:OsmAndCore_android:.*SNAPSHOT@jar/d" ../OsmAnd/build.gradle && \
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 && \
sed -i -e '/qt.*Compile/d' -e '/com.google.firebase/d' build.gradle ../plugins/Osmand-ParkingPlugin/build.gradle ../plugins/Osmand-SRTMPlugin/build.gradle ../plugins/Osmand-Skimaps/build.gradle ../plugins/Osmand-Nautical/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(\"APP_FEATURES\")/\"+play_market +gps_status -parking_plugin -blackberry -amazon -route_nav\"/g" build.gradle && \
sed -i -e "s/System.getenv(\"APP_NAME\")/\"OsmAnd~\"/g" build.gradle && \
sed -i -e "s/System.getenv(\"TARGET_APP_NAME\")/\"OsmAnd~\"/g" build.gradle && \
sed -i -e '/com.android.vending.BILLING/d' AndroidManifest.xml && \
sed -i -e '/javaMaxHeapSize/s/4g/1536m/g' build.gradle && \
sed -i -e "s/compile fileTree.*/ compile 'commons-logging:commons-logging:1.1.1'\n compile group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.3'\n compile 'org.json:json:20090211'\n compile 'it.unibo.alice.tuprolog:tuprolog:3.2.1'\n compile 'net.sf.kxml:kxml2:2.3.0'\n compile 'org.beanshell:bsh-core:2.0b4'\n compile 'com.ibm.icu:icu4j:50.1'\n compile 'fr.univ-valenciennes:bzip2:1.0'\n compile 'com.moparisthebest:junidecode:0.1.1'\n compile 'com.vividsolutions:jts-core:1.14.0'/" ../OsmAnd-java/build.gradle && \
sed -i -e "s/compile fileTree.*/ compile fileTree(include: ['classes.jar'], dir: 'libs')\n compile 'commons-logging:commons-logging-api:1.1'\n compile 'it.unibo.alice.tuprolog:tuprolog:3.2.1'\n compile 'org.beanshell:bsh-core:2.0b4'\n compile 'com.ibm.icu:icu4j:50.1'\n compile 'fr.univ-valenciennes:bzip2:1.0'\n compile 'com.moparisthebest:junidecode:0.1.1'\n compile group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.3'\n compile 'org.immutables:gson:2.5.0'\n compile 'com.vividsolutions:jts-core:1.14.0'/" build.gradle && \
sed -i -e "s/public void debug(Object message) {/ public void trace(Object message) { }\n public void trace(Object message, Throwable t) { }\n public boolean isTraceEnabled() { return false; }\n public void debug(Object message) {/" src/net/osmand/PlatformUtil.java && \
sed -i -e "s/, ':OsmAndCore-sample'//" ../settings.gradle
scanignore=help/website/help/map-legend_nautical.png,help/website/help/map-legend_default.png,android/OsmAnd/libs/classes.jar
ndk=r11c
Maintainer Notes:
Update CV only after sucessfully built and tested.
Summary and Description have been moved to the new localizable text files:
https://f-droid.org/docs/All_About_Descriptions_Graphics_and_Screenshots
scanignore: Initial section of prebuild 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
android/OsmAnd submodule as libs/classes.jar. Hence, scanignore must not
complain about this file. A couple of rogue pngs are also ignored.
The very first sed command prevents gradle downloading
OsmAndCore_android.*SNAPSHOT.jar, which contains the files built above.
Many 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:
commons-logging-1.1.1.jar replaced with commons-logging:commons-logging:1.1.1
gnu-trove-osmand.jar replaced with net.sf.trove4j:trove4j:3.0.3
tuprolog.jar replaced with it.unibo.alice.tuprolog:tuprolog:3.2.1
icu4j-49_1_patched.jar replaced with compile 'com.ibm.icu:icu4j:50.1' in the hope that whatever patch was applied appears also in 50.1.
bzip2-20090327.jar replaced with compile 'fr.univ-valenciennes:bzip2:1.0'
junidecode-0.1.jar replaced with compile 'com.moparisthebest:junidecode:0.1.1'
simple-logging.jar not replaced (subset of commons-logging-1.1.1.jar)
In OsmAnd directory, jar files are replaced as above except for those specifically excluded by the compile fileTree command, which are:
android-support-multidex.jar
QtAndroid-bundled.jar was not replaced
QtAndroidAccessibility-bundled.jar was not replaced
simple-logging.jar replaced by commons-logging-api:1.1 with sed addition of missing abstract methods trace(...) in PlatformUtils.java
The final sed command removes OsmAndCore-sample from the settings to prevent
its build (which also downloads prebuilt binaries). OsmAndCore-sample is demo
code that is not needed.
.
Auto Update Mode:None