Java Code Examples for org.apache.tools.ant.Project#toBoolean()

The following examples show how to use org.apache.tools.ant.Project#toBoolean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MakeLNBM.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Returns true if either a manifest or a module must be specified.
  * This is true unless either the global property
  * makenbm.manOrModReq is false, or the manOrModReq attribute of
  * this task is false.  The attribute, if set, has priority over the
  * global property.
  */
 public boolean reqManOrMod() {
   boolean req = true ;

   if( manOrModReqSet) {
     req = manOrModReq ;
   }
   else {
     String s = getProject().getProperty("makenbm.manOrModReq"); //NOI18N
     if( s != null && !s.equals( "")) { //NOI18N
req = Project.toBoolean(s);
     }
   }

   return( req) ;
 }
 
Example 2
Source File: GenerateJnlpFileTask.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static Set<? extends File> getLazyJarsSet(final Project prj, final List<? extends File> runCp, final Path value) {
    final Set<File> result = new HashSet<File>();
    if (value != null) {
        for (String pathElement : value.list()) {
            result.add(prj.resolveFile(pathElement));
        }
    }
    for (File re : runCp) {
        if (Project.toBoolean(prj.getProperty(String.format(JNLP_LAZY_FORMAT, re.getName())))) {
            result.add(re);
        }
    }
    return result;
}
 
Example 3
Source File: MakeNBM.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public org.w3c.dom.Text getTextNode(Document ownerDoc) {
           // XXX Current XMLUtil.write anyway does not preserve CDATA sections, it seems.
           String nocdata = getProject().getProperty("makenbm.nocdata");
           if (nocdata != null && Project.toBoolean(nocdata)) {
               return ownerDoc.createTextNode(text.toString());
           } else {
               return ownerDoc.createCDATASection(text.toString());
           }
}
 
Example 4
Source File: MakeLNBM.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public String getText () {
           String nocdata = getProject().getProperty("makenbm.nocdata"); //NOI18N
           if (nocdata != null && Project.toBoolean(nocdata)) {
               return xmlEscape(text.toString());
           } else {
               return "<![CDATA[" + text.toString () + "]]>"; //NOI18N
           }
}
 
Example 5
Source File: JarWithModuleAttributes.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void specVersBaseWarning(File manifestFile, String message) throws BuildException {
    message = manifestFile + ": " + message + "\n(see http://wiki.netbeans.org/DevFaqImplementationDependency)" +
            "\n(define spec.version.base.fatal.warning=false in project.properties to make this be a nonfatal warning)";
    if (Project.toBoolean(getProject().getProperty("spec.version.base.fatal.warning"))) {
        throw new BuildException(message);
    } else {
        log(message, Project.MSG_WARN);
    }
}
 
Example 6
Source File: ParseProjectXml.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private File computeClasspathModuleLocation(ModuleListParser modules, String cnb,
        Set<File> clusterPath, Set<String> excludedModules, boolean runtime) throws BuildException {
    ModuleListParser.Entry module = modules.findByCodeNameBase(cnb);
    if (module == null && cnb.contains("-")) {
        final String alternativeCnb = cnb.replace('-', '_');
        module = modules.findByCodeNameBase(alternativeCnb);
        if (module != null) {
            cnb = alternativeCnb;
        }
    }
    if (module == null) {
        throw new BuildException("No dependent module " + cnb, getLocation());
    }
    File jar = module.getJar();
    if (jar == null) return null;

    OK: if (module.getClusterName() != null && clusterPath != null) {
        File clusterF = jar.getParentFile();
        while (clusterF != null) {
            if (clusterPath.contains(clusterF)) {
                break OK;
            }
            clusterF = clusterF.getParentFile();
        }
        String msg = "The module " + cnb + " cannot be " + (runtime ? "run" : "compiled") +
                " against because it is part of the cluster " +
                jar.getParentFile().getParentFile() + " which is not part of cluster.path in your suite configuration.\n\n" +
                "Cluster.path is: " + clusterPath;
        throw new BuildException(msg, getLocation());
    }
    if (excludedModules != null && excludedModules.contains(cnb)) { // again #68716
        throw new BuildException("Module " + cnb + " excluded from the target platform", getLocation());
    }
    if (!jar.isFile()) {
        File srcdir = module.getSourceLocation();
        if (Project.toBoolean(getProject().getProperty(DO_NOT_RECURSE))) {
            log(jar + " missing for " + moduleProject + " but will not first try to build " + srcdir, Project.MSG_VERBOSE);
            return jar;
        }
        if (srcdir != null && srcdir.isDirectory()) {
            log(jar + " missing for " + moduleProject + "; will first try to build " + srcdir, Project.MSG_WARN);
            Ant ant = new Ant();
            ant.setProject(getProject());
            ant.setOwningTarget(getOwningTarget());
            ant.setLocation(getLocation());
            ant.setInheritAll(false);
            ant.setDir(srcdir);
            ant.execute();
        }
    }
    if (!jar.isFile()) {
        throw new BuildException("No such classpath entry: " + jar, getLocation());
    }
    return jar;
}
 
Example 7
Source File: BridgeImpl.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public boolean toBoolean(String val) {
    return Project.toBoolean(val);
}
 
Example 8
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setOnlyBinaryIncompatible(String onlyBinaryIncompatible) {
	this.onlyBinaryIncompatible = Project.toBoolean(onlyBinaryIncompatible);
}
 
Example 9
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setOnlyModified(String onlyModified) {
	this.onlyModified = Project.toBoolean(onlyModified);
}
 
Example 10
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setIncludeSynthetic(String includeSynthetic) {
	this.includeSynthetic = Project.toBoolean(includeSynthetic);
}
 
Example 11
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setNoAnnotations(String noAnnotations) {
	this.noAnnotations = Project.toBoolean(noAnnotations);
}
 
Example 12
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setSemanticVersioning(String semanticVersioning) {
	this.semanticVersioning = Project.toBoolean(semanticVersioning);
}
 
Example 13
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setReportOnlyFilename(String reportOnlyFilename) {
	this.reportOnlyFilename = Project.toBoolean(reportOnlyFilename);
}
 
Example 14
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setIgnoreMissingClasses(String ignoreMissingClasses) {
	this.ignoreMissingClasses = Project.toBoolean(ignoreMissingClasses);
}
 
Example 15
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setIncludeExclusively(String includeExclusively) {
	this.includeExclusively = Project.toBoolean(includeExclusively);
}
 
Example 16
Source File: JApiCmpTask.java    From japicmp with Apache License 2.0 4 votes vote down vote up
public void setExcludeExclusively(String excludeExclusively) {
	this.excludeExclusively = Project.toBoolean(excludeExclusively);
}