8
8
9
9
# Requires -Modules @ { ModuleName = " InvokeBuild" ; ModuleVersion = " 5.0.0" }
10
10
11
- $ProjectName = " SecretManagement"
12
- $FullModuleName = " Microsoft.PowerShell.SecretManagement"
13
- $CSharpSource = Join-Path $PSScriptRoot src/ code
14
- $CSharpPublish = Join-Path $PSScriptRoot artifacts/ publish/ $FullModuleName / $ ($Configuration.ToLower ())
15
- $ModuleOut = Join-Path $PSScriptRoot module
16
- $PackageOut = Join-Path $PSScriptRoot out
17
- $HelpSource = Join-Path $PSScriptRoot help
18
- $HelpOut = Join-Path $ModuleOut en- US
19
-
20
- $CSharpArtifacts = @ (
21
- " $FullModuleName .dll" ,
22
- " $FullModuleName .pdb" ,
23
- " $FullModuleName .xml" ,
24
- " System.Runtime.InteropServices.RuntimeInformation.dll" )
25
-
26
- $BaseArtifacts = @ (
27
- " src/$FullModuleName .format.ps1xml" ,
28
- " README.md" ,
29
- " LICENSE" ,
30
- " ThirdPartyNotices.txt" )
31
-
32
- $ManifestPath = Join-Path $PSScriptRoot " src/$FullModuleName .psd1"
33
-
34
- $HelpAboutTopics = @ ()
35
-
36
11
task FindDotNet - Before Clean , Build {
37
12
Assert (Get-Command dotnet - ErrorAction SilentlyContinue) " The dotnet CLI was not found, please install it: https://aka.ms/dotnet-cli"
38
13
$DotnetVersion = dotnet -- version
@@ -41,63 +16,68 @@ task FindDotNet -Before Clean, Build {
41
16
}
42
17
43
18
task Clean {
44
- Remove-BuildItem ./ artifacts, $ModuleOut , $PackageOut
45
- Invoke-BuildExec { dotnet clean $CSharpSource }
46
-
47
- Remove-BuildItem " $HelpOut /$FullModuleName .dll-Help.xml"
48
- foreach ($aboutTopic in $HelpAboutTopics ) {
49
- Remove-BuildItem " $HelpSource /$aboutTopic .help.txt"
50
- }
19
+ Remove-BuildItem ./ artifacts, ./ module, ./ out
20
+ Invoke-BuildExec { dotnet clean ./ src/ code }
51
21
}
52
22
53
- task BuildDocs - If { Test-Path - LiteralPath $HelpSource } {
54
- New-ExternalHelp - Path $HelpSource - OutputPath $HelpOut
55
- foreach ($aboutTopic in $HelpAboutTopics ) {
56
- New-ExternalHelp - Path " $HelpSource \$aboutTopic .md" - OutputPath $HelpOut
57
- }
23
+ task BuildDocs - If { Test-Path - LiteralPath ./ help } {
24
+ New-ExternalHelp - Path ./ help - OutputPath ./ module/ en- US
58
25
}
59
26
60
27
task BuildModule {
61
- New-Item - ItemType Directory - Force $ModuleOut | Out-Null
28
+ New-Item - ItemType Directory - Force . / module | Out-Null
62
29
63
- Invoke-BuildExec { dotnet publish $CSharpSource -- configuration $Configuration }
30
+ Invoke-BuildExec { dotnet publish . / src / code - c $Configuration }
64
31
65
32
# Hard code building this in release config since we aren't actually developing it,
66
33
# it's only for tests. The tests also hard code the path assuming release config.
67
- Invoke-BuildExec { dotnet publish $PSScriptRoot / ExtensionModules/ CredManStore/ src/ code -- configuration Release }
34
+ Invoke-BuildExec { dotnet publish ./ ExtensionModules/ CredManStore/ src/ code - c Release }
35
+
36
+ $FullModuleName = " Microsoft.PowerShell.SecretManagement"
37
+
38
+ $CSharpArtifacts = @ (
39
+ " $FullModuleName .dll" ,
40
+ " $FullModuleName .pdb" ,
41
+ " $FullModuleName .xml" ,
42
+ " System.Runtime.InteropServices.RuntimeInformation.dll" )
68
43
69
44
$CSharpArtifacts | ForEach-Object {
70
- $item = Join-Path $CSharpPublish $_
71
- Copy-Item - Force - LiteralPath $item - Destination $ModuleOut
45
+ $item = " ./artifacts/publish/ $FullModuleName / $ ( $Configuration .ToLower () ) / $_ "
46
+ Copy-Item - Force - LiteralPath $item - Destination . / module
72
47
}
73
48
49
+ $BaseArtifacts = @ (
50
+ " src/$FullModuleName .format.ps1xml" ,
51
+ " README.md" ,
52
+ " LICENSE" ,
53
+ " ThirdPartyNotices.txt" )
54
+
74
55
$BaseArtifacts | ForEach-Object {
75
56
$itemToCopy = Join-Path $PSScriptRoot $_
76
- Copy-Item - Force - LiteralPath $itemToCopy - Destination $ModuleOut
57
+ Copy-Item - Force - LiteralPath $itemToCopy - Destination . / module
77
58
}
78
59
79
60
[xml ]$xml = Get-Content Directory.Build.props
80
61
$moduleVersion = $xml.Project.PropertyGroup.ModuleVersion
81
- $manifestContent = Get-Content - LiteralPath $ManifestPath - Raw
62
+ $manifestContent = Get-Content - LiteralPath " ./src/ $FullModuleName .psd1 " - Raw
82
63
$newManifestContent = $manifestContent -replace ' {{ModuleVersion}}' , $moduleVersion
83
- Set-Content - LiteralPath " $ModuleOut /$FullModuleName .psd1" - Encoding utf8 - Value $newManifestContent
64
+ Set-Content - LiteralPath " ./module /$FullModuleName .psd1" - Encoding utf8 - Value $newManifestContent
84
65
}
85
66
86
67
task PackageModule {
87
- New-Item - ItemType Directory - Force $PackageOut | Out-Null
68
+ New-Item - ItemType Directory - Force . / out | Out-Null
88
69
89
70
try {
90
- Register-PSResourceRepository - Name $ProjectName - Uri $PackageOut - ErrorAction Stop
91
- $registerSuccessful = $true
92
- Publish-PSResource - Path $ModuleOut - Repository $ProjectName - Verbose
71
+ Register-PSResourceRepository - Name SecretManagement - Uri ./ out - ErrorAction Stop
72
+ Publish-PSResource - Path ./ module - Repository SecretManagement - Verbose
93
73
} finally {
94
- Unregister-PSResourceRepository - Name $ProjectName
74
+ Unregister-PSResourceRepository - Name SecretManagement
95
75
}
96
76
}
97
77
98
78
# AKA Microsoft.PowerShell.SecretManagement.Library
99
79
task PackageLibrary - If { $Configuration -eq " Release" } {
100
- Invoke-BuildExec { dotnet pack $CSharpSource -- no- build -- configuration $Configuration -- output $PackageOut }
80
+ Invoke-BuildExec { dotnet pack . / src / code -- no- build - c $Configuration - o . / out }
101
81
}
102
82
103
83
task Test {
0 commit comments