aboutsummaryrefslogtreecommitdiff
path: root/stage2/Stage2.scala
blob: 9eb47fef85f789ce0228a6558366c21109996868 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package cbt
import java.io._
import java.util.{Set=>_,_}

object Stage2 extends Stage2Base{
  def getBuild(context: Context): Dependency = DirectoryDependency( context, None )

  def run( args: Stage2Args ): ExitCode = {
    import args.logger
    val paths = CbtPaths(args.cbtHome,args.cache)
    import paths._
    val lib = new Lib(args.logger)
    logger.stage2(s"Stage2 start")

    val task = args.args.lift( 0 )

    import scala.collection.JavaConverters._
    val context: Context = new ContextImplementation(
      args.cwd,
      args.cwd,
      args.args.drop( 1 ).toArray,
      logger.enabledLoggers.toArray,
      logger.start,
      args.stage2LastModified,
      null,
      args.classLoaderCache.hashMap,
      args.transientCache,
      args.cache,
      args.cbtHome,
      args.cbtHome,
      args.compatibilityTarget,
      null,
      args.loop
    )
    val code = lib.callReflective(
      DirectoryDependency( context, None ),
      task, context
    )
    logger.stage2(s"Stage2 end with exit code "+code.integer)
    code
  }
}