Giter VIP home page Giter VIP logo

mill-aliases's Introduction

mill-aliases

Maven Central

This is a Scala Mill plugin adding the task alias capability to the build tool. Supports Mill 0.10 and 0.11 series.

Getting Started

First import the plugin into your build.sc using the latest published version, by adding:

import $ivy.`com.carlosedp::mill-aliases::0.4.1`  //ReleaseVerMill
import com.carlosedp.aliases._

To define your project aliases, create an object extending the Aliases trait containing one method per required alias. Aliases are global to your project (whether single or multi-module) and are defined at the root level of your build.sc file.

Aliases can be single string tasks or a sequence of strings containing multiple tasks pointing to your module's tasks and are defined using the alias type in your build.sc, eg:

import mill._, scalalib._

object mymodule extends ScalaModule {
  ... // Your module here
}

object MyAliases extends Aliases {
  def testall     = alias("__.test")
  def compileall  = alias("__.compile")
  def comptestall = alias("__.compile", "__.test")
}

Usage

To show all the defined aliases:

./mill Alias/list

Which will show (eg.):

Use './mill run [alias]'.
Available aliases:
┌─────────────────┬─────────────────┬───────────────────────────────────────────────────────────────────────────────────
| Alias           | Module          | Command(s)
├─────────────────┼─────────────────┼───────────────────────────────────────────────────────────────────────────────────
| compall         | MyAliases       | (__.compile)
| comptestall     | MyAliases       | (__.compile, __.test)
| testall         | MyAliases       | (__.test)
| deps            | MyAliases       | (mill.scalalib.Dependency/showUpdates)
└─────────────────┴─────────────────┴───────────────────────────────────────────────────────────────────────────────────

Run an alias:

./mill Alias/run testall

In this case, the task __.test will be run which is executing the test task for all your modules.

./mill Alias/run comptestall

In this case, the task __.compile will be run first followed by __.test which will first compile all sources from all modules and then test all modules.

To show the help:

./mill Alias/help

Which displays:

--------------------
Mill Aliases Plugin
--------------------
The plugin allows you to define aliases for mill tasks.
The aliases are defined in an object extending `Aliases` in the build.sc file at the root level in the following format:

  object MyAliases extends Aliases {
    def testall     = alias("__.test")
    def compileall  = alias("__.compile")
    def testcompall = alias("__.compile", "__.test")
  }

Aliases can be defines for one or multiple tasks which will be run in sequence.
The aliases can be run with './mill Alias/run [alias]'.
To list all aliases: './mill Alias/list'

Aliases can also be defined on separated objects extending Aliases to help with build organization. If a name conflict happens for aliases on different modules, the list command will show all the aliases and it's module but when run, only the alias on the first module defined will be executed.

mill-aliases's People

Contributors

carlosedp avatar dependabot[bot] avatar github-actions[bot] avatar scala-steward avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

scala-steward

mill-aliases's Issues

Milestones for an initial version

These are the pending tasks:

  • Collect all root modules that extend from trait Aliases
  • Get all method names defined for each module above with the aliases
  • Get the aliased tasks for each alias
  • Execute the aliased tasks using the evaluateTasks for each Mill version
  • Reuse logic for the Alias/list command

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.