forked from microsoft/QuantumLibraries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateQDKVersion.sh
49 lines (37 loc) · 2.27 KB
/
updateQDKVersion.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
ver=$1
pkgs=$2
# It is recommended that you clean up the environment first
# by running this command:
# git submodule deinit --all -f
git submodule update --init
if [ "$(uname)" == "Darwin" ]; then
backup="''"
else
backup=""
fi
: ${ver:="$NUGET_VERSION"}
: ${pkgs:="Microsoft.Quantum.CsharpGeneration;Microsoft.Quantum.Runtime.Core;Microsoft.Quantum.QSharp.Core;Microsoft.Quantum.Development.Kit;Microsoft.Quantum.IQSharp.Core;Microsoft.Quantum.Simulators;Microsoft.Quantum.Compiler;Microsoft.Quantum.Xunit;Microsoft.Quantum.Chemistry;Microsoft.Quantum.Research"}
for pkg in `echo $pkgs | tr ";" "\n"`; do
echo Will update package $pkg with version $ver...
grep --include=\packages.config -lri -e "package *id=\"$pkg\" *version=" * | xargs sed -i $backup "s/package *id=\"$pkg\" *version=\"\([^\"]*\)\"/package id=\"$pkg\" version=\"$ver\"/i"
grep --include=\*proj -lri -e "PackageReference *Include=\"$pkg\" *Version=" * | xargs sed -i $backup "s/PackageReference *Include=\"$pkg\" *Version=\"\([^\"]*\)\"/PackageReference Include=\"$pkg\" Version=\"$ver\"/i"
grep --include=*props -lri -e "PackageReference *Include=\"$pkg\" *Version=" * | xargs sed -i $backup "s/PackageReference *Include=\"$pkg\" *Version=\"\([^\"]*\)\"/PackageReference Include=\"$pkg\" Version=\"$ver\"/i"
done
# Update the version number of the Quantum Sdk:
grep --include=*proj -lri -e "Sdk=\"Microsoft.Quantum.Sdk\/" * | xargs sed -i $backup "s/Sdk=\"Microsoft.Quantum.Sdk\/\([^\"]*\)\"/Sdk=\"Microsoft.Quantum.Sdk\/$ver\"/i"
grep --include=*Template.xml -lri -e "Sdk=\"Microsoft.Quantum.Sdk\/" * | xargs sed -i $backup "s/Sdk=\"Microsoft.Quantum.Sdk\/\([^\"]*\)\"/Sdk=\"Microsoft.Quantum.Sdk\/$ver\"/i"
echo done!
echo
# Commit changes to a release branch:
git status
git --no-pager diff
git submodule foreach git status
git submodule foreach git --no-pager diff
git submodule foreach git checkout -b release/v$ver
echo
echo ------------------------------------------------------------------
echo - Changes not pushed to origin; to push changes run this command: -
echo ------------------------------------------------------------------
echo git submodule foreach git commit --all -m \"Updating projects to $ver\" --allow-empty
echo git submodule foreach git push --set-upstream origin to release/v$ver