Simplify the decision on whether to extract include remotely. Instead of asking
the output service whether a given file is a remote file, just always extract
output files remotely.

RELNOTES: None.
PiperOrigin-RevId: 351532992
diff --git a/src/main/java/com/google/devtools/build/lib/includescanning/IncludeScanningModule.java b/src/main/java/com/google/devtools/build/lib/includescanning/IncludeScanningModule.java
index 54b81e0..18a5e10 100644
--- a/src/main/java/com/google/devtools/build/lib/includescanning/IncludeScanningModule.java
+++ b/src/main/java/com/google/devtools/build/lib/includescanning/IncludeScanningModule.java
@@ -305,7 +305,6 @@
               spawnScannerSupplier,
               env.getExecRoot());
 
-      spawnScannerSupplier.get().setOutputService(env.getOutputService());
       spawnScannerSupplier.get().setInMemoryOutput(options.inMemoryIncludesFiles);
     }
   }
diff --git a/src/main/java/com/google/devtools/build/lib/includescanning/SpawnIncludeScanner.java b/src/main/java/com/google/devtools/build/lib/includescanning/SpawnIncludeScanner.java
index 8e03f89..605ecfd 100644
--- a/src/main/java/com/google/devtools/build/lib/includescanning/SpawnIncludeScanner.java
+++ b/src/main/java/com/google/devtools/build/lib/includescanning/SpawnIncludeScanner.java
@@ -52,7 +52,6 @@
 import com.google.devtools.build.lib.includescanning.IncludeParser.Inclusion;
 import com.google.devtools.build.lib.util.io.FileOutErr;
 import com.google.devtools.build.lib.vfs.IORuntimeException;
-import com.google.devtools.build.lib.vfs.OutputService;
 import com.google.devtools.build.lib.vfs.Path;
 import com.google.devtools.build.lib.vfs.PathFragment;
 import java.io.IOException;
@@ -72,7 +71,6 @@
       ResourceSet.createWithRamCpu(/*memoryMb=*/ 10, /*cpuUsage=*/ 1);
 
   private final Path execRoot;
-  private OutputService outputService;
   private boolean inMemoryOutput;
   private final int remoteExtractionThreshold;
 
@@ -82,11 +80,6 @@
     this.remoteExtractionThreshold = remoteExtractionThreshold;
   }
 
-  public void setOutputService(OutputService outputService) {
-    Preconditions.checkState(this.outputService == null);
-    this.outputService = outputService;
-  }
-
   public void setInMemoryOutput(boolean inMemoryOutput) {
     this.inMemoryOutput = inMemoryOutput;
   }
@@ -120,11 +113,11 @@
     if (file.getRoot().getRoot().isAbsolute()) {
       return false;
     }
-    // Files written remotely that are not locally available should be scanned remotely to avoid the
+    // Output files are generally not locally available should be scanned remotely to avoid the
     // bandwidth and disk space penalty of bringing them across. Also, enable include scanning
-    // remotely when explicitly directed to via a flag.
+    // remotely when the file size exceeds a certain size.
     return remoteExtractionThreshold == 0
-        || (outputService != null && outputService.isRemoteFile(file))
+        || !file.isSourceArtifact()
         || ctx.getPathResolver().toPath(file).getFileSize() > remoteExtractionThreshold;
   }
 
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteOutputService.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteOutputService.java
index 957af4e..6939e1e 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteOutputService.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteOutputService.java
@@ -28,7 +28,6 @@
 import com.google.devtools.build.lib.vfs.FileSystem;
 import com.google.devtools.build.lib.vfs.ModifiedFileSet;
 import com.google.devtools.build.lib.vfs.OutputService;
-import com.google.devtools.build.lib.vfs.Path;
 import com.google.devtools.build.lib.vfs.PathFragment;
 import com.google.devtools.build.lib.vfs.Root;
 import java.util.Map;
@@ -115,13 +114,6 @@
   }
 
   @Override
-  public boolean isRemoteFile(Artifact artifact) {
-    Path path = artifact.getPath();
-    return path.getFileSystem() instanceof RemoteActionFileSystem
-        && ((RemoteActionFileSystem) path.getFileSystem()).isRemote(path);
-  }
-
-  @Override
   public boolean supportsPathResolverForArtifactValues() {
     return actionFileSystemType() != ActionFileSystemType.DISABLED;
   }
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/OutputService.java b/src/main/java/com/google/devtools/build/lib/vfs/OutputService.java
index 88a4cff..21da650 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/OutputService.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/OutputService.java
@@ -141,9 +141,6 @@
    */
   void clean() throws ExecException, InterruptedException;
 
-  /** @return true iff the file actually lives on a remote server */
-  boolean isRemoteFile(Artifact file);
-
   default ActionFileSystemType actionFileSystemType() {
     return ActionFileSystemType.DISABLED;
   }