-
Notifications
You must be signed in to change notification settings - Fork 10
Fix linux path for flutter and add xz extractor #190
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
Conversation
Codacy's Analysis Summary3 new issues (≤ 1 medium issue) Review Pull Request in Codacy →
|
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.
Pull request overview
This PR adds support for extracting tar.xz archives and fixes the Flutter plugin configuration to use the correct download URL and file format for Linux systems.
Changes:
- Added
ExtractTarXzfunction and refactored tar extraction to support both gzip and xz compression - Added Linux-specific extension configuration support in
ExtensionConfig - Updated Flutter plugin to use tar.xz for Linux and corrected the download URL template to exclude architecture
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| utils/extract.go | Added ExtractTarXz function and refactored ExtractTar to accept compression type as a parameter |
| plugins/shared.go | Added Linux field to ExtensionConfig struct and updated GetExtension function to handle Linux-specific extensions |
| plugins/runtimes/flutter/plugin.yaml | Updated URL template to remove architecture placeholder, changed Linux extension to tar.xz, and updated arch mappings |
| config/runtimes-installer.go | Added tar.xz file detection and extraction logic in the download and extract workflow |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
plugins/shared.go
Outdated
| if goos == "linux" { | ||
| return extension.Linux | ||
| } |
Copilot
AI
Jan 14, 2026
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.
The GetExtension function should check if extension.Linux is non-empty before returning it. Currently, if a plugin.yaml has 'linux: ""' specified, it will return an empty string instead of falling back to the Default value. Consider adding a check: if goos == "linux" && extension.Linux != "" { return extension.Linux }.
| @@ -1,15 +1,15 @@ | |||
| name: flutter | |||
| description: Dart Flutterruntime | |||
Copilot
AI
Jan 14, 2026
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.
There is a spelling error in the description. 'Flutterruntime' should be 'Flutter runtime' (with a space).
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
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.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Basic assertions for flutter | ||
| assert.Equal(t, "flutter", flutterInfo.Name) | ||
| assert.Equal(t, "3.35.7", flutterInfo.Version) |
Copilot
AI
Jan 14, 2026
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.
The test coverage for Flutter is minimal compared to the Node test. Consider adding assertions to verify the download URL is correctly formatted, the extension is properly set based on the OS (tar.xz for Linux, zip for others), and the install directory is correct. This would help ensure the Flutter-specific configuration changes (linux extension support and removed architecture from URL) work as expected.
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.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| download: | ||
| url_template: "https://storage.googleapis.com/flutter_infra_release/releases/stable/{{.OS}}/flutter_{{.OS}}_{{.Arch}}_{{.Version}}-stable.{{.Extension}}" | ||
| custom_url_config: | ||
| linux: "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_{{.OS}}_{{.Version}}-stable.{{.Extension}}" |
Copilot
AI
Jan 14, 2026
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.
The custom URL template for Linux still contains {{.OS}} placeholder which will be substituted with 'linux', resulting in 'flutter_linux_' in the URL. Based on the URL structure and the fact that tar.xz files don't include architecture, this should likely be just flutter_{{.Version}}-stable.{{.Extension}} without the OS placeholder.
| url_template: "https://storage.googleapis.com/flutter_infra_release/releases/stable/{{.OS}}/flutter_{{.OS}}_{{.Arch}}_{{.Version}}-stable.{{.Extension}}" | ||
| custom_url_config: | ||
| linux: "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_{{.OS}}_{{.Version}}-stable.{{.Extension}}" | ||
| windows: "https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_{{.OS}}_{{.Version}}-stable.{{.Extension}}" |
Copilot
AI
Jan 14, 2026
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.
The custom URL template for Windows contains {{.OS}} placeholder which will be substituted with 'windows', resulting in 'flutter_windows_' in the URL. This is inconsistent with the original url_template which included architecture ({{.Arch}}). If this custom URL is intended to match the actual Flutter download URLs, verify whether Windows downloads should include the {{.Arch}} placeholder or just the OS.
a229a50 to
cbb3e5b
Compare
cbb3e5b to
248c2d4
Compare
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.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
plugins/runtime-utils.go:66
- Consider adding Flutter to the special install directory handling. Flutter uses a constant filename 'flutter' (not version-specific), so it should get the same treatment as Python and Go for a cleaner directory structure. This would match the test expectations where
installDir = runtimesDir + '/flutter'.
// For Python, we want to use a simpler directory structure
var installDir string
if config.Name == "python" {
installDir = path.Join(runtimesDir, "python")
} else if config.Name == "go" {
installDir = path.Join(runtimesDir, "go")
} else {
installDir = path.Join(runtimesDir, fileName)
}
plugins/runtimes/flutter/plugin.yaml:2
- Corrected spacing in 'Dart Flutterruntime' to 'Dart Flutter runtime'.
description: Dart Flutterruntime
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
248c2d4 to
95e200a
Compare
| Default string `yaml:"default"` | ||
| } | ||
|
|
||
| type CustomURLConfig struct { |
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.
Codacy found an issue: exported type CustomURLConfig should have comment or be unexported
| return ExtractTar(archive, targetDir, archiver.Xz{}) | ||
| } | ||
|
|
||
| func ExtractTar(archive *os.File, targetDir string, compression archiver.Compression) error { |
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.
Codacy found an issue: exported function ExtractTar should have comment or be unexported
| return ExtractTar(archive, targetDir, archiver.Gz{}) | ||
| } | ||
|
|
||
| func ExtractTarXz(archive *os.File, targetDir string) error { |
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.
Codacy found an issue: exported function ExtractTarXz should have comment or be unexported
machadoit
left a comment
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.
I think it would be interesting if we revisit this, and stick with only one mechanism for the URL generation. Maybe if/when improvements become a more pressing priority
No description provided.