Add download-dependencies script#100
Open
iFreilicht wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
Currently, the extension downloads some of its runtime dependencies on-the-fly after starting for the first time. This does not work for air-gapped or otherwise restricted environments without access to the internet. It's also suboptimal for remote development environments (like Coder, GitLab Workspaces, Posit Workbench, etc.) that run vscode from within a docker container. In these cases, pre-downloading the runtime dependencies into the docker container without running vscode is very useful. Potentially, one might want to publish a version with the dependencies built in on an internal registry, too.
Solution
To satisfy these use cases, I wrote a script that imports the relevant functionality for downloading the runtime dependencies directly from the extension modules and executes them such that the dependencies are downloaded to
./dist, where the extension would be built as well.Testing
I've already tested this script extensively in our own environments and on my macOS development machine with multiple versions of the extension (down to 2.90.60, which we have to run on some systems) and it seems to work perfectly, i.e. the extension no longer displays any logs about downloading its dependencies and all analysis features work as expected.
I have not tested this script on Windows.
I am also unsure how one would write an integration test for this, my overview over the codebase is currently not sufficient for that.
Alternatives
Right now, there's one universal build of the extension. All platform-specific dependencies are downloaded on startup. It might also be possible to publish separate builds of the extension for every supported platform that already includes the dependencies. This would increase the size of the extension bundle by ~120MB AFAICT and would complicate the release process.
I opted for this simpler approach because my usecase is admittedly quite niche already, so it seems unreasonable to expect you to dedicate such a high amount of work to satisfying it. This small script seems almost trivial in maintenance cost.
Disclosure of AI Assistance
The script was mostly written with GitHub Copilot using Claude Sonnet 4.6. I gave it a pretty clear prompt based on my own understanding of the codebase:
Afterwards, I reviewed the entire script and did some small modifications (like not hardcoding the platform).