Skip to content

Commit

Permalink
Merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiven committed Mar 27, 2024
2 parents 6e3da2c + 6835d02 commit aae43d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build/ab.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def materialise(self, replacing=False):
if self in unmaterialisedTargets:
unmaterialisedTargets.remove(self)

self.traits.add(self.callback.__name__)
materialisingStack.pop()

def bubbleattr(self, attr, xs):
Expand Down Expand Up @@ -168,6 +167,7 @@ def wrapper(*, name=None, replaces=None, **kwargs):
i.cwd = cwd
i.types = func.__annotations__
i.callback = func
i.traits.add(func.__name__)

i.binding = sig.bind(name=name, self=i, **kwargs)
i.binding.apply_defaults()
Expand Down Expand Up @@ -313,7 +313,7 @@ def filenamesmatchingof(xs, pattern):


def targetswithtraitsof(xs, trait):
return [target for target in targetsof(xs) if target.traits.contains(trait)]
return [target for target in targetsof(xs) if trait in target.traits]


def targetnamesof(*xs):
Expand Down
14 changes: 8 additions & 6 deletions build/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
normalrule,
bubbledattrsof,
stripext,
targetswithtraitsof,
)
from os.path import *
from types import SimpleNamespace
Expand Down Expand Up @@ -139,24 +140,24 @@ def libraryimpl(
cheaders(
replaces=self,
hdrs=hdrs,
deps=filenamesmatchingof(deps, "*.h"),
deps=targetswithtraitsof(deps, "cheaders"),
caller_cflags=caller_cflags,
)
return
if hdrs:
hr = cheaders(
name=self.localname + "_hdrs",
hdrs=hdrs,
deps=filenamesmatchingof(deps, "*.h"),
deps=targetswithtraitsof(deps, "cheaders"),
caller_cflags=caller_cflags,
)
hr.materialise()
deps = deps + [hr]

objs = findsources(
name,
srcs,
filenamesmatchingof(srcs, "*.h")
+ filenamesmatchingof(deps, "*.h")
+ ([hr] if hr else []),
targetswithtraitsof(deps, "cheaders"),
cflags + bubbledattrsof(deps, "caller_cflags"),
kind,
)
Expand All @@ -170,9 +171,10 @@ def libraryimpl(
)
self.outs = self.outs + (hr.outs if hr else [])

self.traits.add("cheaders")
self.attr.caller_ldflags = caller_ldflags
self.bubbleattr("caller_ldflags", deps)
self.bubbleattr("caller_cflags", deps + ([hr] if hr else []))
self.bubbleattr("caller_cflags", deps)


@Rule
Expand Down

0 comments on commit aae43d9

Please sign in to comment.