Repository navigation
sdk%feat(build): add barebones support for Bazel as alternate build system, use FHS layout in Nix environment, mimic Xcode.app layout for macOS SDK, rewrite smoke test in Python, update probe to validate sysroots
#79
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d99005d
sdk%build: mark lockfiles as generated, explicitly set the `rust` driver
kwvg fbd120f
sdk%refac: use `meta` for non-publishable crates, move `dash-dev`
kwvg 0d3fae8
sdk%lint: format only tracked TOML files, never walk the tree
kwvg aab8689
sdk%build(nix): run Linux binaries in an FHS environment w/ `fhs-run`
kwvg 559b0f9
sdk%refac(test): pull greeters from `smoke_test.sh` to `contrib/probes`
kwvg 4088353
sdk%test: rewrite `smoke_test.sh` in Python
kwvg 8032002
sdk%feat(test): validate test binaries, use `lief` to parse them
kwvg 543cbb4
sdk%feat(test): rewrite the greeter probes to use OS-specific APIs
kwvg 8a474fa
sdk%build(nix): define the clang resource directory, macOS `compiler-rt`
kwvg 24e24e9
sdk%build(nix): mimic `Xcode.app` metadata and layout for macOS SDK
kwvg fe80527
sdk%test: report a failed build by its first error line
kwvg c4fd209
sdk%feat(build): add Bazel, a meta crate and Starlark linter
kwvg 9dea503
sdk%build(bazel): contain Bazel(-generated) resources to `.cache`
kwvg f8839ef
sdk%feat(ci): add simple Bazel validation workflow
kwvg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .cache | ||
| .venv | ||
| docs/.site | ||
| public | ||
| target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Bazelisk runs `bazel/bazel` in place of the Bazel release it fetched. | ||
| BAZELISK_WRAPPER_DIRECTORY=bazel | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # The output root is placed in `.cache` (see `bazel/shim.py`), and the repo contents cache cannot live in-tree. | ||
| common --repo_contents_cache= | ||
|
|
||
| # Keeps the convenience symlinks out of the repository root. | ||
| build --symlink_prefix=.cache/bazel- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 9.1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| * text=auto eol=lf | ||
| fuzz/*/corpora/** binary linguist-generated | ||
| *.bat text eol=crlf | ||
| *.lock linguist-generated | ||
| *.lock.yml linguist-generated | ||
| *.rs diff=rust | ||
| fuzz/*/corpora/** binary linguist-generated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| name: Build with Bazel | ||
|
|
||
| on: | ||
| push: | ||
| branches: [develop] | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| bazel: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: | ||
| - ubuntu-24.04 | ||
| - ubuntu-24.04-arm | ||
| - macos-latest | ||
| - macos-15-intel | ||
| - windows-latest | ||
|
|
||
| name: ${{ matrix.os }} (bazel) | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Install just | ||
| uses: taiki-e/install-action@v2 | ||
| with: | ||
| tool: just | ||
|
|
||
| # Windows images ship Bazel beside Bazelisk, and either may come first. | ||
| - name: Uninstall Bazel | ||
| if: runner.os == 'Windows' | ||
| shell: pwsh | ||
| run: | | ||
| if (choco list bazel --exact --limit-output) { | ||
| choco uninstall bazel --yes --no-progress | ||
| } | ||
|
|
||
| - name: Build every target | ||
| run: just zbuild | ||
|
|
||
| - name: Check the output root | ||
| shell: bash | ||
| run: test -d .cache/bazel/install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| [workspace] | ||
| members = [ | ||
| "pkgs/dev", | ||
| "meta/bazel", | ||
| "meta/dev", | ||
| "pkgs/num", | ||
| "pkgs/params", | ||
| "pkgs/p2p_core", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| module( | ||
| name = "dash_base_sdk", | ||
| version = "0.0.0", | ||
| ) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| shim.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| @echo off | ||
| python "%~dp0shim.py" %* | ||
| exit /b %ERRORLEVEL% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Bazel settings shared by the root and crate justfiles. | ||
|
|
||
| # Read by bazelisk, which otherwise downloads Bazel into the user's cache. | ||
| export BAZELISK_HOME := justfile_directory() + "/.cache/bazelisk" | ||
|
kwvg marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/usr/bin/env python3 | ||
| # coding: latin-1 | ||
|
|
||
| # | ||
| # Copyright (c) 2026-present, The Dash Core developers | ||
| # SPDX-License-Identifier: MIT | ||
| # See the accompanying file LICENSE or https://opensource.org/license/MIT | ||
| # | ||
|
|
||
| """Shim that runs Bazel with its output root in `.cache/bazel`.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import os | ||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| OUTPUT_ROOT = Path(__file__).resolve().parents[1] / ".cache" / "bazel" | ||
|
|
||
|
|
||
| def main() -> int: | ||
| real = os.environ.get("BAZEL_REAL") | ||
| if not real: | ||
| print("bazel: run bazelisk, which sets BAZEL_REAL", file=sys.stderr) | ||
| return 2 | ||
| argv = [real, f"--output_user_root={OUTPUT_ROOT}", *sys.argv[1:]] | ||
| if os.name == "nt": | ||
| return subprocess.run(argv, check=False).returncode # noqa: S603 | ||
| os.execv(real, argv) # noqa: S606 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Bazel through bazelisk, with buildifier. | ||
|
|
||
| { pkgs }: | ||
|
|
||
| let | ||
| # nixpkgs builds Bazel from source, whose lockfiles differ from those of the | ||
| # release binaries. Bazelisk fetches the release hosts without Nix run too. | ||
| bazelisk = pkgs.writeShellScriptBin "bazel" '' | ||
| exec ${pkgs.bazelisk}/bin/bazelisk "$@" | ||
| ''; | ||
| in | ||
| { | ||
| packages = [ | ||
| bazelisk | ||
| pkgs.buildifier | ||
| ]; | ||
|
|
||
| shellHook = '' | ||
| if root=$(git rev-parse --show-toplevel 2> /dev/null); then | ||
| export BAZELISK_HOME="$root/.cache/bazelisk" | ||
| fi | ||
| ''; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.