Skip to content

Commit 1a51255

Browse files
committed
temp
1 parent 56ed0e8 commit 1a51255

File tree

3 files changed

+0
-68
lines changed

3 files changed

+0
-68
lines changed

src/OpenTelemetry.AutoInstrumentation.Native/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BIN_DIR})
9898

9999
# Add custom commands to setup dependencies via git
100100

101-
add_custom_command(
102-
OUTPUT ${OUTPUT_DEPS_DIR}/re2/obj/libre2.a
103-
COMMAND git clone -c advice.detachedHead=false --quiet --depth 1 --branch 2023-03-01 https://github.com/google/re2.git && cd re2 && env ARFLAGS=\"-r -s -c\" CXXFLAGS=\"-std=c++11 -O3 -g -fPIC\" make
104-
WORKING_DIRECTORY ${OUTPUT_DEPS_DIR}
105-
)
106-
107101
add_custom_command(
108102
OUTPUT ${OUTPUT_DEPS_DIR}/fmt/libfmt.a
109103
COMMAND git clone -c advice.detachedHead=false --quiet --depth 1 --branch 10.1.1 https://github.com/fmtlib/fmt.git && cd fmt && cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DFMT_TEST=0 -DFMT_DOC=0 . && make
@@ -191,7 +185,6 @@ add_library("OpenTelemetry.AutoInstrumentation.Native.static" STATIC
191185
lib/coreclr/src/pal/prebuilt/idl/corprof_i.cpp
192186
# Source dependencies retrievied via additional commands using git
193187
${OUTPUT_DEPS_DIR}/fmt/libfmt.a
194-
${OUTPUT_DEPS_DIR}/re2/obj/libre2.a
195188
)
196189

197190
set_target_properties("OpenTelemetry.AutoInstrumentation.Native.static" PROPERTIES PREFIX "")
@@ -204,19 +197,16 @@ target_include_directories("OpenTelemetry.AutoInstrumentation.Native.static"
204197
PUBLIC lib/coreclr/src/inc
205198
PUBLIC lib/spdlog/include
206199
PUBLIC ${OUTPUT_DEPS_DIR}/fmt/include
207-
PUBLIC ${OUTPUT_DEPS_DIR}/re2
208200
)
209201

210202
# Define linker libraries
211203
if (ISMACOS)
212204
target_link_libraries("OpenTelemetry.AutoInstrumentation.Native.static"
213-
${OUTPUT_DEPS_DIR}/re2/obj/libre2.a
214205
${OUTPUT_DEPS_DIR}/fmt/libfmt.a
215206
${CMAKE_DL_LIBS}
216207
)
217208
elseif(ISLINUX)
218209
target_link_libraries("OpenTelemetry.AutoInstrumentation.Native.static"
219-
${OUTPUT_DEPS_DIR}/re2/obj/libre2.a
220210
${OUTPUT_DEPS_DIR}/fmt/libfmt.a
221211
${CMAKE_DL_LIBS}
222212
-static-libgcc

src/OpenTelemetry.AutoInstrumentation.Native/cor_profiler.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
#include <corprof.h>
88
#include <string>
99
#include <typeinfo>
10-
#ifdef _WIN32
1110
#include <regex>
12-
#else
13-
#include <re2/re2.h>
14-
#endif
1511

1612
#include "clr_helpers.h"
1713
#include "dllmain.h"
@@ -75,19 +71,11 @@ HRESULT STDMETHODCALLTYPE CorProfiler::Initialize(IUnknown* cor_profiler_info_un
7571

7672
// Update the list also in SmokeTests.NativeLogsHaveNoSensitiveData
7773
const auto secrets_pattern = "(?:^|_)(API|TOKEN|SECRET|KEY|PASSWORD|PASS|PWD|HEADER|CREDENTIALS)(?:_|$)";
78-
#ifdef _WIN32
7974
const std::regex secrets_regex(secrets_pattern, std::regex_constants::ECMAScript | std::regex_constants::icase);
80-
#else
81-
static re2::RE2 re(secrets_pattern, RE2::Quiet);
82-
#endif
8375

8476
for (const auto& env_variable : env_variables)
8577
{
86-
#ifdef _WIN32
8778
if (!std::regex_search(ToString(env_variable), secrets_regex))
88-
#else
89-
if (!re2::RE2::PartialMatch(ToString(env_variable), re))
90-
#endif
9179
{
9280
Logger::Debug(" ", env_variable);
9381
}

src/OpenTelemetry.AutoInstrumentation.Native/integration.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33

44
#include "integration.h"
55

6-
#ifdef _WIN32
76
#include <regex>
8-
#else
9-
#include <re2/re2.h>
10-
#endif
117
#include <sstream>
128

139
#include <unordered_map>
@@ -77,8 +73,6 @@ Version GetVersionFromAssemblyReferenceString(const WSTRING& str)
7773
return {major, minor, build, revision};
7874
}
7975

80-
#ifdef _WIN32
81-
8276
static auto re = std::wregex(WStr("Version=([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)"));
8377

8478
std::wsmatch match;
@@ -90,13 +84,6 @@ Version GetVersionFromAssemblyReferenceString(const WSTRING& str)
9084
WSTRINGSTREAM(match.str(4)) >> revision;
9185
}
9286

93-
#else
94-
95-
static re2::RE2 re("Version=([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)", RE2::Quiet);
96-
re2::RE2::PartialMatch(ToString(str), re, &major, &minor, &build, &revision);
97-
98-
#endif
99-
10087
return {major, minor, build, revision};
10188
}
10289

@@ -109,27 +96,13 @@ WSTRING GetLocaleFromAssemblyReferenceString(const WSTRING& str)
10996
return locale;
11097
}
11198

112-
#ifdef _WIN32
113-
11499
static auto re = std::wregex(WStr("Culture=([a-zA-Z0-9]+)"));
115100
std::wsmatch match;
116101
if (std::regex_search(str, match, re) && match.size() == 2)
117102
{
118103
locale = match.str(1);
119104
}
120105

121-
#else
122-
123-
static re2::RE2 re("Culture=([a-zA-Z0-9]+)", RE2::Quiet);
124-
125-
std::string match;
126-
if (re2::RE2::PartialMatch(ToString(str), re, &match))
127-
{
128-
locale = ToWSTRING(match);
129-
}
130-
131-
#endif
132-
133106
return locale;
134107
}
135108

@@ -142,8 +115,6 @@ PublicKey GetPublicKeyFromAssemblyReferenceString(const WSTRING& str)
142115
return PublicKey(data);
143116
}
144117

145-
#ifdef _WIN32
146-
147118
static auto re = std::wregex(WStr("PublicKeyToken=([a-fA-F0-9]{16})"));
148119
std::wsmatch match;
149120
if (std::regex_search(str, match, re) && match.size() == 2)
@@ -157,23 +128,6 @@ PublicKey GetPublicKeyFromAssemblyReferenceString(const WSTRING& str)
157128
}
158129
}
159130

160-
#else
161-
162-
static re2::RE2 re("PublicKeyToken=([a-fA-F0-9]{16})");
163-
std::string match;
164-
if (re2::RE2::PartialMatch(ToString(str), re, &match))
165-
{
166-
for (int i = 0; i < 8; i++)
167-
{
168-
auto s = match.substr(i * 2, 2);
169-
unsigned long x;
170-
std::stringstream(s) >> std::hex >> x;
171-
data[i] = BYTE(x);
172-
}
173-
}
174-
175-
#endif
176-
177131
return PublicKey(data);
178132
}
179133

0 commit comments

Comments
 (0)