mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
Merge pull request #180251 from avdv/bazel-watcher-0.16.2
bazel-watcher: 0.14.0 -> 0.17.0 & fix on Darwin
This commit is contained in:
commit
886d2294d2
6 changed files with 44 additions and 11 deletions
|
@ -1,4 +1,5 @@
|
||||||
{ buildBazelPackage
|
{ buildBazelPackage
|
||||||
|
, bazel_5
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, git
|
, git
|
||||||
, go
|
, go
|
||||||
|
@ -10,28 +11,49 @@ let
|
||||||
patches = [
|
patches = [
|
||||||
./use-go-in-path.patch
|
./use-go-in-path.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Patch the protoc alias so that it always builds from source.
|
||||||
|
rulesProto = fetchFromGitHub {
|
||||||
|
owner = "bazelbuild";
|
||||||
|
repo = "rules_proto";
|
||||||
|
rev = "4.0.0-3.19.2";
|
||||||
|
sha256 = "sha256-wdmp+Tmf63PPr7G4X5F7rDas45WEETU3eKb47PFVI6o=";
|
||||||
|
postFetch = ''
|
||||||
|
sed -i 's|name = "protoc"|name = "_protoc_original"|' $out/proto/private/BUILD.release
|
||||||
|
cat <<EOF >>$out/proto/private/BUILD.release
|
||||||
|
alias(name = "protoc", actual = "@com_github_protocolbuffers_protobuf//:protoc", visibility = ["//visibility:public"])
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
buildBazelPackage rec {
|
buildBazelPackage rec {
|
||||||
pname = "bazel-watcher";
|
pname = "bazel-watcher";
|
||||||
version = "0.14.0";
|
version = "0.17.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "bazelbuild";
|
owner = "bazelbuild";
|
||||||
repo = "bazel-watcher";
|
repo = "bazel-watcher";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "0gigl1lg8sb4bj5crvj54329ws4yirldbncs15f96db6vhp0ig7r";
|
sha256 = "sha256-aK18Q2nYxYajk9f/EEmtV7YJ8cYqbamR7vh3BTgu53Q=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ go git python3 ];
|
nativeBuildInputs = [ go git python3 ];
|
||||||
removeRulesCC = false;
|
removeRulesCC = false;
|
||||||
|
|
||||||
|
bazel = bazel_5;
|
||||||
|
bazelFlags = [ "--override_repository=rules_proto=${rulesProto}" ];
|
||||||
|
bazelBuildFlags = lib.optionals stdenv.cc.isClang [ "--cxxopt=-x" "--cxxopt=c++" "--host_cxxopt=-x" "--host_cxxopt=c++" ];
|
||||||
bazelTarget = "//ibazel";
|
bazelTarget = "//ibazel";
|
||||||
|
|
||||||
|
fetchConfigured = false; # we want to fetch all dependencies, regardless of the current system
|
||||||
fetchAttrs = {
|
fetchAttrs = {
|
||||||
inherit patches;
|
inherit patches;
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
patchShebangs .
|
patchShebangs .
|
||||||
|
|
||||||
|
echo ${bazel_5.version} > .bazelversion
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preInstall = ''
|
preInstall = ''
|
||||||
|
@ -54,9 +76,12 @@ buildBazelPackage rec {
|
||||||
# should be equivalent.
|
# should be equivalent.
|
||||||
rm -rf $bazelOut/external/{bazel_gazelle_go_repository_tools,\@bazel_gazelle_go_repository_tools.marker}
|
rm -rf $bazelOut/external/{bazel_gazelle_go_repository_tools,\@bazel_gazelle_go_repository_tools.marker}
|
||||||
sed -e '/^FILE:@bazel_gazelle_go_repository_tools.*/d' -i $bazelOut/external/\@*.marker
|
sed -e '/^FILE:@bazel_gazelle_go_repository_tools.*/d' -i $bazelOut/external/\@*.marker
|
||||||
|
|
||||||
|
# remove com_google_protobuf because it had files with different permissions on linux and darwin
|
||||||
|
rm -rf $bazelOut/external/com_google_protobuf
|
||||||
'';
|
'';
|
||||||
|
|
||||||
sha256 = "1j175z3d4fbi4pl35py7yjq7ywrvwin6id131jv32hx0ck4g1m46";
|
sha256 = "sha256-R+Hc9ldYcKgAXETKr2+Hk7IrjJ93WkrjyJ1SQRoM9V4=";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildAttrs = {
|
buildAttrs = {
|
||||||
|
@ -66,10 +91,11 @@ buildBazelPackage rec {
|
||||||
patchShebangs .
|
patchShebangs .
|
||||||
|
|
||||||
substituteInPlace ibazel/BUILD --replace '{STABLE_GIT_VERSION}' ${version}
|
substituteInPlace ibazel/BUILD --replace '{STABLE_GIT_VERSION}' ${version}
|
||||||
|
echo ${bazel_5.version} > .bazelversion
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
install -Dm755 bazel-bin/ibazel/*_pure_stripped/ibazel $out/bin/ibazel
|
install -Dm755 bazel-bin/ibazel/ibazel_/ibazel $out/bin/ibazel
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,8 +104,7 @@ buildBazelPackage rec {
|
||||||
description = "Tools for building Bazel targets when source files change";
|
description = "Tools for building Bazel targets when source files change";
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
maintainers = with maintainers; [ kalbasit ];
|
maintainers = with maintainers; [ kalbasit ];
|
||||||
|
mainProgram = "ibazel";
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
# broken on darwin, see https://github.com/NixOS/nixpkgs/issues/105573
|
|
||||||
broken = stdenv.isDarwin;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ index 51273b6..fcf9ffb 100644
|
||||||
|
|
||||||
go_rules_dependencies()
|
go_rules_dependencies()
|
||||||
|
|
||||||
-go_register_toolchains()
|
-go_register_toolchains(version = "1.17.6")
|
||||||
+go_register_toolchains(go_version = "host")
|
+go_register_toolchains(go_version = "host")
|
||||||
|
|
||||||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
|
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
|
||||||
|
|
|
@ -110,7 +110,9 @@ let
|
||||||
# and libraries path.
|
# and libraries path.
|
||||||
# We prefetch it, patch it, and override it in a global bazelrc.
|
# We prefetch it, patch it, and override it in a global bazelrc.
|
||||||
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
|
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
|
||||||
arch = stdenv.hostPlatform.parsed.cpu.name;
|
|
||||||
|
# on aarch64 Darwin, `uname -m` returns "arm64"
|
||||||
|
arch = with stdenv.hostPlatform; if isDarwin && isAarch64 then "arm64" else parsed.cpu.name;
|
||||||
|
|
||||||
remote_java_tools = stdenv.mkDerivation {
|
remote_java_tools = stdenv.mkDerivation {
|
||||||
name = "remote_java_tools_${system}";
|
name = "remote_java_tools_${system}";
|
||||||
|
|
|
@ -135,7 +135,9 @@ let
|
||||||
# and libraries path.
|
# and libraries path.
|
||||||
# We prefetch it, patch it, and override it in a global bazelrc.
|
# We prefetch it, patch it, and override it in a global bazelrc.
|
||||||
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
|
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
|
||||||
arch = stdenv.hostPlatform.parsed.cpu.name;
|
|
||||||
|
# on aarch64 Darwin, `uname -m` returns "arm64"
|
||||||
|
arch = with stdenv.hostPlatform; if isDarwin && isAarch64 then "arm64" else parsed.cpu.name;
|
||||||
|
|
||||||
remote_java_tools = stdenv.mkDerivation {
|
remote_java_tools = stdenv.mkDerivation {
|
||||||
name = "remote_java_tools_${system}";
|
name = "remote_java_tools_${system}";
|
||||||
|
|
|
@ -126,7 +126,9 @@ let
|
||||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||||
|
|
||||||
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
|
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
|
||||||
arch = stdenv.hostPlatform.parsed.cpu.name;
|
|
||||||
|
# on aarch64 Darwin, `uname -m` returns "arm64"
|
||||||
|
arch = with stdenv.hostPlatform; if isDarwin && isAarch64 then "arm64" else parsed.cpu.name;
|
||||||
|
|
||||||
bazelRC = writeTextFile {
|
bazelRC = writeTextFile {
|
||||||
name = "bazel-rc";
|
name = "bazel-rc";
|
||||||
|
|
|
@ -15398,7 +15398,9 @@ with pkgs;
|
||||||
|
|
||||||
bazel-remote = callPackage ../development/tools/build-managers/bazel/bazel-remote { };
|
bazel-remote = callPackage ../development/tools/build-managers/bazel/bazel-remote { };
|
||||||
|
|
||||||
bazel-watcher = callPackage ../development/tools/bazel-watcher { };
|
bazel-watcher = callPackage ../development/tools/bazel-watcher {
|
||||||
|
go = go_1_18;
|
||||||
|
};
|
||||||
|
|
||||||
bazel-gazelle = callPackage ../development/tools/bazel-gazelle { };
|
bazel-gazelle = callPackage ../development/tools/bazel-gazelle { };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue