Skip to content

WIP Update NuGet packages in 2.0.0 branch #831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ registered_data.ini
.dotnet/
module/Plaster
module/PSScriptAnalyzer
module/PSReadLine
docs/_site/
docs/_repo/
docs/metadata/
Expand Down
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ language: cpp
git:
depth: 1000

os:
- linux
- osx
sudo: required
dist: trusty
osx_image: xcode8.3
matrix:
include:
- os: linux
dist: trusty
sudo: required
- os: osx
osx_image: xcode9.4

before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
Expand All @@ -26,4 +27,4 @@ install:

script:
- ulimit -n 4096
- powershell -File scripts/travis.ps1
- pwsh -File scripts/travis.ps1
8 changes: 1 addition & 7 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<clear />
<add key="CI Builds (dotnet-core)" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="powershell-core" value="https://powershell.myget.org/F/powershell-core/api/v3/index.json" />
</packageSources>
</configuration>
</configuration>
3 changes: 1 addition & 2 deletions PowerShellEditorServices.Common.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>1.9.1</VersionPrefix>
<VersionPrefix>2.0.0</VersionPrefix>
<Company>Microsoft</Company>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageTags>PowerShell;editor;development;language;debugging</PackageTags>
Expand All @@ -9,6 +9,5 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/PowerShell/PowerShellEditorServices</RepositoryUrl>
<DebugType>portable</DebugType>
<RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion>
</PropertyGroup>
</Project>
305 changes: 214 additions & 91 deletions PowerShellEditorServices.build.ps1

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
version: '1.9.1{build}'
version: '2.0.0{build}'
image: Visual Studio 2017
clone_depth: 10
skip_tags: true

branches:
only:
- master
- 2.0.0

environment:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Don't download unneeded packages
DOTNET_CLI_TELEMETRY_OPTOUT: true # Don't send telemetry

install:
- ps: |
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null
Get-Module PowerShellGet,PackageManagement | Remove-Module -Force -Verbose
powershell -Command { Install-Module -Name PowershellGet -MinimumVersion 1.6 -force -confirm:$false -verbose }
powershell -Command { Install-Module -Name PackageManagement -MinimumVersion 1.1.7.0 -Force -Confirm:$false -Verbose }
Import-Module -Name PowerShellGet -MinimumVersion 1.6 -Force
Import-Module -Name PackageManagement -MinimumVersion 1.1.7.0 -Force
Install-PackageProvider -Name NuGet -Force | Out-Null
Import-PackageProvider NuGet -Force | Out-Null
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | Out-Null
Install-Module InvokeBuild -MaximumVersion 5.1.0 -Scope CurrentUser -Force | Out-Null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#

if (!$PSVersionTable.PSEdition -or $PSVersionTable.PSEdition -eq "Desktop") {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/Microsoft.PowerShell.EditorServices.VSCode.dll"
}
else {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.VSCode.dll"
}
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.VSCode.dll"

if ($psEditor -is [Microsoft.PowerShell.EditorServices.Extensions.EditorObject]) {
[Microsoft.PowerShell.EditorServices.VSCode.ComponentRegistration]::Register($psEditor.Components)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PowerShellEditorServices.psm1'

# Version number of this module.
ModuleVersion = '1.9.1'
ModuleVersion = '2.0.0'

# ID used to uniquely identify this module
GUID = '9ca15887-53a2-479a-9cda-48d26bcb6c47'
Expand Down
21 changes: 13 additions & 8 deletions module/PowerShellEditorServices/PowerShellEditorServices.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#

if (!$PSVersionTable.PSEdition -or $PSVersionTable.PSEdition -eq "Desktop") {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/Microsoft.PowerShell.EditorServices.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/Microsoft.PowerShell.EditorServices.Host.dll"
}
else {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.Protocol.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.Host.dll"
# Need to load pipe handling shim assemblies in Windows PowerShell and PSCore 6.0 because they don't have WCP
if ($PSEdition -eq 'Desktop') {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/System.IO.Pipes.AccessControl.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/System.Security.AccessControl.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/System.Security.Principal.Windows.dll"
} elseif ($PSVersionTable.PSVersion -ge '6.0' -and $PSVersionTable.PSVersion -lt '6.1' -and $IsWindows) {
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/6.0/System.IO.Pipes.AccessControl.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/6.0/System.Security.AccessControl.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/6.0/System.Security.Principal.Windows.dll"
}

Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.Host.dll"
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.Protocol.dll"

function Start-EditorServicesHost {
[CmdletBinding()]
param(
Expand Down
3 changes: 2 additions & 1 deletion module/PowerShellEditorServices/Start-EditorServices.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ try {
-BundledModulesPath $BundledModulesPath `
-EnableConsoleRepl:$EnableConsoleRepl.IsPresent `
-DebugServiceOnly:$DebugServiceOnly.IsPresent `
-WaitForDebugger:$WaitForDebugger.IsPresent
-WaitForDebugger:$WaitForDebugger.IsPresent `
-FeatureFlags $FeatureFlags

# TODO: Verify that the service is started
Log "Start-EditorServicesHost returned $editorServicesHost"
Expand Down
5 changes: 5 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
"MinimumVersion":"1.0",
"MaximumVersion":"1.99",
"AllowPrerelease":false
},
"PSReadLine":{
"MinimumVersion":"2.0.0-beta3",
"MaximumVersion":"2.1",
"AllowPrerelease":true
}
}
152 changes: 1 addition & 151 deletions scripts/download.sh
Original file line number Diff line number Diff line change
@@ -1,153 +1,3 @@
#!/usr/bin/env bash

# Let's quit on interrupt of subcommands
trap '
trap - INT # restore default INT handler
echo "Interrupted"
kill -s INT "$$"
' INT

get_url() {
fork=$2
release=v6.0.0-beta.1
echo "https://github.com/$fork/PowerShell/releases/download/$release/$1"
}

fork="PowerShell"
# Get OS specific asset ID and package name
case "$OSTYPE" in
linux*)
source /etc/os-release
# Install curl and wget to download package
case "$ID" in
centos*)
if ! hash curl 2>/dev/null; then
echo "curl not found, installing..."
sudo yum install -y curl
fi

package=powershell-6.0.0_beta.1-1.el7.centos.x86_64.rpm
;;
ubuntu)
if ! hash curl 2>/dev/null; then
echo "curl not found, installing..."
sudo apt-get install -y curl
fi

case "$VERSION_ID" in
14.04)
package=powershell_6.0.0-beta.1-1ubuntu1.14.04.1_amd64.deb
;;
16.04)
package=powershell_6.0.0-beta.1-1ubuntu1.16.04.1_amd64.deb
;;
*)
echo "Ubuntu $VERSION_ID is not supported!" >&2
exit 2
esac
;;
opensuse)
if ! hash curl 2>/dev/null; then
echo "curl not found, installing..."
sudo zypper install -y curl
fi


case "$VERSION_ID" in
42.1)
# TODO during next release remove fork and fix package name
fork=TravisEz13
package=powershell-6.0.0_beta.1-1.suse.42.1.x86_64.rpm
;;
*)
echo "OpenSUSE $VERSION_ID is not supported!" >&2
exit 2
esac
;;
*)
echo "$NAME is not supported!" >&2
exit 2
esac
;;
darwin*)
# We don't check for curl as macOS should have a system version
package=powershell-6.0.0-beta.1-osx.10.12-x64.pkg
;;
*)
echo "$OSTYPE is not supported!" >&2
exit 2
;;
esac

curl -L -o "$package" $(get_url "$package" "$fork")

if [[ ! -r "$package" ]]; then
echo "ERROR: $package failed to download! Aborting..." >&2
exit 1
fi

# Installs PowerShell package
case "$OSTYPE" in
linux*)
source /etc/os-release
# Install dependencies
echo "Installing PowerShell with sudo..."
case "$ID" in
centos)
# yum automatically resolves dependencies for local packages
sudo yum install "./$package"
;;
ubuntu)
# dpkg does not automatically resolve dependencies, but spouts ugly errors
sudo dpkg -i "./$package" &> /dev/null
# Resolve dependencies
sudo apt-get install -f
;;
opensuse)
# Install the Microsoft public key so that zypper trusts the package
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
# zypper automatically resolves dependencies for local packages
sudo zypper --non-interactive install "./$package" &> /dev/null
;;
*)
esac
;;
darwin*)
patched=0
if hash brew 2>/dev/null; then
brew update
if [[ ! -d $(brew --prefix openssl) ]]; then
echo "Installing OpenSSL with brew..."
if ! brew install openssl; then
echo "ERROR: OpenSSL failed to install! Crypto functions will not work..." >&2
# Don't abort because it is not fatal
elif ! brew install curl --with-openssl; then
echo "ERROR: curl failed to build against OpenSSL; SSL functions will not work..." >&2
# Still not fatal
else
# OpenSSL installation succeeded; reme mber to patch System.Net.Http after PowerShell installation
patched=1
fi
fi

else
echo "ERROR: brew not found! OpenSSL may not be available..." >&2
# Don't abort because it is not fatal
fi

echo "Installing $package with sudo ..."
sudo installer -pkg "./$package" -target /
if [[ $patched -eq 1 ]]; then
echo "Patching System.Net.Http for libcurl and OpenSSL..."
find /usr/local/microsoft/powershell -name System.Net.Http.Native.dylib | xargs sudo install_name_tool -change /usr/lib/libcurl.4.dylib /usr/local/opt/curl/lib/libcurl.4.dylib
fi
;;
esac

powershell -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME"'
success=$?

if [[ "$success" != 0 ]]; then
echo "ERROR: PowerShell failed to install!" >&2
exit "$success"
fi
bash <(curl -s https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh)
2 changes: 1 addition & 1 deletion scripts/travis.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

$ErrorActionPreference = 'Stop'

# Install InvokeBuild
Install-Module InvokeBuild -MaximumVersion 5.1.0 -Scope CurrentUser -Force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public WebsocketClientChannel(string url)
this.serverUrl = url;
}

public override async Task WaitForConnection()
public override async Task WaitForConnectionAsync()
{
try
{
Expand All @@ -52,7 +52,7 @@ public override async Task WaitForConnection()
{
Logger.Write(LogLevel.Warning,
string.Format("Failed to connect to WebSocket server. Error was '{0}'", wsException.Message));

}

throw;
Expand Down Expand Up @@ -99,7 +99,7 @@ protected override void Shutdown()
}

/// <summary>
/// Extension of <see cref="MemoryStream"/> that sends data to a WebSocket during FlushAsync
/// Extension of <see cref="MemoryStream"/> that sends data to a WebSocket during FlushAsync
/// and reads during WriteAsync.
/// </summary>
internal class ClientWebSocketStream : MemoryStream
Expand All @@ -110,7 +110,7 @@ internal class ClientWebSocketStream : MemoryStream
/// Constructor
/// </summary>
/// <remarks>
/// It is expected that the socket is in an Open state.
/// It is expected that the socket is in an Open state.
/// </remarks>
/// <param name="socket"></param>
public ClientWebSocketStream(ClientWebSocket socket)
Expand All @@ -119,7 +119,7 @@ public ClientWebSocketStream(ClientWebSocket socket)
}

/// <summary>
/// Reads from the WebSocket.
/// Reads from the WebSocket.
/// </summary>
/// <param name="buffer"></param>
/// <param name="offset"></param>
Expand All @@ -138,7 +138,7 @@ public override async Task<int> ReadAsync(byte[] buffer, int offset, int count,
{
result = await socket.ReceiveAsync(new ArraySegment<byte>(buffer, offset, count), cancellationToken);
} while (!result.EndOfMessage);

if (result.MessageType == WebSocketMessageType.Close)
{
await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Closing", cancellationToken);
Expand Down
Loading