diff --git a/build.sh b/build.sh index a94094d8e3..5287ae1bb4 100755 --- a/build.sh +++ b/build.sh @@ -5,8 +5,10 @@ hash cmake 2>/dev/null || { echo >&2 "No cmake, please run 'sudo apt-get install hash g++ 2>/dev/null || { echo >&2 "No g++, please run 'sudo apt-get install g++'"; exit 1; } hash dotnet 2>/dev/null || { echo >&2 "No dotnet, please visit https://dotnet.github.io/getting-started/"; exit 1; } +TOP="$(pwd)/src/Microsoft.PowerShell.Linux.Host" + # Test for lock file -test -r src/Microsoft.PowerShell.Linux.Host/project.lock.json || { echo >&2 "Please run 'dotnet restore' to download .NET Core packages"; exit 2; } +test -r "$TOP/project.lock.json" || { echo >&2 "Please run 'dotnet restore' to download .NET Core packages"; exit 2; } # Ensure output directory is made BIN="$(pwd)/bin" @@ -16,13 +18,13 @@ mkdir -p "$BIN" pushd src/libpsl-native cmake -DCMAKE_BUILD_TYPE=Debug . make -j -ctest -V -test -r src/libpsl-native.* || { echo >&2 "Compilation of libpsl-native failed"; exit 3; } -cp src/libpsl-native.* "$BIN" +make test popd +test -r $TOP/libpsl-native.* || { echo >&2 "Compilation of libpsl-native failed"; exit 3; } + # Publish PowerShell to bin, with LINUX defined through a configuration -dotnet publish --output "$BIN" --configuration Linux src/Microsoft.PowerShell.Linux.Host +dotnet publish --output "$BIN" --configuration Linux "$TOP" # Fix permissions for packaging chmod -R go=u "$BIN"