Unverified Commit 594b0a4e authored by rewine's avatar rewine Committed by GitHub
Browse files

gitbutler: 0.15.10 -> 0.18.8 (#473706)

parents 733cb77c 72351068
Loading
Loading
Loading
Loading
+4180 −2691

File changed.

Preview size limit exceeded, changes collapsed.

+53 −33
Original line number Diff line number Diff line
@@ -25,51 +25,46 @@
  turbo,
  webkitgtk_4_1,
  wrapGAppsHook4,
  yq,
  dart-sass,
}:

let
  excludeSpec = spec: [
    "--exclude"
    spec
  ];
in

rustPlatform.buildRustPackage (finalAttrs: {
  pname = "gitbutler";
  version = "0.15.10";
  version = "0.18.8";

  src = fetchFromGitHub {
    owner = "gitbutlerapp";
    repo = "gitbutler";
    tag = "release/${finalAttrs.version}";
    hash = "sha256-6sRSH7OSprOsRMoORjy9HI8SoOAXqPak2kqtgRx2bWI=";
    hash = "sha256-OSM2yjiz3I5+SVpcJSWCDyS4y4w9JJ/8CAP2BK0sL7o=";
  };

  # Workaround for https://github.com/NixOS/nixpkgs/issues/359340
  cargoPatches = [ ./gix-from-crates-io.patch ];
  cargoPatches = [
    ./gix-from-crates-io.patch
  ];

  # Let Tauri know what version we're building
  #
  # Remove references to non-existent workspaces in `gix` crates
  #
  # Deactivate the built-in updater
  # Let Tauri know what version we're building and deactivate the built-in updater
  # Note: .bundle.externalBin doesn't include `"but"` at the moment
  #       as that'd require more build adjustments
  postPatch = ''
    tauriConfRelease="crates/gitbutler-tauri/tauri.conf.release.json"
    jq '.version = "${finalAttrs.version}" | .bundle.createUpdaterArtifacts = false' "$tauriConfRelease" | sponge "$tauriConfRelease"

    tomlq -ti 'del(.lints) | del(.workspace.lints)' "$cargoDepsCopy"/gix*/Cargo.toml
    jq '.
        | (.version = "${finalAttrs.version}")
        | (.bundle.createUpdaterArtifacts = false)
        | (.bundle.externalBin = ["gitbutler-git-setsid", "gitbutler-git-askpass"])
      ' "$tauriConfRelease" | sponge "$tauriConfRelease"

    substituteInPlace apps/desktop/src/lib/backend/tauri.ts \
      --replace-fail 'checkUpdate = check;' 'checkUpdate = () => null;'
      --replace-fail 'checkUpdate = tauriCheck;' 'checkUpdate = () => null;'
  '';

  cargoHash = "sha256-H8YR+euwMGiGckURAWJIE9fOcu/ddJ6ENcnA1gHD9B8=";
  cargoHash = "sha256-L53iIVxv3KtmXiqITad1enIMX3Iu/mWSJJPZk7KAWuM=";

  pnpmDeps = fetchPnpmDeps {
    inherit (finalAttrs) pname version src;
    fetcherVersion = 2;
    hash = "sha256-I55RNWP6csT08SBIFEyUp9JTC5EzQXjKIPPSxkSpg7Y=";
    hash = "sha256-IAsEzM9kmZWnh390CV7mOyOshVlESsyoNT0ZvdY03KY=";
  };

  nativeBuildInputs = [
@@ -85,7 +80,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
    pnpm
    turbo
    wrapGAppsHook4
    yq # For `tomlq`
    dart-sass
  ]
  ++ lib.optional stdenv.hostPlatform.isDarwin makeBinaryWrapper;

@@ -106,24 +101,47 @@ rustPlatform.buildRustPackage (finalAttrs: {

  nativeCheckInputs = [ git ];

  # `gitbutler-git`'s checks do not support release mode
  checkType = "debug";
  cargoTestFlags = [
    "--workspace"
  ]
  ++ lib.concatMap excludeSpec [
  # Exclude these workspace crates from testing
  ++ lib.concatMap (crate: [ "--exclude=${crate}" ]) [
    # Requires Git directories
    "but-core"
    "but-rebase"
    "but-workspace"
    # Fails due to the issues above and below
    "but-hunk-dependency"
    # Errors with "Lazy instance has previously been poisoned"
    "gitbutler-branch-actions"
    "gitbutler-stack"
    # `Expecting driver to be located at "../../target/debug/gitbutler-cli" - we also assume a certain crate location`
    # We're not (usually) building in debug mode and always have a different target directory, so...
    "gitbutler-branch-actions"
    "gitbutler-stack"
    "gitbutler-edit-mode"
    "but-cherry-apply"
    "but-worktrees"
  ]
  ++ [
    "--"
  ]
  # Skip these specific tests
  ++ lib.concatMap (test: [ "--skip=${test}" ]) [
    # These tests try connecting to a local address (192.0.2.1) and expect the
    # connection to fail in a certain way. When run on macOS with a network
    # sandbox (?) these tests fail while preparing the socket.
    # https://github.com/NixOS/nixpkgs/pull/473706#issuecomment-3734337124
    "test_is_network_error"
    # assertion `left == right` failed: GIT_EDITOR should take precedence if git is executed correctly
    #  left: "vi"
    # right: "from-GIT_EDITOR"
    "git_editor_takes_precedence"
    # FLAKY (try again): child exited unsuccessfully: ExitStatus(unix_wait_status(10752))
    "migrations_in_parallel_with_processes"
    # Archive at 'tests/fixtures/generated-archives/[...].tar' not found [..] Error: No such file or directory (os error 2)
    "merge_first_branch_into_gb_local_and_verify_rebase"
    "json_output_with_dangling_commits"
    "two_dangling_commits_different_branches"
    # darwin: Error: timeout waiting for matching event
    "track_directory_changes_after_rename"
  ];

  env = {
@@ -135,19 +153,21 @@ rustPlatform.buildRustPackage (finalAttrs: {
    # `fetchPnpmDeps` and `pnpmConfigHook` use a specific version of pnpm, not upstream's
    COREPACK_ENABLE_STRICT = 0;

    # We depend on nightly features
    RUSTC_BOOTSTRAP = 1;

    # We also need to have `tracing` support in `tokio` for `console-subscriber`
    # task tracing requires Tokio to be built with RUSTFLAGS="--cfg tokio_unstable"
    RUSTFLAGS = "--cfg tokio_unstable";

    TUBRO_BINARY_PATH = lib.getExe turbo;
    TURBO_TELEMETRY_DISABLED = 1;

    OPENSSL_NO_VENDOR = true;
    LIBGIT2_NO_VENDOR = 1;
  };

  preBuild = ''
    # force the sass npm dependency to use our own sass binary instead of the bundled one
    substituteInPlace node_modules/.pnpm/sass-embedded@*/node_modules/sass-embedded/dist/lib/src/compiler-path.js \
      --replace-fail 'compilerCommand = (() => {' 'compilerCommand = (() => { return ["${lib.getExe dart-sass}"];'

    turbo run --filter @gitbutler/svelte-comment-injector build
    pnpm build:desktop -- --mode production
  '';