Can set compiler arguments in Java.

pull/1068/head
Jussi Pakkanen 8 years ago
parent 0250b2cce6
commit c9a46fcc93
  1. 3
      mesonbuild/backend/ninjabackend.py
  2. 6
      mesonbuild/build.py
  3. 7
      test cases/java/3 args/com/mesonbuild/Simple.java
  4. 9
      test cases/java/3 args/meson.build

@ -859,6 +859,9 @@ int dummy;
def generate_single_java_compile(self, src, target, compiler, outfile):
args = []
args += compiler.get_buildtype_args(self.environment.coredata.get_builtin_option('buildtype'))
args += self.build.get_global_args(compiler)
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))
for i in target.include_dirs:
for idir in i.get_incdirs():

@ -28,6 +28,7 @@ known_basic_kwargs = {'install' : True,
'cs_args' : True,
'vala_args' : True,
'd_args' : True,
'java_args' : True,
'link_args' : True,
'link_depends': True,
'link_with' : True,
@ -1342,7 +1343,7 @@ class Jar(BuildTarget):
if not s.endswith('.java'):
raise InvalidArguments('Jar source %s is not a java file.' % s)
self.filename = self.name + '.jar'
incdirs = kwargs.get('include_directories', [])
self.java_args = kwargs.get('java_args', [])
def get_main_class(self):
return self.main_class
@ -1350,6 +1351,9 @@ class Jar(BuildTarget):
def type_suffix(self):
return "@jar"
def get_java_args(self):
return self.java_args
class ConfigureFile():
def __init__(self, subdir, sourcename, targetname, configuration_data):

@ -0,0 +1,7 @@
package com.mesonbuild;
class Simple {
public static void main(String [] args) {
System.out.println("Java is working.\n");
}
}

@ -0,0 +1,9 @@
project('simplejava', 'java')
add_project_arguments('-target', '1.6', language : 'java')
javaprog = jar('myprog', 'com/mesonbuild/Simple.java',
main_class : 'com.mesonbuild.Simple',
java_args : ['-source', '1.6'])
test('mytest', javaprog)
Loading…
Cancel
Save