Skip to content

Commit

Permalink
Ensure that only ObjC tests initialize the MockObjcSupport.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 189181919
  • Loading branch information
katre authored and Copybara-Service committed Mar 15, 2018
1 parent a750468 commit 8fb66b3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ public void initializeSkyframeExecutor(boolean doPackageLoadingChecks) throws Ex
analysisMock.getProductName());
actionKeyContext = new ActionKeyContext();
mockToolsConfig = new MockToolsConfig(rootDirectory, false);
analysisMock.setupMockClient(mockToolsConfig);
analysisMock.setupMockWorkspaceFiles(directories.getEmbeddedBinariesRoot());
initializeMockClient();

packageCacheOptions = parsePackageCacheOptions();
skylarkSemanticsOptions = parseSkylarkSemanticsOptions();
Expand Down Expand Up @@ -281,6 +280,11 @@ public void initializeSkyframeExecutor(boolean doPackageLoadingChecks) throws Ex
ResourceManager.instance().setAvailableResources(getStartingResources());
}

public void initializeMockClient() throws IOException {
analysisMock.setupMockClient(mockToolsConfig);
analysisMock.setupMockWorkspaceFiles(directories.getEmbeddedBinariesRoot());
}

protected Map<String, String> getPlatformSetRegexps() {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ public void setup(MockToolsConfig config) throws IOException {
} else {
config.create("tools/cpp/link_dynamic_library.sh", "");
}
MockObjcSupport.setup(config);
MockPlatformSupport.setup(config, "/bazel_tools_workspace/platforms");
MockPlatformSupport.setup(config, "/bazel_tools_workspace/");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.google.devtools.build.lib.rules.cpp.Link;
import com.google.devtools.build.lib.rules.cpp.LinkBuildVariablesTestCase;
import com.google.devtools.build.lib.testutil.TestConstants;
import org.junit.Before;
import java.io.IOException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand All @@ -43,8 +43,9 @@
@RunWith(JUnit4.class)
public class ObjcBuildVariablesTest extends LinkBuildVariablesTestCase {

@Before
public void initializeToolsConfigMock() throws Exception {
@Override
public void initializeMockClient() throws IOException {
super.initializeMockClient();
MockObjcSupport.setup(mockToolsConfig);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import com.google.devtools.build.xcode.bundlemerge.proto.BundleMergeProtos.BundleFile;
import com.google.devtools.build.xcode.bundlemerge.proto.BundleMergeProtos.MergeZip;
import com.google.devtools.build.xcode.plmerge.proto.PlMergeProtos;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
Expand All @@ -95,7 +96,6 @@
import java.util.Locale;
import java.util.Map;
import javax.annotation.Nullable;
import org.junit.Before;

/**
* Superclass for all Obj-C rule tests.
Expand Down Expand Up @@ -260,13 +260,11 @@ protected String execPathEndingWith(Iterable<Artifact> artifacts, String suffix)
return getFirstArtifactEndingWith(artifacts, suffix).getExecPathString();
}

@Before
public final void initializeMockToolsConfig() throws Exception {
@Override
public void initializeMockClient() throws IOException {
super.initializeMockClient();
MockObjcSupport.setup(mockToolsConfig);
MockProtoSupport.setup(mockToolsConfig);

// Set flags required by objc builds.
useConfiguration();
}

protected static String frameworkDir(ConfiguredTarget target) {
Expand Down

0 comments on commit 8fb66b3

Please sign in to comment.