-
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
Changes from all commits
aa33063
842b7cb
8f52a24
c7420e4
95e200a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,10 +3,13 @@ description: Dart Flutterruntime | |
| default_version: "3.7.2" | ||
| 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}}" | ||
|
||
| windows: "https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_{{.OS}}_{{.Version}}-stable.{{.Extension}}" | ||
|
||
| file_name_template: "flutter" | ||
| extension: | ||
| default: "zip" | ||
| linux: "tar.xz" | ||
| default: "zip" | ||
| arch_mapping: | ||
| "386": "ia32" | ||
| "amd64": "x64" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,13 +8,22 @@ | |
|
|
||
| // ExtensionConfig defines the file extension based on OS | ||
| type ExtensionConfig struct { | ||
| Linux string `yaml:"linux"` | ||
| Windows string `yaml:"windows"` | ||
| Default string `yaml:"default"` | ||
| } | ||
|
|
||
| type CustomURLConfig struct { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| Linux string `yaml:"linux"` | ||
| Windows string `yaml:"windows"` | ||
| MacOS string `yaml:"macos"` | ||
| Default string `yaml:"default"` | ||
| } | ||
|
|
||
| // DownloadConfig holds the download configuration from the plugin.yaml | ||
| type DownloadConfig struct { | ||
| URLTemplate string `yaml:"url_template"` | ||
| CustomURLConfig CustomURLConfig `yaml:"custom_url_config,omitempty"` | ||
| FileNameTemplate string `yaml:"file_name_template"` | ||
| Extension ExtensionConfig `yaml:"extension"` | ||
| ArchMapping map[string]string `yaml:"arch_mapping"` | ||
|
|
@@ -80,9 +89,33 @@ | |
| if goos == "windows" { | ||
| return extension.Windows | ||
| } | ||
| if goos == "linux" && extension.Linux != "" { | ||
| return extension.Linux | ||
| } | ||
| return extension.Default | ||
| } | ||
|
|
||
| func getCustomDownloadURL(customURLConfig CustomURLConfig, goos string) (string, bool) { | ||
| switch goos { | ||
| case "linux": | ||
| if customURLConfig.Linux != "" { | ||
| return customURLConfig.Linux, true | ||
| } | ||
| case "windows": | ||
| if customURLConfig.Windows != "" { | ||
| return customURLConfig.Windows, true | ||
| } | ||
| case "darwin": | ||
| if customURLConfig.MacOS != "" { | ||
| return customURLConfig.MacOS, true | ||
| } | ||
| } | ||
| if customURLConfig.Default != "" { | ||
| return customURLConfig.Default, true | ||
| } | ||
| return "", false | ||
| } | ||
|
|
||
| // GetMajorVersion extracts the major version from a version string (e.g. "17.0.10" -> "17") | ||
| func GetMajorVersion(version string) string { | ||
| if idx := strings.Index(version, "."); idx != -1 { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,8 +14,16 @@ | |
| ) | ||
|
|
||
| func ExtractTarGz(archive *os.File, targetDir string) error { | ||
| 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 commentThe 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 |
||
| 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 commentThe 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 |
||
| format := archiver.CompressedArchive{ | ||
| Compression: archiver.Gz{}, | ||
| Compression: compression, | ||
| Archival: archiver.Tar{}, | ||
| } | ||
|
|
||
|
|
||
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.