Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/actions/spelling/excludes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
^NOTICE$
^src/AppInstallerCLICore/Commands/ExperimentalCommand\.cpp$
^src/catch2/
^src/YamlCppLib/
^src/JsonCppLib/
^src/Valijson/
^src/YamlCppLib/
^\.github/
9 changes: 9 additions & 0 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
"commitHash": "9be589598595963f94ba264d7b416d0533421106"
}
}
},
{
"component": {
"type": "git",
"git": {
"repositoryUrl": "https://github.com/tristanpenman/valijson.git",
"commitHash": "7a52fc88cdffd6678c009ca2fad700151f7363c6"
}
}
}
],
"Version": 1
Expand Down
6 changes: 6 additions & 0 deletions src/Valijson/valijson/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build
bin
xcode/valijson.xcodeproj/project.xcworkspace
xcode/valijson.xcodeproj/project.xcworkspace/xcuserdata
xcode/valijson.xcodeproj/xcuserdata
doc/html
Empty file.
74 changes: 74 additions & 0 deletions src/Valijson/valijson/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
language: cpp
sudo: required
dist: trusty

matrix:
include:
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'qtbase5-dev', 'libboost1.55-dev', 'libssl-dev', 'libcurl4-openssl-dev']
env:
- CXX_COMPILER=g++-5
- C_COMPILER=gcc-5

- os: linux
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
packages: ['clang-3.6', 'qtbase5-dev', 'libboost1.55-dev', 'libssl-dev', 'libcurl4-openssl-dev']
env:
- CXX_COMPILER=clang++-3.6
- C_COMPILER=clang-3.6

- os: linux
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7']
packages: ['clang-3.7', 'qtbase5-dev', 'libboost1.55-dev', 'libssl-dev', 'libcurl4-openssl-dev']
env:
- CXX_COMPILER=clang++-3.7
- C_COMPILER=clang-3.7

- os: linux
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8']
packages: ['clang-3.8', 'libc++-dev', 'libc++abi-dev', 'qtbase5-dev', 'libboost1.55-dev', 'libssl-dev', 'libcurl4-openssl-dev']
env:
- CXX_COMPILER=clang++-3.8
- C_COMPILER=clang-3.8
- CMAKE_CXX_FLAGS="-stdlib=libc++"
- CMAKE_EXE_LINKER_FLAGS="-lc++"

before_install:
- pushd ~
- wget https://github.com/pocoproject/poco/archive/poco-1.7.8p2-release.tar.gz
- tar -xf poco-1.7.8p2-release.tar.gz
- cd poco-poco-1.7.8p2-release
- mkdir cmake_build
- cd cmake_build
- export POCO_OPTS="-DENABLE_CRYPTO=off -DENABLE_DATA=off -DENABLE_DATA_MYSQL=off -DENABLE_DATA_ODBC=off -DENABLE_DATA_SQLITE=off"
- export POCO_OPTS="$POCO_OPTS -DENABLE_MONGODB=off -DENABLE_NET=off -DENABLE_NETSSL=off -DENABLE_PAGECOMPILER=off"
- export POCO_OPTS="$POCO_OPTS -DENABLE_PAGECOMPILER_FILE2PAGE=off -DENABLE_PDF=off -DENABLE_UTIL=off -DENABLE_XML=off -DENABLE_ZIP=off"
- cmake -D CMAKE_CXX_COMPILER=`which ${CXX_COMPILER}` -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" -DCMAKE_EXE_LINKER_FLAGS="$CMAKE_EXE_LINKER_FLAGS" $POCO_OPTS ..
- sudo make install
- wget -O curlpp-0.8.1.tar.gz https://github.com/jpbarrette/curlpp/archive/v0.8.1.tar.gz
- tar -xf curlpp-0.8.1.tar.gz
- cd curlpp-0.8.1
- mkdir cmake_build
- cd cmake_build
- cmake -D CMAKE_CXX_COMPILER=`which ${CXX_COMPILER}` -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" -DCMAKE_EXE_LINKER_FLAGS="$CMAKE_EXE_LINKER_FLAGS" ..
- sudo make install
- popd

script:
- mkdir build && cd build
- cmake -D CMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" -D CMAKE_EXE_LINKER_FLAGS="$CMAKE_EXE_LINKER_FLAGS" -D CMAKE_CXX_COMPILER="$CXX_COMPILER" -D CMAKE_C_COMPILER="$C_COMPILER" ..
- VERBOSE=1 make
- ./test_suite
35 changes: 35 additions & 0 deletions src/Valijson/valijson/Authors
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Tristan Penman, tristan@tristanpenman.com
Core library development

James Jensen, jjensen@akamai.com, changes Copyright (c) 2016 Akamai Technologies
Polymorphic constraint support

Tengiz Sharafiev, btolfa+github@gmail.com
Adapter for nlohmann/json parser library

hotwatermorning (github username), hotwatermorning@gmail.com
Adapter for json11 parser library

shsfre09 (github username), <email address unknown>
Adapter for picojson parser library

Michael Smith, michael.smith@puppetlabs.com
Memory management improvements for RapidJson parser library

Richard Clamp, richardc@unixbeard.net
Boost-related fixes

Lars Immisch, lars@ibp.de
noboost branch

Nicolas Witczak, n_witczak@yahoo.com
C++11 improvements

Martin Robinson, 0x4d52@gmail.com
Bug fixes

Pierre Lamot, pierre.lamot@yahoo.fr
Adapter for Qt JSON parser

drewxa (github username), bo.ro.da@mail.ru
Adapter for Poco JSON parser
163 changes: 163 additions & 0 deletions src/Valijson/valijson/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
cmake_minimum_required(VERSION 3.1)
project(valijson)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

option(valijson_INSTALL_HEADERS "Install valijson headers." FALSE)
option(valijson_BUILD_EXAMPLES "Build valijson examples." FALSE)
option(valijson_BUILD_TESTS "Build valijson test suite." TRUE)
option(valijson_EXCLUDE_BOOST "Exclude Boost when building test suite." FALSE)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")

if(valijson_INSTALL_HEADERS)
install(DIRECTORY include/ DESTINATION include)
endif()

if(NOT valijson_BUILD_TESTS AND NOT valijson_BUILD_EXAMPLES)
return()
endif()

SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

find_package(curlpp)
find_package(Poco OPTIONAL_COMPONENTS JSON)
find_package(Qt5Core)

# jsoncpp library
add_library(jsoncpp
thirdparty/jsoncpp-0.9.4/src/lib_json/json_reader.cpp
thirdparty/jsoncpp-0.9.4/src/lib_json/json_value.cpp
thirdparty/jsoncpp-0.9.4/src/lib_json/json_writer.cpp
)

target_include_directories(jsoncpp SYSTEM PRIVATE thirdparty/jsoncpp-0.9.4/include)
set_target_properties(jsoncpp PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/thirdparty/jsoncpp-0.9.4)

add_library(json11
thirdparty/json11-ec4e452/json11.cpp
)

target_include_directories(json11 SYSTEM PRIVATE thirdparty/json11-ec4e452)
set_target_properties(json11 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/thirdparty/json11-ec4e452)

# Not all of these are required for examples build it doesn't hurt to include them
include_directories(include SYSTEM
thirdparty/gtest-1.7.0/include
thirdparty/json11-ec4e452
thirdparty/jsoncpp-0.9.4/include
thirdparty/rapidjson-1.1.0/include
thirdparty/picojson-1.3.0
thirdparty/nlohmann-json-3.1.2
)

if(valijson_BUILD_TESTS)
if(NOT valijson_EXCLUDE_BOOST)
find_package(Boost)
endif()

# Build local gtest
set(gtest_force_shared_crt ON)
add_subdirectory(thirdparty/gtest-1.7.0)

set(TEST_SOURCES
tests/test_adapter_comparison.cpp
tests/test_fetch_document_callback.cpp
tests/test_json_pointer.cpp
tests/test_json11_adapter.cpp
tests/test_jsoncpp_adapter.cpp
tests/test_nlohmann_json_adapter.cpp
tests/test_rapidjson_adapter.cpp
tests/test_picojson_adapter.cpp
tests/test_poly_constraint.cpp
tests/test_validation_errors.cpp
tests/test_validator.cpp
)

# Unit tests executable
add_executable(test_suite ${TEST_SOURCES})

# Definition for using picojson
set_target_properties(test_suite PROPERTIES COMPILE_DEFINITIONS "PICOJSON_USE_INT64")

set(TEST_LIBS gtest gtest_main jsoncpp json11)

if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
list(APPEND TEST_SOURCES tests/test_property_tree_adapter.cpp)
add_definitions(-DBOOST_ALL_DYN_LINK)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
target_compile_definitions(test_suite PRIVATE "VALIJSON_BUILD_PROPERTY_TREE_ADAPTER")
endif()

if(Poco_FOUND)
include_directories(${Poco_INCLUDE_DIRS})
list(APPEND TEST_SOURCES tests/test_poco_json_adapter.cpp)
list(APPEND TEST_LIBS ${Poco_Foundation_LIBRARIES} ${Poco_JSON_LIBRARIES})
target_compile_definitions(test_suite PRIVATE "VALIJSON_BUILD_POCO_ADAPTER")
endif()

if(Qt5Core_FOUND)
include_directories(${Qt5Core_INCLUDE_DIRS})
list(APPEND TEST_SOURCES tests/test_qtjson_adapter.cpp)
list(APPEND TEST_LIBS Qt5::Core)
target_compile_definitions(test_suite PRIVATE "VALIJSON_BUILD_QT_ADAPTER")
endif()

target_link_libraries(test_suite ${TEST_LIBS} ${Boost_LIBRARIES})
endif()

if(valijson_BUILD_EXAMPLES)
include_directories(SYSTEM)

add_executable(custom_schema
examples/custom_schema.cpp
)

add_executable(external_schema
examples/external_schema.cpp
)

add_executable(array_iteration_basics
examples/array_iteration_basics.cpp
)

add_executable(array_iteration_template_fn
examples/array_iteration_template_fn.cpp
)

add_executable(object_iteration
examples/object_iteration.cpp
)

add_executable(json_pointers
examples/json_pointers.cpp
)

if(curlpp_FOUND)
include_directories(${curlpp_INCLUDE_DIR})

add_executable(remote_resolution
examples/remote_resolution.cpp
)

target_link_libraries(remote_resolution curl ${curlpp_LIBRARIES})
endif()

target_link_libraries(custom_schema ${Boost_LIBRARIES})
target_link_libraries(external_schema ${Boost_LIBRARIES})
target_link_libraries(array_iteration_basics jsoncpp)
target_link_libraries(array_iteration_template_fn jsoncpp)
target_link_libraries(object_iteration jsoncpp)
target_link_libraries(json_pointers)
endif()
Loading