Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
4fbd6b9
Added devcontainer.json to allow remote development.
cgranade Aug 26, 2020
53861ca
Allow bootstrap to support -Verbose.
cgranade Aug 27, 2020
5769ee9
Add and verify manifest.
cgranade Aug 27, 2020
e693f05
Copy documentation generator from runtime.
cgranade Aug 27, 2020
c606d67
Add to solution and pack.
cgranade Aug 27, 2020
b48148e
Add rest of assemblies to manifest.
cgranade Aug 27, 2020
4f30e9f
Fix signing step.
cgranade Aug 27, 2020
a45e74c
Fix paths in documentation generator.
cgranade Aug 27, 2020
a280145
Fix manifest.
cgranade Aug 27, 2020
9b03857
Fix manifest again.
cgranade Aug 27, 2020
f8f5c4a
Fix error in manifest.
cgranade Aug 27, 2020
065ad14
Start supporting deprecated attributes.
cgranade Aug 27, 2020
6fd7c5a
One more manifest fix.
cgranade Aug 27, 2020
89f4e54
Remove dead code.
cgranade Aug 27, 2020
9e4863c
Begin nullable enable for doccomment.
cgranade Aug 27, 2020
4484275
One more manifest fix.
cgranade Aug 27, 2020
342c2fc
Support examples and named items as attributes.
cgranade Aug 27, 2020
3830a57
Add named items to Markdown output as well.
cgranade Aug 27, 2020
b56c07e
Add links to input kinds.
cgranade Aug 27, 2020
9c993f3
Use AttributeUtils.
cgranade Aug 27, 2020
238441a
Pack DocumentationGenerator with dotnet instead of nuget.
cgranade Aug 28, 2020
0592d02
Support adding types to named items.
cgranade Aug 28, 2020
e7ccb63
Use new DocumentationWriter class.
cgranade Sep 1, 2020
e851829
Add nuget.exe to devcontainer.
cgranade Sep 1, 2020
8ade23e
Add properties for new docgen package.
cgranade Sep 3, 2020
280433a
Merge remote-tracking branch 'origin/master' into cgranade/experiment…
cgranade Sep 3, 2020
a32e0bc
Add op, fn md links.
cgranade Sep 3, 2020
b68e1a6
Fix targets XML.
cgranade Sep 3, 2020
9084306
One more XML fix.
cgranade Sep 3, 2020
a96e698
Fix props.
cgranade Sep 4, 2020
5640588
Started work on processing namespace comments.
cgranade Sep 4, 2020
2655b8f
Start writing out namespaces.
cgranade Sep 4, 2020
9674b35
Use new generator by default.
cgranade Sep 4, 2020
ec79473
Allow overriding documentation package ids for metapkgs.
cgranade Sep 4, 2020
9c8ce7d
Fix bug with namespace kind.
cgranade Sep 4, 2020
ebbca8a
Add utility to merge documentation post-build.
cgranade Sep 4, 2020
88f7e2d
Added some more API documentation.
cgranade Sep 4, 2020
c318c62
Fix MSBuild files.
cgranade Sep 4, 2020
376f115
Mix documentation properties.
cgranade Sep 5, 2020
ce0df5b
Merge remote-tracking branch 'origin/master' into cgranade/experiment…
cgranade Sep 8, 2020
25fe5b4
Merge pull request #611 from microsoft/master
Sep 8, 2020
eff09ed
Merge branch 'feature/docgen' into cgranade/experimental/docgen
Sep 8, 2020
ed3433f
Addressing feedback.
cgranade Sep 28, 2020
4ae11e2
Merge branch 'cgranade/experimental/docgen' of https://github.com/mic…
cgranade Sep 28, 2020
7e2455e
Apply suggestions from code review
Oct 8, 2020
02a79e3
Update src/QsCompiler/DocumentationGenerator/DocumentationGenerator.c…
Oct 8, 2020
5a389c9
Update src/QsCompiler/DocumentationGenerator/DocumentationWriter.cs
Oct 8, 2020
e772ffc
Addressing feedback.
cgranade Oct 8, 2020
80e1785
Merge branch 'cgranade/experimental/docgen' of https://github.com/mic…
cgranade Oct 8, 2020
2c6f9a6
Move documentation pipeline components into single folder.
cgranade Oct 8, 2020
738b22c
Misc path fixes.
cgranade Oct 8, 2020
bb8595f
Enforce QsharpDocGenerationMode values.
cgranade Oct 8, 2020
8e179ee
Consolidate with SyntaxTreeToQSharp
cgranade Oct 8, 2020
3b7440d
Document new SDK properties.
cgranade Oct 8, 2020
6d49a2d
Deprecate YAML-based generator entirely.
cgranade Oct 9, 2020
f8340c6
Remove --doc option from compiler.
cgranade Oct 9, 2020
985a24d
Apply style rules, add API documentation comments.
cgranade Oct 9, 2020
dc4d233
Remove unit test used for removed functionality.
cgranade Oct 12, 2020
a644b7e
Apply feedback.
cgranade Oct 14, 2020
d69f366
Merge pull request #594 from microsoft/cgranade/experimental/docgen
Oct 14, 2020
0cd17cb
Turn type parameters to markdown links as well.
cgranade Oct 15, 2020
4a7771e
Propagate package ID to docs correctly.
cgranade Oct 15, 2020
ccdc2f6
Ensure newline before package name.
cgranade Oct 15, 2020
a243954
Merge pull request #678 from microsoft/cgranade/docgen-fixes
Oct 15, 2020
61a1fbd
Quote docs output path in qsc.rsp.
cgranade Oct 15, 2020
cdfc660
Add better diagnostics to DocumentationWriter.
cgranade Oct 15, 2020
66d5c16
Strip comments from syntax blocks.
cgranade Oct 15, 2020
27a84c1
Style and diagnostics fixes.
cgranade Oct 15, 2020
4c65700
Fix #679.
cgranade Oct 15, 2020
502694e
Merge pull request #680 from microsoft/cgranade/docgen-absolute
Oct 15, 2020
a27ebcc
Warn when documenting input or type parameter names that don't exist.
cgranade Oct 15, 2020
6aa06f0
Warn on invalid named items as well.
cgranade Oct 16, 2020
a88cda0
Merge pull request #681 from microsoft/cgranade/warn-on-invalid-names
Oct 16, 2020
dd70aa7
Pack docs summary script as well.
cgranade Oct 16, 2020
5529200
Fix package links and Markdown syntax highlighting.
cgranade Oct 20, 2020
b38620c
Fix UID casings, Markdown links, etc.
cgranade Oct 20, 2020
41c447a
Explicitly denote new-style UIDs.
cgranade Oct 20, 2020
e044df7
Fix documentation summarization tool.
cgranade Oct 20, 2020
b567cef
Adapt unit tests.
cgranade Oct 20, 2020
8b85ec1
One more unit test adaptation.
cgranade Oct 20, 2020
8a71234
-Force on copying summarization tool.
cgranade Oct 20, 2020
b27b366
Guard copying documentation tool on packing docs at all.
cgranade Oct 20, 2020
1af28cf
Merge pull request #691 from microsoft/cgranade/copy-summarize
Oct 20, 2020
38a5b3c
Merge branch 'main' into cgranade/main→docgen
cgranade Oct 21, 2020
302c469
Fix nullability issues from merge.
cgranade Oct 21, 2020
aee997c
Fix nullability merge again.
cgranade Oct 21, 2020
dda49d4
Merge pull request #695 from microsoft/cgranade/main→docgen
Oct 21, 2020
20c3b70
Merge branch 'main' into cgranade/docgen
cgranade Oct 21, 2020
67c2d60
Retriggering build.
cgranade Oct 21, 2020
ee830dd
Merge branch 'main' into cgranade/docgen
Oct 22, 2020
fe6d81b
Retriggering build.
cgranade Oct 22, 2020
0a406f2
Merge branch 'main' into cgranade/docgen
Oct 22, 2020
a2e0ea1
Retriggering build.
cgranade Oct 22, 2020
1efe5e2
Merge branch 'cgranade/docgen' of https://github.com/microsoft/qsharp…
cgranade Oct 22, 2020
08a0581
Mark documentation generation as a private asset.
cgranade Oct 22, 2020
203b129
Fix to allow updateQDKversion.sh to work correctly.
cgranade Oct 22, 2020
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
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-focal

# Mono is required to run pack.ps1, so we install it here.
RUN apt-get -y update && \
apt-get -y install dirmngr gnupg apt-transport-https ca-certificates && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
sh -c 'echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" > /etc/apt/sources.list.d/mono-official-stable.list' && \
apt-get -y update && \
apt-get -y install mono-complete && \
apt-get clean && rm -rf /var/lib/apt/lists/
# We can now get Mono itself.
RUN curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe && \
# Create as alias for nuget
echo "alias nuget=\"mono /usr/local/bin/nuget.exe\"" >> /root/.bash_aliases
21 changes: 21 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Remote Development Container for Visual Studio Code (preview) #

This folder defines a _development container_ for the Quantum Development Kit to get up and running with your development environment for contributing to the Q# compiler.

## What is a Development Container? ##

Visual Studio Code allows for using [Docker](https://docs.microsoft.com/dotnet/standard/microservices-architecture/container-docker-introduction/docker-defined) to quickly define development environments, including all the compilers, command-line tools, libraries, and programming platforms you need to get up and running quickly.
Using the definitions provided in this folder, Visual Studio Code can use Docker to automatically install the correct version of the Quantum Development Kit as well as other software you might want to use with Q#, such as Python and Jupyter Notebook --- all into an isolated container that doesn't affect the rest of the software you have on your system.

Next steps:
- [Visual Studio Code: Developing inside a container](https://code.visualstudio.com/docs/remote/containers)

## Getting Started ##

To use this development container, follow the installation instructions on the [Visual Studio Code site](https://code.visualstudio.com/docs/remote/containers#_installation) to prepare your machine to use development containers such as this one.
Once you have done so, clone the [**microsoft/quantum**](https://github.com/microsoft/quantum) repository and open the folder in Visual Studio Code.
You should be prompted to reopen the folder for remote development in the development container; if not, make sure that you have the right extension installed from above.

Once you follow the prompt, Visual Studio Code will automatically configure your development container by installing the Quantum Development Kit into a new image, including installing the .NET Core SDK, project templates, Jupyter Notebook support, and the Python host package.
This process will take a few moments, but once it's complete, you can then open a new shell as normal in Visual Studio Code; this shell will open a command line in your new development container.
The Q# compiler will then be available in the `/workspace/qsharp-compiler/` folder of your development container, so you can easily build different parts of the compiler by using `dotnet build`.
13 changes: 13 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"dockerFile": "./Dockerfile",
"extensions": [
"ms-dotnettools.csharp",
"Ionide.Ionide-fsharp",
"ms-vscode.powershell",
"quantum.quantum-devkit-vscode",
"ms-vscode.cpptools"
],
"settings": {
"terminal.integrated.shell.linux": "/usr/bin/pwsh"
}
}
21 changes: 18 additions & 3 deletions QsCompiler.sln
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28809.33
Expand All @@ -12,7 +13,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "SyntaxProcessor", "src\QsCo
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TextProcessor", "src\QsCompiler\TextProcessor\TextProcessor.fsproj", "{57F1310F-9210-47A2-AEC5-DE2CF345D754}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentationParser", "src\QsCompiler\DocumentationParser\DocumentationParser.csproj", "{EB06DB1E-2B86-4279-81F9-D39B62B4AE0A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentationParser", "src\Documentation\DocumentationParser\DocumentationParser.csproj", "{EB06DB1E-2B86-4279-81F9-D39B62B4AE0A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LanguageServer", "src\QsCompiler\LanguageServer\LanguageServer.csproj", "{D21C9875-2E84-423B-B2CA-84103661F7E4}"
EndProject
Expand All @@ -24,7 +25,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Core", "src\QsCompiler\Core
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Transformations", "src\QsCompiler\Transformations\Transformations.csproj", "{BA5D3733-09F1-4676-9CAC-99AD9A00AECB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.DocGenerator", "src\QsCompiler\Tests.DocGenerator\Tests.DocGenerator.csproj", "{256A6275-FC7F-42E9-9931-BC6EA6D0F31A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.DocGenerator", "src\Documentation\Tests.DocGenerator\Tests.DocGenerator.csproj", "{256A6275-FC7F-42E9-9931-BC6EA6D0F31A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommandLineTool", "src\QsCompiler\CommandLineTool\CommandLineTool.csproj", "{B15C4786-0D35-4E66-907F-94DA85FD5576}"
EndProject
Expand All @@ -44,7 +45,9 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Optimizations", "src\QsComp
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B4A9484D-31FC-4A27-9E26-4C8DE3E02D77}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library2", "src\QsCompiler\TestTargets\Libraries\Library2\Library2.csproj", "{E7E019AB-42F8-48AB-B80C-D33351F2C96A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library2", "src\QsCompiler\TestTargets\Libraries\Library2\Library2.csproj", "{E7E019AB-42F8-48AB-B80C-D33351F2C96A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentationGenerator", "src\Documentation\DocumentationGenerator\DocumentationGenerator.csproj", "{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -272,6 +275,18 @@ Global
{E7E019AB-42F8-48AB-B80C-D33351F2C96A}.Release|x64.Build.0 = Release|Any CPU
{E7E019AB-42F8-48AB-B80C-D33351F2C96A}.Release|x86.ActiveCfg = Release|Any CPU
{E7E019AB-42F8-48AB-B80C-D33351F2C96A}.Release|x86.Build.0 = Release|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Debug|x64.ActiveCfg = Debug|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Debug|x64.Build.0 = Debug|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Debug|x86.ActiveCfg = Debug|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Debug|x86.Build.0 = Debug|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Release|Any CPU.Build.0 = Release|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Release|x64.ActiveCfg = Release|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Release|x64.Build.0 = Release|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Release|x86.ActiveCfg = Release|Any CPU
{11311F0C-78CA-43A3-9C84-D7EA0AE9748C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 2 additions & 0 deletions bootstrap.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[CmdletBinding()]
param(
[string]
$AssemblyVersion = $Env:ASSEMBLY_VERSION,
Expand Down Expand Up @@ -68,6 +69,7 @@ If ($Env:SEMVER_VERSION -eq $null) { $Env:SEMVER_VERSION ="$SemverVersion" }
If ($Env:VSVSIX_VERSION -eq $null) { $Env:VSVSIX_VERSION ="$VsVsixVersion" }
Write-Host "##vso[task.setvariable variable=VsVsix.Version]$VsVsixVersion"

Write-Host "##[info]Finding NuSpec references..."
Push-Location (Join-Path $PSScriptRoot 'src/QsCompiler/Compiler')
.\FindNuspecReferences.ps1;
Pop-Location
5 changes: 5 additions & 0 deletions build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ if ($Env:ENABLE_VSIX -ne "false") {
Write-Host "##vso[task.logissue type=warning;]VSIX building skipped due to ENABLE_VSIX variable."
}

# NB: In other repos, we check the manifest here. That can cause problems
# in our case, however, as some assemblies are only produced during
# packing and publishing. Thus, as an exception, we verify the manifest
# only in pack.ps1.

if (-not $all_ok) {
throw "Building failed. Check the logs."
exit 1
Expand Down
48 changes: 48 additions & 0 deletions build/manifest.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

#!/usr/bin/env pwsh
#Requires -PSEdition Core

& "$PSScriptRoot/set-env.ps1"

if ($Env:ENABLE_VSIX -ne "false") {
# The language server is only built if either the VS2019 or VS Code extension
# is enabled.
$VsixAssemblies = @(
"./src/QsCompiler/LanguageServer/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/Microsoft.Quantum.QsCompilationManager.dll",
"./src/QsCompiler/LanguageServer/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/Microsoft.Quantum.QsCore.dll",
"./src/QsCompiler/LanguageServer/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/Microsoft.Quantum.QsDataStructures.dll",
"./src/QsCompiler/LanguageServer/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/Microsoft.Quantum.QsLanguageServer.dll",
"./src/QsCompiler/LanguageServer/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/Microsoft.Quantum.QsSyntaxProcessor.dll",
"./src/QsCompiler/LanguageServer/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/Microsoft.Quantum.QsTextProcessor.dll",
"./src/QsCompiler/LanguageServer/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/Microsoft.Quantum.QsTransformations.dll"
);

# The VS2019 extension itself is only built if msbuild is present.
if (Get-Command msbuild -ErrorAction SilentlyContinue) {
$VsixAssemblies += @(
"./src/VisualStudioExtension/QsharpVSIX/bin/$Env:BUILD_CONFIGURATION/Microsoft.Quantum.VisualStudio.Extension.dll"
);
}
} else {
$VsixAssemblies = @();
}


@{
Packages = @(
"Microsoft.Quantum.Compiler",
"Microsoft.Quantum.Compiler.CommandLine",
"Microsoft.Quantum.ProjectTemplates",
"Microsoft.Quantum.Sdk",
"Microsoft.Quantum.DocumentationGenerator"
);
Assemblies = $VsixAssemblies + @(
"./src/Documentation/DocumentationGenerator/bin/$Env:BUILD_CONFIGURATION/netstandard2.1/Microsoft.Quantum.DocumentationGenerator.dll",
"./src/QsCompiler/CommandLineTool/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/Microsoft.Quantum.QsCompiler.dll",
"./src/QsCompiler/CommandLineTool/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/Microsoft.Quantum.QsDocumentationParser.dll",
"./src/QsCompiler/CommandLineTool/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/qsc.dll",
"./src/QuantumSdk/Tools/BuildConfiguration/bin/$Env:BUILD_CONFIGURATION/netcoreapp3.1/publish/Microsoft.Quantum.Sdk.BuildConfiguration.dll"
) | ForEach-Object { Get-Item (Join-Path $PSScriptRoot ".." $_) };
} | Write-Output;
37 changes: 37 additions & 0 deletions build/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,30 @@ function Pack-One() {
}
}

function Pack-Dotnet() {
Param($project, $option1 = "", $option2 = "", $option3 = "")
if ("" -ne "$Env:ASSEMBLY_CONSTANTS") {
$args = @("/property:DefineConstants=$Env:ASSEMBLY_CONSTANTS");
} else {
$args = @();
}
dotnet pack (Join-Path $PSScriptRoot $project) `
-o $Env:NUGET_OUTDIR `
-c $Env:BUILD_CONFIGURATION `
-v detailed `
@args `
/property:Version=$Env:ASSEMBLY_VERSION `
/property:PackageVersion=$Env:NUGET_VERSION `
$option1 `
$option2 `
$option3

if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to pack $project."
$script:all_ok = $False
}
}

##
# Q# Language Server (self-contained)
##
Expand Down Expand Up @@ -213,6 +237,7 @@ Publish-One '../src/QuantumSdk/Tools/BuildConfiguration/BuildConfiguration.cspro

Pack-One '../src/QsCompiler/Compiler/Compiler.csproj' '-IncludeReferencedProjects'
Pack-One '../src/QsCompiler/CommandLineTool/CommandLineTool.csproj' '-IncludeReferencedProjects'
Pack-Dotnet '../src/Documentation/DocumentationGenerator/DocumentationGenerator.csproj'
Pack-One '../src/ProjectTemplates/Microsoft.Quantum.ProjectTemplates.nuspec'
Pack-One '../src/QuantumSdk/QuantumSdk.nuspec'

Expand All @@ -230,6 +255,18 @@ if ($Env:ENABLE_VSIX -ne "false") {
Write-Host "##vso[task.logissue type=warning;]VSIX packing skipped due to ENABLE_VSIX variable."
}

# Copy documentation summarization tool into docs drop.
# Note that we only copy this tool when DOCS_OUTDIR is set (that is, when we're
# collecting docs in a build artifact).
if ("$Env:DOCS_OUTDIR".Trim() -ne "") {
Push-Location (Join-Path $PSScriptRoot "../src/Documentation/Summarizer")
Copy-Item -Path *.py, *.txt -Destination $Env:DOCS_OUTDIR
Pop-Location
}

Write-Host "##[info]Verifying manifest..."
& (Join-Path $PSScriptRoot "manifest.ps1")

if (-not $all_ok) {
throw "Packing failed. Check the logs."
exit 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using Microsoft.CodeAnalysis;
using Microsoft.Quantum.QsCompiler;
using Microsoft.Quantum.QsCompiler.SyntaxTree;

namespace Microsoft.Quantum.Documentation
{
/// <summary>
/// Rewrite step that generates API documentation from documentation
/// comments in the Q# source files being compiled.
/// </summary>
public class DocumentationGeneration : IRewriteStep
{
private readonly List<IRewriteStep.Diagnostic> diagnostics;

/// <summary>
/// Initializes a new instance of the <see cref="DocumentationGeneration"/> class.
/// </summary>
public DocumentationGeneration()
{
this.diagnostics = new List<IRewriteStep.Diagnostic>(); // collects diagnostics that will be displayed to the user
}

/// <inheritdoc/>
public string Name => "DocumentationGeneration";

/// <inheritdoc/>
public int Priority => 0; // only compared within this dll

/// <inheritdoc/>
public IDictionary<string, string?> AssemblyConstants { get; } = new Dictionary<string, string?>();

/// <inheritdoc/>
public IEnumerable<IRewriteStep.Diagnostic> GeneratedDiagnostics => this.diagnostics;

/// <inheritdoc/>
public bool ImplementsPreconditionVerification => true;

/// <inheritdoc/>
public bool ImplementsTransformation => true;

/// <inheritdoc/>
public bool ImplementsPostconditionVerification => false;

/// <inheritdoc/>
public bool PreconditionVerification(QsCompilation compilation)
{
var preconditionPassed = true; // nothing to check
if (preconditionPassed)
{
// Diagnostics with severity Info or lower usually won't be displayed to the user.
// If the severity is Error or Warning the diagnostic is shown to the user like any other compiler diagnostic,
// and if the Source property is set to the absolute path of an existing file,
// the user will be directed to the file when double clicking the diagnostics.
this.diagnostics.Add(new IRewriteStep.Diagnostic
{
Severity = DiagnosticSeverity.Info,
Message = $"Precondition for {this.Name} was {(preconditionPassed ? "satisfied" : "not satisfied")}.",
Stage = IRewriteStep.Stage.PreconditionVerification,
});
}

return preconditionPassed;
}

public bool Transformation(QsCompilation compilation, out QsCompilation transformed)
{
var docProcessor = new ProcessDocComments(
this.AssemblyConstants.TryGetValue("DocsOutputPath", out var path)
? path
: null,
this.AssemblyConstants.TryGetValue("DocsPackageId", out var packageName)
? packageName
: null
);

docProcessor.OnDiagnostic += diagnostic =>
{
this.diagnostics.Add(diagnostic);
};

transformed = docProcessor.OnCompilation(compilation);
return true;
}

public bool PostconditionVerification(QsCompilation compilation) =>
throw new NotImplementedException();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\Common\AssemblyCommon.props" />

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Microsoft.Quantum.DocumentationGenerator</AssemblyName>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<Authors>Microsoft</Authors>
<Description>Experimental documentation generation tool for Q#.</Description>
<PackageName>Microsoft.Quantum.DocumentationGenerator</PackageName>
<PackageReleaseNotes>See: https://docs.microsoft.com/en-us/quantum/relnotes/</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/microsoft/qsharp-compiler</PackageProjectUrl>
<PackageIconUrl>https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png</PackageIconUrl>
<PackageTags>Quantum Q# Qsharp</PackageTags>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\QsCompiler\Compiler\Compiler.csproj" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\Common\DelaySign.cs" Link="Properties\DelaySign.cs" />
</ItemGroup>

<ItemGroup>
<Content Include="DocumentationGenerator.props">
<Pack>true</Pack>
<PackagePath>build\Microsoft.Quantum.DocumentationGenerator.props</PackagePath>
</Content>
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="..\..\Common\stylecop.json" Link="stylecop.json" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<QscRef_Microsoft_Quantum_DocumentationGenerator>
$(MSBuildThisFileDirectory)/../lib/netstandard2.1/Microsoft.Quantum.DocumentationGenerator.dll
</QscRef_Microsoft_Quantum_DocumentationGenerator>
</PropertyGroup>

</Project>
Loading