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

Commit

Permalink
Compile command (#914)
Browse files Browse the repository at this point in the history
* Revert "Remove custom compiling process with solc (#570)"

This reverts commit 1b149aa.

* Swap out DependenciesFinder with resolver-engine

Instead of manually looking for dependencies, rely on resolver-engine to handle that for us (which we are already using via the flattener). We are also collecting all dependencies in advance, instead of relying on the callback, for two reasons:

- The resolver interface is async, and the callback is sync
- This allows us to then swap out solc-js for a native or docker compiler

* Add compile command

* Check if recompile is needed and fix tests

* Update project and contract compiler models

* Use solidity-parser-antlr for fetching import directives

* Fix truffle binary lookup

* Generate deployed sourcemap and better logging

* Test and fixes for compile command

Also fixes errors thrown in itShouldParse tests

* Add support for local binary solc

* Use solc list from cache even if expired if download fails

* Add missing contract dependency to test

* Recompile if compiler settings change

* Fix truffle findUp

* Fix compile promise await

* Manage compiler config from zos.json

* Lint!

* Apply suggestions from code review

* Lint and fix rebase issues

* Remove option to compile with truffle from command line

* Use async versions instead of sync

* Remove unused CompilerConfig file

* Force using zos compiler when running zos compile

* IsTruffleProject is determined by config file only

Truffle binary could be installed globally.

* Fix compiler test

IsLocalContract check from getContractNames depends on an absolute path, which makes GreeterImpl to be returned only in the machine where it was compiled.
  • Loading branch information
spalladino authored and mergify[bot] committed Jun 5, 2019
1 parent c827629 commit 0a88c11
Show file tree
Hide file tree
Showing 40 changed files with 2,765 additions and 624 deletions.
3 changes: 2 additions & 1 deletion packages/cli/.eslintignore
@@ -1,2 +1,3 @@
/lib
/test
/test
/solc
19 changes: 19 additions & 0 deletions packages/cli/mocks/mock-stdlib-with-deps/contracts/GreeterImpl.sol
@@ -0,0 +1,19 @@
pragma solidity ^0.5.0;

import "mock-dep/contracts/GreeterDep.sol";

contract GreeterImpl is GreeterDep {
event Greeting(string greeting);

function greet(string memory who) public {
emit Greeting(greeting(who));
}

function greeting(string memory who) public pure returns (string memory) {
return who;
}

function version() public pure returns (string memory) {
return "1.1.0";
}
}
Empty file.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions packages/cli/mocks/mock-stdlib-with-deps/package.json
@@ -0,0 +1,12 @@
{
"name": "mock-stdlib",
"version": "1.1.0",
"description": "Mock stdlib for tests in zos-cli",
"main": "index.js",
"private": true,
"scripts": {
"test": "truffle test"
},
"author": "santiago@zeppelin.solutions",
"license": "MIT"
}
4 changes: 4 additions & 0 deletions packages/cli/mocks/mock-stdlib-with-deps/truffle.js
@@ -0,0 +1,4 @@
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
};

0 comments on commit 0a88c11

Please sign in to comment.