-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
102 lines (75 loc) · 2.94 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name := `pwd | awk -F/ '{print $NF}'`
scala-cli-bin := "scala-cli"
settings-file := "project.scala"
native-settings-file := "project.native.scala"
all-settings-files := settings-file + " " + native-settings-file
bindirs := "bin"
libdirs := "lib"
srcdirs := bindirs + " " + libdirs
testdirs := "tests"
exampledirs := "examples"
docsdirs := "docs"
alias b := build
alias compile := build
alias c := build
alias check := build
alias bn := build-native
alias compile-native := build-native
alias cn := build-native
alias check-native := build-native
alias r := run
alias rn := run-native
alias p := package
alias pn := package-native
alias fmt := format
# Lists available commands to run for this application.
_default:
@just --list
_build *files:
{{ scala-cli-bin }} compile {{ settings-file }} {{ files }} {{ srcdirs }}
_run *files:
{{ scala-cli-bin }} run {{ settings-file }} {{ files }} {{ srcdirs }}
_package ext *files:
{{ scala-cli-bin }} package --assembly {{ settings-file }} {{ files }} {{ srcdirs }} \
--force --output {{ name }}.{{ ext }}
# Builds the core files and reports compilation errors.
build: (_build)
# Builds under scala native.
build-native: (_build native-settings-file)
# Run the main of the application.
run: (_run)
# Run as scala-native.
run-native: (_run native-settings-file)
# Clean any artifacts from building the file.
clean:
scala-cli clean {{ settings-file }}
# Open a scala repl shell with application code available for use.
console:
scala-cli console {{ settings-file }} {{ srcdirs }}
# Runs tests of the application. Tests should be in {{testdirs}} and with suffix '.test.scala'
test:
scala-cli test {{ settings-file }} {{ srcdirs }} {{ testdirs }}
# Packages the application in an executable that needs jvm to run.
package: (_package "jvm.bin")
# Packages the application in an executable compiled to machine code using scala-native.
package-native: (_package "native.bin" native-settings-file)
# Format application source files. Check .scalafmt.conf for formatting settings.
format:
{{ scala-cli-bin }} fmt {{ settings-file }} {{ srcdirs }} {{ exampledirs }} {{ testdirs }}
# Checks if application files are properly formated. Check .scalafmt.conf for formatting settings.
format-check:
{{ scala-cli-bin }} fmt --check {{ settings-file }} {{ srcdirs }} {{ exampledirs }} {{ testdirs }}
# List examples available and run a specific example.
run-example example="":
#!/bin/env bash
MAIN="{{ example }}"
if [ -z "$MAIN" ];
then
echo "Available examples:"
{{ scala-cli-bin }} run {{ settings-file }} {{ libdirs }} {{ exampledirs }} --list-main-classes
else
{{ scala-cli-bin }} run {{ settings-file }} {{ libdirs }} {{ exampledirs }} --main-class "$MAIN"
fi
# Check if there are updates to the libraries in the project
updates-check:
{{ scala-cli-bin }} dependency-update {{ settings-file }} {{ srcdirs }} {{ testdirs }} {{ exampledirs }}