appium-espresso-driver 9.0.4 → 9.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +2 -2
- package/build/lib/commands/actions.d.ts +1 -1
- package/build/lib/commands/actions.d.ts.map +1 -1
- package/build/lib/commands/actions.js.map +1 -1
- package/build/lib/commands/app-install.d.ts.map +1 -1
- package/build/lib/commands/app-install.js +4 -9
- package/build/lib/commands/app-install.js.map +1 -1
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/context.d.ts +1 -1
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/idling-resources.d.ts.map +1 -1
- package/build/lib/commands/idling-resources.js.map +1 -1
- package/build/lib/commands/misc.d.ts.map +1 -1
- package/build/lib/commands/misc.js +1 -1
- package/build/lib/commands/misc.js.map +1 -1
- package/build/lib/commands/screenshot.d.ts.map +1 -1
- package/build/lib/commands/screenshot.js.map +1 -1
- package/build/lib/commands/server/builder.d.ts.map +1 -1
- package/build/lib/commands/server/builder.js +8 -15
- package/build/lib/commands/server/builder.js.map +1 -1
- package/build/lib/commands/server/runner.d.ts +2 -2
- package/build/lib/commands/server/runner.d.ts.map +1 -1
- package/build/lib/commands/server/runner.js +8 -14
- package/build/lib/commands/server/runner.js.map +1 -1
- package/build/lib/commands/server/startup.d.ts.map +1 -1
- package/build/lib/commands/server/startup.js.map +1 -1
- package/build/lib/commands/services.d.ts.map +1 -1
- package/build/lib/commands/services.js.map +1 -1
- package/build/lib/doctor/required-checks.d.ts +1 -1
- package/build/lib/doctor/required-checks.d.ts.map +1 -1
- package/build/lib/doctor/required-checks.js +2 -2
- package/build/lib/doctor/required-checks.js.map +1 -1
- package/build/lib/driver.d.ts +7 -7
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +14 -18
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.d.ts.map +1 -1
- package/build/lib/execute-method-map.js +1 -7
- package/build/lib/execute-method-map.js.map +1 -1
- package/build/lib/method-map.js.map +1 -1
- package/build/lib/types.d.ts.map +1 -1
- package/build/lib/utils/package.d.ts.map +1 -1
- package/build/lib/utils/package.js +2 -2
- package/build/lib/utils/package.js.map +1 -1
- package/espresso-server/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk +0 -0
- package/espresso-server/buildSrc/.gradle/9.6.1/executionHistory/executionHistory.bin +0 -0
- package/espresso-server/buildSrc/.gradle/9.6.1/executionHistory/executionHistory.lock +0 -0
- package/espresso-server/buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/espresso-server/buildSrc/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/espresso-server/buildSrc/.gradle/file-system.probe +0 -0
- package/espresso-server/buildSrc/build/kotlin/compileKotlin/cacheable/last-build.bin +0 -0
- package/espresso-server/library/src/main/java/io/appium/espressoserver/lib/helpers/Version.kt +1 -1
- package/lib/commands/actions.ts +2 -1
- package/lib/commands/app-install.ts +9 -19
- package/lib/commands/app-management.ts +2 -1
- package/lib/commands/context.ts +2 -1
- package/lib/commands/element.ts +31 -76
- package/lib/commands/idling-resources.ts +9 -26
- package/lib/commands/misc.ts +14 -36
- package/lib/commands/screenshot.ts +1 -4
- package/lib/commands/server/builder.ts +13 -28
- package/lib/commands/server/runner.ts +24 -70
- package/lib/commands/server/startup.ts +2 -8
- package/lib/commands/services.ts +1 -5
- package/lib/doctor/required-checks.ts +6 -11
- package/lib/driver.ts +24 -37
- package/lib/execute-method-map.ts +1 -7
- package/lib/method-map.ts +1 -1
- package/lib/types.ts +1 -0
- package/lib/utils/package.ts +3 -2
- package/npm-shrinkwrap.json +166 -245
- package/package.json +57 -68
- package/scripts/build-espresso.mjs +7 -10
- package/scripts/diagnose-app.mjs +8 -13
- package/scripts/lib/dependency-versions/apk-dex.mjs +2 -1
- package/scripts/lib/dependency-versions/apk-kotlin-metadata.mjs +4 -2
- package/scripts/lib/dependency-versions/apk-meta-inf.mjs +4 -3
- package/scripts/lib/dependency-versions/apk-scan.mjs +4 -3
- package/scripts/lib/dependency-versions/comparison.mjs +3 -3
- package/scripts/lib/dependency-versions/gradle-scan.mjs +9 -11
- package/scripts/lib/dependency-versions/index.mjs +2 -9
- package/scripts/lib/dependency-versions/report.mjs +2 -5
- package/scripts/lib/dependency-versions/server-versions.mjs +3 -1
- package/scripts/lib/dependency-versions/tracked-modules.mjs +3 -12
- package/scripts/lib/dependency-versions/version-utils.mjs +1 -0
- package/scripts/lib/diagnose/app-input.mjs +4 -4
- package/scripts/lib/diagnose/checks/compile-sdk.mjs +1 -0
- package/scripts/lib/diagnose/checks/internet-permission.mjs +1 -2
- package/scripts/lib/diagnose/checks/startup-provider.mjs +2 -1
- package/scripts/lib/diagnose/diagnosis.mjs +2 -2
- package/scripts/lib/diagnose/gradle-utils.mjs +1 -5
- package/scripts/lib/diagnose/index.mjs +1 -5
- package/scripts/lib/diagnose/report.mjs +12 -4
- package/scripts/print-espresso-path.mjs +1 -0
- package/scripts/sync-version.mjs +8 -13
package/package.json
CHANGED
|
@@ -1,53 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-espresso-driver",
|
|
3
|
+
"version": "9.0.5",
|
|
3
4
|
"description": "Espresso integration for Appium",
|
|
4
5
|
"keywords": [
|
|
6
|
+
"android",
|
|
5
7
|
"appium",
|
|
6
|
-
"espresso",
|
|
7
8
|
"automated testing",
|
|
8
|
-
"
|
|
9
|
+
"espresso"
|
|
9
10
|
],
|
|
10
|
-
"
|
|
11
|
-
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/appium/appium-espresso-driver/issues"
|
|
13
|
+
},
|
|
12
14
|
"license": "Apache-2.0",
|
|
15
|
+
"author": "Appium Contributors",
|
|
13
16
|
"repository": {
|
|
14
17
|
"type": "git",
|
|
15
18
|
"url": "https://github.com/appium/appium-espresso-driver.git"
|
|
16
19
|
},
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/appium/appium-espresso-driver/issues"
|
|
19
|
-
},
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|
|
22
|
-
"npm": ">=10"
|
|
23
|
-
},
|
|
24
|
-
"prettier": {
|
|
25
|
-
"bracketSpacing": false,
|
|
26
|
-
"printWidth": 100,
|
|
27
|
-
"singleQuote": true
|
|
28
|
-
},
|
|
29
|
-
"type": "module",
|
|
30
|
-
"appium": {
|
|
31
|
-
"driverName": "espresso",
|
|
32
|
-
"automationName": "Espresso",
|
|
33
|
-
"platformNames": [
|
|
34
|
-
"Android"
|
|
35
|
-
],
|
|
36
|
-
"mainClass": "EspressoDriver",
|
|
37
|
-
"scripts": {
|
|
38
|
-
"print-espresso-path": "./scripts/print-espresso-path.mjs",
|
|
39
|
-
"build-espresso": "./scripts/build-espresso.mjs",
|
|
40
|
-
"diagnose-app": "./scripts/diagnose-app.mjs"
|
|
41
|
-
},
|
|
42
|
-
"doctor": {
|
|
43
|
-
"checks": [
|
|
44
|
-
"./build/lib/doctor/required-checks.js",
|
|
45
|
-
"./build/lib/doctor/optional-checks.js"
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"main": "./build/lib/index.js",
|
|
50
|
-
"types": "./build/lib/index.d.ts",
|
|
51
20
|
"bin": {},
|
|
52
21
|
"directories": {
|
|
53
22
|
"lib": "lib"
|
|
@@ -75,16 +44,15 @@
|
|
|
75
44
|
"LICENSE",
|
|
76
45
|
"npm-shrinkwrap.json"
|
|
77
46
|
],
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
"teen_process": "^4.0.6"
|
|
47
|
+
"type": "module",
|
|
48
|
+
"main": "./build/lib/index.js",
|
|
49
|
+
"types": "./build/lib/index.d.ts",
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"types": "./build/lib/index.d.ts",
|
|
53
|
+
"import": "./build/lib/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./package.json": "./package.json"
|
|
88
56
|
},
|
|
89
57
|
"scripts": {
|
|
90
58
|
"build": "npm run build:node && npm run build:server",
|
|
@@ -96,14 +64,13 @@
|
|
|
96
64
|
"clean:node": "npm run build -- --clean",
|
|
97
65
|
"clean:server": "cd espresso-server && ./gradlew clean || cd ..",
|
|
98
66
|
"dev": "npm run build -- --watch",
|
|
99
|
-
"lint": "
|
|
67
|
+
"lint": "oxlint -c oxlint.config.mjs .",
|
|
100
68
|
"lint:server": "cd espresso-server && ./gradlew lint || cd ..",
|
|
101
|
-
"lint:fix": "
|
|
102
|
-
"format": "
|
|
103
|
-
"format:check": "
|
|
69
|
+
"lint:fix": "oxlint -c oxlint.config.mjs --fix .",
|
|
70
|
+
"format": "oxfmt -c oxfmt.config.mjs .",
|
|
71
|
+
"format:check": "oxfmt -c oxfmt.config.mjs --check .",
|
|
104
72
|
"prepare": "npm run rebuild",
|
|
105
73
|
"sync-version": "node ./scripts/sync-version.mjs --package-version=${npm_package_version}",
|
|
106
|
-
"pretest": "npm run build:node",
|
|
107
74
|
"test": "node --test --test-timeout=60000 \"build/test/unit/**/*-specs.js\"",
|
|
108
75
|
"test:node": "npm test",
|
|
109
76
|
"test:server": "cd espresso-server && ./gradlew test --stacktrace || cd ..",
|
|
@@ -112,15 +79,22 @@
|
|
|
112
79
|
"pree2e-test": "npm run build:node",
|
|
113
80
|
"e2e-test": "node --test --test-concurrency=1 --test-timeout=300000 \"build/test/functional/**/*-specs.js\""
|
|
114
81
|
},
|
|
115
|
-
"
|
|
116
|
-
"appium": "^
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"appium-adb": "^16.0.0",
|
|
84
|
+
"appium-android-driver": "^14.0.2",
|
|
85
|
+
"asyncbox": "^6.1.0",
|
|
86
|
+
"axios": "^1.16.1",
|
|
87
|
+
"commander": "^14.0.1",
|
|
88
|
+
"io.appium.settings": "^8.0.1",
|
|
89
|
+
"portscanner": "^2.2.0",
|
|
90
|
+
"semver": "^7.6.2",
|
|
91
|
+
"teen_process": "^4.0.6"
|
|
117
92
|
},
|
|
118
93
|
"devDependencies": {
|
|
119
|
-
"@appium/
|
|
120
|
-
"@appium/
|
|
94
|
+
"@appium/oxc-config": "^1.1.0",
|
|
95
|
+
"@appium/semantic-release-config": "^1.1.0",
|
|
96
|
+
"@appium/tsconfig": "^1.2.0",
|
|
121
97
|
"@appium/types": "^1.5.1",
|
|
122
|
-
"@semantic-release/changelog": "^6.0.1",
|
|
123
|
-
"@semantic-release/git": "^10.0.1",
|
|
124
98
|
"@types/async-lock": "^1.4.2",
|
|
125
99
|
"@types/chai": "^5.2.3",
|
|
126
100
|
"@types/chai-as-promised": "^8.0.2",
|
|
@@ -133,20 +107,35 @@
|
|
|
133
107
|
"async-lock": "^1.0.0",
|
|
134
108
|
"chai": "^6.0.0",
|
|
135
109
|
"chai-as-promised": "^8.0.0",
|
|
136
|
-
"conventional-changelog-conventionalcommits": "^9.3.1",
|
|
137
|
-
"prettier": "^3.0.0",
|
|
138
|
-
"semantic-release": "^25.0.2",
|
|
139
110
|
"semver": "^7.3.7",
|
|
140
111
|
"sinon": "^22.0.0",
|
|
141
|
-
"typescript": "^6.0.3",
|
|
142
112
|
"webdriverio": "^9.26.0",
|
|
143
113
|
"xpath": "^0.x"
|
|
144
114
|
},
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
|
|
148
|
-
|
|
115
|
+
"peerDependencies": {
|
|
116
|
+
"appium": "^3.0.0-rc.2"
|
|
117
|
+
},
|
|
118
|
+
"engines": {
|
|
119
|
+
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|
|
120
|
+
"npm": ">=10"
|
|
121
|
+
},
|
|
122
|
+
"appium": {
|
|
123
|
+
"driverName": "espresso",
|
|
124
|
+
"automationName": "Espresso",
|
|
125
|
+
"platformNames": [
|
|
126
|
+
"Android"
|
|
127
|
+
],
|
|
128
|
+
"mainClass": "EspressoDriver",
|
|
129
|
+
"scripts": {
|
|
130
|
+
"print-espresso-path": "./scripts/print-espresso-path.mjs",
|
|
131
|
+
"build-espresso": "./scripts/build-espresso.mjs",
|
|
132
|
+
"diagnose-app": "./scripts/diagnose-app.mjs"
|
|
149
133
|
},
|
|
150
|
-
"
|
|
134
|
+
"doctor": {
|
|
135
|
+
"checks": [
|
|
136
|
+
"./build/lib/doctor/required-checks.js",
|
|
137
|
+
"./build/lib/doctor/optional-checks.js"
|
|
138
|
+
]
|
|
139
|
+
}
|
|
151
140
|
}
|
|
152
141
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import {logger, fs} from 'appium/support.js';
|
|
5
|
+
import {Command} from 'commander';
|
|
5
6
|
|
|
6
7
|
const LOG = logger.getLogger('EspressoBuild');
|
|
7
8
|
|
|
8
9
|
const ROOT_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
9
|
-
const SERVER_BUILDER_MODULE = pathToFileURL(
|
|
10
|
-
path.join(ROOT_DIR, 'build/lib/commands/server/index.js'),
|
|
11
|
-
).href;
|
|
10
|
+
const SERVER_BUILDER_MODULE = pathToFileURL(path.join(ROOT_DIR, 'build/lib/commands/server/index.js')).href;
|
|
12
11
|
const ESPRESSO_SERVER_ROOT = path.join(ROOT_DIR, 'espresso-server');
|
|
13
12
|
const ESPRESSO_SERVER_BUILD = path.join(ESPRESSO_SERVER_ROOT, 'app', 'build');
|
|
14
13
|
|
|
@@ -31,7 +30,7 @@ async function buildEspressoServer(options) {
|
|
|
31
30
|
if (options.buildConfig) {
|
|
32
31
|
if (!(await fs.exists(options.buildConfig))) {
|
|
33
32
|
throw new Error(
|
|
34
|
-
`Cannot find build config at '${options.buildConfig}'. Please provide a valid absolute path to it
|
|
33
|
+
`Cannot find build config at '${options.buildConfig}'. Please provide a valid absolute path to it.`,
|
|
35
34
|
);
|
|
36
35
|
}
|
|
37
36
|
try {
|
|
@@ -40,8 +39,8 @@ async function buildEspressoServer(options) {
|
|
|
40
39
|
LOG.info(`The espresso build config is ${JSON.stringify(opts.buildConfiguration)}`);
|
|
41
40
|
} catch (e) {
|
|
42
41
|
throw new Error(
|
|
43
|
-
`Failed to parse the build config at '${options.buildConfig}'.
|
|
44
|
-
|
|
42
|
+
`Failed to parse the build config at '${options.buildConfig}'. Please make sure it is a valid JSON file.`,
|
|
43
|
+
{cause: e},
|
|
45
44
|
);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
@@ -79,9 +78,7 @@ async function buildEspressoServer(options) {
|
|
|
79
78
|
*/
|
|
80
79
|
function isGradleLogEnabled(options) {
|
|
81
80
|
const showGradleLogEnv = process.env.SHOW_GRADLE_LOG?.toLowerCase();
|
|
82
|
-
return Boolean(options.showGradleLog ||
|
|
83
|
-
(showGradleLogEnv && ['1', 'true'].includes(showGradleLogEnv))
|
|
84
|
-
);
|
|
81
|
+
return Boolean(options.showGradleLog || (showGradleLogEnv && ['1', 'true'].includes(showGradleLogEnv)));
|
|
85
82
|
}
|
|
86
83
|
|
|
87
84
|
async function main() {
|
package/scripts/diagnose-app.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import {constants as fsConstants} from 'node:fs';
|
|
2
|
+
import {access} from 'node:fs/promises';
|
|
1
3
|
import path from 'node:path';
|
|
2
4
|
import {fileURLToPath} from 'node:url';
|
|
3
|
-
|
|
4
|
-
import {constants as fsConstants} from 'node:fs';
|
|
5
|
-
import {Command} from 'commander';
|
|
5
|
+
|
|
6
6
|
import {logger} from 'appium/support.js';
|
|
7
|
+
import {Command} from 'commander';
|
|
8
|
+
|
|
7
9
|
import {
|
|
8
10
|
collectAppInputFromApk,
|
|
9
11
|
collectAppInputFromProject,
|
|
@@ -50,13 +52,8 @@ async function main() {
|
|
|
50
52
|
const program = new Command();
|
|
51
53
|
program
|
|
52
54
|
.name('appium driver run espresso diagnose-app')
|
|
53
|
-
.description(
|
|
54
|
-
|
|
55
|
-
)
|
|
56
|
-
.requiredOption(
|
|
57
|
-
'--app <path>',
|
|
58
|
-
'Gradle project root of the AUT, or path to a built .apk (debug APK recommended)',
|
|
59
|
-
)
|
|
55
|
+
.description('Diagnose whether an Android app is ready to embed a precompiled Espresso server')
|
|
56
|
+
.requiredOption('--app <path>', 'Gradle project root of the AUT, or path to a built .apk (debug APK recommended)')
|
|
60
57
|
.action(async (options) => {
|
|
61
58
|
const [appInput, serverDefaults] = await Promise.all([
|
|
62
59
|
resolveAppInput(options.app),
|
|
@@ -67,9 +64,7 @@ async function main() {
|
|
|
67
64
|
LOG.info(`App: ${appInput.kind} at ${appInput.path}`);
|
|
68
65
|
LOG.info(`Driver: appium-espresso-driver@${serverDefaults.driverVersion}`);
|
|
69
66
|
if (appInput.sources?.length) {
|
|
70
|
-
LOG.info(
|
|
71
|
-
`Scanned: ${appInput.sources.slice(0, 8).join(', ')}${appInput.sources.length > 8 ? '…' : ''}`,
|
|
72
|
-
);
|
|
67
|
+
LOG.info(`Scanned: ${appInput.sources.slice(0, 8).join(', ')}${appInput.sources.length > 8 ? '…' : ''}`);
|
|
73
68
|
}
|
|
74
69
|
LOG.info('');
|
|
75
70
|
LOG.info(formatDiagnosisReport(report));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {fs} from 'appium/support.js';
|
|
2
|
-
import {ADB} from 'appium-adb';
|
|
3
1
|
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import {ADB} from 'appium-adb';
|
|
4
|
+
import {fs} from 'appium/support.js';
|
|
4
5
|
import {exec} from 'teen_process';
|
|
6
|
+
|
|
5
7
|
import {normalizeVersion} from './version-utils.mjs';
|
|
6
8
|
|
|
7
9
|
/** @type {Promise<import('appium-adb').ADB> | undefined} */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {fs} from 'appium/support.js';
|
|
2
1
|
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import {fs} from 'appium/support.js';
|
|
4
|
+
|
|
3
5
|
import {normalizeVersion} from './version-utils.mjs';
|
|
4
6
|
|
|
5
7
|
/** @type {ReadonlyArray<{moduleId: string, matches: (base: string) => boolean}>} */
|
|
@@ -9,8 +11,7 @@ const META_INF_VERSION_MODULE_RULES = [
|
|
|
9
11
|
{moduleId: 'espresso', matches: (base) => base.startsWith('androidx.test.espresso')},
|
|
10
12
|
{
|
|
11
13
|
moduleId: 'annotation',
|
|
12
|
-
matches: (base) =>
|
|
13
|
-
base.startsWith('androidx.annotation_annotation') && !base.includes('experimental'),
|
|
14
|
+
matches: (base) => base.startsWith('androidx.annotation_annotation') && !base.includes('experimental'),
|
|
14
15
|
},
|
|
15
16
|
{moduleId: 'uiautomator', matches: (base) => base.startsWith('androidx.test.uiautomator')},
|
|
16
17
|
{
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {fs, tempDir} from 'appium/support.js';
|
|
2
|
-
|
|
3
|
-
import {collectVersionsFromCorpus, versionSetsToSortedRecords} from './version-utils.mjs';
|
|
2
|
+
|
|
4
3
|
import {extractApk, readAllDexStrings, detectProguardLikely, collectMetaInfStrings} from './apk-dex.mjs';
|
|
5
|
-
import {mergeMetaInfEmbeddedVersions} from './apk-meta-inf.mjs';
|
|
6
4
|
import {mergeKotlinMetadataVersionsFromDex} from './apk-kotlin-metadata.mjs';
|
|
5
|
+
import {mergeMetaInfEmbeddedVersions} from './apk-meta-inf.mjs';
|
|
6
|
+
import {createEmptyVersionSets} from './tracked-modules.mjs';
|
|
7
|
+
import {collectVersionsFromCorpus, versionSetsToSortedRecords} from './version-utils.mjs';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @param {string} apkPath
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
|
+
|
|
2
3
|
import {TRACKED_MODULES} from './tracked-modules.mjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -166,9 +167,8 @@ function buildVersionRecommendation(mod, diff, appVersion, serverVersion, ctx) {
|
|
|
166
167
|
};
|
|
167
168
|
}
|
|
168
169
|
if (diff === 'major' || diff === 'unknown') {
|
|
169
|
-
const serverIsNewer =
|
|
170
|
-
? semver.gt(serverVersion, appVersion)
|
|
171
|
-
: false;
|
|
170
|
+
const serverIsNewer =
|
|
171
|
+
semver.valid(serverVersion) && semver.valid(appVersion) ? semver.gt(serverVersion, appVersion) : false;
|
|
172
172
|
if (serverIsNewer) {
|
|
173
173
|
return {
|
|
174
174
|
level: 'warning',
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {fs} from 'appium/support.js';
|
|
2
1
|
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import {fs} from 'appium/support.js';
|
|
4
|
+
|
|
3
5
|
import {TRACKED_MODULES, createEmptyVersionSets} from './tracked-modules.mjs';
|
|
4
6
|
import {
|
|
5
7
|
normalizeVersion,
|
|
@@ -9,8 +11,7 @@ import {
|
|
|
9
11
|
} from './version-utils.mjs';
|
|
10
12
|
|
|
11
13
|
/** @type {RegExp} Gradle configs that do not affect the main/release app artifact. */
|
|
12
|
-
const NON_MAIN_DEP_CONFIG_LINE =
|
|
13
|
-
/^\s*(?:androidTest|test)(?:Implementation|Api|CompileOnly|RuntimeOnly|WearApp)\b/;
|
|
14
|
+
const NON_MAIN_DEP_CONFIG_LINE = /^\s*(?:androidTest|test)(?:Implementation|Api|CompileOnly|RuntimeOnly|WearApp)\b/;
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Keeps dependency declarations that can affect the main app artifact (implementation, api, …).
|
|
@@ -50,14 +51,11 @@ export function extractMainAppDependencyScopes(text) {
|
|
|
50
51
|
* @returns {Promise<string[]>}
|
|
51
52
|
*/
|
|
52
53
|
export async function findGradleFiles(root, maxDepth = 6) {
|
|
53
|
-
const matches = await fs.glob(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
ignore: ['**/node_modules/**', '**/.git/**', '**/build/**'],
|
|
59
|
-
},
|
|
60
|
-
);
|
|
54
|
+
const matches = await fs.glob('**/{build.gradle,build.gradle.kts,gradle.properties,libs.versions.toml}', {
|
|
55
|
+
cwd: root,
|
|
56
|
+
absolute: true,
|
|
57
|
+
ignore: ['**/node_modules/**', '**/.git/**', '**/build/**'],
|
|
58
|
+
});
|
|
61
59
|
return matches.filter((filePath) => {
|
|
62
60
|
const parts = path.relative(root, filePath).split(path.sep).filter(Boolean);
|
|
63
61
|
return parts.length - 1 <= maxDepth;
|
|
@@ -7,17 +7,10 @@ export {
|
|
|
7
7
|
versionFromPatternMatch,
|
|
8
8
|
versionSetsToSortedRecords,
|
|
9
9
|
} from './version-utils.mjs';
|
|
10
|
-
export {
|
|
11
|
-
collectAppVersionsFromProject,
|
|
12
|
-
extractMainAppDependencyScopes,
|
|
13
|
-
findGradleFiles,
|
|
14
|
-
} from './gradle-scan.mjs';
|
|
10
|
+
export {collectAppVersionsFromProject, extractMainAppDependencyScopes, findGradleFiles} from './gradle-scan.mjs';
|
|
15
11
|
export {collectAppVersionsFromApk} from './apk-scan.mjs';
|
|
16
12
|
export {mapMetaInfVersionBaseToModule, mergeMetaInfEmbeddedVersions} from './apk-meta-inf.mjs';
|
|
17
|
-
export {
|
|
18
|
-
mergeKotlinMetadataVersionsFromDex,
|
|
19
|
-
parseKotlinMetadataVersionsFromDexdump,
|
|
20
|
-
} from './apk-kotlin-metadata.mjs';
|
|
13
|
+
export {mergeKotlinMetadataVersionsFromDex, parseKotlinMetadataVersionsFromDexdump} from './apk-kotlin-metadata.mjs';
|
|
21
14
|
export {buildComparisonReport, compareModuleVersions} from './comparison.mjs';
|
|
22
15
|
export {formatReport, mergeEspressoBuildConfigSuggestions} from './report.mjs';
|
|
23
16
|
export {loadEspressoServerVersions} from './server-versions.mjs';
|
|
@@ -47,9 +47,7 @@ export function formatReport(report, opts = {}) {
|
|
|
47
47
|
lines.push(' Gradle reports minifyEnabled=true for this project.');
|
|
48
48
|
}
|
|
49
49
|
if (report.proguardLikely) {
|
|
50
|
-
lines.push(
|
|
51
|
-
' The APK looks obfuscated/minified. Dependency versions extracted from the APK may be incomplete.',
|
|
52
|
-
);
|
|
50
|
+
lines.push(' The APK looks obfuscated/minified. Dependency versions extracted from the APK may be incomplete.');
|
|
53
51
|
}
|
|
54
52
|
lines.push('');
|
|
55
53
|
lines.push('Espresso server default module versions (from driver libs.versions.toml):');
|
|
@@ -83,8 +81,7 @@ export function formatReport(report, opts = {}) {
|
|
|
83
81
|
lines.push('');
|
|
84
82
|
}
|
|
85
83
|
|
|
86
|
-
const includeMerged =
|
|
87
|
-
opts.includeMergedConfig !== false && !opts.compact;
|
|
84
|
+
const includeMerged = opts.includeMergedConfig !== false && !opts.compact;
|
|
88
85
|
const mergedConfig = mergeEspressoBuildConfigSuggestions(report.modules);
|
|
89
86
|
if (includeMerged && Object.keys(mergedConfig).length) {
|
|
90
87
|
lines.push('Merged espressoBuildConfig suggestion (combine with your existing config):');
|
|
@@ -35,10 +35,7 @@ export const TRACKED_MODULES = [
|
|
|
35
35
|
toolsVersionKey: 'annotationVersion',
|
|
36
36
|
catalogKey: 'annotation',
|
|
37
37
|
gradleProperty: 'appiumAnnotationVersion',
|
|
38
|
-
patterns: [
|
|
39
|
-
/\bannotation\s*=\s*["']([^"']+)["']/gi,
|
|
40
|
-
/androidx\.annotation:annotation:([\d.]+)/gi,
|
|
41
|
-
],
|
|
38
|
+
patterns: [/\bannotation\s*=\s*["']([^"']+)["']/gi, /androidx\.annotation:annotation:([\d.]+)/gi],
|
|
42
39
|
},
|
|
43
40
|
{
|
|
44
41
|
id: 'androidxTest',
|
|
@@ -47,10 +44,7 @@ export const TRACKED_MODULES = [
|
|
|
47
44
|
toolsVersionKey: null,
|
|
48
45
|
catalogKey: 'androidxTest',
|
|
49
46
|
gradleProperty: 'appiumAndroidxTestVersion',
|
|
50
|
-
patterns: [
|
|
51
|
-
/androidxTest\s*=\s*["']([^"']+)["']/gi,
|
|
52
|
-
/androidx\.test:(?:core|runner|rules|ext):[\w-]*:([\d.]+)/gi,
|
|
53
|
-
],
|
|
47
|
+
patterns: [/androidxTest\s*=\s*["']([^"']+)["']/gi, /androidx\.test:(?:core|runner|rules|ext):[\w-]*:([\d.]+)/gi],
|
|
54
48
|
},
|
|
55
49
|
{
|
|
56
50
|
id: 'uiautomator',
|
|
@@ -59,10 +53,7 @@ export const TRACKED_MODULES = [
|
|
|
59
53
|
toolsVersionKey: null,
|
|
60
54
|
catalogKey: 'uiautomator',
|
|
61
55
|
gradleProperty: 'appiumUiAutomatorVersion',
|
|
62
|
-
patterns: [
|
|
63
|
-
/\buiautomator\s*=\s*["']([^"']+)["']/gi,
|
|
64
|
-
/androidx\.test\.uiautomator:uiautomator:([\d.]+)/gi,
|
|
65
|
-
],
|
|
56
|
+
patterns: [/\buiautomator\s*=\s*["']([^"']+)["']/gi, /androidx\.test\.uiautomator:uiautomator:([\d.]+)/gi],
|
|
66
57
|
},
|
|
67
58
|
{
|
|
68
59
|
id: 'kotlin',
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {fs} from 'appium/support.js';
|
|
2
1
|
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import {fs} from 'appium/support.js';
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
6
|
collectAppVersionsFromApk,
|
|
5
7
|
collectAppVersionsFromProject,
|
|
@@ -37,9 +39,7 @@ export async function loadEspressoServerDefaults(espressoServerRoot, driverRoot)
|
|
|
37
39
|
export async function collectAppInputFromProject(projectRoot) {
|
|
38
40
|
const {versions, minifyEnabled, sources} = await collectAppVersionsFromProject(projectRoot);
|
|
39
41
|
const gradleFiles = sources.map((rel) => path.join(projectRoot, rel));
|
|
40
|
-
const gradleCorpus = (
|
|
41
|
-
await Promise.all(gradleFiles.map((f) => fs.readFile(f, 'utf8').catch(() => '')))
|
|
42
|
-
).join('\n');
|
|
42
|
+
const gradleCorpus = (await Promise.all(gradleFiles.map((f) => fs.readFile(f, 'utf8').catch(() => '')))).join('\n');
|
|
43
43
|
const manifestTexts = await findManifestTexts(projectRoot);
|
|
44
44
|
|
|
45
45
|
return {
|
|
@@ -40,8 +40,7 @@ export async function checkInternetPermission(appInput) {
|
|
|
40
40
|
const corpus = appInput.gradleCorpus ?? '';
|
|
41
41
|
const manifests = appInput.manifestPaths ?? [];
|
|
42
42
|
const hasInternet =
|
|
43
|
-
/android\.permission\.INTERNET/.test(corpus) ||
|
|
44
|
-
manifests.some((m) => /android\.permission\.INTERNET/.test(m));
|
|
43
|
+
/android\.permission\.INTERNET/.test(corpus) || manifests.some((m) => /android\.permission\.INTERNET/.test(m));
|
|
45
44
|
|
|
46
45
|
if (hasInternet) {
|
|
47
46
|
return [
|
|
@@ -23,7 +23,8 @@ export function checkInitializationProvider(appInput) {
|
|
|
23
23
|
id: 'startup-provider',
|
|
24
24
|
title: 'App Startup provider',
|
|
25
25
|
status: 'pass',
|
|
26
|
-
message:
|
|
26
|
+
message:
|
|
27
|
+
'InitializationProvider is explicitly removed for instrumentation (recommended for Espresso fixtures).',
|
|
27
28
|
},
|
|
28
29
|
];
|
|
29
30
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import {buildComparisonReport} from '../dependency-versions/index.mjs';
|
|
2
|
-
import {mergeAllEspressoBuildConfig} from './espresso-build-config.mjs';
|
|
3
|
-
import {buildDiagnosisSummary} from './summary.mjs';
|
|
4
2
|
import {
|
|
5
3
|
checkAndroidX,
|
|
6
4
|
checkCompileSdk,
|
|
@@ -11,6 +9,8 @@ import {
|
|
|
11
9
|
checkPrecompileInputKind,
|
|
12
10
|
mapDependencyChecks,
|
|
13
11
|
} from './checks/index.mjs';
|
|
12
|
+
import {mergeAllEspressoBuildConfig} from './espresso-build-config.mjs';
|
|
13
|
+
import {buildDiagnosisSummary} from './summary.mjs';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @param {import('./types.mjs').AppInput} appInput
|
|
@@ -19,11 +19,7 @@ export function parseGradleProperties(text) {
|
|
|
19
19
|
* @returns {number | null}
|
|
20
20
|
*/
|
|
21
21
|
export function parseCompileSdkFromCorpus(corpus) {
|
|
22
|
-
const patterns = [
|
|
23
|
-
/compileSdk\s*=\s*(\d+)/,
|
|
24
|
-
/compileSdkVersion\s*=\s*(\d+)/,
|
|
25
|
-
/compileSdk\s+(\d+)/,
|
|
26
|
-
];
|
|
22
|
+
const patterns = [/compileSdk\s*=\s*(\d+)/, /compileSdkVersion\s*=\s*(\d+)/, /compileSdk\s+(\d+)/];
|
|
27
23
|
let max = 0;
|
|
28
24
|
for (const pattern of patterns) {
|
|
29
25
|
let match;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
collectAppInputFromApk,
|
|
3
|
-
collectAppInputFromProject,
|
|
4
|
-
loadEspressoServerDefaults,
|
|
5
|
-
} from './app-input.mjs';
|
|
1
|
+
export {collectAppInputFromApk, collectAppInputFromProject, loadEspressoServerDefaults} from './app-input.mjs';
|
|
6
2
|
export {runDiagnosis} from './diagnosis.mjs';
|
|
7
3
|
export {formatDiagnosisReport} from './report.mjs';
|
|
@@ -45,9 +45,17 @@ export function formatDiagnosisReport(report) {
|
|
|
45
45
|
* @param {import('./types.mjs').CheckStatus} s
|
|
46
46
|
*/
|
|
47
47
|
function statusIcon(s) {
|
|
48
|
-
if (s === 'pass') {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (s === '
|
|
48
|
+
if (s === 'pass') {
|
|
49
|
+
return '[PASS]';
|
|
50
|
+
}
|
|
51
|
+
if (s === 'warn') {
|
|
52
|
+
return '[WARN]';
|
|
53
|
+
}
|
|
54
|
+
if (s === 'fail') {
|
|
55
|
+
return '[FAIL]';
|
|
56
|
+
}
|
|
57
|
+
if (s === 'skip') {
|
|
58
|
+
return '[SKIP]';
|
|
59
|
+
}
|
|
52
60
|
return '[INFO]';
|
|
53
61
|
}
|
package/scripts/sync-version.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import {fileURLToPath} from 'node:url';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import {logger, fs} from 'appium/support.js';
|
|
5
|
+
import {Command} from 'commander';
|
|
5
6
|
import semver from 'semver';
|
|
6
7
|
|
|
7
8
|
const LOG = logger.getLogger('VersionSync');
|
|
@@ -19,7 +20,7 @@ const VERSION_FILE = path.join(
|
|
|
19
20
|
'espressoserver',
|
|
20
21
|
'lib',
|
|
21
22
|
'helpers',
|
|
22
|
-
'Version.kt'
|
|
23
|
+
'Version.kt',
|
|
23
24
|
);
|
|
24
25
|
const VERSION_PATTERN = /VERSION\s*=\s*"([0-9.]+)"/;
|
|
25
26
|
|
|
@@ -43,18 +44,12 @@ async function main() {
|
|
|
43
44
|
program
|
|
44
45
|
.name('node ./scripts/sync-version.mjs')
|
|
45
46
|
.description('Sync package version into Espresso server module source')
|
|
46
|
-
.requiredOption(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
(value) => {
|
|
50
|
-
if (!semver.valid(value)) {
|
|
51
|
-
throw new Error(
|
|
52
|
-
`Invalid version specified '${value}'. The value must be a valid semver string like '1.2.3'`
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
return value;
|
|
47
|
+
.requiredOption('--package-version <version>', 'Package version to synchronize', (value) => {
|
|
48
|
+
if (!semver.valid(value)) {
|
|
49
|
+
throw new Error(`Invalid version specified '${value}'. The value must be a valid semver string like '1.2.3'`);
|
|
56
50
|
}
|
|
57
|
-
|
|
51
|
+
return value;
|
|
52
|
+
})
|
|
58
53
|
.action(async (options) => {
|
|
59
54
|
await syncModuleVersion(options.packageVersion);
|
|
60
55
|
});
|