aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compatibility/BuildInterface.java8
-rw-r--r--stage2/BasicBuild.scala5
-rw-r--r--stage2/BuildBuild.scala9
-rw-r--r--stage2/Stage2.scala6
4 files changed, 22 insertions, 6 deletions
diff --git a/compatibility/BuildInterface.java b/compatibility/BuildInterface.java
index ebcfb99..eb60960 100644
--- a/compatibility/BuildInterface.java
+++ b/compatibility/BuildInterface.java
@@ -1,11 +1,15 @@
package cbt;
import java.io.*;
-public abstract class BuildInterface implements Dependency{
- public abstract BuildInterface finalBuild(); // needed to propagage through build builds. Maybe we can get rid of this.
+public interface BuildInterface extends Dependency{
+ // needed to propagage through build builds. Maybe we can get rid of this.
+ public default BuildInterface finalBuild(File current){
+ return finalBuild(); // legacy forwarder
+ }
public abstract File[] triggerLoopFilesArray(); // needed for watching files across composed builds
// deprecated methods, which clients are still allowed to implement, but not required
+ public abstract BuildInterface finalBuild(); // needed to propagage through build builds. Maybe we can get rid of this.
public abstract BuildInterface copy(Context context);
public abstract String scalaVersion();
public abstract String[] crossScalaVersionsArray();
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala
index 4ca39a7..c1a8c4e 100644
--- a/stage2/BasicBuild.scala
+++ b/stage2/BasicBuild.scala
@@ -253,7 +253,12 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
*/
// ========== cbt internals ==========
+ @deprecated("use finalbuild(File)","")
def finalBuild: BuildInterface = this
+ override def finalBuild( current: File ): BuildInterface = {
+ //assert( current.getCanonicalFile == projectDirectory.getCanonicalFile, s"$current == $projectDirectory" )
+ this
+ }
override def show = this.getClass.getSimpleName ++ "(" ++ projectDirectory.string ++ ")"
// a method that can be called only to trigger any side-effects
diff --git a/stage2/BuildBuild.scala b/stage2/BuildBuild.scala
index 2eebcbc..9ac631f 100644
--- a/stage2/BuildBuild.scala
+++ b/stage2/BuildBuild.scala
@@ -1,5 +1,6 @@
package cbt
import java.nio.file._
+import java.io.File
trait BuildBuild extends BuildBuildWithoutEssentials{
override def dependencies =
@@ -97,5 +98,11 @@ trait BuildBuildWithoutEssentials extends BaseBuild{
}
}
override def triggerLoopFiles = super.triggerLoopFiles ++ managedBuild.triggerLoopFiles
- override def finalBuild: BuildInterface = if( projectDirectory == context.cwd ) this else managedBuild.finalBuild
+ @deprecated("use finalbuild(File)","")
+ override def finalBuild: BuildInterface = finalBuild( context.cwd )
+ override def finalBuild( current: File ): BuildInterface = {
+ val p = projectDirectory.getCanonicalFile
+ val c = current.getCanonicalFile
+ if( c == p ) this else managedBuild.finalBuild( current )
+ }
}
diff --git a/stage2/Stage2.scala b/stage2/Stage2.scala
index 93f0a77..7ac7a2a 100644
--- a/stage2/Stage2.scala
+++ b/stage2/Stage2.scala
@@ -4,7 +4,7 @@ import java.util._
object Stage2 extends Stage2Base{
def getBuild(context: Context) = {
- new Lib( context.logger ).loadRoot( context ).finalBuild
+ new Lib( context.logger ).loadRoot( context ).finalBuild( context.cwd )
}
def run( args: Stage2Args ): ExitCode = {
@@ -39,7 +39,7 @@ object Stage2 extends Stage2Base{
null
)
val first = lib.loadRoot( context )
- val build = first.finalBuild
+ val build = first.finalBuild( context.cwd )
val res =
if (loop) {
@@ -57,7 +57,7 @@ object Stage2 extends Stage2Base{
scala.util.control.Breaks.break
case file if triggerFiles.exists(file.toString startsWith _.toString) =>
- val build = lib.loadRoot(context).finalBuild
+ val build = lib.loadRoot(context).finalBuild( context.cwd )
logger.loop(s"Re-running $task for " ++ build.show)
lib.callReflective(build, task)
}