Skip to content

Commit

Permalink
C# driver 2.25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nightroman committed Apr 12, 2024
1 parent 07e348c commit 7e7babe
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 38 deletions.
62 changes: 27 additions & 35 deletions .build.ps1
Expand Up @@ -83,26 +83,25 @@ task meta -Inputs $BuildFile, Release-Notes.md -Outputs "Module\$ModuleName.psd1
}

# Synopsis: Remove temp files.
task clean {
task clean -After pushPSGallery {
remove z, Src\bin, Src\obj, README.htm
}

# Synopsis: Build, publish in post-build, make help.
task build meta, {
exec { dotnet build "Src\$ModuleName.csproj" -c $Configuration }
},
?help
exec {dotnet build "Src\$ModuleName.csproj" -c $Configuration}
}

# Synopsis: Publish the module (post-build).
task publish {
exec { dotnet publish "Src\$ModuleName.csproj" --no-build -c $Configuration -o $ModuleRoot }
exec {dotnet publish "Src\$ModuleName.csproj" --no-build -c $Configuration -o $ModuleRoot}
remove "$ModuleRoot\System.Management.Automation.dll", "$ModuleRoot\*.deps.json"

exec { robocopy Module $ModuleRoot /s /xf *-Help.ps1 } (0..3)
exec {robocopy Module $ModuleRoot /s /xf *-Help.ps1} (0..3)
}

# Synopsis: Build help by https://github.com/nightroman/Helps
task help -Inputs { Get-Item Src\Commands\*, "Module\en-US\$ModuleName-Help.ps1" } -Outputs "$ModuleRoot\en-US\$ModuleName-Help.xml" {
task help -After ?build -Inputs {Get-Item Src\Commands\*, "Module\en-US\$ModuleName-Help.ps1"} -Outputs "$ModuleRoot\en-US\$ModuleName-Help.xml" {
. Helps.ps1
Convert-Helps "Module\en-US\$ModuleName-Help.ps1" $Outputs
}
Expand All @@ -115,7 +114,7 @@ task version {
# Synopsis: Convert markdown to HTML.
task markdown {
requires -Environment MarkdownCss -Path $env:MarkdownCss
exec { pandoc.exe @(
exec {pandoc.exe @(
'README.md'
'--output=README.htm'
'--from=gfm'
Expand All @@ -128,17 +127,17 @@ task markdown {

# Synopsis: Make the package.
task package markdown, version, {
assert ((Get-Module $ModuleName -ListAvailable).Version -eq ([Version]$Version))
assert ((Get-Item $ModuleRoot\$ModuleName.dll).VersionInfo.FileVersion -eq ([Version]"$Version.0"))
equals (Get-Module $ModuleName -ListAvailable).Version ([Version]$Version)
equals (Get-Item $ModuleRoot\$ModuleName.dll).VersionInfo.FileVersion "$Version.0"

remove z
exec { robocopy $ModuleRoot z\$ModuleName /s /xf *.pdb } (0..3)
exec {robocopy $ModuleRoot z\$ModuleName /s /xf *.pdb} 1

Copy-Item LICENSE -Destination z\$ModuleName
Move-Item README.htm -Destination z\$ModuleName

$actual = (Get-ChildItem z\$ModuleName -File -Force -Recurse -Name) -join "`n"
$expected = @'
$result = Get-ChildItem z\$ModuleName -Recurse -File -Name | Out-String
$sample = @'
AWSSDK.Core.dll
AWSSDK.SecurityToken.dll
DnsClient.dll
Expand Down Expand Up @@ -167,33 +166,31 @@ ZstdSharp.dll
en-US\about_Mdbc.help.txt
en-US\Mdbc-Help.xml
'@

equals $actual ($expected -split '\r?\n' -join "`n")
Assert-SameFile.ps1 -Text $sample $result $env:MERGE
}

# Synopsis: Make and push the PSGallery package.
task pushPSGallery package, {
$NuGetApiKey = Read-Host NuGetApiKey
Publish-Module -Path z\$ModuleName -NuGetApiKey $NuGetApiKey
},
clean
}

# Synopsis: Push repository with a version tag.
task pushRelease version, updateScript, {
$changes = exec { git status --short }
$changes = exec {git status --short}
assert (!$changes) "Please, commit changes."

exec { git push }
exec { git tag -a "v$Version" -m "v$Version" }
exec { git push origin "v$Version" }
exec {git push}
exec {git tag -a "v$Version" -m "v$Version"}
exec {git push origin "v$Version"}
}

# Synopsis: Copy external scripts to sources.
task updateScript @{
Partial = $true
Inputs = {
Get-Command Mdbc.ArgumentCompleters.ps1, Update-MongoFiles.ps1 |
.{process{ $_.Definition }}
.{process{$_.Definition}}
}
Outputs = {process{
$2 = "Scripts\$(Split-Path -Leaf $_)"
Expand All @@ -212,7 +209,7 @@ task updateScript @{
}

# Synopsis: Remove test.test* collections
task cleanTest {
task cleanTest -After test {
Import-Module Mdbc
foreach($name in Connect-Mdbc . test *) {
if ($name -like 'test*') {
Expand All @@ -221,25 +218,20 @@ task cleanTest {
}
}

task test_core {
exec { pwsh -NoProfile -Command Invoke-Build test }
# Synopsis: Test Desktop.
task desktop -After pushPSGallery {
exec {powershell -NoProfile -Command Invoke-Build test}
}

task test_desktop {
exec { powershell -NoProfile -Command Invoke-Build test }
# Synopsis: Test Core.
task core -After pushPSGallery {
exec {pwsh -NoProfile -Command Invoke-Build test}
}

# Synopsis: Test PowerShell editions.
task tests test_core, test_desktop

# Synopsis: Test current PowerShell.
task test {
Invoke-Build ** Tests
},
cleanTest

# Synopsis: Build, test, clean.
task all build, tests, clean
}

# Synopsis: Build and clean.
task . build, clean
4 changes: 4 additions & 0 deletions Release-Notes.md
@@ -1,6 +1,10 @@
# Mdbc Release Notes
[C# driver releases]: https://github.com/mongodb/mongo-csharp-driver/releases

## v6.7.1

C# driver 2.25.0

## v6.7.0

C# driver 2.23.1
Expand Down
6 changes: 3 additions & 3 deletions Src/Mdbc.csproj
Expand Up @@ -6,9 +6,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageReference Include="MongoDB.Bson" Version="2.23.1" />
<PackageReference Include="MongoDB.Driver" Version="2.23.1" />
<PackageReference Include="MongoDB.Driver.Core" Version="2.23.1" />
<PackageReference Include="MongoDB.Bson" Version="2.25.0" />
<PackageReference Include="MongoDB.Driver" Version="2.25.0" />
<PackageReference Include="MongoDB.Driver.Core" Version="2.25.0" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="ib publish -Configuration $(Configuration)" />
Expand Down

0 comments on commit 7e7babe

Please sign in to comment.