From 209175ff8ffeb05628ed8a187dd414a3d2935c55 Mon Sep 17 00:00:00 2001 From: lberki Date: Wed, 21 Aug 2019 04:37:11 -0700 Subject: [PATCH] Revert back to the old behavior of not creating a proto source root for generated .proto files. It was meant to be a compatible change, but alas, people seemed to depend on the exact layout of the output tree. Will flip in 1.0 . Tracking bug: https://github.com/bazelbuild/bazel/issues/9215 RELNOTES: None. PiperOrigin-RevId: 264581654 --- .../build/lib/rules/proto/ProtoConfiguration.java | 12 +++++++++--- .../build/lib/rules/proto/BazelProtoLibraryTest.java | 7 ++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java index fccbf1db71cb89..7379ba2d6ae86f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java @@ -41,11 +41,17 @@ public class ProtoConfiguration extends Fragment implements ProtoConfigurationAp /** Command line options. */ public static class Options extends FragmentOptions { @Option( - name = "experimental_generated_protos_in_virtual_imports", - defaultValue = "true", + name = "incompatible_generated_protos_in_virtual_imports", + defaultValue = "false", documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, - help = "If set, generated .proto files are put into a virtual import directory.") + metadataTags = { + OptionMetadataTag.INCOMPATIBLE_CHANGE, + OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES + }, + help = + "If set, generated .proto files are put into a virtual import directory. For more " + + "information, see https://github.com/bazelbuild/bazel/issues/9215") public boolean generatedProtosInVirtualImports; @Option( diff --git a/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java index e23956721200af..7b26d789b732d8 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java @@ -370,16 +370,13 @@ public void testExternalRepoWithGeneratedProto() throws Exception { TestConstants.LOAD_PROTO_LIBRARY, "proto_library(name='a', srcs=['a.proto'], deps=['@foo//x:x'])"); - String genfiles = getTargetConfiguration().getGenfilesFragment().toString(); ConfiguredTarget a = getConfiguredTarget("//a:a"); ProtoInfo aInfo = a.get(ProtoInfo.PROVIDER); - assertThat(aInfo.getTransitiveProtoSourceRoots()) - .containsExactly(".", genfiles + "/external/foo/x/_virtual_imports/x"); + assertThat(aInfo.getTransitiveProtoSourceRoots()).containsExactly(".", "external/foo"); ConfiguredTarget x = getConfiguredTarget("@foo//x:x"); ProtoInfo xInfo = x.get(ProtoInfo.PROVIDER); - assertThat(xInfo.getTransitiveProtoSourceRoots()) - .containsExactly(genfiles + "/external/foo/x/_virtual_imports/x"); + assertThat(xInfo.getTransitiveProtoSourceRoots()).containsExactly("external/foo"); } @Test