eas-cli 0.57.0 → 0.60.0

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.
Files changed (63) hide show
  1. package/README.md +84 -44
  2. package/build/build/android/build.js +17 -3
  3. package/build/build/android/graphql.js +2 -0
  4. package/build/build/android/prepareJob.js +5 -0
  5. package/build/build/android/syncProjectConfiguration.d.ts +3 -4
  6. package/build/build/android/syncProjectConfiguration.js +2 -3
  7. package/build/build/android/version.d.ts +11 -0
  8. package/build/build/android/version.js +71 -1
  9. package/build/build/build.js +1 -1
  10. package/build/build/context.d.ts +4 -0
  11. package/build/build/createContext.d.ts +2 -1
  12. package/build/build/createContext.js +7 -1
  13. package/build/build/ios/build.js +17 -1
  14. package/build/build/ios/graphql.js +2 -0
  15. package/build/build/ios/prepareJob.js +5 -0
  16. package/build/build/ios/syncProjectConfiguration.d.ts +3 -4
  17. package/build/build/ios/syncProjectConfiguration.js +2 -3
  18. package/build/build/ios/version.d.ts +13 -0
  19. package/build/build/ios/version.js +72 -1
  20. package/build/build/local.d.ts +2 -2
  21. package/build/build/local.js +7 -7
  22. package/build/build/metadata.js +18 -2
  23. package/build/build/runBuildAndSubmit.js +25 -3
  24. package/build/build/utils/printBuildInfo.d.ts +1 -1
  25. package/build/build/utils/printBuildInfo.js +7 -13
  26. package/build/commands/build/version/set.d.ts +0 -1
  27. package/build/commands/build/version/set.js +2 -3
  28. package/build/commands/build/version/sync.d.ts +0 -1
  29. package/build/commands/build/version/sync.js +2 -3
  30. package/build/commands/submit.js +4 -1
  31. package/build/commands/update/index.js +12 -2
  32. package/build/graphql/generated.d.ts +240 -4
  33. package/build/graphql/generated.js +2 -0
  34. package/build/graphql/mutations/PublishMutation.d.ts +2 -4
  35. package/build/graphql/queries/BuildQuery.d.ts +4 -1
  36. package/build/graphql/queries/BuildQuery.js +19 -0
  37. package/build/graphql/queries/PublishQuery.d.ts +2 -1
  38. package/build/graphql/queries/PublishQuery.js +16 -0
  39. package/build/graphql/types/Build.d.ts +1 -0
  40. package/build/graphql/types/Build.js +16 -1
  41. package/build/metadata/apple/config/reader.d.ts +3 -2
  42. package/build/metadata/apple/config/reader.js +22 -5
  43. package/build/metadata/apple/config/writer.d.ts +3 -2
  44. package/build/metadata/apple/config/writer.js +22 -6
  45. package/build/metadata/apple/tasks/app-version.d.ts +5 -1
  46. package/build/metadata/apple/tasks/app-version.js +109 -8
  47. package/build/metadata/apple/tasks/index.d.ts +6 -1
  48. package/build/metadata/apple/tasks/index.js +7 -2
  49. package/build/metadata/apple/types.d.ts +3 -7
  50. package/build/metadata/upload.js +6 -1
  51. package/build/project/projectUtils.d.ts +1 -0
  52. package/build/project/projectUtils.js +18 -1
  53. package/build/project/publish.d.ts +3 -1
  54. package/build/project/publish.js +17 -8
  55. package/build/project/remoteVersionSource.d.ts +5 -3
  56. package/build/project/remoteVersionSource.js +18 -9
  57. package/build/submit/submit.d.ts +2 -1
  58. package/build/submit/submit.js +3 -2
  59. package/build/vcs/clients/gitNoCommit.d.ts +1 -0
  60. package/build/vcs/clients/gitNoCommit.js +14 -0
  61. package/oclif.manifest.json +1 -1
  62. package/package.json +26 -25
  63. package/schema/metadata-0.json +38 -233
@@ -13,12 +13,14 @@ export declare type CommonContext<T extends Platform> = Omit<BuildContext<T>, 'a
13
13
  export interface AndroidBuildContext {
14
14
  applicationId: string;
15
15
  gradleContext?: GradleBuildContext;
16
+ versionCodeOverride?: string;
16
17
  }
17
18
  export interface IosBuildContext {
18
19
  bundleIdentifier: string;
19
20
  applicationTarget: Target;
20
21
  targets: Target[];
21
22
  xcodeBuildContext: XcodeBuildContext;
23
+ buildNumberOverride?: string;
22
24
  }
23
25
  export interface BuildContext<T extends Platform> {
24
26
  accountName: string;
@@ -31,6 +33,8 @@ export interface BuildContext<T extends Platform> {
31
33
  exp: ExpoConfig;
32
34
  localBuildOptions: LocalBuildOptions;
33
35
  nonInteractive: boolean;
36
+ noWait: boolean;
37
+ runFromCI: boolean;
34
38
  platform: T;
35
39
  projectDir: string;
36
40
  projectId: string;
@@ -3,13 +3,14 @@ import { BuildProfile, EasJson } from '@expo/eas-json';
3
3
  import { BuildResourceClass } from '../graphql/generated';
4
4
  import { BuildContext } from './context';
5
5
  import { LocalBuildOptions } from './local';
6
- export declare function createBuildContextAsync<T extends Platform>({ buildProfileName, buildProfile, easJsonCliConfig, clearCache, localBuildOptions, nonInteractive, platform, projectDir, resourceClass, message, }: {
6
+ export declare function createBuildContextAsync<T extends Platform>({ buildProfileName, buildProfile, easJsonCliConfig, clearCache, localBuildOptions, nonInteractive, noWait, platform, projectDir, resourceClass, message, }: {
7
7
  buildProfileName: string;
8
8
  buildProfile: BuildProfile<T>;
9
9
  easJsonCliConfig: EasJson['cli'];
10
10
  clearCache: boolean;
11
11
  localBuildOptions: LocalBuildOptions;
12
12
  nonInteractive: boolean;
13
+ noWait: boolean;
13
14
  platform: T;
14
15
  projectDir: string;
15
16
  resourceClass: BuildResourceClass;
@@ -4,6 +4,7 @@ exports.createBuildContextAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const eas_build_job_1 = require("@expo/eas-build-job");
6
6
  const json_file_1 = tslib_1.__importDefault(require("@expo/json-file"));
7
+ const getenv_1 = tslib_1.__importDefault(require("getenv"));
7
8
  const resolve_from_1 = tslib_1.__importDefault(require("resolve-from"));
8
9
  const uuid_1 = require("uuid");
9
10
  const events_1 = require("../analytics/events");
@@ -15,7 +16,7 @@ const Account_1 = require("../user/Account");
15
16
  const actions_1 = require("../user/actions");
16
17
  const build_1 = require("./android/build");
17
18
  const build_2 = require("./ios/build");
18
- async function createBuildContextAsync({ buildProfileName, buildProfile, easJsonCliConfig, clearCache = false, localBuildOptions, nonInteractive = false, platform, projectDir, resourceClass, message, }) {
19
+ async function createBuildContextAsync({ buildProfileName, buildProfile, easJsonCliConfig, clearCache = false, localBuildOptions, nonInteractive, noWait, platform, projectDir, resourceClass, message, }) {
19
20
  var _a;
20
21
  const exp = (0, expoConfig_1.getExpoConfig)(projectDir, { env: buildProfile.env });
21
22
  const user = await (0, actions_1.ensureLoggedInAsync)();
@@ -24,6 +25,7 @@ async function createBuildContextAsync({ buildProfileName, buildProfile, easJson
24
25
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp, { env: buildProfile.env });
25
26
  const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, platform);
26
27
  const accountId = (_a = (0, Account_1.findAccountByName)(user.accounts, accountName)) === null || _a === void 0 ? void 0 : _a.id;
28
+ const runFromCI = getenv_1.default.boolish('CI', false);
27
29
  const credentialsCtx = new context_1.CredentialsContext({
28
30
  exp,
29
31
  nonInteractive,
@@ -43,6 +45,8 @@ async function createBuildContextAsync({ buildProfileName, buildProfile, easJson
43
45
  project_id: projectId,
44
46
  project_type: workflow,
45
47
  ...devClientProperties,
48
+ no_wait: noWait,
49
+ run_from_ci: runFromCI,
46
50
  };
47
51
  events_1.Analytics.logEvent(events_1.BuildEvent.BUILD_COMMAND, trackingCtx);
48
52
  const commonContext = {
@@ -56,6 +60,7 @@ async function createBuildContextAsync({ buildProfileName, buildProfile, easJson
56
60
  exp,
57
61
  localBuildOptions,
58
62
  nonInteractive,
63
+ noWait,
59
64
  platform,
60
65
  projectDir,
61
66
  projectId,
@@ -64,6 +69,7 @@ async function createBuildContextAsync({ buildProfileName, buildProfile, easJson
64
69
  user,
65
70
  workflow,
66
71
  message,
72
+ runFromCI,
67
73
  };
68
74
  if (platform === eas_build_job_1.Platform.ANDROID) {
69
75
  const common = commonContext;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.prepareIosBuildAsync = exports.createIosContextAsync = void 0;
4
4
  const eas_build_job_1 = require("@expo/eas-build-job");
5
+ const eas_json_1 = require("@expo/eas-json");
5
6
  const BuildMutation_1 = require("../../graphql/mutations/BuildMutation");
6
7
  const bundleIdentifier_1 = require("../../project/ios/bundleIdentifier");
7
8
  const scheme_1 = require("../../project/ios/scheme");
@@ -13,7 +14,9 @@ const credentials_1 = require("./credentials");
13
14
  const graphql_2 = require("./graphql");
14
15
  const prepareJob_1 = require("./prepareJob");
15
16
  const syncProjectConfiguration_1 = require("./syncProjectConfiguration");
17
+ const version_1 = require("./version");
16
18
  async function createIosContextAsync(ctx) {
19
+ var _a;
17
20
  const { buildProfile } = ctx;
18
21
  if (ctx.workflow === eas_build_job_1.Workflow.MANAGED) {
19
22
  await (0, bundleIdentifier_1.ensureBundleIdentifierIsDefinedForManagedProjectAsync)(ctx.projectDir, ctx.exp);
@@ -32,11 +35,21 @@ async function createIosContextAsync(ctx) {
32
35
  env: buildProfile.env,
33
36
  });
34
37
  const applicationTarget = (0, target_1.findApplicationTarget)(targets);
38
+ const buildNumberOverride = ((_a = ctx.easJsonCliConfig) === null || _a === void 0 ? void 0 : _a.appVersionSource) === eas_json_1.AppVersionSource.REMOTE
39
+ ? await (0, version_1.resolveRemoteBuildNumberAsync)({
40
+ projectDir: ctx.projectDir,
41
+ projectId: ctx.projectId,
42
+ exp: ctx.exp,
43
+ applicationTarget,
44
+ buildProfile,
45
+ })
46
+ : undefined;
35
47
  return {
36
48
  bundleIdentifier: applicationTarget.bundleIdentifier,
37
49
  applicationTarget,
38
50
  targets,
39
51
  xcodeBuildContext,
52
+ buildNumberOverride,
40
53
  };
41
54
  }
42
55
  exports.createIosContextAsync = createIosContextAsync;
@@ -47,11 +60,14 @@ async function prepareIosBuildAsync(ctx) {
47
60
  return (0, credentials_1.ensureIosCredentialsAsync)(ctx, ctx.ios.targets);
48
61
  },
49
62
  syncProjectConfigurationAsync: async () => {
63
+ var _a;
50
64
  await (0, syncProjectConfiguration_1.syncProjectConfigurationAsync)({
51
65
  projectDir: ctx.projectDir,
52
66
  exp: ctx.exp,
53
- buildProfile: ctx.buildProfile,
54
67
  targets: ctx.ios.targets,
68
+ localAutoIncrement: ((_a = ctx.easJsonCliConfig) === null || _a === void 0 ? void 0 : _a.appVersionSource) === eas_json_1.AppVersionSource.REMOTE
69
+ ? false
70
+ : ctx.buildProfile.autoIncrement,
55
71
  });
56
72
  },
57
73
  prepareJobAsync: async (ctx, jobData) => {
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
6
6
  const graphql_1 = require("../graphql");
7
7
  function transformJob(job) {
8
+ var _a;
8
9
  return {
9
10
  type: (0, graphql_1.transformWorkflow)(job.type),
10
11
  projectArchive: (0, graphql_1.transformProjectArchive)(job.projectArchive),
@@ -14,6 +15,7 @@ function transformJob(job) {
14
15
  secrets: transformIosSecrets(job.secrets),
15
16
  builderEnvironment: job.builderEnvironment,
16
17
  cache: job.cache,
18
+ version: ((_a = job.version) === null || _a === void 0 ? void 0 : _a.buildNumber) ? { buildNumber: job.version.buildNumber } : undefined,
17
19
  scheme: job.scheme,
18
20
  buildConfiguration: job.buildConfiguration,
19
21
  artifactPath: job.artifactPath,
@@ -54,6 +54,11 @@ async function prepareJobAsync(ctx, jobData) {
54
54
  buildConfiguration: ctx.buildProfile.buildConfiguration,
55
55
  artifactPath: ctx.buildProfile.artifactPath,
56
56
  username,
57
+ ...(ctx.ios.buildNumberOverride && {
58
+ version: {
59
+ buildNumber: ctx.ios.buildNumberOverride,
60
+ },
61
+ }),
57
62
  experimental: {
58
63
  prebuildCommand: ctx.buildProfile.prebuildCommand,
59
64
  },
@@ -1,10 +1,9 @@
1
1
  import { ExpoConfig } from '@expo/config';
2
- import { Platform } from '@expo/eas-build-job';
3
- import { BuildProfile } from '@expo/eas-json';
2
+ import { IosVersionAutoIncrement } from '@expo/eas-json';
4
3
  import { Target } from '../../credentials/ios/types';
5
- export declare function syncProjectConfigurationAsync({ projectDir, exp, buildProfile, targets, }: {
4
+ export declare function syncProjectConfigurationAsync({ projectDir, exp, targets, localAutoIncrement, }: {
6
5
  projectDir: string;
7
6
  exp: ExpoConfig;
8
- buildProfile: BuildProfile<Platform.IOS>;
9
7
  targets: Target[];
8
+ localAutoIncrement?: IosVersionAutoIncrement;
10
9
  }): Promise<void>;
@@ -6,10 +6,9 @@ const projectUtils_1 = require("../../project/projectUtils");
6
6
  const workflow_1 = require("../../project/workflow");
7
7
  const UpdatesModule_1 = require("../../update/ios/UpdatesModule");
8
8
  const version_1 = require("./version");
9
- async function syncProjectConfigurationAsync({ projectDir, exp, buildProfile, targets, }) {
9
+ async function syncProjectConfigurationAsync({ projectDir, exp, targets, localAutoIncrement, }) {
10
10
  const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS);
11
- const { autoIncrement } = buildProfile;
12
- const versionBumpStrategy = resolveVersionBumpStrategy(autoIncrement !== null && autoIncrement !== void 0 ? autoIncrement : false);
11
+ const versionBumpStrategy = resolveVersionBumpStrategy(localAutoIncrement !== null && localAutoIncrement !== void 0 ? localAutoIncrement : false);
13
12
  if (workflow === eas_build_job_1.Workflow.GENERIC) {
14
13
  if ((0, projectUtils_1.isExpoUpdatesInstalled)(projectDir)) {
15
14
  await (0, UpdatesModule_1.syncUpdatesConfigurationAsync)(projectDir, exp);
@@ -1,4 +1,6 @@
1
1
  import { ExpoConfig } from '@expo/config';
2
+ import { Platform } from '@expo/eas-build-job';
3
+ import { BuildProfile } from '@expo/eas-json';
2
4
  import type { XCBuildConfiguration } from 'xcode';
3
5
  import { Target } from '../../credentials/ios/types';
4
6
  export declare enum BumpStrategy {
@@ -31,3 +33,14 @@ export declare function updateNativeVersionsAsync({ projectDir, version, buildNu
31
33
  targets: Target[];
32
34
  }): Promise<void>;
33
35
  export declare function evaluateTemplateString(s: string, buildSettings: XCBuildConfiguration['buildSettings']): string;
36
+ /**
37
+ * Returns buildNumber that will be used for the next build. If current build profile
38
+ * has an 'autoIncrement' option set, it increments the version on server.
39
+ */
40
+ export declare function resolveRemoteBuildNumberAsync({ projectDir, projectId, exp, applicationTarget, buildProfile, }: {
41
+ projectDir: string;
42
+ projectId: string;
43
+ exp: ExpoConfig;
44
+ applicationTarget: Target;
45
+ buildProfile: BuildProfile<Platform.IOS>;
46
+ }): Promise<string>;
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.evaluateTemplateString = exports.updateNativeVersionsAsync = exports.getInfoPlistPath = exports.maybeResolveVersionsAsync = exports.readBuildNumberAsync = exports.readShortVersionAsync = exports.bumpVersionInAppJsonAsync = exports.bumpVersionAsync = exports.BumpStrategy = void 0;
3
+ exports.resolveRemoteBuildNumberAsync = exports.evaluateTemplateString = exports.updateNativeVersionsAsync = exports.getInfoPlistPath = exports.maybeResolveVersionsAsync = exports.readBuildNumberAsync = exports.readShortVersionAsync = exports.bumpVersionInAppJsonAsync = exports.bumpVersionAsync = exports.BumpStrategy = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const config_plugins_1 = require("@expo/config-plugins");
6
6
  const eas_build_job_1 = require("@expo/eas-build-job");
7
7
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
8
  const path_1 = tslib_1.__importDefault(require("path"));
9
+ const generated_1 = require("../../graphql/generated");
10
+ const AppVersionMutation_1 = require("../../graphql/mutations/AppVersionMutation");
11
+ const AppVersionQuery_1 = require("../../graphql/queries/AppVersionQuery");
9
12
  const log_1 = tslib_1.__importDefault(require("../../log"));
13
+ const ora_1 = require("../../ora");
10
14
  const target_1 = require("../../project/ios/target");
11
15
  const versions_1 = require("../../project/ios/versions");
12
16
  const workflow_1 = require("../../project/workflow");
@@ -186,3 +190,70 @@ function evaluateTemplateString(s, buildSettings) {
186
190
  });
187
191
  }
188
192
  exports.evaluateTemplateString = evaluateTemplateString;
193
+ /**
194
+ * Returns buildNumber that will be used for the next build. If current build profile
195
+ * has an 'autoIncrement' option set, it increments the version on server.
196
+ */
197
+ async function resolveRemoteBuildNumberAsync({ projectDir, projectId, exp, applicationTarget, buildProfile, }) {
198
+ var _a, _b, _c, _d;
199
+ const remoteVersions = await AppVersionQuery_1.AppVersionQuery.latestVersionAsync(projectId, generated_1.AppPlatform.Ios, applicationTarget.bundleIdentifier);
200
+ const localBuildNumber = await readBuildNumberAsync(projectDir, exp, (_a = applicationTarget.buildSettings) !== null && _a !== void 0 ? _a : {});
201
+ const localShortVersion = await readShortVersionAsync(projectDir, exp, (_b = applicationTarget.buildSettings) !== null && _b !== void 0 ? _b : {});
202
+ let currentBuildVersion;
203
+ if (remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion) {
204
+ currentBuildVersion = remoteVersions.buildVersion;
205
+ }
206
+ else {
207
+ if (localBuildNumber) {
208
+ log_1.default.warn('No remote versions are configured for this project, buildNumber will be initialized based on the value from the local project.');
209
+ currentBuildVersion = localBuildNumber;
210
+ }
211
+ else {
212
+ log_1.default.error(`Remote versions are not configured and EAS CLI was not able to read the current version from your project. Use "eas build:version:set" to initialize remote versions.`);
213
+ throw new Error('Remote versions are not configured.');
214
+ }
215
+ }
216
+ if (!buildProfile.autoIncrement && (remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion)) {
217
+ return currentBuildVersion;
218
+ }
219
+ else if (!buildProfile.autoIncrement && !(remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion)) {
220
+ const spinner = (0, ora_1.ora)(`Initializing buildNumber with ${chalk_1.default.bold(currentBuildVersion)}.`).start();
221
+ try {
222
+ await AppVersionMutation_1.AppVersionMutation.createAppVersionAsync({
223
+ appId: projectId,
224
+ platform: generated_1.AppPlatform.Ios,
225
+ applicationIdentifier: applicationTarget.bundleIdentifier,
226
+ storeVersion: localShortVersion !== null && localShortVersion !== void 0 ? localShortVersion : '1.0.0',
227
+ buildVersion: currentBuildVersion,
228
+ runtimeVersion: (_c = config_plugins_1.Updates.getRuntimeVersionNullable(exp, eas_build_job_1.Platform.IOS)) !== null && _c !== void 0 ? _c : undefined,
229
+ });
230
+ spinner.succeed(`Initialized buildNumber with ${chalk_1.default.bold(currentBuildVersion)}.`);
231
+ }
232
+ catch (err) {
233
+ spinner.fail(`Failed to initialize buildNumber with ${chalk_1.default.bold(currentBuildVersion)}.`);
234
+ throw err;
235
+ }
236
+ return currentBuildVersion;
237
+ }
238
+ else {
239
+ const nextBuildVersion = (0, versions_1.getNextBuildNumber)(currentBuildVersion);
240
+ const spinner = (0, ora_1.ora)(`Incrementing buildNumber from ${chalk_1.default.bold(currentBuildVersion)} to ${chalk_1.default.bold(nextBuildVersion)}.`).start();
241
+ try {
242
+ await AppVersionMutation_1.AppVersionMutation.createAppVersionAsync({
243
+ appId: projectId,
244
+ platform: generated_1.AppPlatform.Ios,
245
+ applicationIdentifier: applicationTarget.bundleIdentifier,
246
+ storeVersion: localShortVersion !== null && localShortVersion !== void 0 ? localShortVersion : '1.0.0',
247
+ buildVersion: nextBuildVersion,
248
+ runtimeVersion: (_d = config_plugins_1.Updates.getRuntimeVersionNullable(exp, eas_build_job_1.Platform.IOS)) !== null && _d !== void 0 ? _d : undefined,
249
+ });
250
+ spinner.succeed(`Incremented buildNumber from ${chalk_1.default.bold(currentBuildVersion)} to ${chalk_1.default.bold(nextBuildVersion)}.`);
251
+ }
252
+ catch (err) {
253
+ spinner.fail(`Failed to increment buildNumber from ${chalk_1.default.bold(currentBuildVersion)} to ${chalk_1.default.bold(nextBuildVersion)}.`);
254
+ throw err;
255
+ }
256
+ return nextBuildVersion;
257
+ }
258
+ }
259
+ exports.resolveRemoteBuildNumberAsync = resolveRemoteBuildNumberAsync;
@@ -1,4 +1,4 @@
1
- import { Job } from '@expo/eas-build-job';
1
+ import { Job, Metadata } from '@expo/eas-build-job';
2
2
  export interface LocalBuildOptions {
3
3
  enable: boolean;
4
4
  skipCleanup?: boolean;
@@ -8,4 +8,4 @@ export interface LocalBuildOptions {
8
8
  workingdir?: string;
9
9
  verbose?: boolean;
10
10
  }
11
- export declare function runLocalBuildAsync(job: Job, options: LocalBuildOptions): Promise<void>;
11
+ export declare function runLocalBuildAsync(job: Job, metadata: Metadata, options: LocalBuildOptions): Promise<void>;
@@ -6,10 +6,10 @@ const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
6
6
  const semver_1 = tslib_1.__importDefault(require("semver"));
7
7
  const ora_1 = require("../ora");
8
8
  const PLUGIN_PACKAGE_NAME = 'eas-cli-local-build-plugin';
9
- const PLUGIN_PACKAGE_VERSION = '0.0.85';
10
- async function runLocalBuildAsync(job, options) {
9
+ const PLUGIN_PACKAGE_VERSION = '0.0.99';
10
+ async function runLocalBuildAsync(job, metadata, options) {
11
11
  var _a;
12
- const { command, args } = await getCommandAndArgsAsync(job);
12
+ const { command, args } = await getCommandAndArgsAsync(job, metadata);
13
13
  let spinner;
14
14
  if (!options.verbose) {
15
15
  spinner = (0, ora_1.ora)().start(options.skipNativeBuild ? 'Preparing project' : 'Building project');
@@ -44,16 +44,16 @@ async function runLocalBuildAsync(job, options) {
44
44
  }
45
45
  }
46
46
  exports.runLocalBuildAsync = runLocalBuildAsync;
47
- async function getCommandAndArgsAsync(job) {
48
- const jobBase64 = Buffer.from(JSON.stringify({ job })).toString('base64');
47
+ async function getCommandAndArgsAsync(job, metadata) {
48
+ const jobAndMetadataBase64 = Buffer.from(JSON.stringify({ job, metadata })).toString('base64');
49
49
  if (process.env.EAS_LOCAL_BUILD_PLUGIN_PATH) {
50
50
  return {
51
51
  command: process.env.EAS_LOCAL_BUILD_PLUGIN_PATH,
52
- args: [jobBase64],
52
+ args: [jobAndMetadataBase64],
53
53
  };
54
54
  }
55
55
  else {
56
- const args = [`${PLUGIN_PACKAGE_NAME}@${PLUGIN_PACKAGE_VERSION}`, jobBase64];
56
+ const args = [`${PLUGIN_PACKAGE_NAME}@${PLUGIN_PACKAGE_VERSION}`, jobAndMetadataBase64];
57
57
  if (await isAtLeastNpm7Async()) {
58
58
  // npx shipped with npm >= 7.0.0 requires the "-y" flag to run commands without
59
59
  // prompting the user to install a package that is used for the first time
@@ -44,6 +44,8 @@ async function collectMetadataAsync(ctx) {
44
44
  ...(ctx.platform === eas_build_job_1.Platform.IOS && {
45
45
  iosEnterpriseProvisioning: resolveIosEnterpriseProvisioning(ctx),
46
46
  }),
47
+ runWithNoWaitFlag: ctx.noWait,
48
+ runFromCI: ctx.runFromCI,
47
49
  };
48
50
  return (0, eas_build_job_1.sanitizeMetadata)(metadata);
49
51
  }
@@ -51,11 +53,25 @@ exports.collectMetadataAsync = collectMetadataAsync;
51
53
  async function maybeResolveVersionsAsync(ctx) {
52
54
  if (ctx.platform === eas_build_job_1.Platform.IOS) {
53
55
  const iosContext = ctx;
54
- return await (0, version_2.maybeResolveVersionsAsync)(ctx.projectDir, ctx.exp, iosContext.ios.targets);
56
+ const resolvedVersion = await (0, version_2.maybeResolveVersionsAsync)(ctx.projectDir, ctx.exp, iosContext.ios.targets);
57
+ if (iosContext.ios.buildNumberOverride) {
58
+ return {
59
+ ...resolvedVersion,
60
+ appBuildVersion: iosContext.ios.buildNumberOverride,
61
+ };
62
+ }
63
+ return resolvedVersion;
55
64
  }
56
65
  else if (ctx.platform === eas_build_job_1.Platform.ANDROID) {
57
66
  const androidCtx = ctx;
58
- return await (0, version_1.maybeResolveVersionsAsync)(ctx.projectDir, ctx.exp, androidCtx.buildProfile);
67
+ const resolvedVersion = await (0, version_1.maybeResolveVersionsAsync)(ctx.projectDir, ctx.exp, androidCtx.buildProfile);
68
+ if (androidCtx.android.versionCodeOverride) {
69
+ return {
70
+ ...resolvedVersion,
71
+ appBuildVersion: androidCtx.android.versionCodeOverride,
72
+ };
73
+ }
74
+ return resolvedVersion;
59
75
  }
60
76
  else {
61
77
  throw new Error(`Unsupported platform ${ctx.platform}`);
@@ -7,11 +7,14 @@ const eas_json_1 = require("@expo/eas-json");
7
7
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
8
  const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
9
9
  const generated_1 = require("../graphql/generated");
10
+ const BuildQuery_1 = require("../graphql/queries/BuildQuery");
10
11
  const AppPlatform_1 = require("../graphql/types/AppPlatform");
11
12
  const log_1 = tslib_1.__importDefault(require("../log"));
12
13
  const platform_1 = require("../platform");
13
14
  const expoSdk_1 = require("../project/expoSdk");
14
15
  const metroConfig_1 = require("../project/metroConfig");
16
+ const projectUtils_1 = require("../project/projectUtils");
17
+ const remoteVersionSource_1 = require("../project/remoteVersionSource");
15
18
  const context_1 = require("../submit/context");
16
19
  const submit_1 = require("../submit/submit");
17
20
  const urls_1 = require("../submit/utils/urls");
@@ -61,6 +64,9 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
61
64
  nonInteractive: flags.nonInteractive,
62
65
  buildProfiles,
63
66
  });
67
+ for (const buildProfile of buildProfiles) {
68
+ (0, remoteVersionSource_1.validateBuildProfileVersionSettings)(buildProfile, easJsonCliConfig);
69
+ }
64
70
  const startedBuilds = [];
65
71
  const buildCtxByPlatform = {};
66
72
  for (const buildProfile of buildProfiles) {
@@ -102,6 +108,7 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
102
108
  submitProfile,
103
109
  nonInteractive: flags.nonInteractive,
104
110
  });
111
+ startedBuild.build = await BuildQuery_1.BuildQuery.withSubmissionsByIdAsync(startedBuild.build.id);
105
112
  submissions.push(submission);
106
113
  }
107
114
  log_1.default.newLine();
@@ -119,14 +126,24 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
119
126
  buildIds: startedBuilds.map(({ build }) => build.id),
120
127
  accountName,
121
128
  });
122
- (0, printBuildInfo_1.printBuildResults)(builds, flags.json);
129
+ if (!flags.json) {
130
+ (0, printBuildInfo_1.printBuildResults)(builds);
131
+ }
123
132
  const haveAllBuildsFailedOrCanceled = builds.every(build => (build === null || build === void 0 ? void 0 : build.status) && [generated_1.BuildStatus.Errored, generated_1.BuildStatus.Canceled].includes(build === null || build === void 0 ? void 0 : build.status));
124
133
  if (haveAllBuildsFailedOrCanceled || !flags.autoSubmit) {
134
+ if (flags.json) {
135
+ (0, json_1.printJsonOnlyOutput)(builds);
136
+ }
125
137
  exitWithNonZeroCodeIfSomeBuildsFailed(builds);
126
138
  }
127
139
  else {
128
- // the following function also exits with non zero code if any of the submissions failed
129
- await (0, submit_1.waitToCompleteAsync)(submissions);
140
+ const completedSubmissions = await (0, submit_1.waitToCompleteAsync)(submissions);
141
+ if (flags.json) {
142
+ (0, json_1.printJsonOnlyOutput)(await Promise.all(builds
143
+ .filter((i) => !!i)
144
+ .map(build => BuildQuery_1.BuildQuery.withSubmissionsByIdAsync(build.id))));
145
+ }
146
+ (0, submit_1.exitWithNonZeroCodeIfSomeSubmissionsDidntFinish)(completedSubmissions);
130
147
  }
131
148
  }
132
149
  exports.runBuildAndSubmitAsync = runBuildAndSubmitAsync;
@@ -137,6 +154,7 @@ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildP
137
154
  clearCache: flags.clearCache,
138
155
  buildProfile: buildProfile.profile,
139
156
  nonInteractive: flags.nonInteractive,
157
+ noWait: !flags.wait,
140
158
  platform: buildProfile.platform,
141
159
  projectDir,
142
160
  localBuildOptions: flags.localBuildOptions,
@@ -148,6 +166,10 @@ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildP
148
166
  const appPlatform = (0, AppPlatform_1.toAppPlatform)(buildProfile.platform);
149
167
  log_1.default.log(`${platform_1.appPlatformEmojis[appPlatform]} ${chalk_1.default.bold(`${platform_1.appPlatformDisplayNames[appPlatform]} build`)}`);
150
168
  }
169
+ await (0, projectUtils_1.validateAppVersionRuntimePolicySupportAsync)(buildCtx.projectDir, buildCtx.exp);
170
+ if ((easJsonCliConfig === null || easJsonCliConfig === void 0 ? void 0 : easJsonCliConfig.appVersionSource) === eas_json_1.AppVersionSource.REMOTE) {
171
+ (0, remoteVersionSource_1.validateAppConfigForRemoteVersionSource)(buildCtx.exp, buildProfile.platform);
172
+ }
151
173
  if (buildCtx.workflow === eas_build_job_1.Workflow.MANAGED) {
152
174
  if (!sdkVersionChecked) {
153
175
  await (0, expoSdk_1.checkExpoSdkIsSupportedAsync)(buildCtx);
@@ -1,5 +1,5 @@
1
1
  import { BuildError, BuildFragment, EasBuildDeprecationInfo } from '../../graphql/generated';
2
2
  export declare function printLogsUrls(builds: BuildFragment[]): void;
3
- export declare function printBuildResults(builds: (BuildFragment | null)[], json: boolean): void;
3
+ export declare function printBuildResults(builds: (BuildFragment | null)[]): void;
4
4
  export declare function printDeprecationWarnings(deprecationInfo?: EasBuildDeprecationInfo | null): void;
5
5
  export declare function printUserError(error: BuildError): void;
@@ -9,7 +9,6 @@ const qrcode_terminal_1 = tslib_1.__importDefault(require("qrcode-terminal"));
9
9
  const generated_1 = require("../../graphql/generated");
10
10
  const log_1 = tslib_1.__importStar(require("../../log"));
11
11
  const platform_1 = require("../../platform");
12
- const json_1 = require("../../utils/json");
13
12
  const url_1 = require("./url");
14
13
  function printLogsUrls(builds) {
15
14
  if (builds.length === 1) {
@@ -23,20 +22,15 @@ function printLogsUrls(builds) {
23
22
  }
24
23
  }
25
24
  exports.printLogsUrls = printLogsUrls;
26
- function printBuildResults(builds, json) {
27
- if (json) {
28
- (0, json_1.printJsonOnlyOutput)(builds);
25
+ function printBuildResults(builds) {
26
+ log_1.default.newLine();
27
+ if (builds.length === 1) {
28
+ const [build] = builds;
29
+ (0, assert_1.default)(build, 'Build should be defined');
30
+ printBuildResult(build);
29
31
  }
30
32
  else {
31
- log_1.default.newLine();
32
- if (builds.length === 1) {
33
- const [build] = builds;
34
- (0, assert_1.default)(build, 'Build should be defined');
35
- printBuildResult(build);
36
- }
37
- else {
38
- builds.filter(i => i).forEach(build => printBuildResult(build));
39
- }
33
+ builds.filter(i => i).forEach(build => printBuildResult(build));
40
34
  }
41
35
  }
42
36
  exports.printBuildResults = printBuildResults;
@@ -1,7 +1,6 @@
1
1
  import EasCommand from '../../../commandUtils/EasCommand';
2
2
  export default class BuildVersionSetView extends EasCommand {
3
3
  static description: string;
4
- static hidden: boolean;
5
4
  static flags: {
6
5
  platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
6
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
@@ -26,12 +26,12 @@ class BuildVersionSetView extends EasCommand_1.default {
26
26
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
27
27
  const platform = await (0, platform_1.selectPlatformAsync)(flags.platform);
28
28
  const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
29
- await (0, remoteVersionSource_1.ensureRemoteVersionPolicyAsync)(projectDir, easJsonReader);
29
+ await (0, remoteVersionSource_1.ensureVersionSourceIsRemoteAsync)(projectDir, easJsonReader);
30
30
  const profile = await easJsonReader.getBuildProfileAsync(platform, (_a = flags.profile) !== null && _a !== void 0 ? _a : undefined);
31
31
  const exp = (0, expoConfig_1.getExpoConfig)(projectDir, { env: profile.env });
32
32
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
33
33
  const projectFullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
34
- await (0, remoteVersionSource_1.validateAppConfigForRemoteVersionPolicyAsync)(exp);
34
+ (0, remoteVersionSource_1.validateAppConfigForRemoteVersionSource)(exp, platform);
35
35
  const applicationIdentifier = await (0, applicationIdentifier_1.getApplicationIdentifierAsync)(projectDir, exp, profile, platform);
36
36
  const remoteVersions = await AppVersionQuery_1.AppVersionQuery.latestVersionAsync(projectId, (0, AppPlatform_1.toAppPlatform)(platform), applicationIdentifier);
37
37
  const currentStateMessage = (remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion)
@@ -61,7 +61,6 @@ class BuildVersionSetView extends EasCommand_1.default {
61
61
  }
62
62
  exports.default = BuildVersionSetView;
63
63
  BuildVersionSetView.description = 'Update version of an app.';
64
- BuildVersionSetView.hidden = true;
65
64
  BuildVersionSetView.flags = {
66
65
  platform: core_1.Flags.enum({
67
66
  char: 'p',
@@ -1,7 +1,6 @@
1
1
  import EasCommand from '../../../commandUtils/EasCommand';
2
2
  export default class BuildVersionSyncView extends EasCommand {
3
3
  static description: string;
4
- static hidden: boolean;
5
4
  static flags: {
6
5
  platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
6
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
@@ -30,7 +30,7 @@ class BuildVersionSyncView extends EasCommand_1.default {
30
30
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
31
31
  const requestedPlatform = await (0, platform_1.selectRequestedPlatformAsync)(flags.platform);
32
32
  const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
33
- await (0, remoteVersionSource_1.ensureRemoteVersionPolicyAsync)(projectDir, easJsonReader);
33
+ await (0, remoteVersionSource_1.ensureVersionSourceIsRemoteAsync)(projectDir, easJsonReader);
34
34
  const platforms = (0, platform_1.toPlatforms)(requestedPlatform);
35
35
  const buildProfiles = await (0, profiles_1.getProfilesAsync)({
36
36
  type: 'build',
@@ -41,7 +41,7 @@ class BuildVersionSyncView extends EasCommand_1.default {
41
41
  for (const profileInfo of buildProfiles) {
42
42
  const exp = (0, expoConfig_1.getExpoConfig)(projectDir, { env: profileInfo.profile.env });
43
43
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
44
- await (0, remoteVersionSource_1.validateAppConfigForRemoteVersionPolicyAsync)(exp);
44
+ (0, remoteVersionSource_1.validateAppConfigForRemoteVersionSource)(exp, profileInfo.platform);
45
45
  const platformDisplayName = platform_1.appPlatformDisplayNames[(0, AppPlatform_1.toAppPlatform)(profileInfo.platform)];
46
46
  const applicationIdentifier = await (0, applicationIdentifier_1.getApplicationIdentifierAsync)(projectDir, exp, profileInfo.profile, profileInfo.platform);
47
47
  const remoteVersions = await AppVersionQuery_1.AppVersionQuery.latestVersionAsync(projectId, (0, AppPlatform_1.toAppPlatform)(profileInfo.platform), applicationIdentifier);
@@ -111,7 +111,6 @@ class BuildVersionSyncView extends EasCommand_1.default {
111
111
  }
112
112
  exports.default = BuildVersionSyncView;
113
113
  BuildVersionSyncView.description = 'Update a version in native code with a value stored on EAS servers';
114
- BuildVersionSyncView.hidden = true;
115
114
  BuildVersionSyncView.flags = {
116
115
  platform: core_1.Flags.enum({
117
116
  char: 'p',
@@ -49,7 +49,10 @@ class Submit extends EasCommand_1.default {
49
49
  log_1.default.newLine();
50
50
  (0, urls_1.printSubmissionDetailsUrls)(submissions);
51
51
  if (flags.wait) {
52
- await (0, submit_1.waitToCompleteAsync)(submissions, { verbose: flags.verbose });
52
+ const completedSubmissions = await (0, submit_1.waitToCompleteAsync)(submissions, {
53
+ verbose: flags.verbose,
54
+ });
55
+ (0, submit_1.exitWithNonZeroCodeIfSomeSubmissionsDidntFinish)(completedSubmissions);
53
56
  }
54
57
  }
55
58
  async sanitizeFlagsAsync(flags) {