-
Notifications
You must be signed in to change notification settings - Fork 525
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
Implement a loading script generator. #1619
Conversation
@smoothdeveloper I rebased against the latest v3 branch and created a new |
Ok I did another round of changes. I think this is now more or less feature complete (at least how I imagined it). One minor thing are probably framework assemblies, but when this hits someone it shouldn't be too difficult to add. @forki how should we integrate this feature? @smoothdeveloper Feel free to submit further changes and thank you for the help. Sorry if you have some open changes, as now you probably have a lot of merge conflicts ... |
let depLines = | ||
input.DependentScripts | ||
|> Seq.map (fun s -> sprintf "#load \"../%s\"" (s.Replace("\\", "/"))) |
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 think we need a helper function given a (assembly: FileInfo) and a (packageFolder: DirectoryInfo) generate a system agnostic path.
those s.Replace here and there seems hackish.
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 and we need to escape the string properly as well. This whole thing is a bit hacky atm :)
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'll give it a spin, trying to not expand too much the code (you did a good slimming of things which ended not being useful from my changes).
@matthid: thanks for pushing :) Seems you got rid of QuickGraph and figured out a way with just Mono.Cecil, sounds great. I'm not sure we want scripts generated on I'm also not sure about the location and naming of scripts, the code should also be more resilient to such adjustments, also maybe it is better to give end user option for alternative location for the scripts to be generated?. @forki: is it ok to add Mono.Cecil (274kb)? |
@matthid, we might need to deal with native binaries also, one example I found is SkiaSharp nuget package has native dll file under build/x86 and build/x64, in F# either of those directories should be included with I'm not sure yet if paket handle those files properly in terms of putting such a dependency in |
I have no idea. But it is likely that (if paket can handle those binaries) we can re-use something from the |
I'm getting on top of changes right now, will update the PR shortly today. |
@matthid, I've made a bunch of changes, please check it out, I think it looks great. I've tried it out on few repositories using paket and it seems to be doing great for a first take at this 😄 |
@matthid I think we need to to work on those points:
@forki how do you forsee integrating this into the main tool (we need only mono.cecil now) |
Currently I'm focused on other stuff but I don't mind to depend on Cecil.
|
|
||
// note: we should probably find/use Paket way to resolve package group folder | ||
match groupName.GetCompareString () with | ||
| "main" -> packagesFolder |
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.
should we replace this with the constant as well?
I see this more like cosmetics, can be fixed later if people have problems with it. Removing would complicate some things at this point.
If we cannot create one script we cannot really create any scripts that depend on it... or we just keep going. We should just let it fail and write the raw problem to the output (and continue whatever paket was doing). People will complain and we can fix issues as they pop up. Or did you mean something else? |
By the way a good set of changes, thanks. You really like the System.IO classes ;) I somehow never find them usable, but thats probably just me :) |
Awesome 😄
yes the overall structure didn't feel natural before I did last change, and I don't think I improved it much, we should work on making the code feel nice and simple. Maybe we also need some integration testing, not clear yet but I'll give a look at how we can do that in current set of integration tests which have great infrastructure.
Good point
We should generate other scripts in other branches of the dependency tree, not sure how easy that is but sounds achievable and useful.
Yes we need to see what happens from user perspective. Also, what do we intend end user to do?
They just make things a bit more obvious, otherwise I always wonder is this a folder, a file, etc. They incur a bit of noise ( |
@matthid, I've restored better integration points to pass higher order function for:
I'm thinking of tackling writing some crude test, and in order to do so, leverage some of the existing integration test cases. I'll add a ScriptGenerationTests module in the integration tests project and see how it goes. |
Some points came up on slack: It would be great to have a Also, has there been any consideration to restoring/generating the scripts on
This isn't a deal-breaker, because it's easy enough to have the bat/ps1/s script call the generate-scripts functionality, but it may be nice. |
My biggest concern with the |
@smoothdeveloper Yes that all sounds great. I might be able to take a closer look, handle framework dependencies and write some tests on the weekend :) @baronfel good idea with the paket.dependencies configuration. And I agree if we include this in paket we should probably generate the scripts on restore. |
@matthid I've done work in the dependencies and lock file parsers before. If you decide to go that route I'd be glad to tackle that if you're busy doing other things. |
@baronfel good point. well we didn't do any integration at this point. because nothing felt really clean ... any suggestion/concern is welcome |
@matthid I think the code should now go right into Paket.Core, could you make that happen so I'm not stomping on files being moved? Once this is done I intend to look at adding a |
@matthid I've added @forki there is some crude framework detection going on in the code I've added, I think to keep in in this command only for now as it is very rough, but would appreciate if there is any pointer in paket codebase dealing with those aspects. |
IncludeScriptsRootFolder : DirectoryInfo | ||
DependentScripts : FileInfo seq | ||
FrameworkReferences : string seq | ||
OrderedRealtiveDllReferences : string seq |
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.
typo? OrderedRelativeDllReferences
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.
yep, thanks
@smoothdeveloper I added framework-dependencies and moved the thing to paket.core, but I guess you already saw that :) . |
@matthid thanks I overlooked framework dependencies, will pay a look at how it works, thanks for cleaning a bit the mess in ScriptGeneration.fs :) |
…a list instead of a seq
… set of dependencies * move fst' as an inner function * bit of documentation
* integration tests covering new behaviour (minor) rename function
ad53d3b
to
7d3fbc5
Compare
Mmh, I need to reproduce this case on a linux / macos machine I guess, I believe the script generation doesn't end up with same scripts on windows vs mono despite the framework is specified. Could it be that @matthid / @forki what do you recommend we do with this test? I don't feel it should hold the feature so I might just |
…ow (only when it fails). The test passes under windows and macos, but not on linux so this needs to be troubleshooted separately and not hold merge of the PR.
@forki, I've disabled the offending test, it won't work on linux until someone can really step through the code there. Please check again if this can be merged now. Thanks! |
I will test this as soon as I have working Internet connection on my pc
|
This will create .csx and .fsx scripts under `paket-files/include-scripts/net45/`, those files can now be | ||
used in your scripts without having to bother with the list and order of all dependencies for given package. | ||
|
||
Note: this command only works after packages have been restored, please call `paket restore` before using `paket generate-include-scripts` or `paket install` if you just changed your `paket.dependencies` file. |
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.
can we make it call restore (in a future PR)?
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.
You mean having the command itself call restore to remove the need from the user?
If you think that's the sensible choice, yes I can make a PR for this.
Similarly, do you have an idea about how it should interact with "garbage collection" story?
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 think create script should do a restore.
I think gc should be extended to clean unused load scripts
On May 10, 2016 10:37, "Gauthier Segay" notifications@github.com wrote:
In docs/content/commands/generate-include-scripts.md
#1619 (comment):@@ -0,0 +1,55 @@
+## Generating include scripts for all Nuget packages
+
+It is possible to generate include scripts for all registered Nuget packages defined in paket.dependencies.
+
- [lang=batchfile]
- $ paket generate-include-scripts framework net45
+This will create .csx and .fsx scripts under
paket-files/include-scripts/net45/
, those files can now be
+used in your scripts without having to bother with the list and order of all dependencies for given package.
+
+Note: this command only works after packages have been restored, please callpaket restore
before usingpaket generate-include-scripts
orpaket install
if you just changed yourpaket.dependencies
file.You mean having the command itself call restore to remove the need from
the user?If you think that's the sensible choice, yes I can make a PR for this.
Similarly, do you have an idea about how it should interact with "garbage
collection" story?—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/fsprojects/Paket/pull/1619/files/3eda83abb200591365d4aac47cbe30d908b111ba#r62631374
Yes I'll rename the folder with all the related tests. |
Any chance to tell ncrunch to work somewhere else? |
maybe, but don't know how |
See #1613. This is a new PR against the v3 branch.
As I don't know when I can continue this, here is a start for
#1593
#677
instead of #702 we resolve everything our-self. I don't know when I can finish this so here is what I have for now.
I think it works for Deedle for now...
Todo: