diff options
author | chriseth <c@ethdev.com> | 2016-01-14 00:34:59 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-01-14 00:35:38 +0800 |
commit | 9ed15c40c62909e7377e9c506519a2d44990deba (patch) | |
tree | 14b6c97a4de56b0984ef39a172a88c6db18ecf85 /docs/layout-of-source-files.rst | |
parent | 154dd8cb02e982e0cd29845e78c319ed9ddbd14e (diff) | |
download | dexon-solidity-9ed15c40c62909e7377e9c506519a2d44990deba.tar.gz dexon-solidity-9ed15c40c62909e7377e9c506519a2d44990deba.tar.zst dexon-solidity-9ed15c40c62909e7377e9c506519a2d44990deba.zip |
Some more clarifications about remappings.
Diffstat (limited to 'docs/layout-of-source-files.rst')
-rw-r--r-- | docs/layout-of-source-files.rst | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst index 040f1cc2..1128685d 100644 --- a/docs/layout-of-source-files.rst +++ b/docs/layout-of-source-files.rst @@ -45,7 +45,6 @@ filesystem, it can also map to resources discovered via e.g. ipfs, http or git. Use in actual Compilers ----------------------- - When the compiler is invoked, it is not only possible to specify how to discover the first element of a path, but it is possible to specify path prefix remappings so that e.g. `github.com/ethereum/dapp-bin/library` is remapped to @@ -54,16 +53,33 @@ remapping keys are prefixes of each other, the longest is tried first. This allows for a "fallback-remapping" with e.g. `""` maps to `"/usr/local/include/solidity"`. +**solc**: + For solc (the commandline compiler), these remappings are provided as `key=value` arguments, where the `=value` part is optional (and defaults to key in that case). All remapping values that are regular files are compiled (including their dependencies). This mechanism is completely backwards-compatible (as long as no filename contains a =) and thus not a breaking change. +So as an example, if you clone +`github.com/ethereum/dapp-bin/` locally to `/usr/local/dapp-bin`, you can use +the following in your source file: + +`import "github.com/ethereum/dapp-bin/library/iterable_mapping.sol" as it_mapping;` + +and then run the compiler as + +`solc github.com/ethereum/dapp-bin/=/usr/local/dapp-bin/ source.sol` + +**browser-solidity**: + The `browser-based compiler <https://chriseth.github.io/browser-solidity>`_ -provides an automatic remapping for github and will also automatically retrieve the file: +provides an automatic remapping for github and will also automatically retrieve +the file over the network: You can import the iterable mapping by e.g. -`import "github.com/ethereum/dapp-bin/library/iterable_mapping.sol"; as it_mapping;`. +`import "github.com/ethereum/dapp-bin/library/iterable_mapping.sol" as it_mapping;`. + +Other source code providers may be added in the future. .. index:: ! comment, natspec |