Skip to content

Commit

Permalink
Kill Legacy Fileset implementation.
Browse files Browse the repository at this point in the history
RELNOTES: None
PiperOrigin-RevId: 195422399
  • Loading branch information
kush-c authored and Copybara-Service committed May 4, 2018
1 parent 30eb983 commit ba6a7d4
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1746,10 +1746,6 @@ public boolean legacyExternalRunfiles() {
return options.legacyExternalRunfiles;
}

public boolean getSkyframeNativeFileset() {
return true;
}

/**
* Returns user-specified test environment variables and their values, as set by the --test_env
* options.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import com.google.devtools.build.lib.packages.PackageSpecification.PackageGroupContents;
import com.google.devtools.build.lib.skyframe.BuildConfigurationValue;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import com.google.devtools.build.lib.vfs.PathFragment;
import javax.annotation.Nullable;

/**
* A configured target for output files generated by {@code Fileset} rules. They are almost the same
Expand All @@ -42,16 +40,14 @@
@AutoCodec
public final class FilesetOutputConfiguredTarget extends OutputFileConfiguredTarget
implements FilesetProvider {
private final Artifact filesetInputManifest;
private final PathFragment filesetLinkDir;
@Nullable private final ImmutableList<FilesetTraversalParams> filesetTraversals;
private final ImmutableList<FilesetTraversalParams> filesetTraversals;

public FilesetOutputConfiguredTarget(
TargetContext targetContext,
OutputFile outputFile,
TransitiveInfoCollection generatingRule,
Artifact outputArtifact,
@Nullable ImmutableList<FilesetTraversalParams> traversals) {
ImmutableList<FilesetTraversalParams> traversals) {
this(
targetContext.getLabel(),
targetContext.getConfigurationKey(),
Expand All @@ -74,26 +70,13 @@ public FilesetOutputConfiguredTarget(
NestedSet<PackageGroupContents> visibility,
TransitiveInfoCollection generatingRule,
Artifact artifact,
@Nullable ImmutableList<FilesetTraversalParams> traversals) {
ImmutableList<FilesetTraversalParams> traversals) {
super(label, configurationKey, visibility, artifact, generatingRule);
FilesetProvider provider = generatingRule.getProvider(FilesetProvider.class);
Preconditions.checkArgument(provider != null);
filesetInputManifest = provider.getFilesetInputManifest();
filesetLinkDir = provider.getFilesetLinkDir();
filesetTraversals = traversals;
}

@Override
public Artifact getFilesetInputManifest() {
return filesetInputManifest;
}

@Override
public PathFragment getFilesetLinkDir() {
return filesetLinkDir;
}

@Nullable
@Override
public ImmutableList<FilesetTraversalParams> getTraversals() {
return filesetTraversals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,16 @@
package com.google.devtools.build.lib.analysis.fileset;

import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.FilesetTraversalParams;
import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
import com.google.devtools.build.lib.vfs.PathFragment;
import javax.annotation.Nullable;

/**
* Information needed by a Fileset to do the right thing when it depends on another Fileset.
*/
public interface FilesetProvider extends TransitiveInfoProvider {
Artifact getFilesetInputManifest();
PathFragment getFilesetLinkDir();

/**
* Returns a list of the traversals that went into this Fileset. Only used by Skyframe-native
* filesets, so will be null if Skyframe-native filesets are not enabled.
*/
@Nullable
ImmutableList<FilesetTraversalParams> getTraversals();
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ public class ExecutionTool {
for (BlazeModule module : runtime.getBlazeModules()) {
module.executorInit(env, request, builder);
}
builder.addActionContextProvider(
new FilesetActionContextImpl.Provider(env.getReporter(), env.getWorkspaceName()));
builder.addActionContextProvider(new FilesetActionContextImpl.Provider(env.getWorkspaceName()));
builder.addActionContext(new SymlinkTreeStrategy(
env.getOutputService(), env.getBlazeWorkspace().getBinTools()));
// TODO(philwo) - the ExecutionTool should not add arbitrary dependencies on its own, instead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@
package com.google.devtools.build.lib.exec;

import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.devtools.build.lib.actions.ActionContext;
import com.google.devtools.build.lib.actions.ExecutionStrategy;
import com.google.devtools.build.lib.events.Reporter;
import com.google.devtools.build.lib.rules.fileset.FilesetActionContext;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
* Context for Fileset manifest actions. It currently only provides a ThreadPoolExecutor.
Expand All @@ -38,48 +33,23 @@ public final class FilesetActionContextImpl implements FilesetActionContext {
*/
public static class Provider extends ActionContextProvider {
private FilesetActionContextImpl impl;
private final Reporter reporter;
private final ThreadPoolExecutor filesetPool;

public Provider(Reporter reporter, String workspaceName) {
this.reporter = reporter;
this.filesetPool = newFilesetPool(100);
this.impl = new FilesetActionContextImpl(filesetPool, workspaceName);
}

private static ThreadPoolExecutor newFilesetPool(int threads) {
ThreadPoolExecutor pool = new ThreadPoolExecutor(threads, threads, 3L, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>());
// Do not consume threads when not in use.
pool.allowCoreThreadTimeOut(true);
pool.setThreadFactory(new ThreadFactoryBuilder().setNameFormat("Fileset worker %d").build());
return pool;
public Provider(String workspaceName) {
this.impl = new FilesetActionContextImpl(workspaceName);
}

@Override
public Iterable<? extends ActionContext> getActionContexts() {
return ImmutableList.of(impl);
}

@Override
public void executionPhaseEnding() {
BlazeExecutor.shutdownHelperPool(reporter, filesetPool, "Fileset");
}
}

private final ThreadPoolExecutor filesetPool;
private final String workspaceName;

private FilesetActionContextImpl(ThreadPoolExecutor filesetPool, String workspaceName) {
this.filesetPool = filesetPool;
private FilesetActionContextImpl(String workspaceName) {
this.workspaceName = workspaceName;
}

@Override
public ThreadPoolExecutor getFilesetPool() {
return filesetPool;
}

@Override
public String getWorkspaceName() {
return workspaceName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,11 @@
package com.google.devtools.build.lib.rules.fileset;

import com.google.devtools.build.lib.actions.ActionContext;
import java.util.concurrent.ThreadPoolExecutor;

/**
* Action context for fileset collection actions.
*/
public interface FilesetActionContext extends ActionContext {

/**
* Returns a thread pool for fileset symlink tree creation.
*/
ThreadPoolExecutor getFilesetPool();

/**
* Returns the name of the workspace the build is run in.
*/
Expand Down

This file was deleted.

0 comments on commit ba6a7d4

Please sign in to comment.