Skip to content

Commit

Permalink
Reimplement lazy evaluation of aspectjVersion
Browse files Browse the repository at this point in the history
Since Providers are not supported as dependency notation in Gradle 5.x
we now evaluate the aspectjVersion in the afterEvaluate callback.

Fixes #4
  • Loading branch information
britter committed Sep 17, 2020
1 parent 60702c3 commit 010b220
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/groovy/aspectj/AspectjGradlePlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ class AspectjGradlePlugin implements Plugin<Project> {
project.plugins.apply(JavaPlugin)

if (project.configurations.findByName('ajtools') == null) {
def aspectjVersion = project.objects.property(String).convention(project.provider { project.aspectjVersion })
project.configurations.create('ajtools')
project.dependencies {
ajtools aspectjVersion.map { "org.aspectj:aspectjtools:${it}" }
compile aspectjVersion.map { "org.aspectj:aspectjrt:${it}" }
project.afterEvaluate {
if (!project.hasProperty('aspectjVersion')) {
throw new GradleException("You must set the property 'aspectjVersion' before applying the aspectj plugin")
}
project.configurations.create('ajtools')
project.dependencies {
ajtools "org.aspectj:aspectjtools:${project.aspectjVersion}"
compile "org.aspectj:aspectjrt:${project.aspectjVersion}"
}
}
}

Expand Down

0 comments on commit 010b220

Please sign in to comment.