-
Notifications
You must be signed in to change notification settings - Fork 143
Support links in using file directive (implements #1328) #3681
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Michał Pawlik <[email protected]> Co-authored-by: tgodzik <[email protected]>
|
@majk-p @tgodzik It works! Indeed, dependencies are resolved recursively already.
|
Note: need to fix formatting & regenerate reference docs for the CI to pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to skip git+ssh
IMO, we don't support that anywhere else, either.
The solution looks good so far, just need to address the TODOs and add tests
As for tests, maybe can reuse stuff from scala.cli.integration.RunGistTestDefinitions
.
// TODO: reuse existing one? e.g. scala.cli.commands.shared.SharedOptions.coursierCache | ||
lazy val fileCache: FileCache[coursier.util.Task] = FileCache() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I think it's accurate that SharedOptions.coursierCache
should be used.
private def downloadFile(pUri: Positioned[java.net.URI]) = | ||
import scala.build.options.ScalaVersionUtil.fileWithTtl0 | ||
val artifact = Artifact(pUri.value.toString).withChanging(true) | ||
fileCache.fileWithTtl0(artifact) | ||
.left | ||
.map(err => | ||
new MalformedDirectiveError(err.describe, pUri.positions) | ||
) // TODO: better error type | ||
.map(f => os.read.bytes(os.Path(f, Os.pwd))).map(content => | ||
Seq(Virtual(pUri.value.toString, content)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very similar to SharedOptions.downloadInputs
... I wonder if the function itself could be passed all the way here, rather than the cache
new MalformedDirectiveError(err.describe, pUri.positions) | ||
) // TODO: better error type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a new error class would do, I think
Scala Tooling Spree 15.05
see #1328