title: Programmatically updating build.gradle in an intellij plugin
body: <p>I am writing a plugin for intellij and I would like to programmatically alter the build.gradle file of an Intellij Project.</p>
  
  <p>I want to add</p>
  
  <pre><code>sourceSets {
      resources {
          srcDir 'src/resources'
      }
  }
  </code></pre>
  
  <p>inside the <code>android</code> object in the build.gradle file (this is an android project)</p>
  
  <p>I realize I have to do something along the lines</p>
  
  <pre><code>GradleBuildFile gradleBuildFile = GradleBuildFile.get(module);
  GrStatementOwner closure = gradleBuildFile.getClosure("android/sourceSets/main/resources");
  gradleBuildFile.setValue(closure, BuildFileKey.SRC_DIR, "blah");
  </code></pre>
  
  <p>Problem is, there is no <code>BuildFileKey.SRC_DIR</code> and I didn't find something remotely similar. </p>
  
  <p>Also, will this add the <code>sourceSets</code> object if it is not there in the build.gradle file?</p>
  
  <p>Any advice?</p>
  
  <p>Thanks</p>
  
  <p><strong>Update:</strong>
  Alternatively, is there a way to mark a folder as a resource folder? I don't want to use the default res folder. Perhaps using the AndroidFacet object..</p>