diff --git a/bootstrap.ps1 b/bootstrap.ps1 index 7c4ff8880ec..302106c3be3 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -7,16 +7,9 @@ Push-Location (Join-Path $PSScriptRoot "build") .\prerequisites.ps1 Pop-Location +cargo install cargo-edit Push-Location (Join-Path $PSScriptRoot "./src/Simulation/qdk_sim_rs") - # We use dotnet-script to inject the version number into Cargo.toml, - # so we go on ahead here and restore any missing tools. - # Since that Cargo.toml is referenced by CMake lists in the QIR - # runtime, this injection has to be the first thing we do. - dotnet tool restore - dotnet script inject-version.csx -- ` - --template Cargo.toml.template ` - --out-path Cargo.toml ` - --version $Env:NUGET_VERSION; + cargo set-version $Env:NUGET_VERSION; Pop-Location if (-not (Test-Path Env:/AGENT_OS)) { # If not CI build, i.e. local build (if AGENT_OS envvar is not defined) diff --git a/build/pack.ps1 b/build/pack.ps1 index 83b73074b3b..cd548194d7f 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -140,10 +140,10 @@ function Pack-Crate() { $OutPath = Resolve-Path (Join-Path $PSScriptRoot $OutPath); } Push-Location (Join-Path $PSScriptRoot $PackageDirectory) - cargo package; - # Copy only the .crate file, since we don't need all the intermediate - # artifacts brought in by the full folder under target/package. - Copy-Item -Force (Join-Path $PSScriptRoot .. "target" "package" "*.crate") $OutPath; + cargo package --allow-dirty; + # Copy only the .crate file, since we don't need all the intermediate + # artifacts brought in by the full folder under target/package. + Copy-Item -Force (Join-Path $PSScriptRoot .. "target" "package" "*.crate") $OutPath; Pop-Location } diff --git a/src/Simulation/qdk_sim_rs/.config/dotnet-tools.json b/src/Simulation/qdk_sim_rs/.config/dotnet-tools.json deleted file mode 100644 index 8e180ea3016..00000000000 --- a/src/Simulation/qdk_sim_rs/.config/dotnet-tools.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "dotnet-script": { - "version": "1.1.0", - "commands": [ - "dotnet-script" - ] - } - } -} \ No newline at end of file diff --git a/src/Simulation/qdk_sim_rs/.gitignore b/src/Simulation/qdk_sim_rs/.gitignore index a740f3ce698..0af728fc99f 100644 --- a/src/Simulation/qdk_sim_rs/.gitignore +++ b/src/Simulation/qdk_sim_rs/.gitignore @@ -4,8 +4,6 @@ win10 target drop -# We inject version numbers into Cargo.toml, so don't want them stored in repo. -Cargo.toml # In the future, it would be good to enable reproducible builds by committing # the lockfile and using --locked in calls to cargo. Cargo.lock diff --git a/src/Simulation/qdk_sim_rs/Cargo.toml.template b/src/Simulation/qdk_sim_rs/Cargo.toml similarity index 99% rename from src/Simulation/qdk_sim_rs/Cargo.toml.template rename to src/Simulation/qdk_sim_rs/Cargo.toml index f589d6d411b..3855ffe6a13 100644 --- a/src/Simulation/qdk_sim_rs/Cargo.toml.template +++ b/src/Simulation/qdk_sim_rs/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "qdk_sim_experimental" -version = "0.1.0" +version = "0.0.1-alpha" authors = ["Microsoft"] edition = "2018" license = "MIT" diff --git a/src/Simulation/qdk_sim_rs/inject-version.csx b/src/Simulation/qdk_sim_rs/inject-version.csx deleted file mode 100644 index ec71338f066..00000000000 --- a/src/Simulation/qdk_sim_rs/inject-version.csx +++ /dev/null @@ -1,39 +0,0 @@ -#r "nuget: System.CommandLine, 2.0.0-beta1.21216.1" -#r "nuget: Tommy, 2.0.0" - -using System.CommandLine; -using System.Linq; -using System.CommandLine.Invocation; -using Tommy; - -// Create a root command with some options -var rootCommand = new RootCommand -{ - new Option( - "--template", - description: "A file to use as the template for cargo manifest."), - new Option( - "--out-path", - description: "Path to write the generated manifest to."), - new Option( - "--version", - description: "The version number to inject.") -}; - -// Note that the parameters of the handler method are matched according to the names of the options -rootCommand.Handler = CommandHandler.Create((template, outPath, version) => -{ - Console.Out.WriteLine($"Injecting version {version} into {template} and writing to {outPath}."); - using var reader = new StreamReader(File.OpenRead(template.FullName)); - var table = TOML.Parse(reader); - - // Set the version number in the table. - table["package"]["version"] = version; - - using var writer = new StreamWriter(File.OpenWrite(outPath)); - table.WriteTo(writer); - // Remember to flush the data if needed! - writer.Flush(); -}); - -await rootCommand.InvokeAsync(Args.ToArray());