2021-10-28 06:52:43 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, protobuf }:
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "protoc-gen-grpc-web";
|
2022-03-10 19:12:11 +00:00
|
|
|
version = "1.3.1";
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "grpc";
|
|
|
|
repo = "grpc-web";
|
|
|
|
rev = version;
|
2022-03-10 19:12:11 +00:00
|
|
|
sha256 = "sha256-NRShN4X9JmCjqPVY/q9oSxSOvv1bP//vM9iOZ6ap5vc=";
|
2021-08-05 21:33:18 +00:00
|
|
|
};
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
sourceRoot = "source/javascript/net/grpc/web/generator";
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
strictDeps = true;
|
|
|
|
nativeBuildInputs = [ protobuf ];
|
|
|
|
buildInputs = [ protobuf ];
|
|
|
|
|
2022-03-10 19:12:11 +00:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "STATIC=no" ];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# https://github.com/grpc/grpc-web/pull/1210
|
|
|
|
./optional-static.patch
|
|
|
|
];
|
2021-08-05 21:33:18 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
doCheck = true;
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ protobuf ];
|
2021-10-28 06:52:43 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
CHECK_TMPDIR="$TMPDIR/proto"
|
|
|
|
mkdir -p "$CHECK_TMPDIR"
|
|
|
|
|
|
|
|
protoc \
|
|
|
|
--proto_path="${src}/packages/grpc-web/test/protos" \
|
|
|
|
--plugin="./protoc-gen-grpc-web" \
|
|
|
|
--grpc-web_out="import_style=commonjs,mode=grpcwebtext:$CHECK_TMPDIR" \
|
|
|
|
echo.proto
|
|
|
|
|
|
|
|
# check for grpc-web generated file
|
|
|
|
[ -f "$CHECK_TMPDIR/echo_grpc_web_pb.js" ]
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/grpc/grpc-web";
|
|
|
|
changelog = "https://github.com/grpc/grpc-web/blob/${version}/CHANGELOG.md";
|
|
|
|
description = "gRPC web support for Google's protocol buffers";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ jk ];
|
2021-10-28 06:52:43 +00:00
|
|
|
platforms = platforms.unix;
|
2021-08-05 21:33:18 +00:00
|
|
|
};
|
|
|
|
}
|