@@ -11,6 +11,7 @@ import (
1111 "sync"
1212
1313 "github.com/gnodet/mvx/pkg/config"
14+ "github.com/gnodet/mvx/pkg/util"
1415 "github.com/gnodet/mvx/pkg/version"
1516)
1617
@@ -261,7 +262,7 @@ func (b *BaseTool) VerifyWithConfig(version string, cfg config.ToolConfig, verif
261262 // Set up environment for verification (needed for tools like Maven that depend on Java)
262263 env , err := b .setupVerificationEnvironment (cfg )
263264 if err != nil {
264- logVerbose ("Failed to setup verification environment: %v" , err )
265+ util . LogVerbose ("Failed to setup verification environment: %v" , err )
265266 env = nil // Fall back to default environment
266267 }
267268
@@ -287,7 +288,7 @@ func (b *BaseTool) setupVerificationEnvironment(cfg config.ToolConfig) ([]string
287288 if tool , err := b .manager .GetTool (b .toolName ); err == nil {
288289 if depProvider , ok := tool .(DependencyProvider ); ok {
289290 dependencies := depProvider .GetDependencies ()
290- logVerbose ("Setting up dependencies for %s verification: %v" , b .toolName , dependencies )
291+ util . LogVerbose ("Setting up dependencies for %s verification: %v" , b .toolName , dependencies )
291292
292293 // Add dependencies to the temporary config
293294 for _ , depName := range dependencies {
@@ -300,7 +301,7 @@ func (b *BaseTool) setupVerificationEnvironment(cfg config.ToolConfig) ([]string
300301 Distribution : installedVersions [0 ].Distribution ,
301302 }
302303 tempConfig .Tools [depName ] = depConfig
303- logVerbose ("Added dependency %s %s to verification environment" , depName , installedVersions [0 ].Version )
304+ util . LogVerbose ("Added dependency %s %s to verification environment" , depName , installedVersions [0 ].Version )
304305 }
305306 }
306307 }
@@ -342,15 +343,15 @@ func (b *BaseTool) setupVerificationEnvironment(cfg config.ToolConfig) ([]string
342343func (b * BaseTool ) SetupHomeEnvironment (version string , cfg config.ToolConfig , envVars map [string ]string , envVarName string , getPath func (string , config.ToolConfig ) (string , error )) error {
343344 binPath , err := getPath (version , cfg )
344345 if err != nil {
345- logVerbose ("Could not determine %s for %s %s: %v" , envVarName , b .toolName , version , err )
346+ util . LogVerbose ("Could not determine %s for %s %s: %v" , envVarName , b .toolName , version , err )
346347 return nil
347348 }
348349
349350 // *_HOME should point to the installation directory, not the bin directory
350351 if strings .HasSuffix (binPath , "/bin" ) {
351352 homeDir := strings .TrimSuffix (binPath , "/bin" )
352353 envVars [envVarName ] = homeDir
353- logVerbose ("Set %s=%s for %s %s" , envVarName , homeDir , b .toolName , version )
354+ util . LogVerbose ("Set %s=%s for %s %s" , envVarName , homeDir , b .toolName , version )
354355 }
355356
356357 return nil
@@ -544,7 +545,7 @@ func (b *BaseTool) getDownloadOptions() DownloadOptions {
544545func (b * BaseTool ) StandardInstall (version string , cfg config.ToolConfig , getDownloadURL func (string ) string ) error {
545546 // Check if we should use system tool instead of downloading
546547 if UseSystemTool (b .toolName ) {
547- logVerbose ("%s=true, forcing use of system %s" , getSystemToolEnvVar (b .toolName ), b .toolName )
548+ util . LogVerbose ("%s=true, forcing use of system %s" , getSystemToolEnvVar (b .toolName ), b .toolName )
548549
549550 // Try primary binary name in PATH
550551 if toolPath , err := exec .LookPath (b .binaryName ); err == nil {
@@ -665,29 +666,29 @@ func (b *BaseTool) ListInstalledVersions(distribution string) []InstalledVersion
665666func (b * BaseTool ) StandardIsInstalled (versionSpec string , cfg config.ToolConfig , getPath func (string , config.ToolConfig ) (string , error )) bool {
666667 if UseSystemTool (b .toolName ) {
667668 if _ , err := exec .LookPath (b .GetBinaryName ()); err == nil {
668- logVerbose ("System %s is available in PATH (MVX_USE_SYSTEM_%s=true)" , b .toolName , strings .ToUpper (b .toolName ))
669+ util . LogVerbose ("System %s is available in PATH (MVX_USE_SYSTEM_%s=true)" , b .toolName , strings .ToUpper (b .toolName ))
669670 return true
670671 }
671672
672- logVerbose ("System %s not available: not found in environment variables or PATH" , b .toolName )
673+ util . LogVerbose ("System %s not available: not found in environment variables or PATH" , b .toolName )
673674 return false
674675 }
675676
676677 tool , err := b .manager .GetTool (b .toolName )
677678 if err != nil {
678- logVerbose ("Failed to get tool %s: %v" , b .toolName , err )
679+ util . LogVerbose ("Failed to get tool %s: %v" , b .toolName , err )
679680 return false
680681 }
681682
682683 spec , err := version .ParseSpec (versionSpec )
683684 if err != nil {
684- logVerbose ("Failed to parse version spec %q: %v" , versionSpec , err )
685+ util . LogVerbose ("Failed to parse version spec %q: %v" , versionSpec , err )
685686 return false
686687 }
687688
688689 targetVersion , resolveErr := b .resolveTargetVersion (tool , spec , versionSpec , cfg )
689690 if resolveErr != nil {
690- logVerbose ("Failed to resolve target version for %s %s: %v" , b .toolName , versionSpec , resolveErr )
691+ util . LogVerbose ("Failed to resolve target version for %s %s: %v" , b .toolName , versionSpec , resolveErr )
691692 }
692693
693694 installed := b .ListInstalledVersions (cfg .Distribution )
@@ -700,7 +701,7 @@ func (b *BaseTool) StandardIsInstalled(versionSpec string, cfg config.ToolConfig
700701 for _ , inst := range installed {
701702 parsed , err := version .ParseVersion (inst .Version )
702703 if err != nil {
703- logVerbose ("Failed to parse installed version %s: %v" , inst .Version , err )
704+ util . LogVerbose ("Failed to parse installed version %s: %v" , inst .Version , err )
704705 continue
705706 }
706707 if spec .Matches (parsed ) {
@@ -718,7 +719,7 @@ func (b *BaseTool) StandardIsInstalled(versionSpec string, cfg config.ToolConfig
718719
719720 // Check candidates in order, return immediately on first valid installation
720721 for _ , candidate := range candidates {
721- logVerbose (" Checking installed version: %s (%s) at %s" , candidate .info .Version , candidate .info .Distribution , candidate .info .Path )
722+ util . LogVerbose (" Checking installed version: %s (%s) at %s" , candidate .info .Version , candidate .info .Distribution , candidate .info .Path )
722723
723724 candidateCfg := cfg
724725 candidateCfg .Version = candidate .info .Version
@@ -728,12 +729,12 @@ func (b *BaseTool) StandardIsInstalled(versionSpec string, cfg config.ToolConfig
728729
729730 binPath , err := getPath (candidate .info .Version , candidateCfg )
730731 if err != nil {
731- logVerbose ("Failed to compute binary path for %s %s: %v" , b .toolName , candidate .info .Version , err )
732+ util . LogVerbose ("Failed to compute binary path for %s %s: %v" , b .toolName , candidate .info .Version , err )
732733 continue
733734 }
734735
735736 if ! b .IsInstalled (binPath ) {
736- logVerbose ("Binary for %s %s not found at %s" , b .toolName , candidate .info .Version , binPath )
737+ util . LogVerbose ("Binary for %s %s not found at %s" , b .toolName , candidate .info .Version , binPath )
737738 continue
738739 }
739740
@@ -742,7 +743,7 @@ func (b *BaseTool) StandardIsInstalled(versionSpec string, cfg config.ToolConfig
742743 // This avoids running "java -version", "mvn --version", etc. on every startup
743744
744745 // Found a valid installation - return immediately
745- logVerbose ("Using previously installed %s %s (%s)" , b .toolName , candidate .info .Version , candidate .info .Distribution )
746+ util . LogVerbose ("Using previously installed %s %s (%s)" , b .toolName , candidate .info .Version , candidate .info .Distribution )
746747 return true
747748 }
748749
@@ -751,26 +752,26 @@ func (b *BaseTool) StandardIsInstalled(versionSpec string, cfg config.ToolConfig
751752 }
752753
753754 if targetVersion == "" {
754- logVerbose ("Resolved target version for %s %s is empty" , b .toolName , versionSpec )
755+ util . LogVerbose ("Resolved target version for %s %s is empty" , b .toolName , versionSpec )
755756 return false
756757 }
757758
758759 installCfg := cfg
759760 installCfg .Version = targetVersion
760761
761- logVerbose ("%s version %s not installed, attempting automatic installation" , b .toolName , targetVersion )
762+ util . LogVerbose ("%s version %s not installed, attempting automatic installation" , b .toolName , targetVersion )
762763 if err := tool .Install (targetVersion , installCfg ); err != nil {
763- logVerbose ("Automatic installation of %s %s failed: %v" , b .toolName , targetVersion , err )
764+ util . LogVerbose ("Automatic installation of %s %s failed: %v" , b .toolName , targetVersion , err )
764765 return false
765766 }
766767
767768 if err := tool .Verify (targetVersion , installCfg ); err != nil {
768- logVerbose ("Verification after installing %s %s failed: %v" , b .toolName , targetVersion , err )
769+ util . LogVerbose ("Verification after installing %s %s failed: %v" , b .toolName , targetVersion , err )
769770 return false
770771 }
771772
772773 b .clearPathCache ()
773- logVerbose ("Successfully installed %s %s on demand" , b .toolName , targetVersion )
774+ util . LogVerbose ("Successfully installed %s %s on demand" , b .toolName , targetVersion )
774775 return true
775776}
776777
@@ -817,7 +818,7 @@ func (b *BaseTool) StandardGetPath(version string, cfg config.ToolConfig, getIns
817818 if UseSystemTool (b .toolName ) {
818819 // Try primary binary name in PATH
819820 if _ , err := exec .LookPath (b .GetBinaryName ()); err == nil {
820- logVerbose ("Using system %s from PATH (MVX_USE_SYSTEM_%s=true)" , b .toolName , strings .ToUpper (b .toolName ))
821+ util . LogVerbose ("Using system %s from PATH (MVX_USE_SYSTEM_%s=true)" , b .toolName , strings .ToUpper (b .toolName ))
821822 b .setCachedPath (cacheKey , "" , nil )
822823 return "" , nil
823824 }
0 commit comments