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

methodCodeHashSignatures throw a os.ResourceNotFoundException #3874

Open
lefou opened this issue Oct 30, 2024 · 1 comment
Open

methodCodeHashSignatures throw a os.ResourceNotFoundException #3874

lefou opened this issue Oct 30, 2024 · 1 comment
Labels
bug The issue represents an bug

Comments

@lefou
Copy link
Member

lefou commented Oct 30, 2024

Just before the build failure, I deleted the tests object from a Scala source file under mill-build/src (see below). I did not change the Mill version.

> mill --version
Mill Build Tool version 0.12.1-7-d8bbe5
Java version: 21.0.4, vendor: Eclipse Adoptium, runtime: /opt/openjdk-bin-21.0.4_p7
Default locale: de_DE, platform encoding: UTF-8
OS name: "Linux", version: 6.1.90-gentoo-x86_64, arch: amd64

This is probably related to

Here's the stack trace:

1 tasks failed
methodCodeHashSignatures os.ResourceNotFoundException: java.net.URLClassLoader@1450ee23/comfisbuild/BuildTemplate$tests$.class
    os.ResourcePath.getInputStream(ResourcePath.scala:21)
    os.read$inputStream$.apply(ReadWriteOps.scala:245)
    mill.codesig.ExternalSummary$.load0$1(ExternalSummary.scala:55)
    mill.codesig.ExternalSummary$.$anonfun$apply$6(ExternalSummary.scala:48)
    scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
    scala.collection.mutable.HashMap.getOrElse(HashMap.scala:451)
    mill.codesig.ExternalSummary$.load$1(ExternalSummary.scala:48)
    mill.codesig.ExternalSummary$.$anonfun$apply$9(ExternalSummary.scala:69)
    mill.codesig.ExternalSummary$.$anonfun$apply$9$adapted(ExternalSummary.scala:69)
    scala.collection.immutable.BitmapIndexedSetNode.foreach(HashSet.scala:951)
    scala.collection.immutable.HashSet.foreach(HashSet.scala:958)
    mill.codesig.ExternalSummary$.apply(ExternalSummary.scala:69)
    mill.codesig.CodeSig$.compute(CodeSig.scala:17)
    mill.runner.MillBuildRootModule.$anonfun$methodCodeHashSignatures$2(MillBuildRootModule.scala:173)
    mill.define.Task$TraverseCtx.evaluate(Task.scala:215)

This project has a meta-build which defines some traits to be used in the build.sc.

Here is a sketch of the relevant parts of the project:

// file: build.sc
package build

object `package` extends RootModule with comfisbuild.BuildTemplate 
// file: mill-build/src/BuildTemplate.scala
package comfisbuild

trait BuildTemplate extends Module {

  // this one I deleted just before the os.ResourcesNotFoundException
  object tests extends TaskModule {
    override def defaultCommandName(): String = "tests"
    /** Prints a test summary for each passed test task. */
    def tests(@mainargs.arg(positional = true) testTasks: mill.main.Tasks[(String, Seq[TestResult])]): Command[Unit] = T.command {
      val res = T.sequence(testTasks.value)()
      T.log.outputStream.println(ComfisUtil.formatTestSummary(res))
    }
  }
}
@lefou lefou added the bug The issue represents an bug label Oct 30, 2024
@lefou lefou changed the title mehtodCodeHashSignatures throw a os.ResourceNotFoundException methodCodeHashSignatures throw a os.ResourceNotFoundException Oct 30, 2024
@lihaoyi
Copy link
Member

lihaoyi commented Oct 30, 2024

@lefou did you manage to zip up the classfiles in out/mill-build/compile.dest/ to look at? So we can see which class is still referencing BuildTemplate$tests$.class and causing Mill to try and load it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue represents an bug
Projects
None yet
Development

No branches or pull requests

2 participants