Skip to content

Commit

Permalink
Delete --experimental_transparent_compression
Browse files Browse the repository at this point in the history
The flag doesn't seem needed anymore.

RELNOTES: Removed the flag --experimental_transparent_compression.
PiperOrigin-RevId: 326460037
  • Loading branch information
laurentlb authored and copybara-github committed Aug 13, 2020
1 parent c59b833 commit f6ad35f
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,4 @@ public enum Compression {
DISALLOW,
/** May compress. */
ALLOW;

/** Maps true/false to allow/disallow respectively. */
public static Compression fromBoolean(boolean allow) {
return allow ? ALLOW : DISALLOW;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ public static FileWriteAction create(
/**
* Creates a new FileWriteAction instance.
*
* <p>There are no inputs. Transparent compression is controlled by the {@code
* --experimental_transparent_compression} flag. No reference to the {@link
* ActionConstructionContext} will be maintained.
* <p>There are no inputs. No reference to the {@link ActionConstructionContext} will be
* maintained.
*
* @param context the action construction context
* @param output the Artifact that will be created by executing this Action
Expand All @@ -169,7 +168,7 @@ public static FileWriteAction create(
output,
fileContents,
makeExecutable,
context.getConfiguration().transparentCompression());
Compression.ALLOW);
}

private static final class CompressedString extends LazyString {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.google.devtools.build.lib.actions.BuildConfigurationEvent;
import com.google.devtools.build.lib.actions.CommandLines.CommandLineLimits;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.actions.Compression;
import com.google.devtools.build.lib.buildeventstream.BuildEventIdUtil;
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos;
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildEventId;
Expand Down Expand Up @@ -708,14 +707,6 @@ public List<Label> getActionListeners() {
return options.actionListeners;
}

/**
* Returns whether FileWriteAction may transparently compress its contents in the analysis phase
* to save memory. Semantics are not affected.
*/
public Compression transparentCompression() {
return Compression.fromBoolean(options.transparentCompression);
}

/**
* Returns whether we should trim configurations to only include the fragments needed to correctly
* analyze a rule.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,20 +515,6 @@ public String getTypeDescription() {
help = "Use action_listener to attach an extra_action to existing build actions.")
public List<Label> actionListeners;

// TODO(bazel-team): Either remove this flag once transparent compression is shown to not
// noticeably affect running time, or keep this flag and move it into a new configuration
// fragment.
@Option(
name = "experimental_transparent_compression",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"Enables gzip compression for the contents of FileWriteActions, which reduces "
+ "memory usage in the analysis phase at the expense of additional time overhead.")
public boolean transparentCompression;

@Option(
name = "is host configuration",
defaultValue = "false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import com.google.devtools.build.lib.actions.ActionOwner;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.util.LazyString;
import java.util.Random;
import org.junit.Test;
Expand Down Expand Up @@ -153,28 +151,4 @@ public String toString() {
assertThat(action.getFileContents()).isEqualTo(backingContents);
assertThat(contents.forced).isEqualTo(1);
}

@Test
public void testTransparentCompressionFlagOn() throws Exception {
Artifact outputArtifact = getBinArtifactWithNoOwner("destination.txt");
String contents = generateLongRandomString();
useConfiguration("--experimental_transparent_compression=true");
ConfiguredTarget target = scratchConfiguredTarget("a", "a", "filegroup(name='a', srcs=[])");
RuleContext context = getRuleContext(target);
FileWriteAction action =
FileWriteAction.create(context, outputArtifact, contents, /*makeExecutable=*/ false);
assertThat(action.usesCompression()).isTrue();
}

@Test
public void testTransparentCompressionFlagOff() throws Exception {
Artifact outputArtifact = getBinArtifactWithNoOwner("destination.txt");
String contents = generateLongRandomString();
useConfiguration("--experimental_transparent_compression=false");
ConfiguredTarget target = scratchConfiguredTarget("a", "a", "filegroup(name='a', srcs=[])");
RuleContext context = getRuleContext(target);
FileWriteAction action =
FileWriteAction.create(context, outputArtifact, contents, /*makeExecutable=*/ false);
assertThat(action.usesCompression()).isFalse();
}
}

0 comments on commit f6ad35f

Please sign in to comment.