diff options
Diffstat (limited to 'build/generator/gen_base.py')
-rw-r--r-- | build/generator/gen_base.py | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/build/generator/gen_base.py b/build/generator/gen_base.py index cad81c2..19b0dc3 100644 --- a/build/generator/gen_base.py +++ b/build/generator/gen_base.py @@ -117,6 +117,7 @@ class GeneratorBase: # Lists of pathnames of various kinds self.test_deps = [] # Non-BDB dependent items to build for the tests self.test_progs = [] # Subset of the above to actually execute + self.test_helpers = [] # $ {test_deps} \setminus {test_progs} $ self.bdb_test_deps = [] # BDB-dependent items to build for the tests self.bdb_test_progs = [] # Subset of the above to actually execute self.target_dirs = [] # Directories in which files are built @@ -299,24 +300,30 @@ for _dt in dep_types: globals()[_dt] = _dt class DependencyNode: - def __init__(self, filename): + def __init__(self, filename, when = None): self.filename = filename + self.when = when def __str__(self): return self.filename class ObjectFile(DependencyNode): - def __init__(self, filename, compile_cmd = None): - DependencyNode.__init__(self, filename) + def __init__(self, filename, compile_cmd = None, when = None): + DependencyNode.__init__(self, filename, when) self.compile_cmd = compile_cmd self.source_generated = 0 class SWIGObject(ObjectFile): - def __init__(self, filename, lang): + def __init__(self, filename, lang, release_mode): ObjectFile.__init__(self, filename) self.lang = lang self.lang_abbrev = lang_abbrev[lang] - self.source_generated = 1 + # in release mode the sources are not generated by the build + # but rather by the packager + if release_mode: + self.source_generated = 0 + else: + self.source_generated = 1 ### hmm. this is Makefile-specific self.compile_cmd = '$(COMPILE_%s_WRAPPER)' % self.lang_abbrev.upper() @@ -361,6 +368,7 @@ class Target(DependencyNode): self.name = name self.gen_obj = gen_obj self.desc = options.get('description') + self.when = options.get('when') self.path = options.get('path', '') self.add_deps = options.get('add-deps', '') self.add_install_deps = options.get('add-install-deps', '') @@ -433,7 +441,7 @@ class TargetLinked(Target): else: raise GenError('ERROR: unknown file extension on ' + src) - ofile = ObjectFile(objname, self.compile_cmd) + ofile = ObjectFile(objname, self.compile_cmd, self.when) # object depends upon source self.gen_obj.graph.add(DT_OBJECT, ofile, SourceFile(src, reldir)) @@ -466,10 +474,15 @@ class TargetExe(TargetLinked): TargetLinked.add_dependencies(self) # collect test programs - if self.install == 'test': + if 'svnauthz' in self.name: # special case + self.gen_obj.test_deps.append(self.filename) + self.gen_obj.test_helpers.append(self.filename) + elif self.install == 'test': self.gen_obj.test_deps.append(self.filename) if self.testing != 'skip': self.gen_obj.test_progs.append(self.filename) + else: + self.gen_obj.test_helpers.append(self.filename) elif self.install == 'bdb-test': self.gen_obj.bdb_test_deps.append(self.filename) if self.testing != 'skip': @@ -551,7 +564,7 @@ class TargetI18N(Target): else: raise GenError('ERROR: unknown file extension on ' + src) - ofile = ObjectFile(objname, self.compile_cmd) + ofile = ObjectFile(objname, self.compile_cmd, self.when) # object depends upon source self.gen_obj.graph.add(DT_OBJECT, ofile, SourceFile(src, reldir)) @@ -606,8 +619,10 @@ class TargetSWIG(TargetLib): self.filename = build_path_join(self.path, lib_filename) ifile = SWIGSource(ipath) - cfile = SWIGObject(build_path_join(self.path, cname), self.lang) - ofile = SWIGObject(build_path_join(self.path, oname), self.lang) + cfile = SWIGObject(build_path_join(self.path, cname), self.lang, + self.gen_obj.release_mode) + ofile = SWIGObject(build_path_join(self.path, oname), self.lang, + self.gen_obj.release_mode) # the .c file depends upon the .i file self.gen_obj.graph.add(DT_SWIG_C, cfile, ifile) @@ -696,7 +711,8 @@ class TargetJavaHeaders(TargetJava): class_pkg_list = self.package.split('.') class_pkg = build_path_join(*class_pkg_list) class_file = ObjectFile(build_path_join(self.classes, class_pkg, - class_name + self.objext)) + class_name + self.objext), + self.when) class_file.source_generated = 1 class_file.class_name = class_name hfile = HeaderFile(class_header, self.package + '.' + class_name, @@ -756,7 +772,7 @@ class TargetJavaClasses(TargetJava): else: raise GenError('ERROR: unknown file extension on "' + src + '"') - ofile = ObjectFile(objname, self.compile_cmd) + ofile = ObjectFile(objname, self.compile_cmd, self.when) sfile = SourceFile(src, reldir) sfile.sourcepath = sourcepath @@ -1123,6 +1139,11 @@ class IncludeDependencyInfo: # of <>/"" convention. return hdrs +class FileInfo: + def __init__(self, filename, when, target=None): + self.filename = filename + self.when = when + self.target = target def _sorted_files(graph, area): "Given a list of targets, sort them based on their dependencies." @@ -1160,9 +1181,9 @@ def _sorted_files(graph, area): s = graph.get_sources(DT_LINK, t.name) for d in s: if d not in targets: - files.append(d.filename) + files.append(FileInfo(d.filename, d.when, d)) else: - files.append(t.filename) + files.append(FileInfo(t.filename, t.when, t)) # don't consider this target any more targets.remove(t) |