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

Expand env vars #38

Merged
8 commits merged into from
Mar 14, 2018
Merged

Expand env vars #38

8 commits merged into from
Mar 14, 2018

Conversation

cjkjellander
Copy link
Collaborator

This fixes #30 and lets both env variables be exported and you can now use env variables from rebar3 inside port_specs, as they are expanded while evaluating the port_specs.

It depends on erlang/rebar3#1706 which in turn depends on erlang/rebar3#1698 but it is written so it shouldn't crash if using an older rebar3. Please check that it doesn't crash for you, before merge:ing.

Also I have updated the README to reflect how to use the env variables inside port_specs cause it depends on how rebar3 exports variables. Specifically, it needs ${} expansion, but at least it works.

README.md Outdated
%% ["c_src/nif.c",
%% "${REBAR_DEPS_DIR}/foo/bar.c"]}]}.
%%
%% This is a _very_ good way to be able to use you code both
Copy link

Choose a reason for hiding this comment

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

Is this supposed to say your code?

README.md Outdated
%% This is a _very_ good way to be able to use you code both
%% as a top level app and a dependency.
%%
%% CAVEAT! Not using {} is broken for the moment.
Copy link

Choose a reason for hiding this comment

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

Does this imply a TODO for the future? If so, maybe add one?

@ghost
Copy link

ghost commented Feb 14, 2018

My two comments are not a code review, just minor nits I noticed. But github marks them as a review, for some reason.

@ghost
Copy link

ghost commented Feb 14, 2018

@tsloughter, @ferd, maybe promote @cjkjellander to collaborator in the repo?

@cjkjellander
Copy link
Collaborator Author

Those were valid points. Fixed them.

@blt
Copy link
Owner

blt commented Feb 16, 2018

@Tuncer @ferd @tsloughter I've promoted @cjkjellander.

@ghost
Copy link

ghost commented Feb 17, 2018

@blt, thanks. Not sure why GitHub won't allow me to select @cjkjellander when requesting a review in #39. I was under the impression all collaborators would be listed. Must be a GitHub glitch.

@cjkjellander
Copy link
Collaborator Author

@Tuncer you can add me as a reviewer of #39 if you want. Looked at it briefly and it looks pretty good.

@ghost
Copy link

ghost commented Feb 24, 2018

@cjkjellander, are you sure you've accepted the invitation to become a collaborator? I can't choose you from the reviewers list.

@ghost
Copy link

ghost commented Feb 25, 2018

@cjkjellander, merged the OTP 21 deprecation fix, since you approved the changes.

@ghost
Copy link

ghost commented Feb 25, 2018

@cjkjellander, any idea when the rebar3 changes will land?

@cjkjellander
Copy link
Collaborator Author

@Tuncer I had missed the collaboration email. About the deprecation fix, the function_exported/3 trick works if the module is loaded, but sting is stdlib so it should be sticky and loaded from the start. I tried the same trick in this branch I had to ensure my module was loaded first.

I think the rebar3 changes are close to being merged. Rewrote them to fix the review comments.

@cjkjellander
Copy link
Collaborator Author

The fixes to rebar3 has landed in master. So this needs a review and a merge.

@ghost
Copy link

ghost commented Mar 8, 2018

Do you have a test case we could include before merging?

@ghost
Copy link

ghost commented Mar 8, 2018

function_exported/3 trick works if the module is loaded, but sting is stdlib so it should be sticky and loaded from the start

Correct, it's one of many modules you can expect to be loaded, just like lists.

@cjkjellander
Copy link
Collaborator Author

Since we have zero tests right now that might be a big project....

@ghost
Copy link

ghost commented Mar 9, 2018

True, and to be precise, what I meant is if you have a project we can extract a test from.

@ghost
Copy link

ghost commented Mar 9, 2018

@asabil, @kape1395, referring to #30, can you verify that a fresh rebar3 with this branch's pc fixes the issue?

@ghost
Copy link

ghost commented Mar 9, 2018

@asabil, @kape1395, if one of you wants to get write permissions in this repo, please say so and @blt will send an invite. The plugin needs active users who are willing to occasionally fix a bug. In fact, the sole reason pc isn't bundled with rebar3 since the removal during refactoring is that Fred and Tristan require more active/dedicated maintainer(s) for pc. Related: erlang/rebar3#1713

@kape1395
Copy link

kape1395 commented Mar 9, 2018

I will try to check the last pc version during this weekend.

@ghost
Copy link

ghost commented Mar 9, 2018

@cjkjellander, if you rebase the branch, I'll test it on my projects.

@cjkjellander
Copy link
Collaborator Author

@Tuncer it is rebased.

I have two branches in two repos to test against.
This one was mentioned in #30 and I've made my own branch that works with rebar3: https://github.com/cjkjellander/bt/tree/rebar3-pc-build

And then we have our code that didn't work with rebar3: https://github.com/campanja/csv/tree/rebar3-build

Both of these should be built both as stand alone and as an included dep, and work in both ways of course.

@ghost
Copy link

ghost commented Mar 14, 2018

Thanks, it passes my local tests.

@ghost ghost merged commit 034efcf into blt:master Mar 14, 2018
@ghost
Copy link

ghost commented Mar 14, 2018

Tagged v1.7.0. @cjkjellander, can you publish to hex.pm?

@cjkjellander
Copy link
Collaborator Author

@Tuncer I'll try publishing.

ghost pushed a commit that referenced this pull request May 16, 2018
This pull request was closed.
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.

REBAR_DEPS_DIR doesn't get expanded
3 participants