aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2016-03-12 22:52:02 -0500
committerChristopher Vogt <oss.nsp@cvogt.org>2016-03-19 21:04:52 -0400
commit83f8bc492d9d714c0dea03f65fa693d77e236cb0 (patch)
treeab29a9c74b306ea67e78784f230edc54b06f64d2
parentba49574e1bf51f7fb1a9cbfe94d3b7185afbbc80 (diff)
downloadcbt-83f8bc492d9d714c0dea03f65fa693d77e236cb0.tar.gz
cbt-83f8bc492d9d714c0dea03f65fa693d77e236cb0.tar.bz2
cbt-83f8bc492d9d714c0dea03f65fa693d77e236cb0.zip
move decision about admin tasks or not from bash into Scala
-rwxr-xr-xcbt8
-rw-r--r--stage1/Stage1.scala12
2 files changed, 4 insertions, 16 deletions
diff --git a/cbt b/cbt
index 6b2242c..a791c68 100755
--- a/cbt
+++ b/cbt
@@ -192,12 +192,8 @@ stage1 () {
fi
log "run CBT and loop if desired. This allows recompiling CBT itself as part of compile looping." $*
- if [ "$1" = "admin" ] || [ "$2" = "admin" ]; then
- mainClass=cbt.AdminStage1
- else
- mainClass=cbt.Stage1
- fi
-
+ mainClass=cbt.Stage1
+
CP=$STAGE1$TARGET:$SCALA_CLASSPATH
if [ $use_nailgun -eq 1 ]
then
diff --git a/stage1/Stage1.scala b/stage1/Stage1.scala
index 417920c..a593c03 100644
--- a/stage1/Stage1.scala
+++ b/stage1/Stage1.scala
@@ -31,22 +31,14 @@ class Init(args: Array[String]) {
val logger = new Logger(props.get("log"))
}
-object Stage1 extends Stage1Base{
- def mainClass = ("cbt.Stage2")
-}
-
-object AdminStage1 extends Stage1Base{
- def mainClass = ("cbt.AdminStage2")
-}
-
-abstract class Stage1Base{
- def mainClass: String
+object Stage1{
protected def newerThan( a: File, b: File ) ={
a.lastModified > b.lastModified
}
def main(args: Array[String]): Unit = {
+ val mainClass = if(args contains "admin") "cbt.AdminStage2" else "cbt.Stage2"
val init = new Init(args)
val lib = new Stage1Lib(init.logger)
import lib._