Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorRolf Bjarne Kvinge <rolf@xamarin.com>2015-11-13 12:48:58 +0300
committerRolf Bjarne Kvinge <rolf@xamarin.com>2015-12-23 14:03:03 +0300
commit4365a2a8a2f37d60d7cf8f31196c70f72de86aa4 (patch)
tree72df92665213d6caa44053ba504b32005061e01a /mcs
parentf7f66cb6d07039f485b7816dfac4336c53d77d89 (diff)
[mkbundle] Add support for --quiet.
Diffstat (limited to 'mcs')
-rwxr-xr-xmcs/tools/mkbundle/mkbundle.cs69
1 files changed, 48 insertions, 21 deletions
diff --git a/mcs/tools/mkbundle/mkbundle.cs b/mcs/tools/mkbundle/mkbundle.cs
index dbf21c44beb..fa39892bb03 100755
--- a/mcs/tools/mkbundle/mkbundle.cs
+++ b/mcs/tools/mkbundle/mkbundle.cs
@@ -33,11 +33,13 @@ class MakeBundle {
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)
{
@@ -94,8 +96,10 @@ class MakeBundle {
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) {
@@ -113,7 +117,8 @@ class MakeBundle {
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) {
@@ -163,6 +168,10 @@ class MakeBundle {
case "--dos2unix=false":
use_dos2unix = false;
break;
+ case "-q":
+ case "--quiet":
+ quiet = true;
+ break;
default:
sources.Add (args [i]);
break;
@@ -170,7 +179,10 @@ class MakeBundle {
}
- 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);
@@ -344,7 +356,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
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);
@@ -355,8 +368,10 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
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}}};",
@@ -368,7 +383,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
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);
@@ -387,7 +403,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
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);
@@ -405,7 +422,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
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);
@@ -473,7 +491,9 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
if (compile_only)
return;
- Console.WriteLine("Compiling:");
+
+ if (!quiet)
+ Console.WriteLine("Compiling:");
if (style == "windows")
{
@@ -544,7 +564,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
Execute (cmd);
}
- Console.WriteLine ("Done");
+ if (!quiet)
+ Console.WriteLine ("Done");
}
}
} finally {
@@ -577,7 +598,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
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;
@@ -662,7 +684,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
}
}
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;
@@ -715,19 +738,19 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
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";
@@ -744,7 +767,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
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)
{
@@ -812,7 +836,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
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;
@@ -827,12 +852,14 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
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;
}