Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question with Gradle : get the return value of a task #197

Closed
joxad opened this issue Dec 2, 2016 · 3 comments
Closed

Question with Gradle : get the return value of a task #197

joxad opened this issue Dec 2, 2016 · 3 comments

Comments

@joxad
Copy link

joxad commented Dec 2, 2016

Hi,

Thanks for the job on fastlane, it is really nice to use. I have a question about it.

I have a lane that is working well :

desc "Building a new release candidate version of the proto"
  lane :build_rc do
    gradle(task: "clean") 
    gradle(task: "assembleReleaseCandidate")
    gradle(task: "createNewRevisionFile")
   # upload to Beta by Crashlytics
    crashlytics(
      api_token: ENV["CRASHLYTICS_API_TOKEN"],
      build_secret: ENV["CRASHLYTICS_BUILD_SECRET"],
    )

    send_slack(
      message:"New release candidate version oavailable",
    )
    # sh "your_script.sh"
    # You can also use other beta testing services here
  end

My question is about the createNewRevisionFile (which is working on its own)

task createNewRevisionFile() << {
    File f = new File("changelogs/"+version+"."+gitSha()+'.txt')
    def string = 'git log -1 --pretty=%B'.execute().text.trim()
    f.append(string)
    return f.getPath()
}

What I want to do is :

String fileForTheRevision =  gradle(task: "createNewRevisionFile")

crashlytics(
    ...
     notes_path: "filteForTheRevision"
    )

How can I get the return value of a gradle task in fastlane ?

@asfalcone
Copy link
Contributor

asfalcone commented Dec 2, 2016

@joxad Thanks for the question. Would you mind closing this issue and opening it in the main repo? This repo is for issues about our docs site itself. 👍

@joxad joxad closed this as completed Dec 7, 2016
@mohit-pandey
Copy link

mohit-pandey commented Oct 21, 2017

@joxad / @asfalcone: Hi, I am also facing the same issue.
Basically I want to fetch the build number and version of android app in fastFile, so that i can use the same in HockeyApp. Is there any workaround available?

@enizbilgin
Copy link

@joxad / @asfalcone: Hi, use this way

version_name = gradle(task: "-q readVersionName")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants