static string machine_config_file = null;
static string config_dir = null;
static string style = "linux";
+ static string os_message = "";
static bool compress;
static bool nomain;
static bool? use_dos2unix = null;
static bool skip_scan;
static string ctor_func;
+ static bool quiet;
static int Main (string [] args)
{
break;
case "--static":
static_link = true;
- Console.WriteLine ("Note that statically linking the LGPL Mono runtime has more licensing restrictions than dynamically linking.");
- Console.WriteLine ("See http://www.mono-project.com/Licensing for details on licensing.");
+ if (!quiet) {
+ Console.WriteLine ("Note that statically linking the LGPL Mono runtime has more licensing restrictions than dynamically linking.");
+ Console.WriteLine ("See http://www.mono-project.com/Licensing for details on licensing.");
+ }
break;
case "--config":
if (i+1 == top) {
machine_config_file = args [++i];
- Console.WriteLine ("WARNING:\n Check that the machine.config file you are bundling\n doesn't contain sensitive information specific to this machine.");
+ if (!quiet)
+ Console.WriteLine ("WARNING:\n Check that the machine.config file you are bundling\n doesn't contain sensitive information specific to this machine.");
break;
case "--config-dir":
if (i+1 == top) {
case "--dos2unix=false":
use_dos2unix = false;
break;
+ case "-q":
+ case "--quiet":
+ quiet = true;
+ break;
default:
sources.Add (args [i]);
break;
}
- Console.WriteLine ("Sources: {0} Auto-dependencies: {1}", sources.Count, autodeps);
+ if (!quiet) {
+ Console.WriteLine (os_message);
+ Console.WriteLine ("Sources: {0} Auto-dependencies: {1}", sources.Count, autodeps);
+ }
if (sources.Count == 0 || output == null) {
Help ();
Environment.Exit (1);
var stream = streams [url];
var real_size = sizes [url];
- Console.WriteLine (" embedding: " + fname);
+ if (!quiet)
+ Console.WriteLine (" embedding: " + fname);
WriteSymbol (ts, "assembly_data_" + encoded, stream.Length);
tc.WriteLine ("static CompressedAssembly assembly_bundle_{0} = {{{{\"{1}\"," +
" assembly_data_{0}, {2}}}, {3}}};",
encoded, aname, real_size, stream.Length);
- double ratio = ((double) stream.Length * 100) / real_size;
- Console.WriteLine (" compression ratio: {0:.00}%", ratio);
+ if (!quiet) {
+ double ratio = ((double) stream.Length * 100) / real_size;
+ Console.WriteLine (" compression ratio: {0:.00}%", ratio);
+ }
} else {
tc.WriteLine ("extern const unsigned char assembly_data_{0} [];", encoded);
tc.WriteLine ("static const MonoBundledAssembly assembly_bundle_{0} = {{\"{1}\", assembly_data_{0}, {2}}};",
try {
FileStream cf = File.OpenRead (fname + ".config");
- Console.WriteLine (" config from: " + fname + ".config");
+ if (!quiet)
+ Console.WriteLine (" config from: " + fname + ".config");
tc.WriteLine ("extern const unsigned char assembly_config_{0} [];", encoded);
WriteSymbol (ts, "assembly_config_" + encoded, cf.Length);
WriteBuffer (ts, cf, buffer);
Error (String.Format ("Failure to open {0}", config_file));
return;
}
- Console.WriteLine ("System config from: " + config_file);
+ if (!quiet)
+ Console.WriteLine ("System config from: " + config_file);
tc.WriteLine ("extern const char system_config;");
WriteSymbol (ts, "system_config", config_file.Length);
Error (String.Format ("Failure to open {0}", machine_config_file));
return;
}
- Console.WriteLine ("Machine config from: " + machine_config_file);
+ if (!quiet)
+ Console.WriteLine ("Machine config from: " + machine_config_file);
tc.WriteLine ("extern const char machine_config;");
WriteSymbol (ts, "machine_config", machine_config_file.Length);
if (compile_only)
return;
- Console.WriteLine("Compiling:");
+
+ if (!quiet)
+ Console.WriteLine("Compiling:");
if (style == "windows")
{
Execute (cmd);
}
- Console.WriteLine ("Done");
+ if (!quiet)
+ Console.WriteLine ("Done");
}
}
} finally {
assemblies.Add (a.CodeBase);
} catch (Exception) {
if (skip_scan) {
- Console.WriteLine ("File will not be scanned: {0}", name);
+ if (!quiet)
+ Console.WriteLine ("File will not be scanned: {0}", name);
assemblies.Add (new Uri (new FileInfo (name).FullName).ToString ());
} else {
throw;
}
}
Error ("Cannot find assembly `" + assembly + "'" );
- Console.WriteLine ("Log: \n" + total_log);
+ if (!quiet)
+ Console.WriteLine ("Log: \n" + total_log);
} catch (IKVM.Reflection.BadImageFormatException f) {
if (skip_scan)
throw;
static void DetectOS ()
{
if (!IsUnix) {
- Console.WriteLine ("OS is: Windows");
+ os_message = "OS is: Windows";
style = "windows";
return;
}
IntPtr buf = Marshal.AllocHGlobal (8192);
if (uname (buf) != 0){
- Console.WriteLine ("Warning: Unable to detect OS");
+ os_message = "Warning: Unable to detect OS";
Marshal.FreeHGlobal (buf);
return;
}
string os = Marshal.PtrToStringAnsi (buf);
- Console.WriteLine ("OS is: " + os);
+ os_message = "OS is: " + os;
if (os == "Darwin")
style = "osx";
static void Execute (string cmdLine)
{
if (IsUnix) {
- Console.WriteLine ("[execute cmd]: " + cmdLine);
+ if (!quiet)
+ Console.WriteLine ("[execute cmd]: " + cmdLine);
int ret = system (cmdLine);
if (ret != 0)
{
psi.Arguments = String.Format("-c \"{0}\"", cmdLine);
}
- Console.WriteLine(cmdLine);
+ if (!quiet)
+ Console.WriteLine(cmdLine);
using (Process p = Process.Start (psi)) {
p.WaitForExit ();
int ret = p.ExitCode;
string val = Environment.GetEnvironmentVariable(name);
if (val != null)
{
- Console.WriteLine("{0} = {1}", name, val);
+ if (!quiet)
+ Console.WriteLine("{0} = {1}", name, val);
}
else
{
val = defaultValue;
- Console.WriteLine("{0} = {1} (default)", name, val);
+ if (!quiet)
+ Console.WriteLine("{0} = {1} (default)", name, val);
}
return val;
}