Skip to content

Commit

Permalink
Added support for MongoDB 8
Browse files Browse the repository at this point in the history
  • Loading branch information
wassim-k committed Oct 22, 2024
1 parent dda10a9 commit 2b960c0
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![build](https://img.shields.io/github/actions/workflow/status/asimmon/ephemeral-mongo/release.yml?logo=github)](https://github.com/asimmon/ephemeral-mongo/actions/workflows/release.yml)

**EphemeralMongo** is a set of multiple NuGet packages wrapping the binaries of **MongoDB 4**, **5**, **6** and **7**.
**EphemeralMongo** is a set of multiple NuGet packages wrapping the binaries of **MongoDB 4**, **5**, **6**, **7** and **8**.
Each package targets **.NET Standard 2.0**, which means you can use it with **.NET Framework 4.5.2** up to **.NET 6 and later**.

The supported operating systems are **Linux**, **macOS** and **Windows** on their **x64 architecture** versions only.
Expand All @@ -29,6 +29,7 @@ This project is very much inspired from [Mongo2Go](https://github.com/Mongo2Go/M
| **EphemeralMongo5** | All-in-one package for **MongoDB 5.0.20** on Linux, macOS and Windows | [![nuget](https://img.shields.io/nuget/v/EphemeralMongo5.svg?logo=nuget)](https://www.nuget.org/packages/EphemeralMongo5/) |
| **EphemeralMongo6** | All-in-one package for **MongoDB 6.0.9** on Linux, macOS and Windows | [![nuget](https://img.shields.io/nuget/v/EphemeralMongo6.svg?logo=nuget)](https://www.nuget.org/packages/EphemeralMongo6/) |
| **EphemeralMongo7** | All-in-one package for **MongoDB 7.0.0** on Linux, macOS and Windows | [![nuget](https://img.shields.io/nuget/v/EphemeralMongo7.svg?logo=nuget)](https://www.nuget.org/packages/EphemeralMongo7/) |
| **EphemeralMongo8** | All-in-one package for **MongoDB 8.0.0** on Linux, macOS and Windows | [![nuget](https://img.shields.io/nuget/v/EphemeralMongo8.svg?logo=nuget)](https://www.nuget.org/packages/EphemeralMongo8/) |


## Usage
Expand All @@ -49,7 +50,7 @@ var options = new MongoRunnerOptions
AdditionalArguments = "--quiet", // Default: null
MongoPort = 27017, // Default: random available port
// EXPERIMENTAL - Only works on Windows and modern .NET (netcoreapp3.1, net5.0, net6.0, net7.0 and so on):
// EXPERIMENTAL - Only works on Windows and modern .NET (netcoreapp3.1, net5.0, net6.0, net7.0, net8.0 and so on):
// Ensures that all MongoDB child processes are killed when the current process is prematurely killed,
// for instance when killed from the task manager or the IDE unit tests window. Processes are managed as a unit using
// job objects: https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects
Expand Down Expand Up @@ -86,7 +87,7 @@ using (var runner = MongoRunner.Run(options))

## Reducing the download size

EphemeralMongo4, 5, 6 and 7 are NuGet *metapackages* that reference dedicated runtime packages for both Linux, macOS and Windows.
EphemeralMongo4, 5, 6, 7 and 8 are NuGet *metapackages* that reference dedicated runtime packages for both Linux, macOS and Windows.
As of now, there isn't a way to optimize NuGet package downloads for a specific operating system (see [#2](https://github.com/asimmon/ephemeral-mongo/issues/2)).
However, one can still avoid referencing the metapackage and directly reference the dependencies instead. Add MSBuild OS platform conditions and you'll get optimized NuGet imports for your OS and less downloads.

Expand Down
7 changes: 7 additions & 0 deletions build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ public sealed class DownloadMongoTask : AsyncFrostingTask<BuildContext>
{
private static readonly ProjectInfo[] Projects =
{
// MongoDB 8.x
new ProjectInfo("EphemeralMongo8.runtime.win-x64", "windows", "x86_64", "base", 8, "win-x64"),
new ProjectInfo("EphemeralMongo8.runtime.osx-x64", "macos", "x86_64", "base", 8, "osx-x64"),
new ProjectInfo("EphemeralMongo8.runtime.linux-x64", "ubuntu2004", "x86_64", "targeted", 8, "linux-x64"),
new ProjectInfo("EphemeralMongo8.runtime.ubuntu.22.04-x64", "ubuntu2204", "x86_64", "targeted", 8, "ubuntu.22.04-x64"),

// MongoDB 7.x
new ProjectInfo("EphemeralMongo7.runtime.win-x64", "windows", "x86_64", "base", 7, "win-x64"),
new ProjectInfo("EphemeralMongo7.runtime.osx-x64", "macos", "x86_64", "base", 7, "osx-x64"),
Expand Down Expand Up @@ -406,6 +412,7 @@ public override void Run(BuildContext context)
"EphemeralMongo5",
"EphemeralMongo6",
"EphemeralMongo7",
"EphemeralMongo8",
};

var packageVersion = File.ReadAllText(Constants.PackageVersionPath);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<MongoVersion>8</MongoVersion>
<FullMongoVersion>PLACEHOLDER</FullMongoVersion>
<FullMongoVersion Condition=" '$(FullMongoVersion)' == 'PLACEHOLDER' ">$(MongoVersion)</FullMongoVersion>
</PropertyGroup>

<Import Project="EphemeralMongo.runtime.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<MongoVersion>8</MongoVersion>
<FullMongoVersion>PLACEHOLDER</FullMongoVersion>
<FullMongoVersion Condition=" '$(FullMongoVersion)' == 'PLACEHOLDER' ">$(MongoVersion)</FullMongoVersion>
</PropertyGroup>

<Import Project="EphemeralMongo.runtime.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<MongoVersion>8</MongoVersion>
<FullMongoVersion>PLACEHOLDER</FullMongoVersion>
<FullMongoVersion Condition=" '$(FullMongoVersion)' == 'PLACEHOLDER' ">$(MongoVersion)</FullMongoVersion>
</PropertyGroup>

<Import Project="EphemeralMongo.runtime.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<MongoVersion>8</MongoVersion>
<FullMongoVersion>PLACEHOLDER</FullMongoVersion>
<FullMongoVersion Condition=" '$(FullMongoVersion)' == 'PLACEHOLDER' ">$(MongoVersion)</FullMongoVersion>
</PropertyGroup>

<Import Project="EphemeralMongo.runtime.targets" />
</Project>
37 changes: 37 additions & 0 deletions src/EphemeralMongo.sln
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EphemeralMongo6.runtime.ubu
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EphemeralMongo7.runtime.ubuntu.22.04-x64", "EphemeralMongo.Runtimes\EphemeralMongo7.runtime.ubuntu.22.04-x64.csproj", "{0E319BF3-C59F-48B7-8B6B-20F9179C89E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EphemeralMongo8.runtime.linux-x64", "EphemeralMongo.Runtimes\EphemeralMongo8.runtime.linux-x64.csproj", "{37499680-C81E-493F-9A39-53A795479016}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EphemeralMongo8.runtime.osx-x64", "EphemeralMongo.Runtimes\EphemeralMongo8.runtime.osx-x64.csproj", "{D60320C0-142B-432B-9821-6E904BF8E996}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EphemeralMongo8.runtime.ubuntu.22.04-x64", "EphemeralMongo.Runtimes\EphemeralMongo8.runtime.ubuntu.22.04-x64.csproj", "{FBA6691F-B441-4D99-A6E7-083BA2F6FC30}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EphemeralMongo8.runtime.win-x64", "EphemeralMongo.Runtimes\EphemeralMongo8.runtime.win-x64.csproj", "{A972B910-AD58-4ECE-BE8E-87119437C359}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EphemeralMongo8", "EphemeralMongo8\EphemeralMongo8.csproj", "{FA5B50DC-EFFA-4A13-B3D1-3EC6EA2EFE51}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -136,6 +146,29 @@ Global
{0E319BF3-C59F-48B7-8B6B-20F9179C89E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E319BF3-C59F-48B7-8B6B-20F9179C89E8}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{0E319BF3-C59F-48B7-8B6B-20F9179C89E8}.Release|Any CPU.Build.0 = Debug|Any CPU
{37499680-C81E-493F-9A39-53A795479016}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37499680-C81E-493F-9A39-53A795479016}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37499680-C81E-493F-9A39-53A795479016}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37499680-C81E-493F-9A39-53A795479016}.Release|Any CPU.Build.0 = Release|Any CPU
{D60320C0-142B-432B-9821-6E904BF8E996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D60320C0-142B-432B-9821-6E904BF8E996}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D60320C0-142B-432B-9821-6E904BF8E996}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D60320C0-142B-432B-9821-6E904BF8E996}.Release|Any CPU.Build.0 = Release|Any CPU
{FBA6691F-B441-4D99-A6E7-083BA2F6FC30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBA6691F-B441-4D99-A6E7-083BA2F6FC30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBA6691F-B441-4D99-A6E7-083BA2F6FC30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBA6691F-B441-4D99-A6E7-083BA2F6FC30}.Release|Any CPU.Build.0 = Release|Any CPU
{A972B910-AD58-4ECE-BE8E-87119437C359}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A972B910-AD58-4ECE-BE8E-87119437C359}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A972B910-AD58-4ECE-BE8E-87119437C359}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A972B910-AD58-4ECE-BE8E-87119437C359}.Release|Any CPU.Build.0 = Release|Any CPU
{FA5B50DC-EFFA-4A13-B3D1-3EC6EA2EFE51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA5B50DC-EFFA-4A13-B3D1-3EC6EA2EFE51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA5B50DC-EFFA-4A13-B3D1-3EC6EA2EFE51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA5B50DC-EFFA-4A13-B3D1-3EC6EA2EFE51}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1C2D8B41-77A2-46EB-A74B-D8B3BE91250E} = {819E3828-0328-4F38-BDB3-5825B4913AAB}
Expand All @@ -152,5 +185,9 @@ Global
{CDDDD084-72FE-4BBB-9239-4B9D038C8F16} = {819E3828-0328-4F38-BDB3-5825B4913AAB}
{72697062-45A5-4E4E-B0F7-E76C8E01A49D} = {819E3828-0328-4F38-BDB3-5825B4913AAB}
{0E319BF3-C59F-48B7-8B6B-20F9179C89E8} = {819E3828-0328-4F38-BDB3-5825B4913AAB}
{37499680-C81E-493F-9A39-53A795479016} = {819E3828-0328-4F38-BDB3-5825B4913AAB}
{D60320C0-142B-432B-9821-6E904BF8E996} = {819E3828-0328-4F38-BDB3-5825B4913AAB}
{FBA6691F-B441-4D99-A6E7-083BA2F6FC30} = {819E3828-0328-4F38-BDB3-5825B4913AAB}
{A972B910-AD58-4ECE-BE8E-87119437C359} = {819E3828-0328-4F38-BDB3-5825B4913AAB}
EndGlobalSection
EndGlobal
26 changes: 26 additions & 0 deletions src/EphemeralMongo8/EphemeralMongo8.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MongoVersion>8</MongoVersion>
<FullMongoVersion>PLACEHOLDER</FullMongoVersion>
<FullMongoVersion Condition=" '$(FullMongoVersion)' == 'PLACEHOLDER' ">$(MongoVersion)</FullMongoVersion>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ImplicitUsings>disable</ImplicitUsings>
<IsPackable>true</IsPackable>
<Description>.NET native wrapper for MongoDB $(FullMongoVersion) built for .NET Standard 2.0.</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\EphemeralMongo.Core\EphemeralMongo.Core.csproj" />
<ProjectReference Include="..\EphemeralMongo.Runtimes\EphemeralMongo$(MongoVersion).runtime.linux-x64.csproj" IncludeAssets="all" ExcludeAssets="none" PrivateAssets="contentfiles;analyzers" />
<ProjectReference Include="..\EphemeralMongo.Runtimes\EphemeralMongo$(MongoVersion).runtime.osx-x64.csproj" IncludeAssets="all" ExcludeAssets="none" PrivateAssets="contentfiles;analyzers" />
<ProjectReference Include="..\EphemeralMongo.Runtimes\EphemeralMongo$(MongoVersion).runtime.win-x64.csproj" IncludeAssets="all" ExcludeAssets="none" PrivateAssets="contentfiles;analyzers" />
</ItemGroup>

<ItemGroup>
<!-- https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5128#solution-1 -->
<None Include="_._" Pack="true" PackagePath="lib\$(TargetFramework)" />
<None Include="..\..\README.md" Link="README.md" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
Empty file added src/EphemeralMongo8/_._
Empty file.

0 comments on commit 2b960c0

Please sign in to comment.