-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Loading user plugins from app data folder. #6551
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6551 +/- ##
==========================================
+ Coverage 47.17% 47.29% +0.12%
==========================================
Files 698 701 +3
Lines 52668 52700 +32
Branches 6944 6943 -1
==========================================
+ Hits 24844 24924 +80
+ Misses 26497 26441 -56
- Partials 1327 1335 +8
|
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.
- The implementation places user plugins in
Roaming
profile, where most of GE stuff is placed, but I have found thatLocal
is also used by GE - window positions are saved there. Should user plugins beRoaming
orLocal
?
Please make Local
the default for user plugins.
- Method
ManagedExtensibility.SetUserPluginsPath
should be internal, but needs to be called fromPluginRegistry
. Can I addAssemblyInternalsVisibleToAttribute
?
IMHO it's ok. But I would like to hear @RussKie on this point, since I'm not sure of what he thinks.
The intention of |
Suppose you have 2 PCs with some GE version (say 3.2) and some PluginA. API changes will be frequent, at least while we're getting everything up and running. |
Applied changes based on codereview.
|
GitCommands/Settings/AppSettings.cs
Outdated
{ | ||
return GetGitExtensionsDirectory(); | ||
} | ||
else |
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 else
is redundant and should be removed to reduce nesting
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.
Ok
} | ||
|
||
return result; | ||
} |
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.
- Tests?
- Do we need to load all *.dlls or only those matching a specific patten (e.g. GitExtensions.*.dll)?
- Is there a perf risk of searching for a looooooong time? 🤔
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.
- Yeah, tests. I'm sorry, I'm going to add them.
- I had a discussion with @mast-eu that GE org could reserve prefix GitExtensions.* on nuget.org, so that official/core plugins could be in this form and community plugins will have any other pattern.
- The idea is that there will only be 1 level of folder nesting.
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.
- The current plugins have no common naming scheme. So, at least for the moment, we need to load all DLLs from
defaultPluginPath
. A decision about enforcing a naming scheme or not can be taken later. - No, I don't expect a performance impact. I didn't perform any tests yet though.
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.
GE org could reserve prefix GitExtensions.* on nuget.org
👍 Any hints how to do that?
3. The idea is that there will only be 1 level of folder nesting.
I'm afraid we can't assume that. We need to be strict in our implementation and don't go deeper than one level.
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.
GE org could reserve prefix GitExtensions.* on nuget.org
👍 Any hints how to do that?
Send email to account@nuget.org, documentation https://docs.microsoft.com/en-us/nuget/reference/id-prefix-reservation#id-prefix-reservation-application-process.
Unfortunately I have already pushed some packages matching GitExtensions.*, so I would need to unlist them and tranfer to GE org (which I'm ok with). Just let me know when GE org nuget account is ready.
- The idea is that there will only be 1 level of folder nesting.
I'm afraid we can't assume that. We need to be strict in our implementation and don't go deeper than one level.
Ok than.
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.
2 minor comments.
@RussKie What do you think about this?
|
Do you see any problems with |
Only that any plugin can call it, but if it's ok for you, I'm ok with it. |
Resolved notes from code review vol.2. |
Only that any plugin can call it..
Can we make so that once it is initialized it can't be changed?
…On Fri, May 17, 2019, 5:25 PM Marek Fišera ***@***.***> wrote:
@RussKie <https://github.com/RussKie> What do you think about this?
Method ManagedExtensibility.SetUserPluginsPath should be internal, but
needs to be called from PluginRegistry. Can I add
AssemblyInternalsVisibleToAttribute?
Do you see any problems with ManagedExtensibility.SetUserPluginsPath
remaining public?
Only that any plugin can call it, but if it's ok for you, I'm ok with it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6551?email_source=notifications&email_token=ABBTEXWN2SUOQ24H5H4PHRTPVZMWTA5CNFSM4HMJ4XVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVT7CRQ#issuecomment-493351238>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABBTEXUCT4VXPU5RMIYA3HTPVZMWTANCNFSM4HMJ4XVA>
.
|
Sure. |
Just browsed through the unit tests. They look ok. |
I think commits should be squashed before merging. |
I'm currently away, so if you happy with it - merge it.
…On Sat, May 18, 2019, 8:29 AM Martin Steinisch ***@***.***> wrote:
I think commits should be squashed before merging.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6551?email_source=notifications&email_token=ABBTEXWJPYOF2ATSJ4VRIODPV4WSXA5CNFSM4HMJ4XVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVV77UA#issuecomment-493617104>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABBTEXWWTS5N6UQEECHHYG3PV4WSXANCNFSM4HMJ4XVA>
.
|
[TestFixture] | ||
public class PluginsPathScannerTests | ||
{ | ||
[TestCase(@"..\..\PathScanningData", "PluginInRootDir.dll", "PluginInOwnDir.dll")] |
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.
Could you clarify it for me (I'm a bit slow, sorry).
Plugins are stored in c:\Users\<user>\Local\GitExtensions\GitExtensions\UserPlugins
folder:
UserPlugins
\Plugin1
\Plugin1.dll
\Plugin1.config
\Plugin2
\Plugin2.dll
\Plugin2.config
In this scenario this looks like:
PathScanningData
\PluginInRootDir
\PluginInRootDir.dll
\NotFoundPlugin
\SubDir
\NotFoundPlugin.dll1.dll
\PluginInRootDir.dll
Why are we expecting to load PluginInRootDir.dll
?
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.
Backward compatibility. I'm using the method for both core and user plugins. Is it ok? Also PM now extracts plugins in a single directory.
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.
Ah, makes sense, thank you.
all good
I'm this weekend away, so I'm going to squash them on Monday. |
{ | ||
DirectoryInfo directory = new DirectoryInfo(pluginsPath); | ||
|
||
result = Enumerable.Concat(result, directory.GetFiles("*.dll")); |
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 would add a paragraph explaining why we are loading two levels of assemblies.
E.g. load plugins located in the folder to provide back compat, and load new style plugin...
Maybe even add a structure to help visualise
UserPlugins
\OldPlugin1.dll
\OldPlugin2.dll
\OldPlugin2.config
\NewPlugin1
\Plugin1.dll
\Plugin1.config
\NewPlugin2
\Plugin2.dll
\Plugin2.config
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.
Ok
Will merge after squash. |
In portable mode it loads plugins from <GE>\UserPlugins. In installed mode it loads plugins from <GEAppData>\UserPlugins.
Squashed commits and added detailed comment to the |
Any hint on what is wrong with the build? |
Like with most software, sometimes AppVeyor builds just need to be restarted ... 😉 |
Thank you. |
Solves #6415.
In addition to standard plugin location, this change adds:
In portable mode: GE loads plugins from <GE>\UserPlugins.
In installed mode: GE loads plugins from <GEAppData>\UserPlugins.
Questions:
The implementation places user plugins in
Roaming
profile, where most of GE stuff is placed, but I have found thatLocal
is also used by GE - window positions are saved there. Should user plugins beRoaming
orLocal
?Method
ManagedExtensibility.SetUserPluginsPath
should be internal, but needs to be called fromPluginRegistry
. Can I addAssemblyInternalsVisibleToAttribute
?