Skip to content

Commit

Permalink
various updates
Browse files Browse the repository at this point in the history
This commit updated with some important feedback from @dtolnay. Thank
you!
  • Loading branch information
steveklabnik committed May 9, 2023
1 parent 2abd1ad commit 914e3aa
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .buckconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ buck = none

[parser]
target_platform_detector_spec = target:root//...->prelude//platforms:default

[project]
ignore = .git, target
Empty file added .buckroot
Empty file.
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI

on:
pull_request:
push:
branches: [main]

jobs:
test:
name: ${{matrix.name || format('Rust {0}', matrix.rust)}}
runs-on: ${{matrix.os || 'ubuntu'}}-latest
strategy:
fail-fast: false
matrix:
include:
- rust: nightly
- rust: beta
- rust: stable
- rust: 1.69.0
- name: Cargo on macOS
rust: nightly
os: macos
- name: Cargo on Windows (msvc)
rust: nightly-x86_64-pc-windows-msvc
os: windows
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
- run: cargo check
- run: cargo run

buck:
name: Buck2 on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
runs-on: ${{matrix.os}}-latest
if: github.event_name != 'pull_request'
strategy:
matrix:
os: [ubuntu, macos, windows]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
with:
components: rust-src
- uses: dtolnay/install-buck2@latest
- run: buck2 build ...
- run: buck2 run //src/bin:hello_world

- uses: actions/cache/restore@v3
id: cache
with:
path: ~/.cargo/bin/reindeer${{matrix.os == 'windows' && '.exe' || ''}}
key: ${{matrix.os}}-reindeer

- run: cargo install --git https://github.com/facebookincubator/reindeer reindeer
if: steps.cache.outputs.cache-hit != 'true'

- uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ~/.cargo/bin/reindeer${{matrix.os == 'windows' && '.exe' || ''}}
key: ${{steps.cache.outputs.cache-primary-key}}

- run: reindeer buckify
working-directory: third-party
if: matrix.os == 'ubuntu'
- name: Check reindeer-generated BUCK file up to date
run: git diff --exit-code
if: matrix.os == 'ubuntu'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
buck-out
/buck-out
target
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ edition = "2021"

[lib]
path = "src/lib/print_hello.rs"

[dependencies]
semver = "1.0.17"
2 changes: 1 addition & 1 deletion prelude
Submodule prelude updated 120 files
1 change: 1 addition & 0 deletions src/bin/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ rust_binary(
deps = [
"//third-party:semver",
],
visibility = ["PUBLIC"],
)
18 changes: 4 additions & 14 deletions third-party/BUCK
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
load("@prelude//rust:cargo_buildscript.bzl", "buildscript_run")
load("@prelude//rust:cargo_package.bzl", "cargo")

alias(
name = "semver",
actual = ":semver-1.0.17",
Expand All @@ -12,7 +15,7 @@ http_archive(
visibility = [],
)

rust_library(
cargo.rust_library(
name = "semver-1.0.17",
srcs = [":semver-1.0.17.crate"],
crate = "semver",
Expand All @@ -24,16 +27,3 @@ rust_library(
],
visibility = [],
)

rust_binary(
name = "semver-1.0.17-build-script-build",
srcs = [":semver-1.0.17.crate"],
crate = "build_script_build",
crate_root = "semver-1.0.17.crate/build.rs",
edition = "2018",
features = [
"default",
"std",
],
visibility = [],
)
1 change: 0 additions & 1 deletion toolchains/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ system_rust_toolchain(

system_cxx_toolchain(
name = "cxx",
linker = "link.exe",
visibility = ["PUBLIC"],
)

Expand Down

0 comments on commit 914e3aa

Please sign in to comment.