Author: mhabersack
Date: 2008-02-05 07:13:54 -0500 (Tue, 05 Feb 2008)
New Revision: 94874
Modified:
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/ChangeLog
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/GenericBuildProvider.cs
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/SimpleBuildProvider.cs
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/TemplateBuildProvider.cs
Log:
Backport of r94873
Modified:
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
===================================================================
---
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
2008-02-05 12:13:31 UTC (rev 94873)
+++
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
2008-02-05 12:13:54 UTC (rev 94874)
@@ -239,6 +239,19 @@
assemblies.Add (a);
}
+ internal void AddAssemblyReference (string assemblyLocation)
+ {
+ try {
+ Assembly asm = Assembly.LoadFrom
(assemblyLocation);
+ if (asm == null)
+ return;
+
+ AddAssemblyReference (asm);
+ } catch {
+ // ignore, it will come up later
+ }
+ }
+
internal void AddAssemblyReference (List <Assembly> asmlist)
{
if (asmlist == null)
Modified:
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/ChangeLog
2008-02-05 12:13:31 UTC (rev 94873)
+++ branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/ChangeLog
2008-02-05 12:13:54 UTC (rev 94874)
@@ -1,5 +1,17 @@
2008-02-05 Marek Habersack <[EMAIL PROTECTED]>
+ * GenericBuildProvider.cs: introduced a new abstract method,
+ GetReferencedAssemblies, which is called on descendant builders to
+ get a list of assemblies referenced by the parsed file. Fixes bug
+ #357499.
+
+ * AssemblyBuilder.cs: added a new overload of the
+ AddAssemblyReference method, to be used by build providers to
+ register assemblies collected by the corresponding parser.
+
+ * TemplateBuildProvider.cs, SimpleBuildProvider.cs: implemented
+ overload of the new abstract method GetReferencedAssemblies.
+
* AspGenerator.cs: introduced a new overload for the Parse method
which accepts a bool indicating whether or not to initialize the
parser. The overload is used when parsing server-side
Modified:
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/GenericBuildProvider.cs
===================================================================
---
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/GenericBuildProvider.cs
2008-02-05 12:13:31 UTC (rev 94873)
+++
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/GenericBuildProvider.cs
2008-02-05 12:13:54 UTC (rev 94874)
@@ -32,6 +32,7 @@
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Web;
@@ -55,6 +56,7 @@
protected abstract string GetCodeBehindSource (TParser parser);
protected abstract string GetClassType (BaseCompiler compiler,
TParser parser);
protected abstract AspGenerator CreateAspGenerator (TParser
parser);
+ protected abstract List <string> GetReferencedAssemblies
(TParser parser);
protected virtual TParser Parse ()
{
@@ -106,6 +108,12 @@
if (codeBehindSource != null)
assemblyBuilder.AddCodeFile (codeBehindSource,
this);
+ List <string> refasms = GetReferencedAssemblies
(parser);
+ if (refasms != null && refasms.Count > 0) {
+ foreach (string loc in refasms)
+ assemblyBuilder.AddAssemblyReference
(loc);
+ }
+
GenerateCode (assemblyBuilder, parser, _compiler);
}
Modified:
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/SimpleBuildProvider.cs
===================================================================
---
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/SimpleBuildProvider.cs
2008-02-05 12:13:31 UTC (rev 94873)
+++
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/SimpleBuildProvider.cs
2008-02-05 12:13:54 UTC (rev 94874)
@@ -32,6 +32,7 @@
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Web;
@@ -115,6 +116,34 @@
return new WebServiceCompiler (parser);
}
+ protected override List <string> GetReferencedAssemblies
(SimpleWebHandlerParser parser)
+ {
+ if (parser == null)
+ return null;
+
+ ArrayList al = parser.Assemblies;
+ int count;
+
+ if (al == null || al.Count == 0)
+ return null;
+
+ List <string> ret = new List <string> ();
+ string loc;
+
+ foreach (object o in al) {
+ loc = o as string;
+ if (loc == null)
+ continue;
+
+ if (ret.Contains (loc))
+ continue;
+
+ ret.Add (loc);
+ }
+
+ return ret;
+ }
+
protected override bool NeedsConstructType {
get { return false; }
}
Modified:
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/TemplateBuildProvider.cs
===================================================================
---
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/TemplateBuildProvider.cs
2008-02-05 12:13:31 UTC (rev 94873)
+++
branches/mono-1-9/mcs/class/System.Web/System.Web.Compilation/TemplateBuildProvider.cs
2008-02-05 12:13:54 UTC (rev 94874)
@@ -32,6 +32,7 @@
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Web;
@@ -91,6 +92,34 @@
return null;
}
+
+ protected override List <string> GetReferencedAssemblies
(TemplateParser parser)
+ {
+ if (parser == null)
+ return null;
+
+ ArrayList al = parser.Assemblies;
+ int count;
+
+ if (al == null || al.Count == 0)
+ return null;
+
+ List <string> ret = new List <string> ();
+ string loc;
+
+ foreach (object o in al) {
+ loc = o as string;
+ if (loc == null)
+ continue;
+
+ if (ret.Contains (loc))
+ continue;
+
+ ret.Add (loc);
+ }
+
+ return ret;
+ }
}
}
#endif
\ No newline at end of file
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches