Skip to content

Commit 82663c8

Browse files
authored
Add IntelliJAspectStrategy for the new IntelliJ aspect (#8356)
Adds a new aspect strategy (IntelliJAspectStarategy) for the new Intllij aspect (https://github.com/JetBrains/intellij-aspect). The new aspect is disabled by default but can be enabled with the bazel.sync.use.intellij.aspect registry key or form the command line for testing with --//clwb:use_intellij_aspect=true flag.
1 parent a50733e commit 82663c8

56 files changed

Lines changed: 1532 additions & 1436 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelci/clion.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,23 @@ tasks:
129129
test_targets:
130130
- //:clwb_tests
131131
soft_fail: false
132+
CLion-Linux-OSS-latest-stable-intellij-aspect:
133+
name: CLion Linux OSS Latest Stable (IntelliJ Aspect)
134+
platform: ubuntu2204
135+
build_flags:
136+
- --lockfile_mode=error
137+
- --define=ij_product=clion-oss-latest-stable
138+
- --//clwb:use_intellij_aspect=true
139+
build_targets:
140+
- //clwb:clwb_bazel_zip
141+
- //clwb:headless_tests
142+
test_flags:
143+
- --define=ij_product=clion-oss-latest-stable
144+
- --//clwb:use_intellij_aspect=true
145+
- --test_output=errors
146+
test_targets:
147+
- //clwb:headless_tests
148+
soft_fail: true
132149
CLion-last-green:
133150
name: CLion Headless Tests Last Green
134151
platform: ubuntu2204

MODULE.bazel

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,23 @@ bazel_dep(name = "protobuf", version = "35.0")
66
bazel_dep(name = "bazel_skylib", version = "1.9.0")
77
bazel_dep(name = "rules_pkg", version = "1.2.0")
88
bazel_dep(name = "rules_jvm_external", version = "7.0")
9+
bazel_dep(name = "rules_kotlin", version = "2.3.20")
10+
11+
register_toolchains("//third_party/kotlin:toolchain")
912

1013
# required for aspect tests
1114
bazel_dep(name = "rules_shell", version = "0.8.0")
1215
bazel_dep(name = "rules_cc", version = "0.2.18")
1316
bazel_dep(name = "abseil-cpp", version = "20250814.2")
1417

18+
# dependency on the new aspect's sdk
19+
bazel_dep(name = "intellij_aspect_sdk")
20+
git_override(
21+
module_name = "intellij_aspect_sdk",
22+
commit = "6149b049b48845ba8aec82ea11861c31414f7576",
23+
remote = "https://github.com/JetBrains/intellij-aspect.git",
24+
)
25+
1526
# import clwb test projects for aspect tests
1627
local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")
1728

@@ -33,16 +44,6 @@ single_version_override(
3344
patches = ["//third_party/bazel/patches:rules_bazel_integration_test.patch"],
3445
)
3546

36-
# custom rules kotlin version, patches are required
37-
bazel_dep(name = "rules_kotlin", version = "2.3.20")
38-
single_version_override(
39-
module_name = "rules_kotlin",
40-
patch_strip = 1,
41-
patches = ["//third_party/kotlin/patches:strip_stdlib.patch"],
42-
)
43-
44-
register_toolchains("//third_party/kotlin:toolchain")
45-
4647
# configure python cor rules_python
4748
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
4849
python.toolchain(

MODULE.bazel.lock

Lines changed: 1108 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aspect/testing/rules/BUILD

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ licenses(["notice"])
99
proto_library(
1010
name = "intellij_aspect_test_fixture_proto",
1111
srcs = ["intellij_aspect_test_fixture.proto"],
12-
deps = ["//proto:intellij_ide_info_proto"],
12+
deps = ["@intellij_aspect_sdk//sdk/proto:ide_info_proto"],
1313
)
1414

1515
java_proto_library(
@@ -26,7 +26,7 @@ java_binary(
2626
deps = [
2727
":intellij_aspect_test_fixture_java_proto",
2828
"//aspect/testing:guava",
29-
"//proto:intellij_ide_info_java_proto",
29+
"//proto:proto_deps",
3030
"@protobuf//:protobuf_java",
3131
],
3232
)
@@ -40,8 +40,7 @@ java_library(
4040
":intellij_aspect_test_fixture_java_proto",
4141
"//aspect/testing:guava",
4242
"//intellij_platform_sdk:jsr305",
43-
"//proto:common_java_proto",
44-
"//proto:intellij_ide_info_java_proto",
43+
"//proto:proto_deps",
4544
"//third_party/java/junit",
4645
],
4746
)

aspect/testing/rules/intellij_aspect_test_fixture.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
syntax = "proto3";
1616

17-
import "proto/intellij_ide_info.proto";
17+
import "sdk/proto/ide_info.proto";
1818

1919
package blaze;
2020

aspect/testing/rules/src/com/google/idea/blaze/aspect/IntellijAspectTest.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import com.google.devtools.intellij.aspect.Common.ArtifactLocation;
2626
import com.google.devtools.intellij.ideinfo.IntellijIdeInfo.Dependency;
2727
import com.google.devtools.intellij.ideinfo.IntellijIdeInfo.Dependency.DependencyType;
28-
import com.google.devtools.intellij.ideinfo.IntellijIdeInfo.LibraryArtifact;
2928
import com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo;
3029
import com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetKey;
3130
import java.io.File;
@@ -221,42 +220,6 @@ protected Dependency dep(TargetIdeInfo targetIdeInfo) {
221220
.build();
222221
}
223222

224-
protected static String libraryArtifactToString(LibraryArtifact libraryArtifact) {
225-
StringBuilder stringBuilder = new StringBuilder();
226-
if (libraryArtifact.hasJar()) {
227-
stringBuilder.append("<jar:");
228-
stringBuilder.append(libraryArtifact.getJar().getRelativePath());
229-
stringBuilder.append(">");
230-
}
231-
if (libraryArtifact.hasInterfaceJar()) {
232-
stringBuilder.append("<ijar:");
233-
stringBuilder.append(libraryArtifact.getInterfaceJar().getRelativePath());
234-
stringBuilder.append(">");
235-
}
236-
if (libraryArtifact.hasSourceJar()) {
237-
stringBuilder.append("<source:");
238-
stringBuilder.append(libraryArtifact.getSourceJar().getRelativePath());
239-
stringBuilder.append(">");
240-
}
241-
242-
return stringBuilder.toString();
243-
}
244-
245-
/** Constructs a string that matches OutputJar#toString for comparison testing. */
246-
protected static String jarString(String jar, String iJar, String sourceJar) {
247-
StringBuilder sb = new StringBuilder();
248-
if (jar != null) {
249-
sb.append("<jar:" + jar + ">");
250-
}
251-
if (iJar != null) {
252-
sb.append("<ijar:" + iJar + ">");
253-
}
254-
if (sourceJar != null) {
255-
sb.append("<source:" + sourceJar + ">");
256-
}
257-
return sb.toString();
258-
}
259-
260223
protected static Iterable<String> relativePathsForArtifacts(List<ArtifactLocation> sourcesList) {
261224
return sourcesList.stream().map(ArtifactLocation::getRelativePath).collect(toList());
262225
}

aspect/testing/tests/src/com/google/idea/blaze/aspect/cpp/ccbinary/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ java_test(
4444
"//aspect/testing/rules:IntellijAspectTest",
4545
"//aspect/testing/rules:intellij_aspect_test_fixture_java_proto",
4646
"//intellij_platform_sdk:test_libs",
47-
"//proto:intellij_ide_info_java_proto",
47+
"//proto:proto_deps",
4848
"//third_party/java/junit",
4949
],
5050
)

aspect/testing/tests/src/com/google/idea/blaze/aspect/cpp/cclibrary/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ cc_library(
1818
"other/headers",
1919
],
2020
defines = ["VERSION2"],
21-
local_defines = ["LOCAL_DEFINE"],
2221
includes = ["foo/bar"],
22+
local_defines = ["LOCAL_DEFINE"],
2323
textual_hdrs = ["simple/simple_textual.h"],
2424
)
2525

@@ -67,7 +67,7 @@ java_test(
6767
"//aspect/testing/rules:IntellijAspectTest",
6868
"//aspect/testing/rules:intellij_aspect_test_fixture_java_proto",
6969
"//intellij_platform_sdk:test_libs",
70-
"//proto:intellij_ide_info_java_proto",
70+
"//proto:proto_deps",
7171
"//third_party/java/junit",
7272
],
7373
)

aspect/testing/tests/src/com/google/idea/blaze/aspect/cpp/cctest/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ java_test(
2828
"//aspect/testing/rules:IntellijAspectTest",
2929
"//aspect/testing/rules:intellij_aspect_test_fixture_java_proto",
3030
"//intellij_platform_sdk:test_libs",
31-
"//proto:intellij_ide_info_java_proto",
31+
"//proto:proto_deps",
3232
"//third_party/java/junit",
3333
],
3434
)

aspect/testing/tests/src/com/google/idea/blaze/aspect/cpp/cctest/CcTestTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public void testCcTest() throws Exception {
3535
assertThat(target.getKind()).isEqualTo("cc_test");
3636

3737
assertThat(target.hasCIdeInfo()).isTrue();
38-
assertThat(target.hasJavaIdeInfo()).isFalse();
3938
CIdeInfo cTargetIdeInfo = target.getCIdeInfo();
4039

4140
assertThat(cTargetIdeInfo.getRuleContext().getCoptsList()).isEmpty();

0 commit comments

Comments
 (0)