summaryrefslogtreecommitdiff
path: root/src/main/java/org/apache/maven/plugin/nar/Java.java
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-10-06 14:44:29 +0200
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-10-06 14:44:29 +0200
commit3dca89f0015613ab3f287945965e9f92a6079cd8 (patch)
treea00619a63c55b74c16ac8116d04b21f322e1747b /src/main/java/org/apache/maven/plugin/nar/Java.java
parent75b9fcffc6709f9c65990f6d04d593d3bfb4743d (diff)
downloadmaven-nar-plugin-3dca89f0015613ab3f287945965e9f92a6079cd8.tar.gz
maven-nar-plugin-3dca89f0015613ab3f287945965e9f92a6079cd8.tar.bz2
maven-nar-plugin-3dca89f0015613ab3f287945965e9f92a6079cd8.tar.xz
maven-nar-plugin-3dca89f0015613ab3f287945965e9f92a6079cd8.zip
Reformat all source files and add licenses to tests
Diffstat (limited to 'src/main/java/org/apache/maven/plugin/nar/Java.java')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Java.java136
1 files changed, 78 insertions, 58 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/Java.java b/src/main/java/org/apache/maven/plugin/nar/Java.java
index 513dc8a..98e48f2 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Java.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Java.java
@@ -33,111 +33,131 @@ import org.apache.maven.plugin.MojoFailureException;
/**
* Java specifications for NAR
- *
+ *
* @author Mark Donszelmann
*/
-public class Java {
+public class Java
+{
/**
* Add Java includes to includepath
- *
+ *
* @parameter expression="" default-value="false"
* @required
*/
private boolean include = false;
/**
- * Java Include Paths, relative to a derived ${java.home}.
- * Defaults to: "${java.home}/include" and "${java.home}/include/<i>os-specific</i>".
- *
+ * Java Include Paths, relative to a derived ${java.home}. Defaults to: "${java.home}/include" and
+ * "${java.home}/include/<i>os-specific</i>".
+ *
* @parameter expression=""
*/
private List includePaths;
/**
* Add Java Runtime to linker
- *
+ *
* @parameter expression="" default-value="false"
* @required
*/
private boolean link = false;
/**
- * Relative path from derived ${java.home} to the java runtime to link with
- * Defaults to Architecture-OS-Linker specific value.
- * FIXME table missing
- *
+ * Relative path from derived ${java.home} to the java runtime to link with Defaults to Architecture-OS-Linker
+ * specific value. FIXME table missing
+ *
* @parameter expression=""
*/
private String runtimeDirectory;
-
+
/**
* Name of the runtime
- *
+ *
* @parameter expression="" default-value="jvm"
*/
private String runtime = "jvm";
-
+
private AbstractCompileMojo mojo;
-
- public Java() {
+
+ public Java()
+ {
}
-
- public void setAbstractCompileMojo(AbstractCompileMojo mojo) {
- this.mojo = mojo;
- }
-
- public void addIncludePaths(CCTask task, String outType) throws MojoFailureException {
- if (include || mojo.getJavah().getJniDirectory().exists()) {
- if (includePaths != null) {
- for (Iterator i=includePaths.iterator(); i.hasNext(); ) {
- String path = (String)i.next();
- task.createIncludePath().setPath(new File(mojo.getJavaHome(mojo.getAOL()), path).getPath());
+
+ public void setAbstractCompileMojo( AbstractCompileMojo mojo )
+ {
+ this.mojo = mojo;
+ }
+
+ public void addIncludePaths( CCTask task, String outType )
+ throws MojoFailureException
+ {
+ if ( include || mojo.getJavah().getJniDirectory().exists() )
+ {
+ if ( includePaths != null )
+ {
+ for ( Iterator i = includePaths.iterator(); i.hasNext(); )
+ {
+ String path = (String) i.next();
+ task.createIncludePath().setPath( new File( mojo.getJavaHome( mojo.getAOL() ), path ).getPath() );
}
- } else {
- String prefix = mojo.getAOL().getKey()+".java.";
- String includes = NarUtil.getDefaults().getProperty(prefix+"include");
- if (includes != null) {
- String[] path = includes.split(";");
- for (int i=0; i<path.length; i++) {
- task.createIncludePath().setPath(new File(mojo.getJavaHome(mojo.getAOL()), path[i]).getPath());
+ }
+ else
+ {
+ String prefix = mojo.getAOL().getKey() + ".java.";
+ String includes = NarUtil.getDefaults().getProperty( prefix + "include" );
+ if ( includes != null )
+ {
+ String[] path = includes.split( ";" );
+ for ( int i = 0; i < path.length; i++ )
+ {
+ task.createIncludePath().setPath(
+ new File( mojo.getJavaHome( mojo.getAOL() ), path[i] ).getPath() );
}
}
}
}
}
-
- public void addRuntime(CCTask task, File javaHome, String os, String prefix) throws MojoFailureException {
- if (link) {
- if (os.equals(OS.MACOSX)) {
+
+ public void addRuntime( CCTask task, File javaHome, String os, String prefix )
+ throws MojoFailureException
+ {
+ if ( link )
+ {
+ if ( os.equals( OS.MACOSX ) )
+ {
CommandLineArgument.LocationEnum end = new CommandLineArgument.LocationEnum();
- end.setValue("end");
-
+ end.setValue( "end" );
+
// add as argument rather than library to avoid argument quoting
LinkerArgument framework = new LinkerArgument();
- framework.setValue("-framework");
- framework.setLocation(end);
- task.addConfiguredLinkerArg(framework);
+ framework.setValue( "-framework" );
+ framework.setLocation( end );
+ task.addConfiguredLinkerArg( framework );
LinkerArgument javavm = new LinkerArgument();
- javavm.setValue("JavaVM");
- javavm.setLocation(end);
- task.addConfiguredLinkerArg(javavm);
- } else {
- if (runtimeDirectory == null) {
- runtimeDirectory = NarUtil.getDefaults().getProperty(prefix+"runtimeDirectory");
- if (runtimeDirectory == null) {
- throw new MojoFailureException("NAR: Please specify a <RuntimeDirectory> as part of <Java>");
+ javavm.setValue( "JavaVM" );
+ javavm.setLocation( end );
+ task.addConfiguredLinkerArg( javavm );
+ }
+ else
+ {
+ if ( runtimeDirectory == null )
+ {
+ runtimeDirectory = NarUtil.getDefaults().getProperty( prefix + "runtimeDirectory" );
+ if ( runtimeDirectory == null )
+ {
+ throw new MojoFailureException( "NAR: Please specify a <RuntimeDirectory> as part of <Java>" );
}
}
- mojo.getLog().debug("Using Java Rumtime Directory: "+runtimeDirectory);
-
+ mojo.getLog().debug( "Using Java Rumtime Directory: " + runtimeDirectory );
+
LibrarySet libset = new LibrarySet();
- libset.setProject(mojo.getAntProject());
- libset.setLibs(new CUtil.StringArrayBuilder(runtime));
- libset.setDir(new File(javaHome, runtimeDirectory));
- task.addLibset(libset);
+ libset.setProject( mojo.getAntProject() );
+ libset.setLibs( new CUtil.StringArrayBuilder( runtime ) );
+ libset.setDir( new File( javaHome, runtimeDirectory ) );
+ task.addLibset( libset );
}
}
- }
+ }
}