-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update pipeline to run sample projects; add multi file sample (#1040)
This PR updates our samples build stage in the pipeline to accept projects. We detect if a sample is a project in `build.py` and execute the correct `qsc` command accordingly. Additionally, this PR adds a new command line flag to `qsc` and `qsi`: `--qsharp-json`. This flag allows the user to specify a path to a `qsharp.json` to compile a project via the command line. Previously, the only way to compile a project via the command line was to `cd` into it.
- Loading branch information
Showing
7 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// # Sample | ||
/// Multi File Project | ||
/// | ||
/// # Description | ||
/// Organizing code into multiple Q# source files is an important part of | ||
/// writing readable and maintainable code. In this project, we have `Main.qs`, | ||
/// and `Particle.qs`, which defines a new namespace for particle operations. | ||
/// The presence of a Q# manifest file (`qsharp.json`) tells the compiler | ||
/// to include all Q# files under `src/`. | ||
namespace MyQuantumApp { | ||
open Particle; | ||
@EntryPoint() | ||
operation Main() : Unit { | ||
let particleA = Particle(0, 0, 0); | ||
let particleB = Particle(1, 1, 1); | ||
|
||
let particleC = addParticles(particleA, particleB); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Particle { | ||
newtype Particle = (x: Int, y: Int, z: Int); | ||
|
||
function addParticles(a: Particle, b: Particle) : Particle { | ||
let (x1, y1, z1) = a!; | ||
let (x2, y2, z2) = b!; | ||
return Particle(x1 + x2, y1 + y2, z1 + z2); | ||
} | ||
} |