Skip to content

Commit

Permalink
Remove unused runSbtTask
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben McCann committed Mar 24, 2017
1 parent 8a9eb55 commit d26827c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
14 changes: 0 additions & 14 deletions framework/src/build-link/src/main/java/play/core/BuildLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,4 @@ public interface BuildLink {
* @return The settings.
*/
public Map<String,String> settings();

/**
* Run a task in the build tool.
*
* This can be used by Play plugins, for example, by a test fixture plugin to run tests. The format of the passed
* in task and the return value are build tool specific.
*
* For the default SBT implementation, it's a standard SBT task, and the result is the return value of that task.
* Note that if the return value is anything but JDK classes, the only way to access it will be using reflection.
*
* @param task The name of the task to run.
* @return The result of running the task.
*/
public Object runTask(String task);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ package play.runsupport

import java.io.{ Closeable, File }
import java.net.{ URL, URLClassLoader }
import java.security.{ PrivilegedAction, AccessController }
import java.security.{ AccessController, PrivilegedAction }
import java.util.jar.JarFile

import play.api.PlayException
import play.core.{ Build, BuildLink, BuildDocHandler }
import play.dev.filewatch.FileWatchService
Expand Down Expand Up @@ -143,7 +144,7 @@ object Reloader {
docsClasspath: Classpath, docsJar: Option[File],
defaultHttpPort: Int, defaultHttpAddress: String, projectPath: File,
devSettings: Seq[(String, String)], args: Seq[String],
runSbtTask: String => AnyRef, mainClassName: String): PlayDevServer = {
mainClassName: String): PlayDevServer = {

val (properties, httpPort, httpsPort, httpAddress) = filterArgs(args, defaultHttpPort, defaultHttpAddress, devSettings)
val systemProperties = extractSystemProperties(javaOptions)
Expand Down Expand Up @@ -213,7 +214,7 @@ object Reloader {
lazy val applicationLoader = dependencyClassLoader("PlayDependencyClassLoader", urls(dependencyClasspath), delegatingLoader)
lazy val assetsLoader = assetsClassLoader(applicationLoader)

lazy val reloader = new Reloader(reloadCompile, reloaderClassLoader, assetsLoader, projectPath, devSettings, monitoredFiles, fileWatchService, generatedSourceHandlers, runSbtTask)
lazy val reloader = new Reloader(reloadCompile, reloaderClassLoader, assetsLoader, projectPath, devSettings, monitoredFiles, fileWatchService, generatedSourceHandlers)

try {
// Now we're about to start, let's call the hooks:
Expand Down Expand Up @@ -295,8 +296,7 @@ class Reloader(
devSettings: Seq[(String, String)],
monitoredFiles: Seq[File],
fileWatchService: FileWatchService,
generatedSourceHandlers: Map[String, GeneratedSourceMapping],
runSbtTask: String => AnyRef) extends BuildLink {
generatedSourceHandlers: Map[String, GeneratedSourceMapping]) extends BuildLink {

// The current classloader for the application
@volatile private var currentApplicationClassLoader: Option[ClassLoader] = None
Expand Down Expand Up @@ -409,8 +409,6 @@ class Reloader(
}.orNull
}

def runTask(task: String): AnyRef = runSbtTask(task)

def close() = {
currentApplicationClassLoader = None
currentSourceMap = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ object PlayRun {
() => Project.runTask(streamsManager in scope, state).map(_._2).get.toEither.right.toOption
)

val runSbtTask: String => AnyRef = (task: String) => {
val parser = Act.scopedKeyParser(state)
val Right(sk) = complete.DefaultParsers.result(parser, task)
val result = Project.runTask(sk.asInstanceOf[Def.ScopedKey[Task[AnyRef]]], state).map(_._2)
result.flatMap(_.toEither.right.toOption).orNull
}

lazy val devModeServer = Reloader.startDevMode(
runHooks.value,
(javaOptions in Runtime).value,
Expand All @@ -103,7 +96,6 @@ object PlayRun {
baseDirectory.value,
devSettings.value,
args,
runSbtTask,
(mainClass in (Compile, Keys.run)).value.get
)

Expand Down

0 comments on commit d26827c

Please sign in to comment.