@@ -412,8 +412,7 @@ public void testStripImportPrefixWithDeps() throws Exception {
412
412
"." );
413
413
}
414
414
415
- private void testExternalRepoWithGeneratedProto (
416
- boolean siblingRepoLayout , boolean useVirtualImports ) throws Exception {
415
+ private void testExternalRepoWithGeneratedProto (boolean siblingRepoLayout ) throws Exception {
417
416
if (!isThisBazel ()) {
418
417
return ;
419
418
}
@@ -423,9 +422,6 @@ private void testExternalRepoWithGeneratedProto(
423
422
if (siblingRepoLayout ) {
424
423
setBuildLanguageOptions ("--experimental_sibling_repository_layout" );
425
424
}
426
- if (!useVirtualImports ) {
427
- useConfiguration ("--noincompatible_generated_protos_in_virtual_imports" );
428
- }
429
425
invalidatePackages ();
430
426
431
427
scratch .file ("/foo/WORKSPACE" );
@@ -445,12 +441,7 @@ private void testExternalRepoWithGeneratedProto(
445
441
siblingRepoLayout ? RepositoryName .create ("foo" ) : RepositoryName .MAIN )
446
442
.toString ();
447
443
String fooProtoRoot ;
448
- if (useVirtualImports ) {
449
- fooProtoRoot =
450
- genfiles + (siblingRepoLayout ? "" : "/external/foo" ) + "/x/_virtual_imports/x" ;
451
- } else {
452
- fooProtoRoot = (siblingRepoLayout ? genfiles : genfiles + "/external/foo" );
453
- }
444
+ fooProtoRoot = (siblingRepoLayout ? genfiles : genfiles + "/external/foo" );
454
445
ConfiguredTarget a = getConfiguredTarget ("//a:a" );
455
446
ProtoInfo aInfo = a .get (ProtoInfo .PROVIDER );
456
447
assertThat (aInfo .getTransitiveProtoSourceRoots ().toList ()).containsExactly ("." , fooProtoRoot );
@@ -462,24 +453,12 @@ private void testExternalRepoWithGeneratedProto(
462
453
463
454
@ Test
464
455
public void testExternalRepoWithGeneratedProto_withSubdirRepoLayout () throws Exception {
465
- testExternalRepoWithGeneratedProto (/*siblingRepoLayout=*/ false , true );
456
+ testExternalRepoWithGeneratedProto (/* siblingRepoLayout= */ false );
466
457
}
467
458
468
459
@ Test
469
460
public void test_siblingRepoLayout_externalRepoWithGeneratedProto () throws Exception {
470
- testExternalRepoWithGeneratedProto (/*siblingRepoLayout=*/ true , true );
471
- }
472
-
473
- @ Test
474
- public void testExternalRepoWithGeneratedProto_withSubdirRepoLayoutAndNoVritualImports ()
475
- throws Exception {
476
- testExternalRepoWithGeneratedProto (/*siblingRepoLayout=*/ false , false );
477
- }
478
-
479
- @ Test
480
- public void test_siblingRepoLayout_externalRepoWithGeneratedProtoAndNoVritualImports ()
481
- throws Exception {
482
- testExternalRepoWithGeneratedProto (/*siblingRepoLayout=*/ true , false );
461
+ testExternalRepoWithGeneratedProto (/* siblingRepoLayout= */ true );
483
462
}
484
463
485
464
@ Test
@@ -1076,35 +1055,7 @@ public void testExperimentalProtoDescriptorSetsIncludeSourceInfo() throws Except
1076
1055
}
1077
1056
1078
1057
@ Test
1079
- public void testSourceAndGeneratedProtoFiles_Bazel () throws Exception {
1080
- if (!isThisBazel ()) {
1081
- return ;
1082
- }
1083
-
1084
- scratch .file (
1085
- "a/BUILD" ,
1086
- TestConstants .LOAD_PROTO_LIBRARY ,
1087
- "genrule(name='g', srcs=[], outs=['g.proto'], cmd = '')" ,
1088
- "proto_library(name='p', srcs=['s.proto', 'g.proto'])" );
1089
-
1090
- ImmutableList <String > commandLine =
1091
- allArgsForAction ((SpawnAction ) getDescriptorWriteAction ("//a:p" ));
1092
- String genfiles = getTargetConfiguration ().getGenfilesFragment (RepositoryName .MAIN ).toString ();
1093
- assertThat (commandLine )
1094
- .containsAtLeast (
1095
- "-Ia/s.proto=" + genfiles + "/a/_virtual_imports/p/a/s.proto" ,
1096
- "-Ia/g.proto=" + genfiles + "/a/_virtual_imports/p/a/g.proto" );
1097
- }
1098
-
1099
- @ Test
1100
- public void testSourceAndGeneratedProtoFiles_Blaze () throws Exception {
1101
- if (!isThisBazel ()) {
1102
- return ;
1103
- }
1104
-
1105
- // Simulate behavoiur of Blaze's `proto_library` in Bazel.
1106
- useConfiguration ("--incompatible_generated_protos_in_virtual_imports=false" );
1107
-
1058
+ public void testSourceAndGeneratedProtoFiles () throws Exception {
1108
1059
scratch .file (
1109
1060
"a/BUILD" ,
1110
1061
TestConstants .LOAD_PROTO_LIBRARY ,
@@ -1210,43 +1161,12 @@ public void testProtoLibraryWithVirtualProtoSourceRoot() throws Exception {
1210
1161
.containsExactly ("foo/x/a.proto" );
1211
1162
}
1212
1163
1213
- @ Test
1214
- public void testProtoLibraryWithGeneratedSources_Bazel () throws Exception {
1215
- if (!isThisBazel ()) {
1216
- return ;
1217
- }
1218
-
1219
- useConfiguration ("--incompatible_generated_protos_in_virtual_imports=true" );
1220
-
1221
- scratch .file (
1222
- "x/BUILD" ,
1223
- "genrule(name='g', srcs=[], outs=['generated.proto'], cmd='')" ,
1224
- "proto_library(name='foo', srcs=['generated.proto'])" );
1225
-
1226
- String genfiles = getTargetConfiguration ().getGenfilesFragment (RepositoryName .MAIN ).toString ();
1227
- ProtoInfo provider = getConfiguredTarget ("//x:foo" ).get (ProtoInfo .PROVIDER );
1228
- assertThat (
1229
- Iterables .transform (
1230
- provider .getDirectSources (), s -> s .getSourceFile ().getExecPath ().getPathString ()))
1231
- .containsExactly (genfiles + "/x/_virtual_imports/foo/x/generated.proto" );
1232
- assertThat (
1233
- Iterables .transform (
1234
- provider .getDirectSources (), s -> s .getSourceRoot ().getSafePathString ()))
1235
- .containsExactly ("x/_virtual_imports/foo" );
1236
- assertThat (
1237
- Iterables .transform (
1238
- provider .getDirectSources (), s -> s .getImportPath ().getPathString ()))
1239
- .containsExactly ("x/generated.proto" );
1240
- }
1241
-
1242
1164
@ Test
1243
1165
public void testProtoLibraryWithGeneratedSources_Blaze () throws Exception {
1244
1166
if (!isThisBazel ()) {
1245
1167
return ;
1246
1168
}
1247
1169
1248
- useConfiguration ("--incompatible_generated_protos_in_virtual_imports=false" );
1249
-
1250
1170
scratch .file (
1251
1171
"x/BUILD" ,
1252
1172
"genrule(name='g', srcs=[], outs=['generated.proto'], cmd='')" ,
@@ -1268,45 +1188,12 @@ public void testProtoLibraryWithGeneratedSources_Blaze() throws Exception {
1268
1188
.containsExactly ("x/generated.proto" );
1269
1189
}
1270
1190
1271
- @ Test
1272
- public void testProtoLibraryWithMixedSources_Bazel () throws Exception {
1273
- if (!isThisBazel ()) {
1274
- return ;
1275
- }
1276
-
1277
- useConfiguration ("--incompatible_generated_protos_in_virtual_imports=true" );
1278
-
1279
- scratch .file (
1280
- "x/BUILD" ,
1281
- "genrule(name='g', srcs=[], outs=['generated.proto'], cmd='')" ,
1282
- "proto_library(name='foo', srcs=['generated.proto', 'a.proto'])" );
1283
-
1284
- String genfiles = getTargetConfiguration ().getGenfilesFragment (RepositoryName .MAIN ).toString ();
1285
- ProtoInfo provider = getConfiguredTarget ("//x:foo" ).get (ProtoInfo .PROVIDER );
1286
- assertThat (
1287
- Iterables .transform (
1288
- provider .getDirectSources (), s -> s .getSourceFile ().getExecPath ().getPathString ()))
1289
- .containsExactly (
1290
- genfiles + "/x/_virtual_imports/foo/x/generated.proto" ,
1291
- genfiles + "/x/_virtual_imports/foo/x/a.proto" );
1292
- assertThat (
1293
- Iterables .transform (
1294
- provider .getDirectSources (), s -> s .getSourceRoot ().getSafePathString ()))
1295
- .containsExactly ("x/_virtual_imports/foo" , "x/_virtual_imports/foo" );
1296
- assertThat (
1297
- Iterables .transform (
1298
- provider .getDirectSources (), s -> s .getImportPath ().getPathString ()))
1299
- .containsExactly ("x/generated.proto" , "x/a.proto" );
1300
- }
1301
-
1302
1191
@ Test
1303
1192
public void testProtoLibraryWithMixedSources_Blaze () throws Exception {
1304
1193
if (!isThisBazel ()) {
1305
1194
return ;
1306
1195
}
1307
1196
1308
- useConfiguration ("--incompatible_generated_protos_in_virtual_imports=false" );
1309
-
1310
1197
scratch .file (
1311
1198
"x/BUILD" ,
1312
1199
"genrule(name='g', srcs=[], outs=['generated.proto'], cmd='')" ,
0 commit comments