mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
fix(agent): after agent setup, Gradle and git work on the device (#3642)
This commit is contained in:
1 parent
811e285834
commit
59eaa0eb06
5 files changed
+75
-2
No files matched your search
@@ -226,7 +226,18 @@ object AgentSetup {
|
||||
/** The whole output of a step's last run; the card shows only its last line. */
|
||||
fun logFile(app: Context, step: Step) = File(app.filesDir, "agent/setup-${step.name.lowercase()}.log")
|
||||
|
||||
fun buildToolsInstalled(app: Context) = AgentHost.guestFileExists(app, "/root/aapt2/aapt2") && AgentHost.guestFileExists(app, "$CHECKOUT/.git")
|
||||
/**
|
||||
* An install set up before setup wrote the Gradle init script gets the step again, but only
|
||||
* once the checkout's setup writes it: the step runs that script, and an older one never would.
|
||||
*/
|
||||
fun buildToolsInstalled(app: Context) = AgentHost.guestFileExists(app, "/root/aapt2/aapt2") && AgentHost.guestFileExists(app, "$CHECKOUT/.git") &&
|
||||
(AgentHost.guestFileExists(app, GRADLE_INIT) || !setupWritesGradleInit(app))
|
||||
|
||||
private const val GRADLE_INIT = "/root/.gradle/init.d/droiddeck-device.gradle"
|
||||
|
||||
private fun setupWritesGradleInit(app: Context) = runCatching {
|
||||
File(LinuxRuntime.rootDir(app), "$CHECKOUT/tools/agent/setup".removePrefix("/")).readText().contains(GRADLE_INIT.substringAfterLast('/'))
|
||||
}.getOrDefault(false)
|
||||
|
||||
/** dd-lab-build compiled this install's commit, so a Lab build compiles only what changed. */
|
||||
private fun prepared(app: Context) = runCatching {
|
||||
|
||||
Reference in new issue
Block a user