diff --git a/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java b/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java index 5a728518a1749f..6f64b7a42bc4dd 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java @@ -24,7 +24,9 @@ import com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider.StrictActionEnvOptions; import com.google.devtools.build.lib.bazel.rules.python.BazelPythonConfiguration; import com.google.devtools.build.lib.packages.util.BazelMockCcSupport; +import com.google.devtools.build.lib.packages.util.BazelMockPythonSupport; import com.google.devtools.build.lib.packages.util.MockCcSupport; +import com.google.devtools.build.lib.packages.util.MockPythonSupport; import com.google.devtools.build.lib.packages.util.MockToolsConfig; import com.google.devtools.build.lib.rules.android.AndroidConfiguration; import com.google.devtools.build.lib.rules.apple.AppleConfiguration; @@ -197,6 +199,7 @@ public void setupMockClient(MockToolsConfig config) throws IOException { config.create("/bazel_tools_workspace/objcproto/well_known_type.proto"); ccSupport().setup(config); + pySupport().setup(config); } /** Contents of {@code //tools/android/emulator/BUILD.tools}. */ @@ -334,4 +337,9 @@ public boolean isThisBazel() { public MockCcSupport ccSupport() { return BazelMockCcSupport.INSTANCE; } + + @Override + public MockPythonSupport pySupport() { + return BazelMockPythonSupport.INSTANCE; + } } diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisMock.java b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisMock.java index dfb49dcabc44bf..03368f63f71c2d 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisMock.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisMock.java @@ -24,6 +24,7 @@ import com.google.devtools.build.lib.bazel.rules.android.AndroidSdkRepositoryRule; import com.google.devtools.build.lib.packages.util.LoadingMock; import com.google.devtools.build.lib.packages.util.MockCcSupport; +import com.google.devtools.build.lib.packages.util.MockPythonSupport; import com.google.devtools.build.lib.packages.util.MockToolsConfig; import com.google.devtools.build.lib.rules.cpp.CcSkyframeSupportValue; import com.google.devtools.build.lib.rules.cpp.CcSupportFunction; @@ -114,6 +115,8 @@ public String getDefaultsPackageContent() { public abstract MockCcSupport ccSupport(); + public abstract MockPythonSupport pySupport(); + public void setupCcSupport(MockToolsConfig config) throws IOException { get().ccSupport().setup(config); } @@ -183,6 +186,11 @@ public MockCcSupport ccSupport() { return delegate.ccSupport(); } + @Override + public MockPythonSupport pySupport() { + return delegate.pySupport(); + } + @Override public Collection getOptionOverrides() { return delegate.getOptionOverrides(); diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockPythonSupport.java b/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockPythonSupport.java new file mode 100644 index 00000000000000..c8592759188aa8 --- /dev/null +++ b/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockPythonSupport.java @@ -0,0 +1,28 @@ +// Copyright 2018 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.devtools.build.lib.packages.util; + +import java.io.IOException; + +/** Mock python support in Bazel. */ +public class BazelMockPythonSupport extends MockPythonSupport { + + public static final BazelMockPythonSupport INSTANCE = new BazelMockPythonSupport(); + + @Override + public void setup(MockToolsConfig config) throws IOException { + + } +} diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/MockPythonSupport.java b/src/test/java/com/google/devtools/build/lib/packages/util/MockPythonSupport.java new file mode 100644 index 00000000000000..4852df34bdad88 --- /dev/null +++ b/src/test/java/com/google/devtools/build/lib/packages/util/MockPythonSupport.java @@ -0,0 +1,26 @@ +// Copyright 2018 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.devtools.build.lib.packages.util; + +import java.io.IOException; + +/** + * Creates mock BUILD files required for the python rules. + */ +public abstract class MockPythonSupport { + + /** Setup the support for building Python. */ + public abstract void setup(MockToolsConfig config) throws IOException; +}