Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
Also check for version as child element
Browse files Browse the repository at this point in the history
  • Loading branch information
cnr committed Jun 4, 2021
1 parent 0eb90c6 commit 702dea4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Strategy/NuGet/PackageReference.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Strategy.NuGet.PackageReference
, Package(..)
) where

import Control.Applicative (optional)
import Control.Applicative (optional, (<|>))
import Control.Effect.Diagnostics
import Data.Foldable (find)
import qualified Data.List as L
Expand Down Expand Up @@ -90,7 +90,7 @@ instance FromXML ItemGroup where
instance FromXML Package where
parseElement el =
Package <$> attr "Include" el
<*> optional (attr "Version" el)
<*> optional (attr "Version" el <|> child "Version" el)

buildGraph :: PackageReference -> Graphing Dependency
buildGraph project = Graphing.fromList (map toDependency direct)
Expand Down
4 changes: 3 additions & 1 deletion test/NuGet/testdata/test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
<PackageReference Include="two" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="three" Version="3.0.0" />
<PackageReference Include="three">
<Version>3.0.0</Version>
</PackageReference>
<PackageReference Include="four">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit 702dea4

Please sign in to comment.