Whenever I switch between running commands on the shell and syncing on Intellij I see logs pertaining to compiling protobufs. It only happens on the first command run or sync. Thereafter, I can only assume Bazel is using a cache.
26 / 245] Compiling external/com_google_protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc [for host]; 1s darwin-sandbox ... (4 actions, 3 running)
[32 / 245] Compiling external/com_google_protobuf/src/google/protobuf/generated_message_util.cc [for host]; 4s darwin-sandbox ... (4 actions, 3 running)
[41 / 245] Compiling external/com_google_protobuf/src/google/protobuf/generated_message_util.cc [for host]; 7s darwin-sandbox ... (4 actions, 3 running)
[45 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc [for host]; 3s darwin-sandbox ... (4 actions running)
[49 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/python/python_generator.cc [for host]; 7s darwin-sandbox ... (4 actions, 3 running)
[53 / 245] Compiling external/com_google_protobuf/src/google/protobuf/repeated_field.cc [for host]; 6s darwin-sandbox ... (4 actions, 3 running)
[64 / 245] Compiling external/com_google_protobuf/src/google/protobuf/generated_message_table_driven_lite.cc [for host]; 4s darwin-sandbox ... (4 actions, 3 running)
[73 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc [for host]; 3s darwin-sandbox ... (4 actions, 3 running)
[81 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc [for host]; 8s darwin-sandbox ... (4 actions, 3 running)
[91 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/java/java_helpers.cc [for host]; 2s darwin-sandbox ... (4 actions, 3 running)
[101 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/js/js_generator.cc [for host]; 5s darwin-sandbox ... (4 actions, 3 running)
[110 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/plugin.cc [for host]; 2s darwin-sandbox ... (4 actions running)
[125 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/java/java_map_field_lite.cc [for host]; 2s darwin-sandbox ... (4 actions running)
[136 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc [for host]; 8s darwin-sandbox ... (4 actions running)
[140 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc [for host]; 6s darwin-sandbox ... (4 actions running)
[153 / 245] Compiling external/com_google_protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc [for host]; 11s darwin-sandbox ... (4 actions running)
[172 / 245] Compiling external/com_google_protobuf/src/google/protobuf/descriptor.pb.cc [for host]; 13s darwin-sandbox ... (4 actions running)
[250 / 352] Compiling external/com_google_protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc [for host]; 4s darwin-sandbox ... (4 actions, 3 running)
I'd expect Bazel to not have to re-compile protobufs every time.
Bazel version:
Build label: 0.29.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Aug 28 14:37:40 2019 (1567003060)
Build timestamp: 1567003060
Build timestamp as int: 1567003060
Plugin version: 2019.08.19.0.5
This could be due to a different PATH between IJ and the CLI shell.
See https://github.com/bazelbuild/bazel/issues/7095
Try adding --incompatible_strict_action_env into your .bazelrc, and see if that'll work.
my .bazelrc file in my project looks like this:
test --test_output=all
--incompatible_strict_action_env
alas, the problem persists
@KaoruDev try add this lines in your project .bazelrc:
build --incompatible_strict_action_env
run --incompatible_strict_action_env
@asv yep, that did it! thanks!
Most helpful comment
@KaoruDev try add this lines in your project .bazelrc: