chore: improve imports lean-only build condition

This commit is contained in:
tydeu 2022-06-09 21:08:06 -04:00
parent 6f38ebebe9
commit 8428ef7cd7

View file

@ -90,8 +90,8 @@ def Workspace.processImportList
/--
Build the workspace-local modules of list of imports.
Build only module `.olean` and `.ilean` files if the default package facet is
just `leanLib` or `oleans` (and the package has no binary executable targets).
Build only module `.olean` and `.ilean` files if
the default package build does not include any binary targets
Otherwise, also build `.c` files.
-/
def Package.buildImportsAndDeps (imports : List String) (self : Package) : BuildM PUnit := do
@ -102,7 +102,7 @@ def Package.buildImportsAndDeps (imports : List String) (self : Package) : Build
else
-- build local imports from list
let infos := (← getWorkspace).processImportList imports
if (self.defaultFacet == .leanLib || self.defaultFacet == .oleans) && self.exes.isEmpty then
if self.exes.isEmpty && self.defaultFacet matches .none | .leanLib | .oleans then
let build := recBuildModuleOleanTargetWithLocalImports depTarget
let targets ← buildModuleArray infos build
targets.forM (·.buildOpaque)