Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove --isolated and add --propagate / --include-dependencies #590

Merged
merged 1 commit into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions frontend/src/main/scala/bloop/cli/Commands.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ object Commands {
@ExtraName("p")
@HelpMessage("The projects to clean.")
project: List[String] = Nil,
@HelpMessage("Do not run clean for dependencies. By default, false.")
isolated: Boolean = false,
@ExtraName("propagate")
@HelpMessage("Run clean for the project's dependencies. By default, false.")
includeDependencies: Boolean = false,
@Recurse cliOptions: CliOptions = CliOptions.default,
) extends RawCommand

Expand Down Expand Up @@ -116,8 +117,9 @@ object Commands {
@ExtraName("p")
@HelpMessage("The project to test (will be inferred from remaining cli args).")
project: String = "",
@HelpMessage("Do not run tests for dependencies. By default, false.")
isolated: Boolean = false,
@ExtraName("propagate")
@HelpMessage("Run tests for the project dependencies. By default, false.")
includeDependencies: Boolean = false,
@ExtraName("o")
@HelpMessage("The list of test suite filters to test for only.")
only: List[String] = Nil,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/main/scala/bloop/engine/Interpreter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ object Interpreter {
val cwd = cmd.cliOptions.common.workingPath
compileAnd(state, project, reporterConfig, false, sequential, "`test`") { state =>
val testEventHandler = new LoggingEventHandler(state.logger)
Tasks.test(state, project, cwd, cmd.isolated, cmd.args, testFilter, testEventHandler)
Tasks.test(state, project, cwd, cmd.includeDependencies, cmd.args, testFilter, testEventHandler)
}
}
if (cmd.watch) watch(project, state, doTest _)
Expand Down Expand Up @@ -394,7 +394,7 @@ object Interpreter {
private def clean(cmd: Commands.Clean, state: State): Task[State] = {
val (projects, missing) = lookupProjects(cmd.project, state)
if (missing.isEmpty)
Tasks.clean(state, projects, cmd.isolated).map(_.mergeStatus(ExitStatus.Ok))
Tasks.clean(state, projects, cmd.includeDependencies).map(_.mergeStatus(ExitStatus.Ok))
else Task.now(reportMissing(missing, state))
}

Expand Down
13 changes: 7 additions & 6 deletions frontend/src/main/scala/bloop/engine/tasks/Tasks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ object Tasks {
*
* @param state The current state of Bloop.
* @param targets The projects to clean.
* @param isolated Do not run clean for dependencies.
* @param includeDeps Do not run clean for dependencies.
* @return The new state of Bloop after cleaning.
*/
def clean(state: State, targets: List[Project], isolated: Boolean): Task[State] = Task {
def clean(state: State, targets: List[Project], includeDeps: Boolean): Task[State] = Task {
val allTargetsToClean =
if (isolated) targets
if (!includeDeps) targets
else targets.flatMap(t => Dag.dfs(state.build.getDagFor(t))).distinct
val newResults = state.results.cleanSuccessful(allTargetsToClean)
state.copy(results = newResults)
Expand Down Expand Up @@ -275,7 +275,7 @@ object Tasks {
* @param state The current state of Bloop.
* @param project The project for which to run the tests.
* @param cwd The directory in which to start the forked JVM.
* @param isolated Do not run the tests for the dependencies of `project`.
* @param includeDependencies Run test in the dependencies of `project`.
* @param testFilter A function from a fully qualified class name to a Boolean, indicating whether
* a test must be included.
* @return The new state of Bloop.
Expand All @@ -284,7 +284,7 @@ object Tasks {
state: State,
project: Project,
cwd: AbsolutePath,
isolated: Boolean,
includeDependencies: Boolean,
frameworkSpecificRawArgs: List[String],
testFilter: String => Boolean,
testEventHandler: TestSuiteEventHandler
Expand Down Expand Up @@ -315,7 +315,8 @@ object Tasks {
}

var failure = false
val projectsToTest = if (isolated) List(project) else Dag.dfs(state.build.getDagFor(project))
val projectsToTest =
if (!includeDependencies) List(project) else Dag.dfs(state.build.getDagFor(project))
val testTasks = projectsToTest.map { project =>
val projectName = project.name
val forker = Forker(project.javaEnv, project.classpath)
Expand Down