Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all 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
8 changes: 3 additions & 5 deletions src/AzureClient/EntryPoint/EntryPointGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,13 @@ public IEntryPoint Generate(string operationName, string? executionTarget,
project.SourceFiles.ToArray(),
compilerMetadata.WithAssemblies(workspaceAssemblies.ToArray()),
logger,
Path.Combine(Workspace.CacheFolder, $"__entrypoint{project.CacheDllName}"),
executionTarget,
runtimeCapability));
Path.Combine(Workspace.CacheFolder, $"__entrypoint{project.CacheDllName}")));
}
catch (Exception e)
{
logger.LogError(
"IQS004",
$"Error compiling project {project.ProjectFile} for execution target {executionTarget}: {e.Message}");
$"Error compiling project {project.ProjectFile}: {e.Message}");
}
}

Expand Down Expand Up @@ -153,7 +151,7 @@ public IEntryPoint Generate(string operationName, string? executionTarget,
operationInfo, compilerMetadata, logger, Path.Combine(Workspace.CacheFolder, "__entrypoint__.dll"), executionTarget, runtimeCapability);
if (EntryPointAssemblyInfo == null || logger.HasErrors)
{
Logger?.LogError($"Error compiling entry point for operation {operationName}.");
Logger?.LogError($"Error compiling entry point operation {operationName} for execution target {executionTarget}.");
throw new CompilationErrorsException(logger.Errors.ToArray());
}

Expand Down
14 changes: 6 additions & 8 deletions src/Core/Compiler/CompilerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ public IEnumerable<QsNamespaceElement> IdentifyElements(string source)
/// Each snippet code is wrapped inside the 'SNIPPETS_NAMESPACE' namespace and processed as a file
/// with the same name as the snippet id.
/// </summary>
public AssemblyInfo? BuildSnippets(Snippet[] snippets, CompilerMetadata metadatas, QSharpLogger logger, string dllName, string? executionTarget = null,
RuntimeCapability? runtimeCapability = null)
public AssemblyInfo? BuildSnippets(Snippet[] snippets, CompilerMetadata metadatas, QSharpLogger logger, string dllName)
{
string openStatements = string.Join("", AutoOpenNamespaces.Select(
entry => string.IsNullOrEmpty(entry.Value)
Expand All @@ -189,7 +188,7 @@ string WrapInNamespace(Snippet s) =>
};

warningCodesToIgnore.ForEach(code => logger.WarningCodesToIgnore.Add(code));
var assembly = BuildAssembly(sources, metadatas, logger, dllName, compileAsExecutable: false, executionTarget, runtimeCapability);
var assembly = BuildAssembly(sources, metadatas, logger, dllName, compileAsExecutable: false);
warningCodesToIgnore.ForEach(code => logger.WarningCodesToIgnore.Remove(code));

return assembly;
Expand All @@ -198,18 +197,17 @@ string WrapInNamespace(Snippet s) =>
/// <summary>
/// Builds the corresponding .net core assembly from the code in the given files.
/// </summary>
public AssemblyInfo? BuildFiles(string[] files, CompilerMetadata metadatas, QSharpLogger logger, string dllName, string? executionTarget = null,
RuntimeCapability? runtimeCapability = null)
public AssemblyInfo? BuildFiles(string[] files, CompilerMetadata metadatas, QSharpLogger logger, string dllName)
{
var sources = ProjectManager.LoadSourceFiles(files, d => logger?.Log(d), ex => logger?.Log(ex));
return BuildAssembly(sources, metadatas, logger, dllName, compileAsExecutable: false, executionTarget, runtimeCapability);
return BuildAssembly(sources, metadatas, logger, dllName, compileAsExecutable: false);
}

/// <summary>
/// Builds the corresponding .net core assembly from the Q# syntax tree.
/// </summary>
private AssemblyInfo? BuildAssembly(ImmutableDictionary<Uri, string> sources, CompilerMetadata metadata, QSharpLogger logger, string dllName, bool compileAsExecutable, string? executionTarget,
RuntimeCapability? runtimeCapability = null)
private AssemblyInfo? BuildAssembly(ImmutableDictionary<Uri, string> sources, CompilerMetadata metadata, QSharpLogger logger, string dllName,
bool compileAsExecutable, string? executionTarget = null, RuntimeCapability? runtimeCapability = null)
{
logger.LogDebug($"Compiling the following Q# files: {string.Join(",", sources.Keys.Select(f => f.LocalPath))}");

Expand Down
6 changes: 2 additions & 4 deletions src/Core/Compiler/ICompilerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ AssemblyInfo BuildEntryPoint(OperationInfo operation, CompilerMetadata metadatas
/// <summary>
/// Builds the corresponding .net core assembly from the code in the given Q# Snippets.
/// </summary>
AssemblyInfo BuildSnippets(Snippet[] snippets, CompilerMetadata metadatas, QSharpLogger logger, string dllName, string executionTarget = null,
RuntimeCapability runtimeCapabilities = null);
AssemblyInfo BuildSnippets(Snippet[] snippets, CompilerMetadata metadatas, QSharpLogger logger, string dllName);

/// <summary>
/// Builds the corresponding .net core assembly from the code in the given files.
/// </summary>
AssemblyInfo BuildFiles(string[] files, CompilerMetadata metadatas, QSharpLogger logger, string dllName, string executionTarget = null,
RuntimeCapability runtimeCapability = null);
AssemblyInfo BuildFiles(string[] files, CompilerMetadata metadatas, QSharpLogger logger, string dllName);

/// <summary>
/// Returns the names of all declared callables and types.
Expand Down