Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eas-cli] send a path to custom build config to EAS Build server with posix separator for Windows #2285

Conversation

szdziedzic
Copy link
Member

@szdziedzic szdziedzic commented Mar 15, 2024

Why

Our server expects to get this path with a POSIX separator

Closes #2160

How

If a build is not local use the posix separator for Windows.

Test Plan

Tests

Comment out process.platform === 'win32' and see if it works on my Mac machine

I don't have a Windows machine to test it

@szdziedzic
Copy link
Member Author

/changelog-entry bug-fix Use a custom build config path with POSIX separator when sending data to the EAS Build server

Copy link

github-actions bot commented Mar 15, 2024

Size Change: -760 B (0%)

Total Size: 51.3 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 51.3 MB -760 B (0%)

compressed-size-action

Copy link

codecov bot commented Mar 15, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 53.96%. Comparing base (33fb5fa) to head (bfff477).
Report is 3 commits behind head on main.

Files Patch % Lines
packages/eas-cli/src/build/android/prepareJob.ts 50.00% 1 Missing ⚠️
packages/eas-cli/src/build/ios/prepareJob.ts 50.00% 1 Missing ⚠️
packages/eas-cli/src/project/customBuildConfig.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2285      +/-   ##
==========================================
- Coverage   53.99%   53.96%   -0.02%     
==========================================
  Files         520      520              
  Lines       18981    18993      +12     
  Branches     3813     4010     +197     
==========================================
+ Hits        10247    10248       +1     
+ Misses       8713     8032     -681     
- Partials       21      713     +692     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ctx.localBuildOptions.localBuildMode !== LocalBuildMode.LOCAL_BUILD_PLUGIN &&
process.platform === 'win32'
) {
maybeCustomBuildConfigPath = path.posix.join(...maybeCustomBuildConfigPath.split(path.sep));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
maybeCustomBuildConfigPath = path.posix.join(...maybeCustomBuildConfigPath.split(path.sep));
maybeCustomBuildConfigPath = path.posix.normalize(maybeCustomBuildConfigPath);

would this have the same effect?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://nodejs.org/api/path.html#pathnormalizepath
nodejs/node#12298

Unfortunately, I don't think it does it 😢

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pity. I noticed it works the other way

> path.win32.normalize("d/b/a.yaml")
'd\\b\\a.yaml'

and I hoped it would go the other way too, but it doesn't.

> path.posix.normalize("d\\b\\a.yaml")
'd\\b\\a.yaml'

@@ -45,9 +46,16 @@ export async function prepareJobAsync(
}
}

const maybeCustomBuildConfigPath = buildProfile.config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the logic here is the same for ios and android maybe in getCustomBuildConfigPath?

Copy link
Contributor

@sjchmiela sjchmiela Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crossed my mind too, I figured we may want to keep getCustomBuildConfigPath local to current environment, e.g. for eas build --local. I guess prepareJob is the borderline between "we're running on this computer" and "sending this to the server".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you are right, we should keep this logic in a single place. Since getCustomBuildConfigPath can be also used in other context than sending the data to the EAS server I created a new function just for preparing this data for the Job object 👍

@@ -68,3 +69,21 @@ export async function validateCustomBuildConfigAsync({
export function getCustomBuildConfigPath(configFilename: string): string {
return path.join('.eas/build', configFilename);
}

export function getCustomBuildConfigPathForJob({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a separate function we could even do:

getCustomBuildConfigPathForJob {
  path.posix.join(...)
}

getCustomBuildConfigPath {
  path.join(...)
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right! thanks!

Copy link

✅ Thank you for adding the changelog entry!

@szdziedzic szdziedzic merged commit ab6483f into main Mar 18, 2024
9 checks passed
@szdziedzic szdziedzic deleted the @szdziedzic/send-path-to-custom-builds-config-file-with-posix-separator-for-windows branch March 18, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom EAS Build incorrectly evaluates path on Native Windows (WSL is fine)
3 participants