@@ -6,7 +6,7 @@ import scala.util.{ Try, Success, Failure }
6
6
import reflect .ClassTag
7
7
import core .Contexts ._
8
8
import scala .annotation .tailrec
9
- import dotty .tools .io .{ Directory , Path }
9
+ import dotty .tools .io .{ Directory , File , Path }
10
10
11
11
// import annotation.unchecked
12
12
// Dotty deviation: Imports take precedence over definitions in enclosing package
@@ -22,7 +22,6 @@ object Settings {
22
22
val ListTag = ClassTag (classOf [List [_]])
23
23
val VersionTag = ClassTag (classOf [ScalaVersion ])
24
24
val OptionTag = ClassTag (classOf [Option [_]])
25
- val DirectoryJarTag = ClassTag (classOf [Path ])
26
25
27
26
class SettingsState (initialValues : Seq [Any ]) {
28
27
private [this ] var values = ArrayBuffer (initialValues : _* )
@@ -141,6 +140,15 @@ object Settings {
141
140
else if (! choices.contains(argRest))
142
141
fail(s " $arg is not a valid choice for $name" , args)
143
142
else update(argRest, args)
143
+ case (StringTag , arg :: args) if name == " -d" =>
144
+ Path (arg) match {
145
+ case _ : Directory =>
146
+ update(arg, args)
147
+ case p if p.extension == " jar" =>
148
+ update(arg, args)
149
+ case _ =>
150
+ fail(s " ' $arg' does not exist or is not a directory " , args)
151
+ }
144
152
case (StringTag , arg2 :: args2) =>
145
153
update(arg2, args2)
146
154
case (IntTag , arg2 :: args2) =>
@@ -161,11 +169,6 @@ object Settings {
161
169
case Success (v) => update(v, args)
162
170
case Failure (ex) => fail(ex.getMessage, args)
163
171
}
164
- case (DirectoryJarTag , arg :: args) =>
165
- val path = Path (arg)
166
- if (path.isDirectory) update(path, args)
167
- else if (path.extension == " jar" ) update(path, args)
168
- else fail(s " ' $arg' does not exist or is not a directory " , args)
169
172
case (_, Nil ) =>
170
173
missingArg
171
174
}
@@ -275,6 +278,9 @@ object Settings {
275
278
def PathSetting (name : String , descr : String , default : String ): Setting [String ] =
276
279
publish(Setting (name, descr, default))
277
280
281
+ def PathSetting (name : String , helpArg : String , descr : String , default : String ): Setting [String ] =
282
+ publish(Setting (name, descr, default, helpArg))
283
+
278
284
def PhasesSetting (name : String , descr : String , default : String = " " ): Setting [List [String ]] =
279
285
publish(Setting (name, descr, if (default.isEmpty) Nil else List (default)))
280
286
@@ -286,8 +292,5 @@ object Settings {
286
292
287
293
def OptionSetting [T : ClassTag ](name : String , descr : String ): Setting [Option [T ]] =
288
294
publish(Setting (name, descr, None , propertyClass = Some (implicitly[ClassTag [T ]].runtimeClass)))
289
-
290
- def DirectoryJarSetting (name : String , helpArg : String , descr : String , default : Directory ): Setting [Path ] =
291
- publish(Setting (name, descr, default, helpArg))
292
295
}
293
296
}
0 commit comments