diff --git a/project/ParadoxSupport.scala b/project/ParadoxSupport.scala index 665569b4cb..b3fdd21318 100644 --- a/project/ParadoxSupport.scala +++ b/project/ParadoxSupport.scala @@ -13,6 +13,7 @@ import org.pegdown.ast._ import sbt.Keys._ import sbt._ +import scala.annotation.tailrec import scala.io.{Codec, Source} import scala.collection.JavaConverters._ @@ -52,9 +53,9 @@ object ParadoxSupport { } else new File(page.file.getParentFile, source) val Signature = """\s*((def|val|type) (\w+)(?=[:(\[]).*)(\s+\=.*)""".r // stupid approximation to match a signature - //println(s"Looking for signature regex '$Signature'") + val text = - Source.fromFile(file)(Codec.UTF8).getLines.collect { + getDefs(file).collect { case line@Signature(signature, kind, l, definition) if labels contains l.replaceAll("Mat$", "").toLowerCase() => //println(s"Found label '$l' with sig '$full' in line $line") if (kind == "type") signature + definition @@ -62,11 +63,9 @@ object ParadoxSupport { }.mkString("\n") if (text.trim.isEmpty) { - logWarn( - s"Did not find any signatures with one of those names [${labels.mkString(", ")}] in ${node.source} " + + throw new IllegalArgumentException( + s"Did not find any signatures with one of those names [${labels.mkString(", ")}] in $source " + s"(was referenced from [${page.path}])") - - new HtmlBlockNode(s"""