Skip to content

Commit

Permalink
fix: compiler integration (#28)
Browse files Browse the repository at this point in the history
* fix: use absolute paths instead of relative ones

* refactor: display compilation notification in compiler manager
  • Loading branch information
fubuloubu authored Apr 19, 2021
1 parent a1d4418 commit 2c2f82e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/ape/managers/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ape.api.compiler import CompilerAPI
from ape.plugins import PluginManager
from ape.types import ContractType
from ape.utils import cached_property
from ape.utils import cached_property, notify

from .config import ConfigManager

Expand Down Expand Up @@ -37,6 +37,7 @@ def compile(self, contract_filepath: Path) -> ContractType:
extension = contract_filepath.suffix

if extension in self.registered_compilers:
notify("INFO", f"Compiling '{contract_filepath.relative_to(Path.cwd())}'")
return self.registered_compilers[extension].compile(contract_filepath)

else:
Expand Down
5 changes: 2 additions & 3 deletions src/ape/managers/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ def _contracts_folder(self) -> Path:

@property
def sources(self) -> List[Path]:
files = []
files: List[Path] = []
for extension in self.compilers.registered_compilers:
for f in self._contracts_folder.rglob("*" + extension):
files.append(f.relative_to(self.path))
files.extend(self._contracts_folder.rglob("*" + extension))

return files

Expand Down
7 changes: 6 additions & 1 deletion src/ape/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
except ImportError:
from singledispatchmethod import singledispatchmethod # type: ignore

NOTIFY_COLORS = {"WARNING": "bright_red", "ERROR": "bright_red", "SUCCESS": "bright_green"}
NOTIFY_COLORS = {
"WARNING": "bright_red",
"ERROR": "bright_red",
"SUCCESS": "bright_green",
"INFO": "blue",
}


def notify(type_, msg):
Expand Down

0 comments on commit 2c2f82e

Please sign in to comment.