|
Scala example source code file (Scaladoc.scala)
The Scala Scaladoc.scala source code/* __ *\ ** ________ ___ / / ___ Scala Ant Tasks ** ** / __/ __// _ | / / / _ | (c) 2005-2011, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ package scala.tools.ant import java.io.File import org.apache.tools.ant.{BuildException, Project} import org.apache.tools.ant.types.{Path, Reference} import org.apache.tools.ant.util.{FileUtils, GlobPatternMapper} import scala.tools.nsc.Global import scala.tools.nsc.doc.Settings import scala.tools.nsc.reporters.{Reporter, ConsoleReporter} /** <p> * An Ant task to document Scala code. * </p> * <p> * This task can take the following parameters as attributes: * </p> * <ul> * <li>srcdir (mandatory), * <li>srcref, * <li>destdir, * <li>classpath, * <li>classpathref, * <li>sourcepath, * <li>sourcepathref, * <li>bootclasspath, * <li>bootclasspathref, * <li>extdirs, * <li>extdirsref, * <li>encoding, * <li>doctitle, * <li>header, * <li>footer, * <li>top, * <li>bottom, * <li>addparams, * <li>deprecation, * <li>docgenerator, * <li>unchecked. * </ul> * <p> * It also takes the following parameters as nested elements: * </p> * <ul> * <li>src (for srcdir), * <li>classpath, * <li>sourcepath, * <li>bootclasspath, * <li>extdirs. * </ul> * * @author Gilles Dubochet, Stephane Micheloud */ class Scaladoc extends ScalaMatchingTask { /** The unique Ant file utilities instance to use in this task. */ private val fileUtils = FileUtils.getFileUtils() /*============================================================================*\ ** Ant user-properties ** \*============================================================================*/ abstract class PermissibleValue { val values: List[String] def isPermissible(value: String): Boolean = (value == "") || values.exists(_.startsWith(value)) } /** Defines valid values for the <code>deprecation and * <code>unchecked properties. */ object Flag extends PermissibleValue { val values = List("yes", "no", "on", "off") } /** The directories that contain source files to compile. */ private var origin: Option[Path] = None /** The directory to put the compiled files in. */ private var destination: Option[File] = None /** The class path to use for this compilation. */ private var classpath: Option[Path] = None /** The source path to use for this compilation. */ private var sourcepath: Option[Path] = None /** The boot class path to use for this compilation. */ private var bootclasspath: Option[Path] = None /** The external extensions path to use for this compilation. */ private var extdirs: Option[Path] = None /** The character encoding of the files to compile. */ private var encoding: Option[String] = None /** The fully qualified name of a doclet class, which will be used to generate the documentation. */ private var docgenerator: Option[String] = None /** The document title of the generated HTML documentation. */ private var doctitle: Option[String] = None /** The document version, to be added to the title. */ private var docversion: Option[String] = None /** Instruct the compiler to generate links to sources */ private var docsourceurl: Option[String] = None /** Point scaladoc at uncompilable sources. */ private var docUncompilable: Option[String] = None /** Instruct the compiler to use additional parameters */ private var addParams: String = "" /** Instruct the compiler to generate deprecation information. */ private var deprecation: Boolean = false /** Instruct the compiler to generate unchecked information. */ private var unchecked: Boolean = false /*============================================================================*\ ** Properties setters ** \*============================================================================*/ /** Sets the <code>srcdir attribute. Used by Ant. * * @param input The value of <code>origin. */ def setSrcdir(input: Path) { if (origin.isEmpty) origin = Some(input) else origin.get.append(input) } /** Sets the <code>origin as a nested src Ant parameter. * * @return An origin path to be configured. */ def createSrc(): Path = { if (origin.isEmpty) origin = Some(new Path(getProject())) origin.get.createPath() } /** Sets the <code>origin as an external reference Ant parameter. * * @param input A reference to an origin path. */ def setSrcref(input: Reference) { createSrc().setRefid(input) } /** Sets the <code>destdir attribute. Used by Ant. * * @param input The value of <code>destination. */ def setDestdir(input: File) { destination = Some(input) } /** Sets the <code>classpath attribute. Used by Ant. * * @param input The value of <code>classpath. */ def setClasspath(input: Path) { if (classpath.isEmpty) classpath = Some(input) else classpath.get.append(input) } /** Sets the <code>classpath as a nested classpath Ant parameter. * * @return A class path to be configured. */ def createClasspath(): Path = { if (classpath.isEmpty) classpath = Some(new Path(getProject())) classpath.get.createPath() } /** Sets the <code>classpath as an external reference Ant parameter. * * @param input A reference to a class path. */ def setClasspathref(input: Reference) = createClasspath().setRefid(input) /** Sets the <code>sourcepath attribute. Used by Ant. * * @param input The value of <code>sourcepath. */ def setSourcepath(input: Path) = if (sourcepath.isEmpty) sourcepath = Some(input) else sourcepath.get.append(input) /** Sets the <code>sourcepath as a nested sourcepath Ant parameter. * * @return A source path to be configured. */ def createSourcepath(): Path = { if (sourcepath.isEmpty) sourcepath = Some(new Path(getProject())) sourcepath.get.createPath() } /** Sets the <code>sourcepath as an external reference Ant parameter. * * @param input A reference to a source path. */ def setSourcepathref(input: Reference) = createSourcepath().setRefid(input) /** Sets the <code>bootclasspath attribute. Used by Ant. * * @param input The value of <code>bootclasspath. */ def setBootclasspath(input: Path) = if (bootclasspath.isEmpty) bootclasspath = Some(input) else bootclasspath.get.append(input) /** Sets the <code>bootclasspath as a nested sourcepath Ant * parameter. * * @return A source path to be configured. */ def createBootclasspath(): Path = { if (bootclasspath.isEmpty) bootclasspath = Some(new Path(getProject())) bootclasspath.get.createPath() } /** Sets the <code>bootclasspath as an external reference Ant * parameter. * * @param input A reference to a source path. */ def setBootclasspathref(input: Reference) { createBootclasspath().setRefid(input) } /** Sets the external extensions path attribute. Used by Ant. * * @param input The value of <code>extdirs. */ def setExtdirs(input: Path) { if (extdirs.isEmpty) extdirs = Some(input) else extdirs.get.append(input) } /** Sets the <code>extdirs as a nested sourcepath Ant parameter. * * @return An extensions path to be configured. */ def createExtdirs(): Path = { if (extdirs.isEmpty) extdirs = Some(new Path(getProject())) extdirs.get.createPath() } /** Sets the <code>extdirs as an external reference Ant parameter. * * @param input A reference to an extensions path. */ def setExtdirsref(input: Reference) { createExtdirs().setRefid(input) } /** Sets the <code>encoding attribute. Used by Ant. * * @param input The value of <code>encoding. */ def setEncoding(input: String) { encoding = Some(input) } /** Sets the <code>docgenerator attribute. * * @param input A fully qualified class name of a doclet. */ def setDocgenerator(input: String) { docgenerator = Some(input) } /** Sets the <code>docversion attribute. * * @param input The value of <code>docversion. */ def setDocversion(input: String) { docversion = Some(input) } /** Sets the <code>docsourceurl attribute. * * @param input The value of <code>docsourceurl. */ def setDocsourceurl(input: String) { docsourceurl = Some(input) } /** Sets the <code>doctitle attribute. * * @param input The value of <code>doctitle. */ def setDoctitle(input: String) { doctitle = Some(input) } /** Set the <code>addparams info attribute. * * @param input The value for <code>addparams. */ def setAddparams(input: String) { addParams = input } /** Set the <code>deprecation info attribute. * * @param input One of the flags <code>yes/no or Other Scala examples (source code examples)Here is a short list of links related to this Scala Scaladoc.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.