Skip to content

Commit 42a4245

Browse files
include async build in release (#89)
separate output files for async build update dependencies v0.0.12
1 parent ef94ffd commit 42a4245

File tree

17 files changed

+85
-71
lines changed

17 files changed

+85
-71
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ jobs:
3535
set -e
3636
npm run test
3737
npm run test-browser
38-
./preparepublishnpm.sh
39-
PACKAGEFILE=`npm pack | tail -n 1`
40-
tar -xvzf $PACKAGEFILE
41-
rm test-browser/lg2.*
42-
echo "run browser tests with npm package"
43-
cp package/lg2.* test-browser/
44-
npm run test-browser
4538
asyncify:
4639
name: Asyncify
4740
runs-on: ubuntu-latest

.github/workflows/publish.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,23 @@ jobs:
2626
source ./emsdk/emsdk_env.sh
2727
cd emscriptenbuild
2828
./build.sh Release
29+
./build.sh Release-async
2930
cd ..
3031
set -e
3132
npm run test
32-
npm run test-browser
3333
export VERSION=`npm view wasm-git dist-tags.latest`
3434
export NEWVERSION=`node -p "require('./package.json').version"`
3535
echo $VERSION $NEWVERSION
3636
./preparepublishnpm.sh
3737
PACKAGEFILE=`npm pack | tail -n 1`
3838
tar -xvzf $PACKAGEFILE
39-
rm test-browser/lg2.*
4039
echo "run browser tests with npm package"
41-
cp package/lg2.* test-browser/
40+
rm test-browser/lg2.*
41+
cp package/lg2.* test-browser/
4242
npm run test-browser
43+
rm test-browser-async/lg2_async.*
44+
cp package/lg2_async.* test-browser-async/
45+
npm run test-browser-async
4346
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
4447
if [[ "$VERSION" = "$NEWVERSION" || "$BRANCH" != "master" ]]; then
4548
echo "version change is $VERSION->$NEWVERSION, branch is $BRANCH, not publishing, only dry-run"

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project(wasm-git)
2+
cmake_minimum_required(VERSION 3.0)
3+
add_subdirectory(libgit2)
4+
set_target_properties(lg2 PROPERTIES OUTPUT_NAME $ENV{LG2_OUTPUT_NAME})

emscriptenbuild/build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ POST_JS="--post-js $(pwd)/post.js"
77
# Reset in case we've done an '-async' build
88
cp ../libgit2patchedfiles/src/transports/emscriptenhttp.c ../libgit2/src/libgit2/transports/emscriptenhttp.c
99

10+
export LG2_OUTPUT_NAME=lg2
11+
1012
# Set build type to Release for release
1113
if [ "$1" == "Release" ]; then
1214
BUILD_TYPE=Release
@@ -20,16 +22,18 @@ if [ "$1" == "Release-async" ]; then
2022

2123
EXTRA_CMAKE_C_FLAGS="-O3 $ASYNCIFY_FLAGS"
2224
POST_JS="--post-js $(pwd)/post-async.js"
25+
export LG2_OUTPUT_NAME=lg2_async
2326
elif [ "$1" == "Debug-async" ]; then
2427
BUILD_TYPE=Debug
2528
cp ../libgit2patchedfiles/src/transports/emscriptenhttp-async.c ../libgit2/src/libgit2/transports/emscriptenhttp.c
2629

2730
EXTRA_CMAKE_C_FLAGS="$ASYNCIFY_FLAGS"
2831
POST_JS="--post-js $(pwd)/post-async.js"
32+
export LG2_OUTPUT_NAME=lg2_async
2933
fi
3034

3135
# Before building, remove any ../libgit2/src/transports/emscriptenhttp.c left from running setup.sh
3236
[ -f "../libgit2/src/libgit2/transports/emscriptenhttp-async.c" ] && rm ../libgit2/src/libgit2/transports/emscriptenhttp-async.c
3337

34-
emcmake cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_FLAGS="$EXTRA_CMAKE_C_FLAGS --pre-js $(pwd)/pre.js $POST_JS -s \"EXTRA_EXPORTED_RUNTIME_METHODS=['FS','callMain']\" -lnodefs.js -lidbfs.js -s INVOKE_RUN=0 -s ALLOW_MEMORY_GROWTH=1 -s STACK_SIZE=131072" -DREGEX_BACKEND=regcomp -DSONAME=OFF -DUSE_HTTPS=OFF -DBUILD_SHARED_LIBS=OFF -DTHREADSAFE=OFF -DUSE_SSH=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=ON ../libgit2
38+
emcmake cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_FLAGS="$EXTRA_CMAKE_C_FLAGS --pre-js $(pwd)/pre.js $POST_JS -s \"EXTRA_EXPORTED_RUNTIME_METHODS=['FS','callMain']\" -lnodefs.js -lidbfs.js -s INVOKE_RUN=0 -s ALLOW_MEMORY_GROWTH=1 -s STACK_SIZE=131072" -DREGEX_BACKEND=regcomp -DSONAME=OFF -DUSE_HTTPS=OFF -DBUILD_SHARED_LIBS=OFF -DTHREADSAFE=OFF -DUSE_SSH=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=ON ..
3539
emmake make lg2

karma.conf-async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(config) {
1616

1717
// list of files / patterns to load in the browser
1818
files: [
19-
{pattern: 'lg2.*', included: false},
19+
{pattern: 'lg2_async.*', included: false},
2020
// {pattern: 'async-test.js', included: false},
2121
{pattern: '**/*.spec.js'}
2222
],

package-lock.json

Lines changed: 53 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wasm-git",
3-
"version": "0.0.11",
3+
"version": "0.0.12",
44
"author": {
55
"name": "Peter Salomonsen",
66
"url": "https://petersalomonsen.com"
@@ -11,6 +11,8 @@
1111
"files": [
1212
"lg2.js",
1313
"lg2.wasm",
14+
"lg2_async.js",
15+
"lg2_async.wasm",
1416
"README.md"
1517
],
1618
"scripts": {
@@ -22,8 +24,8 @@
2224
},
2325
"devDependencies": {
2426
"cgi": "^0.3.1",
25-
"chai": "^4.3.7",
26-
"karma": "^6.4.1",
27+
"chai": "^4.3.10",
28+
"karma": "^6.4.2",
2729
"karma-chai": "^0.1.0",
2830
"karma-chrome-launcher": "^3.2.0",
2931
"karma-mocha": "^2.0.1",

preparepublishnpm.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/bash
22
set -e
33
echo "copy lg2.wasm and lg2.js from build folder"
4-
cp emscriptenbuild/examples/lg2.wasm .
5-
cp emscriptenbuild/examples/lg2.js .
4+
cp emscriptenbuild/libgit2/examples/lg2.wasm .
5+
cp emscriptenbuild/libgit2/examples/lg2.js .
6+
cp emscriptenbuild/libgit2/examples/lg2_async.wasm .
7+
cp emscriptenbuild/libgit2/examples/lg2_async.js .
68
echo "publish --dry-run (run npm publish to finalize)"
79
npm publish --dry-run

test-browser-async/lg2.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test-browser-async/lg2.wasm

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)