Search in sources :

Example 1 with NarSysLib

use of com.github.sdedwards.m2e_nar.internal.model.NarSysLib 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;
}
Also used : NarLib(com.github.sdedwards.m2e_nar.internal.model.NarLib) NarSysLib(com.github.sdedwards.m2e_nar.internal.model.NarSysLib) ISysLib(com.github.maven_nar.ISysLib) NarLinker(com.github.sdedwards.m2e_nar.internal.model.NarLinker) ILib(com.github.maven_nar.ILib)

Example 2 with NarSysLib

use of com.github.sdedwards.m2e_nar.internal.model.NarSysLib 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;
}
Also used : NarLib(com.github.sdedwards.m2e_nar.internal.model.NarLib) NarSysLib(com.github.sdedwards.m2e_nar.internal.model.NarSysLib) ISysLib(com.github.maven_nar.ISysLib) NarBuildArtifact(com.github.sdedwards.m2e_nar.internal.model.NarBuildArtifact) EclipseNarLayout(com.github.maven_nar.EclipseNarLayout) File(java.io.File) ILib(com.github.maven_nar.ILib)

Example 3 with NarSysLib

use of com.github.sdedwards.m2e_nar.internal.model.NarSysLib in project m2e-nar by maven-nar.

the class NarExecutionBuilder method buildSysLibSettings.

public NarSysLib buildSysLibSettings(final ISysLib syslib) {
    logger.debug("NAR sys library: " + syslib.getName());
    NarSysLib settings = new NarSysLib();
    settings.setName(syslib.getName());
    settings.setType(syslib.getType());
    return settings;
}
Also used : NarSysLib(com.github.sdedwards.m2e_nar.internal.model.NarSysLib)

Example 4 with NarSysLib

use of com.github.sdedwards.m2e_nar.internal.model.NarSysLib in project m2e-nar by maven-nar.

the class AbstractSettingsSynchroniser method setLibraries.

private void setLibraries(final ICConfigurationDescription conf, final NarBuildArtifact settings) throws CoreException {
    final ICLanguageSetting[] languageSettings = conf.getRootFolderDescription().getLanguageSettings();
    final List<ICLibraryFileEntry> libraryEntries = new ArrayList<ICLibraryFileEntry>();
    for (final NarLib lib : settings.getDependencyLibs()) {
        final ICLibraryFileEntry library = CDataUtil.createCLibraryFileEntry(lib.getName(), 0);
        libraryEntries.add(library);
    }
    for (final NarSysLib syslib : settings.getDependencySysLibs()) {
        final ICLibraryFileEntry library = CDataUtil.createCLibraryFileEntry(syslib.getName(), 0);
        libraryEntries.add(library);
    }
    for (final NarLib lib : settings.getLinkerSettings().getLibs()) {
        final ICLibraryFileEntry library = CDataUtil.createCLibraryFileEntry(lib.getName(), 0);
        libraryEntries.add(library);
    }
    for (final NarSysLib syslib : settings.getLinkerSettings().getSysLibs()) {
        final ICLibraryFileEntry library = CDataUtil.createCLibraryFileEntry(syslib.getName(), 0);
        libraryEntries.add(library);
    }
    /*
		 * for (String path : settings.getLibraries()) { ICLibraryFileEntry
		 * library = CDataUtil.createCLibraryFileEntry(lib, 0);
		 * libraryPathEntries.add(library); }
		 */
    for (final ICLanguageSetting setting : languageSettings) {
        final List<ICLanguageSettingEntry> l = setting.getSettingEntriesList(ICSettingEntry.LIBRARY_FILE);
        l.clear();
        l.addAll(libraryEntries);
        setting.setSettingEntries(ICSettingEntry.LIBRARY_FILE, l);
    }
}
Also used : ICLibraryFileEntry(org.eclipse.cdt.core.settings.model.ICLibraryFileEntry) NarLib(com.github.sdedwards.m2e_nar.internal.model.NarLib) ICLanguageSettingEntry(org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry) NarSysLib(com.github.sdedwards.m2e_nar.internal.model.NarSysLib) ArrayList(java.util.ArrayList) ICLanguageSetting(org.eclipse.cdt.core.settings.model.ICLanguageSetting)

Aggregations

NarSysLib (com.github.sdedwards.m2e_nar.internal.model.NarSysLib)4 NarLib (com.github.sdedwards.m2e_nar.internal.model.NarLib)3 ILib (com.github.maven_nar.ILib)2 ISysLib (com.github.maven_nar.ISysLib)2 EclipseNarLayout (com.github.maven_nar.EclipseNarLayout)1 NarBuildArtifact (com.github.sdedwards.m2e_nar.internal.model.NarBuildArtifact)1 NarLinker (com.github.sdedwards.m2e_nar.internal.model.NarLinker)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 ICLanguageSetting (org.eclipse.cdt.core.settings.model.ICLanguageSetting)1 ICLanguageSettingEntry (org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry)1 ICLibraryFileEntry (org.eclipse.cdt.core.settings.model.ICLibraryFileEntry)1