Skip to content

Commit

Permalink
Address review remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
blitz-1306 committed Mar 1, 2022
1 parent 41ad8ef commit bc60c2c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
17 changes: 17 additions & 0 deletions docker/download.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
#!/bin/bash

if [[ $# -ne 2 ]] ; then
echo "The $0 utility requires two input arguments:"
echo "- Arch for compilers to download. See https://github.com/ethereum/solc-bin for available archs."
echo "- Target directory to store the downloaded compilers."
echo ""
echo "Note that to use custom compiler cache path, the env variable SOL_AST_COMPILER_CACHE should be set."
echo "See README.md for the details."
echo ""
echo "Example:"
echo ""
echo "$0 'wasm' path/to/compiler/cache"
echo "export SOL_AST_COMPILER_CACHE=path/to/compiler/cache"
echo "sol-ast-compile --locate-compiler-cache"

exit 1;
fi

ARCH="${1}"
CACHE_DIR="${2}"
TARGET_DIR="$CACHE_DIR/$ARCH"
Expand Down
8 changes: 4 additions & 4 deletions src/compile/kinds/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ export async function getCompilerForVersion<T extends CompilerMapping>(
);

/**
* Native compilers are exeсutable files, so give them valid permissions.
* WASM compilers are loaded by NodeJS, so write them as common files.
* Native compilers are exeсutable files, so give them proper permissions.
* WASM compilers are loaded by NodeJS, so write them as readonly common files.
*/
const options = kind === CompilerKind.Native ? { mode: 0o555 } : undefined;
const permissions = kind === CompilerKind.Native ? 0o555 : 0o444;

await fse.writeFile(compilerLocalPath, response.data, options);
await fse.writeFile(compilerLocalPath, response.data, { mode: permissions });
}

if (kind === CompilerKind.Native) {
Expand Down

0 comments on commit bc60c2c

Please sign in to comment.