From 373d2af32a76f336713cba121c34235f7a80ee59 Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Fri, 15 Mar 2024 10:45:34 +0100 Subject: [PATCH 1/6] [eas-cli] send a path to custom build config to EAS Build server with posix separator for Windows --- packages/eas-cli/src/build/android/prepareJob.ts | 9 ++++++++- packages/eas-cli/src/build/ios/prepareJob.ts | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/eas-cli/src/build/android/prepareJob.ts b/packages/eas-cli/src/build/android/prepareJob.ts index 01600acb81..dcc4479130 100644 --- a/packages/eas-cli/src/build/android/prepareJob.ts +++ b/packages/eas-cli/src/build/android/prepareJob.ts @@ -15,6 +15,7 @@ import { AndroidCredentials } from '../../credentials/android/AndroidCredentials import { getCustomBuildConfigPath } from '../../project/customBuildConfig'; import { getUsername } from '../../project/projectUtils'; import { BuildContext } from '../context'; +import { LocalBuildMode } from '../local'; interface JobData { projectArchive: ArchiveSource; @@ -53,9 +54,15 @@ export async function prepareJobAsync( buildType = Android.BuildType.APK; } - const maybeCustomBuildConfigPath = buildProfile.config + let maybeCustomBuildConfigPath = buildProfile.config ? getCustomBuildConfigPath(buildProfile.config) : undefined; + if ( + maybeCustomBuildConfigPath && + ctx.localBuildOptions.localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN + ) { + maybeCustomBuildConfigPath = path.posix.join(...maybeCustomBuildConfigPath.split(path.sep)); + } const job: Android.Job = { type: ctx.workflow, diff --git a/packages/eas-cli/src/build/ios/prepareJob.ts b/packages/eas-cli/src/build/ios/prepareJob.ts index 921bf8fec4..932fa4ad84 100644 --- a/packages/eas-cli/src/build/ios/prepareJob.ts +++ b/packages/eas-cli/src/build/ios/prepareJob.ts @@ -17,6 +17,7 @@ import { IosJobSecretsInput } from '../../graphql/generated'; import { getCustomBuildConfigPath } from '../../project/customBuildConfig'; import { getUsername } from '../../project/projectUtils'; import { BuildContext } from '../context'; +import { LocalBuildMode } from '../local'; interface JobData { projectArchive: ArchiveSource; @@ -45,9 +46,15 @@ export async function prepareJobAsync( } } - const maybeCustomBuildConfigPath = buildProfile.config + let maybeCustomBuildConfigPath = buildProfile.config ? getCustomBuildConfigPath(buildProfile.config) : undefined; + if ( + maybeCustomBuildConfigPath && + ctx.localBuildOptions.localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN + ) { + maybeCustomBuildConfigPath = path.posix.join(...maybeCustomBuildConfigPath.split(path.sep)); + } const job: Ios.Job = { type: ctx.workflow, From 8054712eb9cfdf43f52f22c19fcd731c4a932078 Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Fri, 15 Mar 2024 10:47:24 +0100 Subject: [PATCH 2/6] add process.platform to if statement --- packages/eas-cli/src/build/android/prepareJob.ts | 3 ++- packages/eas-cli/src/build/ios/prepareJob.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/eas-cli/src/build/android/prepareJob.ts b/packages/eas-cli/src/build/android/prepareJob.ts index dcc4479130..5b12003b57 100644 --- a/packages/eas-cli/src/build/android/prepareJob.ts +++ b/packages/eas-cli/src/build/android/prepareJob.ts @@ -59,7 +59,8 @@ export async function prepareJobAsync( : undefined; if ( maybeCustomBuildConfigPath && - ctx.localBuildOptions.localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN + ctx.localBuildOptions.localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN && + process.platform === 'win32' ) { maybeCustomBuildConfigPath = path.posix.join(...maybeCustomBuildConfigPath.split(path.sep)); } diff --git a/packages/eas-cli/src/build/ios/prepareJob.ts b/packages/eas-cli/src/build/ios/prepareJob.ts index 932fa4ad84..8718aa8cc4 100644 --- a/packages/eas-cli/src/build/ios/prepareJob.ts +++ b/packages/eas-cli/src/build/ios/prepareJob.ts @@ -51,7 +51,8 @@ export async function prepareJobAsync( : undefined; if ( maybeCustomBuildConfigPath && - ctx.localBuildOptions.localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN + ctx.localBuildOptions.localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN && + process.platform === 'win32' ) { maybeCustomBuildConfigPath = path.posix.join(...maybeCustomBuildConfigPath.split(path.sep)); } From 0ef7addfa33b79e770048d09c96c8b198bbabcca Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Fri, 15 Mar 2024 09:51:17 +0000 Subject: [PATCH 3/6] update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30eab9aa75..4ed4112bef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ This is the log of notable changes to EAS CLI and related packages. ### ๐Ÿ› Bug fixes +- Use a custom build config path with POSIX separator when sending data to the EAS Build server. ([#2285](https://github.com/expo/eas-cli/pull/2285) by [@szdziedzic](https://github.com/szdziedzic)) + ### ๐Ÿงน Chores - Upgrade [`eas-build`](https://github.com/expo/eas-build) dependencies. ([#2277](https://github.com/expo/eas-cli/pull/2277) by [@expo-bot](https://github.com/expo-bot)) From 1e0fc1c3341fdec06addbf2fe69b12afc51b287c Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Mon, 18 Mar 2024 16:46:03 +0100 Subject: [PATCH 4/6] apply suggestions from cr --- .../eas-cli/src/build/android/prepareJob.ts | 17 ++++++----------- packages/eas-cli/src/build/ios/prepareJob.ts | 17 ++++++----------- .../eas-cli/src/project/customBuildConfig.ts | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/packages/eas-cli/src/build/android/prepareJob.ts b/packages/eas-cli/src/build/android/prepareJob.ts index 5b12003b57..c0f3338e98 100644 --- a/packages/eas-cli/src/build/android/prepareJob.ts +++ b/packages/eas-cli/src/build/android/prepareJob.ts @@ -12,10 +12,9 @@ import path from 'path'; import slash from 'slash'; import { AndroidCredentials } from '../../credentials/android/AndroidCredentialsProvider'; -import { getCustomBuildConfigPath } from '../../project/customBuildConfig'; +import { getCustomBuildConfigPathForJob } from '../../project/customBuildConfig'; import { getUsername } from '../../project/projectUtils'; import { BuildContext } from '../context'; -import { LocalBuildMode } from '../local'; interface JobData { projectArchive: ArchiveSource; @@ -54,16 +53,12 @@ export async function prepareJobAsync( buildType = Android.BuildType.APK; } - let maybeCustomBuildConfigPath = buildProfile.config - ? getCustomBuildConfigPath(buildProfile.config) + const maybeCustomBuildConfigPath = buildProfile.config + ? getCustomBuildConfigPathForJob({ + configFilename: buildProfile.config, + localBuildMode: ctx.localBuildOptions.localBuildMode, + }) : undefined; - if ( - maybeCustomBuildConfigPath && - ctx.localBuildOptions.localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN && - process.platform === 'win32' - ) { - maybeCustomBuildConfigPath = path.posix.join(...maybeCustomBuildConfigPath.split(path.sep)); - } const job: Android.Job = { type: ctx.workflow, diff --git a/packages/eas-cli/src/build/ios/prepareJob.ts b/packages/eas-cli/src/build/ios/prepareJob.ts index 8718aa8cc4..8855b63e50 100644 --- a/packages/eas-cli/src/build/ios/prepareJob.ts +++ b/packages/eas-cli/src/build/ios/prepareJob.ts @@ -14,10 +14,9 @@ import slash from 'slash'; import { IosCredentials, TargetCredentials } from '../../credentials/ios/types'; import { IosJobSecretsInput } from '../../graphql/generated'; -import { getCustomBuildConfigPath } from '../../project/customBuildConfig'; +import { getCustomBuildConfigPathForJob } from '../../project/customBuildConfig'; import { getUsername } from '../../project/projectUtils'; import { BuildContext } from '../context'; -import { LocalBuildMode } from '../local'; interface JobData { projectArchive: ArchiveSource; @@ -46,16 +45,12 @@ export async function prepareJobAsync( } } - let maybeCustomBuildConfigPath = buildProfile.config - ? getCustomBuildConfigPath(buildProfile.config) + const maybeCustomBuildConfigPath = buildProfile.config + ? getCustomBuildConfigPathForJob({ + configFilename: buildProfile.config, + localBuildMode: ctx.localBuildOptions.localBuildMode, + }) : undefined; - if ( - maybeCustomBuildConfigPath && - ctx.localBuildOptions.localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN && - process.platform === 'win32' - ) { - maybeCustomBuildConfigPath = path.posix.join(...maybeCustomBuildConfigPath.split(path.sep)); - } const job: Ios.Job = { type: ctx.workflow, diff --git a/packages/eas-cli/src/project/customBuildConfig.ts b/packages/eas-cli/src/project/customBuildConfig.ts index 9619e2a7ff..55b8eccb0c 100644 --- a/packages/eas-cli/src/project/customBuildConfig.ts +++ b/packages/eas-cli/src/project/customBuildConfig.ts @@ -5,6 +5,7 @@ import chalk from 'chalk'; import fs from 'fs-extra'; import path from 'path'; +import { LocalBuildMode } from '../build/local'; import { Client } from '../vcs/vcs'; export interface CustomBuildConfigMetadata { @@ -68,3 +69,21 @@ export async function validateCustomBuildConfigAsync({ export function getCustomBuildConfigPath(configFilename: string): string { return path.join('.eas/build', configFilename); } + +export function getCustomBuildConfigPathForJob({ + configFilename, + localBuildMode, +}: { + configFilename: string; + localBuildMode?: LocalBuildMode; +}): string { + let customBuildConfigPath = getCustomBuildConfigPath(configFilename); + if ( + customBuildConfigPath && + localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN && + process.platform === 'win32' + ) { + customBuildConfigPath = path.posix.join(...customBuildConfigPath.split(path.sep)); + } + return customBuildConfigPath; +} From 565f39fbfca0fe043c7a55ca2d0f44ae7ef2a735 Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Mon, 18 Mar 2024 16:47:50 +0100 Subject: [PATCH 5/6] remove unnecessary check --- packages/eas-cli/src/project/customBuildConfig.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/eas-cli/src/project/customBuildConfig.ts b/packages/eas-cli/src/project/customBuildConfig.ts index 55b8eccb0c..68742b6114 100644 --- a/packages/eas-cli/src/project/customBuildConfig.ts +++ b/packages/eas-cli/src/project/customBuildConfig.ts @@ -78,11 +78,7 @@ export function getCustomBuildConfigPathForJob({ localBuildMode?: LocalBuildMode; }): string { let customBuildConfigPath = getCustomBuildConfigPath(configFilename); - if ( - customBuildConfigPath && - localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN && - process.platform === 'win32' - ) { + if (localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN && process.platform === 'win32') { customBuildConfigPath = path.posix.join(...customBuildConfigPath.split(path.sep)); } return customBuildConfigPath; From bfff47710abb409f555411e4ae2db953c990cdeb Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Mon, 18 Mar 2024 16:52:19 +0100 Subject: [PATCH 6/6] apply suggested change --- packages/eas-cli/src/build/android/prepareJob.ts | 5 +---- packages/eas-cli/src/build/ios/prepareJob.ts | 5 +---- packages/eas-cli/src/project/customBuildConfig.ts | 15 ++------------- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/packages/eas-cli/src/build/android/prepareJob.ts b/packages/eas-cli/src/build/android/prepareJob.ts index c0f3338e98..26d5b5a4c5 100644 --- a/packages/eas-cli/src/build/android/prepareJob.ts +++ b/packages/eas-cli/src/build/android/prepareJob.ts @@ -54,10 +54,7 @@ export async function prepareJobAsync( } const maybeCustomBuildConfigPath = buildProfile.config - ? getCustomBuildConfigPathForJob({ - configFilename: buildProfile.config, - localBuildMode: ctx.localBuildOptions.localBuildMode, - }) + ? getCustomBuildConfigPathForJob(buildProfile.config) : undefined; const job: Android.Job = { diff --git a/packages/eas-cli/src/build/ios/prepareJob.ts b/packages/eas-cli/src/build/ios/prepareJob.ts index 8855b63e50..a376cc1b4a 100644 --- a/packages/eas-cli/src/build/ios/prepareJob.ts +++ b/packages/eas-cli/src/build/ios/prepareJob.ts @@ -46,10 +46,7 @@ export async function prepareJobAsync( } const maybeCustomBuildConfigPath = buildProfile.config - ? getCustomBuildConfigPathForJob({ - configFilename: buildProfile.config, - localBuildMode: ctx.localBuildOptions.localBuildMode, - }) + ? getCustomBuildConfigPathForJob(buildProfile.config) : undefined; const job: Ios.Job = { diff --git a/packages/eas-cli/src/project/customBuildConfig.ts b/packages/eas-cli/src/project/customBuildConfig.ts index 68742b6114..bf53051872 100644 --- a/packages/eas-cli/src/project/customBuildConfig.ts +++ b/packages/eas-cli/src/project/customBuildConfig.ts @@ -5,7 +5,6 @@ import chalk from 'chalk'; import fs from 'fs-extra'; import path from 'path'; -import { LocalBuildMode } from '../build/local'; import { Client } from '../vcs/vcs'; export interface CustomBuildConfigMetadata { @@ -70,16 +69,6 @@ export function getCustomBuildConfigPath(configFilename: string): string { return path.join('.eas/build', configFilename); } -export function getCustomBuildConfigPathForJob({ - configFilename, - localBuildMode, -}: { - configFilename: string; - localBuildMode?: LocalBuildMode; -}): string { - let customBuildConfigPath = getCustomBuildConfigPath(configFilename); - if (localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN && process.platform === 'win32') { - customBuildConfigPath = path.posix.join(...customBuildConfigPath.split(path.sep)); - } - return customBuildConfigPath; +export function getCustomBuildConfigPathForJob(configFilename: string): string { + return path.posix.join('.eas/build', configFilename); }