Skip to content

Commit

Permalink
flutter buildpack: understand /beta suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
nictuku committed Jul 2, 2019
1 parent a27ea1e commit 4187e19
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion buildpacks/build_flutter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

//https://archive.apache.org/dist/flutter/flutter-3/3.3.3/binaries/apache-flutter-3.3.3-bin.tar.gz
var FLUTTER_DIST_MIRROR = "https://storage.googleapis.com/flutter_infra/releases/stable/{{.OS}}/flutter_{{.OS}}_v{{.Version}}-stable.{{.Extension}}"
var FLUTTER_DIST_MIRROR = "https://storage.googleapis.com/flutter_infra/releases/{{.Channel}}/{{.OS}}/flutter_{{.OS}}_v{{.Version}}-{{.Channel}}.{{.Extension}}"

type FlutterBuildTool struct {
BuildTool
Expand All @@ -35,6 +35,7 @@ func (bt FlutterBuildTool) DownloadUrl() string {
opsys := OS()
arch := Arch()
extension := "tar.xz"
channel := "stable"

if arch == "amd64" {
arch = "x64"
Expand All @@ -46,13 +47,22 @@ func (bt FlutterBuildTool) DownloadUrl() string {
}

version := bt.Version()
parts := strings.Split(version, "/")
if len(parts) > 2 {
version = parts[0]
} else if len(parts) == 2 {
version = parts[0]
channel = parts[1]
}

data := struct {
Channel string
OS string
Arch string
Version string
Extension string
}{
channel,
opsys,
arch,
version,
Expand All @@ -64,6 +74,8 @@ func (bt FlutterBuildTool) DownloadUrl() string {
return url
}

// TODO: Add Channel method?

func (bt FlutterBuildTool) MajorVersion() string {
parts := strings.Split(bt.version, ".")
return parts[0]
Expand Down

0 comments on commit 4187e19

Please sign in to comment.