From 71a9a024ee32826b0ae8088e030760fdb9e3b3a2 Mon Sep 17 00:00:00 2001 From: Dan Sully Date: Mon, 27 Nov 2023 11:10:56 -0800 Subject: [PATCH] feat(installers) add Linux support to Homebrew (#561) --- cargo-dist/src/backend/installer/homebrew.rs | 48 +++++-- cargo-dist/src/tasks.rs | 122 +++++++++++++++--- cargo-dist/templates/installer/homebrew.rb.j2 | 68 +++++++--- .../tests/snapshots/akaikatana_basic.snap | 21 ++- .../akaikatana_repo_with_dot_git.snap | 21 ++- .../tests/snapshots/axolotlsay_abyss.snap | 21 ++- .../tests/snapshots/axolotlsay_basic.snap | 21 ++- .../snapshots/axolotlsay_edit_existing.snap | 21 ++- .../axolotlsay_no_homebrew_publish.snap | 21 ++- .../axolotlsay_user_publish_job.snap | 21 ++- .../snapshots/install_path_cargo_home.snap | 21 ++- .../snapshots/install_path_env_no_subdir.snap | 21 ++- .../snapshots/install_path_env_subdir.snap | 21 ++- .../install_path_env_subdir_space.snap | 21 ++- .../install_path_env_subdir_space_deeper.snap | 21 ++- .../install_path_home_subdir_deeper.snap | 21 ++- .../install_path_home_subdir_min.snap | 21 ++- .../install_path_home_subdir_space.snap | 21 ++- ...install_path_home_subdir_space_deeper.snap | 21 ++- cargo-dist/tests/snapshots/manifest.snap | 1 + 20 files changed, 433 insertions(+), 142 deletions(-) diff --git a/cargo-dist/src/backend/installer/homebrew.rs b/cargo-dist/src/backend/installer/homebrew.rs index 958aa4b05..d0ff38f6d 100644 --- a/cargo-dist/src/backend/installer/homebrew.rs +++ b/cargo-dist/src/backend/installer/homebrew.rs @@ -29,14 +29,22 @@ pub struct HomebrewInstallerInfo { pub desc: Option, /// A GitHub repository to write the formula to, in owner/name format pub tap: Option, - /// AMD64 artifact - pub x86_64: Option, - /// sha256 of AMD64 artifact - pub x86_64_sha256: Option, - /// ARM64 artifact - pub arm64: Option, - /// sha256 of ARM64 artifact - pub arm64_sha256: Option, + /// macOS AMD64 artifact + pub x86_64_macos: Option, + /// sha256 of macOS AMD64 artifact + pub x86_64_macos_sha256: Option, + /// macOS ARM64 artifact + pub arm64_macos: Option, + /// sha256 of macOS ARM64 artifact + pub arm64_macos_sha256: Option, + /// Linux AMD64 artifact + pub x86_64_linux: Option, + /// sha256 of Linux AMD64 artifact + pub x86_64_linux_sha256: Option, + /// Linux ARM64 artifact + pub arm64_linux: Option, + /// sha256 of Linux ARM64 artifact + pub arm64_linux_sha256: Option, /// Generic installer info pub inner: InstallerInfo, /// Additional packages to specify as dependencies @@ -62,18 +70,34 @@ pub(crate) fn write_homebrew_formula( // Generate sha256 as late as possible; the artifacts might not exist // earlier to do that. - if let Some(arm64_ref) = &info.arm64 { + if let Some(arm64_ref) = &info.arm64_macos { let path = Utf8PathBuf::from(&graph.dist_dir).join(&arm64_ref.id); if path.exists() { let sha256 = generate_checksum(&crate::config::ChecksumStyle::Sha256, &path)?; - info.arm64_sha256 = Some(sha256); + info.arm64_macos_sha256 = Some(sha256); } } - if let Some(x86_64_ref) = &info.x86_64 { + if let Some(x86_64_ref) = &info.x86_64_macos { let path = Utf8PathBuf::from(&graph.dist_dir).join(&x86_64_ref.id); if path.exists() { let sha256 = generate_checksum(&crate::config::ChecksumStyle::Sha256, &path)?; - info.x86_64_sha256 = Some(sha256); + info.x86_64_macos_sha256 = Some(sha256); + } + } + + // Linuxbrew + if let Some(arm64_ref) = &info.arm64_linux { + let path = Utf8PathBuf::from(&graph.dist_dir).join(&arm64_ref.id); + if path.exists() { + let sha256 = generate_checksum(&crate::config::ChecksumStyle::Sha256, &path)?; + info.arm64_linux_sha256 = Some(sha256); + } + } + if let Some(x86_64_ref) = &info.x86_64_linux { + let path = Utf8PathBuf::from(&graph.dist_dir).join(&x86_64_ref.id); + if path.exists() { + let sha256 = generate_checksum(&crate::config::ChecksumStyle::Sha256, &path)?; + info.x86_64_linux_sha256 = Some(sha256); } } diff --git a/cargo-dist/src/tasks.rs b/cargo-dist/src/tasks.rs index 9dd3c9908..cdf2fa5e1 100644 --- a/cargo-dist/src/tasks.rs +++ b/cargo-dist/src/tasks.rs @@ -1463,16 +1463,34 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> { let hint = format!("brew install {}", install_target); let desc = "Install prebuilt binaries via Homebrew".to_owned(); - // If they have an x64 macos build but not an arm64 one, add a fallback entry - // to try to install x64 on arm64 and let rosetta2 deal with it. + // If they have an x64 macOS build but not an arm64 one, add a fallback entry + // to try to install x64 on arm64 and let Rosetta 2 deal with it. // - // (This isn't strictly correct because rosetta2 isn't installed by default - // on macos, and the auto-installer only triggers for "real" apps, and not CLIs. + // (This isn't strictly correct because Rosetta 2 isn't installed by default + // on macOS, and the auto-installer only triggers for "real" apps, and not CLIs. // Still, we think this is better than not trying at all.) const X64_MACOS: &str = "x86_64-apple-darwin"; const ARM64_MACOS: &str = "aarch64-apple-darwin"; + const ARM64_GNU: &str = "aarch64-unknown-linux-gnu"; + const ARM64_MUSL: &str = "aarch64-unknown-linux-musl"; + const X64_GNU: &str = "x86_64-unknown-linux-gnu"; + const X64_MUSL: &str = "x86_64-unknown-linux-musl"; + const X64_MUSL_STATIC: &str = "x86_64-unknown-linux-musl-static"; + const X64_MUSL_DYNAMIC: &str = "x86_64-unknown-linux-musl-dynamic"; + const ARM64_MUSL_STATIC: &str = "aarch64-unknown-linux-musl-static"; + const ARM64_MUSL_DYNAMIC: &str = "aarch64-unknown-linux-musl-dynamic"; + let mut has_x64_apple = false; let mut has_arm_apple = false; + let mut has_x86_gnu_linux = false; + let mut has_arm_gnu_linux = false; + let mut has_x86_static_musl_linux = false; + let mut has_arm_static_musl_linux = false; + + // Currently always false, someday these builds will exist + let has_x86_dynamic_musl_linux = false; + let has_arm_dynamic_musl_linux = false; + for &variant_idx in &release.variants { let variant = self.variant(variant_idx); let target = &variant.target; @@ -1482,28 +1500,52 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> { if target == ARM64_MACOS { has_arm_apple = true; } + if target == X64_GNU { + has_x86_gnu_linux = true; + } + if target == ARM64_GNU { + has_arm_gnu_linux = true; + } + if target == X64_MUSL { + has_x86_static_musl_linux = true; + } + if target == ARM64_MUSL { + has_arm_static_musl_linux = true; + } } + let do_rosetta_fallback = has_x64_apple && !has_arm_apple; + let do_x86_gnu_to_musl_fallback = !has_x86_gnu_linux && has_x86_static_musl_linux; + let do_arm_gnu_to_musl_fallback = !has_arm_gnu_linux && has_arm_static_musl_linux; + let do_x86_musl_to_musl_fallback = has_x86_static_musl_linux && !has_x86_dynamic_musl_linux; + let do_arm_musl_to_musl_fallback = has_arm_static_musl_linux && !has_arm_dynamic_musl_linux; - let mut arm64 = None; - let mut x86_64 = None; + let mut arm64_macos = None; + let mut x86_64_macos = None; + let mut arm64_linux = None; + let mut x86_64_linux = None; // Gather up the bundles the installer supports let mut artifacts = vec![]; let mut target_triples = SortedSet::new(); + for &variant_idx in &release.variants { let variant = self.variant(variant_idx); let target = &variant.target; - if target.contains("windows") || target.contains("linux-gnu") { + + if target.contains("windows") { continue; } + // Compute the artifact zip this variant *would* make *if* it were built // FIXME: this is a kind of hacky workaround for the fact that we don't have a good // way to add artifacts to the graph and then say "ok but don't build it". let (artifact, binaries) = self.make_executable_zip_for_variant(to_release, variant_idx); + target_triples.insert(target.clone()); - let fragment = ExecutableZipFragment { + + let mut fragment = ExecutableZipFragment { id: artifact.id, target_triples: artifact.target_triples, zip_style: artifact.archive.as_ref().unwrap().zip_style, @@ -1514,10 +1556,19 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> { }; if target == X64_MACOS { - x86_64 = Some(fragment.clone()); + x86_64_macos = Some(fragment.clone()); } + if target == ARM64_MACOS { - arm64 = Some(fragment.clone()); + arm64_macos = Some(fragment.clone()); + } + + if target == X64_GNU { + x86_64_linux = Some(fragment.clone()); + } + + if target == ARM64_GNU { + arm64_linux = Some(fragment.clone()); } if do_rosetta_fallback && target == X64_MACOS { @@ -1525,8 +1576,45 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> { let mut arm_fragment = fragment.clone(); arm_fragment.target_triples = vec![ARM64_MACOS.to_owned()]; artifacts.push(arm_fragment.clone()); - arm64 = Some(arm_fragment); + arm64_macos = Some(arm_fragment); + } + + // musl-static is actually kind of a fake triple we've invented + // to let us specify which is which; we want to ensure it exists + // for the installer to act on + if target == X64_MUSL { + fragment.target_triples = vec![X64_MUSL_STATIC.to_owned()]; + } + + if target == ARM64_MUSL { + fragment.target_triples = vec![ARM64_MUSL_STATIC.to_owned()]; + } + + // Copy the info but lie that it's actually glibc + if do_x86_gnu_to_musl_fallback && target == X64_MUSL { + let mut musl_fragment = fragment.clone(); + musl_fragment.target_triples = vec![X64_GNU.to_owned()]; + artifacts.push(musl_fragment); } + + if do_x86_musl_to_musl_fallback && target == X64_MUSL { + let mut musl_fragment = fragment.clone(); + musl_fragment.target_triples = vec![X64_MUSL_DYNAMIC.to_owned()]; + artifacts.push(musl_fragment); + } + + if do_arm_gnu_to_musl_fallback && target == ARM64_MUSL { + let mut musl_fragment = fragment.clone(); + musl_fragment.target_triples = vec![ARM64_GNU.to_owned()]; + artifacts.push(musl_fragment); + } + + if do_arm_musl_to_musl_fallback && target == ARM64_MUSL { + let mut musl_fragment = fragment.clone(); + musl_fragment.target_triples = vec![ARM64_MUSL_DYNAMIC.to_owned()]; + artifacts.push(musl_fragment); + } + artifacts.push(fragment); } if artifacts.is_empty() { @@ -1567,10 +1655,14 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> { required_binaries: FastMap::new(), checksum: None, kind: ArtifactKind::Installer(InstallerImpl::Homebrew(HomebrewInstallerInfo { - arm64, - arm64_sha256: None, - x86_64, - x86_64_sha256: None, + arm64_macos, + arm64_macos_sha256: None, + x86_64_macos, + x86_64_macos_sha256: None, + arm64_linux, + arm64_linux_sha256: None, + x86_64_linux, + x86_64_linux_sha256: None, name: app_name, formula_class: formula_name, desc: app_desc, diff --git a/cargo-dist/templates/installer/homebrew.rb.j2 b/cargo-dist/templates/installer/homebrew.rb.j2 index d35469e5b..e10c24644 100644 --- a/cargo-dist/templates/installer/homebrew.rb.j2 +++ b/cargo-dist/templates/installer/homebrew.rb.j2 @@ -5,26 +5,56 @@ class {{ formula_class }} < Formula {%- if homepage %} homepage "{{ homepage }}" {%- endif %} + version "{{ inner.app_version }}" {#- #} - {#- If arm64/x86_64 builds are the same, skip the Hardware::CPU.type if statement #} - {%- if arm64.id == x86_64.id %} - url "{{ inner.base_url }}/{{ arm64.id }}" - {%- if arm64_sha256 %} - sha256 "{{ arm64_sha256 }}" + {%- if arm64_macos.id or x86_64_macos.id %} + on_macos do + {#- If arm64/x86_64 builds are the same, skip the Hardware::CPU.type if statement #} + {%- if arm64_macos.id == x86_64_macos.id %} + url "{{ inner.base_url }}/{{ arm64_macos.id }}" + {%- if arm64_macos_sha256 %} + sha256 "{{ arm64_macos_sha256 }}" + {%- endif %} + {%- else %} + {%- if arm64_macos.id %} + on_arm do + url "{{ inner.base_url }}/{{ arm64_macos.id }}" + {%- if arm64_macos_sha256 %} + sha256 "{{ arm64_macos_sha256 }}" + {%- endif %} + end + {%- endif %} + {%- if x86_64_macos.id %} + on_intel do + url "{{ inner.base_url }}/{{ x86_64_macos.id }}" + {%- if x86_64_macos_sha256 %} + sha256 "{{ x86_64_macos_sha256 }}" + {%- endif %} + end + {%- endif %} + {%- endif %} + end {%- endif %} - {%- else %} - if Hardware::CPU.type == :arm - url "{{ inner.base_url }}/{{ arm64.id }}" - {%- if arm64_sha256 %} - sha256 "{{ arm64_sha256 }}" + {#- #} + {%- if arm64_linux.id or x86_64_linux.id %} + on_linux do + {%- if arm64_linux.id %} + on_arm do + url "{{ inner.base_url }}/{{ arm64_linux.id }}" + {%- if arm64_linux %} + sha256 "{{ arm64_linux_sha256 }}" + {%- endif %} + end {%- endif %} - else - url "{{ inner.base_url }}/{{ x86_64.id }}" - {%- if x86_64_sha256 %} - sha256 "{{ x86_64_sha256 }}" + {%- if x86_64_linux.id %} + on_intel do + url "{{ inner.base_url }}/{{ x86_64_linux.id }}" + {%- if x86_64_linux_sha256 %} + sha256 "{{ x86_64_linux_sha256 }}" + {%- endif %} + end {%- endif %} end - version "{{ inner.app_version }}" {%- endif %} {#- #} {%- if license %} @@ -38,13 +68,13 @@ class {{ formula_class }} < Formula def install {#- Like the URL case above, write out a single install line in the case that the binary artifacts are the same across architectures #} - {%- if arm64.binaries == x86_64.binaries %} - bin.install {% for binary in arm64.binaries %}"{{ binary }}"{{ ", " if not loop.last else "" }}{% endfor %} + {%- if arm64_macos.binaries == x86_64_macos.binaries %} + bin.install {% for binary in arm64_macos.binaries %}"{{ binary }}"{{ ", " if not loop.last else "" }}{% endfor %} {%- else %} if Hardware::CPU.type == :arm - bin.install {% for binary in arm64.binaries %}"{{ binary }}"{{ ", " if not loop.last else "" }}{% endfor %} + bin.install {% for binary in arm64_macos.binaries %}"{{ binary }}"{{ ", " if not loop.last else "" }}{% endfor %} else - bin.install {% for binary in x86_64.binaries %}"{{ binary }}"{{ ", " if not loop.last else "" }}{% endfor %} + bin.install {% for binary in x86_64_macos.binaries %}"{{ binary }}"{{ ", " if not loop.last else "" }}{% endfor %} end {%- endif %} diff --git a/cargo-dist/tests/snapshots/akaikatana_basic.snap b/cargo-dist/tests/snapshots/akaikatana_basic.snap index 5552c07e7..ee757b5ee 100644 --- a/cargo-dist/tests/snapshots/akaikatana_basic.snap +++ b/cargo-dist/tests/snapshots/akaikatana_basic.snap @@ -720,12 +720,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class AkaikatanaRepack < Formula - if Hardware::CPU.type == :arm - url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-aarch64-apple-darwin.tar.xz" - else - url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-apple-darwin.tar.xz" - end version "0.2.0" + on_macos do + on_arm do + url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-aarch64-apple-darwin.tar.xz" + end + on_intel do + url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-apple-darwin.tar.xz" + end + end + on_linux do + on_intel do + url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-unknown-linux-gnu.tar.xz" + end + end license "GPL-2.0-or-later" def install @@ -1255,7 +1263,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install mistydemeo/homebrew-formulae/akaikatana-repack", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/akaikatana_repo_with_dot_git.snap b/cargo-dist/tests/snapshots/akaikatana_repo_with_dot_git.snap index 5552c07e7..ee757b5ee 100644 --- a/cargo-dist/tests/snapshots/akaikatana_repo_with_dot_git.snap +++ b/cargo-dist/tests/snapshots/akaikatana_repo_with_dot_git.snap @@ -720,12 +720,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class AkaikatanaRepack < Formula - if Hardware::CPU.type == :arm - url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-aarch64-apple-darwin.tar.xz" - else - url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-apple-darwin.tar.xz" - end version "0.2.0" + on_macos do + on_arm do + url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-aarch64-apple-darwin.tar.xz" + end + on_intel do + url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-apple-darwin.tar.xz" + end + end + on_linux do + on_intel do + url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-unknown-linux-gnu.tar.xz" + end + end license "GPL-2.0-or-later" def install @@ -1255,7 +1263,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install mistydemeo/homebrew-formulae/akaikatana-repack", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/axolotlsay_abyss.snap b/cargo-dist/tests/snapshots/axolotlsay_abyss.snap index dd73d6de5..965d0d067 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_abyss.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_abyss.snap @@ -721,12 +721,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://fake.axo.dev/faker/axolotlsay/fake-id-do-not-upload/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://fake.axo.dev/faker/axolotlsay/fake-id-do-not-upload/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://fake.axo.dev/faker/axolotlsay/fake-id-do-not-upload/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://fake.axo.dev/faker/axolotlsay/fake-id-do-not-upload/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://fake.axo.dev/faker/axolotlsay/fake-id-do-not-upload/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -2187,7 +2195,8 @@ maybeInstall(true).then(run); "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic.snap b/cargo-dist/tests/snapshots/axolotlsay_basic.snap index 0b4636b57..4d0d2fa17 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic.snap @@ -721,12 +721,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -2179,7 +2187,8 @@ maybeInstall(true).then(run); "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axodotdev/homebrew-packages/axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap index 58a2fae99..e5d4d6fc5 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap @@ -721,12 +721,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -2154,7 +2162,8 @@ maybeInstall(true).then(run); "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axodotdev/homebrew-packages/axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap index 3952b3098..bb29a47ce 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap @@ -721,12 +721,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -2154,7 +2162,8 @@ maybeInstall(true).then(run); "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axodotdev/homebrew-packages/axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap index 224186df5..deb92b1b7 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap @@ -721,12 +721,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -2154,7 +2162,8 @@ maybeInstall(true).then(run); "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axodotdev/homebrew-packages/axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/install_path_cargo_home.snap b/cargo-dist/tests/snapshots/install_path_cargo_home.snap index 1d15d0e0e..d2eb25d35 100644 --- a/cargo-dist/tests/snapshots/install_path_cargo_home.snap +++ b/cargo-dist/tests/snapshots/install_path_cargo_home.snap @@ -721,12 +721,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -1257,7 +1265,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap b/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap index 7ff99ee04..0e202d6ab 100644 --- a/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap +++ b/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap @@ -704,12 +704,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -1237,7 +1245,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir.snap b/cargo-dist/tests/snapshots/install_path_env_subdir.snap index 22f945111..396eb5e27 100644 --- a/cargo-dist/tests/snapshots/install_path_env_subdir.snap +++ b/cargo-dist/tests/snapshots/install_path_env_subdir.snap @@ -704,12 +704,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -1237,7 +1245,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap b/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap index 582e53e3d..016e04107 100644 --- a/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap +++ b/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap @@ -704,12 +704,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -1237,7 +1245,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap b/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap index 1825f45a4..9d640a28c 100644 --- a/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap +++ b/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap @@ -704,12 +704,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -1237,7 +1245,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap index eb06d3bbd..979d9d985 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap @@ -704,12 +704,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -1237,7 +1245,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap index 173627ad0..1014a1e74 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap @@ -704,12 +704,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -1237,7 +1245,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap index 86a856a9b..1e9ab67dc 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap @@ -704,12 +704,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -1237,7 +1245,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap index 74ff54216..15852afb4 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap @@ -704,12 +704,20 @@ download_binary_and_run_installer "$@" || exit 1 ================ formula.rb ================ class Axolotlsay < Formula desc "💬 a CLI for learning to distribute CLIs in rust" - if Hardware::CPU.type == :arm - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" - else - url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" - end version "0.2.1" + on_macos do + on_arm do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-aarch64-apple-darwin.tar.gz" + end + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-apple-darwin.tar.gz" + end + end + on_linux do + on_intel do + url "https://github.com/axodotdev/axolotlsay/releases/download/v0.2.1/axolotlsay-x86_64-unknown-linux-gnu.tar.gz" + end + end license "MIT OR Apache-2.0" def install @@ -1237,7 +1245,8 @@ Install-Binary "$Args" "kind": "installer", "target_triples": [ "aarch64-apple-darwin", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu" ], "install_hint": "brew install axolotlsay", "description": "Install prebuilt binaries via Homebrew" diff --git a/cargo-dist/tests/snapshots/manifest.snap b/cargo-dist/tests/snapshots/manifest.snap index cf2207cd9..e2c6f8e81 100644 --- a/cargo-dist/tests/snapshots/manifest.snap +++ b/cargo-dist/tests/snapshots/manifest.snap @@ -279,6 +279,7 @@ stdout: "target_triples": [ "aarch64-apple-darwin", "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl" ], "install_hint": "brew install axodotdev/homebrew-tap/cargo-dist",