Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set intermediate path sooner #74229

Merged
merged 6 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private Project CreateSubmissionProjectNoLock(Solution solution, ProjectId newSu
name: name,
assemblyName: name,
language: languageName,
compilationOutputFilePaths: default,
compilationOutputInfo: default,
checksumAlgorithm: SourceHashAlgorithms.Default,
isSubmission: true),
compilationOptions: compilationOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public MetadataAsSourceGeneratedFileInfo(string rootPath, Workspace sourceWorksp
name: AssemblyIdentity.Name,
assemblyName: AssemblyIdentity.Name,
language: LanguageName,
compilationOutputFilePaths: default,
compilationOutputInfo: default,
checksumAlgorithm: ChecksumAlgorithm),
compilationOptions: compilationOptions,
parseOptions: _parseOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ internal sealed class PdbSourceDocumentMetadataAsSourceFileProvider(
name: $"{assemblyName} ({assemblyVersion})",
assemblyName: assemblyName,
language: languageName,
compilationOutputFilePaths: default,
compilationOutputInfo: default,
checksumAlgorithm: checksumAlgorithm),
compilationOptions: compilationOptions,
parseOptions: parseOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ internal static ProjectInfo CreateMiscellaneousProjectInfoForDocument(
name: FeaturesResources.Miscellaneous_Files,
assemblyName: assemblyName,
language: languageInformation.LanguageName,
compilationOutputFilePaths: default,
compilationOutputInfo: default,
checksumAlgorithm: checksumAlgorithm,
// Miscellaneous files projects are never fully loaded since, by definition, it won't know
// what the full set of information is except when the file is script code.
Expand Down
2 changes: 1 addition & 1 deletion src/Features/Lsif/Generator/CompilerInvocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static async Task<Project> CreateFromInvocationInfoAsync(CompilerInvocati
name: Path.GetFileNameWithoutExtension(invocationInfo.ProjectFilePath),
assemblyName: parsedCommandLine.CompilationName!,
language: languageName,
compilationOutputFilePaths: default,
compilationOutputInfo: default,
checksumAlgorithm: parsedCommandLine.ChecksumAlgorithm,
filePath: invocationInfo.ProjectFilePath,
outputFilePath: parsedCommandLine.OutputFileName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private void CreateProjects(EditScript<SyntaxNode>[] editScripts, AdhocWorkspace
name: "project",
assemblyName: "project",
language: LanguageName,
compilationOutputFilePaths: default,
compilationOutputInfo: default,
filePath: Path.Combine(TempRoot.Root, "project" + ProjectFileExtension),
checksumAlgorithm: SourceHashAlgorithms.Default));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,12 @@ private async Task<bool> LoadOrReloadProjectAsync(ProjectToLoad projectToLoad, T
else
{
var projectSystemName = $"{projectPath} (${loadedProjectInfo.TargetFramework})";
var projectCreationInfo = new ProjectSystemProjectCreationInfo { AssemblyName = projectSystemName, FilePath = projectPath };
var projectCreationInfo = new ProjectSystemProjectCreationInfo
{
AssemblyName = projectSystemName,
FilePath = projectPath,
CompilationOutputAssemblyFilePath = loadedProjectInfo.IntermediateOutputFilePath
};

var projectSystemProject = await _workspaceFactory.ProjectSystemProjectFactory.CreateAndAddToWorkspaceAsync(
projectSystemName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public void Dispose()
_projectSystemProject.DisplayName = projectDisplayName;
_projectSystemProject.OutputFilePath = newProjectInfo.OutputFilePath;
_projectSystemProject.OutputRefFilePath = newProjectInfo.OutputRefFilePath;
_projectSystemProject.CompilationOutputAssemblyFilePath = newProjectInfo.IntermediateOutputFilePath;

if (newProjectInfo.TargetFrameworkIdentifier != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ public async Task SetBuildSystemPropertiesAsync(IReadOnlyDictionary<string, stri
}
}

// Workaround for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1830960
_project.CompilationOutputAssemblyFilePath = _project.OutputFilePath;
_project.CompilationOutputAssemblyFilePath = _project.CompilationOutputAssemblyFilePath;

string? GetFullyQualifiedPath(string? propertyValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private static ProjectInfo CreateProjectInfo(string projectName, string language
name: projectName,
assemblyName: projectName,
language,
compilationOutputFilePaths: default,
compilationOutputInfo: default,
checksumAlgorithm),
documents: docInfos);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ private Document AddDocumentToProject(string filePath, string language, string p
name: projectName,
assemblyName: projectName,
language,
compilationOutputFilePaths: default,
compilationOutputInfo: default,
checksumAlgorithm: SourceHashAlgorithms.Default));

OnProjectAdded(projectInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private Task<ProjectInfo> CreateProjectInfoAsync(ProjectFileInfo projectFileInfo
name: projectName,
assemblyName: assemblyName,
language: language,
compilationOutputFilePaths: new CompilationOutputInfo(projectFileInfo.IntermediateOutputFilePath),
compilationOutputInfo: new CompilationOutputInfo(projectFileInfo.IntermediateOutputFilePath),
checksumAlgorithm: SourceHashAlgorithms.Default,
filePath: projectPath),
compilationOptions: compilationOptions,
Expand Down Expand Up @@ -370,7 +370,7 @@ private Task<ProjectInfo> CreateProjectInfoAsync(ProjectFileInfo projectFileInfo
projectName,
assemblyName,
language,
compilationOutputFilePaths: new CompilationOutputInfo(projectFileInfo.IntermediateOutputFilePath),
compilationOutputInfo: new CompilationOutputInfo(projectFileInfo.IntermediateOutputFilePath),
checksumAlgorithm: commandLineArgs.ChecksumAlgorithm,
filePath: projectPath,
outputFilePath: projectFileInfo.OutputFilePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static ProjectInfo CreateProjectInfo(string projectName, string language,
name: projectName,
assemblyName: assemblyName,
language: language,
compilationOutputFilePaths: new CompilationOutputInfo(commandLineArguments.OutputFileName != null ? commandLineArguments.GetOutputFilePath(commandLineArguments.OutputFileName) : null),
compilationOutputInfo: new CompilationOutputInfo(commandLineArguments.OutputFileName != null ? commandLineArguments.GetOutputFilePath(commandLineArguments.OutputFileName) : null),
checksumAlgorithm: commandLineArguments.ChecksumAlgorithm),
compilationOptions: commandLineArguments.CompilationOptions
.WithXmlReferenceResolver(xmlFileResolver)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ internal ProjectSystemProject(
string assemblyName,
CompilationOptions? compilationOptions,
string? filePath,
ParseOptions? parseOptions)
ParseOptions? parseOptions,
string? compilationOutputAssemblyFilePath)
{
_projectSystemProjectFactory = projectSystemProjectFactory;
_hostInfo = hostInfo;
Expand Down Expand Up @@ -196,6 +197,7 @@ internal ProjectSystemProject(
_compilationOptions = compilationOptions;
_filePath = filePath;
_parseOptions = parseOptions;
_compilationOutputAssemblyFilePath = compilationOutputAssemblyFilePath;

var watchedDirectories = GetWatchedDirectories(language, filePath);
_documentFileChangeContext = _projectSystemProjectFactory.FileChangeWatcher.CreateContext(watchedDirectories);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ internal class ProjectSystemProjectCreationInfo
public CompilationOptions? CompilationOptions { get; set; }
public string? FilePath { get; set; }
public ParseOptions? ParseOptions { get; set; }
public string? CompilationOutputAssemblyFilePath { get; set; }

public Guid TelemetryId { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public async Task<ProjectSystemProject> CreateAndAddToWorkspaceAsync(string proj
assemblyName,
creationInfo.CompilationOptions,
creationInfo.FilePath,
creationInfo.ParseOptions);
creationInfo.ParseOptions,
creationInfo.CompilationOutputAssemblyFilePath);

var versionStamp = creationInfo.FilePath != null
? VersionStamp.Create(File.GetLastWriteTimeUtc(creationInfo.FilePath))
Expand All @@ -107,7 +108,7 @@ public async Task<ProjectSystemProject> CreateAndAddToWorkspaceAsync(string proj
name: projectSystemName,
assemblyName,
language,
compilationOutputFilePaths: default, // will be updated when command line is set
compilationOutputInfo: new(creationInfo.CompilationOutputAssemblyFilePath), // will be updated when command line is set
SourceHashAlgorithms.Default, // will be updated when command line is set
filePath: creationInfo.FilePath,
telemetryId: creationInfo.TelemetryId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static ProjectInfo Create(
name ?? throw new ArgumentNullException(nameof(name)),
assemblyName ?? throw new ArgumentNullException(nameof(assemblyName)),
language ?? throw new ArgumentNullException(nameof(language)),
compilationOutputFilePaths: default,
compilationOutputInfo: default,
checksumAlgorithm: SourceHashAlgorithm.Sha1,
defaultNamespace: null,
filePath: filePath,
Expand Down Expand Up @@ -401,7 +401,7 @@ internal sealed class ProjectAttributes(
string name,
string assemblyName,
string language,
CompilationOutputInfo compilationOutputFilePaths,
CompilationOutputInfo compilationOutputInfo,
SourceHashAlgorithm checksumAlgorithm,
string? defaultNamespace = null,
string? filePath = null,
Expand Down Expand Up @@ -460,7 +460,7 @@ internal sealed class ProjectAttributes(
/// <summary>
/// Paths to the compiler output files.
/// </summary>
public CompilationOutputInfo CompilationOutputInfo { get; } = compilationOutputFilePaths;
public CompilationOutputInfo CompilationOutputInfo { get; } = compilationOutputInfo;

/// <summary>
/// The default namespace of the project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public ProjectInfo ToProjectInfo()
name: Name,
assemblyName: AssemblyName,
language: Language,
compilationOutputFilePaths: default,
compilationOutputInfo: default,
checksumAlgorithm: Text.SourceHashAlgorithms.Default,
defaultNamespace: DefaultNamespace,
filePath: FilePath,
Expand Down
Loading