Skip to content
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

Extension point for package manager. #2667

Closed
wants to merge 7 commits into from
Closed

Extension point for package manager. #2667

wants to merge 7 commits into from

Conversation

KevinRansom
Copy link
Member

Is the package manager extension point from: #2483

  1. Does not contain the package manager.
  2. Builds on coreclr
  3. Requires package manager key to be at least 2 chars. This allows references to be rooted by a drive letter.

@@ -250,6 +250,7 @@ Misc01 EntryPoint
Misc01 Globalization
Misc01,NoMT Import
Misc01,NoMT ..\..\..\testsprivate\fsharpqa\Source\InteractiveSession\AssemblyLoading
Misc01,NoMT InteractiveSession\Paket
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one should point to UnkonwDependencyManager right?

@forki
Copy link
Contributor

forki commented Mar 21, 2017

Where would we need to put the packagemanager dll?

@dsyme
Copy link
Contributor

dsyme commented Mar 21, 2017

Exciting!

| Some kv -> ReferenceType.RegisteredDependencyManager kv.Value
with
| e ->
errorR(Error(FSComp.SR.packageManagerError(e.Message),m))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it wouldn't hurt to have the full stack trace?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah adding some stack trace would be helpful

ReferenceType.Library path
| _ ->
let managers = RegisteredDependencyManagers()
match managers |> Seq.tryFind (fun kv -> path.StartsWith(kv.Value.Key + ":" )) with
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to fix the lookup, didn't had chance to fix that in original PR but we are using a map, so we should lookup on the exact key rather than iteration.

@KevinRansom
Copy link
Member Author

@forki, currently, the directory containing the executing FSharp.Compiler.dll, or the BaseDirectory of the AppDomain or LoadContext, I.e the directory containing fsi.exe.

@forki
Copy link
Contributor

forki commented Mar 21, 2017 via email

@smoothdeveloper
Copy link
Contributor

@forki / @KevinRansom there are few notes on that topic on the RFC: https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1027-fsi-references.md look for "Handler resolution" on it.

@forki
Copy link
Contributor

forki commented Mar 26, 2017

How can we move forward here?

@smoothdeveloper
Copy link
Contributor

@KevinRansom, I think we should keep some more iteration on @forki's branch, because having a paket-less version of this branch makes it harder to do real things with it, and we are losing important tests that found real issues along the way.

I might resume the work some time next week to sketch an implementation for the "handler resolution", and I think working on the other branch makes most sense, what about you submitting patches to the other branch instead?

Also, I think it would make sense for FSI to have the paket manager assembly since there is no hard dependency, just relying on paket.exe. The handler resolution also allow to override handler that we would be shipping out of the box.

Any input?

@KevinRansom
Copy link
Member Author

KevinRansom commented Apr 7, 2017 via email

@smoothdeveloper
Copy link
Contributor

@KevinRansom can you review the https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1027-fsi-references.md "Handler resolution" section to tell if you think it is too complicated and what you propose instead?

@KevinRansom
Copy link
Member Author

I'm not sure I understand it, I got a bit confused between tool resolution and assembly resolution I thought I did then I lost my place, and sort of got confused.

I think that the rules for #r assembly resolution can be quite simple though.

CAVEAT: The current Windows FSI #r behavior needs to be unchanged on Windows, which makes me wonder about what follows. Perhaps a #newloader pragma to turn on this behavior

  1. for an unqualified assembly name or path without a directory specification
    E.g.
    "System.Runtime.Collections" or "System.Runtime.Collections.dll"

    Load it using the standard Loader semantic. I.e relative to the BaseDirectory of the FSI loadContext.

  2. For an absolute or relative path to the assembly Load it using the standard loader semantic relative to the script directory of the currently executing FSX. If there is no executing script then relative to the fsi.exe location. (Send to FSI needs to specify the executing script location, or project location).

  3. Resolutions using paket or nuget specify the full location of the file on disk.

  4. There is no longer any need to distinguish between ref and impl assemblies. paket or nuget will need to ensure that they add the impl assemblies in the script before the ref assemblies.

  5. For resolving the tool, I think loadfrom files in an environment variable perhaps FSHARP_DM that has a semicolon delimited list of the full path to the location perhaps containing assemblies with the name pattern "DependencyManager.dll", if it's not found there then load from base directory. For sure we will ship paket and nuget integration points in the product so they will be there. And I suppose if someone builds one an NPM integration point, so the environment variable will likely almost never be used

Kevin

@KevinRansom
Copy link
Member Author

@smoothdeveloper BTW, the reason I hadn't pulled this was I was hoping to build a test that demonstrated that it worked, but got sidetracked by PDB work..

errorR(Error(FSComp.SR.packageManagerError(e.Message),m))
None

let resolve (packageManager:IDependencyManagerProvider) implicitIncludeDir fileName m packageManagerTextLines =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have /// comments on all new top-level let , type and module please? thanks

@dsyme
Copy link
Contributor

dsyme commented Apr 13, 2017

I glanced over this, it's looking very good. What's the plan for adding more testing here? There's only one small negative test so far, and the feature PR should really be self-contained w.r.t. testing?

Also is there any testing for the ref/impl split?

let postSources = (!tcConfig).GetAvailableLoadedSources()
let sources = if preSources.Length < postSources.Length then postSources.[preSources.Length..] else []

yield! resolveDependencyManagerSources filename
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is resolveDependencyManagerSources called twice?

// * to minimize footprint of integration in fsi/CompileOps

/// hardcoded to net461 as we don't have fsi on netcore
let targetFramework = "net461"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this, and does it need to be hard-coded?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is remnant from hardcoded parameter we need to give in case of paket.

Notice that IDependencyManagerProvider.ResolveDependencies takes a targetFramework parameter, which has been this value so far.

If we don't give a single framework, it makes it difficult for paket to identify which is intended framework.

I think this should come from tooling, similarly that we have an issue of intellisense always working with latest .net framework rather than having an user option to specify it.

@dsyme
Copy link
Contributor

dsyme commented Jun 27, 2017

@forki Can you update this when you get the chance? Thanks!

@forki
Copy link
Contributor

forki commented Jun 27, 2017

? I had my own pull request. Not sure what Kevin did here

@dsyme
Copy link
Contributor

dsyme commented Dec 1, 2017

Closing in favour of #4042

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants