Skip to content

Add IntelliJAspectStrategy for the new IntelliJ aspect - #8356

Merged
LeFrosch merged 9 commits into
bazelbuild:masterfrom
LeFrosch:pull/5c64e151218ecd480d7f4488e8af8a9495b7cb99
Jun 11, 2026
Merged

Add IntelliJAspectStrategy for the new IntelliJ aspect#8356
LeFrosch merged 9 commits into
bazelbuild:masterfrom
LeFrosch:pull/5c64e151218ecd480d7f4488e8af8a9495b7cb99

Conversation

@LeFrosch

@LeFrosch LeFrosch commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new IntelliJ split aspect strategy (intellij_aspect_sdk) to replace the legacy bundled aspect, refactoring AspectStrategy to support multiple strategies via providers. It cleans up the codebase by removing legacy aspect-related classes, custom Kotlin patches, and several local proto definitions in favor of the SDK's protos. Feedback on the changes highlights a compilation error in IntelliJAspectWriter.kt due to a type mismatch in WorkspaceRoot.relativize, and suggests replacing getOrNull() with standard Java orElse(null) in IntelliJAspectStrategy.kt to avoid JVM-specific imports.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

try {
deployAspectZip(
workspaceRoot = workspaceRoot.path(),
relativeDestination = workspaceRoot.relativize(normalized),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The WorkspaceRoot.relativize method typically expects a File rather than a Path, and returns a WorkspacePath instead of a standard java.nio.file.Path. Since deployAspectZip expects a Path for relativeDestination, calling workspaceRoot.relativize(normalized) will cause a compilation error. Relativizing on workspaceRoot.path() (which is a Path) resolves this type mismatch.

Suggested change
relativeDestination = workspaceRoot.relativize(normalized),
relativeDestination = workspaceRoot.path().relativize(normalized),

Comment on lines +57 to +59
val aspects = Aspects.forRules(toAspectRules(activeLanguages)).mapNotNull { aspect ->
resolve(project, "${aspect.pkg}/${aspect.file}").map { "$it%${aspect.aspect}" }.getOrNull()
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using getOrNull() on Optional requires importing kotlin.jvm.optionals.getOrNull which is JVM-specific and requires Kotlin 1.8+. Using the standard Java orElse(null) is cleaner, more compatible, and allows you to remove the unused import on line 30.

Suggested change
val aspects = Aspects.forRules(toAspectRules(activeLanguages)).mapNotNull { aspect ->
resolve(project, "${aspect.pkg}/${aspect.file}").map { "$it%${aspect.aspect}" }.getOrNull()
}
val aspects = Aspects.forRules(toAspectRules(activeLanguages)).mapNotNull { aspect ->
resolve(project, "${aspect.pkg}/${aspect.file}").map { "$it%${aspect.aspect}" }.orElse(null)
}

@LeFrosch
LeFrosch marked this pull request as ready for review June 9, 2026 14:03
@LeFrosch
LeFrosch requested review from mai93 and ujohnny as code owners June 9, 2026 14:03
@github-actions github-actions Bot added product: CLion CLion plugin product: IntelliJ IntelliJ plugin product: GoLand GoLand plugin awaiting-review Awaiting review from Bazel team on PRs labels Jun 9, 2026
@LeFrosch
LeFrosch merged commit 82663c8 into bazelbuild:master Jun 11, 2026
6 checks passed
@LeFrosch
LeFrosch deleted the pull/5c64e151218ecd480d7f4488e8af8a9495b7cb99 branch June 11, 2026 09:23
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in Bazel IntelliJ Plugin Jun 11, 2026
@github-actions github-actions Bot removed the awaiting-review Awaiting review from Bazel team on PRs label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: CLion CLion plugin product: GoLand GoLand plugin product: IntelliJ IntelliJ plugin

Projects

Development

Successfully merging this pull request may close these issues.

2 participants