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

fix mononoke build #769

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/mononoke_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ on:
branches:
- main

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Show disk space at start
run: df -h
- name: Free up disk space
Expand All @@ -25,10 +28,10 @@ jobs:
run: sudo apt-get update
- name: Install system deps
run: sudo python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive mononoke
- name: Install packaging system deps
run: sudo python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive patchelf
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
- name: Fetch lld
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests lld
- name: Fetch ninja
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests ninja
- name: Fetch cmake
Expand Down Expand Up @@ -89,8 +92,6 @@ jobs:
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests fb303
- name: Fetch rust-shed
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests rust-shed
- name: Build lld
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests lld
- name: Build ninja
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests ninja
- name: Build cmake
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/mononoke_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ on:
branches:
- main

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
build:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Show disk space at start
run: df -h
- name: Free up disk space
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ async fn check_if_independent_branch_and_return(
.commit_graph()
.ancestors_difference_stream(ctx, branch_tips.clone(), other_branches)
.await?
.map_ok({ move |cs| async move { Ok(cs.load(ctx, blobstore).await?) } })
.map_ok(move |cs| async move { Ok(cs.load(ctx, blobstore).await?) })
.try_buffered(100)
.try_collect::<Vec<_>>()
.await?;
Expand Down
2 changes: 1 addition & 1 deletion eden/mononoke/git/git_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#![feature(error_generic_member_access)]
#![feature(iterator_try_reduce)]
#![feature(provide_any)]
#![cfg_attr(fbcode_build, feature(provide_any))]

pub mod mode;

Expand Down
12 changes: 11 additions & 1 deletion eden/mononoke/megarepo_api/megarepo_error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#![feature(error_generic_member_access)]
#![feature(provide_any)]
#![cfg_attr(fbcode_build, feature(provide_any))]

use std::backtrace::BacktraceStatus;
use std::convert::Infallible;
Expand All @@ -21,6 +21,9 @@ use thiserror::Error;
pub mod macro_reexport {
pub use anyhow::anyhow;
}
// The cargo build of anyhow disables its backtrace features when using RUSTC_BOOTSTRAP=1
#[cfg(not(fbcode_build))]
pub static DISABLED: std::backtrace::Backtrace = std::backtrace::Backtrace::disabled();

#[macro_export]
macro_rules! cloneable_error {
Expand All @@ -29,9 +32,15 @@ macro_rules! cloneable_error {
pub struct $name(pub ::std::sync::Arc<anyhow::Error>);

impl $name {
#[cfg(fbcode_build)]
pub fn backtrace(&self) -> &::std::backtrace::Backtrace {
self.0.backtrace()
}

#[cfg(not(fbcode_build))]
pub fn backtrace(&self) -> &::std::backtrace::Backtrace {
&$crate::DISABLED
}
}

impl ::std::fmt::Display for $name {
Expand All @@ -51,6 +60,7 @@ macro_rules! cloneable_error {
Some(&**self.0)
}

#[cfg(fbcode_build)]
fn provide<'a>(&'a self, demand: &mut ::std::any::Demand<'a>) {
demand.provide_ref::<::std::backtrace::Backtrace>(self.backtrace());
}
Expand Down
14 changes: 12 additions & 2 deletions eden/mononoke/mononoke_api/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* GNU General Public License version 2.
*/

use std::any::Demand;
use std::backtrace::Backtrace;
use std::convert::Infallible;
use std::error::Error as StdError;
Expand All @@ -30,10 +29,20 @@ use crate::path::MononokePath;
#[derive(Clone, Debug)]
pub struct InternalError(Arc<Error>);

// The cargo build of anyhow disables its backtrace features when using RUSTC_BOOTSTRAP=1
#[cfg(not(fbcode_build))]
static DISABLED: Backtrace = Backtrace::disabled();

impl InternalError {
#[cfg(fbcode_build)]
pub fn backtrace(&self) -> &Backtrace {
self.0.backtrace()
}

#[cfg(not(fbcode_build))]
pub fn backtrace(&self) -> &Backtrace {
&DISABLED
}
}

impl fmt::Display for InternalError {
Expand All @@ -53,7 +62,8 @@ impl StdError for InternalError {
Some(&**self.0)
}

fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
#[cfg(fbcode_build)]
fn provide<'a>(&'a self, demand: &mut ::std::any::Demand<'a>) {
demand.provide_ref::<Backtrace>(self.backtrace());
}
}
Expand Down
2 changes: 1 addition & 1 deletion eden/mononoke/mononoke_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#![feature(error_generic_member_access)]
#![feature(provide_any)]
#![cfg_attr(fbcode_build, feature(provide_any))]
#![feature(trait_alias)]

use std::sync::Arc;
Expand Down