moved plugin folder back to 'misc/scala-devel/plugins'. moved bash completion to scala-tool-support (see r21449). include continuations in compiler sbaz package. replaced some tabs by spaces. review by extempore.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@21452 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
rytz 2010-04-11 19:11:40 +00:00
parent f44dd8fdee
commit e1f441a666
4 changed files with 47 additions and 190 deletions

View File

@ -623,15 +623,15 @@ QUICK BUILD (QUICK)
file="${src.dir}/continuations/plugin/scalac-plugin.xml"
todir="${build-quick.dir}/classes/continuations-plugin"/>
<!-- not very nice to create jar here but needed to load plugin -->
<mkdir dir="${build-quick.dir}/plugins"/>
<jar destfile="${build-quick.dir}/plugins/continuations.jar">
<mkdir dir="${build-quick.dir}/misc/scala-devel/plugins"/>
<jar destfile="${build-quick.dir}/misc/scala-devel/plugins/continuations.jar">
<fileset dir="${build-quick.dir}/classes/continuations-plugin"/>
</jar>
<!-- might split off library part into its own ant target -->
<scalacfork
destdir="${build-quick.dir}/classes/library"
compilerpathref="locker.classpath"
params="${scalac.args.quick} -Xpluginsdir ${build-quick.dir}/plugins -Xplugin-require:continuations -P:continuations:enable"
params="${scalac.args.quick} -Xpluginsdir ${build-quick.dir}/misc/scala-devel/plugins -Xplugin-require:continuations -P:continuations:enable"
srcdir="${src.dir}/continuations/library"
jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
@ -852,13 +852,13 @@ PACKED QUICK BUILD (PACK)
<target name="pack.pre-plugins" depends="pack.comp">
<uptodate
property="pack.plugins.available"
targetfile="${build-pack.dir}/plugins/continuations.jar"
targetfile="${build-pack.dir}/misc/scala-devel/plugins/continuations.jar"
srcfile="${build-quick.dir}/plugins.complete"/>
</target>
<target name="pack.plugins" depends="pack.pre-plugins" unless="pack.plugins.available">
<mkdir dir="${build-pack.dir}/plugins"/>
<jar destfile="${build-pack.dir}/plugins/continuations.jar">
<mkdir dir="${build-pack.dir}/misc/scala-devel/plugins"/>
<jar destfile="${build-pack.dir}/misc/scala-devel/plugins/continuations.jar">
<fileset dir="${build-quick.dir}/classes/continuations-plugin"/>
</jar>
</target>
@ -933,15 +933,6 @@ PACKED QUICK BUILD (PACK)
<chmod perm="ugo+rx" file="${build-pack.dir}/bin/scaladoc"/>
<chmod perm="ugo+rx" file="${build-pack.dir}/bin/fsc"/>
<chmod perm="ugo+rx" file="${build-pack.dir}/bin/scalap"/>
<mkdir dir="${build-pack.dir}/etc"/>
<exec osfamily="unix" executable="${build-pack.dir}/bin/scala" output="${build-pack.dir}/etc/scala_completion.sh" failifexecutionfails="false" >
<arg line="scala.tools.util.BashCompletion" />
</exec>
<!-- <exec append="true" osfamily="unix" executable="${build-pack.dir}/bin/scala" output="${build-pack.dir}/etc/scala_completion.sh" failifexecutionfails="false" >
<arg line="scala.tools.partest.PartestSpecDryRun" />
</exec> -->
<touch file="${build-pack.dir}/bin.complete" verbose="no"/>
</target>
@ -1130,15 +1121,15 @@ BOOTSTRAPPING BUILD (STRAP)
file="${src.dir}/continuations/plugin/scalac-plugin.xml"
todir="${build-strap.dir}/classes/continuations-plugin"/>
<!-- not very nice to create jar here but needed to load plugin -->
<mkdir dir="${build-strap.dir}/plugins"/>
<jar destfile="${build-strap.dir}/plugins/continuations.jar">
<mkdir dir="${build-strap.dir}/misc/scala-devel/plugins"/>
<jar destfile="${build-strap.dir}/misc/scala-devel/plugins/continuations.jar">
<fileset dir="${build-strap.dir}/classes/continuations-plugin"/>
</jar>
<!-- might split off library part into its own ant target -->
<scalacfork
destdir="${build-strap.dir}/classes/library"
compilerpathref="pack.classpath"
params="${scalac.args.all} -Xpluginsdir ${build-quick.dir}/plugins -Xplugin-require:continuations -P:continuations:enable"
params="${scalac.args.all} -Xpluginsdir ${build-quick.dir}/misc/scala-devel/plugins -Xplugin-require:continuations -P:continuations:enable"
srcdir="${src.dir}/continuations/library"
jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
@ -1522,7 +1513,7 @@ BOOTRAPING TEST AND TEST SUITE
<partest classpathref="pack.classpath">
<env key="PATH" path="${build-pack.dir}/bin:${env.PATH}" />
<sysproperty key="partest.srcdir" value="continuations" />
<sysproperty key="partest.scalacopts" value="${scalac.args.optimise} -Xpluginsdir ${build-quick.dir}/plugins -Xplugin-require:continuations -P:continuations:enable" />
<sysproperty key="partest.scalacopts" value="${scalac.args.optimise} -Xpluginsdir ${build-quick.dir}/misc/scala-devel/plugins -Xplugin-require:continuations -P:continuations:enable" />
<sysproperty key="partest.runsets" value="neg run" />
<syspropertyset>
<propertyref prefix="partest"/>
@ -1554,13 +1545,9 @@ DISTRIBUTION
<chmod perm="ugo+rx" file="${dist.dir}/bin/scaladoc"/>
<chmod perm="ugo+rx" file="${dist.dir}/bin/fsc"/>
<chmod perm="ugo+rx" file="${dist.dir}/bin/scalap"/>
<mkdir dir="${dist.dir}/etc"/>
<copy toDir="${dist.dir}/etc">
<fileset dir="${build-pack.dir}/etc"/>
</copy>
<mkdir dir="${dist.dir}/plugins"/>
<copy toDir="${dist.dir}/plugins">
<fileset dir="${build-pack.dir}/plugins"/>
<mkdir dir="${dist.dir}/misc/scala-devel/plugins"/>
<copy toDir="${dist.dir}/misc/scala-devel/plugins">
<fileset dir="${build-pack.dir}/misc/scala-devel/plugins"/>
</copy>
</target>

View File

@ -102,6 +102,8 @@ MAIN DISTRIBUTION SBAZ
dir="${dist.dir}/bin"
includes="scala,scala.bat,scalac,scalac.bat,scaladoc,scaladoc.bat,fsc,fsc.bat"/>
<libset dir="${dist.dir}/lib" includes="scala-compiler.jar,jline.jar"/>
<miscset dir="${dist.dir}/misc/scala-devel"
includes="plugins/continuations.jar"/>
<manset dir="${dist.dir}/man" includes="**"/>
<srcset dir="${dist.dir}/src" includes="scala-compiler-src.jar"/>
</sbaz>
@ -200,7 +202,7 @@ MAIN DISTRIBUTION SBAZ
<sequential>
<mkdir dir="${dists.dir}/maven/${version.number}/plugins/@{mvn.artifact.name}"/>
<copy todir="${dists.dir}/maven/${version.number}/plugins/@{mvn.artifact.name}">
<fileset dir="${dist.dir}/plugins/">
<fileset dir="${dist.dir}/misc/scala-devel/plugins/">
<filename name="@{mvn.artifact.name}.jar"/>
</fileset>
<fileset dir="${src.dir}/build/maven/">

View File

@ -1,132 +0,0 @@
/* NSC -- new Scala compiler
* Copyright 2006-2010 LAMP/EPFL
* @author Paul Phillips
*/
package scala.tools
package util
import nsc.{ Global, Settings }
/** Examines Settings and generates a bash completion file
* containing both bells and whistles.
*/
object BashCompletion {
val completionTemplate = """
# Bash Scala completion
#
# Add this file to /etc/bash_completion.d/ (or your local equivalent)
# or place a line like this in your .bashrc or .profile:
#
# . /path/to/file/scala_completion.sh
#
# For more information, see:
#
# http://bash-completion.alioth.debian.org/
#
# This file is generated by running scala.tools.util.BashCompletion.
#
SCALA_PHASES="@@PHASES@@"
SCALA_PHASE_SETTINGS=( @@PHASE_SETTINGS@@ )
SCALA_OPTIONS="@@OPTIONS@@"
SCALA_OPTIONS_EXPANDED="@@OPTIONS_EXPANDED@@"
_scala_completion()
{
local cur prev opts colonprefixes
COMPREPLY=()
opts=""
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
colonprefixes=${cur%"${cur##*:}"}
# special case escaping madness because bash treats : as a separator.
case "${cur}" in
-*:*)
precolon=$(echo "${cur}" | sed 's/:.*//g')
for p in ${SCALA_PHASE_SETTINGS[@]}; do
if [[ "${precolon}" == "${p}" ]] ; then
cur=$(echo "${cur}" | sed 's/.*://g') # cut cur down to postcolon part
opts=${SCALA_PHASES}
fi
done
if [ "${opts}" == "" ] ; then
opts=${SCALA_OPTIONS_EXPANDED}
fi
;;
esac
if [ "${opts}" == "" ] ; then
opts=${SCALA_OPTIONS}
fi
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
local i=${#COMPREPLY[*]}
while [ $((--i)) -ge 0 ]; do
COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"}
done
return 0
}
_scala_commands()
{
@@PROGRAMS@@
}
_scala_commands
""".trim
private lazy val settings = new Settings()
import settings._
val phaseNames = "all" :: (new Global(settings) phaseNames)
val phaseSettings = settings.visibleSettings collect { case x: PhasesSetting => "\"" + x.name + "\"" }
def settingStrings(s: Setting, expanded: Boolean) = s match {
case x: ChoiceSetting => if (expanded) x.choices map (x.name + ":" + _) else List(x.name + ":")
case x: PhasesSetting => List(x.name + ":")
case x => List(x.name)
}
/** We embed one list which stops at : and another where all choice settings are expanded out
* to include the choices.
*/
def settingNames = settings.visibleSettings.toList flatMap (x => settingStrings(x, false)) sorted
def settingNamesExpanded = settings.visibleSettings.toList flatMap (x => settingStrings(x, true)) sorted
def commandForName(name: String) = " complete -o default -F _scala_completion " + name + "\n"
def interpolate(template: String, what: (String, String)*) =
what.foldLeft(template) {
case (text, (key, value)) =>
val token = "@@" + key + "@@"
(text indexOf token) match {
case -1 => error("Token '%s' does not exist." format token)
case idx => (text take idx) + value + (text drop idx drop token.length)
}
}
def create(cmds: List[String]) = {
interpolate(completionTemplate,
"PROGRAMS" -> (cmds map commandForName mkString ""),
"OPTIONS" -> (settingNames mkString " "),
"OPTIONS_EXPANDED" -> (settingNamesExpanded mkString " "),
"PHASES" -> (phaseNames mkString " "),
"PHASE_SETTINGS" -> (phaseSettings mkString " ")
)
}
def main(args: Array[String]): Unit = {
val commands = if (args.isEmpty) List("fsc", "scala", "scalac", "scaladoc") else args.toList
val result = create(commands)
if (result contains "@@")
error("Some tokens were not replaced: text is " + result)
println(result)
}
}

View File

@ -120,8 +120,8 @@ object PathResolver {
}
def scalaExtDirs = Environment.scalaExtDirs
def scalaPluginDirs = List("misc", "scala-devel", "plugins")
def scalaPluginPath = join(scalaPluginDirs map (scalaHomeDir / _ path): _*)
def scalaPluginPath = (scalaHomeDir / "misc" / "scala-devel" / "plugins").path
override def toString = """
|object Defaults {