Skip to content

Commit

Permalink
should not inherit alias settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Hamm committed Jan 31, 2024
1 parent fafe6d0 commit 0c1473b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Paket.Core/PaketConfigFiles/LockFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,8 @@ type LockFile (fileName:string, groups: Map<GroupName,LockFileGroup>) =
let groupName,_packageName = visitKey
for dep in deps do
let deps = this.GetDirectDependenciesOfSafe(groupName,dep,referencesFile.FileName)
toVisit := Set.add ((groupName,dep),p,deps) !toVisit
let packagageSettings = { p with Settings = { p.Settings with Aliases = Map.empty }}
toVisit := Set.add ((groupName,dep),packagageSettings,deps) !toVisit

let emitted = HashSet<_>()
[while visited.Count > 0 do
Expand Down
37 changes: 37 additions & 0 deletions tests/Paket.Tests/InstallModel/PaketPropsTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,43 @@ group Other1
| l ->
Assert.Fail(sprintf "expected one ItemGroup but was '%A'" l)


[<Test>]
let ``should not inherit alias settings``() =

let lockFile = """NUGET
remote: https://api.nuget.org/v3/index.json
Argu (4.2.1)
FSharp.Core (>= 3.1.2)
FSharp.Core (3.1.2.5)
Newtonsoft.Json (>= 11.0.2)
Newtonsoft.Json (11.0.5)
"""

let refFileContent = """
Argu
alias Argu.dll Argu_Alias
"""

let lockFile = LockFile.Parse("", toLines lockFile)

let refFile = ReferencesFile.FromLines(toLines refFileContent)

let packages =
[ for kv in refFile.Groups do
let packagesInGroup,_ = lockFile.GetOrderedPackageHull(kv.Key, refFile)
yield! packagesInGroup ]

let (_, p, _) = packages[0]
Assert.Zero(p.Settings.Aliases.Count)

let (_, p, _) = packages[1]
Assert.Zero(p.Settings.Aliases.Count)

let (_, p, _) = packages[2]
Assert.AreEqual(1, p.Settings.Aliases.Count)

[<Test>]
let ``should create props file for design mode with group restrictions``() =

Expand Down

0 comments on commit 0c1473b

Please sign in to comment.