Can create jar objects.

pull/15/head
Jussi Pakkanen 11 years ago
parent 11f2106228
commit 3dadcbc9a7
  1. 2
      backends.py
  2. 7
      build.py
  3. 15
      interpreter.py

@ -715,6 +715,8 @@ class NinjaBackend(Backend):
else:
static_linker = self.build.static_linker
crstr = ''
if static_linker is None:
return
rule = 'rule STATIC%s_LINKER\n' % crstr
command = ' command = %s $LINK_FLAGS %s $in\n' % \
(' '.join(static_linker.get_exelist()),

@ -518,6 +518,13 @@ class SharedLibrary(BuildTarget):
aliases.append(self.get_shbase())
return aliases
class Jar(BuildTarget):
def __init__(self, name, subdir, is_cross, sources, objects, environment, kwargs):
super().__init__(name, subdir, is_cross, sources, objects, environment, kwargs);
for s in self.sources:
if not s.endswith('.java'):
raise InvalidArguments('Jar source %s is not a java file.' % s)
class ConfigureFile():
def __init__(self, subdir, sourcename, targetname, configuration_data):

@ -360,6 +360,10 @@ class SharedLibraryHolder(BuildTargetHolder):
def __init__(self, name, subdir, is_cross, sources, objects, environment, kwargs):
super().__init__(build.SharedLibrary, name, subdir, is_cross, sources, objects, environment, kwargs)
class JarHolder(BuildTargetHolder):
def __init__(self, name, subdir, is_cross, sources, objects, environment, kwargs):
super().__init__(build.Jar, name, subdir, is_cross, sources, objects, environment, kwargs)
class Test(InterpreterObject):
def __init__(self, name, exe, is_parallel, cmd_args, env):
InterpreterObject.__init__(self)
@ -632,6 +636,7 @@ class Interpreter():
'dependency' : self.func_dependency,
'static_library' : self.func_static_lib,
'shared_library' : self.func_shared_lib,
'jar' : self.func_jar,
'generator' : self.func_generator,
'test' : self.func_test,
'headers' : self.func_headers,
@ -966,13 +971,21 @@ class Interpreter():
def func_shared_lib(self, node, args, kwargs):
return self.build_target(node, args, kwargs, SharedLibraryHolder)
def func_jar(self, node, args, kwargs):
return self.build_target(node, args, kwargs, JarHolder)
def func_generator(self, node, args, kwargs):
gen = GeneratorHolder(args, kwargs)
self.generators.append(gen)
return gen
def func_test(self, node, args, kwargs):
self.validate_arguments(args, 2, [str, ExecutableHolder])
if len(args) != 2:
raise InterpreterException('Incorrect number of arguments')
if not isinstance(args[0], str):
raise InterpreterException('First argument of test must be a string.')
if not isinstance(args[1], ExecutableHolder) and not isinstance(args[1], JarHolder):
raise InterpreterException('Second argument must be executable.')
par = kwargs.get('is_parallel', True)
if not isinstance(par, bool):
raise InterpreterException('Keyword argument is_parallel must be a boolean.')

Loading…
Cancel
Save