Skip to content

Commit

Permalink
Merge develop into feature/peer-service
Browse files Browse the repository at this point in the history
  • Loading branch information
Warchant committed Mar 4, 2017
2 parents f796bf1 + b21b688 commit d9cba36
Show file tree
Hide file tree
Showing 49 changed files with 94 additions and 472 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ PROJECT(iroha C CXX)

SET(CMAKE_CXX_FLAGS "-g -std=c++1y -Wall -fPIC")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
SET(CMAKE_CXX_FLAGS_DEBUG "-Wextra -O0")
SET(CMAKE_SHARED_LINKER_FLAGS "-lpthread -lssl")
SET(CMAKE_CXX_FLAGS_DEBUG "-Wextra -Wno-unused-parameter -O0")
#SET(CMAKE_SHARED_LINKER_FLAGS "-lpthread -lssl")
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

option(BENCHMARKING "Build benchmarks" OFF)
option(TESTING "Build tests" ON)
Expand All @@ -17,7 +18,7 @@ message(STATUS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
message(STATUS "-DTESTING=${TESTING}")
message(STATUS "-DBENCHMARKING=${BENCHMARKING}")


include_directories(${PROJECT_SOURCE_DIR}/core)
include("dependencies.cmake")

add_subdirectory(protos)
Expand All @@ -35,4 +36,4 @@ endif()

if(BENCHMARKING)
add_subdirectory(benchmark)
endif()
endif()
11 changes: 8 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ dependencies:
# one way to cache iroha-dev container is to save it to tar image. 2 mins vs 10 mins without caching.
- if [[ -e ~/docker/iroha-dev.tar ]]; then docker load -i ~/docker/iroha-dev.tar; else docker build --rm=false -t hyperledger/iroha-dev ${IROHA_HOME}/docker/dev; fi
# build iroha. Result of this instruction is ${IROHA_HOME}/docker/build/iroha.tar
- docker run -i -v ${IROHA_HOME}/docker/build:/build -v ${IROHA_HOME}:/opt/iroha hyperledger/iroha-dev sh <<< "cd /opt/iroha; /build-iroha.sh Release || exit 2; /mktar-iroha.sh || exit 3; cp /tmp/iroha.tar /build/iroha.tar || exit 4"
- >
docker run -i \
-v ${IROHA_HOME}/docker/build:/build \
-v ${IROHA_HOME}:/opt/iroha \
hyperledger/iroha-dev \
sh <<< "cd /opt/iroha/docker/dev/scripts; ./build-iroha.sh Release || exit 2; ./mktar-iroha.sh || exit 3; cp /tmp/iroha.tar /build/iroha.tar || exit 4"
# build iroha-docker image
- docker build --rm=false -t hyperledger/iroha-docker ${IROHA_HOME}/docker/build
# cache iroha-dev image. takes 30 sec to save into file
Expand All @@ -31,9 +36,9 @@ test:
# first, run ctest inside a container
- docker run -p 1204:1204 hyperledger/iroha-docker /test.sh
# then, run iroha with dummy config (1 node) and print its output to stdout
- docker logs $(docker run -it -d -p 1204:1204 hyperledger/iroha-docker /run.sh)
- docker run -it -d -p 1204:1204 hyperledger/iroha-docker /run.sh
# put new tests below
#- curl -X POST http://127.0.0.1:1204/account/register -d '{"publicKey":"WdvM/DPabapmtA7ISbTYPywbHxk8gWu2221LzmcmAgw=","alias":"yonezu","timestamp":1482053586}'
- curl -X POST http://127.0.0.1:1204/account/register -d '{"publicKey":"WdvM/DPabapmtA7ISbTYPywbHxk8gWu2221LzmcmAgw=","alias":"yonezu","timestamp":1482053586}'


deployment:
Expand Down
6 changes: 0 additions & 6 deletions core/consensus/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

include_directories(
"${PROJECT_SOURCE_DIR}/core"
)

ADD_LIBRARY(sumeragi STATIC
sumeragi.cpp
)
Expand Down
3 changes: 0 additions & 3 deletions core/consensus/connection/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
include_directories(
"${PROJECT_SOURCE_DIR}/core"
)
1 change: 0 additions & 1 deletion core/crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
4 changes: 0 additions & 4 deletions core/infra/config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
include_directories(
${PROJECT_SOURCE_DIR}/core
)

add_library(config_manager STATIC
peer_service_with_json.cpp
iroha_config_with_json.cpp
Expand Down
8 changes: 0 additions & 8 deletions core/infra/connection/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@

SET(CMAKE_CXX_FLAGS "-std=c++14 -L/usr/local/lib `pkg-config --libs grpc++ grpc` -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed -lprotobuf -lpthread -ldl")

include_directories(
${PROJECT_SOURCE_DIR}/core
)

link_directories(
${CRYPTO_PATH}
/usr/local/lib
)


ADD_LIBRARY(connection_with_grpc STATIC
connection_with_grpc.cpp
)
Expand Down
3 changes: 0 additions & 3 deletions core/infra/crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
cmake_minimum_required(VERSION 2.8)

include_directories(${PROJECT_SOURCE_DIR}/core)

# Base64
ADD_LIBRARY(base64 STATIC base64.cpp)
target_include_directories(base64 INTERFACE ${PROJECT_SOURCE_DIR}/core)

# Signature
ADD_LIBRARY(signature STATIC signature.cpp)
Expand Down
29 changes: 0 additions & 29 deletions core/infra/crypto/Makefile

This file was deleted.

3 changes: 2 additions & 1 deletion core/infra/crypto/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

extern "C" {
#include <SimpleFIPS202.h>
}
#include <crypto/hash.hpp>
#include <string>

Expand Down
9 changes: 0 additions & 9 deletions core/infra/protobuf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

SET(CMAKE_CXX_FLAGS "-g -std=c++1y -Wall -fPIC -L/usr/local/lib `pkg-config --libs grpc++ grpc` -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed -lprotobuf -lpthread -ldl")

include_directories(
${PROJECT_SOURCE_DIR}/core
)

link_directories(
/usr/local/lib
)


ADD_LIBRARY(event_with_grpc STATIC
api.grpc.pb.cc
api.pb.cc
Expand Down
16 changes: 0 additions & 16 deletions core/infra/repository/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(LEVELDB_PATH ${PROJECT_SOURCE_DIR}/core/vendor/leveldb)

SET(CMAKE_CXX_FLAGS "-g -Wall -std=c++1y -fPIC")

include_directories(
${LEVELDB_PATH}/include
${PROJECT_SOURCE_DIR}/core
${LEVELDB_PATH}/include
)

link_directories(
${LEVELDB_PATH}/out-shared
${LEVELDB_PATH}/out-static
)

ADD_LIBRARY(world_state_repo_with_level_db STATIC world_state_repository_with_level_db.cpp)
target_link_libraries(world_state_repo_with_level_db
snappy
Expand Down
11 changes: 1 addition & 10 deletions core/infra/repository/consensus/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)


SET(LEVELDB_PATH ${PROJECT_SOURCE_DIR}/core/vendor/leveldb)

include_directories(
${LEVELDB_PATH}/include
)


ADD_LIBRARY(merkle_transaction_repository STATIC merkle_transaction_repository.cpp)

target_link_libraries(merkle_transaction_repository
world_state_repo_with_level_db
exception
Expand Down
3 changes: 0 additions & 3 deletions core/infra/server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
set(JSON_PATH "${PROJECT_SOURCE_DIR}/core/vendor/json")

include_directories(
${JSON_PATH}/src
${PROJECT_SOURCE_DIR}/core
)

ADD_LIBRARY(http_server_with_cappuccino STATIC
Expand Down
4 changes: 0 additions & 4 deletions core/infra/service/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
include_directories(
${PROJECT_SOURCE_DIR}/core
)

ADD_LIBRARY(executor STATIC
executor.cpp
)
Expand Down
29 changes: 4 additions & 25 deletions core/infra/virtual_machine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
add_subdirectory(jvm)

IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include_directories(
$ENV{JAVA_HOME}/include/darwin/
$ENV{JAVA_HOME}/include/
${PROJECT_SOURCE_DIR}/core
)
link_directories(
$ENV{JAVA_HOME}/jre/lib/server
$ENV{JAVA_HOME}/jre/lib/amd64/server
)
ELSE()
include_directories(
$ENV{JAVA_HOME}/include/linux
$ENV{JAVA_HOME}/include
${PROJECT_SOURCE_DIR}/core
)
link_directories(
$ENV{JAVA_HOME}/jre/lib/amd64/server/
)
ENDIF()

########################################################
# virtual_machine_with_java
########################################################
include_directories(
$ENV{JAVA_HOME}/include
)

# Libraries
add_library(virtual_machine_with_java STATIC
Expand All @@ -35,4 +14,4 @@ target_link_libraries(virtual_machine_with_java
java_virtual_machine
logger
json
)
)
34 changes: 3 additions & 31 deletions core/infra/virtual_machine/jvm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(CMAKE_CXX_FLAGS_RELEASE "-Wall -O3 -std=c++1y -Wl,-rpath $ENV{JAVA_HOME}/jre/lib/server")
SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -DDEBUG -O0 -std=c++1y -Wl,-rpath $ENV{JAVA_HOME}/jre/lib/server")

include_directories(
$ENV{JAVA_HOME}/include/darwin/
$ENV{JAVA_HOME}/include/
)
link_directories(
$ENV{JAVA_HOME}/jre/lib/server
$ENV{JAVA_HOME}/jre/lib/amd64/server
)
ELSE()
SET(CMAKE_CXX_FLAGS_RELEASE "-Wall -O3 -std=c++1y -Wl,-rpath $ENV{JAVA_HOME}/jre/lib/amd64/server")
SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -DDEBUG -O0 -std=c++1y -Wl,-rpath $ENV{JAVA_HOME}/jre/lib/amd64/server")

include_directories(
$ENV{JAVA_HOME}/include/linux
$ENV{JAVA_HOME}/include
)
link_directories(
$ENV{JAVA_HOME}/jre/lib/amd64/server/
)
ENDIF()

include_directories(
${PROJECT_SOURCE_DIR}/core
)

###################################################
# java data structure
#
Expand All @@ -40,6 +11,8 @@ add_library(java_data_structure STATIC
target_link_libraries(java_data_structure
create_objects_helper
exception
jvm
config_manager
)

###################################################
Expand All @@ -54,7 +27,6 @@ add_library(java_virtual_machine STATIC
)

target_link_libraries(java_virtual_machine
$ENV{JAVA_HOME}/jre/lib/amd64/server/libjvm.so
java_data_structure
json
)
)
2 changes: 1 addition & 1 deletion core/infra/virtual_machine/jvm/java_data_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,4 @@ convertMapStringToTrust(const std::map<std::string, std::string> &trustMap) {
}

} // namespace jvm
} // namespace virtual_machine
} // namespace virtual_machine
2 changes: 1 addition & 1 deletion core/infra/virtual_machine/virtual_machine_with_java.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ void invokeFunction(const std::string &packageName,
}
}

}
}
9 changes: 2 additions & 7 deletions core/repository/consensus/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

include_directories(
${PROJECT_SOURCE_DIR}/core
)

add_library(merkle_transaction_repository STATIC
merkle_transaction_repository.cpp
)

target_link_libraries(merkle_transaction_repository
hash
world_state_repo_with_level_db
)
)
4 changes: 2 additions & 2 deletions core/repository/consensus/merkle_transaction_repository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ namespace merkle_transaction_repository {
std::string hash(const T&);

template<>
std::string hash<Api::Transaction>(const Api::Transaction& tx){
inline std::string hash<Api::Transaction>(const Api::Transaction& tx){
return hash::sha3_256_hex(tx.SerializeAsString());
}

template<>
std::string hash<std::string>(const std::string& s){
inline std::string hash<std::string>(const std::string& s){
return hash::sha3_256_hex(s);
}

Expand Down
6 changes: 1 addition & 5 deletions core/repository/domain/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
include_directories(
"${PROJECT_SOURCE_DIR}/core"
)

add_subdirectory(instance)
add_subdirectory(instance)
12 changes: 1 addition & 11 deletions core/repository/domain/instance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@ SET(CMAKE_CXX_FLAGS "-g -Wall -std=c++1y -fPIC")

SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

link_directories(
${PROJECT_BINARY_DIR}/lib
${LEVELDB_PATH}/out-shared
${LEVELDB_PATH}/out-static
)

include_directories(
${PROJECT_SOURCE_DIR}/core
${LEVELDB_PATH}/include
)

add_library(core_repository STATIC
domain_repository.cpp
account_repository.cpp
Expand All @@ -28,4 +17,5 @@ target_link_libraries(core_repository
world_state_repo_with_level_db
event_with_grpc
protobuf
leveldb
)
4 changes: 0 additions & 4 deletions core/service/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
include_directories(
"${PROJECT_SOURCE_DIR}/core"
)

ADD_LIBRARY(executor STATIC
executor.cpp
)
Expand Down
Loading

0 comments on commit d9cba36

Please sign in to comment.