Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 30 lines (28 sloc) 0.988 kb
33434bc @harrah Cut size of final jar by 300k.
authored
1 /* sbt -- Simple Build Tool
2 * Copyright 2008,2009 David MacIver, Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
b2077ce @harrah more 2.8 updates, launcher compiles and runs with 2.8
authored
7 import scala.collection.immutable.List
33434bc @harrah Cut size of final jar by 300k.
authored
8
988c22c @harrah support reason for retrieving jars in launcher
authored
9 class Enumeration
33434bc @harrah Cut size of final jar by 300k.
authored
10 {
11 def elements: List[Value] = members
12 private lazy val members: List[Value] =
13 {
14 val c = getClass
15 val correspondingFields = ListMap( c.getDeclaredFields.map(f => (f.getName, f)) : _*)
16 c.getMethods.toList flatMap { method =>
17 if(method.getParameterTypes.length == 0 && classOf[Value].isAssignableFrom(method.getReturnType))
18 {
19 for(field <- correspondingFields.get(method.getName) if field.getType == method.getReturnType) yield
20 method.invoke(this).asInstanceOf[Value]
21 }
22 else
23 Nil
24 }
25 }
f70442c @harrah * new [ivy] section with 'cache-directory' label in launcher configu…
authored
26 def value(s: String) = new Value(s, 0)
27 def value(s: String, i: Int) = new Value(s, i)
988c22c @harrah support reason for retrieving jars in launcher
authored
28 final class Value(override val toString: String, val id: Int)
33434bc @harrah Cut size of final jar by 300k.
authored
29 def toValue(s: String): Value = elements.find(_.toString == s).getOrElse(error("Expected one of " + elements.mkString(",") + " (got: " + s + ")"))
30 }
Something went wrong with that request. Please try again.