Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Fix missing and hardcoded flags #596

Merged
merged 3 commits into from
Jul 22, 2016
Merged

Fix missing and hardcoded flags #596

merged 3 commits into from
Jul 22, 2016

Conversation

as-cii
Copy link
Contributor

@as-cii as-cii commented Jul 22, 2016

This pull-request fixes a problem when installing dependencies via apm that prevents the runtime from being recognized, causing packages such as nodegit to fail the build. In particular, we are adding the --runtime=electron flag to every npm command that interfaces with modules installation and their subsequent compilation.

Please, note that this is the approach that electron-rebuild uses too.

While in the process of adding such flag, we spotted a couple of places in the dedupe command where the target architecture of native modules was being hardcoded; this was probably not an issue, but it feels reasonable to use config.getElectronArch() as we do elsewhere.

@atom/core: I'd ❤️ to have some more 👀 on this, so that we can 🚢 it before getting the new apm version into beta.

@50Wliu
Copy link
Contributor

50Wliu commented Jul 22, 2016

Supersedes #536.

@as-cii as-cii merged commit 3b36e18 into master Jul 22, 2016
@as-cii as-cii deleted the as-fix-missing-flags branch July 22, 2016 16:02
@50Wliu 50Wliu mentioned this pull request Jul 22, 2016
@@ -71,6 +72,7 @@ class Dedupe extends Command

forkDedupeCommand: (options, callback) ->
dedupeArgs = ['--globalconfig', config.getGlobalConfigPath(), '--userconfig', config.getUserConfigPath(), 'dedupe']
dedupeArgs.push("--runtime=electron")

Choose a reason for hiding this comment

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

Contrary to the name "dedupe", don't we have a lot of dups going on here? I guess we realized we needed '--runtime=electron' on all npm calls and then you had to find 6 places to add it… I found only one in #536 :)

Cleanup time?

Copy link
Contributor

@maxbrunsfeld maxbrunsfeld Jul 24, 2016

Choose a reason for hiding this comment

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

I believe the variable is called dedupeArgs because it is the list of arguments passed to the npm dedupe command.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah nevermind, didn't get that this was a joke about code duplication 😄

Copy link
Contributor Author

@as-cii as-cii Jul 25, 2016

Choose a reason for hiding this comment

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

That's a great point, @hedefalk. I considered using the .apmrc file to store all these configuration settings, but it felt somewhat inconsistent because we still need to use dynamically generated options (e.g. the architecture and the electron version) and there is something nice about having those options close to one another.

I guess an alternative could be to extract a method (and put it in apm.coffee) named getNpmBuildOptions()/getNpmBuildFlags() which takes care of constructing an array with the necessary parameters. I'll open a pull-request with this change. 👍

viddo added a commit to viddo/atom-textual-velocity that referenced this pull request Sep 1, 2016
Requires a more recent version of Atom, since this version of Chokidar
was not compatible with native extensions in previous versions of apm
See atom/apm#596
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants