public Artifact getArtifactFor(String groupId, String artifactId) throws PlatformUnsupportedException { List<Artifact> artifacts = artifactContext.getArtifactsFor( groupId, artifactId, null, null ); if ( artifacts.size() == 0 ) { throw new PlatformUnsupportedException( "NPANDAY-066-023: Could not locate the plugin - missing entry in the net-dependencies.xml file: GroupId = " + groupId + ", ArtifactId = " + artifactId ); } Artifact artifact = artifacts.get( 0 ); if ( artifact == null ) { throw new PlatformUnsupportedException( "NPANDAY-066-021: Could not locate the plugin: GroupId = " + groupId + ", ArtifactId = " + artifactId ); } return artifact; }
/** * Determines the vendor based on the path of the executable * * @param path * @return vendor * @throws PlatformUnsupportedException */ private Vendor getVendorFromPath( String path ) throws PlatformUnsupportedException { if ( !new File( path ).exists() ) { throw new PlatformUnsupportedException( "NPANDAY-042-002: Unable to locate path: Path = " + path ); } if ( path.contains( "Microsoft.NET" ) ) { return Vendor.MICROSOFT; } else if ( path.contains( "Mono" ) ) { return Vendor.MONO; } else if ( path.contains( "Portable.NET" ) ) { return Vendor.DOTGNU; } throw new PlatformUnsupportedException( "NPANDAY-042-003: Platform not supported: Path " + path ); }
public VendorInfo getConfiguredVendorInfoByExample(VendorInfo vendorInfoExample) throws PlatformUnsupportedException { List<VendorInfo> infos = getVendorInfosFor(vendorInfoExample, false); if (infos.size() == 0) { throw new PlatformUnsupportedException( "NPANDAY-200-001: Could not find configuration for " + vendorInfoExample ); } if (infos.size() > 2) { // reload default infos = getVendorInfosFor(vendorInfoExample, true); } assert infos.size() == 1; return infos.get(0); }
private ExecutableCapability matchFromExecutableCapabilities( List<ExecutableCapability> executableCapabilities, List<ExecutableMatchPolicy> matchPolicies ) throws PlatformUnsupportedException { for ( ExecutableCapability executableCapability : executableCapabilities ) { logger.debug( "NPANDAY-065-005: Attempting to match capability: " + executableCapability ); if ( matchExecutableCapability( executableCapability, matchPolicies ) ) { logger.debug( "NPANDAY-065-001: Made a Platform Capability Match: " + executableCapability ); return executableCapability; } } throw new PlatformUnsupportedException( "NPANDAY-065-002: Could not match platform: OS = " + System.getProperty( "os.name" ) + ", Number of Capabilities = " + executableCapabilities.size() + ", Number of Policies = " + matchPolicies.size() ); }
throw new PlatformUnsupportedException( "NPANDAY-061-008: Could not locate Global Assembly Cache for Mono. Try setting the MONO_ROOT environmental variable." );
throw new PlatformUnsupportedException( "", e ); throw new PlatformUnsupportedException( "NPANDAY-042-001: Platform not supported: Results = " + results );
/** * @see AssemblerContext#getClassExtensionFor(String) */ public String getClassExtensionFor( String language ) throws PlatformUnsupportedException { try { return repository.getAssemblyPluginFor( language ).getExtension(); } catch ( AssemblyInfoException e ) { throw new PlatformUnsupportedException( "NPANDAY-020-006: Language not supported: Language = " + language, e ); } }
throw new PlatformUnsupportedException( "NPANDAY-064-001: Unable to create NetCompiler: Class Name = " + className, e ); throw new PlatformUnsupportedException( "NPANDAY-064-002: Unable to create NetCompiler: Class Name = " + className, e ); throw new PlatformUnsupportedException( "NPANDAY-064-003: Unable to create NetCompiler: Class Name = " + className, e );
private void moveInteropDllToBuildDirectory(Artifact artifact) throws PlatformUnsupportedException { try { File file = artifact.getFile(); String oldPath = file.getAbsolutePath(); String target = project.getBuild().getDirectory(); String newPath = target + File.separator + "Interop." + artifact.getArtifactId() + ".dll"; if ( oldPath.contains( target ) ) //already copied to target return ; logger.info( "NPANDAY-000-000:[COM Reference] copying file ["+ oldPath+"] to [" + target +"]" ); FileUtils.copyFileToDirectory( file, new File( target ) ); logger.info( "NPANDAY-000-000:[COM Reference] deleting directory ["+ file.getParentFile() +"]" ); FileUtils.deleteDirectory( file.getParentFile() ); logger.info( "NPANDAY-000-000:[COM Reference] updating artifact path to ["+ newPath +"]" ); artifact.setFile( new File( newPath ) ); }catch(Exception e) { throw new PlatformUnsupportedException (e); } }
throw new PlatformUnsupportedException( "NPANDAY-000-000: Could not find GAC dependency: File = " + gacFile.getAbsolutePath() );
throw new PlatformUnsupportedException( "NPANDAY-104-001: One of more of the parameters is null: Vendor = " + vendor + ", Vendor Version = " + vendorVersion + ", Framework Version = " + frameworkVersion ); throw new PlatformUnsupportedException( "NPANDAY-104-002: Unable to find install root: Vendor = " + vendor + ", Vendor Version = " + vendorVersion + ", Framework Version = " + frameworkVersion );
List<File> getExecutablePathsFor( String vendor, String vendorVersion, String frameworkVersion ) throws PlatformUnsupportedException { List<File> executablePaths = new ArrayList<File>(); if ( vendor == null || vendorVersion == null || frameworkVersion == null ) { throw new PlatformUnsupportedException( "NPANDAY-104-006: One of more of the parameters is null: Vendor = " + vendor + ", Vendor Version = " + vendorVersion + ", Framework Version = " + frameworkVersion ); } for ( Vendor v : vendors ) { if ( vendor.equals( v.getVendorName().trim() ) && vendorVersion.equals( v.getVendorVersion().trim() ) ) { List<Framework> frameworks = v.getFrameworks(); for ( Framework framework : frameworks ) { if ( frameworkVersion.equals( framework.getFrameworkVersion().trim() ) ) { List paths = framework.getExecutablePaths(); for(Object path : paths) { executablePaths.add(new File((String)path)); } } } } } return executablePaths; }
File getSdkInstallRootFor( String vendor, String vendorVersion, String frameworkVersion ) throws PlatformUnsupportedException { if ( vendor == null || vendorVersion == null || frameworkVersion == null ) { throw new PlatformUnsupportedException( "NPANDAY-104-004: One of more of the parameters is null: Vendor = " + vendor + ", Vendor Version = " + vendorVersion + ", Framework Version = " + frameworkVersion ); } for ( Vendor v : vendors ) { if ( vendor.equals( v.getVendorName().trim() ) && vendorVersion.equals( v.getVendorVersion().trim() ) ) { List<Framework> frameworks = v.getFrameworks(); for ( Framework framework : frameworks ) { if ( frameworkVersion.equals( framework.getFrameworkVersion().trim() ) ) { String sdkRoot = framework.getSdkInstallRoot(); if(sdkRoot != null) return new File(sdkRoot ); } } } } return null; }
/** * Returns all platform capabilities (as defined in the compiler-plugins.xml file). This is more than the platform * capabilities for the invoking platform. * * @return all platform capabilities (as defined in the compiler-plugins.xml file). */ private List<ExecutableCapability> getExecutableCapabilities() throws PlatformUnsupportedException { ExecutablePluginsRepository pluginsRepository = (ExecutablePluginsRepository) repositoryRegistry.find( "executable-plugins" ); ExecutablePluginsRepository pluginsRepositoryExt = (ExecutablePluginsRepository) repositoryRegistry.find( "executable-plugins-ext" ); List<ExecutableCapability> primary = new ArrayList<ExecutableCapability>(); if ( pluginsRepository != null ) { primary = pluginsRepository.getCapabilities(); } if ( pluginsRepositoryExt != null ) { primary.addAll( pluginsRepositoryExt.getCapabilities() ); } if ( primary.isEmpty() ) { throw new PlatformUnsupportedException( "NPANDAY-065-004: No executable capabilities configured" ); } return primary; }
/** * Returns all platform capabilities (as defined in the compiler-plugins.xml file). This is more than the platform * capabilities for the invoking platform. * * @return all platform capabilities (as defined in the compiler-plugins.xml file). */ private List<ExecutableCapability> getCompilerCapabilities() throws PlatformUnsupportedException { CompilerPluginsRepository pluginsRepository = (CompilerPluginsRepository) repositoryRegistry.find( "compiler-plugins" ); CompilerPluginsRepository pluginsRepositoryExt = (CompilerPluginsRepository) repositoryRegistry.find( "compiler-plugins-ext" ); List<ExecutableCapability> primary = new ArrayList<ExecutableCapability>(); if ( pluginsRepository != null ) { primary = pluginsRepository.getCompilerCapabilities(); } if ( pluginsRepositoryExt != null ) { primary.addAll( pluginsRepositoryExt.getCompilerCapabilities() ); } if ( primary.isEmpty() ) { throw new PlatformUnsupportedException( "NPANDAY-065-003: No compiler capabilities configured" ); } return primary; }
throw new PlatformUnsupportedException( "NPANDAY-xxx-000: Invalid version format", e ); if ( !gacRoot.exists() ) throw new PlatformUnsupportedException( "NPANDAY-xxx-000: The Mono GAC path does not exist: Path = " + gacRoot.getAbsolutePath() ); throw new PlatformUnsupportedException("NPANDAY-200-002: Could not locate a valid GAC");
public CompilerCapability matchCompilerCapabilityFor( CompilerRequirement compilerRequirement, List<ExecutableMatchPolicy> matchPolicies ) throws PlatformUnsupportedException { if ( compilerRequirement == null ) { throw new PlatformUnsupportedException( "NPANDAY-065-006: The compiler requirement should not be null." ); } if ( matchPolicies == null ) { matchPolicies = new ArrayList<ExecutableMatchPolicy>(); } matchPolicies.add( MatchPolicyFactory.createOperatingSystemPolicy( System.getProperty( "os.name" ) ) ); matchPolicies.add( MatchPolicyFactory.createVendorPolicy( compilerRequirement.getVendor() ) ); matchPolicies.add( MatchPolicyFactory.createLanguagePolicy( compilerRequirement.getLanguage() ) ); matchPolicies.add( MatchPolicyFactory.createFrameworkVersionPolicy( compilerRequirement.getFrameworkVersion() ) ); matchPolicies.add( MatchPolicyFactory.createProfilePolicy( compilerRequirement.getProfile() ) ); return (CompilerCapability) matchFromExecutableCapabilities( getCompilerCapabilities(), matchPolicies ); }
if ( artifacts.size() == 0 ) throw new PlatformUnsupportedException( "NPANDAY-066-024: Could not locate the executable - missing entry in the net-dependencies.xml file: GroupId = " + groupId + ", ArtifactId = " + artifactId ); if ( artifact == null ) throw new PlatformUnsupportedException( "NPANDAY-066-025: Could not locate the executable: GroupId = " + groupId + ", ArtifactId = " + artifactId ); throw new PlatformUnsupportedException( "NPANDAY-066-010: Illegal State: Vendor Info = " + vendorInfo, e ); throw new PlatformUnsupportedException( "NPANDAY-066-020: Missing Vendor Information: " + vendorInfo ); throw new PlatformUnsupportedException( "NPANDAY-066-022: Could not locate the executable- missing entry in the net-dependencies.xml: GroupId = " + groupId + ", ArtifactId = " + artifactId ); throw new PlatformUnsupportedException( "NPANDAY-066-006: Unable to initialize the repository executable context", e ); throw new PlatformUnsupportedException( "NPANDAY-066-004: Unable to find net executable", e );
throw new PlatformUnsupportedException( "NPANDAY-061-004: Unable to create NetCompiler: Class Name = " + className, e ); throw new PlatformUnsupportedException( "NPANDAY-061-005: Unable to create NetCompiler: Class Name = " + className, e ); throw new PlatformUnsupportedException( "NPANDAY-061-006: Unable to create NetCompiler: Class Name = " + className, e ); if ( icons.length > 1 ) throw new PlatformUnsupportedException( "NPANDAY-061-007: There is more than one win32icon in resource directory: Number = " + icons .length );
throw new PlatformUnsupportedException( "NPANDAY-066-010: Illegal State: Vendor Info = " + vendorInfo, e ); vendorInfo.getVendorVersion() == null ) throw new PlatformUnsupportedException( "NPANDAY-066-018: Missing Vendor Information: " + vendorInfo ); throw new PlatformUnsupportedException( "NPANDAY-066-001: Unable to find net executable", e );