Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lake run build の実行が遅いので代替手段を用意する #766

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ lean_lib Examples where
section Script

/-- 与えられた文字列をシェルで実行する -/
@[inline] def runCmd (input : String) : IO Unit := do
def runCmd (input : String) : IO Unit := do
let cmdList := input.splitOn " "
let cmd := cmdList.head!
let args := cmdList.tail |>.toArray
let out ← IO.Process.output {
cmd := cmd
cmd := cmd
args := args
}
if out.exitCode != 0 then
Expand All @@ -55,10 +55,10 @@ macro_rules
IO.println s!"Running {$s}: {end_time - start_time}ms")

/-- mk_exercise と mdgen と mdbook を順に実行し、
Lean ファイルから Markdown ファイルと HTML ファイルを生成する。-/
script build do
let start_time ← IO.monoMsNow;
Lean ファイルから Markdown ファイルと HTML ファイルを生成する。

`.\scripts\Build.ps1` を実行したほうが高速 -/
script build do
-- `lake run mk_exercise` を使用すると遅くなってしまうのでコピペしている
with_time running "mk_exercise"
runCmd "lake exe mk_exercise Examples/Solution Exercise"
Expand All @@ -69,9 +69,6 @@ script build do

with_time running "mdbook"
runCmd "mdbook build"

let end_time ← IO.monoMsNow;
IO.println s!"Total time: {end_time - start_time}ms"
return 0

end Script
10 changes: 10 additions & 0 deletions scripts/Build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<# lake run build に相当するスクリプト

lake を介することで実行が遅くなってしまうので、
lake を介することなく実行ファイルを直接叩く。 #>

./.lake/packages/mk-exercise/.lake/build/bin/mk_exercise.exe Examples/Solution Exercise

./.lake/packages/mdgen/.lake/build/bin/mdgen.exe Exercise src/Exercise

mdbook build
Loading