title: Run curl command in gradle at a specific point in time
body: <p>I use bugsnag to monitor crashes in my Android app.
  I also use ProGuard when I compile a release version.
  I need to upload the mapping.txt file that is generated in build/outputs/mapping/prod/release folder of my project.</p>
  
  <p>When I run this command in (Windows) command line: </p>
  
  <pre><code>curl https://upload.bugsnag.com -F proguard=@C:/mapping.txt -F apiKey=1111111111111111111111 -F versionCode=11111111 -F appId=com.my.package -F versionNumber=1.0.0
  </code></pre>
  
  <p>The file is uploaded and everything works.</p>
  
  <p>All I need is to add a task to gradle so it uploads the file once its ready.
  So once I compile the project for release, the mapping.txt file gets generated and once its ready, upload the file using this curl command (<a href="https://bugsnag.com/docs/notifiers/android/proguard" rel="nofollow">which is taken from bugsnag's web site by the way</a>).</p>
  
  <p>I tried many variations. The current one compiles but I do not think the file is being uploaded... I can't see any indication that it actually happened.
  This is the code I currently use:</p>
  
  <pre><code>task uploadPro(type: Exec) {
      logger.error("inside upload task")
      commandLine 'cmd', '/c', 'curl', 'https://upload.bugsnag.com', '-F','proguard=@build/outputs/mapping/prod/release/mapping.txt', '-F', 'apiKey=1111111111111111111111', '-F', 'versionCode=111111', '-F', 'appId=com.my.package', '-F', 'versionNumber=1.0.0'
      standardOutput = new ByteArrayOutputStream()
      doLast {
          String output = standardOutput.toString()
          logger.info(output);
      }
  }
  </code></pre>
  
  <p>I also tried using this:</p>
  
  <pre><code>def p = ['cmd', '/c', 'curl', 'https://upload.bugsnag.com', '-F', 'proguard=@build/outputs/mapping/prod/release/mapping.txt', '-F', 'apiKey=11111111111111111111111', '-F', 'versionCode=1111111', '-F', 'appId=com.my.package', '-F', 'versionNumber=1.0.0'].execute()
  </code></pre>
  
  <p>The way I call this task is by using this command:</p>
  
  <pre><code>tasks.getByName("assembleRelease").finalizedBy(uploadPro)
  </code></pre>
  
  <p>Im really not sure how to do this. Any help is appreciated!! Thank you!</p>