Skip to content

Commit

Permalink
debug: Add extra debug logging along Gradle analysis path (#1360)
Browse files Browse the repository at this point in the history
* debug: Add extra debug logging along Gradle analysis path

* Update CHANGELOG

* Address comments
  • Loading branch information
elldritch committed Jan 11, 2024
1 parent 64c2f20 commit a48355e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# FOSSA CLI Changelog

## v3.8.30
- Debug: add more logging for debugging missing dependencies. ([#1360](https://github.com/fossas/fossa-cli/pull/1360))

## v3.8.29
- Prevents showing SCM warnings in fossa analyze, test, and report [#1354](https://github.com/fossas/fossa-cli/pull/1354)
- Pathfinder: Pathfinder has been deprecated and removed. ([#1350](https://github.com/fossas/fossa-cli/pull/1350))
Expand Down
4 changes: 4 additions & 0 deletions src/App/Fossa/Analyze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import Effect.Exec (Exec)
import Effect.Logger (
Logger,
Severity (..),
logDebug,
logInfo,
logStdout,
)
Expand Down Expand Up @@ -353,8 +354,10 @@ analyze cfg = Diag.context "fossa-analyze" $ do
forkTask $ do
res <- Diag.runDiagnosticsIO . diagToDebug . stickyLogStack . withEmptyStack $ Archive.discover (runAnalyzers filters) basedir ancestryDirect
Diag.withResult SevError SevWarn res (const (pure ()))
logDebug $ "Unfiltered project scans: " <> pretty (show projectScans)

let filteredProjects = mapMaybe toProjectResult projectScans
logDebug $ "Filtered project scans: " <> pretty (show filteredProjects)

maybeEndpointAppVersion <- case destination of
UploadScan apiOpts _ -> runFossaApiClient apiOpts $ do
Expand All @@ -377,6 +380,7 @@ analyze cfg = Diag.context "fossa-analyze" $ do
$ traverse (enrichPathDependencies includeAll vendoredDepsOptions revision) filteredProjects
(True, _) -> pure $ map enrichPathDependencies' filteredProjects
(False, _) -> traverse (withPathDependencyNudge includeAll) filteredProjects
logDebug $ "Filtered projects with path dependencies: " <> pretty (show filteredProjects')

let analysisResult = AnalysisScanResult projectScans vsiResults binarySearchResults manualSrcUnits dynamicLinkedResults maybeLernieResults
renderScanSummary (severity cfg) maybeEndpointAppVersion analysisResult $ Config.filterSet cfg
Expand Down
2 changes: 2 additions & 0 deletions src/Strategy/Gradle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ analyze foundTargets dir = withSystemTempDir "fossa-gradle" $ \tmpDir -> do

let text = decodeUtf8 $ BL.toStrict stdout
let resolvedProjects = ResolutionApi.parseResolutionApiJsonDeps text
logDebug $ "Resolved projects: " <> pretty (show resolvedProjects)
let graphFromResolutionApi = ResolutionApi.buildGraph resolvedProjects (onlyConfigurations)
logDebug $ "Graph: " <> pretty (show graphFromResolutionApi)

-- Log debug messages as seen in gradle script
traverse_ (logDebug . pretty) (getDebugMessages text)
Expand Down

0 comments on commit a48355e

Please sign in to comment.