Merge pull request #162 from rkflx/rkflx/improve-first-run-experience

Make it easier to directly run BRouter from source checkout
This commit is contained in:
abrensch 2019-06-24 13:12:00 +02:00 committed by GitHub
commit 36ae1bb3f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 14 deletions

4
.gitignore vendored
View file

@ -1,7 +1,9 @@
misc/segments4
misc/customprofiles
target/
*.BAK
.classpath
.project
*.class
.idea/
*.iml
*.iml

View file

@ -10,10 +10,29 @@ For more infos see http://brouter.de/brouter
<a href="https://play.google.com/store/apps/details?id=btools.routingapp" target="_blank">
<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png" alt="Get it on Google Play" height="90"/></a>
## Build and Install
Compile with (Java 6!):
> mvn clean install -Dandroid.sdk.path=<your-sdk-path>
To skip building for Android, add ``-pl '!brouter-routing-app'``.
Next, download one or more [data file(s)](http://brouter.de/brouter/segments4/) (rd5) into the ``misc/segments4`` directory.
## Run
On Linux:
> ./misc/scripts/standalone/server.sh
On Windows (using Bash):
> ./misc/scripts/standalone/server.sh
On Windows (using CMD):
> misc\scripts\standalone\server.cmd
Related Projects
================

View file

@ -1,10 +1,3 @@
#!/bin/sh
# BRouter standalone server
# java -cp brouter.jar btools.brouter.RouteServer <segmentdir> <profile-map> <customprofiledir> <port> <maxthreads> [bindaddress]
# maxRunningTime is the request timeout in seconds, set to 0 to disable timeout
JAVA_OPTS="-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300"
CLASSPATH=../brouter.jar
java $JAVA_OPTS -cp $CLASSPATH btools.server.RouteServer ../segments4 ../profiles2 ../customprofiles 17777 1 localhost
BINDADDRESS="localhost" "$(dirname "$0")/server.sh"

View file

@ -3,8 +3,35 @@
REM BRouter standalone server
REM java -cp brouter.jar btools.brouter.RouteServer <segmentdir> <profile-map> <customprofiledir> <port> <maxthreads>
pushd %~dp0
REM maxRunningTime is the request timeout in seconds, set to 0 to disable timeout
set JAVA_OPTS=-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300
set CLASSPATH=../brouter.jar
java %JAVA_OPTS% -cp %CLASSPATH% btools.server.RouteServer ..\segments4 ..\profiles2 ..\customprofiles 17777 1
REM First search in locations matching the directory structure as found in the official BRouter zip archive
set CLASSPATH=../brouter.jar
set SEGMENTSPATH=..\segments4
set PROFILESPATH=..\profiles2
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'
) do (
set CLASSPATH=%%w
)
)
if not exist "%SEGMENTSPATH%" (
set SEGMENTSPATH=..\..\segments4
)
if not exist "%PROFILESPATH%" (
set PROFILESPATH=..\..\profiles2
)
if not exist "%CUSTOMPROFILESPATH%" (
set CUSTOMPROFILESPATH=..\..\customprofiles
)
java %JAVA_OPTS% -cp %CLASSPATH% btools.server.RouteServer "%SEGMENTSPATH%" "%PROFILESPATH%" "%CUSTOMPROFILESPATH%" 17777 1
popd

View file

@ -2,10 +2,30 @@
cd "$(dirname "$0")"
# BRouter standalone server
# java -cp brouter.jar btools.brouter.RouteServer <segmentdir> <profile-map> <customprofiledir> <port> <maxthreads>
# java -cp brouter.jar btools.brouter.RouteServer <segmentdir> <profile-map> <customprofiledir> <port> <maxthreads> [bindaddress]
# maxRunningTime is the request timeout in seconds, set to 0 to disable timeout
JAVA_OPTS="-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300"
CLASSPATH=../brouter.jar
java $JAVA_OPTS -cp $CLASSPATH btools.server.RouteServer ../segments4 ../profiles2 ../customprofiles 17777 1
# If paths are unset, first search in locations matching the directory structure
# as found in the official BRouter zip archive
CLASSPATH=${CLASSPATH:-"../brouter.jar"}
SEGMENTSPATH=${SEGMENTSPATH:-"../segments4"}
PROFILESPATH=${PROFILESPATH:-"../profiles2"}
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)"
fi
if [ ! -e "$SEGMENTSPATH" ]; then
SEGMENTSPATH="../../segments4"
fi
if [ ! -e "$PROFILESPATH" ]; then
PROFILESPATH="../../profiles2"
fi
if [ ! -e "$CUSTOMPROFILESPATH" ]; then
CUSTOMPROFILESPATH="../../customprofiles"
fi
java $JAVA_OPTS -cp $CLASSPATH btools.server.RouteServer "$SEGMENTSPATH" "$PROFILESPATH" "$CUSTOMPROFILESPATH" 17777 1 $BINDADDRESS