Skip to content

Conversation

@sanych-sun
Copy link
Member

No description provided.

@sanych-sun sanych-sun requested a review from a team as a code owner December 3, 2024 20:17
</PropertyGroup>

<Target Name="DownloadNativeBinaries_linux_x64" BeforeTargets="BeforeBuild" Condition="!Exists('$(MSBuildProjectDirectory)/linux/x64/libmongocrypt.so')">
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is where the main magic is situated: we call MSBuild to start "another" project, which is actually the same project ($(MSBuildProjectFullPath)) by explicitly invoking Target named DownloadNativeBinary and pass some variables that define where the file should be pulled from. Also important stuff: we set TargetFramework=once, this is to override default Targets we have. If we do not override that - the target will be started 3 times (once per existing target framework).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And yep - repeat for each file to download.

</Target>

<Target Name="DownloadNativeBinaries_Alpine" BeforeTargets="BeforeBuild" Condition="!Exists('$(MSBuildProjectDirectory)/linux/alpine/libmongocrypt.so')">
<Target Name="DownloadNativeBinary">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Target is the one that actually doing the work.

<ItemGroup>
<Content Include="$(MSBuildProjectDirectory)/linux/x64/libmongocrypt.so">
<Link>libmongocrypt\linux-x64\libmongocrypt.so</Link>
<Content Include="$(MSBuildProjectDirectory)/runtimes/osx/native/libmongocrypt.dylib">
Copy link
Member Author

@sanych-sun sanych-sun Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed where we store the file in project folder to match the library search path, so we do not need to set the LIBMONGOCRYPT_PATH env variable anymore. Path to the file in the package was not changed.

@sanych-sun sanych-sun removed the request for review from a team December 6, 2024 18:42
Copy link
Contributor

@adelinowona adelinowona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sanych-sun sanych-sun merged commit fe331f9 into mongodb:main Dec 7, 2024
372 of 384 checks passed
@sanych-sun sanych-sun deleted the csharp5343 branch December 7, 2024 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants