Skip to content

Commit

Permalink
fix: comp spec fix
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed May 28, 2024
1 parent 3f6b7f8 commit 3f3331b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 6 additions & 6 deletions ape_solidity/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ def compile(
with pm.isolate_in_tempdir() as isolated_project:
filepaths = [isolated_project.path / src_id for src_id in source_ids]
yield from self._compile(filepaths, project=isolated_project, settings=settings)
compilers = isolated_project.manifest.compilers

pm.update_manifest(compilers=compilers)

def _compile(
self,
Expand Down Expand Up @@ -604,20 +607,17 @@ def _compile(

vers = contract_versions[ct.name]
settings = input_jsons[vers]["settings"]
contract_id = f"{ct.source_id}:{ct.name}"
if vers in compilers_used and contract_id not in (
compilers_used[vers].contractTypes or []
):
if vers in compilers_used and ct.name not in (compilers_used[vers].contractTypes or []):
compilers_used[vers].contractTypes = [
*(compilers_used[vers].contractTypes or []),
contract_id,
ct.name,
]

elif vers not in compilers_used:
compilers_used[vers] = Compiler(
name=self.name.lower(),
version=f"{vers}",
contractTypes=[contract_id],
contractTypes=[ct.name],
settings=settings,
)

Expand Down
3 changes: 1 addition & 2 deletions tests/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest
import solcx

from ape import Project, reverts
from ape.exceptions import CompilerError
from ape.logging import LogLevel
Expand Down Expand Up @@ -596,7 +595,7 @@ def test_compile_outputs_compiler_data_to_manifest(project, compiler):
assert len(project.manifest.compilers or []) == 1
actual = project.manifest.compilers[0]
assert actual.name == "solidity"
assert "contracts/CompilesOnce.sol:CompilesOnce" in actual.contractTypes
assert "CompilesOnce" in actual.contractTypes
assert actual.version == "0.8.25+commit.b61c2a91"
# Compiling again should not add the same compiler again.
_ = [c for c in compiler.compile((path,), project=project)]
Expand Down

0 comments on commit 3f3331b

Please sign in to comment.