in build/generator/gen_win.py [0:0]
def get_proj_sources(self, quote_path, target):
"Get the list of source files for each project"
sources = [ ]
javac_exe = "javac"
jar_exe = "jar"
if self.jdk_path:
javac_exe = os.path.join(self.jdk_path, "bin", javac_exe)
jar_exe = os.path.join(self.jdk_path, "bin", jar_exe)
if not isinstance(target, gen_base.TargetProject):
for source, object, reldir in self.get_win_sources(target):
cbuild = None
ctarget = None
cdesc = None
cignore = None
if isinstance(target, gen_base.TargetJava):
classes = targetdir = self.path(target.classes)
if self.junit_path is not None:
classes = "%s;%s" % (classes, self.junit_path)
headers = ''
if target.headers is not None:
headers = '-h %s' % self.quote(self.path(target.headers))
sourcepath = self.path(source.sourcepath)
per_project_flags = ""
if target.name.find("-compat-"):
per_project_flags += "-Xlint:-deprecation -Xlint:-dep-ann" \
" -Xlint:-rawtypes"
cbuild = ("%s -g -Xlint -Xlint:-options %s %s "
" -target 1.8 -source 1.8 -classpath "
" %s -d %s "
" -sourcepath %s $(InputPath)") \
% (self.quote(javac_exe), per_project_flags, headers,
self.quote(classes), self.quote(targetdir),
self.quote(sourcepath))
if isinstance(object, gen_base.HeaderFile):
ctarget = self.path(object.filename_win)
cdesc = "Generating %s" % (object.filename_win)
else:
ctarget = self.path(object.filename)
cdesc = "Compiling %s" % (source)
rsrc = self.path(str(source))
if quote_path and '-' in rsrc:
rsrc = '"%s"' % rsrc
if (not isinstance(source, gen_base.SourceFile)
and cbuild is None and ctarget is None and cdesc is None
and source in self._excluded_from_build):
# Make sure include dependencies are excluded from the build.
# This is an 'orrible 'ack that relies on the source being a
# string if it's an include dependency, or a SourceFile object
# otherwise.
cignore = 'yes'
sources.append(ProjectItem(path=rsrc, reldir=reldir, user_deps=[],
custom_build=cbuild, custom_target=ctarget,
custom_desc=cdesc, ignored = cignore,
extension=os.path.splitext(rsrc)[1]))
if isinstance(target, gen_base.TargetJava) and target.jar:
classdir = self.path(target.classes)
jarfile = msvc_path_join(classdir, target.jar)
cbuild = "%s cf %s -C %s %s" \
% (self.quote(jar_exe), jarfile, classdir,
" ".join(target.packages))
deps = [x.custom_target for x in sources]
sources.append(ProjectItem(path='makejar', reldir='', user_deps=deps,
custom_build=cbuild, custom_target=jarfile,
extension=''))
if isinstance(target, gen_base.TargetSWIG):
swig_options = self.swig.opts[target.lang].split()
swig_options.append('-DWIN32')
swig_deps = []
for include_dir in self.get_win_includes(target):
swig_options.append("-I%s" % self.quote(include_dir))
for obj in self.graph.get_sources(gen_base.DT_LINK, target.name):
if isinstance(obj, gen_base.SWIGObject):
for cobj in self.graph.get_sources(gen_base.DT_OBJECT, obj):
if isinstance(cobj, gen_base.SWIGObject):
csrc = self.path(cobj.filename)
cout = csrc
# included header files that the generated c file depends on
user_deps = swig_deps[:]
for iobj in self.graph.get_sources(gen_base.DT_SWIG_C, cobj):
isrc = self.path(str(iobj))
if not isinstance(iobj, gen_base.SWIGSource):
user_deps.append(isrc)
continue
cbuild = '%s %s -o %s $(InputPath)' \
% (self.swig_exe, " ".join(swig_options), cout)
cdesc = 'Generating %s' % cout
sources.append(ProjectItem(path=isrc, reldir=None,
custom_build=cbuild,
custom_target=csrc,
custom_desc=cdesc,
user_deps=user_deps,
extension=''))
def_file = self.get_def_file(target)
if def_file is not None:
gsrc = self.path("build/generator/extractor.py")
deps = [self.path('build.conf')]
for header in target.msvc_export:
deps.append(self.path('subversion/include', header))
cbuild = "%s $(InputPath) %s > %s" \
% (self.quote(sys.executable), " ".join(deps), def_file)
cdesc = 'Generating %s ' % def_file
sources.append(ProjectItem(path=gsrc, reldir=None,
custom_build=cbuild,
custom_target=def_file,
custom_desc=cdesc,
user_deps=deps,
extension=''))
sources.append(ProjectItem(path=def_file, reldir=None,
custom_build=None, user_deps=[],
extension=''))
sources.sort(key = lambda x: x.path)
return sources