|
| 1 | +// This file is part of arduino-cli. |
| 2 | +// |
| 3 | +// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) |
| 4 | +// |
| 5 | +// This software is released under the GNU General Public License version 3, |
| 6 | +// which covers the main part of arduino-cli. |
| 7 | +// The terms of this license can be found at: |
| 8 | +// https://www.gnu.org/licenses/gpl-3.0.en.html |
| 9 | +// |
| 10 | +// You can be released from the requirements of the above licenses by purchasing |
| 11 | +// a commercial license. Buying such a license is mandatory if you want to |
| 12 | +// modify or otherwise use the software for commercial activities involving the |
| 13 | +// Arduino software without disclosing the source code of your own applications. |
| 14 | +// To purchase a commercial license, send an email to [email protected]. |
| 15 | + |
| 16 | +package commands |
| 17 | + |
| 18 | +import ( |
| 19 | + "fmt" |
| 20 | + |
| 21 | + "github.com/arduino/arduino-cli/arduino/cores" |
| 22 | + "github.com/arduino/arduino-cli/arduino/cores/packagemanager" |
| 23 | + "github.com/arduino/arduino-cli/arduino/resources" |
| 24 | + semver "go.bug.st/relaxed-semver" |
| 25 | +) |
| 26 | + |
| 27 | +var ( |
| 28 | + serialMonitorVersion = semver.ParseRelaxed("0.9.1") |
| 29 | + serialMonitorFlavors = []*cores.Flavor{ |
| 30 | + { |
| 31 | + OS: "i686-pc-linux-gnu", |
| 32 | + Resource: &resources.DownloadResource{ |
| 33 | + ArchiveFileName: fmt.Sprintf("serial-monitor_v%s_Linux_32bit.tar.bz2", serialMonitorVersion), |
| 34 | + URL: fmt.Sprintf("https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v%s_Linux_32bit.tar.gz", serialMonitorVersion), |
| 35 | + Size: 1899387, |
| 36 | + Checksum: "SHA-256:3939282c9c74dd259a0ebd66d959133efafc8b50fd800860d8c1f634615b665c", |
| 37 | + CachePath: "tools", |
| 38 | + }, |
| 39 | + }, |
| 40 | + { |
| 41 | + OS: "x86_64-pc-linux-gnu", |
| 42 | + Resource: &resources.DownloadResource{ |
| 43 | + ArchiveFileName: fmt.Sprintf("serial-monitor_v%s_Linux_64bit.tar.bz2", serialMonitorVersion), |
| 44 | + URL: fmt.Sprintf("https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v%s_Linux_64bit.tar.gz", serialMonitorVersion), |
| 45 | + Size: 1954589, |
| 46 | + Checksum: "SHA-256:f121374fc33a66350381591816b2f2a0b0a108d70cf0ca01c59cc05186e6a5ce", |
| 47 | + CachePath: "tools", |
| 48 | + }, |
| 49 | + }, |
| 50 | + { |
| 51 | + OS: "i686-mingw32", |
| 52 | + Resource: &resources.DownloadResource{ |
| 53 | + ArchiveFileName: fmt.Sprintf("serial-monitor_v%s_Windows_32bit.zip", serialMonitorVersion), |
| 54 | + URL: fmt.Sprintf("https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v%s_Windows_32bit.zip", serialMonitorVersion), |
| 55 | + Size: 1956735, |
| 56 | + Checksum: "SHA-256:15157e93618365cd959df57a9a25ccaa5a79d46a34f589e8711f571fe2e318e7", |
| 57 | + CachePath: "tools", |
| 58 | + }, |
| 59 | + }, |
| 60 | + { |
| 61 | + OS: "x86_64-mingw32", |
| 62 | + Resource: &resources.DownloadResource{ |
| 63 | + ArchiveFileName: fmt.Sprintf("serial-monitor_v%s_Windows_64bit.zip", serialMonitorVersion), |
| 64 | + URL: fmt.Sprintf("https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v%s_Windows_64bit.zip", serialMonitorVersion), |
| 65 | + Size: 1990791, |
| 66 | + Checksum: "SHA-256:e45561908526e855a7b9284ee438d2503cb21f9a5421fd840c1f10cd46b10b25", |
| 67 | + CachePath: "tools", |
| 68 | + }, |
| 69 | + }, |
| 70 | + { |
| 71 | + OS: "x86_64-apple-darwin", |
| 72 | + Resource: &resources.DownloadResource{ |
| 73 | + ArchiveFileName: fmt.Sprintf("serial-monitor_v%s_macOS_64bit.tar.bz2", serialMonitorVersion), |
| 74 | + URL: fmt.Sprintf("https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v%s_macOS_64bit.tar.gz", serialMonitorVersion), |
| 75 | + Size: 1871195, |
| 76 | + Checksum: "SHA-256:ebb4750e079ec893d89e9e256cd80b0e810a6cc17cd66189978f46246f52e14a", |
| 77 | + CachePath: "tools", |
| 78 | + }, |
| 79 | + }, |
| 80 | + { |
| 81 | + OS: "arm-linux-gnueabihf", |
| 82 | + Resource: &resources.DownloadResource{ |
| 83 | + ArchiveFileName: fmt.Sprintf("serial-monitor_v%s_Linux_ARMv6.tar.bz2", serialMonitorVersion), |
| 84 | + URL: fmt.Sprintf("https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v%s_Linux_ARMv6.tar.gz", serialMonitorVersion), |
| 85 | + Size: 1829212, |
| 86 | + Checksum: "SHA-256:bd2cf410f7fbcb43dbe6ea9bdf265585de96bf7247cb425d050537ee59d16355", |
| 87 | + CachePath: "tools", |
| 88 | + }, |
| 89 | + }, |
| 90 | + { |
| 91 | + OS: "arm64-linux-gnueabihf", |
| 92 | + Resource: &resources.DownloadResource{ |
| 93 | + ArchiveFileName: fmt.Sprintf("serial-monitor_v%s_Linux_ARM64.tar.bz2", serialMonitorVersion), |
| 94 | + URL: fmt.Sprintf("https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v%s_Linux_ARM64.tar.gz", serialMonitorVersion), |
| 95 | + Size: 1837454, |
| 96 | + Checksum: "SHA-256:be774d68c72fe7d79f9f6ec53f23e63e71793a15a60ed1210d51ec78c6fc0dc1", |
| 97 | + CachePath: "tools", |
| 98 | + }, |
| 99 | + }, |
| 100 | + } |
| 101 | +) |
| 102 | + |
| 103 | +func getBuiltinSerialMonitorTool(pm *packagemanager.PackageManager) *cores.ToolRelease { |
| 104 | + builtinPackage := pm.Packages.GetOrCreatePackage("builtin") |
| 105 | + serialMonitorTool := builtinPackage.GetOrCreateTool("serial-monitor") |
| 106 | + serialMonitorToolRel := serialMonitorTool.GetOrCreateRelease(serialMonitorVersion) |
| 107 | + serialMonitorToolRel.Flavors = serialMonitorFlavors |
| 108 | + return serialMonitorToolRel |
| 109 | +} |
0 commit comments