androidkotlingradleproguard

Curl command execution in Gradle.kts Script


I would like to execute below curl command in my gradle.kts Script. Tried gradle task but command not executable with error [pid=1991, exitValue="Not exited"].

curl -v -H Content-Type:text/plain --upload-file mapping.txt --user Example+account:Example-License-Key-4e8ec2ae6cfe https://api.eum-appdynamics.com/v2/account/Example+account/com.example.networklogger/1/proguard-mapping

I have tried this approach with below Gradle task and expecting to execute curl command.

task.create{
val command = "curl command URL"
Runtime.getRuntime().exec(command)
}

Solution

  • Finally for the answer after long dig deep.

    Did follow this curl command

    tasks.create(name: "uploadMappingFileToAppDynamics") { 
    
    doLast {
    exec {
    val sourcePath = "${outputsDir)/mapping/selectableEnvironmentRelease/mapping.txt"
    commandLine = Listof("curl",
    "-X",
    "Proxy URL",
    "-H",
    "Content-Type: text/plain",
    "--upload-filel",
    "${sourcePath}"
    "--User",
    "username",
    "password")
    }
    

    } }