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

Add additional toolchains maintained by cross-rs. #795

Merged
merged 1 commit into from
Jun 15, 2022

Conversation

Alexhuszagh
Copy link
Contributor

These toolchains are not automatically tested by CI, and must be built manually by the user. However, they are confirmed to build at least once, and are likely to work as-is.

@Alexhuszagh Alexhuszagh requested a review from a team as a code owner June 14, 2022 20:10
@Alexhuszagh Alexhuszagh changed the title Added additional toolchains maintained by cross-rs. Add additional toolchains maintained by cross-rs. Jun 14, 2022
xtask/src/build_docker_image.rs Outdated Show resolved Hide resolved
xtask/src/build_docker_image.rs Outdated Show resolved Hide resolved
@Alexhuszagh Alexhuszagh force-pushed the ext_toolchains branch 2 times, most recently from bdce1f0 to 3dd967c Compare June 14, 2022 22:46
@Alexhuszagh Alexhuszagh requested a review from Emilgardis June 14, 2022 22:49
@Alexhuszagh
Copy link
Contributor Author

Alexhuszagh commented Jun 14, 2022

I think that's everything. We now locate the Dockerfiles ahead of time, allowing mixing and matching in the docker root or the cross-toolchain docker root:

fn locate_dockerfile(
    target: String,
    docker_root: &Path,
    cross_toolchain_root: &Path,
) -> cross::Result<(String, String)> {
    let dockerfile_name = format!("Dockerfile.{target}");
    let dockerfile_root = if cross_toolchain_root.join(&dockerfile_name).exists() {
        &cross_toolchain_root
    } else if docker_root.join(&dockerfile_name).exists() {
        &docker_root
    } else {
        eyre::bail!("unable to find dockerfile for target \"{target}\"");
    };
    let dockerfile = dockerfile_root.join(dockerfile_name).display().to_string();
    Ok((target, dockerfile))
}

...

pub fn build_docker_image(...) -> cross::Result<()> {
    ....
    let targets = targets
        .into_iter()
        .map(|t| locate_dockerfile(t, &docker_root, &cross_toolchains_root))
        .collect::<cross::Result<Vec<_>>>()?;

    let mut results = vec![];
    for (target, dockerfile) in &targets {
        ....
    }

    ....
}

These toolchains are not automatically tested by CI, and must be built
manually by the user. However, they are confirmed to build at least
once, and are likely to work as-is.

Also adds better error handling when it cannot find a suitable Dockerfile
for a given target.
Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

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

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 15, 2022

Build succeeded:

@bors bors bot merged commit d90b016 into cross-rs:main Jun 15, 2022
@Emilgardis Emilgardis added this to the v0.2.2 milestone Jun 15, 2022
@Alexhuszagh Alexhuszagh deleted the ext_toolchains branch June 23, 2022 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants