Removed RestoreCommand and made assemblies load from packages/root folder#302
Removed RestoreCommand and made assemblies load from packages/root folder#302glennblock merged 26 commits intoscriptcs:devfrom
Conversation
|
One thing I worry about with this change is how it will impact performance. We don't want to have to hit nuget apis to find the reference paths every time we load. The first time it's ok. How about if we create a file in the bin which contains all the paths you discovered for binaries? Then if the file exists you just use the paths within, and if it doesn't, you create it. |
There was a problem hiding this comment.
This feels like more of a service then a base command. Instead of using a base, what if you just have an IAssemblyPaths service which is injected into whoever needs it?
I agree, we could even do this on installation? |
|
Yes, but remember if there's no bin today we run install for you. Similarly On Mon, May 27, 2013 at 12:25 AM, Kristian Hellang <[email protected]
|
|
We run installation automatically if there's a packages.config, but no packages folder. Automatic installation:
Install:
Run:
Have I forgotten anything? |
|
Looks good. -----Original Message----- We run installation automatically if there's a packages.config, but no packages folder. |
|
How do you want the manifest? JSON, XML, CSV, separated lines, whatever? |
|
I think it would be a good idea to format this file in a way that makes it extensible. That way we can use the same file to store additional state if it becomes necessary in the future. Users shouldn't need to view or edit the contents of the manifest file, so we don't necessarily need to limit ourselves to plain text formats. But for simplicity, 👍 JSON. |
|
Alright! I'll just stick with ServiceStack.Text for the de-/serialization work, then 😄 |
|
@glennblock Regarding the |
|
JSON please! On Mon, May 27, 2013 at 6:51 AM, Kristian Hellang
|
|
What do you guys think? I added Now the only thing left is lots of tests 😄 |
|
This PR became a bit bigger than first intended... 😟 |
|
Break it up ;-) On Mon, May 27, 2013 at 9:11 AM, Kristian Hellang
|
|
I'm not sure how to split it up and leave the codebase in a good state. It isn't that big, functionality wise, but some renaming can make it seem big because it touches a lot of files... 28 files is a lot for this small codebase 😉 |
|
I didn't even look at it, I just responded off the cuff ;p On Mon, May 27, 2013 at 9:48 AM, Kristian Hellang
|
…ded tests for IAssemblyResolver
|
OK :-) |
|
@glennblock That's probably because as of now, the exceptions are swallowed.... |
|
But try out the webapi and nancy samples since both should break for you. |
|
Will do 😄 |
|
@khellang right i just merged that |
|
There are some things though... How do I know which package folders I should pick up with MEF? For a package, there could be net40, sl4, etc. I could use the |
There was a problem hiding this comment.
The AssemblyResolver is used to get assemblies to include in the AggregateCatalog. It's later reused when running a script/REPL for passing assemblies to reference in the ScriptExecutor. Should we cache these assembly names?
There was a problem hiding this comment.
Yes I would
-----Original Message-----
From: "Kristian Hellang" [email protected]
Sent: 6/6/2013 3:24 PM
To: "scriptcs/scriptcs" [email protected]
Cc: "Glenn Block" [email protected]
Subject: Re: [scriptcs] Removed RestoreCommand and made assemblies load frompackages/root folder (#302)
In src/ScriptCs/CompositionRoot.cs:
{
var scriptPath = Path.Combine(Environment.CurrentDirectory, "bin");if (Directory.Exists(scriptPath)){var catalog = new DirectoryCatalog(scriptPath);builder.RegisterComposablePartCatalog(catalog);}var currentDirectory = Environment.CurrentDirectory; The AssemblyResolver is used to get assemblies to include in the AggregateCatalog. It's later reused when running a script/REPL for passing assemblies to reference in the ScriptExecutor. Should we cache these assembly names?var assemblies = assemblyResolver.GetAssemblyPaths(currentDirectory);
—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
I would make the resolver cache
-----Original Message-----
From: "Kristian Hellang" [email protected]
Sent: 6/6/2013 3:24 PM
To: "scriptcs/scriptcs" [email protected]
Cc: "Glenn Block" [email protected]
Subject: Re: [scriptcs] Removed RestoreCommand and made assemblies load frompackages/root folder (#302)
In src/ScriptCs/CompositionRoot.cs:
{
var scriptPath = Path.Combine(Environment.CurrentDirectory, "bin");if (Directory.Exists(scriptPath)){var catalog = new DirectoryCatalog(scriptPath);builder.RegisterComposablePartCatalog(catalog);}var currentDirectory = Environment.CurrentDirectory; The AssemblyResolver is used to get assemblies to include in the AggregateCatalog. It's later reused when running a script/REPL for passing assemblies to reference in the ScriptExecutor. Should we cache these assembly names?var assemblies = assemblyResolver.GetAssemblyPaths(currentDirectory);
—
Reply to this email directly or view it on GitHub.
|
Now the caching should be good. Went from 226ms to 113ms 😃 |
|
Cool -----Original Message----- Now the caching should be good. Went from 226ms to 113ms |
|
@khellang just tested it out, it is making big progress! Web API hosting sample worked without a hitch. I ran the sample with just packages.config, it installed them and worked perfect! However, the RavenDB sample did not. I did the same and ran it and got this output. So for some reason even though installed the packages it did not work. Now, after it errored out, I checked the packages folder and all the packages were there. I then ran it again and it worked. I haven't tried to debug it yet, but it sounds like it either failed to load or tried to load too early. |
|
@khellang I just removed my packages folder and tested again, same result. So it's easy to repro using the RavenDB sample. Also if I do "scriptcs -install" first and then run it works fine as well. |
|
@glennblock that is actually not a problem with this PR, it's been there for a while. See #297. It only happens on automatic installation because the binaries are resolved at startup, and because there are no binaries at startup (hence the automatic installation), it fails when trying to run. Don't know if that's understandable 😄 We need to think about how we can do this in a two phase fashion, i.e. run automatic installation before bootstrapping the CLI app... |
|
Yes, I think what we should do here is basically tear down the container if On Mon, Jun 10, 2013 at 11:24 PM, Kristian Hellang <[email protected]
|
|
This looks good enough to merge now so I am going to push the button. We can still go back and refactor the setup code that I commented on above, but it's not critical. It'll be great to have this feature! |
|
Merged! |
Removed RestoreCommand and made assemblies load from packages/root folder
Removed RestoreCommand and made assemblies load from packages/root folder
Fixes #1
Please provide feedback on the current logic, it might not be 100%...