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
Update Gradle, Error Prone plugin, and Android Gradle Plugin #294
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
#!/usr/bin/env sh | ||
|
||
# added manually | ||
./config/hooks/install-pre-commit | ||
# | ||
# Copyright 2015 the original author or authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
############################################################################## | ||
## | ||
|
@@ -31,7 +44,7 @@ APP_NAME="Gradle" | |
APP_BASE_NAME=`basename "$0"` | ||
|
||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
DEFAULT_JVM_OPTS="" | ||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems very very low, but if it works for building NullAway, then all the better, I suppose. |
||
|
||
# Use the maximum available, or set MAX_FD != -1 to use that value. | ||
MAX_FD="maximum" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
import com.android.build.gradle.api.BaseVariant | ||
import net.ltgt.gradle.errorprone.CheckSeverity | ||
|
||
plugins { | ||
|
@@ -39,6 +40,29 @@ android { | |
lintOptions { | ||
abortOnError false | ||
} | ||
|
||
DomainObjectSet<BaseVariant> variants = getApplicationVariants() // or getLibraryVariants() in libraries | ||
variants.addAll(getTestVariants()) | ||
variants.addAll(getUnitTestVariants()) | ||
variants.configureEach { variant -> | ||
variant.getJavaCompileProvider().configure { | ||
options.errorprone { | ||
check("NullAway", CheckSeverity.ERROR) | ||
option("NullAway:AnnotatedPackages", "com.uber") | ||
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we tried manually injecting a I am not sure we have integration tests for this config, so is worth doing that small manual sanity check :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @ZacSweers, would you mind rebasing and testing this? After that I'd be glad to merge this. Edit: Actually, never mind, testing it now :) |
||
|
||
// If you want to disable NullAway in justs tests, you can do the below | ||
// DomainObjectSet<BaseVariant> testVariants = getTestVariants() | ||
// testVariants.addAll(getUnitTestVariants()) | ||
// testVariants.configureEach { variant -> | ||
// variant.getJavaCompileProvider().configure { | ||
// options.errorprone { | ||
// check("NullAway", CheckSeverity.OFF) | ||
// } | ||
// } | ||
// } | ||
} | ||
|
||
dependencies { | ||
|
@@ -49,14 +73,3 @@ dependencies { | |
testImplementation deps.test.junit4 | ||
|
||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
// remove the if condition if you want to run NullAway on test code | ||
if (!name.toLowerCase().contains("test")) { | ||
options.errorprone { | ||
check("NullAway", CheckSeverity.ERROR) | ||
option("NullAway:AnnotatedPackages", "com.uber") | ||
} | ||
} | ||
} | ||
|
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.
Isn't this the GJF hook installer? Why are we getting rid of it?
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.
@lazaroclapp I just opened #297 on this. We should find a different way to do this.
gradlew
is an auto-generated file so this was a hack all along.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.
I vote we re-add this for now, then we remove it again at the same time as we implement #297
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.
Sure, but then let's land #298 before this one. We really shouldn't let master be red with respect to this, hack or not :)