Ejemplo n.º 1
0
        private static void HandleGenerateSolution(string mainProjectPath, string binariesPath, IEnumerable <string> additionalProjectsPaths, string output, bool generateEntryProject)
        {
            Project mainProject;

            if (!Project.TryLoadFromFile(mainProjectPath, out mainProject))
            {
                Console.Error.WriteLine("Could not load main project");
                return;
            }

            var additionalProjects = new List <Project>();

            foreach (var additionalProjectPath in additionalProjectsPaths ?? Enumerable.Empty <string>())
            {
                Project additionalProject;
                if (!Project.TryLoadFromFile(additionalProjectPath, out additionalProject))
                {
                    Console.Error.WriteLine("Could not load additional project: {0}", additionalProject);
                    return;
                }
                additionalProjects.Add(additionalProject);
            }

            var solution = SolutionGenerator.Generate(mainProject, generateEntryProject, binariesPath, additionalProjects);

            if (output == null)
            {
                Console.WriteLine(solution);
            }
            else
            {
                solution.Save(output);
                solution.SaveTestsFile(Path.Combine(output, testsFileName));
            }
        }
Ejemplo n.º 2
0
        private static void HandleGenerateSolution(Options options)
        {
            Project mainProject;

            if (!Project.TryLoadFromFile(options.MainProject, out mainProject))
            {
                Console.Error.WriteLine("Could not load main project");
                return;
            }

            var additionalProjects = new List <Project>();

            foreach (var additionalProjectPath in options.AdditionalProjects ?? Enumerable.Empty <string>())
            {
                Project additionalProject;
                if (!Project.TryLoadFromFile(additionalProjectPath, out additionalProject))
                {
                    Console.Error.WriteLine("Could not load additional project: {0}", additionalProject);
                    return;
                }
                additionalProjects.Add(additionalProject);
            }

            var solution = SolutionGenerator.Generate(options.SolutionName, mainProject, options.GenerateEntryProject, options.BinariesDirectory, additionalProjects);

            if (options.OutputDirectory == null)
            {
                Console.WriteLine(solution);
            }
            else
            {
                var configuration = new Configuration(solution, options.RobotTests.Select(x => new RobotTestSuite(x)));
                configuration.Save(options.OutputDirectory);
            }
        }
Ejemplo n.º 3
0
        private static Configuration HandleCustomSolution(Options options)
        {
            var stepManager = new StepManager();
            var pathHelper  = new PathHelper(options.Directories.Select(Path.GetFullPath));

            var uiSelectionStep = new UiStep(pathHelper);
            var robotTestsStep  = new RobotTestsStep("Choose robot tests:", pathHelper);

            stepManager
            .AddStep(uiSelectionStep)
            .AddStep(new ProjectsListStep <CpuCoreProject>("Choose supported architectures:", pathHelper))
            .AddStep(new ProjectsListStep <ExtensionProject>("Choose extensions libraries:", pathHelper))
            .AddStep(new PluginStep("Choose plugins:", pathHelper))
            .AddStep(new ProjectsListStep <TestsProject>("Choose tests:", pathHelper))
            .AddStep(robotTestsStep)
            .AddStep(new ProjectsListStep <UnknownProject>("Choose other projects:", pathHelper))
            .Run();

            if (stepManager.IsCancelled)
            {
                return(null);
            }

            return(new Configuration(
                       SolutionGenerator.Generate(options.SolutionName, uiSelectionStep.UIProject, options.GenerateEntryProject, options.OutputDirectory,
                                                  stepManager.GetSteps <ProjectsListStep>().SelectMany(x => x.AdditionalProjects).Union(uiSelectionStep.UIProject.GetAllReferences())),
                       robotTestsStep.SelectedTests));
        }
Ejemplo n.º 4
0
        private static Solution HandleCustomSolution(string outputPath, bool generateEntryProject, IEnumerable <string> directories)
        {
            var stepManager = new StepManager();
            var pathHelper  = new PathHelper(directories.Select(Path.GetFullPath));

            stepManager.AddStep(new UiStep(pathHelper));
            stepManager.AddStep(new ProjectsListStep <CpuCoreProject>("Choose supported architectures:", pathHelper));
            stepManager.AddStep(new ProjectsListStep <ExtensionProject>("Choose extensions libraries:", pathHelper));
            stepManager.AddStep(new PluginStep("Choose plugins:", pathHelper));
            stepManager.AddStep(new ProjectsListStep <TestsProject>("Choose tests:", pathHelper));
            stepManager.AddStep(new ProjectsListStep <UnknownProject>("Choose other projects:", pathHelper));

            stepManager.Run();
            return(stepManager.IsCancelled ? null
                      : SolutionGenerator.Generate(stepManager.GetStep <UiStep>().UIProject, generateEntryProject, outputPath,
                                                   stepManager.GetSteps <ProjectsListStep>().SelectMany(x => x.AdditionalProjects).Union(stepManager.GetStep <UiStep>().UIProject.GetAllReferences())));
        }
Ejemplo n.º 5
0
        public static Solution GenerateWithAllReferences(UiProject mainProject, bool generateEntryProject, string binariesPath, IEnumerable <Project> extraProjects = null)
        {
            if (extraProjects == null)
            {
                extraProjects = new Project[0];
            }

            var extensionProjects = Scanner.Instance.Projects.OfType <ExtensionProject>();
            var pluginProjects    = Scanner.Instance.Projects.OfType <PluginProject>().Where(x => !x.PluginModes.Any() || x.PluginModes.Contains(mainProject.UiType));

            var projects = extensionProjects
                           .Union(extraProjects)
                           .Union(extraProjects.SelectMany(x => x.GetAllReferences()))
                           .Union(extensionProjects.SelectMany(x => x.GetAllReferences()))
                           .Union(pluginProjects)
                           .Union(pluginProjects.SelectMany(x => x.GetAllReferences())).ToList();

            return(SolutionGenerator.Generate(mainProject, generateEntryProject, binariesPath, projects));
        }