Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/zed-intergration/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zed/
26 changes: 26 additions & 0 deletions scripts/zed-intergration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Intro
We use a patched version of zed to help with the data edition in the monorepo that mega managing.

# How to use
Currently, the script for patching and building zed is only used for helping making up the docker image.

However, you can still use the script or manually build the patched version of zed.

## With unix-shell environment

Simply execute the script and you shall get the target binary right in the:
```shell
# build the patched zed
./build.sh

# run zed
./zed/target/release/zed
```

## Without unix-shell environment

You can still follow the steps below to build:
- Clone zed
- Checkout to the specific version mentioned in `build.sh`
- Use the patches in `./patches/` with `git am xxx.patch`
- Run `cargo build -r` and enjoy:)
43 changes: 43 additions & 0 deletions scripts/zed-intergration/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/sh

# Clone zed and switch to the specific version
ZED_ROOT='./zed'
ZED_REPO='https://github.com/zed-industries/zed.git'
TARGET_PATCH_VERSION='04ee5e3e6e563fbcc6ea37f8733aaf6897428773'

# Place patch files here
PATCH_DIR='./patches/'

COUNTDOWN=10
export MEGA_ROOT="`pwd`/../.."

# Initialize or update zed repository
git clone ${ZED_REPO} ${ZED_ROOT}
cd ${ZED_ROOT}
git fetch

# Check & Cleanup
if ! git diff --quiet; then
count=1
echo "You have uncomitted changes, all the change will be resotred in $COUNTDOWN seconds!"
while [ $count -le $COUNTDOWN ]; do
sleep 1
echo "Restoring in $(( $COUNTDOWN - $count )), press Ctrl-C to exit..."
((count++))
done
git restore .
fi

# Patch
git checkout ${TARGET_PATCH_VERSION}
for patch in ../patches/*.patch; do
echo "Applying: $patch"
git am "$patch"
if [ $? -ne 0 ]; then
echo "Failed applying patch: $patch"
exit 1
fi
done

# Build
cargo build --release
Loading