nimbus-build-system/scripts/create_nbs_paths.sh
Zahary Karadjov 95afb33019
Generate nimbus-build-system.paths from env.sh again
The model where nimbus-build-system.paths were generated as a dependency
from `update-common` proved to create various issues in practice:

* It was not working properly during the repository bootstrapping
  because the paths file generation script is assuming that all
  submodules are already checked out

* It was not always triggered from builds of the top-level targets
  due to missing or already satisfied dependencies on `update-common`.

A more proper solution would structure the dependencies like this:

top-level-project -> nimbus-build-system.paths -> vendor-modules

... but this requires a larger refactoring of the Makefiles, so I'm
merging this interim solution as a way to improve the status quo.
2023-02-23 17:12:35 +02:00

26 lines
751 B
Bash
Executable File

#!/usr/bin/env bash
cd "$TOP_LEVEL_DIR"
# We use a temp path to make this safe under concurrent builds.
# Once the paths file is fully generated, we will move it to its final
# destination. If were were directly writing to the final path instead,
# we risk that the contents produced from multiple `create_nbs_paths.sh`
# invocations may get interleaved.
temp_nbs_paths=$(mktemp nimbus-build-system.paths.XXXXXXXXXXXXXXX)
echo "--noNimblePath" > $temp_nbs_paths
for file in $(ls -d $PWD/vendor/*)
do
if uname | grep -qiE "mingw|msys"; then
file=$(cygpath -m $file)
fi
if [ -d "$file/src" ]; then
echo --path:"\"$file/src\""
else
echo --path:"\"$file\""
fi
done >> $temp_nbs_paths
mv $temp_nbs_paths nimbus-build-system.paths