appium-espresso-driver 2.17.0 → 2.18.1

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.18.1](https://github.com/appium/appium-espresso-driver/compare/v2.18.0...v2.18.1) (2023-03-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * remove .js ext from build-espresso command ([d13b85d](https://github.com/appium/appium-espresso-driver/commit/d13b85da41973e321b54dbd91c7679e9ee97ba35))
7
+
8
+ ## [2.18.0](https://github.com/appium/appium-espresso-driver/compare/v2.17.0...v2.18.0) (2023-03-22)
9
+
10
+
11
+ ### Features
12
+
13
+ * add building espresso server command via appium command ([#858](https://github.com/appium/appium-espresso-driver/issues/858)) ([cfaad9a](https://github.com/appium/appium-espresso-driver/commit/cfaad9a9cf82679df11cc4cbf57206d4f6d55b9c))
14
+
1
15
  ## [2.17.0](https://github.com/appium/appium-espresso-driver/compare/v2.16.1...v2.17.0) (2023-03-13)
2
16
 
3
17
 
package/README.md CHANGED
@@ -42,7 +42,12 @@ On top of standard Appium requirements Espresso driver also expects the followin
42
42
 
43
43
  ## Scripts
44
44
 
45
- - `appium driver run print-espresso-path` prints the path to the Appium Espresso server root. You can modify the gradle file directly if [Espresso Build Config](#espresso-build-config) was not sufficient.
45
+ - `appium driver run espresso print-espresso-path` prints the path to the Appium Espresso server root. You can modify the gradle file directly if [Espresso Build Config](#espresso-build-config) was not sufficient.
46
+ - `appium driver run espresso build-espresso` builds the espresso server since driver version 2.18.0. It helps building the espresso server outside of the Appium process. Available environment variables are below:
47
+ - `SHOW_GRADLE_LOG` configures if the command shows the gradle task logs. `true` or `1` sets it as enabled, but others set it as disabled. Defaults to disabled.
48
+ - `TEST_APP_PACKAGE` configures the target application to build the espresso server for.
49
+ - `ESPRESSO_BUILD_CONFIG` is an absolute path to the [Espresso Build Config](#espresso-build-config) as JSON format file.
50
+ - e.g. `SHOW_GRADLE_LOG=true TEST_APP_PACKAGE=your.test.pkg ESPRESSO_BUILD_CONFIG=/path/to/the/config.json appium driver run build-espresso`
46
51
 
47
52
  ## Capabilities
48
53
 
@@ -1259,4 +1264,3 @@ more details.
1259
1264
  * Espresso server unit tests are located at `io.appium.espressoserver.test` and can be run in Android Studio
1260
1265
  * NodeJS unit tests are run with `npm run test`
1261
1266
  * End-to-end tests are run with `npm run e2e-test` (remember to run `npm run build` before running this command so that it has up-to-date Espresso Server and NodeJS code)
1262
-
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-espresso-driver",
3
- "version": "2.17.0",
3
+ "version": "2.18.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-espresso-driver",
9
- "version": "2.17.0",
9
+ "version": "2.18.1",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@babel/runtime": "^7.4.3",
@@ -1124,7 +1124,7 @@
1124
1124
  }
1125
1125
  },
1126
1126
  "node_modules/@types/node": {
1127
- "version": "18.15.1",
1127
+ "version": "18.15.5",
1128
1128
  "license": "MIT"
1129
1129
  },
1130
1130
  "node_modules/@types/normalize-package-data": {
@@ -1445,7 +1445,7 @@
1445
1445
  "license": "ISC"
1446
1446
  },
1447
1447
  "node_modules/appium-chromedriver": {
1448
- "version": "5.3.0",
1448
+ "version": "5.3.1",
1449
1449
  "hasInstallScript": true,
1450
1450
  "license": "Apache-2.0",
1451
1451
  "dependencies": {
@@ -2628,7 +2628,7 @@
2628
2628
  }
2629
2629
  },
2630
2630
  "node_modules/graceful-fs": {
2631
- "version": "4.2.10",
2631
+ "version": "4.2.11",
2632
2632
  "license": "ISC"
2633
2633
  },
2634
2634
  "node_modules/handlebars": {
@@ -3141,7 +3141,7 @@
3141
3141
  "license": "ISC"
3142
3142
  },
3143
3143
  "node_modules/marked": {
3144
- "version": "4.2.12",
3144
+ "version": "4.3.0",
3145
3145
  "extraneous": true,
3146
3146
  "license": "MIT",
3147
3147
  "bin": {
@@ -4043,7 +4043,7 @@
4043
4043
  "license": "MIT"
4044
4044
  },
4045
4045
  "node_modules/safe-stable-stringify": {
4046
- "version": "2.4.2",
4046
+ "version": "2.4.3",
4047
4047
  "extraneous": true,
4048
4048
  "license": "MIT",
4049
4049
  "engines": {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "automated testing",
8
8
  "android"
9
9
  ],
10
- "version": "2.17.0",
10
+ "version": "2.18.1",
11
11
  "author": "Appium Contributors",
12
12
  "license": "Apache-2.0",
13
13
  "repository": {
@@ -39,7 +39,8 @@
39
39
  ],
40
40
  "mainClass": "EspressoDriver",
41
41
  "scripts": {
42
- "print-espresso-path": "./scripts/print-espresso-path.js"
42
+ "print-espresso-path": "./scripts/print-espresso-path.js",
43
+ "build-espresso": "./scripts/build-espresso.js"
43
44
  }
44
45
  },
45
46
  "main": "./build/index.js",
@@ -0,0 +1,56 @@
1
+ const _ = require('lodash');
2
+ const path = require('path');
3
+ const { logger, fs } = require('@appium/support');
4
+ const { ServerBuilder } = require('../build/lib/server-builder.js');
5
+
6
+ const LOG = new logger.getLogger('EspressoBuild');
7
+
8
+ const ROOT_DIR = path.resolve(__dirname, '..');
9
+ const ESPRESSO_SERVER_ROOT = path.join(ROOT_DIR, 'espresso-server');
10
+
11
+ const ESPRESSO_SERVER_BUILD = path.join(ESPRESSO_SERVER_ROOT, 'app', 'build');
12
+
13
+ async function buildEspressoServer () {
14
+
15
+ LOG.info(`Deleting the build directory ${ESPRESSO_SERVER_BUILD}`);
16
+
17
+ const opts = {
18
+ serverPath: ESPRESSO_SERVER_ROOT,
19
+ showGradleLog: !_.isEmpty(process.env.SHOW_GRADLE_LOG) && ['1', 'true'].includes(_.toLower(process.env.SHOW_GRADLE_LOG))
20
+ };
21
+
22
+ if (process.env.TEST_APP_PACKAGE) {
23
+ opts.testAppPackage = process.env.TEST_APP_PACKAGE;
24
+ }
25
+
26
+ if (process.env.ESPRESSO_BUILD_CONFIG) {
27
+ if (!(await fs.exists(process.env.ESPRESSO_BUILD_CONFIG))) {
28
+ throw new Error(`'${process.env.ESPRESSO_BUILD_CONFIG}' did not exist. Please set the path as an absolute path.`);
29
+ }
30
+ try {
31
+ const buildConfigurationStr = await fs.readFile(process.env.ESPRESSO_BUILD_CONFIG, 'utf8');
32
+ opts.buildConfiguration = JSON.parse(buildConfigurationStr);
33
+ LOG.info(`The espresso build config is ${JSON.stringify(opts.buildConfiguration)}`);
34
+ } catch (e) {
35
+ throw new Error(`Failed to parse the ${process.env.ESPRESSO_BUILD_CONFIG}. `
36
+ `Please make sure that the JSON is valid format. Error: ${e}`);
37
+ }
38
+ }
39
+
40
+ const builder = new ServerBuilder(LOG, opts);
41
+ try {
42
+ await builder.build();
43
+ } catch (e) {
44
+ throw new Error(`Failed to build the espresso server. `
45
+ `SHOW_GRADLE_LOG=true environment variable helps to check the gradle log. Error: ${e}`);
46
+ }
47
+
48
+ const dstPath = path.resolve(ESPRESSO_SERVER_ROOT, 'app', 'build', 'outputs', 'apk', 'androidTest', 'debug', 'app-debug-androidTest.apk');
49
+ if (await fs.exists(dstPath)) {
50
+ LOG.info(`Full path to the server APK: ${dstPath}`);
51
+ } else {
52
+ LOG.info(`Full path to the server build folder: ${ESPRESSO_SERVER_BUILD}`);
53
+ }
54
+ }
55
+
56
+ (async () => await buildEspressoServer())();