Skip to content

Commit

Permalink
Automated rollback of commit dfd48fc.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Broke Bazel CI: #7577

*** Original change description ***

Set default value of --incompatible_remap_main_repo to true.

Related to #7130

RELNOTES: Set default value of --incompatible_remap_main_repo to true.
PiperOrigin-RevId: 236084411
  • Loading branch information
meteorcloudy authored and copybara-github committed Feb 28, 2019
1 parent c210d2f commit 70981cd
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl

@Option(
name = "incompatible_remap_main_repo",
defaultValue = "true",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
effectTags = OptionEffectTag.LOADING_AND_ANALYSIS,
metadataTags = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public static Builder builderWithDefaults() {
.incompatibleNoSupportToolsInActionInputs(false)
.incompatibleNoTargetOutputGroup(false)
.incompatibleNoTransitiveLoads(false)
.incompatibleRemapMainRepo(true)
.incompatibleRemapMainRepo(false)
.incompatibleRemoveNativeMavenJar(false)
.incompatibleRequireFeatureConfigurationForPic(true)
.incompatibleStricArgumentOrdering(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,19 @@ public void testMappingsNotAMap() throws Exception {

@Test
public void testImplicitMainRepoRename() throws Exception {
helper.setSkylarkSemantics("--incompatible_remap_main_repo");
helper.parse("workspace(name = 'foo')");
assertMapping(helper, "@", "@foo", "@");
}

@Test
public void testNoImplicitMainRepoRenameWithoutFlag() throws Exception {
helper.parse("workspace(name = 'foo')");
RepositoryName foo = RepositoryName.create("@foo");
assertThat(helper.getPackage().getRepositoryMapping(RepositoryName.create("@")))
.doesNotContainEntry(foo, RepositoryName.MAIN);
}

@Test
public void testEmptyRepositoryHasEmptyMap() throws Exception {
helper.parse("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ public void testSimpleMapping() throws Exception {
.hasEntryThat(skyKey)
.isEqualTo(
RepositoryMappingValue.withMapping(
ImmutableMap.of(
RepositoryName.create("@a"),
RepositoryName.create("@b"),
RepositoryName.create("@good"),
RepositoryName.MAIN)));
ImmutableMap.of(RepositoryName.create("@a"), RepositoryName.create("@b"))));
}

@Test
Expand All @@ -97,20 +93,12 @@ public void testMultipleRepositoriesWithMapping() throws Exception {
.hasEntryThat(skyKey1)
.isEqualTo(
RepositoryMappingValue.withMapping(
ImmutableMap.of(
RepositoryName.create("@a"),
RepositoryName.create("@b"),
RepositoryName.create("@good"),
RepositoryName.MAIN)));
ImmutableMap.of(RepositoryName.create("@a"), RepositoryName.create("@b"))));
assertThatEvaluationResult(eval(skyKey2))
.hasEntryThat(skyKey2)
.isEqualTo(
RepositoryMappingValue.withMapping(
ImmutableMap.of(
RepositoryName.create("@x"),
RepositoryName.create("@y"),
RepositoryName.create("@good"),
RepositoryName.MAIN)));
ImmutableMap.of(RepositoryName.create("@x"), RepositoryName.create("@y"))));
}

@Test
Expand All @@ -132,8 +120,7 @@ public void testRepositoryWithMultipleMappings() throws Exception {
RepositoryMappingValue.withMapping(
ImmutableMap.of(
RepositoryName.create("@a"), RepositoryName.create("@b"),
RepositoryName.create("@x"), RepositoryName.create("@y"),
RepositoryName.create("@good"), RepositoryName.MAIN)));
RepositoryName.create("@x"), RepositoryName.create("@y"))));
}

@Test
Expand All @@ -159,6 +146,7 @@ public void testErrorWithMapping() throws Exception {

@Test
public void testDefaultMainRepoNameInMapping() throws Exception {
setSkylarkSemanticsOptions("--incompatible_remap_main_repo");
scratch.overwriteFile(
"WORKSPACE",
"local_repository(",
Expand All @@ -180,6 +168,7 @@ public void testDefaultMainRepoNameInMapping() throws Exception {

@Test
public void testExplicitMainRepoNameInMapping() throws Exception {
setSkylarkSemanticsOptions("--incompatible_remap_main_repo");
scratch.overwriteFile(
"WORKSPACE",
"workspace(name = 'good')",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,19 +278,17 @@ public void testRepositoryMappingInChunks() throws Exception {
RepositoryName b = RepositoryName.create("@b");
RepositoryName x = RepositoryName.create("@x");
RepositoryName y = RepositoryName.create("@y");
RepositoryName good = RepositoryName.create("@good");
RepositoryName main = RepositoryName.MAIN;

SkyKey key0 = WorkspaceFileValue.key(workspace, 0);
EvaluationResult<WorkspaceFileValue> result0 = eval(key0);
WorkspaceFileValue value0 = result0.get(key0);
assertThat(value0.getRepositoryMapping()).containsEntry(a, ImmutableMap.of(x, y, good, main));
assertThat(value0.getRepositoryMapping()).containsEntry(a, ImmutableMap.of(x, y));

SkyKey key1 = WorkspaceFileValue.key(workspace, 1);
EvaluationResult<WorkspaceFileValue> result1 = eval(key1);
WorkspaceFileValue value1 = result1.get(key1);
assertThat(value1.getRepositoryMapping()).containsEntry(a, ImmutableMap.of(x, y, good, main));
assertThat(value1.getRepositoryMapping()).containsEntry(b, ImmutableMap.of(x, y, good, main));
assertThat(value1.getRepositoryMapping()).containsEntry(a, ImmutableMap.of(x, y));
assertThat(value1.getRepositoryMapping()).containsEntry(b, ImmutableMap.of(x, y));
}

@Test
Expand Down
10 changes: 7 additions & 3 deletions src/test/shell/bazel/workspace_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,8 @@ a = 1
EOF

cd mainrepo
bazel query //... &>"$TEST_log" || fail "Expected query to succeed"
bazel query --incompatible_remap_main_repo //... &>"$TEST_log" \
|| fail "Expected query to succeed"
expect_log "def.bzl loaded"
expect_not_log "external"
}
Expand All @@ -753,7 +754,8 @@ EOF
# the bzl file should be loaded from the main workspace and
# not as an external repository
cd mainrepo
bazel query @a//... &>"$TEST_log" || fail "Expected query to succeed"
bazel query --incompatible_remap_main_repo @a//... &>"$TEST_log" \
|| fail "Expected query to succeed"
expect_log "def.bzl loaded"
expect_not_log "external"

Expand All @@ -770,7 +772,9 @@ EOF
# now that @mainrepo doesn't exist within workspace "a",
# the query should fail
cd mainrepo
bazel query @a//... &>"$TEST_log" && fail "Failure expected" || true
bazel query --incompatible_remap_main_repo \
@a//... &>"$TEST_log" \
&& fail "Failure expected" || true
}

function test_external_subpacakge() {
Expand Down

0 comments on commit 70981cd

Please sign in to comment.