diff --git a/bootstrap.cmd b/bootstrap.cmd
index bceffe8091f..a7b49e63c01 100644
--- a/bootstrap.cmd
+++ b/bootstrap.cmd
@@ -12,9 +12,6 @@ git --version || GOTO missingGit
:: Initialize C++ runtime project
CALL :runtimeBootstrap || EXIT /B 1
-:: Initialize the compiler's nuspec file
-CALL :nuspecBootstrap || EXIT /B 1
-
:: Next steps are only needed for developers environment, they are skipped for cloud builds.
IF NOT "%AGENT_ID%" == "" GOTO EOF
@@ -33,17 +30,6 @@ popd
EXIT /B
-:: Bootstrap the compiler nuspec
-:nuspecBootstrap
-pushd src\Simulation\CsharpGeneration
-CALL powershell -NoProfile .\FindNuspecReferences.ps1 || EXIT /B 1
-popd
-
-pushd src\Simulation\Simulators
-CALL powershell -NoProfile .\FindNuspecReferences.ps1 || EXIT /B 1
-popd
-EXIT /B
-
:missingGit
echo.
echo This script depends on git.
diff --git a/bootstrap.ps1 b/bootstrap.ps1
new file mode 100644
index 00000000000..861a83f3f34
--- /dev/null
+++ b/bootstrap.ps1
@@ -0,0 +1,24 @@
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License.
+
+$ErrorActionPreference = 'Stop'
+
+Push-Location (Join-Path $PSScriptRoot "src/Simulation/CsharpGeneration")
+ .\FindNuspecReferences.ps1
+Pop-Location
+
+Push-Location (Join-Path $PSScriptRoot "src/Simulation/Simulators")
+ .\FindNuspecReferences.ps1
+Pop-Location
+
+# bootstrap native folder
+if ($Env:ENABLE_NATIVE -ne "false") {
+ ## Run the right script based on the OS.
+ if (-not (Test-Path Env:AGENT_OS) -or ($Env:AGENT_OS.StartsWith("Win"))) {
+ .\bootstrap.cmd
+ } else {
+ .\bootstrap.sh
+ }
+} else {
+ Write-Host "Skipping native. ENABLE_NATIVE variable set to: $Env:ENABLE_NATIVE."
+}
\ No newline at end of file
diff --git a/build/build.ps1 b/build/build.ps1
index 524c0895aa8..73bfd351d01 100644
--- a/build/build.ps1
+++ b/build/build.ps1
@@ -6,14 +6,18 @@ $ErrorActionPreference = 'Stop'
& "$PSScriptRoot/set-env.ps1"
$all_ok = $True
-Write-Host "##[info]Build Native simulator"
-cmake --build (Join-Path $PSScriptRoot "../src/Simulation/Native/build") --config $Env:BUILD_CONFIGURATION
-if ($LastExitCode -ne 0) {
- Write-Host "##vso[task.logissue type=error;]Failed to build Native simulator."
- $script:all_ok = $False
+if ($Env:ENABLE_NATIVE -ne "false") {
+ Write-Host "##[info]Build Native simulator"
+ $nativeBuild = (Join-Path $PSScriptRoot "../src/Simulation/Native/build")
+ cmake --build $nativeBuild --config $Env:BUILD_CONFIGURATION
+ if ($LastExitCode -ne 0) {
+ Write-Host "##vso[task.logissue type=error;]Failed to build Native simulator."
+ $script:all_ok = $False
+ }
+} else {
+ Write-Host "Skipping native. ENABLE_NATIVE variable set to: $Env:ENABLE_NATIVE."
}
-
function Build-One {
param(
[string]$action,
diff --git a/build/ci.yml b/build/ci.yml
index dc1942468d3..b274f861d26 100644
--- a/build/ci.yml
+++ b/build/ci.yml
@@ -9,34 +9,22 @@ variables:
Drop.Native: $(System.DefaultWorkingDirectory)/xplat
jobs:
-- job: macOS
- pool:
- vmImage: 'macOS-latest'
- steps:
- - template: steps-xplat.yml
-
+- job: build
+ displayName: Build
+ strategy:
+ matrix:
+ linux:
+ imageName: 'ubuntu-latest'
+ mac:
+ imageName: 'macOS-latest'
+ windows:
+ imageName: 'windows-latest'
+ pool:
+ vmImage: $(imageName)
-- job: Linux
- pool:
- vmImage: 'ubuntu-latest'
steps:
- - template: steps-xplat.yml
-
-
-- job: Windows
- pool:
- vmImage: 'windows-2019'
- dependsOn:
- - macOS
- - Linux
- condition: succeeded()
- steps:
- - task: DownloadBuildArtifacts@0
- displayName: 'Download xplat native binaries'
- inputs:
- artifactName: xplat
- downloadPath: $(System.DefaultWorkingDirectory)
- template: steps.yml
+
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
inputs:
diff --git a/build/manifest.ps1 b/build/manifest.ps1
index 29ea070beb7..147f234a98c 100644
--- a/build/manifest.ps1
+++ b/build/manifest.ps1
@@ -16,15 +16,15 @@
);
Assemblies = @(
".\src\Azure\Azure.Quantum.Client\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Azure.Quantum.Client.dll",
- ".\src\simulation\CsharpGeneration\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.CsharpGeneration.dll",
- ".\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.Simulators.dll",
+ ".\src\Simulation\CsharpGeneration\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.CsharpGeneration.dll",
+ ".\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.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;
diff --git a/build/steps-init.yml b/build/steps-init.yml
index 6c5d681bae7..694ba89302a 100644
--- a/build/steps-init.yml
+++ b/build/steps-init.yml
@@ -18,8 +18,6 @@ steps:
##
# Bootstrap
##
-- task: BatchScript@1
- displayName: 'Prepare build'
- inputs:
- filename: bootstrap.cmd
- modifyEnvironment: true
+- pwsh: ./bootstrap.ps1
+ displayName: "Bootstrap repository"
+ workingDirectory: $(System.DefaultWorkingDirectory)
diff --git a/build/steps-wrap-up.yml b/build/steps-wrap-up.yml
index fb36f7194b8..9cf3a9957fc 100644
--- a/build/steps-wrap-up.yml
+++ b/build/steps-wrap-up.yml
@@ -12,7 +12,8 @@ steps:
testRunTitle: 'Q# runtime tests'
- task: PublishSymbols@1
- displayName: 'Publish symbols'
+ displayName: 'Publish symbols (Windows only)'
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
continueOnError: true
inputs:
SearchPattern: '$(System.DefaultWorkingDirectory)/src/**/*.pdb'
diff --git a/build/steps-xplat.yml b/build/steps-xplat.yml
deleted file mode 100644
index 0af6e6d1300..00000000000
--- a/build/steps-xplat.yml
+++ /dev/null
@@ -1,50 +0,0 @@
-##
-# xplat Native Simulator build
-##
-steps:
-
-- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 3.1.100'
- inputs:
- packageType: sdk
- version: '3.1.100'
-
-
-- bash: ./bootstrap.sh
- displayName: "Bootstrap repository"
- workingDirectory: $(System.DefaultWorkingDirectory)
-
-
-- powershell: ./build.ps1
- displayName: "Building Q# runtime"
- workingDirectory: $(System.DefaultWorkingDirectory)/build
-
-
-- powershell: ./test.ps1
- displayName: "Testing Q# runtime"
- workingDirectory: $(System.DefaultWorkingDirectory)/build
- condition: and(succeeded(), ne(variables['Skip.Tests'], 'true'))
-
-
-- task: CopyFiles@2
- displayName: 'Copy Files to: artifact staging directory'
- inputs:
- SourceFolder: '$(System.DefaultWorkingDirectory)'
- Contents: 'src/Simulation/Native/build/**'
- TargetFolder: '$(Build.ArtifactStagingDirectory)'
-
-
-- task: PublishTestResults@2
- displayName: 'Publish tests results'
- condition: succeededOrFailed()
- inputs:
- testResultsFormat: VSTest
- testResultsFiles: '$(System.DefaultWorkingDirectory)/**/*.trx'
- testRunTitle: 'Q# xplat runtime tests'
-
-
-- task: PublishBuildArtifacts@1
- displayName: 'Publish Artifact: xplat'
- inputs:
- PathtoPublish: '$(Build.ArtifactStagingDirectory)'
- artifactName: xplat
diff --git a/build/steps.yml b/build/steps.yml
index 3b45dddd9eb..87da999f9e3 100644
--- a/build/steps.yml
+++ b/build/steps.yml
@@ -23,7 +23,8 @@ steps:
- powershell: ./pack.ps1
- displayName: "Pack Q# runtime"
+ displayName: "Pack Q# runtime (Windows only)"
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
workingDirectory: $(System.DefaultWorkingDirectory)/build
diff --git a/build/test.ps1 b/build/test.ps1
index f66c42e0ad1..09e0e49fb9f 100644
--- a/build/test.ps1
+++ b/build/test.ps1
@@ -4,16 +4,19 @@
& "$PSScriptRoot/set-env.ps1"
$all_ok = $True
-Write-Host "##[info]Test Native simulator"
-pushd (Join-Path $PSScriptRoot "../src/Simulation/Native/build")
-cmake --build . --config $Env:BUILD_CONFIGURATION
-ctest -C $Env:BUILD_CONFIGURATION
-if ($LastExitCode -ne 0) {
- Write-Host "##vso[task.logissue type=error;]Failed to test Native Simulator"
- $script:all_ok = $False
+if ($Env:ENABLE_NATIVE -ne "false") {
+ Write-Host "##[info]Test Native simulator"
+ pushd (Join-Path $PSScriptRoot "../src/Simulation/Native/build")
+ cmake --build . --config $Env:BUILD_CONFIGURATION
+ ctest -C $Env:BUILD_CONFIGURATION
+ if ($LastExitCode -ne 0) {
+ Write-Host "##vso[task.logissue type=error;]Failed to test Native Simulator"
+ $script:all_ok = $False
+ }
+ popd
+} else {
+ Write-Host "Skipping native. ENABLE_NATIVE variable set to: $Env:ENABLE_NATIVE."
}
-popd
-
function Test-One {
Param($project)
diff --git a/src/Simulation/Common/Simulators.Dev.props b/src/Simulation/Common/Simulators.Dev.props
index 2c93b5ab65e..7c44b437a38 100644
--- a/src/Simulation/Common/Simulators.Dev.props
+++ b/src/Simulation/Common/Simulators.Dev.props
@@ -5,14 +5,17 @@
bin\$(BuildConfiguration)\$(TargetFramework)\$(AssemblyName).xml
$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory)..\..\..\))
$([MSBuild]::NormalizePath($(EnlistmentRoot)src/Simulation/Native/build/))
+
+
+
$([MSBuild]::NormalizePath($(NativeBuildPath)/libMicrosoft.Quantum.Simulator.Runtime.dylib))
$([MSBuild]::NormalizePath($(NativeBuildPath)/libMicrosoft.Quantum.Simulator.Runtime.so))
$([MSBuild]::NormalizePath($(NativeBuildPath)/Release/Microsoft.Quantum.Simulator.Runtime.dll))
$([MSBuild]::NormalizePath($(NativeBuildPath)/Debug/Microsoft.Quantum.Simulator.Runtime.dll))
- $(QsimDllMac)
- $(QsimDllLinux)
- $(QsimDllWindowsRelease)
- $(QsimDllWindowsDebug)
+ $(QsimDllMac)
+ $(QsimDllLinux)
+ $(QsimDllWindowsRelease)
+ $(QsimDllWindowsDebug)
@@ -23,6 +26,14 @@
+
+
+ Microsoft.Quantum.Simulator.Runtime.dll
+ PreserveNewest
+ false
+
+
+
diff --git a/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1 b/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1
index 0c3695812f9..f669dac1860 100644
--- a/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1
+++ b/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1
@@ -21,13 +21,13 @@
using namespace System.IO
-$target = 'Microsoft.Quantum.CsharpGeneration.nuspec'
+$target = Join-Path $PSScriptRoot 'Microsoft.Quantum.CsharpGeneration.nuspec'
if (Test-Path $target) {
Write-Host "$target exists. Skipping generating new one."
exit
}
-$nuspec = [Xml](Get-Content 'Microsoft.Quantum.CsharpGeneration.nuspec.template')
+$nuspec = [Xml](Get-Content (Join-Path $PSScriptRoot 'Microsoft.Quantum.CsharpGeneration.nuspec.template'))
$dependencies = $nuspec.CreateElement('dependencies', $nuspec.package.metadata.NamespaceURI)
# Adds a dependency to the dependencies element if it does not already exist.
diff --git a/src/Simulation/Simulators/FindNuspecReferences.ps1 b/src/Simulation/Simulators/FindNuspecReferences.ps1
index a1fd46b8f2b..993f4b0948e 100644
--- a/src/Simulation/Simulators/FindNuspecReferences.ps1
+++ b/src/Simulation/Simulators/FindNuspecReferences.ps1
@@ -19,7 +19,7 @@
# nuget is tracking this problem at: https://github.com/NuGet/Home/issues/4491
########################################
-$target = "Microsoft.Quantum.Simulators.nuspec"
+$target = Join-Path $PSScriptRoot "Microsoft.Quantum.Simulators.nuspec"
if (Test-Path $target) {
Write-Host "$target exists. Skipping generating new one."
@@ -28,7 +28,7 @@ if (Test-Path $target) {
# Start with the nuspec template
-$nuspec = [xml](Get-Content "Microsoft.Quantum.Simulators.nuspec.template")
+$nuspec = [xml](Get-Content (Join-Path $PSScriptRoot "Microsoft.Quantum.Simulators.nuspec.template"))
$dep = $nuspec.CreateElement('dependencies', $nuspec.package.metadata.NamespaceURI)
function Add-PackageReferenceIfNew($ref)
diff --git a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj
index 50eef571a8b..98541863364 100644
--- a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj
+++ b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj
@@ -25,12 +25,6 @@
-
- Microsoft.Quantum.Simulator.Runtime.dll
- PreserveNewest
- false
-
-
runtimes\win-x64\native\%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest