by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 22 2015 11:10
    japgolly commented #2066
  • Jun 22 2015 08:25
    keepscoding commented #2044
  • Jun 21 2015 03:24
    xerial commented #157
  • Jun 21 2015 00:10
    eed3si9n unlabeled #2057
  • Jun 21 2015 00:10

    eed3si9n on 0.13

    Adds bundledLauncherProj to all… Remove launcher tests Add unit tests to Travis and 3 more (compare)

  • Jun 21 2015 00:10
    eed3si9n closed #2057
  • Jun 21 2015 00:10

    eed3si9n on fixbuild

    (compare)

  • Jun 20 2015 18:42
    eed3si9n synchronize #2057
  • Jun 20 2015 18:42

    eed3si9n on fixbuild

    Fix typo (compare)

  • Jun 20 2015 18:23

    eed3si9n on fixbuild

    Adds bundledLauncherProj to all… Remove launcher tests Add unit tests to Travis and 1 more (compare)

  • Jun 20 2015 18:23
    eed3si9n synchronize #2057
  • Jun 20 2015 14:59

    eed3si9n on scalaversionbump

    (compare)

  • Jun 20 2015 14:59

    eed3si9n on 0.13

    Bumping up Scala version to 2.1… Try to keep bincompat Fixes #1666 and 1 more (compare)

  • Jun 20 2015 14:59
    eed3si9n unlabeled #2068
  • Jun 20 2015 14:59
    eed3si9n closed #2068
  • Jun 20 2015 14:59
    eed3si9n closed #1666
  • Jun 20 2015 14:57
    eed3si9n commented #2068
  • Jun 20 2015 12:55
    dwijnand commented #2068
  • Jun 20 2015 04:51
    eed3si9n synchronize #2068
  • Jun 20 2015 04:51

    eed3si9n on scalaversionbump

    Fixes #1666 (compare)

Daniel Spiewak
@djspiewak
Dredging through the code, it looks like this is ultimately coming from ExecutorService#shutdownNow(), which claims to be using Thread#interrupt()
But like… I'm catching interruption and not seeing it, so I'm very perplexed as to how this is possible without using weird functions like stop()
Daniel Spiewak
@djspiewak
Oh… it's just literally not interrupting anything
that explains so much
Daniel Spiewak
@djspiewak

As a follow-up to my previous… it appears that sbt just doesn't correctly interrupt run-main threads. This is supposed to happen in EvaluateTask… but doesn't. I don't know why. The threads are interruptible (I checked), and interrupt() is being called, it's just not, like, happening.

Anyway, with significant shenanigans, you can detect the presence of sbt's unforked runner within your application… and trigger your own interrupts:

    if (Thread.currentThread().getName().startsWith("run-main")) {
      try {
        // the security manager will be sbt.TrapExit; use its classloader to jailbreak out and find sbt.EvaluateTask
        val klass = System.getSecurityManager().getClass().getClassLoader().loadClass("sbt.EvaluateTask$")

        val EvaluateTask = klass.getDeclaredField("MODULE$").get(null).asInstanceOf[{ val currentlyRunningEngine: AtomicReference[AnyRef] }]
        val currentEngine = EvaluateTask.currentlyRunningEngine

        val outer = Thread.currentThread()

        val monitor = new Thread({ () =>
          var continue = true
          while (continue)  {
            if (currentEngine.get() == null) {
              continue = false
              outer.interrupt()
            }
            Thread.sleep(100)
          }
        })

        monitor.setName("sbt-unforked-interrupt-monitor")
        monitor.setPriority(Thread.MIN_PRIORITY)
        monitor.setDaemon(true)

        monitor.start()
      } catch {
        case _: Throwable => ()   // literally swallow anything that moves... (it probably means our detection failed, or sbt changed its internals)
      }
    }

This assumes you're setting interrupt handlers properly on your main thread, which you should be in case sbt ever fixes this bug. This is basically just a busy-wait workaround to the fact that the interruption never seems to actually happen.

At any rate, this also has the handy side-effect of fixing sbt's current issues with memory leaks coming out of run
hrj
@hrj
Is there a way in sbt to pin the contents of an artifact? Similar to this gradle plugin: checksum dependency plugin
Darren Bishop
@DarrenBishop
Hi all, just upgraded to Scala 2.13.3 to try out -Yimports:a,b,c but can’t get it to work in SBT 1.3.12
[error] bad preamble import com.darrenbishop.lang
As a minimal basic example that works wih scalac on its own
± tree example
example
└── p1
    ├── p2
    │   └── Main.scala
    └── package.scala

2 directories, 2 files
Darren Bishop
@DarrenBishop
// p1/package.scala
package object p1 {

    def printHello(name: String): Unit = println(s"Hello, $name");
}
// p1/p2/Main.scala
package p1.p2

object Main {

    def main(args: Array[String]): Unit = {

        args foreach { printHello }
    }
}
Compile and run with
± scalac -Yimports:java.lang,scala,scala.Predef,p1 -sourcepath example -d example-classes $(find example -type f)

± scala -classpath example-classes p1.p2.Main Tom Dick Harry
Hello, Tom
Hello, Dick
Hello, Harry
Does anyone have any pointers?
FWIW, my build.sbt contains (amongst other things):
scalacOptions ++= Seq(
  "-target:jvm-1.8",
  "-Xmigration",
  "-Yimports:java.lang,scala,scala.Predef,com.darrenbishop.lang"
)
Darren Bishop
@DarrenBishop
The error seems consistent with scalac not being able to see the package e.g.
± scalac -Yimports:java.lang,scala,scala.Predef,p1x -sourcepath example -d example-classes $(find example -type f)
error: bad preamble import p1x
error: bad preamble import p1x
2 errors
Boris V.Kuznetsov
@tampler

Hello ! I'm trying to specify a custom task, which produces a sequence of commands , defined by lagom-sbt plugin. Here's the code:

lazy val startCass = taskKey[Unit]("Start Cass")
startCass :=  { 
    lagomCassandraStart.value
    lagomCassandraStop.value
  }

This doesn't work, yielding in error : Reference to undefined setting: lagomCassandraStart. Any ideas how to fix this ? Thank you in advance

OlegYch
@OlegYch
perhaps you need to enable that plugin
or use a specific scope where the tasks are defined
eugene yokota
@eed3si9n
@djspiewak could you open an issue for this?
Daniel Spiewak
@djspiewak
I will as soon as I can get it to reproduce again. It seems like InterruptedException is properly getting raised again in my test env, which is like… weird
eugene yokota
@eed3si9n
@tampler you might also want to read this. as you coded it, it will run lagomCassandraStart task and lagomCassandraStop task at the same time - https://www.scala-sbt.org/1.x/docs/Howto-Sequencing.html
@DarrenBishop this might be analogous to defining and consuming your own macros. typically the answer is: split them into different subproject
Loránd Szakács
@lorandszakacs

folks, sometimes when I startup sbt I get this and it fails to load:

[error] java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.CompletableFuture$AsyncSupply@aa10429c rejected from java.util.concurrent.ThreadPoolExecutor@cfb67129[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]

It only happened since 1.3.13... usually I retry a few more times and it succeeds :sweat_smile:

note: I only ever saw it happening on a project with upwards of 20+ sub projects. Classic concurrency bug it seems :)
Brice Jaglin
@bjaglin
@lorandszakacs I am investigating a similar issue with 1.3.12 for sbt-scalafix (scalacenter/scalafix#1196) - what's the stack trace for you?
Loránd Szakács
@lorandszakacs

@bjaglin, it is indeed due to scalafix:

[error] java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.CompletableFuture$AsyncSupply@41c9d936 rejected from java.util.concurrent.ThreadPoolExecutor@541430d6[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2055)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:825)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1355)
[error]     at java.base/java.util.concurrent.CompletableFuture.asyncSupplyStage(CompletableFuture.java:1714)
[error]     at java.base/java.util.concurrent.CompletableFuture.supplyAsync(CompletableFuture.java:1931)
[error]     at org.eclipse.jgit.util.FS$FileStoreAttributes.getFileStoreAttributes(FS.java:329)
[error]     at org.eclipse.jgit.util.FS$FileStoreAttributes.get(FS.java:296)
[error]     at org.eclipse.jgit.util.FS.getFileStoreAttributes(FS.java:767)
[error]     at org.eclipse.jgit.internal.storage.file.FileSnapshot.<init>(FileSnapshot.java:224)
[error]     at org.eclipse.jgit.internal.storage.file.FileSnapshot.<init>(FileSnapshot.java:205)
[error]     at org.eclipse.jgit.internal.storage.file.FileSnapshot.save(FileSnapshot.java:102)
[error]     at org.eclipse.jgit.internal.storage.file.FileRepository.<init>(FileRepository.java:209)
[error]     at org.eclipse.jgit.storage.file.FileRepositoryBuilder.build(FileRepositoryBuilder.java:55)
[error]     at scalafix.internal.sbt.JGitCompletion.<init>(JGitCompletions.scala:23)
[error]     at scalafix.internal.sbt.ScalafixCompletions.gitDiffParser$lzycompute(ScalafixCompletions.scala:99)
[error]     at scalafix.internal.sbt.ScalafixCompletions.gitDiffParser(ScalafixCompletions.scala:98)
[error]     at scalafix.internal.sbt.ScalafixCompletions.parser(ScalafixCompletions.scala:167)
[error]     at scalafix.sbt.ScalafixPlugin$.$anonfun$parser$1(ScalafixPlugin.scala:175)
[error]     at scalafix.sbt.ScalafixPlugin$$$Lambda$3290/0000000069A58420.apply(Unknown Source)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]     at scala.Function1$$Lambda$1042/0000000000000000.apply(Unknown Source)
[error]     at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:223)
[error]     at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:166)
[error]     at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87)
[error]     at sbt.internal.util.EvaluateSettings$$Lambda$2050/0000000000000000.apply$mcV$sp(Unknown Source)
[error]     at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:99)
[error]     at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]     at java.base/java.lang.Thread.run(Thread.java:834)
[error] java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.CompletableFuture$AsyncSupply@41c9d936 rejected from java.util.concurrent.ThreadPoolExecutor@541430d6[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]

I just updated the scalafix plugin from 0.9.17 to 0.9.18, but also updated sbt from 1.3.12 to 1.3.13

Brice Jaglin
@bjaglin
ok, it's really the same issue then, if you have any details that are not already on the ticket (other plugins used, environment, etc), can you add them? thanks!
Loránd Szakács
@lorandszakacs
@bjaglin nothing to add :)
Boris V.Kuznetsov
@tampler
@eed3si9n Thanks, Eugene-San. I'll give it a try
Mikhail Nemenko
@eniqen
Hi guys. could you tell me please how can i solve this problem
I have Windows 10 and jdk 8
when I run command like sbt run using play framework I'm getting this exception about path
[error] (docExtract) java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0_251\jre\bin\java": CreateProcess error=206, The filename or extension is too long
Ryan Peters
@sloshy
My first guess is that sounds like the familiar NTFS file path limitation
@eniqen
Where is your project exactly
If it's in a lot of nested folders there might be something going on there
Darren Bishop
@DarrenBishop
@eed3si9n thanks for coming back, although I am reluctant to reduce this to a macro-like problem, if the solution is ‘create another project’, which is hard to justify, merely to exploit a new compiler flag
If there is any other option, will be god to hear it. Otherwise, I guess that compiler flag will not be used over here and will put up with a common set of imports reoccurring everywhere
eugene yokota
@eed3si9n
-Yimports changes the predef, changing effectively how println("hello") should be compiled.. so I think it's reasonable for the compiler to expect that you have it in *.class form like macro for the intended usage. if you'd like the compiler to somehow reorder the compilation, then I guess you have to take it up with scala/scala.
objektwerks
@objektwerks
brew info sbt
sbt: stable 1.3.12
Build tool for Scala projects
https://www.scala-sbt.org/
/usr/local/Cellar/sbt/1.3.12 (805 files, 61.4MB) *
Built from source on 2020-06-01 at 10:37:35
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/sbt.rb
License: Apache-2.0
==> Dependencies
Required: openjdk ✔
==> Caveats
You can use $SBT_OPTS to pass additional JVM options to sbt.
Project specific options should be placed in .sbtopts in the root of your project.
Global settings should be placed in /usr/local/etc/sbtopts
==> Analytics
install: 11,503 (30 days), 44,212 (90 days), 207,581 (365 days)
install-on-request: 10,881 (30 days), 41,498 (90 days), 193,032 (365 days)
build-error: 0 (30 days)
Where is sbt 1.3.13. Or am I missing something?
Is Homebrew no longer supported?
Seth Tisue
@SethTisue
Rich
@Rich2
Is there any point in using ScalaDoc comment syntax in sbt files?
Thomas
@thomasschoeftner

Hi all - a question about SBT in combination with IDEA IntelliJ:

The combination of SBT and IntelliJ seems to produce friction in context of generated/managed source - specifically Avro code generation.
Does it also happen to other people that sbt ~test (or other interactive sbt commands prefixed with~) frequently runs into issues with generated sources missing while SBT still runs? - This produces an array of compilation errors.

This is extremely annoying because my typical development workflow is interrupted.
This occurs frequently too, which makes interactive sbt commands (e.g. sbt ~test) practically unusable... :(

I guess this could be fixed in the IntelliJ project settings after import, but that's not a permanent fix...
Any hints how to fix this? - Thanks!

OlegYch
@OlegYch
'use sbt for build'
Thomas
@thomasschoeftner
aw, cool - I'll check it out
thanks
objektwerks
@objektwerks
@SethTisue Thanks! Hopefully, that PR gets sorted out.
Leif Warner
@LeifW
@LeifW
What does it mean when an sbt eviction warning only shows a single item? e.g.
* com.google.protobuf:protobuf-java:3.10.0 is selected over 2.6.1 [warn] +- software.amazon.kinesis:amazon-kinesis-client:2.2.7 (depends on 2.6.1)
How can there be a conflict if there was only one thing depending on that?
Also, it's a shame sbt dependency graph doesn't work on sbt 1.3
3 replies
Eric Loots
@eloots
I'm using two sbt plugins that both set shellPrompt.
One of them is mine, the other is the sbt PlayFramework plugin.
Unfortunately (for me), the PlayFramework "wins".
Is there a way to influence this behavior without changing one
of the plugins to not set shellPrompt?
OlegYch
@OlegYch
@LeifW perhaps the project itself depends on 3.10.0?