@@ -10,16 +10,6 @@ param(
1010 [switch ] $Force
1111)
1212
13- $moduleName = ' ClassExplorer'
14- $testModuleManifestSplat = @ {
15- ErrorAction = ' Ignore'
16- WarningAction = ' Ignore'
17- Path = " $PSScriptRoot \module\$moduleName .psd1"
18- }
19-
20- $manifest = Test-ModuleManifest @testModuleManifestSplat
21- $moduleVersion = $manifest.Version
22-
2313$tools = " $PSScriptRoot \tools"
2414$script :GetDotNet = Get-Command $tools \GetDotNet.ps1
2515$script :AssertModule = Get-Command $tools \AssertRequiredModule.ps1
@@ -93,6 +83,7 @@ task GetProjectInfo {
9383
9484 $manifest = Test-ModuleManifest @testModuleManifestSplat
9585 $script :ModuleVersion = $manifest.Version
86+ $script :ReleasePath = " ./Release/$script :ModuleName /$script :ModuleVersion "
9687 $script :_IsWindows = $true
9788 $runtimeInfoType = ' System.Runtime.InteropServices.RuntimeInformation' -as [type ]
9889 try {
@@ -132,7 +123,7 @@ task Clean {
132123}
133124
134125task BuildDocs - If { Test-Path ./ docs/ $PSCulture /* .md } {
135- $releaseDocs = " ./Release/ClassExplorer/ $moduleVersion "
126+ $releaseDocs = $ script :ReleasePath
136127 $null = New-Item $releaseDocs / $PSCulture - ItemType Directory - Force - ErrorAction Ignore
137128 $null = New-ExternalHelp - Path ./ docs/ $PSCulture - OutputPath $releaseDocs / $PSCulture
138129
@@ -153,15 +144,15 @@ task CopyToRelease {
153144 $modern = $script :ModernTarget
154145 $legacy = $script :LegacyTarget
155146
156- $releasePath = " ./Release/ClassExplorer/ $version "
157- if (-not (Test-Path - LiteralPath $releasePath )) {
158- $null = New-Item $releasePath - ItemType Directory
147+ $release = $ script :ReleasePath
148+ if (-not (Test-Path - LiteralPath $release )) {
149+ $null = New-Item $release - ItemType Directory
159150 }
160151
161- Copy-Item - Path ./ module/* - Destination $releasePath - Recurse - Force
152+ Copy-Item - Path ./ module/* - Destination $release - Recurse - Force
162153
163154 if ($script :_IsWindows ) {
164- $null = New-Item $releasePath / bin/ Legacy - Force - ItemType Directory
155+ $null = New-Item $release / bin/ Legacy - Force - ItemType Directory
165156 $legacyFiles = (
166157 ' ClassExplorer.dll' ,
167158 ' ClassExplorer.pdb' ,
@@ -172,17 +163,17 @@ task CopyToRelease {
172163 ' System.Runtime.CompilerServices.Unsafe.dll' )
173164
174165 foreach ($file in $legacyFiles ) {
175- Copy-Item - Force - LiteralPath . / artifacts / publish / ClassExplorer / ${Configuration} _ $legacy / $ file - Destination $releasePath / bin/ Legacy
166+ Copy-Item - Force - LiteralPath (GetArtifactPath - FileName $ file - Legacy) - Destination $release / bin/ Legacy
176167 }
177168 }
178169
179- $null = New-Item $releasePath / bin/ Modern - Force - ItemType Directory
170+ $null = New-Item $release / bin/ Modern - Force - ItemType Directory
180171 $modernFiles = (
181172 ' ClassExplorer.dll' ,
182173 ' ClassExplorer.pdb' ,
183174 ' ClassExplorer.deps.json' )
184175 foreach ($file in $modernFiles ) {
185- Copy-Item - Force - LiteralPath . / artifacts / publish / ClassExplorer / ${Configuration} _ $modern / $ file - Destination $releasePath / bin/ Modern
176+ Copy-Item - Force - LiteralPath (GetArtifactPath - FileName $ file) - Destination $release / bin/ Modern
186177 }
187178}
188179
@@ -210,19 +201,21 @@ task DoTest -If { Test-Path ./test/*.ps1 } {
210201 $powershellCommand = ' pwsh'
211202 }
212203
213- $powershell = ( Get-Command - CommandType Application $powershellCommand ). Source
204+ $powershell = Get-Command - CommandType Application $powershellCommand | Select-Object - First 1 - ExpandProperty Source
214205
206+ # Can't be bothered atm, gotta modernize this at some point.
207+ $GenerateCodeCoverage = $false
215208 if ($GenerateCodeCoverage.IsPresent ) {
216209 # OpenCover needs full pdb's. I'm very open to suggestions for streamlining this...
217210 # & $dotnet clean
218211 & $dotnet publish -- configuration $Configuration -- framework $script :LegacyTarget -- verbosity quiet -- nologo / p:DebugType= Full
219212
220213 $moduleName = $Settings.Name
221- $release = ' {0}\ bin\Desktop\{1} ' -f $Folders .Release , $moduleName
222- $coverage = ' {0}\net471\{1} ' -f $Folders .Build , $moduleName
214+ $release = " $ script :ReleasePath / bin/Legacy/ $ script :ModuleName "
215+ $coverage = GetArtifactPath - Legacy $ script :ModuleName
223216
224- Rename-Item " $release .pdb" - NewName " $moduleName .pdb.tmp"
225- Rename-Item " $release .dll" - NewName " $moduleName .dll.tmp"
217+ Rename-Item " $release .pdb" - NewName " $script :ModuleName .pdb.tmp"
218+ Rename-Item " $release .dll" - NewName " $script :ModuleName .dll.tmp"
226219 Copy-Item " $coverage .pdb" " $release .pdb"
227220 Copy-Item " $coverage .dll" " $release .dll"
228221
@@ -236,8 +229,8 @@ task DoTest -If { Test-Path ./test/*.ps1 } {
236229
237230 Remove-Item " $release .pdb"
238231 Remove-Item " $release .dll"
239- Rename-Item " $release .pdb.tmp" - NewName " $moduleName .pdb"
240- Rename-Item " $release .dll.tmp" - NewName " $moduleName .dll"
232+ Rename-Item " $release .pdb.tmp" - NewName " $script :ModuleName .pdb"
233+ Rename-Item " $release .dll.tmp" - NewName " $script :ModuleName .dll"
241234 } else {
242235 & $powershell - NoProfile - EncodedCommand $encodedCommand
243236 }
0 commit comments