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

Added --import command-line option #1526

Merged
merged 8 commits into from
Oct 14, 2021
Merged

Conversation

lefou
Copy link
Member

@lefou lefou commented Oct 12, 2021

Motivation: Some plugins provide "External Modules" which can be used by mill without modifying the build.sc.

With this PR applied, you can run targets from external modules from the command-line without touching the build.sc.

Example:

$ dev-mill --plugin ivy:de.tototec::de.tobiasroeser.mill.vcs.version_mill0.10.0-M2:0.1.2 show de.tobiasroeser.mill.vcs.version.VcsVersion/vcsState
[1/1] show 
[1/1] show > [1/1] de.tobiasroeser.mill.vcs.version.VcsVersion.vcsState 
{
    "currentRevision": "5f6538e3cb7191c0a8c778f9d47601967b744036",
    "lastTag": [
        "0.10.0-M3"
    ],
    "commitsSinceLastTag": 36,
    "dirtyHash": [

    ]
}

This PR also add support for empty versions in $ivy-imports, which will get expanded to the exact mill version. This makes consuming mill contrib plugins even more easy.

Example: Generating Bloop Config without modyfing the build.sc

mill --plugin ivy:com.lihaoyi::mill-contrib-bloop: mill.contrib.bloop.Bloop/install

@lefou
Copy link
Member Author

lefou commented Oct 14, 2021

@lihaoyi I'm asking for a review or comment here. I'm myself a bit undecided. I think the --plugin options is useful, but I'm not sure about its name, the syntax (especially the "ivy:" prefix to match meaning of $ivy so we can later support others too) and also the new feature of leaving out the version (affects also import $ivy) to substitute the current mill version. The motivation for the version was twofold: convenience in build.sc but also the fact it's hard to escape the variable substitution of the used shell to provide a $MILL_VERSION in the command-line.

@lefou lefou requested a review from lihaoyi October 14, 2021 07:35
@lihaoyi
Copy link
Member

lihaoyi commented Oct 14, 2021

@lefou I think it looks reasonable to me; I don't have a use for it, but I imagine others might. Maybe call it --import ivy:foo, for symmetry with the import $ivy.foo syntax we use in the build.sc file?

@lefou
Copy link
Member Author

lefou commented Oct 14, 2021

@lihaoyi Thank you! I like --import.

Potential users are @scala-steward and Metals, which want to run mill with additional external modules.

@lefou lefou changed the title Added --plugin command-line option Added --import command-line option Oct 14, 2021
@lefou lefou merged commit 5de0742 into com-lihaoyi:main Oct 14, 2021
@lefou lefou deleted the plugin-param branch October 14, 2021 10:30
@lefou lefou added this to the after 0.10.0-M3 milestone Oct 14, 2021
lefou added a commit to lefou/mill that referenced this pull request Nov 11, 2021
With this PR applied, you can run targets from external modules from the command-line without touching the `build.sc`.

Example:

```
dev-mill --plugin ivy:de.tototec::de.tobiasroeser.mill.vcs.version_mill0.10.0-M2:0.1.2 show de.tobiasroeser.mill.vcs.version.VcsVersion/vcsState
```

This PR also add support for empty versions in $ivy-imports, which will get expanded to the exact mill version. This makes consuming mill contrib plugins even more easy.

Example: Generating Bloop Config without modifying the `build.sc`

```
mill --plugin ivy:com.lihaoyi::mill-contrib-bloop: mill.contrib.bloop.Bloop/install
```

See pull request: com-lihaoyi#1526
lefou added a commit that referenced this pull request Nov 11, 2021
With this PR applied, you can run targets from external modules from the command-line without touching the `build.sc`.

Example:

```
dev-mill --plugin ivy:de.tototec::de.tobiasroeser.mill.vcs.version_mill0.10.0-M2:0.1.2 show de.tobiasroeser.mill.vcs.version.VcsVersion/vcsState
```

This PR also add support for empty versions in $ivy-imports, which will get expanded to the exact mill version. This makes consuming mill contrib plugins even more easy.

Example: Generating Bloop Config without modifying the `build.sc`

```
mill --plugin ivy:com.lihaoyi::mill-contrib-bloop: mill.contrib.bloop.Bloop/install
```

See pull request: #1526

Pull request: #1562
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