static void Main(string [] args) { if (!File.Exists ("genproj.cs") || !File.Exists ("monowrap.cs")){ Console.WriteLine ("This command should be ran from mono/msvc/scripts"); Environment.Exit (1); } var sln_gen = new SlnGenerator (); XDocument doc = XDocument.Load ("order.xml"); foreach (XElement project in doc.Root.Elements ()){ string dir = project.Attribute ("dir").Value; string library = project.Attribute ("library").Value; // // Do only class libraries for now // if (!(dir.StartsWith ("class") || dir.StartsWith ("mcs"))) continue; // // Do not do 2.1, it is not working yet // Do not do basic, as there is no point (requires a system mcs to be installed). // if (library.Contains ("moonlight") || library.Contains ("-basic")) continue; var gen = new MsbuildGenerator (dir); try { sln_gen.Add (gen.Generate (project)); } catch (Exception e) { Console.WriteLine ("Error in {0}\n{1}", dir, e); } } sln_gen.Write ("mcs_full.sln"); }
static void FillSolution(SlnGenerator solution, string profileString, IEnumerable <MsbuildGenerator> projects, Func <MsbuildGenerator.VsCsproj, bool> additionalFilter = null) { foreach (var generator in projects) { var vsCsproj = generator.Csproj; if (!vsCsproj.library.Contains(profileString)) { continue; } if (additionalFilter != null && !additionalFilter(vsCsproj)) { continue; } var csprojFilename = vsCsproj.csProjFilename; if (!solution.ContainsProjectIdentifier(vsCsproj.library)) { solution.Add(vsCsproj); RecursiveAddProj(solution, vsCsproj); } } }
static void WriteSolution(SlnGenerator sln_gen, string slnfilename) { Console.WriteLine(String.Format("Writing solution {1}, with {0} projects", sln_gen.Count, slnfilename)); sln_gen.Write(slnfilename); }
static void Main(string [] args) { if (!File.Exists("genproj.cs")) { Console.WriteLine("This command must be executed from mono/msvc/scripts"); Environment.Exit(1); } if (args.Length == 1 && args [0].ToLower().Contains("-h")) { Console.WriteLine("Usage:"); Console.WriteLine("genproj.exe [visual_studio_release] [output_full_solutions]"); Console.WriteLine("If output_full_solutions is false, only the main System*.dll"); Console.WriteLine(" assemblies (and dependencies) is included in the solution."); Console.WriteLine("Example:"); Console.WriteLine("genproj.exe 2012 false"); Console.WriteLine("genproj.exe with no arguments is equivalent to 'genproj.exe 2012 true'"); Environment.Exit(0); } var slnVersion = (args.Length > 0) ? args [0] : "2012"; bool fullSolutions = (args.Length > 1) ? bool.Parse(args [1]) : true; var sln_gen = new SlnGenerator(slnVersion); var two_sln_gen = new SlnGenerator(slnVersion); var four_sln_gen = new SlnGenerator(slnVersion); var three_five_sln_gen = new SlnGenerator(slnVersion); var four_five_sln_gen = new SlnGenerator(slnVersion); var projects = new Dictionary <string, MsbuildGenerator> (); var duplicates = new List <string> (); foreach (var project in GetProjects()) { var library_output = project.Element("library_output").Value; projects [library_output] = new MsbuildGenerator(project); } foreach (var project in GetProjects()) { var library_output = project.Element("library_output").Value; var gen = projects [library_output]; try { var csproj = gen.Generate(projects); var csprojFilename = csproj.csProjFilename; if (!sln_gen.ContainsProjectIdentifier(csproj.library)) { sln_gen.Add(csproj); } else { duplicates.Add(csprojFilename); } } catch (Exception e) { Console.WriteLine("Error in {0}\n{1}", project, e); } } Func <MsbuildGenerator.VsCsproj, bool> additionalFilter; additionalFilter = fullSolutions ? (Func <MsbuildGenerator.VsCsproj, bool>)null : IsCommonLibrary; FillSolution(two_sln_gen, MsbuildGenerator.profile_2_0, projects.Values, additionalFilter); FillSolution(four_five_sln_gen, MsbuildGenerator.profile_4_5, projects.Values, additionalFilter); FillSolution(four_sln_gen, MsbuildGenerator.profile_4_0, projects.Values, additionalFilter); FillSolution(three_five_sln_gen, MsbuildGenerator.profile_3_5, projects.Values, additionalFilter); var sb = new StringBuilder(); sb.AppendLine("WARNING: Skipped some project references, apparent duplicates in order.xml:"); foreach (var item in duplicates) { sb.AppendLine(item); } Console.WriteLine(sb.ToString()); WriteSolution(two_sln_gen, MakeSolutionName(MsbuildGenerator.profile_2_0)); WriteSolution(three_five_sln_gen, MakeSolutionName(MsbuildGenerator.profile_3_5)); WriteSolution(four_sln_gen, MakeSolutionName(MsbuildGenerator.profile_4_0)); WriteSolution(four_five_sln_gen, MakeSolutionName(MsbuildGenerator.profile_4_5)); // A few other optional solutions // Solutions with 'everything' and the most common libraries used in development may be of interest //WriteSolution (sln_gen, "mcs_full.sln"); //WriteSolution (small_full_sln_gen, "small_full.sln"); // The following may be useful if lacking visual studio or MonoDevelop, to bootstrap mono compiler self-hosting //WriteSolution (basic_sln_gen, "mcs_basic.sln"); //WriteSolution (build_sln_gen, "mcs_build.sln"); }
static void Main(string [] args) { if (!File.Exists("genproj.cs")) { Console.WriteLine("This command must be executed from mono/msvc/scripts"); Environment.Exit(1); } if (args.Length == 1 && args [0].ToLower().Contains("-h")) { Console.WriteLine("Usage:"); Console.WriteLine("genproj.exe [visual_studio_release] [output_full_solutions]"); Console.WriteLine("If output_full_solutions is false, only the main System*.dll"); Console.WriteLine(" assemblies (and dependencies) is included in the solution."); Console.WriteLine("Example:"); Console.WriteLine("genproj.exe 2012 false"); Console.WriteLine("genproj.exe with no arguments is equivalent to 'genproj.exe 2012 true'"); Environment.Exit(0); } var slnVersion = (args.Length > 0) ? args [0] : "2012"; bool fullSolutions = (args.Length > 1) ? bool.Parse(args [1]) : true; var sln_gen = new SlnGenerator(slnVersion); var two_sln_gen = new SlnGenerator(slnVersion); var four_sln_gen = new SlnGenerator(slnVersion); var three_five_sln_gen = new SlnGenerator(slnVersion); var four_five_sln_gen = new SlnGenerator(slnVersion); var projects = new List <MsbuildGenerator.VsCsproj> (); XDocument doc = XDocument.Load("order.xml"); var duplicates = new List <string> (); foreach (XElement project in doc.Root.Elements()) { string dir = project.Attribute("dir").Value; string library = project.Attribute("library").Value; // // Do only class libraries for now // if (!(dir.StartsWith("class") || dir.StartsWith("mcs") || dir.StartsWith("basic"))) { continue; } // // Do not do 2.1, it is not working yet // Do not do basic, as there is no point (requires a system mcs to be installed). // //if (library.Contains ("moonlight") || library.Contains ("-basic") || library.EndsWith ("bootstrap")) if (library.Contains("moonlight") || library.EndsWith("bootstrap")) { continue; } var gen = new MsbuildGenerator(dir); try { var csproj = gen.Generate(project, projects); var csprojFilename = csproj.csprojFileName; if (!sln_gen.ContainsProjectIdentifier(csproj.library)) { projects.Add(csproj); sln_gen.Add(csproj); } else { duplicates.Add(csprojFilename); } } catch (Exception e) { Console.WriteLine("Error in {0}\n{1}", dir, e); } } Func <MsbuildGenerator.VsCsproj, bool> additionalFilter; additionalFilter = fullSolutions ? (Func <MsbuildGenerator.VsCsproj, bool>)null : IsCommonLibrary; FillSolution(two_sln_gen, MsbuildGenerator.profile_2_0, projects, additionalFilter); FillSolution(four_five_sln_gen, MsbuildGenerator.profile_4_5, projects, additionalFilter); FillSolution(four_sln_gen, MsbuildGenerator.profile_4_0, projects, additionalFilter); FillSolution(three_five_sln_gen, MsbuildGenerator.profile_3_5, projects, additionalFilter); var sb = new StringBuilder(); sb.AppendLine("WARNING: Skipped some project references, apparent duplicates in order.xml:"); foreach (var item in duplicates) { sb.AppendLine(item); } Console.WriteLine(sb.ToString()); WriteSolution(two_sln_gen, MakeSolutionName(MsbuildGenerator.profile_2_0)); WriteSolution(three_five_sln_gen, MakeSolutionName(MsbuildGenerator.profile_3_5)); WriteSolution(four_sln_gen, MakeSolutionName(MsbuildGenerator.profile_4_0)); WriteSolution(four_five_sln_gen, MakeSolutionName(MsbuildGenerator.profile_4_5)); // A few other optional solutions // Solutions with 'everything' and the most common libraries used in development may be of interest //WriteSolution (sln_gen, "mcs_full.sln"); //WriteSolution (small_full_sln_gen, "small_full.sln"); // The following may be useful if lacking visual studio or MonoDevelop, to bootstrap mono compiler self-hosting //WriteSolution (basic_sln_gen, "mcs_basic.sln"); //WriteSolution (build_sln_gen, "mcs_build.sln"); }
static void FillSolution (SlnGenerator solution, string profileString, List<MsbuildGenerator.VsCsproj> projects, Func<MsbuildGenerator.VsCsproj, bool> additionalFilter = null) { foreach (var vsCsproj in projects) { if (!vsCsproj.library.Contains (profileString)) continue; if (additionalFilter != null && !additionalFilter (vsCsproj)) continue; var csprojFilename = vsCsproj.csprojFileName; if (!solution.ContainsProjectIdentifier (vsCsproj.library)) { solution.Add (vsCsproj); RecursiveAddProj (solution, vsCsproj); } } }
static void Main (string [] args) { if (!File.Exists ("genproj.cs")) { Console.WriteLine ("This command must be executed from mono/msvc/scripts"); Environment.Exit (1); } if (args.Length == 1 && args [0].ToLower ().Contains ("-h")) { Console.WriteLine ("Usage:"); Console.WriteLine ("genproj.exe [visual_studio_release] [output_full_solutions]"); Console.WriteLine ("If output_full_solutions is false, only the main System*.dll"); Console.WriteLine (" assemblies (and dependencies) is included in the solution."); Console.WriteLine ("Example:"); Console.WriteLine ("genproj.exe 2012 false"); Console.WriteLine ("genproj.exe with no arguments is equivalent to 'genproj.exe 2012 true'"); Environment.Exit (0); } var slnVersion = (args.Length > 0) ? args [0] : "2012"; bool fullSolutions = (args.Length > 1) ? bool.Parse (args [1]) : true; var sln_gen = new SlnGenerator (slnVersion); var two_sln_gen = new SlnGenerator (slnVersion); var four_sln_gen = new SlnGenerator (slnVersion); var three_five_sln_gen = new SlnGenerator (slnVersion); var four_five_sln_gen = new SlnGenerator (slnVersion); var projects = new List<MsbuildGenerator.VsCsproj> (); XDocument doc = XDocument.Load ("order.xml"); var duplicates = new List<string> (); foreach (XElement project in doc.Root.Elements ()) { string dir = project.Attribute ("dir").Value; string library = project.Attribute ("library").Value; // // Do only class libraries for now // if (!(dir.StartsWith ("class") || dir.StartsWith ("mcs") || dir.StartsWith ("basic"))) continue; // // Do not do 2.1, it is not working yet // Do not do basic, as there is no point (requires a system mcs to be installed). // //if (library.Contains ("moonlight") || library.Contains ("-basic") || library.EndsWith ("bootstrap")) if (library.Contains ("moonlight") || library.EndsWith ("bootstrap")) continue; var gen = new MsbuildGenerator (dir); try { var csproj = gen.Generate (project, projects); var csprojFilename = csproj.csprojFileName; if (!sln_gen.ContainsProjectIdentifier (csproj.library)) { projects.Add (csproj); sln_gen.Add (csproj); } else { duplicates.Add (csprojFilename); } } catch (Exception e) { Console.WriteLine ("Error in {0}\n{1}", dir, e); } } Func<MsbuildGenerator.VsCsproj, bool> additionalFilter; additionalFilter = fullSolutions ? (Func<MsbuildGenerator.VsCsproj, bool>)null : IsCommonLibrary; FillSolution (two_sln_gen, MsbuildGenerator.profile_2_0, projects, additionalFilter); FillSolution (four_five_sln_gen, MsbuildGenerator.profile_4_5, projects, additionalFilter); FillSolution (four_sln_gen, MsbuildGenerator.profile_4_0, projects, additionalFilter); FillSolution (three_five_sln_gen, MsbuildGenerator.profile_3_5, projects, additionalFilter); var sb = new StringBuilder (); sb.AppendLine ("WARNING: Skipped some project references, apparent duplicates in order.xml:"); foreach (var item in duplicates) { sb.AppendLine (item); } Console.WriteLine (sb.ToString ()); WriteSolution (two_sln_gen, MakeSolutionName (MsbuildGenerator.profile_2_0)); WriteSolution (three_five_sln_gen, MakeSolutionName (MsbuildGenerator.profile_3_5)); WriteSolution (four_sln_gen, MakeSolutionName (MsbuildGenerator.profile_4_0)); WriteSolution (four_five_sln_gen, MakeSolutionName (MsbuildGenerator.profile_4_5)); // A few other optional solutions // Solutions with 'everything' and the most common libraries used in development may be of interest //WriteSolution (sln_gen, "mcs_full.sln"); //WriteSolution (small_full_sln_gen, "small_full.sln"); // The following may be useful if lacking visual studio or MonoDevelop, to bootstrap mono compiler self-hosting //WriteSolution (basic_sln_gen, "mcs_basic.sln"); //WriteSolution (build_sln_gen, "mcs_build.sln"); }
static void WriteSolution (SlnGenerator sln_gen, string slnfilename) { Console.WriteLine (String.Format ("Writing solution {1}, with {0} projects", sln_gen.Count, slnfilename)); sln_gen.Write (slnfilename); }
static void RecursiveAddProj (SlnGenerator solution, MsbuildGenerator.VsCsproj vsCsproj, int recursiveDepth = 1) { const int max_recursive = 16; if (recursiveDepth > max_recursive) throw new Exception (string.Format ("Reached {0} levels of project dependency", max_recursive)); foreach (var projRef in vsCsproj.projReferences) { if (!solution.ContainsProjectIdentifier (projRef.library)) { solution.Add (projRef); RecursiveAddProj (solution, projRef, recursiveDepth + 1); } } }
static void Main (string [] args) { if (!File.Exists ("genproj.cs")) { Console.WriteLine ("This command must be executed from mono/msvc/scripts"); Environment.Exit (1); } if (args.Length == 1 && args [0].ToLower ().Contains ("-h")) { Console.WriteLine ("Usage:"); Console.WriteLine ("genproj.exe [visual_studio_release] [output_full_solutions]"); Console.WriteLine ("If output_full_solutions is false, only the main System*.dll"); Console.WriteLine (" assemblies (and dependencies) is included in the solution."); Console.WriteLine ("Example:"); Console.WriteLine ("genproj.exe 2012 false"); Console.WriteLine ("genproj.exe with no arguments is equivalent to 'genproj.exe 2012 true'\n\n"); Console.WriteLine ("genproj.exe deps"); Console.WriteLine ("Generates a Makefile dependency file from the projects input"); Environment.Exit (0); } var slnVersion = (args.Length > 0) ? args [0] : "2012"; bool fullSolutions = (args.Length > 1) ? bool.Parse (args [1]) : true; // To generate makefile depenedencies var makefileDeps = (args.Length > 0 && args [0] == "deps"); var sln_gen = new SlnGenerator (slnVersion); var four_five_sln_gen = new SlnGenerator (slnVersion); var projects = new Dictionary<string,MsbuildGenerator> (); var duplicates = new List<string> (); foreach (var project in GetProjects (makefileDeps)) { var library_output = project.Element ("library_output").Value; projects [library_output] = new MsbuildGenerator (project); } foreach (var project in GetProjects (makefileDeps)){ var library_output = project.Element ("library_output").Value; //Console.WriteLine ("=== {0} ===", library_output); var gen = projects [library_output]; try { var csproj = gen.Generate (library_output, projects); var csprojFilename = csproj.csProjFilename; if (!sln_gen.ContainsProjectIdentifier (csproj.library)) { sln_gen.Add (csproj); } else { duplicates.Add (csprojFilename); } } catch (Exception e) { Console.WriteLine ("Error in {0}\n{1}", project, e); } } Func<MsbuildGenerator.VsCsproj, bool> additionalFilter; additionalFilter = fullSolutions ? (Func<MsbuildGenerator.VsCsproj, bool>)null : IsCommonLibrary; FillSolution (four_five_sln_gen, MsbuildGenerator.profile_4_x, projects.Values, additionalFilter); if (duplicates.Count () > 0) { var sb = new StringBuilder (); sb.AppendLine ("WARNING: Skipped some project references, apparent duplicates in order.xml:"); foreach (var item in duplicates) { sb.AppendLine (item); } Console.WriteLine (sb.ToString ()); } WriteSolution (four_five_sln_gen, Path.Combine ("..", "..", MakeSolutionName (MsbuildGenerator.profile_4_x))); if (makefileDeps){ const string classDirPrefix = "./../../"; Console.WriteLine ("here {0}", sln_gen.libraries.Count); foreach (var p in sln_gen.libraries){ string rebasedOutput = RebaseToClassDirectory (MsbuildGenerator.GetRelativePath ("../../mcs/class", p.library_output)); Console.Write ("{0}: ", rebasedOutput); foreach (var r in p.projReferences){ var lo = r.library_output; if (lo.StartsWith (classDirPrefix)) lo = lo.Substring (classDirPrefix.Length); else lo = "<<ERROR-dependency is not a class library>>"; Console.Write ("{0} ", lo); } Console.Write ("\n\t(cd {0}; make {1})", p.MsbuildGenerator.dir, p.library_output); Console.WriteLine ("\n"); } } // A few other optional solutions // Solutions with 'everything' and the most common libraries used in development may be of interest //WriteSolution (sln_gen, "./mcs_full.sln"); //WriteSolution (small_full_sln_gen, "small_full.sln"); // The following may be useful if lacking visual studio or MonoDevelop, to bootstrap mono compiler self-hosting //WriteSolution (basic_sln_gen, "mcs_basic.sln"); //WriteSolution (build_sln_gen, "mcs_build.sln"); }
static void Main(string [] args) { if (!File.Exists("genproj.cs")) { Console.WriteLine("This command must be executed from mono/msvc/scripts"); Environment.Exit(1); } if (args.Length == 1 && args [0].ToLower().Contains("-h")) { Console.WriteLine("Usage:"); Console.WriteLine("genproj.exe [visual_studio_release] [output_full_solutions]"); Console.WriteLine("If output_full_solutions is false, only the main System*.dll"); Console.WriteLine(" assemblies (and dependencies) is included in the solution."); Console.WriteLine("Example:"); Console.WriteLine("genproj.exe 2012 false"); Console.WriteLine("genproj.exe with no arguments is equivalent to 'genproj.exe 2012 true'\n\n"); Console.WriteLine("genproj.exe deps"); Console.WriteLine("Generates a Makefile dependency file from the projects input"); Environment.Exit(0); } var slnVersion = (args.Length > 0) ? args [0] : "2012"; bool fullSolutions = (args.Length > 1) ? bool.Parse(args [1]) : true; // To generate makefile depenedencies var makefileDeps = (args.Length > 0 && args [0] == "deps"); var sln_gen = new SlnGenerator(slnVersion); var four_five_sln_gen = new SlnGenerator(slnVersion); var projects = new Dictionary <string, MsbuildGenerator> (); var duplicates = new List <string> (); foreach (var project in GetProjects(makefileDeps)) { var library_output = project.Element("library_output").Value; projects [library_output] = new MsbuildGenerator(project); } foreach (var project in GetProjects(makefileDeps)) { var library_output = project.Element("library_output").Value; //Console.WriteLine ("=== {0} ===", library_output); var gen = projects [library_output]; try { var csproj = gen.Generate(library_output, projects); var csprojFilename = csproj.csProjFilename; if (!sln_gen.ContainsProjectIdentifier(csproj.library)) { sln_gen.Add(csproj); } else { duplicates.Add(csprojFilename); } } catch (Exception e) { Console.WriteLine("Error in {0}\n{1}", project, e); } } Func <MsbuildGenerator.VsCsproj, bool> additionalFilter; additionalFilter = fullSolutions ? (Func <MsbuildGenerator.VsCsproj, bool>)null : IsCommonLibrary; FillSolution(four_five_sln_gen, MsbuildGenerator.profile_4_x, projects.Values, additionalFilter); if (duplicates.Count() > 0) { var sb = new StringBuilder(); sb.AppendLine("WARNING: Skipped some project references, apparent duplicates in order.xml:"); foreach (var item in duplicates) { sb.AppendLine(item); } Console.WriteLine(sb.ToString()); } WriteSolution(four_five_sln_gen, Path.Combine("..", "..", MakeSolutionName(MsbuildGenerator.profile_4_x))); if (makefileDeps) { const string classDirPrefix = "./../../"; Console.WriteLine("here {0}", sln_gen.libraries.Count); foreach (var p in sln_gen.libraries) { string rebasedOutput = RebaseToClassDirectory(MsbuildGenerator.GetRelativePath("../../mcs/class", p.library_output)); Console.Write("{0}: ", rebasedOutput); foreach (var r in p.projReferences) { var lo = r.library_output; if (lo.StartsWith(classDirPrefix)) { lo = lo.Substring(classDirPrefix.Length); } else { lo = "<<ERROR-dependency is not a class library>>"; } Console.Write("{0} ", lo); } Console.Write("\n\t(cd {0}; make {1})", p.MsbuildGenerator.dir, p.library_output); Console.WriteLine("\n"); } } // A few other optional solutions // Solutions with 'everything' and the most common libraries used in development may be of interest //WriteSolution (sln_gen, "./mcs_full.sln"); //WriteSolution (small_full_sln_gen, "small_full.sln"); // The following may be useful if lacking visual studio or MonoDevelop, to bootstrap mono compiler self-hosting //WriteSolution (basic_sln_gen, "mcs_basic.sln"); //WriteSolution (build_sln_gen, "mcs_build.sln"); }