-
Notifications
You must be signed in to change notification settings - Fork 2
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 mill module #9
Conversation
build.sbt
Outdated
@@ -44,14 +45,23 @@ lazy val `sbt-plugin` = projectMatrix | |||
.dependsOn(core) | |||
.enablePlugins(ScriptedPlugin) | |||
.settings( | |||
name := """sbt-vcpkg""", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sbt plugins are usually named sbt-xyz
. Why change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is still a draft PR and is constantly changing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end I think it will be sbt-vcpkg
and mill-vcpkg
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was to keep consistency with the vcpkg-core
module, but I'll abide with whatever @keynmol says
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with
core
sbt-vcpkg
mill-vcpkg
It seems to follow what ScalablyTyped is like and I want to mimic it.
Also, can be changed before the release, no biggie.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no problem, I'll amend it here :)
* Mill's native plugin constructs, which can then delegate to these functions, | ||
* keeping the build-tool-specific code down to a minimum. | ||
*/ | ||
trait VcpkgPluginImpl { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keynmol I've factored most of the logic that I had to repeat in this build-tool-agnostic trait.
This reduces the size of both sbt and mill plugins to ~65
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks great, thanks
import mill.api.{DummyInputStream, Result} | ||
|
||
// Borrowed from the mill codebase : https://github.com/Baccata/mill/blob/master/main/test/src/util/TestEvaluator.scala | ||
object TestEvaluator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've resorted to copying this test evaluator from mill's codebase, as it allows to tests plugins in unit tests (from SBT, or any build tool), which makes it drastically easier to set up than having SBT shell-out to a mill process in order to run integration tests.
I'll probably spend some to try and make this available from mill as an opt-in artifact, though not sure how easy it'll be to decouple it from upickle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, is it possible to just run mill's integration tests as a separate stage?
We no longer have sbt-gha so if it's easier, you can just add a mill stage to the workflow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer have sbt-gha so if it's easier, you can just add a mill stage to the workflow?
The problem is really that you'd have to add an explicit call to publishLocal
from SBT before being able to run the tests from mill, which is like, totally fair enough in CI, but utterly shite in terms of developer experience on local machines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright.
Not fantastic that a copypasta has to live here, so I sure hope at some point it can be made into a dependency.
At this point it's more important to have a mill plugin + tests, so let's keep it this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I sure hope at some point it can be made into a dependency.
I hope so too, I have a number of usecases for this
import mill.util.TestEvaluator | ||
import mill.util.TestUtil | ||
|
||
object VcpkgModuleSpec extends utest.TestSuite { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what the tests of mill plugins look like (once the TestEvaluator is made available). It looks quite decent and has the quality of being runnable from sbt as a mere test
task call
Can you also add a Without the binding generator part, as it doesn't have Mill plugin yet :) Just to show the usage and eventually I want to make it runnable on CI |
Sure. I can make a manual binding to show end to end usage. I'll get on it later today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add example in this PR.
I'm happy with it as is, and if you are as well let's hit that like and subscribe button merge button
Adds a mill module
com.indoorvivants.vcpkg
(to make it easier for Anton to get relevant stats from sonatype)Addresses #5