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

expose cargo package name as CARGO_PKG_NAME #2523

Merged
merged 1 commit into from
Mar 29, 2016
Merged

expose cargo package name as CARGO_PKG_NAME #2523

merged 1 commit into from
Mar 29, 2016

Conversation

srinivasreddy
Copy link
Contributor

#2504 Expose cargo package name as CARGO_PKG_NAME, and package description and home page are exposed as CARGO_PKG_DESCRIPTION and CARGO_PKG_HOMEPAGE respectively

@rust-highfive
Copy link

r? @wycats

(rust_highfive has picked a reviewer for you, use r? to override)

@srinivasreddy
Copy link
Contributor Author

r? @alexcrichton

@rust-highfive rust-highfive assigned alexcrichton and unassigned wycats Mar 26, 2016
@srinivasreddy srinivasreddy changed the title implemented cargo package name as CARGO_PKG_NAME expose cargo package name as CARGO_PKG_NAME Mar 26, 2016
@alexcrichton
Copy link
Member

Thanks! Can you add tests for this as well?

@srinivasreddy
Copy link
Contributor Author

@alexcrichton Could you please take a look at this?

@@ -109,12 +109,17 @@ impl<'cfg> Compilation<'cfg> {
}
}

let metadata = pkg.manifest().metadata().clone();
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't need to get cloned here, does it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

metadata() does not return a reference, so i think it needs to. Please correct me if am wrong. I just started on rust.

Copy link
Member

Choose a reason for hiding this comment

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

If it doesn't return a reference then you shouldn't need the clone() as it's not a reference, but if it does a reference you should be able to use the fields through the reference (without cloning).

The parts below can probably be:

metadata.description.as_ref().unwrap_or(&String::new())

…tion and home page are exposed as CARGO_PKG_DESCRIPTION and CARGO_PKG_HOMEPAGE respectively. And add a test case - for CARGO_PKG_NAME, CARGO_PKR_DESCRIPTION, CARGO_HOMEPAGE.
@srinivasreddy
Copy link
Contributor Author

@alexcrichton done.

@alexcrichton alexcrichton added the relnotes Release-note worthy label Mar 29, 2016
@alexcrichton
Copy link
Member

@bors: r+ 3a654e4

Thanks!

@bors
Copy link
Contributor

bors commented Mar 29, 2016

⌛ Testing commit 3a654e4 with merge abdc756...

bors added a commit that referenced this pull request Mar 29, 2016
expose cargo package name as CARGO_PKG_NAME
@bors
Copy link
Contributor

bors commented Mar 29, 2016

@bors bors merged commit 3a654e4 into rust-lang:master Mar 29, 2016
@srinivasreddy srinivasreddy deleted the issue-2504 branch March 29, 2016 17:18
smaximov added a commit to smaximov/cargo that referenced this pull request Apr 12, 2016
bors added a commit that referenced this pull request Apr 12, 2016
Document env vars introduced in PR #2523 to the docs

Document environment variables introduced in #2523 (`CARGO_PKG_NAME`, `CARGO_PKG_DESCRIPTION`, `CARGO_PKG_HOMEPAGE`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Release-note worthy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants