Skip to content

Commit

Permalink
Allow Error Prone API version to be configured via a property (#470)
Browse files Browse the repository at this point in the history
With this change, the version of Error Prone that NullAway is compiled and tested against in a build can be changed via a project property `epApiVersion`.  E.g., to compile and test against Error Prone 2.6.0 you can run:
```
./gradlew -PepApiVersion=2.6.0 build
```
When the property is not set, we default to the oldest currently-supported version of Error Prone (currently 2.4.0).

This change will enable running separate CI jobs to test NullAway against different Error Prone versions; that change (along with some test fixes) will come in a follow-up PR.
  • Loading branch information
msridhar committed May 5, 2021
1 parent dba4c2d commit c9487c1
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.gradle.util.VersionNumber

/*
* Copyright (C) 2017. Uber Technologies
*
Expand All @@ -14,11 +16,27 @@
* limitations under the License.
*/

// The oldest version of Error Prone that we support running on
def oldestErrorProneApi = "2.4.0"

if (project.hasProperty("epApiVersion")) {
def epApiVNum = VersionNumber.parse(epApiVersion)
if (epApiVNum.equals(VersionNumber.UNKNOWN)) {
throw new IllegalArgumentException("Invalid Error Prone API version " + epApiVersion)
}
if (epApiVNum.compareTo(VersionNumber.parse(oldestErrorProneApi)) < 0) {
throw new IllegalArgumentException(
"Error Prone API version " + epApiVersion + " is too old; "
+ oldestErrorProneApi + " is the oldest supported version")
}
}
def versions = [
asm : "7.1",
checkerFramework : "3.6.0",
errorProne : "2.4.0", // The version of error prone running on this project
errorProneApi : "2.4.0", // The version of error prone built against and shipped
// The version of Error Prone used to check NullAway's code
errorProne : "2.4.0",
// The version of Error Prone that NullAway is compiled and tested against
errorProneApi : project.hasProperty("epApiVersion") ? epApiVersion : oldestErrorProneApi,
support : "27.1.1",
wala : "1.5.4",
commonscli : "1.4",
Expand Down

0 comments on commit c9487c1

Please sign in to comment.