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

Support for custom Cargo profiles #5326

Closed
wants to merge 1 commit into from

Conversation

da-x
Copy link
Member

@da-x da-x commented Apr 9, 2018

This allows creating custom profiles that inherit from other profiles.

For example, one can have a release-lto profile that looks like this:

[profile.custom.release-lto]
inherits = "release"
lto = true

The profile name will also carry itself into the output directory name so that the different build outputs can be cached independently from one another.

So in effect, at the target directory, a name will be created for the new profile, in addition to the 'debug' and 'release' builds:

    $ cargo build --profile release-lto
    $ ls -l target
    debug release release-lto

This allows creating custom profiles that inherit from other profiles.

For example, one can have a release-lto profile that looks like this:

    [profile.custom.release-lto]
    inherits = "release"
    lto = true

The profile name will also carry itself into the output directory name
so that the different build outputs can be cached independently from
one another.

So in effect, at the `target` directory, a name will be created for
the new profile, in addition to the 'debug' and 'release' builds:

```
    $ cargo build --profile release-lto
    $ ls -l target
    debug release release-lto
```
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matklad (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@da-x
Copy link
Member Author

da-x commented Apr 9, 2018

I understand that some cleanups and changes may be needed to insert this cleanly.

I had a problem adding new tests because rustc as executed from the test harness failed with "error: no default toolchain configured".

Also, I wonder if it makes sense to allow more commands to receive --profile.

@da-x da-x mentioned this pull request Apr 9, 2018
@matklad
Copy link
Member

matklad commented Apr 9, 2018

Thanks for the PR, @da-x! I am afraid we are not ready to implement custom profiles just yet. In the recent RFC, we've decided to slightly postpone the design of custom profiles, until the related workflows proposal is made:

proifles rfc: rust-lang/rfcs#2282 (comment)
workflows pre-proposal: http://aturon.github.io/2018/04/05/workflows/

I am almost sure we'll do it by the next epoch though, together with removal of all build-in profiles besides dev and test.

So I suggest closing this for know, and revisiting after workflows RFC and #5298 are done.

@da-x
Copy link
Member Author

da-x commented Apr 9, 2018

Thanks. There's no urgency - I'll use my fork for now. At least the CI checks revealed some bugs I'll fix in my implementation.

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.

3 participants