|
|
|
@ -970,7 +970,7 @@ int dummy; |
|
|
|
|
class_list = [] |
|
|
|
|
compiler = target.compilers['java'] |
|
|
|
|
c = 'c' |
|
|
|
|
m = '' |
|
|
|
|
m = 'm' |
|
|
|
|
e = '' |
|
|
|
|
f = 'f' |
|
|
|
|
main_class = target.get_main_class() |
|
|
|
@ -980,11 +980,21 @@ int dummy; |
|
|
|
|
plain_class_path = self.generate_single_java_compile(src, target, compiler, outfile) |
|
|
|
|
class_list.append(plain_class_path) |
|
|
|
|
class_dep_list = [os.path.join(self.get_target_private_dir(target), i) for i in class_list] |
|
|
|
|
manifest_path = os.path.join(self.get_target_private_dir(target), 'Manifest.txt') |
|
|
|
|
os.makedirs(os.path.dirname(os.path.join(self.environment.get_build_dir(), manifest_path)), exist_ok=True) |
|
|
|
|
with open(manifest_path, 'w') as manifest: |
|
|
|
|
if any(target.link_targets): |
|
|
|
|
manifest.write('Class-Path: ') |
|
|
|
|
cp_paths = [os.path.join(self.get_target_dir(l), l.get_filename()) for l in target.link_targets] |
|
|
|
|
manifest.write(' '.join(cp_paths)) |
|
|
|
|
manifest.write('\n') |
|
|
|
|
jar_rule = 'java_LINKER' |
|
|
|
|
commands = [c + m + e + f] |
|
|
|
|
commands.append(manifest_path) |
|
|
|
|
if e != '': |
|
|
|
|
commands.append(main_class) |
|
|
|
|
commands.append(self.get_target_filename(target)) |
|
|
|
|
commands.append(manifest_path) |
|
|
|
|
# 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. |
|
|
|
@ -1063,12 +1073,14 @@ int dummy; |
|
|
|
|
self.generate_generator_list_rules(target, outfile) |
|
|
|
|
|
|
|
|
|
def generate_single_java_compile(self, src, target, compiler, outfile): |
|
|
|
|
deps = [os.path.join(self.get_target_dir(l), l.get_filename()) for l in target.link_targets] |
|
|
|
|
args = [] |
|
|
|
|
args += compiler.get_buildtype_args(self.get_option_for_target('buildtype', target)) |
|
|
|
|
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)) |
|
|
|
|
args += target.get_classpath_args() |
|
|
|
|
curdir = target.get_subdir() |
|
|
|
|
sourcepath = os.path.join(self.build_to_src, curdir) + os.pathsep |
|
|
|
|
sourcepath += os.path.normpath(curdir) + os.pathsep |
|
|
|
@ -1080,6 +1092,7 @@ int dummy; |
|
|
|
|
plain_class_path = src.fname[:-4] + 'class' |
|
|
|
|
rel_obj = os.path.join(self.get_target_private_dir(target), plain_class_path) |
|
|
|
|
element = NinjaBuildElement(self.all_outputs, rel_obj, compiler.get_language() + '_COMPILER', rel_src) |
|
|
|
|
element.add_dep(deps) |
|
|
|
|
element.add_item('ARGS', args) |
|
|
|
|
element.write(outfile) |
|
|
|
|
return plain_class_path |
|
|
|
|