-
Notifications
You must be signed in to change notification settings - Fork 74
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
Embed the Zipline app in Android app assets #1563
Conversation
This allows the app to function without the server running, or without ever having to had connect to the server in the past. It will also allow automated testing of these applications in the future.
cb055d8
to
56c31da
Compare
// Add a timestamp to the manifest which is required for Zipline to load as an embedded app. | ||
val outputManifest = inputManifest.copy( | ||
unsigned = inputManifest.unsigned.copy( | ||
freshAtEpochMs = System.currentTimeMillis(), | ||
), | ||
) | ||
val outputManifestFile = outputDirectory.file("${appName.get()}.$ZIPLINE_MANIFEST_JSON").asFile | ||
outputManifestFile.writeText(outputManifest.encodeJson()) | ||
|
||
// Rewrite all .zipline files to their SHA-256 hashes which is how Zipline loads when embedded. | ||
for (module in outputManifest.modules.values) { | ||
val inputFile = checkNotNull(fileMap.remove(module.url)) { | ||
"No ${module.url} file found in input files as specified by the manifest" | ||
} | ||
val outputFile = outputDirectory.file(module.sha256.hex()).asFile | ||
inputFile.copyTo(outputFile) | ||
} |
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.
Future change: going to move all this to happen on the production-side rather than the consumer-side so as to support iOS more easily.
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.
And move this to the Zipline Gradle plugin!
/** Bundle a zip with dependencies and startup scripts. */ | ||
fun application(name: String, mainClass: String) | ||
/** Bundle a zip with dependencies and startup scripts for a CLI. */ | ||
fun cliApplication(name: String, mainClass: String) |
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 really like how this plugin is structured
@@ -374,4 +376,74 @@ private class RedwoodBuildExtensionImpl(private val project: Project) : RedwoodB | |||
} | |||
} | |||
} | |||
|
|||
override fun ziplineApplication() { |
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 aught to move this behavior to Zipline itself!
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.
Love it.
This allows the app to function without the server running, or without ever having to had connect to the server in the past. It will also allow automated testing of these applications in the future.
Refs #537
Views:
Compose UI: