In a build file does it matter where `apply plugin...
# community-support
c
In a build file does it matter where
apply plugin
is called? I have an android app module build file that I'm migrating to kts and I noticed that we have
apply plugin: "com.google.gms.google-services
line at the bottom of the build file. Now I'm wondering if theres any reason why it would be at the bottom vs the 10 plugins at the top of the file. seems like someone in the past made a concious decision to put it at the bottom?
v
You should not use
apply
at all, that is legacy and discouraged. You should always use the
plugins
block to apply plugins. But yes, there could be a reason, if you do something in the code before that influences what happens in that plugin application.
c
yeah, im moving to the plugins block with my move to kts, but found that random apply plugin. so im not sure if im safe to move it up. seems like safety isn't guaranteed, so ill try to figure out why it was added down here
v
Good idea, if you can. I have a colleague that has a brain reset on each weekend. :-D Either way, chances are high it was just symptom treatment anyway. :-)