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

Add support for Apple M1 architecture (chromedriver) #193

Merged
merged 2 commits into from
Jan 12, 2021

Conversation

MichaelHoste
Copy link
Contributor

@MichaelHoste MichaelHoste commented Jan 7, 2021

Fixes #191

I hope it's the correct approach.

It's still compatible with Chromedriver versions lower than 87.0.4280.88 but it will then fallback to the Intel version of Chrome.

@MichaelHoste MichaelHoste changed the title Add support for Apple M1 architecture (chromedriver). Fixes #191 Add support for Apple M1 architecture (chromedriver). Jan 7, 2021
@MichaelHoste MichaelHoste changed the title Add support for Apple M1 architecture (chromedriver). Add support for Apple M1 architecture (chromedriver) Jan 7, 2021
Copy link
Collaborator

@kapoorlakshya kapoorlakshya left a comment

Choose a reason for hiding this comment

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

@MichaelHoste Thank you very much for the PR! Left two comments, but the overall approach looks good to me.

lib/webdrivers/chromedriver.rb Show resolved Hide resolved
@@ -96,7 +104,9 @@ def download_url
normalize_version(required_version)
end

file_name = System.platform == 'win' || System.wsl? ? 'win32' : "#{System.platform}64"
archi = apple_m1_cpu? && apple_m1_compatible?(version) ? '_m1' : ''
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we please rename archi to apple_arch or mac_arch since it's specific to macOS/apple? Another option is to pull out the filename logic into a separate method to keep the complexity low.

@MichaelHoste
Copy link
Contributor Author

I did what you suggested, it made sense!

I first tried to create a separate method for the storage file name, but since we need to pass version with it, it was becoming too verbose and confusing for something that was already quite easy to read and understand. I'm not sure it was better.

@kapoorlakshya
Copy link
Collaborator

@MichaelHoste Thank you for making the changes. Looks good!

@kapoorlakshya kapoorlakshya merged commit 591cb8f into titusfortner:master Jan 12, 2021
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.

Google Chrome on Apple M1 architecture
2 participants