equal
deleted
inserted
replaced
141 yield (theory, node_name.node) |
141 yield (theory, node_name.node) |
142 |
142 |
143 def get_imports: Base = imports getOrElse Base.bootstrap(global_theories) |
143 def get_imports: Base = imports getOrElse Base.bootstrap(global_theories) |
144 } |
144 } |
145 |
145 |
|
146 private def check_files(paths: List[Path]): (List[(Path, SHA1.Digest)], List[String]) = |
|
147 { |
|
148 val digests = for (p <- paths if p.is_file) yield (p, SHA1.digest(p.file)) |
|
149 val errors = for (p <- paths if !p.is_file) yield "No such file: " + p |
|
150 (digests, errors) |
|
151 } |
|
152 |
146 sealed case class Deps(session_bases: Map[String, Base], all_known: Known) |
153 sealed case class Deps(session_bases: Map[String, Base], all_known: Known) |
147 { |
154 { |
148 def is_empty: Boolean = session_bases.isEmpty |
155 def is_empty: Boolean = session_bases.isEmpty |
149 def apply(name: String): Base = session_bases(name) |
156 def apply(name: String): Base = session_bases(name) |
150 def sources(name: String): List[SHA1.Digest] = session_bases(name).sources.map(_._2) |
157 def sources(name: String): List[SHA1.Digest] = session_bases(name).sources.map(_._2) |
195 else info.groups.mkString(" (", " ", ")") |
202 else info.groups.mkString(" (", " ", ")") |
196 progress.echo("Session " + info.chapter + "/" + info.name + groups) |
203 progress.echo("Session " + info.chapter + "/" + info.name + groups) |
197 } |
204 } |
198 |
205 |
199 val thy_deps = |
206 val thy_deps = |
200 { |
207 resources.thy_info.dependencies( |
201 val root_theories = |
208 for { (_, thys) <- info.theories; (thy, pos) <- thys } |
202 info.theories.flatMap({ case (_, thys) => |
209 yield (resources.import_name(info.theory_qualifier, info.dir.implode, thy), pos)) |
203 thys.map({ case (thy, pos) => |
|
204 (resources.import_name(info.theory_qualifier, info.dir.implode, thy), pos) }) |
|
205 }) |
|
206 resources.thy_info.dependencies(root_theories) |
|
207 } |
|
208 |
210 |
209 val overall_syntax = thy_deps.overall_syntax |
211 val overall_syntax = thy_deps.overall_syntax |
210 |
212 |
211 val theory_files = thy_deps.names.map(_.path) |
213 val theory_files = thy_deps.names.map(_.path) |
212 val loaded_files = |
214 val loaded_files = |
217 } |
219 } |
218 else thy_deps.loaded_files |
220 else thy_deps.loaded_files |
219 } |
221 } |
220 else Nil |
222 else Nil |
221 |
223 |
222 val all_files = |
224 val session_files = |
223 (theory_files ::: loaded_files.flatMap(_._2) ::: |
225 (theory_files ::: loaded_files.flatMap(_._2) ::: |
224 info.files.map(file => info.dir + file) ::: |
226 info.files.map(file => info.dir + file) ::: |
225 info.document_files.map(file => info.dir + file._1 + file._2)).map(_.expand) |
227 info.document_files.map(file => info.dir + file._1 + file._2)).map(_.expand) |
226 |
228 |
227 if (list_files) |
229 if (list_files) |
228 progress.echo(cat_lines(all_files.map(_.implode).sorted.map(" " + _))) |
230 progress.echo(cat_lines(session_files.map(_.implode).sorted.map(" " + _))) |
229 |
231 |
230 if (check_keywords.nonEmpty) { |
232 if (check_keywords.nonEmpty) { |
231 Check_Keywords.check_keywords( |
233 Check_Keywords.check_keywords( |
232 progress, overall_syntax.keywords, check_keywords, theory_files) |
234 progress, overall_syntax.keywords, check_keywords, theory_files) |
233 } |
235 } |
268 val known = |
270 val known = |
269 Known.make(info.dir, List(imports_base), |
271 Known.make(info.dir, List(imports_base), |
270 theories = thy_deps.names, |
272 theories = thy_deps.names, |
271 loaded_files = loaded_files) |
273 loaded_files = loaded_files) |
272 |
274 |
273 val sources = |
275 val (sources, sources_errors) = check_files(session_files) |
274 for (p <- all_files if p.is_file) yield (p, SHA1.digest(p.file)) |
|
275 val sources_errors = |
|
276 for (p <- all_files if !p.is_file) yield "No such file: " + p |
|
277 |
276 |
278 val base = |
277 val base = |
279 Base( |
278 Base( |
280 pos = info.pos, |
279 pos = info.pos, |
281 global_theories = global_theories, |
280 global_theories = global_theories, |