Skip to content

Commit

Permalink
adapt to net462
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshnj committed Feb 6, 2025
1 parent 5e76e15 commit d5d09b6
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 29 deletions.
34 changes: 17 additions & 17 deletions build/nupkg_local/libdatadog/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ urls=(
)

# Create the sources/runtime directory if it doesn't exist
mkdir -p sources/runtimes
Download release files
for url in "${urls[@]}"; do
filename=$(basename "$url")
# mkdir -p sources/runtimes
# Download release files
# for url in "${urls[@]}"; do
# filename=$(basename "$url")

echo "Downloading $url... at release/$filename"
curl -L -o "release/$filename" "$url"
done
# echo "Downloading $url... at release/$filename"
# curl -L -o "release/$filename" "$url"
# done

# extract the files
mkdir -p release/unzipped
for file in release/*; do
if [[ $file == *.tar.gz ]]; then
echo "Extracting $file..."
tar -xzf "$file" -C release/unzipped
elif [[ $file == *.zip ]]; then
echo "Extracting $file..."
unzip -q "$file" -d release/unzipped
fi
done
# mkdir -p release/unzipped
# for file in release/*; do
# if [[ $file == *.tar.gz ]]; then
# echo "Extracting $file..."
# tar -xzf "$file" -C release/unzipped
# elif [[ $file == *.zip ]]; then
# echo "Extracting $file..."
# unzip -q "$file" -d release/unzipped
# fi
# done

# copy required binaries to their rid format inside sources/runtimes
# {os]-{distro}-{arch}
Expand Down
10 changes: 0 additions & 10 deletions build/nupkg_local/libdatadog/sources/build/libdatadog.props

This file was deleted.

60 changes: 60 additions & 0 deletions build/nupkg_local/libdatadog/sources/build/libdatadog.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Computes .NET version -->

<PropertyGroup>
<IsLegacyNetVersion>FALSE</IsLegacyNetVersion>
</PropertyGroup>

<PropertyGroup>
<NetVersion>$(TargetFrameworkVersion.Replace("v", "").Replace(".", "").Substring(0,2))</NetVersion>
</PropertyGroup>

<!-- IS LEGACY .NET FRAMEWORK v2.x-->

<PropertyGroup Condition=" ('$(NetVersion)' == '20')">
<IsLegacyNetVersion>TRUE</IsLegacyNetVersion>
</PropertyGroup>

<!-- IS LEGACY .NET FRAMEWORK v3.x-->

<PropertyGroup Condition=" ('$(NetVersion)' == '30')">
<IsLegacyNetVersion>TRUE</IsLegacyNetVersion>
</PropertyGroup>

<PropertyGroup Condition=" ('$(NetVersion)' == '35')">
<IsLegacyNetVersion>TRUE</IsLegacyNetVersion>
</PropertyGroup>

<!-- IS LEGACY .NET FRAMEWORK v4.x-->

<PropertyGroup Condition=" ('$(NetVersion)' &gt;= '40') AND ('$(NetVersion)' &lt; '50') ">
<IsLegacyNetVersion>TRUE</IsLegacyNetVersion>
</PropertyGroup>

<!-- FOR LEGACY .NET FRAMEWORK - Copy native libraries directly to output folders -->

<PropertyGroup Condition="('$(Platform)'=='x64') AND ('$(IsLegacyNetVersion)'=='TRUE')">
<DDPlatform>x64</DDPlatform>
</PropertyGroup>
<PropertyGroup Condition="(('$(Platform)'=='x86') Or ('$(Platform)'=='AnyCPU')) AND ('$(IsLegacyNetVersion)'=='TRUE')">
<DDPlatform>x86</DDPlatform>
</PropertyGroup>

<ItemGroup Condition ="('$(IsLegacyNetVersion)'=='TRUE')">
<None Include="$(MSBuildThisFileDirectory)..\runtimes\win-$(DDPlatform)\native\datadog_profiling_ffi.dll">
<Link>datadog_profiling_ffi.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<!-- FOR .NET Core and .NET5+, just simply copy runtimes to output folders -->

<ItemGroup Condition ="('$(IsLegacyNetVersion)'=='FALSE')">
<NativeLibs Include="$(MSBuildThisFileDirectory)..\..\runtimes\**" />
<None Include="@(NativeLibs)">
<Link>runtimes\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions build/nupkg_local/libdatadog/test/Console/Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net462</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ImplicitUsings>false</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
Expand Down
Binary file modified packages/libdatadog.42.0.1.nupkg
Binary file not shown.

0 comments on commit d5d09b6

Please sign in to comment.