2008-10-09 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Thu, 9 Oct 2008 14:45:06 +0000 (14:45 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Thu, 9 Oct 2008 14:45:06 +0000 (14:45 -0000)
* MonoSettingsSection.cs: added - a section for mono-specific
settings.

2008-10-09  Marek Habersack  <mhabersack@novell.com>

* BuildManager.cs: if monoSettings section is found in the
system.web section in web.config, use its contents to augment
compiler configuration. Used to work around the issue reported in
bug #433806

2008-10-09  Marek Habersack  <mhabersack@novell.com>

* System.Web.dll.sources: added System.Web.Configuration_2.0/MonoSettingsSection.cs

svn path=/trunk/mcs/; revision=115337

mcs/class/System.Web/ChangeLog
mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
mcs/class/System.Web/System.Web.Compilation/ChangeLog
mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
mcs/class/System.Web/System.Web.Configuration_2.0/MonoSettingsSection.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.dll.sources

index 5cf716f55e2a38deaea43b57c6f8ea589ccd397f..28599a58dc9ff8beca0e285e52d05cf494db8a56 100644 (file)
@@ -1,3 +1,7 @@
+2008-10-09  Marek Habersack  <mhabersack@novell.com>
+
+       * System.Web.dll.sources: added System.Web.Configuration_2.0/MonoSettingsSection.cs
+
 2008-09-13  Atsushi Enomoto  <atsushi@ximian.com>
 
        * System.Web.dll.sources: added System.Web.UI/IAutoFieldGenerator.cs
index 84fdd3a027a8dbd89ba55ad1ebcea00407f83312..895877f44d359b4de60a29839a6cc68d94afce5e 100644 (file)
@@ -600,9 +600,22 @@ namespace System.Web.Compilation {
                        return ret;
                }
 
-               static void SetCommonParameters (CompilationSection config, CompilerParameters p)
+               static void SetCommonParameters (CompilationSection config, CompilerParameters p, Type compilerType, string language)
                {
                        p.IncludeDebugInformation = config.Debug;
+                       MonoSettingsSection mss = WebConfigurationManager.GetSection ("system.web/monoSettings") as MonoSettingsSection;
+                       if (mss == null || !mss.UseCompilersCompatibility)
+                               return;
+
+                       Compiler compiler = mss.CompilersCompatibility.Get (language);
+                       if (compiler == null)
+                               return;
+
+                       Type type = HttpApplication.LoadType (compiler.Type, false);
+                       if (type != compilerType)
+                               return;
+
+                       p.CompilerOptions = String.Concat (p.CompilerOptions, " ", compiler.CompilerOptions);
                }
                
                internal static CompilerType GetDefaultCompilerTypeForLanguage (string language, CompilationSection configSection)
@@ -619,20 +632,23 @@ namespace System.Web.Compilation {
                        
                        Compiler compiler = config.Compilers.Get (language);
                        CompilerParameters p;
+                       Type type;
+                       
                        if (compiler != null) {
-                               Type type = HttpApplication.LoadType (compiler.Type, true);
+                               type = HttpApplication.LoadType (compiler.Type, true);
                                p = new CompilerParameters ();
                                p.CompilerOptions = compiler.CompilerOptions;
                                p.WarningLevel = compiler.WarningLevel;
-                               SetCommonParameters (config, p);
+                               SetCommonParameters (config, p, type, language);
                                return new CompilerType (type, p);
                        }
 
                        if (CodeDomProvider.IsDefinedLanguage (language)) {
                                CompilerInfo info = CodeDomProvider.GetCompilerInfo (language);
-                               CompilerParameters par = info.CreateDefaultCompilerParameters ();
-                               SetCommonParameters (config, par);
-                               return new CompilerType (info.CodeDomProviderType, par);
+                               p = info.CreateDefaultCompilerParameters ();
+                               type = info.CodeDomProviderType;
+                               SetCommonParameters (config, p, type, language);
+                               return new CompilerType (type, p);
                        }
 
                        throw new HttpException (String.Concat ("No compiler for language '", language, "'."));
index 468a299c846c0226099c28b3dd1f04efdaad8ade..fc61db3ba7d6b3fe218b6c4ef2ccd8f408f9fdb5 100644 (file)
@@ -1,3 +1,10 @@
+2008-10-09  Marek Habersack  <mhabersack@novell.com>
+
+       * BuildManager.cs: if monoSettings section is found in the
+       system.web section in web.config, use its contents to augment
+       compiler configuration. Used to work around the issue reported in
+       bug #433806
+
 2008-10-08  Marek Habersack  <mhabersack@novell.com>
 
        * TemplateControlCompiler.cs: templates must be instantiated even
index 0b2e9ba3276cc625c8efbb15fac93e898ff2b8f2..29c0b3c2d035f7294b97251b2d42ab7fe09bb9d0 100644 (file)
@@ -1,3 +1,8 @@
+2008-10-09  Marek Habersack  <mhabersack@novell.com>
+
+       * MonoSettingsSection.cs: added - a section for mono-specific
+       settings.
+
 2008-10-01  Marek Habersack  <mhabersack@novell.com>
 
        * CapabilitiesResult.cs: added support for the "browsers"
diff --git a/mcs/class/System.Web/System.Web.Configuration_2.0/MonoSettingsSection.cs b/mcs/class/System.Web/System.Web.Configuration_2.0/MonoSettingsSection.cs
new file mode 100644 (file)
index 0000000..7de027b
--- /dev/null
@@ -0,0 +1,71 @@
+//
+// System.Web.Configuration.CompilationSection
+//
+// Authors:
+//      Marek Habersack (mhabersack@novell.com)
+//
+// (c) Copyright 2008 Novell, Inc (http://www.novell.com)
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System;
+using System.Configuration;
+using System.ComponentModel;
+
+namespace System.Web.Configuration
+{
+       internal sealed class MonoSettingsSection : ConfigurationSection
+       {
+               static ConfigurationPropertyCollection properties;
+               static ConfigurationProperty compilersCompatibilityProp;
+               static ConfigurationProperty useCompilersCompatibilityProp;
+               
+               static MonoSettingsSection ()
+               {
+                       compilersCompatibilityProp = new ConfigurationProperty ("compilersCompatibility", typeof (CompilerCollection), null, null, PropertyHelper.DefaultValidator,
+                                                                               ConfigurationPropertyOptions.None);
+                       useCompilersCompatibilityProp = new ConfigurationProperty ("useCompilersCompatibility", typeof (bool), true);
+                       
+                       properties = new ConfigurationPropertyCollection ();
+                       properties.Add (compilersCompatibilityProp);
+                       properties.Add (useCompilersCompatibilityProp);
+               }
+
+               [ConfigurationProperty ("compilersCompatibility")]
+                public CompilerCollection CompilersCompatibility {
+                        get { return (CompilerCollection) base [compilersCompatibilityProp]; }
+                }
+
+               [ConfigurationProperty ("useCompilersCompatibility", DefaultValue = "True")]
+                public bool UseCompilersCompatibility {
+                        get { return (bool) base [useCompilersCompatibilityProp]; }
+                        set { base [useCompilersCompatibilityProp] = value; }
+                }
+               
+               protected override ConfigurationPropertyCollection Properties {
+                        get { return properties; }
+                }
+       }
+}
+#endif
index 1aa8e93f73f8d5d4986ba76ee57a8d8f467a471a..2c298c8f885ce9b696a8819769d282f28c81b354 100644 (file)
@@ -195,6 +195,7 @@ System.Web.Configuration_2.0/MachineKeySection.cs
 System.Web.Configuration_2.0/MachineKeySectionUtils.cs
 System.Web.Configuration_2.0/MachineKeyValidationConverter.cs
 System.Web.Configuration_2.0/MembershipSection.cs
+System.Web.Configuration_2.0/MonoSettingsSection.cs
 System.Web.Configuration_2.0/NamespaceCollection.cs
 System.Web.Configuration_2.0/NamespaceInfo.cs
 System.Web.Configuration_2.0/NullableStringValidator.cs