You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve Command Caching by Aliasing Commands (#2304)
* Wip to cache more
* Switch approaches to alias a command root
This simplifies the logic significantly.
Some downsides to this:
- its not bidirectional, so 'C:\dotnet' gets aliased to 'dotnet' but any cached stuff for 'C:\dotnet' is not saved and reused by 'dotnet'. But this is a problem with the previous approach.
- Doing it this way allows us to future proof commands. e.g. list sdks, list runtimes, etc. having it bi-directional requires us to see what commands were already cached with the previous command key, which would mean we'd need to store all of the cached commands or search the entire cache map since the options etc are part of what gets cached, we can't just search via the command root, unless we separate the data structure into a 2 part lookup, but that will add further issues.
consider linux edge cases here, this should be ok for now.
* Fix ordering and add tests
log seems to show its not working. Need to check this and added test. maybe the in place edit of the object doesnt work
* Fix the logic and tests
* Fix the sorting logic, thx copilot for writing this boring code
// This is deprecated but still needed to scan .NET 6 and below
35
+
process.env.DOTNET_MULTILEVEL_LOOKUP='0';// make it so --list-runtimes only finds the runtimes on that path: https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/7.0/multilevel-lookup#reason-for-change
this.workerContext.eventStream.post(newDotnetConditionsValidated(`${dotnetExecutablePath} satisfies the conditions.`));
65
+
returntrue;
66
+
}
45
67
}
68
+
69
+
this.workerContext.eventStream.post(newDotnetFindPathDidNotMeetCondition(`${dotnetExecutablePath} did NOT satisfy the conditions: hostArch: ${hostArch}, requiredArch: ${requirement.acquireContext.architecture},
this.workerContext.eventStream.post(newDotnetConditionsValidated(`${dotnetExecutablePath} satisfies the conditions.`));
59
-
returntrue;
83
+
deleteprocess.env.DOTNET_MULTILEVEL_LOOKUP;
60
84
}
61
85
}
62
-
63
-
this.workerContext.eventStream.post(newDotnetFindPathDidNotMeetCondition(`${dotnetExecutablePath} did NOT satisfy the conditions: hostArch: ${hostArch}, requiredArch: ${requirement.acquireContext.architecture},
* @param commandRootAlias The root of the command that will result in the same output. Example: if we know "dotnet" is "C:\\Program Files\\dotnet\\dotnet.exe"
113
+
* @param aliasedCommandRoot The identical command that had likely already been cached.
114
+
* @remarks This does not work in the opposite direction. If you alias "dotnet" to "dotnet2", it will not alias "dotnet2" to "dotnet".
115
+
* Trying that will result in neither command being cache aliased to one another.
116
+
* Basically, this will replace all command checks in the cache that have the commandRoot of `commandRootAlias` with the `aliasedCommandRoot`.
0 commit comments