Remove Zed-specific and CI scripts
Keep only essential development scripts: - clippy (linting) - linux (Linux dependency installation) - metal-debug (macOS GPU debugging) Removed: - Version bumping scripts (Zed release process) - CI helper scripts (target dir cleaning, crate version) - Build tool installers (cmake, mold, wild, rustup) - Prettier/shellcheck (Zed-specific checks) - crate-dep-graph (references Zed crates) - histogram (Python perf analysis) - new-crate (references Zed licensing) - lib/ helpers (blob-store, deploy, etc.)
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Parse arguments
|
||||
bump_type=${1:-minor}
|
||||
|
||||
if [[ "$bump_type" != "minor" && "$bump_type" != "patch" ]]; then
|
||||
echo "Usage: $0 [minor|patch]"
|
||||
echo " minor (default): bumps the minor version (e.g., 0.1.0 -> 0.2.0)"
|
||||
echo " patch: bumps the patch version (e.g., 0.1.0 -> 0.1.1)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure we're in a clean state on an up-to-date `main` branch.
|
||||
if [[ -n $(git status --short --untracked-files=no) ]]; then
|
||||
echo "can't bump versions with uncommitted changes"
|
||||
exit 1
|
||||
fi
|
||||
if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]]; then
|
||||
echo "this command must be run on main"
|
||||
exit 1
|
||||
fi
|
||||
git pull -q --ff-only origin main
|
||||
|
||||
|
||||
# Parse the current version
|
||||
version=$(script/get-crate-version gpui)
|
||||
major=$(echo $version | cut -d. -f1)
|
||||
minor=$(echo $version | cut -d. -f2)
|
||||
patch=$(echo $version | cut -d. -f3)
|
||||
|
||||
if [[ "$bump_type" == "minor" ]]; then
|
||||
next_minor=$(expr $minor + 1)
|
||||
next_version="${major}.${next_minor}.0"
|
||||
else
|
||||
next_patch=$(expr $patch + 1)
|
||||
next_version="${major}.${minor}.${next_patch}"
|
||||
fi
|
||||
|
||||
branch_name="bump-gpui-to-v${next_version}"
|
||||
|
||||
git checkout -b ${branch_name}
|
||||
|
||||
script/lib/bump-version.sh gpui gpui-v "" $bump_type true
|
||||
|
||||
git checkout -q main
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "usage: $0 <MAX_SIZE_IN_GB>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ -d target ]]; then
|
||||
echo "target directory does not exist yet"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
max_size_gb=$1
|
||||
|
||||
current_size=$(du -s target | cut -f1)
|
||||
current_size_gb=$(expr ${current_size} / 1024 / 1024)
|
||||
|
||||
echo "target directory size: ${current_size_gb}gb. max size: ${max_size_gb}gb"
|
||||
|
||||
if [[ ${current_size_gb} -gt ${max_size_gb} ]]; then
|
||||
echo "clearing target directory"
|
||||
shopt -s dotglob
|
||||
rm -rf target/*
|
||||
fi
|
||||
@@ -1,22 +0,0 @@
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[int]$MAX_SIZE_IN_GB
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$PSNativeCommandUseErrorActionPreference = $true
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
|
||||
if (-Not (Test-Path -Path "target")) {
|
||||
Write-Host "target directory does not exist yet"
|
||||
exit 0
|
||||
}
|
||||
|
||||
$current_size_gb = (Get-ChildItem -Recurse -Force -File -Path "target" | Measure-Object -Property Length -Sum).Sum / 1GB
|
||||
|
||||
Write-Host "target directory size: ${current_size_gb}GB. max size: ${MAX_SIZE_IN_GB}GB"
|
||||
|
||||
if ($current_size_gb -gt $MAX_SIZE_IN_GB) {
|
||||
Write-Host "clearing target directory"
|
||||
Remove-Item -Recurse -Force -Path "target\*" -ErrorAction SilentlyContinue
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -x cargo-depgraph ]]; then
|
||||
cargo install cargo-depgraph
|
||||
fi
|
||||
|
||||
graph_file=target/crate-graph.html
|
||||
|
||||
cargo depgraph \
|
||||
--workspace-only \
|
||||
--offline \
|
||||
--root=zed,cli,collab \
|
||||
--dedup-transitive-deps \
|
||||
| dot -Tsvg > $graph_file
|
||||
|
||||
echo "open $graph_file"
|
||||
open $graph_file
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 <crate_name>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CRATE_NAME=$1
|
||||
|
||||
cargo metadata \
|
||||
--no-deps \
|
||||
--format-version=1 \
|
||||
| jq \
|
||||
--raw-output \
|
||||
".packages[] | select(.name == \"${CRATE_NAME}\") | .version"
|
||||
@@ -1,16 +0,0 @@
|
||||
if ($args.Length -ne 1) {
|
||||
Write-Error "Usage: $($MyInvocation.MyCommand.Name) <crate_name>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$crateName = $args[0]
|
||||
|
||||
$metadata = cargo metadata --no-deps --format-version=1 | ConvertFrom-Json
|
||||
|
||||
$package = $metadata.packages | Where-Object { $_.name -eq $crateName }
|
||||
if ($package) {
|
||||
$package.version
|
||||
}
|
||||
else {
|
||||
Write-Error "Crate '$crateName' not found."
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Required dependencies for this script:
|
||||
#
|
||||
# pandas: For data manipulation and analysis.
|
||||
# matplotlib: For creating static, interactive, and animated visualizations in Python.
|
||||
# seaborn: For making statistical graphics in Python, based on matplotlib.
|
||||
|
||||
# To install these dependencies, use the following pip command:
|
||||
# pip install pandas matplotlib seaborn
|
||||
|
||||
# This script is designed to parse log files for performance measurements and create histograms of these measurements.
|
||||
# It expects log files to contain lines with measurements in the format "measurement: timeunit" where timeunit can be in milliseconds (ms) or microseconds (µs).
|
||||
# Lines that do not contain a colon ':' are skipped.
|
||||
# The script takes one or more file paths as command-line arguments, parses each log file, and then combines the data into a single DataFrame.
|
||||
# It then converts all time measurements into milliseconds, discards the original time and unit columns, and creates histograms for each unique measurement type.
|
||||
# The histograms display the distribution of times for each measurement, separated by log file, and normalized to show density rather than count.
|
||||
# To use this script, run it from the command line with the log file paths as arguments, like so:
|
||||
# python this_script.py log1.txt log2.txt ...
|
||||
# The script will then parse the provided log files and display the histograms for each type of measurement found.
|
||||
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
import sys
|
||||
|
||||
def parse_log_file(file_path):
|
||||
data = {'measurement': [], 'time': [], 'unit': [], 'log_file': []}
|
||||
with open(file_path, 'r') as file:
|
||||
for line in file:
|
||||
if ':' not in line:
|
||||
continue
|
||||
|
||||
parts = line.strip().split(': ')
|
||||
if len(parts) != 2:
|
||||
continue
|
||||
|
||||
measurement, time_with_unit = parts[0], parts[1]
|
||||
if 'ms' in time_with_unit:
|
||||
time, unit = time_with_unit[:-2], 'ms'
|
||||
elif 'µs' in time_with_unit:
|
||||
time, unit = time_with_unit[:-2], 'µs'
|
||||
else:
|
||||
# Print an error message if we can't parse the line and then continue with rest.
|
||||
print(f'Error: Invalid time unit in line "{line.strip()}". Skipping.', file=sys.stderr)
|
||||
continue
|
||||
|
||||
data['measurement'].append(measurement)
|
||||
data['time'].append(float(time))
|
||||
data['unit'].append(unit)
|
||||
data['log_file'].append(file_path.split('/')[-1])
|
||||
return pd.DataFrame(data)
|
||||
|
||||
def create_histograms(df, measurement):
|
||||
filtered_df = df[df['measurement'] == measurement]
|
||||
plt.figure(figsize=(12, 6))
|
||||
sns.histplot(data=filtered_df, x='time_ms', hue='log_file', element='step', stat='density', common_norm=False, palette='bright')
|
||||
plt.title(f'Histogram of {measurement}')
|
||||
plt.xlabel('Time (ms)')
|
||||
plt.ylabel('Density')
|
||||
plt.grid(True)
|
||||
plt.xlim(filtered_df['time_ms'].quantile(0.01), filtered_df['time_ms'].quantile(0.99))
|
||||
plt.show()
|
||||
|
||||
|
||||
file_paths = sys.argv[1:]
|
||||
dfs = [parse_log_file(path) for path in file_paths]
|
||||
combined_df = pd.concat(dfs, ignore_index=True)
|
||||
combined_df['time_ms'] = combined_df.apply(lambda row: row['time'] if row['unit'] == 'ms' else row['time'] / 1000, axis=1)
|
||||
combined_df.drop(['time', 'unit'], axis=1, inplace=True)
|
||||
|
||||
measurement_types = combined_df['measurement'].unique()
|
||||
for measurement in measurement_types:
|
||||
create_histograms(combined_df, measurement)
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# This script installs an up-to-date version of CMake.
|
||||
#
|
||||
# For MacOS use Homebrew to install the latest version.
|
||||
#
|
||||
# For Ubuntu use the official KitWare Apt repository with backports.
|
||||
# See: https://apt.kitware.com/
|
||||
#
|
||||
# For other systems (RHEL 8.x, 9.x, AmazonLinux, SUSE, Fedora, Arch, etc)
|
||||
# use the official CMake installer script from KitWare.
|
||||
#
|
||||
# Note this is similar to how GitHub Actions runners install cmake:
|
||||
# https://github.com/actions/runner-images/blob/main/images/ubuntu/scripts/build/install-cmake.sh
|
||||
#
|
||||
# Upstream: 3.30.4 (2024-09-27)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
if [[ "$(uname -s)" == "darwin" ]]; then
|
||||
brew --version >/dev/null \
|
||||
|| echo "Error: Homebrew is required to install cmake on MacOS." && exit 1
|
||||
echo "Installing cmake via Homebrew (can't pin to old versions)."
|
||||
brew install cmake
|
||||
exit 0
|
||||
elif [ "$(uname -s)" != "Linux" ]; then
|
||||
echo "Error: This script is intended for MacOS/Linux systems only."
|
||||
exit 1
|
||||
elif [ -z "${1:-}" ]; then
|
||||
echo "Usage: $0 [3.30.4]"
|
||||
exit 1
|
||||
fi
|
||||
CMAKE_VERSION="${CMAKE_VERSION:-${1:-3.30.4}}"
|
||||
|
||||
if [ "$(whoami)" = root ]; then SUDO=; else SUDO="$(command -v sudo || command -v doas || true)"; fi
|
||||
|
||||
if cmake --version 2>/dev/null | grep -q "$CMAKE_VERSION"; then
|
||||
echo "CMake $CMAKE_VERSION is already installed."
|
||||
exit 0
|
||||
elif [ -e /usr/local/bin/cmake ]; then
|
||||
echo "Warning: existing cmake found at /usr/local/bin/cmake. Skipping installation."
|
||||
exit 0
|
||||
elif [ -e /etc/apt/sources.list.d/kitware.list ]; then
|
||||
echo "Warning: existing KitWare repository found. Skipping installation."
|
||||
exit 0
|
||||
elif [ -e /etc/lsb-release ] && grep -qP 'DISTRIB_ID=Ubuntu' /etc/lsb-release; then
|
||||
curl -fsSL https://apt.kitware.com/keys/kitware-archive-latest.asc \
|
||||
| $SUDO gpg --dearmor - \
|
||||
| $SUDO tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
|
||||
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \
|
||||
| $SUDO tee /etc/apt/sources.list.d/kitware.list >/dev/null
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y kitware-archive-keyring cmake
|
||||
else
|
||||
arch="$(uname -m)"
|
||||
if [ "$arch" != "x86_64" ] && [ "$arch" != "aarch64" ]; then
|
||||
echo "Error. Only x86_64 and aarch64 are supported."
|
||||
exit 1
|
||||
fi
|
||||
tempdir=$(mktemp -d)
|
||||
pushd "$tempdir"
|
||||
CMAKE_REPO="https://github.com/Kitware/CMake"
|
||||
CMAKE_INSTALLER="cmake-$CMAKE_VERSION-linux-$arch.sh"
|
||||
curl -fsSL --output cmake-$CMAKE_VERSION-SHA-256.txt \
|
||||
"$CMAKE_REPO/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt"
|
||||
curl -fsSL --output $CMAKE_INSTALLER \
|
||||
"$CMAKE_REPO/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-$arch.sh"
|
||||
# workaround for old versions of sha256sum not having --ignore-missing
|
||||
grep -F "cmake-$CMAKE_VERSION-linux-$arch.sh" "cmake-$CMAKE_VERSION-SHA-256.txt" \
|
||||
| sha256sum -c \
|
||||
| grep -qP "^${CMAKE_INSTALLER}: OK"
|
||||
chmod +x cmake-$CMAKE_VERSION-linux-$arch.sh
|
||||
$SUDO ./cmake-$CMAKE_VERSION-linux-$arch.sh --prefix=/usr/local --skip-license
|
||||
popd
|
||||
rm -rf "$tempdir"
|
||||
fi
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Install `mold` official binaries from GitHub Releases.
|
||||
#
|
||||
# Adapted from the official rui314/setup-mold@v1 action to:
|
||||
# * use environment variables instead of action inputs
|
||||
# * remove make-default support
|
||||
# * use curl instead of wget
|
||||
# * support doas for sudo
|
||||
# * support redhat systems
|
||||
# See: https://github.com/rui314/setup-mold/blob/main/action.yml
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
MOLD_VERSION="2.34.0"
|
||||
|
||||
if [ "$(uname -s)" != "Linux" ]; then
|
||||
echo "Error: This script is intended for Linux systems only."
|
||||
exit 1
|
||||
elif [ -e /usr/local/bin/mold ]; then
|
||||
echo "Warning: existing mold found at /usr/local/bin/mold. Skipping installation."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$(whoami)" = root ]; then SUDO=; else SUDO="$(command -v sudo || command -v doas || true)"; fi
|
||||
|
||||
MOLD_REPO="${MOLD_REPO:-https://github.com/rui314/mold}"
|
||||
MOLD_URL="${MOLD_URL:-$MOLD_REPO}/releases/download/v$MOLD_VERSION/mold-$MOLD_VERSION-$(uname -m)-linux.tar.gz"
|
||||
|
||||
echo "Downloading from $MOLD_URL"
|
||||
curl -fsSL --output - "$MOLD_URL" \
|
||||
| $SUDO tar -C /usr/local --strip-components=1 --no-overwrite-dir -xzf -
|
||||
|
||||
# Note this binary depends on the system libatomic.so.1 which is usually
|
||||
# provided as a dependency of gcc so it should be available on most systems.
|
||||
|
||||
cat <<EOF
|
||||
Mold is installed to /usr/local/bin/mold
|
||||
|
||||
To make it your default, add or merge these lines into your ~/.cargo/config.toml:
|
||||
|
||||
[target.'cfg(target_os = "linux")']
|
||||
linker = "clang"
|
||||
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
||||
EOF
|
||||
@@ -1,39 +0,0 @@
|
||||
# Checks if cargo is in the user's path or in default install path
|
||||
# If not, download with rustup-installer (which respects CARGO_HOME / RUSTUP_HOME)
|
||||
|
||||
# Like 'set -e' in bash
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$cargoHome = if ($env:CARGO_HOME) { $env:CARGO_HOME } else { "$env:USERPROFILE\.cargo" }
|
||||
$rustupPath = "$cargoHome\bin\rustup.exe"
|
||||
$cargoPath = "$cargoHome\bin\cargo.exe"
|
||||
|
||||
# Check if cargo is already available in path
|
||||
if (Get-Command cargo -ErrorAction SilentlyContinue)
|
||||
{
|
||||
cargo --version
|
||||
exit
|
||||
}
|
||||
# Check if rustup and cargo are available in CARGO_HOME
|
||||
elseif (-not ((Test-Path $rustupPath) -and (Test-Path $cargoPath))) {
|
||||
Write-Output "Rustup or Cargo not found in $cargoHome, installing..."
|
||||
|
||||
$tempDir = [System.IO.Path]::GetTempPath()
|
||||
|
||||
# Download and install rustup
|
||||
$RustupInitPath = "$tempDir\rustup-init.exe"
|
||||
Write-Output "Downloading rustup installer..."
|
||||
Invoke-WebRequest `
|
||||
-OutFile $RustupInitPath `
|
||||
-Uri https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe
|
||||
|
||||
Write-Output "Installing rustup..."
|
||||
& $RustupInitPath -y --default-toolchain none
|
||||
Remove-Item -Force $RustupInitPath
|
||||
|
||||
Write-Output "Rust installation complete."
|
||||
# This is necessary
|
||||
}
|
||||
|
||||
& $rustupPath --version
|
||||
& $cargoPath --version
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Install wild-linker official binaries from GitHub Releases.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
WILD_VERSION="${WILD_VERSION:-${1:-0.6.0}}"
|
||||
if [ "$(uname -s)" != "Linux" ]; then
|
||||
echo "Error: This script is intended for Linux systems only."
|
||||
exit 1
|
||||
elif [ -z "$WILD_VERSION" ]; then
|
||||
echo "Usage: $0 [version]"
|
||||
exit 1
|
||||
elif command -v wild >/dev/null 2>&1 && wild --version | grep -Fq "$WILD_VERSION" ; then
|
||||
echo "Warning: existing wild $WILD_VERSION found at $(command -v wild). Skipping installation."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$(whoami)" = root ]; then SUDO=; else SUDO="$(command -v sudo || command -v doas || true)"; fi
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
WILD_REPO="${WILD_REPO:-https://github.com/davidlattimore/wild}"
|
||||
WILD_PACKAGE="wild-linker-${WILD_VERSION}-${ARCH}-unknown-linux-gnu"
|
||||
WILD_URL="${WILD_URL:-$WILD_REPO}/releases/download/$WILD_VERSION/${WILD_PACKAGE}.tar.gz"
|
||||
DEST_DIR=/usr/local/bin
|
||||
|
||||
echo "Downloading from $WILD_URL"
|
||||
curl -fsSL --output - "$WILD_URL" \
|
||||
| $SUDO tar -C ${DEST_DIR} --strip-components=1 --no-overwrite-dir -xzf - \
|
||||
"${WILD_PACKAGE}/wild"
|
||||
|
||||
cat <<EOF
|
||||
Wild is installed to ${DEST_DIR}/wild
|
||||
|
||||
To make it your default, add or merge these lines into your ~/.cargo/config.toml:
|
||||
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
linker = "clang"
|
||||
rustflags = ["-C", "link-arg=--ld-path=wild"]
|
||||
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
linker = "clang"
|
||||
rustflags = ["-C", "link-arg=--ld-path=wild"]
|
||||
EOF
|
||||
@@ -1,68 +0,0 @@
|
||||
function UploadToBlobStoreWithACL {
|
||||
param (
|
||||
[string]$BucketName,
|
||||
[string]$FileToUpload,
|
||||
[string]$BlobStoreKey,
|
||||
[string]$ACL
|
||||
)
|
||||
|
||||
# Format date to match AWS requirements
|
||||
$Date = (Get-Date).ToUniversalTime().ToString("r")
|
||||
# Note: Original script had a bug where it overrode the ACL parameter
|
||||
# I'm keeping the same behavior for compatibility
|
||||
$ACL = "public-read"
|
||||
$ContentType = "application/octet-stream"
|
||||
$StorageClass = "STANDARD"
|
||||
|
||||
# Create string to sign (AWS S3 compatible format)
|
||||
$StringToSign = "PUT`n`n${ContentType}`n${Date}`nx-amz-acl:${ACL}`nx-amz-storage-class:${StorageClass}`n/${BucketName}/${BlobStoreKey}"
|
||||
|
||||
# Generate HMAC-SHA1 signature
|
||||
$HMACSHA1 = New-Object System.Security.Cryptography.HMACSHA1
|
||||
$HMACSHA1.Key = [System.Text.Encoding]::UTF8.GetBytes($env:DIGITALOCEAN_SPACES_SECRET_KEY)
|
||||
$Signature = [System.Convert]::ToBase64String($HMACSHA1.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($StringToSign)))
|
||||
|
||||
# Upload file using Invoke-WebRequest (equivalent to curl)
|
||||
$Headers = @{
|
||||
"Host" = "${BucketName}.nyc3.digitaloceanspaces.com"
|
||||
"Date" = $Date
|
||||
"Content-Type" = $ContentType
|
||||
"x-amz-storage-class" = $StorageClass
|
||||
"x-amz-acl" = $ACL
|
||||
"Authorization" = "AWS ${env:DIGITALOCEAN_SPACES_ACCESS_KEY}:$Signature"
|
||||
}
|
||||
|
||||
$Uri = "https://${BucketName}.nyc3.digitaloceanspaces.com/${BlobStoreKey}"
|
||||
|
||||
# Read file content
|
||||
$FileContent = Get-Content $FileToUpload -Raw -AsByteStream
|
||||
|
||||
try {
|
||||
Invoke-WebRequest -Uri $Uri -Method PUT -Headers $Headers -Body $FileContent -ContentType $ContentType -Verbose
|
||||
Write-Host "Successfully uploaded $FileToUpload to $Uri" -ForegroundColor Green
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to upload file: $_"
|
||||
throw $_
|
||||
}
|
||||
}
|
||||
|
||||
function UploadToBlobStorePublic {
|
||||
param (
|
||||
[string]$BucketName,
|
||||
[string]$FileToUpload,
|
||||
[string]$BlobStoreKey
|
||||
)
|
||||
|
||||
UploadToBlobStoreWithACL -BucketName $BucketName -FileToUpload $FileToUpload -BlobStoreKey $BlobStoreKey -ACL "public-read"
|
||||
}
|
||||
|
||||
function UploadToBlobStore {
|
||||
param (
|
||||
[string]$BucketName,
|
||||
[string]$FileToUpload,
|
||||
[string]$BlobStoreKey
|
||||
)
|
||||
|
||||
UploadToBlobStoreWithACL -BucketName $BucketName -FileToUpload $FileToUpload -BlobStoreKey $BlobStoreKey -ACL "private"
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
function upload_to_blob_store_with_acl
|
||||
{
|
||||
bucket_name="$1"
|
||||
file_to_upload="$2"
|
||||
blob_store_key="$3"
|
||||
acl="$4"
|
||||
|
||||
date=$(date +"%a, %d %b %Y %T %z")
|
||||
content_type="application/octet-stream"
|
||||
storage_type="x-amz-storage-class:STANDARD"
|
||||
string="PUT\n\n${content_type}\n${date}\n${acl}\n${storage_type}\n/${bucket_name}/${blob_store_key}"
|
||||
signature=$(echo -en "${string}" | openssl sha1 -hmac "${DIGITALOCEAN_SPACES_SECRET_KEY}" -binary | base64)
|
||||
|
||||
curl --fail -vv -s -X PUT -T "$file_to_upload" \
|
||||
-H "Host: ${bucket_name}.nyc3.digitaloceanspaces.com" \
|
||||
-H "Date: $date" \
|
||||
-H "Content-Type: $content_type" \
|
||||
-H "$storage_type" \
|
||||
-H "$acl" \
|
||||
-H "Authorization: AWS ${DIGITALOCEAN_SPACES_ACCESS_KEY}:$signature" \
|
||||
"https://${bucket_name}.nyc3.digitaloceanspaces.com/${blob_store_key}"
|
||||
}
|
||||
|
||||
function upload_to_blob_store_public
|
||||
{
|
||||
upload_to_blob_store_with_acl "$1" "$2" "$3" "x-amz-acl:public-read"
|
||||
}
|
||||
|
||||
function upload_to_blob_store
|
||||
{
|
||||
upload_to_blob_store_with_acl "$1" "$2" "$3" "x-amz-acl:private"
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
package=$1
|
||||
tag_prefix=$2
|
||||
tag_suffix=$3
|
||||
version_increment=$4
|
||||
gpui_release=${5:-false}
|
||||
|
||||
if [[ -n $(git status --short --untracked-files=no) ]]; then
|
||||
echo "can't bump version with uncommitted changes"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
which cargo-set-version > /dev/null || cargo install cargo-edit
|
||||
which jq > /dev/null || brew install jq
|
||||
cargo set-version --package $package --bump $version_increment
|
||||
cargo check --quiet
|
||||
|
||||
new_version=$(script/get-crate-version $package)
|
||||
branch_name=$(git rev-parse --abbrev-ref HEAD)
|
||||
old_sha=$(git rev-parse HEAD)
|
||||
tag_name=${tag_prefix}${new_version}${tag_suffix}
|
||||
|
||||
git commit --quiet --all --message "${package} ${new_version}"
|
||||
git tag ${tag_name}
|
||||
|
||||
if [[ "$gpui_release" == "true" ]]; then
|
||||
cat <<MESSAGE
|
||||
Locally committed and tagged ${package} version ${new_version}
|
||||
|
||||
To push this:
|
||||
|
||||
git push origin ${tag_name} ${branch_name}; gh pr create -H ${branch_name}
|
||||
|
||||
To undo this:
|
||||
|
||||
git branch -D ${branch_name} && git tag -d ${tag_name}
|
||||
|
||||
MESSAGE
|
||||
else
|
||||
cat <<MESSAGE
|
||||
Locally committed and tagged ${package} version ${new_version}
|
||||
|
||||
To push this:
|
||||
|
||||
git push origin ${tag_name} ${branch_name}
|
||||
|
||||
To undo this:
|
||||
|
||||
git reset --hard ${old_sha} && git tag -d ${tag_name}
|
||||
|
||||
MESSAGE
|
||||
fi
|
||||
@@ -1,37 +0,0 @@
|
||||
function export_vars_for_environment {
|
||||
local environment=$1
|
||||
local env_file="crates/collab/k8s/environments/${environment}.sh"
|
||||
if [[ ! -f $env_file ]]; then
|
||||
echo "Invalid environment name '${environment}'" >&2
|
||||
exit 1
|
||||
fi
|
||||
export $(grep -v '^#' $env_file | grep -v '^[[:space:]]*$')
|
||||
}
|
||||
|
||||
function target_zed_kube_cluster {
|
||||
if [[ $(kubectl config current-context 2> /dev/null) != do-nyc1-zed-1 ]]; then
|
||||
doctl kubernetes cluster kubeconfig save zed-1
|
||||
fi
|
||||
}
|
||||
|
||||
function tag_for_environment {
|
||||
if [[ "$1" == "production" ]]; then
|
||||
echo "collab-production"
|
||||
elif [[ "$1" == "staging" ]]; then
|
||||
echo "collab-staging"
|
||||
else
|
||||
echo "Invalid environment name '${environment}'" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function url_for_environment {
|
||||
if [[ "$1" == "production" ]]; then
|
||||
echo "https://collab.zed.dev"
|
||||
elif [[ "$1" == "staging" ]]; then
|
||||
echo "https://collab-staging.zed.dev"
|
||||
else
|
||||
echo "Invalid environment name '${environment}'" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
excluded_rules = [
|
||||
# We use `serial` already, no point changing now.
|
||||
"prefer-identity",
|
||||
|
||||
# We store timestamps in UTC, so we don't care about the timezone.
|
||||
"prefer-timestamptz",
|
||||
|
||||
"prefer-big-int",
|
||||
"prefer-bigint-over-int",
|
||||
]
|
||||
pg_version = "15.0"
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
function ParseZedWorkspace {
|
||||
$metadata = cargo metadata --no-deps --offline | ConvertFrom-Json
|
||||
$env:ZED_WORKSPACE = $metadata.workspace_root
|
||||
$env:RELEASE_VERSION = $metadata.packages | Where-Object { $_.name -eq "zed" } | Select-Object -ExpandProperty version
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Try to make sure we are in the zed repo root
|
||||
if [ ! -d "crates" ] || [ ! -d "script" ]; then
|
||||
echo "Error: Run from the \`zed\` repo root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "Cargo.toml" ]; then
|
||||
echo "Error: Run from the \`zed\` repo root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <crate_name> [optional_license_flag]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CRATE_NAME="$1"
|
||||
|
||||
LICENSE_FLAG=$(echo "${2}" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ "$LICENSE_FLAG" == *"apache"* ]]; then
|
||||
LICENSE_MODE="Apache-2.0"
|
||||
LICENSE_FILE="LICENSE-APACHE"
|
||||
elif [[ "$LICENSE_FLAG" == *"agpl"* ]]; then
|
||||
LICENSE_MODE="AGPL-3.0-or-later"
|
||||
LICENSE_FILE="LICENSE-AGPL"
|
||||
else
|
||||
LICENSE_MODE="GPL-3.0-or-later"
|
||||
LICENSE_FILE="LICENSE-GPL"
|
||||
fi
|
||||
|
||||
if [[ ! "$CRATE_NAME" =~ ^[a-z0-9_]+$ ]]; then
|
||||
echo "Error: Crate name must be lowercase and contain only alphanumeric characters and underscores"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CRATE_PATH="crates/$CRATE_NAME"
|
||||
mkdir -p "$CRATE_PATH/src"
|
||||
|
||||
# Symlink the license
|
||||
ln -sf "../../$LICENSE_FILE" "$CRATE_PATH/$LICENSE_FILE"
|
||||
|
||||
CARGO_TOML_TEMPLATE=$(cat << 'EOF'
|
||||
[package]
|
||||
name = "$CRATE_NAME"
|
||||
version = "0.1.0"
|
||||
edition.workspace = true
|
||||
publish.workspace = true
|
||||
license = "$LICENSE_MODE"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[lib]
|
||||
path = "src/$CRATE_NAME.rs"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
gpui.workspace = true
|
||||
ui.workspace = true
|
||||
util.workspace = true
|
||||
|
||||
# Uncomment other workspace dependencies as needed
|
||||
# assistant.workspace = true
|
||||
# client.workspace = true
|
||||
# project.workspace = true
|
||||
# settings.workspace = true
|
||||
EOF
|
||||
)
|
||||
|
||||
# Populate template
|
||||
CARGO_TOML_CONTENT=$(echo "$CARGO_TOML_TEMPLATE" | sed \
|
||||
-e "s/\$CRATE_NAME/$CRATE_NAME/g" \
|
||||
-e "s/\$LICENSE_MODE/$LICENSE_MODE/g")
|
||||
|
||||
echo "$CARGO_TOML_CONTENT" > "$CRATE_PATH/Cargo.toml"
|
||||
|
||||
echo "//! # $CRATE_NAME" > "$CRATE_PATH/src/$CRATE_NAME.rs"
|
||||
|
||||
echo "Created new crate: $CRATE_NAME in $CRATE_PATH"
|
||||
echo "License: $LICENSE_MODE (symlinked from $LICENSE_FILE)"
|
||||
echo "Don't forget to add the new crate to the workspace!"
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
PRETTIER_VERSION=3.5.0
|
||||
|
||||
pnpm dlx "prettier@${PRETTIER_VERSION}" assets/settings/default.json --parser=jsonc --check || {
|
||||
echo "To fix, run from the root of the Zed repo:"
|
||||
echo " pnpm dlx prettier@${PRETTIER_VERSION} assets/settings/default.json --parser=jsonc --write"
|
||||
false
|
||||
}
|
||||
|
||||
cd docs
|
||||
pnpm dlx "prettier@${PRETTIER_VERSION}" . --check || {
|
||||
echo "To fix, run from the root of the Zed repo:"
|
||||
echo " cd docs && pnpm dlx prettier@${PRETTIER_VERSION} . --write && cd .."
|
||||
false
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
mode=${1:-error}
|
||||
[[ "$mode" =~ ^(error|warning)$ ]] || { echo "Usage: $0 [error|warning]"; exit 1; }
|
||||
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
|
||||
find script -maxdepth 1 -type f -print0 |
|
||||
xargs -0 grep -l -E '^#!(/bin/|/usr/bin/env )(sh|bash|dash)' |
|
||||
xargs -r shellcheck -x -S "$mode" -C
|
||||
Reference in New Issue
Block a user