Can run built jar files.

pull/15/head
Jussi Pakkanen 11 years ago
parent 7cd9749127
commit efc79fb85e
  1. 13
      backends.py
  2. 7
      build.py
  3. 3
      test cases/java/1 basic/meson.build

@ -249,10 +249,21 @@ class Backend():
obj_list = []
compiler = self.get_compiler_for_source(src_list[0])
assert(compiler.get_language() == 'java')
c = 'c'
m = ''
e = ''
f = 'f'
main_class = target.get_main_class()
if main_class != '':
e = 'e'
for src in src_list:
obj_list.append(self.generate_single_java_compile(src, target, compiler, outfile))
jar_rule = 'java_LINKER'
commands = ['cf', self.get_target_filename(target)] + obj_list
commands = [c+m+e+f]
if e != '':
commands.append(main_class)
commands.append(self.get_target_filename(target))
commands += obj_list
elem = NinjaBuildElement(outname_rel, jar_rule, [])
elem.add_dep(obj_list)
elem.add_item('FLAGS', commands)

@ -261,6 +261,10 @@ class BuildTarget():
if self.custom_install_dir is not None:
if not isinstance(self.custom_install_dir, str):
raise InvalidArguments('Custom_install_dir must be a string')
main_class = kwargs.get('main_class', '')
if not isinstance(main_class, str):
raise InvalidArguments('Main class must be a string')
self.main_class = main_class
def get_subdir(self):
return self.subdir
@ -526,6 +530,9 @@ class Jar(BuildTarget):
raise InvalidArguments('Jar source %s is not a java file.' % s)
self.filename = self.name + '.jar'
def get_main_class(self):
return self.main_class
class ConfigureFile():
def __init__(self, subdir, sourcename, targetname, configuration_data):

@ -1,4 +1,5 @@
project('simplejava', 'java')
javaprog = jar('myprog', 'com/sourceforge/meson/Simple.java')
javaprog = jar('myprog', 'com/sourceforge/meson/Simple.java',
main_class : 'com.sourceforge.meson.Simple')
test('mytest', javaprog)

Loading…
Cancel
Save