-
-
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.
Pass auxiliary class files to zinc so they are deleted together
Fixes #3068 `*.tasty`, `*.nir` and `*.sjsir` files were not cleaned up by zinc when the companion class files were deleted. This passes the right `AuxiliaryClassFiles` to zinc
- Loading branch information
Showing
6 changed files
with
149 additions
and
5 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
integration/feature/auxiliary-class-files/repo/app/src/foo.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 @@ | ||
object foo |
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 @@ | ||
// Issue https://github.com/com-lihaoyi/mill/issues/3068 | ||
import mill._ | ||
import mill.scalalib._ | ||
import mill.scalajslib._ | ||
import mill.scalanativelib._ | ||
|
||
object app extends Module { | ||
trait Common extends ScalaModule { | ||
def millSourcePath = super.millSourcePath / os.up | ||
def scalaVersion = "3.4.0" | ||
} | ||
|
||
object jvm extends Common | ||
object js extends Common with ScalaJSModule { | ||
def scalaJSVersion = "1.15.0" | ||
} | ||
object native extends Common with ScalaNativeModule { | ||
def scalaNativeVersion = "0.4.17" | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
integration/feature/auxiliary-class-files/test/src/AuxiliaryClassFilesTests.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,59 @@ | ||
package mill.integration | ||
|
||
import utest._ | ||
|
||
// Regress test for issue https://github.com/com-lihaoyi/mill/issues/1901 | ||
object AuxiliaryClassFilesTests extends IntegrationTestSuite { | ||
val tests: Tests = Tests { | ||
test("tasty files are deleted together with companion class files") { | ||
initWorkspace() | ||
eval("app.jvm.compile") | ||
|
||
val classes = wd / "out" / "app" / "jvm" / "compile.dest" / "classes" | ||
val firstRun = os.list(classes).map(_.last) | ||
|
||
os.remove(wd / "app" / "src" / "foo.scala") | ||
|
||
eval("app.jvm.compile") | ||
|
||
val secondRun = os.list(classes).map(_.last) | ||
|
||
assert(firstRun == Seq("foo$.class", "foo.class", "foo.tasty")) | ||
assert(secondRun == Seq.empty) | ||
} | ||
|
||
test("nir files are deleted together with companion class files") { | ||
initWorkspace() | ||
eval("app.native.compile") | ||
|
||
val classes = wd / "out" / "app" / "native" / "compile.dest" / "classes" | ||
val firstRun = os.list(classes).map(_.last) | ||
|
||
os.remove(wd / "app" / "src" / "foo.scala") | ||
|
||
eval("app.native.compile") | ||
|
||
val secondRun = os.list(classes).map(_.last) | ||
|
||
assert(firstRun == Seq("foo$.class", "foo$.nir", "foo.class", "foo.nir", "foo.tasty")) | ||
assert(secondRun == Seq.empty) | ||
} | ||
|
||
test("sjsir files are deleted together with companion class files") { | ||
initWorkspace() | ||
eval("app.js.compile") | ||
|
||
val classes = wd / "out" / "app" / "js" / "compile.dest" / "classes" | ||
val firstRun = os.list(classes).map(_.last) | ||
|
||
os.remove(wd / "app" / "src" / "foo.scala") | ||
|
||
eval("app.js.compile") | ||
|
||
val secondRun = os.list(classes).map(_.last) | ||
|
||
assert(firstRun == Seq("foo$.class", "foo$.sjsir", "foo.class", "foo.tasty")) | ||
assert(secondRun == Seq.empty) | ||
} | ||
} | ||
} |
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
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