-
-
Notifications
You must be signed in to change notification settings - Fork 353
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 a Netty example build.sc
and write about it
#3326
Conversation
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.
Great case study.
$ time ./mvnw -DskipTests -Dcheckstyle.skip -Denforcer.skip=true clean install | ||
|
||
$ time ./mill clean __.compile |
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 think these are not fair comparisions. We either also run jar
in Mill or we don't install
in Maven.
$ time ./mvnw -DskipTests -Dcheckstyle.skip -Denforcer.skip=true clean install | |
$ time ./mill clean __.compile | |
$ time ./mvnw -DskipTests -Dcheckstyle.skip -Denforcer.skip=true clean compile testCompile | |
$ time ./mill clean __.compile |
Running just compile
sometimes works in a Maven reactor build, sometimes not. Need to check.
Alternatively, we need to run jar
in Mill.
$ time ./mvnw -DskipTests -Dcheckstyle.skip -Denforcer.skip=true clean install | |
$ time ./mill clean __.compile | |
$ time ./mvnw -DskipTests -Dcheckstyle.skip -Denforcer.skip=true clean install | |
$ time ./mill clean __.jar |
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.
The thing is, in Mill the common workflow is running compile
, while in Maven the equivalent workflow is running install
. AFAICT, this is because Maven uses ~/.m2/local
for passing dependencies between subprojects, while Mill doesn't.
Part of the reason Mill is faster is because it does less work, but I don't think that makes the comparison unfair. In the end, nobody runs compile
in Maven or jar
in Mill. mvn install
and mill compile
are equivalent user workflows
In general, the Mill snippet contains all the same information as the Maven snippet: the name | ||
of the module and its dependency on `common`. Much of the other information in the Maven XML | ||
is inherited from the `trait NettyModule` we defined earlier in the file, where it can be | ||
shared with the rest of the modules rather than being duplicated for each one. This means |
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.
shared with the rest of the modules rather than being duplicated for each one. This means | |
shared with the rest of the modules rather than being duplicated for each one. |
|
||
While Mill cannot make the complexity of your build disappear, what it can do is give you | ||
the tools necessary to manage it. In this case, it means the JNI-related logic can be defined | ||
once and re-used, rather than duplicating it as is often done in Maven `pom.xml`s. |
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.
once and re-used, rather than duplicating it as is often done in Maven `pom.xml`s. | |
once and re-used, rather than duplicating it as is often done in Maven ``pom.xml``s. |
val context = new java.util.HashMap[String, Object] | ||
|
||
context.put("collection.template.dir", "common/src/main/templates") | ||
context.put("collection.template.test.dir", "common/src/test/templates") | ||
context.put("collection.src.dir", (T.dest / "src").toString) | ||
context.put("collection.testsrc.dir", (T.dest / "testsrc").toString) | ||
|
||
shell.setProperty("properties", context) |
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.
val context = new java.util.HashMap[String, Object] | |
context.put("collection.template.dir", "common/src/main/templates") | |
context.put("collection.template.test.dir", "common/src/test/templates") | |
context.put("collection.src.dir", (T.dest / "src").toString) | |
context.put("collection.testsrc.dir", (T.dest / "testsrc").toString) | |
shell.setProperty("properties", context) | |
val context = Map[String, Object]( | |
"collection.template.dir" -> "common/src/main/templates", | |
"collection.template.test.dir" -> "common/src/test/templates", | |
"collection.src.dir" -> (T.dest / "src").toString, | |
"collection.testsrc.dir" -> (T.dest / "testsrc").toString | |
) | |
import scala.jdk.CollectionConverters._ | |
shell.setProperty("properties", context.asJava) |
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'd like to leave this as is, since we're interoping with Java libraries, and this example is meant to be readable to Java programmers. Scala is more idiomatic Mill, but staying in java.util.HashMap
-land will be much more familiar and less scary
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 almost expected this answer as I had the same thought. ;)
@@ -16,46 +16,334 @@ To do this, we have written a Mill `build.sc` file for the Netty project. This c | |||
with Mill to build and test the various submodules of the Netty project without needing to | |||
change any other files in the repository: | |||
|
|||
- ???[Netty `build.sc` file] | |||
- https://github.com/com-lihaoyi/mill/blob/main/example/thirdparty/netty/build.sc[Netty `build.sc` file] |
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.
- https://github.com/com-lihaoyi/mill/blob/main/example/thirdparty/netty/build.sc[Netty `build.sc` file] | |
- {mill-github-url}/blob/main/example/thirdparty/netty/build.sc[Netty `build.sc` file] |
build.sc
and write about itbuild.sc
and write about it
No description provided.