Add test workspace that uses both strip_import_prefix and import_prefix
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index a767a6a..f766d48 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml
@@ -2483,6 +2483,48 @@ test_targets: - "//..." working_directory: test_workspaces/absolute_strip_import_prefix + test_workspace_combined_strip_and_add_prefix_ubuntu1804: + name: 'test workspace: combined_strip_and_add_prefix' + bazel: last_green + platform: ubuntu1804 + test_flags: + - "--test_output=errors" + - "--incompatible_disable_proto_source_root" + - "--incompatible_load_python_rules_from_bzl" + - "--incompatible_load_cc_rules_from_bzl" + - "--incompatible_load_proto_rules_from_bzl" + - "--incompatible_load_java_rules_from_bzl" + test_targets: + - "//..." + working_directory: test_workspaces/combined_strip_and_add_prefix + test_workspace_combined_strip_and_add_prefix_windows: + name: 'test workspace: combined_strip_and_add_prefix' + bazel: last_green + platform: windows + test_flags: + - "--test_output=errors" + - "--incompatible_disable_proto_source_root" + - "--incompatible_load_python_rules_from_bzl" + - "--incompatible_load_cc_rules_from_bzl" + - "--incompatible_load_proto_rules_from_bzl" + - "--incompatible_load_java_rules_from_bzl" + test_targets: + - "//..." + working_directory: test_workspaces/combined_strip_and_add_prefix + test_workspace_combined_strip_and_add_prefix_macos: + name: 'test workspace: combined_strip_and_add_prefix' + bazel: last_green + platform: macos + test_flags: + - "--test_output=errors" + - "--incompatible_disable_proto_source_root" + - "--incompatible_load_python_rules_from_bzl" + - "--incompatible_load_cc_rules_from_bzl" + - "--incompatible_load_proto_rules_from_bzl" + - "--incompatible_load_java_rules_from_bzl" + test_targets: + - "//..." + working_directory: test_workspaces/combined_strip_and_add_prefix test_workspace_exclusions_ubuntu1804: name: 'test workspace: exclusions' bazel: last_green
diff --git a/test_workspaces/Makefile.mk b/test_workspaces/Makefile.mk index 1954364..c0a4684 100644 --- a/test_workspaces/Makefile.mk +++ b/test_workspaces/Makefile.mk
@@ -2,6 +2,10 @@ cd test_workspaces/absolute_strip_import_prefix; \ bazel --batch test --verbose_failures --disk_cache=../bazel-disk-cache --test_output=errors //... +test_workspace_combined_strip_and_add_prefix: + cd test_workspaces/combined_strip_and_add_prefix; \ + bazel --batch test --verbose_failures --disk_cache=../bazel-disk-cache --test_output=errors //... + test_workspace_exclusions: cd test_workspaces/exclusions; \ bazel --batch test --verbose_failures --disk_cache=../bazel-disk-cache --test_output=errors //... @@ -50,4 +54,4 @@ cd test_workspaces/shared_proto; \ bazel --batch test --verbose_failures --disk_cache=../bazel-disk-cache --test_output=errors //... -all_test_workspaces: test_workspace_absolute_strip_import_prefix test_workspace_exclusions test_workspace_generated_proto test_workspace_go_importpath test_workspace_import_prefix test_workspace_objc_capitalisation test_workspace_python2_grpc test_workspace_python3_grpc test_workspace_python_dashes test_workspace_python_deps test_workspace_readme_http_archive test_workspace_relative_strip_import_prefix test_workspace_shared_proto +all_test_workspaces: test_workspace_absolute_strip_import_prefix test_workspace_combined_strip_and_add_prefix test_workspace_exclusions test_workspace_generated_proto test_workspace_go_importpath test_workspace_import_prefix test_workspace_objc_capitalisation test_workspace_python2_grpc test_workspace_python3_grpc test_workspace_python_dashes test_workspace_python_deps test_workspace_readme_http_archive test_workspace_relative_strip_import_prefix test_workspace_shared_proto
diff --git a/test_workspaces/combined_strip_and_add_prefix/BUILD.bazel b/test_workspaces/combined_strip_and_add_prefix/BUILD.bazel new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test_workspaces/combined_strip_and_add_prefix/BUILD.bazel
diff --git a/test_workspaces/combined_strip_and_add_prefix/WORKSPACE b/test_workspaces/combined_strip_and_add_prefix/WORKSPACE new file mode 100644 index 0000000..fabfb1a --- /dev/null +++ b/test_workspaces/combined_strip_and_add_prefix/WORKSPACE
@@ -0,0 +1,10 @@ +local_repository( + name = "rules_proto_grpc", + path = "../../", +) + +load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_toolchains") +rules_proto_grpc_toolchains() + +load("@rules_proto_grpc//python:repositories.bzl", "python_repos") +python_repos()
diff --git a/test_workspaces/combined_strip_and_add_prefix/package/BUILD.bazel b/test_workspaces/combined_strip_and_add_prefix/package/BUILD.bazel new file mode 100644 index 0000000..4552c01 --- /dev/null +++ b/test_workspaces/combined_strip_and_add_prefix/package/BUILD.bazel
@@ -0,0 +1,24 @@ +package(default_visibility = ["//visibility:private"]) + +load("@rules_proto_grpc//python:defs.bzl", "python_proto_library") + +# Use both strip_import_prefix and import_prefix attributes + +proto_library( + name = "proto_lib", + srcs = ["a/b/demo.proto"], + strip_import_prefix = "/package/a/b", + import_prefix = "c/d", +) + +python_proto_library( + name = "py_lib", + deps = ["proto_lib"], +) + +py_test( + name = "test", + srcs = ["main.py"], + main = "main.py", + deps = ["py_lib"], +)
diff --git a/test_workspaces/combined_strip_and_add_prefix/package/a/b/demo.proto b/test_workspaces/combined_strip_and_add_prefix/package/a/b/demo.proto new file mode 100644 index 0000000..09b3ede --- /dev/null +++ b/test_workspaces/combined_strip_and_add_prefix/package/a/b/demo.proto
@@ -0,0 +1,5 @@ +syntax = "proto3"; + +message demo { + bool field = 1; +}
diff --git a/test_workspaces/combined_strip_and_add_prefix/package/main.py b/test_workspaces/combined_strip_and_add_prefix/package/main.py new file mode 100644 index 0000000..e22c058 --- /dev/null +++ b/test_workspaces/combined_strip_and_add_prefix/package/main.py
@@ -0,0 +1,2 @@ +# Attempt to import proto file +import c.d.demo_pb2