Make incremental repository updates feature available without a flag

- i.e. managed directories attribute can be used in workspace() function without --experimental_allow_incremental_repository_updates flag.
- we should remove the flag itself in a separate release, to give users the time for removing the usage of the flag from their Bazel config files.

Closes #8889.

PiperOrigin-RevId: 258602402
diff --git a/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java b/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java
index 73879e3..c4d3fe4 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java
@@ -1,4 +1,4 @@
-// Copyright 2017 The Bazel Authors. All rights reserved.
+// Copyright 2019 The Bazel Authors. All rights reserved.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -11,6 +11,7 @@
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
+//
 
 package com.google.devtools.build.lib.packages;
 
@@ -64,17 +65,13 @@
 
   @Option(
       name = "experimental_allow_incremental_repository_updates",
-      defaultValue = "false",
+      defaultValue = "true",
       documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
       effectTags = {OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
       metadataTags = {OptionMetadataTag.EXPERIMENTAL},
       help =
-          "If used, it is possible to define a mapping between external repositories"
-              + " and some (mostly likely ignored by .bazelignore) directories."
-              + " The repository rule can read and update files in those directories,"
-              + " and the changes will be visible in the same build."
-              + " Use attribute 'managed_directories' of the global workspace()"
-              + " function in WORKSPACE file to define the mapping.")
+          "This flag will be removed in Bazel 1.0. Please do not use it.\n"
+              + "Incremental repository updates feature is now enabled without the flag.")
   public boolean experimentalAllowIncrementalRepositoryUpdates;
 
   @Option(
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/WorkspaceGlobalsApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/WorkspaceGlobalsApi.java
index fd346d4..7df30ee 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/WorkspaceGlobalsApi.java
+++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/WorkspaceGlobalsApi.java
@@ -11,6 +11,7 @@
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
+//
 
 package com.google.devtools.build.lib.skylarkbuildapi;
 
@@ -24,7 +25,6 @@
 import com.google.devtools.build.lib.syntax.Runtime.NoneType;
 import com.google.devtools.build.lib.syntax.SkylarkDict;
 import com.google.devtools.build.lib.syntax.SkylarkList;
-import com.google.devtools.build.lib.syntax.StarlarkSemantics.FlagIdentifier;
 
 /** A collection of global skylark build API functions that apply to WORKSPACE files. */
 @SkylarkGlobalLibrary
@@ -52,9 +52,7 @@
             noneable = true,
             named = true,
             positional = false,
-            enableOnlyWithFlag = FlagIdentifier.EXPERIMENTAL_ALLOW_INCREMENTAL_REPOSITORY_UPDATES,
             defaultValue = "{}",
-            valueWhenDisabled = "{}",
             doc =
                 "Dict (strings to list of strings) for defining the mappings between external"
                     + " repositories and relative (to the workspace root) paths to directories"
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java
index f2181f4..a1f7420 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java
@@ -1,4 +1,4 @@
-// Copyright 2017 The Bazel Authors. All rights reserved.
+// Copyright 2019 The Bazel Authors. All rights reserved.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -11,6 +11,7 @@
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
+//
 
 package com.google.devtools.build.lib.syntax;
 
@@ -248,7 +249,7 @@
           // <== Add new options here in alphabetic order ==>
           .experimentalBuildSettingApi(true)
           .experimentalCcSkylarkApiEnabledPackages(ImmutableList.of())
-          .experimentalAllowIncrementalRepositoryUpdates(false)
+          .experimentalAllowIncrementalRepositoryUpdates(true)
           .experimentalEnableAndroidMigrationApis(false)
           .experimentalGoogleLegacyApi(false)
           .experimentalJavaCommonCreateProviderEnabledPackages(ImmutableList.of())
diff --git a/src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/ManagedDirectoriesBlackBoxTest.java b/src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/ManagedDirectoriesBlackBoxTest.java
index 2cbbf74..5bd52ff 100644
--- a/src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/ManagedDirectoriesBlackBoxTest.java
+++ b/src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/ManagedDirectoriesBlackBoxTest.java
@@ -92,27 +92,17 @@
     checkProjectFiles();
   }
 
-  @Test
-  public void testWithoutFlag() throws Exception {
-    generateProject();
-    ProcessResult result = context().bazel().shouldFail().build("//...");
-    assertThat(result.errString())
-        .contains(
-            "parameter 'managed_directories' is experimental and thus unavailable"
-                + " with the current flags.");
-  }
-
   private BuilderRunner bazel() {
     return bazel(false);
   }
 
   private BuilderRunner bazel(boolean watchFs) {
     currentDebugId = random.nextInt();
-    String[] flags =
-        watchFs
-            ? new String[] {"--experimental_allow_incremental_repository_updates", "--watchfs=true"}
-            : new String[] {"--experimental_allow_incremental_repository_updates"};
-    return context().bazel().withFlags(flags).withEnv("DEBUG_ID", String.valueOf(currentDebugId));
+    BuilderRunner bazel = context().bazel().withEnv("DEBUG_ID", String.valueOf(currentDebugId));
+    if (watchFs) {
+      bazel.withFlags("--watchfs=true");
+    }
+    return bazel;
   }
 
   @Test