Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 24 21:02

    github-actions[bot] on gh-pages

    Updated github pages from commi… (compare)

  • May 24 20:42

    lefou on main

    Update trees to 4.5.8 (#1885) … (compare)

  • May 24 20:42
    lefou closed #1885
  • May 24 19:16
    scala-steward opened #1885
  • May 24 18:03
    lefou closed #1302
  • May 24 12:38

    github-actions[bot] on gh-pages

    Updated github pages from commi… (compare)

  • May 24 12:35

    lefou on main

    Add 'new' command for creating … Implement Giter8Module as an ex… Address PR comments and 5 more (compare)

  • May 24 12:35
    lefou closed #1874
  • May 24 07:49
    sake92 synchronize #1874
  • May 23 20:10
    sake92 synchronize #1874
  • May 23 13:46
    sake92 synchronize #1874
  • May 21 16:37
    lefou closed #1883
  • May 21 16:37
    lefou edited #1866
  • May 21 13:09
    scala-steward opened #1883
  • May 21 10:33
    sake92 edited #1874
  • May 21 10:33
    sake92 synchronize #1874
  • May 21 05:22

    lihaoyi on bump-upickle-2

    Update build.sc (compare)

  • May 21 05:22
    lihaoyi synchronize #1866
  • May 20 12:53
    sake92 synchronize #1874
  • May 19 05:52

    github-actions[bot] on gh-pages

    Updated github pages from commi… (compare)

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
cc @daddykotex
Simon Parten
@Quafadas

I have the feeling that something silly is happening, but I can't see it. Can anyone?

import $ivy.`com.disneystreaming.smithy4s::smithy4s-codegen:0.12.16`

import coursier.maven.MavenRepository
import mill._
import mill.api.PathRef
import mill.scalalib._
import os.Path
import smithy4s.codegen.{Codegen => Smithy4s}
import smithy4s.codegen.CodegenArgs

import scala.util._

trait Smithy4sModule extends ScalaModule {
}

And I get this;

Compiling /Users/simon/Code/mill-full-stack/mill-full-stack/project/smithy4s.sc
/Users/simon/Code/mill-full-stack/mill-full-stack/project/smithy4s.sc:8: value codegen is not a member of object ammonite.$file.project.smithy4s
import smithy4s.codegen.{Codegen => Smithy4s}
IT's successfully downloaded the artefacts, but is claiming that smithy4s.codegen isn't part of them.
Which as far as I can tell, it is!
Would anyone have a hint on where to start?
Lorenzo Gabriele
@lolgab
@Quafadas I think the problem is that the file is called smithy4s which Ammonite uses to create the object smithy4s which wraps your code. You need to either change the imports to import _root_.smithy4s.codegen.{Codegen => Smithy4s} etc. or rename the file to some other name.
Simon Parten
@Quafadas
@lolgab Thankyou... it had the feeling of something silly, and it was exactly this.
Tobias Roeser
@tobiasroeser:matrix.org
[m]
haha, that's probably the most easy to create and hard to debug issue with Mill. Once a co-worker of me placed some scripts into a mill dir, and everthing went crazy.
Simon Parten
@Quafadas
:-)
JulGvoz
@JulGvoz
image.png
So I just installed mill, but it's pretty much invisible on my shell
JulGvoz
@JulGvoz
I know that I could just run every command with --color false, but that's very bothersome. Is there some option I can set somewhere?
1 reply
discobaba
@uncleweirdo_twitter
@tobiasroeser:matrix.org A clue on the compiling forever problem: the 9.x versions fail, too, after 0.9.4.
1 reply
Sakib Hadžiavdić
@sake92
What is the easiest way to have cross jvm/js project?
Similar to https://github.com/portable-scala/sbt-crossproject CrossType.Full
3 replies
Should I just override sources to add shared folder too?
jilen
@jilen
Hi, how can I avoid fully rebuild while only updating a single dependency version in build file ?
Tobias Roeser
@tobiasroeser:matrix.org
[m]
As long as you need to change the build.sc, you can't avoid it.
Li Haoyi
@lihaoyi
the Zinc incremental compiler helps sometimes, but yeah Mill isn't smart enough to do fine grained invalidation
jilen
@jilen
Does mill support remote cache ? I want to run a CI job to update dependency in the midnight, and others can reuse that build cache the next day.
Tobias Roeser
@tobiasroeser:matrix.org
[m]
Mill uses coursier to cache Maven/Ivy dependencies, so yes, you can cache the coursier specific cache/storage directory and restore before each CI-run, to avoid unnecessary downloads.
But compiler output and everything under ./out does not support distribution
jilen
@jilen
Ok, understood.
Seems currently I can use the CI cache facility to cache the output
But no builtin support to store output to aws s3 or something else.
Right ?
Tobias Roeser
@tobiasroeser:matrix.org
[m]
right
Christophe Pache
@chpache

Hi there, I have troubles to get one module of my project in Intellij. Could someone help me to understand this error (which should have been fixed, so I expect my conf to cause this trouble):

mill.scalalib.GenIdea.idea java.lang.Exception: Duplicated item inserted into OrderedSet: /home/project/out/project/itest/resources.dest/resources

The only difference with other ScalaModules is that I compile other modules to test those jars:

object itest extends IntegrationTests {
    def moduleDeps = super.moduleDeps ++ Seq(main.test)

    def programAsItResource(dest: os.Path, jar: PathRef, name: String) = {
      val folder = dest / "resources"
      val targetFolder = folder / "programs"
      os.makeDir.all(targetFolder)
      os.hardlink(targetFolder / s"$name.jar", jar.path)
      PathRef(folder)
    }

    override def resources = T.sources {
      super.resources() :+
        programAsItResource(T.dest, program.jar(), "program") :+
        programAsItResource(T.dest, local_error.jar(), "local_error")
    }
  }
Tobias Roeser
@tobiasroeser:matrix.org
[m]
The code you posted does indeed add that same folder two times. Looks like you've imported mill.api.Strict.Agg which enforces uniqueness strictly. You can instead use mill.api.Loose.Agg or just mill.Agg.
Sakib Hadžiavdić
@sake92
Support for creating new projects from giter8 is merged, you can try mill -i init sake92/mill-scala-hello.g8 with latest snapshot. We should probably try to upgrade some often used giter8 repos to support Mill too!
Tobias Roeser
@tobiasroeser:matrix.org
[m]
I don't know g8 very well. Is there some support for "tools", in the meaning, we set some default variable like tools=mill and the template can decide whether it should create a build.sc vs. a build.sbt?
An update to the documentation which contains the g8 feature would be very nice, before we release the next version.
4 replies
Christophe Pache
@chpache
@tobiasroeser:matrix.org Thanks a lot! I finally returned only once the folder and it worked.
Sakib Hadžiavdić
@sake92
@tobiasroeser:matrix.org it has support for conditionally creating files, but only for yes/no, you cant write "if tool==mill"
It would be ok-ish to have both build tools, there are some repos that have both maven and gradle builds supported
For example we could add a build.sc here https://github.com/playframework/play-scala-seed.g8/tree/2.8.x/src/main/g8 and people could use it with mill
At least for start
Later we could figure out something with conditionals maybe
Lorenzo Gabriele
@lolgab
Since mill also has other conventions for the directory structure, maybe it's worth to have a separate g8 specific to mill.
1 reply
ex0ns
@ex0ns

I want to run two mill commands in two different shell (one to watch changes and restart my API, and the other one to reload my frontend):

mill -w   __.frontend.public # shell number 1
mill -w   __.backend.runBackground # shell number 2

however I notice that as soon as I run the second one, a new MillServerMain process appears, which make me think that they are not using the same mill server:

% jps -l                                                       ✹
3283331 mill.main.client.MillClientMain
3283361 mill.main.MillServerMain <-- this
3283431 jdk.jcmd/sun.tools.jps.Jps
3283092 mill.main.MillServerMain <--- this
3127320 bloop.Server
3283147 mill.scalalib.backgroundwrapper.BackgroundWrapper
3249739 scala.meta.metals.Main
3283069 mill.main.client.MillClientMain

Is there a way to run multiple mill client against the same server ?
Note that I've tried to run mill -w __.frontend.public + __.backend.runBackground but in this specific case it does not work because each time the frontend is changed the backend is restarted as well

Tobias Roeser
@tobiasroeser:matrix.org
[m]
Each Mill server is serving a single client. We keep up to 5 servers running in parallel and stop them when idle for a while.
1 reply
Damian Reeves
@DamianReeves
Is there a way to enable watch in the build repl?
i.e. to watch on compile