Skip to content

Commit 41a6107

Browse files
authored
Misc general updates to make consistent (UbiquityDotNET#30)
* Updated build scripting to handle multiple instances of VS - Latest instealled release build is used. * Minor doc corrections and clarifications. * Added margin guideline for Markdown files for consistency of formatting and layout. * Updated docfx version to use latest
1 parent 49637cf commit 41a6107

File tree

10 files changed

+413
-168
lines changed

10 files changed

+413
-168
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ indent_style = space
2727
indent_size = 2
2828
tab_width = 2
2929

30+
[*.md]
31+
# mark left margion for split screen preview of markdown files
32+
# requires: https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelinesPreview
33+
guidelines = 92
34+
3035
# match ISO standard requirement for C/C++
3136
[*.c,*.h,*.cpp]
3237
insert_final_newline = true

Build-Docs.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Param(
2727
[switch]$ShowDocs
2828
)
2929

30-
$docFXToolVersion = '2.78.3'
30+
$docFXToolVersion = '2.78.4'
3131

3232
$InformationPreference = 'Continue'
3333
$ErrorInformationPreference = 'Stop'

PsModules/CommonBuild/Public/Initialize-CommonBuildEnvironment.ps1

Lines changed: 69 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -52,74 +52,85 @@ function Initialize-CommonBuildEnvironment
5252
[string]$repoRoot,
5353
[switch]$FullInit
5454
)
55-
56-
# Script code should ALWAYS use the global CurrentBuildKind
57-
$currentBuildKind = Get-CurrentBuildKind
58-
59-
# set/reset legacy environment vars for non-script tools (i.e. msbuild.exe)
60-
$env:IsAutomatedBuild = $currentBuildKind -ne [BuildKind]::LocalBuild
61-
$env:IsPullRequestBuild = $currentBuildKind -eq [BuildKind]::PullRequestBuild
62-
$env:IsReleaseBuild = $currentBuildKind -eq [BuildKind]::ReleaseBuild
63-
64-
switch($currentBuildKind)
55+
try
6556
{
66-
([BuildKind]::LocalBuild) { $env:CiBuildName = 'ZZZ' }
67-
([BuildKind]::PullRequestBuild) { $env:CiBuildName = 'PRQ' }
68-
([BuildKind]::CiBuild) { $env:CiBuildName = 'BLD' }
69-
([BuildKind]::ReleaseBuild) { $env:CiBuildName = '' }
70-
default { throw "Invalid build kind" }
71-
}
57+
# Script code should ALWAYS use the global CurrentBuildKind
58+
$currentBuildKind = Get-CurrentBuildKind
7259

73-
# get the ISO-8601 formatted time stamp of the HEAD commit or the current UTC time for local builds
74-
# for FullInit force a re-capture of the time stamp.
75-
if(!$env:BuildTime -or $FullInit)
76-
{
77-
# for any automated builds use the ISO-8601 time stamp of the current commit
78-
if($currentBuildKind -ne [BuildKind]::LocalBuild)
79-
{
80-
$env:BuildTime = (git show -s --format=%cI)
81-
}
82-
else
60+
# set/reset legacy environment vars for non-script tools (i.e. msbuild.exe)
61+
$env:IsAutomatedBuild = $currentBuildKind -ne [BuildKind]::LocalBuild
62+
$env:IsPullRequestBuild = $currentBuildKind -eq [BuildKind]::PullRequestBuild
63+
$env:IsReleaseBuild = $currentBuildKind -eq [BuildKind]::ReleaseBuild
64+
65+
switch($currentBuildKind)
8366
{
84-
$env:BuildTime = ([System.DateTime]::UtcNow.ToString("o"))
67+
([BuildKind]::LocalBuild) { $env:CiBuildName = 'ZZZ' }
68+
([BuildKind]::PullRequestBuild) { $env:CiBuildName = 'PRQ' }
69+
([BuildKind]::CiBuild) { $env:CiBuildName = 'BLD' }
70+
([BuildKind]::ReleaseBuild) { $env:CiBuildName = '' }
71+
default { throw "Invalid build kind" }
8572
}
86-
}
87-
88-
# On Windows setup the equivalent of a Developer prompt.
89-
#
90-
# Other platform runners may have different defaulted paths etc...
91-
# to account for here.
92-
if ($IsWindows)
93-
{
94-
Write-Verbose "Configuring VS tools support"
9573

96-
# For windows force a common VS tools prompt;
97-
# Sadly most of this is undocumented and found from various sites
98-
# spelunking the process. This isn't as bad as it might seem as the
99-
# installer will create persistent use of this as a Windows Terminal
100-
# "profile" and the actual command is exposed.
101-
if($null -eq (Find-OnPath vswhere))
74+
# get the ISO-8601 formatted time stamp of the HEAD commit or the current UTC time for local builds
75+
# for FullInit force a re-capture of the time stamp.
76+
if(!$env:BuildTime -or $FullInit)
10277
{
103-
# NOTE: automated builds in Github do NOT include WinGet (for reasons unknown)
104-
# However, they do contain VSWHERE so should not hit this.
105-
winget install Microsoft.VisualStudio.Locator | Out-Null
78+
# for any automated builds use the ISO-8601 time stamp of the current commit
79+
if($currentBuildKind -ne [BuildKind]::LocalBuild)
80+
{
81+
$env:BuildTime = (git show -s --format=%cI)
82+
}
83+
else
84+
{
85+
$env:BuildTime = ([System.DateTime]::UtcNow.ToString("o"))
86+
}
10687
}
10788

108-
$vsShellModulePath = vswhere -find **\Microsoft.VisualStudio.DevShell.dll
109-
$vsToolsArch = Get-VsArchitecture
110-
if(!$vsShellModulePath)
89+
# On Windows setup the equivalent of a Developer prompt.
90+
#
91+
# Other platform runners may have different defaulted paths etc...
92+
# to account for here.
93+
if ($IsWindows)
11194
{
112-
throw "VS shell module not found!"
95+
Write-Verbose "Configuring VS tools support"
96+
97+
# For windows force a common VS tools prompt;
98+
# Sadly most of this is undocumented and found from various sites
99+
# spelunking the process. This isn't as bad as it might seem as the
100+
# installer will create persistent use of this as a Windows Terminal
101+
# "profile" and the actual command is exposed.
102+
if($null -eq (Find-OnPath vswhere))
103+
{
104+
# NOTE: automated builds in Github do NOT include WinGet (for reasons unknown)
105+
# However, they do contain VSWHERE so should not hit this.
106+
winget install Microsoft.VisualStudio.Locator | Out-Null
107+
}
108+
109+
$vsShellModulePath = vswhere -latest -find **\Microsoft.VisualStudio.DevShell.dll
110+
$vsToolsArch = Get-VsArchitecture
111+
if(!$vsShellModulePath)
112+
{
113+
throw "VS shell module not found!"
114+
}
115+
116+
Import-Module $vsShellModulePath | Out-Null
117+
$vsInstanceId = vswhere -latest -format value -property InstanceId
118+
Enter-VsDevShell $vsInstanceId -SkipAutomaticLocation -DevCmdArguments "-arch=$vsToolsArch -host_arch=$vsToolsArch" | Out-Null
113119
}
114120

115-
Import-Module $vsShellModulePath | Out-Null
116-
$vsInstanceId = vswhere -format value -property InstanceId
117-
Enter-VsDevShell $vsInstanceId -SkipAutomaticLocation -DevCmdArguments "-arch=$vsToolsArch -host_arch=$vsToolsArch" | Out-Null
121+
#Start with standard build paths then add additional values to the hashtable
122+
$buildInfo = Get-DefaultBuildPaths $repoRoot
123+
$buildInfo['CurrentBuildKind'] = $currentBuildKind
124+
$buildInfo['VersionTag'] = Get-BuildVersionTag $buildInfo
125+
return $buildInfo
126+
}
127+
catch
128+
{
129+
# everything from the official docs to the various articles in the blog-sphere says this isn't needed
130+
# and in fact it is redundant - They're all WRONG! By re-throwing the exception the original location
131+
# information is retained and the error reported will include the correct source file and line number
132+
# data for the error. Without this, only the error message is retained and the location information is
133+
# Line 1, Column 1, of the outer most script file, or the calling location neither of which is useful.
134+
throw
118135
}
119-
120-
#Start with standard build paths then add additional values to the hashtable
121-
$buildInfo = Get-DefaultBuildPaths $repoRoot
122-
$buildInfo['CurrentBuildKind'] = $currentBuildKind
123-
$buildInfo['VersionTag'] = Get-BuildVersionTag $buildInfo
124-
return $buildInfo
125136
}

PsModules/RepoBuild/RepoBuild.psd1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ RequiredModules = @(Join-Path $PsScriptRoot '..' CommonBuild CommonBuild.psd1)
6161

6262
# Functions to export from this module
6363
FunctionsToExport = @(
64-
'Get-FunctionsToExport'
6564
'Initialize-BuildEnvironment'
6665
)
6766

Show-Docs.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Param(
1818
[string]$DocsPathToHost
1919
)
2020

21-
$docFXToolVersion = '2.78.3'
21+
$docFXToolVersion = '2.78.4'
2222

2323
$InformationPreference = 'Continue'
2424
$ErrorInformationPreference = 'Stop'

docfx/Attributions.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@ library and documentation:
1616
* Used to validate conformance to style within the repo
1717
* [docfx](https://dotnet.github.io/docfx/)
1818
* Used to generate the documentation site for this repo
19-
* [MSBUILD Project Creator](https://github.com/jeffkl/MSBuildProjectCreator)
20-
* Used for unit testing the task package itself.

0 commit comments

Comments
 (0)