Skip to content

Commit

Permalink
Revert back to the old behavior of not creating a proto source root f…
Browse files Browse the repository at this point in the history
…or 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:

bazelbuild#9215

RELNOTES: None.
PiperOrigin-RevId: 264581654
  • Loading branch information
lberki authored and copybara-github committed Aug 21, 2019
1 parent 7e83721 commit 209175f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 209175f

Please sign in to comment.