From 2c2f82e973c6aef246e31e62cb36bde30dd3e758 Mon Sep 17 00:00:00 2001 From: Just some guy <3859395+fubuloubu@users.noreply.github.com> Date: Mon, 19 Apr 2021 18:30:50 -0400 Subject: [PATCH] fix: compiler integration (#28) * fix: use absolute paths instead of relative ones * refactor: display compilation notification in compiler manager --- src/ape/managers/compilers.py | 3 ++- src/ape/managers/project.py | 5 ++--- src/ape/utils.py | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ape/managers/compilers.py b/src/ape/managers/compilers.py index b9ed1256a2..9cc586a565 100644 --- a/src/ape/managers/compilers.py +++ b/src/ape/managers/compilers.py @@ -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 @@ -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: diff --git a/src/ape/managers/project.py b/src/ape/managers/project.py index f6e27faf4d..de54e765b4 100644 --- a/src/ape/managers/project.py +++ b/src/ape/managers/project.py @@ -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 diff --git a/src/ape/utils.py b/src/ape/utils.py index 09646997a6..ea9ee14f9a 100644 --- a/src/ape/utils.py +++ b/src/ape/utils.py @@ -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):