-
Notifications
You must be signed in to change notification settings - Fork 201
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outstanding work @spalladino! You literally wrote a bulletproof zos compiler in a couple of days! Loved it.
Please let me know when it's ready for a final review. As you may have noticed, we will have to fix some conflicts between this branch and the one of the zos-config
file.
async compileWithSolc(compilerOptions?: CompilerOptions): Promise<void> { | ||
const inputDir = Contracts.getLocalContractsDir(); | ||
const outputDir = Contracts.getLocalBuildDir(); | ||
const options = { ... this.getSettings(), ... compilerOptions }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone through the compile
command, and if you call it without having a truffle.js
/truffle-config.js
file, this line will throw: TypeError: Cannot read property 'getSettings' of undefined
. changing this
to Compiler
will do the trick though (and use our solc compiler)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, good catch. I'll wait for your PR and review this with the latest config version.
packages/cli/src/utils/solidity.ts
Outdated
export function compilerSettingsMatch(s1: CompilerVersionOptions, s2: CompilerVersionOptions) { | ||
if (!s1 || !s2) return false; | ||
|
||
/* tslint:disable:triple-equals */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not longer relevant since we removed tslint 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's by design, I wanted to accept comparing runs set as both strings and numbers.
packages/cli/src/models/compiler/solidity/SolidityContractsCompiler.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Splendid work @spalladino! I like amount of comments and the structure of the code. I don't know what is your previous knowledge on solc complier and how much of a code is taken from other source but technical depth looks impressive!
🚢 🚀
packages/cli/src/utils/solidity.ts
Outdated
export function compilerSettingsMatch(s1: CompilerVersionOptions, s2: CompilerVersionOptions) { | ||
if (!s1 || !s2) return false; | ||
|
||
/* tslint:disable:triple-equals */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not longer relevant since we removed tslint 😃
5ba8cb1
to
ad965f8
Compare
This reverts commit 1b149aa.
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
Also fixes errors thrown in itShouldParse tests
910a81e
to
7852d17
Compare
Truffle binary could be installed globally.
IsLocalContract check from getContractNames depends on an absolute path, which makes GreeterImpl to be returned only in the machine where it was compiled.
Adds a new
zos compile
command to the CLI, which will use eithertruffle compile
or call solc directly from zOS.The workflow for compiling now is as follows:
truffle.js
config file, thentruffle compile
is called as usual, and returns~/.solc/list.json
, expires after 2hs)0.5.8
), then by specific build (0.5.10-nightly.2019.5.28
)pragma
s is usedsolc
in path, and its version matches the resolved one, it is used~/.solc
If
zos compile
is manually called at any time, its settings are saved in the zos.json file, and any further compilation is run using zos instead of truffle.Note for reviewers: this PR starts from an original PR by Facu with a custom compiler, and then builds on top of it. It also includes code from resolver-engine, plus a few bits from buidler, as well as a custom solc-wrapper package. I'd suggest reviewing by-commit, since it's a large set of changes.
Fixes #854