Make Java compilation work with inner classes. Closes #1157.
This commit is contained in:
parent
e128d26b35
commit
5787a4b4fb
|
@ -803,8 +803,10 @@ int dummy;
|
|||
if e != '':
|
||||
commands.append(main_class)
|
||||
commands.append(self.get_target_filename(target))
|
||||
for cls in class_list:
|
||||
commands += ['-C', self.get_target_private_dir(target), cls]
|
||||
# Java compilation can produce an arbitrary number of output
|
||||
# class files for a single source file. Thus tell jar to just
|
||||
# grab everything in the final package.
|
||||
commands += ['-C', self.get_target_private_dir(target), '.']
|
||||
elem = NinjaBuildElement(self.all_outputs, outname_rel, jar_rule, [])
|
||||
elem.add_dep(class_dep_list)
|
||||
elem.add_item('ARGS', commands)
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.mesonbuild;
|
||||
|
||||
class Simple {
|
||||
class Inner {
|
||||
public String getString() {
|
||||
return "Inner class is working.\n";
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String [] args) {
|
||||
Simple s = new Simple();
|
||||
Simple.Inner ic = s.new Inner();
|
||||
System.out.println(ic.getString());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
project('simplejava', 'java')
|
||||
|
||||
javaprog = jar('myprog', 'com/mesonbuild/Simple.java',
|
||||
main_class : 'com.mesonbuild.Simple')
|
||||
test('mytest', javaprog)
|
Loading…
Reference in New Issue