From 3dca89f0015613ab3f287945965e9f92a6079cd8 Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Tue, 6 Oct 2009 14:44:29 +0200 Subject: Reformat all source files and add licenses to tests --- src/main/java/org/apache/maven/plugin/nar/Lib.java | 90 +++++++++++++--------- 1 file changed, 53 insertions(+), 37 deletions(-) (limited to 'src/main/java/org/apache/maven/plugin/nar/Lib.java') diff --git a/src/main/java/org/apache/maven/plugin/nar/Lib.java b/src/main/java/org/apache/maven/plugin/nar/Lib.java index b501174..ab6e925 100644 --- a/src/main/java/org/apache/maven/plugin/nar/Lib.java +++ b/src/main/java/org/apache/maven/plugin/nar/Lib.java @@ -35,14 +35,15 @@ import org.apache.tools.ant.Project; /** * Keeps info on a library - * + * * @author Mark Donszelmann */ -public class Lib { +public class Lib +{ /** * Name of the library, or a dependency groupId:artifactId if this library contains sublibraries - * + * * @parameter expression="" * @required */ @@ -50,7 +51,7 @@ public class Lib { /** * Type of linking for this library - * + * * @parameter expression="" default-value="shared" * @required */ @@ -58,57 +59,72 @@ public class Lib { /** * Location for this library - * + * * @parameter expression="" * @required */ private File directory; - + /** * Sub libraries for this library - * + * * @parameter expression="" */ - private List/**/ libs; + private List/* */libs; - public void addLibSet(AbstractDependencyMojo mojo, LinkerDef linker, Project antProject) throws MojoFailureException, MojoExecutionException { - addLibSet(mojo, linker, antProject, name, directory); + public void addLibSet( AbstractDependencyMojo mojo, LinkerDef linker, Project antProject ) + throws MojoFailureException, MojoExecutionException + { + addLibSet( mojo, linker, antProject, name, directory ); } - private void addLibSet(AbstractDependencyMojo mojo, LinkerDef linker, Project antProject, String name, File dir) throws MojoFailureException, MojoExecutionException { - if (name == null) { - throw new MojoFailureException("NAR: Please specify as part of "); + private void addLibSet( AbstractDependencyMojo mojo, LinkerDef linker, Project antProject, String name, File dir ) + throws MojoFailureException, MojoExecutionException + { + if ( name == null ) + { + throw new MojoFailureException( "NAR: Please specify as part of " ); } - if (libs == null) { - if (!type.equals("framework") && (dir == null)) { - throw new MojoFailureException("NAR: Please specify as part of "); + if ( libs == null ) + { + if ( !type.equals( "framework" ) && ( dir == null ) ) + { + throw new MojoFailureException( "NAR: Please specify as part of " ); } LibrarySet libSet = new LibrarySet(); - libSet.setProject(antProject); - libSet.setLibs(new CUtil.StringArrayBuilder(name)); + libSet.setProject( antProject ); + libSet.setLibs( new CUtil.StringArrayBuilder( name ) ); LibraryTypeEnum libType = new LibraryTypeEnum(); - libType.setValue(type); - libSet.setType(libType); - libSet.setDir(dir); - linker.addLibset(libSet); - } else { - List dependencies = mojo.getNarManager().getNarDependencies("compile"); - for (Iterator i=libs.iterator(); i.hasNext(); ) { - Lib lib = (Lib)i.next(); - String[] ids = name.split(":",2); - if (ids.length != 2) { - throw new MojoFailureException("NAR: Please specify as part of in format 'groupId:artifactId'"); + libType.setValue( type ); + libSet.setType( libType ); + libSet.setDir( dir ); + linker.addLibset( libSet ); + } + else + { + List dependencies = mojo.getNarManager().getNarDependencies( "compile" ); + for ( Iterator i = libs.iterator(); i.hasNext(); ) + { + Lib lib = (Lib) i.next(); + String[] ids = name.split( ":", 2 ); + if ( ids.length != 2 ) + { + throw new MojoFailureException( + "NAR: Please specify as part of in format 'groupId:artifactId'" ); } - for (Iterator j=dependencies.iterator(); j.hasNext(); ) { - Artifact dependency = (Artifact)j.next(); - if (dependency.getGroupId().equals(ids[0]) && dependency.getArtifactId().equals(ids[1])) { - File narDir = new File(mojo.getNarManager().getNarFile(dependency).getParentFile(), "nar/lib/"+mojo.getAOL()+"/"+lib.type); - String narName = dependency.getArtifactId()+"-"+lib.name+"-"+dependency.getVersion(); - lib.addLibSet(mojo, linker, antProject, narName, narDir); + for ( Iterator j = dependencies.iterator(); j.hasNext(); ) + { + Artifact dependency = (Artifact) j.next(); + if ( dependency.getGroupId().equals( ids[0] ) && dependency.getArtifactId().equals( ids[1] ) ) + { + File narDir = + new File( mojo.getNarManager().getNarFile( dependency ).getParentFile(), "nar/lib/" + + mojo.getAOL() + "/" + lib.type ); + String narName = dependency.getArtifactId() + "-" + lib.name + "-" + dependency.getVersion(); + lib.addLibSet( mojo, linker, antProject, narName, narDir ); } } } } - } + } } - -- cgit v1.2.3