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

config: Read environment variables from [env] section in config.toml #12

Merged
merged 1 commit into from
Mar 4, 2022

Conversation

MarijnS95
Copy link
Member

@MarijnS95 MarijnS95 commented Feb 28, 2022

Environment variables can be set and optionally override the process environment through .cargo/config.toml's [env] section: https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to overriding the environment set in the process, and can optionally represent paths relative to the parent of the containing .cargo/ folder.

src/config.rs Outdated Show resolved Hide resolved
src/config.rs Outdated Show resolved Hide resolved
@MarijnS95 MarijnS95 force-pushed the env branch 2 times, most recently from c1d70a2 to 1d4d80d Compare March 2, 2022 14:03
@MarijnS95 MarijnS95 changed the title config: Parse [env] block config: Read environment variables from [env] section in config.toml Mar 2, 2022
@MarijnS95 MarijnS95 force-pushed the env branch 2 times, most recently from a54b1f1 to e992e82 Compare March 2, 2022 14:18
MarijnS95 added a commit to MarijnS95/ndk that referenced this pull request Mar 2, 2022
Environment variables can be set and optionally override the process
environment through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.  The entire handling of these variables is implemented in
rust-mobile/cargo-subcommand#12 which can be read
as-is from cargo-apk and ndk-build, through a trait to keep ndk-build
oblivious for cargo-subcommand.
@MarijnS95 MarijnS95 requested a review from dvc94ch March 2, 2022 14:49
MarijnS95 added a commit that referenced this pull request Mar 3, 2022
While implementing #12 an invalid `.cargo/config.toml` turned into an
undescriptive and incorrect `ManifestNotFound` here.  Forwarding the
parsing error gives the user a much more descriptive error message
that'll help understand what to fix.
MarijnS95 added a commit that referenced this pull request Mar 3, 2022
…errors from "manifest not found" (#14)

* error: Distinguish toml parsing errors from "manifest not found"

While implementing #12 an invalid `.cargo/config.toml` turned into an
undescriptive and incorrect `ManifestNotFound` here.  Forwarding the
parsing error gives the user a much more descriptive error message
that'll help understand what to fix.

* error: Map toml parsing errors to include path of offending file

* error: Add path to io errors as context
MarijnS95 added a commit to MarijnS95/ndk that referenced this pull request Mar 3, 2022
Environment variables can be set and optionally override the process
environment through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.  The entire handling of these variables is implemented in
rust-mobile/cargo-subcommand#12 which can be read
as-is from cargo-apk and ndk-build, through a trait to keep ndk-build
oblivious for cargo-subcommand.
Copy link
Collaborator

@dvc94ch dvc94ch left a comment

Choose a reason for hiding this comment

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

looks good

src/config.rs Show resolved Hide resolved
src/config.rs Show resolved Hide resolved
Environment variables can be set and optionally override the process
environment through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.
@MarijnS95
Copy link
Member Author

Glad I got the CI merged first 😬 - already coming in clutch.

@MarijnS95 MarijnS95 merged commit aeb0f50 into master Mar 4, 2022
@MarijnS95 MarijnS95 deleted the env branch March 4, 2022 09:52
@MarijnS95
Copy link
Member Author

Published as 0.6 since we have at least breaking changes in the public error type.

MarijnS95 added a commit to MarijnS95/ndk that referenced this pull request Mar 4, 2022
Environment variables can be set and optionally override the process
environment through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.  The entire handling of these variables is implemented in
rust-mobile/cargo-subcommand#12 which can be read
as-is from cargo-apk and ndk-build, through a trait to keep ndk-build
oblivious for cargo-subcommand.
MarijnS95 added a commit to rust-mobile/ndk that referenced this pull request Mar 22, 2022
Environment variables can be set and override the process environment
through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.  The entire handling of these variables is implemented in
rust-mobile/cargo-subcommand#12 and
rust-mobile/cargo-subcommand#16 which immediately
populate the process environment with these variables when
`Subcommand::new()` is called by `cargo-apk`.
MarijnS95 added a commit to rust-mobile/ndk that referenced this pull request Mar 22, 2022
Environment variables can be set and override the process environment
through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.  The entire handling of these variables is implemented in
rust-mobile/cargo-subcommand#12 and
rust-mobile/cargo-subcommand#16 which immediately
populate the process environment with these variables when
`Subcommand::new()` is called by `cargo-apk`.
MarijnS95 added a commit to rust-mobile/ndk that referenced this pull request Mar 25, 2022
)

Environment variables can be set and override the process environment
through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.  The entire handling of these variables is implemented in
rust-mobile/cargo-subcommand#12 and
rust-mobile/cargo-subcommand#16 which immediately
populate the process environment with these variables when
`Subcommand::new()` is called by `cargo-apk`.
MarijnS95 added a commit to rust-mobile/xbuild that referenced this pull request May 3, 2023
…nment

Environment variables can be set and optionally override the process
environment through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.

Besides exposing variables to all other processes called by `xbuild`,
this also allows `xbuild` itself to be driven by variables set in
`.cargo/config.toml`, such as `$ANDROID_HOME` needed for #116.

rust-mobile/cargo-subcommand#12
rust-mobile/cargo-subcommand#16
MarijnS95 added a commit to rust-mobile/xbuild that referenced this pull request May 15, 2023
…nment

Environment variables can be set and optionally override the process
environment through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.

Besides exposing variables to all other processes called by `xbuild`,
this also allows `xbuild` itself to be driven by variables set in
`.cargo/config.toml`, such as `$ANDROID_HOME` needed for #116.

rust-mobile/cargo-subcommand#12
rust-mobile/cargo-subcommand#16
MarijnS95 added a commit to rust-mobile/xbuild that referenced this pull request Aug 17, 2023
…nment

Environment variables can be set and optionally override the process
environment through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.

Besides exposing variables to all other processes called by `xbuild`,
this also allows `xbuild` itself to be driven by variables set in
`.cargo/config.toml`, such as `$ANDROID_HOME` needed for #116.

rust-mobile/cargo-subcommand#12
rust-mobile/cargo-subcommand#16
MarijnS95 added a commit to rust-mobile/xbuild that referenced this pull request Aug 22, 2023
…nment (#117)

* Propagate `.cargo/config.toml` `[env]` settings to the process environment

Environment variables can be set and optionally override the process
environment through `.cargo/config.toml`'s `[env]` section:
https://doc.rust-lang.org/cargo/reference/config.html#env

These config variables have specific precedence rules with regards to
overriding the environment set in the process, and can optionally
represent paths relative to the parent of the containing `.cargo/`
folder.

Besides exposing variables to all other processes called by `xbuild`,
this also allows `xbuild` itself to be driven by variables set in
`.cargo/config.toml`, such as `$ANDROID_HOME` needed for #116.

rust-mobile/cargo-subcommand#12
rust-mobile/cargo-subcommand#16

* cargo/config: Don't canonicalize joined `[env]` `relative` paths

Cargo doesn't do this either, and canonicalization requires the path to
exist which it does not have to.
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.

2 participants