[buildj] Topologically sort targets before passing them to waf
- From: Abderrahim Kitouni <akitouni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [buildj] Topologically sort targets before passing them to waf
- Date: Mon, 13 Sep 2010 19:18:59 +0000 (UTC)
commit 7400cd962f1716b8a9e9bd497d94c08ae9f4faa7
Author: Abderrahim Kitouni <a kitouni gmail com>
Date: Mon Sep 13 13:38:29 2010 +0100
Topologically sort targets before passing them to waf
waf is not always smart enough to figure out these dependencies
(especially for vala targets)
buildj.py | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/buildj.py b/buildj.py
index c125717..decb368 100644
--- a/buildj.py
+++ b/buildj.py
@@ -96,7 +96,19 @@ class ProjectFile:
return option_list
def get_targets (self):
- return self._targets
+ names = dict([(tgt.get_name(), tgt) for tgt in self._targets])
+ deps = dict([(tgt.get_name(), tgt.get_uses()) for tgt in self._targets])
+ S = [tgt for tgt in deps if not deps[tgt]]
+ targets = []
+ while S:
+ n = S.pop(0)
+ targets.append(names[n])
+ for m in deps:
+ if n in deps[m]:
+ deps[m].remove(n)
+ if not deps[m]:
+ S.insert(0,m)
+ return targets
def get_tools (self):
tools = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]