use of com.github.maven_nar.ITest in project m2e-nar by maven-nar.
the class NarExecutionBuilder method build.
public NarExecution build(final String buildType) throws CoreException {
try {
NarExecution settings = new NarExecution(mojoExecution);
settings.setSkip(narCompileMojo.isSkip());
settings.setOS(narCompileMojo.getOS());
settings.setLinkerName(narCompileMojo.getLinker().getName());
List<NarBuildArtifact> artifactSettings = settings.getArtifactSettings();
if (NarExecution.MAIN.equals(buildType)) {
List<?> libraries = narCompileMojo.getLibraries();
for (Iterator<?> iter = libraries.iterator(); iter.hasNext(); ) {
ILibrary library = (ILibrary) iter.next();
NarBuildArtifact buildArtifact = buildArtifactSettings(library.getType(), buildType, library.linkCPP(), null);
buildArtifact.setArtifactName(narCompileMojo.getOutput(library.getType()));
buildArtifact.setConfigName(CdtUtils.getConfigName(mojoExecution, buildArtifact));
artifactSettings.add(buildArtifact);
}
} else if (NarExecution.TEST.equals(buildType)) {
List<?> tests = narCompileMojo.getTests();
for (Iterator<?> iter = tests.iterator(); iter.hasNext(); ) {
ITest test = (ITest) iter.next();
NarBuildArtifact buildArtifact = buildArtifactSettings(NarBuildArtifact.EXECUTABLE, buildType, true, test);
buildArtifact.setArtifactName(test.getName());
buildArtifact.setConfigName(CdtUtils.getTestConfigName(mojoExecution, buildArtifact));
artifactSettings.add(buildArtifact);
}
}
return settings;
} catch (MojoFailureException e) {
throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Mojo failure", e));
} catch (MojoExecutionException e) {
throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Mojo execution failed", e));
}
}
Aggregations