Package com.github.maven_nar.cpptasks.types

Examples of com.github.maven_nar.cpptasks.types.LibrarySet


            Vector<String> preargs, Vector<String> midargs, Vector<String> endargs) {
        Vector<String> libnames = new Vector<String>();
        super.addLibrarySets(task, libsets, preargs, midargs, endargs);
        LibraryTypeEnum previousLibraryType = null;
        for (int i = 0; i < libsets.length; i++) {
            LibrarySet set = libsets[i];
            File libdir = set.getDir(null);
            String[] libs = set.getLibs();
            if (libdir != null) {
                    String relPath = libdir.getAbsolutePath();
                    //File outputFile = task.getOutfile();
                    File currentDir = new File(".");
                    if (currentDir != null && currentDir.getParentFile() != null) {
                        relPath = CUtil.getRelativePath(
                            currentDir.getParentFile().getAbsolutePath(), libdir);
                    }
                    if (set.getType() != null &&
                                    "framework".equals(set.getType().getValue()) &&
                                                isDarwin()) {
                            endargs.addElement("-F" + relPath);
                    } else {
                            endargs.addElement("-L" + relPath);
                    }
            }
            //
            //  if there has been a change of library type
            //
            if (set.getType() != previousLibraryType) {
                    if (set.getType() != null && "static".equals(set.getType().getValue())) {
// BEGINFREEHEP not on MacOS X
                      if (!isDarwin()) {
                            endargs.addElement(getStaticLibFlag());
                            previousLibraryType = set.getType();
                      }
//ENDFREEHEP                         
                    } else {
// FREEHEP not on MacOS X, recheck this!
                            if (set.getType() == null ||
                                            !"framework".equals(set.getType().getValue()) &&
                                                        !isDarwin()) {
                                    endargs.addElement(getDynamicLibFlag());
                                    previousLibraryType = set.getType();
                            }
                    }
            }
            StringBuffer buf = new StringBuffer("-l");
            if (set.getType() != null &&
                            "framework".equals(set.getType().getValue()) &&
                                        isDarwin()) {
                    buf.setLength(0);
// FREEHEP, added as endarg w/o trailing space to avoid quoting!
                    endargs.addElement("-framework");
            }
View Full Code Here


    public String[] addLibrarySets(CCTask task, LibrarySet[] libsets,
            Vector preargs, Vector midargs, Vector endargs) {
        super.addLibrarySets(task, libsets, preargs, midargs, endargs);
        StringBuffer buf = new StringBuffer("-l");
        for (int i = 0; i < libsets.length; i++) {
            LibrarySet set = libsets[i];
            File libdir = set.getDir(null);
            String[] libs = set.getLibs();
            if (libdir != null) {
                endargs.addElement("-L");
                endargs.addElement(libdir.getAbsolutePath());
            }
            for (int j = 0; j < libs.length; j++) {
View Full Code Here

    }
    private void addActiveLibrarySet(Project project, Vector libsets,
            Vector srcSets) {
        Enumeration srcenum = srcSets.elements();
        while (srcenum.hasMoreElements()) {
            LibrarySet set = (LibrarySet) srcenum.nextElement();
            if (set.isActive(project)) {
                libsets.addElement(set);
            }
        }
    }
View Full Code Here

                extendsDef.visitSystemLibraries(linker, libraryVisitor);
            }
            if (sysLibrarySets.size() > 0) {
                File[] libpath = linker.getLibraryPath();
                for (int i = 0; i < sysLibrarySets.size(); i++) {
                    LibrarySet set = (LibrarySet) sysLibrarySets.elementAt(i);
                    if (set.isActive(p)) {
                        set.visitLibraries(p, linker, libpath,
                                libraryVisitor);
                    }
                }
            }
        }
View Full Code Here

            //   visit the user libraries
            //
            if (librarySets.size() > 0) {
                File[] libpath = linker.getLibraryPath();
                for (int i = 0; i < librarySets.size(); i++) {
                    LibrarySet set = (LibrarySet) librarySets.elementAt(i);
                    if (set.isActive(p)) {
                        set.visitLibraries(p, linker, libpath,
                                libraryVisitor);
                    }
                }
            }
        }
View Full Code Here

   * Tests that libset's that appear in the base linker are effective when
   * creating the command line for a linker that extends it.
   */
  public void testExtendsLibSet() {
    LinkerDef baseLinker = new LinkerDef();
    LibrarySet libset = new LibrarySet();
    LinkerDef extendedLinker = (LinkerDef) createExtendedProcessorDef(
        baseLinker);
    libset.setProject(baseLinker.getProject());
    CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder("advapi32");
    libset.setLibs(libs);
    baseLinker.addLibset(libset);
    CommandLineLinkerConfiguration config = (CommandLineLinkerConfiguration)
        getConfiguration(extendedLinker);
    String[] libnames = config.getLibraryNames();
    assertEquals(1, libnames.length);
View Full Code Here

  /**
   * Evaluate isActive when "if" specifies a property that is set.
   */
  public final void testIsActive1() {
    LibrarySet libset = new LibrarySet();
    Project project = new Project();
    project.setProperty("windows", "");
    libset.setProject(project);
    libset.setIf("windows");
    CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder("kernel32");
    libset.setLibs(libs);
    boolean isActive = libset.isActive(project);
    assertTrue(isActive);
  }
View Full Code Here

   * Evaluate isActive when "if" specifies a property whose value suggests the
   * user thinks the value is significant.
   *
   */
  public final void testIsActive2() {
    LibrarySet libset = new LibrarySet();
    Project project = new Project();
    //
    // setting the value to false should throw
    //    exception to warn user that they are misusing if
    //
    project.setProperty("windows", "false");
    libset.setIf("windows");
    try {
      boolean isActive = libset.isActive(project);
    } catch (BuildException ex) {
      return;
    }
    fail();
  }
View Full Code Here

  /**
   * Evaluate isActive when "if" specifies a property that is not set.
   */
  public final void testIsActive3() {
    LibrarySet libset = new LibrarySet();
    Project project = new Project();
    libset.setIf("windows");
    boolean isActive = libset.isActive(project);
    assertTrue(!isActive);
  }
View Full Code Here

  /**
   * Evaluate isActive when "unless" specifies a property that is set.
   *
   */
  public final void testIsActive4() {
    LibrarySet libset = new LibrarySet();
    Project project = new Project();
    project.setProperty("windows", "");
    libset.setUnless("windows");
    boolean isActive = libset.isActive(project);
    assertTrue(!isActive);
  }
View Full Code Here

TOP

Related Classes of com.github.maven_nar.cpptasks.types.LibrarySet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.