Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache to prebuild #4

Merged
merged 3 commits into from
Oct 13, 2023
Merged
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
69 changes: 69 additions & 0 deletions .devcontainer/build-caches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

# generate java BUILD file
cat > java/src/main/java/bazel/bootcamp/BUILD <<EOF
java_binary(
name = "HelloBazelBootcamp",
srcs = ["HelloBazelBootcamp.java"],
)

java_library(
name = "JavaLoggingClientLibrary",
srcs = ["JavaLoggingClientLibrary.java"],
deps = [
"//proto/logger:logger_java_proto",
"//proto/logger:logger_java_grpc",
"@io_grpc_grpc_java//core",
"@io_grpc_grpc_java//netty",
]
)

java_binary(
name = "JavaLoggingClient",
srcs = ["JavaLoggingClient.java"],
deps = [":JavaLoggingClientLibrary"],
visibility = ["//visibility:public"]
)

java_test(
name = "JavaLoggingClientLibraryTest",
srcs = ["JavaLoggingClientLibraryTest.java"],
deps = [":JavaLoggingClientLibrary"]
)

java_test(
name = "JavaLoggingClientTest",
srcs = ["JavaLoggingClientTest.java"],
deps = [":JavaLoggingClient"]
)
EOF


# generate proto BUILD file
cat > proto/logger/BUILD <<EOF

package(default_visibility = ["//visibility:public"])

load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library")

proto_library(
name = "logger_proto",
srcs = ["logger.proto"]
)

java_proto_library(
name = "logger_java_proto",
deps = [":logger_proto"]
)

java_grpc_library(
name = "logger_java_grpc",
srcs = [":logger_proto"],
deps = [":logger_java_proto"],
)
EOF

bazel run //:gazelle
bazel build //...
git reset --hard
git clean -f
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"ghcr.io/balazs23/devcontainers-features/bazel:1.0.1": {
"bazelisk": "v1.15.0"
}
}
},
"onCreateCommand": "bash .devcontainer/build-caches.sh"
}
24 changes: 0 additions & 24 deletions generate_build_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,30 +79,6 @@ sh_test(
)
EOF


cat > typescript/BUILD <<EOF
# FIXME(alexeagle)
# load("@npm_bazel_typescript//:index.bzl", "ts_library", "ts_devserver")

# ts_devserver(
# name = "devserver",
# bootstrap = ["@npm_bazel_typescript//:protobufjs_bootstrap_scripts"],
# entry_module = "bootcamp/typescript/app",
# port = 8088,
# deps = [":app"],
# )

# ts_library(
# name = "app",
# srcs = ["app.ts"],
# deps = [
# "//proto/logger:logger_ts_proto",
# ],
# )

# exports_files(["tsconfig.json"])
EOF

# write WORKSPACE file
${SHELL} ./generate_workspace.sh

Expand Down