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

FindLocalTools fails to search Paket.exe in Subdirectory #2390

Closed
nilshelmig opened this issue Sep 4, 2019 · 7 comments
Closed

FindLocalTools fails to search Paket.exe in Subdirectory #2390

nilshelmig opened this issue Sep 4, 2019 · 7 comments

Comments

@nilshelmig
Copy link
Contributor

nilshelmig commented Sep 4, 2019

Description

Since Fake 5.16.1 Paket fails to find the local paket tool when it lays in a subdirectory. e.g. <project>/someFolder/.paket/paket.exe

Repro steps

Use Fake.Dotnet.Paket 5.16.1 and have the .paket folder in a subdirectory. Then run Paket.restore

Expected behavior

Paket runs and all packages are restored

Actual behavior

Fake fails with following error:

Script reported an error:
-> BuildFailedException: Target 'WebUI.Fable restore' failed.
   StackTrace:
        at Fake.Core.TargetModule.raiseIfError(OptionalTargetContext context) in d:\a\1\s\src\app\Fake.Core.Target\Target.fs:line 968
        at Fake.Core.TargetModule.runOrDefault(String defaultTarget) in d:\a\1\s\src\app\Fake.Core.Target\Target.fs:line 1150
        at <StartupCode$build_1123B44A282FACB7CED724E7AC817BA781814837820A94699F2A057E60CA8BE9>.$Build$fsx.main@() in D:\Repositories\P-PLUS\build.fsx:line 419
-> One or more errors occurred. (Could not find a part of the path 'D:\Repositories\P-PLUS\.paket'.)
-> DirectoryNotFoundException: Could not find a part of the path 'D:\Repositories\P-PLUS\.paket'.
   StackTrace:
        at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
        at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, EnumerationOptions options)
        at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options)
        at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories(String directory, String expression, EnumerationOptions options)
        at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
        at System.IO.Directory.EnumerateDirectories(String path)
        at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 78
        at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext() in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 64
        at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeOuter@273[T,TResult](ConcatEnumerator`2 x, Unit unitVar0) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seqcore.fs:line 274
        at Microsoft.FSharp.Collections.SeqModule.oneStepTo@985[T](IEnumerable`1 source, List`1 prefix, FSharpRef`1 enumeratorR, Int32 i) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 994
        at Microsoft.FSharp.Collections.SeqModule.action@4126-1[T](IEnumerable`1 source, List`1 prefix, FSharpRef`1 enumeratorR, Int32 i, Unit unitVar0) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 1009
        at [email protected](Int32 i)
        at Microsoft.FSharp.Collections.Internal.IEnumerator.unfold@205.DoMoveNext(b& curr) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 207
        at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext() in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 64
        at Microsoft.FSharp.Collections.SeqModule.IsEmpty[T](IEnumerable`1 source) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 700
        at Fake.Core.ProcessUtils.enumerateDirs@98(IEnumerable`1 dirs) in d:\a\1\s\src\app\Fake.Core.Process\ProcessUtils.fs:line 100
        at [email protected](IEnumerable`1& next) in d:\a\1\s\src\app\Fake.Core.Process\ProcessUtils.fs:line 107
        at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl() in E:\A\_work\130\s\src\fsharp\FSharp.Core\seqcore.fs:line 371
        at Microsoft.FSharp.Collections.Generator.Microsoft-FSharp-Collections-Generator-Generator-1-get_Apply@418-1.Invoke(Unit unitVar0) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 419
        at Microsoft.FSharp.Collections.Generator.appG[a](Generator`1 g) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 314
        at Microsoft.FSharp.Collections.Generator.Microsoft-FSharp-Collections-Generator-Generator-1-get_Apply@339.Invoke(Unit unitVar0) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 340
        at Microsoft.FSharp.Collections.Generator.appG[a](Generator`1 g) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 314
        at Microsoft.FSharp.Collections.Generator.EnumeratorWrappingLazyGenerator`1.System-Collections-IEnumerator-MoveNext()
        at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@171.System-Collections-IEnumerator-MoveNext() in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 178
        at Microsoft.FSharp.Collections.SeqModule.oneStepTo@985[T](IEnumerable`1 source, List`1 prefix, FSharpRef`1 enumeratorR, Int32 i) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 994
        at Microsoft.FSharp.Collections.SeqModule.action@4126-1[T](IEnumerable`1 source, List`1 prefix, FSharpRef`1 enumeratorR, Int32 i, Unit unitVar0) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 1009
        at [email protected](Int32 i)
        at Microsoft.FSharp.Collections.Internal.IEnumerator.unfold@205.DoMoveNext(b& curr) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 207
        at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext() in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 64
        at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeInner@266[T,TResult](ConcatEnumerator`2 x, Unit unitVar0) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seqcore.fs:line 268
        at Microsoft.FSharp.Collections.Generator.Microsoft-FSharp-Collections-Generator-Generator-1-get_Apply@418-1.Invoke(Unit unitVar0) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 419
        at Microsoft.FSharp.Collections.Generator.appG[a](Generator`1 g) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 314
        at Microsoft.FSharp.Collections.Generator.Microsoft-FSharp-Collections-Generator-Generator-1-get_Apply@339.Invoke(Unit unitVar0) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 340
        at Microsoft.FSharp.Collections.Generator.appG[a](Generator`1 g) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 314
        at Microsoft.FSharp.Collections.Generator.EnumeratorWrappingLazyGenerator`1.System-Collections-IEnumerator-MoveNext()
        at Microsoft.FSharp.Collections.SeqModule.TryHead[T](IEnumerable`1 source) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 1369
        at Fake.Core.ProcessUtils.findLocalTool(String envVar, String tool, IEnumerable`1 recursiveDirs) in d:\a\1\s\src\app\Fake.Core.Process\ProcessUtils.fs:line 128
        at Fake.DotNet.Paket.restore(FSharpFunc`2 setParams) in d:\a\1\s\src\app\Fake.DotNet.Paket\Paket.fs:line 261
        at [email protected](TargetParameter unitVar) in D:\Repositories\P-PLUS\build.fsx:line 149
        at Fake.Core.TargetModule.runSimpleInternal(TargetContext context, Target target) in d:\a\1\s\src\app\Fake.Core.Target\Target.fs:line 301

Known workarounds

Change version of Fake.DotNet.Paket in build.fsx.lock to 5.16.0

Related information

  • Operating system: Windows
  • Indications of severity: critical
  • Version of FAKE: 5.16.1
@matthid
Copy link
Member

matthid commented Sep 5, 2019

I'm not sure if this is a bug. Should we really search all directories recursively in the project to find paket.exe? When the project is large or we have stuff like node_modules this might take a long time?
For these scenarios, you can still set the path yourself?

@nilshelmig
Copy link
Contributor Author

@matthid
It worked in 5.16.0 so I think it is a bug.
If it is an intentional change, then I think it should be included in Version 6.0 since it is an breaking change.
We can't build with 5.16.1 anymore since we can't set the path to paket.exe because it searches for .paket folder in the root directory, which does not exists.

At least there should be an option to set the path to paket tool without crashing

@matthid
Copy link
Member

matthid commented Sep 10, 2019

At least there should be an option to set the path to paket tool without crashing

@nilshelmig You already can, as almost any API in FAKE there is a ToolPath flag:

https://github.com/fsharp/FAKE/blob/921f1973c9f1f1b3d7ce14ef4cc4282b4e0b83ef/src/app/Fake.DotNet.Paket/Paket.fs#L17

@nilshelmig
Copy link
Contributor Author

@matthid
I would like to change the ToolPath but the program fails before I can set the path. This happens because restore has only a modifier func to change the parameters but not create them. It will first create default parameters where it fails to finde the paket executeable

@matthid
Copy link
Member

matthid commented Sep 23, 2019

Now I see, yes we need a fix...

@sergey-tihon
Copy link
Member

It is possible to teach findPaketExecutable to identify paket installed as .net core 3.0 local tool?

If user have .config/dotnet-tools.json and it has paket

{
  "version": 1,
  "isRoot": true,
  "tools": {
    "paket": {
      "version": "5.223.0",
      "commands": [
        "paket"
      ]
    },
    "fake-cli": {
      "version": "5.16.1",
      "commands": [
        "fake"
      ]
    }
  }
}

then find it somewhere in Nuget cache, to better call dotnet paket ...

@matthid
Copy link
Member

matthid commented Oct 20, 2019

Ok thanks for reporting this. I found the root cause, should be fixed in the next release (5.18), sorry for taking a bit longer. I didn't understand the impact initially and overlooked this on 5.17.

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

No branches or pull requests

3 participants