Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
[breaking change] project view section bazel_path has been renamed …
Browse files Browse the repository at this point in the history
…to `bazel_binary` | #BAZEL-505 Done

changelog update

bazel path -> bazel binary

Merge-request: BAZEL-MR-354
Merged-by: Marcin Abramowicz <[email protected]>
  • Loading branch information
abrams27 authored and Space Team committed Jul 7, 2023
1 parent 920b682 commit 5bd2a06
Show file tree
Hide file tree
Showing 37 changed files with 249 additions and 249 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Project view file is obligatory now! Server requires path to the file in `argv` in `.bsp/bazelbsp.json`.
Debugger address (`debugger_address`), java path (`java_path`) and flag for trace log (`produce_trace_log`) are *no
longer* fields in project view files! They can be set *only* using installer flags (check [README](install/README.md)).
- Project view `bazel_path` has been renamed to `bazel_binary` (now it's compatible with https://ij.bazel.build/docs/project-views.html#bazel_binary).

### Features 🎉
- Enhance support for Kotlin by providing Kotlin target's specific info.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ class BazelRunner private constructor(
.also { bspClientLogger.withOriginId(originId).message(it) }
}

private fun bazel(workspaceContext: WorkspaceContext): String = workspaceContext.bazelPath.value.toString()
private fun bazel(workspaceContext: WorkspaceContext): String = workspaceContext.bazelBinary.value.toString()
private fun buildFlags(workspaceContext: WorkspaceContext): List<String> = workspaceContext.buildFlags.values
}
6 changes: 3 additions & 3 deletions executioncontext/projectview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ For more details, see `--help`.
Imports another project view.

You may use multiple imports in any project view. Any list type sections (e.g. `targets`) compose. Single-value
sections (e.g. `bazel_path`) override and use the last one encountered, depth-first parse order (i.e. imports are
sections (e.g. `bazel_binary`) override and use the last one encountered, depth-first parse order (i.e. imports are
evaluated as they are encountered).

##### example:
Expand Down Expand Up @@ -68,14 +68,14 @@ targets:

---

#### bazel_path
#### bazel_binary

Path to bazel which will be used to invoke bazel from the server (e.g. to build a project, or query bazel).

##### example:

```
bazel_path: /usr/local/bin/bazel
bazel_binary: /usr/local/bin/bazel
```

##### default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.jetbrains.bsp.bazel.projectview.generator

import io.vavr.control.Try
import org.jetbrains.bsp.bazel.projectview.generator.sections.ProjectViewTargetsSectionGenerator
import org.jetbrains.bsp.bazel.projectview.generator.sections.ProjectViewBazelPathSectionGenerator
import org.jetbrains.bsp.bazel.projectview.generator.sections.ProjectViewBazelBinarySectionGenerator
import org.jetbrains.bsp.bazel.projectview.generator.sections.ProjectViewBuildFlagsSectionGenerator
import org.jetbrains.bsp.bazel.projectview.generator.sections.ProjectViewBuildManualTargetsSectionGenerator
import org.jetbrains.bsp.bazel.projectview.generator.sections.*
Expand All @@ -21,7 +21,7 @@ object DefaultProjectViewGenerator : ProjectViewGenerator {
override fun generatePrettyString(projectView: ProjectView): String =
listOfNotNull(
ProjectViewTargetsSectionGenerator.generatePrettyString(projectView.targets),
ProjectViewBazelPathSectionGenerator.generatePrettyString(projectView.bazelPath),
ProjectViewBazelBinarySectionGenerator.generatePrettyString(projectView.bazelBinary),
ProjectViewBuildFlagsSectionGenerator.generatePrettyString(projectView.buildFlags),
ProjectViewBuildManualTargetsSectionGenerator.generatePrettyString(projectView.buildManualTargets),
ProjectViewDirectoriesSectionGenerator.generatePrettyString(projectView.directories),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jetbrains.bsp.bazel.projectview.generator.sections

import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewSingletonSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewBazelPathSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewBazelBinarySection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewBuildManualTargetsSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewDeriveTargetsFromDirectoriesSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewImportDepthSection
Expand All @@ -18,7 +18,7 @@ abstract class ProjectViewSingletonSectionGenerator<in T : ProjectViewSingletonS
"${section.sectionName}: ${section.value}"
}

object ProjectViewBazelPathSectionGenerator : ProjectViewSingletonSectionGenerator<ProjectViewBazelPathSection>()
object ProjectViewBazelBinarySectionGenerator : ProjectViewSingletonSectionGenerator<ProjectViewBazelBinarySection>()

object ProjectViewBuildManualTargetsSectionGenerator : ProjectViewSingletonSectionGenerator<ProjectViewBuildManualTargetsSection>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import io.vavr.control.Try
import org.apache.logging.log4j.LogManager
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewSingletonSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewTargetsSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewBazelPathSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewBazelBinarySection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewBuildFlagsSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewBuildManualTargetsSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewDeriveTargetsFromDirectoriesSection
Expand All @@ -23,7 +23,7 @@ data class ProjectView constructor(
/** targets included and excluded from the project */
val targets: ProjectViewTargetsSection?,
/** bazel path used to invoke bazel from the code */
val bazelPath: ProjectViewBazelPathSection?,
val bazelBinary: ProjectViewBazelBinarySection?,
/** bazel flags added to all bazel command invocations */
val buildFlags: ProjectViewBuildFlagsSection?,
/** flag for building manual targets. */
Expand All @@ -39,7 +39,7 @@ data class ProjectView constructor(
data class Builder constructor(
private val imports: List<Try<ProjectView>> = emptyList(),
private val targets: ProjectViewTargetsSection? = null,
private val bazelPath: ProjectViewBazelPathSection? = null,
private val bazelBinary: ProjectViewBazelBinarySection? = null,
private val buildFlags: ProjectViewBuildFlagsSection? = null,
private val buildManualTargets: ProjectViewBuildManualTargetsSection? = null,
private val directories: ProjectViewDirectoriesSection? = null,
Expand All @@ -58,7 +58,7 @@ data class ProjectView constructor(

private fun buildWithImports(importedProjectViews: List<ProjectView>): ProjectView {
val targets = combineTargetsSection(importedProjectViews)
val bazelPath = combineBazelPathSection(importedProjectViews)
val bazelBinary = combineBazelBinarySection(importedProjectViews)
val buildFlags = combineBuildFlagsSection(importedProjectViews)
val buildManualTargets = combineManualTargetsSection(importedProjectViews)
val directories = combineDirectoriesSection(importedProjectViews)
Expand All @@ -67,14 +67,14 @@ data class ProjectView constructor(
log.debug(
"Building project view with combined"
+ " targets: {},"
+ " bazel path: {},"
+ " bazel binary: {},"
+ " build flags: {}"
+ " build manual targets {},"
+ " directories: {},"
+ " deriveTargetsFlag: {}."
+ " import depth: {},",
targets,
bazelPath,
bazelBinary,
buildFlags,
buildManualTargets,
directories,
Expand All @@ -83,7 +83,7 @@ data class ProjectView constructor(
)
return ProjectView(
targets,
bazelPath,
bazelBinary,
buildFlags,
buildManualTargets,
directories,
Expand Down Expand Up @@ -173,8 +173,8 @@ data class ProjectView constructor(
values: List<V>, constructor: (List<V>) -> T
): T? = if (values.isEmpty()) null else constructor(values)

private fun combineBazelPathSection(importedProjectViews: List<ProjectView>): ProjectViewBazelPathSection? =
bazelPath ?: getLastImportedSingletonValue(importedProjectViews, ProjectView::bazelPath)
private fun combineBazelBinarySection(importedProjectViews: List<ProjectView>): ProjectViewBazelBinarySection? =
bazelBinary ?: getLastImportedSingletonValue(importedProjectViews, ProjectView::bazelBinary)

private fun combineManualTargetsSection(importedProjectViews: List<ProjectView>): ProjectViewBuildManualTargetsSection? =
buildManualTargets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ data class ProjectViewDeriveTargetsFromDirectoriesSection(override val value: Bo
}
}

data class ProjectViewBazelPathSection(override val value: Path) :
data class ProjectViewBazelBinarySection(override val value: Path) :
ProjectViewSingletonSection<Path>(SECTION_NAME) {
companion object {
const val SECTION_NAME = "bazel_path"
const val SECTION_NAME = "bazel_binary"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import io.vavr.control.Try
import org.apache.logging.log4j.LogManager
import org.jetbrains.bsp.bazel.projectview.model.ProjectView
import org.jetbrains.bsp.bazel.projectview.parser.sections.ProjectViewTargetsSectionParser
import org.jetbrains.bsp.bazel.projectview.parser.sections.ProjectViewBazelPathSectionParser
import org.jetbrains.bsp.bazel.projectview.parser.sections.ProjectViewBazelBinarySectionParser
import org.jetbrains.bsp.bazel.projectview.parser.sections.ProjectViewBuildFlagsSectionParser
import org.jetbrains.bsp.bazel.projectview.parser.sections.ProjectViewBuildManualTargetsSectionParser
import org.jetbrains.bsp.bazel.projectview.parser.sections.ProjectViewDeriveTargetsFromDirectoriesSectionParser
Expand Down Expand Up @@ -44,7 +44,7 @@ open class DefaultProjectViewParser : ProjectViewParser {
return ProjectView.Builder(
imports = findImportedProjectViews(rawSections),
targets = ProjectViewTargetsSectionParser.parse(rawSections),
bazelPath = ProjectViewBazelPathSectionParser.parse(rawSections),
bazelBinary = ProjectViewBazelBinarySectionParser.parse(rawSections),
buildFlags = ProjectViewBuildFlagsSectionParser.parse(rawSections),
buildManualTargets = ProjectViewBuildManualTargetsSectionParser.parse(rawSections),
directories = ProjectViewDirectoriesSectionParser.parse(rawSections),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jetbrains.bsp.bazel.projectview.parser.sections

import org.apache.logging.log4j.LogManager
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewBazelPathSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewBazelBinarySection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewSingletonSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewBuildManualTargetsSection
import org.jetbrains.bsp.bazel.projectview.model.sections.ProjectViewDeriveTargetsFromDirectoriesSection
Expand Down Expand Up @@ -44,12 +44,12 @@ abstract class ProjectViewSingletonSectionParser<V, T : ProjectViewSingletonSect
}


object ProjectViewBazelPathSectionParser :
ProjectViewSingletonSectionParser<Path, ProjectViewBazelPathSection>(ProjectViewBazelPathSection.SECTION_NAME) {
object ProjectViewBazelBinarySectionParser :
ProjectViewSingletonSectionParser<Path, ProjectViewBazelBinarySection>(ProjectViewBazelBinarySection.SECTION_NAME) {

override fun mapRawValue(rawValue: String): Path = Path(rawValue)

override fun createInstance(value: Path): ProjectViewBazelPathSection = ProjectViewBazelPathSection(value)
override fun createInstance(value: Path): ProjectViewBazelBinarySection = ProjectViewBazelBinarySection(value)
}

object ProjectViewDeriveTargetsFromDirectoriesSectionParser :
Expand Down
Loading

0 comments on commit 5bd2a06

Please sign in to comment.