Unverified Commit 51ad015d authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

antigravity: 1.11.3 -> 1.11.5 (#464198)

parents 4fc7c7cc bb3085b0
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
{
  "version": "1.11.5",
  "vscodeVersion": "1.104.0",
  "sources": {
    "x86_64-linux": {
      "url": "https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/1.11.5-5234145629700096/linux-x64/Antigravity.tar.gz",
      "sha256": "4e03151a55743cf30fac595abb343c9eb5a3b6a80d2540136d75b4ead8072112"
    },
    "aarch64-linux": {
      "url": "https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/1.11.5-5234145629700096/linux-arm/Antigravity.tar.gz",
      "sha256": "e154dc745c51c7aadc33becee985188c92246a36a16ee0ba545c422172f8d0c2"
    },
    "x86_64-darwin": {
      "url": "https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/1.11.5-5234145629700096/darwin-x64/Antigravity.zip",
      "sha256": "393336a2177fc3795adb9450f311ce5d453b5df0e0cfa23e35e419f46e3ebc2c"
    },
    "aarch64-darwin": {
      "url": "https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/1.11.5-5234145629700096/darwin-arm/Antigravity.zip",
      "sha256": "800890265dca8b74d7d28af99fae7fc5762f4d529e8eeb451a76c25e09dff488"
    }
  }
}
+7 −17
Original line number Diff line number Diff line
@@ -14,22 +14,14 @@

let
  inherit (stdenv) hostPlatform;

  sources =
    (lib.importJSON ./sources.json)."${hostPlatform.system}"
  information = (lib.importJSON ./information.json);
  source =
    information.sources."${hostPlatform.system}"
      or (throw "antigravity: unsupported system ${hostPlatform.system}");

  version = "1.11.3";
  vscodeVersion = "1.104.0";
in
(callPackage vscode-generic {
  inherit
    commandLineArgs
    useVSCodeRipgrep
    version
    vscodeVersion
    ;

  inherit commandLineArgs useVSCodeRipgrep;
  inherit (information) version vscodeVersion;
  pname = "antigravity";

  executableName = "antigravity";
@@ -38,9 +30,7 @@ in
  libraryName = "antigravity";
  iconName = "antigravity";

  src = fetchurl {
    inherit (sources) url hash;
  };
  src = fetchurl { inherit (source) url sha256; };

  sourceRoot = if hostPlatform.isDarwin then "Antigravity.app" else "Antigravity";

@@ -68,7 +58,7 @@ in
    );

  tests = { };
  updateScript = ./update.sh;
  updateScript = ./update.js;

  dontFixup = hostPlatform.isDarwin;

+0 −18
Original line number Diff line number Diff line
{
  "x86_64-linux": {
    "url": "https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/1.11.3-6583016683339776/linux-x64/Antigravity.tar.gz",
    "hash": "sha256-Al2lEvl5mnFU4sx1vAkIIBOCwazy6DePnaI1y4SlYVs="
  },
  "aarch64-linux": {
    "url": "https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/1.11.3-6583016683339776/linux-arm/Antigravity.tar.gz",
    "hash": "sha256-Mn9Zq2Fo3cLsJ/Ckx7IDOvSkThKREf5XLz3vSOu61TM="
  },
  "x86_64-darwin": {
    "url": "https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/1.11.3-6583016683339776/darwin-x64/Antigravity.zip",
    "hash": "sha256-eNl0Z/+6G6B8vsx25KlaIpGIPkaOOisTH+k2viDKoqk="
  },
  "aarch64-darwin": {
    "url": "https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/1.11.3-6583016683339776/darwin-arm/Antigravity.zip",
    "hash": "sha256-cjFFkvpz/YBY2c78RN0kYbhOAM1roPjujJ7e511kEng="
  }
}
+44 −0
Original line number Diff line number Diff line
#!/usr/bin/env nix
/*
#!nix shell --ignore-environment .#cacert .#nodejs --command node
*/
// @ts-check
import assert from "node:assert/strict";
import * as fs from "node:fs";
import * as path from "node:path";
/**
 * @typedef {object} UpdateInfo
 * @property {number} timestamp Unix timestamp in seconds, example: 1763468493
 * @property {string} productVersion VSCode OSS version, example: "1.104.0"
 * @property {string} sha256hash SHA256 hash of the download file, example: "8eb01462dc4f26aba45be4992bda0b145d1ec210c63a6272578af27e59f23bef"
 * @property {string} url Download URL, example: "https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/1.11.2-6251250307170304/linux-arm/Antigravity.tar.gz", "https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/1.11.2-6251250307170304/darwin-x64/Antigravity.zip"
 */
/** @typedef {"x86_64-linux" | "aarch64-linux" | "x86_64-darwin" | "aarch64-darwin"} Platform */
/** @typedef {{ version: string; vscodeVersion: string; sources: Record<Platform, { url: string; sha256: string; }> }} Information */

let version = "";
let vscodeVersion = "";
async function getLatestInformation(/** @type {"linux-x64" | "linux-arm64" | "darwin-arm64" | "darwin"} */ targetSystem) {
  /** @type {UpdateInfo} */
  const latestInfo = await (await fetch(`https://antigravity-auto-updater-974169037036.us-central1.run.app/api/update/${targetSystem}/stable/latest`)).json();
  const newVersion = /\/antigravity\/stable\/([\d.]+)-[\d]+/.exec(latestInfo.url)?.[1] ?? ""; // Current API lack version field now, we need to parse it from the URL temporarily.
  assert(version === '' || version === newVersion, `Version mismatch: ${version}(linux-x64) != ${newVersion}(${targetSystem})`);
  version = newVersion;
  assert(vscodeVersion === '' || vscodeVersion === latestInfo.productVersion, `VSCode version mismatch: ${vscodeVersion}(linux-x64) != ${latestInfo.productVersion}(${targetSystem})`);
  vscodeVersion = latestInfo.productVersion;
  return {
    url: latestInfo.url,
    sha256: latestInfo.sha256hash,
  };
}
/** @type {Information['sources']} */
const sources = {
  "x86_64-linux": await getLatestInformation("linux-x64"),
  "aarch64-linux": await getLatestInformation("linux-arm64"),
  "x86_64-darwin": await getLatestInformation("darwin"),
  "aarch64-darwin": await getLatestInformation("darwin-arm64"),
};
/** @type {Information} */
const information = { version, vscodeVersion, sources };
fs.writeFileSync(path.join(import.meta.dirname, "./information.json"), JSON.stringify(information, null, 2) + "\n", "utf-8");
console.log(`[update] Updating Antigravity complete, version: ${version}, vscodeVersion: ${vscodeVersion}`);
+0 −88
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnugrep gnused gnutar jq
# shellcheck shell=bash

set -euo pipefail

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
PACKAGE_NIX="${SCRIPT_DIR}/package.nix"
SOURCES_JSON="${SCRIPT_DIR}/sources.json"

echo "Fetching latest release information..."
page=$(curl -fsSL --compressed "https://antigravity.google/download/linux")
script_name=$(printf '%s\n' "$page" | grep -o 'main-[a-zA-Z0-9]*\.js' | head -n1)
js_content=$(curl -fsSL --compressed "https://antigravity.google/$script_name")

# Extract Linux x86_64 URL
linux_x86_64_url=$(
  printf '%s\n' "$js_content" \
    | grep -o 'https://[^"]*/linux-x64/Antigravity.tar.gz' \
    | head -n1
)

# Extract version and check for update
version=$(
  printf '%s\n' "$linux_x86_64_url" \
    | sed -n 's#.*/stable/\([^-]*\)-[0-9]*/linux-x64/Antigravity.tar.gz#\1#p'
)
echo "Version: $version"

current_version=$(grep -oP '^\s*version = "\K[^"]+' "$PACKAGE_NIX" | head -n1)
if [[ "$version" == "$current_version" ]]; then
  echo "Antigravity is already up-to-date"
  exit 0
fi

# Derive URLs
linux_aarch64_url="${linux_x86_64_url/linux-x64\/Antigravity.tar.gz/linux-arm\/Antigravity.tar.gz}"
darwin_x86_64_url="${linux_x86_64_url/linux-x64\/Antigravity.tar.gz/darwin-x64\/Antigravity.zip}"
darwin_aarch64_url="${linux_x86_64_url/linux-x64\/Antigravity.tar.gz/darwin-arm\/Antigravity.zip}"

echo "Prefetching x86_64-linux from $linux_x86_64_url..."
prefetch_output=$(nix-prefetch-url --print-path "$linux_x86_64_url")
linux_x86_64_hash_base32=$(echo "$prefetch_output" | head -n1)
archive_path=$(echo "$prefetch_output" | tail -n1)
echo "path is '$archive_path'" >&2
linux_x86_64_hash=$(nix-hash --type sha256 --to-sri "$linux_x86_64_hash_base32")

echo "Prefetching aarch64-linux from $linux_aarch64_url..."
linux_aarch64_hash_base32=$(nix-prefetch-url "$linux_aarch64_url")
linux_aarch64_hash=$(nix-hash --type sha256 --to-sri "$linux_aarch64_hash_base32")

echo "Prefetching x86_64-darwin from $darwin_x86_64_url..."
darwin_x86_64_hash_base32=$(nix-prefetch-url "$darwin_x86_64_url")
darwin_x86_64_hash=$(nix-hash --type sha256 --to-sri "$darwin_x86_64_hash_base32")

echo "Prefetching aarch64-darwin from $darwin_aarch64_url..."
darwin_aarch64_hash_base32=$(nix-prefetch-url "$darwin_aarch64_url")
darwin_aarch64_hash=$(nix-hash --type sha256 --to-sri "$darwin_aarch64_hash_base32")

# Extract VS Code version from metadata
vscodeVersion=$(
  tar -Oxzf "$archive_path" "Antigravity/resources/app/product.json" \
    | jq -r '.version'
)
echo "VS Code version: $vscodeVersion"

echo "Updating package.nix"
sed -i "s/version = \".*\"/version = \"$version\"/" "$PACKAGE_NIX"
sed -i "s/vscodeVersion = \".*\"/vscodeVersion = \"$vscodeVersion\"/" "$PACKAGE_NIX"

echo "Updating sources.json"
jq -n \
  --arg linux_x86_64_url "$linux_x86_64_url" \
  --arg linux_x86_64_hash "$linux_x86_64_hash" \
  --arg linux_aarch64_url "$linux_aarch64_url" \
  --arg linux_aarch64_hash "$linux_aarch64_hash" \
  --arg darwin_x86_64_url "$darwin_x86_64_url" \
  --arg darwin_x86_64_hash "$darwin_x86_64_hash" \
  --arg darwin_aarch64_url "$darwin_aarch64_url" \
  --arg darwin_aarch64_hash "$darwin_aarch64_hash" \
  '{
    "x86_64-linux": { url: $linux_x86_64_url, hash: $linux_x86_64_hash },
    "aarch64-linux": { url: $linux_aarch64_url, hash: $linux_aarch64_hash },
    "x86_64-darwin": { url: $darwin_x86_64_url, hash: $darwin_x86_64_hash },
    "aarch64-darwin": { url: $darwin_aarch64_url, hash: $darwin_aarch64_hash }
  }' > "$SOURCES_JSON"

echo "Update complete"