Skip current APKs during project updates
This commit is contained in:
1 parent
605f353f4b
commit
4d00fe1b60
2 files changed
+35
-5
No files matched your search
@@ -1127,7 +1127,7 @@ private fun AppListScreen(
|
||||
|
||||
/**
|
||||
* Update is the whole way from the remote to this phone: pull, build what that brought in, and
|
||||
* install every APK it produced.
|
||||
* install each APK whose built copy is newer than what is on this phone.
|
||||
*
|
||||
* Written as the two halves in order rather than as a route of its own, because each half is
|
||||
* already a thing this app does and reports: the pull-and-build reports in the project's row
|
||||
@@ -1170,7 +1170,12 @@ private fun AppListScreen(
|
||||
// fired together means the second replaces the first on
|
||||
// screen, and a component silently not installed is worse than
|
||||
// one that says it is waiting.
|
||||
for (component in fresh.components.filter { it.apk != null }) {
|
||||
val installed = installedTimes[fresh.key].orEmpty()
|
||||
val variants = chosenVariants[fresh.key].orEmpty()
|
||||
for (component in
|
||||
fresh.components.filter {
|
||||
needsInstall(it, installed[it.name], variants[it.name])
|
||||
}) {
|
||||
// Not the one whose build just failed: its row already
|
||||
// says so, and asking for it again would run the same
|
||||
// failing command a second time to say it twice.
|
||||
@@ -4318,11 +4323,27 @@ private fun hasWorkWaiting(
|
||||
entry.newCommits ||
|
||||
entry.components.any { component ->
|
||||
component.isStale ||
|
||||
component.apk?.let {
|
||||
!isUpToDate(it, installedTimes[component.name], chosenVariants[component.name])
|
||||
} == true
|
||||
needsInstall(
|
||||
component,
|
||||
installedTimes[component.name],
|
||||
chosenVariants[component.name],
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this component has an APK that would change what is installed on this phone.
|
||||
*
|
||||
* Shared by the card's Update button and the project-wide Update loop: once a pull has left an APK
|
||||
* current, the button's reason for being enabled may belong to a sibling server, and that must not
|
||||
* make this APK an install candidate anyway.
|
||||
*/
|
||||
private fun needsInstall(
|
||||
component: ProjectComponent,
|
||||
installedLastUpdateTimeMillis: Long?,
|
||||
chosenVariantPath: String?,
|
||||
): Boolean =
|
||||
component.apk?.let { !isUpToDate(it, installedLastUpdateTimeMillis, chosenVariantPath) } == true
|
||||
|
||||
private fun isUpToDate(
|
||||
apk: ComponentApk,
|
||||
installedLastUpdateTimeMillis: Long?,
|
||||
|
||||
Reference in new issue
Block a user