ethereum / solidity

Solidity, the Smart Contract Programming Language
https://soliditylang.org
GNU General Public License v3.0
22.96k stars 5.69k forks source link

Proposal: A project local config for solidity projects #1226

Closed LefterisJP closed 7 years ago

LefterisJP commented 7 years ago

Introduction

I would like to propose a convention for the existence of a project local config file for solidity projects. The config file should be in the root project directory where solc should be called from and should have a standard recognizeable name. For example .solidity or .solc.

The Problem

The problem this proposal tries to solve is how third party developer tools like say editor plugins/modules handle solidity development. I take the EMACS solidity-mode as an example here.

2016-10-15-145220_1163x145_scrot

The plugin performs on the fly compilation of solidity and highlights errors on your sourcecode. The problem is that it has no way to know what compilation arguments you are using with solc and as such if you use the remappings feature then the on the fly compilation will always fail at the import and this functionality of the plugin becomes useless.

The solution

Add a .solidity file in the root of the project and there provide all such configuration variables that would be needed by the compiler for each individual project.

*
|---- .solidity
|---- ProjectSource1.sol
|---- ProjectSource2.sol

.solidity

remappings: raiden=/home/lefteris/w/raiden/raiden/smart_contracts

How?

For now the only use case I can see is the above, and only for the remappings argument. Perhaps there are others, but quite certainly there will be need for per-project configuration in the future. My suggestion on how to proceed ahead from here is to ask other developer's opinions and see if they like this approach.

If yes then we can all start including it in our solidity projects and tool developers can start expecting and parsing this file to have their tools become project aware.

chriseth commented 7 years ago

Please also see the discussion in https://github.com/ethpm/epm and the related gitter channel.

axic commented 7 years ago

@LefterisJP it may make sense moving this to browser-solidity given it has a config file now and is an IDE.

LefterisJP commented 7 years ago

It's fine by me. I just want us to establish some kind of standard for project configuration so that we can have all IDEs follow it and be able to provide info for things such as remapping so that compilation works.

chriseth commented 7 years ago

I would like to move that into the scope of the ethpm project.