Skip to content

Commit

Permalink
Deduplicate input tasks in inspect command (#3102)
Browse files Browse the repository at this point in the history
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.

Pull request: #3102
  • Loading branch information
lefou authored Mar 27, 2024
1 parent 36c5217 commit 13a31e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main/src/mill/main/MainModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ trait MainModule extends mill.define.Module {
"\n",
ctx.applyPrefixColor("Inputs").toString,
":"
) ++ t.inputs.distinct.iterator.flatMap(rec).map("\n " + _.render)
) ++ t.inputs.iterator.flatMap(rec).map("\n " + _.render).distinct
}
}

Expand Down

0 comments on commit 13a31e5

Please sign in to comment.