add new keyword 4 RUN_JAVA_PROGRAM pt 1
@@ -31,17 +31,21 @@ def extract_macro_calls2(unit, macro_value_name):
def onrun_java_program(unit, *args):
+ args = list(args)
"""
Custom code generation
@link: https://wiki.yandex-team.ru/yatool/java/#kodogeneracijarunjavaprogram
"""
- flat, kv = common.sort_by_keywords({'IN': -1, 'IN_DIR': -1, 'OUT': -1, 'OUT_DIR': -1, 'CWD': 1, 'CLASSPATH': -1, 'ADD_SRCS_TO_CLASSPATH': 0}, args)
+ flat, kv = common.sort_by_keywords({'IN': -1, 'IN_DIR': -1, 'OUT': -1, 'OUT_DIR': -1, 'CWD': 1, 'CLASSPATH': -1, 'CP_USE_COMMAND_FILE': 1, 'ADD_SRCS_TO_CLASSPATH': 0}, args)
depends = kv.get('CLASSPATH', []) + kv.get('JAR', [])
if depends:
# XXX: hack to force ymake to build dependencies
unit.on_run_java(['TOOL'] + depends + ["OUT", "fake.out.{}".format(hash(tuple(depends)))])
+ if not kv.get('CP_USE_COMMAND_FILE'):
+ args += ['CP_USE_COMMAND_FILE', unit.get(['JAVA_PROGRAM_CP_USE_COMMAND_FILE']) or 'yes']
+
prev = unit.get(['RUN_JAVA_PROGRAM_VALUE']) or ''
new_val = (prev + ' ' + base64.b64encode(json.dumps(list(args), encoding='utf-8'))).strip()
unit.set(['RUN_JAVA_PROGRAM_VALUE', new_val])
