2020-04-24 07:18:00 +02:00
|
|
|
#! /usr/bin/env nix-shell
|
|
|
|
#! nix-shell -p python3 dotnet-sdk_3 -i bash
|
|
|
|
|
|
|
|
# Run this script to generate deps.nix
|
|
|
|
# ./create_deps.sh /path/to/microsoft/python/language/server/source/checkout
|
|
|
|
|
2021-05-03 19:17:00 +02:00
|
|
|
set -euo pipefail
|
|
|
|
|
2020-04-24 07:18:00 +02:00
|
|
|
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
|
|
|
|
if [ -d "$1" ]; then
|
|
|
|
CHECKOUT_PATH="$1"
|
|
|
|
else
|
|
|
|
echo "First argument must be a directory, the path to the Microsoft Python Language Server source checkout"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Generate lockfiles in source checkout
|
2021-05-03 19:17:00 +02:00
|
|
|
cd "$CHECKOUT_PATH/src"
|
2020-04-24 07:18:00 +02:00
|
|
|
dotnet nuget locals all --clear
|
|
|
|
dotnet restore -v normal --no-cache PLS.sln --use-lock-file -r linux-x64
|
|
|
|
|
|
|
|
# Use the lockfiles to make a file with two columns: name and version number
|
|
|
|
# for all possible package dependencies
|
2021-05-03 19:17:00 +02:00
|
|
|
cd "$SCRIPTDIR"
|
2020-04-24 07:18:00 +02:00
|
|
|
echo "" > all_versions.txt
|
|
|
|
for lockfile in $(find "$CHECKOUT_PATH" -name packages.lock.json); do
|
|
|
|
echo "Processing lockfile $lockfile"
|
|
|
|
python ./process_lockfile.py "$lockfile" >> all_versions.txt
|
|
|
|
done
|
|
|
|
# Add extra manually added packages
|
|
|
|
cat ./manual_deps.txt >> all_versions.txt
|
|
|
|
cat all_versions.txt | sed '/^$/d' | sort | uniq > tmp
|
|
|
|
mv tmp all_versions.txt
|
|
|
|
|
|
|
|
# Retrieve sha256 hashes for each dependency and format fetchNuGet calls into deps.nix
|
|
|
|
./format-deps.sh all_versions.txt > deps.nix
|
|
|
|
rm all_versions.txt
|