question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Separate project and dependency sources for a target

See original GitHub issue

Currently buildTarget/dependencySources will deliver both actual project sources / source directories and library dependency sources in one result.

However these are semantically different. Project sources are part of the actual compilation. Library sources are only used for browsing definitions or generating documentation. Editing them has no effect on the compilation output.

In the general case, it’s not possible to differentiate between project sources and library sources based on file/directory type or location. We are currently using heuristics (directory vs jar), but this is not very robust and doesn’t even cover all cases which can already be supported. For instance, in IntelliJ it’s possible to attach any directory as library sources, and the editor will be aware that it is not part of the project sources.

to be discussed for bsp 2.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
olafurpgcommented, Oct 25, 2018

After discussions with @jvican we came with the following proposal

  • remove buildTarget/textDocuments
  • bloop should not include project source directories in buildTarget/dependencySources
  • add new request endpoint buildTarget/sources
// Request from client to server
trait BuildTargetSourcesParams {
  def targets: List[BuildTargetIdenfitier]
}
// Response from server
trait BuildTargetSourcesResult {
  def items: List[SourcesItem]
}
trait SourcesItem {
  def target: BuildTargetIdentifier
  def sources: List[SourceItem]
}
trait SourceItem {
  /** Represents a directory if the uri ends with a slash /, otherwise a text document */
  def uri: Uri
  def kind: Int
}
object SourceKind {
  val Default = 1
  val AutoGenerated = 2
}
1reaction
jvicancommented, Jun 14, 2018

I think it would make sense to add a field sources in BuildTarget given how generic this property is for any target. Then, we can delegate dependencySources to fetch sources of project dependencies only.

I’ve been thinking about merging this spec change with my proposal in https://github.com/scalacenter/bsp/issues/14 so that the demand of sources of project dependencies is always done by the client explicitly and lazily. However, I think that we should still keep this entrypoint for two reasons:

  1. Simplifies the life of the client implementations.
  2. Some clients may not support this feature at all.

Anyhow, it’s still premature to tell. I’ll get back to this before 2.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Separate project and dependency sources for a target #21
I think project sources and library sources are separate concerns and should be in separate requests. Project sources are a vital part of ......
Read more >
Apache Maven Dependency Plugin – dependency:sources
Description: Goal that resolves the project source dependencies from the repository. Attributes: Requires a Maven project to be executed. Requires dependency ...
Read more >
Make Maven to copy dependencies into target/lib
Works for me with dependencies directory created in target folder. ... which is ${project.build.directory}/dependencies , add a System property named ...
Read more >
Module dependencies | IntelliJ IDEA Documentation - JetBrains
Modules can depend on SDKs, JAR files (libraries) or other modules within a project. When you compile or run your code, the list...
Read more >
Managing multiple projects and their dependencies
Manage related projects in one place using a workspace, or configure build-time dependencies between different Xcode projects using cross-project references ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found