New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to Ignore scalac options change #548
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a3cbbd1
Add a failing test to represent ignoring scalac options change
lukaszwawrzyk 836f91a
Remove hardcoded implicits
lukaszwawrzyk 58e8f8d
Add means to override compile setup equivalence
lukaszwawrzyk 0327404
Revert "Add means to override compile setup equivalence"
lukaszwawrzyk 8681829
Add ignorable scalac options by regex
lukaszwawrzyk 4060c08
Add tests for scalac optons equiv
lukaszwawrzyk e948c36
Fix binary compatibility
lukaszwawrzyk 9d3df6c
Add a test for ignored options ordering
lukaszwawrzyk 54eca16
reworks
lukaszwawrzyk File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are missing test case for option ordering