diff --git a/Simulation.sln b/Simulation.sln
index 2566fb7b457..7886189c882 100644
--- a/Simulation.sln
+++ b/Simulation.sln
@@ -17,11 +17,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulatio
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulation.Common", "src\Simulation\Common\Microsoft.Quantum.Simulation.Common.csproj", "{8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulation.Simulators", "src\Simulation\Simulators\Microsoft.Quantum.Simulation.Simulators.csproj", "{72B7E75C-D305-45BD-929E-C86298AAA8DE}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulators", "src\Simulation\Simulators\Microsoft.Quantum.Simulators.csproj", "{72B7E75C-D305-45BD-929E-C86298AAA8DE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime", "src\Simulation\QCTraceSimulator.Tests\Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj", "{DD50D2D9-2765-449B-8C4B-835A428E160D}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulation.Simulators", "src\Simulation\Simulators.Tests\Tests.Microsoft.Quantum.Simulation.Simulators.csproj", "{23461B29-F9DE-4F5B-BC30-50BBE1A10B48}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulators", "src\Simulation\Simulators.Tests\Tests.Microsoft.Quantum.Simulators.csproj", "{23461B29-F9DE-4F5B-BC30-50BBE1A10B48}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "simulation", "simulation", "{34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4}"
EndProject
@@ -47,9 +47,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProject
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QsharpExe", "src\Simulation\Simulators.Tests\TestProjects\QsharpExe\QsharpExe.csproj", "{2F5796A7-4AF8-4B78-928A-0A3A80752F9D}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntryPointDriver", "src\Simulation\EntryPointDriver\EntryPointDriver.csproj", "{944FE7EF-9220-4CC6-BB20-CE517195B922}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Quantum.EntryPointDriver", "src\Simulation\EntryPointDriver\Microsoft.Quantum.EntryPointDriver.csproj", "{944FE7EF-9220-4CC6-BB20-CE517195B922}"
EndProject
-Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.EntryPointDriver", "src\Simulation\EntryPointDriver.Tests\Tests.EntryPointDriver.fsproj", "{E2F30496-19D8-46A8-9BC0-26936FFE70D2}"
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Tests.Microsoft.Quantum.EntryPointDriver", "src\Simulation\EntryPointDriver.Tests\Tests.Microsoft.Quantum.EntryPointDriver.fsproj", "{E2F30496-19D8-46A8-9BC0-26936FFE70D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library1", "src\Simulation\Simulators.Tests\TestProjects\Library1\Library1.csproj", "{7256B986-6705-42FC-9F57-485D72D9DE51}"
EndProject
diff --git a/build/manifest.ps1 b/build/manifest.ps1
index 07a8fca41f3..29ea070beb7 100644
--- a/build/manifest.ps1
+++ b/build/manifest.ps1
@@ -8,6 +8,7 @@
"Microsoft.Azure.Quantum.Client",
"Microsoft.Quantum.CsharpGeneration",
"Microsoft.Quantum.Development.Kit",
+ "Microsoft.Quantum.EntryPointDriver",
"Microsoft.Quantum.QSharp.Core",
"Microsoft.Quantum.Runtime.Core",
"Microsoft.Quantum.Simulators",
@@ -19,10 +20,11 @@
".\src\simulation\CsharpGeneration.App\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.CsharpGeneration.App.dll",
".\src\simulation\CsharpGeneration.App\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.RoslynWrapper.dll",
".\src\simulation\Core\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Runtime.Core.dll",
+ ".\src\simulation\EntryPointDriver\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.EntryPointDriver.dll",
".\src\simulation\QsharpCore\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QSharp.Core.dll",
".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.Common.dll",
".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll",
- ".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.Simulators.dll",
+ ".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulators.dll",
".\src\Xunit\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Xunit.dll"
) | ForEach-Object { Get-Item (Join-Path $PSScriptRoot (Join-Path ".." $_)) };
-} | Write-Output;
\ No newline at end of file
+} | Write-Output;
diff --git a/build/pack.ps1 b/build/pack.ps1
index b4b39f19e2a..893db2b5728 100644
--- a/build/pack.ps1
+++ b/build/pack.ps1
@@ -61,6 +61,7 @@ function Pack-Dotnet() {
Write-Host "##[info]Using nuget to create packages"
Pack-Dotnet '../src/Azure/Azure.Quantum.Client/Microsoft.Azure.Quantum.Client.csproj'
Pack-One '../src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj' '-IncludeReferencedProjects'
+Pack-Dotnet '../src/Simulation/EntryPointDriver/Microsoft.Quantum.EntryPointDriver.csproj'
Pack-Dotnet '../src/Simulation/Core/Microsoft.Quantum.Runtime.Core.csproj'
Pack-Dotnet '../src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj'
Pack-One '../src/Simulation/Simulators/Microsoft.Quantum.Simulators.nuspec'
diff --git a/src/Simulation/Common/Simulators.Dev.props b/src/Simulation/Common/Simulators.Dev.props
index d459a4b6634..f92092e9568 100644
--- a/src/Simulation/Common/Simulators.Dev.props
+++ b/src/Simulation/Common/Simulators.Dev.props
@@ -28,7 +28,7 @@
-
+
diff --git a/src/Simulation/Core/Properties/AssemblyInfo.cs b/src/Simulation/Core/Properties/AssemblyInfo.cs
index 9781d4c4d84..c2a5d12dced 100644
--- a/src/Simulation/Core/Properties/AssemblyInfo.cs
+++ b/src/Simulation/Core/Properties/AssemblyInfo.cs
@@ -6,4 +6,4 @@
using System.Runtime.InteropServices;
// Allow the test assembly to use our internal methods
-[assembly: InternalsVisibleTo("Tests.Microsoft.Quantum.Simulation.Simulators" + SigningConstants.PUBLIC_KEY)]
+[assembly: InternalsVisibleTo("Tests.Microsoft.Quantum.Simulators" + SigningConstants.PUBLIC_KEY)]
diff --git a/src/Simulation/CsharpGeneration.Tests/Tests.CsharpGeneration.fsproj b/src/Simulation/CsharpGeneration.Tests/Tests.CsharpGeneration.fsproj
index 45d4e5dfe37..906f812078b 100644
--- a/src/Simulation/CsharpGeneration.Tests/Tests.CsharpGeneration.fsproj
+++ b/src/Simulation/CsharpGeneration.Tests/Tests.CsharpGeneration.fsproj
@@ -54,7 +54,7 @@
-
+
diff --git a/src/Simulation/CsharpGeneration/EntryPoint.fs b/src/Simulation/CsharpGeneration/EntryPoint.fs
index b975bf374a8..8906a7403c7 100644
--- a/src/Simulation/CsharpGeneration/EntryPoint.fs
+++ b/src/Simulation/CsharpGeneration/EntryPoint.fs
@@ -24,7 +24,25 @@ type private Parameter =
let entryPointClassName = "__QsEntryPoint__"
/// The namespace containing the non-generated parts of the entry point driver.
-let private driverNamespace = "Microsoft.Quantum.CsharpGeneration.EntryPointDriver"
+let private driverNamespace = "Microsoft.Quantum.EntryPointDriver"
+
+/// The driver settings object.
+let private driverSettings =
+ let newDriverSettings = driverNamespace + ".DriverSettings" |> ``type`` |> SyntaxFactory.ObjectCreationExpression
+ let namedArg (name : string) expr = SyntaxFactory.NameColon name |> (SyntaxFactory.Argument expr).WithNameColon
+ let immutableList elements = invoke (ident "System.Collections.Immutable.ImmutableList.Create") ``(`` elements ``)``
+ let simulatorOptionAliases =
+ [ literal <| "--" + fst CommandLineArguments.SimulatorOption
+ literal <| "-" + snd CommandLineArguments.SimulatorOption ]
+ |> immutableList
+ [ namedArg "simulatorOptionAliases" simulatorOptionAliases
+ namedArg "quantumSimulatorName" <| literal AssemblyConstants.QuantumSimulator
+ namedArg "toffoliSimulatorName" <| literal AssemblyConstants.ToffoliSimulator
+ namedArg "resourcesEstimatorName" <| literal AssemblyConstants.ResourcesEstimator ]
+ |> SyntaxFactory.SeparatedList
+ |> SyntaxFactory.ArgumentList
+ |> newDriverSettings.WithArgumentList
+ :> ExpressionSyntax
/// A sequence of all of the named parameters in the argument tuple and their respective C# and Q# types.
let rec private parameters context doc = function
@@ -104,7 +122,7 @@ let private mainMethod context entryPoint =
let callableName, argTypeName, returnTypeName = callableTypeNames context entryPoint
let driverType = generic (driverNamespace + ".Driver") ``<<`` [callableName; argTypeName; returnTypeName] ``>>``
let entryPointInstance = ``new`` (``type`` entryPointClassName) ``(`` [] ``)``
- let driver = ``new`` driverType ``(`` [entryPointInstance] ``)``
+ let driver = ``new`` driverType ``(`` [driverSettings; entryPointInstance] ``)``
let commandLineArgsName = "args"
arrow_method "System.Threading.Tasks.Task" "Main" ``<<`` [] ``>>``
``(`` [param commandLineArgsName ``of`` (``type`` "string[]")] ``)``
@@ -121,7 +139,7 @@ let private entryPointClass context entryPoint =
context.assemblyConstants.TryGetValue AssemblyConstants.DefaultSimulator
|> snd
|> (fun value -> if String.IsNullOrWhiteSpace value then AssemblyConstants.QuantumSimulator else value)
- let defaultSimulatorProperty = property "DefaultSimulator" "string" (literal defaultSimulator)
+ let defaultSimulatorNameProperty = property "DefaultSimulatorName" "string" (literal defaultSimulator)
let infoProperty =
property "Info"
(sprintf "EntryPointInfo<%s, %s>" argTypeName returnTypeName)
@@ -129,7 +147,7 @@ let private entryPointClass context entryPoint =
let members : MemberDeclarationSyntax list = [
summaryProperty
parameterOptionsProperty parameters
- defaultSimulatorProperty
+ defaultSimulatorNameProperty
infoProperty
customSimulatorFactory defaultSimulator
createArgument context entryPoint
diff --git a/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1 b/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1
index 68d012099af..0c3695812f9 100644
--- a/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1
+++ b/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1
@@ -59,13 +59,6 @@ function Add-PackageReferenceDependencies($ProjectFileName) {
# Add dependencies for the projects included in this NuGet package.
Add-PackageReferenceDependencies 'Microsoft.Quantum.CsharpGeneration.fsproj'
-Add-PackageReferenceDependencies '..\EntryPointDriver\EntryPointDriver.csproj'
-
-# Manually add EntryPointDriver's project references as package references to avoid a build-time dependency cycle.
-# $version$ is replaced with the current package version when the package is built.
-Add-Dependency 'Microsoft.Quantum.Runtime.Core' '$version$'
-Add-Dependency 'Microsoft.Quantum.Simulators' '$version$'
-Add-Dependency 'Microsoft.Azure.Quantum.Client' '$version$'
$nuspec.package.metadata.AppendChild($dependencies)
$nuspec.Save([Path]::Combine((Get-Location), $target))
diff --git a/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.nuspec.template b/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.nuspec.template
index cf3797a7b0a..997341009c3 100644
--- a/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.nuspec.template
+++ b/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.nuspec.template
@@ -23,12 +23,5 @@
-
-
-
-
diff --git a/src/Simulation/EntryPointDriver.Tests/Tests.EntryPointDriver.fsproj b/src/Simulation/EntryPointDriver.Tests/Tests.Microsoft.Quantum.EntryPointDriver.fsproj
similarity index 85%
rename from src/Simulation/EntryPointDriver.Tests/Tests.EntryPointDriver.fsproj
rename to src/Simulation/EntryPointDriver.Tests/Tests.Microsoft.Quantum.EntryPointDriver.fsproj
index 24ea7c82cda..8ab17e90bed 100644
--- a/src/Simulation/EntryPointDriver.Tests/Tests.EntryPointDriver.fsproj
+++ b/src/Simulation/EntryPointDriver.Tests/Tests.Microsoft.Quantum.EntryPointDriver.fsproj
@@ -4,7 +4,7 @@
netcoreapp3.1
false
false
- Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests
+ Microsoft.Quantum.EntryPointDriver.Tests
@@ -29,7 +29,7 @@
-
+
diff --git a/src/Simulation/EntryPointDriver.Tests/Tests.fs b/src/Simulation/EntryPointDriver.Tests/Tests.fs
index 808b4b6b607..57f283a2d73 100644
--- a/src/Simulation/EntryPointDriver.Tests/Tests.fs
+++ b/src/Simulation/EntryPointDriver.Tests/Tests.fs
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-module Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests
+module Microsoft.Quantum.EntryPointDriver.Tests
open System
open System.Collections.Immutable
@@ -33,7 +33,7 @@ let private intrinsicFile = Path.GetFullPath "Intrinsic.qs"
let private testFile = Path.GetFullPath "Tests.qs"
/// The namespace used for the test cases.
-let private testNamespace = "Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests"
+let private testNamespace = "Microsoft.Quantum.EntryPointDriver.Tests"
/// The test case for the given test number.
let private testCase =
@@ -95,12 +95,12 @@ let private compileCsharp (sources : string seq) =
"System.Runtime"
"System.Runtime.Extensions"
"System.Runtime.Numerics"
- "Microsoft.Quantum.CsharpGeneration.EntryPointDriver"
+ "Microsoft.Quantum.EntryPointDriver"
"Microsoft.Quantum.QSharp.Core"
"Microsoft.Quantum.QsDataStructures"
"Microsoft.Quantum.Runtime.Core"
"Microsoft.Quantum.Simulation.Common"
- "Microsoft.Quantum.Simulation.Simulators"
+ "Microsoft.Quantum.Simulators"
]
|> List.map (fun name -> upcast MetadataReference.CreateFromFile (referencedAssembly name))
diff --git a/src/Simulation/EntryPointDriver.Tests/Tests.qs b/src/Simulation/EntryPointDriver.Tests/Tests.qs
index bfe7a467c8d..89ff907bde9 100644
--- a/src/Simulation/EntryPointDriver.Tests/Tests.qs
+++ b/src/Simulation/EntryPointDriver.Tests/Tests.qs
@@ -5,14 +5,14 @@
// No Options
//
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation ReturnUnit() : Unit { }
}
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation ReturnInt() : Int {
return 42;
@@ -21,7 +21,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation ReturnString() : String {
return "Hello, World!";
@@ -34,7 +34,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// Single Option
//
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptInt(n : Int) : Int {
return n;
@@ -43,7 +43,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptBigInt(n : BigInt) : BigInt {
return n;
@@ -52,7 +52,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptDouble(n : Double) : Double {
return n;
@@ -61,7 +61,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptBool(b : Bool) : Bool {
return b;
@@ -70,7 +70,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptPauli(p : Pauli) : Pauli {
return p;
@@ -79,7 +79,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptResult(r : Result) : Result {
return r;
@@ -88,7 +88,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptRange(r : Range) : Range {
return r;
@@ -97,7 +97,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptString(s : String) : String {
return s;
@@ -106,7 +106,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptUnit(u : Unit) : Unit {
return u;
@@ -115,7 +115,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptStringArray(xs : String[]) : String[] {
return xs;
@@ -124,7 +124,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptBigIntArray(bs : BigInt[]) : BigInt[] {
return bs;
@@ -133,7 +133,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptPauliArray(ps : Pauli[]) : Pauli[] {
return ps;
@@ -142,7 +142,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptRangeArray(rs : Range[]) : Range[] {
return rs;
@@ -151,7 +151,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptResultArray(rs : Result[]) : Result[] {
return rs;
@@ -160,7 +160,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation AcceptUnitArray(us : Unit[]) : Unit[] {
return us;
@@ -173,7 +173,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// Multiple Options
//
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation TwoOptions(n : Int, b : Bool) : String {
return $"{n} {b}";
@@ -182,7 +182,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation ThreeOptions(n : Int, b : Bool, xs : String[]) : String {
return $"{n} {b} {xs}";
@@ -195,7 +195,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// Tuples
//
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation RedundantOneTuple((x : Int)) : String {
return $"{x}";
@@ -204,7 +204,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation RedundantTwoTuple((x : Int, y : Int)) : String {
return $"{x} {y}";
@@ -213,7 +213,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation OneTuple(x : Int, (y : Int)) : String {
return $"{x} {y}";
@@ -222,7 +222,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation TwoTuple(x : Int, (y : Int, z : Int)) : String {
return $"{x} {y} {z}";
@@ -235,7 +235,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// Name Conversion
//
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation CamelCase(camelCaseName : String) : String {
return camelCaseName;
@@ -244,7 +244,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation SingleLetter(x : String) : String {
return x;
@@ -257,7 +257,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// Shadowing
//
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation ShadowSimulator(simulator : String) : String {
return simulator;
@@ -266,7 +266,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation ShadowS(s : String) : String {
return s;
@@ -275,7 +275,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation ShadowVersion(version : String) : String {
return version;
@@ -284,7 +284,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation ShadowTarget(target : String) : String {
return target;
@@ -293,7 +293,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// ---
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
@EntryPoint()
operation ShadowShots(shots : Int) : Int {
return shots;
@@ -306,7 +306,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// Simulators
//
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
open Microsoft.Quantum.Intrinsic;
@EntryPoint()
@@ -332,7 +332,7 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
// Help
//
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Tests {
+namespace Microsoft.Quantum.EntryPointDriver.Tests {
/// # Summary
/// This test checks that the entry point documentation appears correctly in the command line help message.
///
diff --git a/src/Simulation/EntryPointDriver/Azure.cs b/src/Simulation/EntryPointDriver/Azure.cs
index 48116911142..86ad79791a3 100644
--- a/src/Simulation/EntryPointDriver/Azure.cs
+++ b/src/Simulation/EntryPointDriver/Azure.cs
@@ -8,9 +8,9 @@
using Microsoft.Azure.Quantum.Exceptions;
using Microsoft.Quantum.Runtime;
using Microsoft.Quantum.Simulation.Common.Exceptions;
-using static Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Driver;
+using static Microsoft.Quantum.EntryPointDriver.Driver;
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver
+namespace Microsoft.Quantum.EntryPointDriver
{
///
/// Provides entry point submission to Azure Quantum.
diff --git a/src/Simulation/EntryPointDriver/Driver.cs b/src/Simulation/EntryPointDriver/Driver.cs
index 36dc8d72c56..daabf992cde 100644
--- a/src/Simulation/EntryPointDriver/Driver.cs
+++ b/src/Simulation/EntryPointDriver/Driver.cs
@@ -2,6 +2,7 @@
// Licensed under the MIT License.
using System;
+using System.Collections.Immutable;
using System.CommandLine;
using System.CommandLine.Builder;
using System.CommandLine.Help;
@@ -11,11 +12,10 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Microsoft.Quantum.QsCompiler.ReservedKeywords;
using Microsoft.Quantum.Simulation.Core;
-using static Microsoft.Quantum.CsharpGeneration.EntryPointDriver.Driver;
+using static Microsoft.Quantum.EntryPointDriver.Driver;
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver
+namespace Microsoft.Quantum.EntryPointDriver
{
///
/// The entry point driver is the entry point for the C# application that executes the Q# entry point.
@@ -25,6 +25,11 @@ namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver
/// The entry point's return type.
public sealed class Driver where TCallable : AbstractCallable, ICallable
{
+ ///
+ /// The driver settings.
+ ///
+ private readonly DriverSettings settings;
+
///
/// The entry point.
///
@@ -38,24 +43,22 @@ public sealed class Driver where TCallable : AbstractCalla
///
/// Creates a new driver for the entry point.
///
+ /// The driver settings.
/// The entry point.
- public Driver(IEntryPoint entryPoint)
+ public Driver(DriverSettings settings, IEntryPoint entryPoint)
{
+ this.settings = settings;
this.entryPoint = entryPoint;
SimulatorOption = new OptionInfo(
- new[]
- {
- "--" + CommandLineArguments.SimulatorOption.Item1,
- "-" + CommandLineArguments.SimulatorOption.Item2
- },
- entryPoint.DefaultSimulator,
+ settings.SimulatorOptionAliases,
+ entryPoint.DefaultSimulatorName,
"The name of the simulator to use.",
suggestions: new[]
{
- AssemblyConstants.QuantumSimulator,
- AssemblyConstants.ToffoliSimulator,
- AssemblyConstants.ResourcesEstimator,
- entryPoint.DefaultSimulator
+ settings.QuantumSimulatorName,
+ settings.ToffoliSimulatorName,
+ settings.ResourcesEstimatorName,
+ entryPoint.DefaultSimulatorName
});
}
@@ -119,28 +122,28 @@ public async Task Run(string[] args)
/// The exit code.
private async Task Simulate(ParseResult parseResult, string simulator) =>
await Simulation.Simulate(
- entryPoint, parseResult, DefaultIfShadowed(SimulatorOption, simulator));
+ settings, entryPoint, parseResult, DefaultIfShadowed(SimulatorOption, simulator));
///
/// Submits the entry point to Azure Quantum.
///
/// The command-line parsing result.
- /// The submission settings.
- private async Task Submit(ParseResult parseResult, AzureSettings settings) =>
+ /// The Azure submission settings.
+ private async Task Submit(ParseResult parseResult, AzureSettings azureSettings) =>
await Azure.Submit(entryPoint, parseResult, new AzureSettings
{
- Target = settings.Target,
- Storage = settings.Storage,
- Subscription = settings.Subscription,
- ResourceGroup = settings.ResourceGroup,
- Workspace = settings.Workspace,
- AadToken = DefaultIfShadowed(AadTokenOption, settings.AadToken),
- BaseUri = DefaultIfShadowed(BaseUriOption, settings.BaseUri),
- JobName = DefaultIfShadowed(JobNameOption, settings.JobName),
- Shots = DefaultIfShadowed(ShotsOption, settings.Shots),
- Output = DefaultIfShadowed(OutputOption, settings.Output),
- DryRun = DefaultIfShadowed(DryRunOption, settings.DryRun),
- Verbose = DefaultIfShadowed(VerboseOption, settings.Verbose)
+ Target = azureSettings.Target,
+ Storage = azureSettings.Storage,
+ Subscription = azureSettings.Subscription,
+ ResourceGroup = azureSettings.ResourceGroup,
+ Workspace = azureSettings.Workspace,
+ AadToken = DefaultIfShadowed(AadTokenOption, azureSettings.AadToken),
+ BaseUri = DefaultIfShadowed(BaseUriOption, azureSettings.BaseUri),
+ JobName = DefaultIfShadowed(JobNameOption, azureSettings.JobName),
+ Shots = DefaultIfShadowed(ShotsOption, azureSettings.Shots),
+ Output = DefaultIfShadowed(OutputOption, azureSettings.Output),
+ DryRun = DefaultIfShadowed(DryRunOption, azureSettings.DryRun),
+ Verbose = DefaultIfShadowed(VerboseOption, azureSettings.Verbose)
});
///
@@ -206,55 +209,55 @@ internal static class Driver
/// The target option.
///
internal static readonly OptionInfo TargetOption = new OptionInfo(
- new[] { "--target" }, "The target device ID.");
+ ImmutableList.Create("--target"), "The target device ID.");
///
/// The storage option.
///
internal static readonly OptionInfo StorageOption = new OptionInfo(
- new[] { "--storage" }, "The storage account connection string.");
-
+ ImmutableList.Create("--storage"), "The storage account connection string.");
+
///
/// The subscription option.
///
internal static readonly OptionInfo SubscriptionOption = new OptionInfo(
- new[] { "--subscription" }, "The subscription ID.");
+ ImmutableList.Create("--subscription"), "The subscription ID.");
///
/// The resource group option.
///
internal static readonly OptionInfo ResourceGroupOption = new OptionInfo(
- new[] { "--resource-group" }, "The resource group name.");
+ ImmutableList.Create("--resource-group"), "The resource group name.");
///
/// The workspace option.
///
internal static readonly OptionInfo WorkspaceOption = new OptionInfo(
- new[] { "--workspace" }, "The workspace name.");
+ ImmutableList.Create("--workspace"), "The workspace name.");
///
/// The AAD token option.
///
internal static readonly OptionInfo AadTokenOption = new OptionInfo(
- new[] { "--aad-token" }, default, "The Azure Active Directory authentication token.");
-
+ ImmutableList.Create("--aad-token"), default, "The Azure Active Directory authentication token.");
+
///
/// The base URI option.
///
internal static readonly OptionInfo BaseUriOption = new OptionInfo(
- new[] { "--base-uri" }, default, "The base URI of the Azure Quantum endpoint.");
+ ImmutableList.Create("--base-uri"), default, "The base URI of the Azure Quantum endpoint.");
///
/// The job name option.
///
internal static readonly OptionInfo JobNameOption = new OptionInfo(
- new[] { "--job-name" }, default, "The name of the submitted job.");
-
+ ImmutableList.Create("--job-name"), default, "The name of the submitted job.");
+
///
/// The shots option.
///
internal static readonly OptionInfo ShotsOption = new OptionInfo(
- new[] { "--shots" },
+ ImmutableList.Create("--shots"),
500,
"The number of times the program is executed on the target machine.",
validator: result =>
@@ -266,7 +269,7 @@ internal static class Driver
/// The output option.
///
internal static readonly OptionInfo OutputOption = new OptionInfo(
- new[] { "--output" },
+ ImmutableList.Create("--output"),
OutputFormat.FriendlyUri,
"The information to show in the output after the job is submitted.");
@@ -274,7 +277,7 @@ internal static class Driver
/// The dry run option.
///
internal static readonly OptionInfo DryRunOption = new OptionInfo(
- new[] { "--dry-run" },
+ ImmutableList.Create("--dry-run"),
false,
"Validate the program and options, but do not submit to Azure Quantum.");
@@ -282,7 +285,7 @@ internal static class Driver
/// The verbose option.
///
internal static readonly OptionInfo VerboseOption = new OptionInfo(
- new[] { "--verbose" }, false, "Show additional information about the submission.");
+ ImmutableList.Create("--verbose"), false, "Show additional information about the submission.");
///
/// Displays a message to the console using the given color and text writer.
@@ -308,7 +311,9 @@ internal sealed class QsHelpBuilder : HelpBuilder
/// Creates a new help builder using the given console.
///
/// The console to use.
- internal QsHelpBuilder(IConsole console) : base(console) { }
+ internal QsHelpBuilder(IConsole console) : base(console)
+ {
+ }
protected override string ArgumentDescriptor(IArgument argument)
{
diff --git a/src/Simulation/EntryPointDriver/DriverSettings.cs b/src/Simulation/EntryPointDriver/DriverSettings.cs
new file mode 100644
index 00000000000..4b513cf50e4
--- /dev/null
+++ b/src/Simulation/EntryPointDriver/DriverSettings.cs
@@ -0,0 +1,49 @@
+using System.Collections.Immutable;
+
+namespace Microsoft.Quantum.EntryPointDriver
+{
+ ///
+ /// Settings for the entry point driver.
+ ///
+ public sealed class DriverSettings
+ {
+ ///
+ /// The aliases for the simulator command-line option.
+ ///
+ internal IImmutableList SimulatorOptionAliases { get; }
+
+ ///
+ /// The name of the quantum simulator.
+ ///
+ internal string QuantumSimulatorName { get; }
+
+ ///
+ /// The name of the Toffoli simulator.
+ ///
+ internal string ToffoliSimulatorName { get; }
+
+ ///
+ /// The name of the resources estimator.
+ ///
+ internal string ResourcesEstimatorName { get; }
+
+ ///
+ /// Creates a new driver settings instance.
+ ///
+ /// The aliases for the simulator command-line option.
+ /// The name of the quantum simulator.
+ /// The name of the Toffoli simulator.
+ /// The name of the resources estimator.
+ public DriverSettings(
+ IImmutableList simulatorOptionAliases,
+ string quantumSimulatorName,
+ string toffoliSimulatorName,
+ string resourcesEstimatorName)
+ {
+ SimulatorOptionAliases = simulatorOptionAliases;
+ QuantumSimulatorName = quantumSimulatorName;
+ ToffoliSimulatorName = toffoliSimulatorName;
+ ResourcesEstimatorName = resourcesEstimatorName;
+ }
+ }
+}
diff --git a/src/Simulation/EntryPointDriver/IEntryPoint.cs b/src/Simulation/EntryPointDriver/IEntryPoint.cs
index 65250d086d3..b06f3e7c016 100644
--- a/src/Simulation/EntryPointDriver/IEntryPoint.cs
+++ b/src/Simulation/EntryPointDriver/IEntryPoint.cs
@@ -7,7 +7,7 @@
using System.CommandLine.Parsing;
using Microsoft.Quantum.Simulation.Core;
-namespace Microsoft.Quantum.CsharpGeneration.EntryPointDriver
+namespace Microsoft.Quantum.EntryPointDriver
{
///
/// The interface between the entry point and the command-line program.
@@ -24,17 +24,17 @@ public interface IEntryPoint
/// The summary from the entry point's documentation comment.
///
string Summary { get; }
-
+
///
/// The command-line options corresponding to the entry point's parameters.
///
IEnumerable
-
diff --git a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.nuspec.template b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.nuspec.template
index 36b266522d6..756eaca2e6b 100644
--- a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.nuspec.template
+++ b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.nuspec.template
@@ -22,6 +22,9 @@
+
+
+
diff --git a/src/Simulation/Simulators/Properties/AssemblyInfo.cs b/src/Simulation/Simulators/Properties/AssemblyInfo.cs
index ed09e5cdc2b..4dc75e0a503 100644
--- a/src/Simulation/Simulators/Properties/AssemblyInfo.cs
+++ b/src/Simulation/Simulators/Properties/AssemblyInfo.cs
@@ -6,4 +6,4 @@
using System.Runtime.InteropServices;
// Allow the test assembly to use our internal methods
-[assembly: InternalsVisibleTo("Tests.Microsoft.Quantum.Simulation.Simulators" + SigningConstants.PUBLIC_KEY)]
\ No newline at end of file
+[assembly: InternalsVisibleTo("Tests.Microsoft.Quantum.Simulators" + SigningConstants.PUBLIC_KEY)]
\ No newline at end of file