mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-05 23:43:07 +00:00
nix-nimble: generate paths for submodules containing .nimble files
This commit is contained in:
parent
c9b43db409
commit
5b8ddabe90
@ -35,6 +35,10 @@ find . -name .gitmodules | while read -r gitmodules_file; do
|
|||||||
if should_exclude "$abs_path"; then
|
if should_exclude "$abs_path"; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
# Append /src if it exists in the submodule directory
|
||||||
|
if [[ -d "$abs_path/src" ]]; then
|
||||||
|
abs_path="$abs_path/src"
|
||||||
|
fi
|
||||||
|
|
||||||
# Write the absolute path of the submodule to the output file
|
# Write the absolute path of the submodule to the output file
|
||||||
echo "$abs_path" >> "$output_file"
|
echo "$abs_path" >> "$output_file"
|
||||||
@ -52,16 +56,28 @@ mkdir -p "$nimble_pkgs_dir"
|
|||||||
|
|
||||||
# Read each submodule path and process it
|
# Read each submodule path and process it
|
||||||
while IFS= read -r submodule_path; do
|
while IFS= read -r submodule_path; do
|
||||||
# Extract the submodule name (last part of the path)
|
if [[ "$submodule_path" == */src ]]; then
|
||||||
submodule_name=$(basename "$submodule_path")
|
submodule_name=$(basename "$(dirname "$submodule_path")")
|
||||||
|
else
|
||||||
|
submodule_name=$(basename "$submodule_path")
|
||||||
|
fi
|
||||||
|
|
||||||
# Create the directory for the submodule
|
# Check if the submodule directory (without /src) contains at least one .nimble file
|
||||||
submodule_dir="$nimble_pkgs_dir/${submodule_name}-#head"
|
base_dir="${submodule_path%/src}"
|
||||||
mkdir -p "$submodule_dir"
|
# Check if there is at least one .nimble file in the directory (excluding empty matches)
|
||||||
|
nimble_files_count=$(find "$base_dir" -maxdepth 1 -type f -name "*.nimble" | wc -l)
|
||||||
|
|
||||||
# Create the .nimble-link file with the absolute path
|
# Proceed only if there is at least one .nimble file
|
||||||
nimble_link_file="$submodule_dir/${submodule_name}.nimble-link"
|
if [ "$nimble_files_count" -gt 0 ]; then
|
||||||
echo "$submodule_path" > "$nimble_link_file"
|
# Create the directory for the submodule
|
||||||
|
submodule_dir="$nimble_pkgs_dir/${submodule_name}-#head"
|
||||||
|
mkdir -p "$submodule_dir"
|
||||||
|
|
||||||
|
# Create the .nimble-link file with the absolute path
|
||||||
|
nimble_link_file="$submodule_dir/${submodule_name}.nimble-link"
|
||||||
|
echo "$submodule_path" > "$nimble_link_file"
|
||||||
|
echo "$submodule_path" >> "$nimble_link_file"
|
||||||
|
fi
|
||||||
done < "$output_file"
|
done < "$output_file"
|
||||||
|
|
||||||
echo "Nimble packages prepared in $nimble_pkgs_dir"
|
echo "Nimble packages prepared in $nimble_pkgs_dir"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user