1
1
package scala .meta .internal .builds
2
2
3
3
import java .util .concurrent .TimeUnit
4
- import java .util .concurrent .atomic .AtomicBoolean
5
4
6
5
import scala .concurrent .ExecutionContext
7
6
import scala .concurrent .Future
@@ -37,33 +36,23 @@ final class BloopInstall(
37
36
override def toString : String = s " BloopInstall( $workspace) "
38
37
39
38
def runUnconditionally (
40
- buildTool : BloopInstallProvider ,
41
- isImportInProcess : AtomicBoolean ,
39
+ buildTool : BloopInstallProvider
42
40
): Future [WorkspaceLoadedStatus ] = {
43
- if (isImportInProcess.compareAndSet(false , true )) {
44
- buildTool.bloopInstall(
45
- workspace,
46
- args => {
47
- scribe.info(s " running ' ${args.mkString(" " )}' " )
48
- val process =
49
- runArgumentsUnconditionally(buildTool, args, userConfig().javaHome)
50
- process.foreach { e =>
51
- if (e.isFailed) {
52
- // Record the exact command that failed to help troubleshooting.
53
- scribe.error(s " $buildTool command failed: ${args.mkString(" " )}" )
54
- }
41
+ buildTool.bloopInstall(
42
+ workspace,
43
+ args => {
44
+ scribe.info(s " running ' ${args.mkString(" " )}' " )
45
+ val process =
46
+ runArgumentsUnconditionally(buildTool, args, userConfig().javaHome)
47
+ process.foreach { e =>
48
+ if (e.isFailed) {
49
+ // Record the exact command that failed to help troubleshooting.
50
+ scribe.error(s " $buildTool command failed: ${args.mkString(" " )}" )
55
51
}
56
- process.onComplete(_ => isImportInProcess.set(false ))
57
- process
58
- },
59
- )
60
- } else {
61
- Future
62
- .successful {
63
- languageClient.showMessage(ImportAlreadyRunning )
64
- WorkspaceLoadedStatus .Dismissed
65
52
}
66
- }
53
+ process
54
+ },
55
+ )
67
56
}
68
57
69
58
private def runArgumentsUnconditionally (
@@ -123,7 +112,6 @@ final class BloopInstall(
123
112
def runIfApproved (
124
113
buildTool : BloopInstallProvider ,
125
114
digest : String ,
126
- isImportInProcess : AtomicBoolean ,
127
115
): Future [WorkspaceLoadedStatus ] =
128
116
synchronized {
129
117
oldInstallResult(digest) match {
@@ -133,7 +121,7 @@ final class BloopInstall(
133
121
Future .successful(result)
134
122
case _ =>
135
123
if (userConfig().shouldAutoImportNewProject) {
136
- runUnconditionally(buildTool, isImportInProcess )
124
+ runUnconditionally(buildTool)
137
125
} else {
138
126
scribe.debug(" Awaiting user response..." )
139
127
for {
@@ -145,7 +133,7 @@ final class BloopInstall(
145
133
)
146
134
installResult <- {
147
135
if (userResponse.isYes) {
148
- runUnconditionally(buildTool, isImportInProcess )
136
+ runUnconditionally(buildTool)
149
137
} else {
150
138
// Don't spam the user with requests during rapid build changes.
151
139
notification.dismiss(2 , TimeUnit .MINUTES )
0 commit comments