bazel_7: cleanup dead files

There are some unused patch files and files related to tests that
aren't used, were likely copied from `bazel_6` but weren't make to work.

It is quite possible that https://github.com/bazelbuild/examples won't
be a good fit to test recent bazel versions so better cleanup
non-working code and remain open for any working way to add tests.
The deleted stuff still remains in git history and in bazel 6 and below
packages for reference if needed.
This commit is contained in:
Dmitry Ivankov
2024-12-05 21:56:17 +01:00
parent 9bb136edda
commit e34631a069
12 changed files with 2 additions and 16636 deletions
File diff suppressed because it is too large Load Diff
@@ -1,178 +0,0 @@
{ lib
, rnix-hashes
, runCommand
, fetchurl
# The path to the right MODULE.bazel.lock
, lockfile
# A predicate used to select only some dependencies based on their name
, requiredDepNamePredicate ? _: true
, canonicalIds ? true
}:
let
modules = builtins.fromJSON (builtins.readFile lockfile);
modulesVersion = modules.lockFileVersion;
# A foldl' for moduleDepGraph repoSpecs.
# We take any RepoSpec object under .moduleDepGraph.<moduleName>.repoSpec
foldlModuleDepGraph = op: acc: value:
if builtins.isAttrs value && value ? moduleDepGraph && builtins.isAttrs value.moduleDepGraph
then
lib.foldlAttrs
(_acc: moduleDepGraphName: module: (
if builtins.isAttrs module && module ? repoSpec
then op _acc { inherit moduleDepGraphName; } module.repoSpec
else _acc
))
acc
value.moduleDepGraph
else acc;
# a foldl' for moduleExtensions generatedRepoSpecs
# We take any RepoSpec object under .moduleExtensions.<moduleExtensionName>.general.generatedRepoSpecs.<generatedRepoName>
foldlGeneratedRepoSpecs = op: acc: value:
if builtins.isAttrs value && value ? moduleExtensions
then
lib.foldlAttrs
(_acc: moduleExtensionName: moduleExtension: (
if builtins.isAttrs moduleExtension
&& moduleExtension ? general
&& builtins.isAttrs moduleExtension.general
&& moduleExtension.general ? generatedRepoSpecs
&& builtins.isAttrs moduleExtension.general.generatedRepoSpecs
then
lib.foldlAttrs
(__acc: moduleExtensionGeneratedRepoName: repoSpec: (
op __acc { inherit moduleExtensionName moduleExtensionGeneratedRepoName; } repoSpec
))
_acc
moduleExtension.general.generatedRepoSpecs
else _acc
))
acc
value.moduleExtensions
else acc;
# remove the "--" prefix, abusing undocumented negative substring length
sanitize = str:
if modulesVersion < 3
then builtins.substring 2 (-1) str
else str;
unmangleName = mangledName:
if mangledName ? moduleDepGraphName
then builtins.replaceStrings [ "@" ] [ "~" ] mangledName.moduleDepGraphName
else
# given moduleExtensionName = "@scope~//path/to:extension.bzl%extension"
# and moduleExtensionGeneratedRepoName = "repoName"
# return "scope~extension~repoName"
let
isMainModule = lib.strings.hasPrefix "//" mangledName.moduleExtensionName;
moduleExtensionParts = builtins.split "^@*([a-zA-Z0-9_~]*)//.*%(.*)$" mangledName.moduleExtensionName;
match = if (builtins.length moduleExtensionParts >= 2) then builtins.elemAt moduleExtensionParts 1 else [ "unknownPrefix" "unknownScope" "unknownExtension" ];
scope = if isMainModule then "_main" else builtins.elemAt match 0;
extension = builtins.elemAt match 1;
in
"${scope}~${extension}~${mangledName.moduleExtensionGeneratedRepoName}";
# We take any "attributes" object that has a "sha256" field. Every value
# under "attributes" is assumed to be an object, and all the "attributes"
# with a "sha256" field are assumed to have either a "urls" or "url" field.
#
# We add them to the `acc`umulator:
#
# acc // {
# "ffad2b06ef2e09d040...fc8e33706bb01634" = fetchurl {
# name = "source";
# sha256 = "ffad2b06ef2e09d040...fc8e33706bb01634";
# urls = [
# "https://mirror.bazel.build/github.com/golang/library.zip",
# "https://github.com/golang/library.zip"
# ];
# };
# }
#
# !REMINDER! This works on a best-effort basis, so try to keep it from
# failing loudly. Prefer warning traces.
extract_source = f: acc: mangledName: value:
let
attrs = value.attributes;
name = unmangleName mangledName;
entry = hash: urls: name: {
${hash} = fetchurl {
name = "source"; # just like fetch*, to get some deduplication
inherit urls;
sha256 = hash;
passthru.sha256 = hash;
passthru.source_name = name;
passthru.urls = urls;
};
};
insert = acc: hash: urls:
let
validUrls = builtins.isList urls
&& builtins.all (url: builtins.isString url && builtins.substring 0 4 url == "http") urls;
validHash = builtins.isString hash;
valid = validUrls && validHash;
in
if valid then acc // entry hash urls name
else acc;
withToplevelValue = acc: insert acc
(attrs.integrity or attrs.sha256)
(attrs.urls or [ attrs.url ]);
# for http_file patches
withRemotePatches = acc: lib.foldlAttrs
(acc: url: hash: insert acc hash [ url ])
acc
(attrs.remote_patches or { });
# for _distdir_tar
withArchives = acc: lib.foldl'
(acc: archive: insert acc attrs.sha256.${archive} attrs.urls.${archive})
acc
(attrs.archives or [ ]);
addSources = acc: withToplevelValue (withRemotePatches (withArchives acc));
in
if builtins.isAttrs value && value ? attributes
&& value ? ruleClassName
&& builtins.isAttrs attrs
&& (attrs ? sha256 || attrs ? integrity)
&& (attrs ? urls || attrs ? url)
&& f name
then addSources acc
else acc;
requiredSourcePredicate = n: requiredDepNamePredicate (sanitize n);
requiredDeps = foldlModuleDepGraph (extract_source requiredSourcePredicate) { } modules // foldlGeneratedRepoSpecs (extract_source requiredSourcePredicate) { } modules;
command = ''
mkdir -p $out/content_addressable/sha256
cd $out
'' + lib.concatMapStrings
(drv: ''
filename=$(basename "${lib.head drv.urls}")
echo Bundling $filename ${lib.optionalString (drv?source_name) "from ${drv.source_name}"}
# 1. --repository_cache format:
# 1.a. A file under a content-hash directory
hash=$(${rnix-hashes}/bin/rnix-hashes --encoding BASE16 ${drv.sha256} | cut -f 2)
mkdir -p content_addressable/sha256/$hash
ln -sfn ${drv} content_addressable/sha256/$hash/file
# 1.b. a canonicalId marker based on the download urls
# Bazel uses these to avoid reusing a stale hash when the urls have changed.
canonicalId="${lib.concatStringsSep " " drv.urls}"
canonicalIdHash=$(echo -n "$canonicalId" | sha256sum | cut -d" " -f1)
echo -n "$canonicalId" > content_addressable/sha256/$hash/id-$canonicalIdHash
# 2. --distdir format:
# Just a file with the right basename
# Mostly to keep old tests happy, and because symlinks cost nothing.
# This is brittle because of expected file name conflicts
ln -sn ${drv} $filename || true
'')
(builtins.attrValues requiredDeps)
;
repository_cache = runCommand "bazel-repository-cache" { } command;
in
repository_cache
@@ -1,7 +0,0 @@
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
File diff suppressed because it is too large Load Diff
@@ -1,85 +0,0 @@
{
bazel
, bazel-examples
, bazelTest
, callPackage
, cctools
, darwin
, distDir
, extraBazelArgs ? ""
, Foundation ? null
, lib
, runLocal
, runtimeShell
, stdenv
, symlinkJoin
, writeScript
, writeText
}:
let
localDistDir = callPackage ./bazel-repository-cache.nix {
lockfile = ./cpp-test-MODULE.bazel.lock;
# Take all the rules_ deps, bazel_ deps and their transitive dependencies,
# but none of the platform-specific binaries, as they are large and useless.
requiredDepNamePredicate = name:
null == builtins.match ".*(macos|osx|linux|win|android|maven).*" name
&& null != builtins.match "(platforms|com_google_|protobuf|rules_|bazel_|apple_support).*" name;
};
mergedDistDir = symlinkJoin {
name = "mergedDistDir";
paths = [ localDistDir distDir ];
};
toolsBazel = writeScript "bazel" ''
#! ${runtimeShell}
export CXX='${stdenv.cc}/bin/clang++'
export LD='${cctools}/bin/ld'
export LIBTOOL='${cctools}/bin/libtool'
export CC='${stdenv.cc}/bin/clang'
# XXX: hack for macosX, this flags disable bazel usage of xcode
# See: https://github.com/bazelbuild/bazel/issues/4231
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
exec "$BAZEL_REAL" "$@"
'';
workspaceDir = runLocal "our_workspace" {} (''
cp -r ${bazel-examples}/cpp-tutorial/stage3 $out
find $out -type d -exec chmod 755 {} \;
cp ${./cpp-test-MODULE.bazel} $out/MODULE.bazel
cp ${./cpp-test-MODULE.bazel.lock} $out/MODULE.bazel.lock
echo > $out/WORSPACE
''
+ (lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir $out/tools
cp ${toolsBazel} $out/tools/bazel
''));
testBazel = bazelTest {
name = "bazel-test-cpp";
inherit workspaceDir;
bazelPkg = bazel;
bazelScript = ''
${bazel}/bin/bazel build //... \
--enable_bzlmod \
--verbose_failures \
--repository_cache=${mergedDistDir} \
--curses=no \
'' + lib.optionalString (stdenv.hostPlatform.isDarwin) ''
--cxxopt=-x --cxxopt=c++ \
--host_cxxopt=-x --host_cxxopt=c++ \
'' + lib.optionalString (stdenv.hostPlatform.isDarwin && Foundation != null) ''
--linkopt=-Wl,-F${Foundation}/Library/Frameworks \
--linkopt=-L${darwin.libobjc}/lib \
'' + ''
'';
};
in testBazel
@@ -718,16 +718,8 @@ stdenv.mkDerivation rec {
dontPatchELF = true;
passthru = {
# Additional tests that check bazels functionality. Execute
#
# nix-build . -A bazel_7.tests
#
# in the nixpkgs checkout root to exercise them locally.
# tests = callPackage ./tests.nix {
# inherit Foundation bazel_self lockfile repoCache;
# };
# TODO tests have not been updated yet and will likely need a rewrite
# tests = callPackage ./tests.nix { inherit Foundation bazelDeps bazel_self; };
# TODO add some tests to cover basic functionality, and also tests for enableNixHacks=true (buildBazelPackage tests)
# tests = ...
# For ease of debugging
inherit bazelDeps bazelFhs bazelBootstrap;
@@ -1,89 +0,0 @@
{ bazel
, bazelTest
, bazel-examples
, stdenv
, symlinkJoin
, callPackage
, cctools
, extraBazelArgs ? ""
, lib
, openjdk8
, jdk11_headless
, runLocal
, runtimeShell
, writeScript
, writeText
, repoCache ? "unused"
, distDir
}:
let
localDistDir = callPackage ./bazel-repository-cache.nix {
lockfile = ./cpp-test-MODULE.bazel.lock;
# Take all the rules_ deps, bazel_ deps and their transitive dependencies,
# but none of the platform-specific binaries, as they are large and useless.
requiredDepNamePredicate = name:
null == builtins.match ".*(macos|osx|linux|win|apple|android|maven).*" name
&& null != builtins.match "(platforms|com_google_|protobuf|rules_|bazel_).*" name ;
};
mergedDistDir = symlinkJoin {
name = "mergedDistDir";
paths = [ localDistDir distDir ];
};
toolsBazel = writeScript "bazel" ''
#! ${runtimeShell}
export CXX='${stdenv.cc}/bin/clang++'
export LD='${cctools}/bin/ld'
export LIBTOOL='${cctools}/bin/libtool'
export CC='${stdenv.cc}/bin/clang'
# XXX: hack for macosX, this flags disable bazel usage of xcode
# See: https://github.com/bazelbuild/bazel/issues/4231
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
exec "$BAZEL_REAL" "$@"
'';
workspaceDir = runLocal "our_workspace" {} (''
cp -r ${bazel-examples}/java-tutorial $out
find $out -type d -exec chmod 755 {} \;
cp ${./cpp-test-MODULE.bazel} $out/MODULE.bazel
cp ${./cpp-test-MODULE.bazel.lock} $out/MODULE.bazel.lock
''
+ (lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir $out/tools
cp ${toolsBazel} $out/tools/bazel
''));
testBazel = bazelTest {
name = "bazel-test-java";
inherit workspaceDir;
bazelPkg = bazel;
buildInputs = [ (if lib.strings.versionOlder bazel.version "5.0.0" then openjdk8 else jdk11_headless) ];
bazelScript = ''
${bazel}/bin/bazel \
run \
--announce_rc \
${lib.optionalString (lib.strings.versionOlder "5.0.0" bazel.version)
"--toolchain_resolution_debug='@bazel_tools//tools/jdk:(runtime_)?toolchain_type'"
} \
--distdir=${mergedDistDir} \
--repository_cache=${mergedDistDir} \
--verbose_failures \
--curses=no \
--strict_java_deps=off \
//:ProjectRunner \
'' + lib.optionalString (lib.strings.versionOlder bazel.version "5.0.0") ''
--host_javabase='@local_jdk//:jdk' \
--java_toolchain='@bazel_tools//tools/jdk:toolchain_hostjdk8' \
--javabase='@local_jdk//:jdk' \
'' + extraBazelArgs;
};
in testBazel
@@ -1,166 +0,0 @@
{ bazel
, Foundation
, bazelTest
, callPackage
, cctools
, darwin
, distDir
, extraBazelArgs ? ""
, fetchurl
, jdk11_headless
, lib
, libtool
, lndir
, openjdk8
, repoCache
, runLocal
, runtimeShell
, stdenv
, symlinkJoin
, tree
, writeScript
, writeText
}:
# This test uses bzlmod because I could not make it work without it.
# This is good, because we have at least one test with bzlmod enabled.
# However, we have to create our own lockfile, wich is quite a big file by
# itself.
let
# To update the lockfile, run
# $ nix-shell -A bazel_7.tests.vanilla.protobuf
# [nix-shell]$ genericBuild # (wait a bit for failure, or kill it)
# [nix-shell]$ rm -f MODULE.bazel.lock
# [nix-shell]$ bazel mod deps --lockfile_mode=update
# [nix-shell]$ cp MODULE.bazel.lock $HERE/protobuf-test.MODULE.bazel.lock
lockfile = ./protobuf-test.MODULE.bazel.lock;
protobufRepoCache = callPackage ./bazel-repository-cache.nix {
# We are somewhat lucky that bazel's own lockfile works for our tests.
# Use extraDeps if the tests need things that are not in that lockfile.
# But most test dependencies are bazel's builtin deps, so that at least aligns.
inherit lockfile;
# Remove platform-specific binaries, as they are large and useless.
requiredDepNamePredicate = name:
null == builtins.match ".*(macos|osx|linux|win|android|maven).*" name;
};
mergedRepoCache = symlinkJoin {
name = "mergedDistDir";
paths = [ protobufRepoCache distDir ];
};
MODULE = writeText "MODULE.bazel" ''
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "protobuf", version = "21.7")
bazel_dep(name = "zlib", version = "1.3")
'';
WORKSPACE = writeText "WORKSPACE" ''
# Empty, we use bzlmod instead
'';
personProto = writeText "person.proto" ''
syntax = "proto3";
package person;
message Person {
string name = 1;
int32 id = 2;
string email = 3;
}
'';
personBUILD = writeText "BUILD" ''
load("@rules_proto//proto:defs.bzl", "proto_library")
proto_library(
name = "person_proto",
srcs = ["person.proto"],
visibility = ["//visibility:public"],
)
java_proto_library(
name = "person_java_proto",
deps = [":person_proto"],
)
cc_proto_library(
name = "person_cc_proto",
deps = [":person_proto"],
)
'';
toolsBazel = writeScript "bazel" ''
#! ${runtimeShell}
export CXX='${stdenv.cc}/bin/clang++'
export LD='${cctools}/bin/ld'
export LIBTOOL='${cctools}/bin/libtool'
export CC='${stdenv.cc}/bin/clang'
# XXX: hack for macosX, this flags disable bazel usage of xcode
# See: https://github.com/bazelbuild/bazel/issues/4231
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
export HOMEBREW_RUBY_PATH="foo"
exec "$BAZEL_REAL" "$@"
'';
workspaceDir = runLocal "our_workspace" { } (''
mkdir $out
cp ${MODULE} $out/MODULE.bazel
cp ${./protobuf-test.MODULE.bazel.lock} $out/MODULE.bazel.lock
#cp ${WORKSPACE} $out/WORKSPACE
touch $out/WORKSPACE
touch $out/BUILD.bazel
mkdir $out/person
cp ${personProto} $out/person/person.proto
cp ${personBUILD} $out/person/BUILD.bazel
''
+ (lib.optionalString stdenv.hostPlatform.isDarwin ''
echo 'tools bazel created'
mkdir $out/tools
install ${toolsBazel} $out/tools/bazel
''));
testBazel = bazelTest {
name = "bazel-test-protocol-buffers";
inherit workspaceDir;
bazelPkg = bazel;
buildInputs = [
(if lib.strings.versionOlder bazel.version "5.0.0" then openjdk8 else jdk11_headless)
tree
bazel
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
Foundation
darwin.objc4
];
bazelScript = ''
${bazel}/bin/bazel \
build \
--repository_cache=${mergedRepoCache} \
${extraBazelArgs} \
--enable_bzlmod \
--lockfile_mode=error \
--verbose_failures \
//... \
'' + lib.optionalString (lib.strings.versionOlder bazel.version "5.0.0") ''
--host_javabase='@local_jdk//:jdk' \
--java_toolchain='@bazel_tools//tools/jdk:toolchain_hostjdk8' \
--javabase='@local_jdk//:jdk' \
'' + lib.optionalString (stdenv.hostPlatform.isDarwin) ''
--cxxopt=-x --cxxopt=c++ --host_cxxopt=-x --host_cxxopt=c++ \
'' + ''
'';
};
in
testBazel
@@ -1,21 +0,0 @@
diff --git a/src/main/starlark/builtins_bzl/common/java/proto/java_proto_library.bzl b/src/main/starlark/builtins_bzl/common/java/proto/java_proto_library.bzl
index e2118aabea..6a33f03472 100644
--- a/src/main/starlark/builtins_bzl/common/java/proto/java_proto_library.bzl
+++ b/src/main/starlark/builtins_bzl/common/java/proto/java_proto_library.bzl
@@ -117,6 +117,7 @@ def java_compile_for_protos(ctx, output_jar_suffix, source_jar = None, deps = []
deps = deps,
exports = exports,
output_source_jar = source_jar,
+ strict_deps = ctx.fragments.proto.strict_proto_deps(),
injecting_rule_kind = injecting_rule_kind,
javac_opts = java_toolchain.compatible_javacopts("proto"),
enable_jspecify = False,
@@ -140,7 +141,7 @@ bazel_java_proto_aspect = aspect(
attr_aspects = ["deps", "exports"],
required_providers = [ProtoInfo],
provides = [JavaInfo, JavaProtoAspectInfo],
- fragments = ["java"],
+ fragments = ["java", "proto"],
)
def bazel_java_proto_library_rule(ctx):
@@ -1,173 +0,0 @@
{ lib
# tooling
, callPackage
, fetchFromGitHub
, newScope
, recurseIntoAttrs
, runCommandCC
, stdenv
# inputs
, Foundation
, bazel_self
, lr
, xe
, lockfile
, ...
}:
let
inherit (stdenv.hostPlatform) isDarwin;
testsDistDir = testsRepoCache;
testsRepoCache = callPackage ./bazel-repository-cache.nix {
# Bazel builtin tools versions are hard-coded in bazel. If the project
# lockfile has not been generated by the same bazel version as this one
# then it may be missing depeendencies for builtin tools. Export
# dependencies from baazel itself here, and let projects also import their
# own if need be. It's just a symlinkJoin after all. See ./cpp-test.nix
inherit lockfile;
# Take all the rules_ deps, bazel_ deps and their transitive dependencies,
# but none of the platform-specific binaries, as they are large and useless.
requiredDepNamePredicate = name:
name == "_main~bazel_build_deps~workspace_repo_cache"
|| null == builtins.match ".*(macos|osx|linux|win|android|maven).*" name
&& null != builtins.match "(platforms|com_google_|protobuf|rules_|.*bazel_|apple_support).*" name;
};
runLocal = name: attrs: script:
let
attrs' = removeAttrs attrs [ "buildInputs" ];
buildInputs = attrs.buildInputs or [ ];
in
runCommandCC name
({
inherit buildInputs;
preferLocalBuild = true;
meta.platforms = bazel_self.meta.platforms;
} // attrs')
script;
# bazel wants to extract itself into $install_dir/install every time it runs,
# so lets do that only once.
extracted = bazelPkg:
let
install_dir =
# `install_base` field printed by `bazel info`, minus the hash.
# yes, this path is kinda magic. Sorry.
"$HOME/.cache/bazel/_bazel_nixbld";
in
runLocal "bazel-extracted-homedir" { passthru.install_dir = install_dir; } ''
export HOME=$(mktemp -d)
touch WORKSPACE # yeah, everything sucks
install_base="$(${bazelPkg}/bin/bazel info install_base)"
# assert its actually below install_dir
[[ "$install_base" =~ ${install_dir} ]] \
|| (echo "oh no! $install_base but we are \
trying to copy ${install_dir} to $out instead!"; exit 1)
cp -R ${install_dir} $out
'';
bazelTest = { name, bazelScript, workspaceDir, bazelPkg, buildInputs ? [ ] }:
runLocal name
{
inherit buildInputs;
# Necessary for the tests to pass on Darwin with sandbox enabled.
__darwinAllowLocalNetworking = true;
}
''
# Bazel needs a real home for self-extraction and internal cache
mkdir bazel_home
export HOME=$PWD/bazel_home
${# Concurrent bazel invocations have the same workspace path.
# On darwin, for some reason, it means they access and corrupt the
# same outputRoot, outputUserRoot and outputBase
# Ensure they use build-local outputRoot by setting TEST_TMPDIR
lib.optionalString isDarwin ''
export TEST_TMPDIR=$HOME/.cache/bazel
''
}
${# Speed-up tests by caching bazel extraction.
# Except on Darwin, because nobody knows how Darwin works.
let bazelExtracted = extracted bazelPkg;
in lib.optionalString (!isDarwin) ''
mkdir -p ${bazelExtracted.install_dir}
cp -R ${bazelExtracted}/install ${bazelExtracted.install_dir}
# https://stackoverflow.com/questions/47775668/bazel-how-to-skip-corrupt-installation-on-centos6
# Bazel checks whether the mtime of the install dir files
# is >9 years in the future, otherwise it extracts itself again.
# see PosixFileMTime::IsUntampered in src/main/cpp/util
# What the hell bazel.
${lr}/bin/lr -0 -U ${bazelExtracted.install_dir} | ${xe}/bin/xe -N0 -0 touch --date="9 years 6 months" {}
''
}
${# Note https://github.com/bazelbuild/bazel/issues/5763#issuecomment-456374609
# about why to create a subdir for the workspace.
''cp -r ${workspaceDir} wd && chmod ug+rw -R wd && cd wd''
}
${# run the actual test snippet
bazelScript
}
${# Try to keep darwin clean of our garbage
lib.optionalString isDarwin ''
rm -rf $HOME || true
''
}
touch $out
'';
bazel-examples = fetchFromGitHub {
owner = "bazelbuild";
repo = "examples";
rev = "93564e1f1e7a3c39d6a94acee12b8d7b74de3491";
hash = "sha256-DaPKp7Sn5uvfZRjdDx6grot3g3B7trqCyL0TRIdwg98=";
};
callBazelTests = bazel:
let
callBazelTest = newScope {
inherit runLocal bazelTest bazel-examples;
inherit Foundation;
inherit bazel;
distDir = testsDistDir;
extraBazelArgs = "--noenable_bzlmod";
repoCache = testsRepoCache;
};
in
recurseIntoAttrs (
(lib.optionalAttrs (!isDarwin) {
# `extracted` doesnt work on darwin
shebang = callBazelTest ../shebang-test.nix {
inherit extracted;
extraBazelArgs = "--noenable_bzlmod";
};
}) // {
bashTools = callBazelTest ../bash-tools-test.nix { };
cpp = callBazelTest ./cpp-test.nix {
extraBazelArgs = "";
};
java = callBazelTest ./java-test.nix { };
pythonBinPath = callBazelTest ../python-bin-path-test.nix { };
protobuf = callBazelTest ./protobuf-test.nix { };
}
);
bazelWithNixHacks = bazel_self.override { enableNixHacks = true; };
in
recurseIntoAttrs {
distDir = testsDistDir;
testsRepoCache = testsRepoCache;
vanilla = callBazelTests bazel_self;
withNixHacks = callBazelTests bazelWithNixHacks;
# add some downstream packages using buildBazelPackage
downstream = recurseIntoAttrs ({
# TODO: fix bazel-watcher build with bazel 7, or find other packages
#inherit bazel-watcher;
});
}
@@ -1,17 +0,0 @@
diff --git a/tools/cpp/osx_cc_wrapper.sh.tpl b/tools/cpp/osx_cc_wrapper.sh.tpl
index 8264090c29..b7b9e8537a 100644
--- a/tools/cpp/osx_cc_wrapper.sh.tpl
+++ b/tools/cpp/osx_cc_wrapper.sh.tpl
@@ -64,7 +64,11 @@ done
%{env}
# Call the C++ compiler
-%{cc} "$@"
+if [[ ${*: -1} = "" ]]; then
+ %{cc} "${@:0:$#}"
+else
+ %{cc} "$@"
+fi
function get_library_path() {
for libdir in ${LIB_DIRS}; do