title: gradle apply plugin conditionally in sub-modules w/o affecting root?
body: <p>I am tinkering with this concept of a 'local.gradle' that can add/extend a build.gradle for a sub-project if the local.gradle exists.  Simple example:</p>
  
  <pre><code>if(file('local.gradle').exists()){
      apply from: 'local.gradle' 
  }
  </code></pre>
  
  <p>This works ok, and can embellish local builds but not 'clog' up our continous builds with goop from workstations etc. </p>
  
  <p>Trouble is, one of my local.gradle files wants to use a plugin like so: </p>
  
  <pre><code>apply plugin: 'fladoodle'
  buildscript {
      repositories {
          maven {
              url 'http://dl.bintray.com/niftystuff/pseudorepo'
          }
      }   
      dependencies {
          classpath 'org.home:gradle-fladoodle-plugin:0.1'
      }
  }
  </code></pre>
  
  <p>This kinda works, but then tasks and stuff in local.gradle don't really 'know' about stuff the multi-project build and root build file; stuff like tasks.getByPath(':somesub:somejar') doesn't seem to make sense in the local.gradle. </p>
  
  <p>So I moved the buildscript stuff for locating the plugin to the root; near (actually in) the section in the root build where other plugin dependencies are declared.   The local.gradle just has an apply and then gradle stuff for that plugin; all is well and that absolute path stuff seems to be working now.   I have not included any reference to local.gradle in the root setting.gradle ...nor do I want too...</p>
  
  <p>But, now I have stuff in root build.gradle that really doesn't belong there -- as the root will never know if a sub will have a local.gradle.     NOTE:   the buildscript stuff is NOT in allprojects{  } or subprojects  {}   -- so it really can't ask the question for the current sub that I am processing, is there a local.gradle; if so add a new maven repo to the buildscript { } for resolution of a plugin that maybe used in the local.gradle  (further, the root should really NOT need to know if a local file wishes to apply additional pluggins -- just smells like bad coupling).    </p>
  
  <p><strong><em>So can a conditionally included 'local.gradle' file some how affect the plugin "apply from" dependencies in a way w/o having to leak this information into other places (i.e. the root) of a build?</em></strong></p>