From 60b9c8300c7cb8f3b5afe1e01967f59420f23fb3 Mon Sep 17 00:00:00 2001 From: Niclas Moeslund Overby Date: Tue, 19 Jun 2018 17:24:57 +0200 Subject: java: implement java linking --- mesonbuild/build.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'mesonbuild/build.py') diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 7d071e0..dc14326 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1911,6 +1911,9 @@ class Jar(BuildTarget): for s in self.sources: if not s.endswith('.java'): raise InvalidArguments('Jar source %s is not a java file.' % s) + for t in self.link_targets: + if not isinstance(t, Jar): + raise InvalidArguments('Link target %s is not a jar target.' % t) self.filename = self.name + '.jar' self.outputs = [self.filename] self.java_args = kwargs.get('java_args', []) @@ -1928,6 +1931,13 @@ class Jar(BuildTarget): # All jar targets are installable. pass + def is_linkable_target(self): + return True + + def get_classpath_args(self): + cp_paths = [os.path.join(l.get_subdir(), l.get_filename()) for l in self.link_targets] + return ['-cp', os.pathsep.join(cp_paths)] + class CustomTargetIndex: """A special opaque object returned by indexing a CustomTarget. This object @@ -1950,7 +1960,6 @@ class CustomTargetIndex: def get_subdir(self): return self.target.get_subdir() - class ConfigureFile: def __init__(self, subdir, sourcename, targetname, configuration_data): -- cgit v1.1