Skip to content

Commit ed9573d

Browse files
authored
article for day 25 (#537)
1 parent 6999159 commit ed9573d

File tree

4 files changed

+542
-5
lines changed

4 files changed

+542
-5
lines changed

build.sbt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@ def taskPatchSolutions(year: String, getSrcDir: File => File) = Def.task {
2929
IO.copyDirectory(srcDir, trgDir)
3030
val sourceFiles = (trgDir ** "*.scala").get.toSet
3131
for (f <- sourceFiles)
32-
IO.writeLines(f, patchSolutions(year, IO.readLines(f)))
32+
IO.writeLines(f, patchSolutions(f.getName, year, IO.readLines(f)))
3333
sourceFiles
3434
} (Set(srcDir)).toSeq
3535
}
3636

3737
/** adds `package adventofcode${year}` to the file after the last using directive */
38-
def patchSolutions(year: String, lines: List[String]): List[String] = {
39-
val (before, after) = lines.span(line => line.startsWith("// using") || line.startsWith("//> using"))
40-
before ::: s"package adventofcode$year" :: after
38+
def patchSolutions(name: String, year: String, lines: List[String]): List[String] = {
39+
if (name.contains(".test.scala")) Nil // hack to avoid compiling test files
40+
else {
41+
val (before, after) = lines.span(line => line.startsWith("// using") || line.startsWith("//> using"))
42+
before ::: s"package adventofcode$year" :: after
43+
}
4144
}
4245

4346
lazy val docs = project

0 commit comments

Comments
 (0)