예제 #1
0
        void AutoConfigureIOS()
        {
            var test_suites             = new string [] { "monotouch-test", "framework-test", "interdependent-binding-projects" };
            var library_projects        = new string [] { "BundledResources", "EmbeddedResources", "bindings-test", "bindings-test2", "bindings-framework-test" };
            var fsharp_test_suites      = new string [] { "fsharp" };
            var fsharp_library_projects = new string [] { "fsharplibrary" };

            foreach (var p in test_suites)
            {
                IOSTestProjects.Add(new iOSTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p + "/" + p + ".csproj")))
                {
                    Name = p
                });
            }
            foreach (var p in fsharp_test_suites)
            {
                IOSTestProjects.Add(new iOSTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p + "/" + p + ".fsproj")))
                {
                    Name = p
                });
            }
            foreach (var p in library_projects)
            {
                IOSTestProjects.Add(new iOSTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p + "/" + p + ".csproj")), false)
                {
                    Name = p
                });
            }
            foreach (var p in fsharp_library_projects)
            {
                IOSTestProjects.Add(new iOSTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p + "/" + p + ".fsproj")), false)
                {
                    Name = p
                });
            }

            IOSTestProjects.Add(new iOSTestProject(Path.GetFullPath(Path.Combine(RootDirectory, "introspection", "iOS", "introspection-ios.csproj")))
            {
                Name = "introspection"
            });
            IOSTestProjects.Add(new iOSTestProject(Path.GetFullPath(Path.Combine(RootDirectory, "linker", "ios", "dont link", "dont link.csproj")))
            {
                Configurations = new string [] { "Debug", "Release" }
            });
            IOSTestProjects.Add(new iOSTestProject(Path.GetFullPath(Path.Combine(RootDirectory, "linker", "ios", "link all", "link all.csproj")))
            {
                Configurations = new string [] { "Debug", "Release" }
            });
            IOSTestProjects.Add(new iOSTestProject(Path.GetFullPath(Path.Combine(RootDirectory, "linker", "ios", "link sdk", "link sdk.csproj")))
            {
                Configurations = new string [] { "Debug", "Release" }
            });

            foreach (var flavor in new MonoNativeFlavor[] { MonoNativeFlavor.Compat, MonoNativeFlavor.Unified })
            {
                var monoNativeInfo = new MonoNativeInfo(this, flavor);
                var iosTestProject = new iOSTestProject(monoNativeInfo.ProjectPath)
                {
                    MonoNativeInfo = monoNativeInfo,
                    Name           = monoNativeInfo.ProjectName,
                    SkipwatchOSARM64_32Variation = monoNativeInfo.ProjectName.Contains("compat"),
                };

                IOSTestProjects.Add(iosTestProject);
            }

            // add all the tests that are using the precompiled mono assemblies
            var monoImportTestFactory = new BCLTestImportTargetFactory(this);

            IOSTestProjects.AddRange(monoImportTestFactory.GetiOSBclTargets());

            WatchOSContainerTemplate = Path.GetFullPath(Path.Combine(RootDirectory, "templates/WatchContainer"));
            WatchOSAppTemplate       = Path.GetFullPath(Path.Combine(RootDirectory, "templates/WatchApp"));
            WatchOSExtensionTemplate = Path.GetFullPath(Path.Combine(RootDirectory, "templates/WatchExtension"));

            TodayContainerTemplate    = Path.GetFullPath(Path.Combine(RootDirectory, "templates", "TodayContainer"));
            TodayExtensionTemplate    = Path.GetFullPath(Path.Combine(RootDirectory, "templates", "TodayExtension"));
            BCLTodayExtensionTemplate = Path.GetFullPath(Path.Combine(RootDirectory, "bcl-test", "templates", "today"));
        }
예제 #2
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,
                });
            }

            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 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);
        }