Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/actions/build_debug/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ runs:
prefix-key: buck2-debug
- name: Build buck2 binary (debug)
run: |-
rm -rf $RUNNER_TEMP/artifacts
mkdir $RUNNER_TEMP/artifacts
cargo build --bin=buck2 -Z unstable-options --artifact-dir=$RUNNER_TEMP/artifacts
shell: bash
1 change: 1 addition & 0 deletions .github/actions/build_release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ runs:
prefix-key: buck2-release
- name: Build buck2 binary (release)
run: |-
rm -rf $RUNNER_TEMP/artifacts
mkdir $RUNNER_TEMP/artifacts
cargo build --bin=buck2 --release -Z unstable-options --artifact-dir=$RUNNER_TEMP/artifacts
shell: bash
5 changes: 4 additions & 1 deletion .github/actions/setup_linux_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description: Setup Linux environment
runs:
using: composite
steps:
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: SebRollen/toml-action@v1.2.0
id: read_rust_toolchain
with:
Expand All @@ -14,7 +17,7 @@ runs:
components: clippy
- run: sudo apt-get update
shell: bash
- run: sudo apt-get install opam libzstd-dev python3-pip erlang
- run: sudo apt-get install -y --no-install-recommends opam libzstd-dev python3-pip erlang
shell: bash
- uses: haskell-actions/setup@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload_buck2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ jobs:
chmod +x artifacts/buck2-release
- name: Install dependencies
run: |
sudo apt-get install -y yarn
sudo apt-get install -y --no-install-recommends yarn
id: build
- name: Build the Website
run: |
Expand Down
3 changes: 3 additions & 0 deletions app/buck2_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ buck2_wrapper_common = { workspace = true }
[dev-dependencies]
assert_matches = { workspace = true }
tempfile = { workspace = true }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(fbcode_build)"] }
3 changes: 2 additions & 1 deletion app/buck2_client/src/commands/build/out.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,8 @@ mod tests {
Ok(())
}

#[cfg(unix)]
#[cfg(fbcode_build)] // @oss-enable
// @oss-disable: #[cfg(unix)]
mod unix {

use assert_matches::assert_matches;
Expand Down
10 changes: 7 additions & 3 deletions app/buck2_execute_local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ where
let stdout = InterruptibleAsyncRead::<_, Drainer<_>>::new(stdout);
let stderr = InterruptibleAsyncRead::<_, Drainer<_>>::new(stderr);
let stdout = FramedRead::new(stdout, BytesCodec::new())
.map(|data| Ok(StdioEvent::Stdout(data?.freeze())));
.map(|data: Result<bytes::BytesMut, std::io::Error>| Ok(StdioEvent::Stdout(data?.freeze())));
let stderr = FramedRead::new(stderr, BytesCodec::new())
.map(|data| Ok(StdioEvent::Stderr(data?.freeze())));
.map(|data: Result<bytes::BytesMut, std::io::Error>| Ok(StdioEvent::Stderr(data?.freeze())));

futures::stream::select(stdout, stderr).left_stream()
} else {
Expand Down Expand Up @@ -472,6 +472,7 @@ mod tests {
use std::str::FromStr;
use std::sync::Arc;
use std::sync::Mutex;
#[cfg(fbcode_build)]
use std::time::Instant;

use assert_matches::assert_matches;
Expand Down Expand Up @@ -557,6 +558,7 @@ mod tests {
Ok(())
}

#[cfg(fbcode_build)]
#[tokio::test]
async fn test_gather_output_timeout() -> buck2_error::Result<()> {
let now = Instant::now();
Expand Down Expand Up @@ -590,7 +592,8 @@ mod tests {
Ok(())
}

#[cfg(unix)]
#[cfg(fbcode_build)] // @oss-enable
// @oss-disable: #[cfg(unix)]
#[tokio::test]
async fn test_spawn_retry_txt_busy() -> buck2_error::Result<()> {
use tokio::fs::OpenOptions;
Expand Down Expand Up @@ -626,6 +629,7 @@ mod tests {
Ok(())
}

#[cfg(fbcode_build)]
#[tokio::test]
async fn test_spawn_retry_other_error() -> buck2_error::Result<()> {
let tempdir = tempfile::tempdir()?;
Expand Down
3 changes: 3 additions & 0 deletions app/buck2_server_ctx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ starlark_map = { workspace = true }
assert_matches = { workspace = true }
derivative = { workspace = true }
tokio = { workspace = true }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(fbcode_build)"] }
8 changes: 8 additions & 0 deletions app/buck2_server_ctx/src/concurrency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,11 +821,15 @@ mod tests {
use buck2_common::legacy_configs::dice::SetLegacyConfigs;
use buck2_core::fs::project::ProjectRootTemp;
use buck2_core::is_open_source;
#[cfg(fbcode_build)]
use buck2_events::BuckEvent;
#[cfg(fbcode_build)]
use buck2_events::create_source_sink_pair;
use buck2_events::daemon_id::DaemonId;
use buck2_events::sink::null::NullEventSink;
#[cfg(fbcode_build)]
use buck2_events::source::ChannelEventSource;
#[cfg(fbcode_build)]
use buck2_events::span::SpanId;
use derivative::Derivative;
use dice::DetectCycles;
Expand Down Expand Up @@ -1631,6 +1635,7 @@ mod tests {
Ok(())
}

#[cfg(fbcode_build)]
async fn wait_for_event<F>(
source: &mut ChannelEventSource,
matcher: Box<F>,
Expand All @@ -1655,6 +1660,7 @@ mod tests {
.buck_error_context("Time out waiting for matching buck event")
}

#[cfg(fbcode_build)]
async fn wait_for_exclusive_span_start(
source: &mut ChannelEventSource,
cmd: Option<&str>,
Expand All @@ -1680,6 +1686,7 @@ mod tests {
.span_id())
}

#[cfg(fbcode_build)]
async fn wait_for_exclusive_span_end(
source: &mut ChannelEventSource,
span_id: Option<SpanId>,
Expand All @@ -1700,6 +1707,7 @@ mod tests {
.await
}

#[cfg(fbcode_build)]
#[tokio::test]
async fn exclusive_command_lock() -> buck2_error::Result<()> {
let dice = make_default_dice().await;
Expand Down
3 changes: 3 additions & 0 deletions dice/dice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ bincode = { workspace = true }
derivative = "2.1.1"
tempfile = "3.1"
tokio = { version = "1.5", features = ["full"] }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(fbcode_build)"] }
2 changes: 2 additions & 0 deletions dice/dice/src/impls/tests/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use std::sync::Arc;
#[cfg(fbcode_build)]
use std::sync::Barrier;
use std::sync::Mutex;
use std::sync::atomic::AtomicBool;
Expand Down Expand Up @@ -133,6 +134,7 @@ async fn set_injected_with_no_change_no_new_ctx() -> anyhow::Result<()> {
Ok(())
}

#[cfg(fbcode_build)]
#[test]
fn dice_computations_are_parallel() {
let n_thread = 10;
Expand Down
1 change: 1 addition & 0 deletions dice/dice/src/impls/tests/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ async fn concurrent_identical_requests_are_deduped() -> anyhow::Result<()> {
Ok(())
}

#[cfg(fbcode_build)]
#[test]
fn different_requests_are_spawned_in_parallel() -> anyhow::Result<()> {
let n_thread = 10usize;
Expand Down
2 changes: 1 addition & 1 deletion dice/dice/src/impls/worker/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ async fn _run_cancellation_caching_test(
// Ensure that the time it took to run the test is expected
match cancel_type {
CancelType::Sync | CancelType::ASync => {
let limit = (FIRST_COMPUTE_MS as f64) * 0.05 + (CANCELLATION_WAIT_MS as f64) * 1.05;
let limit = (FIRST_COMPUTE_MS as f64) * 0.05 + (CANCELLATION_WAIT_MS as f64) * 2.0;
assert!(elapsed_ms < limit as u64);
}
CancelType::NotCancelled => {
Expand Down
32 changes: 32 additions & 0 deletions do/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -eu -o pipefail

act_build()
{
act \
--bind \
--container-architecture linux/x86_64 \
--platform 4-core-ubuntu=catthehacker/ubuntu:act-22.04 \
--workflows .github/workflows/build-and-test.yml \
--job linux-build-and-test \
"$@"
}

if [ ${1-} = --clean ]; then
if [ -d "$(dotslash -- cache-dir)" ]; then
dotslash -- clean
fi
rm -rf ~/.cache/act ~/.cache/actcache
rm -rf build/fbcode_builder/getdeps/__pycache__/

rm -rf buck-out/
rm -rf conan-build/


act_build \
--rebuild \
--container-options --init
else
act_build \
--reuse
fi
4 changes: 3 additions & 1 deletion prelude/apple/prebuilt_apple_framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ load(
"cxx_attr_preferred_linkage",
"cxx_platform_supported",
)
load("@prelude//cxx:linker.bzl", "wrap_linker_flags")
load(
"@prelude//cxx:preprocessor.bzl",
"CPreprocessor",
Expand Down Expand Up @@ -122,10 +123,11 @@ def prebuilt_apple_framework_impl(ctx: AnalysisContext) -> [list[Provider], Prom
lib = framework_library_artifact,
)

linker_type = get_cxx_toolchain_info(ctx).linker_info.type
link = LinkInfo(
name = framework_name,
linkables = [linkable],
pre_flags = [cxx_attr_exported_linker_flags(ctx)],
pre_flags = wrap_linker_flags(linker_type, cxx_attr_exported_linker_flags(ctx)),
)
link_info = LinkInfos(default = link)

Expand Down
36 changes: 36 additions & 0 deletions prelude/build_mode/constraints/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
load("@prelude//utils:source_listing.bzl", "source_listing")

oncall("build_infra")

source_listing()

# Build mode constraints for OSS

constraint_setting(
name = "build_mode",
visibility = ["PUBLIC"],
)

constraint_value(
name = "static",
constraint_setting = ":build_mode",
visibility = ["PUBLIC"],
)

constraint_value(
name = "static_pic",
constraint_setting = ":build_mode",
visibility = ["PUBLIC"],
)

constraint_value(
name = "opt",
constraint_setting = ":build_mode",
visibility = ["PUBLIC"],
)

constraint_value(
name = "dev",
constraint_setting = ":build_mode",
visibility = ["PUBLIC"],
)
37 changes: 37 additions & 0 deletions prelude/compiler/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is dual-licensed under either the MIT license found in the
# LICENSE-MIT file in the root directory of this source tree or the Apache
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree. You may select, at your option, one of the
# above-listed licenses.

load("@prelude//utils:source_listing.bzl", "source_listing")

oncall("build_infra")

source_listing()

config_setting(
name = "clang",
constraint_values = [
"prelude//compiler/constraints:clang",
],
visibility = ["PUBLIC"],
)

config_setting(
name = "gcc",
constraint_values = [
"prelude//compiler/constraints:gcc",
],
visibility = ["PUBLIC"],
)

config_setting(
name = "msvc",
constraint_values = [
"prelude//compiler/constraints:msvc",
],
visibility = ["PUBLIC"],
)
36 changes: 36 additions & 0 deletions prelude/compiler/constraints/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is dual-licensed under either the MIT license found in the
# LICENSE-MIT file in the root directory of this source tree or the Apache
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree. You may select, at your option, one of the
# above-listed licenses.

load("@prelude//utils:source_listing.bzl", "source_listing")

oncall("build_infra")

source_listing()

constraint_setting(
name = "compiler",
visibility = ["PUBLIC"],
)

constraint_value(
name = "clang",
constraint_setting = ":compiler",
visibility = ["PUBLIC"],
)

constraint_value(
name = "gcc",
constraint_setting = ":compiler",
visibility = ["PUBLIC"],
)

constraint_value(
name = "msvc",
constraint_setting = ":compiler",
visibility = ["PUBLIC"],
)
21 changes: 21 additions & 0 deletions prelude/cpp/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
load("@prelude//utils:source_listing.bzl", "source_listing")

oncall("build_infra")

source_listing()

config_setting(
name = "libc++",
constraint_values = [
"//cpp/constraints:libc++",
],
visibility = ["PUBLIC"],
)

config_setting(
name = "libstdc++",
constraint_values = [
"//cpp/constraints:libstdc++",
],
visibility = ["PUBLIC"],
)
Loading
Loading