-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRakefile
75 lines (61 loc) · 1.44 KB
/
Rakefile
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
desc "Build the default debug (alias)"
task default: "build:debug"
@build_dir = ENV["BUILD_DIR"] || "./build"
desc "Build debug binary (alias)"
task build: "build:debug"
namespace :build do
desc "Build debug binary"
task :debug do
`dub build`
end
desc "Build release binary"
task :release do
`dub build --build=release`
end
namespace :release do
desc "Build release with $DC compiler"
task :dc do
`dub build --build=release --compiler=#{ENV["DC"] || "dmd"}`
end
desc "Build release with $DC compiler and strip"
task strip: "release:dc" do
`strip #{@build_dir}/trash`
end
end
end
desc "Build and run tests"
task :test do
`dub test`
end
namespace :test do
desc "Build and run tests with code coverage"
task :coverage do
`dub test --coverage`
coverage_dir = @build_dir + "/coverage/"
FileUtils.mkdir_p coverage_dir
FileUtils.mv Dir.glob("*.lst"), coverage_dir
end
end
desc "Run linting"
task :lint do
`dub lint`
end
desc "Format with dfmt"
task :format do
`dub run dfmt -- -i source/**/*.d`
end
desc "Build the manpage with ronn"
task :manpage do
FileUtils.mkdir_p @build_dir
`ronn --roff --pipe MANUAL.md > #{@build_dir}/trash.man`
end
desc "Build DEB and RPM packages with FPM"
task package: %w[build:release:dc manpage] do
ruby "./package.rb #{@build_dir}/"
end
desc "Remove build artifacts"
task :clean do
FileUtils.rm_rf @build_dir
end
desc "Build every artifact"
task all: %w[build:release manpage package]