Author: peterw
Date: 2006-07-19 00:11:53 -0400 (Wed, 19 Jul 2006)
New Revision: 62726

Modified:
   trunk/mbuild/Monkeywrench/ChangeLog
   trunk/mbuild/Monkeywrench/Monkeywrench.Compiler/GraphBuilder.cs
   trunk/mbuild/Monkeywrench/Monkeywrench/ProjectManager.cs
Log:
2006-07-19  Peter Williams  <[EMAIL PROTECTED]>

        * Monkeywrench.Compiler/GraphBuilder.cs (AddDependentBundles): 
        Loop through the bundles in the BundleManager and add 
        DependentItemInfos for them.
        (SetProjectInfo): Call the above here.
        (dep_bundles): Change to just be a List`1.

        * Monkeywrench/ProjectManager.cs (GraphNeedsRebuild): Check the
        bundle assemblies for changes.
        (LoadSavedGraph): Call the above after loading bundles, so that
        we have the bundle assemblies to poke.



Modified: trunk/mbuild/Monkeywrench/ChangeLog
===================================================================
--- trunk/mbuild/Monkeywrench/ChangeLog 2006-07-19 03:51:30 UTC (rev 62725)
+++ trunk/mbuild/Monkeywrench/ChangeLog 2006-07-19 04:11:53 UTC (rev 62726)
@@ -1,3 +1,16 @@
+2006-07-19  Peter Williams  <[EMAIL PROTECTED]>
+
+       * Monkeywrench.Compiler/GraphBuilder.cs (AddDependentBundles): 
+       Loop through the bundles in the BundleManager and add 
+       DependentItemInfos for them.
+       (SetProjectInfo): Call the above here.
+       (dep_bundles): Change to just be a List`1.
+
+       * Monkeywrench/ProjectManager.cs (GraphNeedsRebuild): Check the
+       bundle assemblies for changes.
+       (LoadSavedGraph): Call the above after loading bundles, so that
+       we have the bundle assemblies to poke.
+
 2006-07-18  Peter Williams  <[EMAIL PROTECTED]>
 
        Fix requests of targets in providers to the side.

Modified: trunk/mbuild/Monkeywrench/Monkeywrench/ProjectManager.cs
===================================================================
--- trunk/mbuild/Monkeywrench/Monkeywrench/ProjectManager.cs    2006-07-19 
03:51:30 UTC (rev 62725)
+++ trunk/mbuild/Monkeywrench/Monkeywrench/ProjectManager.cs    2006-07-19 
04:11:53 UTC (rev 62726)
@@ -6,6 +6,8 @@
 using System;
 using System.IO;
 using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
 
 using Mono.Build;
 using Mono.Build.Bundling;
@@ -100,10 +102,12 @@
        {
            BinaryLoadedGraph blg = BinaryLoadedGraph.Load (gfile, log);
 
-           if (check_rebuild && GraphNeedsRebuild (blg))
+           if (blg.GetProjectInfo ().LoadBundles (bm, log))
                return null;
 
-           if (blg.GetProjectInfo ().LoadBundles (bm, log))
+           // Do this after loading bundles to check dependent assemblies.
+
+           if (check_rebuild && GraphNeedsRebuild (blg))
                return null;
 
            return blg;
@@ -122,8 +126,43 @@
                }
            }
 
-           // FIXME: check bundles
+           // This is a bit gross, but it's called once.
+           // We've just loaded the bundles straight from the graph's
+           // ProjectInfo, but the pinfo may not be in sync with the
+           // DII list.
 
+           Dictionary<string,Assembly> namemap = new 
Dictionary<string,Assembly> ();
+           int num_pinfo = 0, num_dii = 0;
+
+           foreach (Assembly assy in bm.BundleAssemblies) {
+               namemap[assy.GetName ().Name] = assy;
+               num_pinfo++;
+           }
+
+           foreach (DependentItemInfo dii in gs.GetDependentBundles ()) {
+               if (!namemap.ContainsKey (dii.Name)) {
+                   Console.WriteLine (" ... recompiling because extra dep 
assembly {0}", 
+                                      dii.Name);
+                   return true;
+               }
+
+               Fingerprint fp = Fingerprint.FromFile 
(namemap[dii.Name].Location);
+
+               if (fp != dii.Fingerprint) {
+                   Console.WriteLine (" ... recompiling because of assembly 
{0} (FIXME SCWL)", 
+                                      dii.Name);
+                   return true;
+               }
+
+               num_dii++;
+           }
+
+           if (num_pinfo != num_dii) {
+               Console.WriteLine (" ... recompiling because more assemblies in 
" +
+                                  "pinfo than in dep list");
+               return true;
+           }
+
            return false;
        }
 

Modified: trunk/mbuild/Monkeywrench/Monkeywrench.Compiler/GraphBuilder.cs
===================================================================
--- trunk/mbuild/Monkeywrench/Monkeywrench.Compiler/GraphBuilder.cs     
2006-07-19 03:51:30 UTC (rev 62725)
+++ trunk/mbuild/Monkeywrench/Monkeywrench.Compiler/GraphBuilder.cs     
2006-07-19 04:11:53 UTC (rev 62726)
@@ -2,6 +2,7 @@
 using System.IO;
 using System.Collections;
 using System.Collections.Generic;
+using System.Reflection;
 
 using Mono.Build;
 using Mono.Build.Bundling;
@@ -71,24 +72,22 @@
            return dep_files.Values;
        }
 
-       Dictionary<string,DependentItemInfo> dep_bundles = 
-           new Dictionary<string,DependentItemInfo> ();
+       List<DependentItemInfo> dep_bundles = new List<DependentItemInfo> ();
 
-       public void AddDependentBundle (string bname, Fingerprint fp)
+       void AddDependentBundles ()
        {
-           if (dep_bundles.ContainsKey (bname))
-               return;
+           foreach (Assembly assy in bm.BundleAssemblies) {
+               DependentItemInfo dii = new DependentItemInfo ();
+               dii.Name = assy.GetName ().Name;
+               dii.Fingerprint = Fingerprint.FromFile (assy.Location);;
 
-           DependentItemInfo dii = new DependentItemInfo ();
-           dii.Name = bname;
-           dii.Fingerprint = fp;
-
-           dep_bundles[bname] = dii;
+               dep_bundles.Add (dii);
+           }
        }
 
        public IEnumerable<DependentItemInfo> GetDependentBundles ()
        {
-           return dep_bundles.Values;
+           return dep_bundles;
        }
 
        // Project Info
@@ -110,6 +109,8 @@
            if (pinfo.LoadBundles (bm, log))
                return true;
 
+           AddDependentBundles ();
+
            return false;
        }
 

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

Reply via email to