Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit da855c2

Browse files
author
Bettina Heim
committed
replacing the setVersionNr script
1 parent e46c118 commit da855c2

File tree

4 files changed

+37
-32
lines changed

4 files changed

+37
-32
lines changed

build/bootstrap.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dotnet --info || GOTO missingDotnet
66
git --version || GOTO missingGit
77

88
:: Set Build number on all files that uses it
9-
CALL build\setVersionNumber.cmd
9+
call powershell -NoProfile build\setVersionNumber.ps1
1010

1111
:: Initialize the compiler's nuspec file
1212
CALL :nuspecBootstrap

build/setVersionNumber.cmd

Lines changed: 0 additions & 29 deletions
This file was deleted.

build/setVersionNumer.ps1

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
param(
2+
[string]
3+
$AssemblyVersion = $Env:ASSEMBLY_VERSION,
4+
5+
[string]
6+
$NuGetVersion = $Env:NUGET_VERSION
7+
);
8+
9+
if ("$AssemblyVersion".Trim().Length -eq 0) {
10+
$Date = Get-Date;
11+
$Year = $Date.Year.ToString().Substring(2);
12+
$Month = $Date.Month.ToString().PadLeft(2, "0");
13+
$Hour = (Get-Date).Hour.ToString().PadLeft(2, "0");
14+
$Minute = (Get-Date).Minute.ToString().PadLeft(2, "0");
15+
$AssemblyVersion = "0.0.$Year$Month.$Hour$Minute";
16+
}
17+
18+
if ("$NuGetVersion".Trim().Length -eq 0) {
19+
$NuGetVersion = "$AssemblyVersion-alpha";
20+
}
21+
22+
Get-ChildItem -Recurse *.v.template `
23+
| ForEach-Object {
24+
$Source = $_.FullName;
25+
$Target = $Source.Substring(0, $Source.Length - 11);
26+
Write-Verbose "Replacing ASSEMBLY_VERSION with $AssemblyVersion in $Source and writing to $Target.";
27+
Get-Content $Source `
28+
| ForEach-Object {
29+
$_.
30+
Replace("#ASSEMBLY_VERSION#", $AssemblyVersion).
31+
Replace("#NUGET_VERSION#", $NuGetVersion)
32+
} `
33+
| Set-Content $Target -NoNewline
34+
}

src/VSCodeExtension/BUILDING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ Change back to the "Extension" debugger and resume.
6969
### semver Issues ###
7070

7171
You may see an error when packaging or debugging the VS Code extension indicating that the package is not semver compatible.
72-
This indicates that the build script `setVersionNumber.cmd` did not produce a SemVer 2.0–compatible version number when writing `package.json` from `package.json.v.template`, typically due to a mis-set environment variable.
73-
If this happens, correct the environment variables used by `setVersionNumber.cmd` or manually edit the `version` property of `package.json` (note that any such manual edits **will** be overwritten by calls to `setVersionNumber.cmd` and will not be saved in the repo).
72+
This indicates that the build script `setVersionNumber.ps1` did not produce a SemVer 2.0–compatible version number when writing `package.json` from `package.json.v.template`, typically due to a mis-set environment variable.
73+
If this happens, correct the environment variables used by `setVersionNumber.ps1` or manually edit the `version` property of `package.json` (note that any such manual edits **will** be overwritten by calls to `setVersionNumber.ps1` and will not be saved in the repo).

0 commit comments

Comments
 (0)