mirror of
https://git.sr.ht/~kivikakk/niar
synced 2024-12-22 23:42:23 +00:00
build: use IL from plan, not on disk.
We haven't extracted it yet.
This commit is contained in:
parent
12dc846334
commit
8175fb5d0a
|
@ -76,7 +76,7 @@ def main(np: Project, args):
|
||||||
|
|
||||||
# The outf doesn't exist here; it's only used for the digest name basis.
|
# The outf doesn't exist here; it's only used for the digest name basis.
|
||||||
cr.add_process(execute_build,
|
cr.add_process(execute_build,
|
||||||
infs=[np.path.build(subdir, fn)],
|
infs=[{np.path.build(subdir, fn): plan.files[fn]}],
|
||||||
outf=np.path.build(subdir, np.name))
|
outf=np.path.build(subdir, np.name))
|
||||||
|
|
||||||
cr.run()
|
cr.run()
|
||||||
|
|
|
@ -14,7 +14,7 @@ class CompilationUnit:
|
||||||
self.cmd = cmd
|
self.cmd = cmd
|
||||||
else:
|
else:
|
||||||
self.cmd = [str(el) for el in cmd]
|
self.cmd = [str(el) for el in cmd]
|
||||||
self.infs = [str(p) for p in infs]
|
self.infs = infs
|
||||||
self.outf = str(outf) if outf else None
|
self.outf = str(outf) if outf else None
|
||||||
self.chdir = chdir
|
self.chdir = chdir
|
||||||
|
|
||||||
|
@ -50,14 +50,12 @@ class CompilationUnit:
|
||||||
def digest_str(s):
|
def digest_str(s):
|
||||||
digest_bytes(s.encode())
|
digest_bytes(s.encode())
|
||||||
|
|
||||||
sorted_in_paths = list(self.infs)
|
infs = self.process_infs()
|
||||||
sorted_in_paths.sort()
|
|
||||||
|
|
||||||
digest_int(len(sorted_in_paths))
|
digest_int(len(infs))
|
||||||
for in_path in sorted_in_paths:
|
for in_path in sorted(infs.keys()):
|
||||||
digest_str(in_path)
|
digest_str(in_path)
|
||||||
with open(in_path, "rb") as f:
|
digest_bytes(infs[in_path])
|
||||||
digest_bytes(f.read())
|
|
||||||
|
|
||||||
if not inspect.isfunction(self.cmd):
|
if not inspect.isfunction(self.cmd):
|
||||||
digest_int(len(self.cmd))
|
digest_int(len(self.cmd))
|
||||||
|
@ -66,7 +64,18 @@ class CompilationUnit:
|
||||||
|
|
||||||
return m.hexdigest()
|
return m.hexdigest()
|
||||||
|
|
||||||
|
def process_infs(self):
|
||||||
|
r = {}
|
||||||
|
for inf in self.infs:
|
||||||
|
if isinstance(inf, dict):
|
||||||
|
for k, v in inf.items():
|
||||||
|
if isinstance(v, str):
|
||||||
|
v = v.encode()
|
||||||
|
r[str(k)] = v
|
||||||
|
else:
|
||||||
|
with open(inf, "rb") as f:
|
||||||
|
r[str(inf)] = f.read()
|
||||||
|
return r
|
||||||
class CommandRunner:
|
class CommandRunner:
|
||||||
cus: list[CompilationUnit]
|
cus: list[CompilationUnit]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue