Skip to content

Conversation

matthewnitschke-wk
Copy link
Contributor

@matthewnitschke-wk matthewnitschke-wk commented Mar 28, 2023

FEA-1596

Issue Status

Previously there were some assumptions in folder paths for resolving references to dart sdk packages. Essentially, we were assuming 'dart-sdk/lib/' would exist in the path to the dart core, which is not a guarantee.

Instead of relying on this, we use the uri for the element's enclosing element: element.enclosingElement.source.uri, which correlates to the path for the element's file in the dart sdk. Ex: dart:core/path/to/whatever.dart, we use this full path for the scip symbol, and use it substringed by / ('dart:core/path/to/whatever.dart'.split('/').first) for retrieving the package name

These changes result in a more consistent calculation of dart sdk symbols, and will work regardless of how dart was installed on the system

@rmconsole-wf
Copy link

rmconsole-wf commented Mar 28, 2023

Merge Requirements Met ✅

Request Rosie to automerge this pull request by including @Workiva/release-management-p in a comment.

General Information

Ticket(s):

Code Review(s): #20
Release Image Tags:

  • drydock.workiva.net/workiva/scip-dart:4417847
  • drydock.workiva.net/workiva/scip-dart:pr-20

Reviewers: evanweible-wf, matthewnitschke-wk

Additional Information

Watchlist Notifications: None

	When this pull is merged I will add it to the following release:
	Version: scip-dart 1.0.4
	Release Ticket(s): RM-183271


Note: This is a shortened report. Click here to view Rosie's full evaluation.
Last updated on Tuesday, March 28 02:09 PM CST

@aviary-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

.substring(sourcePath.indexOf('dart-sdk/lib/') + 'dart-sdk/'.length);

if (element.enclosingElement?.source?.uri != null) {
filePath = element.enclosingElement!.source!.uri.toString();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is pulled directly from how dart resolves the isInSdk check: https://sourcegraph.com/github.com/dart-lang/sdk/-/blob/pkg/analyzer/lib/src/dart/element/element.dart?L4196

Instead of resolving a path to the root, this will return dart:<package>/path/to/file.dart. While this is technically changing the output of the scip, and and a breaking change, since we dont index the sdk and rely on analysis between references/definitions, this should be ok

@matthewnitschke-wk matthewnitschke-wk changed the title resolved dart sdk resolve issue Fixed dart install location issue Mar 28, 2023
@bender-wk bender-wk changed the title Fixed dart install location issue FEA-1596: Fixed dart install location issue Mar 28, 2023
@matthewnitschke-wk matthewnitschke-wk marked this pull request as ready for review March 28, 2023 18:52
@matthewnitschke-wk matthewnitschke-wk requested a review from a team March 28, 2023 18:54
@matthewnitschke-wk
Copy link
Contributor Author

QA +1

Verified scip snapshots are still ok, minor changes to symbols, but since we dont index dart/sdk, everything should be ok

@matthewnitschke-wk
Copy link
Contributor Author

🚀 @Workiva/release-management-p 🚢

Copy link

@rmconsole-wf rmconsole-wf left a comment

Choose a reason for hiding this comment

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

+1 from RM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants