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

Fix script generation if package contains FSharp.Core name #4287

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Paket.Core/Installation/ScriptGeneration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ module ScriptGeneration =
refls |> List.filter ( fun ref ->
if scriptType = ScriptType.FSharp then
match ref with
| Assembly info -> not (String.containsIgnoreCase "FSharp.Core" info.Name)
| Framework info -> not (String.containsIgnoreCase "FSharp.Core" info)
| LoadScript info -> not (String.containsIgnoreCase "FSharp.Core" info)
| Assembly info -> not (String.startsWithIgnoreCase "FSharp.Core" info.Name)
| Framework info -> not (String.startsWithIgnoreCase "FSharp.Core" info)
| LoadScript info -> not (String.startsWithIgnoreCase "FSharp.Core" info)
else true
)

Expand Down
37 changes: 37 additions & 0 deletions tests/Paket.Tests/ScriptGeneration/LoadingScriptTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,44 @@ let ``generateFSharpScript generates load script``() =
| Generate [ ReferenceType.LoadScript _ ] -> ()
| _ -> Assert.Fail("generated script was expected to be a single load script")

[<Test>]
let ``generateFSharpScript not generates load script for FSharp.Core``() =
let output = ScriptGeneration.generateScript ScriptType.FSharp {
PackageName = Paket.Domain.PackageName "FSharp.Core"
DependentScripts = List.empty
FrameworkReferences = List.empty
OrderedDllReferences = List.empty
PackageLoadScripts = ["foo.fsx"]
}

match output with
| DoNotGenerate -> ()
| _ -> Assert.Fail("generated script was expected to be a single load script")

let ``generateFSharpScript generates load script if contains FSharp.Core but not FSharp.Core - case`` () =
[
"Company.FSharp.Core"
"CompanyFSharp.Core"
"FSharp.Core.Company"
"FSharp.CoreCompany"
"CompanyFsharp.Core.Company"
"Company.Fsharp.CoreCompany"
]

[<Test>]
[<TestCaseSource(nameof(``generateFSharpScript generates load script if contains FSharp.Core but not FSharp.Core - case``))>]
let ``generateFSharpScript generates load script if contains FSharp.Core but not FSharp.Core`` packageName =
let output = ScriptGeneration.generateScript ScriptType.FSharp {
PackageName = Paket.Domain.PackageName packageName
DependentScripts = List.empty
FrameworkReferences = List.empty
OrderedDllReferences = List.empty
PackageLoadScripts = ["foo.fsx"]
}

match output with
| Generate [ ReferenceType.LoadScript _ ] -> ()
| _ -> Assert.Fail("generated script was expected to be a single load script")

let lockFileData = """NUGET
remote: http://www.nuget.org/api/v2
Expand Down