Skip to content
Merged
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
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Config: `paths.only` and `paths.exclude` in `.fossa.yml` now accept glob patterns. ([#1703](https://github.com/fossas/fossa-cli/pull/1703))
- Licensing - Fix two bad GPL matches [No PR]
- NuGet: PackageReference discovery now analyzes every `.csproj`/`.xproj`/`.vbproj`/`.dbproj`/`.fsproj` in a directory. Previously only the first match returned by the directory listing was analyzed, so sibling project files were silently dropped. ([#1712](https://github.com/fossas/fossa-cli/pull/1712))


## 3.17.5
Expand Down
2 changes: 1 addition & 1 deletion integration-test/Analysis/NugetSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ testServiceStackForPkgReferences =
aroundAll (withAnalysisOf NonStrict $ serviceStack NuGet.discover) $ do
describe "ServiceStack" $ do
it "should find targets" $ \(result, _) -> do
length result `shouldBe` 64
length result `shouldBe` 92

testServiceStackForPkgConfig :: Spec
testServiceStackForPkgConfig =
Expand Down
1 change: 1 addition & 0 deletions spectrometer.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ test-suite unit-tests
Node.PackageLockSpec
Node.PackageLockV3Spec
NuGet.DirectoryPackagesPropsSpec
NuGet.NuGetSpec
NuGet.NuspecSpec
NuGet.PackageReferenceSpec
NuGet.PackagesConfigSpec
Expand Down
5 changes: 1 addition & 4 deletions src/Strategy/NuGet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Control.Effect.Reader (Reader)
import Data.Aeson (
ToJSON,
)
import Data.Foldable (find)
import Data.List qualified as L
import Discovery.Filters (AllFilters)
import Discovery.Simple (simpleDiscover)
Expand Down Expand Up @@ -51,9 +50,7 @@ findProjects :: (Has ReadFS sig m, Has Diagnostics sig m, Has (Reader AllFilters
findProjects = walkWithFilters' $ \_ _ files -> do
case findProjectAssetsJsonFile files of
Just file -> pure ([NuGetProject file], WalkContinue)
Nothing -> case find isPackageRefFile files of
Just file -> pure ([NuGetProject file], WalkContinue)
Nothing -> pure ([], WalkContinue)
Nothing -> pure (map NuGetProject (filter isPackageRefFile files), WalkContinue)
where
findProjectAssetsJsonFile :: [Path Abs File] -> Maybe (Path Abs File)
findProjectAssetsJsonFile = findFileNamed "project.assets.json"
Expand Down
25 changes: 25 additions & 0 deletions test/NuGet/NuGetSpec.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{-# LANGUAGE TemplateHaskell #-}

module NuGet.NuGetSpec (
spec,
) where

import Path (mkRelDir, mkRelFile, (</>))
import Path.IO (getCurrentDir)
import Strategy.NuGet (NuGetProject (..))
import Strategy.NuGet qualified as NuGet
import Test.Effect (it', shouldMatchList')
import Test.Hspec (Spec, describe, runIO)
import Types (DiscoveredProject (projectData))

spec :: Spec
spec = do
currDir <- runIO getCurrentDir
let projectDir = currDir </> $(mkRelDir "test/NuGet/testdata/multi-csproj")
appCore = projectDir </> $(mkRelFile "App.Core.csproj")
ingageWeb = projectDir </> $(mkRelFile "IngageWeb.csproj")
describe "NuGet discovery" $
it' "discovers every .csproj sibling in a directory (ANE-2523)" $ do
projects <- NuGet.discover projectDir
let files = map (nugetProjectFile . projectData) projects
files `shouldMatchList'` [appCore, ingageWeb]
6 changes: 6 additions & 0 deletions test/NuGet/testdata/multi-csproj/App.Core.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions test/NuGet/testdata/multi-csproj/IngageWeb.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
</ItemGroup>
</Project>
Loading