Skip to content

Commit 55bdcfa

Browse files
committed
Merge pull request #1806 from ethersphere/solc2
new solc api - late fixes
2 parents 071e2cd + 3a5e7ed commit 55bdcfa

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

common/compiler/solidity.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ import (
3535
)
3636

3737
var (
38-
versionRegExp = regexp.MustCompile("[0-9]+\\.[0-9]+\\.[0-9]+")
39-
newAPIRegexp = regexp.MustCompile("0\\.1\\.[2-9][0-9]*")
38+
versionRegexp = regexp.MustCompile("[0-9]+\\.[0-9]+\\.[0-9]+")
39+
legacyRegexp = regexp.MustCompile("0\\.(9\\..*|1\\.[01])")
4040
paramsLegacy = []string{
4141
"--binary", // Request to output the contract in binary (hexadecimal).
4242
"file", //
@@ -50,13 +50,13 @@ var (
5050
"1",
5151
}
5252
paramsNew = []string{
53-
"--bin", // Request to output the contract in binary (hexadecimal).
54-
"--abi", // Request to output the contract's JSON ABI interface.
55-
"--userdoc", // Request to output the contract's Natspec user documentation.
56-
"--devdoc", // Request to output the contract's Natspec developer documentation.
57-
"--add-std", // include standard lib contracts
58-
"--optimize=1", // code optimizer switched on
59-
"-o", // output directory
53+
"--bin", // Request to output the contract in binary (hexadecimal).
54+
"--abi", // Request to output the contract's JSON ABI interface.
55+
"--userdoc", // Request to output the contract's Natspec user documentation.
56+
"--devdoc", // Request to output the contract's Natspec developer documentation.
57+
"--add-std", // include standard lib contracts
58+
"--optimize", // code optimizer switched on
59+
"-o", // output directory
6060
}
6161
)
6262

@@ -102,8 +102,8 @@ func New(solcPath string) (sol *Solidity, err error) {
102102
}
103103

104104
fullVersion := out.String()
105-
version := versionRegExp.FindString(fullVersion)
106-
legacy := !newAPIRegexp.MatchString(version)
105+
version := versionRegexp.FindString(fullVersion)
106+
legacy := legacyRegexp.MatchString(version)
107107

108108
sol = &Solidity{
109109
solcPath: solcPath,

common/compiler/solidity_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ contract test {
4646
func TestCompiler(t *testing.T) {
4747
sol, err := New("")
4848
if err != nil {
49-
t.Skip("solc not found: skip: %v", err)
49+
t.Skipf("solc not found: %v", err)
5050
} else if sol.Version() != solcVersion {
51-
t.Skip("WARNING: skipping due to a newer version of solc found (%v, expect %v)", sol.Version(), solcVersion)
51+
t.Skipf("WARNING: a newer version of solc found (%v, expect %v)", sol.Version(), solcVersion)
5252
}
5353
contracts, err := sol.Compile(source)
5454
if err != nil {
@@ -83,7 +83,7 @@ func TestCompileError(t *testing.T) {
8383
func TestNoCompiler(t *testing.T) {
8484
_, err := New("/path/to/solc")
8585
if err != nil {
86-
t.Log("solidity quits with error: %v", err)
86+
t.Logf("solidity quits with error: %v", err)
8787
} else {
8888
t.Errorf("no solc installed, but got no error")
8989
}

0 commit comments

Comments
 (0)