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

Move package mill statement after comments in examples #3475

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions example/depth/cross/1-simple/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
// Mill handles cross-building of all sorts via the `Cross[T]` module.

package build
import mill._

object foo extends Cross[FooModule]("2.10", "2.11", "2.12")
Expand Down
3 changes: 1 addition & 2 deletions example/depth/cross/10-static-blog/build.mill
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package build
// The following example demonstrates a use case: using cross modules to
// turn files on disk into blog posts. To begin with, we import two third-party
// libraries - Commonmark and Scalatags - to deal with Markdown parsing and
// HTML generation respectively:

package build
import $ivy.`com.lihaoyi::scalatags:0.12.0`, scalatags.Text.all._
import $ivy.`com.atlassian.commonmark:commonmark:0.13.1`
import org.commonmark.parser.Parser
Expand Down
3 changes: 1 addition & 2 deletions example/depth/cross/2-cross-source-path/build.mill
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package build
// If you want to have dedicated ``millSourcePath``s, you can add the cross
// parameters to it as follows:

package build
import mill._

object foo extends Cross[FooModule]("2.10", "2.11", "2.12")
Expand Down
3 changes: 1 addition & 2 deletions example/depth/cross/3-outside-dependency/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
// You can refer to targets defined in cross-modules as follows:

package build
import mill._

object foo extends Cross[FooModule]("2.10", "2.11", "2.12")
Expand Down
3 changes: 1 addition & 2 deletions example/depth/cross/4-cross-dependencies/build.mill
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package build
// Targets in cross-modules can use one another the same way they are used from
// external targets:

package build
import mill._

object foo extends mill.Cross[FooModule]("2.10", "2.11", "2.12")
Expand Down
3 changes: 1 addition & 2 deletions example/depth/cross/5-multiple-cross-axes/build.mill
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package build
// You can have a cross-module with multiple inputs using the `Cross.Module2`
// trait:

package build
import mill._

val crossMatrix = for {
Expand Down
2 changes: 1 addition & 1 deletion example/depth/cross/6-axes-extension/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package build
// You can also take an existing cross module and extend it with additional cross
// axes as shown:
package build
import mill._

object foo extends Cross[FooModule]("a", "b")
Expand Down
1 change: 0 additions & 1 deletion example/depth/large/11-helper-files/util.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package build

import mill._, scalalib._

def myScalaVersion = "2.13.14"
Expand Down
1 change: 0 additions & 1 deletion example/depth/large/13-helper-files-mill-sc/util.mill.sc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package build

import mill._, scalalib._

def myScalaVersion = "2.13.14"
Expand Down
3 changes: 1 addition & 2 deletions example/depth/modules/7-modules/build.mill
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package build
// == Simple Modules
//
// The path to a Mill module from the root of your build file corresponds to the
// path you would use to run tasks within that module from the command line. e.g.
// for the following `build.mill`:

package build
import mill._

object foo extends Module {
Expand Down
3 changes: 1 addition & 2 deletions example/depth/modules/8-diy-java-modules/build.mill
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package build
// This section puts together what we've learned about ``Task``s and ``Module``s
// so far into a worked example: implementing our own minimal version of
// `mill.scalalib.JavaModule` from first principles.

package build
import mill._

trait DiyJavaModule extends Module{
Expand Down
3 changes: 1 addition & 2 deletions example/depth/tasks/1-task-graph/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
// The following is a simple self-contained example using Mill to compile Java:

package build
import mill._

def mainClass: T[Option[String]] = Some("foo.Foo")
Expand Down
3 changes: 1 addition & 2 deletions example/depth/tasks/2-primary-tasks/build.mill
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package build
// There are three primary kinds of _Tasks_ that you should care about:
//
// * <<_sources>>, defined using `T.sources {...}`
// * <<_targets>>, defined using `T {...}`
// * <<_commands>>, defined using `T.command {...}`

// === Sources

package build

import mill.{Module, T, _}

Expand Down
3 changes: 1 addition & 2 deletions example/depth/tasks/5-persistent-targets/build.mill
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package build
// Persistent targets defined using `T.persistent` are similar to normal
// ``Target``s, except their `T.dest` folder is not cleared before every
// evaluation. This makes them useful for caching things on disk in a more
// fine-grained manner than Mill's own Target-level caching.
//
// Below is a semi-realistic example of using a `T.persistent` target:

package build
import mill._, scalalib._
import java.util.Arrays
import java.io.ByteArrayOutputStream
Expand Down
3 changes: 1 addition & 2 deletions example/depth/tasks/6-workers/build.mill
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package build
// Mill workers defined using `T.worker` are long-lived in-memory objects that
// can persistent across multiple evaluations. These are similar to persistent
// targets in that they let you cache things, but the fact that they let you
// cache the worker object in-memory allows for greater performance and
// flexibility: you are no longer limited to caching only serializable data
// and paying the cost of serializing it to disk every evaluation. This example
// uses a Worker to provide simple in-memory caching for compressed files.

package build
import mill._, scalalib._
import java.util.Arrays
import java.io.ByteArrayOutputStream
Expand Down
3 changes: 1 addition & 2 deletions example/extending/plugins/7-writing-mill-plugins/build.mill
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package build
// This example demonstrates how to write and test Mill plugin, and publish it to
// Sonatype's Maven Central so it can be used by other developers over the internet
// via xref:Import_File_And_Import_Ivy.adoc[import $ivy].

// == Project Configuration

package build
import mill._, scalalib._, publish._
import mill.main.BuildInfo.millVersion

Expand Down
3 changes: 1 addition & 2 deletions example/javalib/basic/1-simple/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
//// SNIPPET:BUILD

package build
import mill._, javalib._

object `package` extends RootModule with JavaModule {
Expand Down
3 changes: 1 addition & 2 deletions example/javalib/basic/2-custom-build-logic/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
//// SNIPPET:BUILD

package build
import mill._, javalib._

object `package` extends RootModule with JavaModule {
Expand Down
3 changes: 1 addition & 2 deletions example/javalib/basic/3-multi-module/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
//// SNIPPET:BUILD

package build
import mill._, javalib._

trait MyModule extends JavaModule{
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/basic/4-builtin-commands/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._

trait MyModule extends JavaModule{
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/builds/1-common-config/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._

object `package` extends RootModule with JavaModule {
Expand Down
3 changes: 1 addition & 2 deletions example/javalib/builds/2-custom-tasks/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
//// SNIPPET:BUILD

package build
import mill._, javalib._

object `package` extends RootModule with JavaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/builds/3-override-tasks/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD1
package build
import mill._, javalib._

object foo extends JavaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/builds/4-nested-modules/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._

trait MyModule extends JavaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/builds/6-publish-module/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._, publish._

object foo extends JavaModule with PublishModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/builds/8-compat-modules/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:ALL
package build
import mill._, javalib._

object foo extends MavenModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/builds/9-realistic/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:ALL
package build
import mill._, javalib._, publish._

trait MyModule extends JavaModule with PublishModule {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._

object `package` extends RootModule with JavaModule{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._

object `package` extends RootModule with JavaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/module/11-assembly-config/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._
import mill.javalib.Assembly._

Expand Down
3 changes: 1 addition & 2 deletions example/javalib/module/12-repository-config/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
//// SNIPPET:BUILD1

package build
import mill._, javalib._
import mill.define.ModuleRef
import coursier.maven.MavenRepository
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/module/2-ivy-deps/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._

object `package` extends RootModule with JavaModule {
Expand Down
3 changes: 1 addition & 2 deletions example/javalib/module/3-run-compile-deps/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
//// SNIPPET:BUILD1

package build
import mill._, javalib._

object foo extends JavaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/module/5-resources/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._

object foo extends JavaModule {
Expand Down
3 changes: 1 addition & 2 deletions example/javalib/module/7-docjar/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
//// SNIPPET:BUILD

package build
import mill._, javalib._

object foo extends JavaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/module/8-unmanaged-jars/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._

object `package` extends RootModule with JavaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/module/9-main-class/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, javalib._

object `package` extends RootModule with JavaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/testing/1-test-suite/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD1
package build
import mill._, javalib._

object foo extends JavaModule {
Expand Down
3 changes: 1 addition & 2 deletions example/javalib/testing/2-test-deps/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
//// SNIPPET:BUILD

package build
import mill._, javalib._

object qux extends JavaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/javalib/testing/3-integration-suite/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD3
package build
import mill._, javalib._
object qux extends JavaModule {
object test extends JavaTests with TestModule.Junit5
Expand Down
3 changes: 1 addition & 2 deletions example/scalalib/basic/1-simple/build.mill
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package build
//// SNIPPET:BUILD

package build
import mill._, scalalib._

object `package` extends RootModule with ScalaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/scalalib/basic/2-custom-build-logic/build.mill
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package build
// Mill makes it very easy to customize your build graph, overriding portions
// of it with custom logic. In this example, we override the JVM `resources` of
// our `ScalaModule` - normally the `resources/` folder - to instead contain a
// single generated text file containing the line count of all the source files
// in that module

//// SNIPPET:BUILD
package build
import mill._, scalalib._

object `package` extends RootModule with ScalaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/scalalib/basic/3-multi-module/build.mill
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package build
//// SNIPPET:BUILD
package build
import mill._, scalalib._

trait MyModule extends ScalaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/scalalib/basic/4-builtin-commands/build.mill
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package build
// == Example `build.mill`
//
// The following examples will be assuming the `build.mill` file given below:

//// SNIPPET:BUILD
package build
import mill._, scalalib._

trait MyModule extends ScalaModule {
Expand Down
2 changes: 1 addition & 1 deletion example/scalalib/builds/1-common-config/build.mill
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package build
// This example shows some of the common tasks you may want to override on a
// `ScalaModule`: specifying the `mainClass`, adding additional
// sources/resources, generating resources, and setting compilation/run
// options.

//// SNIPPET:BUILD
package build
import mill._, scalalib._

object `package` extends RootModule with ScalaModule {
Expand Down
3 changes: 1 addition & 2 deletions example/scalalib/builds/2-custom-tasks/build.mill
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package build
// This example shows how to define target that depend on other tasks:
//
// 1. For `generatedSources`, we override an the task and make it depend
Expand All @@ -10,7 +9,7 @@ package build
// count at runtime using `sys.props` and print it when the program runs

//// SNIPPET:BUILD

package build
import mill._, scalalib._

object `package` extends RootModule with ScalaModule {
Expand Down
Loading
Loading