Add Javadoc comment about not invoking (externally-defined) Methods inside Groovy/Gradle DSL (Closures).

Additionally:

* Suppress compiler warnings.
* Guard against possibly null Projecct objects passed to isAuthRequired(:Project) method.
This commit is contained in:
John Blum
2022-02-23 15:21:03 -08:00
parent 94fe7bd387
commit f3c9565e99

View File

@@ -34,6 +34,7 @@ class ArtifactoryPlugin implements Plugin<Project> {
project.plugins.apply('com.jfrog.artifactory')
// (Externally-defined) Methods cannot be invoked inside the Groovy/Gradle DSL.
def artifactoryRepoKey = resolveRepositoryKey(project)
def authRequired = isAuthRequired(project)
@@ -54,10 +55,12 @@ class ArtifactoryPlugin implements Plugin<Project> {
}
}
@SuppressWarnings("all")
private boolean isAuthRequired(Project project) {
project.hasProperty('artifactoryUsername')
project?.hasProperty('artifactoryUsername')
}
@SuppressWarnings("all")
private String resolveRepositoryKey(Project project) {
boolean isSnapshot = Utils.isSnapshot(project);