Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request in3/c/in3-core!188
  • Loading branch information
simon-jentzsch committed Mar 18, 2020
2 parents 071573b + 886c737 commit 608a3a8
Show file tree
Hide file tree
Showing 129 changed files with 4,527 additions and 1,695 deletions.
52 changes: 37 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@ gcc8:
- short-jobs
script:
- mkdir x64_build
- mkdir x64_jni
- cd x64_build
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DUSE_CURL=false ..
- make in3_jni
- cp lib/libin3_jni.so ../x64_jni/
- rm -rf *
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DBUILD_DOC=true ..
- make
artifacts:
paths:
- x64_jni
- x64_build/bin
- x64_build/lib
- x64_build/c/docs/doc_doxygen
Expand All @@ -48,18 +54,34 @@ win_mingw:
image: docker.slock.it/build-images/cmake:gcc7-mingw
extends: .conanbuild
variables:
CONAN_OPTS: "-DLIBCURL_LINKTYPE=static -DJAVA=true"
CONAN_OPTS: "-DLIBCURL_LINKTYPE=static -DJAVA=false"
BUILD: "win_build"

win_jni:
image: docker.slock.it/build-images/cmake:gcc7-mingw
extends: .conanbuild
variables:
CONAN_OPTS: "-DUSE_CURL=false -DJAVA=true"
BUILD: "win_jni"

arm7:
image: docker.slock.it/build-images/cmake:gcc8-armv7
extends: .conanbuild
tags:
- arm
variables:
CONAN_OPTS: "-DJAVA=true"
CONAN_OPTS: "-DJAVA=false"
BUILD: "arm7_build"

arm_jni:
image: docker.slock.it/build-images/cmake:gcc8-armv7
extends: .conanbuild
tags:
- arm
variables:
CONAN_OPTS: "-DJAVA=true -DUSE_CURL=false"
BUILD: "arm_jni_build"

gcc8-x86:
image: docker.slock.it/build-images/cmake:gcc8-x86
extends: .conanbuild
Expand All @@ -78,23 +100,29 @@ clang50:
clang10:
image: docker.slock.it/build-images/cmake:clang10
extends: .conanbuild

mac_os:
stage: build
script:
- mkdir mac_build
- mkdir mac_jni
- cd mac_build
- cmake -DTEST=true -DTAG_VERSION=$CI_COMMIT_TAG -DEVM_GAS=true -DCMAKE_BUILD_TYPE=Debug -DLIBCURL_TYPE=shared ..
- make
- ctest -V | tee ../mac_test_c.log | test/junit > ../mac_test_c.xml
- rm -rf *
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=MINSIZEREL -DJAVA=true -DUSE_CURL=false -DUSE_SCRYPT=true ..
- make in3_jni
- cp lib/libin3_jni.dylib ../mac_jni/
- rm -rf *
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=MINSIZEREL -DJAVA=true ..
- make

artifacts:
reports:
junit: mac_test_c.xml
paths:
- mac_jni
- mac_build/c/docs
- mac_build/java/docs
- mac_build/lib
Expand Down Expand Up @@ -149,17 +177,17 @@ java:
- short-jobs
dependencies:
- mac_os
- win_mingw
- win_jni
- gcc8
- arm7
- arm_jni
script:
- mkdir java_build
- cd java_build
- mkdir -p ../java/src/in3/native/
- cp ../mac_build/lib/libin3_jni.dylib ../java/src/in3/native/
- cp ../win_build/lib/libin3_jni.so ../java/src/in3/native/in3_jni.dll
- cp ../x64_build/lib/libin3_jni.so ../java/src/in3/native/
- cp ../arm7_build/lib/libin3_jni.so ../java/src/in3/native/libin3_jni_arm.so
- cp ../mac_jni/libin3_jni.dylib ../java/src/in3/native/
- cp ../win_jni/lib/libin3_jni.so ../java/src/in3/native/in3_jni.dll
- cp ../x64_jni/libin3_jni.so ../java/src/in3/native/
- cp ../arm_jni_build/lib/libin3_jni.so ../java/src/in3/native/libin3_jni_arm.so
- cmake -DIN3_LIB=false -DJAVA_MULTI_LIBS=true -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DBUILD_DOC=true ..
- make in3j
artifacts:
Expand Down Expand Up @@ -264,7 +292,6 @@ test_c:
# - cd ../vmTests
# - ../../../../testbuild/test/vmrunner */*.json || echo "\n ignoring failure .."


test_android:
image: cangol/android-gradle
stage: test
Expand All @@ -275,15 +302,12 @@ test_android:
- cd in3-example-android/app
- cp -r ../../java/src/in3 src/main/java/
- mv ../../c ../../java in3-c/
- mkdir c
- cp in3-c/c/compiler.cmake c/
- cd ..
- ./gradlew build
artifacts:
paths:
- in3-example-android/app/build/outputs/apk


test_wasm:
image: docker.slock.it/build-images/node:10-alpine
dependencies:
Expand Down Expand Up @@ -669,8 +693,6 @@ release_mac_and_wasm:
- IPFS_RESPONSE=$(curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS -H 'Content-Type:multipart/form-data' -H 'pinata_api_key:'"$PINATA_API_KEY" -H 'pinata_secret_api_key:'"$PINATA_SECRET_API_KEY" -F file=@in3_${CI_COMMIT_TAG}_mac.tar.gz -F 'pinataMetadata={"name":"in3_'${CI_COMMIT_TAG}'_mac.tar.gz","keyValues":{"version":"${CI_COMMIT_TAG}"}}' -F 'pinataOptions={"cidVersion":0}')
- "IPFS_HASH=$(echo $IPFS_RESPONSE | sed -e 's/[{}]/''/g' | awk -v RS=',' -F: '/IpfsHash/ {print $2}')"
- ghr -u slockIt -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_mac.tar.gz
- mv wasm/release-wasm .
- mv wasm/release-asmjs .
- tar -zcv --exclude=in3-mac-wasm/python --exclude=in3-mac-wasm/java --exclude=in3-mac-wasm/bin --exclude=in3-mac-wasm/lib --exclude=*cmake* -f in3_${CI_COMMIT_TAG}_wasm.tar.gz in3-mac-wasm/
- IPFS_RESPONSE=$(curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS -H 'Content-Type:multipart/form-data' -H 'pinata_api_key:'"$PINATA_API_KEY" -H 'pinata_secret_api_key:'"$PINATA_SECRET_API_KEY" -F file=@in3_${CI_COMMIT_TAG}_wasm.tar.gz -F 'pinataMetadata={"name":"in3_'${CI_COMMIT_TAG}'_wasm.tar.gz","keyValues":{"version":"${CI_COMMIT_TAG}"}}' -F 'pinataOptions={"cidVersion":0}')
- "IPFS_HASH=$(echo $IPFS_RESPONSE | sed -e 's/[{}]/''/g' | awk -v RS=',' -F: '/IpfsHash/ {print $2}')"
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@
"eth_call_response_binary.h": "c",
"malloc.h": "c",
"memzero.h": "c",
"eth_basic.h": "c"
"eth_basic.h": "c",
"sha2.h": "c",
"pb_decode.h": "c"
},
"C_Cpp.errorSquiggles": "Disabled"
}
36 changes: 24 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,23 @@ option(WASM_EMBED "embedds the wasm as base64-encoded into the js-file" ON)
option(WASM_EMMALLOC "use ther smaller EMSCRIPTEN Malloc, which reduces the size about 10k, but may be a bit slower" ON)
option(WASM_SYNC "intiaializes the WASM synchronisly, which allows to require and use it the same function, but this will not be supported by chrome (4k limit)" OFF)
option(CODE_COVERAGE "Builds targets with code coverage instrumentation. (Requires GCC or Clang)" OFF)
option(USE_SCRYPT "integrate scrypt into the build in order to allow decrypt_key for scrypt encoded keys." ON)
option(USE_CURL "if true the curl transport will be built (with a dependency to libcurl)" ON)

if (USE_PRECOMPUTED_EC)
ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=1)
else()
ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=0)
endif()

if (CURL_BLOCKING)
ADD_DEFINITIONS(-DCURL_BLOCKING)
if (USE_CURL AND NOT (JAVA OR WASM OR ASMJS))
ADD_DEFINITIONS(-DUSE_CURL)
set(IN3_TRANSPORT ${IN3_TRANSPORT} transport_curl)
if (CURL_BLOCKING)
ADD_DEFINITIONS(-DCURL_BLOCKING)
endif()
else()
set(USE_CURL 0)
endif()


Expand All @@ -81,23 +89,27 @@ if (ERR_MSG)
endif()

if(ETH_FULL)
ADD_DEFINITIONS(-DETH_FULL)
set(IN3_VERIFIER eth_full)
ADD_DEFINITIONS(-DETH_FULL)
set(IN3_VERIFIER eth_full)
set(ETH_BASIC true)
set(ETH_NANO true)
elseif(ETH_BASIC)
ADD_DEFINITIONS(-DETH_BASIC)
set(IN3_VERIFIER eth_basic)
ADD_DEFINITIONS(-DETH_BASIC)
set(IN3_VERIFIER eth_basic)
set(ETH_NANO true)
elseif(ETH_NANO)
ADD_DEFINITIONS(-DETH_NANO)
set(IN3_VERIFIER eth_nano)
ADD_DEFINITIONS(-DETH_NANO)
set(IN3_VERIFIER eth_nano)
endif()

if(IN3API)
ADD_DEFINITIONS(-DETH_API)
set(IN3_API eth_api)
ADD_DEFINITIONS(-DETH_API)
set(IN3_API eth_api)
endif()

if(IPFS)
ADD_DEFINITIONS(-DIPFS)
set(IN3_VERIFIER ${IN3_VERIFIER} ipfs)
ADD_DEFINITIONS(-DIPFS)
set(IN3_VERIFIER ${IN3_VERIFIER} ipfs)
endif()

if(COLOR AND NOT (MSVC OR MSYS OR MINGW))
Expand Down
63 changes: 45 additions & 18 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,33 +52,60 @@ add_subdirectory(docs)
if (IN3_LIB)
set(IN3_LIBS
$<TARGET_OBJECTS:core_o>
$<TARGET_OBJECTS:init_o>
$<TARGET_OBJECTS:crypto_o>
$<TARGET_OBJECTS:b64_o>
$<TARGET_OBJECTS:tommath_o>
$<TARGET_OBJECTS:evm_o>
$<TARGET_OBJECTS:eth_full_o>
$<TARGET_OBJECTS:eth_api_o>
$<TARGET_OBJECTS:eth_basic_o>
$<TARGET_OBJECTS:eth_nano_o>
$<TARGET_OBJECTS:usn_api_o>
$<TARGET_OBJECTS:ipfs_o>
$<TARGET_OBJECTS:ipfs_api_o>
)
# if we use curl, we include curl transport as well
if (USE_CURL)
set(IN3_LIBS ${IN3_LIBS} $<TARGET_OBJECTS:transport_curl_o>)

if (ETH_FULL)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:tommath_o>
$<TARGET_OBJECTS:evm_o>
$<TARGET_OBJECTS:eth_full_o>
)
endif()

if (ETH_BASIC)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:eth_basic_o>
)
endif()

if (ETH_NANO)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:eth_nano_o>
)
endif()

if (IPFS)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:b64_o>
$<TARGET_OBJECTS:ipfs_o>
)
if (IN3API)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:ipfs_api_o>
)
endif()
endif()

if (IN3API)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:eth_api_o>
$<TARGET_OBJECTS:usn_api_o>
$<TARGET_OBJECTS:api_utils_o>
)
endif()

if (USE_SCRYPT)
set(IN3_LIBS ${IN3_LIBS} $<TARGET_OBJECTS:scrypt_o>)
endif()

# create the libraries
add_library(in3_bundle STATIC ${IN3_LIBS} )
add_library(in3_lib SHARED ${IN3_LIBS} )
set_target_properties(in3_bundle PROPERTIES OUTPUT_NAME "in3")
set_target_properties(in3_lib PROPERTIES OUTPUT_NAME "in3")

# for curl we need to add the dependency
if (USE_CURL)
target_link_libraries(in3_lib transport_curl)
endif()
target_link_libraries(in3_lib ${IN3_TRANSPORT})

# install
INSTALL(TARGETS in3_bundle
Expand Down
34 changes: 31 additions & 3 deletions c/docs/1_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ When configuring cmake, you can set a lot of different incubed specific like `cm
Default-Value: `-DASMJS=OFF`


#### BTC

if true, the bitcoin verifiers will be build

Default-Value: `-DBTC=OFF`


#### BUILD_DOC

generates the documenation with doxygen.
Expand All @@ -42,6 +49,20 @@ Default-Value: `-DBUILD_DOC=OFF`
Default-Value: `-DCMD=ON`


#### CODE_COVERAGE

Builds targets with code coverage instrumentation. (Requires GCC or Clang)

Default-Value: `-DCODE_COVERAGE=OFF`


#### COLOR

Enable color codes for debug

Default-Value: `-DCOLOR=ON`


#### ERR_MSG

if set human readable error messages will be inculded in th executable, otherwise only the error code is used. (saves about 19kB)
Expand Down Expand Up @@ -112,6 +133,13 @@ Default-Value: `-DIN3_SERVER=OFF`
Default-Value: `-DIN3_STAGING=OFF`


#### IPFS

build IPFS verification

Default-Value: `-DIPFS=ON`


#### JAVA

build the java-binding (shared-lib and jar-file)
Expand Down Expand Up @@ -163,7 +191,7 @@ Default-Value: `-DTRANSPORTS=ON`

#### USE_CURL

if true the curl transport will be build (with a dependency to libcurl)
if true the curl transport will be built (with a dependency to libcurl)

Default-Value: `-DUSE_CURL=ON`

Expand All @@ -177,9 +205,9 @@ Default-Value: `-DUSE_PRECOMPUTED_EC=ON`

#### USE_SCRYPT

if scrypt is installed, it will link dynamicly to the shared scrypt lib.
integrate scrypt into the build in order to allow decrypt_key for scrypt encoded keys.

Default-Value: `-DUSE_SCRYPT=OFF`
Default-Value: `-DUSE_SCRYPT=ON`


#### WASM
Expand Down
Loading

0 comments on commit 608a3a8

Please sign in to comment.