Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.4.2
9.0.0rc3
18 changes: 14 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "rules_bazel_integration_test", version = "0.34.0")
bazel_dep(name = "rules_jvm_external", version = "6.9")

# temporary to bump version of the transitve dependency (drop wit Bazel 9 release)
bazel_dep(name = "aspect_bazel_lib", version = "2.21.2")
bazel_dep(name = "rules_android", version = "0.6.6")
git_override(
module_name = "rules_android",
commit = "a11ce9d817a9a66e4ff2074bbe5c2fa264733547",
patch_strip = 1,
patches = ["//third_party/android/patches:remove_sdk_check.patch"],
remote = "https://github.com/bazelbuild/rules_android.git",
)

# required for aspect tests
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "rules_cc", version = "0.2.14")
Expand Down Expand Up @@ -48,10 +59,8 @@ use_repo(python, "python_3_12", "python_versions")
bazel_binaries = use_extension("@rules_bazel_integration_test//:extensions.bzl", "bazel_binaries")
bazel_binaries.download(version = "6.5.0")
bazel_binaries.download(version = "7.6.2")
bazel_binaries.download(
current = True,
version = "8.4.2",
)
bazel_binaries.download(version = "8.4.2")
bazel_binaries.download(version = "9.0.0rc3")
bazel_binaries.download(version = "last_green")
use_repo(
bazel_binaries,
Expand All @@ -60,6 +69,7 @@ use_repo(
"build_bazel_bazel_6_5_0",
"build_bazel_bazel_7_6_2",
"build_bazel_bazel_8_4_2",
"build_bazel_bazel_9_0_0rc3",
"build_bazel_bazel_last_green",
)

Expand Down
419 changes: 91 additions & 328 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions aspect/python_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
###end
# TEMPLATE-INCLUDE-END

# TEMPLATE-IGNORE-BEGIN
load("@rules_python//python:defs.bzl", RulesPyInfo = "PyInfo")
# TEMPLATE-IGNORE-END

def py_info_in_target(target):
# TEMPLATE-IGNORE-BEGIN
return PyInfo in target
return RulesPyInfo in target
# TEMPLATE-IGNORE-END

# TEMPLATE-INCLUDE-BEGIN
Expand All @@ -23,8 +27,8 @@ def py_info_in_target(target):

def get_py_info(target):
# TEMPLATE-IGNORE-BEGIN
if PyInfo in target:
return target[PyInfo]
if RulesPyInfo in target:
return target[RulesPyInfo]
else:
return None
# TEMPLATE-IGNORE-END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testCcLibrary() throws Exception {
// compilation context
final var compilationCtx = target.getCIdeInfo().getCompilationContext();
assertThat(compilationCtx.getDefinesList()).containsExactly("VERSION2");
assertThat(compilationCtx.getSystemIncludesList()).contains(testRelative("foo/bar"));
assertThat(compilationCtx.getIncludesList()).contains(testRelative("foo/bar"));
assertThat(compilationCtx.getQuoteIncludesList()).contains(".");
assertThat(relativePathsForArtifacts(compilationCtx.getHeadersList()))
.containsExactly(testRelative("simple/simple.h"), testRelative("simple/simple_textual.h"));
Expand All @@ -70,7 +70,7 @@ public void testCcLibrary() throws Exception {
public void testCcLibraryHasToolchain() throws Exception {
final var testFixture = loadTestFixture(":simple_fixture");
final var toolchains = testFixture.getTargetsList().stream()
.filter(x -> x.hasCToolchainIdeInfo() && x.getKindString().equals("cc_toolchain_alias"))
.filter(x -> x.hasCToolchainIdeInfo() && x.getKindString().equals("cc_toolchain"))
.collect(Collectors.toList());

assertThat(toolchains).hasSize(1);
Expand All @@ -90,8 +90,8 @@ public void testCcDependencies() throws Exception {
final var ruleContext = lib1.getCIdeInfo().getRuleContext();
final var compilationContext = lib1.getCIdeInfo().getCompilationContext();

assertThat(compilationContext.getSystemIncludesList()).contains(testRelative("foo/bar"));
assertThat(compilationContext.getSystemIncludesList()).contains(testRelative("baz/lib"));
assertThat(compilationContext.getIncludesList()).contains(testRelative("foo/bar"));
assertThat(compilationContext.getIncludesList()).contains(testRelative("baz/lib"));

assertThat(ruleContext.getCoptsList()).containsExactly("-DGOPT", "-Ifoo/baz/");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void testExternalFilePath() throws Exception {
final var ideInfo = getCIdeInfo("//main:main");
final var sourceFile = ideInfo.getRuleContext().getSources(0);

assertThat(sourceFile.getRootPath()).isEqualTo("external/+_repo_rules+clwb_virtual_includes_project");
assertThat(sourceFile.getRootPath()).isEqualTo("external/+local_repository+clwb_virtual_includes_project");
assertThat(sourceFile.getRelativePath()).isEqualTo("main/main.cc");
assertThat(sourceFile.getIsExternal()).isTrue();
assertThat(sourceFile.getIsSource()).isTrue();
Expand All @@ -76,7 +76,7 @@ public void testCorrectPathToTargetBuildFile() throws Exception {
final var ideInfo = getIdeInfo("//main:main");
final var buildFile = ideInfo.getBuildFileArtifactLocation();

assertThat(buildFile.getRootPath()).isEqualTo("external/+_repo_rules+clwb_virtual_includes_project");
assertThat(buildFile.getRootPath()).isEqualTo("external/+local_repository+clwb_virtual_includes_project");
assertThat(buildFile.getRelativePath()).isEqualTo("main/BUILD");
assertThat(buildFile.getIsExternal()).isTrue();
assertThat(buildFile.getIsSource()).isTrue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.google.idea.blaze.clwb.base.ClwbHeadlessTestCase;
import com.google.idea.blaze.clwb.run.BlazeCidrRemoteDebugProcess;
import com.google.idea.blaze.common.Label;
import com.google.idea.testing.headless.BazelVersionRule;
import com.google.idea.testing.headless.ProjectViewBuilder;
import com.intellij.execution.ExecutionListener;
import com.intellij.execution.ExecutionManager;
Expand Down Expand Up @@ -41,13 +42,18 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import org.jetbrains.annotations.NotNull;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class ExecutionTest extends ClwbHeadlessTestCase {

// catch requires bazel 7+
@Rule
public final BazelVersionRule bazelRule = new BazelVersionRule(7, 0);

private static final String ECHO_OUTPUT_MARKER = "ECHO_OUTPUT_FILE: ";

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.google.idea.blaze.base.bazel.BazelVersion;
import com.google.idea.blaze.clwb.base.ClwbHeadlessTestCase;
import com.google.idea.testing.headless.BazelVersionRule;
import com.google.idea.testing.headless.OSRule;
import com.google.idea.testing.headless.ProjectViewBuilder;
import com.intellij.openapi.vfs.VfsUtilCore;
Expand All @@ -27,6 +28,10 @@ public class LibCppTest extends ClwbHeadlessTestCase {
@Rule
public final OSRule osRule = new OSRule(OS.Linux, OS.macOS);

// catch requires bazel 7+
@Rule
public final BazelVersionRule bazelRule = new BazelVersionRule(7, 0);

@Test
public void testClwb() throws IOException {
assertExists(new File("/usr/bin/clang"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,26 @@
import com.google.idea.blaze.base.lang.buildfile.psi.LoadStatement;
import com.google.idea.blaze.base.sync.autosync.ProjectTargetManager.SyncStatus;
import com.google.idea.blaze.clwb.base.ClwbHeadlessTestCase;
import com.google.idea.testing.headless.BazelVersionRule;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.cidr.lang.workspace.compiler.ClangCompilerKind;
import com.jetbrains.cidr.lang.workspace.compiler.GCCCompilerKind;
import com.jetbrains.cidr.lang.workspace.compiler.MSVCCompilerKind;
import java.io.IOException;
import java.nio.file.Files;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class SimpleTest extends ClwbHeadlessTestCase {

// catch requires bazel 7+
@Rule
public final BazelVersionRule bazelRule = new BazelVersionRule(7, 0);

@Test
public void testClwb() throws IOException {
final var errors = runSync(defaultSyncParams().build());
Expand Down
2 changes: 1 addition & 1 deletion clwb/tests/projects/execution/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bazel_dep(name = "rules_cc", version = "0.2.14")
bazel_dep(name = "catch2", version = "3.7.1")
bazel_dep(name = "catch2", version = "3.11.0")
2 changes: 1 addition & 1 deletion clwb/tests/projects/external_includes/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bazel_dep(name = "rules_cc", version = "0.2.14")
bazel_dep(name = "catch2", version = "3.7.1")
bazel_dep(name = "catch2", version = "3.11.0")
7 changes: 7 additions & 0 deletions clwb/tests/projects/llvm_toolchain/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
bazel_dep(name = "rules_cc", version = "0.2.14")

# temporary to fix missings loads in toolchains_llvm (drop wit Bazel 9 release)
bazel_dep(name = "toolchains_llvm", version = "1.5.0")
git_override(
module_name = "toolchains_llvm",
commit = "43e5dc41535c0f8d4f3573c7373caf10e883e4bb",
remote = "https://github.com/bazel-contrib/toolchains_llvm.git",
)

# Configure and register the toolchain.
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
Expand Down
2 changes: 1 addition & 1 deletion clwb/tests/projects/simple/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bazel_dep(name = "rules_cc", version = "0.2.14")
bazel_dep(name = "catch2", version = "3.7.1")
bazel_dep(name = "catch2", version = "3.11.0")
Empty file.
18 changes: 18 additions & 0 deletions third_party/android/patches/remove_sdk_check.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
We don't need any SDK, so we also don't care what version is there.

diff --git a/rules/android_sdk_repository/rule.bzl b/rules/android_sdk_repository/rule.bzl
index cc06816..1acc819 100644
--- a/rules/android_sdk_repository/rule.bzl
+++ b/rules/android_sdk_repository/rule.bzl
@@ -135,11 +135,6 @@ def _android_sdk_repository_impl(repo_ctx):
# Check validity of build_tools
if not build_tools:
fail("Unable to determine build tools version")
- if compare_android_revisions(build_tools, _MIN_BUILD_TOOLS_VERSION) != build_tools:
- fail("Bazel requires Android build tools version %s or newer, %s was provided" % (
- _MIN_BUILD_TOOLS_VERSION.dir,
- build_tools.dir,
- ))

# Determine system image dirs
system_images = _find_system_images(repo_ctx, android_sdk_path)