Merge pull request #4094 from Project-OSRM/refactor/rapidash

Replace timezone shapefile parsing with geojson parsing
This commit is contained in:
Patrick Niklaus 2017-06-02 20:01:04 +00:00 committed by GitHub
commit 0d12d2fd28
321 changed files with 44723 additions and 231 deletions

View File

@ -361,8 +361,5 @@ script:
npm run nodejs-tests
fi
- |
if [ "${ENABLE_MASON}" == "ON" ]; then
npm run test-conditionals
fi
- popd
- yarn test

View File

@ -447,11 +447,6 @@ if(ENABLE_MASON)
add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS})
set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS})
mason_use(libshp2 VERSION ${MASON_LIBSHP_VERSION})
target_include_directories(UTIL PRIVATE ${MASON_PACKAGE_libshp2_INCLUDE_DIRS})
set(MAYBE_SHAPEFILE ${MASON_PACKAGE_libshp2_STATIC_LIBS})
target_compile_definitions(UTIL PRIVATE COMPILE_DEFINITIONS ENABLE_SHAPEFILE)
if(NOT MASON_PACKAGE_tbb_LIBRARY_DIRS)
message(FATAL_ERROR "MASON_PACKAGE_tbb_LIBRARY_DIRS is empty, rpath will not work")
endif()
@ -478,6 +473,8 @@ if(ENABLE_MASON)
# expat and bzip2 are used from mason rather than the system
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/rapidjson/include)
else()
find_package(Boost 1.54 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
@ -525,15 +522,6 @@ else()
ENDIF()
ENDIF()
find_package(Shapefile) # optional package libshp-dev
if (Shapefile_FOUND)
set(MAYBE_SHAPEFILE "${LIBSHAPEFILE_LIBRARY}")
target_include_directories(UTIL PRIVATE ${LIBSHAPEFILE_INCLUDE_DIR})
target_compile_definitions(UTIL PRIVATE COMPILE_DEFINITIONS ENABLE_SHAPEFILE)
else()
set(MAYBE_SHAPEFILE "")
endif()
set(USED_LUA_LIBRARIES ${LUA_LIBRARIES})
add_dependency_includes(${LUA_INCLUDE_DIR})
@ -556,6 +544,9 @@ else()
find_package(Osmium REQUIRED COMPONENTS io)
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR})
set(RAPIDJSON_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/rapidjson/include")
include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR})
endif()
# prefix compilation with ccache by default if available and on clang or gcc
@ -610,12 +601,12 @@ set(BOOST_ENGINE_LIBRARIES
${BOOST_BASE_LIBRARIES})
# Binaries
target_link_libraries(osrm-datastore osrm_store ${Boost_PROGRAM_OPTIONS_LIBRARY} ${MAYBE_SHAPEFILE})
target_link_libraries(osrm-datastore osrm_store ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(osrm-extract osrm_extract ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(osrm-partition osrm_partition ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(osrm-customize osrm_customize ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${MAYBE_SHAPEFILE} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
set(EXTRACTOR_LIBRARIES
${BZIP2_LIBRARIES}
@ -640,7 +631,6 @@ set(CUSTOMIZER_LIBRARIES
${BOOST_ENGINE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${TBB_LIBRARIES}
${MAYBE_SHAPEFILE}
${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
set(UPDATER_LIBRARIES
@ -648,7 +638,6 @@ set(UPDATER_LIBRARIES
${CMAKE_THREAD_LIBS_INIT}
${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY}
${MAYBE_SHAPEFILE}
${MAYBE_COVERAGE_LIBRARIES}
${ZLIB_LIBRARY})
set(CONTRACTOR_LIBRARIES
@ -657,7 +646,6 @@ set(CONTRACTOR_LIBRARIES
${USED_LUA_LIBRARIES}
${STXXL_LIBRARY}
${TBB_LIBRARIES}
${MAYBE_SHAPEFILE}
${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
set(ENGINE_LIBRARIES
@ -678,7 +666,6 @@ set(UTIL_LIBRARIES
${CMAKE_THREAD_LIBS_INIT}
${STXXL_LIBRARY}
${TBB_LIBRARIES}
${MAYBE_SHAPEFILE}
${MAYBE_COVERAGE_LIBRARIES})
# Libraries
@ -698,10 +685,11 @@ install(TARGETS osrm-components DESTINATION bin)
if(BUILD_TOOLS)
message(STATUS "Activating OSRM internal tools")
add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $<TARGET_OBJECTS:UTIL>)
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES} ${MAYBE_SHAPEFILE})
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES})
install(TARGETS osrm-io-benchmark DESTINATION bin)
find_package(Shapefile)
if(SHAPEFILE_FOUND AND (Boost_VERSION VERSION_GREATER 106000 OR ENABLE_MASON))
add_executable(osrm-extract-conditionals src/tools/extract-conditionals.cpp $<TARGET_OBJECTS:UTIL>)
target_include_directories(osrm-extract-conditionals PRIVATE ${LIBSHAPEFILE_INCLUDE_DIR})

View File

@ -1,9 +1,7 @@
module.exports = {
default: '--strict --tags ~@stress --tags ~@todo --tags ~@shapelib --require features/support --require features/step_definitions',
verify: '--strict --tags ~@stress --tags ~@todo --tags ~@shapelib -f progress --require features/support --require features/step_definitions',
default: '--strict --tags ~@stress --tags ~@todo --require features/support --require features/step_definitions',
verify: '--strict --tags ~@stress --tags ~@todo -f progress --require features/support --require features/step_definitions',
todo: '--strict --tags @todo --require features/support --require features/step_definitions',
all: '--strict --require features/support --require features/step_definitions',
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@alternative --tags ~@matrix --tags ~@trip --tags ~@shapelib --require features/support --require features/step_definitions -f progress',
conditionals: '--strict --tags @conditionals --require features/support --require features/step_definitions',
mld_conditionals: '--strict --tags @conditionals --require features/support --require features/step_definitions -f progress'
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@alternative --tags ~@matrix --tags ~@trip --tags --require features/support --require features/step_definitions -f progress'
}

View File

@ -13,8 +13,8 @@ Feature: Car - Turn restrictions
Scenario: Car - ignores unrecognized restriction
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -43,8 +43,8 @@ Feature: Car - Turn restrictions
Scenario: Car - Restriction would be on, but the restriction was badly tagged
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
@ -76,8 +76,8 @@ Feature: Car - Turn restrictions
Scenario: Car - ignores except restriction
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -108,8 +108,8 @@ Feature: Car - Turn restrictions
Scenario: Car - only_right_turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -138,8 +138,8 @@ Feature: Car - Turn restrictions
Scenario: Car - No right turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -168,8 +168,8 @@ Feature: Car - Turn restrictions
Scenario: Car - only_left_turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -198,8 +198,8 @@ Feature: Car - Turn restrictions
Scenario: Car - No left turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -228,8 +228,8 @@ Feature: Car - Turn restrictions
Scenario: Car - Conditional restriction is off
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -258,8 +258,8 @@ Feature: Car - Turn restrictions
Scenario: Car - Conditional restriction is on
Given the extract extra arguments "--parse-conditional-restrictions"
# 10am utc, wed
Given the contract extra arguments "--parse-conditionals-from-now=1493805600"
Given the customize extra arguments "--parse-conditionals-from-now=1493805600"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
Given the node map
"""
n
@ -288,8 +288,8 @@ Feature: Car - Turn restrictions
Scenario: Car - Conditional restriction with multiple time windows
Given the extract extra arguments "--parse-conditional-restrictions"
# 5pm Wed 02 May, 2017 GMT
Given the contract extra arguments "--parse-conditionals-from-now=1493744400"
Given the customize extra arguments "--parse-conditionals-from-now=1493744400"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
Given the node map
"""
@ -317,50 +317,12 @@ Feature: Car - Turn restrictions
| n | p | nj,js,js,jp,jp |
| m | p | mj,jp,jp |
@only_turning @conditionals
Scenario: Car - Somewhere in Liverpool, the UK, GMT timezone
Given the extract extra arguments "--parse-conditional-restrictions=1"
# 9am UTC, 10am BST
Given the contract extra arguments "--parse-conditionals-from-now=1493802000"
Given the customize extra arguments "--parse-conditionals-from-now=1493802000"
# """
# a
# e
# b
# d
# c
# """
Given the node locations
| node | lat | lon |
| a | 51.5250 | -0.1166 |
| b | 51.5243 | -0.1159 |
| c | 51.5238 | -0.1152 |
| d | 51.5241 | -0.1167 |
| e | 51.5247 | -0.1153 |
And the ways
| nodes | name |
| ab | albic |
| bc | albic |
| db | dobe |
| be | dobe |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ab | be | b | only_left_turn @ (Mo-Fr 07:00-11:00) |
When I route I should get
| from | to | route | turns |
| a | c | albic,dobe,dobe,albic,albic | depart,turn left,continue uturn,turn left,arrive |
| a | e | albic,dobe,dobe | depart,turn left,arrive |
@shapelib @no_turning @conditionals
@no_turning @conditionals
Scenario: Car - only_right_turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -385,12 +347,12 @@ Feature: Car - Turn restrictions
| e | n | ej,nj,nj |
| e | p | ej,nj,nj,jp,jp |
@shapelib @no_turning @conditionals
@no_turning @conditionals
Scenario: Car - No right turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -415,12 +377,12 @@ Feature: Car - Turn restrictions
| e | n | ej,js,js,nj,nj | avoids right turn |
| e | p | ej,jp,jp | normal maneuver |
@shapelib @only_turning @conditionals
@only_turning @conditionals
Scenario: Car - only_left_turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -445,12 +407,12 @@ Feature: Car - Turn restrictions
| e | n | ej,js,js,nj,nj |
| e | p | ej,js,js,jp,jp |
@shapelib @no_turning @conditionals
@no_turning @conditionals
Scenario: Car - No left turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -475,12 +437,12 @@ Feature: Car - Turn restrictions
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
@shapelib @no_turning @conditionals
@no_turning @conditionals
Scenario: Car - Conditional restriction is off
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493719200"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
@ -505,12 +467,12 @@ Feature: Car - Turn restrictions
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
@shapelib @no_turning @conditionals
@no_turning @conditionals
Scenario: Car - Conditional restriction is on
Given the extract extra arguments "--parse-conditional-restrictions"
# 10am utc, wed
Given the contract extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493805600"
Given the customize extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493805600"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
Given the node map
"""
n
@ -535,12 +497,12 @@ Feature: Car - Turn restrictions
| e | n | ej,js,js,nj,nj |
| e | p | ej,jp,jp |
@shapelib @no_turning @conditionals
@no_turning @conditionals
Scenario: Car - Conditional restriction with multiple time windows
Given the extract extra arguments "--parse-conditional-restrictions"
# 5pm Wed 02 May, 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493744400"
Given the customize extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493744400"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
Given the node map
"""
@ -569,12 +531,12 @@ Feature: Car - Turn restrictions
| m | p | mj,jp,jp |
# https://www.openstreetmap.org/#map=18/38.91099/-77.00888
@shapelib @no_turning @conditionals
@no_turning @conditionals
Scenario: Car - DC North capitol situation, two on one off
Given the extract extra arguments "--parse-conditional-restrictions=1"
# 9pm Wed 02 May, 2017 UTC, 5pm EST
Given the contract extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493845200"
Given the customize extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493845200"
# 9pm Wed 02 May, 2017 UTC, 5pm EDT
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200"
# """
# a h
@ -616,12 +578,12 @@ Feature: Car - Turn restrictions
| f | d | cap north,florida,florida nw | depart,turn left,arrive |
| e | c | florida ne,florida nw,cap south,cap south | depart,continue uturn,turn right,arrive |
@shapelib @no_turning @conditionals
@no_turning @conditionals
Scenario: Car - DC North capitol situation, one on two off
Given the extract extra arguments "--parse-conditional-restrictions=1"
# 10:30am utc, wed, 6:30am est
Given the contract extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493807400"
Given the customize extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493807400"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400"
# """
# a h
@ -663,12 +625,89 @@ Feature: Car - Turn restrictions
| f | d | cap north,florida ne,florida ne,florida nw | depart,turn sharp right,continue uturn,arrive |
| e | c | florida ne,cap south,cap south | depart,turn left,arrive |
@shapelib @only_turning @conditionals
Scenario: Car - Somewhere in Liverpool, the UK, GMT timezone
Given the extract extra arguments "--parse-conditional-restrictions=1"
@only_turning @conditionals
Scenario: Car - Restriction is always off when point not found in timezone files
# same test as the following one, but given a different time zone file
Given the extract extra arguments "--parse-conditional-restrictions"
# 9am UTC, 10am BST
Given the contract extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493802000"
Given the customize extra arguments "--time-zone-file=test/data/tz/OGRGeoJSON.shp --parse-conditionals-from-now=1493802000"
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493802000"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493802000"
# """
# a
# e
# b
# d
# c
# """
Given the node locations
| node | lat | lon |
| a | 51.5250 | -0.1166 |
| b | 51.5243 | -0.1159 |
| c | 51.5238 | -0.1152 |
| d | 51.5241 | -0.1167 |
| e | 51.5247 | -0.1153 |
And the ways
| nodes | name |
| ab | albic |
| bc | albic |
| db | dobe |
| be | dobe |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ab | be | b | only_left_turn @ (Mo-Fr 07:00-11:00) |
When I route I should get
| from | to | route | turns |
| a | c | albic,albic | depart,arrive |
| a | e | albic,dobe,dobe | depart,turn left,arrive |
@only_turning @conditionals
Scenario: Car - Somewhere in london, the UK, GMT timezone
Given the extract extra arguments "--parse-conditional-restrictions"
# 9am UTC, 10am BST
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
# """
# a
# e
# b
# d
# c
# """
Given the node locations
| node | lat | lon |
| a | 51.5250 | -0.1166 |
| b | 51.5243 | -0.1159 |
| c | 51.5238 | -0.1152 |
| d | 51.5241 | -0.1167 |
| e | 51.5247 | -0.1153 |
And the ways
| nodes | name |
| ab | albic |
| bc | albic |
| db | dobe |
| be | dobe |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ab | be | b | only_left_turn @ (Mo-Fr 07:00-11:00) |
When I route I should get
| from | to | route | turns |
| a | c | albic,dobe,dobe,albic,albic | depart,turn left,continue uturn,turn left,arrive |
| a | e | albic,dobe,dobe | depart,turn left,arrive |
@only_turning @conditionals
Scenario: Car - Somewhere in London, the UK, GMT timezone
Given the extract extra arguments "--parse-conditional-restrictions=1"
# 9am UTC, 10am BST
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
# """
# a

View File

@ -40,6 +40,7 @@ module.exports = function () {
this.DEFAULT_GRID_SIZE = 100; // meters
// get algorithm name from the command line profile argument
this.ROUTING_ALGORITHM = process.argv[process.argv.indexOf('-p') + 1].match('mld') ? 'MLD' : 'CH';
this.TIMEZONE_NAMES = this.PLATFORM_WINDOWS ? 'win' : 'iana';
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;

View File

@ -15,7 +15,8 @@ module.exports = function () {
'{profile_file}': this.profileFile,
'{rastersource_file}': this.rasterCacheFile,
'{speeds_file}': this.speedsCacheFile,
'{penalties_file}': this.penaltiesCacheFile
'{penalties_file}': this.penaltiesCacheFile,
'{timezone_names}': this.TIMEZONE_NAMES
};
for (let k in table) {

View File

@ -0,0 +1,84 @@
#ifndef OSRM_GEOJSON_VALIDATION_HPP
#define OSRM_GEOJSON_VALIDATION_HPP
#include "util/exception.hpp"
#include "util/log.hpp"
#include "rapidjson/document.h"
namespace osrm
{
namespace util
{
inline void validateCoordinate(const rapidjson::Value &coordinate)
{
if (!coordinate.IsArray())
throw osrm::util::exception("Feature geometry has a non-array coordinate.");
if (coordinate.Capacity() != 2)
{
throw osrm::util::exception(
"Feature geometry has a malformed coordinate with more than 2 values.");
}
else
{
for (rapidjson::SizeType i = 0; i < coordinate.Size(); i++)
{
if (!coordinate[i].IsNumber() && !coordinate[i].IsDouble())
throw osrm::util::exception("Feature geometry has a non-number coordinate.");
}
}
}
inline void validateFeature(const rapidjson::Value &feature)
{
if (!feature.HasMember("type"))
{
throw osrm::util::exception("Feature is missing type member.");
}
else if (!feature["type"].IsString())
{
throw osrm::util::exception("Feature has non-string type member.");
}
if (!feature.HasMember("properties"))
{
throw osrm::util::exception("Feature is missing properties member.");
}
else if (!feature.GetObject()["properties"].IsObject())
{
throw osrm::util::exception("Feature has non-object properties member.");
}
if (!feature.HasMember("geometry"))
{
throw osrm::util::exception("Feature is missing geometry member.");
}
else if (!feature.GetObject()["geometry"].IsObject())
{
throw osrm::util::exception("Feature non-object geometry member.");
}
if (!feature["geometry"].GetObject().HasMember("type"))
{
throw osrm::util::exception("Feature geometry is missing type member.");
}
else if (!feature["geometry"].GetObject()["type"].IsString())
{
throw osrm::util::exception("Feature geometry has non-string type member.");
}
if (!feature["geometry"].GetObject().HasMember("coordinates"))
{
throw osrm::util::exception("Feature geometry is missing coordinates member.");
}
else if (!feature["geometry"].GetObject()["coordinates"].IsArray())
{
throw osrm::util::exception("Feature geometry has a non-array coordinates member.");
}
const auto coord_array = feature["geometry"].GetObject()["coordinates"].GetArray();
if (coord_array.Empty())
throw osrm::util::exception("Feature geometry coordinates member is empty.");
if (!coord_array[0].GetArray()[0].IsArray())
throw osrm::util::exception("Feature geometry coordinates array has non-array outer ring.");
}
}
}
#endif // OSRM_GEOJSON_VALIDATION_HPP

View File

@ -3,8 +3,12 @@
#include "util/log.hpp"
#include <boost/filesystem/path.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/optional.hpp>
#include <rapidjson/document.h>
#include <chrono>
@ -24,21 +28,19 @@ using rtree_t =
boost::geometry::index::rtree<std::pair<box_t, size_t>, boost::geometry::index::rstar<8>>;
using local_time_t = std::pair<polygon_t, struct tm>;
bool SupportsShapefiles();
class Timezoner
{
public:
Timezoner() = default;
Timezoner(std::string tz_filename, std::time_t utc_time_now);
Timezoner(const char geojson[], std::time_t utc_time_now);
Timezoner(const boost::filesystem::path &tz_shapes_filename, std::time_t utc_time_now);
struct tm operator()(const point_t &point) const;
boost::optional<struct tm> operator()(const point_t &point) const;
private:
void LoadLocalTimesRTree(const std::string &tz_shapes_filename, std::time_t utc_time);
void LoadLocalTimesRTree(rapidjson::Document &geojson, std::time_t utc_time);
struct tm default_time;
rtree_t rtree;
std::vector<local_time_t> local_times;
};

View File

@ -17,7 +17,6 @@
"scripts": {
"lint": "eslint -c ./.eslintrc features/step_definitions/ features/support/",
"test": "npm run lint && node ./node_modules/cucumber/bin/cucumber.js features/ -p verify && node ./node_modules/cucumber/bin/cucumber.js features/ -p mld",
"test-conditionals": "npm run lint && node ./node_modules/cucumber/bin/cucumber.js features/ -p conditionals && node ./node_modules/cucumber/bin/cucumber.js features/ -p mld_conditionals",
"clean": "rm -rf test/cache",
"docs": "./scripts/build_api_docs.sh",
"install": "node-pre-gyp install --fallback-to-build=false || ./scripts/node_install.sh",

View File

@ -18,13 +18,18 @@ VARIANT_TAG=v1.1.0
SOL_REPO="https://github.com/ThePhD/sol2.git"
SOL_TAG=v2.15.8
RAPIDJSON_REPO="https://github.com/miloyip/rapidjson.git"
RAPIDJSON_TAG=v1.1.0
VARIANT_LATEST=$(curl "https://api.github.com/repos/mapbox/variant/releases/latest" | jq ".tag_name")
OSMIUM_LATEST=$(curl "https://api.github.com/repos/osmcode/libosmium/releases/latest" | jq ".tag_name")
SOL_LATEST=$(curl "https://api.github.com/repos/ThePhD/sol2/releases/latest" | jq ".tag_name")
RAPIDJSON_LATEST=$(curl "https://api.github.com/repos/miloyip/rapidjson/releases/latest" | jq ".tag_name")
echo "Latest osmium release is $OSMIUM_LATEST, pulling in \"$OSMIUM_TAG\""
echo "Latest variant release is $VARIANT_LATEST, pulling in \"$VARIANT_TAG\""
echo "Latest sol2 release is $SOL_LATEST, pulling in \"$SOL_TAG\""
echo "Latest rapidjson release is $RAPIDJSON_LATEST, pulling in \"$RAPIDJSON_TAG\""
read -p "Update osmium (y/n) " ok
if [[ $ok =~ [yY] ]]
@ -56,4 +61,12 @@ then
fi
fi
read -p "Update rapidjson (y/n) " ok
if [[ $ok =~ [yY] ]]
then
if [ -d "third_party/rapidjson" ]; then
git subtree pull -P third_party/rapidjson/ $RAPIDJSON_REPO $RAPIDJSON_TAG --squash
else
git subtree add -P third_party/rapidjson/ $RAPIDJSON_REPO $RAPIDJSON_TAG --squash
fi
fi

View File

@ -68,18 +68,11 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig
->default_value(0),
"Optional for conditional turn restriction parsing, provide a UTC time stamp from "
"which "
"to evaluate the validity of conditional turn restrictions");
if (updater::SupportsShapefiles())
{
config_options.add_options()("time-zone-file",
boost::program_options::value<std::string>(
&contractor_config.updater_config.tz_file_path)
->default_value(""),
"Required for conditional turn restriction parsing, provide a "
"shp or dbf file containing "
"to evaluate the validity of conditional turn restrictions")(
"time-zone-file",
boost::program_options::value<std::string>(&contractor_config.updater_config.tz_file_path),
"Required for conditional turn restriction parsing, provide a geojson file containing "
"time zone boundaries");
}
// hidden options, will be allowed on command line, but will not be shown to the user
boost::program_options::options_description hidden_options("Hidden options");

View File

@ -8,7 +8,6 @@
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include <util/timezones.hpp>
#include <iostream>
@ -59,18 +58,13 @@ parseArguments(int argc, char *argv[], customizer::CustomizationConfig &customiz
->default_value(0),
"Optional for conditional turn restriction parsing, provide a UTC time stamp from "
"which "
"to evaluate the validity of conditional turn restrictions");
if (updater::SupportsShapefiles())
{
config_options.add_options()("time-zone-file",
"to evaluate the validity of conditional turn restrictions")(
"time-zone-file",
boost::program_options::value<std::string>(
&customization_config.updater_config.tz_file_path)
->default_value(""),
"Required for conditional turn restriction parsing, provide a "
"shp or dbf file containing "
"Required for conditional turn restriction parsing, provide a geojson file containing "
"time zone boundaries");
}
// hidden options, will be allowed on command line, but will not be
// shown to the user

View File

@ -464,6 +464,8 @@ bool IsRestrictionValid(const Timezoner &tz_handler,
// Get local time of the restriction
const auto &local_time = tz_handler(point_t{lon, lat});
if (!local_time)
return false;
// TODO: check restriction type [:<transportation mode>][:<direction>]
// http://wiki.openstreetmap.org/wiki/Conditional_restrictions#Tagging
@ -471,7 +473,7 @@ bool IsRestrictionValid(const Timezoner &tz_handler,
// TODO: parsing will fail for combined conditions, e.g. Sa-Su AND weight>7
// http://wiki.openstreetmap.org/wiki/Conditional_restrictions#Combined_conditions:_AND
if (osrm::util::CheckOpeningHours(condition, local_time))
if (osrm::util::CheckOpeningHours(condition, *local_time))
return true;
return false;
@ -835,7 +837,7 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
});
}
if (update_turn_penalties)
if (update_turn_penalties || update_conditional_turns)
{
const auto save_penalties = [](const auto &filename, const auto &data) -> void {
storage::io::FileWriter writer(filename, storage::io::FileWriter::GenerateFingerprint);

View File

@ -1,16 +1,23 @@
#include "util/timezones.hpp"
#include "util/exception.hpp"
#include "util/geojson_validation.hpp"
#include "util/log.hpp"
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/optional.hpp>
#include <boost/scope_exit.hpp>
#ifdef ENABLE_SHAPEFILE
#include <shapefil.h>
#endif
#include "rapidjson/document.h"
#include "rapidjson/istreamwrapper.h"
#include <fstream>
#include <regex>
#include <string>
#include <unordered_map>
#include <time.h>
// Function loads time zone shape polygons, computes a zone local time for utc_time,
// creates a lookup R-tree and returns a lambda function that maps a point
// to the corresponding local time
@ -19,59 +26,59 @@ namespace osrm
namespace updater
{
bool SupportsShapefiles()
{
#ifdef ENABLE_SHAPEFILE
return true;
#else
return false;
#endif
}
Timezoner::Timezoner(std::string tz_filename, std::time_t utc_time_now)
Timezoner::Timezoner(const char geojson[], std::time_t utc_time_now)
{
util::Log() << "Time zone validation based on UTC time : " << utc_time_now;
// Thread safety: MT-Unsafe const:env
default_time = *gmtime(&utc_time_now);
LoadLocalTimesRTree(tz_filename, utc_time_now);
rapidjson::Document doc;
rapidjson::ParseResult ok = doc.Parse(geojson);
if (!ok)
{
auto code = ok.Code();
auto offset = ok.Offset();
throw osrm::util::exception("Failed to parse timezone geojson with error code " +
std::to_string(code) + " malformed at offset " +
std::to_string(offset));
}
LoadLocalTimesRTree(doc, utc_time_now);
}
void Timezoner::LoadLocalTimesRTree(const std::string &tz_shapes_filename, std::time_t utc_time)
Timezoner::Timezoner(const boost::filesystem::path &tz_shapes_filename, std::time_t utc_time_now)
{
util::Log() << "Time zone validation based on UTC time : " << utc_time_now;
if (tz_shapes_filename.empty())
return;
#ifdef ENABLE_SHAPEFILE
// Load time zones shapes and collect local times of utc_time
auto shphandle = SHPOpen(tz_shapes_filename.c_str(), "rb");
auto dbfhandle = DBFOpen(tz_shapes_filename.c_str(), "rb");
throw osrm::util::exception("Missing time zone geojson file");
boost::filesystem::ifstream file(tz_shapes_filename);
if (!file.is_open())
throw osrm::util::exception("failed to open " + tz_shapes_filename.string());
BOOST_SCOPE_EXIT(&shphandle, &dbfhandle)
util::Log() << "Parsing " + tz_shapes_filename.string();
rapidjson::IStreamWrapper isw(file);
rapidjson::Document geojson;
geojson.ParseStream(isw);
if (geojson.HasParseError())
{
DBFClose(dbfhandle);
SHPClose(shphandle);
auto error_code = geojson.GetParseError();
auto error_offset = geojson.GetErrorOffset();
throw osrm::util::exception("Failed to parse " + tz_shapes_filename.string() +
" with error " + std::to_string(error_code) +
". JSON malformed at " + std::to_string(error_offset));
}
BOOST_SCOPE_EXIT_END
if (!shphandle || !dbfhandle)
{
throw osrm::util::exception("failed to open " + tz_shapes_filename + ".shp or " +
tz_shapes_filename + ".dbf file");
LoadLocalTimesRTree(geojson, utc_time_now);
}
int num_entities, shape_type;
SHPGetInfo(shphandle, &num_entities, &shape_type, NULL, NULL);
if (num_entities != DBFGetRecordCount(dbfhandle))
void Timezoner::LoadLocalTimesRTree(rapidjson::Document &geojson, std::time_t utc_time)
{
throw osrm::util::exception("inconsistent " + tz_shapes_filename + ".shp and " +
tz_shapes_filename + ".dbf files");
}
const auto tzid = DBFGetFieldIndex(dbfhandle, "TZID");
if (tzid == -1)
{
throw osrm::util::exception("did not find field called 'TZID' in the " +
tz_shapes_filename + ".dbf file");
}
if (!geojson.HasMember("type"))
throw osrm::util::exception("Failed to parse time zone file. Missing type member.");
if (!geojson["type"].IsString())
throw osrm::util::exception(
"Failed to parse time zone file. Missing string-based type member.");
if (geojson["type"].GetString() != std::string("FeatureCollection"))
throw osrm::util::exception(
"Failed to parse time zone file. Geojson is not of FeatureCollection type");
if (!geojson.HasMember("features"))
throw osrm::util::exception("Failed to parse time zone file. Missing features list.");
// Lambda function that returns local time in the tzname time zone
// Thread safety: MT-Unsafe const:env
@ -81,50 +88,75 @@ void Timezoner::LoadLocalTimesRTree(const std::string &tz_shapes_filename, std::
if (it == local_time_memo.end())
{
struct tm timeinfo;
#if defined(_WIN32)
_putenv_s("TZ", tzname);
_tzset();
localtime_s(&timeinfo, &utc_time);
#else
setenv("TZ", tzname, 1);
tzset();
localtime_r(&utc_time, &timeinfo);
#endif
it = local_time_memo.insert({tzname, timeinfo}).first;
}
return it->second;
};
// Get all time zone shapes and save local times in a vector
BOOST_ASSERT(geojson["features"].IsArray());
const auto &features_array = geojson["features"].GetArray();
std::vector<rtree_t::value_type> polygons;
for (int shape = 0; shape < num_entities; ++shape)
for (rapidjson::SizeType i = 0; i < features_array.Size(); i++)
{
auto object = SHPReadObject(shphandle, shape);
BOOST_SCOPE_EXIT(&object) { SHPDestroyObject(object); }
BOOST_SCOPE_EXIT_END
if (object && object->nSHPType == SHPT_POLYGON)
util::validateFeature(features_array[i]);
// time zone geojson specific checks
if (!features_array[i]["properties"].GetObject().HasMember("TZID") &&
!features_array[i]["properties"].GetObject().HasMember("tzid"))
{
// Find time zone polygon and place its bbox in into R-Tree
polygon_t polygon;
for (int vertex = 0; vertex < object->nVertices; ++vertex)
{
polygon.outer().emplace_back(object->padfX[vertex], object->padfY[vertex]);
throw osrm::util::exception("Feature is missing TZID member in properties.");
}
else if (!features_array[i]["properties"].GetObject()["tzid"].IsString())
{
throw osrm::util::exception("Feature has non-string TZID value.");
}
const std::string &feat_type =
features_array[i].GetObject()["geometry"].GetObject()["type"].GetString();
std::regex polygon_match("polygon", std::regex::icase);
std::smatch res;
if (std::regex_match(feat_type, res, polygon_match))
{
polygon_t polygon;
// per geojson spec, the first array of polygon coords is the exterior ring, we only
// want to access that
auto coords_outer_array = features_array[i]
.GetObject()["geometry"]
.GetObject()["coordinates"]
.GetArray()[0]
.GetArray();
for (rapidjson::SizeType i = 0; i < coords_outer_array.Size(); ++i)
{
util::validateCoordinate(coords_outer_array[i]);
const auto &coords = coords_outer_array[i].GetArray();
polygon.outer().emplace_back(coords[0].GetDouble(), coords[1].GetDouble());
}
polygons.emplace_back(boost::geometry::return_envelope<box_t>(polygon),
local_times.size());
// Get time zone name and emplace polygon and local time for the UTC input
const auto tzname = DBFReadStringAttribute(dbfhandle, shape, tzid);
local_times.emplace_back(local_time_t{polygon, get_local_time_in_tz(tzname)});
// std::cout << boost::geometry::dsv(boost::geometry::return_envelope<box_t>(polygon))
// << " " << tzname << " " << asctime(&local_times.back().second);
const auto &tzname =
features_array[i].GetObject()["properties"].GetObject()["tzid"].GetString();
local_times.push_back(local_time_t{polygon, get_local_time_in_tz(tzname)});
}
else
{
util::Log(logDEBUG) << "Skipping non-polygon shape in timezone file";
}
}
util::Log() << "Parsed " << polygons.size() << "time zone polygons." << std::endl;
// Create R-tree for collected shape polygons
rtree = rtree_t(polygons);
#endif
}
struct tm Timezoner::operator()(const point_t &point) const
boost::optional<struct tm> Timezoner::operator()(const point_t &point) const
{
std::vector<rtree_t::value_type> result;
rtree.query(boost::geometry::index::intersects(point), std::back_inserter(result));
@ -134,7 +166,7 @@ struct tm Timezoner::operator()(const point_t &point) const
if (boost::geometry::within(point, local_times[index].first))
return local_times[index].second;
}
return default_time;
return boost::none;
}
}
}

Binary file not shown.

View File

@ -1 +0,0 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,7 @@
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { "tzid": "America\/New_York" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -77.22564697265625, 38.758366935612784 ], [ -77.22564697265625, 39.030919255760622 ], [ -76.8218994140625, 39.030919255760622 ], [ -76.8218994140625, 38.758366935612784 ], [ -77.22564697265625, 38.758366935612784 ] ] ] } }
]
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,195 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"tzid": "Europe\\/Isle_of_Man"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-4.115297325087907,
54.52745749948722
],
[
-4.0344301,
54.479
],
[
-3.9654913,
54.292
],
[
-3.9921158,
54.219
],
[
-4.1294243,
54.062
],
[
-4.3969301,
53.905
],
[
-4.4945949,
53.869
],
[
-4.8076135,
53.845
],
[
-4.9658203125,
53.863090828317766
],
[
-4.9658203125,
54.35334454933009
],
[
-4.8948807,
54.392
],
[
-4.868376,
54.4339904
],
[
-4.542761329182349,
54.52745749948722
],
[
-4.115297325087907,
54.52745749948722
]
]
]
}
},
{
"type": "Feature",
"properties": {
"tzid": "Europe\\/London"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-4.9658203125,
52.99176453037065
],
[
-4.8118632,
53.085
],
[
-4.9658203125,
53.175318218576706
],
[
-4.9658203125,
53.42898022700984
],
[
-4.8911294,
53.532
],
[
-4.7808677,
53.595
],
[
-4.6646014,
53.621
],
[
-4.4026046,
53.634
],
[
-4.147566,
53.599
],
[
-4.0053089,
53.526
],
[
-3.8324713,
53.541
],
[
-3.6271987,
53.508
],
[
-3.4402166,
53.547
],
[
-3.4248294,
53.62
],
[
-3.3683406,
53.697
],
[
-3.3958062,
53.764
],
[
-3.3917274,
53.8697263
],
[
-3.5494708,
53.99
],
[
-3.605841,
54.079
],
[
-3.729297,
54.198
],
[
-3.7790165,
54.288
],
[
-3.9491542,
54.4245157
],
[
-4.115297325087907,
54.52745749948722
],
[
-2.13134765625,
54.52745749948722
],
[
-2.13134765625,
52.65639394198803
],
[
-4.9658203125,
52.65639394198803
],
[
-4.9658203125,
52.99176453037065
]
]
]
}
}
]
}

View File

@ -0,0 +1,7 @@
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { "tzid": "Europe\/London" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -0.212860107421875, 51.468766318140872 ], [ -0.212860107421875, 51.573868997085803 ], [ -0.014076232910156, 51.573868997085803 ], [ -0.014076232910156, 51.468766318140872 ], [ -0.212860107421875, 51.468766318140872 ] ] ] } }
]
}

View File

@ -0,0 +1,7 @@
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { "tzid": "EST+5EDT" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -77.22564697265625, 38.758366935612784 ], [ -77.22564697265625, 39.030919255760622 ], [ -76.8218994140625, 39.030919255760622 ], [ -76.8218994140625, 38.758366935612784 ], [ -77.22564697265625, 38.758366935612784 ] ] ] } }
]
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,195 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"tzid": "GMT0BST"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-4.115297325087907,
54.52745749948722
],
[
-4.0344301,
54.479
],
[
-3.9654913,
54.292
],
[
-3.9921158,
54.219
],
[
-4.1294243,
54.062
],
[
-4.3969301,
53.905
],
[
-4.4945949,
53.869
],
[
-4.8076135,
53.845
],
[
-4.9658203125,
53.863090828317766
],
[
-4.9658203125,
54.35334454933009
],
[
-4.8948807,
54.392
],
[
-4.868376,
54.4339904
],
[
-4.542761329182349,
54.52745749948722
],
[
-4.115297325087907,
54.52745749948722
]
]
]
}
},
{
"type": "Feature",
"properties": {
"tzid": "Europe\\/London"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-4.9658203125,
52.99176453037065
],
[
-4.8118632,
53.085
],
[
-4.9658203125,
53.175318218576706
],
[
-4.9658203125,
53.42898022700984
],
[
-4.8911294,
53.532
],
[
-4.7808677,
53.595
],
[
-4.6646014,
53.621
],
[
-4.4026046,
53.634
],
[
-4.147566,
53.599
],
[
-4.0053089,
53.526
],
[
-3.8324713,
53.541
],
[
-3.6271987,
53.508
],
[
-3.4402166,
53.547
],
[
-3.4248294,
53.62
],
[
-3.3683406,
53.697
],
[
-3.3958062,
53.764
],
[
-3.3917274,
53.8697263
],
[
-3.5494708,
53.99
],
[
-3.605841,
54.079
],
[
-3.729297,
54.198
],
[
-3.7790165,
54.288
],
[
-3.9491542,
54.4245157
],
[
-4.115297325087907,
54.52745749948722
],
[
-2.13134765625,
54.52745749948722
],
[
-2.13134765625,
52.65639394198803
],
[
-4.9658203125,
52.65639394198803
],
[
-4.9658203125,
52.99176453037065
]
]
]
}
}
]
}

View File

@ -0,0 +1,7 @@
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { "tzid": "GMT0BST" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -0.212860107421875, 51.468766318140872 ], [ -0.212860107421875, 51.573868997085803 ], [ -0.014076232910156, 51.573868997085803 ], [ -0.014076232910156, 51.468766318140872 ], [ -0.212860107421875, 51.468766318140872 ] ] ] } }
]
}

22
third_party/rapidjson/.gitattributes vendored Normal file
View File

@ -0,0 +1,22 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cpp text
*.h text
*.txt text
*.md text
*.cmake text
*.svg text
*.dot text
*.yml text
*.in text
*.sh text
*.autopkg text
Dockerfile text
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.json binary

25
third_party/rapidjson/.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
/bin/*
!/bin/data
!/bin/encodings
!/bin/jsonchecker
!/bin/types
/build
/doc/html
/doc/doxygen_*.db
*.a
# Temporary files created during CMake build
CMakeCache.txt
CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
Makefile
RapidJSON*.cmake
RapidJSON.pc
Testing
/googletest
install_manifest.txt
Doxyfile
Doxyfile.zh-cn
DartConfiguration.tcl
*.nupkg

3
third_party/rapidjson/.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "thirdparty/gtest"]
path = thirdparty/gtest
url = https://github.com/google/googletest.git

98
third_party/rapidjson/.travis.yml vendored Normal file
View File

@ -0,0 +1,98 @@
sudo: required
dist: precise
language: cpp
cache:
- ccache
env:
global:
- USE_CCACHE=1
- CCACHE_SLOPPINESS=pch_defines,time_macros
- CCACHE_COMPRESS=1
- CCACHE_MAXSIZE=100M
- ARCH_FLAGS_x86='-m32' # #266: don't use SSE on 32-bit
- ARCH_FLAGS_x86_64='-msse4.2' # use SSE4.2 on 64-bit
- GITHUB_REPO='miloyip/rapidjson'
- secure: "HrsaCb+N66EG1HR+LWH1u51SjaJyRwJEDzqJGYMB7LJ/bfqb9mWKF1fLvZGk46W5t7TVaXRDD5KHFx9DPWvKn4gRUVkwTHEy262ah5ORh8M6n/6VVVajeV/AYt2C0sswdkDBDO4Xq+xy5gdw3G8s1A4Inbm73pUh+6vx+7ltBbk="
before_install:
- sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- sudo apt-get install -y cmake valgrind g++-multilib libc6-dbg:i386
matrix:
include:
# gcc
- env: CONF=release ARCH=x86 CXX11=ON
compiler: gcc
- env: CONF=release ARCH=x86_64 CXX11=ON
compiler: gcc
- env: CONF=debug ARCH=x86 CXX11=OFF
compiler: gcc
- env: CONF=debug ARCH=x86_64 CXX11=OFF
compiler: gcc
# clang
- env: CONF=debug ARCH=x86 CXX11=ON CCACHE_CPP2=yes
compiler: clang
- env: CONF=debug ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
compiler: clang
- env: CONF=debug ARCH=x86 CXX11=OFF CCACHE_CPP2=yes
compiler: clang
- env: CONF=debug ARCH=x86_64 CXX11=OFF CCACHE_CPP2=yes
compiler: clang
- env: CONF=release ARCH=x86 CXX11=ON CCACHE_CPP2=yes
compiler: clang
- env: CONF=release ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
compiler: clang
# coverage report
- env: CONF=debug ARCH=x86 CXX11=ON GCOV_FLAGS='--coverage'
compiler: gcc
cache:
- ccache
- pip
after_success:
- pip install --user cpp-coveralls
- coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
- env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage'
compiler: gcc
cache:
- ccache
- pip
after_success:
- pip install --user cpp-coveralls
- coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
- script: # Documentation task
- cd build
- cmake .. -DRAPIDJSON_HAS_STDSTRING=ON -DCMAKE_VERBOSE_MAKEFILE=ON
- make travis_doc
cache: false
addons:
apt:
packages:
- doxygen
before_script:
- ccache -s
# hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469),
# exposed by merging PR#163 (using -march=native)
# TODO: Since this bug is already fixed. Remove this when valgrind can be upgraded.
- sed -i "s/-march=native//" CMakeLists.txt
- mkdir build
script:
- if [ "$CXX" = "clang++" ]; then export CXXFLAGS="-stdlib=libc++ ${CXXFLAGS}"; fi
- >
eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ;
(cd build && cmake
-DRAPIDJSON_HAS_STDSTRING=ON
-DRAPIDJSON_BUILD_CXX11=$CXX11
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=$CONF
-DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS"
-DCMAKE_EXE_LINKER_FLAGS=$GCOV_FLAGS
..)
- cd build
- make tests -j 2
- make examples -j 2
- ctest -j 2 -V `[ "$CONF" = "release" ] || echo "-E perftest"`

158
third_party/rapidjson/CHANGELOG.md vendored Normal file
View File

@ -0,0 +1,158 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
## 1.1.0 - 2016-08-25
### Added
* Add GenericDocument ctor overload to specify JSON type (#369)
* Add FAQ (#372, #373, #374, #376)
* Add forward declaration header `fwd.h`
* Add @PlatformIO Library Registry manifest file (#400)
* Implement assignment operator for BigInteger (#404)
* Add comments support (#443)
* Adding coapp definition (#460)
* documenttest.cpp: EXPECT_THROW when checking empty allocator (470)
* GenericDocument: add implicit conversion to ParseResult (#480)
* Use <wchar.h> with C++ linkage on Windows ARM (#485)
* Detect little endian for Microsoft ARM targets
* Check Nan/Inf when writing a double (#510)
* Add JSON Schema Implementation (#522)
* Add iostream wrapper (#530)
* Add Jsonx example for converting JSON into JSONx (a XML format) (#531)
* Add optional unresolvedTokenIndex parameter to Pointer::Get() (#532)
* Add encoding validation option for Writer/PrettyWriter (#534)
* Add Writer::SetMaxDecimalPlaces() (#536)
* Support {0, } and {0, m} in Regex (#539)
* Add Value::Get/SetFloat(), Value::IsLossLessFloat/Double() (#540)
* Add stream position check to reader unit tests (#541)
* Add Templated accessors and range-based for (#542)
* Add (Pretty)Writer::RawValue() (#543)
* Add Document::Parse(std::string), Document::Parse(const char*, size_t length) and related APIs. (#553)
* Add move constructor for GenericSchemaDocument (#554)
* Add VS2010 and VS2015 to AppVeyor CI (#555)
* Add parse-by-parts example (#556, #562)
* Support parse number as string (#564, #589)
* Add kFormatSingleLineArray for PrettyWriter (#577)
* Added optional support for trailing commas (#584)
* Added filterkey and filterkeydom examples (#615)
* Added npm docs (#639)
* Allow options for writing and parsing NaN/Infinity (#641)
* Add std::string overload to PrettyWriter::Key() when RAPIDJSON_HAS_STDSTRING is defined (#698)
### Fixed
* Fix gcc/clang/vc warnings (#350, #394, #397, #444, #447, #473, #515, #582, #589, #595, #667)
* Fix documentation (#482, #511, #550, #557, #614, #635, #660)
* Fix emscripten alignment issue (#535)
* Fix missing allocator to uses of AddMember in document (#365)
* CMake will no longer complain that the minimum CMake version is not specified (#501)
* Make it usable with old VC8 (VS2005) (#383)
* Prohibit C++11 move from Document to Value (#391)
* Try to fix incorrect 64-bit alignment (#419)
* Check return of fwrite to avoid warn_unused_result build failures (#421)
* Fix UB in GenericDocument::ParseStream (#426)
* Keep Document value unchanged on parse error (#439)
* Add missing return statement (#450)
* Fix Document::Parse(const Ch*) for transcoding (#478)
* encodings.h: fix typo in preprocessor condition (#495)
* Custom Microsoft headers are necessary only for Visual Studio 2012 and lower (#559)
* Fix memory leak for invalid regex (26e69ffde95ba4773ab06db6457b78f308716f4b)
* Fix a bug in schema minimum/maximum keywords for 64-bit integer (e7149d665941068ccf8c565e77495521331cf390)
* Fix a crash bug in regex (#605)
* Fix schema "required" keyword cannot handle duplicated keys (#609)
* Fix cmake CMP0054 warning (#612)
* Added missing include guards in istreamwrapper.h and ostreamwrapper.h (#634)
* Fix undefined behaviour (#646)
* Fix buffer overrun using PutN (#673)
* Fix rapidjson::value::Get<std::string>() may returns wrong data (#681)
* Add Flush() for all value types (#689)
* Handle malloc() fail in PoolAllocator (#691)
* Fix builds on x32 platform. #703
### Changed
* Clarify problematic JSON license (#392)
* Move Travis to container based infrastructure (#504, #558)
* Make whitespace array more compact (#513)
* Optimize Writer::WriteString() with SIMD (#544)
* x86-64 48-bit pointer optimization for GenericValue (#546)
* Define RAPIDJSON_HAS_CXX11_RVALUE_REFS directly in clang (#617)
* Make GenericSchemaDocument constructor explicit (#674)
* Optimize FindMember when use std::string (#690)
## [1.0.2] - 2015-05-14
### Added
* Add Value::XXXMember(...) overloads for std::string (#335)
### Fixed
* Include rapidjson.h for all internal/error headers.
* Parsing some numbers incorrectly in full-precision mode (`kFullPrecisionParseFlag`) (#342)
* Fix some numbers parsed incorrectly (#336)
* Fix alignment of 64bit platforms (#328)
* Fix MemoryPoolAllocator::Clear() to clear user-buffer (0691502573f1afd3341073dd24b12c3db20fbde4)
### Changed
* CMakeLists for include as a thirdparty in projects (#334, #337)
* Change Document::ParseStream() to use stack allocator for Reader (ffbe38614732af8e0b3abdc8b50071f386a4a685)
## [1.0.1] - 2015-04-25
### Added
* Changelog following [Keep a CHANGELOG](https://github.com/olivierlacan/keep-a-changelog) suggestions.
### Fixed
* Parsing of some numbers (e.g. "1e-00011111111111") causing assertion (#314).
* Visual C++ 32-bit compilation error in `diyfp.h` (#317).
## [1.0.0] - 2015-04-22
### Added
* 100% [Coverall](https://coveralls.io/r/miloyip/rapidjson?branch=master) coverage.
* Version macros (#311)
### Fixed
* A bug in trimming long number sequence (4824f12efbf01af72b8cb6fc96fae7b097b73015).
* Double quote in unicode escape (#288).
* Negative zero roundtrip (double only) (#289).
* Standardize behavior of `memcpy()` and `malloc()` (0c5c1538dcfc7f160e5a4aa208ddf092c787be5a, #305, 0e8bbe5e3ef375e7f052f556878be0bd79e9062d).
### Removed
* Remove an invalid `Document::ParseInsitu()` API (e7f1c6dd08b522cfcf9aed58a333bd9a0c0ccbeb).
## 1.0-beta - 2015-04-8
### Added
* RFC 7159 (#101)
* Optional Iterative Parser (#76)
* Deep-copy values (#20)
* Error code and message (#27)
* ASCII Encoding (#70)
* `kParseStopWhenDoneFlag` (#83)
* `kParseFullPrecisionFlag` (881c91d696f06b7f302af6d04ec14dd08db66ceb)
* Add `Key()` to handler concept (#134)
* C++11 compatibility and support (#128)
* Optimized number-to-string and vice versa conversions (#137, #80)
* Short-String Optimization (#131)
* Local stream optimization by traits (#32)
* Travis & Appveyor Continuous Integration, with Valgrind verification (#24, #242)
* Redo all documentation (English, Simplified Chinese)
### Changed
* Copyright ownership transfered to THL A29 Limited (a Tencent company).
* Migrating from Premake to CMAKE (#192)
* Resolve all warning reports
### Removed
* Remove other JSON libraries for performance comparison (#180)
## 0.11 - 2012-11-16
## 0.1 - 2011-11-18
[Unreleased]: https://github.com/miloyip/rapidjson/compare/v1.1.0...HEAD
[1.1.0]: https://github.com/miloyip/rapidjson/compare/v1.0.2...v1.1.0
[1.0.2]: https://github.com/miloyip/rapidjson/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/miloyip/rapidjson/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/miloyip/rapidjson/compare/v1.0-beta...v1.0.0

173
third_party/rapidjson/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,173 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
if(POLICY CMP0025)
# detect Apple's Clang
cmake_policy(SET CMP0025 NEW)
endif()
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
PROJECT(RapidJSON CXX)
set(LIB_MAJOR_VERSION "1")
set(LIB_MINOR_VERSION "1")
set(LIB_PATCH_VERSION "0")
set(LIB_VERSION_STRING "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_PATCH_VERSION}")
# compile in release with debug info mode by default
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
# Build all binaries in a separate directory
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." ON)
option(RAPIDJSON_BUILD_EXAMPLES "Build rapidjson examples." ON)
option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." ON)
option(RAPIDJSON_BUILD_THIRDPARTY_GTEST
"Use gtest installation in `thirdparty/gtest` by default if available" OFF)
option(RAPIDJSON_BUILD_CXX11 "Build rapidjson with C++11 (gcc/clang)" ON)
option(RAPIDJSON_BUILD_ASAN "Build rapidjson with address sanitizer (gcc/clang)" OFF)
option(RAPIDJSON_BUILD_UBSAN "Build rapidjson with undefined behavior sanitizer (gcc/clang)" OFF)
option(RAPIDJSON_HAS_STDSTRING "" OFF)
if(RAPIDJSON_HAS_STDSTRING)
add_definitions(-DRAPIDJSON_HAS_STDSTRING)
endif()
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics")
endif()
endif(CCACHE_FOUND)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror")
if (RAPIDJSON_BUILD_CXX11)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif()
if (RAPIDJSON_BUILD_ASAN)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.0")
message(FATAL_ERROR "GCC < 4.8 doesn't support the address sanitizer")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()
endif()
if (RAPIDJSON_BUILD_UBSAN)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0")
message(FATAL_ERROR "GCC < 4.9 doesn't support the undefined behavior sanitizer")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
endif()
endif()
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror -Wno-missing-field-initializers")
if (RAPIDJSON_BUILD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
if (RAPIDJSON_BUILD_ASAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()
if (RAPIDJSON_BUILD_UBSAN)
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
endif()
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
endif()
#add extra search paths for libraries and includes
SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE STRING "Directory where lib will install")
SET(DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}" CACHE PATH "Path to the documentation")
IF(UNIX OR CYGWIN)
SET(_CMAKE_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}")
ELSEIF(WIN32)
SET(_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/cmake")
ENDIF()
SET(CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" CACHE PATH "The directory cmake fiels are installed in")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
if(RAPIDJSON_BUILD_DOC)
add_subdirectory(doc)
endif()
add_custom_target(travis_doc)
add_custom_command(TARGET travis_doc
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/travis-doxygen.sh)
if(RAPIDJSON_BUILD_EXAMPLES)
add_subdirectory(example)
endif()
if(RAPIDJSON_BUILD_TESTS)
if(MSVC11)
# required for VS2012 due to missing support for variadic templates
add_definitions(-D_VARIADIC_MAX=10)
endif(MSVC11)
add_subdirectory(test)
include(CTest)
endif()
# pkg-config
IF (UNIX OR CYGWIN)
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
@ONLY)
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"
COMPONENT pkgconfig)
ENDIF()
install(FILES readme.md
DESTINATION "${DOC_INSTALL_DIR}"
COMPONENT doc)
install(DIRECTORY include/rapidjson
DESTINATION "${INCLUDE_INSTALL_DIR}"
COMPONENT dev)
install(DIRECTORY example/
DESTINATION "${DOC_INSTALL_DIR}/examples"
COMPONENT examples
# Following patterns are for excluding the intermediate/object files
# from an install of in-source CMake build.
PATTERN "CMakeFiles" EXCLUDE
PATTERN "Makefile" EXCLUDE
PATTERN "cmake_install.cmake" EXCLUDE)
# Provide config and version files to be used by other applications
# ===============================
export(PACKAGE ${PROJECT_NAME})
# cmake-modules
CONFIGURE_FILE(${PROJECT_NAME}Config.cmake.in
${PROJECT_NAME}Config.cmake
@ONLY)
CONFIGURE_FILE(${PROJECT_NAME}ConfigVersion.cmake.in
${PROJECT_NAME}ConfigVersion.cmake
@ONLY)
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION "${CMAKE_INSTALL_DIR}"
COMPONENT dev)

View File

@ -0,0 +1,30 @@
SET(GTEST_SEARCH_PATH
"${GTEST_SOURCE_DIR}"
"${CMAKE_CURRENT_LIST_DIR}/../thirdparty/gtest/googletest")
IF(UNIX)
IF(RAPIDJSON_BUILD_THIRDPARTY_GTEST)
LIST(APPEND GTEST_SEARCH_PATH "/usr/src/gtest")
ELSE()
LIST(INSERT GTEST_SEARCH_PATH 1 "/usr/src/gtest")
ENDIF()
ENDIF()
FIND_PATH(GTEST_SOURCE_DIR
NAMES CMakeLists.txt src/gtest_main.cc
PATHS ${GTEST_SEARCH_PATH})
# Debian installs gtest include directory in /usr/include, thus need to look
# for include directory separately from source directory.
FIND_PATH(GTEST_INCLUDE_DIR
NAMES gtest/gtest.h
PATH_SUFFIXES include
HINTS ${GTEST_SOURCE_DIR}
PATHS ${GTEST_SEARCH_PATH})
INCLUDE(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GTestSrc DEFAULT_MSG
GTEST_SOURCE_DIR
GTEST_INCLUDE_DIR)

7
third_party/rapidjson/RapidJSON.pc.in vendored Normal file
View File

@ -0,0 +1,7 @@
includedir=@INCLUDE_INSTALL_DIR@
Name: @PROJECT_NAME@
Description: A fast JSON parser/generator for C++ with both SAX/DOM style API
Version: @LIB_VERSION_STRING@
URL: https://github.com/miloyip/rapidjson
Cflags: -I${includedir}

View File

@ -0,0 +1,3 @@
get_filename_component(RAPIDJSON_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(RAPIDJSON_INCLUDE_DIRS "@INCLUDE_INSTALL_DIR@")
message(STATUS "RapidJSON found. Headers: ${RAPIDJSON_INCLUDE_DIRS}")

View File

@ -0,0 +1,10 @@
SET(PACKAGE_VERSION "@LIB_VERSION_STRING@")
IF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
SET(PACKAGE_VERSION_EXACT "true")
ENDIF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
IF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
SET(PACKAGE_VERSION_COMPATIBLE "true")
ELSE (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
SET(PACKAGE_VERSION_UNSUITABLE "true")
ENDIF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)

41
third_party/rapidjson/appveyor.yml vendored Normal file
View File

@ -0,0 +1,41 @@
os: Visual Studio 2015 CTP
version: 1.1.0.{build}
configuration:
- Debug
- Release
environment:
matrix:
# - VS_VERSION: 9 2008
# VS_PLATFORM: win32
# - VS_VERSION: 9 2008
# VS_PLATFORM: x64
- VS_VERSION: 10 2010
VS_PLATFORM: win32
- VS_VERSION: 10 2010
VS_PLATFORM: x64
- VS_VERSION: 11 2012
VS_PLATFORM: win32
- VS_VERSION: 11 2012
VS_PLATFORM: x64
- VS_VERSION: 12 2013
VS_PLATFORM: win32
- VS_VERSION: 12 2013
VS_PLATFORM: x64
- VS_VERSION: 14 2015
VS_PLATFORM: win32
- VS_VERSION: 14 2015
VS_PLATFORM: x64
before_build:
- git submodule update --init --recursive
- cmake -H. -BBuild/VS -G "Visual Studio %VS_VERSION%" -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=true -Wno-dev
build:
project: Build\VS\RapidJSON.sln
parallel: true
verbosity: minimal
test_script:
- cd Build\VS && if %CONFIGURATION%==Debug (ctest --verbose -E perftest --build-config %CONFIGURATION%) else (ctest --verbose --build-config %CONFIGURATION%)

Binary file not shown.

BIN
third_party/rapidjson/bin/data/menu.json vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
sample.json is obtained from http://code.google.com/p/json-test-suite/downloads/detail?name=sample.zip

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,150 @@
{
"id": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Core schema meta-schema",
"definitions": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#" }
},
"positiveInteger": {
"type": "integer",
"minimum": 0
},
"positiveIntegerDefault0": {
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
},
"simpleTypes": {
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
},
"stringArray": {
"type": "array",
"items": { "type": "string" },
"minItems": 1,
"uniqueItems": true
}
},
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uri"
},
"$schema": {
"type": "string",
"format": "uri"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"default": {},
"multipleOf": {
"type": "number",
"minimum": 0,
"exclusiveMinimum": true
},
"maximum": {
"type": "number"
},
"exclusiveMaximum": {
"type": "boolean",
"default": false
},
"minimum": {
"type": "number"
},
"exclusiveMinimum": {
"type": "boolean",
"default": false
},
"maxLength": { "$ref": "#/definitions/positiveInteger" },
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
"pattern": {
"type": "string",
"format": "regex"
},
"additionalItems": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#" }
],
"default": {}
},
"items": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/schemaArray" }
],
"default": {}
},
"maxItems": { "$ref": "#/definitions/positiveInteger" },
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
"uniqueItems": {
"type": "boolean",
"default": false
},
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" },
"additionalProperties": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#" }
],
"default": {}
},
"definitions": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"properties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"dependencies": {
"type": "object",
"additionalProperties": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/stringArray" }
]
}
},
"enum": {
"type": "array",
"minItems": 1,
"uniqueItems": true
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
]
},
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#" }
},
"dependencies": {
"exclusiveMaximum": [ "maximum" ],
"exclusiveMinimum": [ "minimum" ]
},
"default": {}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Test suite from http://json.org/JSON_checker/.
If the JSON_checker is working correctly, it must accept all of the pass*.json files and reject all of the fail*.json files.

View File

@ -0,0 +1 @@
TODO

View File

@ -0,0 +1,4 @@
language: python
python: "2.7"
install: pip install jsonschema
script: bin/jsonschema_suite check

View File

@ -0,0 +1,19 @@
Copyright (c) 2012 Julian Berman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,148 @@
JSON Schema Test Suite [![Build Status](https://travis-ci.org/json-schema/JSON-Schema-Test-Suite.png?branch=develop)](https://travis-ci.org/json-schema/JSON-Schema-Test-Suite)
======================
This repository contains a set of JSON objects that implementors of JSON Schema
validation libraries can use to test their validators.
It is meant to be language agnostic and should require only a JSON parser.
The conversion of the JSON objects into tests within your test framework of
choice is still the job of the validator implementor.
Structure of a Test
-------------------
If you're going to use this suite, you need to know how tests are laid out. The
tests are contained in the `tests` directory at the root of this repository.
Inside that directory is a subdirectory for each draft or version of the
schema. We'll use `draft3` as an example.
If you look inside the draft directory, there are a number of `.json` files,
which logically group a set of test cases together. Often the grouping is by
property under test, but not always, especially within optional test files
(discussed below).
Inside each `.json` file is a single array containing objects. It's easiest to
illustrate the structure of these with an example:
```json
{
"description": "the description of the test case",
"schema": {"the schema that should" : "be validated against"},
"tests": [
{
"description": "a specific test of a valid instance",
"data": "the instance",
"valid": true
},
{
"description": "another specific test this time, invalid",
"data": 15,
"valid": false
}
]
}
```
So a description, a schema, and some tests, where tests is an array containing
one or more objects with descriptions, data, and a boolean indicating whether
they should be valid or invalid.
Coverage
--------
Draft 3 and 4 should have full coverage. If you see anything missing or think
there is a useful test missing, please send a pull request or open an issue.
Who Uses the Test Suite
-----------------------
This suite is being used by:
### Coffeescript ###
* [jsck](https://github.com/pandastrike/jsck)
### Dart ###
* [json_schema](https://github.com/patefacio/json_schema)
### Erlang ###
* [jesse](https://github.com/klarna/jesse)
### Go ###
* [gojsonschema](https://github.com/sigu-399/gojsonschema)
* [validate-json](https://github.com/cesanta/validate-json)
### Haskell ###
* [aeson-schema](https://github.com/timjb/aeson-schema)
* [hjsonschema](https://github.com/seagreen/hjsonschema)
### Java ###
* [json-schema-validator](https://github.com/fge/json-schema-validator)
### JavaScript ###
* [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark)
* [direct-schema](https://github.com/IreneKnapp/direct-schema)
* [is-my-json-valid](https://github.com/mafintosh/is-my-json-valid)
* [jassi](https://github.com/iclanzan/jassi)
* [JaySchema](https://github.com/natesilva/jayschema)
* [json-schema-valid](https://github.com/ericgj/json-schema-valid)
* [Jsonary](https://github.com/jsonary-js/jsonary)
* [jsonschema](https://github.com/tdegrunt/jsonschema)
* [request-validator](https://github.com/bugventure/request-validator)
* [skeemas](https://github.com/Prestaul/skeemas)
* [tv4](https://github.com/geraintluff/tv4)
* [z-schema](https://github.com/zaggino/z-schema)
* [jsen](https://github.com/bugventure/jsen)
* [ajv](https://github.com/epoberezkin/ajv)
### Node.js ###
The JSON Schema Test Suite is also available as an
[npm](https://www.npmjs.com/package/json-schema-test-suite) package.
Node-specific support is maintained on the [node branch](https://github.com/json-schema/JSON-Schema-Test-Suite/tree/node).
See [NODE-README.md](https://github.com/json-schema/JSON-Schema-Test-Suite/blob/node/NODE-README.md)
for more information.
### .NET ###
* [Newtonsoft.Json.Schema](https://github.com/JamesNK/Newtonsoft.Json.Schema)
### PHP ###
* [json-schema](https://github.com/justinrainbow/json-schema)
### Python ###
* [jsonschema](https://github.com/Julian/jsonschema)
### Ruby ###
* [json-schema](https://github.com/hoxworth/json-schema)
### Rust ###
* [valico](https://github.com/rustless/valico)
### Swift ###
* [JSONSchema](https://github.com/kylef/JSONSchema.swift)
If you use it as well, please fork and send a pull request adding yourself to
the list :).
Contributing
------------
If you see something missing or incorrect, a pull request is most welcome!
There are some sanity checks in place for testing the test suite. You can run
them with `bin/jsonschema_suite check` or `tox`. They will be run automatically by
[Travis CI](https://travis-ci.org/) as well.

View File

@ -0,0 +1,283 @@
#! /usr/bin/env python
from __future__ import print_function
import sys
import textwrap
try:
import argparse
except ImportError:
print(textwrap.dedent("""
The argparse library could not be imported. jsonschema_suite requires
either Python 2.7 or for you to install argparse. You can do so by
running `pip install argparse`, `easy_install argparse` or by
downloading argparse and running `python2.6 setup.py install`.
See https://pypi.python.org/pypi/argparse for details.
""".strip("\n")))
sys.exit(1)
import errno
import fnmatch
import json
import os
import random
import shutil
import unittest
import warnings
if getattr(unittest, "skipIf", None) is None:
unittest.skipIf = lambda cond, msg : lambda fn : fn
try:
import jsonschema
except ImportError:
jsonschema = None
else:
validators = getattr(
jsonschema.validators, "validators", jsonschema.validators
)
ROOT_DIR = os.path.join(
os.path.dirname(__file__), os.pardir).rstrip("__pycache__")
SUITE_ROOT_DIR = os.path.join(ROOT_DIR, "tests")
REMOTES = {
"integer.json": {"type": "integer"},
"subSchemas.json": {
"integer": {"type": "integer"},
"refToInteger": {"$ref": "#/integer"},
},
"folder/folderInteger.json": {"type": "integer"}
}
REMOTES_DIR = os.path.join(ROOT_DIR, "remotes")
TESTSUITE_SCHEMA = {
"$schema": "http://json-schema.org/draft-03/schema#",
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {"type": "string", "required": True},
"schema": {"required": True},
"tests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {"type": "string", "required": True},
"data": {"required": True},
"valid": {"type": "boolean", "required": True}
},
"additionalProperties": False
},
"minItems": 1
}
},
"additionalProperties": False,
"minItems": 1
}
}
def files(paths):
for path in paths:
with open(path) as test_file:
yield json.load(test_file)
def groups(paths):
for test_file in files(paths):
for group in test_file:
yield group
def cases(paths):
for test_group in groups(paths):
for test in test_group["tests"]:
test["schema"] = test_group["schema"]
yield test
def collect(root_dir):
for root, dirs, files in os.walk(root_dir):
for filename in fnmatch.filter(files, "*.json"):
yield os.path.join(root, filename)
class SanityTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
print("Looking for tests in %s" % SUITE_ROOT_DIR)
cls.test_files = list(collect(SUITE_ROOT_DIR))
print("Found %s test files" % len(cls.test_files))
assert cls.test_files, "Didn't find the test files!"
def test_all_files_are_valid_json(self):
for path in self.test_files:
with open(path) as test_file:
try:
json.load(test_file)
except ValueError as error:
self.fail("%s contains invalid JSON (%s)" % (path, error))
def test_all_descriptions_have_reasonable_length(self):
for case in cases(self.test_files):
descript = case["description"]
self.assertLess(
len(descript),
60,
"%r is too long! (keep it to less than 60 chars)" % (descript,)
)
def test_all_descriptions_are_unique(self):
for group in groups(self.test_files):
descriptions = set(test["description"] for test in group["tests"])
self.assertEqual(
len(descriptions),
len(group["tests"]),
"%r contains a duplicate description" % (group,)
)
@unittest.skipIf(jsonschema is None, "Validation library not present!")
def test_all_schemas_are_valid(self):
for schema in os.listdir(SUITE_ROOT_DIR):
schema_validator = validators.get(schema)
if schema_validator is not None:
test_files = collect(os.path.join(SUITE_ROOT_DIR, schema))
for case in cases(test_files):
try:
schema_validator.check_schema(case["schema"])
except jsonschema.SchemaError as error:
self.fail("%s contains an invalid schema (%s)" %
(case, error))
else:
warnings.warn("No schema validator for %s" % schema)
@unittest.skipIf(jsonschema is None, "Validation library not present!")
def test_suites_are_valid(self):
validator = jsonschema.Draft3Validator(TESTSUITE_SCHEMA)
for tests in files(self.test_files):
try:
validator.validate(tests)
except jsonschema.ValidationError as error:
self.fail(str(error))
def test_remote_schemas_are_updated(self):
for url, schema in REMOTES.items():
filepath = os.path.join(REMOTES_DIR, url)
with open(filepath) as schema_file:
self.assertEqual(json.load(schema_file), schema)
def main(arguments):
if arguments.command == "check":
suite = unittest.TestLoader().loadTestsFromTestCase(SanityTests)
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(not result.wasSuccessful())
elif arguments.command == "flatten":
selected_cases = [case for case in cases(collect(arguments.version))]
if arguments.randomize:
random.shuffle(selected_cases)
json.dump(selected_cases, sys.stdout, indent=4, sort_keys=True)
elif arguments.command == "remotes":
json.dump(REMOTES, sys.stdout, indent=4, sort_keys=True)
elif arguments.command == "dump_remotes":
if arguments.update:
shutil.rmtree(arguments.out_dir, ignore_errors=True)
try:
os.makedirs(arguments.out_dir)
except OSError as e:
if e.errno == errno.EEXIST:
print("%s already exists. Aborting." % arguments.out_dir)
sys.exit(1)
raise
for url, schema in REMOTES.items():
filepath = os.path.join(arguments.out_dir, url)
try:
os.makedirs(os.path.dirname(filepath))
except OSError as e:
if e.errno != errno.EEXIST:
raise
with open(filepath, "wb") as out_file:
json.dump(schema, out_file, indent=4, sort_keys=True)
elif arguments.command == "serve":
try:
from flask import Flask, jsonify
except ImportError:
print(textwrap.dedent("""
The Flask library is required to serve the remote schemas.
You can install it by running `pip install Flask`.
Alternatively, see the `jsonschema_suite remotes` or
`jsonschema_suite dump_remotes` commands to create static files
that can be served with your own web server.
""".strip("\n")))
sys.exit(1)
app = Flask(__name__)
@app.route("/<path:path>")
def serve_path(path):
if path in REMOTES:
return jsonify(REMOTES[path])
return "Document does not exist.", 404
app.run(port=1234)
parser = argparse.ArgumentParser(
description="JSON Schema Test Suite utilities",
)
subparsers = parser.add_subparsers(help="utility commands", dest="command")
check = subparsers.add_parser("check", help="Sanity check the test suite.")
flatten = subparsers.add_parser(
"flatten",
help="Output a flattened file containing a selected version's test cases."
)
flatten.add_argument(
"--randomize",
action="store_true",
help="Randomize the order of the outputted cases.",
)
flatten.add_argument(
"version", help="The directory containing the version to output",
)
remotes = subparsers.add_parser(
"remotes",
help="Output the expected URLs and their associated schemas for remote "
"ref tests as a JSON object."
)
dump_remotes = subparsers.add_parser(
"dump_remotes", help="Dump the remote ref schemas into a file tree",
)
dump_remotes.add_argument(
"--update",
action="store_true",
help="Update the remotes in an existing directory.",
)
dump_remotes.add_argument(
"--out-dir",
default=REMOTES_DIR,
type=os.path.abspath,
help="The output directory to create as the root of the file tree",
)
serve = subparsers.add_parser(
"serve",
help="Start a webserver to serve schemas used by remote ref tests."
)
if __name__ == "__main__":
main(parser.parse_args())

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More