Skip to content

Commit

Permalink
chore: Merge all stubs into one single file during artifact generation
Browse files Browse the repository at this point in the history
  • Loading branch information
PROFeNoM committed Nov 8, 2024
1 parent 02d88d9 commit 1fd307e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tooling/bin/generate-final-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<?php\n" . $mergedStubs;

echo "$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
########################
Expand Down

0 comments on commit 1fd307e

Please sign in to comment.