Beispiel #1
0
 public override void RefreshPerBuildCompilerParameters()
 {
     Cci.CompilerOptions options = this.scProject.CompilerParameters as Cci.CompilerOptions;
     if (options != null && this.BuildSite != null)
     {
         options.Site = new Microsoft.VisualStudio.IntegrationHelper.BuildSiteAdaptor(this.BuildSite);
     }
 }
Beispiel #2
0
 public virtual Project GetCompilerProject(XmlElement config, Cci.ErrorNodeList errors)
 {
     if (config == null)
     {
         return(null);
     }
     lock (ProjectManager.BuildLock){
         Project project = this.scProject;
         if (project == null)
         {
             Debug.Assert(false); return(null);
         }
         bool refresh = this.LastModifiedTime != project.LastModifiedTime || this.lastConfig != config;
         if (!refresh)
         {
             Debug.Assert(project.CompilerParameters != null);
             this.RefreshPerBuildCompilerParameters();
             return(project);
         }
         Cci.Compilation compilation = project.Compilation = this.compiler.CreateCompilation(null, null, null, null);
         this.compiler.CurrentCompilation = compilation;
         project.LastModifiedTime         = this.LastModifiedTime;
         Microsoft.VisualStudio.Package.ProjectOptions vscOptions = this.GetProjectOptions(config);
         Cci.CompilerOptions options = this.GetCompilerOptions(vscOptions);
         if (options == null)
         {
             Debug.Assert(false); return(null);
         }
         project.CompilerParameters = options;
         string         dir       = this.ProjectFolder;
         XmlDocument    doc       = this.projFile;
         Cci.StringList fileNames = new Cci.StringList();
         Cci.CompilationUnitSnippetList cuSnippets = new Cci.CompilationUnitSnippetList();
         Cci.CompilationUnitList        cUnits     = new Cci.CompilationUnitList();
         foreach (XmlElement e in doc.SelectNodes("//Files/Include/File"))
         {
             if (e == null)
             {
                 continue;
             }
             string relpath = e.GetAttribute("RelPath");
             string file    = Path.Combine(dir, relpath);
             Cci.CompilationUnitSnippet snippet = null;
             int key = Cci.Identifier.For(file).UniqueIdKey;
             if (!File.Exists(file))
             {
                 errors.Add(this.compiler.CreateErrorNode(Cci.Error.NoSuchFile, file));
                 continue;
             }
             snippet = this.GetCompilationUnitSnippetFor(file, e.GetAttribute("BuildAction"));
             if (snippet == null)
             {
                 continue;
             }
             fileNames.Add(file);
             cuSnippets.Add(snippet);
             cUnits.Add(snippet);
             snippet.Compilation = compilation;
         }
         project.CompilationUnitSnippets    = cuSnippets;
         project.FullPathsToSources         = fileNames;
         compilation.CompilationUnits       = cUnits;
         compilation.CompilerParameters     = options;
         compilation.ReferencedCompilations = this.GetReferencedCompilations(config, errors);
         this.compiler.ConstructSymbolTable(compilation, errors);
         this.compiler.CurrentCompilation = null;
         return(project);
     }
 }