示例#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 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));
        }
示例#3
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);
        }
示例#4
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));
        }