0

I am trying to create a gradle script to share apk with testers using the code below.

ext {
    TESTERS_LIST = ""
}
task uploadToFirebase(type: GradleBuild) {
    /*
        some logic here
    */
    tasks = ['appDistributionUploadBeta', 'app:assembleBeta']
}

task sendBuildToTeam1Qa() {
    TESTERS_LIST = "john@gmail.com, jane@gmail.com"
}
task sendBuildToTeam2Qa() {
    TESTERS_LIST = "other@gmail.com, another@gmail.com"
}
task sendBuildToTeam3Qa() {
    TESTERS_LIST = "doe@gmail.com"
}

sendBuildToTeam1Qa.dependsOn uploadToFirebase
sendBuildToTeam2Qa.dependsOn uploadToFirebase
sendBuildToTeam3Qa.dependsOn uploadToFirebase

and

firebaseAppDistribution {
     releaseNotes = project.RELEASE_NOTES_FROM_BRANCH
     testers = project.TESTERS_LIST
}

when I want to share apk with for example team1, I just run "./gradlew sendBuildToTeam1Qa", but problem here is when I do that, because all other tasks also run in configuration phase, value of TESTERS_LIST becomes the latest task on gradle ( for example here value will be third task's tester's list, because that is the one that executed last in configuration phase)

I've tried wrapping TESTERS_LIST assignments with doLast, but when I do that at the end TESTERS_LIST becomes empty because it is executed after upload task to firebase

nasibeyyubov
  • 1,735
  • 3
  • 11
  • 28

0 Answers0