nitunit: keeps track of the source directory of the tested module.
[nit.git] / src / nitg.nit
index f575b91..345fb43 100644 (file)
@@ -25,6 +25,7 @@ import global_compiler
 import separate_erasure_compiler
 import separate_compiler
 import android_platform
+import compiler_ffi
 
 # Create a tool context to handle options and paths
 var toolcontext = new ToolContext
@@ -36,8 +37,10 @@ toolcontext.option_context.add_option(opt_global)
 var opt_mixins = new OptionArray("Additionals module to min-in", "-m")
 toolcontext.option_context.add_option(opt_mixins)
 
+toolcontext.tooldescription = "Usage: nitg [OPTION]... file.nit\nCompiles Nit programs."
+
 # We do not add other options, so process them now!
-toolcontext.process_options
+toolcontext.process_options(args)
 
 # We need a model to collect stufs
 var model = new Model
@@ -45,14 +48,10 @@ var model = new Model
 var modelbuilder = new ModelBuilder(model, toolcontext)
 
 var arguments = toolcontext.option_context.rest
-if arguments.is_empty then
-       toolcontext.option_context.usage
-       return
-end
 if arguments.length > 1 then
        print "Too much arguments: {arguments.join(" ")}"
-       toolcontext.option_context.usage
-       return
+       print toolcontext.tooldescription
+       exit 1
 end
 var progname = arguments.first
 
@@ -71,6 +70,10 @@ else
        mainmodule.set_imported_mmodules(mmodules)
 end
 
+var platform = mainmodule.target_platform
+if platform != null and not platform.supports_libunwind then
+       if toolcontext.opt_stacktrace.value == null then toolcontext.opt_stacktrace.value = "none" # default is none
+end
 
 if toolcontext.opt_erasure.value then
        modelbuilder.run_separate_erasure_compiler(mainmodule, null)