-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add support for asynchronous extender builds #236
Conversation
/build_async /job_status /job_result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of code, but most it has been battle tested.
I think the logging bit can be improved though.
task createVersionFile() { | ||
def sha = System.getenv("COMMIT_SHORT_SHA") | ||
if (sha == null) { | ||
def outputStream = new ByteArrayOutputStream() | ||
exec { | ||
commandLine "git", "rev-parse", "--short", "HEAD" | ||
standardOutput = outputStream | ||
} | ||
sha = outputStream.toString().trim() | ||
} | ||
def build_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date ()) | ||
def text = """ | ||
// Auto generated by gradle | ||
|
||
package com.defold.extender; | ||
public class Version { | ||
public static final String gitVersion = "${sha}"; | ||
public static final String buildTime = "${build_time}"; | ||
} | ||
""" | ||
def binding = ["sha" : sha, "build_time" : build_time] | ||
|
||
def engine = new groovy.text.SimpleTemplateEngine() | ||
def template = engine.createTemplate(text).make(binding) | ||
|
||
new File(projectDir.toString() + "/src/main/java/com/defold/extender", "Version.java").text = template.toString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the benefit of this as opposed to the python script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was debating wether to change this or not. Removing the python script drops a dependency on python in favour of Java.
This adds asynchronous build support via the
/build_async/PLATFORM/VERSION
endpoint. Async builds return a job id which can be used to query build status via the/job_status?jobId=JOBID
endpoint while the build is in progress. When a build has completed the build result can be retrieved through the/job_result&jobId=JOBID
endpoint.