diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2012-04-14 20:49:04 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2012-04-14 20:49:04 +0400 |
commit | 8e8c545059ceb7e09d9ebcd06d75593e7c5de800 (patch) | |
tree | d4c90b8f382835b7581640c42e295065fc23ef40 /webcompare | |
parent | c5b7adcaf72baabdb7fe18ccb3a72a84512ec7fc (diff) |
Bring back to life
Diffstat (limited to 'webcompare')
-rw-r--r-- | webcompare/db/AssemblyResolver.cs | 91 | ||||
-rw-r--r-- | webcompare/db/Makefile | 2 | ||||
-rw-r--r-- | webcompare/db/MySqlDataAccess.cs | 2 | ||||
-rw-r--r-- | webcompare/db/webcompare-db.cs | 13 | ||||
-rw-r--r-- | webcompare/index.aspx | 87 |
5 files changed, 133 insertions, 62 deletions
diff --git a/webcompare/db/AssemblyResolver.cs b/webcompare/db/AssemblyResolver.cs new file mode 100644 index 00000000..aebeb866 --- /dev/null +++ b/webcompare/db/AssemblyResolver.cs @@ -0,0 +1,91 @@ +// +// AssemblyResolver.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// Sebastien Pouliot <sebastien@ximian.com> +// +// Copyright (C) 2007-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. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +using Mono.Cecil; + +namespace GuiCompare { + + public class AssemblyResolver : BaseAssemblyResolver { + + Dictionary<string, AssemblyDefinition> assemblies; + + private AssemblyResolver () + { + assemblies = new Dictionary<string, AssemblyDefinition> (); + } + + public IDictionary<string,AssemblyDefinition> AssemblyCache { + get { return assemblies; } + } + + public override AssemblyDefinition Resolve (AssemblyNameReference name) + { + if (name == null) + throw new ArgumentNullException ("name"); + + string aname = name.Name; + AssemblyDefinition asm = null; + if (!assemblies.TryGetValue (aname, out asm)) { + try { + asm = base.Resolve (name); + } + catch (FileNotFoundException) { + // note: analysis will be incomplete + } + assemblies.Add (aname, asm); + } + return asm; + } + + public void CacheAssembly (AssemblyDefinition assembly) + { + if (assembly == null) + throw new ArgumentNullException ("assembly"); + + assemblies.Add (assembly.Name.Name, assembly); + string location = Path.GetDirectoryName (assembly.MainModule.FullyQualifiedName); + AddSearchDirectory (location); + } + + static private AssemblyResolver resolver; + + static public AssemblyResolver Resolver { + get { + if (resolver == null) + resolver = new AssemblyResolver (); + return resolver; + } + } + } +} diff --git a/webcompare/db/Makefile b/webcompare/db/Makefile index 70f57955..e3c4cfa2 100644 --- a/webcompare/db/Makefile +++ b/webcompare/db/Makefile @@ -1,7 +1,7 @@ base = ../../gui-compare LIB_SOURCES = \ - $(base)/AssemblyResolver.cs \ + AssemblyResolver.cs \ $(base)/CompareContext.cs \ $(base)/Comparison.cs \ $(base)/CecilMetadata.cs \ diff --git a/webcompare/db/MySqlDataAccess.cs b/webcompare/db/MySqlDataAccess.cs index 41b0f3ba..f7a7dcbd 100644 --- a/webcompare/db/MySqlDataAccess.cs +++ b/webcompare/db/MySqlDataAccess.cs @@ -60,7 +60,7 @@ namespace Mono.WebCompareDB { { IDbCommand cmd = cnc.CreateCommand (); cmd.CommandType = CommandType.Text; - cmd.CommandText = String.Format ("LOAD DATA INFILE '{0}' INTO TABLE {1}", file_name, table); + cmd.CommandText = String.Format ("LOAD DATA LOCAL INFILE '{0}' INTO TABLE {1}", file_name, table); cmd.ExecuteNonQuery (); } diff --git a/webcompare/db/webcompare-db.cs b/webcompare/db/webcompare-db.cs index 7a795507..a893b351 100644 --- a/webcompare/db/webcompare-db.cs +++ b/webcompare/db/webcompare-db.cs @@ -54,7 +54,7 @@ namespace Mono.WebCompareDB { Console.WriteLine (); Console.WriteLine (" When invoked with no arguments it is equivalent to:"); Console.WriteLine (); - Console.WriteLine (" webcompare-db.exe '4.5 4.5' '4.0 4.0' + Console.WriteLine (" webcompare-db.exe '4.5 4.5' '4.0 4.0'"); Console.WriteLine (); Console.WriteLine (" The first argument of each pair is a directory in ../masterinfos."); Console.WriteLine (" The second argument of each pair is a directory in ../binary."); @@ -66,7 +66,7 @@ namespace Mono.WebCompareDB { Console.WriteLine (); } - static string [] default_compares = new string [] { "4.5 4.5", "4.0 4.0" }; + static string [] default_compares = new string [] { "3.5 2.0", "SL2 2.1", "2.0 2.0", "1.1 1.0" }; static int Main (string [] args) { @@ -187,8 +187,7 @@ namespace Mono.WebCompareDB { string reference = s [0]; string profile = s [1]; string mpath = "../masterinfos/" + reference; - string bpath = "../masterinfos/" + profile; - //string bpath = "../binary/" + profile; + string bpath = "../binary/" + profile; if (!Directory.Exists (mpath)) continue; @@ -205,8 +204,7 @@ namespace Mono.WebCompareDB { if (include_list.Count > 0 && include_list.IndexOf (assembly) == -1) continue; string info_file = Path.Combine (mpath, assembly + ".xml"); - //string dll_file = Path.Combine (bpath, assembly + ".dll"); - string dll_file = Path.Combine (bpath, assembly + ".xml"); + string dll_file = Path.Combine (bpath, assembly + ".dll"); State state = new State (reference, profile, assembly, info_file, dll_file); work_items.Add (state); } @@ -226,8 +224,7 @@ namespace Mono.WebCompareDB { CompareContext cc = new CompareContext ( () => new MasterAssembly (info_file), - () => new MasterAssembly (dll_file)); - //() => new CecilAssembly (dll_file)); + () => new CecilAssembly (dll_file)); cc.ProgressChanged += delegate (object sender, CompareProgressChangedEventArgs a){ //Console.Error.WriteLine (a.Message); diff --git a/webcompare/index.aspx b/webcompare/index.aspx index 4bf1804f..76489006 100644 --- a/webcompare/index.aspx +++ b/webcompare/index.aspx @@ -44,8 +44,13 @@ void GenerateList (string reference, string profile) { - string mpath = Server.MapPath ("masterinfos/" + reference); - string bpath = Server.MapPath ("binary/" + profile); + GenerateList (reference, "masterinfos/", profile, "binary/", ".dll"); +} + +void GenerateList (string reference, string ref_dir, string profile, string prof_dir, string dll_extension) +{ + string mpath = Server.MapPath (ref_dir + reference); + string bpath = Server.MapPath (prof_dir + profile); if (!Directory.Exists (mpath)){ Response.Write ("Directory does not exist for masterinfo: " + reference); @@ -61,7 +66,7 @@ void GenerateList (string reference, string profile) select System.IO.Path.GetFileNameWithoutExtension (p); var dlls = from p in Directory.GetFiles (bpath) - where p.EndsWith (".dll") + where p.EndsWith (dll_extension) select System.IO.Path.GetFileNameWithoutExtension (p); foreach (var assembly in (from p in infos.Intersect (dlls) orderby p select p)) @@ -71,66 +76,44 @@ void GenerateList (string reference, string profile) </script> </head> <body> - <div id="header"> - <h1>Mono Class Status Pages</h1> - </div> - <div id="content"> -<div id="col1"> -<h2>Mono 4.0 vs .NET 4.0 RC</h2> - - <p>This shows the work-in-progress of Mono towards completing - the 4.0 RC APIs. - - <ul class="assemblies"> - <% GenerateList ("4.0", "4.0"); %> - </ul> -</div> - -<div id="col2"> -<h2>Mono 3.5 vs .NET 3.5</h2> - - <p>This shows the work-in-progress of Mono towards completing - the 3.5 SP1 APIs. - - <ul class="assemblies"> - <% GenerateList ("3.5", "2.0"); %> - </ul> +<div id="header"> +<h1>Mono Class Status Pages</h1> </div> +<div id="content"> + <div id="col1"> -<div id="col3"> -<h2>Moonlight vs Silverlight 3.0</h2> + <h2>.NET 4.0 vs .NET 4.5</h2> - <p>This is used to compare Mono + Moonlight assemblies against - the published API of Silverlight 3.0. + <p>This shows the API added between 4.0 and 4.5. - <ul class="assemblies"> - <% GenerateList ("SL3", "2.1"); %> - </ul> -<h2>Moonlight vs Silverlight 2.0</h2> + <ul class="assemblies"> + <% GenerateList ("4.0", "masterinfos/", "4.5", "masterinfos/", ".xml"); %> + </ul> + </div> - <p>This is used to compare Mono + Moonlight assemblies against - the published API of Silverlight 2.0. + <div id="col2"> + <h2>Mono 4.5 vs .NET 4.5</h2> - <ul class="assemblies"> - <% GenerateList ("SL2", "2.1"); %> - </ul> -</div> + <p>This shows the work-in-progress of Mono towards completing + the 4.5 APIs. -<div id="col4"> -<h2>Mono 3.5 vs .NET 2.0</h2> + <ul class="assemblies"> + <% GenerateList ("4.5", "4.5"); %> + </ul> + </div> - <p>This is comparing Mono's latest API which is typically - installed in the lib/mono/2.0/ directory, but contains the 3.5 API. + <div id="col3"> + <h2>Mono 4.0 vs .NET 4.0</h2> - <p>This list is only useful to determine if there are some - major missing features, but not for detecting if there are - extra APIs (we will have them, as we are now tracking 3.5) + <p>This shows the work-in-progress of Mono towards completing + the 4.0 APIs. - <ul class="assemblies"> - <% GenerateList ("2.0", "2.0"); %> - </ul> -</div> + <ul class="assemblies"> + <% GenerateList ("4.0", "4.0"); %> + </ul> + </div> </div> <div id="footer"> </div> + </body> </html> |