Skip to content

Commit

Permalink
Make m2e-nar compatible with nar-maven-plugin-3.5.1
Browse files Browse the repository at this point in the history
Add the new configuration fields, notably 'embedManifest' which was
causing an exception to be thrown. Also update the methods to be sure
that dependencies are handled in the same way as the plugin.

This fixes #3 and fixes #4
  • Loading branch information
sdedwards committed Mar 31, 2018
1 parent 71a101b commit 8090a73
Show file tree
Hide file tree
Showing 18 changed files with 1,038 additions and 852 deletions.
2 changes: 1 addition & 1 deletion com.github.sdedwards.m2e-nar.tests/it/it-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.2.3</version>
<version>3.5.1</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down
2 changes: 2 additions & 0 deletions com.github.sdedwards.m2e-nar/.classpath
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/maven-common-artifact-filters-1.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-plugin-annotations-3.2.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
Expand Down
3 changes: 3 additions & 0 deletions com.github.sdedwards.m2e-nar/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ Export-Package: com.github.maven_nar;x-internal:=true,
com.github.sdedwards.m2e_nar,
com.github.sdedwards.m2e_nar.internal;x-internal:=true,
com.github.sdedwards.m2e_nar.internal.model;x-internal:=true
Bundle-ClassPath: lib/maven-common-artifact-filters-1.4.jar,
lib/maven-plugin-annotations-3.2.jar,
.
10 changes: 9 additions & 1 deletion com.github.sdedwards.m2e-nar/NOTICE
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
NAR Maven Plugin Integration for Eclipse
Copyright 2015 Stephen Edwards
Copyright 2015-2018 Stephen Edwards

Portions of this code -- specifically, most of the com.github.maven_nar
package -- were adapted from the nar-maven-plugin open source project
(http://maven-nar.github.io/)

Maven Plugin Java 5 Annotations
Copyright 2004-2012 The Apache Software Foundation

Maven Common Artifact Filters
Copyright 2002-2011 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
4 changes: 3 additions & 1 deletion com.github.sdedwards.m2e-nar/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ output.. = target/classes/
bin.includes = META-INF/,\
plugin.xml,\
lifecycle-mapping-metadata.xml,\
.
.,\
lib/maven-common-artifact-filters-1.4.jar,\
lib/maven-plugin-annotations-3.2.jar
source.. = src/
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import java.util.LinkedList;
import java.util.List;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Parameter;

import com.github.sdedwards.m2e_nar.internal.cdt.CdtUtils;

Expand All @@ -40,111 +40,114 @@
*/
public abstract class AbstractCompileMojo extends AbstractDependencyMojo implements INarCompileMojo {

/**
* C++ Compiler
*
* @parameter default-value=""
*/
private Cpp cpp;

/**
* C Compiler
*
* @parameter default-value=""
*/
private C c;

/**
* Fortran Compiler
*
* @parameter default-value=""
*/
private Fortran fortran;

/**
* Resource Compiler
*
* @parameter default-value=""
*/
private Resource resource;

/**
* IDL Compiler
*
* @parameter default-value=""
*/
private IDL idl;

/**
* Message Compiler
*
* @parameter default-value=""
*/
private Message message;

/**
* By default NAR compile will attempt to compile using all known compilers
* against files in the directories specified by convention. This allows
* configuration to a reduced set, you will have to specify each compiler to
* use in the configuration.
*
* @parameter default-value="false"
*/
protected boolean onlySpecifiedCompilers;

/**
* Maximum number of Cores/CPU's to use. 0 means unlimited.
*
* @parameter default-value=""
*/
private int maxCores = 0;

/**
* Fail on compilation/linking error.
*
* @parameter default-value="true"
* @required
*/
private boolean failOnError;

/**
* Sets the type of runtime library, possible values "dynamic", "static".
*
* @parameter default-value="dynamic"
* @required
*/
private String runtime;

/**
* Set use of libtool. If set to true, the "libtool " will be prepended to
* the command line for compatible processors.
*
* @parameter default-value="false"
* @required
*/
private boolean libtool;

/**
* List of tests to create
*
* @parameter default-value=""
*/
private List tests;

/**
* Java info for includes and linking
*
* @parameter default-value=""
*/
private Java java;

/**
* Flag to cpptasks to indicate whether linker options should be decorated
* or not
*
* @parameter default-value=""
*/
protected boolean decorateLinkerOptions;
/**
* C++ Compiler
*/
@Parameter
private Cpp cpp;

/**
* C Compiler
*/
@Parameter
private C c;

/**
* Fortran Compiler
*/
@Parameter
private Fortran fortran;

/**
* Resource Compiler
*/
@Parameter
private Resource resource;

/**
* IDL Compiler
*/
@Parameter
private IDL idl;

/**
* Message Compiler
*/
@Parameter
private Message message;

/**
* By default NAR compile will attempt to compile using all known compilers
* against files in the directories specified by convention.
* This allows configuration to a reduced set, you will have to specify each
* compiler to use in the configuration.
*/
@Parameter(defaultValue = "false")
protected boolean onlySpecifiedCompilers;

/**
* Do we log commands that is executed to produce the end-result?
* Conception was to allow eclipse to sniff out include-paths from compile.
*/
@Parameter
protected int commandLogLevel = 3;

/**
* Maximum number of Cores/CPU's to use. 0 means unlimited.
*/
@Parameter
private int maxCores = 0;

/**
* Fail on compilation/linking error.
*/
@Parameter(defaultValue = "true", required = true)
private boolean failOnError;

/**
* Sets the type of runtime library, possible values "dynamic", "static".
*/
@Parameter(defaultValue = "dynamic", required = true)
private String runtime;

/**
* Set use of libtool. If set to true, the "libtool " will be prepended to the
* command line for compatible
* processors.
*/
@Parameter(defaultValue = "false", required = true)
private boolean libtool;

/**
* List of tests to create
*/
@Parameter
private List tests;

/**
* Java info for includes and linking
*/
@Parameter
private Java java;

/**
* To support scanning the code with HPE Fortify.
* <p>
* The attribute functions as a flag that indicates Fortify is required,
* and the value is an ID, prepended to the command line as
* {@code sourceanalyzer –b <fortifyID>}.
* </p>
*/
@Parameter(defaultValue = "")
private String fortifyID;


/**
* Flag to cpptasks to indicate whether linker options should be decorated or
* not
*/
@Parameter
protected boolean decorateLinkerOptions;

private NarInfo narInfo;

Expand Down Expand Up @@ -412,7 +415,8 @@ protected File getLibraryPath(NarArtifact dependency) throws MojoFailureExceptio
List libraries = new ArrayList();
if (test != null) {
// Add the library of this package if it exists
final String linkType = test.getLink();
List<ILibrary> myLibs = new ArrayList<ILibrary>(getLibraries());
final String linkType = test.getLink(myLibs);
getLog().debug("Test: " + test.getName() + ", link: " + linkType);
boolean found = false;
for (Library lib : getLibraries()) {
Expand All @@ -423,7 +427,7 @@ protected File getLibraryPath(NarArtifact dependency) throws MojoFailureExceptio
}
if (found) {
getLog().debug("Adding " + linkType + " library for test " + test.getName());
final File dir = new File(getMavenProject().getBasedir(), CdtUtils.DEFAULT_CONFIG_NAME_PREFIX + test.getLink());
final File dir = new File(getMavenProject().getBasedir(), CdtUtils.DEFAULT_CONFIG_NAME_PREFIX + test.getLink(myLibs));
final Lib library = new Lib();
library.setName(getOutput(linkType));
library.setDirectory(dir);
Expand Down
Loading

0 comments on commit 8090a73

Please sign in to comment.