Android gradle task Google Appengine

断了今生、忘了曾经 提交于 2019-12-03 13:13:03

问题


I'm trying to write a gradle task for my android application that starts the google appengine developer server, runs a test, and then closes the server.

What I've tried so far looks like this:

task runAppEngine (dependsOn: ":backend:appengineRun") <<{
   //run test 
   //stop development server
    }

The appengineRun task runs, but whatever I put in the doLast section of the gradle task never seems to get executed. For example if I put in a println statement it is never printed to the console.

I'm also not sure how to go about calling appengineStop from the task to stop the development server as well.

Thanks for any help anyone can offer!


回答1:


You probably need to run your backend:appengineRun task in daemon mode so it allows the gradle process to continue. See : https://github.com/GoogleCloudPlatform/gradle-appengine-plugin#convention-properties

This hack seems to work in my testing

task runAppEngine (dependsOn: ":backend:appengineRun") {
  project(":backend").afterEvaluate { backend ->
    backend.extensions.appengine.daemon = true
  }              
  doLast {
    println "started the server!"
  }
}

runAppEngine.finalizedBy ":backend:appengineStop"
// or whatever task you want it to stop after


来源:https://stackoverflow.com/questions/31434928/android-gradle-task-google-appengine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!