-
-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add smoketest for incremental compilation of multi-file build (#3750)
Seems there's a bug in sbt/zinc#1461 causing over-compilation, for now just assert the misbehavior
- Loading branch information
Showing
5 changed files
with
62 additions
and
9 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
8 changes: 8 additions & 0 deletions
8
integration/invalidation/zinc-build-compilation/resources/build.mill
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 build | ||
import $packages._ | ||
import mill._ | ||
|
||
|
||
def foo = { println("running foo"); build_.subfolder.package_.helperFoo } | ||
|
||
def dummy = Task{ 1 } |
6 changes: 6 additions & 0 deletions
6
integration/invalidation/zinc-build-compilation/resources/subfolder/package.mill
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,6 @@ | ||
package build.subfolder | ||
import mill._ | ||
|
||
val valueFoo = 0 | ||
val valueFooUsedInBar = 0 | ||
def helperFoo = { println("running helperFoo"); 1 + valueFoo } |
40 changes: 40 additions & 0 deletions
40
integration/invalidation/zinc-build-compilation/src/ZincBuildCompilationTests.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,40 @@ | ||
package mill.integration | ||
|
||
import mill.testkit.UtestIntegrationTestSuite | ||
|
||
import utest._ | ||
|
||
object ZincBuildCompilationTests extends UtestIntegrationTestSuite { | ||
val tests: Tests = Tests { | ||
test("simple") - integrationTest { tester => | ||
import tester._ | ||
|
||
val initial = eval(("dummy")) | ||
|
||
assert(initial.err.contains("compiling 2 Scala sources")) | ||
|
||
val cached = eval(("dummy")) | ||
assert(!cached.err.contains("compiling")) | ||
|
||
modifyFile(workspacePath / "build.mill", _.replace("running foo", "running foo2")) | ||
val mangledFoo = eval(("dummy")) | ||
assert(mangledFoo.err.contains("compiling 1 Scala source")) | ||
|
||
val cached2 = eval(("dummy")) | ||
assert(!cached2.err.contains("compiling")) | ||
|
||
val subFolderResCached = eval(("dummy")) | ||
assert(!subFolderResCached.err.contains("compiling")) | ||
|
||
modifyFile( | ||
workspacePath / "subfolder/package.mill", | ||
_.replace("running helperFoo", "running helperFoo2") | ||
) | ||
val mangledHelperFoo = eval(("dummy")) | ||
// This should only compile 1 source but it seems there's an upstream bug in Zinc | ||
// https://github.com/sbt/zinc/issues/1461 | ||
assert(mangledHelperFoo.err.contains("compiling 2 Scala source")) | ||
|
||
} | ||
} | ||
} |
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