Custom Plugin that adds dependencies to project depending on the plugin configuration

I want to create a plugin that when applied to a project and has attributes configure it will add set of dependencies
So if I had the below configured for my custom plugin in a project I would add feature 1 dependencies but not feature 2

myCustomPlugin {
 feature1=true
 feature2=false
}

Any good examples to follow or pointers the best way to implement this in Gradle 3?