-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #548 from lukaszwawrzyk/ignore-scalac-options
Add option to Ignore scalac options change
- Loading branch information
Showing
13 changed files
with
184 additions
and
30 deletions.
There are no files selected for viewing
76 changes: 57 additions & 19 deletions
76
internal/compiler-interface/src/main/contraband-java/xsbti/compile/IncOptions.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
61 changes: 61 additions & 0 deletions
61
internal/zinc-core/src/test/scala/sbt/internal/inc/MiniSetupUtilSpec.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,61 @@ | ||
package sbt.internal.inc | ||
|
||
import MiniSetupUtil._ | ||
|
||
class MiniSetupUtilSpec extends UnitSpec { | ||
|
||
it should "detect options change" in { | ||
val equiv = equivScalacOptions(ignoredRegexes = Array()) | ||
|
||
val before = Array("-deprecation") | ||
val after = Array[String]() | ||
|
||
equiv.equiv(before, after) shouldBe false | ||
} | ||
|
||
it should "ignore options list different by specfied options (exact)" in { | ||
val equiv = equivScalacOptions(ignoredRegexes = Array("-Xprint:typer", "-Xfatal-warnings")) | ||
|
||
val before = Array("-Xprint:typer", "-deprecation") | ||
val after = Array("-Xfatal-warnings", "-deprecation") | ||
|
||
equiv.equiv(before, after) shouldBe true | ||
} | ||
|
||
it should "use regex to ignore options" in { | ||
val equiv = equivScalacOptions(ignoredRegexes = Array("-Xprint:.*")) | ||
|
||
val before = Array("-Xprint:typer") | ||
val after = Array("-Xprint:typer", "-Xprint:refcheck", "-Xprint:parse") | ||
|
||
equiv.equiv(before, after) shouldBe true | ||
} | ||
|
||
it should "combine options with their parameters with space for analysis" in { | ||
val equiv = equivScalacOptions(ignoredRegexes = Array("-opt .*")) | ||
|
||
val before = Array("-opt", "abc") | ||
val after = Array("-opt", "def") | ||
|
||
equiv.equiv(before, after) shouldBe true | ||
} | ||
|
||
it should "detect change for options with parameters" in { | ||
val equiv = equivScalacOptions(ignoredRegexes = Array("-opt a.*")) | ||
|
||
val before = Array("-opt", "abc") | ||
val after = Array("-opt", "def") | ||
|
||
equiv.equiv(before, after) shouldBe false | ||
} | ||
|
||
it should "ignore reordering of options" in { | ||
val equiv = equivScalacOptions(ignoredRegexes = Array()) | ||
|
||
val before = Array("-a", "1", "-b", "2", "-c") | ||
val after = Array("-b", "2", "-c", "-a", "1") | ||
|
||
equiv.equiv(before, after) shouldBe true | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class A |
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 @@ | ||
class B |
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 @@ | ||
class C |
3 changes: 3 additions & 0 deletions
3
zinc/src/sbt-test/source-dependencies/scalac-options/changes/A.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,3 @@ | ||
class A { | ||
val a = 1 | ||
} |
2 changes: 2 additions & 0 deletions
2
zinc/src/sbt-test/source-dependencies/scalac-options/changes/incOptions.properties
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,2 @@ | ||
ignoredScalacOptions = -Xfatal-warnings | ||
scalac.options = -deprecation -Xprint:typer |
2 changes: 2 additions & 0 deletions
2
zinc/src/sbt-test/source-dependencies/scalac-options/incOptions.properties
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,2 @@ | ||
ignoredScalacOptions = -Xfatal-warnings | ||
scalac.options = -Xfatal-warnings -Xprint:typer -deprecation |
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,7 @@ | ||
> compile | ||
|
||
$ copy-file changes/A.scala A.scala | ||
$ copy-file changes/incOptions.properties incOptions.properties | ||
|
||
> compile | ||
> checkRecompilations 1 A |