protected Compilation LoadProject(string projectPath, List <SyntaxTree> syntaxTrees, string sourceCode, string sourcePath, out SyntaxTree sourceSyntaxTree)
        {
            //load all syntax trees
            syntaxTrees.Clear();
            this.LoadProjectALFiles(projectPath, syntaxTrees, sourceCode, sourcePath, out sourceSyntaxTree);

            List <Diagnostic> diagnostics = new List <Diagnostic>();

            //load project manifest
            string          projectFile = Path.Combine(projectPath, "app.json");
            ProjectManifest manifest    = ProjectManifest.ReadFromString(projectFile, File.ReadAllText(projectFile), diagnostics);

            //create compilation
            Compilation compilation = Compilation.Create("MyCompilation", manifest.AppManifest.AppPublisher,
                                                         manifest.AppManifest.AppVersion, manifest.AppManifest.AppId,
                                                         null, syntaxTrees,
                                                         new CompilationOptions());

            LocalCacheSymbolReferenceLoader referenceLoader =
                this.SafeCreateLocalCacheSymbolReferenceLoader(Path.Combine(projectPath, ".alpackages"));

            compilation = compilation
                          .WithReferenceLoader(referenceLoader)
                          .WithReferences(manifest.GetAllReferences());

            return(compilation);
        }
コード例 #2
0
        protected void LoadProject()
        {
            this.Logger.WriteInformation("Loading al files...");

            //load all syntax trees
            this.SyntaxTrees = new List <SyntaxTree>();
            this.ALFiles     = new List <ProjectFileInfo>();
            this.LoadProjectALFiles(this.ProjectPath, this.OutputPath);

            List <Diagnostic> diagnostics = new List <Diagnostic>();

            //load project manifest
            string          projectFile = Path.Combine(this.ProjectPath, "app.json");
            ProjectManifest manifest    = ProjectManifest.ReadFromString(projectFile, File.ReadAllText(projectFile), diagnostics);

            this.Logger.WriteInformation("Preparing compilation...");

            //create compilation
            Compilation compilation = Compilation.Create("MyCompilation", manifest.AppManifest.AppPublisher,
                                                         manifest.AppManifest.AppVersion, manifest.AppManifest.AppId,
                                                         null, this.SyntaxTrees,
                                                         new CompilationOptions());

            LocalCacheSymbolReferenceLoader referenceLoader =
                new LocalCacheSymbolReferenceLoader(Path.Combine(this.ProjectPath, ".alpackages"));

            compilation = compilation
                          .WithReferenceLoader(referenceLoader)
                          .WithReferences(manifest.GetAllReferences());

            this.Compilation = compilation;
        }