Commit a555995c authored by Mrmaxmeier's avatar Mrmaxmeier
Browse files

gitbutler: 0.15.10 -> 0.18.3

parent e6eae2ee
Loading
Loading
Loading
Loading
+2108 −3145

File changed.

Preview size limit exceeded, changes collapsed.

+49 −25
Original line number Diff line number Diff line
@@ -25,7 +25,8 @@
  turbo,
  webkitgtk_4_1,
  wrapGAppsHook4,
  yq,
  dart-sass,
  fetchpatch,
}:

let
@@ -37,39 +38,48 @@ in

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

  src = fetchFromGitHub {
    owner = "gitbutlerapp";
    repo = "gitbutler";
    tag = "release/${finalAttrs.version}";
    hash = "sha256-6sRSH7OSprOsRMoORjy9HI8SoOAXqPak2kqtgRx2bWI=";
    hash = "sha256-N/xs63QjqEgDXAOEZpzBRl1QrwDlcYyFWSyNlku6tKw=";
  };

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

    # This allows building tests with release mode instead of setting checkType = "debug";
    (fetchpatch {
      name = "remove-test-askpass-path-workaround.patch";
      url = "https://github.com/Mrmaxmeier/gitbutler/commit/34bcde7db1fa44b801428535ed4c60881d4fc4e1.patch";
      hash = "sha256-BjFSkkCdS0HxqeJNA/RmuIVzkfTZZ/kBhMDM+TwCwp4=";
    })
  ];

  # 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-jJ8fUBv9M9aZYSgymh/FeyLOT4h4cynqi/4fnuAbIDQ=";

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

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

@@ -106,8 +116,6 @@ rustPlatform.buildRustPackage (finalAttrs: {

  nativeCheckInputs = [ git ];

  # `gitbutler-git`'s checks do not support release mode
  checkType = "debug";
  cargoTestFlags = [
    "--workspace"
  ]
@@ -118,12 +126,26 @@ rustPlatform.buildRustPackage (finalAttrs: {
    "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"
    # tui::get_text::tests::git_editor_takes_precedence
    "but"
    # thread 'hooks::pre_push_hook_failure' (38982) panicked at crates/gitbutler-repo/tests/hooks.rs:83:18:
    # success: Text file busy (os error 26)
    "gitbutler-repo"
  ]
  ++ [
    # 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
    "--"
    "--skip=test_is_network_error"
  ];

  env = {
@@ -135,19 +157,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
  '';