Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .azure-pipelines/ultimate-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ variables:
DD_LOGGER_DD_TAGS: test.configuration.job:$(System.JobDisplayName)
DD_LOGGER_ENABLED: true
DD_COLLECTOR_CPU_USAGE: true
ToolVersion: 3.57.0
# .NET SDK performance optimization variables
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
Expand Down Expand Up @@ -5722,7 +5721,9 @@ stages:

- script: |
dotnet --info
dotnet tool install dd-trace --tool-path $(smokeTestAppDir)/publish --add-source $(smokeTestAppDir)/artifacts/. --version $(ToolVersion)
TOOL_VERSION=$(basename $(smokeTestAppDir)/artifacts/dd-trace.*.nupkg | sed 's/^dd-trace\.//; s/\.nupkg$//')
echo "Installing dd-trace $TOOL_VERSION"
dotnet tool install dd-trace --tool-path $(smokeTestAppDir)/publish --add-source $(smokeTestAppDir)/artifacts/. --version "$TOOL_VERSION"
displayName: Install tracer

- script: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/_create_draft_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ jobs:
if: ${{ !inputs.is_hotfix }}
run: ./tracer/build.sh RenameVNextMilestone
env:
Version: ${{steps.versions.outputs.full_version}}
GITHUB_TOKEN: "${{ steps.generate-token.outputs.token }}"

- name: Create Release
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/auto_create_version_bump_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ jobs:
run: .\tracer\build.ps1 CalculateNextVersion
id: versions

# Must run before "Bump Version": CloseMilestone closes the milestone matching the version in
# version.props, which is the just-released version until the bump rewrites it.
- name: "Close previous milestone"
run: .\tracer\build.ps1 CloseMilestone

- name: "Bump Version"
run: .\tracer\build.ps1 UpdateVersion
env:
Expand All @@ -83,11 +88,6 @@ jobs:
reviewers: "DataDog/apm-dotnet"
body: "${{steps.changes.outputs.release_notes}}"

- name: "Close previous milestone"
run: .\tracer\build.ps1 CloseMilestone
env:
Version: ${{steps.versions.outputs.previous_version}}

- name: Display output
run: |
echo "Pull Request Number - ${{ steps.pr.outputs.pull-request-number }}"
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,7 @@ tools/dumps/

# test optimization temp/run folder
.dd/

# NetEscapades.ProjectInfo output. Unlike our other generators, this one emits the version
# number, so a committed copy would have to be regenerated on every version bump.
**/Generated/**/NetEscapades.ProjectInfo/
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ endif()
# Project definition
# ******************************************************

project("Datadog.APM.Native" VERSION 2.18.0)
include("${CMAKE_CURRENT_LIST_DIR}/build/cmake/DdVersion.cmake")
project("Datadog.APM.Native" VERSION ${DD_VERSION})

# ******************************************************
# Environment detection
Expand Down
28 changes: 28 additions & 0 deletions build/DdVersion.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project>

<!--
The SDK version for native (.vcxproj) projects: they import this file instead of version.props,
which managed projects import directly. It is the MSBuild equivalent of build/cmake/DdVersion.cmake.

As well as the properties from tracer/build/_build/version.props, it adds the DD_VERSION_MAJOR,
DD_VERSION_MINOR and DD_VERSION_PATCH preprocessor definitions that shared/src/native-src/dd_version.h
expects - the same set that DdVersion.cmake defines. dd_version.h derives everything else from them,
so new derived values belong there, not here.
-->

<Import Project="$(MSBuildThisFileDirectory)..\tracer\build\_build\version.props" />

<PropertyGroup>
<DD_NativeVersionDefinitions>DD_VERSION_MAJOR=$([System.Version]::Parse('$(DD_VersionPrefix)').Major);DD_VERSION_MINOR=$([System.Version]::Parse('$(DD_VersionPrefix)').Minor);DD_VERSION_PATCH=$([System.Version]::Parse('$(DD_VersionPrefix)').Build)</DD_NativeVersionDefinitions>
</PropertyGroup>

<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>$(DD_NativeVersionDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>$(DD_NativeVersionDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>

</Project>
42 changes: 42 additions & 0 deletions build/cmake/DdVersion.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Exposes the version from tracer/build/_build/version.props as DD_VERSION, for project(... VERSION ...),
# which accepts only a numeric major[.minor[.patch[.tweak]]]. Also adds the DD_VERSION_MAJOR,
# DD_VERSION_MINOR and DD_VERSION_PATCH compile definitions that shared/src/native-src/dd_version.h
# expects (build/DdVersion.props defines the same set for the MSBuild builds). dd_version.h derives
# everything else from them, so new derived values belong there, not here.
#
# Included only by the root CMakeLists.txt, before any add_subdirectory(), so that every subproject
# inherits DD_VERSION and the compile definitions. CMake must therefore be configured from the
# repository root.
#
# Deliberately re-read on every configure and stored as a normal (not cached) variable, so that a
# version bump is picked up by an existing build directory, and you don't get weird instrumentation
# mismatches locally, just after a release.

get_filename_component(DD_REPO_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)

set(DD_VERSION_PROPS "${DD_REPO_ROOT}/tracer/build/_build/version.props")
if(NOT EXISTS "${DD_VERSION_PROPS}")
message(FATAL_ERROR "Could not find ${DD_VERSION_PROPS}. This file holds the SDK version number.")
endif()

# Re-run configure whenever version.props changes
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${DD_VERSION_PROPS}")

file(READ "${DD_VERSION_PROPS}" _dd_version_props_content)
string(REGEX MATCH "<DD_VersionPrefix>(([0-9]+)\.([0-9]+)\.([0-9]+))</DD_VersionPrefix>"
_dd_version_match "${_dd_version_props_content}")
if(NOT _dd_version_match)
message(FATAL_ERROR "Could not parse <DD_VersionPrefix> out of ${DD_VERSION_PROPS}.")
endif()

set(DD_VERSION "${CMAKE_MATCH_1}")
message(STATUS "Datadog SDK version: ${DD_VERSION}")

# Directory-scoped, so they apply to every target in this directory and below
add_compile_definitions(
DD_VERSION_MAJOR=${CMAKE_MATCH_2}
DD_VERSION_MINOR=${CMAKE_MATCH_3}
DD_VERSION_PATCH=${CMAKE_MATCH_4})

unset(_dd_version_props_content)
unset(_dd_version_match)
5 changes: 5 additions & 0 deletions profiler/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- This file applies to both managed and native projects. DdVersion.props imports version.props
itself, so each project imports exactly one of the two. -->
<Import Project="$(MSBuildThisFileDirectory)..\tracer\build\_build\version.props" Condition="'$(MSBuildProjectExtension)' != '.vcxproj'" />
<Import Project="$(MSBuildThisFileDirectory)..\build\DdVersion.props" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'" />

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- # Purpose -->
<!-- -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# Project definition
# ******************************************************

project("Datadog.Linux.ApiWrapper" VERSION 3.57.0)
# DD_VERSION is set by build/cmake/DdVersion.cmake, which the root CMakeLists.txt includes,
# so configure CMake from the repository root rather than from this directory
project("Datadog.Linux.ApiWrapper" VERSION ${DD_VERSION})

# ******************************************************
# Compiler options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# Project definition
# ******************************************************

project("Datadog.Profiler.Native.Linux" VERSION 3.57.0)
# DD_VERSION is set by build/cmake/DdVersion.cmake, which the root CMakeLists.txt includes,
# so configure CMake from the repository root rather than from this directory
project("Datadog.Profiler.Native.Linux" VERSION ${DD_VERSION})

option(RUN_ASAN "Build with Clang Undefined-Behavior Sanitizer" OFF)
option(RUN_UBSAN "Build with Clang Undefined-Behavior Sanitizer" OFF)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ END
#endif // not APSTUDIO_INVOKED

// ------- version info -------------------------------------------------------
#include "../../../../shared/src/native-src/dd_version.h"

VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,57,0,0
PRODUCTVERSION 3,57,0,0
FILEVERSION DD_VERSION_MAJOR,DD_VERSION_MINOR,DD_VERSION_PATCH,DD_VERSION_REVISION
PRODUCTVERSION DD_VERSION_MAJOR,DD_VERSION_MINOR,DD_VERSION_PATCH,DD_VERSION_REVISION
FILEFLAGSMASK VS_FF_PRERELEASE
FILEOS VOS_NT
FILETYPE VFT_DLL
Expand All @@ -74,12 +76,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Datadog"
VALUE "FileDescription", "Continuous Profiler for .NET Applications"
VALUE "FileVersion", "3.57.0.0"
VALUE "FileVersion", DD_FOUR_PART_VERSION_STR
VALUE "InternalName", "Native Profiler Engine"
VALUE "LegalCopyright", "(c) Datadog 2020-2022"
VALUE "OriginalFilename", "Datadog.Profiler.Native.dll"
VALUE "ProductName", "Continuous Profiler for .NET Applications"
VALUE "ProductVersion", "3.57.0.0"
VALUE "ProductVersion", DD_FOUR_PART_VERSION_STR
END
END
BLOCK "VarFileInfo"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

#pragma once

constexpr auto PROFILER_VERSION = "3.57.0";
#include "../../../../shared/src/native-src/version.h"
5 changes: 2 additions & 3 deletions profiler/src/ProfilerEngine/ProductVersion.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
<!-- Follow the instructions in the comments to set the version and the version-date. -->
<!-- This will make sure, your assmebly and file versions, as well as your NuGet package version are managed correctly. -->

<!-- * * * * * * * * * * * INPUTS. Update this section EVERY time the component is shipped/released! * * * * * * * * * * * -->
<!-- The version comes from tracer/build/_build/version.props. -->
<PropertyGroup>
<ProductVersion>3.57.0</ProductVersion>
<ProductVersion>$(DD_VersionPrefix)</ProductVersion>
</PropertyGroup>
<!-- * * * * * * * * * * * END OF INPUTS. * * * * * * * * * * * -->

<PropertyGroup>
<ProductSuffix>+$([System.DateTime]::UtcNow.ToString('yyyyMMddHHmmss'))</ProductSuffix>
Expand Down
1 change: 1 addition & 0 deletions shared/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@

<Import Project="$(MSBuildThisFileDirectory)\RepoAndBuild-DirectoryStructure.props" />
<Import Project="$(MSBuildThisFileDirectory)\CodeAnalysis.props" Condition=" '$(SkipCodeAnalysis)' != 'True' " />
<Import Project="$(MSBuildThisFileDirectory)..\tracer\build\_build\version.props" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ endif()
# Project definition
# ******************************************************

project("Datadog.Trace.ClrProfiler.Native" VERSION 3.57.0)
# DD_VERSION is set by build/cmake/DdVersion.cmake, which the root CMakeLists.txt includes,
# so configure CMake from the repository root rather than from this directory
project("Datadog.Trace.ClrProfiler.Native" VERSION ${DD_VERSION})

if (UNIVERSAL)
find_package(GlibcCompat REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)..\..\..\build\DdVersion.props" />
</Project>
10 changes: 6 additions & 4 deletions shared/src/Datadog.Trace.ClrProfiler.Native/Resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,17 @@ END
// Version
//

#include "../native-src/dd_version.h"

VS_VERSION_INFO VERSIONINFO
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEVERSION 3,57,0,0
PRODUCTVERSION 3,57,0,0
FILEVERSION DD_VERSION_MAJOR,DD_VERSION_MINOR,DD_VERSION_PATCH,DD_VERSION_REVISION
PRODUCTVERSION DD_VERSION_MAJOR,DD_VERSION_MINOR,DD_VERSION_PATCH,DD_VERSION_REVISION
FILEOS VOS_NT
FILETYPE VFT_DLL
BEGIN
Expand All @@ -68,12 +70,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Datadog"
VALUE "FileDescription", "Native loader for Datadog .NET APM"
VALUE "FileVersion", "3.57.0.0"
VALUE "FileVersion", DD_FOUR_PART_VERSION_STR
VALUE "InternalName", "Native loader"
VALUE "LegalCopyright", "(c) Datadog 2020-2022"
VALUE "OriginalFilename", "Datadog.Trace.ClrProfiler.Native.dll"
VALUE "ProductName", "Native loader for Datadog .NET APM"
VALUE "ProductVersion", "3.57.0.0"
VALUE "ProductVersion", DD_FOUR_PART_VERSION_STR
END
END
BLOCK "VarFileInfo"
Expand Down
8 changes: 6 additions & 2 deletions shared/src/msi-installer/WindowsInstaller.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
<MsiOutputPath Condition="'$(MsiOutputPath)' == ''">bin\$(Configuration)\$(Platform)\</MsiOutputPath>
<OutputPath>$(MsiOutputPath)</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\$(Platform)\</IntermediateOutputPath>
<OutputName>datadog-dotnet-apm-3.57.0-$(Platform)</OutputName> <!-- -The regex recognizes this line -->
<OutputName>datadog-dotnet-apm-$(DD_SemVer)-$(Platform)</OutputName>
<MonitoringHomeDirectory Condition="'$(MonitoringHomeDirectory)' == ''">$(MSBuildThisFileDirectory)..\..\bin\monitoring-home</MonitoringHomeDirectory>
<DefineConstants>InstallerVersion=3.57.0;MonitoringHomeDirectory=$(MonitoringHomeDirectory);</DefineConstants>
<!--
InstallerVersion becomes the Windows Installer ProductVersion, which has to be numeric
major.minor.build with no suffix, and which needs to increase monotonically for upgrades to work.
-->
<DefineConstants>InstallerVersion=$(DD_VersionPrefix);MonitoringHomeDirectory=$(MonitoringHomeDirectory);</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DefineConstants>$(DefineConstants);Debug</DefineConstants>
Expand Down
29 changes: 29 additions & 0 deletions shared/src/native-src/dd_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef DD_VERSION_H
#define DD_VERSION_H

// The SDK version for native code and the Windows resource scripts. The build passes only the major,
// minor and patch numbers, as preprocessor definitions derived from version.props: see
// build/DdVersion.props for MSBuild and build/cmake/DdVersion.cmake for CMake. Everything else is
// derived here, so adding a new derived value only requires changing this file.
//
// #define rather than constexpr, and include guards rather than #pragma once, because rc.exe
// preprocesses this file too and supports neither.

#if !defined(DD_VERSION_MAJOR) || !defined(DD_VERSION_MINOR) || !defined(DD_VERSION_PATCH)
#error "The DD_VERSION_* definitions are missing. They come from build/DdVersion.props (MSBuild) or build/cmake/DdVersion.cmake (CMake)."
#endif

// The native tracer and the managed loader both resolve Datadog.Trace by its exact strong name, so the
// revision stays at zero.
#define DD_VERSION_REVISION 0

// Two levels are needed: # stringifies its argument exactly as written, so DD_STRINGIFY_IMPL(DD_VERSION_MAJOR)
// would produce the macro's name rather than its value. Passing through DD_STRINGIFY first expands the
// macros to their values, so DD_STRINGIFY(DD_VERSION_MAJOR.DD_VERSION_MINOR) produces "1.2".
#define DD_STRINGIFY_IMPL(x) #x
#define DD_STRINGIFY(x) DD_STRINGIFY_IMPL(x)

#define DD_THREE_PART_VERSION_STR DD_STRINGIFY(DD_VERSION_MAJOR.DD_VERSION_MINOR.DD_VERSION_PATCH)
#define DD_FOUR_PART_VERSION_STR DD_STRINGIFY(DD_VERSION_MAJOR.DD_VERSION_MINOR.DD_VERSION_PATCH.DD_VERSION_REVISION)

#endif // DD_VERSION_H
9 changes: 8 additions & 1 deletion shared/src/native-src/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#pragma once

constexpr auto PROFILER_VERSION = "3.57.0";
#include "dd_version.h"

// This must stay a bare numeric version (no suffix):
// - Instrumentation.cs compares GetNativeTracerVersion() (which the native profiler IL-rewrites
// to this value) against TracerConstants.ThreePartVersion for an exact string match.
// - generated_calltargets.g.cpp builds the managed assembly's strong name by concatenating
// "Datadog.Trace, Version=" + PROFILER_VERSION + ".0, Culture=...".
constexpr auto PROFILER_VERSION = DD_THREE_PART_VERSION_STR;
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)..\..\..\build\DdVersion.props" />
</Project>
16 changes: 16 additions & 0 deletions tracer/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)build\_build\version.props" />

<PropertyGroup>
<IsPackable>false</IsPackable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -18,6 +20,20 @@
<NoWarn>$(NoWarn);SYSLIB0014;NU1901;NU1902;NU1903;NU1904</NoWarn>
</PropertyGroup>

<!--
The version values that NetEscapades.ProjectInfo echoes into a generated ProjectInfo class,
defined once so every project that opts in reports the same thing. The generator itself stays
opt-in: each project that needs it adds the PackageReference, so projects without one just carry
inert items.

ProjectInfoUtf8 is deliberately not here - it generates a ReadOnlySpan<byte> member, which the
managed loader cannot compile on net461/netcoreapp2.0. It lives in the projects that need it.
-->
<ItemGroup>
<ProjectInfoString Include="AssemblyVersion" Value="$(DD_AssemblyVersion)" />
<ProjectInfoString Include="ThreePartVersion" Value="$(DD_VersionPrefix)" />
</ItemGroup>

<!-- StyleCop -->
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="all"/>
Expand Down
Loading
Loading