Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Ref #15: Fix code generation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nathanielhourt committed May 3, 2017
1 parent 97b87b0 commit e09354e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 7 additions & 5 deletions libraries/types/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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} )

8 changes: 6 additions & 2 deletions libraries/types/types.eos
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down Expand Up @@ -67,6 +67,10 @@ struct CreateProducer
name AccountName
key PublicKey

struct UpdateProducer
name AccountName
newKey PublicKey

# implies message.sender account
struct ApproveProducer
producer AccountName
Expand Down

0 comments on commit e09354e

Please sign in to comment.