Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Jul 1, 2024
2 parents ade8c50 + 067e187 commit b720602
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ target widgetPackageLock : FilePath := do
} (quiet := true)

/-- Target to build all TypeScript widget modules that match `widget/src/*.tsx`. -/
def widgetJsAllTarget (isDev : Bool) : FetchM (BuildJob (Array FilePath)) := do
def widgetJsAllTarget (pkg : Package) (isDev : Bool) : FetchM (BuildJob (Array FilePath)) := do
let fs ← (widgetDir / "src").readDir
let srcs : Array FilePath := fs.filterMap fun f =>
let p := f.path
Expand All @@ -75,7 +75,12 @@ def widgetJsAllTarget (isDev : Bool) : FetchM (BuildJob (Array FilePath)) := do
let deps ← liftM <| depFiles.mapM inputTextFile'
let deps := deps.push <| ← widgetPackageLock.fetch
let deps ← BuildJob.collectArray deps
deps.bindSync fun depInfo depTrace => do
/- `widgetJsAll` is an `extraDepTarget`,
and Lake's default build order is `extraDepTargets -> cloud release -> main build`.
We must instead ensure that the cloud release is fetched first
so that this target does not build from scratch unnecessarily.
`afterReleaseAsync` guarantees this. -/
pkg.afterReleaseAsync $ deps.bindSync fun depInfo depTrace => do
let traceFile := buildDir / "js" / "lake.trace"
let _ ← buildUnlessUpToDate? traceFile depTrace traceFile do
/- HACK: Ensure that NPM modules are installed before building TypeScript,
Expand Down Expand Up @@ -106,11 +111,11 @@ def widgetJsAllTarget (isDev : Bool) : FetchM (BuildJob (Array FilePath)) := do
-- Lake.logInfo "JavaScript build up to date"
return (depInfo, depTrace)

target widgetJsAll : Array FilePath :=
widgetJsAllTarget (isDev := false)
target widgetJsAll pkg : Array FilePath :=
widgetJsAllTarget pkg (isDev := false)

target widgetJsAllDev : Array FilePath :=
widgetJsAllTarget (isDev := true)
target widgetJsAllDev pkg : Array FilePath :=
widgetJsAllTarget pkg (isDev := true)

@[default_target]
lean_lib ProofWidgets where
Expand Down

0 comments on commit b720602

Please sign in to comment.