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

Add support for asynchronous extender builds #236

Merged
merged 19 commits into from
Aug 29, 2022
Merged

Add support for asynchronous extender builds #236

merged 19 commits into from
Aug 29, 2022

Conversation

britzl
Copy link
Contributor

@britzl britzl commented Aug 16, 2022

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.

Copy link
Contributor

@JCash JCash left a 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.

Comment on lines +83 to +108
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()
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@britzl britzl merged commit f24b7cc into dev Aug 29, 2022
@britzl britzl deleted the dev-async-builds branch August 29, 2022 10:17
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

Successfully merging this pull request may close these issues.

None yet

2 participants