Exemplo n.º 1
0
        private void LoadProject(string firstSource, string[] args, string outputFolder)
        {
            Console.WriteLine(@"Loading project {0}", Path.GetFileNameWithoutExtension(firstSource));

            var projectLoader = new ProjectLoader(this.Options, args, outputFolder);

            if (!projectLoader.Load(firstSource))
            {
                this.Errors = projectLoader.Errors.ToArray();

                Console.WriteLine(@"Project Errors: {0}", this.Errors.Count());
                foreach (var diagnostic in this.Errors)
                {
                    Console.WriteLine(diagnostic);
                }

                if (projectLoader.Warnings.Any())
                {
                    Console.WriteLine(@"Project Warnings: {0}", projectLoader.Warnings.Count());
                    foreach (var diagnostic in projectLoader.Warnings)
                    {
                        Console.WriteLine(diagnostic);
                    }
                }

                this.Sources    = new string[0];
                this.Impl       = new string[0];
                this.References = new string[0];

                return;
            }

            projectLoader.BuildDependantProjects();

            if (projectLoader.Warnings.Any())
            {
                Console.WriteLine(@"Project Warnings: {0}", projectLoader.Warnings.Count());
                foreach (var diagnostic in projectLoader.Warnings)
                {
                    Console.WriteLine(diagnostic);
                }
            }

            DebugOutput = !this.Options["Configuration"].Contains("Release");

            this.Sources    = projectLoader.Sources.ToArray();
            this.Impl       = projectLoader.Content.Where(c => c.EndsWith(".c") || c.EndsWith(".cpp") || c.EndsWith(".cxx") || c.EndsWith(".h") || c.EndsWith(".hpp") || c.EndsWith(".hxx")).ToArray();
            this.References = projectLoader.References.ToArray();
            if (projectLoader.ReferencesFromRuntime.Any())
            {
                this.CoreLibPath = this.ResolveAssemblyReferense(projectLoader.ReferencesFromRuntime.First());
            }
        }