public List<String> getCommands() throws MojoExecutionException { List<String> commands = new ArrayList<String>(); String targetPath = "target" + File.separator + project.getArtifactId() + "." + ArtifactType.getArtifactTypeForPackagingName( project.getPackaging() ).getExtension(); String outputPath = "target" + File.separator + "Output.xml"; String relativePathToTargetFile = ( rootDir != null ) ? new File( project.getBasedir(), targetPath ).getAbsolutePath().substring( rootDir.getAbsolutePath().length() + 1 ) : targetPath; String relativePathToOutputFile = ( rootDir != null ) ? new File( project.getBasedir(), outputPath ).getAbsolutePath().substring( rootDir.getAbsolutePath().length() + 1 ) : outputPath; commands.add( "/f:" + relativePathToTargetFile ); commands.add( "/o:" + relativePathToOutputFile ); return commands; } }
/** * Returns artifact type for the specified packaging name * * @param packagingName the package name (as given in the package tag within the pom.xml) of the artifact. * @return the artifact type for the specified packaging name */ public static synchronized ArtifactType getArtifactTypeForPackagingName( String packagingName ) { for( ArtifactType t : ArtifactType.values() ) { if(packagingName.equals(t.getPackagingType())) return t; } return ArtifactType.NULL; } }
public static boolean isDotnetMavenPlugin(String packaging) { return isDotnetMavenPlugin( ArtifactType.getArtifactTypeForPackagingName( packaging ) ); }
logger.debug( "NPANDAY-061-006: Artifact Type:" + type); logger.debug( "NPANDAY-061-007: Artifact Type:" + ArtifactTypeHelper.isDotnetGenericGac( type )); ArtifactType artifactType = ArtifactType.getArtifactTypeForPackagingName( type ); if ( ArtifactTypeHelper.isDotnetModule( type )) StringUtils.equals( artifactType.getTargetCompileType(), "library" ) || artifactType.getExtension().equals( "dll" ) || artifactType.getExtension().equals( "exe" )) else if (type.equals(ArtifactType.GAC_MSIL4.getPackagingType())) { String gacRoot = System.getenv( "SystemRoot" ) + "\\Microsoft.NET\\assembly\\GAC_MSIL\\"; setArtifactGacFile( gacRoot, artifact ); libraries.add( artifact ); else if ( type.equals( ArtifactType.GAC.getPackagingType() ) ) else if ( type.equals( ArtifactType.GAC_32.getPackagingType() ) ) else if ( type.equals( ArtifactType.GAC_32_4.getPackagingType() ) ) else if ( type.equals( ArtifactType.GAC_64.getPackagingType() ) ) else if ( type.equals( ArtifactType.GAC_64_4.getPackagingType() ) ) else if ( type.equals( ArtifactType.GAC_MSIL.getPackagingType() ) ) else if ( type.equals( ArtifactType.COM_REFERENCE.getPackagingType() ) ) "library".equals(artifactType.getTargetCompileType() )
rootDependency.setVersion( model.getVersion() ); rootDependency.setType( ArtifactType.getArtifactTypeForPackagingName( model.getPackaging() ).getPackagingType() ); rootDependency.setScope( Artifact.SCOPE_COMPILE ); dependencies.add( rootDependency );
public static File getGACFile4Artifact(Artifact artifact) { File gacFile; String type = artifact.getType(); if (type.equals(ArtifactType.GAC_MSIL4.getPackagingType())) { String gacRoot = System.getenv( "SystemRoot" ) + "\\Microsoft.NET\\assembly\\GAC_MSIL\\"; gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + "v4.0" + "_" + artifact.getVersion() + "__" + artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" ); } else if (type.equals(ArtifactType.GAC_32_4.getPackagingType())) { String gacRoot = System.getenv( "SystemRoot" ) + "\\Microsoft.NET\\assembly\\GAC_32\\"; gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + "v4.0" + "_" + artifact.getVersion() + "__" + artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" ); } else if (type.equals(ArtifactType.GAC_64_4.getPackagingType())) { String gacRoot = System.getenv( "SystemRoot" ) + "\\Microsoft.NET\\assembly\\GAC_64\\"; gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + "v4.0" + "_" + artifact.getVersion() + "__" + artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" ); } else { gacFile = artifact.getFile(); } return gacFile; }
/** * This method will return a File where File.isExist() returns false, if NetCompile.compile has not been * invoked. * * @return * @throws InvalidArtifactException */ public File getArtifact() throws InvalidArtifactException { ArtifactType artifactType = config.getArtifactType(); if ( artifactType == null || artifactType.equals( ArtifactType.NULL ) ) { throw new InvalidArtifactException( "NPANDAY-061-001: Artifact Type cannot be null" ); } //TODO: The test-plugin has a dependency on this fileName/dir. If we change it here, it will break the plugin. Fix this encapsulation issue. String fileName = ( config.isTestCompile() ) ? project.getBuild().getDirectory() + File.separator + project.getArtifactId() + "-test.dll" : project.getBuild().getDirectory() + File.separator + project.getArtifactId() + "." + artifactType.getExtension(); return new File( fileName ); }
public List<String> getCommands() throws ExecutionException { if ( compilerContext == null ) { throw new ExecutionException( "NPANDAY-068-000: Compiler has not been initialized with a context" ); } List<String> commands = new ArrayList<String>(); CompilerConfig config = compilerContext.getNetCompilerConfig(); String sourceDirectory = compilerContext.getSourceDirectoryName(); File srcDir = new File( sourceDirectory ); commands.add( "--" + config.getArtifactType().getExtension() ); for ( String command : config.getCommands() ) { if ( command.startsWith( "main:" ) ) { String className = command.split( "[:]" )[1]; File classFile = new File("target/build-sources/" + className); commands.add( "'" + classFile.getAbsolutePath() + "'"); } else { commands.add( command ); } } return commands; }
public List<String> getCommands() throws ExecutionException { CompilerConfig config = compilerContext.getNetCompilerConfig(); List<Artifact> resources = compilerContext.getLibraryDependencies(); String sourceDirectory = compilerContext.getSourceDirectoryName(); String artifactFilePath = compilerContext.getArtifact().getAbsolutePath(); String targetArtifactType = config.getArtifactType().getTargetCompileType(); List<String> commands = new ArrayList<String>(); commands.add( "/out:" + artifactFilePath ); commands.add( "/target:" + targetArtifactType ); if ( !resources.isEmpty() ) { for ( Artifact artifact : resources ) { String path = artifact.getFile().getAbsolutePath(); commands.add( "/reference:" + path ); } } String[] files = FileUtils.getFilesFromExtension( sourceDirectory, new String[]{"php"} ); for ( String file : files ) { commands.add( file ); } return commands; }
public static boolean isDotnetExecutable(String packaging) { return isDotnetExecutable( ArtifactType.getArtifactTypeForPackagingName( packaging ) ); }
public boolean match( NetDependency netDependency ) { return ArtifactTypeHelper.isDotnetExecutable(netDependency.getType()) || ArtifactTypeHelper.isDotnetMavenPlugin(netDependency.getType()) || netDependency.getType().equals( ArtifactType.VISUAL_STUDIO_ADDIN.getPackagingType() ) || netDependency.getType().equals( ArtifactType.SHARP_DEVELOP_ADDIN.getPackagingType() ); } }
String targetArtifactType = config.getArtifactType().getTargetCompileType();
String ext = ArtifactType.getArtifactTypeForPackagingName( artifact.getType() ).getExtension();
public static boolean isDotnet4Gac(String packaging) { return isDotnet4Gac( ArtifactType.getArtifactTypeForPackagingName( packaging ) ); }
private CompilerConfig createCompilerConfig(String source, String destination) throws MojoExecutionException { CompilerConfig compilerConfig = (CompilerConfig) CompilerConfig.Factory.createDefaultExecutableConfig(); compilerConfig.setLocalRepository( localRepository ); compilerConfig.setCommands( getCommands( source, destination ) ); String artifactTypeName = project.getArtifact().getType(); ArtifactType artifactType = ArtifactType.getArtifactTypeForPackagingName( artifactTypeName ); if ( artifactType.equals( ArtifactType.NULL ) ) { throw new MojoExecutionException( "NPANDAY-900-002: Unrecognized artifact type: Language = " + language + ", Vendor = " + vendor + ", ArtifactType = " + artifactTypeName ); } compilerConfig.setArtifactType( artifactType ); return compilerConfig; }
else if ( artifactType.equals( ArtifactType.GAC.getPackagingType() ) ) else if ( artifactType.equals( ArtifactType.GAC_32.getPackagingType() ) ) else if ( artifactType.equals( ArtifactType.GAC_32_4.getPackagingType() ) ) else if ( artifactType.equals( ArtifactType.GAC_64.getPackagingType() ) ) else if ( artifactType.equals( ArtifactType.GAC_64_4.getPackagingType() ) ) else if ( artifactType.equals( ArtifactType.GAC_MSIL.getPackagingType() ) ) else if ( artifactType.equals( ArtifactType.GAC_MSIL4.getPackagingType() ) )