Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@

import com.google.common.collect.ImmutableSet;
import java.util.Set;
import javax.annotation.Nullable;
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.PipelineRunner;
import org.apache.beam.sdk.metrics.MetricResults;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.options.PipelineOptionsRegistrar;
import org.apache.beam.sdk.transforms.display.DisplayData;
import org.apache.beam.sdk.util.ApiSurface;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -43,9 +48,17 @@ public void testDirectRunnerApiSurface() throws Exception {
final ClassLoader thisClassLoader = getClass().getClassLoader();
ApiSurface apiSurface =
ApiSurface.ofPackage(thisPackage, thisClassLoader)
// Do not include dependencies that are required based on the known exposures. This
// could alternatively prune everything exposed by the public parts of the Core SDK
.pruningClass(Pipeline.class)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems OK, though org.apache.beam.sdk is already allowed so it should be made automatic. Perhaps this is part of BEAM-2231, making is lazy. Whenever you arrive at a class that is allowed, it should be presumed anything reachable from there is also allowed. Of course, this would make us miss when one of our dependencies mistakenly exposes Guava, for example.

.pruningClass(PipelineRunner.class)
.pruningClass(PipelineOptions.class)
.pruningClass(PipelineOptionsRegistrar.class)
.pruningClass(PipelineOptions.DirectRunner.class)
.pruningClass(DisplayData.Builder.class)
.pruningClass(MetricResults.class)
.pruningPattern("org[.]apache[.]beam[.].*Test.*")
.pruningPattern("org[.]apache[.]beam[.].*IT")
.pruningClass(Nullable.class)
.pruningPattern("java[.]io.*")
.pruningPattern("java[.]lang.*")
.pruningPattern("java[.]util.*");
Expand Down