diff --git a/.gitignore b/.gitignore index 4a858d36d02..b2f6cabeafb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,7 @@ xcode/ # Dependencies node_modules +lib/json +lib/protobuf .idea/ diff --git a/.gitmodules b/.gitmodules index c733113007c..80925b865c5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,3 @@ -[submodule "lib/protobuf"] - path = lib/protobuf - url = https://github.com/protocolbuffers/protobuf.git [submodule "lib/googletest"] path = lib/googletest url = https://github.com/google/googletest.git -[submodule "lib/json"] - path = lib/json - url = https://github.com/nlohmann/json.git diff --git a/CMakeLists.txt b/CMakeLists.txt index f76fd0098be..d7fccbb296e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ macro(find_host_package) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endmacro(find_host_package) -find_host_package(Boost) +find_host_package(Boost REQUIRED) # Submodules find_package(Git QUIET) @@ -36,12 +36,10 @@ if(NOT EXISTS "${PROJECT_SOURCE_DIR}/lib/googletest/CMakeLists.txt") message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") endif() -# JSON -set(JSON_BuildTests OFF CACHE INTERNAL "") -add_subdirectory(lib/json) +include(ExternalProject) -# Protobuf -set(ROOT_DIR ${PROJECT_SOURCE_DIR}) +# Dependencies +include(cmake/JSON.cmake) include(cmake/Protobuf.cmake) # Source files @@ -51,14 +49,15 @@ if(${ANDROID}) add_library(TrustWalletCore SHARED ${sources} ${PROTO_SRCS} ${PROTO_HDRS}) find_library(log-lib log) - target_link_libraries(TrustWalletCore PRIVATE TrezorCrypto protobuf ${log-lib} Boost::boost nlohmann_json::nlohmann_json) + target_link_libraries(TrustWalletCore PRIVATE TrezorCrypto protobuf ${log-lib} Boost::boost) else() message("Configuring standalone") file(GLOB_RECURSE sources src/*.c src/proto/*.cc src/*.cpp src/*.h) add_library(TrustWalletCore ${sources} ${PROTO_SRCS} ${PROTO_HDRS}) - target_link_libraries(TrustWalletCore PRIVATE TrezorCrypto protobuf Boost::boost nlohmann_json::nlohmann_json) + target_link_libraries(TrustWalletCore PRIVATE TrezorCrypto protobuf Boost::boost) endif() +add_dependencies(TrustWalletCore nlohmann_json) # Define headers for this library. PUBLIC headers are used for compiling the # library, and will be added to consumers' build paths. @@ -69,6 +68,7 @@ target_include_directories(TrustWalletCore PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/jni/cpp + ${json_INCLUDE_DIRS} ) if(NOT ANDROID AND NOT IOS_PLATFORM) diff --git a/TrustWalletCore.podspec b/TrustWalletCore.podspec index 1c565827323..5c901dcedb0 100644 --- a/TrustWalletCore.podspec +++ b/TrustWalletCore.podspec @@ -24,112 +24,110 @@ Pod::Spec.new do |s| 'swift/Sources/**/*.{swift,h,m,cpp}', 'trezor-crypto/src/**/*.{c,h}', 'trezor-crypto/include/**/*.{h}', - 'lib/protobuf/src/google/protobuf/stubs/bytestream.cc', - 'lib/protobuf/src/google/protobuf/stubs/callback.cc', - 'lib/protobuf/src/google/protobuf/stubs/common.cc', - 'lib/protobuf/src/google/protobuf/stubs/int128.cc', - 'lib/protobuf/src/google/protobuf/stubs/status.cc', - 'lib/protobuf/src/google/protobuf/stubs/statusor.cc', - 'lib/protobuf/src/google/protobuf/stubs/stringpiece.cc', - 'lib/protobuf/src/google/protobuf/stubs/stringprintf.cc', - 'lib/protobuf/src/google/protobuf/stubs/structurally_valid.cc', - 'lib/protobuf/src/google/protobuf/stubs/strutil.cc', - 'lib/protobuf/src/google/protobuf/stubs/time.cc', - 'lib/protobuf/src/google/protobuf/arena.cc', - 'lib/protobuf/src/google/protobuf/extension_set.cc', - 'lib/protobuf/src/google/protobuf/generated_message_util.cc', - 'lib/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc', - 'lib/protobuf/src/google/protobuf/implicit_weak_message.cc', - 'lib/protobuf/src/google/protobuf/message_lite.cc', - 'lib/protobuf/src/google/protobuf/repeated_field.cc', - 'lib/protobuf/src/google/protobuf/wire_format_lite.cc', - 'lib/protobuf/src/google/protobuf/io/coded_stream.cc', - 'lib/protobuf/src/google/protobuf/io/strtod.cc', - 'lib/protobuf/src/google/protobuf/io/zero_copy_stream.cc', - 'lib/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc', - 'lib/protobuf/src/google/protobuf/any.pb.cc', - 'lib/protobuf/src/google/protobuf/api.pb.cc', - 'lib/protobuf/src/google/protobuf/stubs/mathlimits.cc', - 'lib/protobuf/src/google/protobuf/stubs/mathlimits.h', - 'lib/protobuf/src/google/protobuf/any.cc', - 'lib/protobuf/src/google/protobuf/descriptor.cc', - 'lib/protobuf/src/google/protobuf/descriptor_database.cc', - 'lib/protobuf/src/google/protobuf/descriptor.pb.cc', - 'lib/protobuf/src/google/protobuf/duration.pb.cc', - 'lib/protobuf/src/google/protobuf/dynamic_message.cc', - 'lib/protobuf/src/google/protobuf/empty.pb.cc', - 'lib/protobuf/src/google/protobuf/extension_set_heavy.cc', - 'lib/protobuf/src/google/protobuf/field_mask.pb.cc', - 'lib/protobuf/src/google/protobuf/generated_message_reflection.cc', - 'lib/protobuf/src/google/protobuf/generated_message_table_driven_lite.h', - 'lib/protobuf/src/google/protobuf/generated_message_table_driven.cc', - 'lib/protobuf/src/google/protobuf/map_field.cc', - 'lib/protobuf/src/google/protobuf/message.cc', - 'lib/protobuf/src/google/protobuf/reflection_internal.h', - 'lib/protobuf/src/google/protobuf/reflection_ops.cc', - 'lib/protobuf/src/google/protobuf/service.cc', - 'lib/protobuf/src/google/protobuf/source_context.pb.cc', - 'lib/protobuf/src/google/protobuf/struct.pb.cc', - 'lib/protobuf/src/google/protobuf/stubs/substitute.cc', - 'lib/protobuf/src/google/protobuf/stubs/substitute.h', - 'lib/protobuf/src/google/protobuf/text_format.cc', - 'lib/protobuf/src/google/protobuf/timestamp.pb.cc', - 'lib/protobuf/src/google/protobuf/type.pb.cc', - 'lib/protobuf/src/google/protobuf/unknown_field_set.cc', - 'lib/protobuf/src/google/protobuf/wire_format.cc', - 'lib/protobuf/src/google/protobuf/wrappers.pb.cc', - 'lib/protobuf/src/google/protobuf/io/gzip_stream.cc', - 'lib/protobuf/src/google/protobuf/io/printer.cc', - 'lib/protobuf/src/google/protobuf/io/strtod.cc', - 'lib/protobuf/src/google/protobuf/io/tokenizer.cc', - 'lib/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc', - 'lib/protobuf/src/google/protobuf/compiler/importer.cc', - 'lib/protobuf/src/google/protobuf/compiler/parser.cc', - 'lib/protobuf/src/google/protobuf/util/delimited_message_util.cc', - 'lib/protobuf/src/google/protobuf/util/field_comparator.cc', - 'lib/protobuf/src/google/protobuf/util/field_mask_util.cc', - 'lib/protobuf/src/google/protobuf/util/internal/constants.h', - 'lib/protobuf/src/google/protobuf/util/internal/datapiece.cc', - 'lib/protobuf/src/google/protobuf/util/internal/datapiece.h', - 'lib/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc', - 'lib/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h', - 'lib/protobuf/src/google/protobuf/util/internal/error_listener.cc', - 'lib/protobuf/src/google/protobuf/util/internal/error_listener.h', - 'lib/protobuf/src/google/protobuf/util/internal/expecting_objectwriter.h', - 'lib/protobuf/src/google/protobuf/util/internal/field_mask_utility.cc', - 'lib/protobuf/src/google/protobuf/util/internal/field_mask_utility.h', - 'lib/protobuf/src/google/protobuf/util/internal/json_escaping.cc', - 'lib/protobuf/src/google/protobuf/util/internal/json_escaping.h', - 'lib/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc', - 'lib/protobuf/src/google/protobuf/util/internal/json_objectwriter.h', - 'lib/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc', - 'lib/protobuf/src/google/protobuf/util/internal/json_stream_parser.h', - 'lib/protobuf/src/google/protobuf/util/internal/location_tracker.h', - 'lib/protobuf/src/google/protobuf/util/internal/mock_error_listener.h', - 'lib/protobuf/src/google/protobuf/util/internal/object_location_tracker.h', - 'lib/protobuf/src/google/protobuf/util/internal/object_source.h', - 'lib/protobuf/src/google/protobuf/util/internal/object_writer.cc', - 'lib/protobuf/src/google/protobuf/util/internal/object_writer.h', - 'lib/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc', - 'lib/protobuf/src/google/protobuf/util/internal/protostream_objectsource.h', - 'lib/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc', - 'lib/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.h', - 'lib/protobuf/src/google/protobuf/util/internal/proto_writer.cc', - 'lib/protobuf/src/google/protobuf/util/internal/proto_writer.h', - 'lib/protobuf/src/google/protobuf/util/internal/structured_objectwriter.h', - 'lib/protobuf/src/google/protobuf/util/internal/type_info.cc', - 'lib/protobuf/src/google/protobuf/util/internal/type_info.h', - 'lib/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc', - 'lib/protobuf/src/google/protobuf/util/internal/type_info_test_helper.h', - 'lib/protobuf/src/google/protobuf/util/internal/utility.cc', - 'lib/protobuf/src/google/protobuf/util/internal/utility.h', - 'lib/protobuf/src/google/protobuf/util/json_util.cc', - 'lib/protobuf/src/google/protobuf/util/message_differencer.cc', - 'lib/protobuf/src/google/protobuf/util/time_util.cc', - 'lib/protobuf/src/google/protobuf/util/type_resolver_util.cc' + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/bytestream.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/callback.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/common.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/int128.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/status.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/statusor.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/stringpiece.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/stringprintf.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/structurally_valid.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/strutil.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/time.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/arena.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/extension_set.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/generated_message_util.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/generated_message_table_driven_lite.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/implicit_weak_message.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/message_lite.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/repeated_field.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/wire_format_lite.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/io/coded_stream.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/io/strtod.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/io/zero_copy_stream.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/io/zero_copy_stream_impl_lite.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/any.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/api.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/mathlimits.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/mathlimits.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/any.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/descriptor.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/descriptor_database.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/descriptor.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/duration.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/dynamic_message.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/empty.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/extension_set_heavy.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/field_mask.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/generated_message_reflection.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/generated_message_table_driven_lite.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/generated_message_table_driven.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/map_field.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/message.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/reflection_internal.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/reflection_ops.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/service.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/source_context.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/struct.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/substitute.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/stubs/substitute.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/text_format.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/timestamp.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/type.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/unknown_field_set.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/wire_format.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/wrappers.pb.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/io/gzip_stream.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/io/printer.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/io/strtod.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/io/tokenizer.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/io/zero_copy_stream_impl.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/compiler/importer.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/compiler/parser.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/delimited_message_util.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/field_comparator.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/field_mask_util.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/constants.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/datapiece.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/datapiece.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/default_value_objectwriter.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/default_value_objectwriter.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/error_listener.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/error_listener.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/expecting_objectwriter.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/field_mask_utility.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/field_mask_utility.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/json_escaping.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/json_escaping.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/json_objectwriter.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/json_objectwriter.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/json_stream_parser.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/json_stream_parser.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/location_tracker.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/mock_error_listener.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/object_location_tracker.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/object_source.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/object_writer.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/object_writer.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/protostream_objectsource.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/protostream_objectsource.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/protostream_objectwriter.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/protostream_objectwriter.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/proto_writer.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/proto_writer.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/structured_objectwriter.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/type_info.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/type_info.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/type_info_test_helper.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/type_info_test_helper.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/utility.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/internal/utility.h', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/json_util.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/message_differencer.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/time_util.cc', + 'build/protobuf/src/protobuf_ext/src/google/protobuf/util/type_resolver_util.cc' s.exclude_files = - 'trezor-crypto/src/gui/*.{c,h}', - 'trezor-crypto/src/sqlite/*.{c,h}', 'trezor-crypto/src/rand.c' s.public_header_files = 'include/**/*.h', @@ -137,8 +135,9 @@ Pod::Spec.new do |s| s.preserve_paths = 'trezor-crypto/src/*.{table}', - 'lib/protobuf/src/google/protobuf/**/*.h', - 'lib/json/include/**/*.hpp' + 'lib/protobuf/include/**/*.h', + 'lib/json/include/**/*.hpp', + 'src/proto/*.proto' s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(inherited) ' \ '${PODS_ROOT}/TrustWalletCore/src ' \ @@ -148,7 +147,7 @@ Pod::Spec.new do |s| '${PODS_ROOT}/TrustWalletCore/include ' \ '${PODS_ROOT}/TrustWalletCore/trezor-crypto/include ' \ '${PODS_ROOT}/TrustWalletCore/lib/protobuf/src ' \ - '${PODS_ROOT}/TrustWalletCore/lib/json/include', + '${PODS_ROOT}/TrustWalletCore/build/nlohmann/src/nlohmann_json', 'GCC_WARN_UNUSED_FUNCTION' => 'NO', 'GCC_WARN_64_TO_32_BIT_CONVERSION' => 'NO', 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17', @@ -157,5 +156,7 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { 'SYSTEM_HEADER_SEARCH_PATHS' => '$(inherited) /usr/local/include' } + s.prepare_command = 'tools/generate-files && cmake -H. -Bbuild && make -Cbuild' + s.dependency 'SwiftProtobuf', '~> 1.3.0' end diff --git a/bitrise.yml b/bitrise.yml new file mode 100644 index 00000000000..d2662b30c92 --- /dev/null +++ b/bitrise.yml @@ -0,0 +1,55 @@ +--- +format_version: '6' +default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git +project_type: other +trigger_map: +- push_branch: master + workflow: primary +- pull_request_source_branch: "*" + pull_request_target_branch: master + workflow: primary +workflows: + primary: + steps: + - activate-ssh-key@4.0.3: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' + - git-clone@4.0.14: {} + - cache-pull@2.0.1: {} + - script@1.1.5: + title: Unlink Node + inputs: + - content: brew unlink node@8 || true + - brew-install@0.9.0: + inputs: + - packages: autoconf automake cmake protobuf swift-protobuf boost node + - script@1.1.5: + title: Run Tests + inputs: + - content: |- + #!/usr/bin/env bash + set -e + set -x + + tools/generate-files + cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release + make -C build tests + build/tests/tests --gtest_output=xml + - script@1.1.5: + title: Run Ruby Tests + inputs: + - content: | + #!/usr/bin/env bash + set -e + set -x + + cd codegen + rake + - cocoapods-install@1.7.2: + inputs: + - source_root_path: "$BITRISE_SOURCE_DIR/swift" + - xcode-test@2.1.1: + inputs: + - scheme: TrustWalletCore + - project_path: swift/TrustWalletCore.xcworkspace + - cache-push@2.0.5: {} + - deploy-to-bitrise-io@1.3.19: {} diff --git a/bootstrap.sh b/bootstrap.sh index c7e8f0df69d..68ee53e72c5 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -6,11 +6,8 @@ set -e echo "#### Updating submodules... ####" git submodule update --init -echo "#### Generating code... ####" +echo "#### Generating files... ####" tools/generate-files -pushd codegen -bin/codegen -popd echo "#### Building... ####" cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DGIT_SUBMODULE=OFF diff --git a/cmake/JSON.cmake b/cmake/JSON.cmake new file mode 100644 index 00000000000..18689d8a5b7 --- /dev/null +++ b/cmake/JSON.cmake @@ -0,0 +1,20 @@ +set(json_PREFIX ${PROJECT_SOURCE_DIR}/lib/json) +file(MAKE_DIRECTORY ${json_PREFIX}/include/nlohmann) + +ExternalProject_Add( + nlohmann_json + + PREFIX "nlohmann" + INSTALL_DIR ${json_PREFIX} + + URL https://github.com/nlohmann/json/releases/download/v3.5.0/include.zip + URL_HASH SHA256=3564da9c5b0cf2e032f97c69baedf10ddbc98030c337d0327a215ea72259ea21 + + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /nlohmann /include/nlohmann +) +ExternalProject_Get_Property(nlohmann_json source_dir) + +set(json_SOURCE_DIR ${source_dir}) +set(json_INCLUDE_DIRS ${json_SOURCE_DIR}) diff --git a/cmake/Protobuf.cmake b/cmake/Protobuf.cmake index 2dd1dcbe162..988738dacd1 100644 --- a/cmake/Protobuf.cmake +++ b/cmake/Protobuf.cmake @@ -1,130 +1,160 @@ -include_directories("${PROJECT_SOURCE_DIR}/lib/protobuf/src") -add_library(protobuf - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/bytestream.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/bytestream.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/common.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/hash.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/int128.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/int128.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/map_util.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/mathutil.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/status.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/status.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/status_macros.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/statusor.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/statusor.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/stringpiece.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/stringpiece.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/stringprintf.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/stringprintf.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/structurally_valid.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/strutil.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/time.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/time.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/arena.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/extension_set.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/generated_message_util.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/generated_message_table_driven_lite.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/implicit_weak_message.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/message_lite.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/repeated_field.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/wire_format_lite.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/io/coded_stream.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/io/coded_stream_inl.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/io/strtod.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/io/zero_copy_stream.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/any.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/api.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/mathlimits.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/mathlimits.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/any.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/descriptor.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/descriptor_database.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/descriptor.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/duration.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/dynamic_message.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/empty.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/extension_set_heavy.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/field_mask.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/generated_message_reflection.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/generated_message_table_driven_lite.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/generated_message_table_driven.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/map_field.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/message.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/reflection_internal.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/reflection_ops.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/service.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/source_context.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/struct.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/substitute.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/stubs/substitute.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/text_format.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/timestamp.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/type.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/unknown_field_set.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/wire_format.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/wrappers.pb.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/io/gzip_stream.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/io/printer.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/io/strtod.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/io/tokenizer.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/compiler/importer.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/compiler/parser.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/delimited_message_util.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/field_comparator.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/field_mask_util.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/constants.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/datapiece.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/datapiece.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/error_listener.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/error_listener.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/expecting_objectwriter.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/field_mask_utility.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/field_mask_utility.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/json_escaping.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/json_escaping.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/json_objectwriter.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/json_stream_parser.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/location_tracker.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/mock_error_listener.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/object_location_tracker.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/object_source.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/object_writer.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/object_writer.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/protostream_objectsource.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/proto_writer.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/proto_writer.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/structured_objectwriter.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/type_info.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/type_info.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/type_info_test_helper.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/utility.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/internal/utility.h - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/json_util.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/message_differencer.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/time_util.cc - ${PROJECT_SOURCE_DIR}/lib/protobuf/src/google/protobuf/util/type_resolver_util.cc +set(protobuf_PREFIX ${PROJECT_SOURCE_DIR}/lib/protobuf) +file(MAKE_DIRECTORY ${protobuf_PREFIX}) + +ExternalProject_Add( + protobuf_ext + + URL https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-cpp-3.6.1.tar.gz + URL_HASH SHA256=b3732e471a9bb7950f090fd0457ebd2536a9ba0891b7f3785919c654fe2a2529 + + PREFIX "protobuf" + INSTALL_DIR ${protobuf_PREFIX} + + UPDATE_COMMAND "" + PATCH_COMMAND "" + CONFIGURE_COMMAND /configure --prefix + BUILD_COMMAND "" + INSTALL_COMMAND "" ) +ExternalProject_Get_Property(protobuf_ext source_dir) +set(protobuf_SOURCE_DIR ${source_dir}) -set(source_dir ${PROJECT_SOURCE_DIR}/lib/protobuf) -set(protobuf_include_dir ${source_dir}/src) +set(protobuf_SOURCE_FILES + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/hash.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/int128.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/int128.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/map_util.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/mathutil.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status_macros.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/statusor.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/statusor.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringprintf.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringprintf.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/structurally_valid.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/time.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/time.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_table_driven_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_table_driven_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream_inl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/any.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/api.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/mathlimits.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/mathlimits.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/any.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/duration.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/empty.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_heavy.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/field_mask.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_table_driven_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_table_driven.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_internal.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/source_context.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/struct.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/substitute.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/substitute.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/timestamp.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/type.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/wrappers.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/constants.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/datapiece.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/datapiece.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/default_value_objectwriter.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/default_value_objectwriter.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/error_listener.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/error_listener.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/expecting_objectwriter.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/field_mask_utility.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/field_mask_utility.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_escaping.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_escaping.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_objectwriter.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_objectwriter.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_stream_parser.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_stream_parser.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/location_tracker.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/mock_error_listener.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/object_location_tracker.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/object_source.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/object_writer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/object_writer.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectsource.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectsource.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectwriter.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectwriter.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/proto_writer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/proto_writer.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/structured_objectwriter.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info_test_helper.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info_test_helper.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/utility.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/utility.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver_util.cc +) +set_source_files_properties(${protobuf_SOURCE_FILES} PROPERTIES GENERATED TRUE) + +file(GLOB_RECURSE protobuf_HEADER_FILES ${protobuf_SOURCE_DIR}/src/**/*.h) +include_directories(${protobuf_SOURCE_DIR}/src) + +add_library(protobuf ${protobuf_SOURCE_FILES}) +add_dependencies(protobuf protobuf_ext) set_target_properties( protobuf PROPERTIES IMPORTED_CONFIGURATIONS Release - INTERFACE_INCLUDE_DIRECTORIES ${protobuf_include_dir} + INCLUDE_DIRECTORIES ${protobuf_SOURCE_DIR}/src + PUBLIC_HEADER "${protobuf_HEADER_FILES}" LINK_FLAGS -no-undefined ) target_compile_options(protobuf PRIVATE -DHAVE_PTHREAD=1) + +install(TARGETS protobuf + ARCHIVE DESTINATION ${protobuf_PREFIX}/lib + PUBLIC_HEADER DESTINATION ${protobuf_PREFIX}/include +) diff --git a/lib/json b/lib/json deleted file mode 160000 index db53bdac192..00000000000 --- a/lib/json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit db53bdac1926d1baebcb459b685dcd2e4608c355 diff --git a/lib/protobuf b/lib/protobuf deleted file mode 160000 index 66dc42d891a..00000000000 --- a/lib/protobuf +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 66dc42d891a4fc8e9190c524fd67961688a37bbe diff --git a/swift/TrustWalletCore.xcodeproj/project.pbxproj b/swift/TrustWalletCore.xcodeproj/project.pbxproj index f383169546f..fbd3d94f71c 100644 --- a/swift/TrustWalletCore.xcodeproj/project.pbxproj +++ b/swift/TrustWalletCore.xcodeproj/project.pbxproj @@ -762,6 +762,7 @@ 61E4446D221CD8C0006A4FF1 /* Ethereum.pb.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Ethereum.pb.cc; sourceTree = ""; }; 61EE6B2021DEB46A001FBB79 /* UnspentSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnspentSelector.h; sourceTree = ""; }; 61EE6B2121DEB46A001FBB79 /* UnspentSelector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnspentSelector.cpp; sourceTree = ""; }; + 61FCE682221E287000B38E9C /* unknown_field_set.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = unknown_field_set.h; sourceTree = ""; }; 61FD1FD321F13ECD000617B1 /* libprotobuf-lite.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libprotobuf-lite.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 667A8CF3B4C135CBB4CAC72E /* Pods-TrustWalletCore.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TrustWalletCore.release.xcconfig"; path = "Target Support Files/Pods-TrustWalletCore/Pods-TrustWalletCore.release.xcconfig"; sourceTree = ""; }; 7B3B8FA185E5408ACD70CFB5 /* Pods_TrustWalletCore_TrustWalletCoreTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TrustWalletCore_TrustWalletCoreTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1331,6 +1332,7 @@ 61A9B30921FF978700E601B3 /* timestamp.pb.cc */, 61A9B31021FF978800E601B3 /* type.pb.cc */, 61A9B31A21FF978900E601B3 /* unknown_field_set.cc */, + 61FCE682221E287000B38E9C /* unknown_field_set.h */, 61CAC8A021F113C70086D9A0 /* wire_format_lite_inl.h */, 61CAC89D21F113C70086D9A0 /* wire_format_lite.cc */, 61CACC9721F113CA0086D9A0 /* wire_format_lite.h */, @@ -1338,7 +1340,7 @@ 61A9B31321FF978800E601B3 /* wrappers.pb.cc */, ); name = protobuf; - path = ../lib/protobuf/src/google/protobuf; + path = ../build/protobuf/src/protobuf_ext/src/google/protobuf; sourceTree = ""; }; 61CAC6AE21F113C60086D9A0 /* stubs */ = { @@ -2306,7 +2308,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 9873B38DWV; - HEADER_SEARCH_PATHS = "${SRCROOT}/../lib/protobuf/src"; + HEADER_SEARCH_PATHS = "${SRCROOT}/../build/protobuf/src/protobuf_ext/src"; OTHER_CFLAGS = "-DHAVE_PTHREAD=1"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2321,7 +2323,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 9873B38DWV; - HEADER_SEARCH_PATHS = "${SRCROOT}/../lib/protobuf/src"; + HEADER_SEARCH_PATHS = "${SRCROOT}/../build/protobuf/src/protobuf_ext/src"; OTHER_CFLAGS = "-DHAVE_PTHREAD=1"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/swift/cpp.xcconfig.in b/swift/cpp.xcconfig.in index eeaf828ba51..453670b4156 100644 --- a/swift/cpp.xcconfig.in +++ b/swift/cpp.xcconfig.in @@ -4,4 +4,4 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -HEADER_SEARCH_PATHS = $SRCROOT/../src @Boost_INCLUDE_DIRS@ +HEADER_SEARCH_PATHS = $SRCROOT/../src @Boost_INCLUDE_DIRS@ @JSON_INCLUDE_DIR@ diff --git a/tools/generate-files b/tools/generate-files index 7001547387b..87fd5395f2b 100755 --- a/tools/generate-files +++ b/tools/generate-files @@ -10,22 +10,10 @@ set -e -PROTOC="$PWD/lib/protobuf/src/protoc" - -# Build Protobuf -git submodule update --init -if [ ! -f "$PROTOC" ]; then - pushd lib/protobuf - ./autogen.sh - ./configure - pushd src - make -j4 protoc - popd - popd -fi +PROTOBUF_DIR="$PWD/build/protobuf/src/protobuf_ext/" # Generate Java, C++ and Swift Protobuf files -$PROTOC -I=lib/protobuf/src -I=src/proto --cpp_out=src/proto --java_out=jni/java --swift_out=swift/Sources --swift_opt=Visibility=Public src/proto/*.proto +protoc -I=$PROTOBUF_DIR/src -I=src/proto --cpp_out=src/proto --java_out=jni/java --swift_out=swift/Sources --swift_opt=Visibility=Public src/proto/*.proto # Generate JS Protobuf files pushd js @@ -39,5 +27,5 @@ pushd protobuf-plugin mkdir -p build cmake -H. -Bbuild make -Cbuild -protoc -I=../lib/protobuf/src -I=../src/proto --plugin=build/protoc-gen-int --int_out ../include/TrustWalletCore ../src/proto/*.proto +protoc -I=../$PROTOBUF_DIR/src -I=../src/proto --plugin=build/protoc-gen-int --int_out ../include/TrustWalletCore ../src/proto/*.proto popd diff --git a/tools/ios-build b/tools/ios-build index 0b20e362482..60cb768bad2 100755 --- a/tools/ios-build +++ b/tools/ios-build @@ -9,6 +9,7 @@ echo -e "\n\nBuilding for iOS Device..." mkdir -p build/ios-dev cmake -H. -Bbuild/ios-dev -DCMAKE_TOOLCHAIN_FILE=cmake/ios.toolchain.cmake -DIOS_PLATFORM=OS -DIOS_DEPLOYMENT_TARGET=10.0 -DCMAKE_BUILD_TYPE=Release make -C build/ios-dev +make -C build/ios-dev install echo -e "\nBuilding for iOS Simulator..." mkdir -p build/ios-sim diff --git a/tools/ios-release b/tools/ios-release index af26833597e..8db71bdbd35 100755 --- a/tools/ios-release +++ b/tools/ios-release @@ -18,7 +18,7 @@ end # Make archive puts 'Archiving...' -includes = Dir.glob('include/**/*.h') +includes = Dir.glob('include/**/*.h') + Dir.glob('lib/**/*.{h,hpp}') sources = Dir.glob('swift/Sources/**/*.{swift,h,m}') libs = Dir.glob('build/ios/*.a') files = includes + sources + libs @@ -76,15 +76,5 @@ PODSPEC file = File.new('build/TrustWalletCore.podspec', 'w') file.write(podspec) file.close -stdout, stderr, status = Open3.capture3('pod', 'trunk', 'push', - '--skip-tests', - '--skip-import-validation', - '--allow-warnings', - file.path) -puts stdout -if status != 0 - STDERR.puts stderr - exit 1 -end -puts "Done! Version #{version} is now live." +puts "Done. Please run 'pod trunk push --allow-warnings #{file.path}'"