Commit graph

6111 commits

Author SHA1 Message Date
Steve Lee 11a98c47fb Update third party notices (#7042)
Based on adding a reference to new assemblies, need to update ThirdPartyNotices.txt
Add ThirdPartyNotices to all packages
2018-06-12 10:58:05 -07:00
Christoph Bergmeister fbbca53f4c AppVeyor build matrix: more efficient build job split to reduce total time by another 5 minutes (#7021)
Closes #6944

Following PR #6945, further, reduce the total build time (without any disadvantages) by around 5 minutes by making sure there is a more even split between the 2 build jobs (the 2nd build job used to be much shorter).
Therefore this PR moves also the xUnit and Pester-Admin tests into the 2nd build job. If it is a daily/feature test commit, then the feature tests will also happen (only) in the 2nd build job. Because both jobs now run tests, the failfast option was removed. The final question from my side is whether running tests in 2 build jobs is OK for the daily build, which uploads code coverage results?

The time to wait for the AppVeyor build results is now 15 +/- 2 minutes, which is a huge improvement to what used to be around 28 minutes before the build matrix was introduced.
2018-06-11 14:18:51 -07:00
Steve Lee 50d061148d Remove 'SemanticVersion' from 'knowntypes' list in serialization code to enable interop between WinPS and PSCore (#7016)
PowerShell serialization has a list of known PowerShell types. When an object is deserialized containing a known type it tries to deserialize the object to that specific type and throws an exception if it can't succeed. SemanticVersion only exists in PSCore6 so when remoting from Windows PowerShell or importing clixml generated from PSCore6 that contains SemanticVersion, it fails.

With this fix, it will be rehydrated as a "PSObject" with "Deseriealized.System.Management.Automation.SemanticVersion" in the 'TypeNames' in both Windows PowerShell and PowerShell Core.
2018-06-08 11:38:14 -07:00
Christoph Bergmeister fa544c33db Update links that contain 'en-us' culture (#7013)
Update links that contain 'en-us' culture to remove 'en-us' culture (if possible) and in some cases update to newer re-directed link to docs.microsoft.com
2018-06-08 10:49:03 +05:00
Dongbo Wang e9e8dc2313
Add Andrew to the default reviewers of the build related files (#7019) 2018-06-07 12:55:14 -07:00
Josh 0d51ea7aea Fix links to PowerShell install docs (#7001) 2018-06-07 17:24:41 +05:00
Bruce Payette 5b90423e63 Fix for #6880 Progress panel displays incorrectly on UNIX when the user is typing. (#6972)
This fixes issue #6880 where user input interferes with the way the progress panel is displayed. If the user types any input while running a command displaying progress, that input would be echoed causing the terminal's cursor position to change. On the next progress write, output would be written using the new, incorrect cursor position. This had the effect of causing the progress pane to "march" across the screen if the user held down a key. The fix is fairly simple - update the physical cursor position right before updating the screen. This still leaves a very small window where an individual update might be off by a character or two but this is not cumulative and will be corrected on the next update. I've added code to SetBufferContents() to do this but only on UNIX. It's not a problem on non-VT100 style consoles.
2018-06-07 08:40:04 +05:00
Travis Plunk 4192463ce6
fix issue with setReleaseTag using variable meant for non-release branches during a release (#7011)
There was a regression in the script where a variable meant for non-release branches was used during releases
2018-06-06 10:55:28 -07:00
Travis Plunk cecdd1ef80
make macOS package use a consistent path (#7006)
Address mac portions of PowerShell/PowerShell-RFC#115 (comment)

Make path when stable /usr/local/microsoft/powershell/6
when not stable (preview) /usr/local/microsoft/powershell/6-preview and symlink name pwsh-preview
allow side-by-side install of stable and preview
Also:

fix an issue where the utime work around for mac requires sudo
refactor some code into common functions
2018-06-06 10:28:22 -07:00
Steve Lee 92cb949cac Use PSReadLine 2.0.0-beta2 from PSGallery (#6998)
Removed building PSReadLine from the repository. Instead, change to downloading from PSGallery.
2018-06-06 09:42:19 -07:00
Dongbo Wang b20dd31398
Fix parser to continue parsing key-value pairs after an If-Statement value in a HashExpression (#7002)
After parsing `if () { }`, new lines are skipped in order to see if either `elseif` or `else` is present. When neither is present, we should resync back to the pointer before skipping those possibly available new lines, so that the new line tokens can be utilized by the subsequent parsing.
2018-06-06 09:38:05 -07:00
Dongbo Wang 2429b43181 Skip compiling the non-supported cmdlets on Unix in System.Management.Automation.dll (#6939)
This is to keep the cache in InitialSessionState in sync with the actual available cmdlet types in System.Management.Automation.dll
2018-06-06 08:08:49 +05:00
Christoph Bergmeister faf832401f Fix broken links due to PR 6899 that removed GitHub docs on installation docs, known issues and breaking changes due to complete migration to docs.microsoft.com (#6981)
* Fix broken installation links in README.md

* fix remaining broken links due to removal of breakingchanges and knownissues docs

* Remove en-us culture from docs links in readme

* Remove last en-us culture link from issue template
2018-06-05 19:37:14 -07:00
Dongbo Wang 6ea1389571
Skip dotnet-cli initialization and stop caching the 'dotnet' folder for Travis CI (#7007) 2018-06-05 15:51:13 -07:00
Robert Holt f559acfae1 Change packaging to differentiate only between major versions and previews (#6968)
Change the *nix packaging over with the following changes:

Package name (as used by e.g. apt):
Non-preview releases are namedpowershell
Preview releases are named powershell-preview
Installation path:
No longer looks like /opt/microsoft/powershell/6.1.0/ or /opt/microsoft/powershell/6.1.0-preview.1/
Non-previews go to a path like /opt/microsoft/powershell/6/
Previews go to a path like /opt/microsoft/powershell/6-preview/
Path to executable symlink:
Allows SxS with preview
Non-previews linked to /usr/bin/pwsh or /usr/local/bin/pwsh on macOS
Previews linked to /usr/bin/pwsh-preview or /usr/local/bin/pwsh-preview on macOS
Implements PowerShell/PowerShell-RFC#115 (comment)
2018-06-05 12:51:47 -07:00
Christoph Bergmeister 2ec3056f9e Use Appveyor matrix for faster PR builds (#6945)
Related: #6944

Reduce PR build time by 5 minutes by:

Having Packaging as a separate build job in a matrix -> runs in parallel in PR builds because the Microsoft account is a paid account that allows that (at no additional costs)
Not caching the dotnet folder anymore, which is too large and the overhead of zipping/unzipping/upload/download does not pay off (and fails in forked builds that are on a free AppVeyor account due to the size).
Setting the environment variable DOTNET_SKIP_FIRST_TIME_EXPERIENCE to 1 because the initialization of the dotnet CLI cache (1 minute) does not pay off for the whole build.
The total build time of builds on a fork that is on a free AppVeyor account and therefore does not have parallelism, remains the same due to the time saving of redundant caching.

This is just a simple example of what we can easily achieve, we could continue this pattern and split the test runs as per the referenced issue to bring PR builds down to 10 minutes (but this will incur an increase for fork builds on free AppVeyor accounts)
2018-06-05 10:48:44 -07:00
Klaudia Algiz cda6ef175c Remove not initialized variable $IsElevated from test in New-Item.Tests.ps1 (#6746)
* Remove not initialized variable  from PowerShell tests

* Separate the tests that requires no elevation from the others.
2018-06-05 10:26:04 -07:00
Sergey Vasin 3b1a4a4722 Replace "Dbg.Assert" with 'if () throw' in CSVCommands.cs.. (#6910)
Add more useful messages.
2018-06-05 22:12:57 +05:00
Christoph Bergmeister f54085f8a3 Create JumpList in background thread to improve performance (#6985)
* Perform JumpList creation in background thread to improve performance when pwsh owns the window (i.e. when the Jumplist has to be created)

* Move JumpList creation to a later stage to allow for more code that might make it exit earlier as suggested in PR review by @iSazonov
2018-06-05 17:44:45 +05:00
Ilya b66013d11c
Disable some StyleCop rules (#6986)
* Disable some StyleCop rules
* Add CodeFactor status badge in README.md
2018-06-05 16:32:06 +05:00
Dongbo Wang 0b32d0c04b [Feature] Minor update on 'GetFileSystemItem' (#6984) 2018-06-05 09:51:04 +05:00
Jan Pazdziora ebc7cdf847 Make the build step fail when the curl operation fails. (#6961)
Without the pipefail, the step always succeeds and the layer gets
cached, resulting in confusion during the next step failing and
subsequent rebuild attempt.
2018-06-04 13:18:07 -07:00
Frederik Carlier d663b41bd5 Remove dependencies on libcurl, libunwind, matching the .NET Core behavior (#6964) 2018-06-04 13:15:27 -07:00
Jan Pazdziora 3cb2424d8e Fix the double curly bracket typo. (#6960) 2018-06-04 12:22:10 -07:00
Ilya d67d87caf0
Add Settings.StyleCop file (#6930)
Disable:
1.SA1402 FileMayOnlyContainASingleType
2.SA1403 FileMayOnlyContainASingleNamespace
3.SA1101 PrefixLocalCallsWithThis
4.SA1126 PrefixCallsCorrectly

Add custom global config file stylecop.json
2018-06-04 10:41:10 +05:00
Steve Lee 5dc7a6cb07 Add Windows Compatibility Pack 2.0.0 to PS Core and adopt the official .NET Core 2.1 (#6958)
To support PowerShell modules built with .NET Windows Compatibility Pack, we decided that it was best to ship the WCP assemblies with PS Core. This also adds many new .NET APIs be default while only adding ~3.5 MB additional disk footprint (to a ~137 MB install currently).
Also update the build to adopt the official .NET Core 2.1.
2018-06-03 22:06:26 -07:00
Ilya 57b3d3380b
Cleanup FileSystem provider (#6909)
The cleanup is coming from a code review to cleanup psl. Here we clean up the side branch of the code that will allow later to clean up a branch which uses psl.
- IO.FileInfo does not make system calls in constructor. So we can create the object and then use the required attributes without direct call IO.FileInfo.GetAttributes() ( SafeGetFileAttributes() ). This allow us to exclude some p/invoke calls in our code in later cleanups. Also we get unified code for both Windows and Unix.
- Remove SafeGetFileAttributes() and WinSafeGetFileAttributes(). Currently .Net Core support file attributes on all platforms in fastest way and we can remove our workaround. We get a regression in rare case (for files like pagefile.sys). Fix is ready in CoreFX, we get it in 2.1.1. I suggest ignore the regression because this is a very-very rare situation (Get-ChildItem c:\pagefile.sys -Hidden). The .Net Core team was not even able to create an artificial test for such files and uses a real pagefile.sys file for the test. Also the enumeration is still working (dir c:\ -hidden).
- Re-add test which we lost in #4050. The test is pending because of the regression.
2018-06-04 10:00:56 +05:00
Sean Wheeler 1f918bb648 Migrating docs from source to docs repo (#6899)
* migrating docs to docs repo
2018-06-01 14:28:09 -07:00
Christoph Bergmeister b851b55ec6 Add Jumplist 'Run as Administrator' to Taskbar on Windows (#6913)
Closes #6649

This is a port of existing C++ Windows PowerShell code from MainEntry.cpp
Some of the code has been copied and minified from the WindowsApiPack.

The code is not compiled for Linux (not sure also another condition is needed for Windows on ARM?).
The code checks if the PowerShell process has a window handle by checking the startupinfo and only then tries to populate the list (and also checks if there is a slot available in the jumplist).
Tested on Windows 10 1803, jumpLists have been supported in Windows since Windows 7, which matches what PowerShell Core supports.
2018-05-31 12:24:19 -07:00
Ilya a5f77955e8
Fix xUnit test GetTempFileName (#6943)
Use Path.GetTempFileName() to get a temporary file.
2018-05-31 11:03:14 +05:00
Ilya c297eac50e
Cleanup NonWindowsGetDomainName() (#6948)
Add an optional extended description…
2018-05-31 10:18:33 +05:00
Sergei Vorobev 115d0715dc Remove myself (@vors) from codeowners for parser (#6952)
I was not able to provide reviews on the vast majority of the auto-assigned reviews.
I don't see a point to keep this auto-assignment.
2018-05-29 09:14:43 +05:00
Steve Lee a707702aac remove deprecated file that is no longer used (#6922) 2018-05-24 16:54:02 +05:00
wesholton84 5263875993 Added line break to error message (#6803) 2018-05-24 08:30:26 +05:00
Klaudia Algiz facb228451 Remove ShouldBeErrorId custom function. (#6891) 2018-05-23 07:57:03 +05:00
Aditya Patwardhan 9f25daa059
Added logic to create signing XML for NuGet packages (#6921) 2018-05-22 15:34:21 -07:00
Darwin 862d99f595 adding path cleanup utility Reset-PWSHSystemPath.ps1 (#6892) 2018-05-22 12:58:51 -07:00
Ilya 6d7799b766
Clean up #if SILVERLIGHT (#6907) 2018-05-22 14:56:45 +05:00
Travis Plunk 948532ac83
Don't cache files that change every build (#6901)
Don't cache files that change every build
Fixes #6894
2018-05-21 14:18:56 -07:00
Travis Plunk ab95de02c5
Make MMI CmdLets full symbols (#6912)
Make MMI cmdlets full symbols

remove properties which are defined in common props file
2018-05-21 14:18:13 -07:00
Ilya 626a83bcd4
Fix tab completions for a hash table (#6839)
Now working:
- Get-Date | Sort-Object @{Expression=<tab>
- Get-Date | Sort-Object @{Expression=...;<tab>
2018-05-21 09:05:59 +05:00
Travis Plunk b43d3e5d00
stop corrupting memory in libpsl-native SetDate (#6881)
stop corrupting memory in libpsl-native SetDate
Addresses #6872 - the first step
2018-05-18 12:56:09 -07:00
Travis Plunk 731efc2369 Update signing xml based on new signing guidelines (#6893) 2018-05-18 11:55:51 -07:00
Klaudia Algiz 4070d51ee1 Add functions into build.psm1 to Save and Restore PSOptions between different sessions. (#6884)
Add functions into build.psm1 to Save and Restore PSOptions between different sessions.
2018-05-17 19:04:20 -07:00
Klaudia Algiz 2df9aac811 Convert ShouldBeErrorId to Should -Throw -ErrorId in PowerShell tests (#6682)
Convert ShouldBeErrorId to Should -Throw -ErrorId in PowerShell tests.
Get rid of try { } catch { } formula to assert that errors were thrown.
Small fixes in tests to obey the new Pester -Parameter syntax.
2018-05-17 14:42:04 -07:00
Steve Lee ed282ce0ef Update PowerShell to build against netcoreapp.2.1-rc1 (#6873) 2018-05-16 23:18:53 -07:00
Matthew Bobke 4e3db1bb93 Fix 'Set-Location DriveName:' to restore current working directory in the drive (#6774) 2018-05-16 17:13:22 -07:00
Dongbo Wang aa0af5ed56
Further improve PSMethod to Delegate conversion (#6851)
Refactor code to make it easier to maintain and a little faster. Changes are as follows:

1. Support finding a matching signature with variance. But make PowerShell prefer exact match over a match with variance.
2. The metadata signatures in `PSMethod<..>` are generated based on the array of method overloads in `MethodCacheEntry.MethodInformationStructures`, in the exact same order. So in `LanguagePrimitive.ConvertViaParseMethod`, when we try to figure out if there is a match using the metadata signatures in `PSMethod<..>`, we can get the index of the matching signature, and the same index should locate the matching method in `MethodCacheEntry.MethodInformationStructures`. Therefore, we don't need to compare signatures again in the actual conversion method, and instead, we can just leverage the index we found when figuring out the conversion in `ConvertViaParseMethod`.
   - This gets rid of the reflection call `GetMethod("Invoke")` and the subsequent signature comparisons in the final conversion method.
   - Also, when comparing signatures using `PSMethod<..>` in `ConvertViaParseMethod`, we can just use the generic argument types of each `Func<..>` metadata type, instead of calling `GetMethod("Invoke")` and then `GetParameters()`. This makes the code for comparing signatures simpler (the type `SignatureComparator`).
   - Move `MatchesPSMethodProjectedType` from `PSMemberInfo.cs` to the type `SignatureComparator` in `LanguagePrimitives.cs`, as it's closely related to the signature comparison. Also, renamed it to `ProjectedTypeMatchesTargetType`.
   - These changes make PSMethod-to-Delegate conversion a little faster, but no big improvement, as the true bottleneck probably is in delegate creation(?). Actually, the performance of this conversion is not critical at all at this moment because this feature should rarely be used in any hot script path. So this exercise is mainly for fun. 
3. Remove `PSEnum<T>`. We can directly use enum types when constructing the metadata type `Func<..>`.
4. Remove the code that generates metadata signatures for generic method definitions (call `MakeGenericMethod` with fake types like `GenericType0`, `GenericType1`). This is because:
   - We don't support convert generic method to delegate today, so may be better not spending time on preparing the metadata signature types for those methods. 
   - When the day comes that we need to support it, it's better to use generic argument types directly to construct the `Func<..>` metadata types. I left comments in `GetMethodGroupType` method in `PSMemberInfo.cs` to explain why that approach is better.
2018-05-15 11:45:04 -07:00
Travis Plunk 472b5f7bd1
Enable full symbols for windows (#6853)
The main purpose of this was to enable full symbols for windows release build.
Also makes explicit where we are optimizing and where we are not optimizing due to https://github.com/dotnet/corefx/issues/29700
2018-05-14 15:01:44 -07:00
Dongbo Wang 0a322ddb70
Update installation doc about Raspbian (#6859) 2018-05-14 12:39:38 -07:00