-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multiple resolc fixes and improvements (#151)
- Error out early on compiler invocations with invalid base path or include path flags. - Do not error out if no files and no errors were produced. This aligns resolc closer to sloc. - Add a CLI test with an involved fixture containing multiple contract remappings to properly testing the standard JSON path. - Fixes input normalization in the Wasm version. Co-authored-by: Cyrill Leutwiler <[email protected]>
- Loading branch information
Showing
7 changed files
with
207 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
crates/solidity/src/tests/cli-tests/src/contracts/compiled/1.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,44 @@ | ||
import * as shell from 'shelljs'; | ||
import * as fs from 'fs'; | ||
import { spawnSync } from 'child_process'; | ||
|
||
interface CommandResult { | ||
output: string; | ||
exitCode: number; | ||
} | ||
|
||
export const executeCommand = (command: string): CommandResult => { | ||
const result = shell.exec(command, {async: false}); | ||
export const executeCommand = (command: string, stdin?: string): CommandResult => { | ||
if (stdin) { | ||
const process = spawnSync(command, [], { | ||
input: stdin, | ||
shell: true, | ||
encoding: 'utf8', | ||
maxBuffer: 30 * 1024 * 1024 | ||
}); | ||
|
||
return { | ||
exitCode: process.status || 0, | ||
output: (process.stdout || process.stderr || '').toString() | ||
}; | ||
} | ||
|
||
const result = shell.exec(command, { silent: true, async: false }); | ||
return { | ||
exitCode: result.code, | ||
output: result.stdout.trim() || result.stderr.trim(), | ||
output: result.stdout || result.stderr || '' | ||
}; | ||
}; | ||
|
||
export const isFolderExist = (folder: string): boolean => { | ||
export const isFolderExist = (folder: string): boolean => { | ||
return shell.test('-d', folder); | ||
}; | ||
|
||
export const isFileExist = (pathToFileDir: string, fileName: string, fileExtension:string): boolean => { | ||
return shell.ls(pathToFileDir).stdout.includes(fileName + fileExtension); | ||
export const isFileExist = (pathToFileDir: string, fileName: string, fileExtension: string): boolean => { | ||
return shell.ls(pathToFileDir).stdout.includes(fileName + fileExtension); | ||
}; | ||
|
||
export const isFileEmpty = (file: string): boolean => { | ||
export const isFileEmpty = (file: string): boolean => { | ||
if (fs.existsSync(file)) { | ||
return (fs.readFileSync(file).length === 0); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters