Skip to content
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

Add a Scratch.sln for prototyping #10067

Merged

Conversation

zadjii-msft
Copy link
Member

⚠️ This targets #10051

Summary of the Pull Request

This PR creates a Samples solution which can be used for quickly testing our particular WinUI + Xaml Islands + wapproj setup, with a TermControl. This lets us quickly prototype and minimally repro xaml islands bugs, but also lets us iterate quickly on changes in the process model. I'll be using this in the future to prove that the out-of-proc control works (for tear-out), without having to tear up the entire TerminalApp all at once.

While I'll be leaning on this extensively for tear-out prototyping, I've also found myself wanting this kind of sample sln many times in the past. We run into bugs all the time where we're not sure if they're XAML Islands bugs or Terminal bugs. However, standing up a scratch sln with MUX hooked up, and a XamlApplication from the toolkit, and XAML Islands is time consuming. This sample sln should let us validate if bugs are XI bugs or Terminal bugs much easier.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

This is largely a copy-pasta of our existing projects, in massively simplified form. I'm gonna wontfix most comments on the code that was copy-pasta'd. If it's bad here, it's probably also bad in the real version in OpenConsole.sln.

  • I made an entirely new .sln for this, so that these samples wouldn't need to build in CI. They're not critical code, they're literally just for prototyping.
  • TerminalAppLib & TerminalApp became SampleAppLib and SampleApp. This is just a simple application hosting a single TermControl. It references the winmds and dlls from the main OpenConsole.sln, but in a way that would be more like a project consuming a nuget feed of the control, rather than a ProjectReference.
    • It still does all the App.xaml and Toolkit.XamlApplication stuff that TerminalApp does, so that it can load MUX resources, and do MUX-y things.
  • WindowsTerminal became WindowExe. I tore out all of the NonClientIslandWindow stuff - this is just a window with a xaml island.
  • CascadiaPackage became Package. It does the vclibs hack again for the TerminalConnection dlls (because this package can't actually determine that TerminalConnection.dll requires cprest*.dll), as well as for windowsterminal.exe (which we'll need in the future for out-of-proc controls). I got rid of all the Dev/Preview/Release asset machinations as well.

Wherever possible, I changed filenames slightly so that they won't get accitdentally opened when someone tries to open a file by name in their editor (cough sublime's ctrl+p menu cough).

Validation Steps Performed

The sample app launches, and displays a TermControl. What else do you want? (rhetorical, not a prompt for a wishlist)

@zadjii-msft zadjii-msft added Issue-Samples A request for an example on how we do something. Probably a good docs candidate. Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. labels May 10, 2021
@github-actions

This comment has been minimized.

@DHowett
Copy link
Member

DHowett commented May 20, 2021

notes from 1:1 - samples is reserved for applications that demonstrate how to use console APIs; @zadjii-msft was not upset at the idea of moving this sample

@zadjii-msft zadjii-msft added this to the Terminal v1.10 milestone May 21, 2021
samples/ScratchIslandApp/Package/Package.appxmanifest Outdated Show resolved Hide resolved
samples/ScratchIslandApp/Package/Package.wapproj Outdated Show resolved Hide resolved
samples/ScratchIslandApp/SampleApp/SampleAppLib.vcxproj Outdated Show resolved Hide resolved
samples/ScratchIslandApp/SampleApp/dll/SampleApp.vcxproj Outdated Show resolved Hide resolved
samples/ScratchIslandApp/SampleApp/dll/SampleApp.vcxproj Outdated Show resolved Hide resolved
samples/ScratchIslandApp/WindowExe/WindowExe.def Outdated Show resolved Hide resolved
samples/ScratchIslandApp/WindowExe/WindowExe.manifest Outdated Show resolved Hide resolved
samples/ScratchIslandApp/WindowExe/WindowExe.vcxproj Outdated Show resolved Hide resolved
samples/ScratchIslandApp/WindowExe/WindowExe.vcxproj Outdated Show resolved Hide resolved
Samples.sln Outdated Show resolved Hide resolved
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels May 21, 2021
@zadjii-msft zadjii-msft changed the title Add a Samples.sln for prototyping Add a Scratch.sln for prototyping May 24, 2021
@miniksa miniksa added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jun 10, 2021
@ghost
Copy link

ghost commented Jun 10, 2021

Hello @miniksa!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 30d6cf4 into dev/migrie/interactivity-projection-000 Jun 10, 2021
@ghost ghost deleted the dev/migrie/oop/sample-project branch June 10, 2021 17:49
@miniksa miniksa restored the dev/migrie/oop/sample-project branch June 10, 2021 17:50
DHowett pushed a commit that referenced this pull request Jun 10, 2021
#### ⚠️ This targets #10051

## Summary of the Pull Request

This PR creates a `Samples` solution which can be used for quickly testing our particular WinUI + Xaml Islands + wapproj setup, with a `TermControl`. This lets us quickly prototype and minimally repro xaml islands bugs, but also lets us iterate quickly on changes in the process model. I'll be using this in the future to prove that the out-of-proc control works (for tear-out), without having to tear up the entire `TerminalApp` all at once.

While I'll be leaning on this extensively for tear-out prototyping, I've also found myself wanting this kind of sample sln many times in the past. We run into bugs all the time where we're not sure if they're XAML Islands bugs or Terminal bugs. However, standing up a scratch sln with MUX hooked up, and a `XamlApplication` from the toolkit, and XAML Islands is time consuming. This sample sln should let us validate if bugs are XI bugs or Terminal bugs much easier.

## References
* Tear-out: #1256
* Megathread: #5000
* Project: https://github.com/microsoft/terminal/projects/5

## PR Checklist
* [x] Closes one bullet point of https://github.com/microsoft/terminal/projects/5#card-50760312
* [x] I work here
* [x] Tests added/passed
* [n/a] Requires documentation to be updated

## Detailed Description of the Pull Request / Additional comments

This is _largely_ a copy-pasta of our existing projects, in massively simplified form. I'm gonna wontfix most comments on the code that was copy-pasta'd. If it's bad here, it's probably also bad in the real version in `OpenConsole.sln`.

* I made an entirely new `.sln` for this, so that these samples wouldn't need to build in CI. They're not critical code, they're literally just for prototyping.
* `TerminalAppLib` & `TerminalApp` became `SampleAppLib` and `SampleApp`. This is just a simple application hosting a single `TermControl`. It references the winmds and dlls from the main `OpenConsole.sln`, but in a way that would be more like a project consuming a nuget feed of the control, rather than a `ProjectReference`.
  - It still does all the `App.xaml` and `Toolkit.XamlApplication` stuff that TerminalApp does, so that it can load MUX resources, and do MUX-y things.
* `WindowsTerminal` became `WindowExe`. I tore out all of the `NonClientIslandWindow` stuff - this is just a window with a xaml island.
* `CascadiaPackage` became `Package`. It does the vclibs hack again for the `TerminalConnection` dlls (because this package can't actually determine that `TerminalConnection.dll` requires `cprest*.dll`), as well as for `windowsterminal.exe` (which we'll need in the future for out-of-proc controls). I got rid of all the Dev/Preview/Release asset machinations as well.

Wherever possible, I changed filenames slightly so that they won't get accitdentally opened when someone tries to open a file by name in their editor (**cough** sublime's <kbd>ctrl+p</kbd> menu **cough**).

## Validation Steps Performed

The sample app launches, and displays a TermControl. What else do you want? <sup>(_rhetorical, not a prompt for a wishlist_)</sup>

(cherry picked from commit 30d6cf4)
@carlos-zamora
Copy link
Member

Urgh. This is something super minor (and late), but any chance we can move Scratch.sln to be somewhere else? Maybe under samples.

Didn't want to open a new issue for a minor inconvenience of mine haha.

@DHowett
Copy link
Member

DHowett commented Jun 10, 2021

@carlos-zamora you can move it into scratch/ itself if you like, you just have to edit all of the project paths inside of it.

@DHowett
Copy link
Member

DHowett commented Jun 10, 2021

Does having two SLN files in the root of the repo mess up some tools? Sorry, we didn't even consider...

@carlos-zamora
Copy link
Member

Does having two SLN files in the root of the repo mess up some tools? Sorry, we didn't even consider...

Nah, this is just a personal pet peeve haha. I have this in my PowerShell $profile:

Function Open-Solution
{
    $repo_root = git rev-parse --show-toplevel
    Invoke-Item $repo_root\*.sln
}

So now it'll always open OpenConsole.sln and Scratch.sln.

That said, I feel like Scratch.sln being at the root is a bit out of place imo.

@DHowett
Copy link
Member

DHowett commented Jun 10, 2021

out of place

I agree. Take action!

@DHowett DHowett deleted the dev/migrie/oop/sample-project branch October 26, 2021 16:56
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Samples A request for an example on how we do something. Probably a good docs candidate. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants