示例#1
0
        void ConfigureMac()
        {
            var classic_targets           = new List <MacClassicTarget> ();
            var unified_targets           = new List <MacUnifiedTarget> ();
            var hardcoded_unified_targets = new List <MacUnifiedTarget> ();

            RootDirectory = Path.GetFullPath(RootDirectory).TrimEnd('/');

            if (AutoConf)
            {
                AutoConfigureMac();
            }

            CreateBCLProjects();

            foreach (var file in TestProjects)
            {
                if (!File.Exists(file))
                {
                    throw new FileNotFoundException(file);
                }

                var unifiedMobile = new MacUnifiedTarget(true)
                {
                    TemplateProjectPath = file,
                    Harness             = this,
                };
                unifiedMobile.Execute();
                unified_targets.Add(unifiedMobile);

                var unifiedXM45 = new MacUnifiedTarget(false)
                {
                    TemplateProjectPath = file,
                    Harness             = this,
                };
                unifiedXM45.Execute();
                unified_targets.Add(unifiedXM45);

                var classic = new MacClassicTarget()
                {
                    TemplateProjectPath = file,
                    Harness             = this,
                };
                classic.Execute();
                classic_targets.Add(classic);
            }

            foreach (var file in HardCodedTestProjects)
            {
                var unifiedMobile = new MacUnifiedTarget(true, true)
                {
                    TemplateProjectPath = file,
                    Harness             = this,
                };
                unifiedMobile.Execute();
                hardcoded_unified_targets.Add(unifiedMobile);
            }

            MakefileGenerator.CreateMacMakefile(this, classic_targets.Union <MacTarget> (unified_targets).Union(hardcoded_unified_targets));
        }
示例#2
0
 void IMakefileBlock.Process(MakefileGenerator generator)
 {
     generator.ExternalBuilder.AppendLine();
     generator.ExternalBuilder.AppendLine($"# Toolset ({generator.Project.Toolset.Name})");
     generator.ExternalBuilder.AppendLine($"TOOLSETPATH={Program.Config.GetPath($"Toolset.{generator.Project.Toolset.Name}")}");
     foreach (var tool in generator.Project.Toolset.Tools)
     {
         generator.ExternalBuilder.AppendLine($"{tool.Name}=$(TOOLSETPATH)/{tool.Binary}");
     }
 }
示例#3
0
 void IMakefileBlock.Process(MakefileGenerator generator)
 {
     if (Program.Config.AdvSource.Count > 0)
     {
         generator.Builder.AppendLine();
         generator.Builder.AppendLine("# Source files");
         foreach (var src in Program.Config.AdvSource)
         {
             generator.Builder.AppendLine($"SRC += {src}");
         }
     }
 }
示例#4
0
        void ConfigureIOS()
        {
            var unified_targets = new List <UnifiedTarget> ();
            var tvos_targets    = new List <TVOSTarget> ();
            var watchos_targets = new List <WatchOSTarget> ();

            RootDirectory = Path.GetFullPath(RootDirectory).TrimEnd('/');

            if (AutoConf)
            {
                AutoConfigureIOS();
            }

            CreateBCLProjects();

            foreach (var proj in IOSTestProjects)
            {
                var file = proj.Path;
                if (!File.Exists(file))
                {
                    throw new FileNotFoundException(file);
                }

                var watchos = new WatchOSTarget()
                {
                    TemplateProjectPath = file,
                    Harness             = this,
                };
                watchos.Execute();
                watchos_targets.Add(watchos);

                var tvos = new TVOSTarget()
                {
                    TemplateProjectPath = file,
                    Harness             = this,
                };
                tvos.Execute();
                tvos_targets.Add(tvos);

                var unified = new UnifiedTarget()
                {
                    TemplateProjectPath = file,
                    Harness             = this,
                };
                unified.Execute();
                unified_targets.Add(unified);
            }

            SolutionGenerator.CreateSolution(this, watchos_targets, "watchos");
            SolutionGenerator.CreateSolution(this, tvos_targets, "tvos");
            MakefileGenerator.CreateMakefile(this, unified_targets, tvos_targets, watchos_targets);
        }
示例#5
0
        void IMakefileBlock.Process(MakefileGenerator generator)
        {
            foreach (var driver in generator.Project.Drivers)
            {
                driver.Source.Used = true;
                // TODO: load driver config?
                //        AppendSourceFiles(drv.Source, true);
                //       AppendIncludes(drv.Source, true);
            }

            foreach (var driver in Catalog.Drivers.Where(x => x.Used))
            {
                generator.AppendSourceFiles(driver, true);
                generator.AppendIncludes(driver, true);
            }
        }
示例#6
0
        static void Main(string[] args)
        {
            Config.Parse(args);
            string ProjectFile = Config.Result;

            if (string.IsNullOrEmpty(ProjectFile))
            {
                ProjectFile = "project.xml";
            }

            Log(AppVersion);
            try
            {
                Log("Loading data...");
                Catalog.DataDirectory = Config.GetPath("Data") ?? Path.Combine(AppPath, "data");
                Catalog.WorkDirectory = "build";
                Catalog.Initialize();

                Log("Loading project...");
                Project project;
                project = Catalog.LoadProject(ProjectFile);

                RepositoryResolver.ResolveForProject(project);

                Log("Generating files...");
                MakefileGenerator m = new MakefileGenerator(project);
                m.UseExternalMakefile = false;
                m.Export("Makefile");

                Make make = new Make();
                foreach (var rule in Config.Rules)
                {
                    Log($"Rule {rule}");
                    make.Run(rule);
                }

                Log("Finished");
            }
            catch (Exception e)
            {
                Log($"Unhandled: {e.Message}", "Error");
            }
        }
示例#7
0
        void ConfigureIOS()
        {
            var unified_targets = new List <UnifiedTarget> ();
            var tvos_targets    = new List <TVOSTarget> ();
            var watchos_targets = new List <WatchOSTarget> ();
            var today_targets   = new List <TodayExtensionTarget> ();

            RootDirectory = Path.GetFullPath(RootDirectory).TrimEnd('/');

            if (AutoConf)
            {
                AutoConfigureIOS();
            }

            foreach (var bclTestInfo in IOSTestProjects.Where(x => x.BCLInfo != null).Select(x => x.BCLInfo))
            {
                bclTestInfo.Convert();
            }

            foreach (var proj in IOSTestProjects)
            {
                var file = proj.Path;
                if (!File.Exists(file))
                {
                    throw new FileNotFoundException(file);
                }

                if (!proj.SkipwatchOSVariation)
                {
                    var watchos = new WatchOSTarget()
                    {
                        TemplateProjectPath = file,
                        Harness             = this,
                        TestProject         = proj,
                    };
                    watchos.Execute();
                    watchos_targets.Add(watchos);
                }

                if (!proj.SkiptvOSVariation)
                {
                    var tvos = new TVOSTarget()
                    {
                        TemplateProjectPath = file,
                        Harness             = this,
                        TestProject         = proj,
                    };
                    tvos.Execute();
                    tvos_targets.Add(tvos);
                }

                if (!proj.SkipiOSVariation)
                {
                    var unified = new UnifiedTarget()
                    {
                        TemplateProjectPath = file,
                        Harness             = this,
                        TestProject         = proj,
                    };
                    unified.Execute();
                    unified_targets.Add(unified);

                    var today = new TodayExtensionTarget {
                        TemplateProjectPath = file,
                        Harness             = this,
                        TestProject         = proj,
                    };
                    today.Execute();
                    today_targets.Add(today);
                }
            }

            SolutionGenerator.CreateSolution(this, watchos_targets, "watchos");
            SolutionGenerator.CreateSolution(this, tvos_targets, "tvos");
            SolutionGenerator.CreateSolution(this, today_targets, "today");
            MakefileGenerator.CreateMakefile(this, unified_targets, tvos_targets, watchos_targets, today_targets);
        }
示例#8
0
        void ConfigureMac()
        {
            var classic_targets           = new List <MacClassicTarget> ();
            var unified_targets           = new List <MacUnifiedTarget> ();
            var hardcoded_unified_targets = new List <MacUnifiedTarget> ();

            Action <MacTarget, string, bool> configureTarget = (MacTarget target, string file, bool isNUnitProject) => {
                target.TemplateProjectPath = file;
                target.Harness             = this;
                target.IsNUnitProject      = isNUnitProject;
                target.Execute();
            };

            RootDirectory = Path.GetFullPath(RootDirectory).TrimEnd('/');

            if (AutoConf)
            {
                AutoConfigureMac();
            }

            foreach (var bclTestInfo in MacTestProjects.Where(x => x.BCLInfo != null).Select(x => x.BCLInfo))
            {
                bclTestInfo.Convert();
            }

            foreach (var proj in MacTestProjects.Where((v) => v.GenerateVariations))
            {
                var file = Path.ChangeExtension(proj.Path, "csproj");
                if (!File.Exists(file))
                {
                    throw new FileNotFoundException(file);
                }

                foreach (bool thirtyTwoBit in new bool[] { false, true })
                {
                    if (proj.GenerateModern)
                    {
                        var modern = new MacUnifiedTarget(true, thirtyTwoBit);
                        configureTarget(modern, file, proj.IsNUnitProject);
                        unified_targets.Add(modern);
                    }

                    if (proj.GenerateFull)
                    {
                        var full = new MacUnifiedTarget(false, thirtyTwoBit);
                        configureTarget(full, file, proj.IsNUnitProject);
                        unified_targets.Add(full);
                    }
                }

                if (proj.GenerateSystem)
                {
                    var system = new MacUnifiedTarget(false, false);
                    system.System = true;
                    configureTarget(system, file, proj.IsNUnitProject);
                    unified_targets.Add(system);
                }

                var classic = new MacClassicTarget();
                configureTarget(classic, file, false);
                classic_targets.Add(classic);
            }

            foreach (var proj in MacTestProjects.Where(v => !v.GenerateVariations))
            {
                var file    = proj.Path;
                var unified = new MacUnifiedTarget(proj.GenerateModern, thirtyTwoBit: false, shouldSkipProjectGeneration: true);
                unified.BCLInfo = proj.BCLInfo;
                configureTarget(unified, file, proj.IsNUnitProject);
                hardcoded_unified_targets.Add(unified);
            }

            MakefileGenerator.CreateMacMakefile(this, classic_targets.Union <MacTarget> (unified_targets).Union(hardcoded_unified_targets));
        }
示例#9
0
        int ConfigureIOS()
        {
            var rv = 0;
            var unified_targets = new List <UnifiedTarget> ();
            var tvos_targets    = new List <TVOSTarget> ();
            var watchos_targets = new List <WatchOSTarget> ();
            var today_targets   = new List <TodayExtensionTarget> ();

            RootDirectory = Path.GetFullPath(RootDirectory).TrimEnd('/');

            if (AutoConf)
            {
                AutoConfigureIOS();
            }

            foreach (var bclTestInfo in IOSTestProjects.Where(x => x.BCLInfo != null).Select(x => x.BCLInfo))
            {
                bclTestInfo.Convert();
            }
            foreach (var monoNativeInfo in IOSTestProjects.Where(x => x.MonoNativeInfo != null).Select(x => x.MonoNativeInfo))
            {
                monoNativeInfo.Convert();
            }

            foreach (var proj in IOSTestProjects)
            {
                var file = proj.Path;

                if (proj.MonoNativeInfo != null)
                {
                    file = proj.MonoNativeInfo.TemplatePath;
                }

                if (!File.Exists(file))
                {
                    Console.WriteLine($"Can't find the project file {file}.");
                    rv = 1;
                    continue;
                }

                if (!proj.SkipwatchOSVariation)
                {
                    var watchos = new WatchOSTarget()
                    {
                        TemplateProjectPath = file,
                        Harness             = this,
                        TestProject         = proj,
                    };
                    watchos.Execute();
                    watchos_targets.Add(watchos);
                }

                if (!proj.SkiptvOSVariation)
                {
                    var tvos = new TVOSTarget()
                    {
                        TemplateProjectPath = file,
                        Harness             = this,
                        TestProject         = proj,
                    };
                    tvos.Execute();
                    tvos_targets.Add(tvos);
                }

                if (!proj.SkipiOSVariation)
                {
                    var unified = new UnifiedTarget()
                    {
                        TemplateProjectPath = file,
                        Harness             = this,
                        TestProject         = proj,
                    };
                    unified.Execute();
                    unified_targets.Add(unified);

                    var today = new TodayExtensionTarget {
                        TemplateProjectPath = file,
                        Harness             = this,
                        TestProject         = proj,
                    };
                    today.Execute();
                    today_targets.Add(today);
                }
            }

            SolutionGenerator.CreateSolution(this, watchos_targets, "watchos");
            SolutionGenerator.CreateSolution(this, tvos_targets, "tvos");
            SolutionGenerator.CreateSolution(this, today_targets, "today");
            MakefileGenerator.CreateMakefile(this, unified_targets, tvos_targets, watchos_targets, today_targets);

            return(rv);
        }
示例#10
0
        int AutoConfigureMac(bool generate_projects)
        {
            int rv = 0;

            var test_suites = new [] {
                new { Directory = "apitest", ProjectFile = "apitest", Name = "apitest", Flavors = MacFlavors.Full | MacFlavors.Modern },
                new { Directory = "linker/mac/dont link", ProjectFile = "dont link-mac", Name = "dont link", Flavors = MacFlavors.Modern | MacFlavors.Full | MacFlavors.System },
            };

            foreach (var p in test_suites)
            {
                MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p.Directory, p.ProjectFile + ".csproj")))
                {
                    Name = p.Name,
                    TargetFrameworkFlavors = p.Flavors,
                });
            }

            MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, "introspection", "Mac", "introspection-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern)
            {
                Name = "introspection"
            });

            var hard_coded_test_suites = new [] {
                new { Directory = "mmptest", ProjectFile = "mmptest", Name = "mmptest", IsNUnit = true, Configurations = (string[])null, Platform = "x86", Flavors = MacFlavors.Console, },
                new { Directory = "msbuild-mac", ProjectFile = "msbuild-mac", Name = "MSBuild tests", IsNUnit = true, Configurations = (string[])null, Platform = "x86", Flavors = MacFlavors.Console, },
                new { Directory = "xammac_tests", ProjectFile = "xammac_tests", Name = "xammac tests", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "AnyCPU", Flavors = MacFlavors.Modern, },
                new { Directory = "linker/mac/link all", ProjectFile = "link all-mac", Name = "link all", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", Flavors = MacFlavors.Modern, },
                new { Directory = "linker/mac/link sdk", ProjectFile = "link sdk-mac", Name = "link sdk", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", Flavors = MacFlavors.Modern, },
            };

            foreach (var p in hard_coded_test_suites)
            {
                MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p.Directory, p.ProjectFile + ".csproj")), targetFrameworkFlavor: p.Flavors)
                {
                    Name           = p.Name,
                    IsNUnitProject = p.IsNUnit,
                    SolutionPath   = Path.GetFullPath(Path.Combine(RootDirectory, "tests-mac.sln")),
                    Configurations = p.Configurations,
                    Platform       = p.Platform,
                });
            }

            var bcl_suites = new string[] {
            };

            foreach (var p in bcl_suites)
            {
                var bclTestInfo    = new MacBCLTestInfo(this, p);
                var bclTestProject = new MacTestProject(bclTestInfo.ProjectPath, targetFrameworkFlavor: MacFlavors.Modern | MacFlavors.Full)
                {
                    Name     = p,
                    BCLInfo  = bclTestInfo,
                    Platform = "AnyCPU",
                };

                MacTestProjects.Add(bclTestProject);
            }

            foreach (var flavor in new MonoNativeFlavor [] { MonoNativeFlavor.Compat, MonoNativeFlavor.Unified })
            {
                var monoNativeInfo = new MacMonoNativeInfo(this, flavor);
                var macTestProject = new MacTestProject(monoNativeInfo.ProjectPath, targetFrameworkFlavor: MacFlavors.Modern | MacFlavors.Full)
                {
                    MonoNativeInfo = monoNativeInfo,
                    Name           = monoNativeInfo.ProjectName,
                    Platform       = "AnyCPU",
                };

                MacTestProjects.Add(macTestProject);
            }

            var monoImportTestFactory = new BCLTestImportTargetFactory(this);

            MacTestProjects.AddRange(monoImportTestFactory.GetMacBclTargets());

            // Generate test projects from templates (bcl/mono-native templates)
            if (generate_projects)
            {
                foreach (var bclTestInfo in MacTestProjects.Where(x => x.BCLInfo != null).Select(x => x.BCLInfo))
                {
                    bclTestInfo.Convert();
                }

                foreach (var mtp in MacTestProjects.Where(x => x.MonoNativeInfo != null).Select(x => x.MonoNativeInfo))
                {
                    mtp.Convert();
                }
            }

            // All test projects should be either Modern projects or NUnit/console executables at this point.
            // If we need to generate Full/System variations, we do that here.
            var unified_targets = new List <MacTarget> ();

            Action <MacTarget, string, bool, bool> configureTarget = (MacTarget target, string file, bool isNUnitProject, bool skip_generation) => {
                target.TemplateProjectPath = file;
                target.Harness             = this;
                target.IsNUnitProject      = isNUnitProject;
                if (!generate_projects || skip_generation)
                {
                    target.ShouldSkipProjectGeneration = true;
                }
                target.Execute();
            };

            foreach (var proj in MacTestProjects)
            {
                var target = new MacTarget(MacFlavors.Modern);
                target.MonoNativeInfo = proj.MonoNativeInfo;
                configureTarget(target, proj.Path, proj.IsNUnitProject, true);
                unified_targets.Add(target);
            }

            foreach (var proj in MacTestProjects.Where((v) => v.GenerateVariations).ToArray())
            {
                var file = proj.Path;
                if (!File.Exists(file))
                {
                    Console.WriteLine($"Can't find the project file {file}.");
                    rv = 1;
                    continue;
                }

                // Generate variations if requested
                if (proj.GenerateFull)
                {
                    var target = new MacTarget(MacFlavors.Full);
                    target.MonoNativeInfo = proj.MonoNativeInfo;
                    configureTarget(target, file, proj.IsNUnitProject, false);
                    unified_targets.Add(target);

                    var cloned_project = (MacTestProject)proj.Clone();
                    cloned_project.TargetFrameworkFlavors = MacFlavors.Full;
                    cloned_project.Path = target.ProjectPath;
                    MacTestProjects.Add(cloned_project);
                }

                if (proj.GenerateSystem)
                {
                    var target = new MacTarget(MacFlavors.System);
                    target.MonoNativeInfo = proj.MonoNativeInfo;
                    configureTarget(target, file, proj.IsNUnitProject, false);
                    unified_targets.Add(target);

                    var cloned_project = (MacTestProject)proj.Clone();
                    cloned_project.TargetFrameworkFlavors = MacFlavors.System;
                    cloned_project.Path = target.ProjectPath;
                    MacTestProjects.Add(cloned_project);
                }

                // We're done generating now
                // Re-use the existing TestProject instance instead of creating a new one.
                proj.TargetFrameworkFlavors = MacFlavors.Modern;                 // the default/template flavor is 'Modern'
            }

            if (generate_projects)
            {
                MakefileGenerator.CreateMacMakefile(this, unified_targets);
            }

            return(rv);
        }
示例#11
0
        void ConfigureMac()
        {
            var classic_targets           = new List <MacClassicTarget> ();
            var unified_targets           = new List <MacUnifiedTarget> ();
            var hardcoded_unified_targets = new List <MacUnifiedTarget> ();

            RootDirectory = Path.GetFullPath(RootDirectory).TrimEnd('/');

            if (AutoConf)
            {
                AutoConfigureMac();
            }

            foreach (var proj in MacBclTests)
            {
                proj.Convert(this);
            }

            foreach (var proj in MacTestProjects.Where((v) => v.GenerateVariations))
            {
                var file = proj.Path;
                if (!File.Exists(file))
                {
                    throw new FileNotFoundException(file);
                }

                foreach (bool thirtyTwoBit in new bool[] { false, true })
                {
                    var unifiedMobile = new MacUnifiedTarget(true, thirtyTwoBit)
                    {
                        TemplateProjectPath = file,
                        Harness             = this,
                    };
                    unifiedMobile.Execute();
                    unified_targets.Add(unifiedMobile);

                    if (!proj.SkipXMVariations)
                    {
                        var unifiedXM45 = new MacUnifiedTarget(false, thirtyTwoBit)
                        {
                            TemplateProjectPath = file,
                            Harness             = this,
                        };
                        unifiedXM45.Execute();
                        unified_targets.Add(unifiedXM45);
                    }
                }

                var classic = new MacClassicTarget()
                {
                    TemplateProjectPath = file,
                    Harness             = this,
                };
                classic.Execute();
                classic_targets.Add(classic);
            }

            foreach (var proj in MacTestProjects.Where((v) => !v.GenerateVariations))
            {
                var file          = proj.Path;
                var unifiedMobile = new MacUnifiedTarget(true, false, true)
                {
                    TemplateProjectPath = file,
                    Harness             = this,
                };
                unifiedMobile.Execute();
                hardcoded_unified_targets.Add(unifiedMobile);
            }

            MakefileGenerator.CreateMacMakefile(this, classic_targets.Union <MacTarget> (unified_targets).Union(hardcoded_unified_targets));
        }
示例#12
0
 void IMakefileBlock.Process(MakefileGenerator generator)
 {
     generator.AppendSourceFiles(generator.Project.Framework, true);
     generator.AppendIncludes(generator.Project.Framework, true);
 }