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

Add in ability to pass in whatDependsOn to JavaModule.ivyDepsTree #2191

Merged
merged 2 commits into from
Dec 15, 2022

Conversation

ckipp01
Copy link
Contributor

@ckipp01 ckipp01 commented Dec 11, 2022

This pr introduces the ability to also pass in whatDependsOn when using the ivyDepsTree command. For example if you were to use the following:

mill main.ivyDepsTree

You'd get a giant tree to parse through or maybe grep if you're looking for something specific. Coursier has the ability to target specific entries in the tree and treat those at roots in order for you to clearly see where they come from. To give a couple examples, you can now pass in multiple --whatDependsOn to get the minimal trees you're looking for.

An example of one

❯ ./mill -i dev.run ~/Documents/scala-workspace/com-lihaoyi/mill  main.ivyDepsTree --whatDependsOn com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_2.13
[69/780] de.tobiasroeser.mill.vcs.version.VcsVersion.vcsState
[780/780] dev.run
[33/33] main.ivyDepsTree
└─ com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_2.13:2.13.5
   ├─ io.get-coursier:coursier_2.13:2.1.0-RC1
   └─ org.virtuslab.scala-cli:config_2.13:0.1.16
      └─ io.get-coursier:coursier-cache_2.13:2.1.0-RC1
         └─ io.get-coursier:coursier_2.13:2.1.0-RC1

An example of what it looks like when passing in multiple

❯ ./mill -i dev.run ~/Documents/scala-workspace/com-lihaoyi/mill  main.ivyDepsTree --whatDependsOn com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_2.13 --whatDependsOn org.jline:jline
[69/780] de.tobiasroeser.mill.vcs.version.VcsVersion.vcsState
[780/780] dev.run
[33/33] main.ivyDepsTree
├─ com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_2.13:2.13.5
│  ├─ io.get-coursier:coursier_2.13:2.1.0-RC1
│  └─ org.virtuslab.scala-cli:config_2.13:0.1.16
│     └─ io.get-coursier:coursier-cache_2.13:2.1.0-RC1
│        └─ io.get-coursier:coursier_2.13:2.1.0-RC1
└─ org.jline:jline:3.21.0
   └─ org.scala-lang:scala-compiler:2.13.10
      ├─ com.lihaoyi:ammonite-compiler_2.13.10:2.5.5
      │  └─ com.lihaoyi:ammonite_2.13.10:2.5.5
      ├─ com.lihaoyi:mill-moduledefs_2.13:0.10.9
      │  └─ com.lihaoyi:scalac-mill-moduledefs-plugin_2.13.10:0.10.9
      └─ com.lihaoyi:scalac-mill-moduledefs-plugin_2.13.10:0.10.9

I used the trick you showed me in
#2033 (reply in thread) so I believe this should be done in a compatible way.

scalalib/src/JavaModule.scala Outdated Show resolved Hide resolved
scalalib/src/JavaModule.scala Show resolved Hide resolved
@lefou
Copy link
Member

lefou commented Dec 13, 2022

Thank you @ckipp01 for this PR. I'll need some more time to do a review. For context, I'm still in search of a principled approach to evolve commands with arguments in a convenient but compatible way.

Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this PR essentially contains a new feature which I really like and introduces some new experimental pattern for commands. I think we need to get more experience with the latter, so I won't address it now. I'll open a discussion when I find the time. Just for now, it's probably fair to tell you, that it's not clear if we will keep it like it is in this PR or change it.

Feature wise, the only thing I'm missing is a better guide for the user on how to use it. The PR description is already very good, but we either need to add some more info what kind of parameters the command parameter --whatDependsOn accepts to the scaladoc (which can be read with mill inspect foo.ivyDepsTree) or we need to add something to the documentation. Ideally we do both.

@lefou
Copy link
Member

lefou commented Dec 15, 2022

There is a section about ivyDepsTree in docs/antora/modules/ROOT/pages/Library_Dependencies.adoc

@ckipp01
Copy link
Contributor Author

ckipp01 commented Dec 15, 2022

Just for now, it's probably fair to tell you, that it's not clear if we will keep it like it is in this PR or change it.

That's totally fine. I'm glad I can be a guinea pig using this approach and hopefully it will provide insight into the best way to do this moving forward.

Ideally we do both.

For sure, let me add both.

@ckipp01 ckipp01 requested a review from lefou December 15, 2022 08:37
This pr introduces the ability to also pass n `whatDependsOn` when using
the `ivyDepsTree` command. For example if you were to use the following:

```
mill main.ivyDepsTree
```

You'd get a giant tree to parse through or maybe grep if you're looking
for something specific. Coursier has the ability to target specific
entries in the tree and treat those at roots in order for you to clearly
see where they come from. To give a couple examples, you can now pass in
multiple `--whatDependsOn` to get the minimal trees you're looking for.

_An example of one_

```
❯ ./mill -i dev.run ~/Documents/scala-workspace/com-lihaoyi/mill  main.ivyDepsTree --whatDependsOn com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_2.13
[69/780] de.tobiasroeser.mill.vcs.version.VcsVersion.vcsState
[780/780] dev.run
[33/33] main.ivyDepsTree
└─ com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_2.13:2.13.5
   ├─ io.get-coursier:coursier_2.13:2.1.0-RC1
   └─ org.virtuslab.scala-cli:config_2.13:0.1.16
      └─ io.get-coursier:coursier-cache_2.13:2.1.0-RC1
         └─ io.get-coursier:coursier_2.13:2.1.0-RC1
```

_An example of what it looks like when passing in multiple_

```
❯ ./mill -i dev.run ~/Documents/scala-workspace/com-lihaoyi/mill  main.ivyDepsTree --whatDependsOn com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_2.13 --whatDependsOn org.jline:jline
[69/780] de.tobiasroeser.mill.vcs.version.VcsVersion.vcsState
[780/780] dev.run
[33/33] main.ivyDepsTree
├─ com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_2.13:2.13.5
│  ├─ io.get-coursier:coursier_2.13:2.1.0-RC1
│  └─ org.virtuslab.scala-cli:config_2.13:0.1.16
│     └─ io.get-coursier:coursier-cache_2.13:2.1.0-RC1
│        └─ io.get-coursier:coursier_2.13:2.1.0-RC1
└─ org.jline:jline:3.21.0
   └─ org.scala-lang:scala-compiler:2.13.10
      ├─ com.lihaoyi:ammonite-compiler_2.13.10:2.5.5
      │  └─ com.lihaoyi:ammonite_2.13.10:2.5.5
      ├─ com.lihaoyi:mill-moduledefs_2.13:0.10.9
      │  └─ com.lihaoyi:scalac-mill-moduledefs-plugin_2.13.10:0.10.9
      └─ com.lihaoyi:scalac-mill-moduledefs-plugin_2.13.10:0.10.9
```

I used the trick you showed me in
com-lihaoyi#2033 (reply in thread)
so I _believe_ this should be done in a compatible way.
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thank you!

@lefou lefou changed the title feat: add in ability to pass in whatDependsOn to ivyDepsTree Add in ability to pass in whatDependsOn to JavaModule.ivyDepsTree Dec 15, 2022
@lefou lefou merged commit 31d1761 into com-lihaoyi:main Dec 15, 2022
@lefou lefou added this to the 0.11.0-M1 milestone Dec 15, 2022
@ckipp01 ckipp01 deleted the whatDependsOn branch December 15, 2022 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants