Skip to content

Commit

Permalink
Migrate build to mill
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhijit Sarkar committed Dec 24, 2024
1 parent 9092a6d commit 2b96bae
Show file tree
Hide file tree
Showing 105 changed files with 317 additions and 68 deletions.
17 changes: 10 additions & 7 deletions .github/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ no_lint=0
while (( $# > 0 )); do
case "$1" in
--help)
printf "run.sh [OPTION]... [PKG]\n"
printf "run.sh [OPTION]... [DIR]\n"
printf "options:\n"
printf "\t--help Show help\n"
printf "\t--no-test Skip tests\n"
Expand All @@ -29,21 +29,24 @@ while (( $# > 0 )); do
esac
done

./mill __.compile

if (( no_test == 0 )); then
if [[ -z "$1" ]]; then
sbt -warn test
./mill __.test
elif ./mill resolve problems["$1"].__.test &>/dev/null; then
./mill problems["$1"].__.test
else
green='\033[1;32m'
red='\033[0;31m'
no_color='\033[0m'
printf "Running tests in packages matching: %b%s*%b\n" "$green" "$1" "$no_color"
sbt -warn "Test / testOnly $1*"
printf "%bNo tests found in: %s%b\n" "$red" "$1" "$no_color"
fi
fi

if (( no_lint == 0 )); then
if [[ -z "${CI}" ]]; then
sbt -warn scalafmtAll
./mill mill.scalalib.scalafmt.ScalafmtModule/reformatAll problems[_].sources
else
sbt -warn scalafmtCheckAll
./mill mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll problems[_].sources
fi
fi
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
java-version: 21
- name: Test
run: ./.github/run.sh --no-lint
- name: Lint
Expand Down
44 changes: 21 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
# macOS
.DS_Store
*.class
*.log
*~

# sbt
# idea
.idea
.idea_modules
/.worksheet/

# mill
out/

.bsp/
.metals/
.vscode/
.bloop/

# SBT
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/project
project/plugins/project/
project/local-plugins.sbt
.history
.ensime
.ensime_cache/
.sbt-scripted/
local.sbt
.cache
.lib/

# Bloop
.bsp

# VS Code
.vscode/

# Metals
.bloop/
.metals/
metals.sbt

# IDEA
.idea
.idea_modules
/.worksheet/
# virtual machine crash logs
hs_err_pid*
1 change: 1 addition & 0 deletions .mill-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.12.4
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.7.17"
version = "3.8.3"
align.preset = more
maxColumn = 120
runner.dialect = scala3
Expand Down
35 changes: 35 additions & 0 deletions build.mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package build

import mill._, scalalib._, scalafmt._
import $packages._
import $file.{versions => v}

val moduleNames = interp.watchValue(os.list(millSourcePath / "problems").map(_.last))

object problems extends Cross[NineNineModule](moduleNames)

trait NineNineModule extends ScalaModule with Cross.Module[String] with ScalafmtModule {

val scalaVersion = v.scalaVersion
def millSourcePath = super.millSourcePath / crossValue

def scalacOptions: T[Seq[String]] = Seq(
"-encoding", "UTF-8",
"-feature",
"-Werror",
"-explain",
"-deprecation",
"-unchecked",
"-Wunused:all",
"-rewrite",
"-indent",
"-source", "future",
)

object test extends ScalaTests with TestModule.Munit {
def ivyDeps = Agg(
ivy"org.scalameta::munit:${v.munitVersion}",
ivy"org.scalameta::munit-scalacheck:${v.munitScalaCheckVersion}",
)
}
}
31 changes: 0 additions & 31 deletions build.sbt

This file was deleted.

Loading

0 comments on commit 2b96bae

Please sign in to comment.