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.

`ResourcesItem` specification might be incomplete

See original GitHub issue

Related to https://github.com/sbt/sbt/issues/6550 and https://github.com/sbt/sbt/pull/6552

According to the specification, the ResourcesItem contains

export interface ResourcesItem {
  target: BuildTargetIdentifier;
  /** List of resource files. */
  resources: Uri[];
}

I think this is incomplete because the build client might want to know for each resource URI if it is a file or a directory. In the case it is a file, it does not know the relative path of the file to be copied to the target directory.

@jastice Is this part already implemented in IntelliJ and how? Do you think it is worth improving this part of the spec?

As a comparison the content of a SourcesItem is:

export interface SourcesItem {
  target: BuildTargetIdentifer;
  /** The text documents or and directories that belong to this build target. */
  sources: SourceItem[];
  /** The root directories from where source files should be relativized.
   *
   * Example: ["file://Users/name/dev/metals/src/main/scala"]
   */
  roots?: Uri[];
}

export interface SourceItem {
  /** Either a text document or a directory. A directory entry must end with a forward
   * slash "/" and a directory entry implies that every nested text document within the
   * directory belongs to this source item.
   */
  uri: Uri;

  /** Type of file of the source item, such as whether it is file or directory.
   */
  kind: SourceItemKind;

  /** Indicates if this source is automatically generated by the build and is not
   * intended to be manually edited by the user. */
  generated: Boolean;
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
adpi2commented, Jun 22, 2021

Or we can mix the old spec with the new spec so that all the old and new clients/servers can talk to each other:

export interface ResourcesItem {
  target: BuildTargetIdentifer;

  /** The resource files or and directories that belong to this build target. */
  resourceItems: ResourceItem[]

  /** Deprecated version of the resourceItems field
  * Servers should provide it to maintain the compatibility with older clients
  * Clients should try to read resourceItems first and fallback to resources if 
  * resourceItems is not defined.
  */
  resources: Uri[];
}
2reactions
adpi2commented, Jun 22, 2021

My understanding is that files should get added directly to the runtime classpath, without getting relativized by a directory. I’m not sure what effect that has however, I’m unable to load up a resource file that was added directly to the classpath.

Well yes that should work but it would be better if made explicit in the data structure and specification of ResourcesItem.

Also I think the client might need to know if a resource is generated or not for the same reason as a SourceItem:

/** Indicates if this source is automatically generated by the build and is not
   * intended to be manually edited by the user. */

So I think it is worth aligning the ResourceItems structure and spec with the existing SourceItems. It would look like this:

export interface ResourcesItem {
  target: BuildTargetIdentifer;
  /** The resource files or and directories that belong to this build target. */
  resources: ResourceItem[];
}

export interface ResourceItem {
  /** Either a file or a directory.
   * A directory entry must end with a forward slash "/".
   * A directory entry implies that every nested file within the
   * directory belongs to this resource item.
   */
  uri: Uri;

  /** Type of file of the source item, such as whether it is file or directory.
   */
  kind: ResourceItemKind;

  /** Indicates if this resource is automatically generated by the build and is not
   * intended to be manually edited by the user. */
  generated: Boolean;
}

export namespace ResourceItemKind {
  /** The resource item references a normal file.  */
  export const File: Int = 1;
  /** The resource item references a directory. */
  export const Directory: Int = 2;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with bad/incomplete/unclear specifications? [duplicate]
More often than not, the business part of the specs are either incomplete or unaware of what can and can't be done (given...
Read more >
What do you do when specifications are incomplete ... - Quora
Look deeper or re-frame your point of view, as it might be that specs are not missing, and your expectations are wrong. There...
Read more >
[BUG] [Go] Incomplete generation for refs #2980 - GitHub
Description. I'm attempting to generate a client for a spec which includes complex references https://swagger.io/docs/specification/data-models ...
Read more >
RD2.4: Errors Commonly Made in the Construction Documents
RD2.4: Errors Commonly Made in the Construction Documents · Closed Specifications. · Incomplete, Unclear, or Ambiguous Statements. · Inspection and "Approval" by ...
Read more >
Resource provider registration errors - Azure - Microsoft Learn
Describes how to resolve Azure resource provider registration errors for resources deployed with a Bicep file or Azure Resource Manager ...
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