Author: peterw
Date: 2005-08-29 17:15:31 -0400 (Mon, 29 Aug 2005)
New Revision: 49095

Modified:
   trunk/mbuild/Mono.Build/ChangeLog
   trunk/mbuild/Mono.Build/Mono.Build/CompositeResult.cs
   trunk/mbuild/doc/error-codes.txt
   trunk/mbuild/mbuild/ChangeLog
   trunk/mbuild/mbuild/mbuild.cs
Log:
        2005-08-29  Peter Williams  <[EMAIL PROTECTED]>

        * mbuild.cs (DoInitMode): if ~/.mbuild-init.config exists, import it as
        an XML file.
        (ImportXml): Don't necessarily exit after doing an import.
        (DoXmlExportMode): If no filename given, export to stdout

2005-08-29  Peter Williams  <[EMAIL PROTECTED]>

        * Mono.Build/CompositeResult.cs: Use 'as' instead of a cast to not bomb
        on null compositeresult members.



Modified: trunk/mbuild/Mono.Build/ChangeLog
===================================================================
--- trunk/mbuild/Mono.Build/ChangeLog   2005-08-29 20:40:55 UTC (rev 49094)
+++ trunk/mbuild/Mono.Build/ChangeLog   2005-08-29 21:15:31 UTC (rev 49095)
@@ -1,3 +1,8 @@
+2005-08-29  Peter Williams  <[EMAIL PROTECTED]>
+
+       * Mono.Build/CompositeResult.cs: Use 'as' instead of a cast to not bomb
+       on null compositeresult members.
+
 2005-08-26  Peter Williams  <[EMAIL PROTECTED]>
 
        * Mono.Build.Bundling/NameLookupContext.cs: Add suggestion to error

Modified: trunk/mbuild/Mono.Build/Mono.Build/CompositeResult.cs
===================================================================
--- trunk/mbuild/Mono.Build/Mono.Build/CompositeResult.cs       2005-08-29 
20:40:55 UTC (rev 49094)
+++ trunk/mbuild/Mono.Build/Mono.Build/CompositeResult.cs       2005-08-29 
21:15:31 UTC (rev 49095)
@@ -194,7 +194,7 @@
                                xw.WriteStartElement ("field");
                                xw.WriteAttributeString ("name", fi.Name);
                                xw.WriteAttributeString ("decl_type", 
fi.DeclaringType.FullName);
-                               Result r = (Result) fi.GetValue (this);
+                               Result r = fi.GetValue (this) as Result;
 
                                if (r == null)
                                        xw.WriteAttributeString ("is_null", 
"true");

Modified: trunk/mbuild/doc/error-codes.txt
===================================================================
--- trunk/mbuild/doc/error-codes.txt    2005-08-29 20:40:55 UTC (rev 49094)
+++ trunk/mbuild/doc/error-codes.txt    2005-08-29 21:15:31 UTC (rev 49095)
@@ -87,5 +87,6 @@
 E3017 - required DLL not found
 E3018 - exception in substitution processing
 W3019 - XML import structure error
+W3020 - Cannot open init config XML file
 
 E4000 - No ProviderPrefixAttribute on provider

Modified: trunk/mbuild/mbuild/ChangeLog
===================================================================
--- trunk/mbuild/mbuild/ChangeLog       2005-08-29 20:40:55 UTC (rev 49094)
+++ trunk/mbuild/mbuild/ChangeLog       2005-08-29 21:15:31 UTC (rev 49095)
@@ -1,3 +1,10 @@
+2005-08-29  Peter Williams  <[EMAIL PROTECTED]>
+
+       * mbuild.cs (DoInitMode): if ~/.mbuild-init.config exists, import it as
+       an XML file.
+       (ImportXml): Don't necessarily exit after doing an import.
+       (DoXmlExportMode): If no filename given, export to stdout
+
 2005-07-14  Peter Williams  <[EMAIL PROTECTED]>
 
        * mbuild.cs (ImportXml): Don't need to pass the IResultTypeLookup 
anymore.

Modified: trunk/mbuild/mbuild/mbuild.cs
===================================================================
--- trunk/mbuild/mbuild/mbuild.cs       2005-08-29 20:40:55 UTC (rev 49094)
+++ trunk/mbuild/mbuild/mbuild.cs       2005-08-29 21:15:31 UTC (rev 49095)
@@ -64,6 +64,7 @@
 
        XmlTextWriter export_writer = null;
        XmlTextReader import_reader = null;
+       bool exit_after_import = true;
 
        bool query_mode;
        QueryVariables query_var;
@@ -159,6 +160,18 @@
                init_srcdir = dir;
                select_tag = "prereq";
 
+               string p = Environment.GetFolderPath 
(Environment.SpecialFolder.Personal);
+               p = Path.Combine (p, ".mbuild-init.config");
+
+               if (File.Exists (p)) {
+                       try {
+                               import_reader = new XmlTextReader (p);
+                               exit_after_import = false;
+                       } catch (Exception e) {
+                               log.Warning (3020, "Could not open " + p, 
e.ToString ());
+                       }
+               }
+
                return WhatToDoNext.GoAhead;
        }
 
@@ -201,7 +214,11 @@
                func = new OperationFunc (ExportAsXml);
                select_tag = null;
 
-               export_writer = new XmlTextWriter (file, 
System.Text.Encoding.Default);
+               if (file == null || file.Length == 0)
+                       export_writer = new XmlTextWriter (Console.Out);
+               else
+                       export_writer = new XmlTextWriter (file, 
System.Text.Encoding.Default);
+
                export_writer.Formatting = Formatting.Indented;
 
                return WhatToDoNext.GoAhead;
@@ -607,7 +624,6 @@
 
                Console.WriteLine ("Imported {0} result values", num_imported);
 
-               pm.Dispose ();
                return 0;
        }
 
@@ -678,9 +694,15 @@
                if (query_mode)
                        return RunQuery (here, pm);
 
-               if (import_reader != null)
-                       return ImportXml (here, pm);
+               if (import_reader != null) {
+                       int res = ImportXml (here, pm);
 
+                       if (exit_after_import) {
+                               pm.Dispose ();
+                               return res;
+                       }
+               }
+
                WrenchOperations.BeforeBuild += new OperationFunc 
(BeforeBuildEvent);
                WrenchOperations.BeforeSkip += new OperationFunc 
(BeforeSkipEvent);
                WrenchOperations.BeforeClean += new OperationFunc 
(BeforeCleanEvent);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to