You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by HARDION Vincent <vi...@synchrotron-soleil.fr> on 2009/08/18 17:51:44 UTC
RE : AW: Re: RE : AW: RE: AW: Re: AW: Re: Maven for Non-Java Projects
Hi all,
Mark,
Pleased to receive news from you about the NAR project.
You can find the patch from the version 2.0-alpha-11-SNAPSHOT (04/2009).
As we use cvs in our company, I can't report all commit so don't hesitate to mail me about why.
The patch add some features like :
Import 3rd Party :
- include import libraries with .dll for windows
- Possibility to add include dependant from platform (This point breaks the no_arch philosophy !!!)
Configuration :
- Allows to define specific configuration enabled following the value of different variables (aol, os, debug mode etc ...) inspired from profile activation. These specifics configurations enhance the default configuration.
We also fix some minor bug and other that I don't remember but I can find.
I hope this may help.
Last question: I read somewhere that NAR plugin was given to Sonatype ?
Best regards,
Vincent Hardion
-----Message d'origine-----
De�: Donszelmann Mark [mailto:mark.donszelmann@gmail.com]
Envoy�: mardi 18 ao�t 2009 09:44
��: Maven Users List
Objet�: Re: AW: Re: RE : AW: RE: AW: Re: AW: Re: Maven for Non-Java Projects
Hi
I am the original author of the freehep-nar-plugin. It was made at
SLAC, Stanford Linear Accelerator Center,
when I worked there. In my current job, which terminates on september
15, I hade no time to support this
and the other Native code related plugins.
I am planning to pick things up again middle of september. I would be
interested in your lists of things that
fail to work with NAR, though I can think of a few myself. Any patches
you have created can be applied if
they work fine for NAR.
I plan to build some good test cases, and some better examples so that
things run out of the box.
Let me know
Regards
Mark Donszelmann
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE : RE : AW: Re: RE : AW: RE: AW: Re: AW: Re: Maven for Non-Java Projects
Posted by HARDION Vincent <vi...@synchrotron-soleil.fr>.
Hi,
Here is the patch :
# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action
on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AbstractCompileMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AbstractCompileMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AbstractCompileMojo.java 1.4
@@ -3,13 +3,17 @@
import java.io.File;
import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
+import java.util.Set;
+import org.apache.maven.plugin.MojoFailureException;
import org.apache.tools.ant.Project;
/**
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: AbstractCompileMojo.java,v 1.1 2009/04/03 07:11:37
hardion Exp $
+ * @version $Id: AbstractCompileMojo.java,v 1.4 2009/07/08 14:04:08
hardion Exp $
*/
public abstract class AbstractCompileMojo extends
AbstractDependencyMojo {
@@ -109,6 +113,13 @@
*/
private Java java;
+ /**
+ * Specific configuration for AOL, type of library
+ *
+ * @parameter expression=""
+ */
+ private Set/*<? extends AbstractCompileMojo>*/
specificConfigurations = new HashSet();
+
private NarInfo narInfo;
private List/*<String>*/ dependencyLibOrder;
@@ -173,6 +184,11 @@
return libraries;
}
+ protected Set getSpecificConfigurations() {
+ if (specificConfigurations == null) specificConfigurations =
Collections.EMPTY_SET;
+ return specificConfigurations;
+ }
+
protected List getTests() {
if (tests == null) tests = Collections.EMPTY_LIST;
return tests;
@@ -205,4 +221,32 @@
}
return narInfo;
}
+
+ public void parseSpecificConfigurations() throws
MojoFailureException{
+ for (Iterator it = specificConfigurations.iterator();
it.hasNext();) {
+ SpecificConfiguration configuration =
(SpecificConfiguration)it.next();
+
+ // Check activation condition
+ // All conditions must be true to activate
specificConfiguration (AND)
+ Activation activation = configuration.getActivation();
+ if(activation.isActive(this)){
+// this.getLog().info("Active Specific Configuration :
"+configuration);
+ this.enhancement(configuration);
+ }else{
+// this.getLog().debug("Specific Configuration unactive
:"+configuration);
}
+ }
+ }
+
+ public void enhancement(final AbstractCompileMojo other) {
+
+ if (!this.equals(other) && other != null) {
+
+ super.enhancement(other);
+ this.getCpp().enhancement(other.cpp);
+ this.getC().enhancement(other.c);
+ this.getFortran().enhancement(other.fortran);
+ }
+ }
+
+}
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AbstractDependencyMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AbstractDependencyMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AbstractDependencyMojo.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AbstractNarMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AbstractNarMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AbstractNarMojo.java 1.3
@@ -10,7 +10,7 @@
/**
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: AbstractNarMojo.java,v 1.1 2009/04/03 07:11:37 hardion
Exp $
+ * @version $Id: AbstractNarMojo.java,v 1.3 2009/05/06 16:42:11 hardion
Exp $
*/
public abstract class AbstractNarMojo extends AbstractMojo implements
NarConstants {
@@ -126,4 +126,10 @@
protected MavenProject getMavenProject() {
return mavenProject;
}
+
+ public void enhancement(final AbstractNarMojo other) {
+ if (!this.equals(other) && other != null) {
+ this.getLinker().enhancement(other.linker);
}
+ }
+}
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AOL.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AOL.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AOL.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AttachedNarArtifact.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AttachedNarArtifact.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/AttachedNarArtifact.java 1.2
@@ -11,25 +11,28 @@
* NarArtifact with its own type, classifier and artifactHandler.
*
* @author Mark Donszelmann
- * @version $Id: AttachedNarArtifact.java,v 1.1 2009/04/03 07:11:37
hardion Exp $
+ * @version $Id: AttachedNarArtifact.java,v 1.1 2009/04/03 07:11:37
hardion Exp
+ * $
*/
public class AttachedNarArtifact extends DefaultArtifact {
- public AttachedNarArtifact(String groupId, String artifactId,
String version, String scope,
- String type, String classifier, boolean
optional) throws InvalidVersionSpecificationException {
- super(groupId, artifactId,
VersionRange.createFromVersionSpec(version), scope,
- type, classifier, null, optional);
- setArtifactHandler(new Handler(classifier));
+ public AttachedNarArtifact(String groupId, String artifactId,
+ String version, String scope, String type,
String classifier,
+ boolean optional) throws
InvalidVersionSpecificationException {
+ super(groupId, artifactId,
VersionRange.createFromVersionSpec(version),
+ scope, type, classifier, null,
optional);
+ this.setArtifactHandler(new Handler(classifier));
}
public AttachedNarArtifact(Artifact parent, String type, String
classifier) {
- super(parent.getGroupId(), parent.getArtifactId(),
parent.getVersionRange(), parent.getScope(),
- type, classifier, null, parent.isOptional());
- setArtifactHandler(new Handler(classifier));
+ super(parent.getGroupId(), parent.getArtifactId(),
parent
+ .getVersionRange(), parent.getScope(),
type, classifier, null,
+ parent.isOptional());
+ this.setArtifactHandler(new Handler(classifier));
}
private class Handler implements ArtifactHandler {
- private String classifier;
+ private final String classifier;
Handler(String classifier) {
this.classifier = classifier;
@@ -60,7 +63,7 @@
}
public boolean isAddedToClasspath() {
- return false;
+ return true;
}
}
}
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/C.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/C.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/C.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Compiler.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Compiler.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Compiler.java 1.3
@@ -4,6 +4,7 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -26,7 +27,7 @@
* Abstract Compiler class
*
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: Compiler.java,v 1.1 2009/04/03 07:11:37 hardion Exp $
+ * @version $Id: Compiler.java,v 1.3 2009/05/06 16:42:11 hardion Exp $
*/
public abstract class Compiler {
@@ -71,6 +72,10 @@
*/
private boolean debug = false;
+ public boolean isDebug() {
+ return debug;
+ }
+
/**
* Enables generation of exception handling code.
*
@@ -493,4 +498,91 @@
}
}
}
+
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
}
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final Compiler other = (Compiler) obj;
+ if (this.sourceDirectory != other.sourceDirectory &&
(this.sourceDirectory == null ||
!this.sourceDirectory.equals(other.sourceDirectory))) {
+ return false;
+ }
+ if (this.includes != other.includes && (this.includes == null
|| !this.includes.equals(other.includes))) {
+ return false;
+ }
+ if (this.excludes != other.excludes && (this.excludes == null
|| !this.excludes.equals(other.excludes))) {
+ return false;
+ }
+ if ((this.optimize == null) ? (other.optimize != null) :
!this.optimize.equals(other.optimize)) {
+ return false;
+ }
+ if (this.defines != other.defines && (this.defines == null ||
!this.defines.equals(other.defines))) {
+ return false;
+ }
+ if ((this.defineSet == null) ? (other.defineSet != null) :
!this.defineSet.equals(other.defineSet)) {
+ return false;
+ }
+ if (this.undefines != other.undefines && (this.undefines ==
null || !this.undefines.equals(other.undefines))) {
+ return false;
+ }
+ if ((this.undefineSet == null) ? (other.undefineSet != null) :
!this.undefineSet.equals(other.undefineSet)) {
+ return false;
+ }
+ if (this.includePaths != other.includePaths &&
(this.includePaths == null ||
!this.includePaths.equals(other.includePaths))) {
+ return false;
+ }
+ if (this.systemIncludePaths != other.systemIncludePaths &&
(this.systemIncludePaths == null ||
!this.systemIncludePaths.equals(other.systemIncludePaths))) {
+ return false;
+ }
+ if (this.options != other.options && (this.options == null ||
!this.options.equals(other.options))) {
+ return false;
+ }
+ if ((this.optionSet == null) ? (other.optionSet != null) :
!this.optionSet.equals(other.optionSet)) {
+ return false;
+ }
+ return true;
+ }
+
+ public int hashCode() {
+ int hash = 7;
+ return hash;
+ }
+
+ public void enhancement(final Compiler other) {
+
+ if (!this.equals(other) && (other != null)) {
+
+ this.includes =
NarUtil.enhanceCollection(getName()+".includes",this.includes,
other.includes);
+
+ this.excludes =
NarUtil.enhanceCollection(getName()+".excludes",this.excludes,
other.excludes);
+ this.optimize =
NarUtil.enhanceDefaultObject(getName()+".optimize",this.optimize,
other.optimize, "none");
+ this.defines =
NarUtil.enhanceCollection(getName()+".defines",this.defines,
other.defines);
+ this.defineSet =
NarUtil.enhanceDefaultObject(getName()+".defineSet",this.defineSet,
other.defineSet, "");
+ this.undefines =
NarUtil.enhanceCollection(getName()+".undefines",this.undefines,
other.undefines);
+ this.undefineSet =
NarUtil.enhanceDefaultObject(getName()+".undefineSet",this.undefineSet,
other.undefineSet, "");
+ this.includePaths =
NarUtil.enhanceCollection(getName()+".includePaths",this.includePaths,
other.includePaths);
+ this.systemIncludePaths =
NarUtil.enhanceCollection(getName()+".systemIncludePaths",this.systemInc
ludePaths, other.systemIncludePaths);
+ this.options =
NarUtil.enhanceCollection(getName()+".options",this.options,
other.options);
+ this.optionSet =
NarUtil.enhanceDefaultObject(getName()+".optionSet",this.optionSet,
other.optionSet, "");
+
+ this.debug =
NarUtil.enhanceDefaultObject(getName()+".debug", this.debug,
other.debug,Boolean.FALSE);
+
+ this.exceptions =
NarUtil.enhanceDefaultObject(getName()+".exceptions", exceptions,
other.exceptions,Boolean.TRUE);
+
+ this.rtti= NarUtil.enhanceDefaultObject(getName()+".rtti",
this.rtti, (Boolean)other.rtti,Boolean.TRUE);
+
+ this.multiThreaded =
NarUtil.enhanceDefaultObject(getName()+".multiThreaded",
this.multiThreaded, (Boolean)other.multiThreaded,Boolean.FALSE);
+
+ this.clearDefaultDefines =
NarUtil.enhanceDefaultObject(getName()+".clearDefaultDefines",
this.clearDefaultDefines,
(Boolean)other.clearDefaultDefines,Boolean.FALSE);
+
+ this.clearDefaultUndefines =
NarUtil.enhanceDefaultObject(getName()+".clearDefaultUndefines",
this.clearDefaultUndefines,
(Boolean)other.clearDefaultUndefines,Boolean.FALSE);
+
+ this.clearDefaultOptions =
NarUtil.enhanceDefaultObject(getName()+".clearDefaultOptions",
this.clearDefaultOptions,
(Boolean)other.clearDefaultOptions,Boolean.FALSE);
+
+ }
+ }
+
+}
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Cpp.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Cpp.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Cpp.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Executable.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Executable.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Executable.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Fortran.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Fortran.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Fortran.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Java.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Java.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Java.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Javah.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Javah.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Javah.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Lib.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Lib.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Lib.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Library.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Library.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Library.java 1.2
@@ -9,7 +9,7 @@
* Sets up a library to create
*
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: Library.java,v 1.1 2009/04/03 07:11:37 hardion Exp $
+ * @version $Id: Library.java,v 1.2 2009/05/05 07:27:07 hardion Exp $
*/
public class Library implements Executable {
@@ -114,4 +114,9 @@
public File getNarSystemDirectory() {
return narSystemDirectory;
}
+
+
+
+
+
}
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Linker.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Linker.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Linker.java 1.3
@@ -27,7 +27,7 @@
* Linker tag
*
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: Linker.java,v 1.1 2009/04/03 07:11:37 hardion Exp $
+ * @version $Id: Linker.java,v 1.3 2009/05/06 16:42:11 hardion Exp $
*/
public class Linker {
@@ -345,4 +345,26 @@
}
}
}
+
+ public void enhancement(final Linker other) {
+
+ if (!this.equals(other) && (other != null)) {
+
+ this.options =
NarUtil.enhanceCollection("linker.options",this.options, other.options);
+ this.optionSet =
NarUtil.enhanceDefaultObject("linker.optionSet",this.optionSet,
other.optionSet,"");
+ this.libs =
NarUtil.enhanceCollection("linker.libs",this.libs, other.libs);
+ this.libSet =
NarUtil.enhanceDefaultObject("linker.libSet",this.libSet,
other.libSet,"");
+ this.sysLibs =
NarUtil.enhanceCollection("linker.sysLibs",this.sysLibs, other.sysLibs);
+ this.sysLibSet =
NarUtil.enhanceDefaultObject("linker.sysLibSet",this.sysLibSet,
other.sysLibSet,"");
+ this.narDependencyLibOrder =
NarUtil.enhanceDefaultObject("linker.narDependencyLibOrder",this.narDepe
ndencyLibOrder, other.narDependencyLibOrder,"");
+
+ this.incremental =
NarUtil.enhanceDefaultObject("linker.incremental",incremental,
other.incremental,Boolean.FALSE);
+
+ this.map = NarUtil.enhanceDefaultObject("linker.map",map,
other.map,Boolean.FALSE);
+
+ this.clearDefaultOptions =
NarUtil.enhanceDefaultObject("linker.clearDefaultOptions",clearDefaultOp
tions, other.clearDefaultOptions,Boolean.FALSE);
+
}
+ }
+
+}
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarArchiver.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarArchiver.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarArchiver.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarArtifact.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarArtifact.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarArtifact.java 1.2
@@ -3,18 +3,20 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.versioning.VersionRange;
/**
*
* @author duns
- * @version $Id: NarArtifact.java,v 1.1 2009/04/03 07:11:37 hardion Exp
$
+ * @version $Id: NarArtifact.java,v 1.2 2009/05/14 15:06:40 hardion Exp
$
*/
public class NarArtifact extends DefaultArtifact {
private NarInfo narInfo;
public NarArtifact(Artifact dependency, NarInfo narInfo) {
- super(dependency.getGroupId(), dependency.getArtifactId(),
dependency.getVersionRange(),
+ //PATCH It's not this plugin which should resolve version
+ super(dependency.getGroupId(), dependency.getArtifactId(),
VersionRange.createFromVersion(dependency.getVersion()),
dependency.getScope(), dependency.getType(),
dependency.getClassifier(),
dependency.getArtifactHandler(),
dependency.isOptional());
this.narInfo = narInfo;
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarArtifactHandler.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarArtifactHandler.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarArtifactHandler.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarAssemblyMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarAssemblyMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarAssemblyMojo.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarCompileMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarCompileMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarCompileMojo.java 1.4
@@ -31,7 +31,7 @@
* @phase compile
* @requiresDependencyResolution compile
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: NarCompileMojo.java,v 1.1 2009/04/03 07:11:37 hardion
Exp $
+ * @version $Id: NarCompileMojo.java,v 1.4 2009/07/16 12:38:10 hardion
Exp $
*/
public class NarCompileMojo extends AbstractCompileMojo {
@@ -42,6 +42,9 @@
// make sure destination is there
getTargetDirectory().mkdirs();
+ // Parse Specific Configuration
+ this.parseSpecificConfigurations();
+
// check for source files
int noOfSources = 0;
noOfSources += getSourcesFor(getCpp()).size();
@@ -57,6 +60,9 @@
// FIXME, should the include paths be defined at
a higher level ?
getCpp().copyIncludeFiles(getMavenProject(),
new File(getTargetDirectory(),
"include"));
+ // VH: For C too
+ getC().copyIncludeFiles(getMavenProject(),
+ new File(getTargetDirectory(),
"include"));
} catch (IOException e) {
throw new MojoExecutionException(
"NAR: could not copy include
files", e);
@@ -107,7 +113,7 @@
File outFile;
if (type.equals(Library.EXECUTABLE)) {
// executable has no version number
- outFile = new File(outDir,
getMavenProject().getArtifactId());
+ outFile = new File(outDir, getOutput(null));
} else {
outFile = new File(outDir, getOutput(getAOL()));
}
@@ -169,8 +175,14 @@
if (include.exists()) {
task.createIncludePath().setPath(include.getPath());
}
+ //Looking for platform dependant include file
+ include = new File(include,getAOL().toString());
+ getLog().debug("Looking for for specific
aol directory: " + include);
+ if (include.exists()) {
+
task.createIncludePath().setPath(include.getPath());
}
}
+ }
// add linker
LinkerDef linkerDefinition = getLinker().getLinker(this,
antProject,
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarConstants.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarConstants.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarConstants.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarDownloadMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarDownloadMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarDownloadMojo.java 1.6
@@ -3,20 +3,25 @@
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
+import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
/**
- * Downloads any dependent NAR files. This includes the noarch and aol
type NAR files.
+ * Downloads any dependent NAR files. This includes the noarch and aol
type NAR
+ * files.
*
* @goal nar-download
* @phase generate-sources
* @requiresProject
* @requiresDependencyResolution
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: NarDownloadMojo.java,v 1.1 2009/04/03 07:11:37 hardion
Exp $
+ * @version $Id: NarDownloadMojo.java,v 1.6 2009/05/19 09:45:36 hardion
Exp $
*/
public class NarDownloadMojo extends AbstractDependencyMojo {
@@ -48,24 +53,34 @@
private List classifiers;
public void execute() throws MojoExecutionException,
MojoFailureException {
- getLog().info("Using AOL: "+getAOL());
+ this.getLog().info("Using AOL: " + this.getAOL());
- if (shouldSkip()) {
-
getLog().info("*********************************************************
**************");
- getLog().info("NAR Plugin SKIPPED, no NAR Libraries will
be produced.");
-
getLog().info("*********************************************************
**************");
+ if (this.shouldSkip()) {
+ this
+ .getLog()
+ .info(
+
"***********************************************************************
");
+ this.getLog().info(
+ "NAR Plugin SKIPPED, no NAR
Libraries will be produced.");
+ this
+ .getLog()
+ .info(
+
"***********************************************************************
");
return;
}
- List narArtifacts =
getNarManager().getNarDependencies("compile");
+ List narArtifacts =
this.getNarManager().getNarDependencies("compile");
+
if (classifiers == null) {
-
getNarManager().downloadAttachedNars(narArtifacts,
remoteArtifactRepositories,
- artifactResolver, null);
+ // TODO Take account classifier from artifact
like else part
+
this.getNarManager().downloadAttachedNars(narArtifacts,
+ remoteArtifactRepositories,
artifactResolver, null);
} else {
for (Iterator j = classifiers.iterator();
j.hasNext();) {
-
getNarManager().downloadAttachedNars(narArtifacts,
remoteArtifactRepositories,
- artifactResolver,
(String) j.next());
+
this.getNarManager().downloadAttachedNars(narArtifacts,
+
remoteArtifactRepositories, artifactResolver,
+ (String) j.next());
}
}
}
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarInfo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarInfo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarInfo.java 1.4
@@ -15,7 +15,7 @@
/**
*
* @author Mark Donszelmann
- * @version $Id: NarInfo.java,v 1.1 2009/04/03 07:11:37 hardion Exp $
+ * @version $Id: NarInfo.java,v 1.4 2009/07/22 08:45:18 hardion Exp $
*/
public class NarInfo {
@@ -34,15 +34,16 @@
// Fill with general properties.nar file
File propertiesDir = new
File("src/main/resources/META-INF/nar/"
+ groupId + "/" + artifactId);
- if (!propertiesDir.exists()) {
- propertiesDir.mkdirs();
- }
+ if (propertiesDir.exists()) {
+
File propertiesFile = new File(propertiesDir,
NarInfo.NAR_PROPERTIES);
+
try {
info.load(new FileInputStream(propertiesFile));
} catch (IOException ioe) {
// ignored
}
+ }
}
@@ -88,10 +89,19 @@
* @return
*/
public String getBinding(AOL aol, String defaultBinding) {
- return getProperty(aol, "libs.binding", defaultBinding);
+ String result = getProperty(aol, "libs.binding",
defaultBinding);
+
+ // FIXME SOLEIL Mantis:13184
+ if(result!=null && result.equals("executable")){
+ result="bin";
}
+ return result;
+ }
public void setBinding(AOL aol, String value) {
+ if(value.equals("executable")){
+ value="bin";
+ }
setProperty(aol, "libs.binding", value);
}
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarIntegrationTestMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarIntegrationTestMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarIntegrationTestMojo.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarJavahMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarJavahMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarJavahMojo.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarLogger.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarLogger.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarLogger.java 1.2
@@ -10,7 +10,7 @@
* Logger to connect the Ant logging to the Maven logging.
*
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: NarLogger.java,v 1.1 2009/04/03 07:11:37 hardion Exp $
+ * @version $Id: NarLogger.java,v 1.2 2009/07/22 14:15:57 hardion Exp $
*/
public class NarLogger implements BuildListener {
@@ -54,7 +54,10 @@
log.warn(msg);
break;
case Project.MSG_INFO:
- if ((msg.indexOf("files were compiled") >= 0) ||
(msg.indexOf("Linking...") >= 0)) {
+ if ((msg.indexOf("files were compiled") >= 0)
+ || (msg.indexOf("Linking...") >= 0)
+ || (msg.indexOf("Starting link") >= 0)
+ ||
(msg.indexOf("Execute:Java13CommandLauncher") >= 0)) {
log.info(msg);
} else if (msg.indexOf("error") >= 0) {
log.error(msg);
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarManager.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarManager.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarManager.java 1.6
@@ -6,17 +6,23 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.LinkedList;
+import java.util.Set;
import java.util.jar.JarFile;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.DefaultArtifactResolver;
+import
org.apache.maven.artifact.transform.ReleaseArtifactTransformation;
import
org.apache.maven.artifact.versioning.InvalidVersionSpecificationExceptio
n;
+import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
@@ -29,16 +35,17 @@
public class NarManager {
- private Log log;
+ private final Log log;
- private MavenProject project;
+ private final MavenProject project;
- private ArtifactRepository repository;
+ private final ArtifactRepository repository;
- private AOL defaultAOL;
- private String linkerName;
+ private final AOL defaultAOL;
+ private final String linkerName;
- private String[] narTypes = { "noarch", Library.STATIC,
Library.SHARED, Library.JNI, Library.PLUGIN };
+ private final String[] narTypes = { "noarch", Library.STATIC,
+ Library.SHARED, Library.JNI, Library.PLUGIN };
public NarManager(Log log, ArtifactRepository repository,
MavenProject project, String architecture,
String os, Linker linker)
@@ -46,8 +53,8 @@
this.log = log;
this.repository = repository;
this.project = project;
- this.defaultAOL = NarUtil.getAOL(architecture, os,
linker, null);
- this.linkerName = NarUtil.getLinkerName(architecture,
os, linker);
+ defaultAOL = NarUtil.getAOL(architecture, os, linker,
null);
+ linkerName = NarUtil.getLinkerName(architecture, os,
linker);
}
/**
@@ -56,16 +63,75 @@
*/
public List/* <NarArtifact> */getNarDependencies(String scope)
throws MojoExecutionException {
+
+ //SOLEIL LOG
+ log.debug("List of dependencies : ");
+ List dependencies = project.getDependencies();
+ for (Iterator iterator = dependencies.iterator();
iterator.hasNext();) {
+ Dependency object = (Dependency) iterator.next();
+ log.debug("Found dependency : " + object.toString());
+ }
+ log.debug("List of artifacts : ");
+// List artifacts = project.getCompileClasspathElements();
//Artifacts();
+ Set artifacts = project.getArtifacts();
+ //project.getCompileClasspathElements();
+ for (Iterator iterator = artifacts.iterator();
iterator.hasNext();) {
+ Artifact object = (Artifact) iterator.next();
+ log.debug("Found artifact : " + object.toString() + " "
+ object.getBaseVersion() + " "+ object.getVersion() + " " +
object.isResolved());
+
+ log.debug("Found artifact : " + object.toString() + " "
+ object.getBaseVersion() + " "+ object.getVersion() + " " +
object.isResolved());
+ }
+
+ Set darts = project.getDependencyArtifacts();
+ for (Iterator iterator = darts.iterator();
iterator.hasNext();) {
+ log.debug("Found dart : " + iterator.next());
+ }
+ //SOLEIL LOG
+
+
+
List narDependencies = new LinkedList();
- for (Iterator i = getDependencies(scope).iterator();
i.hasNext();) {
+ for (Iterator i =
this.getDependencies(scope).iterator(); i.hasNext();) {
Artifact dependency = (Artifact) i.next();
- log.debug("Examining artifact for NarInfo:
"+dependency);
+ log.debug("Examining artifact for NarInfo: " +
dependency);
- NarInfo narInfo = getNarInfo(dependency);
+ NarInfo narInfo = this.getNarInfo(dependency);
+ // TODO Take a account when it's a direct
NarAttached dependency
+ // with classifier data
+ // IDEA : create a fake NarInfo
+ if (narInfo == null) {
+ narInfo = new
NarInfo(dependency.getGroupId(), dependency
+ .getArtifactId(),
dependency.getVersion(), log);
+ // Setting binding from classifier
+ String classifier =
dependency.getClassifier();
+ if (classifier != null) {
+ int dash =
classifier.lastIndexOf('-');
+ if (dash >= 0) {
+ AOL aol = new
AOL(classifier.substring(0, dash));
+ String type =
classifier.substring(dash + 1);
+ narInfo.setBinding(aol,
type);
+
+ // Add NAR from
+ narInfo.setNar(null,
type, dependency.getGroupId()
+ + ":" +
dependency.getArtifactId() + ":"
+ +
NarConstants.NAR_TYPE + ":"
+ + (aol
!= null ? "${aol}-" : "") + type);
+
+ // Add noarch
+ narInfo.setNar(null,
NarConstants.NAR_NO_ARCH,
+
dependency.getGroupId() + ":"
+
+ dependency.getArtifactId() + ":"
+
+ NarConstants.NAR_TYPE + ":"
+
+ NarConstants.NAR_NO_ARCH);
+ }
+ }
+ }
+ // END OF PATCH
if (narInfo != null) {
log.debug(" - added as
NarDependency");
narDependencies.add(new
NarArtifact(dependency, narInfo));
}
+ //
}
return narDependencies;
}
@@ -79,22 +145,24 @@
public Map/* <String, List<AttachedNarArtifact>>
*/getAttachedNarDependencyMap(
String scope) throws MojoExecutionException,
MojoFailureException {
Map attachedNarDependencies = new HashMap();
- for (Iterator i = getNarDependencies(scope).iterator();
i.hasNext();) {
+ for (Iterator i =
this.getNarDependencies(scope).iterator(); i
+ .hasNext();) {
Artifact dependency = (Artifact) i.next();
for (int j = 0; j < narTypes.length; j++) {
- List artifactList =
getAttachedNarDependencies(dependency,
+ List artifactList =
this.getAttachedNarDependencies(dependency,
defaultAOL,
narTypes[j]);
- if (artifactList != null)
+ if (artifactList != null) {
attachedNarDependencies.put(narTypes[j], artifactList);
}
}
+ }
return attachedNarDependencies;
}
public List/* <AttachedNarArtifact>
*/getAttachedNarDependencies(
List/* <NarArtifacts> */narArtifacts)
throws MojoExecutionException,
MojoFailureException {
- return getAttachedNarDependencies(narArtifacts, null);
+ return this.getAttachedNarDependencies(narArtifacts,
null);
}
public List/* <AttachedNarArtifact>
*/getAttachedNarDependencies(
@@ -112,7 +180,7 @@
type = classifier.substring(dash + 1);
}
}
- return getAttachedNarDependencies(narArtifacts, aol,
type);
+ return this.getAttachedNarDependencies(narArtifacts,
aol, type);
}
/**
@@ -143,9 +211,9 @@
List artifactList = new ArrayList();
for (Iterator i = narArtifacts.iterator(); i.hasNext();)
{
Artifact dependency = (Artifact) i.next();
- NarInfo narInfo = getNarInfo(dependency);
+ NarInfo narInfo = this.getNarInfo(dependency);
if (noarch) {
-
artifactList.addAll(getAttachedNarDependencies(dependency,
+
artifactList.addAll(this.getAttachedNarDependencies(dependency,
null, "noarch"));
}
@@ -156,11 +224,11 @@
// FIXME kludge, but does not work anymore since
AOL is now a class
if (aol.equals("noarch")) {
// FIXME no handling of local
-
artifactList.addAll(getAttachedNarDependencies(dependency,
+
artifactList.addAll(this.getAttachedNarDependencies(dependency,
null, "noarch"));
} else {
-
artifactList.addAll(getAttachedNarDependencies(dependency, aol,
- binding));
+
artifactList.addAll(this.getAttachedNarDependencies(dependency,
+ aol, binding));
}
}
return artifactList;
@@ -169,16 +237,18 @@
private List/* <AttachedNarArtifact>
*/getAttachedNarDependencies(
Artifact dependency, AOL aol, String type)
throws MojoExecutionException,
MojoFailureException {
- log.debug("GetNarDependencies for " + dependency + ",
aol: " + aol + ", type: " + type);
+ log.debug("GetNarDependencies for " + dependency + ",
aol: " + aol
+ + ", type: " + type);
List artifactList = new ArrayList();
- NarInfo narInfo = getNarInfo(dependency);
+ NarInfo narInfo = this.getNarInfo(dependency);
String[] nars = narInfo.getAttachedNars(aol, type);
// FIXME Move this to NarInfo....
if (nars != null) {
for (int j = 0; j < nars.length; j++) {
log.debug(" Checking: " + nars[j]);
- if (nars[j].equals(""))
+ if (nars[j].equals("")) {
continue;
+ }
String[] nar = nars[j].split(":", 5);
if (nar.length >= 4) {
try {
@@ -189,8 +259,8 @@
// translate for
instance g++ to gcc...
aol =
narInfo.getAOL(aol);
if (aol != null) {
- classifier =
NarUtil.replace("${aol}", aol.toString(),
-
classifier);
+ classifier =
NarUtil.replace("${aol}", aol
+
.toString(), classifier);
}
String version =
nar.length >= 5 ? nar[4].trim()
:
dependency.getVersion();
@@ -216,22 +286,53 @@
throws MojoExecutionException {
// FIXME reported to maven developer list, isSnapshot
changes behaviour
// of getBaseVersion, called in pathOf.
- if (dependency.isSnapshot())
+ if (dependency.isSnapshot()) {
;
+ }
+ // TODO Take a account when it's a direct NarAttached
dependency
+ // with classifier data
+ // IDEA : create a fake NarInfo
+ NarInfo info = null;
+ if (dependency instanceof NarArtifact) {
+ info = ((NarArtifact) dependency).getNarInfo();
+ } else {
- File file = new File(repository.getBasedir(), repository
- .pathOf(dependency));
+ //XXX : Problem with RELEASE version label
+ File file = null;
+
if(dependency.getVersion().equals(Artifact.RELEASE_VERSION)){
+ file = dependency.getFile();
+ // RESOLVE VERSION
+ // Maybe with DefaultArtifactResolver dar = ???
+ //
ReleaseArtifactTransformation.transformForResolve
+ //new
ReleaseArtifactTransformation().transformForResolve(dependency,
project.getRepositories(), repository);
+ // Quickfix : version from file !!!
+ String version = file.getName();
+ String artifactId = dependency.getArtifactId();
+ int begin =
version.indexOf(artifactId)+artifactId.length()+1;//index of the first
character of version string
+ int end = version.indexOf(".jar");
+ version = version.substring(begin,end);
+ dependency.setVersion(version);
+ //
+
+ }else{
+ // the correct mean is above but i don't want break old
behaviour
+ file = new File(repository.getBasedir(),
repository.pathOf(dependency));
+ }
+
+
JarFile jar = null;
try {
jar = new JarFile(file);
- NarInfo info = new
NarInfo(dependency.getGroupId(), dependency
+ info = new
NarInfo(dependency.getGroupId(), dependency
.getArtifactId(),
dependency.getVersion(), log);
- if (!info.exists(jar))
- return null;
+ if (info.exists(jar)) {
info.read(jar);
- return info;
+ } else {
+ info = null;
+ }
} catch (IOException e) {
- throw new MojoExecutionException("Error while
reading " + file, e);
+ throw new MojoExecutionException("Error
while reading " + file,
+ e);
} finally {
if (jar != null) {
try {
@@ -242,12 +343,15 @@
}
}
}
+ return info;
+ }
public File getNarFile(Artifact dependency) throws
MojoFailureException {
// FIXME reported to maven developer list, isSnapshot
changes behaviour
// of getBaseVersion, called in pathOf.
- if (dependency.isSnapshot())
+ if (dependency.isSnapshot()) {
;
+ }
return new File(repository.getBasedir(),
NarUtil.replace("${aol}",
defaultAOL.toString(),
repository.pathOf(dependency)));
}
@@ -258,16 +362,34 @@
} else if (scope.equals("runtime")) {
return project.getRuntimeArtifacts();
}
- return project.getCompileArtifacts();
+ return this.getCompileArtifacts();
}
+ // Hacked from maven source without isAddedToClasspath() check
+ private List getCompileArtifacts() {
+ List list = new
ArrayList(project.getArtifacts().size());
+
+ for (Iterator i = project.getArtifacts().iterator();
i.hasNext();) {
+ Artifact a = (Artifact) i.next();
+
+ // TODO: let the scope handler deal with this
+ if (Artifact.SCOPE_COMPILE.equals(a.getScope())
+ ||
Artifact.SCOPE_PROVIDED.equals(a.getScope())
+ ||
Artifact.SCOPE_SYSTEM.equals(a.getScope())) {
+ list.add(a);
+ }
+ }
+ return list;
+ }
+
public void downloadAttachedNars(List/* <NarArtifacts>
*/narArtifacts,
List remoteRepositories, ArtifactResolver
resolver,
String classifier) throws
MojoExecutionException,
MojoFailureException {
// FIXME this may not be the right way to do this.... -U
ignored and
// also SNAPSHOT not used
- List dependencies =
getAttachedNarDependencies(narArtifacts, classifier);
+ List dependencies =
this.getAttachedNarDependencies(narArtifacts,
+ classifier);
for (Iterator i = dependencies.iterator(); i.hasNext();)
{
Artifact dependency = (Artifact) i.next();
try {
@@ -286,17 +408,19 @@
public void unpackAttachedNars(List/* <NarArtifacts>
*/narArtifacts,
ArchiverManager manager, String classifier,
String os)
throws MojoExecutionException,
MojoFailureException {
- log.debug("Unpack called for OS: "+os+", classifier:
"+classifier+" for NarArtifacts {");
- for (Iterator i = narArtifacts.iterator(); i.hasNext();
) {
- log.debug(" - "+((NarArtifact)i.next()));
+ log.debug("Unpack called for OS: " + os + ", classifier:
" + classifier
+ + " for NarArtifacts {");
+ for (Iterator i = narArtifacts.iterator(); i.hasNext();)
{
+ log.debug(" - " + (i.next()));
}
log.debug("}");
// FIXME, kludge to get to download the -noarch, based
on classifier
- List dependencies =
getAttachedNarDependencies(narArtifacts, classifier);
+ List dependencies =
this.getAttachedNarDependencies(narArtifacts,
+ classifier);
for (Iterator i = dependencies.iterator(); i.hasNext();)
{
Artifact dependency = (Artifact) i.next();
log.debug("Unpack " + dependency);
- File file = getNarFile(dependency);
+ File file = this.getNarFile(dependency);
File narLocation = new
File(file.getParentFile(), "nar");
File flagFile = new File(narLocation,
FileUtils.basename(file
.getPath(), "." +
AbstractNarMojo.NAR_EXTENSION)
@@ -314,22 +438,25 @@
if (process) {
try {
- unpackNar(manager, file,
narLocation);
+ this.unpackNar(manager, file,
narLocation);
if
(!NarUtil.getOS(os).equals("Windows")) {
-
NarUtil.makeExecutable(new File(narLocation, "bin/"+defaultAOL),
- log);
+
NarUtil.makeExecutable(new File(narLocation, "bin/"
+ +
defaultAOL), log);
// FIXME clumsy
if
(defaultAOL.hasLinker("g++")) {
-
NarUtil.makeExecutable(new File(narLocation,
"bin/"+NarUtil.replace("g++", "gcc", defaultAOL.toString())),
-
log);
+
NarUtil.makeExecutable(new File(narLocation, "bin/"
+
+ NarUtil.replace("g++", "gcc", defaultAOL
+
.toString())), log);
}
}
if (linkerName.equals("gcc") ||
linkerName.equals("g++")) {
- NarUtil.runRanlib(new
File(narLocation, "lib/"+defaultAOL), log);
+ NarUtil.runRanlib(new
File(narLocation, "lib/"
+ +
defaultAOL), log);
// FIXME clumsy
if
(defaultAOL.hasLinker("g++")) {
-
NarUtil.runRanlib(new File(narLocation, "lib/"+NarUtil.replace("g++",
"gcc", defaultAOL.toString())),
-
log);
+
NarUtil.runRanlib(new File(narLocation, "lib/"
+
+ NarUtil.replace("g++", "gcc", defaultAOL
+
.toString())), log);
}
}
FileUtils.fileDelete(flagFile.getPath());
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarPackageMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarPackageMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarPackageMojo.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarResourcesMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarResourcesMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarResourcesMojo.java 1.2
@@ -23,7 +23,7 @@
* @phase process-resources
* @requiresProject
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: NarResourcesMojo.java,v 1.1 2009/04/03 07:11:37
hardion Exp $
+ * @version $Id: NarResourcesMojo.java,v 1.2 2009/04/03 11:52:36
hardion Exp $
*/
public class NarResourcesMojo extends AbstractCompileMojo {
@@ -62,14 +62,16 @@
/**
* To look up Archiver/UnArchiver implementations
*
- * @parameter
expression="${component.org.codehaus.plexus.archiver.manager.ArchiverMan
ager}"
+ * @parameter expression=
+ *
"${component.org.codehaus.plexus.archiver.manager.ArchiverManager}"
* @required
*/
private ArchiverManager archiverManager;
public void execute() throws MojoExecutionException,
MojoFailureException {
- if (shouldSkip())
+ if (this.shouldSkip()) {
return;
+ }
// scan for AOLs
File aolDir = new File(resourceDirectory, "aol");
@@ -79,14 +81,15 @@
boolean ignore = false;
for (Iterator j =
FileUtils.getDefaultExcludesAsList()
.iterator();
j.hasNext();) {
- String exclude =
(String)j.next();
- if
(SelectorUtils.matchPath(exclude.replace('/', File.separatorChar),
aols[i])) {
+ String exclude = (String)
j.next();
+ if
(SelectorUtils.matchPath(exclude.replace('/',
+
File.separatorChar), aols[i])) {
ignore = true;
break;
}
}
if (!ignore) {
- copyResources(new File(aolDir,
aols[i]));
+ this.copyResources(new
File(aolDir, aols[i]));
}
}
}
@@ -100,7 +103,8 @@
// copy headers
File includeDir = new File(aolDir,
resourceIncludeDir);
if (includeDir.exists()) {
- File includeDstDir = new
File(getTargetDirectory(), "include");
+ File includeDstDir = new
File(this.getTargetDirectory(),
+ "include");
includeDstDir = new File(includeDstDir,
aol);
copied += NarUtil.copyDirectoryStructure(includeDir,
@@ -110,7 +114,7 @@
// copy binaries
File binDir = new File(aolDir, resourceBinDir);
if (binDir.exists()) {
- File binDstDir = new
File(getTargetDirectory(), "bin");
+ File binDstDir = new
File(this.getTargetDirectory(), "bin");
binDstDir = new File(binDstDir, aol);
copied +=
NarUtil.copyDirectoryStructure(binDir, binDstDir,
@@ -121,33 +125,54 @@
File libDir = new File(aolDir, resourceLibDir);
if (libDir.exists()) {
// create all types of libs
- for (Iterator i =
getLibraries().iterator(); i.hasNext();) {
+ for (Iterator i =
this.getLibraries().iterator(); i.hasNext();) {
Library library = (Library)
i.next();
String type = library.getType();
- File libDstDir = new
File(getTargetDirectory(), "lib");
+
+ // Copy from typed directory
+ File typedLibDir = new
File(libDir, type);
+ if (typedLibDir.exists()) {
+
+ File libDstDir = new
File(this.getTargetDirectory(),
+ "lib");
libDstDir = new File(libDstDir,
aol);
libDstDir = new File(libDstDir,
type);
// filter files for lib
- // TODO For shared library under windows copy the
.lib too
- String includes = "**/*."
- +
NarUtil.getDefaults().getProperty(
-
NarUtil.getAOLKey(aol) + "." + type
-
+ ".extension");
- copied +=
NarUtil.copyDirectoryStructure(libDir, libDstDir,
- includes,
NarUtil.DEFAULT_EXCLUDES);
+ String includes =
"**/*.*";
+ // +
NarUtil.getDefaults().getProperty(
+ //
NarUtil.getAOLKey(aol) + "." + type
+ // + ".extension");
+ // // For shared library
under windows copy the .lib too
+ // if
((type.equals(Library.SHARED))
+ // &&
NarUtil.getAOLKey(aol).endsWith(
+ // "Windows-msvc")) {
+ // includes = includes
+ // + ","
+ // +
NarUtil.getDefaults().getProperty(
+ //
NarUtil.getAOLKey(aol) + "."
+ // + Library.STATIC
+ // + ".extension");
+ // this.getLog().debug(
+ // "add import lib for
dll for windows ");
+ // }
+ copied +=
NarUtil.copyDirectoryStructure(typedLibDir,
+
libDstDir, includes, NarUtil.DEFAULT_EXCLUDES);
}
}
+ }
// unpack jar files
- File classesDirectory = new
File(getOutputDirectory(),"classes");
+ File classesDirectory = new
File(this.getOutputDirectory(),
+ "classes");
classesDirectory.mkdirs();
List jars = FileUtils.getFiles(aolDir,
"**/*.jar", null);
- for (Iterator i=jars.iterator(); i.hasNext(); )
{
- File jar = (File)i.next();
- getLog().debug("Unpacking jar "+jar);
+ for (Iterator i = jars.iterator(); i.hasNext();)
{
+ File jar = (File) i.next();
+ this.getLog().debug("Unpacking jar " +
jar);
UnArchiver unArchiver;
- unArchiver =
archiverManager.getUnArchiver(AbstractNarMojo.NAR_ROLE_HINT);
+ unArchiver = archiverManager
+
.getUnArchiver(AbstractNarMojo.NAR_ROLE_HINT);
unArchiver.setSourceFile(jar);
unArchiver.setDestDirectory(classesDirectory);
unArchiver.extract();
@@ -157,9 +182,10 @@
} catch (NoSuchArchiverException e) {
throw new MojoExecutionException("NAR: Could not
find archiver", e);
} catch (ArchiverException e) {
- throw new MojoExecutionException("NAR: Could not
unarchive jar file", e);
+ throw new MojoExecutionException(
+ "NAR: Could not unarchive jar
file", e);
}
- getLog().info("Copied " + copied + " resources for " +
aol);
+ this.getLog().info("Copied " + copied + " resources for
" + aol);
}
}
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarSystemGenerate.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarSystemGenerate.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarSystemGenerate.java 1.2
@@ -7,6 +7,10 @@
import java.io.PrintWriter;
import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -18,13 +22,25 @@
* @phase generate-sources
* @requiresProject
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: NarSystemGenerate.java,v 1.1 2009/04/03 07:11:37
hardion Exp $
+ * @version $Id: NarSystemGenerate.java,v 1.2 2009/05/15 16:20:58
hardion Exp $
*/
public class NarSystemGenerate extends AbstractCompileMojo {
public void execute() throws MojoExecutionException,
MojoFailureException {
if (shouldSkip())
return;
+ this.getLog().debug("List of dependencies : ");
+ List dependencies =
this.getMavenProject().getDependencies();
+ for (Iterator iterator = dependencies.iterator();
iterator.hasNext();) {
+ Dependency object = (Dependency)
iterator.next();
+ this.getLog().debug("Found dependency : " +
object.toString());
+ }
+ this.getLog().debug("List of artifacts : ");
+ Set artifacts = this.getMavenProject().getArtifacts();
+ for (Iterator iterator = artifacts.iterator();
iterator.hasNext();) {
+ Artifact object = (Artifact) iterator.next();
+ this.getLog().debug("Found artifact : " + object.toString()
+" "+ object.getVersion()+" "+object.isResolved());
+ }
// get packageName if specified for JNI.
String packageName = null;
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarTestCompileMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarTestCompileMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarTestCompileMojo.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarTestMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarTestMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarTestMojo.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarUnArchiver.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarUnArchiver.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarUnArchiver.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarUnpackMojo.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarUnpackMojo.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarUnpackMojo.java 1.11
@@ -4,8 +4,15 @@
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.archiver.manager.ArchiverManager;
/**
@@ -13,11 +20,11 @@
* and also sets flags on binaries and corrects static libraries.
*
* @goal nar-unpack
- * @phase process-sources
+ * @phase generate-sources
* @requiresProject
* @requiresDependencyResolution
* @author <a href="Mark.Donszelmann@slac.stanford.edu">Mark
Donszelmann</a>
- * @version $Id: NarUnpackMojo.java,v 1.1 2009/04/03 07:11:37 hardion
Exp $
+ * @version $Id: NarUnpackMojo.java,v 1.11 2009/05/19 07:45:32 hardion
Exp $
*/
public class NarUnpackMojo extends AbstractDependencyMojo {
@@ -38,8 +45,9 @@
private ArchiverManager archiverManager;
public void execute() throws MojoExecutionException,
MojoFailureException {
- if (shouldSkip()) return;
-
+ if (shouldSkip()) {
+ return;
+ }
List narArtifacts =
getNarManager().getNarDependencies("compile");
if (classifiers == null) {
getNarManager().unpackAttachedNars(narArtifacts,
archiverManager, null, getOS());
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarUtil.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarUtil.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/NarUtil.java 1.4
@@ -6,6 +6,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -18,13 +19,14 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugin.logging.SystemStreamLog;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.PropertyUtils;
import org.codehaus.plexus.util.cli.Commandline;
/**
* @author Mark Donszelmann
- * @version $Id: NarUtil.java,v 1.1 2009/04/03 07:11:37 hardion Exp $
+ * @version $Id: NarUtil.java,v 1.4 2009/07/20 17:13:38 hardion Exp $
*/
public class NarUtil {
@@ -207,6 +209,7 @@
/* Matcher. jdk 1.4
*/quoteReplacement(replacement.toString()));
}
+
/* for jdk 1.4 */
private static String quote(String s) {
int slashEIndex = s.indexOf("\\E");
@@ -414,4 +417,31 @@
}
}
+ private static Log LOG = new SystemStreamLog();
+
+ public final static <T extends Collection> T
enhanceCollection(String name, final T original, final T enhancer) {
+ T result = original;
+// LOG.debug(name+" Enhance Collection :"+original+" (original)
:"+enhancer+" (enhancer)");
+ // Not initialized List case
+ if (enhancer != null) {
+ if (original == null) {
+ result = enhancer;
+ } else {
+ result.addAll(enhancer);
}
+// LOG.debug(name+" Collection enhanced:"+original+"
(original) :"+enhancer+" (enhancer) : "+result+" (result)");
+ }
+ return result;
+ }
+
+ public final static <T> T enhanceDefaultObject(String name, final
T original, final T enhancer, final T defaultValue) {
+ T result = original;
+// LOG.debug(name+" Enhance Object :"+original+" (original)
:"+enhancer+" (enhancer)");
+ if ((enhancer != null) && !(enhancer.equals(defaultValue))) {
+ result = enhancer;
+// LOG.debug(name+" Object enhanced:"+original+" (original)
:"+enhancer+" (enhancer) : "+result+" (result)");
+ }
+ return result;
+ }
+
+}
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/OS.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/OS.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/OS.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/SysLib.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/SysLib.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/SysLib.java 1.1
Index:
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Test.java
---
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Test.java 1.1
+++
ContinuousIntegration/maven/plugins/freehep-nar-plugin/src/main/java/org
/freehep/maven/nar/Test.java 1.1
Best regards,
Vincent Hardion
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org