-
-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test case ensuring zinc is only re-compiling changed sources (#1907)
Regression test, making sure Zinc incremental compilation only compile changed files. Related to * #1901 * #1904 Pull request: #1907
- Loading branch information
Showing
7 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
integration/local/resources/zinc-incremental-compilation/app/src/main/scala/App.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package app | ||
|
||
import io.getquill._ | ||
|
||
object App { | ||
|
||
val ctx = new SqlMirrorContext(PostgresDialect, SnakeCase) | ||
import ctx._ | ||
|
||
case class Person(name: String, age: Int) | ||
|
||
def test = { | ||
val key = "foo" | ||
val q = quote { | ||
query[Person].filter(c => c.name like "% $1" + lift(key) + "%") | ||
} | ||
ctx.run(q) | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
...n/local/resources/zinc-incremental-compilation/app/src/main/scala/models/TestModel1.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package models | ||
|
||
import java.time._ | ||
|
||
case class Foo( | ||
id: Long = 0L, | ||
gmtCreate: LocalDateTime | ||
) |
14 changes: 14 additions & 0 deletions
14
integration/local/resources/zinc-incremental-compilation/build.sc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Issue https://github.com/com-lihaoyi/mill/issues/1901 | ||
import mill._ | ||
import mill.scalalib._ | ||
|
||
object app extends SbtModule { | ||
|
||
def scalaVersion = "2.13.8" | ||
|
||
def scalacOptions = Seq("-Vclasspath") | ||
|
||
def ivyDeps = Agg( | ||
ivy"io.getquill::quill-sql:3.18.0" | ||
) | ||
} |
42 changes: 42 additions & 0 deletions
42
integration/local/src/ZincIncrementalCompilationTests.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package mill.integration | ||
|
||
import utest._ | ||
|
||
// Regress test for issue https://github.com/com-lihaoyi/mill/issues/1901 | ||
class ZincIncrementalCompilationTests(fork: Boolean, clientServer: Boolean) | ||
extends IntegrationTestSuite("zinc-incremental-compilation", fork, clientServer) { | ||
val tests = Tests { | ||
initWorkspace() | ||
"incremental compilation only compiles changed files" - { | ||
val successful = eval("app.compile") | ||
assert(successful) | ||
|
||
val appSrc = wd / "app" / "src" / "main" / "scala" / "App.scala" | ||
val classes = wd / "out" / "app" / "compile.dest" / "classes" | ||
val app = classes / "app" / "App.class" | ||
val model = classes / "models" / "Foo.class" | ||
assert(Seq(classes, app, model, appSrc).forall(os.exists)) | ||
|
||
val appSrcInfo1 = os.stat(appSrc) | ||
val appInfo1 = os.stat(app) | ||
val modelInfo1 = os.stat(model) | ||
|
||
println("** second run **") | ||
os.write.append(appSrc, "\n ") | ||
|
||
val succ2nd = eval("app.compile") | ||
assert(succ2nd) | ||
|
||
val appSrcInfo2 = os.stat(appSrc) | ||
val appInfo2 = os.stat(app) | ||
val modelInfo2 = os.stat(model) | ||
|
||
// we changed it | ||
assert(appSrcInfo1.mtime != appSrcInfo2.mtime) | ||
// expected to be re-compiled | ||
assert(appInfo1.ctime != appInfo2.ctime) | ||
// expected to be NOT re-compiled | ||
assert(modelInfo1.ctime == modelInfo2.ctime) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package mill.integration | ||
package local | ||
|
||
object DocAnnotationsTests extends DocAnnotationsTests(fork = false, false) | ||
object HygieneTests extends HygieneTests(fork = false, false) | ||
object LargeProjectTests extends LargeProjectTests(fork = false, false) | ||
object ScriptsInvalidationTests extends ScriptsInvalidationTests(fork = false, false) | ||
object ScriptsInvalidationForeignTests extends ScriptsInvalidationForeignTests(fork = false, false) | ||
object DocAnnotationsTests extends DocAnnotationsTests(fork = false, clientServer = false) | ||
object HygieneTests extends HygieneTests(fork = false, clientServer = false) | ||
object LargeProjectTests extends LargeProjectTests(fork = false, clientServer = false) | ||
object ScriptsInvalidationTests extends ScriptsInvalidationTests(fork = false, clientServer = false) | ||
object ScriptsInvalidationForeignTests extends ScriptsInvalidationForeignTests(fork = false, clientServer = false) | ||
object ZincIncrementalCompilationTests extends ZincIncrementalCompilationTests(fork = false, clientServer = false) |