check-dependencies.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { fs } from '@appium/support';
  2. import _ from 'lodash';
  3. import { exec } from 'teen_process';
  4. import path from 'path';
  5. import XcodeBuild from './xcodebuild';
  6. import {
  7. WDA_SCHEME, SDK_SIMULATOR, WDA_RUNNER_APP
  8. } from './constants';
  9. import { BOOTSTRAP_PATH } from './utils';
  10. import log from './logger';
  11. async function buildWDASim () {
  12. const args = [
  13. '-project', path.join(BOOTSTRAP_PATH, 'WebDriverAgent.xcodeproj'),
  14. '-scheme', WDA_SCHEME,
  15. '-sdk', SDK_SIMULATOR,
  16. 'CODE_SIGN_IDENTITY=""',
  17. 'CODE_SIGNING_REQUIRED="NO"',
  18. 'GCC_TREAT_WARNINGS_AS_ERRORS=0',
  19. ];
  20. await exec('xcodebuild', args);
  21. }
  22. // eslint-disable-next-line require-await
  23. async function checkForDependencies () {
  24. log.debug('Dependencies are up to date');
  25. return false;
  26. }
  27. async function bundleWDASim (xcodebuild) {
  28. if (xcodebuild && !_.isFunction(xcodebuild.retrieveDerivedDataPath)) {
  29. xcodebuild = new XcodeBuild('', {});
  30. }
  31. const derivedDataPath = await xcodebuild.retrieveDerivedDataPath();
  32. const wdaBundlePath = path.join(derivedDataPath, 'Build', 'Products', 'Debug-iphonesimulator', WDA_RUNNER_APP);
  33. if (await fs.exists(wdaBundlePath)) {
  34. return wdaBundlePath;
  35. }
  36. await buildWDASim();
  37. return wdaBundlePath;
  38. }
  39. export { checkForDependencies, bundleWDASim };