Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile multiple contracts #149

Open
jasonbert opened this issue Mar 16, 2019 · 6 comments
Open

Compile multiple contracts #149

jasonbert opened this issue Mar 16, 2019 · 6 comments

Comments

@jasonbert
Copy link

jasonbert commented Mar 16, 2019

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

EOSFactory project management

  • All smart-contract projects are kept in a folder referenced to as 'contract workspace'. The path to this folder is set on the installation process.
  • Each smart contract project has its own folder, named after the name of the contract.
  • Each contract folder is structured, involving the following folders:
    • .vscode
    • build
    • resources
    • src
    • tests
    • utils

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

  • EOSIO smart contracts do not interact on the level of their code.
  • The 'eosio.cdt' tools do not work on take multiple contracts.
  • The 'cleos' deployment tool suggest using the naming convention that we accept.
  • In our opinion, VSCode can be used with many windows set side by side.

@jasonbert
Copy link
Author

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
Copy link
Contributor

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants