-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Rename Microsoft.Terminal.TerminalControl
to .Control
; Split into dll & lib
#9472
Conversation
Wadda ya know, we _can_ have TerminalCore expose types. Maybe we just got that in a recent VS / cppwinrt update, but it works finally
If we're gonna rename the namespace, now is as good a time as any to rename the DLL file too. Microsoft.Terminal.Control.dll. |
(WinRT consumers may contractually (apparently) try to resolve namespace X.Y.Z by doing LoadLibrary(X.Y.Z.dll), X.Y.dll, and X.dll) |
I still don't understand the thesis. If we make the interactivity stuff part of Core, that's what we test. Are we doing work today (make the UWP Control a lib) that we'll be undoing later? |
yea okay
probably not? We might be adding tests in the future - when we do, we'll be happy that we have a lib. But we will be moving most of the testable code into M.T.Core.lib, which is already easily testable, so that's not the biggest worry. What I am worried about is that the delicate house of cards we have will fall over if I revert part of it. I did the dll->dll&lib split first, then did the Control.ICoreSettings -> Core.ICoreSettings thing. Part of me is worried that will no longer work if I revert the lib&dll split |
OpenConsole.sln
Outdated
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.AuditMode|Any CPU.ActiveCfg = Debug|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.AuditMode|ARM.ActiveCfg = AuditMode|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.AuditMode|ARM64.ActiveCfg = Release|ARM64 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.AuditMode|DotNet_x64Test.ActiveCfg = Debug|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.AuditMode|DotNet_x86Test.ActiveCfg = Debug|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.AuditMode|x64.ActiveCfg = Release|x64 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.AuditMode|x86.ActiveCfg = Release|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Debug|Any CPU.ActiveCfg = Debug|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Debug|ARM.ActiveCfg = Debug|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Debug|ARM64.ActiveCfg = Debug|ARM64 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Debug|DotNet_x64Test.ActiveCfg = Debug|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Debug|DotNet_x86Test.ActiveCfg = Debug|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Debug|x64.ActiveCfg = Debug|x64 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Debug|x64.Build.0 = Debug|x64 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Debug|x86.Build.0 = Debug|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Release|Any CPU.ActiveCfg = Release|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Release|ARM.ActiveCfg = Release|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Release|ARM64.ActiveCfg = Release|ARM64 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Release|ARM64.Build.0 = Release|ARM64 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Release|DotNet_x64Test.ActiveCfg = Release|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Release|DotNet_x86Test.ActiveCfg = Release|Win32 | ||
{CA5CAD1A-5555-4AC7-AC72-6CA5B3AB89ED}.Release|x64.ActiveCfg = Release|x64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make absolutely certain your project configurations are correct for a new project. We had some issues earlier where new projects were set to build for DotNet_x86Test and DotNet_x64Test and AnyCPU(!) on debug/release when they were not projects that the wpf control needed. This caused build failures later on when the release pipeline tried to build the WPF control on its own.
I suspect this project is Debug+Release x86+64 only, no audit no dotnet no anycpu...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I straight up copied TerminalControl's original lines here. If this is wrong, how will I know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like *|DotNet_x64Test.*
, *|DotNet_x86Test.*
, and *|Any CPU.*
all always map to Win32
. The Audit lines are all weird:
{CA5CAD1A-F542-4635-A069-7CAEFB930070}.AuditMode|Any CPU.ActiveCfg = Debug|Win32
{CA5CAD1A-F542-4635-A069-7CAEFB930070}.AuditMode|ARM.ActiveCfg = AuditMode|Win32
{CA5CAD1A-F542-4635-A069-7CAEFB930070}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{CA5CAD1A-F542-4635-A069-7CAEFB930070}.AuditMode|DotNet_x64Test.ActiveCfg = Debug|Win32
{CA5CAD1A-F542-4635-A069-7CAEFB930070}.AuditMode|DotNet_x86Test.ActiveCfg = Debug|Win32
{CA5CAD1A-F542-4635-A069-7CAEFB930070}.AuditMode|x64.ActiveCfg = Release|x64
{CA5CAD1A-F542-4635-A069-7CAEFB930070}.AuditMode|x86.ActiveCfg = Release|Win32
presumably though should all map to either Audit, Debug or Release, but presumably all the same thing.
Then again, TerminalAppLib is the same way:
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|Any CPU.ActiveCfg = Debug|Win32
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|ARM.ActiveCfg = AuditMode|Win32
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|DotNet_x64Test.ActiveCfg = Debug|Win32
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|DotNet_x86Test.ActiveCfg = Debug|Win32
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|x64.ActiveCfg = Release|x64
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|x86.ActiveCfg = Release|Win32
so maybe this is fine
<!-- Manually add a reference to TerminalControl here. We need this so | ||
MDMERGE will know where the TermControl types are defined. However, we need | ||
to do it exactly like this so the packaging project won't roll up | ||
TermControl's .xbf's from both the TermControl project and this one. --> | ||
<!-- <Reference Include="Microsoft.Terminal.Control"> | ||
<HintPath>$(OpenConsoleCommonOutDir)TerminalControl\Microsoft.Terminal.Control.winmd</HintPath> | ||
<IsWinMDFile>true</IsWinMDFile> | ||
<Private>false</Private> | ||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies> | ||
</Reference> --> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment spells doom and gloom if we don't do this thing, but then it's commented out. Why do we NOT need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna be real with you - no idea why this works now. maybe it thinks the .xbfs belong to TerminalControlLib now, not TerminalControl.dll?
<WinMDReferenceToCompile Remove="@(WinMDReferenceToCompile)" Condition="'%(Filename)' == '$(RootNamespace)'"/> | ||
</ItemGroup> | ||
</Target> | ||
<Import Project="$(SolutionDir)build\rules\CollectWildcardResources.targets" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shocked that resources might just "work", scared too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
me too
Microsoft namespace. This is, obviously, not great. None of our other | ||
projects compile properly when they depend on this "Microsoft.winmd." | ||
--> | ||
<CppWinRTNamespaceMergeDepth>3</CppWinRTNamespaceMergeDepth> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not be doing any namespace merging in this DLL file -- are we?
…rminalcontrol-into-lib # Conflicts: # src/cascadia/TerminalApp/TerminalSettings.h # src/cascadia/TerminalSettingsModel/TerminalSettings.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
108/108, looks fine to me. Mechanical. Makes our build times slower, I suspect, but what doesn't these days? Thanks for doing my renames. 😄
@microsoft/windows-console-team this is a mechanical change -- can we get it reviewed? |
Microsoft.Terminal.TerminalControl
to Microsoft.Terminal.Control
; Split Control into dll & libMicrosoft.Terminal.TerminalControl
to .Control
; Split into dll & lib
Body and title edited to fit commit style (ignore me) |
Hello @zadjii-msft! Because this pull request has the 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 (
|
TIL that the `<None Include="Foo.def" />` line in our projects is actually totally meaningless. The important line is the one that's in `cppwinrt.build.pre.props`, where we declare ```xml <ModuleDefinitionFile Condition="Exists('$(ProjectName).def')">$(ProjectName).def</ModuleDefinitionFile> ``` So if you change a project's name, and not the `.def` file, then the linker will just _not use the `.def` file at all_. More importantly, this seemingly doesn't matter in debug builds. In a Debug build, the linker will happily still include `WINRT_CanUnloadNow` and `WINRT_GetActivationFactory` in the exports from the dll, even without the `.def`. But in a Release build, the linker is much more agressive about pruning symbols that aren't referenced, and without those two, NONE of the symbols are eventually referenced. This PR fixes `Microsoft.Terminal.Control` by renaming the `.def`, and makes it marginally harder for someone to make the same mistake in the future. ## References * Regressed in #9472 ## PR Checklist * [x] Closes #9529 * [x] I work here
Does what it says on the can. This is a follow up to #9472. Now that we have a control .lib, we can add tests for it. Unfortunately, the `TermControl` itself is a horrible mess. So this new unittest lib is empty for now. I'm working on actual tests as a part of #6842, but this PR is here to keep the diffs smaller. Also, apparently `server.vcxproj` had the wrong GUID in it. * [x] I work here * [x] Adds tests
BE NOT AFRAID. I know that there's 107 files in this PR, but almost
all of it is just find/replacing
TerminalControl
withControl
.This is the start of the work to move TermControl into multiple pieces,
for #5000. The PR starts this work by:
TerminalControl
into separate lib and dll projects. We'llwant control tests in the future, and for that, we'll need a lib.
ICoreSettings
back into theMicrosoft.Terminal.Core
namespace. We'll have other types in there soon too.
cppwinrt version? Maybe we're just better at dealing with mdmerge
bugs these days.
Microsoft.Terminal.TerminalControl
toMicrosoft.Terminal.Control
. This touches pretty much every file inthe sln. Sorry about that (not sorry).
An upcoming PR will move much of the logic in TermControl into a new
ControlCore
class that we'll add inMicrosoft.Terminal.Core
.ControlCore
will then be unittest-able in theUnitTests_TerminalCore
, which will help prevent regressions like #9455Detailed Description of the Pull Request / Additional comments
You're really gonna want to clean the sln first, then merge this into
your branch, then rebuild. It's very likely that old winmds will get
left behind. If you see something like
then that's what happened to you.