From 61dd46811b324a070c9a5007ac9b92a58fce9bb4 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Thu, 8 Feb 2018 00:11:26 +0000 Subject: ninja: avoid needing include_directory('.') with jar() Although only one file is passed to javac at a time, if your code has any inter-file dependencies javac still needs to know how to find other source files for its -implicit:class feature to work whereby it will automatically also compile files that the given file depends on. -implicit:class is the default, practical, behaviour of javac since otherwise it would be necessary to declare the class dependencies for parallel java builds to be feasible. Passing "include_directory: include_directory('.')" to jar() causes -souredir to be passed to javac which then enables your source code to have inter-file class dependencies - assuming none of your source code is generated. This ensures that '.' is included by default. --- mesonbuild/backend/ninjabackend.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mesonbuild/backend') diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index cb51f3b..8ac7658 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1029,12 +1029,12 @@ int dummy; args += self.build.get_project_args(compiler, target.subproject) args += target.get_java_args() args += compiler.get_output_args(self.get_target_private_dir(target)) - sourcepath = '' + curdir = target.get_subdir() + sourcepath = os.path.join(self.build_to_src, curdir) + os.pathsep for i in target.include_dirs: for idir in i.get_incdirs(): sourcepath += os.path.join(self.build_to_src, i.curdir, idir) + os.pathsep - if sourcepath != '': - args += ['-sourcepath', sourcepath] + args += ['-sourcepath', sourcepath] rel_src = src.rel_to_builddir(self.build_to_src) plain_class_path = src.fname[:-4] + 'class' rel_obj = os.path.join(self.get_target_private_dir(target), plain_class_path) -- cgit v1.1