alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (FscSettings.scala)

This example Scala source code file (FscSettings.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

boolean, booleansetting, booleansetting, fscsettings, ipv6, pathsetting, set, set, setting, string, string, stringsetting, stringsetting, ygenjavap

The Scala FscSettings.scala source code

/* NSC -- new Scala compiler
 * Copyright 2005-2011 LAMP/EPFL
 * @author  Paul Phillips
 */

package scala.tools
package nsc
package settings

import util.ClassPath
import io.{ Directory, Path, AbstractFile }

class FscSettings(error: String => Unit) extends Settings(error) {
  outer =>
  
  locally {
    disable(prompt)
    disable(resident)
  }
  
  val currentDir   = StringSetting ("-current-dir", "path", "Base directory for resolving relative paths", "").internalOnly()
  val reset        = BooleanSetting("-reset",    "Reset compile server caches")
  val shutdown     = BooleanSetting("-shutdown", "Shutdown compile server")
  val server       = StringSetting ("-server",   "hostname:portnumber", "Specify compile server socket", "")
  val preferIPv4   = BooleanSetting("-ipv4",     "Use IPv4 rather than IPv6 for the server socket")
  val idleMins     = IntSetting    ("-max-idle", "Set idle timeout in minutes for fsc (use 0 for no timeout)",
                                              30, Some(0, Int.MaxValue), (_: String) => None)

  // For improved help output, separating fsc options from the others.
  def fscSpecific = Set[Settings#Setting](
    currentDir, reset, shutdown, server, preferIPv4, idleMins
  )
  val isFscSpecific: String => Boolean = fscSpecific map (_.name)

  /** If a setting (other than a PathSetting) represents a path or paths.
   *  For use in absolutization.
   */
  private def holdsPath = Set[Settings#Setting](
    d, dependencyfile, pluginsDir, Ygenjavap
  )

  /** All user set settings rewritten with absolute paths. */
  def absolutize(root: Path) {
    def rewrite(p: String) = (root resolve Path(p)).normalize.path
    userSetSettings foreach {
      case p: OutputSetting => p.outputDirs setSingleOutput AbstractFile.getDirectory(rewrite(p.value))
      case p: PathSetting   => p.value = ClassPath.map(p.value, rewrite)
      case p: StringSetting => if (holdsPath(p)) p.value = rewrite(p.value)
      case _                => ()
    }
  }
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala FscSettings.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

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.