Skip to content

Instantly share code, notes, and snippets.

@LimHyungTae
Created October 23, 2024 22:06
Show Gist options
  • Save LimHyungTae/c8fdc465242dcc9b49c801cc6d9afe75 to your computer and use it in GitHub Desktop.
Save LimHyungTae/c8fdc465242dcc9b49c801cc6d9afe75 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Find all compile_commands.json files under ./build directory
find ./build -type f -name "compile_commands.json" | while read src_file; do
# Extract the package name from the file path
package_name=$(echo "$src_file" | sed -e 's|./build/\([^/]*\)/compile_commands.json|\1|')
# Define the destination path
dest_file="./src/${package_name}/compile_commands.json"
# Ensure the destination directory exists
mkdir -p "./src/${package_name}"
# Copy the file
echo "Copying $src_file to $dest_file"
cp "$src_file" "$dest_file"
done
echo "All available compile_commands.json files copied successfully."
@LimHyungTae
Copy link
Author

To copy compile_commands.json files for each package once compile_commands.json does exist in ./build/${PACKAGE_NAME}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment