From e09354ea2526153bc45a9c768d6f97dec753b328 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Wed, 3 May 2017 13:50:53 -0500 Subject: [PATCH] Ref #15: Fix code generation Dependencies for code generation were not set up correctly (in fact, they were cyclic) which meant that code generation never took place after initially setting up the repo. Now it should run automatically whenever types.eos or the generator itself changes --- libraries/types/CMakeLists.txt | 12 +++++++----- libraries/types/types.eos | 8 ++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libraries/types/CMakeLists.txt b/libraries/types/CMakeLists.txt index 1c133aa380e..b3386047539 100644 --- a/libraries/types/CMakeLists.txt +++ b/libraries/types/CMakeLists.txt @@ -6,17 +6,19 @@ add_library( eos_types TypeParser.cpp native.cpp ${HEADERS} + "${CMAKE_CURRENT_SOURCE_DIR}/include/eos/types/generated.hpp" ) target_include_directories( eos_types PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) target_link_libraries( eos_types eos_utilities fc ) -add_executable( type_generator type_generator.cpp ) -target_link_libraries( type_generator fc eos_types ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) +add_executable( type_generator type_generator.cpp TypeParser.cpp native.cpp ) +target_include_directories( type_generator PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) +target_link_libraries( type_generator eos_utilities fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) -add_custom_command( OUTPUT include/eos/types/generated.hpp +add_custom_command( OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/include/eos/types/generated.hpp" COMMAND ${CMAKE_CURRENT_BINARY_DIR}/type_generator ${CMAKE_CURRENT_SOURCE_DIR}/types.eos ${CMAKE_CURRENT_SOURCE_DIR}/include/eos/types/generated.hpp - DEPENDS types.eos type_generator type_generator.cpp ) + DEPENDS types.eos type_generator ) -add_executable( types_test test.cpp include/eos/types/generated.hpp ) +add_executable( types_test test.cpp "${CMAKE_CURRENT_SOURCE_DIR}/include/eos/types/generated.hpp" ) target_link_libraries( types_test eos_types fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) diff --git a/libraries/types/types.eos b/libraries/types/types.eos index d64a1833fe5..dbca75510b7 100644 --- a/libraries/types/types.eos +++ b/libraries/types/types.eos @@ -21,8 +21,8 @@ struct AccountPermissionWeight weight UInt16 struct Transaction - ref_block_num UInt16 - ref_block_prefix UInt32 + refBlockNum UInt16 + refBlockPrefix UInt32 expiration Time tapos UInt32 messages Message[] @@ -67,6 +67,10 @@ struct CreateProducer name AccountName key PublicKey +struct UpdateProducer + name AccountName + newKey PublicKey + # implies message.sender account struct ApproveProducer producer AccountName