From 90bb1b007959003eeaed0e66d7e2a4d197169a37 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Wed, 18 Aug 2021 13:03:54 +0200 Subject: [PATCH] migrate to gradle part 5 --- README.md | 7 +- brouter-map-creator/build.gradle | 28 +-- .../src/main/assets/segments4.zip | Bin 1050 -> 1056 bytes .../src/main/assets/serverconfig.txt | 4 +- brouter-server/build.gradle | 47 +++- misc/pbfparser/README.txt | 2 +- misc/readmes/mapcreation.md | 2 +- misc/readmes/readme_Android11.txt | 221 ++++++++++++++++++ .../scripts/mapcreation/process_pbf_planet.sh | 2 +- misc/scripts/standalone/server.cmd | 2 +- misc/scripts/standalone/server.sh | 2 +- 11 files changed, 280 insertions(+), 37 deletions(-) create mode 100644 misc/readmes/readme_Android11.txt diff --git a/README.md b/README.md index 6fc8ca6..52f649e 100644 --- a/README.md +++ b/README.md @@ -66,12 +66,17 @@ app), use gradlew clean build -x :brouter-routing-app:build ``` -Then build jars for server and map creator with all dependent classes +Then build a jar for server and map creator with all dependent classes ``` gradlew farJar ``` +Build a zip file for distribution. Contains readmes, profiles, apk and jar + +``` +gradlew distZip +``` ### Get the required segments (data) files diff --git a/brouter-map-creator/build.gradle b/brouter-map-creator/build.gradle index f2664f9..609bb50 100644 --- a/brouter-map-creator/build.gradle +++ b/brouter-map-creator/build.gradle @@ -1,34 +1,8 @@ plugins { - id 'application' + id 'java-library' } -application { - // Gradles 'application' plugin requires one main class; since we have multiple ones, just specify - // one of them, since the applications won't be run from gradle anyways. - mainClass.set('btools.mapcreator.PosUnifier') - - jar { - manifest { - attributes "Main-Class": getMainClass(), "Implementation-Version": project.version - } - } - - task fatJar(type: Jar) { - manifest.from jar.manifest - classifier = 'all' - from { - configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } - } { - exclude "META-INF/*.SF" - exclude "META-INF/*.DSA" - exclude "META-INF/*.RSA" - } - with jar - } - -} - dependencies { implementation project(':brouter-codec') implementation project(':brouter-util') diff --git a/brouter-routing-app/src/main/assets/segments4.zip b/brouter-routing-app/src/main/assets/segments4.zip index c7671fd2a293f68ffffab99965995089f6e3a3c1..c661c62a3e45b8ea609465eb591e3b12ce285ec9 100644 GIT binary patch delta 411 zcmbQmv4EpKz?+#xgn@y9gTc3zKUnXDl9UD`149TC1A_oiv^ce>EVU>(KQApaU9Y5~ zWNM&e-eCoSJ?^LE!%ms@EnT(TtJ1N*)?rKAQ8zX*U5jb;@dZv-=d9{t-hAdXx@Ue{0s+HbDc1ZrNOi>vs-3_GwsPk(bb7dt;Bgg`80DJg0rSkJbgBGpzmc zS7FbT3F5xI-_CFQa!;PWuQKjYe3#jY=s=S{^1imqt*W$6wtAJl7ZkcG`)rel$U)t! zdZrU+<@bkNKR#72BK2c$=DP6KOA{ZRR(KY(@!*v2PWt!qtylRs&waV{g+b&SC9Ui= zRjD%TBQIv3Ss< zB~t?(`wlDc>TZFR=+6wF}Z%p*_S^S zFm&~NP;jP4vVZzZ2KDyfJbpI85Be}~SLMzIOjFW1Cy9ErY> zmDL?z`JySJjQhBpL6gRJnTzl5Dm?ILNKnyz5W-Y&Q%8n><}ZhhchtUKUpQsT{@dGv zXNFA{_qNWNpZasPt=ygy7EAp_eh19Ycx8F@;^$W}nP26YoR;l6>{NDEQ*US3%*Hbn z)jM|Ct*eO?-*5c;by#@wtqBvom%oeIcsOR;0Y60@=~XNH+^e{y&h+>?9qv18{Ww*x zEAKqJXNvh0_KQyE|G8$$T;G4QsXAlM3lXXFS0*pY-6W}0`TyL#lim~h{%Zea2ZiY5 twagNmix{snD%vyP3SAXo_yWP?EM`YW`^jsVRT%>&Ut;!Pvu6eg0|0bFt8V}R diff --git a/brouter-routing-app/src/main/assets/serverconfig.txt b/brouter-routing-app/src/main/assets/serverconfig.txt index ff9eeb7..3f0b858 100644 --- a/brouter-routing-app/src/main/assets/serverconfig.txt +++ b/brouter-routing-app/src/main/assets/serverconfig.txt @@ -6,8 +6,8 @@ # segment_url=https://brouter.de/brouter/segments4/ -lookup_url=https://brouter.de/brouter/segments4/ -profiles_url=https://brouter.de/brouter/segments4/ +lookup_url=https://brouter.de/brouter/profiles2/ +profiles_url=https://brouter.de/brouter/profiles2/ # these are comma separated arrays diff --git a/brouter-server/build.gradle b/brouter-server/build.gradle index 14693a8..f54af9b 100644 --- a/brouter-server/build.gradle +++ b/brouter-server/build.gradle @@ -6,12 +6,16 @@ plugins { application { mainClass.set('btools.server.BRouter') + distTar.enabled = false + jar { manifest { attributes "Main-Class": getMainClass(), "Implementation-Version": project.version } } task fatJar(type: Jar) { + archiveFileName = 'brouter-' + project.version + '-all.jar' + manifest.from jar.manifest classifier = 'all' from { @@ -25,11 +29,50 @@ application { } } +distZip { + archiveFileName = 'brouter-' + project.version + '.zip' +} + +distributions { + main { + + contents { + exclude('**/brouter-codec*.jar') + exclude('**/brouter-core*.jar') + exclude('**/brouter-expressions*.jar') + exclude('**/brouter-map-creator*.jar') + exclude('**/brouter-mapaccess*.jar') + exclude('**/brouter-server*.jar') + exclude('**/brouter-util*.jar') + exclude('**/brouter-server') + exclude('**/brouter-server.bat') + exclude('**/all.brf') + exclude('**/softaccess.brf') + from ('../misc') { + include 'readmes/*' + include 'profiles2/*' + } + from ('../brouter-routing-app/build/outputs/apk/prod/release') { + include '*.apk' + } + from ('../brouter-routing-app/build/outputs/apk/minApi10/release') { + include '*.apk' + } + from ('../brouter-server/build/libs') { + include 'brouter-*-all.jar' + } + } + } +} + dependencies { testImplementation 'junit:junit:4.13.1' - - implementation project(':brouter-util') + + implementation project(':brouter-codec') implementation project(':brouter-core') + implementation project(':brouter-expressions') + implementation project(':brouter-map-creator') implementation project(':brouter-mapaccess') + implementation project(':brouter-util') } diff --git a/misc/pbfparser/README.txt b/misc/pbfparser/README.txt index 298e3b9..b43e019 100644 --- a/misc/pbfparser/README.txt +++ b/misc/pbfparser/README.txt @@ -11,7 +11,7 @@ by doing the following: this folder -> copy lib/default/protobuf-java-*.jar in the archive to protobuf.jar in this folder --> copy the brouter-server/target/brouter-server...with-dependencies.jar to +-> copy the brouter-server/build/libs/brouter-...-all.jar to brouter.jar in this folder -> compile the PBF-Parser using: javac -d . -cp protobuf.jar:osmosis.jar:brouter.jar *.java diff --git a/misc/readmes/mapcreation.md b/misc/readmes/mapcreation.md index d6bdfd4..1a5bee4 100644 --- a/misc/readmes/mapcreation.md +++ b/misc/readmes/mapcreation.md @@ -23,7 +23,7 @@ more efficient. If you want to use the latter one, you will have to build the `lib/default/osmosis-osm-binary-*.jar` files from the unzipped Osmosis archive to `misc/pbfparser/protobuf.jar` and `misc/pbfparser/osmosis.jar`. * Build BRouter and copy - `brouter-server/target/brouter-server-*-jar-with-dependencies.jar` to + `brouter-server/build/libs/brouter-*-all.jar` to `misc/pbfparser/brouter.jar`. * You can build the `pbfparser` using, in the `misc/pbfparser/` folder, diff --git a/misc/readmes/readme_Android11.txt b/misc/readmes/readme_Android11.txt new file mode 100644 index 0000000..3c28aa5 --- /dev/null +++ b/misc/readmes/readme_Android11.txt @@ -0,0 +1,221 @@ +BRouter - Version 1.4 - Setting up the Android App +==================================================== + +Choosing and Installing a Map-Tool +---------------------------------- + + +BRouter just calculates tracks as GPX- or Geojson-output, it +does not display any map or give any navigation +instuctions. Therefore you need a map-tool in +order for BRouter to be useful. + +Currently, BRouter cooperates with any map tool that can use the BRouter +interface without file access. So you need to install some, and get familiar with, +at least one of them: + +- "OsmAnd": See http://www.osmand.net Get It from Google-Play + or get it as an APK from the release-build archive: + http://download.osmand.net/releases/ + +- "Locus": See http://www.locusmap.eu There's a "Pro" + Version which is ad-free and a free version with ads. + You can get it from Google-Play, but for the free-version + there's also an APK-Download. + +- "Oruxmaps": See http://www.oruxmaps.com Oruxmaps is + Donation-Ware, which means it's free and you're supposed + to donate to the project if you want to support it. + + +Installing the BRouter App +-------------------------- + +You can install the BRouter-App either from Google's Play Store +or directly from the APK-File contained within the "brouter-1.6.2.zip" +distribution zip-file. + +Choosing a SD-Card Base Directory +--------------------------------- + +When first starting BRouter (or after deleting/moving +the brouter folder on the sd-card), it asks for a +sd-card base directory and gives you proposals plus +the option to enter any other base directory. + +Most phones (namely those with Android 4.x) have 2 logical +"SD-Cards", where the first one is internal and not an actual +Card, and the second one is a an optional "external" micro-sd-card +that can be taken out of the device. + +Navigation needs big data files that usually should go on an +external, big sd-card. You should accept the external card, which +is usually the one with the most space available. + +Since Android 11 BRouter app uses only its local storage on +.../Android/media/btools.routingapp/ + +That means it can't access the folders from other apps like OsmAnd, OruxMaps or Locus. + + +Completing your installation +---------------------------- + +After accepting a base-directory proposal, "BRouter" creates a subfolders +relative to this base directory, so you end up with e.g. the following structure: +(depending on base dir and your map-tool choice): + +/mnt/sdcard/Android/media/btools.routingapp/brouter +/mnt/sdcard/Android/media/btools.routingapp/brouter/segments4 <- ** put routing data files (*.rd5) here ** +/mnt/sdcard/Android/media/btools.routingapp/brouter/profiles2 <- lookup-table and routing profiles +/mnt/sdcard/Android/media/btools.routingapp/brouter/modes <- routing-mode/profile mapping +/mnt/sdcard/Android/media/btools.routingapp/import <- allow a small file exchange with other apps +/mnt/sdcard/Android/media/btools.routingapp/import/tracks <- place the nogo* files here + + +The "profiles2" and the "modes" directory get some reasonable default-configuration +from the installation procedure, but the "segments4" directory is basically empty +(except for the storageconfig.txt file) so you have to get routing-datafiles in +order to complete your installation. + +After accepting the base directory, the download manager starts automatically to +help you with this download. Or you can download +them manually from the following location: + + http://brouter.de/brouter/segments4 + +Routing data files are organised as 5*5 degree files, +with the Filename containing the south-west corner +of the square, which means: + +- You want to route near West48/North37 -> get W50_N35.rd5 +- You want to route near East7/North47 -> get E5_N45.rd5 + +From the above link you find routing data for all places in the world where OSM +data is available. The carsubset datafiles are needed only if you want to +calculate car-routes over long distances, otherwise you are fine with just the +normal (full) rd5's. + +The minimum files BRouter needs to work are e.g. + +/mnt/sdcard/Android/media/btools.routingapp/brouter/segments4/E5_N45.rd5 +/mnt/sdcard/Android/media/btools.routingapp/brouter/profiles2/lookups.dat +/mnt/sdcard/Android/media/btools.routingapp/brouter/profiles2/trekking.brf + +But of course you can put as many routing data files +and routing profiles as you like. + +Since folders on other apps are not longer available you could use the +import folder to place a favourites.gpx with waypoints or +in subfolder 'tracks' your nogo*.gpx files. + + +Routing via the service interface +================================= + +BRouter is best used via it's "service interface". No need to start the BRouter-App +in order to do that, it's just a services that sits in the background and can be +called by the map-tools very much like on online routing service. + +To do that, you have to choose BRouter as a navigation service in your map-tool. +This is supported by OsmAnd, Locus-Maps and OruxMaps (In OsmAnd starting with version 1.7, +you see BRouter as a navigation service if BRouter is installed. You do not see the +option if BRouter is not installed). + +There's a mapping between the "routing-mode" asked for by the map-tool +(on out of 6: car/bike/foot * fast/slow) and BRouter's routing-profiles. +This mapping is stored in the file brouter/modes/serviceconfig.dat and is +pre-configured by the installation process to the following mapping: + + motorcar_fast -> car-test + motorcar_short -> moped + bicycle_fast -> fastbike + bicycle_short -> trekking + foot_fast -> shortest + foot_short -> shortest + +This mapping, however, can be changed any time by starting the BRouter-APP and using +the "Server Mode" button (or by editing the serviceconfig.dat manually). You can also +change gthe profiles themselves or create new ones. Please refer to the +"profile_developers_guide.txt" (contained in the distribution-zip) if you plan to +adapt routing profiles to your preferences. + +Note that if called via the service-interface, BRouter uses a timeout of 60 seconds, +which sets a limit on the distances you can calculate. + + +Calculate routes using the file interface +========================================= + +The other option is using the BRouter-App to calculate a route. This is the prefered option +when calculating long-distance-routes that would not finish within the 60 seconds timout +if calculated via the service-interface. + +To do this, start the BRouter-App, select two or more waypoints from the favorite waypoint-database +in your import folder and then start the route calculation. These waypoints are called "Favorites" +in OsmAnd, "POI"s in Locus or "Waypoints" in Oruxmaps and allow to store a location +on the map and give it a name. Export them from the app to the import folder. + +No need anymore to create special "to", "from", "via1..via9" points, but they are still supported +and if a "from" and a "to" wayppoint is found in the database, you will not be prompted +to select waypoints from the database. + +If a route is calculated, it is stored as "brouter0.gpx" in the BRouter import/tracks directory. +If started once more with identical input, BRouter will store a second route broute1.gpx +for the first alternative and so on. + + +Using nogo-areas +================ + +There's a special naming-convention to specify nogo-areas: + + "nogo[radius] [name]" defines a nogo-area, where radius (in Meter) + is optional and defaults to 20m, and the name is also optional. + So "nogo", "nogo1000", "nogo roadblock", "nogo200 badferry" are all valid + names for nogo-waypoints. + +The effect is that BRouter searches a route that does not touch the disc +defined by the position and the radius of the nogo-area. + +Nogo-Areas are effective in the service-interface and in the BRouter-App. +In the BRouter-App, you will get a nogo-dialog allowing to de-select them +if nogo-waypoints are found in the waypoint-database. This de-selection +can also be bound to a service mode using the "Server Mode" button to make +it effective in the service-interface as well, but initially, every nogo-area +is effective in the service-interface. + +Nogo areas can be used either to account for real obstacles or to enforce +personal routing preferences. + +Please note that nogo values can transfer also by new interface +parameter: polylines, polygons +see 'IBRouterService.aidl' for more information. + + +Mixed operation: "timeout-free recalculations" +============================================== + +You can combine both operation modes (service-interface + BRouter-App) to +become able to calculate very long distances, but make use of the advantages of +the service interface as well, especially the dynamic recalculations if you get +off the track, without running into the 60 seconds timeout. + +To support this, BRouter can do "timeout free recalculations". It works by +initially calculating a track to your destination and binding it to one or +more routing-modes using the "Server Mode" button. This way, BRouter stores +a "reference track" in the "brouter/modes" subdirectory. + +If afterwards a route to the exact same destination is calculated via the service interface, +BRouter uses a special calculation mode that makes use of the reference track for +faster processing that is guaranteed to give a result within 60 seconds. +"Exact same" destination means withing 5m, so best use the same waypoint for +re-calculating that you used for the initial calculation. + +This way you can follow a long distance route via the service interface, enjoying +automatic recalculations if you get off the track. + + +Issues and bugs: +================ + diff --git a/misc/scripts/mapcreation/process_pbf_planet.sh b/misc/scripts/mapcreation/process_pbf_planet.sh index dd6d97d..2ad173d 100755 --- a/misc/scripts/mapcreation/process_pbf_planet.sh +++ b/misc/scripts/mapcreation/process_pbf_planet.sh @@ -28,7 +28,7 @@ JAVA='/java/bin/java -Xmx2600m -Xms2600m -Xmn32m' BROUTER_PROFILES=$(realpath "../../profiles2") -BROUTER_JAR=$(realpath $(ls ../../../brouter-server/target/brouter-server-*-jar-with-dependencies.jar)) +BROUTER_JAR=$(realpath $(ls ../../../brouter-server/build/libs/brouter-*-all.jar)) OSMOSIS_JAR=$(realpath "../../pbfparser/osmosis.jar") PROTOBUF_JAR=$(realpath "../../pbfparser/protobuf.jar") PBFPARSER_JAR=$(realpath "../../pbfparser/pbfparser.jar") diff --git a/misc/scripts/standalone/server.cmd b/misc/scripts/standalone/server.cmd index dc35e9c..4a5e0a3 100644 --- a/misc/scripts/standalone/server.cmd +++ b/misc/scripts/standalone/server.cmd @@ -17,7 +17,7 @@ set CUSTOMPROFILESPATH=..\customprofiles REM Otherwise try to locate files inside the source checkout if not exist "%CLASSPATH%" ( for /f "tokens=*" %%w in ( - 'where /R ..\..\..\brouter-server\target brouter-server*-jar-with-dependencies.jar' + 'where /R ..\..\..\brouter-server\build\libs brouter-*-all.jar' ) do ( set CLASSPATH=%%w ) diff --git a/misc/scripts/standalone/server.sh b/misc/scripts/standalone/server.sh index b27914c..83513a7 100755 --- a/misc/scripts/standalone/server.sh +++ b/misc/scripts/standalone/server.sh @@ -16,7 +16,7 @@ CUSTOMPROFILESPATH=${CUSTOMPROFILESPATH:-"../customprofiles"} # Otherwise try to locate files inside the source checkout if [ ! -e "$CLASSPATH" ]; then - CLASSPATH="$(ls ../../../brouter-server/target/brouter-server-*jar-with-dependencies.jar | sort --reverse --version-sort | head --lines 1)" + CLASSPATH="$(ls ../../../brouter-server/build/libs/brouter-*-all.jar | sort --reverse --version-sort | head --lines 1)" fi if [ ! -e "$SEGMENTSPATH" ]; then SEGMENTSPATH="../../segments4"