Author: ankit
Date: 2007-03-28 12:16:39 -0500 (Wed, 28 Mar 2007)
New Revision: 75088
Modified:
trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog
trunk/monodevelop/Extras/MonoDevelop.Autotools/CustomMakefile.cs
trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileData.cs
Log:
* CustomMakefile.cs (InitVarToValuesDict): Skip blank entries.
* MakefileData.cs: Replace StartsWith with direct comparisons for small
strings. For references, ignore empty entries.
(ParseReference):
(GacRefToString): Catch specific exceptions for AssemblyName.GetAssemblyName
Modified: trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog 2007-03-28
17:06:39 UTC (rev 75087)
+++ trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog 2007-03-28
17:16:39 UTC (rev 75088)
@@ -1,3 +1,11 @@
+2007-03-28 Ankit Jain <[EMAIL PROTECTED]>
+
+ * CustomMakefile.cs (InitVarToValuesDict): Skip blank entries.
+ * MakefileData.cs: Replace StartsWith with direct comparisons for small
+ strings. For references, ignore empty entries.
+ (ParseReference):
+ (GacRefToString): Catch specific exceptions for
AssemblyName.GetAssemblyName
+
2007-03-21 Ankit Jain <[EMAIL PROTECTED]>
* MakefileData.cs (PkgCheckModulesRegex): Fix regex to correctly handle
Modified: trunk/monodevelop/Extras/MonoDevelop.Autotools/CustomMakefile.cs
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Autotools/CustomMakefile.cs
2007-03-28 17:06:39 UTC (rev 75087)
+++ trunk/monodevelop/Extras/MonoDevelop.Autotools/CustomMakefile.cs
2007-03-28 17:16:39 UTC (rev 75088)
@@ -155,8 +155,10 @@
if (val.Length == 0)
continue;
- foreach (string s in val.Split (new
char [] {' ', '\t'}))
- list.Add (s);
+ foreach (string s in val.Split (new
char [] {' ', '\t'}, StringSplitOptions.RemoveEmptyEntries)) {
+ if (s.Length > 0)
+ list.Add (s);
+ }
}
varToValuesDict [varname] = list;
Modified: trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileData.cs
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileData.cs
2007-03-28 17:06:39 UTC (rev 75087)
+++ trunk/monodevelop/Extras/MonoDevelop.Autotools/MakefileData.cs
2007-03-28 17:16:39 UTC (rev 75088)
@@ -861,9 +861,9 @@
foreach (string r in references) {
//Handle -r:System,System.Data also
try {
- ParseReference (r.Trim (), usePrefix,
refVar, len, refType, project);
+ ParseReference (r, usePrefix, refVar,
len, refType, project);
} catch (Exception e) {
- Console.WriteLine ("Unable to parse
reference '{0}'. Ignoring.", r);
+ Console.WriteLine ("For project {0}
Unable to parse reference '{1}'. Ignoring. {2}", project.Name, r, e.ToString
());
monitor.ReportWarning
(GettextCatalog.GetString (
"Unable to parse reference
'{0}', reason : {1}. Ignoring.", r, e.Message));
refVar.Extra.Add (r);
@@ -887,6 +887,7 @@
DotNetProject project)
{
string rname = reference;
+ // .StartsWith "$("
if (rname.Length > 3 && rname [0] == '$' && rname [1]
== '(' && rname [rname.Length - 1] == ')') {
if (!UseAutotools) {
refVar.Extra.Add (reference);
@@ -931,10 +932,11 @@
return;
}
- if (rname.StartsWith ("-pkg:")) {
- string pkgName = rname.Substring (5).Trim ();
+ // .StartsWith "-pkg:"
+ if (rname.Length >= 5 && rname [0] == '-' && rname [1]
== 'p' && rname [2] == 'k' && rname [3] == 'g' && rname [4] == ':') {
+ string pkgName = rname.Substring (5);
//-pkg:foo,bar
- foreach (string s in pkgName.Split (new char []
{','})) {
+ foreach (string s in pkgName.Split (new char []
{','}, StringSplitOptions.RemoveEmptyEntries)) {
if (ReferencedPackages.Contains (s))
continue;
@@ -952,9 +954,9 @@
//FIXME: try/catch around the split refs ?
bool varFound = false;
- foreach (string r in rname.Split (new char [] {','})) {
+ foreach (string r in rname.Split (new char [] {','},
StringSplitOptions.RemoveEmptyEntries)) {
string refname = r;
- if (refname.StartsWith ("$(") && !UseAutotools)
{
+ if (refname.Length >= 2 && refname [0] == '$'
&& refname [1] == '(' && !UseAutotools) {
//Eg. -r:$(top_builddir)/foo.dll
refVar.Extra.Add (reference);
continue;
@@ -977,7 +979,8 @@
string fullname = null;
try {
fullname = AssemblyName.GetAssemblyName
(fullpath).FullName;
- } catch {
+ } catch (FileNotFoundException) {
+ } catch (BadImageFormatException) {
}
// Valid assembly, From a package, add as Gac
@@ -1200,13 +1203,13 @@
{
// Cosmetic fix: remove the "./" prefix
- if (!fileName.StartsWith ("./"))
+ if (! (fileName [0] == '.' && fileName [1] == '/'))
return fileName;
do {
- if (fileName.StartsWith ("./"))
+ if (fileName [0] == '.' && fileName [1] == '/')
fileName = fileName.Substring (2);
- else if (fileName.StartsWith ("/"))
+ else if (fileName [0] == '/')
fileName = fileName.Substring (1);
else
return fileName;
@@ -1405,10 +1408,12 @@
//Path
try {
fullname =
AssemblyName.GetAssemblyName (pr.Reference).FullName;
- } catch {
- //Invalid assembly!
+ //If this throws : Invalid
assembly!
//let it fall through and be
emitted as a asm ref
+ } catch (FileNotFoundException) {
pkg = null;
+ } catch (BadImageFormatException) {
+ pkg = null;
}
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches