use of com.github.sdedwards.m2e_nar.internal.model.NarLib in project m2e-nar by maven-nar.
the class NarExecutionBuilder method buildLinkerSettings.
@SuppressWarnings("unchecked")
public NarLinker buildLinkerSettings(final ILinker linker, final boolean linkCpp, final ITest test) throws MojoFailureException, MojoExecutionException {
NarLinker settings = new NarLinker();
settings.setName(linker.getName());
List<NarLib> libs = settings.getLibs();
for (Iterator<?> it = linker.getLibs().iterator(); it.hasNext(); ) {
libs.add(buildLibSettings((ILib) it.next()));
}
List<NarSysLib> sysLibs = settings.getSysLibs();
for (Iterator<?> it = linker.getSysLibs().iterator(); it.hasNext(); ) {
sysLibs.add(buildSysLibSettings((ISysLib) it.next()));
}
settings.setIncremental(linker.isIncremental());
settings.setMap(linker.isMap());
List<String> options = settings.getOptions();
options.addAll(linker.getOptions());
if (test != null) {
List<String> testOptions = linker.getTestOptions();
if (testOptions != null) {
options.addAll(testOptions);
}
}
settings.setLinkCpp(linkCpp);
return settings;
}
use of com.github.sdedwards.m2e_nar.internal.model.NarLib in project m2e-nar by maven-nar.
the class AbstractGnuLinkerSynchroniser method getFlags.
public String getFlags(final NarLinker linkerSettings, final List<NarLib> libs) {
final StringBuilder flags = new StringBuilder();
flags.append(defaultFlags);
if (linkerSettings.isIncremental()) {
flags.append(" ");
flags.append(incrementalFlag);
}
if (linkerSettings.isMap()) {
flags.append(" ");
flags.append(mapFlag);
}
for (String option : linkerSettings.getOptions()) {
flags.append(" ");
flags.append(option);
}
boolean first = true;
for (NarLib lib : libs) {
if (!NarBuildArtifact.isSharedLibrary(lib.getType())) {
continue;
}
if (first) {
first = false;
flags.append(" " + rpathFlag + ",");
} else {
flags.append(":");
}
flags.append(lib.getDirectory());
}
return flags.toString();
}
use of com.github.sdedwards.m2e_nar.internal.model.NarLib in project m2e-nar by maven-nar.
the class AbstractSettingsSynchroniser method setLibraryPaths.
private void setLibraryPaths(final ICConfigurationDescription conf, final NarBuildArtifact settings) throws CoreException {
final ICLanguageSetting[] languageSettings = conf.getRootFolderDescription().getLanguageSettings();
final List<ICLibraryPathEntry> libraryPathEntries = new ArrayList<ICLibraryPathEntry>();
for (final NarLib lib : settings.getDependencyLibs()) {
ICLibraryPathEntry libraryPath = createLibraryPathEntry(lib.getDirectory().getPath(), 0);
libraryPathEntries.add(libraryPath);
}
for (final NarLib lib : settings.getLinkerSettings().getLibs()) {
ICLibraryPathEntry libraryPath = createLibraryPathEntry(lib.getDirectory().getPath(), 0);
libraryPathEntries.add(libraryPath);
}
for (final ICLanguageSetting setting : languageSettings) {
final List<ICLanguageSettingEntry> l = setting.getSettingEntriesList(ICSettingEntry.LIBRARY_PATH);
l.clear();
l.addAll(libraryPathEntries);
setting.setSettingEntries(ICSettingEntry.LIBRARY_PATH, l);
}
}
use of com.github.sdedwards.m2e_nar.internal.model.NarLib in project m2e-nar by maven-nar.
the class NarExecutionBuilder method buildLibSettings.
public NarLib buildLibSettings(final ILib lib) {
logger.debug("NAR library: " + lib.getName());
NarLib settings = new NarLib();
settings.setName(lib.getName());
settings.setType(lib.getType());
settings.setDirectory(lib.getDirectory());
return settings;
}
use of com.github.sdedwards.m2e_nar.internal.model.NarLib in project m2e-nar by maven-nar.
the class NarExecutionBuilder method buildArtifactSettings.
@SuppressWarnings("unchecked")
private NarBuildArtifact buildArtifactSettings(final String type, final String buildType, final boolean linkCPP, final ITest test) throws MojoExecutionException, MojoFailureException {
NarBuildArtifact settings = new NarBuildArtifact();
settings.setType(type);
List<String> projectRefs = settings.getProjectReferences();
List<com.github.maven_nar.NarArtifact> narArtifacts = narCompileMojo.getNarArtifacts();
for (com.github.maven_nar.NarArtifact artifact : narArtifacts) {
if (artifact.getNarLayout() instanceof EclipseNarLayout) {
EclipseNarLayout layout = (EclipseNarLayout) artifact.getNarLayout();
projectRefs.add(layout.getProject().getProject().getName());
}
}
settings.setLinkerSettings(buildLinkerSettings(narCompileMojo.getLinker(), linkCPP, test));
settings.setCppSettings(buildCompilerSettings(narCompileMojo.getCpp(), buildType, test));
settings.setCSettings(buildCompilerSettings(narCompileMojo.getC(), buildType, test));
List<String> javahIncludePaths = settings.getJavahIncludePaths();
javahIncludePaths.addAll(narCompileMojo.getJavahIncludePaths());
List<String> javaIncludePaths = settings.getJavaIncludePaths();
javaIncludePaths.addAll(narCompileMojo.getJavaIncludePaths());
List<File> dependencyIncludePaths = settings.getDependencyIncludePaths();
logger.debug("include paths size " + narCompileMojo.getDependencyIncludePaths().size());
dependencyIncludePaths.addAll(narCompileMojo.getDependencyIncludePaths());
List<NarLib> dependencyLibs = settings.getDependencyLibs();
logger.debug("library size " + narCompileMojo.getDependencyLibs(type, test).size());
for (Iterator<?> it = narCompileMojo.getDependencyLibs(type, test).iterator(); it.hasNext(); ) {
dependencyLibs.add(buildLibSettings((ILib) it.next()));
}
List<NarSysLib> dependencySysLibs = settings.getDependencySysLibs();
for (Iterator<?> it = narCompileMojo.getDependencySysLibs(type).iterator(); it.hasNext(); ) {
dependencySysLibs.add(buildSysLibSettings((ISysLib) it.next()));
}
List<String> dependencyOptions = settings.getDependencyOptions();
dependencyOptions.addAll(narCompileMojo.getDependencyOptions(type));
return settings;
}
Aggregations