Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2001 from hyperledger/dev
Browse files Browse the repository at this point in the history
Hyperledger Iroha v1.0 Release Candidate 2
  • Loading branch information
kamilsa authored Jan 10, 2019
2 parents 6850928 + 5ae3c01 commit 393729c
Show file tree
Hide file tree
Showing 674 changed files with 6,074 additions and 10,667 deletions.
2 changes: 1 addition & 1 deletion .jenkinsci/artifacts.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def uploadArtifacts(filePaths, uploadPath, artifactServers=['nexus.iroha.tech'])

withCredentials([usernamePassword(credentialsId: 'ci_nexus', passwordVariable: 'NEXUS_PASS', usernameVariable: 'NEXUS_USER')]) {
artifactServers.each {
sh(script: "while read line; do curl -u ${NEXUS_USER}:${NEXUS_PASS} --upload-file \$line https://${it}/repository/artifacts/${uploadPath}/ ; done < \$(pwd)/batch.txt")
sh(script: "while read line; do curl --http1.1 -u ${NEXUS_USER}:${NEXUS_PASS} --upload-file \$line https://${it}/repository/artifacts/${uploadPath}/ ; done < \$(pwd)/batch.txt")
}
}
}
Expand Down
28 changes: 21 additions & 7 deletions .jenkinsci/debug-build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ def doDebugBuild(coverageEnabled=false) {
def manifest = load ".jenkinsci/docker-manifest.groovy"
def pCommit = load ".jenkinsci/previous-commit.groovy"
def parallelism = params.PARALLELISM
def sanitizeEnabled = params.sanitize
def fuzzingEnabled = params.fuzzing
def platform = sh(script: 'uname -m', returnStdout: true).trim()
def previousCommit = pCommit.previousCommitOrCurrent()
// params are always null unless job is started
// this is the case for the FIRST build only.
// So just set this to same value as default.
// This is a known bug. See https://issues.jenkins-ci.org/browse/JENKINS-41929
if (sanitizeEnabled == null){
sanitizeEnabled = true
}
if (!parallelism) {
parallelism = 4
}
Expand Down Expand Up @@ -57,7 +62,13 @@ def doDebugBuild(coverageEnabled=false) {
def scmVars = checkout scm
def cmakeOptions = ""
if ( coverageEnabled ) {
cmakeOptions = " -DCOVERAGE=ON "
cmakeOptions += " -DCOVERAGE=ON "
}
if ( sanitizeEnabled ){
cmakeOptions += " -DSANITIZE='address;leak' "
}
if ( fuzzingEnabled ){
cmakeOptions += " -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 -DFUZZING=ON "
}
env.IROHA_VERSION = "0x${scmVars.GIT_COMMIT}"
env.IROHA_HOME = "/opt/iroha"
Expand All @@ -83,12 +94,15 @@ def doDebugBuild(coverageEnabled=false) {
if ( coverageEnabled ) {
sh "cmake --build build --target coverage.init.info"
}
sh "cd build; ctest --output-on-failure --no-compress-output -T Test || true"
sh 'python .jenkinsci/helpers/platform_tag.py "Linux \$(uname -m)" \$(ls build/Testing/*/Test.xml)'
// Mark build as UNSTABLE if there are any failed tests (threshold <100%)
xunit testTimeMargin: '3000', thresholdMode: 2, thresholds: [passed(unstableThreshold: '100')], \
tools: [CTest(deleteOutputFiles: true, failIfNotNew: false, \
pattern: 'build/Testing/**/Test.xml', skipNoTestFiles: false, stopProcessingIfError: true)]
//If fuzzing Enabled do not run tests, they never stop
if ( !fuzzingEnabled ){
sh "cd build; ctest --output-on-failure --no-compress-output -T Test || true"
sh 'python .jenkinsci/helpers/platform_tag.py "Linux \$(uname -m)" \$(ls build/Testing/*/Test.xml)'
// Mark build as UNSTABLE if there are any failed tests (threshold <100%)
xunit testTimeMargin: '3000', thresholdMode: 2, thresholds: [passed(unstableThreshold: '100')], \
tools: [CTest(deleteOutputFiles: true, failIfNotNew: false, \
pattern: 'build/Testing/**/Test.xml', skipNoTestFiles: false, stopProcessingIfError: true)]
}
if ( coverageEnabled ) {
sh "cmake --build build --target cppcheck"
// Sonar
Expand Down
8 changes: 7 additions & 1 deletion .jenkinsci/docker-pull-or-build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ def dockerPullOrUpdate(imageName, currentDockerfileURL, previousDockerfileURL, r
// Worst case scenario. We cannot count on the local cache
// because Dockerfile may contain apt-get entries that would try to update
// from invalid (stale) addresses
iC = docker.build("${DOCKER_REGISTRY_BASENAME}:${commit}-${BUILD_NUMBER}", "${buildOptions} --no-cache -f /tmp/${env.GIT_COMMIT}/f1 /tmp/${env.GIT_COMMIT}")
if(remoteFilesDiffer(currentDockerfileURL, referenceDockerfileURL)){
// Dockerfile has been changed compared to the develop
iC = docker.build("${DOCKER_REGISTRY_BASENAME}:${commit}-${BUILD_NUMBER}", "${buildOptions} --no-cache -f /tmp/${env.GIT_COMMIT}/f1 /tmp/${env.GIT_COMMIT}")
} else {
// Dockerfile is same as develop, we can just pull it
iC = docker.image("${DOCKER_REGISTRY_BASENAME}:${imageName}")
}
}
else {
// first commit in this branch or Dockerfile modified
Expand Down
25 changes: 22 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,31 @@ endif()
PROJECT(iroha C CXX)

SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
SET(CMAKE_CXX_FLAGS "-std=c++14 -Wall -fdiagnostics-color=always")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wno-error=deprecated-declarations")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -O0")
if (NOT MSVC)
SET(CMAKE_CXX_FLAGS "-std=c++14 -Wall -fdiagnostics-color=always")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wno-error=deprecated-declarations")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -O0")
endif()
SET(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
SET(CMAKE_INSTALL_RPATH "../lib")

if(WIN32)
# We have to set _WIN32_WINNT for gRPC
if(${CMAKE_SYSTEM_VERSION} EQUAL 10) # Windows 10
add_definitions(-D _WIN32_WINNT=0x0A00)
elseif(${CMAKE_SYSTEM_VERSION} EQUAL 6.3) # Windows 8.1
add_definitions(-D _WIN32_WINNT=0x0603)
elseif(${CMAKE_SYSTEM_VERSION} EQUAL 6.2) # Windows 8
add_definitions(-D _WIN32_WINNT=0x0602)
elseif(${CMAKE_SYSTEM_VERSION} EQUAL 6.1) # Windows 7
add_definitions(-D _WIN32_WINNT=0x0601)
elseif(${CMAKE_SYSTEM_VERSION} EQUAL 6.0) # Windows Vista
add_definitions(-D _WIN32_WINNT=0x0600)
else() # Windows XP (5.1)
add_definitions(-D _WIN32_WINNT=0x0501)
endif()
endif()

if(COVERAGE)
find_program(LCOV_PROGRAM lcov)
if(NOT LCOV_PROGRAM)
Expand Down
2 changes: 2 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ properties([parameters([
choice(choices: 'Release\nDebug', description: 'Android bindings build type', name: 'ABBuildType'),
choice(choices: 'arm64-v8a\narmeabi-v7a\narmeabi\nx86_64\nx86', description: 'Android bindings platform', name: 'ABPlatform'),
booleanParam(defaultValue: true, description: 'Build docs', name: 'Doxygen'),
booleanParam(defaultValue: true, description: 'Sanitize address;leak', name: 'sanitize'),
booleanParam(defaultValue: false, description: 'Build fuzzing, but do not run tests', name: 'fuzzing'),
string(defaultValue: '8', description: 'Expect ~3GB memory consumtion per CPU core', name: 'PARALLELISM')])])


Expand Down
7 changes: 6 additions & 1 deletion cmake/Modules/Findgflags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,10 @@ endif ()
set_target_properties(gflags PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${gflags_INCLUDE_DIR}
IMPORTED_LOCATION ${gflags_LIBRARY}
INTERFACE_LINK_LIBRARIES "pthread"
)

if (NOT MSVC)
set_target_properties(gflags PROPERTIES
INTERFACE_LINK_LIBRARIES "pthread"
)
endif ()
7 changes: 6 additions & 1 deletion cmake/Modules/Findgrpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,15 @@ endif ()

set_target_properties(grpc PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${grpc_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES "pthread;dl"
IMPORTED_LOCATION ${grpc_LIBRARY}
)

if (NOT MSVC)
set_target_properties(grpc PROPERTIES
INTERFACE_LINK_LIBRARIES "pthread;dl"
)
endif ()

set_target_properties(grpc++ PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${grpc_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES grpc
Expand Down
39 changes: 30 additions & 9 deletions cmake/Modules/Findpq.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,29 @@ mark_as_advanced(pq_INCLUDE_DIR)
find_path(postgres_INCLUDE_DIR postgres_ext.h PATH_SUFFIXES postgresql)
mark_as_advanced(postgres_INCLUDE_DIR)

find_library(pq_LIBRARY pq)
# Windows libraries are usually not prefixed with 'lib', however this library
# has such a prefix, therefore we need to search for libpq instead of pq on
# Windows
find_library(pq_LIBRARY NAMES pq libpq)
mark_as_advanced(pq_LIBRARY)

find_program(pg_config_EXECUTABLE pg_config)
mark_as_advanced(pg_config_EXECUTABLE)
# Debug library has 'd' suffix on Windows
if (MSVC)
find_library(pqd_LIBRARY NAMES pqd libpqd)
mark_as_advanced(pqd_LIBRARY)
endif ()

if (NOT MSVC)
find_program(pg_config_EXECUTABLE pg_config)
mark_as_advanced(pg_config_EXECUTABLE)
set(pg_config_REQUIRED pg_config_EXECUTABLE)
endif ()

find_package_handle_standard_args(pq DEFAULT_MSG
pq_INCLUDE_DIR
postgres_INCLUDE_DIR
pq_LIBRARY
pg_config_EXECUTABLE
${pg_config_REQUIRED}
)

set(URL https://git.postgresql.org/git/postgresql.git)
Expand Down Expand Up @@ -50,17 +62,26 @@ endif ()
get_filename_component(pq_LIBRARY_DIR ${pq_LIBRARY} DIRECTORY)
mark_as_advanced(pq_LIBRARY_DIR)

get_filename_component(pg_config_EXECUTABLE_DIR ${pg_config_EXECUTABLE} DIRECTORY)
mark_as_advanced(pg_config_EXECUTABLE_DIR)
if (MSVC)
set_target_properties(pq PROPERTIES
IMPORTED_LOCATION_DEBUG ${pqd_LIBRARY}
IMPORTED_LOCATION_RELEASE ${pq_LIBRARY}
)
endif ()

set_target_properties(pq PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${pq_INCLUDE_DIR};${postgres_INCLUDE_DIR}"
IMPORTED_LOCATION ${pq_LIBRARY}
)

set_target_properties(pg_config PROPERTIES
IMPORTED_LOCATION ${pg_config_EXECUTABLE}
)
if (NOT MSVC)
get_filename_component(pg_config_EXECUTABLE_DIR ${pg_config_EXECUTABLE} DIRECTORY)
mark_as_advanced(pg_config_EXECUTABLE_DIR)

set_target_properties(pg_config PROPERTIES
IMPORTED_LOCATION ${pg_config_EXECUTABLE}
)
endif ()

if(ENABLE_LIBS_PACKAGING)
add_install_step_for_lib(${pq_LIBRARY})
Expand Down
11 changes: 8 additions & 3 deletions cmake/Modules/Findsoci.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ mark_as_advanced(SOCI_INCLUDE_DIRS)

find_library(
SOCI_LIBRARY
NAMES soci_core
NAMES soci_core soci_core_3_2
HINTS ${SOCI_INCLUDE_DIR}/..
PATH_SUFFIXES lib${LIB_SUFFIX})
mark_as_advanced(SOCI_LIBRARY)

find_library(
SOCI_postgresql_PLUGIN
NAMES soci_postgresql
NAMES soci_postgresql soci_postgresql_3_2
HINTS ${SOCI_INCLUDE_DIR}/..
PATH_SUFFIXES lib${LIB_SUFFIX})
mark_as_advanced(SOCI_postgresql_PLUGIN)
Expand Down Expand Up @@ -76,9 +76,14 @@ endif ()
set_target_properties(SOCI::core PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SOCI_INCLUDE_DIRS}"
IMPORTED_LOCATION "${SOCI_LIBRARY}"
INTERFACE_LINK_LIBRARIES dl
)

if (NOT MSVC)
set_target_properties(SOCI::core PROPERTIES
INTERFACE_LINK_LIBRARIES dl
)
endif ()

set_target_properties(SOCI::postgresql PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SOCI_INCLUDE_DIRS}"
IMPORTED_LOCATION "${SOCI_postgresql_PLUGIN}"
Expand Down
103 changes: 92 additions & 11 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ find_package(PackageHandleStandardArgs)

include(ExternalProject)

set(EP_PREFIX "${PROJECT_SOURCE_DIR}/external")
set(EP_PREFIX "${PROJECT_BINARY_DIR}/external")
set_directory_properties(PROPERTIES
EP_PREFIX ${EP_PREFIX}
)
Expand All @@ -27,13 +27,73 @@ find_package(spdlog)
# protobuf #
################################
option(FIND_PROTOBUF "Try to find protobuf in system" ON)
find_package(protobuf)
if (MSVC)
find_package(Protobuf REQUIRED CONFIG)
add_library(protobuf INTERFACE IMPORTED)
target_link_libraries(protobuf INTERFACE
protobuf::libprotobuf
)

get_target_property(Protobuf_INCLUDE_DIR protobuf::libprotobuf
INTERFACE_INCLUDE_DIRECTORIES)

get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
IMPORTED_LOCATION_RELEASE)
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
IMPORTED_LOCATION_DEBUG)
endif()
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
IMPORTED_LOCATION_NOCONFIG)
endif()

add_executable(protoc IMPORTED)
set_target_properties(protoc PROPERTIES
IMPORTED_LOCATION ${Protobuf_PROTOC_EXECUTABLE}
)
else ()
find_package(protobuf)
endif()

#########################
# gRPC #
#########################
option(FIND_GRPC "Try to find gRPC in system" ON)
find_package(grpc)
if (MSVC)
find_package(gRPC REQUIRED CONFIG)

add_library(grpc INTERFACE IMPORTED)
target_link_libraries(grpc INTERFACE
gRPC::grpc
)
add_library(grpc++ INTERFACE IMPORTED)
target_link_libraries(grpc++ INTERFACE
gRPC::grpc++
)
add_library(gpr INTERFACE IMPORTED)
target_link_libraries(gpr INTERFACE
gRPC::gpr
)

get_target_property(gRPC_CPP_PLUGIN_EXECUTABLE gRPC::grpc_cpp_plugin
IMPORTED_LOCATION_RELEASE)
if(NOT EXISTS "${gRPC_CPP_PLUGIN_EXECUTABLE}")
get_target_property(gRPC_CPP_PLUGIN_EXECUTABLE gRPC::grpc_cpp_plugin
IMPORTED_LOCATION_DEBUG)
endif()
if(NOT EXISTS "${gRPC_CPP_PLUGIN_EXECUTABLE}")
get_target_property(gRPC_CPP_PLUGIN_EXECUTABLE gRPC::grpc_cpp_plugin
IMPORTED_LOCATION_NOCONFIG)
endif()

add_executable(grpc_cpp_plugin IMPORTED)
set_target_properties(grpc_cpp_plugin PROPERTIES
IMPORTED_LOCATION ${gRPC_CPP_PLUGIN_EXECUTABLE}
)
else ()
find_package(grpc)
endif()

################################
# rapidjson #
Expand All @@ -53,7 +113,11 @@ find_package(soci)
################################
# gflags #
################################
find_package(gflags)
if (MSVC)
find_package(gflags REQUIRED CONFIG)
else ()
find_package(gflags)
endif()

##########################
# rx c++ #
Expand All @@ -63,7 +127,15 @@ find_package(rxcpp)
##########################
# TBB #
##########################
find_package(tbb)
if (MSVC)
find_package(TBB REQUIRED CONFIG)
add_library(tbb INTERFACE IMPORTED)
target_link_libraries(tbb INTERFACE
TBB::tbb
)
else ()
find_package(tbb)
endif()

##########################
# boost #
Expand All @@ -74,12 +146,21 @@ find_package(Boost 1.65.0 REQUIRED
system
thread
)

add_library(boost INTERFACE IMPORTED)
set_target_properties(boost PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS}
INTERFACE_LINK_LIBRARIES "${Boost_LIBRARIES}"
)
if (MSVC)
add_library(boost INTERFACE IMPORTED)
target_link_libraries(boost INTERFACE
Boost::boost
Boost::filesystem
Boost::system
Boost::thread
)
else ()
add_library(boost INTERFACE IMPORTED)
set_target_properties(boost PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS}
INTERFACE_LINK_LIBRARIES "${Boost_LIBRARIES}"
)
endif()

if(ENABLE_LIBS_PACKAGING)
foreach (library ${Boost_LIBRARIES})
Expand Down
Loading

0 comments on commit 393729c

Please sign in to comment.