-
Notifications
You must be signed in to change notification settings - Fork 7
/
build-order
executable file
·50 lines (38 loc) · 1.5 KB
/
build-order
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /usr/bin/python
#-------------------------------------------------------------- -*- python -*- #
# buildorder
# Remi Attab, 08 Nov 2012
# Copyright (c) 2012 Datacratic. All rights reserved.
#
# Checks the build ordering of the targets to make sure that a target doesn't
# depend on something that doesn't exist.
# ------------------------------------------------------------------------------#
import jmlbuild
import os
import sys
build_folder = jmlbuild.find_dotgit(os.getcwd())
graph = jmlbuild.parse_makefile("Makefile", build_folder)
built = set([])
error = False
for target in graph.order:
# makefiles aren't part of the dependency graph.
if target == "Makefile": continue
if target.endswith(jmlbuild.Ext.MK): continue
# nodejs modules dependencies are resolved at runtime.
if target.endswith(jmlbuild.Ext.NODEJS_TEST): continue
if target.endswith(jmlbuild.Ext.NODEJS_MODULE): continue
built = built | set([target])
for dep in graph.edges[target]:
# nodejs modules dependencies are resolved at runtime.
if dep.endswith(jmlbuild.Ext.NODEJS_MODULE): continue
if (not dep in built) and (dep in graph.edges):
level = "warning"
if not target.endswith(jmlbuild.Ext.TEST):
error = True
level = "error"
print "%s: %s built before dependency %s" % (level, target, dep)
if error:
print "ERROR: Fix the build ordering and try again."
else:
print "No build order errors detected."
sys.exit(error)