How can I conditionally run code if a Gradle plugin is applied? -


i have script plugin to:

  • check if ivy-publish applied (via apply plugin: ivy-publish):
  • if applied, declare publishing { repositories { ivy { } } }
  • if it's not applied, run other code

however, i'm unsure of how run code if ivy-publish plugin applied, , couldn't find in documentation. there way this?

you can use pluginmanager.withplugin(string id, action<? super appliedplugin> action) method. javadoc:

if plugin specified id has been applied, supplied action executed immediately. otherwise, action executed after plugin specified id applied.

in build script like:

pluginmanager.withplugin('ivy-publish') {   // configuration } 

Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -