Package com.github.maven_nar.cpptasks

Examples of com.github.maven_nar.cpptasks.CompilerDef


    RuntimeType runtimeType = new RuntimeType();
    runtimeType.setValue(getRuntime(getAOL()));
    task.setRuntime(runtimeType);

    // add C++ compiler
    CompilerDef cpp = getCpp().getCompiler(Compiler.MAIN,null);
    if (cpp != null) {
      task.addConfiguredCompiler(cpp);
    }
   
    // add VCPROJ_MOJO def (see UnitTestDriverImpl.cpp generated by Krusoe plugin)
    DefineSet defineSet = new DefineSet();
    DefineArgument defineArgument = new DefineArgument();
    defineArgument.setName("VCPROJ_MOJO");
    defineSet.addDefine(defineArgument);
    cpp.addConfiguredDefineset(defineSet);
   
   
    // add javah include path
    File jniDirectory = getJavah().getJniDirectory();
    if (jniDirectory.exists()) {
View Full Code Here


  /**
   * Tests that the classname attribute in the base compiler is effective.
   */
  public void testExtendsClassname() {
    CompilerDef baseCompiler = new CompilerDef();
    baseCompiler
        .setClassname(
      "com.github.maven_nar.cpptasks.devstudio.DevStudioCCompiler");
    CompilerDef extendedCompiler = (CompilerDef) createExtendedProcessorDef(
        baseCompiler);
    extendedCompiler.setExceptions(true);
    String[] preArgs = getPreArguments(extendedCompiler);
    assertEquals("/EHsc", preArgs[2]);
  }
View Full Code Here

   * Creates a new processor.
   *
   * @return new processor
   */
  protected ProcessorDef create() {
    return new CompilerDef();
  }
View Full Code Here

   * "debug" property defined. Return value from getActiveDefines should
   * contain one member
   */
  public void testGetActiveDefines() {
    Project project = new org.apache.tools.ant.Project();
    CompilerDef def = new CompilerDef();
    def.setProject(project);
    DefineSet defset = new DefineSet();
    DefineArgument arg1 = new DefineArgument();
    arg1.setName("DEBUG");
    arg1.setIf("debug");
    defset.addDefine(arg1);
    DefineArgument arg2 = new DefineArgument();
    arg2.setName("NDEBUG");
    arg2.setUnless("debug");
    defset.addDefine(arg2);
    def.addConfiguredDefineset(defset);
    //
    //  Evaluate without "debug" set
    //
    UndefineArgument[] activeArgs = def.getActiveDefines();
    assertEquals(1, activeArgs.length);
    assertEquals("NDEBUG", activeArgs[0].getName());
    //
    //  Set the "debug" property
    //
    project.setProperty("debug", "");
    activeArgs = def.getActiveDefines();
    assertEquals(1, activeArgs.length);
    assertEquals("DEBUG", activeArgs[0].getName());
  }
View Full Code Here

   *
   * and is evaluate for a project without and without "debug" set
   */
  public void testGetActiveIncludePaths() {
    Project project = new org.apache.tools.ant.Project();
    CompilerDef def = new CompilerDef();
    def.setProject(project);
    ConditionalPath path = def.createIncludePath();
    path.setLocation(new File(".."));
    path.setIf("debug");
    //
    //  Evaluate without "debug" set
    //
    String[] includePaths = def.getActiveIncludePaths();
    assertEquals(0, includePaths.length);
    //
    //  Set the "debug" property
    //
    project.setProperty("debug", "");
    includePaths = def.getActiveIncludePaths();
    assertEquals(1, includePaths.length);
  }
View Full Code Here

  /**
   * Tests that setting classname to the Gcc compiler is effective.
   */
  public void testGetGcc() {
    CompilerDef compilerDef = (CompilerDef) create();
    compilerDef.setClassname("com.github.maven_nar.cpptasks.gcc.GccCCompiler");
    Compiler comp = (Compiler) compilerDef.getProcessor();
    assertNotNull(comp);
    assertSame(GccCCompiler.getInstance(), comp);
  }
View Full Code Here

  /**
   * Tests that setting classname to the MSVC compiler is effective.
   */
  public void testGetMSVC() {
    CompilerDef compilerDef = (CompilerDef) create();
    compilerDef
        .setClassname(
      "com.github.maven_nar.cpptasks.devstudio.DevStudioCCompiler");
    Compiler comp = (Compiler) compilerDef.getProcessor();
    assertNotNull(comp);
    assertSame(DevStudioCCompiler.getInstance(), comp);
  }
View Full Code Here

  /**
   * Tests that setting classname to an bogus class name results in a
   * BuildException.
   */
  public void testUnknownClass() {
    CompilerDef compilerDef = (CompilerDef) create();
    try {
      compilerDef
          .setClassname("com.github.maven_nar.cpptasks.bogus.BogusCompiler");
    } catch (BuildException ex) {
      return;
    }
    fail("Exception not thrown");
View Full Code Here

   * Test that setting classname to a class that doesn't support Compiler
   * throws a BuildException.
   *
   */
  public void testWrongType() {
    CompilerDef compilerDef = (CompilerDef) create();
    try {
      compilerDef
          .setClassname("com.github.maven_nar.cpptasks.devstudio.DevStudioLinker");
    } catch (BuildException ex) {
      return;
    }
    fail("Exception not thrown");
View Full Code Here

   * Tests if the rebuild attribute of the base compiler definition is
   * effective.
   *
   */
  public void testExtendsRebuild() {
    testExtendsRebuild(new CompilerDef());
  }
View Full Code Here

TOP

Related Classes of com.github.maven_nar.cpptasks.CompilerDef

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.