Skip to content

Commit

Permalink
Prepare Bazel unit tests for loading top-level symbols from rules_java
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 623470267
Change-Id: I203929d7a3f8626aba71c6f1af7d1df82096b37e
  • Loading branch information
hvadehra authored and Copybara-Service committed Apr 10, 2024
1 parent c8fcfd4 commit 999762d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider;
import com.google.devtools.build.lib.analysis.ShellConfiguration;
import com.google.devtools.build.lib.analysis.util.AbstractMockJavaSupport;
import com.google.devtools.build.lib.analysis.util.AnalysisMock;
import com.google.devtools.build.lib.bazel.bzlmod.LocalPathOverride;
import com.google.devtools.build.lib.bazel.bzlmod.NonRegistryOverride;
Expand Down Expand Up @@ -968,6 +969,11 @@ public MockCcSupport ccSupport() {
return BazelMockCcSupport.INSTANCE;
}

@Override
public AbstractMockJavaSupport javaSupport() {
return AbstractMockJavaSupport.BAZEL;
}

@Override
public MockPythonSupport pySupport() {
return BazelMockPythonSupport.INSTANCE;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2024 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.analysis.util;

import com.google.devtools.build.lib.packages.util.MockToolsConfig;
import java.io.IOException;

public abstract class AbstractMockJavaSupport {

public static final AbstractMockJavaSupport BAZEL =
new AbstractMockJavaSupport() {
@Override
public void setupRulesJava(MockToolsConfig mockToolsConfig) {
// nothing special required
}
};

public abstract void setupRulesJava(MockToolsConfig mockToolsConfig) throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ public void setupMockToolsRepository(MockToolsConfig config) throws IOException

public abstract MockCcSupport ccSupport();

public abstract AbstractMockJavaSupport javaSupport();

public abstract MockPythonSupport pySupport();

public ImmutableMap<SkyFunctionName, SkyFunction> getSkyFunctions(BlazeDirectories directories) {
Expand Down Expand Up @@ -272,6 +274,11 @@ public MockCcSupport ccSupport() {
return delegate.ccSupport();
}

@Override
public AbstractMockJavaSupport javaSupport() {
return delegate.javaSupport();
}

@Override
public MockPythonSupport pySupport() {
return delegate.pySupport();
Expand Down

0 comments on commit 999762d

Please sign in to comment.