Skip to content

Commit

Permalink
Revert ckpkg related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshnj committed Feb 6, 2025
1 parent c7ba2a3 commit 11e2aa4
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 133 deletions.
8 changes: 0 additions & 8 deletions tracer/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@
</Otherwise>
</Choose>


<PropertyGroup Condition=" '$(MSBuildProjectExtension)' == '.vcxproj' ">
<!-- VCPKG setup -->
<VcpkgEnableManifest>true</VcpkgEnableManifest>
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgTriplet>$(Platform)-windows</VcpkgTriplet>
</PropertyGroup>

<!-- Fix C5105 Warning (warning C5105: macro expansion producing 'defined' has undefined behavior) due to a bug in the Windows SDK 10.0.19041.0
This can be removed when we upgrade the Windows SDK
-->
Expand Down
70 changes: 0 additions & 70 deletions tracer/build/_build/Build.Shared.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
using Logger = Serilog.Log;
using System.Runtime.InteropServices;
using Serilog;
using static PrepareRelease.SetAllVersions;

partial class Build
{
Expand Down Expand Up @@ -140,73 +137,6 @@ partial class Build
var testExe = ToolResolver.GetLocalTool(exePath);
testExe($"--gtest_output=xml:{testsResultFile}", workingDirectory: workingDirectory);
});


Target PublishLibdatadog => _ => _
.Unlisted()
.DependsOn(PublishLibdatadogWindows)
.DependsOn(PublishLibdatadogLinux);

Target PublishLibdatadogWindows => _ => _
.Unlisted()
.OnlyWhenStatic(() => IsWin)
.After(CompileProfilerNativeSrc)
.Executes(() =>
{
const string fileName = "datadog_profiling_ffi";

var dllFile = $"{fileName}.dll";
var pdbFile = $"{fileName}.pdb";

foreach (var architecture in ArchitecturesForPlatformForProfiler)
{
var dest = MonitoringHomeDirectory / $"win-{architecture}";

foreach (var sourceDir in new[] { ProfilerDeployDirectory / $"win-{architecture}" , NativeTracerProject.Directory / "bin" / BuildConfiguration / architecture })
{
if (!File.Exists(dest / dllFile))
{
var sourceFile = sourceDir / dllFile;
TryCopyFrom(sourceFile, dest);
}

if (!File.Exists(dest / pdbFile))
{
var sourceFile = sourceDir / pdbFile;
TryCopyFrom(sourceFile, dest);
}
}
}

bool TryCopyFrom(string sourceFile, AbsolutePath dest)
{
if (File.Exists(sourceFile))
{
CopyFileToDirectory(sourceFile, dest, FileExistsPolicy.Overwrite);
return true;
}
return false;
}
});

Target PublishLibdatadogLinux => _ => _
.Unlisted()
.OnlyWhenStatic(() => IsLinux)
.After(CompileProfilerNativeSrc)
.Executes(() =>
{
var (arch, _) = GetUnixArchitectureAndExtension();
var sourceDir = ProfilerDeployDirectory / arch;
EnsureExistingDirectory(MonitoringHomeDirectory / arch);

var files = new[] { "libdatadog_profiling.so" };
foreach (var file in files)
{
var source = sourceDir / file;
var dest = MonitoringHomeDirectory / arch / file;
CopyFile(source, dest, FileExistsPolicy.Overwrite);
}
});

Target CompileNativeLoaderOsx => _ => _
.Unlisted()
Expand Down
1 change: 0 additions & 1 deletion tracer/build/_build/Build.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ bool RequiresThoroughTesting()

Target CompileTracerNativeSrcWindows => _ => _
.Unlisted()
.DependsOn(SetupVcpkg)
.After(CompileManagedLoader)
.OnlyWhenStatic(() => IsWin)
.Executes(() =>
Expand Down
3 changes: 1 addition & 2 deletions tracer/build/_build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ void DeleteReparsePoints(string path)
Target BuildTracerHome => _ => _
.Description("Builds the native and managed src, and publishes the tracer home directory")
.After(Clean)
.DependsOn(CompileManagedLoader, BuildNativeTracerHome, BuildManagedTracerHome, BuildNativeLoader)
.DependsOn(PublishLibdatadog);
.DependsOn(CompileManagedLoader, BuildNativeTracerHome, BuildManagedTracerHome, BuildNativeLoader);

Target BuildProfilerHome => _ => _
.Description("Builds the Profiler native and managed src, and publishes the profiler home directory")
Expand Down
3 changes: 1 addition & 2 deletions tracer/src/Datadog.Tracer.Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ if (ISMACOS)
elseif(ISLINUX)
target_link_libraries("Datadog.Tracer.Native.static"
managed-loader-objs
libdatadog-lib
coreclr
re2-lib
spdlog-headers
Expand All @@ -240,7 +239,7 @@ elseif(ISLINUX)
)
endif()

add_dependencies("Datadog.Tracer.Native.static" coreclr re2-lib spdlog-headers managed-loader-objs libdatadog-lib)
add_dependencies("Datadog.Tracer.Native.static" coreclr re2-lib spdlog-headers managed-loader-objs)

# ******************************************************
# Define shared target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@
<PropertyGroup Condition="'$(Platform)'=='ARM64EC'">
<BuildAsX>true</BuildAsX>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>true</VcpkgEnableManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@
<PropertyGroup Condition="'$(Platform)'=='ARM64EC'">
<BuildAsX>true</BuildAsX>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>true</VcpkgEnableManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
Expand Down
6 changes: 0 additions & 6 deletions tracer/src/Datadog.Tracer.Native/cor_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,12 +946,6 @@ HRESULT CorProfiler::TryRejitModule(ModuleID module_id, std::vector<ModuleID>& m
RewritingPInvokeMaps(module_metadata, WStr("debugger"), debugger_nonwindows_nativemethods_type);
RewritingPInvokeMaps(module_metadata, WStr("fault_tolerant"), fault_tolerant_nonwindows_nativemethods_type);
#endif // _WIN32
auto module_file_path = fs::path(shared::GetCurrentModuleFileName());
auto native_loader_file_path = module_file_path.parent_path() / native_libdatadog_filename;
auto native_loader_file_path_wstr = shared::ToWSTRING(native_loader_file_path.string());

RewritingPInvokeMaps(module_metadata, WStr("trace_exporter"), traceexporter_nativemethods_type, native_loader_file_path_wstr); //Maybe this won't happen for nuget manual instrumentation? Check with Andrew Lock


mdTypeDef bubbleUpTypeDef;
call_target_bubble_up_exception_available = EnsureCallTargetBubbleUpExceptionTypeAvailable(module_metadata, &bubbleUpTypeDef);
Expand Down
10 changes: 0 additions & 10 deletions tracer/src/Datadog.Tracer.Native/dd_profiler_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ const shared::WSTRING manual_instrumentation_name = WStr("Datadog.Trace.Manual")
const shared::WSTRING nonwindows_nativemethods_type = WStr("Datadog.Trace.ClrProfiler.NativeMethods+NonWindows");
const shared::WSTRING windows_nativemethods_type = WStr("Datadog.Trace.ClrProfiler.NativeMethods+Windows");

const shared::WSTRING traceexporter_nativemethods_type = WStr("Datadog.Trace.LibDatadog.TraceExporterNative");

const shared::WSTRING appsec_nonwindows_nativemethods_type = WStr("Datadog.Trace.AppSec.Waf.NativeBindings.NativeLibrary+NonWindows");
const shared::WSTRING appsec_windows_nativemethods_type = WStr("Datadog.Trace.AppSec.Waf.NativeBindings.NativeLibrary+Windows");
const shared::WSTRING profiler_nativemethods_type = WStr("Datadog.Trace.ContinuousProfiler.NativeInterop+NativeMethods");
Expand Down Expand Up @@ -151,14 +149,6 @@ const shared::WSTRING native_dll_filename = WStr("Datadog.Tracer.Native.dylib");
const shared::WSTRING native_dll_filename = WStr("Datadog.Tracer.Native.so");
#endif

#ifdef _WIN32 //TODO steal me
const shared::WSTRING native_libdatadog_filename = WStr("datadog_profiling_ffi.dll");
#elif MACOS
const shared::WSTRING native_libdatadog_filename = WStr("datadog_profiling_ffi.dylib");
#else
const shared::WSTRING native_libdatadog_filename = WStr("datadog_profiling.so");
#endif

const AssemblyProperty managed_profiler_assembly_property = AssemblyProperty(
managed_profiler_name,
new BYTE[160]{0, 36, 0, 0, 4, 128, 0, 0, 148, 0, 0, 0, 6, 2, 0, 0, 0, 36, 0, 0,
Expand Down
8 changes: 0 additions & 8 deletions tracer/src/Datadog.Tracer.Native/interop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,8 @@
#define EXTERN_C extern "C" __attribute__((visibility("default")))
#endif

// this is a hack to force vcpkg to copy dll output dir
extern "C"
{
#include "datadog/profiling.h"
}

EXTERN_C BOOL STDAPICALLTYPE IsProfilerAttached()
{
// this is a hack to force vcpkg to copy dll output dir
ddog_ArrayQueue_is_empty(nullptr);
return trace::profiler != nullptr && trace::profiler->IsAttached();
}

Expand Down
7 changes: 1 addition & 6 deletions tracer/src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,5 @@
<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)Datadog.Trace.Tools.Analyzers\Datadog.Trace.Tools.Analyzers.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<PropertyGroup Condition=" '$(MSBuildProjectExtension)' == '.vcxproj' ">
<!-- VCPKG setup -->
<VcpkgEnableManifest>true</VcpkgEnableManifest>
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgTriplet>$(Platform)-windows</VcpkgTriplet>
</PropertyGroup>

</Project>
14 changes: 0 additions & 14 deletions tracer/src/Directory.Build.targets

This file was deleted.

0 comments on commit 11e2aa4

Please sign in to comment.