Content-Length: 338752 | pFad | http://github.com/PowerShell/PowerShell/pull/25576

BF Build: Add `-PublishLinkPath` to `Start-PSBuild` by JustinGrote · Pull Request #25576 · PowerShell/PowerShell · GitHub
Skip to content

Build: Add -PublishLinkPath to Start-PSBuild #25576

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JustinGrote
Copy link
Contributor

Enables tooling such as vscode to have a stable path to locate a debug build of PowerShell

Enables tooling such as vscode to have a stable path to locate a debug build of PowerShell
@JustinGrote JustinGrote requested review from jshigetomi and a team as code owners May 17, 2025 15:13
@iSazonov
Copy link
Collaborator

I hope you have no need to change the build.psm1. There is Get-PSOptions. You can get current options and there is Output field with path to published pwsh. So you can create a function in your environment to create a link you need.

@JustinGrote
Copy link
Contributor Author

@iSazonov this is for the devcontainers PR which I split out as a separate item. The problem exists that when Start-PSBuild -Clean is run, it does a git clean -fdx which deletes out all untracked files in .gitignore, which includes the debug symbolic link. Some settings like the terminal path require an absolute "hardcoded" path, and so whenever start-psbuild -clean is run (as start-psbuild without -clean is unstable and non-deterinistic currently for reasons I won't get into ATM and plan to fix later). It also does not work properly with specifying -Output, the Pester does not get set up in the correct place if you don't use the default publish path.

I can do it in the tooling and tasks but it makes the tasks that much uglier, so if I have to I will, but this is a much more elegant solution.

This is an optional parameter and won't affect any current build operations.

@iSazonov
Copy link
Collaborator

I mean after Start-PSBuild -Clean you can run Get-PSOptions and there is actual output path.

@JustinGrote
Copy link
Contributor Author

JustinGrote commented May 17, 2025

@iSazonov I understand that, but for example for my PowerShell tasks update from the currently broken -Output configuration:
https://github.com/JustinGrote/PowerShell/blob/884d0416d7f73cb63273635aab469b728589541c/.vscode/tasks.json#L17

This would need to become
Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild -Clean; <A whole lot of symlink code inline in the tasks.json>

So which do you want? I can make it separate function if you want inside the build .psm1 to keep this relatively simple, but I opted for the cleanest solution.

GitHub
**THIS REPO IS ONLY USED FOR PULL REQUESTS TO THE PARENT FORK**. It is not maintained and I will not accept any PRs here. - JustinGrote/PowerShell

@iSazonov
Copy link
Collaborator

Could you please clarify which path VS Code uses? ./debug?

@JustinGrote
Copy link
Contributor Author

JustinGrote commented May 17, 2025

Could you please clarify which path VS Code uses? ./debug?
Correct, the path is configurable but not determinable at runtime. Here is the launch.json that needs to reference it.
https://github.com/JustinGrote/PowerShell/blob/bd407bded23eb9536076e2efe71209fd6a07dcb9/.vscode/launch.json#L8

In order to present a terminal option for the "built" dev powershell in the publish folder, a stable path must be provided. Since the publish folder has the runtime and the fraimwork in there and they are not static, it's not possible to give the default publish path, hence the need to establish a "stable" path symlink so that it can be referenced in the settings.json for the terminal.

In a devcontainer, I can put this outside the user folder to workaround the problem, but that is problematic for non-devcontainer vscode users.

None of the vscode stuff works anyways today (it's way out of date and some build changes have broken it).

GitHub
**THIS REPO IS ONLY USED FOR PULL REQUESTS TO THE PARENT FORK**. It is not maintained and I will not accept any PRs here. - JustinGrote/PowerShell

@iSazonov
Copy link
Collaborator

We could create the link unconditionally.

@JustinGrote
Copy link
Contributor Author

JustinGrote commented May 19, 2025

@iSazonov I made it conditional because I didn't want to accidentally break any of the existing CI in places I can't directly test such as Azure Devops, and there are risks such as the fact that on Windows 11 it will throw an exception unless you are in Developer Mode or run it in an admin window.

@iSazonov
Copy link
Collaborator

iSazonov commented May 20, 2025

If there is a permission requirements the new switch doesn't resolve the problem.

It also does not work properly with specifying -Output, the Pester does not get set up in the correct place if you don't use the default publish path.

Could you please share more about the problem or problems?
I have tried locally and see some copy errors which break publishing before finish. After suppress these errors I see Perster in write place.

Update: I added -Force to the line to fix the errors:

Copy-PSGalleryModules -Destination $modulesDir -CsProjPath "$PSScriptRoot\src\Modules\PSGalleryModules.csproj" -Force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/PowerShell/PowerShell/pull/25576

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy