aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Targets/AutotoolsTarget.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Targets/AutotoolsTarget.cs')
-rw-r--r--Prebuild/src/Core/Targets/AutotoolsTarget.cs112
1 files changed, 45 insertions, 67 deletions
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
index f102038..5dcbb38 100644
--- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs
+++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
@@ -65,18 +65,9 @@ POSSIBILITY OF SUCH DAMAGE.
65 */ 65 */
66 66
67#endregion 67#endregion
68
69#region CVS Information
70/*
71 * $Source$
72 * $Author: jendave $
73 * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $
74 * $Revision: 136 $
75 */
76#endregion
77
78using System; 68using System;
79using System.Collections; 69using System.Collections;
70using System.Collections.Generic;
80using System.Collections.Specialized; 71using System.Collections.Specialized;
81using System.IO; 72using System.IO;
82using System.Reflection; 73using System.Reflection;
@@ -182,8 +173,7 @@ namespace Prebuild.Core.Targets
182 Hashtable assemblyPathToPackage = new Hashtable(); 173 Hashtable assemblyPathToPackage = new Hashtable();
183 Hashtable assemblyFullNameToPath = new Hashtable(); 174 Hashtable assemblyFullNameToPath = new Hashtable();
184 Hashtable packagesHash = new Hashtable(); 175 Hashtable packagesHash = new Hashtable();
185 ArrayList packages = new ArrayList(); 176 readonly List<SystemPackage> packages = new List<SystemPackage>();
186 ClrVersion currentVersion;
187 177
188 #endregion 178 #endregion
189 179
@@ -203,22 +193,6 @@ namespace Prebuild.Core.Targets
203 di.Create(); 193 di.Create();
204 } 194 }
205 195
206 private void mkStubFiles(string dirName, ArrayList fileNames)
207 {
208 for (int i = 0; i < fileNames.Count; i++)
209 {
210 string tmpFile = dirName + "/" + (string)fileNames[i];
211
212 FileStream tmpFileStream =
213 new FileStream(tmpFile, FileMode.Create);
214
215 StreamWriter sw = new StreamWriter(tmpFileStream);
216 sw.WriteLine("These are not the files you are looking for.");
217 sw.Flush();
218 tmpFileStream.Close();
219 }
220 }
221
222 private void chkMkDir(string dirName) 196 private void chkMkDir(string dirName)
223 { 197 {
224 System.IO.DirectoryInfo di = 198 System.IO.DirectoryInfo di =
@@ -273,11 +247,11 @@ namespace Prebuild.Core.Targets
273 } 247 }
274 } 248 }
275 249
276 private ArrayList GetAssembliesWithLibInfo(string line, string file) 250 private List<string> GetAssembliesWithLibInfo(string line, string file)
277 { 251 {
278 ArrayList references = new ArrayList(); 252 List<string> references = new List<string>();
279 ArrayList libdirs = new ArrayList(); 253 List<string> libdirs = new List<string>();
280 ArrayList retval = new ArrayList(); 254 List<string> retval = new List<string>();
281 foreach (string piece in line.Split(' ')) 255 foreach (string piece in line.Split(' '))
282 { 256 {
283 if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) 257 if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
@@ -304,9 +278,9 @@ namespace Prebuild.Core.Targets
304 return retval; 278 return retval;
305 } 279 }
306 280
307 private ArrayList GetAssembliesWithoutLibInfo(string line, string file) 281 private List<string> GetAssembliesWithoutLibInfo(string line, string file)
308 { 282 {
309 ArrayList references = new ArrayList(); 283 List<string> references = new List<string>();
310 foreach (string reference in line.Split(' ')) 284 foreach (string reference in line.Split(' '))
311 { 285 {
312 if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) 286 if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
@@ -356,7 +330,7 @@ namespace Prebuild.Core.Targets
356 if (packagesHash.Contains(pname)) 330 if (packagesHash.Contains(pname))
357 return; 331 return;
358 332
359 ArrayList fullassemblies = null; 333 List<string> fullassemblies = null;
360 string version = ""; 334 string version = "";
361 string desc = ""; 335 string desc = "";
362 336
@@ -404,7 +378,7 @@ namespace Prebuild.Core.Targets
404 package.Initialize(pname, 378 package.Initialize(pname,
405 version, 379 version,
406 desc, 380 desc,
407 (string[])fullassemblies.ToArray(typeof(string)), 381 fullassemblies.ToArray(),
408 ClrVersion.Default, 382 ClrVersion.Default,
409 false); 383 false);
410 packages.Add(package); 384 packages.Add(package);
@@ -414,7 +388,7 @@ namespace Prebuild.Core.Targets
414 void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) 388 void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
415 { 389 {
416 SystemPackage package = new SystemPackage(); 390 SystemPackage package = new SystemPackage();
417 ArrayList list = new ArrayList(); 391 List<string> list = new List<string>();
418 392
419 string dir = Path.Combine(prefix, version); 393 string dir = Path.Combine(prefix, version);
420 if (!Directory.Exists(dir)) 394 if (!Directory.Exists(dir))
@@ -431,7 +405,7 @@ namespace Prebuild.Core.Targets
431 package.Initialize("mono", 405 package.Initialize("mono",
432 version, 406 version,
433 "The Mono runtime", 407 "The Mono runtime",
434 (string[])list.ToArray(typeof(string)), 408 list.ToArray(),
435 ver, 409 ver,
436 false); 410 false);
437 packages.Add(package); 411 packages.Add(package);
@@ -444,12 +418,10 @@ namespace Prebuild.Core.Targets
444 if (Environment.Version.Major == 1) 418 if (Environment.Version.Major == 1)
445 { 419 {
446 versionDir = "1.0"; 420 versionDir = "1.0";
447 currentVersion = ClrVersion.Net_1_1;
448 } 421 }
449 else 422 else
450 { 423 {
451 versionDir = "2.0"; 424 versionDir = "2.0";
452 currentVersion = ClrVersion.Net_2_0;
453 } 425 }
454 426
455 //Pull up assemblies from the installed mono system. 427 //Pull up assemblies from the installed mono system.
@@ -483,9 +455,9 @@ namespace Prebuild.Core.Targets
483 } 455 }
484 } 456 }
485 search_dirs += Path.PathSeparator + libpath; 457 search_dirs += Path.PathSeparator + libpath;
486 if (search_dirs != null && search_dirs.Length > 0) 458 if (!string.IsNullOrEmpty(search_dirs))
487 { 459 {
488 ArrayList scanDirs = new ArrayList(); 460 List<string> scanDirs = new List<string>();
489 foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) 461 foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
490 { 462 {
491 if (!scanDirs.Contains(potentialDir)) 463 if (!scanDirs.Contains(potentialDir))
@@ -763,20 +735,22 @@ namespace Prebuild.Core.Targets
763 bool hasAssemblyConfig = false; 735 bool hasAssemblyConfig = false;
764 chkMkDir(projectDir); 736 chkMkDir(projectDir);
765 737
766 ArrayList 738 List<string>
767 compiledFiles = new ArrayList(), 739 compiledFiles = new List<string>(),
768 contentFiles = new ArrayList(), 740 contentFiles = new List<string>(),
769 embeddedFiles = new ArrayList(), 741 embeddedFiles = new List<string>(),
742
743 binaryLibs = new List<string>(),
744 pkgLibs = new List<string>(),
745 systemLibs = new List<string>(),
746 runtimeLibs = new List<string>(),
770 747
771 binaryLibs = new ArrayList(), 748 extraDistFiles = new List<string>(),
772 pkgLibs = new ArrayList(), 749 localCopyTargets = new List<string>();
773 systemLibs = new ArrayList(),
774 runtimeLibs = new ArrayList(),
775 750
776 extraDistFiles = new ArrayList(), 751 // If there exists a .config file for this assembly, copy
777 localCopyTargets = new ArrayList(); 752 // it to the project folder
778 753
779 // If there exists a .config file for this assembly, copy it to the project folder
780 // TODO: Support copying .config.osx files 754 // TODO: Support copying .config.osx files
781 // TODO: support processing the .config file for native library deps 755 // TODO: support processing the .config file for native library deps
782 string projectAssemblyName = project.Name; 756 string projectAssemblyName = project.Name;
@@ -839,11 +813,15 @@ namespace Prebuild.Core.Targets
839 foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) 813 foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
840 Console.WriteLine("Error! '{0}'", error.ErrorText); 814 Console.WriteLine("Error! '{0}'", error.ErrorText);
841 815
842 string projectFullName = cr.CompiledAssembly.FullName; 816 try {
843 Regex verRegex = new Regex("Version=([\\d\\.]+)"); 817 string projectFullName = cr.CompiledAssembly.FullName;
844 Match verMatch = verRegex.Match(projectFullName); 818 Regex verRegex = new Regex("Version=([\\d\\.]+)");
845 if (verMatch.Success) 819 Match verMatch = verRegex.Match(projectFullName);
820 if (verMatch.Success)
846 projectVersion = verMatch.Groups[1].Value; 821 projectVersion = verMatch.Groups[1].Value;
822 }catch{
823 Console.WriteLine("Couldn't compile AssemblyInfo.cs");
824 }
847 825
848 // Clean up the temp file 826 // Clean up the temp file
849 try 827 try
@@ -853,7 +831,7 @@ namespace Prebuild.Core.Targets
853 } 831 }
854 catch 832 catch
855 { 833 {
856 //Console.WriteLine("Error! '{0}'", e.ToString()); 834 Console.WriteLine("Error! '{0}'", e.ToString());
857 } 835 }
858 836
859 } 837 }
@@ -1013,46 +991,46 @@ namespace Prebuild.Core.Targets
1013 } 991 }
1014 } 992 }
1015 993
1016 string lineSep = " \\\n\t"; 994 const string lineSep = " \\\n\t";
1017 string compiledFilesString = string.Empty; 995 string compiledFilesString = string.Empty;
1018 if (compiledFiles.Count > 0) 996 if (compiledFiles.Count > 0)
1019 compiledFilesString = 997 compiledFilesString =
1020 lineSep + string.Join(lineSep, (string[])compiledFiles.ToArray(typeof(string))); 998 lineSep + string.Join(lineSep, compiledFiles.ToArray());
1021 999
1022 string embeddedFilesString = ""; 1000 string embeddedFilesString = "";
1023 if (embeddedFiles.Count > 0) 1001 if (embeddedFiles.Count > 0)
1024 embeddedFilesString = 1002 embeddedFilesString =
1025 lineSep + string.Join(lineSep, (string[])embeddedFiles.ToArray(typeof(string))); 1003 lineSep + string.Join(lineSep, embeddedFiles.ToArray());
1026 1004
1027 string contentFilesString = ""; 1005 string contentFilesString = "";
1028 if (contentFiles.Count > 0) 1006 if (contentFiles.Count > 0)
1029 contentFilesString = 1007 contentFilesString =
1030 lineSep + string.Join(lineSep, (string[])contentFiles.ToArray(typeof(string))); 1008 lineSep + string.Join(lineSep, contentFiles.ToArray());
1031 1009
1032 string extraDistFilesString = ""; 1010 string extraDistFilesString = "";
1033 if (extraDistFiles.Count > 0) 1011 if (extraDistFiles.Count > 0)
1034 extraDistFilesString = 1012 extraDistFilesString =
1035 lineSep + string.Join(lineSep, (string[])extraDistFiles.ToArray(typeof(string))); 1013 lineSep + string.Join(lineSep, extraDistFiles.ToArray());
1036 1014
1037 string pkgLibsString = ""; 1015 string pkgLibsString = "";
1038 if (pkgLibs.Count > 0) 1016 if (pkgLibs.Count > 0)
1039 pkgLibsString = 1017 pkgLibsString =
1040 lineSep + string.Join(lineSep, (string[])pkgLibs.ToArray(typeof(string))); 1018 lineSep + string.Join(lineSep, pkgLibs.ToArray());
1041 1019
1042 string binaryLibsString = ""; 1020 string binaryLibsString = "";
1043 if (binaryLibs.Count > 0) 1021 if (binaryLibs.Count > 0)
1044 binaryLibsString = 1022 binaryLibsString =
1045 lineSep + string.Join(lineSep, (string[])binaryLibs.ToArray(typeof(string))); 1023 lineSep + string.Join(lineSep, binaryLibs.ToArray());
1046 1024
1047 string systemLibsString = ""; 1025 string systemLibsString = "";
1048 if (systemLibs.Count > 0) 1026 if (systemLibs.Count > 0)
1049 systemLibsString = 1027 systemLibsString =
1050 lineSep + string.Join(lineSep, (string[])systemLibs.ToArray(typeof(string))); 1028 lineSep + string.Join(lineSep, systemLibs.ToArray());
1051 1029
1052 string localCopyTargetsString = ""; 1030 string localCopyTargetsString = "";
1053 if (localCopyTargets.Count > 0) 1031 if (localCopyTargets.Count > 0)
1054 localCopyTargetsString = 1032 localCopyTargetsString =
1055 string.Join("\n", (string[])localCopyTargets.ToArray(typeof(string))); 1033 string.Join("\n", localCopyTargets.ToArray());
1056 1034
1057 string monoPath = ""; 1035 string monoPath = "";
1058 foreach (string runtimeLib in runtimeLibs) 1036 foreach (string runtimeLib in runtimeLibs)