From 349a62dd563e780fa99357509e7d5bfd0cf25c35 Mon Sep 17 00:00:00 2001 From: Luis Calle <53507599+TheLeoP@users.noreply.github.com> Date: Thu, 9 May 2024 13:01:10 -0500 Subject: [PATCH 01/27] Add a NeoVim LSP/DAP plugin to readme (#2162) --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 614f81096..9c54ca76b 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ The functionality in PowerShell Editor Services is available in the following ed - [lsp-pwsh](https://github.com/emacs-lsp/lsp-mode/blob/master/clients/lsp-pwsh.el), an Emacs PowerShell plugin - [intellij-powershell](https://github.com/ant-druha/intellij-powershell), adds PowerShell language support to IntelliJ-based IDEs - [coc-powershell](https://github.com/yatli/coc-powershell), a Vim and Neovim plugin +- [powershell.nvim](https://github.com/TheLeoP/powershell.nvim) a Neovim plugin Please note that other than PowerShell for Visual Studio Code, these clients are community maintained and may be very out of date. It is recommended that you simply use an LSP plugin for your editor and configure it as demonstrated [below](#Usage). @@ -55,7 +56,7 @@ The start script, `Start-EditorServices.ps1`, is found in the `PowerShellEditorS The session details (which named pipes were created) will be written to the given session details path, and the client needs to point to these in order to connect. -The Visual Studio Code, Vim, and IntelliJ extensions use named pipes. +The Visual Studio Code, Vim, Neovim, and IntelliJ extensions use named pipes. ### Standard Input and Output @@ -130,6 +131,7 @@ The debugging functionality in PowerShell Editor Services is available in the fo - [PowerShell for Visual Studio Code](https://github.com/PowerShell/vscode-powershell) - [nvim-dap-powershell for Neovim](https://github.com/Willem-J-an/nvim-dap-powershell) +- [powershell.nvim for Neovim](https://github.com/TheLeoP/powershell.nvim) ## API Usage @@ -190,7 +192,7 @@ Open the PowerShellEditorServices folder that you cloned locally and press ## Contributions Welcome -We would love to incorporate community contributions into this project. If you would like to +We would love to incorporate community contributions into this project. If you would like to contribute code, documentation, tests, or bug reports, please read our [Contribution Guide](https://github.com/PowerShell/PowerShellEditorServices/blob/main/CONTRIBUTING.md) to learn more. ## Maintainers From a56a361cdd8a4cf837797ab81a6f5ded6d1dd995 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 16 May 2024 14:39:45 -0700 Subject: [PATCH 02/27] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index dddfa22df..686e5e7a0 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,8 +1,10 @@ -# Code of Conduct +# Microsoft Open Source Code of Conduct -This project has adopted the [Microsoft Open Source Code of Conduct][conduct-code]. -For more information see the [Code of Conduct FAQ][conduct-FAQ] or contact [opencode@microsoft.com][conduct-email] with any additional questions or comments. +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -[conduct-code]: http://opensource.microsoft.com/codeofconduct/ -[conduct-FAQ]: http://opensource.microsoft.com/codeofconduct/faq/ -[conduct-email]: mailto:opencode@microsoft.com +Resources: + +- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) +- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns +- Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support) From c33b8ecf4785aaffb13401de0fdf6d81549aac4e Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Wed, 22 May 2024 12:03:17 -0700 Subject: [PATCH 03/27] Disable Dependabot It's having weird bugs and we're giving up on it. --- .github/dependabot.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index e3a2fb57f..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: 2 -updates: -- package-ecosystem: nuget - directory: "/" - labels: [ ] - schedule: - interval: weekly - open-pull-requests-limit: 10 - groups: - OmniSharp: - patterns: - - "OmniSharp.Extensions.*" - xUnit: - patterns: - - "xunit" - - "xunit.*" -- package-ecosystem: github-actions - directory: "/" - labels: [ ] - schedule: - interval: weekly From 5a8ba0bd0772e96e38195283127d41cbe639f8c9 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:10:48 -0700 Subject: [PATCH 04/27] Add SECURITY.md --- SECURITY.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..f941d308b --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin) and [PowerShell](https://github.com/PowerShell). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd). + + From bd1b8aa5864af42fae12e548353b0e1e267dc7c6 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:16:09 -0700 Subject: [PATCH 05/27] Update README.md --- README.md | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9c54ca76b..d09331f89 100644 --- a/README.md +++ b/README.md @@ -190,33 +190,34 @@ PS C:\path\to\PowerShellEditorServices> Invoke-Build Build Open the PowerShellEditorServices folder that you cloned locally and press Ctrl+Shift+B (or Cmd+Shift+B on macOS). +## Code of Conduct + +Please see our [Code of Conduct](CODE_OF_CONDUCT.md) before participating in this project. + ## Contributions Welcome We would love to incorporate community contributions into this project. If you would like to -contribute code, documentation, tests, or bug reports, please read our [Contribution Guide](https://github.com/PowerShell/PowerShellEditorServices/blob/main/CONTRIBUTING.md) to learn more. +contribute code, documentation, tests, or bug reports, please read our [Contribution Guide](CONTRIBUTING.md) to learn more. + +## Security Note + +For any security issues, please see [here](SECURITY.md). ## Maintainers -- [Justin Grote](https://github.com/JustinGrote) - [@JustinWGrote](https://twitter.com/justinwgrote) -- [Patrick Meinecke](https://github.com/SeeminglyScience) - [@SeeminglyScienc](http://twitter.com/SeeminglyScienc) -- [Andy Jordan](https://github.com/andschwa) - [andyleejordan.com](https://andyleejordan.com/) +- Andy Jordan - [@andyleejordan](https://github.com/andyleejordan) +- Patrick Meinecke - [@SeeminglyScience](https://github.com/SeeminglyScience) +- Sydney Smith - [@SydneyhSmith](https://github.com/SydneyhSmith) +- Justin Grote - [@JustinGrote](https://github.com/JustinGrote) ### Emeriti -- [Rob Holt](https://github.com/rjmholt) - [@rjmholt](https://twitter.com/rjmholt) -- [Tyler Leonhardt](https://github.com/TylerLeonhardt) - [tylerleonhardt.com](https://tylerleonhardt.com) -- [David Wilson](https://github.com/daviwil) - [@daviwil](https://twitter.com/daviwil) +- Rob Holt - [@rjmholt](https://github.com/rjmholt) +- Tyler Leonhardt - [@TylerLeonhardt](https://github.com/TylerLeonhardt) +- David Wilson - [@daviwil](https://github.com/daviwil) ## License -This project is [licensed under the MIT License](LICENSE). - -## [Code of Conduct][conduct-md] - -This project has adopted the [Microsoft Open Source Code of Conduct][conduct-code]. -For more information, see the [Code of Conduct FAQ][conduct-FAQ] or contact [opencode@microsoft.com][conduct-email] with any additional questions or comments. - -[conduct-code]: http://opensource.microsoft.com/codeofconduct/ -[conduct-FAQ]: http://opensource.microsoft.com/codeofconduct/faq/ -[conduct-email]: mailto:opencode@microsoft.com -[conduct-md]: https://github.com/PowerShell/PowerShellEditorServices/blob/main/CODE_OF_CONDUCT.md +This project is [licensed under the MIT License](LICENSE). Please see the +[third-party notices](NOTICE.txt) file for details on the third-party +binaries that we include with releases of this project. From 117de607f5f80ba3c85b6905ab0b99c5d42e0165 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Wed, 19 Jun 2024 12:07:01 -0700 Subject: [PATCH 06/27] Enable all workflows regardless of files Otherwise PR gates get stuck on documentation changes. --- .github/workflows/codeql-analysis.yml | 1 - .github/workflows/emacs-test.yml | 1 - .github/workflows/vim-test.yml | 1 - 3 files changed, 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 81deb8c41..d36681fbe 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -6,7 +6,6 @@ on: pull_request: # The branches below must be a subset of the branches above branches: [ main ] - paths-ignore: [ '**/*.md' ] schedule: - cron: '35 13 * * 4' diff --git a/.github/workflows/emacs-test.yml b/.github/workflows/emacs-test.yml index 351b233f9..b7ac6da9f 100644 --- a/.github/workflows/emacs-test.yml +++ b/.github/workflows/emacs-test.yml @@ -6,7 +6,6 @@ on: pull_request: # The branches below must be a subset of the branches above branches: [ main ] - paths-ignore: [ '**/*.md' ] merge_group: types: [ checks_requested ] diff --git a/.github/workflows/vim-test.yml b/.github/workflows/vim-test.yml index 90898830d..ff9d15810 100644 --- a/.github/workflows/vim-test.yml +++ b/.github/workflows/vim-test.yml @@ -6,7 +6,6 @@ on: pull_request: # The branches below must be a subset of the branches above branches: [ main ] - paths-ignore: [ '**/*.md' ] merge_group: types: [ checks_requested ] From e6575bfce7fe684aebfc84781cb3a2c75aa4cf0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Etienne=20Prud=E2=80=99homme?= Date: Tue, 21 May 2024 13:24:58 -0400 Subject: [PATCH 07/27] Fix typo in README.md Fix bad file name for vim-simple-test.vim --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d09331f89..57b18d298 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ This is because because these two features require their own IO streams and stdi Please see the [emacs-simple-test.el](test/emacs-simple-test.el), [emacs-test.el](test/emacs-test.el), -[vim-simple-test.el](test/vim-simple-test.vim) and [vim-test.vim](test/vim-test.vim) for examples of end-to-end tested configurations. +[vim-simple-test.vim](test/vim-simple-test.vim) and [vim-test.vim](test/vim-test.vim) for examples of end-to-end tested configurations. They use [eglot for Emacs](https://github.com/joaotavora/eglot) and [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim). ### Advanced Usage From f494617cbea6b7234e0304355bcefb1c481c470e Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 20 Jun 2024 11:45:34 -0700 Subject: [PATCH 08/27] Enable CodeQL in OneBranch And rely on GitHub's automatic action. --- .github/workflows/codeql-analysis.yml | 53 ------------------- .../PowerShellEditorServices-Official.yml | 9 ++++ 2 files changed, 9 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index d36681fbe..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: CodeQL Analysis - -on: - push: - branches: [ main ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] - schedule: - - cron: '35 13 * * 4' - -jobs: - analyze: - name: analyze - strategy: - fail-fast: false - matrix: - language: [ csharp ] - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - env: - DOTNET_NOLOGO: true - DOTNET_GENERATE_ASPNET_CERTIFICATE: false - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install dotnet - uses: actions/setup-dotnet@v4 - with: - cache: true - cache-dependency-path: '**/*.csproj' - - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - - - name: Install PSResources - shell: pwsh - run: tools/installPSResources.ps1 - - - name: Build - shell: pwsh - run: Invoke-Build Build - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: '/language:${{matrix.language}}' diff --git a/.pipelines/PowerShellEditorServices-Official.yml b/.pipelines/PowerShellEditorServices-Official.yml index 4e9a8743a..3e111a2d3 100644 --- a/.pipelines/PowerShellEditorServices-Official.yml +++ b/.pipelines/PowerShellEditorServices-Official.yml @@ -10,6 +10,14 @@ trigger: none +schedules: +- cron: '35 13 * * 4' + displayName: Weekly CodeQL + branches: + include: + - main + always: true + parameters: - name: debug displayName: Enable debug output @@ -125,6 +133,7 @@ extends: **/System.Reactive.dll; - stage: release dependsOn: build + condition: ne(variables['Build.Reason'], 'Schedule') variables: version: $[ stageDependencies.build.main.outputs['package.version'] ] prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ] From bc2a41a7a0134fa3a19925a19f51aa171fcfd3d7 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:42:28 -0700 Subject: [PATCH 09/27] Update build info task Differentiate Azure DevOps from GitHub Actions. --- PowerShellEditorServices.build.ps1 | 36 ++++++++++-------------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index fecc39a01..59e1dede7 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -97,36 +97,24 @@ Task Clean FindDotNet, BinClean, { } Task CreateBuildInfo { - $buildVersion = "" $buildOrigin = "Development" $buildCommit = git rev-parse HEAD - # Set build info fields on build platforms - if ($env:TF_BUILD) { - if ($env:BUILD_BUILDNUMBER -like "PR-*") { - $buildOrigin = "PR" - } elseif ($env:BUILD_DEFINITIONNAME -like "*-CI") { - $buildOrigin = "CI" - } else { - $buildOrigin = "Release" - } + [xml]$xml = Get-Content "$PSScriptRoot/PowerShellEditorServices.Common.props" + $buildVersion = $xml.Project.PropertyGroup.VersionPrefix + $prerelease = $xml.Project.PropertyGroup.VersionSuffix + if ($prerelease) { $buildVersion += "-$prerelease" } - $propsXml = [xml](Get-Content -Raw -LiteralPath "$PSScriptRoot/PowerShellEditorServices.Common.props") - $propsBody = $propsXml.Project.PropertyGroup - $buildVersion = $propsBody.VersionPrefix - if ($propsBody.VersionSuffix) { - $buildVersion += '-' + $propsBody.VersionSuffix + # Set build info fields on build platforms + if ($env:TF_BUILD) { # Azure DevOps AKA OneBranch + if ($env:BUILD_REASON -like "Manual") { + $buildOrigin = "Release" + } else { + $buildOrigin = "AzureDevOps-CI" } - } - - # Allow override of build info fields (except date) - if ($env:PSES_BUILD_VERSION) { - $buildVersion = $env:PSES_BUILD_VERSION - } - - if ($env:PSES_BUILD_ORIGIN) { - $buildOrigin = $env:PSES_BUILD_ORIGIN + } elseif ($env:GITHUB_ACTIONS) { + $buildOrigin = "GitHub-CI" } [string]$buildTime = [datetime]::Today.ToString("s", [System.Globalization.CultureInfo]::InvariantCulture) From 41fce39f491d5d351b4ac5864e89857ec070e107 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:53:25 -0700 Subject: [PATCH 10/27] Update packages --- .../PowerShellEditorServices.csproj | 6 +++--- .../PowerShellEditorServices.Test.E2E.csproj | 6 +++--- .../PowerShellEditorServices.Test.csproj | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/PowerShellEditorServices/PowerShellEditorServices.csproj b/src/PowerShellEditorServices/PowerShellEditorServices.csproj index 8581053ff..03e11b7fb 100644 --- a/src/PowerShellEditorServices/PowerShellEditorServices.csproj +++ b/src/PowerShellEditorServices/PowerShellEditorServices.csproj @@ -36,10 +36,10 @@ - + - - + + diff --git a/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj b/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj index ec30df02e..e7a7e6480 100644 --- a/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj +++ b/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj @@ -7,10 +7,10 @@ - + - - + + diff --git a/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj b/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj index 548f36c3e..5c6bba34d 100644 --- a/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj +++ b/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj @@ -18,7 +18,7 @@ - + @@ -37,7 +37,7 @@ - + From 29c8d0f5e72f071417954d5d0d7df1e075c2f668 Mon Sep 17 00:00:00 2001 From: Friedrich von Never Date: Fri, 23 Aug 2024 22:57:14 +0200 Subject: [PATCH 11/27] Docs: mention debugging support in intellij-powershell --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 57b18d298..6dec799a5 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,7 @@ The debugging functionality in PowerShell Editor Services is available in the fo - [PowerShell for Visual Studio Code](https://github.com/PowerShell/vscode-powershell) - [nvim-dap-powershell for Neovim](https://github.com/Willem-J-an/nvim-dap-powershell) - [powershell.nvim for Neovim](https://github.com/TheLeoP/powershell.nvim) +- [intellij-powershell](https://github.com/ant-druha/intellij-powershell) ## API Usage From a99180d4ce0594d59ff6577e340c97f7666e42c3 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:36:28 -0700 Subject: [PATCH 12/27] Update build to support CFS for PowerShell modules And a bunch of clean-ups to the build script, updated SDKs, removal of PowerShell 7.3 (EOL), and testing PowerShell daily on merge. --- .github/workflows/ci-test.yml | 9 +- .gitignore | 1 - .../PowerShellEditorServices-Official.yml | 22 +- PowerShellEditorServices.build.ps1 | 275 +++++++----------- modules.json | 10 - .../PowerShellEditorServices.Test.csproj | 11 +- tools/installPSResources.ps1 | 12 +- 7 files changed, 121 insertions(+), 219 deletions(-) delete mode 100644 modules.json diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index ceec61b37..482c8c003 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -47,14 +47,19 @@ jobs: sparse-checkout: tools/install-powershell.ps1 sparse-checkout-cone-mode: false + - name: Install daily + if: ${{ github.event_name == 'schedule' || github.event_name == 'merge_group' }} + shell: pwsh + run: ./pwsh/tools/install-powershell.ps1 -Daily + - name: Build and test shell: pwsh run: Invoke-Build -Configuration Release ${{ github.event_name == 'merge_group' && 'TestFull' || 'Test' }} - - name: Test with daily + - name: Test daily if: ${{ github.event_name == 'schedule' }} shell: pwsh - run: ./pwsh/tools/install-powershell.ps1 -Daily && Invoke-Build -Configuration Release TestE2EDaily + run: Invoke-Build -Configuration Release TestE2EDaily - name: Upload build artifacts if: always() diff --git a/.gitignore b/.gitignore index ae0c4384b..1b97c3908 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ bin/ obj/ module/PowerShellEditorServices/NOTICE.txt module/PowerShellEditorServices/Commands/en-US/ -module/Plaster/ module/PSReadLine/ module/PSScriptAnalyzer/ TestResults/ diff --git a/.pipelines/PowerShellEditorServices-Official.yml b/.pipelines/PowerShellEditorServices-Official.yml index 3e111a2d3..b01b57203 100644 --- a/.pipelines/PowerShellEditorServices-Official.yml +++ b/.pipelines/PowerShellEditorServices-Official.yml @@ -27,7 +27,7 @@ parameters: variables: system.debug: ${{ parameters.debug }} BuildConfiguration: Release - WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2019/vse2022:latest + WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest DOTNET_NOLOGO: true DOTNET_GENERATE_ASPNET_CERTIFICATE: false @@ -46,6 +46,10 @@ extends: asyncSdl: enabled: true forStages: [build] + featureFlags: + WindowsHostVersion: + Version: 2022 + Network: Netlock stages: - stage: build jobs: @@ -75,22 +79,16 @@ extends: inputs: packageType: sdk version: 8.x - - task: UseDotNet@2 - displayName: Use .NET 7.x runtime (for tests) - inputs: - packageType: runtime - version: 7.x - task: UseDotNet@2 displayName: Use .NET 6.x runtime (for tests) inputs: packageType: runtime version: 6.x - - task: PowerShell@2 - displayName: Install PSResources - inputs: - pwsh: true - filePath: tools/installPSResources.ps1 - - pwsh: Invoke-Build TestFull -Configuration $(BuildConfiguration) + - pwsh: | + Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted + Install-Module -Repository CFS -Name InvokeBuild -RequiredVersion 5.11.3 + Install-Module -Repository CFS -Name platyPS -RequiredVersion 0.14.2 + Invoke-Build TestFull -Configuration $(BuildConfiguration) -PSRepository CFS displayName: Build and test - task: PublishTestResults@2 displayName: Publish test results diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index 59e1dede7..cdd71ef57 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -7,11 +7,7 @@ param( [switch]$LocalOmniSharp, - [string]$PsesSubmodulePath = "$PSScriptRoot/module", - - [string]$ModulesJsonPath = "$PSScriptRoot/modules.json", - - [string]$DefaultModuleRepository = "PSGallery", + [string]$PSRepository = "PSGallery", [string]$Verbosity = "minimal", @@ -22,8 +18,8 @@ param( [string[]]$TestArgs = @("--logger", "console;verbosity=minimal", "--logger", "trx") ) -#Requires -Modules @{ModuleName="InvokeBuild"; ModuleVersion="5.0.0"} -#Requires -Modules @{ModuleName="platyPS"; ModuleVersion="0.14.0"} +#Requires -Modules @{ModuleName = "InvokeBuild"; ModuleVersion = "5.0.0"} +#Requires -Modules @{ModuleName = "platyPS"; ModuleVersion = "0.14.2"} $script:dotnetBuildArgs = @( "--verbosity" @@ -40,29 +36,22 @@ $script:dotnetTestArgs = @("test") + $script:dotnetBuildArgs + $TestArgs + @( ) $script:IsNix = $IsLinux -or $IsMacOS -# For Apple M1, pwsh might be getting emulated, in which case we need to check -# for the proc_translated flag, otherwise we can check the architecture. -$script:IsAppleM1 = $IsMacOS -and ((sysctl -n sysctl.proc_translated 2> $null) -eq 1 -or - [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture -eq "Arm64") -$script:IsArm64 = -not $script:IsNix -and @("ARM64") -contains $env:PROCESSOR_ARCHITECTURE -$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Hosting", "BuildInfo.cs") -$script:PsesCommonProps = [xml](Get-Content -Raw "$PSScriptRoot/PowerShellEditorServices.Common.props") +$script:BuildInfoPath = "src/PowerShellEditorServices.Hosting/BuildInfo.cs" $script:NetFramework = @{ PS51 = 'net462' PS72 = 'net6.0' - PS73 = 'net7.0' PS74 = 'net8.0' Standard = 'netstandard2.0' } -$script:HostCoreOutput = "$PSScriptRoot/src/PowerShellEditorServices.Hosting/bin/$Configuration/$($script:NetFramework.PS72)/publish" -$script:HostDeskOutput = "$PSScriptRoot/src/PowerShellEditorServices.Hosting/bin/$Configuration/$($script:NetFramework.PS51)/publish" -$script:PsesOutput = "$PSScriptRoot/src/PowerShellEditorServices/bin/$Configuration/$($script:NetFramework.Standard)/publish" +$script:HostCoreOutput = "src/PowerShellEditorServices.Hosting/bin/$Configuration/$($script:NetFramework.PS72)/publish" +$script:HostDeskOutput = "src/PowerShellEditorServices.Hosting/bin/$Configuration/$($script:NetFramework.PS51)/publish" +$script:PsesOutput = "src/PowerShellEditorServices/bin/$Configuration/$($script:NetFramework.Standard)/publish" if (Get-Command git -ErrorAction SilentlyContinue) { # ignore changes to this file - git update-index --assume-unchanged "$PSScriptRoot/src/PowerShellEditorServices.Hosting/BuildInfo.cs" + git update-index --assume-unchanged $script:BuildInfoPath } Task FindDotNet { @@ -72,40 +61,27 @@ Task FindDotNet { [Version]$existingVersion, $null = (dotnet --version) -split " " -split "-" Assert ($existingVersion -ge [Version]("8.0")) ".NET SDK 8.0 or higher is required, please update it: https://aka.ms/dotnet-cli" - Write-Host "Using dotnet v$(dotnet --version) at path $((Get-Command dotnet).Source)" -ForegroundColor Green -} - -Task BinClean { - Remove-BuildItem $PSScriptRoot\.tmp - Remove-BuildItem $PSScriptRoot\module\PowerShellEditorServices\bin + Write-Build DarkGreen "Using dotnet v$(dotnet --version) at path $((Get-Command dotnet).Source)" } -Task Clean FindDotNet, BinClean, { +Task Clean FindDotNet, { + Write-Build DarkMagenta "Cleaning PowerShellEditorServices" Invoke-BuildExec { & dotnet clean --verbosity $Verbosity } - Remove-BuildItem $PSScriptRoot\src\*.nupkg - Remove-BuildItem $PSScriptRoot\PowerShellEditorServices*.zip - Remove-BuildItem $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US\*-help.xml - - # Remove bundled component modules - $moduleJsonPath = "$PSScriptRoot\modules.json" - if (Test-Path $moduleJsonPath) { - Get-Content -Raw $moduleJsonPath | - ConvertFrom-Json | - ForEach-Object { $_.PSObject.Properties.Name } | - ForEach-Object { Remove-BuildItem -Path "$PSScriptRoot/module/$_" } - } + Remove-BuildItem module/PowerShellEditorServices/bin + Remove-BuildItem module/PowerShellEditorServices/Commands/en-US/*-help.xml + Remove-BuildItem module/PSReadLine + Remove-BuildItem module/PSScriptAnalyzer } Task CreateBuildInfo { $buildOrigin = "Development" $buildCommit = git rev-parse HEAD - [xml]$xml = Get-Content "$PSScriptRoot/PowerShellEditorServices.Common.props" + [xml]$xml = Get-Content "PowerShellEditorServices.Common.props" $buildVersion = $xml.Project.PropertyGroup.VersionPrefix $prerelease = $xml.Project.PropertyGroup.VersionSuffix if ($prerelease) { $buildVersion += "-$prerelease" } - # Set build info fields on build platforms if ($env:TF_BUILD) { # Azure DevOps AKA OneBranch if ($env:BUILD_REASON -like "Manual") { @@ -138,49 +114,98 @@ namespace Microsoft.PowerShell.EditorServices.Hosting "@ if (Compare-Object $buildInfoContents.Split([Environment]::NewLine) (Get-Content $script:BuildInfoPath)) { - Write-Host "Updating build info." + Write-Build DarkMagenta "Updating build info" Set-Content -LiteralPath $script:BuildInfoPath -Value $buildInfoContents -Force } } -Task SetupHelpForTests { - # TODO: Check if it must be updated in a compatible way! - Write-Host "Updating help for tests." - Update-Help -Module Microsoft.PowerShell.Management,Microsoft.PowerShell.Utility -Force -Scope CurrentUser -UICulture en-US +task RestorePsesModules -If (-not (Test-Path "module/PSReadLine") -or -not (Test-Path "module/PSScriptAnalyzer")) { + Write-Build DarkMagenta "Restoring bundled modules" + Save-Module -Path module -Repository $PSRepository -Name PSScriptAnalyzer -RequiredVersion "1.22.0" -Verbose + Save-Module -Path module -Repository $PSRepository -Name PSReadLine -RequiredVersion "2.4.0-beta0" -AllowPrerelease -Verbose } -Task Build FindDotNet, CreateBuildInfo, { - Invoke-BuildExec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:NetFramework.Standard } - Invoke-BuildExec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetFramework.PS72 } +Task Build FindDotNet, CreateBuildInfo, RestorePsesModules, { + Write-Build DarkGreen "Building PowerShellEditorServices" + Invoke-BuildExec { & dotnet publish $script:dotnetBuildArgs ./src/PowerShellEditorServices/PowerShellEditorServices.csproj -f $script:NetFramework.Standard } + Invoke-BuildExec { & dotnet publish $script:dotnetBuildArgs ./src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj -f $script:NetFramework.PS72 } if (-not $script:IsNix) { - Invoke-BuildExec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetFramework.PS51 } + Invoke-BuildExec { & dotnet publish $script:dotnetBuildArgs ./src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj -f $script:NetFramework.PS51 } } } -# The concise set of tests (for pull requests) -Task Test TestPS74, TestE2EPwsh, TestPS51, TestE2EPowerShell +Task AssembleModule -After Build { + Write-Build DarkGreen "Assembling PowerShellEditorServices module" + $psesOutputPath = "./module/PowerShellEditorServices" + $psesBinOutputPath = "$psesOutputPath/bin" + $psesDepsPath = "$psesBinOutputPath/Common" + $psesCoreHostPath = "$psesBinOutputPath/Core" + $psesDeskHostPath = "$psesBinOutputPath/Desktop" -# Every combination of tests (for main branch) -Task TestFull Test, TestPS73, TestPS72, TestE2EPwshCLM, TestE2EPowerShellCLM + foreach ($dir in $psesDepsPath, $psesCoreHostPath, $psesDeskHostPath) { + New-Item -Force -Path $dir -ItemType Directory | Out-Null + } -Task TestPS74 Build, SetupHelpForTests, { - Set-Location .\test\PowerShellEditorServices.Test\ - Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetFramework.PS74 } + # Copy third party notices to module folder + Copy-Item -Force -Path "NOTICE.txt" -Destination $psesOutputPath + + # Assemble PSES module + $includedDlls = [System.Collections.Generic.HashSet[string]]::new() + [void]$includedDlls.Add('System.Management.Automation.dll') + + # PSES/bin/Common + foreach ($psesComponent in Get-ChildItem $script:PsesOutput) { + if ($psesComponent.Name -eq 'System.Management.Automation.dll' -or + $psesComponent.Name -eq 'System.Runtime.InteropServices.RuntimeInformation.dll') { + continue + } + + if ($psesComponent.Extension) { + [void]$includedDlls.Add($psesComponent.Name) + Copy-Item -Path $psesComponent.FullName -Destination $psesDepsPath -Force + } + } + + # PSES/bin/Core + foreach ($hostComponent in Get-ChildItem $script:HostCoreOutput) { + if (-not $includedDlls.Contains($hostComponent.Name)) { + Copy-Item -Path $hostComponent.FullName -Destination $psesCoreHostPath -Force + } + } + + # PSES/bin/Desktop + if (-not $script:IsNix) { + foreach ($hostComponent in Get-ChildItem $script:HostDeskOutput) { + if (-not $includedDlls.Contains($hostComponent.Name)) { + Copy-Item -Path $hostComponent.FullName -Destination $psesDeskHostPath -Force + } + } + } } -Task TestPS73 Build, SetupHelpForTests, { - Set-Location .\test\PowerShellEditorServices.Test\ - Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetFramework.PS73 } +Task BuildCmdletHelp -After AssembleModule { + Write-Build DarkGreen "Building cmdlet help" + New-ExternalHelp -Path ./module/docs -OutputPath ./module/PowerShellEditorServices/Commands/en-US -Force +} + +Task SetupHelpForTests { + Write-Build DarkMagenta "Updating help (for tests)" + Update-Help -Module Microsoft.PowerShell.Management,Microsoft.PowerShell.Utility -Force -Scope CurrentUser -UICulture en-US +} + +Task TestPS74 Build, SetupHelpForTests, { + Set-Location ./test/PowerShellEditorServices.Test/ + Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetFramework.PS74 } } Task TestPS72 Build, SetupHelpForTests, { - Set-Location .\test\PowerShellEditorServices.Test\ + Set-Location ./test/PowerShellEditorServices.Test/ Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetFramework.PS72 } } Task TestPS51 -If (-not $script:IsNix) Build, SetupHelpForTests, { - Set-Location .\test\PowerShellEditorServices.Test\ + Set-Location ./test/PowerShellEditorServices.Test/ # TODO: See https://github.com/dotnet/sdk/issues/18353 for x64 test host # that is debuggable! If architecture is added, the assembly path gets an # additional folder, necessitating fixes to find the commands definition @@ -199,7 +224,7 @@ Task TestPS51 -If (-not $script:IsNix) Build, SetupHelpForTests, { # NOTE: The framework for the E2E tests applies to the mock client, and so # should just be the latest supported framework. Task TestE2EPwsh Build, SetupHelpForTests, { - Set-Location .\test\PowerShellEditorServices.Test.E2E\ + Set-Location ./test/PowerShellEditorServices.Test.E2E/ $env:PWSH_EXE_NAME = "pwsh" Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetFramework.PS74 } } @@ -207,18 +232,18 @@ Task TestE2EPwsh Build, SetupHelpForTests, { $PwshDaily = if ($script:IsNix) { "$HOME/.powershell-daily/pwsh" } else { - "$env:LOCALAPPDATA\Microsoft\powershell-daily\pwsh.exe" + "$env:LOCALAPPDATA/Microsoft/powershell-daily/pwsh.exe" } Task TestE2EDaily -If (Test-Path $PwshDaily) Build, SetupHelpForTests, { - Set-Location .\test\PowerShellEditorServices.Test.E2E\ + Set-Location ./test/PowerShellEditorServices.Test.E2E/ $env:PWSH_EXE_NAME = $PwshDaily - Write-Host "Running end-to-end tests with: $(& $PwshDaily --version)" + Write-Build DarkGreen "Running end-to-end tests with: $(& $PwshDaily --version)" Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetFramework.PS74 } } Task TestE2EPowerShell -If (-not $script:IsNix) Build, SetupHelpForTests, { - Set-Location .\test\PowerShellEditorServices.Test.E2E\ + Set-Location ./test/PowerShellEditorServices.Test.E2E/ $env:PWSH_EXE_NAME = "powershell" try { # TODO: See https://github.com/PowerShell/vscode-powershell/issues/3886 @@ -232,16 +257,16 @@ Task TestE2EPowerShell -If (-not $script:IsNix) Build, SetupHelpForTests, { } Task TestE2EPwshCLM -If (-not $script:IsNix) Build, SetupHelpForTests, { - Set-Location .\test\PowerShellEditorServices.Test.E2E\ + Set-Location ./test/PowerShellEditorServices.Test.E2E/ $env:PWSH_EXE_NAME = "pwsh" if (-not [Security.Principal.WindowsIdentity]::GetCurrent().Owner.IsWellKnown("BuiltInAdministratorsSid")) { - Write-Warning "Skipping Constrained Language Mode tests as they must be ran in an elevated process." + Write-Build DarkRed "Skipping Constrained Language Mode tests as they must be ran in an elevated process" return } try { - Write-Host "Running end-to-end tests in Constrained Language Mode." + Write-Build DarkGreen "Running end-to-end tests in Constrained Language Mode" [System.Environment]::SetEnvironmentVariable("__PSLockdownPolicy", "0x80000007", [System.EnvironmentVariableTarget]::Machine) Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetFramework.PS74 } } finally { @@ -250,16 +275,16 @@ Task TestE2EPwshCLM -If (-not $script:IsNix) Build, SetupHelpForTests, { } Task TestE2EPowerShellCLM -If (-not $script:IsNix) Build, SetupHelpForTests, { - Set-Location .\test\PowerShellEditorServices.Test.E2E\ + Set-Location ./test/PowerShellEditorServices.Test.E2E/ $env:PWSH_EXE_NAME = "powershell" if (-not [Security.Principal.WindowsIdentity]::GetCurrent().Owner.IsWellKnown("BuiltInAdministratorsSid")) { - Write-Warning "Skipping Constrained Language Mode tests as they must be ran in an elevated process." + Write-Build DarkRed "Skipping Constrained Language Mode tests as they must be ran in an elevated process" return } try { - Write-Host "Running end-to-end tests in Constrained Language Mode." + Write-Build DarkGreen "Running end-to-end tests in Constrained Language Mode" [System.Environment]::SetEnvironmentVariable("__PSLockdownPolicy", "0x80000007", [System.EnvironmentVariableTarget]::Machine) # TODO: See https://github.com/PowerShell/vscode-powershell/issues/3886 # Inheriting the module path for powershell.exe breaks things! @@ -272,110 +297,8 @@ Task TestE2EPowerShellCLM -If (-not $script:IsNix) Build, SetupHelpForTests, { } } -Task LayoutModule -After Build { - $modulesDir = "$PSScriptRoot/module" - $psesOutputPath = "$modulesDir/PowerShellEditorServices" - $psesBinOutputPath = "$PSScriptRoot/module/PowerShellEditorServices/bin" - $psesDepsPath = "$psesBinOutputPath/Common" - $psesCoreHostPath = "$psesBinOutputPath/Core" - $psesDeskHostPath = "$psesBinOutputPath/Desktop" +Task Test TestPS72, TestPS74, TestE2EPwsh, TestPS51, TestE2EPowerShell - foreach ($dir in $psesDepsPath, $psesCoreHostPath, $psesDeskHostPath) { - New-Item -Force -Path $dir -ItemType Directory | Out-Null - } - - # Copy third party notices to module folder - Copy-Item -Force -Path "$PSScriptRoot\NOTICE.txt" -Destination $psesOutputPath - - # Assemble PSES module - - $includedDlls = [System.Collections.Generic.HashSet[string]]::new() - [void]$includedDlls.Add('System.Management.Automation.dll') - - # PSES/bin/Common - foreach ($psesComponent in Get-ChildItem $script:PsesOutput) { - if ($psesComponent.Name -eq 'System.Management.Automation.dll' -or - $psesComponent.Name -eq 'System.Runtime.InteropServices.RuntimeInformation.dll') { - continue - } - - if ($psesComponent.Extension) { - [void]$includedDlls.Add($psesComponent.Name) - Copy-Item -Path $psesComponent.FullName -Destination $psesDepsPath -Force - } - } - - # PSES/bin/Core - foreach ($hostComponent in Get-ChildItem $script:HostCoreOutput) { - if (-not $includedDlls.Contains($hostComponent.Name)) { - Copy-Item -Path $hostComponent.FullName -Destination $psesCoreHostPath -Force - } - } - - # PSES/bin/Desktop - if (-not $script:IsNix) { - foreach ($hostComponent in Get-ChildItem $script:HostDeskOutput) { - if (-not $includedDlls.Contains($hostComponent.Name)) { - Copy-Item -Path $hostComponent.FullName -Destination $psesDeskHostPath -Force - } - } - } -} - -task RestorePsesModules -After Build { - $submodulePath = (Resolve-Path $PsesSubmodulePath).Path + [IO.Path]::DirectorySeparatorChar - Write-Host "Restoring EditorServices modules..." - - # Read in the modules.json file as a hashtable so it can be splatted - $moduleInfos = @{} - - (Get-Content -Raw $ModulesJsonPath | ConvertFrom-Json).PSObject.Properties | ForEach-Object { - $name = $_.Name - $body = @{ - Name = $name - Version = $_.Value.Version - AllowPrerelease = $_.Value.AllowPrerelease - Repository = if ($_.Value.Repository) { $_.Value.Repository } else { $DefaultModuleRepository } - Path = $submodulePath - } - - if (-not $name) { - throw "EditorServices module listed without name in '$ModulesJsonPath'" - } - - $moduleInfos.Add($name, $body) - } - - # Save each module in the modules.json file - foreach ($moduleName in $moduleInfos.Keys) { - if (Test-Path -Path (Join-Path -Path $submodulePath -ChildPath $moduleName)) { - Write-Host "`tModule '${moduleName}' already detected, skipping!" - continue - } - - $moduleInstallDetails = $moduleInfos[$moduleName] - - $splatParameters = @{ - Name = $moduleName - RequiredVersion = $moduleInstallDetails.Version - Repository = if ($moduleInstallDetails.Repository) { $moduleInstallDetails.Repository } else { $DefaultModuleRepository } - Path = $submodulePath - } - - # There's a bug in PowerShell get where this argument isn't correctly translated when it's false. - if ($moduleInstallDetails.AllowPrerelease) { - $splatParameters["AllowPrerelease"] = $moduleInstallDetails.AllowPrerelease - } - - Write-Host "`tInstalling module: ${moduleName} with arguments $(ConvertTo-Json $splatParameters)" - - Save-Module @splatParameters - } -} - -Task BuildCmdletHelp -After LayoutModule { - New-ExternalHelp -Path $PSScriptRoot\module\docs -OutputPath $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US -Force | Out-Null -} +Task TestFull Test, TestE2EDaily, TestE2EPwshCLM, TestE2EPowerShellCLM -# The default task is to run the entire CI build Task . Clean, Build, Test diff --git a/modules.json b/modules.json deleted file mode 100644 index f72a38714..000000000 --- a/modules.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "PSScriptAnalyzer": { - "Version": "1.22.0", - "AllowPrerelease": false - }, - "PSReadLine": { - "Version": "2.4.0-beta0", - "AllowPrerelease": true - } -} diff --git a/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj b/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj index 5c6bba34d..e004a0efe 100644 --- a/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj +++ b/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj @@ -2,7 +2,7 @@ - net8.0;net7.0;net6.0;net462 + net8.0;net6.0;net462 Microsoft.PowerShell.EditorServices.Test x64 @@ -18,17 +18,12 @@ - - - - - - + - + diff --git a/tools/installPSResources.ps1 b/tools/installPSResources.ps1 index a7b4b041f..5456cac13 100644 --- a/tools/installPSResources.ps1 +++ b/tools/installPSResources.ps1 @@ -1,13 +1,5 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -$ErrorActionPreference = 'Stop' - -Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | Out-Null -if ($PSVersionTable.PSVersion.Major -lt 6) { - throw "The build script requires PowerShell 7!" -} - -# TODO: Switch to Install-PSResource when CI uses PowerShell 7.4 -Install-Module -Name InvokeBuild -Scope CurrentUser -Install-Module -Name platyPS -Scope CurrentUser +Install-PSResource -TrustRepository -Name InvokeBuild -Scope CurrentUser +Install-PSResource -TrustRepository -Name platyPS -Scope CurrentUser From 22c1fc8bdd6d8bed5e29055fb436eb5ecbd0d202 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:05:29 -0700 Subject: [PATCH 13/27] Allow release stage only on manual build So pushes can trigger the pipeline automatically. --- .pipelines/PowerShellEditorServices-Official.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.pipelines/PowerShellEditorServices-Official.yml b/.pipelines/PowerShellEditorServices-Official.yml index b01b57203..faab0c375 100644 --- a/.pipelines/PowerShellEditorServices-Official.yml +++ b/.pipelines/PowerShellEditorServices-Official.yml @@ -8,7 +8,8 @@ # Support: https://aka.ms/onebranchsup # ################################################################################# -trigger: none +trigger: +- main schedules: - cron: '35 13 * * 4' @@ -131,7 +132,7 @@ extends: **/System.Reactive.dll; - stage: release dependsOn: build - condition: ne(variables['Build.Reason'], 'Schedule') + condition: eq(variables['Build.Reason'], 'Manual') variables: version: $[ stageDependencies.build.main.outputs['package.version'] ] prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ] From 791039d14dac602fde326754da33012f38156ba7 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Mon, 7 Oct 2024 15:23:53 -0700 Subject: [PATCH 14/27] Change VIM in Test to nightly (#2183) --- .github/workflows/vim-test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/vim-test.yml b/.github/workflows/vim-test.yml index ff9d15810..982049e6f 100644 --- a/.github/workflows/vim-test.yml +++ b/.github/workflows/vim-test.yml @@ -35,7 +35,10 @@ jobs: run: Invoke-Build Build - name: Install Vim + id: vim uses: rhysd/action-setup-vim@v1 + with: + version: nightly - name: Checkout vim-ps1 uses: actions/checkout@v4 @@ -59,6 +62,9 @@ jobs: repository: thinca/vim-themis path: vim-themis + # - name: Debug if run with debugging enabled + # uses: lhotari/action-upterm@v1 + - name: Run Themis with full CLI env: THEMIS_VIM: ${{ steps.vim.outputs.executable }} From f4e09729324fc42ac08733f8595291872abde546 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:49:35 -0700 Subject: [PATCH 15/27] Pull suggested updates --- .pipelines/PowerShellEditorServices-Official.yml | 1 + global.json | 2 +- .../PowerShellEditorServices.csproj | 7 ------- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.pipelines/PowerShellEditorServices-Official.yml b/.pipelines/PowerShellEditorServices-Official.yml index faab0c375..aae8d3943 100644 --- a/.pipelines/PowerShellEditorServices-Official.yml +++ b/.pipelines/PowerShellEditorServices-Official.yml @@ -48,6 +48,7 @@ extends: enabled: true forStages: [build] featureFlags: + EnableCDPxPAT: false WindowsHostVersion: Version: 2022 Network: Netlock diff --git a/global.json b/global.json index 4c4c3ae5e..892db14b0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "8.0.110", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/PowerShellEditorServices/PowerShellEditorServices.csproj b/src/PowerShellEditorServices/PowerShellEditorServices.csproj index 03e11b7fb..7b1246d1c 100644 --- a/src/PowerShellEditorServices/PowerShellEditorServices.csproj +++ b/src/PowerShellEditorServices/PowerShellEditorServices.csproj @@ -59,11 +59,4 @@ - - - - - - - From 51b8d071d14bba2a6c822898821c29acec41288a Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:03:52 -0700 Subject: [PATCH 16/27] Enable NuGet Central Package Management --- Directory.Build.props | 5 ++++ Directory.Packages.props | 29 +++++++++++++++++++ .../PowerShellEditorServices.Hosting.csproj | 10 +++---- .../PowerShellEditorServices.csproj | 26 ++++++++--------- .../PowerShellEditorServices.Test.E2E.csproj | 14 ++++----- .../PowerShellEditorServices.Test.csproj | 14 ++++----- 6 files changed, 66 insertions(+), 32 deletions(-) create mode 100644 Directory.Build.props create mode 100644 Directory.Packages.props diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 000000000..193280892 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,5 @@ + + + true + + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 000000000..b4b5d0cea --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj b/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj index 5c31f0758..68a203da5 100644 --- a/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj +++ b/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj @@ -11,10 +11,10 @@ - - - - + + + + @@ -22,7 +22,7 @@ - + diff --git a/src/PowerShellEditorServices/PowerShellEditorServices.csproj b/src/PowerShellEditorServices/PowerShellEditorServices.csproj index 7b1246d1c..9a1771500 100644 --- a/src/PowerShellEditorServices/PowerShellEditorServices.csproj +++ b/src/PowerShellEditorServices/PowerShellEditorServices.csproj @@ -32,17 +32,17 @@ - - - - - - - - - - - + + + + + + + + + + + @@ -54,8 +54,8 @@ - - + + diff --git a/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj b/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj index e7a7e6480..3756f071d 100644 --- a/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj +++ b/test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj @@ -7,11 +7,11 @@ - - - - - + + + + + @@ -23,8 +23,8 @@ - - + + diff --git a/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj b/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj index e004a0efe..65d3d1b6c 100644 --- a/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj +++ b/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj @@ -18,24 +18,24 @@ - + - + - + - - - - + + + + From 75cff4c98499e45cbcf1fc3512d22b022919e4dc Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:09:41 -0700 Subject: [PATCH 17/27] Remove NETStandard.Library package reference As it's implicit and now dotnet errors if you duplicate it. --- Directory.Packages.props | 9 ++++----- .../PowerShellEditorServices.Hosting.csproj | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index b4b5d0cea..ccd3e5cd8 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,12 +1,11 @@ - - + + - @@ -25,5 +24,5 @@ - - + + diff --git a/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj b/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj index 68a203da5..8233ead02 100644 --- a/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj +++ b/src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj @@ -11,7 +11,6 @@ - From b5411e185e801f8259498dca429aebabcb95dd30 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:15:53 -0700 Subject: [PATCH 18/27] Use `global.json` in CI --- .github/workflows/ci-test.yml | 6 ++---- .pipelines/PowerShellEditorServices-Official.yml | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 482c8c003..fc118c0ee 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -30,10 +30,8 @@ jobs: with: cache: true cache-dependency-path: '**/*.csproj' - dotnet-version: | - 6.0.x - 7.0.x - 8.0.x + dotnet-version: 6.0.x + global-json-file: "./global.json" - name: Install PSResources shell: pwsh diff --git a/.pipelines/PowerShellEditorServices-Official.yml b/.pipelines/PowerShellEditorServices-Official.yml index aae8d3943..5c8fe0655 100644 --- a/.pipelines/PowerShellEditorServices-Official.yml +++ b/.pipelines/PowerShellEditorServices-Official.yml @@ -80,7 +80,7 @@ extends: displayName: Use .NET 8.x SDK inputs: packageType: sdk - version: 8.x + useGlobalJson: true - task: UseDotNet@2 displayName: Use .NET 6.x runtime (for tests) inputs: From a1e354d701a78df1d55e4ae35458d75a52c90df7 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:19:34 -0700 Subject: [PATCH 19/27] Don't make temp test files in bin directory --- PowerShellEditorServices.sln | 160 ------------------ .../DebugAdapterProtocolMessageTests.cs | 8 +- .../Language/SymbolsServiceTests.cs | 2 +- 3 files changed, 3 insertions(+), 167 deletions(-) delete mode 100644 PowerShellEditorServices.sln diff --git a/PowerShellEditorServices.sln b/PowerShellEditorServices.sln deleted file mode 100644 index c41d92df0..000000000 --- a/PowerShellEditorServices.sln +++ /dev/null @@ -1,160 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F594E7FD-1E72-4E51-A496-B019C2BA3180}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{422E561A-8118-4BE7-A54F-9309E4F03AAE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Test", "test\PowerShellEditorServices.Test\PowerShellEditorServices.Test.csproj", "{8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Test.Shared", "test\PowerShellEditorServices.Test.Shared\PowerShellEditorServices.Test.Shared.csproj", "{6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{E2316F5C-A551-4A8D-8103-E42CA6D757E2}" - ProjectSection(SolutionItems) = preProject - scripts\AddCopyrightHeaders.ps1 = scripts\AddCopyrightHeaders.ps1 - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices", "src\PowerShellEditorServices\PowerShellEditorServices.csproj", "{29EEDF03-0990-45F4-846E-2616970D1FA2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Test.E2E", "test\PowerShellEditorServices.Test.E2E\PowerShellEditorServices.Test.E2E.csproj", "{2561F253-8F72-436A-BCC3-AA63AB82EDC0}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Hosting", "src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj", "{3CC791E7-6FC9-4DDE-B4A2-547266977E4E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - CoreCLR|Any CPU = CoreCLR|Any CPU - CoreCLR|x64 = CoreCLR|x64 - CoreCLR|x86 = CoreCLR|x86 - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.CoreCLR|Any CPU.ActiveCfg = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.CoreCLR|Any CPU.Build.0 = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.CoreCLR|x64.ActiveCfg = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.CoreCLR|x64.Build.0 = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.CoreCLR|x86.ActiveCfg = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.CoreCLR|x86.Build.0 = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Debug|x64.ActiveCfg = Debug|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Debug|x64.Build.0 = Debug|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Debug|x86.ActiveCfg = Debug|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Debug|x86.Build.0 = Debug|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Release|Any CPU.Build.0 = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Release|x64.ActiveCfg = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Release|x64.Build.0 = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Release|x86.ActiveCfg = Release|Any CPU - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3}.Release|x86.Build.0 = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.CoreCLR|Any CPU.ActiveCfg = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.CoreCLR|Any CPU.Build.0 = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.CoreCLR|x64.ActiveCfg = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.CoreCLR|x64.Build.0 = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.CoreCLR|x86.ActiveCfg = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.CoreCLR|x86.Build.0 = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Debug|x64.ActiveCfg = Debug|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Debug|x64.Build.0 = Debug|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Debug|x86.ActiveCfg = Debug|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Debug|x86.Build.0 = Debug|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Release|Any CPU.Build.0 = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Release|x64.ActiveCfg = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Release|x64.Build.0 = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Release|x86.ActiveCfg = Release|Any CPU - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA}.Release|x86.Build.0 = Release|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.CoreCLR|Any CPU.ActiveCfg = CoreCLR|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.CoreCLR|Any CPU.Build.0 = CoreCLR|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.CoreCLR|x64.ActiveCfg = CoreCLR|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.CoreCLR|x64.Build.0 = CoreCLR|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.CoreCLR|x86.ActiveCfg = CoreCLR|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.CoreCLR|x86.Build.0 = CoreCLR|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Debug|x64.ActiveCfg = Debug|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Debug|x64.Build.0 = Debug|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Debug|x86.ActiveCfg = Debug|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Debug|x86.Build.0 = Debug|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Release|Any CPU.Build.0 = Release|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Release|x64.ActiveCfg = Release|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Release|x64.Build.0 = Release|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Release|x86.ActiveCfg = Release|Any CPU - {3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Release|x86.Build.0 = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.CoreCLR|Any CPU.ActiveCfg = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.CoreCLR|Any CPU.Build.0 = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.CoreCLR|x64.ActiveCfg = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.CoreCLR|x64.Build.0 = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.CoreCLR|x86.ActiveCfg = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.CoreCLR|x86.Build.0 = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|x64.ActiveCfg = Debug|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|x64.Build.0 = Debug|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|x86.ActiveCfg = Debug|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|x86.Build.0 = Debug|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|Any CPU.Build.0 = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|x64.ActiveCfg = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|x64.Build.0 = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|x86.ActiveCfg = Release|Any CPU - {29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|x86.Build.0 = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.CoreCLR|Any CPU.ActiveCfg = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.CoreCLR|Any CPU.Build.0 = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.CoreCLR|x64.ActiveCfg = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.CoreCLR|x64.Build.0 = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.CoreCLR|x86.ActiveCfg = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.CoreCLR|x86.Build.0 = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Debug|x64.ActiveCfg = Debug|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Debug|x64.Build.0 = Debug|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Debug|x86.ActiveCfg = Debug|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Debug|x86.Build.0 = Debug|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Release|Any CPU.Build.0 = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Release|x64.ActiveCfg = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Release|x64.Build.0 = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Release|x86.ActiveCfg = Release|Any CPU - {2561F253-8F72-436A-BCC3-AA63AB82EDC0}.Release|x86.Build.0 = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.CoreCLR|Any CPU.ActiveCfg = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.CoreCLR|Any CPU.Build.0 = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.CoreCLR|x64.ActiveCfg = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.CoreCLR|x64.Build.0 = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.CoreCLR|x86.ActiveCfg = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.CoreCLR|x86.Build.0 = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Debug|x64.ActiveCfg = Debug|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Debug|x64.Build.0 = Debug|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Debug|x86.ActiveCfg = Debug|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Debug|x86.Build.0 = Debug|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Release|Any CPU.Build.0 = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Release|x64.ActiveCfg = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Release|x64.Build.0 = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Release|x86.ActiveCfg = Release|Any CPU - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {8ED116F4-9DDF-4C49-AB96-AE462E3D64C3} = {422E561A-8118-4BE7-A54F-9309E4F03AAE} - {6A20B9E9-DE66-456E-B4F5-ACFD1A95C3CA} = {422E561A-8118-4BE7-A54F-9309E4F03AAE} - {29EEDF03-0990-45F4-846E-2616970D1FA2} = {F594E7FD-1E72-4E51-A496-B019C2BA3180} - {2561F253-8F72-436A-BCC3-AA63AB82EDC0} = {422E561A-8118-4BE7-A54F-9309E4F03AAE} - {3CC791E7-6FC9-4DDE-B4A2-547266977E4E} = {F594E7FD-1E72-4E51-A496-B019C2BA3180} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {3B9E8987-D4AC-426B-86F6-889126243A9A} - EndGlobalSection -EndGlobal diff --git a/test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs b/test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs index bc1ac3435..05b10ca5b 100644 --- a/test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs +++ b/test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs @@ -4,7 +4,6 @@ using System; using System.IO; using System.Linq; -using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Threading; @@ -21,11 +20,8 @@ namespace PowerShellEditorServices.Test.E2E [Trait("Category", "DAP")] public class DebugAdapterProtocolMessageTests : IAsyncLifetime, IDisposable { - private const string TestOutputFileName = "__dapTestOutputFile.txt"; private static readonly bool s_isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - private static readonly string s_binDir = - Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - private static readonly string s_testOutputPath = Path.Combine(s_binDir, TestOutputFileName); + private static readonly string s_testOutputPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); private readonly ITestOutputHelper _output; private DebugAdapterClient PsesDebugAdapterClient; @@ -116,7 +112,7 @@ public void Dispose() private static string NewTestFile(string script, bool isPester = false) { string fileExt = isPester ? ".Tests.ps1" : ".ps1"; - string filePath = Path.Combine(s_binDir, Path.GetRandomFileName() + fileExt); + string filePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + fileExt); File.WriteAllText(filePath, script); return filePath; diff --git a/test/PowerShellEditorServices.Test/Language/SymbolsServiceTests.cs b/test/PowerShellEditorServices.Test/Language/SymbolsServiceTests.cs index 630c8a018..359a424f8 100644 --- a/test/PowerShellEditorServices.Test/Language/SymbolsServiceTests.cs +++ b/test/PowerShellEditorServices.Test/Language/SymbolsServiceTests.cs @@ -832,7 +832,7 @@ public void FindsSymbolsInFile() Assert.True(symbol.IsDeclaration); // There should be no region symbols unless the provider has been registered. - Assert.Empty(symbols.Where(i => i.Type == SymbolType.Region)); + Assert.DoesNotContain(symbols, i => i.Type == SymbolType.Region); } [Fact] From bbf627b597011a8c43379abe025d60df15449087 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 10 Oct 2024 10:43:33 -0700 Subject: [PATCH 20/27] Rereate solution file for C# extension * `dotnet new sln` * `find . -name "*.csproj" | xargs dotnet sln PowerShellEditorServices.sln add` --- PowerShellEditorServices.sln | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 PowerShellEditorServices.sln diff --git a/PowerShellEditorServices.sln b/PowerShellEditorServices.sln new file mode 100644 index 000000000..754851233 --- /dev/null +++ b/PowerShellEditorServices.sln @@ -0,0 +1,57 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F46EF430-95AA-4386-9259-292A443AB715}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShellEditorServices.Test.Shared", "test\PowerShellEditorServices.Test.Shared\PowerShellEditorServices.Test.Shared.csproj", "{9D307AF9-D1F7-4185-AE9B-2DD3F178832C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShellEditorServices.Test", "test\PowerShellEditorServices.Test\PowerShellEditorServices.Test.csproj", "{DFD3C9C2-F9E6-4EE3-B614-A8EA7D1E1A98}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShellEditorServices.Test.E2E", "test\PowerShellEditorServices.Test.E2E\PowerShellEditorServices.Test.E2E.csproj", "{AA007633-5178-4D73-A262-CCE7247BDE93}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F40C4EC9-AE86-4A26-974F-95381888DCDC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShellEditorServices", "src\PowerShellEditorServices\PowerShellEditorServices.csproj", "{B4431254-9A2F-43DE-A998-12B22A1593CE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShellEditorServices.Hosting", "src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj", "{983D05F2-3C77-4B51-9A28-A8C6595911BA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9D307AF9-D1F7-4185-AE9B-2DD3F178832C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D307AF9-D1F7-4185-AE9B-2DD3F178832C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D307AF9-D1F7-4185-AE9B-2DD3F178832C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D307AF9-D1F7-4185-AE9B-2DD3F178832C}.Release|Any CPU.Build.0 = Release|Any CPU + {DFD3C9C2-F9E6-4EE3-B614-A8EA7D1E1A98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DFD3C9C2-F9E6-4EE3-B614-A8EA7D1E1A98}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DFD3C9C2-F9E6-4EE3-B614-A8EA7D1E1A98}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DFD3C9C2-F9E6-4EE3-B614-A8EA7D1E1A98}.Release|Any CPU.Build.0 = Release|Any CPU + {AA007633-5178-4D73-A262-CCE7247BDE93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA007633-5178-4D73-A262-CCE7247BDE93}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA007633-5178-4D73-A262-CCE7247BDE93}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA007633-5178-4D73-A262-CCE7247BDE93}.Release|Any CPU.Build.0 = Release|Any CPU + {B4431254-9A2F-43DE-A998-12B22A1593CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4431254-9A2F-43DE-A998-12B22A1593CE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4431254-9A2F-43DE-A998-12B22A1593CE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4431254-9A2F-43DE-A998-12B22A1593CE}.Release|Any CPU.Build.0 = Release|Any CPU + {983D05F2-3C77-4B51-9A28-A8C6595911BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {983D05F2-3C77-4B51-9A28-A8C6595911BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {983D05F2-3C77-4B51-9A28-A8C6595911BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {983D05F2-3C77-4B51-9A28-A8C6595911BA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {9D307AF9-D1F7-4185-AE9B-2DD3F178832C} = {F46EF430-95AA-4386-9259-292A443AB715} + {DFD3C9C2-F9E6-4EE3-B614-A8EA7D1E1A98} = {F46EF430-95AA-4386-9259-292A443AB715} + {AA007633-5178-4D73-A262-CCE7247BDE93} = {F46EF430-95AA-4386-9259-292A443AB715} + {B4431254-9A2F-43DE-A998-12B22A1593CE} = {F40C4EC9-AE86-4A26-974F-95381888DCDC} + {983D05F2-3C77-4B51-9A28-A8C6595911BA} = {F40C4EC9-AE86-4A26-974F-95381888DCDC} + EndGlobalSection +EndGlobal From 9cda0ebcbd87a1fe155513991f2128661c6d0262 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:45:08 -0700 Subject: [PATCH 21/27] Allow daily PowerShell test to fail Really, it's the installation that's failing because literally the upstream posting of new daily PowerShell builds is broken. If it succeeds, TestFull and the daily schedule will run it. If it doesn't, they'll ignore it because the build script will skip it. --- .github/workflows/ci-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index fc118c0ee..6a6b0936f 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -47,6 +47,7 @@ jobs: - name: Install daily if: ${{ github.event_name == 'schedule' || github.event_name == 'merge_group' }} + continue-on-error: true shell: pwsh run: ./pwsh/tools/install-powershell.ps1 -Daily From 6b4fb45085309f05ccef2cf8c93bb75f8c439e86 Mon Sep 17 00:00:00 2001 From: LucasArona Date: Mon, 9 Sep 2024 22:33:56 +0200 Subject: [PATCH 22/27] Add the ability to use the Call operator instead of the DotSource operator With a unit test! --- .../Services/DebugAdapter/DebugStateService.cs | 2 ++ .../Handlers/ConfigurationDoneHandler.cs | 6 ++++-- .../Handlers/LaunchAndAttachHandler.cs | 6 ++++++ .../Utility/PSCommandExtensions.cs | 6 ++++-- .../DebugAdapterClientExtensions.cs | 14 +++++--------- .../DebugAdapterProtocolMessageTests.cs | 11 +++++++++++ 6 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/DebugStateService.cs b/src/PowerShellEditorServices/Services/DebugAdapter/DebugStateService.cs index f1bf3199e..9736b3e85 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/DebugStateService.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/DebugStateService.cs @@ -34,6 +34,8 @@ internal class DebugStateService internal bool IsUsingTempIntegratedConsole { get; set; } + internal string ExecuteMode { get; set; } + // This gets set at the end of the Launch/Attach handler which set debug state. internal TaskCompletionSource ServerStarted { get; set; } diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs index df8165319..038f61955 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs @@ -110,9 +110,11 @@ internal async Task LaunchScriptAsync(string scriptToLaunch) PSCommand command; if (System.IO.File.Exists(scriptToLaunch)) { - // For a saved file we just execute its path (after escaping it). + // For a saved file we just execute its path (after escaping it), with the configured operator + // (which can't be called that because it's a reserved keyword in C#). + string executeMode = _debugStateService?.ExecuteMode == "Call" ? "&" : "."; command = PSCommandHelpers.BuildDotSourceCommandWithArguments( - PSCommandHelpers.EscapeScriptFilePath(scriptToLaunch), _debugStateService?.Arguments); + PSCommandHelpers.EscapeScriptFilePath(scriptToLaunch), _debugStateService?.Arguments, executeMode); } else // It's a URI to an untitled script, or a raw script. { diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs index 1ec1557ed..97bd6cca7 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs @@ -65,6 +65,11 @@ internal record PsesLaunchRequestArguments : LaunchRequestArguments /// public string[] RuntimeArgs { get; set; } + /// + /// Gets or sets the script execution mode, either "DotSource" or "Call". + /// + public string ExecuteMode { get; set; } + /// /// Gets or sets optional environment variables to pass to the debuggee. The string valued /// properties of the 'environmentVariables' are used as key/value pairs. @@ -186,6 +191,7 @@ public async Task Handle(PsesLaunchRequestArguments request, Can _debugStateService.ScriptToLaunch = request.Script; _debugStateService.Arguments = request.Args; _debugStateService.IsUsingTempIntegratedConsole = request.CreateTemporaryIntegratedConsole; + _debugStateService.ExecuteMode = request.ExecuteMode; if (request.CreateTemporaryIntegratedConsole && !string.IsNullOrEmpty(request.Script) diff --git a/src/PowerShellEditorServices/Utility/PSCommandExtensions.cs b/src/PowerShellEditorServices/Utility/PSCommandExtensions.cs index b16129af9..4fe298424 100644 --- a/src/PowerShellEditorServices/Utility/PSCommandExtensions.cs +++ b/src/PowerShellEditorServices/Utility/PSCommandExtensions.cs @@ -94,10 +94,12 @@ private static StringBuilder AddCommandText(this StringBuilder sb, Command comma public static string EscapeScriptFilePath(string f) => string.Concat("'", f.Replace("'", "''"), "'"); - public static PSCommand BuildDotSourceCommandWithArguments(string command, IEnumerable arguments) + // Operator defaults to dot-source but could also be call (ampersand). + // It can't be called that because it's a reserved keyword in C#. + public static PSCommand BuildDotSourceCommandWithArguments(string command, IEnumerable arguments, string executeMode = ".") { string args = string.Join(" ", arguments ?? Array.Empty()); - string script = string.Concat(". ", command, string.IsNullOrEmpty(args) ? "" : " ", args); + string script = string.Concat(executeMode, " ", command, string.IsNullOrEmpty(args) ? "" : " ", args); // HACK: We use AddScript instead of AddArgument/AddParameter to reuse Powershell parameter binding logic. return new PSCommand().AddScript(script); } diff --git a/test/PowerShellEditorServices.Test.E2E/DebugAdapterClientExtensions.cs b/test/PowerShellEditorServices.Test.E2E/DebugAdapterClientExtensions.cs index bdf785ede..dfcb0bbc7 100644 --- a/test/PowerShellEditorServices.Test.E2E/DebugAdapterClientExtensions.cs +++ b/test/PowerShellEditorServices.Test.E2E/DebugAdapterClientExtensions.cs @@ -11,21 +11,17 @@ namespace PowerShellEditorServices.Test.E2E { public static class DebugAdapterClientExtensions { - public static async Task LaunchScript(this DebugAdapterClient debugAdapterClient, string script, TaskCompletionSource started) + public static async Task LaunchScript(this DebugAdapterClient debugAdapterClient, string script, TaskCompletionSource started, string executeMode = "DotSource") { - LaunchResponse launchResponse = await debugAdapterClient.Launch( + _ = await debugAdapterClient.Launch( new PsesLaunchRequestArguments { NoDebug = false, Script = script, Cwd = "", - CreateTemporaryIntegratedConsole = false - }); - - if (launchResponse is null) - { - throw new Exception("Launch response was null."); - } + CreateTemporaryIntegratedConsole = false, + ExecuteMode = executeMode, + }) ?? throw new Exception("Launch response was null."); // This will check to see if we received the Initialized event from the server. await started.Task; diff --git a/test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs b/test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs index 05b10ca5b..654001da7 100644 --- a/test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs +++ b/test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs @@ -189,6 +189,17 @@ public async Task UsesDotSourceOperatorAndQuotesAsync() (i) => Assert.StartsWith(". '", i)); } + [Fact] + public async Task UsesCallOperatorWithSettingAsync() + { + string filePath = NewTestFile(GenerateScriptFromLoggingStatements("$($MyInvocation.Line)")); + await PsesDebugAdapterClient.LaunchScript(filePath, Started, executeMode: "Call"); + ConfigurationDoneResponse configDoneResponse = await PsesDebugAdapterClient.RequestConfigurationDone(new ConfigurationDoneArguments()); + Assert.NotNull(configDoneResponse); + Assert.Collection(await GetLog(), + (i) => Assert.StartsWith("& '", i)); + } + [Fact] public async Task CanLaunchScriptWithNoBreakpointsAsync() { From 09080fece17616697b87374f130c3f2aa4e08c95 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 10 Oct 2024 12:17:06 -0700 Subject: [PATCH 23/27] Update PSScriptAnalyzer to 1.23.0 --- PowerShellEditorServices.build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index cdd71ef57..72648411d 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -121,7 +121,7 @@ namespace Microsoft.PowerShell.EditorServices.Hosting task RestorePsesModules -If (-not (Test-Path "module/PSReadLine") -or -not (Test-Path "module/PSScriptAnalyzer")) { Write-Build DarkMagenta "Restoring bundled modules" - Save-Module -Path module -Repository $PSRepository -Name PSScriptAnalyzer -RequiredVersion "1.22.0" -Verbose + Save-Module -Path module -Repository $PSRepository -Name PSScriptAnalyzer -RequiredVersion "1.23.0" -Verbose Save-Module -Path module -Repository $PSRepository -Name PSReadLine -RequiredVersion "2.4.0-beta0" -AllowPrerelease -Verbose } From b6e107d0ddce84d52b61c5a984fdb12c164b6525 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:47:52 -0700 Subject: [PATCH 24/27] Fix unit test broken by GitHub Action image update Which now includes an AWS module with a conflicting completion. --- .../Completion/CompleteCommandInFile.cs | 14 +++++++------- .../Completion/CompletionExamples.psm1 | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/PowerShellEditorServices.Test.Shared/Completion/CompleteCommandInFile.cs b/test/PowerShellEditorServices.Test.Shared/Completion/CompleteCommandInFile.cs index 80a1cc906..f84a44a11 100644 --- a/test/PowerShellEditorServices.Test.Shared/Completion/CompleteCommandInFile.cs +++ b/test/PowerShellEditorServices.Test.Shared/Completion/CompleteCommandInFile.cs @@ -12,7 +12,7 @@ internal static class CompleteCommandInFile file: TestUtilities.NormalizePath("Completion/CompletionExamples.psm1"), text: string.Empty, startLineNumber: 8, - startColumnNumber: 7, + startColumnNumber: 10, startOffset: 0, endLineNumber: 0, endColumnNumber: 0, @@ -22,17 +22,17 @@ internal static class CompleteCommandInFile { Kind = CompletionItemKind.Function, Detail = "", - FilterText = "Get-Something", - InsertText = "Get-Something", - Label = "Get-Something", - SortText = "0001Get-Something", + FilterText = "Get-XYZSomething", + InsertText = "Get-XYZSomething", + Label = "Get-XYZSomething", + SortText = "0001Get-XYZSomething", TextEdit = new TextEdit { - NewText = "Get-Something", + NewText = "Get-XYZSomething", Range = new Range { Start = new Position { Line = 7, Character = 0 }, - End = new Position { Line = 7, Character = 6 } + End = new Position { Line = 7, Character = 9 } } } }; diff --git a/test/PowerShellEditorServices.Test.Shared/Completion/CompletionExamples.psm1 b/test/PowerShellEditorServices.Test.Shared/Completion/CompletionExamples.psm1 index a4ce41222..b8427615e 100644 --- a/test/PowerShellEditorServices.Test.Shared/Completion/CompletionExamples.psm1 +++ b/test/PowerShellEditorServices.Test.Shared/Completion/CompletionExamples.psm1 @@ -1,11 +1,11 @@ -function Get-Something +function Get-XYZSomething { $testVar2 = "Shouldn't find this variable" } $testVar1 = "Should find this variable" -Get-So +Get-XYZSo $testVar From 809e95891ddb213ae53e1df03d5eb40275ffe514 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 10 Oct 2024 15:03:00 -0700 Subject: [PATCH 25/27] Migrate to DeployBox for release stage --- .github/workflows/ci-test.yml | 1 + .gitignore | 5 +-- .../PowerShellEditorServices-Official.yml | 42 ++++++++++--------- PowerShellEditorServices.build.ps1 | 6 ++- tools/installPSResources.ps1 | 12 +++++- 5 files changed, 39 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 6a6b0936f..2c504a075 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -38,6 +38,7 @@ jobs: run: ./tools/installPSResources.ps1 - name: Download daily install script + if: ${{ github.event_name == 'schedule' || github.event_name == 'merge_group' }} uses: actions/checkout@v4 with: repository: PowerShell/PowerShell diff --git a/.gitignore b/.gitignore index 1b97c3908..d8c2d5b16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ bin/ obj/ -module/PowerShellEditorServices/NOTICE.txt -module/PowerShellEditorServices/Commands/en-US/ -module/PSReadLine/ -module/PSScriptAnalyzer/ +module/ TestResults/ diff --git a/.pipelines/PowerShellEditorServices-Official.yml b/.pipelines/PowerShellEditorServices-Official.yml index 5c8fe0655..79e2a85a3 100644 --- a/.pipelines/PowerShellEditorServices-Official.yml +++ b/.pipelines/PowerShellEditorServices-Official.yml @@ -51,7 +51,9 @@ extends: EnableCDPxPAT: false WindowsHostVersion: Version: 2022 - Network: Netlock + Network: KS3 + release: + category: NonAzure stages: - stage: build jobs: @@ -60,7 +62,7 @@ extends: pool: type: windows variables: - ob_outputDirectory: $(Build.SourcesDirectory)/module + ob_outputDirectory: $(Build.SourcesDirectory)/out steps: - pwsh: | [xml]$xml = Get-Content PowerShellEditorServices.Common.props @@ -88,9 +90,10 @@ extends: version: 6.x - pwsh: | Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted - Install-Module -Repository CFS -Name InvokeBuild -RequiredVersion 5.11.3 - Install-Module -Repository CFS -Name platyPS -RequiredVersion 0.14.2 - Invoke-Build TestFull -Configuration $(BuildConfiguration) -PSRepository CFS + Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet + ./tools/installPSResources.ps1 -PSRepository CFS + displayName: Install PSResources + - pwsh: Invoke-Build TestFull -Configuration $(BuildConfiguration) -PSRepository CFS displayName: Build and test - task: PublishTestResults@2 displayName: Publish test results @@ -131,36 +134,37 @@ extends: **/OmniSharp.Extensions*.dll; **/Serilog*.dll; **/System.Reactive.dll; + - task: ArchiveFiles@2 + displayName: Zip signed artifacts + inputs: + rootFolderOrFile: $(Build.SourcesDirectory)/module + includeRootFolder: false + archiveType: zip + archiveFile: out/PowerShellEditorServices.zip - stage: release dependsOn: build condition: eq(variables['Build.Reason'], 'Manual') variables: + ob_release_environment: Production version: $[ stageDependencies.build.main.outputs['package.version'] ] prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ] - drop: $(Pipeline.Workspace)/drop_build_main jobs: - job: github displayName: Publish draft to GitHub pool: - type: windows - variables: - ob_outputDirectory: $(Build.SourcesDirectory)/out - steps: - - download: current - displayName: Download artifacts - - task: ArchiveFiles@2 - displayName: Zip signed artifacts + type: release + templateContext: inputs: - rootFolderOrFile: $(drop) - includeRootFolder: false - archiveType: zip - archiveFile: out/PowerShellEditorServices.zip + - input: pipelineArtifact + artifactName: drop_build_main + steps: - task: GitHubRelease@1 displayName: Create GitHub release inputs: gitHubConnection: GitHub repositoryName: PowerShell/PowerShellEditorServices - assets: out/PowerShellEditorServices.zip + target: main + assets: $(Pipeline.Workspace)/PowerShellEditorServices.zip tagSource: userSpecifiedTag tag: v$(version) isDraft: true diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index 72648411d..02a5d6436 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -147,8 +147,10 @@ Task AssembleModule -After Build { New-Item -Force -Path $dir -ItemType Directory | Out-Null } - # Copy third party notices to module folder - Copy-Item -Force -Path "NOTICE.txt" -Destination $psesOutputPath + # Copy documents to module root + foreach ($document in @("LICENSE", "NOTICE.txt", "README.md", "SECURITY.md")) { + Copy-Item -Force -Path $document -Destination "./module" + } # Assemble PSES module $includedDlls = [System.Collections.Generic.HashSet[string]]::new() diff --git a/tools/installPSResources.ps1 b/tools/installPSResources.ps1 index 5456cac13..e98910d70 100644 --- a/tools/installPSResources.ps1 +++ b/tools/installPSResources.ps1 @@ -1,5 +1,13 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. +param( + [ValidateSet("PSGallery", "CFS")] + [string]$PSRepository = "PSGallery" +) -Install-PSResource -TrustRepository -Name InvokeBuild -Scope CurrentUser -Install-PSResource -TrustRepository -Name platyPS -Scope CurrentUser +if ($PSRepository -eq "CFS" -and -not (Get-PSResourceRepository -Name CFS -ErrorAction SilentlyContinue)) { + Register-PSResourceRepository -Name CFS -Uri "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v3/index.json" +} + +Install-PSResource -Repository $PSRepository -TrustRepository -Name InvokeBuild +Install-PSResource -Repository $PSRepository -TrustRepository -Name platyPS From a20e119bb2595c4369630cc74e72a358ded7d33a Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:47:09 -0700 Subject: [PATCH 26/27] Bump packages for component governance --- Directory.Packages.props | 2 +- .../PowerShellEditorServices.Test.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index ccd3e5cd8..92a025bed 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ - + diff --git a/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj b/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj index 65d3d1b6c..01c23bcee 100644 --- a/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj +++ b/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj @@ -18,12 +18,12 @@ - + - + From 5fb353cce7db90a50c32911df5e1e20e09fc82b8 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:32:45 -0700 Subject: [PATCH 27/27] v3.21.0: Updates to PSScriptAnalyzer and Call-operator support --- CHANGELOG.md | 7 +++++++ PowerShellEditorServices.Common.props | 2 +- .../PowerShellEditorServices/PowerShellEditorServices.psd1 | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9dffa950..b44fa94b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # PowerShell Editor Services Release History +## v3.21.0 +### Wednesday, October 30, 2024 + +See more details at the GitHub Release for [v3.21.0](https://github.com/PowerShell/PowerShellEditorServices/releases/tag/v3.21.0). + +Updates to PSScriptAnalyzer and Call-operator support + ## v3.20.1 ### Friday, May 03, 2024 diff --git a/PowerShellEditorServices.Common.props b/PowerShellEditorServices.Common.props index 0abe50b0f..cc0dc7531 100644 --- a/PowerShellEditorServices.Common.props +++ b/PowerShellEditorServices.Common.props @@ -1,6 +1,6 @@ - 3.20.1 + 3.21.0 Microsoft © Microsoft Corporation. diff --git a/module/PowerShellEditorServices/PowerShellEditorServices.psd1 b/module/PowerShellEditorServices/PowerShellEditorServices.psd1 index 7aab2416a..02e3385b6 100644 --- a/module/PowerShellEditorServices/PowerShellEditorServices.psd1 +++ b/module/PowerShellEditorServices/PowerShellEditorServices.psd1 @@ -19,7 +19,7 @@ RootModule = if ($PSEdition -eq 'Core') } # Version number of this module. -ModuleVersion = '3.20.1' +ModuleVersion = '3.21.0' # ID used to uniquely identify this module GUID = '9ca15887-53a2-479a-9cda-48d26bcb6c47'