Skip to content

Commit

Permalink
Fixed Generator Cache with --no-export
Browse files Browse the repository at this point in the history
  • Loading branch information
nicorum authored and olofk committed Dec 18, 2024
1 parent 282bafe commit 1a9b687
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions fusesoc/edalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@ def run_generators(self):
core.direct_deps.append(str(gen_core.name))
gen_core.pos = _ttptttg.pos
self._resolved_or_generated_cores.append(gen_core)
if self.export_root and not (
_ttptttg.is_generator_cacheable()
or _ttptttg.is_input_cacheable()
):
if self.export_root and not _ttptttg.is_cacheable():
self._generated_core_dirs_to_remove.append(gen_core.core_root)

def export(self):
Expand Down Expand Up @@ -532,7 +529,9 @@ def to_yaml(self, edam_file):


class Ttptttg:
def __init__(self, ttptttg, core, generators, gen_root, resolve_env_vars=False):
def __init__(
self, ttptttg, core, generators, temp_gen_root, resolve_env_vars=False
):
generator_name = ttptttg["generator"]
if not generator_name in generators:
raise RuntimeError(
Expand All @@ -545,7 +544,11 @@ def __init__(self, ttptttg, core, generators, gen_root, resolve_env_vars=False):
self.name = ttptttg["name"]
self.pos = ttptttg["pos"]
self.gen_name = generator_name
self.gen_root = gen_root
self.gen_root = (
temp_gen_root
if temp_gen_root and not self.is_cacheable()
else self.core.cache_root
)
self.resolve_env_vars = resolve_env_vars
parameters = ttptttg["config"]

Expand Down Expand Up @@ -652,6 +655,9 @@ def is_generator_cacheable(self):
and self.generator["cache_type"] == "generator"
)

def is_cacheable(self):
return self.is_input_cacheable() or self.is_generator_cacheable()

def generate(self):
"""Run a parametrized generator
Expand All @@ -664,7 +670,7 @@ def generate(self):
logger.debug("Generator input yaml hash: " + hexdigest)

generator_cwd = os.path.join(
self.gen_root or self.core.cache_root,
self.gen_root,
"generator_cache",
self.vlnv.sanitized_name + "-" + hexdigest,
)
Expand Down

0 comments on commit 1a9b687

Please sign in to comment.