@@ -68,45 +68,7 @@ void java_bytecode_languaget::get_language_options(const cmdlinet &cmd)
68
68
java_cp_include_files=cmd.get_value (" java-cp-include-files" );
69
69
// load file list from JSON file
70
70
if (java_cp_include_files[0 ]==' @' )
71
- {
72
- jsont json_cp_config;
73
- if (parse_json (
74
- java_cp_include_files.substr (1 ),
75
- get_message_handler (),
76
- json_cp_config))
77
- throw " cannot read JSON input configuration for JAR/WAR loading" ;
78
-
79
- if (!json_cp_config.is_object ())
80
- throw " the JSON file has a wrong format" ;
81
- jsont include_jar_files=json_cp_config[" jar" ];
82
- if (!include_jar_files.is_null ())
83
- {
84
- if (!include_jar_files.is_array ())
85
- throw " the JSON file has a wrong format" ;
86
-
87
- // add jars from JSON config file to classpath
88
- for (const jsont &file_entry : include_jar_files.array )
89
- {
90
- assert (file_entry.is_string () &&
91
- has_suffix (file_entry.value , " .jar" ));
92
- config.java .classpath .push_back (file_entry.value );
93
- }
94
- }
95
- jsont include_war_files=json_cp_config[" war" ];
96
- if (!include_war_files.is_null ())
97
- {
98
- if (!include_war_files.is_array ())
99
- throw " the JSON file has a wrong format" ;
100
-
101
- // add wars from JSON config file to classpath
102
- for (const jsont &file_entry : include_war_files.array )
103
- {
104
- assert (file_entry.is_string () &&
105
- has_suffix (file_entry.value , " .war" ));
106
- config.java .classpath .push_back (file_entry.value );
107
- }
108
- }
109
- }
71
+ load_from_archive_files (java_cp_include_files.substr (1 ));
110
72
}
111
73
else
112
74
java_cp_include_files=" .*" ;
@@ -480,3 +442,45 @@ bool java_bytecode_languaget::to_expr(
480
442
java_bytecode_languaget::~java_bytecode_languaget ()
481
443
{
482
444
}
445
+
446
+ void java_bytecode_languaget::load_from_archive_files (
447
+ const std::string &json_config)
448
+ {
449
+ jsont json_cp_config;
450
+ if (parse_json (
451
+ json_config,
452
+ get_message_handler (),
453
+ json_cp_config))
454
+ throw " cannot read JSON input configuration for JAR/WAR loading" ;
455
+
456
+ if (!json_cp_config.is_object ())
457
+ throw " the JSON file has a wrong format" ;
458
+ jsont include_jar_files=json_cp_config[" jar" ];
459
+ if (!include_jar_files.is_null ())
460
+ {
461
+ if (!include_jar_files.is_array ())
462
+ throw " the JSON file has a wrong format" ;
463
+
464
+ // add jars from JSON config file to classpath
465
+ for (const jsont &file_entry : include_jar_files.array )
466
+ {
467
+ assert (file_entry.is_string () &&
468
+ has_suffix (file_entry.value , " .jar" ));
469
+ config.java .classpath .push_back (file_entry.value );
470
+ }
471
+ }
472
+ jsont include_war_files=json_cp_config[" war" ];
473
+ if (!include_war_files.is_null ())
474
+ {
475
+ if (!include_war_files.is_array ())
476
+ throw " the JSON file has a wrong format" ;
477
+
478
+ // add wars from JSON config file to classpath
479
+ for (const jsont &file_entry : include_war_files.array )
480
+ {
481
+ assert (file_entry.is_string () &&
482
+ has_suffix (file_entry.value , " .war" ));
483
+ config.java .classpath .push_back (file_entry.value );
484
+ }
485
+ }
486
+ }
0 commit comments