Skip to content

Commit

Permalink
Refactored to be able to build one contract at a time later.
Browse files Browse the repository at this point in the history
  • Loading branch information
thekevinbrown committed Apr 10, 2019
1 parent 8ea1739 commit fce3c94
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,7 @@ export const buildAll = async () => {
const basename = path.basename(contract, '.cpp');

try {
console.log(`- Compiling ${basename}:`);

const result = await docker.command(
// Arg 1 is filename, arg 2 is contract name. They're the same for us.
`exec lamington /opt/eosio/bin/scripts/compile_contract.sh "/${path.join(
'opt',
'eosio',
'bin',
'project',
contract
)}" "${path.dirname(contract)}" "${basename}"`
);

console.log(result.raw);
await build(contract);
} catch (error) {
errors.push({
error: `Failed to compile contract ${basename}`,
Expand All @@ -216,3 +203,20 @@ export const buildAll = async () => {
process.exit(1);
}
};

export const build = async (contractPath: string) => {
const basename = path.basename(contractPath, '.cpp');

console.log(`- Compiling ${basename}:`);

return await docker.command(
// Arg 1 is filename, arg 2 is contract name. They're the same for us.
`exec lamington /opt/eosio/bin/scripts/compile_contract.sh "/${path.join(
'opt',
'eosio',
'bin',
'project',
contractPath
)}" "${path.dirname(contractPath)}" "${basename}"`
);
};

0 comments on commit fce3c94

Please sign in to comment.