From 1fd307e3df629953ea2f60de36fa18853e187314 Mon Sep 17 00:00:00 2001 From: Alexandre Choura Date: Fri, 8 Nov 2024 09:27:51 +0100 Subject: [PATCH] chore: Merge all stubs into one single file during artifact generation --- tooling/bin/generate-final-artifact.sh | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tooling/bin/generate-final-artifact.sh b/tooling/bin/generate-final-artifact.sh index 77334b6980..5e6ad1409a 100755 --- a/tooling/bin/generate-final-artifact.sh +++ b/tooling/bin/generate-final-artifact.sh @@ -152,6 +152,34 @@ for architecture in "${architectures[@]}"; do "${tmp_folder_final_musl_appsec}/etc/recommended.json" fi + ######################## + # PHP Stubs + ######################## + $stubs = [ + '/home/circleci/app/src/ddtrace_php_api.stubs.php', + '/home/circleci/app/ext/ddtrace.stub.php', + '/home/circleci/app/ext/hook/uhook.stub.php', + '/home/circleci/app/ext/hook/uhook_attributes.stub.php', + ]; + + $mergedStubs = ''; + foreach ($stubs as $stub) { + $content = file_get_contents($stub); + $content = preg_replace('/^<\?php/', '', $content); + $mergedStubs .= "\n### " . basename($stub) . " ###" + $merg$mergedStubsed .= $content; + } + + $stub = " $tmp_folder_final_gnu/dd-library-php/ddtrace_api.stubs.php + if [[ -z ${DDTRACE_MAKE_PACKAGES_ASAN:-} ]]; then + echo "$stub" > $tmp_folder_final_musl/dd-library-php/ddtrace_api.stubs.php + if [[ $architecture == "x86_64" ]]; then + echo "$stub" > $tmp_folder_final_windows/dd-library-php/ddtrace_api.stubs.php + fi + fi + ######################## # Final archives ########################