Skip to content

Commit 469897f

Browse files
author
Matthias Güdemann
committed
add jars from JSON config to classpath
1 parent ed34a73 commit 469897f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/java_bytecode/java_bytecode_language.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Author: Daniel Kroening, [email protected]
1313
#include <util/config.h>
1414
#include <util/cmdline.h>
1515
#include <util/string2int.h>
16+
#include <json/json_parser.h>
1617

1718
#include <goto-programs/class_hierarchy.h>
1819

@@ -59,6 +60,25 @@ void java_bytecode_languaget::get_language_options(const cmdlinet &cmd)
5960
java_cp_include_files=cmd.get_value("java-cp-include-files");
6061
else
6162
java_cp_include_files=".*";
63+
// load file list from JSON file
64+
if(java_cp_include_files[0]=='@')
65+
{
66+
jsont json_cp_config;
67+
if(parse_json(
68+
java_cp_include_files.substr(1),
69+
get_message_handler(),
70+
json_cp_config))
71+
throw "cannot read JSON input configuration for JAR loading";
72+
assert(json_cp_config.is_object() && "JSON has wrong format");
73+
jsont include_files=json_cp_config["jar"];
74+
assert(include_files.is_array() && "JSON has wrong format");
75+
// add jars from JSON config file to classpath
76+
for(const jsont &file_entry : include_files.array)
77+
{
78+
assert(file_entry.is_string() && has_suffix(file_entry.value, ".jar"));
79+
config.java.classpath.push_back(file_entry.value);
80+
}
81+
}
6282
}
6383

6484
/*******************************************************************\

0 commit comments

Comments
 (0)