appium-webdriveragent 3.9.1 → 3.9.2
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.
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const { asyncify } = require('asyncbox');
|
|
4
|
+
const { logger, fs, mkdirp, zip } = require('appium-support');
|
|
5
|
+
const { exec } = require('teen_process');
|
|
6
|
+
const xcode = require('appium-xcode');
|
|
7
|
+
|
|
8
|
+
const log = new logger.getLogger('WDABuild');
|
|
9
|
+
const rootDir = path.resolve(__dirname, '..');
|
|
10
|
+
|
|
11
|
+
async function buildWebDriverAgent (xcodeVersion) {
|
|
12
|
+
// Get Xcode version
|
|
13
|
+
xcodeVersion = xcodeVersion || await xcode.getVersion();
|
|
14
|
+
log.info(`Building bundle for Xcode version '${xcodeVersion}'`);
|
|
15
|
+
|
|
16
|
+
// Clear WebDriverAgent from derived data
|
|
17
|
+
const derivedDataPath = path.resolve(os.homedir(), 'Library', 'Developer',
|
|
18
|
+
'Xcode', 'DerivedData');
|
|
19
|
+
log.info(`Clearing contents of '${derivedDataPath}/WebDriverAgent-*'`);
|
|
20
|
+
for (const wdaPath of
|
|
21
|
+
await fs.glob('WebDriverAgent-*', {cwd: derivedDataPath, absolute: true})
|
|
22
|
+
) {
|
|
23
|
+
log.info(`Deleting existing WDA: '${wdaPath}'`);
|
|
24
|
+
await fs.rimraf(wdaPath);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Clean and build
|
|
28
|
+
log.info('Running ./Scripts/build.sh');
|
|
29
|
+
let env = {TARGET: 'runner', SDK: 'sim'};
|
|
30
|
+
try {
|
|
31
|
+
await exec('/bin/bash', ['./Scripts/build.sh'], {env, cwd: rootDir});
|
|
32
|
+
} catch (e) {
|
|
33
|
+
log.error(`===FAILED TO BUILD FOR ${xcodeVersion}`);
|
|
34
|
+
log.error(e.stdout);
|
|
35
|
+
log.error(e.stderr);
|
|
36
|
+
log.error(e.message);
|
|
37
|
+
throw e;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Create bundles folder
|
|
41
|
+
const pathToBundles = path.resolve(rootDir, 'bundles');
|
|
42
|
+
await mkdirp(pathToBundles);
|
|
43
|
+
|
|
44
|
+
// Start creating zip
|
|
45
|
+
const uncompressedDir = path.resolve(rootDir, 'uncompressed');
|
|
46
|
+
await fs.rimraf(uncompressedDir);
|
|
47
|
+
await mkdirp(uncompressedDir);
|
|
48
|
+
log.info('Creating zip');
|
|
49
|
+
|
|
50
|
+
// Move contents of the root to folder called "uncompressed"
|
|
51
|
+
await exec('rsync', [
|
|
52
|
+
'-av', '.', uncompressedDir,
|
|
53
|
+
'--exclude', 'node_modules',
|
|
54
|
+
'--exclude', 'build',
|
|
55
|
+
'--exclude', 'ci-jobs',
|
|
56
|
+
'--exclude', 'lib',
|
|
57
|
+
'--exclude', 'test',
|
|
58
|
+
'--exclude', 'bundles',
|
|
59
|
+
'--exclude', 'azure-templates',
|
|
60
|
+
], {cwd: rootDir});
|
|
61
|
+
|
|
62
|
+
// Move DerivedData/WebDriverAgent-* from Library to "uncompressed" folder
|
|
63
|
+
const wdaPath = (await fs.glob(`${derivedDataPath}/WebDriverAgent-*`))[0];
|
|
64
|
+
await mkdirp(path.resolve(uncompressedDir, 'DerivedData'));
|
|
65
|
+
await fs.rename(wdaPath, path.resolve(uncompressedDir, 'DerivedData', 'WebDriverAgent'));
|
|
66
|
+
|
|
67
|
+
// Compress the "uncompressed" bundle as a Zip
|
|
68
|
+
const pathToZip = path.resolve(pathToBundles, `webdriveragent-xcode_${xcodeVersion}.zip`);
|
|
69
|
+
await zip.toArchive(
|
|
70
|
+
pathToZip, {cwd: path.join(rootDir, 'uncompressed')}
|
|
71
|
+
);
|
|
72
|
+
log.info(`Zip bundled at "${pathToZip}"`);
|
|
73
|
+
|
|
74
|
+
// Now just zip the .app and place it in the root directory
|
|
75
|
+
// This zip file will be published to NPM
|
|
76
|
+
const wdaAppBundle = 'WebDriverAgentRunner-Runner.app';
|
|
77
|
+
const appBundlePath = path.join(uncompressedDir, 'DerivedData', 'WebDriverAgent',
|
|
78
|
+
'Build', 'Products', 'Debug-iphonesimulator', wdaAppBundle);
|
|
79
|
+
const appBundleZipPath = path.join(rootDir, `${wdaAppBundle}.zip`);
|
|
80
|
+
await fs.rimraf(appBundleZipPath);
|
|
81
|
+
log.info(`Created './${wdaAppBundle}.zip'`);
|
|
82
|
+
await zip.toArchive(appBundleZipPath, {cwd: appBundlePath});
|
|
83
|
+
log.info(`Zip bundled at "${appBundleZipPath}"`);
|
|
84
|
+
// Clean up the uncompressed directory
|
|
85
|
+
await fs.rimraf(uncompressedDir);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (require.main === module) {
|
|
89
|
+
asyncify(buildWebDriverAgent);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
module.exports = buildWebDriverAgent;
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-webdriveragent",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.2",
|
|
4
4
|
"description": "Package bundling WebDriverAgent",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"lint:fix": "gulp eslint --fix",
|
|
16
16
|
"precommit-msg": "echo 'Pre-commit checks...' && exit 0",
|
|
17
17
|
"precommit-test": "gulp lint",
|
|
18
|
-
"bundle": "node ./
|
|
18
|
+
"bundle": "node ./Scripts/build-webdriveragent.js",
|
|
19
19
|
"fetch-prebuilt-wda": "node ./Scripts/fetch-prebuilt-wda"
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"build/lib",
|
|
79
79
|
"Scripts/build.sh",
|
|
80
80
|
"Scripts/fetch-prebuilt-wda.js",
|
|
81
|
+
"Scripts/build-webdriveragent.js",
|
|
81
82
|
"Cartfile",
|
|
82
83
|
"Cartfile.resolved",
|
|
83
84
|
"Configurations",
|