8000 Tags · com-lihaoyi/mill · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Tags: com-lihaoyi/mill

Tags

1.0.0-RC1

Toggle 1.0.0-RC1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
First pass at changelog for Mill 1.0.0-RC1 release (#4981)

Co-authored-by: Tobias Roeser <le.petit.fou@web.de>

1.0.0-M1

Toggle 1.0.0-M1's commit message
turn back on github actions publishing and update example and bootstr…

…ap script download URLs

debug-badge

Toggle debug-badge's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
bugfix: All git cmds should be run with cwd=vcsBasePath (#5102)

When mill `out/` directory was moved out of srctree by MILL_OUTPUT_DIR
env, all git cmds w/o `cwd` set to `vcsBasePath` will be failed.

Signed-off-by: Jiuyue Ma <majiuyue@bosc.ac.cn>

0.12.11

Toggle 0.12.11's commit message
changelog for 0.12.11.

0.13.0-M2

Toggle 0.13.0-M2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add a YAML header comment syntax for configuration of `.mill-` files,…

… `import $ivy`, `mill-version` (#4969)

This PR adds a YAML 1.2 header comment syntax that subsumes many of the
ad-hoc configuration mechanisms we have today: `.mill-version`,
`.mill-opts`, `.mill-jvm-opts`, `.mill-jvm-version`, `import $ivy`, and
possibly more meta-build overrides or other configuration options in
future.

```scala
//| mill-version: 0.13.0
//| mill-jvm-version: 17
//| repositories: [$PWD_URI/custom-repo]
//| mvnDeps: [org.thymeleaf:thymeleaf:3.1.1.RELEASE]
package build
import mill._, javalib._
import org.thymeleaf.TemplateEngine
import org.thymeleaf.context.Context

object foo extends JavaModule {
  def htmlSnippet = Task {
    val context = new Context
    context.setVariable("heading", "hello")
    context.setVariable("paragraph", "world")
    new TemplateEngine().process(
      """<div><h1 th:text="${heading}"></h1><p th:text="${paragraph}"></p></div>""",
      context
    )
  }

  def resources = Task {
    os.write(Task.dest / "snippet.txt", htmlSnippet())
    super.resources() ++ Seq(PathRef(Task.dest))
  }
}
```

The YAML header for any `.mill` file must be a line-comment block
starting from the first line of the file and prefixed by `//|`. The
prefix is chosen to avoid conflicts with normal comments (`//`),
Scala-CLI directives (`//>`), and Java markdown comments (`///`), and to
be reminiscent of Scala `|`s commonly used in `.stripMargin`

We use YAML 1.2 (via `snakeyaml-engine`) rather than ScalaCLI directives
because:

- It can map more directly to Mill concepts: `mill-version`,
`mill-jvm-version`, `mvnDeps`, and other config keys can be directly in
YAML without any mapping.

- YAML's hierarchical list/dict/primitive data model maps clearly to
Mill's JSON data model for tasks, whereas Scala-CLI directives do not
have such a clean correspondence and will require that we manually
maintain an explicit mapping

- YAML will also be more familiar to non-Scala developers than
Scala-CLI's directive syntax, including all the edge cases that are
moderately well defined (quoting? escaping? comments? type coercions?
multi-line strings?)

- Processing by third-party tools will be easier: anyone can write a
Python script to strip the prefixes and parse out the YAML using pyyaml
or yamlcore, or their equivalents in Node.js/Ruby/Rust/Go/whatever,
whereas with Scala-CLI directives you are restricted to a single JVM
implementation without spec or documentation

All of these concerns were raised in the original Scala-CLI directives
discussion but were ignored
([link](https://contributors.scala-lang.org/t/pre-sip-using-directives/5700/5?u=lihaoyi),
[link](https://contributors.scala-lang.org/t/pre-sip-scala-cli-as-new-scala-command/5628/92?u=lihaoyi)),
so that brings us to today where we have to diverge from their syntax.

The choice of YAML over TOML was largely arbitrary. Python chose TOML
for their script-header metadata in
[PEP-723](https://peps.python.org/pep-0723/), whereas all Markdown
implementations
([Github](https://docs.github.com/en/contributing/writing-for-github-docs/using-yaml-frontmatter),
[RMarkdown](https://zsmith27.github.io/rmarkdown_crash-course/lesson-4-yaml-headers.html),
[Jekyll](https://jekyllrb.com/docs/front-matter/)) chose YAML for their
header-metadata syntax. YAML 1.2 seems to fix/mitigate most of the
problems with YAML 1.1 (e.g. the `no == false` thing). Kotlin has their
own syntax for file-level metadata
[`@file:JvmName("Foo")`](https://kotlinlang.org/docs/annotations.html#annotation-use-site-targets),
as does Swift [`@Metadata { @DocumentationExtension(mergeBehavior:
override) }`](https://www.swift.org/documentation/docc/metadata)

Builds on top of #4624

---------

Co-authored-by: Tobias Roeser <le.petit.fou@web.de>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

0.13.0-M1

Toggle 0.13.0-M1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Rebootstrap on `main` branch targeting `0.13.x` (#4848)

0