8000 Revert "Pull PSReadLine from PSGallery" by adityapatwardhan · Pull Request #5986 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Revert "Pull PSReadLine from PSGallery" #5986

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

Merged
merged 2 commits into from
Jan 23, 2018
Merged
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 PowerShell-Win.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Management.Infras
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerShell.Commands.Diagnostics", "src\Microsoft.PowerShell.Commands.Diagnostics\Microsoft.PowerShell.Commands.Diagnostics.csproj", "{439A24FC-8E0A-48B6-8227-44C297311F49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerShell.PSReadLine", "src\Microsoft.PowerShell.PSReadLine\Microsoft.PowerShell.PSReadLine.csproj", "{07BFD271-8992-4F34-9091-6CFC3E224A24}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.WSMan.Management", "src\Microsoft.WSMan.Management\Microsoft.WSMan.Management.csproj", "{8F63D134-E413-4181-936D-D82F3F5F1D85}"
EndProject
Expand Down
134 changes: 92 additions & 42 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,9 @@ Fix steps:

# handle Restore
if ($Restore -or -not (Test-Path "$($Options.Top)/obj/project.assets.json")) {
$srcProjectDirs = @($Options.Top, "$PSScriptRoot/src/TypeCatalogGen", "$PSScriptRoot/src/ResGen", "$PSScriptRoot/src/Modules/PSGalleryModules.csproj")
log "Run dotnet restore"

$srcProjectDirs = @($Options.Top, "$PSScriptRoot/src/TypeCatalogGen", "$PSScriptRoot/src/ResGen")
$testProjectDirs = Get-ChildItem "$PSScriptRoot/test/*.csproj" -Recurse | ForEach-Object { [System.IO.Path]::GetDirectoryName($_) }

$RestoreArguments = @("--verbosity")
Expand All @@ -531,11 +533,7 @@ Fix steps:
$RestoreArguments += "quiet"
}

($srcProjectDirs + $testProjectDirs) | ForEach-Object {
log "Run dotnet restore $_ $RestoreArguments"

Start-NativeExecution { dotnet restore $_ $RestoreArguments }
}
($srcProjectDirs + $testProjectDirs) | ForEach-Object { Start-NativeExecution { dotnet restore $_ $Resto 2364 reArguments } }
}

# handle ResGen
Expand Down Expand Up @@ -648,11 +646,17 @@ function Restore-PSModuleToBuild
$CI
)

$ProgressPreference = "SilentlyContinue"
log "Restore PowerShell modules to $publishPath"

$modulesDir = Join-Path -Path $publishPath -ChildPath "Modules"

Copy-PSGalleryModules -Destination $modulesDir
# Restore modules from powershellgallery feed
Restore-PSModule -Destination $modulesDir -Name @(
# PowerShellGet depends on PackageManagement module, so PackageManagement module will be installed with the PowerShellGet module.
'PowerShellGet'
'Microsoft.PowerShell.Archive'
) -SourceLocation "https://www.powershellgallery.com/api/v2/"

if($CI.IsPresent)
{
Expand All @@ -671,7 +675,6 @@ function Restore-PSPester

Restore-GitModule -Destination $Destination -Uri 'https://github.com/PowerShell/psl-pester' -Name Pester -CommitSha '1f546b6aaa0893e215e940a14f57c96f56f7eff1'
}

function Compress-TestContent {
[CmdletBinding()]
param(
Expand Down Expand Up @@ -2352,6 +2355,7 @@ function Start-CrossGen {
"Microsoft.PowerShell.Security.dll",
"Microsoft.PowerShell.CoreCLR.Eventing.dll",
"Microsoft.PowerShell.ConsoleHost.dll",
"Microsoft.PowerShell.PSReadLine.dll",
"System.Management.Automation.dll"
)

Expand Down Expand Up @@ -2460,56 +2464,102 @@ function Restore-GitModule
}

# Install PowerShell modules such as PackageManagement, PowerShellGet
function Copy-PSGalleryModules
function Restore-PSModule
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Destination
[string[]]$Name,

[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Destination,

[string]$SourceLocation="https://powershell.myget.org/F/powershellmodule/api/v2/",

[string]$RequiredVersion
)

if (!$Destination.EndsWith("Modules")) {
throw "Installing to an unexpected location"
}
$needRegister = $true
$RepositoryName = "mygetpsmodule"

$cache = dotnet nuget locals global-packages -l
if ($cache -match "info : global-packages: (.*)") {
$nugetCache = $matches[1]
}
else {
throw "Can't find nuget global cache"
# Check if the PackageManagement works in the base-oS or PowerShellCore
$null = Get-PackageProvider -Name NuGet -ForceBootstrap -Verbose:$VerbosePreference
$null = Get-PackageProvider -Name PowerShellGet -Verbose:$VerbosePreference

# Get the existing registered PowerShellGet repositories
$psrepos = PowerShellGet\Get-PSRepository

foreach ($repo in $psrepos)
{
if(($repo.SourceLocation -eq $SourceLocation) -or ($repo.SourceLocation.TrimEnd("/") -eq $SourceLocation.TrimEnd("/")))
{
# found a registered repository that matches the source location
$needRegister = $false
$RepositoryName = $repo.Name
break
}
}

$psGalleryProj = [xml](Get-Content -Raw $PSScriptRoot\src\Modules\PSGalleryModules.csproj)
if($needRegister)
{
$regVar = PowerShellGet\Get-PSRepository -Name $RepositoryName -ErrorAction SilentlyContinue
if($regVar)
{
PowerShellGet\UnRegister-PSRepository -Name $RepositoryName
}

foreach ($m in $psGalleryProj.Project.ItemGroup.PackageReference) {
$name = $m.Include
$version = $m.Version
log "Name='$Name', Version='$version', Destination='$Destination'"
log "Registering PSRepository with name: $RepositoryName and sourcelocation: $SourceLocation"
PowerShellGet\Register-PSRepository -Name $RepositoryName -SourceLocation $SourceLocation -ErrorVariable ev -verbose
if($ev)
{
throw ("Failed to register repository '{0}'" -f $RepositoryName)
}

# Remove the build revision from the src (nuget drops it).
$srcVer = if ($version -match "(\d+.\d+.\d+).\d+") {
$matches[1]
} else {
$version
$regVar = PowerShellGet\Get-PSRepository -Name $RepositoryName
if(-not $regVar)
{
throw ("'{0}' is not registered" -f $RepositoryName)
}
#
# Remove semantic version in the destination directory
$destVer = if ($version -match "(\d+.\d+.\d+)-.+") {
$matches[1]
} else {
$version
}

log ("Name='{0}', Destination='{1}', Repository='{2}'" -f ($Name -join ','), $Destination, $RepositoryName)

# do not output progress
$ProgressPreference = "SilentlyContinue"
$Name | ForEach-Object {

$command = @{
Name=$_
Path = $Destination
Repository =$RepositoryName
}

if($RequiredVersion)
{
$command.Add("RequiredVersion", $RequiredVersion)
}

# Nuget seems to always use lowercase in the cache
$src = "$nugetCache/$($name.ToLower())/$srcVer"
$dest = "$Destination/$name/$destVer"
# pull down the module
log "running save-module $_"
PowerShellGet\Save-Module @command -Force

# Remove PSGetModuleInfo.xml file
Find-Module -Name $_ -Repository $RepositoryName -IncludeDependencies | ForEach-Object {
Remove-Item -Path $Destination\$($_.Name)\*\PSGetModuleInfo.xml -Force
}
}

Remove-Item -Force -ErrorAction Ignore -Recurse "$Destination/$name"
New-Item -Path $dest -ItemType Directory -Force -ErrorAction Stop > $null
$dontCopy = '*.nupkg', '*.nupkg.sha512', '*.nuspec', 'System.Runtime.InteropServices.RuntimeInformation.dll'
Copy-Item -Exclude $dontCopy -Recurse $src/* $dest
# Clean up
if($needRegister)
{
$regVar = PowerShellGet\Get-PSRepository -Name $RepositoryName -ErrorAction SilentlyContinue
if($regVar)
{
log "Unregistering PSRepository with name: $RepositoryName"
PowerShellGet\UnRegister-PSRepository -Name $RepositoryName
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion docs/building/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ We are calling `dotnet` tool build for `$Top` directory
### Dummy dependencies

We use dummy dependencies between projects to leverage `dotnet` build functionality.
For example, `src\powershell-win-core\powershell-win-core.csproj` has depen 10000 dency on `Microsoft.PowerShell.Commands.Diagnostics.csproj`,
For example, `src\powershell-win-core\powershell-win-core.csproj` has dependency on `Microsoft.PowerShell.PSReadLine`,
but in reality, there is no build dependency.

Dummy dependencies allows us to build just `$Top` folder, instead of building several folders.
Expand Down
5 changes: 5 additions & 0 deletions docs/testing-guidelines/CodeCoverageAnalysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The following table shows the status for the above commit, dated 06/18/2017
| Microsoft.PowerShell.CoreCLR.AssemblyLoadContext | 97.65% |
| Microsoft.PowerShell.CoreCLR.Eventing | 29.91% |
| Microsoft.PowerShell.LocalAccounts | 86.35% |
| Microsoft.PowerShell.PSReadLine | 10.18% |
| Microsoft.PowerShell.Security | 44.44% |
| Microsoft.WSMan.Management | 4.91% |
| System.Management.Automation | 50.42% |
Expand Down Expand Up @@ -51,6 +52,10 @@ The following table shows the status for the above commit, dated 06/18/2017

- [ ] Add tests for ETW events. [#4156](https://github.com/PowerShell/PowerShell/issues/4156)

### Microsoft.PowerShell.PSReadLine

- [ ] We need tests from PSReadline repo or ignore coverage data for this module. (This will be filtered out.)

### Microsoft.PowerShell.Security

- [ ] Add tests for *-Acl cmdlets. [4157] (https://github.com/PowerShell/PowerShell/issues/4157)
Expand Down
1 change: 0 additions & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="powershell-core" value="https://powershell.myget.org/F/powershell-core/api/v3/index.json" />
<add key="PSGallery" value="https://www.powershellgallery.com/api/v2/" />
</packageSources>
</configuration>
19 changes: 19 additions & 0 deletions src/Microsoft.PowerShell.PSReadLine/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/

using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTrademark("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("36053fb0-0bd0-4a1c-951c-b2ec109deca3")]
Loading
0