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
"""Starlark version of `new_local_repository` for module extensions. | |
Currently `native.new_local_repository` cannot be called from Bazel module | |
extensions: https://github.com/bazelbuild/bazel/issues/15412 | |
The plan is to eventually "starlark-ify" this rule: | |
- https://docs.google.com/document/d/17RZKMuMjAIgNfFdrsLhqNsMTQDSS-BBA-S-fCSBPV7M/edit | |
- https://github.com/bazelbuild/bazel/issues/18285 | |
In the interim we've got our own Starlark-native `new_local_repository` |
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
Meant to be used together with this Bazel fork: | |
- https://github.com/rrbutani/bazel/compare/70fc57d29ce21204f28f8462627badbd5b750787...b8553d4fcf157acddbac855a3945c74d0f962c27 | |
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
"""Helper functions for repository rules that ensure labels are well-formed. | |
Labels constructed and used within repository rules do not have their name (the | |
part after `:`) checked against the package structure of the repo they point to; | |
they are allowed to refer to source artifacts via paths that do not respect the | |
package structure or visibility. | |
For example, for a source file that lives at `@foo//bar/baz:some/file/path`, all | |
of the following — when passed to repository context functions like `rctx.path` | |
or `rctx.read` — will refer to the file, without error: |
First you need to run echo "test" > /tmp/foo
.
Running bazel build @repo//...
will print "running repo rule".
Touching test_file
and then bazel build @repo//...
will not do anything; the repo rule is not rerun and the artifacts in @repo
are not rebuilt.
Modifying test_file
will cause the workspace rule to be rerun.
- if you make a change that yields a different BUILD.bazel file then artifacts will be rebuilt (i.e. changing the first line of
test_file
) - if you make a change that still yields the same BUILD.bazel file no actions will be run (i.e adding extra lines, whitespace to
test_file
)
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
{ lib }: { | |
# Given an attrset of derivations of interest, returns an attrset where each | |
# corresponding key is the full list of deps for the derivation. | |
# | |
# Note: this is far from perfect; this function only walks the usual | |
# `mkDerivation` dependency list attributes so it'll miss dependencies in | |
# strings. | |
collectDeps = pkgSet: let | |
# dbg = x: builtins.trace (builtins.typeOf x) (builtins.trace x x); | |
d = path: builtins.unsafeDiscardStringContext path; |
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
... | |
see the revision history for lock files, if required |
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
{ lib ? import <nixpkgs/lib>, pkgs ? import <nixpkgs> { config.checkMeta = true; }, config ? pkgs.config }: let | |
extendedMetaAttrs = [ "agsRoles" ]; | |
removeExtendedFromMeta = attrs: attrs // (lib.optionalAttrs (attrs ? meta) { | |
meta = builtins.removeAttrs attrs.meta extendedMetaAttrs; | |
}); | |
getExtendedMeta = attrs: lib.filterAttrs | |
(n: _: builtins.elem n extendedMetaAttrs) | |
(attrs.meta or {}) |
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
{ pkgs ? import ./. {} }: let | |
overlay = f: p: let base = p.llvmPackages_15; in { | |
llvmPackages_15 = let | |
patch = f.fetchpatch { | |
url = "https://github.com/llvm/llvm-project/commit/57c7bb3ec89565c68f858d316504668f9d214d59.patch"; | |
hash = "sha256-AaM9A6tQ4YAw7uDqCIV4VaiUyLZv+unwcOqbakwW9/k="; | |
relative = "libcxx"; | |
}; | |
tools = base.tools; |
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
// We want to slice and dice our opcode map on: | |
// - opcode byte | |
// - opcode map (aka leading opcode bytes; if present) | |
// - prefixes | |
// | |
// Unfortunately, C doesn't have pattern matching. The macros that follow are | |
// our (unfortunate) facsimile. | |
// | |
// Essentially we are — in the style of `disas_insn` — appropriating the upper |