@@ -226,7 +226,8 @@ func (a *analyzeCommand) setupNetworkProvider(ctx context.Context, providerName
226226 providerSpecificConfig ["lspServerName" ] = providerName
227227 providerSpecificConfig ["lspServerPath" ] = JDTLSBinLocation
228228 providerSpecificConfig ["bundles" ] = JavaBundlesLocation
229- providerSpecificConfig ["depOpenSourceLabelsFile" ] = "/usr/local/etc/maven.default.index"
229+ providerSpecificConfig ["mavenIndexPath" ] = MavenIndexPath
230+ providerSpecificConfig ["depOpenSourceLabelsFile" ] = DepOpenSourceLabels
230231 if a .mavenSettingsFile != "" {
231232 // Use container path where settings.xml is mounted (copied by getConfigVolumes)
232233 providerSpecificConfig ["mavenSettingsFile" ] = path .Join (util .ConfigMountPath , "settings.xml" )
@@ -417,14 +418,15 @@ func (a *analyzeCommand) setupBuiltinProviderHybrid(ctx context.Context, additio
417418 }
418419
419420 builtinConfig := provider.Config {
420- Name : "builtin" ,
421- InitConfig : []provider.InitConfig {
422- {
423- Location : a .input ,
424- AnalysisMode : provider .AnalysisMode (a .mode ),
425- ProviderSpecificConfig : providerSpecificConfig ,
426- },
427- },
421+ Name : "builtin" ,
422+ InitConfig : []provider.InitConfig {},
423+ }
424+ if ! a .isFileInput {
425+ builtinConfig .InitConfig = append (builtinConfig .InitConfig , provider.InitConfig {
426+ Location : a .input ,
427+ AnalysisMode : provider .AnalysisMode (a .mode ),
428+ ProviderSpecificConfig : providerSpecificConfig ,
429+ })
428430 }
429431
430432 // Set proxy if configured
@@ -592,6 +594,7 @@ func (a *analyzeCommand) RunAnalysisHybridInProcess(ctx context.Context) error {
592594 a .log .Info ("loaded override provider settings" , "file" , a .overrideProviderSettings , "providers" , len (overrideConfigs ))
593595 }
594596
597+ providerToInputVolName := map [string ]string {}
595598 // Start containerized providers if any
596599 if len (a .providersMap ) > 0 {
597600 startProviderSetup := time .Now ()
@@ -643,6 +646,7 @@ func (a *analyzeCommand) RunAnalysisHybridInProcess(ctx context.Context) error {
643646 type providerHealthResult struct {
644647 providerName string
645648 err error
649+ volName string
646650 }
647651 healthChan := make (chan providerHealthResult , len (a .providersMap ))
648652
@@ -652,7 +656,7 @@ func (a *analyzeCommand) RunAnalysisHybridInProcess(ctx context.Context) error {
652656 provInit := provInit
653657 go func () {
654658 err := waitForProvider (ctx , provName , provInit .port , 30 * time .Second , a .log )
655- healthChan <- providerHealthResult {providerName : provName , err : err }
659+ healthChan <- providerHealthResult {providerName : provName , err : err , volName : volName }
656660 }()
657661 }
658662
@@ -662,6 +666,7 @@ func (a *analyzeCommand) RunAnalysisHybridInProcess(ctx context.Context) error {
662666 if result .err != nil {
663667 return fmt .Errorf ("provider %s health check failed: %w" , result .providerName , result .err )
664668 }
669+ providerToInputVolName [result .providerName ] = result .volName
665670 }
666671
667672 a .log .Info ("all providers are ready" )
@@ -680,6 +685,13 @@ func (a *analyzeCommand) RunAnalysisHybridInProcess(ctx context.Context) error {
680685
681686 var additionalBuiltinConfigs []provider.InitConfig
682687
688+ hostRoot := a .input
689+ containerRoot := util .SourceMountPath
690+ if a .isFileInput {
691+ // For binary files, use parent directory as hostRoot
692+ hostRoot = filepath .Dir (a .input )
693+ containerRoot = path .Dir (util .SourceMountPath )
694+ }
683695 // Setup network-based provider clients for all configured providers
684696 for provName := range a .providersMap {
685697 a .log .Info ("setting up network provider" , "provider" , provName )
@@ -699,38 +711,54 @@ func (a *analyzeCommand) RunAnalysisHybridInProcess(ctx context.Context) error {
699711 }
700712 providers [provName ] = provClient
701713 providerLocations = append (providerLocations , locs ... )
702- additionalBuiltinConfigs = append (additionalBuiltinConfigs , configs ... )
703- }
704-
705- // CRITICAL FIX: Transform container paths to host paths
706- // The Java provider runs in a container and returns configs with container paths (/opt/input/source).
707- // The builtin provider runs on the host and needs host paths (a.input).
708- // We must transform these paths or builtin provider won't find any files!
709- hostRoot := a .input
710- containerRoot := util .SourceMountPath
711- if a .isFileInput {
712- // For binary files, use parent directory as hostRoot
713- hostRoot = filepath .Dir (a .input )
714- containerRoot = path .Dir (util .SourceMountPath )
715- }
714+ // CRITICAL FIX: Transform container paths to host paths
715+ // The Java provider runs in a container and returns configs with container paths (/opt/input/source).
716+ // The builtin provider runs on the host and needs host paths (a.input).
717+ // We must transform these paths or builtin provider won't find any files!
718+ providerHostRoot := hostRoot
719+ if isBinaryAnalysis {
720+ cmd := exec .CommandContext (ctx , Settings .ContainerBinary , "volume" , "inspect" , providerToInputVolName [provName ])
721+ o , err := cmd .Output ()
722+ if err == nil {
723+ j := []map [string ]any {}
724+ err = json .Unmarshal (o , & j )
725+ if len (j ) == 1 {
726+ found := false
727+ if volPath , ok := j [0 ]["Mountpoint" ]; ok {
728+ if _ , err := os .Lstat (volPath .(string )); err == nil {
729+ providerHostRoot = volPath .(string )
730+ found = true
731+ }
732+ }
733+ if opt , ok := j [0 ]["Options" ]; ! found && ok {
734+ op , ok := opt .(map [string ]any )
735+ if ok {
736+ if volPath , ok := op ["device" ]; ok {
737+ if _ , err := os .Lstat (volPath .(string )); err == nil {
738+ providerHostRoot = volPath .(string )
739+ found = true
740+ }
741+ }
742+ }
743+ }
744+ }
745+ }
746+ }
716747
717- transformedConfigs := make ([]provider.InitConfig , len (additionalBuiltinConfigs ))
718- for i , conf := range additionalBuiltinConfigs {
719- transformedConfigs [i ] = conf
720- // Replace container path prefix with host path
721- if strings .HasPrefix (conf .Location , containerRoot ) {
722- rel := strings .TrimPrefix (conf .Location , containerRoot )
723- rel = strings .TrimPrefix (rel , "/" )
724- if rel == "" {
725- transformedConfigs [i ].Location = hostRoot
726- } else {
727- transformedConfigs [i ].Location = filepath .Join (hostRoot , rel )
748+ for _ , c := range configs {
749+ if rel , err := filepath .Rel (containerRoot , c .Location ); err == nil {
750+ if rel == "." {
751+ c .Location = providerHostRoot
752+ } else {
753+ c .Location = filepath .Join (providerHostRoot , filepath .FromSlash (rel ))
754+ }
728755 }
756+ additionalBuiltinConfigs = append (additionalBuiltinConfigs , c )
729757 }
730758 }
731759
732760 // Setup builtin provider (always in-process)
733- builtinProvider , builtinLocations , err := a .setupBuiltinProviderHybrid (ctx , transformedConfigs , analyzeLog , overrideConfigs , reporter )
761+ builtinProvider , builtinLocations , err := a .setupBuiltinProviderHybrid (ctx , additionalBuiltinConfigs , analyzeLog , overrideConfigs , reporter )
734762 if err != nil {
735763 errLog .Error (err , "unable to start builtin provider" )
736764 return fmt .Errorf ("unable to start builtin provider: %w" , err )
@@ -938,21 +966,17 @@ func (a *analyzeCommand) RunAnalysisHybridInProcess(ctx context.Context) error {
938966 startStaticReport := time .Now ()
939967 a .log .Info ("[TIMING] Starting static report generation" )
940968
941- // Create static report log file for container output
942- staticReportLogPath := filepath .Join (a .output , "static-report.log" )
943- staticReportLog , err := os .Create (staticReportLogPath )
944- if err != nil {
945- return fmt .Errorf ("failed creating static report log file at %s: %w" , staticReportLogPath , err )
946- }
947- defer staticReportLog .Close ()
948-
949- err = a .GenerateStaticReport (ctx , a .log , staticReportLog )
969+ err = a .GenerateStaticReport (ctx , a .log )
950970 if err != nil {
951971 a .log .Error (err , "failed to generate static report" )
952972 return err
953973 }
954974 a .log .Info ("[TIMING] Static report generation complete" , "duration_ms" , time .Since (startStaticReport ).Milliseconds ())
955975
976+ if err := a .getProviderLogs (ctx ); err != nil {
977+ a .log .Error (err , "failed to get provider logs" )
978+ }
979+
956980 // Print results summary (only in progress mode, not in --no-progress mode)
957981 progressMode .Println ("\n Results:" )
958982 reportPath := filepath .Join (a .output , "static-report" , "index.html" )
0 commit comments