Skip to content

Commit

Permalink
add local rebuild support
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Jun 13, 2024
1 parent 2ff40eb commit a5f9e4c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 19 deletions.
40 changes: 33 additions & 7 deletions cibuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,29 +182,42 @@ fi
# TODO: check if some versionned *.sql files can be omitted
# TODO: for bigger extensions than pgvector make separate packaging.

# include current pglite source for easy local rebuild with just npm run build:js.

if echo "$*"|grep "node"
then
echo "================================================="
mkdir -p /tmp/sdk/packages/
cp -r packages/pglite /tmp/sdk/packages/
cp -vf /tmp/web/repl/postgres.{js,data,wasm} $PGLITE/release/
cp -vf /tmp/web/repl/libecpg.so $PGLITE/release/postgres.so
mkdir -p /tmp/sdk/

# remove versionned symlinks
rm ${PGROOT}/lib/lib*.so.? 2>/dev/null
if $CI
then
tar -cpRz ${PGROOT} > /tmp/sdk/pg.tar.gz
tar -cpR ${PGROOT} > /tmp/sdk/pg.tar
fi
fi

# run linkweb after node build because it will remove some wasm .so used by node from fs
# they don't need to be in MEMFS as they are fetched.


# include current pglite source for easy local rebuild with just npm run build:js.


if echo "$*"|grep "linkweb"
then
echo "================================================="
if [ -d pglite ]
then
# work tree
pushd pglite/packages/pglite
PGLITE=$(pwd)
else
# release tree
pushd packages/pglite
PGLITE=$(pwd)
fi
popd

export PGLITE

# build web version
pushd build/postgres
Expand All @@ -218,8 +231,21 @@ then
cp -r $WEBROOT/* /tmp/web/
fi
popd

# copy neeeded files for a minimal js/ts/extension build
# these don't use NODE FS !!!

mkdir -p ${PGROOT}/sdk/packages/
cp -r $PGLITE ${PGROOT}/sdk/packages/

if $CI
then
tar -cpR ${PGROOT} > /tmp/sdk/pg.tar
fi

fi

[ -f /tmp/sdk/pg.tar ] && gzip -9 /tmp/sdk/pg.tar

# pglite also use web build files, so make it last.

Expand Down
4 changes: 2 additions & 2 deletions cibuild/linkweb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ mkdir -p ${WEBROOT}/repl
</html>" > index.html

mv index.html ${WEBROOT}/
mv -v postgres.* ${WEBROOT}/repl/
mv ${PGROOT}/lib/libecpg.so ${WEBROOT}/repl/
cp -v postgres.* ${WEBROOT}/repl/
cp ${PGROOT}/lib/libecpg.so ${WEBROOT}/repl/


cp $GITHUB_WORKSPACE/tests/vtx.js ${WEBROOT}/repl/
Expand Down
21 changes: 11 additions & 10 deletions cibuild/pglite-ts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,17 @@ END
if $CI
then
npm run build:js
npm pack
mv electric-sql-pglite-*.tgz /tmp/sdk/
mkdir -p ${WEBROOT}/node_modules/@electric-sql/pglite
echo "------------------------------"
#find ${PGLITE}/dist/
echo "------------------------------"
cp -r ${PGLITE}/{../../LICENSE,package.json,README.md} ${PGLITE}/dist ${WEBROOT}/node_modules/@electric-sql/pglite/
pushd ${WEBROOT}
zip /tmp/sdk/pglite.zip -q -r node_modules
popd
if $CI
then
npm pack
mv electric-sql-pglite-*.tgz /tmp/sdk/
else
mkdir -p ${WEBROOT}/node_modules/@electric-sql/pglite
cp -r ${PGLITE}/{../../LICENSE,package.json,README.md} ${PGLITE}/dist ${WEBROOT}/node_modules/@electric-sql/pglite/
pushd ${WEBROOT}
zip /tmp/sdk/pglite.zip -q -r node_modules
popd
fi
fi

popd
Expand Down

0 comments on commit a5f9e4c

Please sign in to comment.