Author: sisbell Date: Fri Mar 2 13:02:26 2007 New Revision: 513948 URL: http://svn.apache.org/viewvc?view=rev&rev=513948 Log: Fixed bug: if the plugin passed an empty vendor version or vendor framework version, the state machine processor would treat it as valid and not try to resolved the empty value. Also added a post process state for filling in executable paths. These bugs caused NMaven to only use the system path for executables.
Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/NetExecutableFactoryImpl.java incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/VendorInfoState.java incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/StateMachineProcessorImpl.java incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/VendorInfoTransitionRuleFactory.java Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/NetExecutableFactoryImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/NetExecutableFactoryImpl.java?view=diff&rev=513948&r1=513947&r2=513948 ============================================================================== --- incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/NetExecutableFactoryImpl.java (original) +++ incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/NetExecutableFactoryImpl.java Fri Mar 2 13:02:26 2007 @@ -72,7 +72,7 @@ } /** - * @see + * @see */ public CompilerExecutable getCompilerExecutableFor( CompilerRequirement compilerRequirement, CompilerConfig compilerConfig, MavenProject project, @@ -98,7 +98,7 @@ throw new PlatformUnsupportedException( "NMAVEN-066-012: Vendor could not be found: " + vendorInfo ); } - logger.info( "NMAVEN-066-012: Found Vendor = " + vendorInfo ); + logger.info( "NMAVEN-066-013: Found Vendor = " + vendorInfo ); compilerRequirement.setVendor( vendorInfo.getVendor() ); compilerRequirement.setVendorVersion( vendorInfo.getVendorVersion() ); compilerRequirement.setFrameworkVersion( vendorInfo.getFrameworkVersion() ); @@ -133,7 +133,10 @@ throws PlatformUnsupportedException { - if(commands == null) commands = new ArrayList<String>(); + if ( commands == null ) + { + commands = new ArrayList<String>(); + } try { @@ -229,9 +232,22 @@ ExecutableConfig executableConfig = ExecutableConfig.Factory.createDefaultExecutableConfig(); executableConfig.setCommands( commands ); + if ( netHome != null ) { + logger.info( "NMAVEN-066-014: Found executable path: Path = " + netHome.getAbsolutePath() ); executableConfig.setExecutionPath( netHome.getAbsolutePath() ); + } + else if ( vendorInfo.getExecutablePath() != null && vendorInfo.getExecutablePath().exists() ) + { + logger.info( + "NMAVEN-066-015: Found executable path: Path = " + vendorInfo.getExecutablePath().getAbsolutePath() ); + executableConfig.setExecutionPath( vendorInfo.getExecutablePath().getAbsolutePath() ); + } + else + { + logger.info( "NMAVEN-066-016: Did not find executable path, will try system path: Executable Path = " + + vendorInfo.getExecutablePath() ); } executableContext.init( executableRequirement, executableConfig, project, capabilityMatcher ); Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/VendorInfoState.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/VendorInfoState.java?view=diff&rev=513948&r1=513947&r2=513948 ============================================================================== --- incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/VendorInfoState.java (original) +++ incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/VendorInfoState.java Fri Mar 2 13:02:26 2007 @@ -118,7 +118,12 @@ /** * Null state of VendorInfo object */ - NULL; + NULL, + + /** + * Post processing state + */ + POST_PROCESS; /** * Returns the completion state of the specified vendor info @@ -131,6 +136,16 @@ if ( vendorInfo == null ) { return NULL; + } + + if ( vendorInfo.getVendorVersion() != null && vendorInfo.getVendorVersion().trim().equals( "" ) ) + { + vendorInfo.setVendorVersion( null ); + } + + if ( vendorInfo.getFrameworkVersion() != null && vendorInfo.getFrameworkVersion().trim().equals( "" ) ) + { + vendorInfo.setFrameworkVersion( null ); } if ( vendorInfo.getVendor() == null ) Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/StateMachineProcessorImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/StateMachineProcessorImpl.java?view=diff&rev=513948&r1=513947&r2=513948 ============================================================================== --- incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/StateMachineProcessorImpl.java (original) +++ incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/StateMachineProcessorImpl.java Fri Mar 2 13:02:26 2007 @@ -80,7 +80,7 @@ transitionRules.put( VendorInfoState.MTF, factory.createVendorInfoSetterForMTF() ); transitionRules.put( VendorInfoState.MFT, factory.createVendorInfoSetterForMFT() ); transitionRules.put( VendorInfoState.NTT, factory.createVendorInfoSetterForNTT() ); - + transitionRules.put( VendorInfoState.POST_PROCESS, factory.createPostProcessRule() ); try { factory.init( repositoryRegistry, vendorInfoRepository, logger ); Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/VendorInfoTransitionRuleFactory.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/VendorInfoTransitionRuleFactory.java?view=diff&rev=513948&r1=513947&r2=513948 ============================================================================== --- incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/VendorInfoTransitionRuleFactory.java (original) +++ incubator/nmaven/branches/SI_IDE/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/VendorInfoTransitionRuleFactory.java Fri Mar 2 13:02:26 2007 @@ -118,6 +118,29 @@ vendorInfos = settingsRepository.getVendorInfos(); } + VendorInfoTransitionRule createPostProcessRule() + { + return new VendorInfoTransitionRule() + { + public VendorInfoState process( VendorInfo vendorInfo ) + { + logger.debug( "NMAVEN-103-034: Entering State = Post Process" ); + if ( vendorInfo.getExecutablePath() == null ) + { + try + { + vendorInfo.setExecutablePath( vendorInfoRepository.getInstallRootFor( vendorInfo ) ); + } + catch ( PlatformUnsupportedException e ) + { + logger.debug( "NMAVEN-103-35: Failed to resolve install root." ); + } + } + return VendorInfoState.EXIT; + } + }; + } + /** * Returns the vendor info transition rule for state: Vendor is Novell, vendor version exists, framework version exists. * @@ -130,7 +153,7 @@ public VendorInfoState process( VendorInfo vendorInfo ) { logger.debug( "NMAVEN-103-003: Entering State = NTT" ); - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } }; } @@ -146,7 +169,7 @@ { vendorInfo.setVendorVersion( defaultVendorVersion ); vendorInfo.setFrameworkVersion( defaultFrameworkVersion ); - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } else { @@ -159,7 +182,7 @@ { vendorInfo.setVendorVersion( vi.getVendorVersion() ); vendorInfo.setFrameworkVersion( "2.0.50727" ); - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } } } @@ -173,7 +196,7 @@ vendorInfo.setVendorVersion( vi.getVendorVersion() ); vendorInfo.setFrameworkVersion( "2.0.50727" ); //TODO: this should be according to max version - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } } } @@ -203,7 +226,7 @@ public VendorInfoState process( VendorInfo vendorInfo ) { logger.debug( "NMAVEN-103-006: Entering State = NFT" ); - return VendorInfoState.EXIT; //NO WAY TO KNOW + return VendorInfoState.POST_PROCESS; //NO WAY TO KNOW } }; } @@ -511,7 +534,7 @@ } catch ( PlatformUnsupportedException e ) { - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } return ( vendorInfo.getVendor().equals( Vendor.MICROSOFT ) ) ? VendorInfoState.MFT : VendorInfoState.NFT; @@ -534,7 +557,7 @@ } catch ( PlatformUnsupportedException e ) { - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } if ( ( vendorVersion.equals( "2.0.50727" ) || vendorVersion.equals( "1.1.4322" ) ) && defaultVendor.equals( Vendor.MICROSOFT ) ) @@ -594,7 +617,7 @@ } catch ( PlatformUnsupportedException e ) { - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } return ( vendorInfo.getVendor().equals( Vendor.MICROSOFT ) ) ? VendorInfoState.MFF : VendorInfoState.NFF; @@ -612,7 +635,7 @@ vendorInfo.setVendor( defaultVendor ); vendorInfo.setVendorVersion( defaultVendorVersion ); vendorInfo.setFrameworkVersion( defaultFrameworkVersion ); - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } }; } @@ -625,7 +648,7 @@ public VendorInfoState process( VendorInfo vendorInfo ) { logger.debug( "NMAVEN-103-018: Entering State = MTT" ); - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } }; } @@ -738,7 +761,7 @@ logger.debug( "NMAVEN-103-023: Entering State = GFF" ); vendorInfo.setFrameworkVersion( "2.0.50727" ); vendorInfo.setVendorVersion( "2.0.50727" ); - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } }; } @@ -754,7 +777,7 @@ { vendorInfo.setVendorVersion( defaultVendorVersion ); vendorInfo.setFrameworkVersion( "2.0.50727" ); - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } else { @@ -773,11 +796,11 @@ String maxVersion = vendorInfoRepository.getMaxVersion( versions ); vendorInfo.setVendorVersion( maxVersion ); vendorInfo.setFrameworkVersion( "2.0.50727" ); - return VendorInfoState.EXIT; + return VendorInfoState.POST_PROCESS; } catch ( InvalidVersionFormatException e ) { - logger.info( "NMAVEN-103-030: Invalid version. Unable to determine best vendor version", e ); + logger.info( "NMAVEN-103-031: Invalid version. Unable to determine best vendor version", e ); return createVendorInfoSetterForGFF_NoSettings().process( vendorInfo ); } }