Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:11

    github-actions[bot] on gh-pages

    Updated github pages from commi… (compare)

  • 13:08

    lefou on main

    bloop: use the same naming sche… (compare)

  • 13:08
    lefou closed #1981
  • 13:00
    lefou closed #1980
  • Aug 07 12:24
    ckipp01 synchronize #1912
  • Aug 04 13:05
    scala-steward closed #1978
  • Aug 04 13:05
    scala-steward opened #1984
  • Aug 02 13:02
    scala-steward synchronize #1978
  • Aug 02 12:01

    github-actions[bot] on gh-pages

    Updated github pages from commi… (compare)

  • Aug 02 11:42

    lefou on main

    Update bloop-config to 1.5.3 (#… (compare)

  • Aug 02 11:42
    lefou closed #1982
  • Jul 31 12:57
    scala-steward opened #1982
  • Jul 31 05:54
    ajrnz opened #1981
  • Jul 29 21:59
    IdiosApps opened #1980
  • Jul 29 13:24
    scala-steward closed #1973
  • Jul 29 13:24
    scala-steward opened #1978
  • Jul 29 13:13

    github-actions[bot] on gh-pages

    Updated github pages from commi… (compare)

  • Jul 29 13:10

    lefou on main

    Experimental dependency managem… (compare)

  • Jul 29 13:10
    lefou closed #1947
  • Jul 29 13:08
    lefou ready_for_review #1947
Tobias Roeser
@tobiasroeser:matrix.org
[m]
Greatest impact would be the persistence of such a pathref to json.
Oliver Wickham
@ollyw
@lolgab I see the caching not working with zero files changed, which is what is puzzling me
Tobias Roeser
@tobiasroeser:matrix.org
[m]
I guess, the caching happens in memory, so only as long as a Mill server instance is alive. Without usage, a server will shutdown itself after five minutes, IIRC
And with -i or --no-server, there is no caching at all
Lorenzo Gabriele
@lolgab

@lolgab I see the caching not working with zero files changed, which is what is puzzling me

If you didn't change any file and it starts again it might be a bug. I will try myself to see if I can reproduce as well.

Tobias Roeser
@tobiasroeser:matrix.org
[m]
regarding the scalafmt caching. Persisting the in-memory cache (map) to a json file is probably straight forward and should improve the caching experience.
ex0ns
@ex0ns
I don't know if this is a change related to bloop, mill or metals (always hard to tell), but code navigation for mill is working on VSCode now \o/
hilco
@hilco:matrix.org
[m]
Is there a way to have Mill run an "arbitrary" shell command? Specifically, I would like to untar a tarball. Or should I just use java.lang.ProcessBuilder?
Lorenzo Gabriele
@lolgab
@hilco You can use os.proc(...).call() which is already included in Mill
You can find the docs here: https://github.com/com-lihaoyi/os-lib
hilco
@hilco:matrix.org
[m]
Ah, I did come across that. Thanks, I'll give that a try.
Delphine Peter
@delpeter
Hi, is there a way to override the clean command ? I'd like to automatically do a make clean for the shared libraries in addition to the usual cleaning performed by mill clean.
Tobias Roeser
@tobiasroeser:matrix.org
[m]
@delpeter: Have you tried to just override it toplevel in build.sc? Should work, I guess.
ex0ns
@ex0ns

Did any of you tried to cache the out folder in a CI ? I was thinking that the invalidation of mill should work fine with this setup and correctly use the cache from previous run (similar to the way bazel does it)

Is there something that could prevent this from working as expected ?

Lorenzo Gabriele
@lolgab
I don't remember if Mill was migrated to use the new zinc virtualfile abstraction which was created to solve this issue : sbt/sbt#4168
I've seen cache invalidation problems on CI with Sbt before this change.
Tobias Roeser
@tobiasroeser:matrix.org
[m]
Yes, we use the latest zinc api, and it also requires to use the virtual file abstraction
But I think we use a simple implementation of it which just uses the full path
Ichoran
@Ichoran
Are there any examples of running benchmarks with mill (of any sort--JMH or otherwise)?
2 replies
Or, failing that, a way to get .test like functionality but with everything separate (so you don't have to run the benchmarks to run unit tests)?
I've got an unboxed Either for Scala 3 using opaque type unions that seems to be working well functionally, but I'd like to write a benchmark suite that documents its speed compared to, say, Either.
Ichoran
@Ichoran
I guess I can literally just have a second test suite named "bench" that uses a test framework but co-opt it to run a benchmark instead.
Tobias Roeser
@tobiasroeser:matrix.org
[m]
I think the actual integration should be pretty easy, either as Java tool or as external process
Ichoran
@Ichoran
I never get tired of stuff like that just working in mill after years of it seeming like it should work in sbt instead of everything being on fire instead :laughing:
Tobias Roeser
@tobiasroeser:matrix.org
[m]
But I'm not familiar with JMH, so I can't tell details
Ichoran
@Ichoran
Yeah. I'll have to judge my level of motivation here. Running it as a second test suite (not JMH, but in-JVM) is so easy that it's tempting to just do that.
Thanks! I'll probably need help with the integration if I decide it's necessary, but I'll run some manually and see whether I think it's critical.
Tobias Roeser
@tobiasroeser:matrix.org
[m]
Sure. I'll try to help. If you can show me how to run it manually, I probably can sketch a prototype
Lorenzo Gabriele
@lolgab
@Ichoran sjsonnet uses jmh and mill for its benchmarks: https://github.com/databricks/sjsonnet/blob/master/bench/src/main/scala/sjsonnet/MainBenchmark.scala
You can take some inspiration there, maybe
Ichoran
@Ichoran
@lolgab - Great, thanks for the pointer!
Hm, the documentation says to run the benchmarks with sbt :/
Lorenzo Gabriele
@lolgab
Oh no :-/ I guess we need mill-jmh
discobaba
@uncleweirdo_twitter
@tobiasroeser:matrix.org I started a compile last night and it was still compiling the same thing over and over when I got back this morning. I guess that problem hasn't found a cure, yet. It was just looping over the top project, no sub-projects, whatever that implies. Seeing as getting you something to build was a bust, I was wondering if your system is such that you could just add pile of logging and put an unadvertised/unsupported version somewhere where a change to .mill-version would pick it up and allow users to help you debug. Just a random thought ...
discobaba
@uncleweirdo_twitter
@tobiasroeser:matrix.org A clue is that as it compiles over and over, it doesn't agree on the number of sources. One time it is 2 Scala sources and 24 Java sources then 4 Scala sources and 180 Java sources and so on. Number of java files should be more like 600. It was working recently. Maybe I can figure out what broke it ...
Tobias Roeser
@tobiasroeser:matrix.org
[m]
You could override the target and print all files out to get a first clue.
discobaba
@uncleweirdo_twitter
Not that I overrode the target, but > mill show reds.allSourceFiles | grep ref | wc -l
[1/1] show
[1/1] show > [2/5] reds.sources
622
David Francoeur
@daddykotex

hi, thanks for everything
we're using mill a lot here and sometimes we write or own plugins (libraries pull in other builds)
we started looking into writing test for those and so far we've had to grab a copy of https://github.com/com-lihaoyi/mill/blob/main/main/test/src/util/TestEvaluator.scala to run our test

would you be interested in a PR that does the following:

  1. extract this class (and part of the requirements (TestUtils, for example)) into a module to be published
  2. remove utest explicit dependency so that the user leveraging TestEvaluator can use it with another test framework

(cross posting from scala#com-lihaoyi)

Tobias Roeser
@tobiasroeser:matrix.org
[m]
Hi @daddykotex ! Great that you enjoy Mill. This sounds interesting.
Out of interest: Have you tried (or are you aware of) mill-integrationtest, a plugin specifically for testing mill plugins? It is more loosely coupled to Mill than TestEvaluator, but on the other side, it allows more integrationtest-like setups and also supports tests against different Mill versions.
Maybe, you can share some test, so we can get a better idea how a test setup and a test case might look like.
David Francoeur
@daddykotex
ahh, let me check mill-integrationtest out
our test is very simple, we have a model that has a task writing files to a path and returning a pathref
our test is just running the test (using the TestEvaluator) and ensuring files were written to disk
Tobias Roeser
@tobiasroeser:matrix.org
[m]
Here is my disclaimer, I wrote mill-integrationtest. ;-)
David Francoeur
@daddykotex

Here is my disclaimer, I wrote mill-integrationtest. ;-)

I've seen that, that does not bother me :)

Brian Maso
@bmaso
Is there a way to set the repositories used by the $ivy magic import on the command-line, or use environment variables? I would prefer not to use interp.repostiroies() ++= ... or import $repo if at all possible.
3 replies
Brian Maso
@bmaso

There seems to be what I would consider to be an error in mill 0.10.4 -- possibly in earlier version (I haven't checked). Here's what I see:

I've defined the following in a JAR archive that I build locally and add to the local maven repo (local maven coordinate "bmaso::mylib:0.0.1", package bmaso):

package bmaso

import upickle.default.{ReadWriter => RW, macroRW}

case class DatasetFile(filename: String, timestamp: Long, size: Long)

object DatasetFile {
  //...upickle RW so I can use this as the value type of a mill target...
  implicit val rw: RW[DatasetFile] = macroRW
}

I have this very simple build.sc script:

import $repo.`file://<my home dir>/.m2/repository`
import mill._, scalalib._
import $ivy.`bmaso::mylib:0.0.1`, bmaso._

def test = T {
  DatasetFile("test", 1L, 1L)
}

I would expect mill show test to just spit out the JSON representation of that DatasetFile object. Instead I get the following stack trace:

Exception in thread "MillServerActionRunner" java.lang.NoClassDefFoundError: scala/Serializable
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        ...(elided for readability)...
Caused by: java.lang.ClassNotFoundException: scala.Serializable
    at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
    at ammonite.runtime.SpecialClassLoader.findClass(ClassLoaders.scala:241)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 80 more
Could it be that using a custom value type loaded from a dynamically defined repo is simply not supported?
Brian Maso
@bmaso
It all works fine if you define the custom case class and its ReadWriter in a jar loaded from the startup set of repos, or defined in the script itself, or in a script imported from a static location (using $file). You just can't load from a JAR loaded from a dynamically-defined repo location
Lorenzo Gabriele
@lolgab
Interesting! Ammonite has special classloader code and it might be causing what you say. Can you open a bug with a minimal reproduction? It might be a solvable problem :)
David Francoeur
@daddykotex

Out of interest: Have you tried (or are you aware of) mill-integrationtest, a plugin specifically for testing mill plugins? It is more loosely coupled to Mill than TestEvaluator, but on the other side, it allows more integrationtest-like setups and also supports tests against different Mill versions.

I gave it a shot, but I got blocked. Our plugin pulls dependencies from an internal artifactory. When the IT test runs, it tries to pull dependencies maven central instead. it ignores the configured repositoriesTask. I tried configuring it in multiple places but I did not succeed (our plugin configures it, I added the configuration to the ittest module I created, I also added the configuration in the test itself)

7 replies
Tobias Roeser
@tobiasroeser:matrix.org
[m]
You can add additional content via perTestResources (see documentation: https://github.com/lefou/mill-integrationtest#configuration-and-targets), which could be a shared.sc which you generate and include in each project under test
3 replies