com-lihaoyi / mill

Your shiny new Java/Scala build tool!
https://mill-build.com/
MIT License
2k stars 308 forks source link

Deduplicate input tasks in `inspect` command #3102

Closed lefou closed 3 months ago

lefou commented 3 months ago

Before, inspect may show multiple instances of the same input task:

> mill inspect main.docJar
...
main.docJar(ScalaModule.scala:332)
    The documentation jar, containing all the Javadoc/Scaladoc HTML files, for
    publishing to Maven Central

Inputs:
    main.compileClasspath
    main.scalaVersion
    main.scalaOrganization
    main.scalaDocClasspath
    main.scalacPluginClasspath
    main.scalaDocOptions
    main.scalaVersion
    main.scalaVersion
    main.docResources
    main.docSources
    main.scalaVersion
    main.docResources
    main.docSources
    main.docSources

After, it's only showing each input once:

> mill inspect main.docJar
...
main.docJar(ScalaModule.scala:332)
    The documentation jar, containing all the Javadoc/Scaladoc HTML files, for
    publishing to Maven Central

Inputs:
    main.compileClasspath
    main.scalaVersion
    main.scalaOrganization
    main.scalaDocClasspath
    main.scalacPluginClasspath
    main.scalaDocOptions
    main.docResources
    main.docSources

Please note, inspect isn't incorrect when showing multiple entries of the same input. Due to the generic implementation, tasks can depend on the same input multiple times. But since inspect does provide information to the user, it' not beneficial to list all raw dependencies.

lefou commented 3 months ago

This fixes a regression of https://github.com/com-lihaoyi/mill/pull/1558