Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: fetch missing dependency sources #5819

Merged
merged 5 commits into from
Dec 12, 2023

Conversation

kasiaMarek
Copy link
Contributor

@kasiaMarek kasiaMarek commented Nov 7, 2023

When build server fails to provide dependency sources for a build target metals will try to resolve/download the missing sources.
resolves: #4780

@kasiaMarek kasiaMarek force-pushed the fetch-deps-sources branch 2 times, most recently from 1955642 to 0610210 Compare November 9, 2023 11:53
@kasiaMarek kasiaMarek marked this pull request as ready for review November 21, 2023 11:30
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

Great work! Just two comments.

.when(groupId.nonEmpty && version.nonEmpty && artifactId.nonEmpty) {
Dependency.of(groupId, artifactId, version)
}
.filterNot(dep => isSbtDap(dep) || isMetalsPlugin(dep))
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we filter those out? This might be added manually to the build even by the user. There is no way to see if it was added on purpose or automatically. I think it's fine to leave it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't get sbt-debug-adapter to resolve correctly.

private def fetchDependencySources(
dependency: Dependency
): List[Path] = {
Fetch
Copy link
Contributor

Choose a reason for hiding this comment

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

Forgot about it and I think we do it wrong in most places. Could we make sure we handle an issue if there is no internet available? Make sure it doesn't get stuck etc. Probably we should have some timeout and do it in a separate future

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

Minor changes, but looks good!

.addClassifiers(Classifier.sources)
.future()
.map(_.map(_.toPath()).toList)
.withTimeout(5, TimeUnit.MINUTES)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.withTimeout(5, TimeUnit.MINUTES)
.withTimeout(1, TimeUnit.MINUTES)

would be enough I think

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if could fail quickly if maven central is not available?

@kasiaMarek kasiaMarek requested a review from tgodzik December 11, 2023 14:54
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM!

@tgodzik tgodzik merged commit 67ec987 into scalameta:main Dec 12, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

goto definition in sbt file when using sbt as a Build Server doesn't work even though Doctor shows it should
2 participants