Skip to content

Commit

Permalink
fix: properly handle rest of settings
Browse files Browse the repository at this point in the history
needed for per-optimization-level compilation
  • Loading branch information
z80dev committed Oct 24, 2023
1 parent 145d376 commit 6cb728e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ape_vyper/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,20 @@ def compile(

for vyper_version, source_paths in version_map.items():
settings = all_settings.get(vyper_version, {})
path_args = {str(get_relative_path(p.absolute(), base_path)): p for p in source_paths}
optimizations_map = self.get_optimization_pragma_map(list(source_paths))

for optimization, paths in optimizations_map.items():
for optimization, source_paths in optimizations_map.items():
path_args = {
str(get_relative_path(p.absolute(), base_path)): p for p in source_paths
}
input_json = {
"language": "Vyper",
"settings": settings,
"sources": {s: {"content": p.read_text()} for s, p in path_args.items()},
}

input_json["settings"]["optimize"] = optimization
input_json["settings"]["outputSelection"] = {s: ["*"] for s in path_args}
if interfaces := self.import_remapping:
input_json["interfaces"] = interfaces

Expand Down Expand Up @@ -480,10 +483,6 @@ def get_compiler_settings(
continue

version_settings: Dict = {"optimize": True}
path_args = {
str(get_relative_path(p.absolute(), contracts_path)): p for p in source_paths
}
version_settings["outputSelection"] = {s: ["*"] for s in path_args}
if evm_version := data.get("evm_version"):
version_settings["evmVersion"] = evm_version

Expand Down

0 comments on commit 6cb728e

Please sign in to comment.