fix rust_wasm_build (#1824)

This commit is contained in:
007gzs
2025-02-27 14:15:50 +08:00
committed by GitHub
parent 45fdd95a9c
commit 5bece9c8ef
5 changed files with 11 additions and 7 deletions

View File

@@ -133,6 +133,11 @@ jobs:
command=" command="
set -e set -e
cd /workspace/plugins/wasm-rust/extensions/${PLUGIN_NAME} cd /workspace/plugins/wasm-rust/extensions/${PLUGIN_NAME}
if [ -f ./.prebuild ]; then
echo 'Found .prebuild file, sourcing it...'
. ./.prebuild
fi
rustup target add wasm32-wasip1
cargo build --target wasm32-wasip1 --release cargo build --target wasm32-wasip1 --release
cp target/wasm32-wasip1/release/*.wasm plugin.wasm cp target/wasm32-wasip1/release/*.wasm plugin.wasm
tar czvf plugin.tar.gz plugin.wasm tar czvf plugin.tar.gz plugin.wasm

View File

@@ -3,10 +3,10 @@ WORKDIR /workspace
RUN rustup target add wasm32-wasip1 RUN rustup target add wasm32-wasip1
ARG PLUGIN_NAME="say-hello" ARG PLUGIN_NAME="say-hello"
ARG BUILD_OPTS="--release" ARG BUILD_OPTS="--release"
ARG BUILDRC=".buildrc" ARG PREBUILD=".prebuild"
COPY . . COPY . .
WORKDIR /workspace/extensions/$PLUGIN_NAME WORKDIR /workspace/extensions/$PLUGIN_NAME
RUN if [ -f $BUILDRC ]; then sh $BUILDRC; fi RUN if [ -f $PREBUILD ]; then sh $PREBUILD; fi
RUN cargo build --target wasm32-wasip1 $BUILD_OPTS \ RUN cargo build --target wasm32-wasip1 $BUILD_OPTS \
&& cp target/wasm32-wasip1/release/*.wasm /main.wasm && cp target/wasm32-wasip1/release/*.wasm /main.wasm

View File

@@ -1 +0,0 @@
apt update && apt-get install gcc gcc-multilib llvm clang -y && apt clean

View File

@@ -0,0 +1,3 @@
apt-get update
apt-get install gcc gcc-multilib llvm clang -y
apt-get clean

View File

@@ -108,10 +108,7 @@ impl EventStream {
} }
fn is_2eol(&self, i: usize) -> Option<usize> { fn is_2eol(&self, i: usize) -> Option<usize> {
let size1 = match self.is_eol(i) { let size1 = self.is_eol(i)?;
None => return None,
Some(size1) => size1,
};
if i + size1 < self.buffer.len() { if i + size1 < self.buffer.len() {
match self.is_eol(i + size1) { match self.is_eol(i + size1) {
None => { None => {