Detecting gradle version from a plugin

I would like the ability to throw an exception if my gradle plugin doesn’t align with the expected gradle version (for example, my plugin currently only works on gradle 1.0 m3, it fails on m5).

Any thoughts on this? How do I detect the current gradle version?

project.gradle.gradleVersion