From 846700d44b67b22835b57a1c04f17043db8323a3 Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Thu, 1 Oct 2009 14:33:24 +0200 Subject: Moved files in from freehep-nar-plugin version 2.0-alpha-11-SNAPSHOT --- src/site/apt/narLibrary.apt | 109 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 src/site/apt/narLibrary.apt (limited to 'src/site/apt/narLibrary.apt') diff --git a/src/site/apt/narLibrary.apt b/src/site/apt/narLibrary.apt new file mode 100644 index 0000000..98d4a11 --- /dev/null +++ b/src/site/apt/narLibrary.apt @@ -0,0 +1,109 @@ + --- +FreeHEP NAR Plugin + --- + --- +Mark Donszelmann + --- + +NAR Library + + Other plugins may need to use some of the functionality of the NAR Plugin, +such as downloading and unpacking. The NAR Plugin therefore groups most of +its functionality into the NAR Manager and allows other plugins and the NAR +Plugin itself to call on the NAR Manager. + + The {{{http://java.freehep.org/freehep-swig-plugin}SWIG Plugin}} which needs +the swig native executable uses the NAR Manager to download, unpack and call +the executable. + + To use the NAR Manager, see the {{{apidocs/index.html}API Docs}}, add the +following to your POM file: + ++-- + + ... + + ... + + org.freehep + freehep-nar-plugin + 2.0-alpha-2-SNAPSHOT + + + ++-- + + and use the code with the following snippet: + ++-- +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.freehep.maven.nar.Linker; +import org.freehep.maven.nar.NarManager; +import org.freehep.maven.nar.NarUtil; + +/** + * Description... + * + * @goal your-goal + * @phase your-phase + * @requiresDependencyResolution compile + */ +public class YourMojo extends AbstractMojo { + + /** + * Level of logging messages, 0 is minimum. + * + * @parameter expression="${logLevel}" default-value="0" + */ + private int logLevel; + + /** + * @parameter expression="${localRepository}" + * @required + * @readonly + */ + private ArtifactRepository localRepository; + + /** + * @parameter expression="${project}" + * @required + * @readonly + */ + private MavenProject project; + + /** + * The Architecture for picking up swig, Some choices are: "x86", "i386", + * "amd64", "ppc", "sparc", ... Defaults to ${os.arch} + * + * @parameter expression="${os.arch}" + * @required + */ + private String architecture; + + /** + * The Operating System for picking up swig. Some choices are: "Windows", + * "Linux", "MacOSX", "SunOS", ... Defaults to a derived value from + * ${os.name} + * + * @parameter expression="" + */ + private String os; + + private NarManager narManager; + + public void execute() throws MojoExecutionException, MojoFailureException { + + os = NarUtil.getOS(os); + // FIXME, should have some function in NarUtil + Linker linker = new Linker("g++"); + narManager = new NarManager(getLog(), logLevel, localRepository, project, + architecture, os, linker); + + ... DO WHATEVER YOU NEED WITH THE NarManager + } +} ++-- -- cgit v1.2.3