Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bazel-my-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
uses: ./

- name: bazel build
run: bazelisk build --remote_cache=http://localhost:3055 //...
run: bazelisk build --remote_cache=grpcs://localhost:4000 //...
73 changes: 71 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,32 @@ load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("//:node_modules/protoc-gen-ts/index.bzl", "ts_proto_library")

npm_link_all_packages(name = "node_modules")

ts_project(
name = "main",
srcs = [
"src/ActionsCache.ts",
"src/GrpcServer_patched.ts",
"src/HttpServer.ts",
"src/main.ts",
"src/main_patched.ts",
],
declaration = True,
deps = [
":remote_execution_ts",
"//:node_modules/@actions/core",
"//:node_modules/@actions/http-client",
"//:node_modules/@grpc/grpc-js",
"//:node_modules/@types/node",
],
)

esbuild(
name = "main_bundle",
srcs = [":main"],
entry_point = "src/main.js",
entry_point = "src/main_patched.js",
minify = True,
platform = "node",
sourcemap = "external",
Expand All @@ -32,3 +37,67 @@ write_source_files(
name = "dist",
files = {"dist/main.js": ":main_bundle.js"},
)

genrule(
name = "patch_bazel-bin",
srcs = ["src/GrpcServer.ts"],
outs = ["src/GrpcServer_patched.ts"],
cmd = "cat $< | sed -e 's!bazel-bin/!!' > $@",
)

genrule(
name = "patch2",
srcs = ["src/main.ts"],
outs = ["src/main_patched.ts"],
cmd = "cat $< | sed -e 's/GrpcServer/GrpcServer_patched/' > $@",
)

ts_proto_library(
name = "remote_execution_ts_proto",
outs = [
"build/bazel/remote/execution/v2/remote_execution.ts",
"build/bazel/semver/semver.ts",
"google/api/annotations.ts",
"google/api/http.ts",
"google/longrunning/operations.ts",
"google/protobuf/any.ts",
"google/protobuf/descriptor.ts",
"google/protobuf/duration.ts",
"google/protobuf/empty.ts",
"google/protobuf/timestamp.ts",
"google/protobuf/wrappers.ts",
"google/rpc/status.ts",
],
deps = [
"@remote_apis//build/bazel/remote/execution/v2:remote_execution_proto",
],
)

ts_project(
name = "remote_execution_ts",
srcs = [
"build/bazel/remote/execution/v2/remote_execution.ts",
"build/bazel/semver/semver.ts",
"google/api/annotations.ts",
"google/api/http.ts",
"google/longrunning/operations.ts",
"google/protobuf/any.ts",
"google/protobuf/descriptor.ts",
"google/protobuf/duration.ts",
"google/protobuf/empty.ts",
"google/protobuf/timestamp.ts",
"google/protobuf/wrappers.ts",
"google/rpc/status.ts",
],
declaration = True,
extends = "tsconfig.json",
tsconfig = {
"compilerOptions": {
"strict": False,
},
},
deps = [
"//:node_modules/@grpc/grpc-js",
"//:node_modules/@types/google-protobuf",
],
)
27 changes: 27 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,30 @@ esbuild_register_toolchains(
name = "esbuild",
esbuild_version = LATEST_VERSION,
)

http_archive(
name = "com_github_grpc_grpc",
sha256 = "b391a327429279f6f29b9ae7e5317cd80d5e9d49cc100e6d682221af73d984a6",
strip_prefix = "grpc-93e8830070e9afcbaa992c75817009ee3f4b63a0", # v1.24.3 with fixes
urls = ["https://github.com/grpc/grpc/archive/93e8830070e9afcbaa992c75817009ee3f4b63a0.zip"],
)

# Pull in all gRPC dependencies.
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()

http_archive(
name = "remote_apis",
sha256 = "d242ff05ab0fe97a8d4c75cef0a518701abf6c01093050108553a0b60c931f68",
strip_prefix = "remote-apis-3a21deee813d0b98aaeef9737c720e509e10dc8b",
url = "https://github.com/bazelbuild/remote-apis/archive/3a21deee813d0b98aaeef9737c720e509e10dc8b.zip",
)

http_archive(
name = "googleapis",
build_file = "@remote_apis//:external/BUILD.googleapis",
sha256 = "7b6ea252f0b8fb5cd722f45feb83e115b689909bbb6a393a873b6cbad4ceae1d",
strip_prefix = "googleapis-143084a2624b6591ee1f9d23e7f5241856642f4d",
urls = ["https://github.com/googleapis/googleapis/archive/143084a2624b6591ee1f9d23e7f5241856642f4d.zip"],
)
63 changes: 57 additions & 6 deletions dist/main.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
"license": "MIT",
"devDependencies": {
"@tsconfig/node16": "^1.0.3",
"@types/google-protobuf": "^3.15.6",
"@types/node": "^18.6.2",
"protoc-gen-ts": "^0.8.6-rc1",
"typescript": "4.7.4"
},
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/http-client": "^2.0.1"
"@actions/http-client": "^2.0.1",
"@grpc/grpc-js": "^1.7.3",
"google-protobuf": "^3.13.0"
}
}
Loading