Author: ankit
Date: 2007-02-08 19:27:28 -0500 (Thu, 08 Feb 2007)
New Revision: 72528

Modified:
   trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog
   trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileData.cs
   trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs
Log:
* MakefileOptionPanelWidget.cs: Add a null check.
* MakefileData.cs: Refactor encodeValues into a property. Initiliaze it
  outside UpdateProject.

Modified: trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog    2007-02-09 
00:00:39 UTC (rev 72527)
+++ trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog    2007-02-09 
00:27:28 UTC (rev 72528)
@@ -1,5 +1,11 @@
 2007-02-09  Ankit Jain <[EMAIL PROTECTED]> 
 
+       * MakefileOptionPanelWidget.cs: Add a null check.
+       * MakefileData.cs: Refactor encodeValues into a property. Initiliaze it
+         outside UpdateProject.
+
+2007-02-09  Ankit Jain <[EMAIL PROTECTED]> 
+
        * MakefileData.cs: Keep the list of references sorted in the makefile.
        * CustomMakefile.cs: Write to the makefile only if something changed.
 

Modified: trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileData.cs
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileData.cs      
2007-02-09 00:00:39 UTC (rev 72527)
+++ trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileData.cs      
2007-02-09 00:27:28 UTC (rev 72528)
@@ -419,7 +419,26 @@
 
                // VarName -> Encode filenames Eg. $(srcdir)
                Dictionary<string, bool> encodeValues;
+               Dictionary<string, bool> EncodeValues {
+                       get {
+                               if (encodeValues == null) {
+                                       encodeValues = new Dictionary<string, 
bool> ();
 
+                                       // Default is false!
+                                       encodeValues [BuildFilesVar.Name] = 
false;
+                                       encodeValues [DeployFilesVar.Name] = 
false;
+                                       encodeValues [OthersVar.Name] = false;
+                                       encodeValues [ResourcesVar.Name] = 
false;
+
+                                       encodeValues [GacRefVar.Name] = false;
+                                       encodeValues [AsmRefVar.Name] = false;
+                                       encodeValues [ProjectRefVar.Name] = 
false;
+                               }
+
+                               return encodeValues;
+                       }
+               }
+
                //use events.. 
                public void UpdateProject (IProgressMonitor monitor, bool 
promptForRemoval)
                {
@@ -456,6 +475,8 @@
                        }
 
                        dirty = true;
+                       encodeValues = null;
+
                        try {
                                if (IsAutotoolsProject)
                                        configuredPackages = new 
ConfiguredPackagesManager (Path.Combine (AbsoluteConfigureInPath, 
"configure.in"));
@@ -469,17 +490,6 @@
                                        AbsoluteConfigureInPath, 
OwnerProject.Name, e.Message));
                        }
 
-                       if (encodeValues == null) {
-                               encodeValues = new Dictionary<string, bool> ();
-                       } else {
-                               encodeValues.Clear ();
-                       }
-
-                       encodeValues [BuildFilesVar.Name] = false;
-                       encodeValues [DeployFilesVar.Name] = false;
-                       encodeValues [OthersVar.Name] = false;
-                       encodeValues [ResourcesVar.Name] = false;
-
                        ReadFiles (BuildFilesVar, BuildAction.Compile, "Build", 
promptForRemoval);
                        ReadFiles (DeployFilesVar, BuildAction.FileCopy, 
"Deploy", promptForRemoval);
                        ReadFiles (OthersVar, BuildAction.Nothing, "Others", 
promptForRemoval);
@@ -502,10 +512,6 @@
                                        AsmRefVar.Extra.Clear ();
                                        ProjectRefVar.Extra.Clear ();
 
-                                       encodeValues [GacRefVar.Name] = false;
-                                       encodeValues [AsmRefVar.Name] = false;
-                                       encodeValues [ProjectRefVar.Name] = 
false;
-
                                        existingGacRefs = new 
Dictionary<string, ProjectReference> ();
                                        newGacRefs = new Dictionary<string, 
ProjectReference> ();
 
@@ -656,7 +662,7 @@
 
                                        varFound = false;
                                        fname = ResolveBuildVars (fname, ref 
varFound);
-                                       encodeValues [fileVar.Name] |= varFound;
+                                       EncodeValues [fileVar.Name] |= varFound;
 
                                        //File path in the makefile are 
relative to the makefile,
                                        //but have to be added to the project 
as relative to project.BaseDirectory
@@ -822,7 +828,7 @@
 
                                varFound = false;
                                refname = ResolveBuildVars (refname, ref 
varFound);
-                               encodeValues [refVar.Name] |= varFound;
+                               EncodeValues [refVar.Name] |= varFound;
 
                                //if refname is part of a package then add as 
gac
                                if (refname.IndexOf 
(Path.DirectorySeparatorChar) < 0 &&
@@ -1072,6 +1078,8 @@
                        
                                // Sort list of references in the makefile,
                                // but sort only once per distinct var
+                               // (Required as we are comparing the full 
makefile as a string,
+                               //  to detect changes!)
                                List<string> list = Makefile.GetListVariable 
(GacRefVar.Name);
                                if (list != null)
                                        list.Sort ();
@@ -1120,7 +1128,7 @@
                                        else
                                                str = pf.RelativePath;
 
-                                       if (encodeValues [fileVar.Name]) {
+                                       if (EncodeValues [fileVar.Name]) {
                                                if (pf.IsExternalToProject)
                                                        str = EncodeFileName 
(str, "top_srcdir", false);
                                                else
@@ -1284,7 +1292,7 @@
 
                string AsmRefToString (string reference, MakefileVar refVar)
                {
-                       if (!reference.StartsWith (BaseDirectory) && 
encodeValues [refVar.Name])
+                       if (!reference.StartsWith (BaseDirectory) && 
EncodeValues [refVar.Name])
                                //Reference is external to this project
                                return EncodeFileName (reference, 
"top_builddir", true);
 

Modified: 
trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs 
2007-02-09 00:00:39 UTC (rev 72527)
+++ trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs 
2007-02-09 00:27:28 UTC (rev 72528)
@@ -222,7 +222,8 @@
 
                                tmpData.UpdateProject (monitor, oldData == null 
|| (!oldData.IntegrationEnabled && tmpData.IntegrationEnabled));
                        } else {
-                               oldData. IntegrationEnabled = false;
+                               if (oldData != null)
+                                       oldData.IntegrationEnabled = false;
                        }
 
                        return true;

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

Reply via email to