From b60591961b9e6f014ed66b102be9a3c15f5a29f1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Tue, 4 Aug 2015 14:40:41 -0400 Subject: [PATCH] contrib/jwrapper: saving the model must be asked by an option MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/jwrapper/src/code_generator.nit | 5 +++++ contrib/jwrapper/src/jwrapper.nit | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/jwrapper/src/code_generator.nit b/contrib/jwrapper/src/code_generator.nit index 02a3cb5..e716a2e 100644 --- a/contrib/jwrapper/src/code_generator.nit +++ b/contrib/jwrapper/src/code_generator.nit @@ -146,6 +146,8 @@ class CodeGenerator # Serialize `model` to a file next to `file_name` fun write_model_to_file do + if not sys.opt_save_model.value then return + # Write the model to file next to the Nit module var model_path = file_name.strip_extension + ".jwrapper.bin" var model_stream = model_path.to_path.open_wo @@ -435,6 +437,9 @@ redef class Sys # Option to _not_ generate properties (static or from classes) var opt_no_properties = new OptionBool("Do not wrap properties, only classes and basic services", "-n", "--no-properties") + + # Should the model be serialized to a file? + var opt_save_model = new OptionBool("Save the model next to the generated Nit module", "-s", "--save-model") end redef class String diff --git a/contrib/jwrapper/src/jwrapper.nit b/contrib/jwrapper/src/jwrapper.nit index 847f121..bf25f1e 100644 --- a/contrib/jwrapper/src/jwrapper.nit +++ b/contrib/jwrapper/src/jwrapper.nit @@ -44,7 +44,7 @@ var opt_output = new OptionString("Output file", "-o") var opt_regex = new OptionString("Regex pattern to filter classes in Jar archives", "-r") var opt_help = new OptionBool("Show this help message", "-h", "--help") -opts.add_option(opt_output, opt_unknown, opt_extern_class_prefix, opt_libs, opt_regex, opt_cast_objects, opt_arrays, opt_load_models, opt_no_properties, opt_verbose, opt_help) +opts.add_option(opt_output, opt_unknown, opt_extern_class_prefix, opt_libs, opt_regex, opt_cast_objects, opt_arrays, opt_save_model, opt_load_models, opt_no_properties, opt_verbose, opt_help) opts.parse args if opts.errors.not_empty or opts.rest.is_empty or opt_help.value then -- 1.7.9.5