tokenika / eosfactory

Python-based EOS smart-contract development & testing framework
http://eosfactory.io/
Other
243 stars 62 forks source link

Compile multiple contracts #149

Open jasonbert opened 5 years ago

jasonbert commented 5 years ago

Is it possible to compile multiple contracts in the same project? It appears only the first .cpp file is taken into account at the moment.

EDIT:

Just want to expand on this, hopefully I'm missing something obvious, I'd like to be able to have multiple contract files in the /src folder of a project and have them all built & output to the /build folder. At the moment i seems as though you have to create a new project for each contract. This isn't great for source control purposes, or project management in general.

stefanzarembinski commented 5 years ago

It is our design assumption: you have to create a new project for each contract. This is compatible with the rules of eosio.cdt compiler: it take single source file only.

jasonbert commented 5 years ago

The compiler may only accept a single contract at a time, but you could still have a project with multiple contracts in it. I came from using EOS Easy Contract, in their "projects" you could have multiple contracts and they would all be compiled to their respective ABI/WASM.

It's not very practical to have a separate project and repo for each contract, you could end up with tonnes of repos which will be a nightmare to maintain. Conversely, storing lots of project folders in the same repo deviates from the norms of folder structures on GitHub. It's still probably better compared to the former, but not ideal.

stefanzarembinski commented 5 years ago

EOSFactory project management

This project management system, our design assumption, result from the following observations:

jasonbert commented 5 years ago

I think you're missing the point between design aspects of a contract versus project maintainability. To say you can have multiple VS Code windows open is preposterous, it highly simplifies the likelihood that EOS projects will have quite a few contracts to maintain. You can't expect someone to have 10+ VS Code windows open and then run a compile command on each one.

Just because the eosio.cdt doesn't compile multiple contracts at the same time doesn't mean you can't iterate through the contracts and compile each one individually. The compiler is not dictating rules on how to organise a project, you just pass it a contract and it spits out compiled files.

I suspect the approach you're taking with project/contract maintainability will hinder the adoption. It's unfortunate because you're doing excellent work with this.

stefanzarembinski commented 5 years ago

I appreciate your persistance. I hope, I will implement your suggestion, possibly soon, but not now. Now I am busy preparing for publication a VSCode extension that organizes a skeleton IDE for smart contracts. If you see this work, I will ask you for detailed suggestions on how to multiply its functionality.

stefanzarembinski commented 5 years ago

Now I want to consider your demand. Please, see EOSIDE which is an extension to VSCode, available from VSCode Marketplace. Please, let me know your suggestions about how to organize development of two (or more) contracts in the came VSCode window.

An example of a context, where working on two contracts in parallel is convenient, could help me to understand your point.