From 03c452c98ced868a6dd8eb1c4b5bbbfbb83a965a Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Mon, 28 Mar 2016 13:58:00 -0700 Subject: [PATCH 1/3] Deploy native library automatically --- PowerShellGitHubDev.psm1 | 3 +-- src/Microsoft.PowerShell.Linux.Host/.gitignore | 1 + src/Microsoft.PowerShell.Linux.Host/project.json | 4 +++- xunit.sh | 11 +---------- 4 files changed, 6 insertions(+), 13 deletions(-) create mode 100644 src/Microsoft.PowerShell.Linux.Host/.gitignore diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 555f14e007..0375d2a8da 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -145,7 +145,7 @@ function Start-PSBuild $Ext = if ($IsLinux) { "so" } elseif ($IsOSX) { "dylib" } $Native = "$PSScriptRoot/src/libpsl-native" - $Lib = "$Native/src/libpsl-native.$Ext" + $Lib = "$Top/libpsl-native.$Ext" Write-Verbose "Building $Lib" try { @@ -158,7 +158,6 @@ function Start-PSBuild } if (-Not (Test-Path $Lib)) { throw "Compilation of $Lib failed" } - Copy-Item $Lib $Output } } else diff --git a/src/Microsoft.PowerShell.Linux.Host/.gitignore b/src/Microsoft.PowerShell.Linux.Host/.gitignore new file mode 100644 index 0000000000..aa00c4e67c --- /dev/null +++ b/src/Microsoft.PowerShell.Linux.Host/.gitignore @@ -0,0 +1 @@ +*.a \ No newline at end of file diff --git a/src/Microsoft.PowerShell.Linux.Host/project.json b/src/Microsoft.PowerShell.Linux.Host/project.json index c24629b4ba..bb59090d33 100644 --- a/src/Microsoft.PowerShell.Linux.Host/project.json +++ b/src/Microsoft.PowerShell.Linux.Host/project.json @@ -19,7 +19,9 @@ "content": [ "Modules", - "PSL_profile.ps1" + "*_profile.ps1", + "*.so", + "*.dylib" ], "frameworks": { diff --git a/xunit.sh b/xunit.sh index f20e31bb2f..2813b4274f 100755 --- a/xunit.sh +++ b/xunit.sh @@ -8,21 +8,12 @@ hash dotnet 2>/dev/null || { echo >&2 "No dotnet, please visit https://dotnet.gi # Test for lock file test -r test/csharp/project.lock.json || { echo >&2 "Please run 'dotnet restore' to download .NET Core packages"; exit 2; } -# Build native components -pushd src/libpsl-native -cmake -DCMAKE_BUILD_TYPE=Debug . -make -j -ctest -V -## Work-around dotnet/cli#710 -export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(pwd)/src" -popd - # Run xUnit tests pushd test/csharp ## Build dotnet build -c Linux ## Work-around dotnet/cli#753 -cp -r ../../src/Microsoft.PowerShell.Linux.Host/Modules bin/Linux/netstandardapp1.5/ubuntu.14.04-x64 +cp -r -f ../../src/Microsoft.PowerShell.Linux.Host/{Modules,*.so,*.dylib} bin/Linux/netstandardapp1.5/ubuntu.14.04-x64 2>/dev/null ## Test dotnet test -c Linux result=$? From 489af530528806132cb0a16506acd9d34c0c258f Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Mon, 28 Mar 2016 14:04:55 -0700 Subject: [PATCH 2/3] Bump libpsl-native submodule --- src/libpsl-native | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libpsl-native b/src/libpsl-native index 454524cf72..4bb241ad11 160000 --- a/src/libpsl-native +++ b/src/libpsl-native @@ -1 +1 @@ -Subproject commit 454524cf7294021584a3005f2f3243c80b670a89 +Subproject commit 4bb241ad11c54985617343fbeb8700cfdcdf7ae0 From 497afcd23711c3282ca5fdd3e295f56fc9314686 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 29 Mar 2016 11:46:16 -0700 Subject: [PATCH 3/3] Fix build.sh for new location of libpsl-native --- build.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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"