Revert "Fix adbkit API invocations (#524)" (#528)

This reverts commit 6f09708304.
This commit is contained in:
Karol Wrótniak
2022-05-12 10:08:47 +02:00
committed by GitHub
parent eacc7bbca7
commit e60bcee3fc
14 changed files with 11377 additions and 11710 deletions

View File

@@ -10,7 +10,6 @@ var pathutil = require('../../../util/pathutil')
var devutil = require('../../../util/devutil')
var streamutil = require('../../../util/streamutil')
var Resource = require('./util/resource')
var deviceClient = require('@devicefarmer/adbkit').DeviceClient
module.exports = syrup.serial()
.dependency(require('../support/adb'))
@@ -68,11 +67,9 @@ module.exports = syrup.serial()
, mode: 0755
})
}
var client = deviceClient(adb, options.serial)
function removeResource(res) {
return client.shell(['rm', '-f', res.dest])
return adb.shell(options.serial, ['rm', '-f', res.dest])
.timeout(10000)
.then(function(out) {
return streamutil.readAll(out)
@@ -81,7 +78,7 @@ module.exports = syrup.serial()
}
function pushResource(res) {
return client.push(res.src, res.dest, res.mode)
return adb.push(options.serial, res.src, res.dest, res.mode)
.timeout(10000)
.then(function(transfer) {
return new Promise(function(resolve, reject) {
@@ -96,7 +93,7 @@ module.exports = syrup.serial()
log.info('Installing "%s" as "%s"', res.src, res.dest)
function checkExecutable(res) {
return client.stat(res.dest)
return adb.stat(options.serial, res.dest)
.timeout(5000)
.then(function(stats) {
// Can't use fs.constants.S_IXUSR due to differences on Windows.

View File

@@ -3,7 +3,6 @@ var util = require('util')
var syrup = require('@devicefarmer/stf-syrup')
var ProtoBuf = require('protobufjs')
var semver = require('semver')
var deviceClient = require('@devicefarmer/adbkit').DeviceClient
var pathutil = require('../../../util/pathutil')
var streamutil = require('../../../util/streamutil')
@@ -31,8 +30,7 @@ module.exports = syrup.serial()
}
function getPath() {
var client = deviceClient(adb, options.serial)
return client.shell(['pm', 'path', resource.pkg])
return adb.shell(options.serial, ['pm', 'path', resource.pkg])
.timeout(10000)
.then(function(out) {
return streamutil.findLine(out, (/^package:/))
@@ -48,8 +46,7 @@ module.exports = syrup.serial()
return getPath()
.then(function(installedPath) {
log.info('Running version check')
var client = deviceClient(adb, options.serial)
return client.shell(util.format(
return adb.shell(options.serial, util.format(
"export CLASSPATH='%s';" +
" exec app_process /system/bin '%s' --version 2>/dev/null"
, installedPath
@@ -77,13 +74,11 @@ module.exports = syrup.serial()
log.info('Installing STFService')
// Uninstall first to make sure we don't have any certificate
// issues.
var client = deviceClient(adb, options.serial)
return client.uninstall(resource.pkg)
return adb.uninstall(options.serial, resource.pkg)
.timeout(15000)
.then(function() {
return promiseutil.periodicNotify(
client.install(resource.apk)
adb.install(options.serial, resource.apk)
, 20000
)
.timeout(65000)